CombinedText stringlengths 4 3.42M |
|---|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <denkpadje@gmail.com>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package Orka.SIMD.AVX.Singles is
pragma Pure;
type Index_Double_Homogeneous is range 1 .. 8;
type m256 is array (Index_Double_Homogeneous) of Float_32
with Alignment => 32;
pragma Machine_Attribute (m256, "vector_type");
end Orka.SIMD.AVX.Singles;
|
with GL.Objects.Programs;
with Multivector_Analyze;
with Multivectors;
with Palet;
package C3GA_Draw is
procedure Draw (Render_Program : GL.Objects.Programs.Program;
MV : Multivectors.Multivector;
Palet_Type : Palet.Colour_Palet := Palet.Is_Null);
-- Method : GA_Draw.Method_Type :=
-- GA_Draw.Draw_Method_Undefined);
procedure Draw_Point (Render_Program : GL.Objects.Programs.Program;
Analysis : Multivector_Analyze.MV_Analysis;
Palet_Type : Palet.Colour_Palet := Palet.Is_Null);
end C3GA_Draw;
|
-- Standard Ada library specification
-- Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com>
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
with Ada.Finalization;
with System.Storage_Elements;
package System.Storage_Pools is
pragma Preelaborate (System.Storage_Pools);
type Root_Storage_Pool is
abstract new Ada.Finalization.Limited_Controlled with private;
pragma Preelaborable_Initialization (Root_Storage_Pool);
procedure Allocate
(Pool : in out Root_Storage_Pool;
Storage_Address : out Address;
Size_In_Storage_Elements : in Storage_Elements.Storage_Count;
Alignment : in Storage_Elements.Storage_Count)
is abstract;
procedure Deallocate
(Pool : in out Root_Storage_Pool;
Storage_Address : in Address;
Size_In_Storage_Elements : in Storage_Elements.Storage_Count;
Alignment : in Storage_Elements.Storage_Count)
is abstract;
function Storage_Size
(Pool : Root_Storage_Pool)
return Storage_Elements.Storage_Count
is abstract;
private
pragma Import (Ada, Root_Storage_Pool);
end System.Storage_Pools;
|
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired)
--
-- Copyright William A. Whitaker (1936–2010)
--
-- This is a free program, which means it is proper to copy it and pass
-- it on to your friends. Consider it a developmental item for which
-- there is no charge. However, just for form, it is Copyrighted
-- (c). Permission is hereby freely given for any and all use of program
-- and data. You can sell it as your own, but at least tell me.
--
-- This version is distributed without obligation, but the developer
-- would appreciate comments and suggestions.
--
-- All parts of the WORDS system, source code and data files, are made freely
-- available to anyone who wishes to use them, for whatever purpose.
with Text_IO;
with Latin_Utils.Strings_Package; use Latin_Utils.Strings_Package;
-- with Latin_Utils.Latin_File_Names; use Latin_Utils.Latin_File_Names;
with Latin_Utils.Inflections_Package; use Latin_Utils.Inflections_Package;
with Latin_Utils.Dictionary_Package; use Latin_Utils.Dictionary_Package;
-- with line_stuff; use line_stuff;
-- with dictionary_form;
procedure Uniqpage is
-- package Integer_IO is new Text_IO.Integer_IO (Integer);
use Text_IO;
use Dictionary_Entry_IO;
use Part_Entry_IO;
use Kind_Entry_IO;
use Translation_Record_IO;
use Age_Type_IO;
use Area_Type_IO;
use Geo_Type_IO;
use Frequency_Type_IO;
use Source_Type_IO;
Uniques_File, Uniqpage : Text_IO.File_Type;
S : constant String (1 .. 400) := (others => ' ');
Line : String (1 .. 400) := (others => ' ');
Blanks : constant String (1 .. 400) := (others => ' ');
L, Last : Integer := 0;
Stem : Stem_Type := Null_Stem_Type;
Qual : Quality_Record;
Kind : Kind_Entry;
Tran : Translation_Record;
Mean : Meaning_Type;
procedure Get_Line_Unique
(Input : in Text_IO.File_Type;
S : out String;
Last : out Natural)
is
begin
Last := 0;
Text_IO.Get_Line (Input, S, Last);
-- FIXME: this if statement was commented out, because it triggered
-- warning "if statement has no effect". I didn't delete it because quite
-- possibly author wanted it to do something. Question is what?
--if Trim (s (s'First .. last)) /= "" then -- Rejecting blank lines
-- null;
--end if;
end Get_Line_Unique;
begin
Put_Line ("UNIQUES.LAT -> UNIQPAGE.PG");
Put_Line ("Takes UNIQUES form, single lines it, puts # at beginning,");
Put_Line ("producing a .PG file for sorting to produce paper dictionary");
Create (Uniqpage, Out_File, "UNIQPAGE.PG");
Open (Uniques_File, In_File, "UNIQUES.LAT");
Over_Lines :
while not End_Of_File (Uniques_File) loop
Line := Blanks;
Get_Line_Unique (Uniques_File, Line, Last); -- STEM
Stem := Head (Trim (Line (1 .. Last)), Max_Stem_Size);
Line := Blanks;
Get_Line_Unique (Uniques_File, Line, Last); -- QUAL, KIND, TRAN
Quality_Record_IO.Get (Line (1 .. Last), Qual, L);
Get (Line (L + 1 .. Last), Qual.Pofs, Kind, L);
Age_Type_IO.Get (Line (L + 1 .. Last), Tran.Age, L);
Area_Type_IO.Get (Line (L + 1 .. Last), Tran.Area, L);
Geo_Type_IO.Get (Line (L + 1 .. Last), Tran.Geo, L);
Frequency_Type_IO.Get (Line (L + 1 .. Last), Tran.Freq, L);
Source_Type_IO.Get (Line (L + 1 .. Last), Tran.Source, L);
Line := Blanks;
Get_Line_Unique (Uniques_File, Line, L); -- MEAN
Mean := Head (Trim (Line (1 .. L)), Max_Meaning_Size);
-- while not END_OF_FILE (UNIQUES_FILE) loop
-- S := BLANK_LINE;
-- GET_LINE (INPUT, S, LAST);
-- if TRIM (S (1 .. LAST)) /= "" then -- Rejecting blank lines
--
--
Text_IO.Put (Uniqpage, "#" & Stem);
Quality_Record_IO.Put (Uniqpage, Qual);
-- PART := (V, (QUAL.V.CON, KIND.V_KIND));
if (Qual.Pofs = V) and then (Kind.V_Kind in Gen .. Perfdef) then
Text_IO.Put (Uniqpage, " " &
Verb_Kind_Type'Image (Kind.V_Kind) & " ");
end if;
Text_IO.Put (Uniqpage, " [");
Age_Type_IO.Put (Uniqpage, Tran.Age);
Area_Type_IO.Put (Uniqpage, Tran.Area);
Geo_Type_IO.Put (Uniqpage, Tran.Geo);
Frequency_Type_IO.Put (Uniqpage, Tran.Freq);
Source_Type_IO.Put (Uniqpage, Tran.Source);
Text_IO.Put (Uniqpage, "]");
Put (Uniqpage, " :: ");
Put_Line (Uniqpage, Mean);
--end if; -- Rejecting blank lines
end loop Over_Lines;
Close (Uniqpage);
exception
when Text_IO.Data_Error =>
null;
when others =>
Put_Line (S (1 .. Last));
Close (Uniqpage);
end Uniqpage;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . N U M E R I C S . A U X --
-- --
-- S p e c --
-- (Apple OS X Version) --
-- --
-- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This version is for use on OS X. It uses the normal Unix math functions,
-- except for sine/cosine which have been implemented directly in Ada to get
-- the required accuracy.
package Ada.Numerics.Aux is
pragma Pure;
pragma Linker_Options ("-lm");
type Double is digits 15;
-- Type Double is the type used to call the C routines
-- The following functions have been implemented in Ada, since
-- the OS X math library didn't meet accuracy requirements for
-- argument reduction. The implementation here has been tailored
-- to match Ada strict mode Numerics requirements while maintaining
-- maximum efficiency.
function Sin (X : Double) return Double;
pragma Inline (Sin);
function Cos (X : Double) return Double;
pragma Inline (Cos);
-- We import these functions directly from C. Note that we label them
-- all as pure functions, because indeed all of them are in fact pure.
function Tan (X : Double) return Double;
pragma Import (C, Tan, "tan");
pragma Pure_Function (Tan);
function Exp (X : Double) return Double;
pragma Import (C, Exp, "exp");
pragma Pure_Function (Exp);
function Sqrt (X : Double) return Double;
pragma Import (C, Sqrt, "sqrt");
pragma Pure_Function (Sqrt);
function Log (X : Double) return Double;
pragma Import (C, Log, "log");
pragma Pure_Function (Log);
function Acos (X : Double) return Double;
pragma Import (C, Acos, "acos");
pragma Pure_Function (Acos);
function Asin (X : Double) return Double;
pragma Import (C, Asin, "asin");
pragma Pure_Function (Asin);
function Atan (X : Double) return Double;
pragma Import (C, Atan, "atan");
pragma Pure_Function (Atan);
function Sinh (X : Double) return Double;
pragma Import (C, Sinh, "sinh");
pragma Pure_Function (Sinh);
function Cosh (X : Double) return Double;
pragma Import (C, Cosh, "cosh");
pragma Pure_Function (Cosh);
function Tanh (X : Double) return Double;
pragma Import (C, Tanh, "tanh");
pragma Pure_Function (Tanh);
function Pow (X, Y : Double) return Double;
pragma Import (C, Pow, "pow");
pragma Pure_Function (Pow);
end Ada.Numerics.Aux;
|
------------------------------------------------------------------------------
-- --
-- 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-2015, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with System; use type System.Address;
package body Ada.Containers.Doubly_Linked_Lists 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 := null;
Container.Last := null;
Container.Length := 0;
Zero_Counts (Container.TC);
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 := 1)
is
begin
Insert (Container, No_Element, New_Item, Count);
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;
pragma Warnings (Off);
Free (X);
pragma Warnings (On);
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
Lock (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
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;
TC_Check (Container.TC);
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
-- 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;
TC_Check (Target.TC);
TC_Check (Source.TC);
-- 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
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;
TC_Check (Container.TC);
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
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;
TC_Check (Container.TC);
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
Lock (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;
----------
-- 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
Lock (TC.all);
end return;
end;
end Reference;
---------------------
-- Replace_Element --
---------------------
procedure Replace_Element
(Container : in out List;
Position : Cursor;
New_Item : Element_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;
TE_Check (Container.TC);
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
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;
TC_Check (Target.TC);
TC_Check (Source.TC);
Splice_Internal (Target, Before.Node, Source);
end Splice;
procedure Splice
(Container : in out List;
Before : Cursor;
Position : Cursor)
is
begin
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);
TC_Check (Container.TC);
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;
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;
TC_Check (Target.TC);
TC_Check (Source.TC);
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
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;
TE_Check (Container.TC);
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
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;
TC_Check (Container.TC);
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>
--
-- 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 System;
-- ****h* Tcl/Tcl
-- FUNCTION
-- Provides binding to Tcl API
-- SOURCE
package Tcl is
-- ****
--## rule off REDUCEABLE_SCOPE
-- ****t* Tcl/Tcl.Tcl_Interpreter
-- FUNCTION
-- Pointer to the selected Tcl interpreter
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
type Tcl_Interpreter is new System.Address;
-- ****
-- ****d* Tcl/Tcl.Null_Interpreter
-- FUNCTION
-- Not set Tcl interterpreter
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
Null_Interpreter: constant Tcl_Interpreter :=
Tcl_Interpreter(System.Null_Address);
-- ****
--------------------------------
-- Initialization of Tcl binding
--------------------------------
-- ****f* Tcl/Tcl.Create_Interpreter
-- FUNCTION
-- Create a new Tcl interpreter
-- RESULT
-- Pointer to the newly created Tcl interpreter
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Create a new Tcl interpreter
-- My_Interpreter: constant Tcl_Interpreter := Create_Interpreter;
-- SOURCE
function Create_Interpreter return Tcl_Interpreter with
Global => null,
Import,
Convention => C,
External_Name => "Tcl_CreateInterp";
-- ****
--## rule off REDUCEABLE_SCOPE
-- ****f* Tcl/Set_Interpreter
-- FUNCTION
-- Set the default Tcl interpreter to the selected interpreter
-- PARAMETERS
-- Interpreter - The Tcl interpreter which will be set as default. If
-- is Null_Interpreter. The dafault interpreter will remain
-- unchanged
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Set My_Interpreter as the default Tcl interpreter
-- Set_Interpreter(My_Interpreter);
-- SOURCE
procedure Set_Interpreter(Interpreter: Tcl_Interpreter) with
Pre => Interpreter /= Null_Interpreter;
-- ****
-- ****f* Tcl/Tcl.Get_Interpreter
-- FUNCTION
-- Get the default Tcl interpreter
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get the default Tcl interpreter
-- My_Interpreter: constant Tcl_Interpreter := Get_Interpreter;
-- SOURCE
function Get_Interpreter return Tcl_Interpreter;
-- ****
-- ****f* Tcl/Tcl.Tcl_Init
-- FUNCTION
-- Initialize Tcl
-- PARAMETERS
-- Interpreter - Tcl interpreter to initialize
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Initialize Tcl on the new Tcl interpreter
-- Is_Initialized: constant Boolean := Tcl_Init(Create_Interpreter);
-- SOURCE
function Tcl_Init(Interpreter: Tcl_Interpreter) return Boolean with
Pre => Interpreter /= Null_Interpreter;
-- ****
-------------------------
-- Evaluation of Tcl code
-------------------------
--## rule off TYPE_INITIAL_VALUES
-- ****t* Tcl/Tcl.Tcl_Results
-- FUNCTION
-- Used as return Tcl result for commands
-- OPTIONS
-- TCL_OK - Used when a command finished successfuly. Standard result
-- TCL_ERROR - Used when a command meet a problem
-- TCL_RETURN - Used when a command want to emulate Tcl command return
-- TCL_BREAK - Used when a command want to emulate Tcl command break
-- TCL_CONTINUE - Used when a command want to emulate Tcl command continue
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
type Tcl_Results is
(TCL_OK, TCL_ERROR, TCL_RETURN, TCL_BREAK, TCL_CONTINUE) with
Default_Value => TCL_OK;
-- ****
--## rule off TYPE_INITIAL_VALUES
-- ****t* Tcl/Tcl.Tcl_Boolean_Result
-- FUNCTION
-- Used to store result of evaluation of Tcl command
-- PARAMETERS
-- Message_Length - The length of the error message returned by Tcl
-- command. By most time it should be 0
-- Return_Code - The Tcl_Result returned by the Tcl command
-- Message - If Return_Code is Tcl_Error it contains message
-- returned by the Tcl command
-- Result - The result of the Tcl command
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
type Tcl_Boolean_Result(Message_Length: Natural) is record
Return_Code: Tcl_Results;
Message: String(1 .. Message_Length);
Result: Boolean;
end record;
-- ****
-- ****t* Tcl/Tcl.Tcl_String_Result
-- FUNCTION
-- Used to store result of evaluation of Tcl command
-- PARAMETERS
-- Message_Length - The length of the error message returned by Tcl
-- command. By most time it should be 0
-- Result_Length - The length of the result string returned by Tcl
-- command
-- Return_Code - The Tcl_Result returned by the Tcl command
-- Message - If Return_Code is Tcl_Error it contains message
-- returned by the Tcl command
-- Result - The result of the Tcl command
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
type Tcl_String_Result(Message_Length, Result_Length: Natural) is record
Return_Code: Tcl_Results;
Message: String(1 .. Message_Length);
Result: String(1 .. Result_Length);
end record;
-- ****
-- ****t* Tcl/Tcl.Tcl_Integer_Result
-- FUNCTION
-- Used to store result of evaluation of Tcl command
-- PARAMETERS
-- Message_Length - The length of the error message returned by Tcl
-- command. By most time it should be 0
-- Return_Code - The Tcl_Result returned by the Tcl command
-- Message - If Return_Code is Tcl_Error it contains message
-- returned by the Tcl command
-- Result - The result of the Tcl command
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
type Tcl_Integer_Result(Message_Length: Natural) is record
Return_Code: Tcl_Results;
Message: String(1 .. Message_Length);
Result: Integer;
end record;
-- ****
-- ****t* Tcl/Tcl.Tcl_Float_Result
-- FUNCTION
-- Used to store result of evaluation of Tcl command
-- PARAMETERS
-- Message_Length - The length of the error message returned by Tcl
-- command. By most time it should be 0
-- Return_Code - The Tcl_Result returned by the Tcl command
-- Message - If Return_Code is Tcl_Error it contains message
-- returned by the Tcl command
-- Result - The result of the Tcl command
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
type Tcl_Float_Result(Message_Length: Natural) is record
Return_Code: Tcl_Results;
Message: String(1 .. Message_Length);
Result: Float;
end record;
-- ****
-- ****f* Tcl/Tcl.Tcl_Eval_(procedure)
-- FUNCTION
-- Evaluate the selected Tcl script on the selected Tcl intepreter
-- PARAMETERS
-- Tcl_Script - Tcl script to evaluate
-- Interpreter - Tcl interpreter on which the script will be evaluated.
-- By default it is current default Tcl interpreter
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Print hello world on default Tcl interpreter
-- Tcl_Eval("puts {hello world}");
-- SEE ALSO
-- Tcl.Tcl_Eval_(function)
-- SOURCE
procedure Tcl_Eval
(Tcl_Script: String; Interpreter: Tcl_Interpreter := Get_Interpreter) with
Pre => Tcl_Script'Length > 0 and Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Tcl_Eval", Mode => Nominal);
-- ****
-- ****f* Tcl/Tcl.Tcl_Eval_(function_string_result)
-- FUNCTION
-- Evaluate the selected Tcl script on the selected Tcl intepreter and
-- return its result as String
-- PARAMETERS
-- Tcl_Script - Tcl script to evaluate
-- Interpreter - Tcl interpreter on which the script will be evaluated.
-- By default it is current default Tcl interpreter
-- RESULT
-- Tcl_String_Result with the result of the evaluation of Tcl_Script
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get result of expresion on default Tcl interpreter
-- Result: constant Tcl_String_Result := Tcl_Eval("expr 2 + 2");
-- SEE ALSO
-- Tcl.Tcl_Eval_(procedure), Tcl.Tcl_Eval(function_boolean_result),
-- Tcl.Tcl_Eval(function_integer_result), Tcl.Tcl_Eval(function_float_result)
-- SOURCE
function Tcl_Eval
(Tcl_Script: String; Interpreter: Tcl_Interpreter := Get_Interpreter)
return Tcl_String_Result with
Pre => Tcl_Script'Length > 0 and Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Tcl_Eval2", Mode => Nominal);
-- ****
-- ****f* Tcl/Tcl.Tcl_Eval_(function_boolean_result)
-- FUNCTION
-- Evaluate the selected Tcl script on the selected Tcl intepreter and
-- return its result as Tcl_Boolean_Result
-- PARAMETERS
-- Tcl_Script - Tcl script to evaluate
-- Interpreter - Tcl interpreter on which the script will be evaluated.
-- By default it is current default Tcl interpreter
-- RESULT
-- Tcl_Boolean_Result record with the result of the evaluation of Tcl_Script
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get result of Tcl command on default Tcl interpreter
-- Result: constant Tcl_Boolean_Result := Tcl_Eval("info exists myvar");
-- SEE ALSO
-- Tcl.Tcl_Eval_(procedure), Tcl.Tcl_Eval(function_string_result),
-- Tcl.Tcl_Eval(function_integer_result), Tcl.Tcl_Eval(function_float_result)
-- SOURCE
function Tcl_Eval
(Tcl_Script: String; Interpreter: Tcl_Interpreter := Get_Interpreter)
return Tcl_Boolean_Result with
Pre => Tcl_Script'Length > 0 and Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Tcl_Eval3", Mode => Nominal);
-- ****
-- ****f* Tcl/Tcl.Tcl_Eval_(function_integer_result)
-- FUNCTION
-- Evaluate the selected Tcl script on the selected Tcl intepreter and
-- return its result as Tcl_Integer_Result
-- PARAMETERS
-- Tcl_Script - Tcl script to evaluate
-- Interpreter - Tcl interpreter on which the script will be evaluated.
-- By default it is current default Tcl interpreter
-- RESULT
-- Tcl_Boolean_Result record with the result of the evaluation of Tcl_Script
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get result of Tcl command on default Tcl interpreter
-- Result: constant Tcl_Integer_Result := Tcl_Eval("expr 2 + 2");
-- SEE ALSO
-- Tcl.Tcl_Eval_(procedure), Tcl.Tcl_Eval(function_string_result),
-- Tcl.Tcl_Eval(function_boolean_result), Tcl.Tcl_Eval(function_float_result)
-- SOURCE
function Tcl_Eval
(Tcl_Script: String; Interpreter: Tcl_Interpreter := Get_Interpreter)
return Tcl_Integer_Result with
Pre => Tcl_Script'Length > 0 and Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Tcl_Eval4", Mode => Nominal);
-- ****
-- ****f* Tcl/Tcl.Tcl_Eval_(function_float_result)
-- FUNCTION
-- Evaluate the selected Tcl script on the selected Tcl intepreter and
-- return its result as Tcl_Float_Result
-- PARAMETERS
-- Tcl_Script - Tcl script to evaluate
-- Interpreter - Tcl interpreter on which the script will be evaluated.
-- By default it is current default Tcl interpreter
-- RESULT
-- Tcl_Boolean_Result record with the result of the evaluation of Tcl_Script
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get result of Tcl command on default Tcl interpreter
-- Result: constant Tcl_Float_Result := Tcl_Eval("expr 2.5 + 2.2");
-- SEE ALSO
-- Tcl.Tcl_Eval_(procedure), Tcl.Tcl_Eval(function_string_result),
-- Tcl.Tcl_Eval(function_boolean_result), Tcl.Tcl_Eval(function_integer_result)
-- SOURCE
function Tcl_Eval
(Tcl_Script: String; Interpreter: Tcl_Interpreter := Get_Interpreter)
return Tcl_Float_Result with
Pre => Tcl_Script'Length > 0 and Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Tcl_Eval5", Mode => Nominal);
-- ****
-- ****f* Tcl/Tcl.Tcl_Eval_File
-- FUNCTION
-- Evaluate the selected file as Tcl script on the selected Tcl intepreter
-- PARAMETERS
-- File_Name - The path (absolute or relative) to the file which will
-- be evaluated
-- Interpreter - Tcl interpreter on which the file will be evaluated.
-- By default it is current default Tcl interpreter
-- RESULT
-- Tcl_Result of evaluation of the selected file
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Evaluate file myscript.tcl on the default Tcl interpreter
-- if Tcl_Eval_File("myscript.tcl") = TCL_ERROR then
-- Ada.Text_IO.Put_Line("failed to evaluate myscript.tcl file.");
-- end if;
-- SEE ALSO
-- Tcl.Tcl_Eval_(function)
-- SOURCE
function Tcl_Eval_File
(File_Name: String; Interpreter: Tcl_Interpreter := Get_Interpreter)
return Tcl_Results with
Pre => File_Name'Length > 0 and Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Tcl_Eval_File", Mode => Nominal);
-- ****
---------------------------------------
-- Manipulating the Tcl commands result
---------------------------------------
-- ****t* Tcl/Tcl.Result_Types
-- FUNCTION
-- Type of the Tcl commands result
-- OPTIONS
-- TCL_STATIC - The result string will not be changed by the code
-- TCL_VOLATILE - The result string is volatile
-- TCL_DYNAMIC - The result string will be changed by the code
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
type Result_Types is (TCL_STATIC, TCL_VOLATILE, TCL_DYNAMIC) with
Default_Value => TCL_STATIC;
for Result_Types use (TCL_STATIC => 0, TCL_VOLATILE => 1, TCL_DYNAMIC => 3);
-- ****
-- ****d* Tcl/Default_Result_Type
-- FUNCTION
-- The default type of Tcl result
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
Default_Result_Type: constant Result_Types := TCL_STATIC;
-- ****
-- ****f* Tcl/Tcl.Tcl_Get_Result_(string)
-- FUNCTION
-- Get the result of last Tcl command as string
-- PARAMETERS
-- Interpreter - Tcl interpreter from which the result will be taken. By
-- default it is current default Tcl interpreter.
-- RESULT
-- String with the result of the last Tcl command
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Print the result of the last Tcl command on the default Tcl interpreter
-- Ada.Text_IO.Put_Line(Tcl_Get_Result);
-- SEE ALSO
-- Tcl.Tcl_Get_Result_(integer), Tcl.Tcl_Get_Result_(float)
-- SOURCE
function Tcl_Get_Result
(Interpreter: Tcl_Interpreter := Get_Interpreter) return String with
Pre => Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Tcl_GetResult", Mode => Nominal);
-- ****
-- ****f* Tcl/Tcl.Tcl_Get_Result_(integer)
-- FUNCTION
-- Get the result of last Tcl command as integer
-- PARAMETERS
-- Interpreter - Tcl interpreter from which the result will be taken. By
-- default it is current default Tcl interpreter.
-- RESULT
-- Integer value of the result of the last Tcl command, or 0 if no result
-- is set or result cannot be converted to Integer
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get the result of the last Tcl command on the default Tcl interpreter
-- My_Result: constant Integer := Tcl_Get_Result;
-- SEE ALSO
-- Tcl.Tcl_Get_Result_(string), Tcl.Tcl_Get_Result_(float)
-- SOURCE
function Tcl_Get_Result
(Interpreter: Tcl_Interpreter := Get_Interpreter) return Integer with
Pre => Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Tcl_GetResult2", Mode => Nominal);
-- ****
-- ****f* Tcl/Tcl.Tcl_Get_Result_(float)
-- FUNCTION
-- Get the result of last Tcl command as float
-- PARAMETERS
-- Interpreter - Tcl interpreter from which the result will be taken. By
-- default it is current default Tcl interpreter.
-- RESULT
-- Float value of the result of the last Tcl command
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get the result of the last Tcl command on the default Tcl interpreter
-- My_Result: constant Float := Tcl_Get_Result;
-- SEE ALSO
-- Tcl.Tcl_Get_Result_(string), Tcl.Tcl_Get_Result_(integer)
-- SOURCE
function Tcl_Get_Result
(Interpreter: Tcl_Interpreter := Get_Interpreter) return Float is
(Float'Value(Tcl_Get_Result(Interpreter => Interpreter))) with
Pre => Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Tcl_GetResult3", Mode => Nominal);
-- ****
-- ****f* Tcl/Tcl.Tcl_Set_Result
-- FUNCTION
-- Set Tcl result value
-- PARAMETERS
-- Tcl_Result - String which will be set as Tcl result
-- Result_Type - Type of the result. Can be only TCL_STATIC, TCL_VOLATILE
-- or TCL_DYNAMIC
-- Interpreter - Tcl interpreter on which the result will be set. By
-- default it is current default Tcl interpreter.
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Set the Tcl result on the default Tcl interpreter to OK as static result
-- Tcl_Set_Result("OK");
-- SOURCE
procedure Tcl_Set_Result
(Tcl_Result: String; Result_Type: Result_Types := Default_Result_Type;
Interpreter: Tcl_Interpreter := Get_Interpreter) with
Pre => Tcl_Result'Length > 0 and Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Tcl_SetResult", Mode => Nominal);
-- ****
-------------------
-- Various commands
-------------------
-- ****f* Tcl/Tcl.Tcl_Update
-- FUNCTION
-- Process pending Tcl events and idle callbacks
-- PARAMETERS
-- Interpreter - Tcl interpreter on which events will be processed
-- Idle_Tasks_Only - If true, process only idle events and callbacks, no
-- new errors or events are processed. Default value
-- is False: process everythings.
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Process all events and callbacks on the default Tcl interpreter
-- Tcl_Update;
-- SOURCE
procedure Tcl_Update
(Interpreter: Tcl_Interpreter := Get_Interpreter;
Idle_Tasks_Only: Boolean := False) with
Pre => Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Tcl_Update", Mode => Nominal);
-- ****
end Tcl;
|
-- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
-- Autogenerated by Generate, do not edit
package GL.API.Doubles is
pragma Preelaborate;
Vertex_Attrib1 : T1;
Vertex_Attrib2 : T2;
Vertex_Attrib2v : T3;
Vertex_Attrib3 : T4;
Vertex_Attrib3v : T5;
Vertex_Attrib4 : T6;
Vertex_Attrib4v : T7;
end GL.API.Doubles;
|
with
openGL.Texture,
openGL.Visual;
limited
with
openGL.Camera;
package openGL.Impostor
--
-- Contains a 2D image of another openGL visual.
--
is
type Counter is mod 2**32;
type pixel_Region is
record
X, Y : gl.glInt;
Width, Height : gl.glSizeI;
end record;
type Item is abstract tagged -- TODO: Make private.
record
Target : openGL.Visual.view;
Visual : openGL.Visual.view;
freshen_Count : Counter := 0;
freshen_count_update_trigger_Mod : Counter := 150;
size_update_trigger_Delta : gl.glSizeI := 2;
expand_X, expand_Y : Real := 0.03;
never_Updated : Boolean := True;
is_Valid : Boolean := True; -- True when rendered target has both width and height > 0.
-- (NB: Always true for simple impostors.)
-- Current state.
--
current_pixel_Region : pixel_Region;
current_Width_pixels,
current_Height_pixels : gl.glSizei;
current_copy_X_Offset,
current_copy_Y_Offset : gl.glInt := 0;
current_copy_X,
current_copy_Y : gl.glInt;
current_copy_Width,
current_copy_Height : gl.glSizeI;
target_camera_Distance : Real;
target_camera_Distance_less_frame_Count : Real;
-- Prior state.
--
prior_pixel_Region : pixel_Region := (X => 0, Y => 0, Width => gl.glSizeI'First, Height => gl.glSizeI'First);
prior_Width_pixels : gl.glSizei := 0;
prior_Height_pixels : gl.glSizei := 0;
prior_target_Rotation : Matrix_3x3 := Identity_3x3;
prior_target_Position : Vector_3 := (0.0, 0.0, 0.0);
prior_camera_Position : Vector_3 := (1.0, 1.0, 1.0);
is_Terrain : Boolean := False;
end record;
type View is access all Item'Class;
type Views is array (Positive range <>) of View;
---------
--- Forge
--
procedure destroy (Self : in out Item);
procedure free (Self : in out View);
--------------
--- Attributes
--
procedure set_Target (Self : in out Item; Target : in Visual.view);
function get_Target (Self : in Item) return Visual.view;
procedure Visual_is (Self : in out Item; Now : in Visual.view);
function Visual (Self : access Item) return Visual.view;
function current_Camera_look_at_Rotation (Self : in Item) return Matrix_3x3
is abstract;
function update_Required (Self : access Item; the_Camera : access Camera.item'Class) return Boolean
is abstract;
--
-- NB: Caches current pixel_Region as a side-effect.
function is_Valid (Self : in Item'Class) return Boolean;
--
-- True when rendered target has width and height greater than 0.
function never_Updated (Self : in Item'Class) return Boolean;
--
-- True when 'update' has never been called for the impostor.
function frame_Count_since_last_update (Self : in Item'Class) return Natural;
function target_camera_Distance (Self : in Item'Class) return Real;
--
-- Returns the distance from the camera to the target, when 'update_required' was last called.
-- Update trigger configuration.
--
procedure set_freshen_count_update_trigger_Mod (Self : in out Item; To : in Positive);
function get_freshen_count_update_trigger_Mod (Self : in Item) return Positive;
--
-- Periodic freshen trigger.
procedure set_size_update_trigger_Delta (Self : in out Item; To : in Positive);
function get_size_update_trigger_Delta (Self : in Item) return Positive;
--
-- Update due to change in size of targets pixel rectangle.
-- Base class subprograms
--
function is_Transparent (Self : in Item) return Boolean;
procedure set_Alpha (Self : in out Item; Alpha : in Real);
function face_Count (Self : in Item) return Natural;
procedure pre_update (Self : in out Item; the_Camera : access Camera.item'Class)
is abstract;
procedure update (Self : in out Item; the_Camera : access Camera.item'Class;
texture_Pool : in texture.Pool_view);
--
-- Renders the impostor to a cleared framebuffer and copies the image to the impostors texture.
procedure post_update (Self : in out Item; the_Camera : access Camera.item'Class)
is abstract;
private
function get_pixel_Region (Self : access Item'Class; camera_Spin : in Matrix_3x3;
camera_Site : in Vector_3;
camera_projection_Transform : in Matrix_4x4;
camera_Viewport : in linear_Algebra_3d.Rectangle) return pixel_Region;
--
-- Calculate and return the smallest rectangular screen region which encloses the target, when rendered by the_Camera.
function general_Update_required (Self : access Item; the_Camera_Site : in Vector_3;
the_pixel_Region : in pixel_Region) return Boolean;
function size_Update_required (Self : access Item; the_pixel_Region : in pixel_Region) return Boolean;
end openGL.Impostor;
|
with Ada.Text_IO; use Ada.Text_IO;
with Constants;
package body Input is
-- Function implementation for getting integer value from user
-- Input value should use limits from Constants package to ensure
-- valid input data
end Input;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ F I X D --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Expand routines for fixed-point convert, divide and multiply operations
with Types; use Types;
package Exp_Fixd is
-- General note on universal fixed. In the routines below, a fixed-point
-- type is always a specific fixed-point type or universal real, never
-- universal fixed. Universal fixed only appears as the result type of a
-- division or multplication and in all such cases, the parent node, which
-- must be either a conversion node or a 'Round attribute reference node,
-- has the specific type information. In both cases, the parent node is
-- removed from the tree, and the appropriate routine in this package is
-- called with a multiply or divide node with all types (and also possibly
-- the Rounded_Result flag) set.
----------------------------
-- Fixed-Point Conversion --
----------------------------
procedure Expand_Convert_Fixed_To_Fixed (N : Node_Id);
-- This routine expands the conversion of one fixed-point type to another,
-- N is the N_Op_Conversion node with the result and expression types (and
-- possibly the Rounded_Result flag) set.
procedure Expand_Convert_Fixed_To_Float (N : Node_Id);
-- This routine expands the conversion from a fixed-point type to a
-- floating-point type. N is an N_Type_Conversion node with the result
-- and expression types set.
procedure Expand_Convert_Fixed_To_Integer (N : Node_Id);
-- This routine expands the conversion from a fixed-point type to an
-- integer type. N is an N_Type_Conversion node with the result and
-- operand types set.
procedure Expand_Convert_Float_To_Fixed (N : Node_Id);
-- This routine expands the conversion from a floating-point type to
-- a fixed-point type. N is an N_Type_Conversion node with the result
-- and operand types (and possibly the Rounded_Result flag) set.
procedure Expand_Convert_Integer_To_Fixed (N : Node_Id);
-- This routine expands the conversion from an integer type to a
-- fixed-point type. N is an N_Type_Conversion node with the result
-- and operand types (and possibly the Rounded_Result flag) set.
--------------------------
-- Fixed-Point Division --
--------------------------
procedure Expand_Decimal_Divide_Call (N : Node_Id);
-- This routine expands a call to the procedure Decimal.Divide. The
-- argument N is the N_Function_Call node.
procedure Expand_Divide_Fixed_By_Fixed_Giving_Fixed (N : Node_Id);
-- This routine expands the division between fixed-point types, with
-- a fixed-point type result. N is an N_Op_Divide node with operand
-- and result types (and possibly the Rounded_Result flag) set. Either
-- (but not both) of the operands may be universal real.
procedure Expand_Divide_Fixed_By_Fixed_Giving_Float (N : Node_Id);
-- This routine expands the division between two fixed-point types with
-- a floating-point result. N is an N_Op_Divide node with the result
-- and operand types set. Either (but not both) of the operands may be
-- universal real.
procedure Expand_Divide_Fixed_By_Fixed_Giving_Integer (N : Node_Id);
-- This routine expands the division between two fixed-point types with
-- an integer type result. N is an N_Op_Divide node with the result and
-- operand types set. Either (but not both) of the operands may be
-- universal real.
procedure Expand_Divide_Fixed_By_Integer_Giving_Fixed (N : Node_Id);
-- This routine expands the division between a fixed-point type and
-- standard integer type. The result type is the same fixed-point type
-- as the operand type. N is an N_Op_Divide node with the result and
-- left operand types being the fixed-point type, and the right operand
-- type being standard integer (and possibly Rounded_Result set).
--------------------------------
-- Fixed-Point Multiplication --
--------------------------------
procedure Expand_Multiply_Fixed_By_Fixed_Giving_Fixed (N : Node_Id);
-- This routine expands the multiplication between fixed-point types
-- with a fixed-point type result. N is an N_Op_Multiply node with the
-- result and operand types set. Either (but not both) of the operands
-- may be universal real.
procedure Expand_Multiply_Fixed_By_Fixed_Giving_Float (N : Node_Id);
-- This routine expands the multiplication between two fixed-point types
-- with a floating-point result. N is an N_Op_Multiply node with the
-- result and operand types set. Either (but not both) of the operands
-- may be universal real.
procedure Expand_Multiply_Fixed_By_Fixed_Giving_Integer (N : Node_Id);
-- This routine expands the multiplication between two fixed-point types
-- with an integer result. N is an N_Op_Multiply node with the result
-- and operand types set. Either (but not both) of the operands may be
-- be universal real.
procedure Expand_Multiply_Fixed_By_Integer_Giving_Fixed (N : Node_Id);
-- This routine expands the multiplication between a fixed-point type and
-- a standard integer type. The result type is the same fixed-point type
-- as the fixed operand type. N is an N_Op_Multiply node whose result type
-- and left operand types are the fixed-point type, and whose right operand
-- type is always standard integer.
procedure Expand_Multiply_Integer_By_Fixed_Giving_Fixed (N : Node_Id);
-- This routine expands the multiplication between standard integer and a
-- fixed-point type. The result type is the same fixed-point type as the
-- the fixed operand type. N is an N_Op_Multiply node whose result type
-- and right operand types are the fixed-point type, and whose left operand
-- type is always standard integer.
end Exp_Fixd;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with FE310.Device; use FE310.Device;
with FE310.GPIO; use FE310.GPIO;
package HiFive1 is
HF1_Pin_0 : GPIO_Point renames P16;
HF1_Pin_1 : GPIO_Point renames P17;
HF1_Pin_2 : GPIO_Point renames P18;
HF1_Pin_3 : GPIO_Point renames P19; -- Green LED
HF1_Pin_4 : GPIO_Point renames P20;
HF1_Pin_5 : GPIO_Point renames P21; -- Blue LED
HF1_Pin_6 : GPIO_Point renames P22; -- Red LED
HF1_Pin_7 : GPIO_Point renames P23;
HF1_Pin_8 : GPIO_Point renames P00;
HF1_Pin_9 : GPIO_Point renames P01;
HF1_Pin_10 : GPIO_Point renames P02;
HF1_Pin_11 : GPIO_Point renames P03;
HF1_Pin_12 : GPIO_Point renames P04;
HF1_Pin_13 : GPIO_Point renames P05;
-- HF1_Pin_14 is not connected
HF1_Pin_15 : GPIO_Point renames P09;
HF1_Pin_16 : GPIO_Point renames P10;
HF1_Pin_17 : GPIO_Point renames P11;
HF1_Pin_18 : GPIO_Point renames P12;
HF1_Pin_19 : GPIO_Point renames P13;
end HiFive1;
|
-----------------------------------------------------------------------
-- Aawa-tests-helpers - Helpers for AWA unit tests
-- Copyright (C) 2011 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package AWA.Tests.Helpers is
end AWA.Tests.Helpers;
|
-- This spec has been automatically generated from STM32F427x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
with System;
with HAL;
package STM32_SVD.FLASH is
pragma Preelaborate;
---------------
-- Registers --
---------------
------------------
-- ACR_Register --
------------------
subtype ACR_LATENCY_Field is HAL.UInt3;
-- Flash access control register
type ACR_Register is record
-- Latency
LATENCY : ACR_LATENCY_Field := 16#0#;
-- unspecified
Reserved_3_7 : HAL.UInt5 := 16#0#;
-- Prefetch enable
PRFTEN : Boolean := False;
-- Instruction cache enable
ICEN : Boolean := False;
-- Data cache enable
DCEN : Boolean := False;
-- Write-only. Instruction cache reset
ICRST : Boolean := False;
-- Data cache reset
DCRST : Boolean := False;
-- unspecified
Reserved_13_31 : HAL.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ACR_Register use record
LATENCY at 0 range 0 .. 2;
Reserved_3_7 at 0 range 3 .. 7;
PRFTEN at 0 range 8 .. 8;
ICEN at 0 range 9 .. 9;
DCEN at 0 range 10 .. 10;
ICRST at 0 range 11 .. 11;
DCRST at 0 range 12 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
-----------------
-- SR_Register --
-----------------
-- Status register
type SR_Register is record
-- End of operation
EOP : Boolean := False;
-- Operation error
OPERR : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- Write protection error
WRPERR : Boolean := False;
-- Programming alignment error
PGAERR : Boolean := False;
-- Programming parallelism error
PGPERR : Boolean := False;
-- Programming sequence error
PGSERR : Boolean := False;
-- unspecified
Reserved_8_15 : HAL.Byte := 16#0#;
-- Read-only. Busy
BSY : Boolean := False;
-- unspecified
Reserved_17_31 : HAL.UInt15 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
EOP at 0 range 0 .. 0;
OPERR at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
WRPERR at 0 range 4 .. 4;
PGAERR at 0 range 5 .. 5;
PGPERR at 0 range 6 .. 6;
PGSERR at 0 range 7 .. 7;
Reserved_8_15 at 0 range 8 .. 15;
BSY at 0 range 16 .. 16;
Reserved_17_31 at 0 range 17 .. 31;
end record;
-----------------
-- CR_Register --
-----------------
subtype CR_SNB_Field is HAL.UInt5;
subtype CR_PSIZE_Field is HAL.UInt2;
-- Control register
type CR_Register is record
-- Programming
PG : Boolean := False;
-- Sector Erase
SER : Boolean := False;
-- Mass Erase of sectors 0 to 11
MER : Boolean := False;
-- Sector number
SNB : CR_SNB_Field := 16#0#;
-- Program size
PSIZE : CR_PSIZE_Field := 16#0#;
-- unspecified
Reserved_10_14 : HAL.UInt5 := 16#0#;
-- Mass Erase of sectors 12 to 23
MER1 : Boolean := False;
-- Start
STRT : Boolean := False;
-- unspecified
Reserved_17_23 : HAL.UInt7 := 16#0#;
-- End of operation interrupt enable
EOPIE : Boolean := False;
-- Error interrupt enable
ERRIE : Boolean := False;
-- unspecified
Reserved_26_30 : HAL.UInt5 := 16#0#;
-- Lock
LOCK : Boolean := True;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
PG at 0 range 0 .. 0;
SER at 0 range 1 .. 1;
MER at 0 range 2 .. 2;
SNB at 0 range 3 .. 7;
PSIZE at 0 range 8 .. 9;
Reserved_10_14 at 0 range 10 .. 14;
MER1 at 0 range 15 .. 15;
STRT at 0 range 16 .. 16;
Reserved_17_23 at 0 range 17 .. 23;
EOPIE at 0 range 24 .. 24;
ERRIE at 0 range 25 .. 25;
Reserved_26_30 at 0 range 26 .. 30;
LOCK at 0 range 31 .. 31;
end record;
--------------------
-- OPTCR_Register --
--------------------
subtype OPTCR_BOR_LEV_Field is HAL.UInt2;
subtype OPTCR_RDP_Field is HAL.Byte;
subtype OPTCR_nWRP_Field is HAL.UInt12;
-- Flash option control register
type OPTCR_Register is record
-- Option lock
OPTLOCK : Boolean := True;
-- Option start
OPTSTRT : Boolean := False;
-- BOR reset Level
BOR_LEV : OPTCR_BOR_LEV_Field := 16#3#;
-- unspecified
Reserved_4_4 : HAL.Bit := 16#0#;
-- WDG_SW User option bytes
WDG_SW : Boolean := True;
-- nRST_STOP User option bytes
nRST_STOP : Boolean := True;
-- nRST_STDBY User option bytes
nRST_STDBY : Boolean := True;
-- Read protect
RDP : OPTCR_RDP_Field := 16#AA#;
-- Not write protect
nWRP : OPTCR_nWRP_Field := 16#FFF#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OPTCR_Register use record
OPTLOCK at 0 range 0 .. 0;
OPTSTRT at 0 range 1 .. 1;
BOR_LEV at 0 range 2 .. 3;
Reserved_4_4 at 0 range 4 .. 4;
WDG_SW at 0 range 5 .. 5;
nRST_STOP at 0 range 6 .. 6;
nRST_STDBY at 0 range 7 .. 7;
RDP at 0 range 8 .. 15;
nWRP at 0 range 16 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
---------------------
-- OPTCR1_Register --
---------------------
subtype OPTCR1_nWRP_Field is HAL.UInt12;
-- Flash option control register 1
type OPTCR1_Register is record
-- unspecified
Reserved_0_15 : HAL.Short := 16#0#;
-- Not write protect
nWRP : OPTCR1_nWRP_Field := 16#FFF#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OPTCR1_Register use record
Reserved_0_15 at 0 range 0 .. 15;
nWRP at 0 range 16 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- FLASH
type FLASH_Peripheral is record
-- Flash access control register
ACR : ACR_Register;
-- Flash key register
KEYR : HAL.Word;
-- Flash option key register
OPTKEYR : HAL.Word;
-- Status register
SR : SR_Register;
-- Control register
CR : CR_Register;
-- Flash option control register
OPTCR : OPTCR_Register;
-- Flash option control register 1
OPTCR1 : OPTCR1_Register;
end record
with Volatile;
for FLASH_Peripheral use record
ACR at 0 range 0 .. 31;
KEYR at 4 range 0 .. 31;
OPTKEYR at 8 range 0 .. 31;
SR at 12 range 0 .. 31;
CR at 16 range 0 .. 31;
OPTCR at 20 range 0 .. 31;
OPTCR1 at 24 range 0 .. 31;
end record;
-- FLASH
FLASH_Periph : aliased FLASH_Peripheral
with Import, Address => FLASH_Base;
end STM32_SVD.FLASH;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . C H A R A C T E R S . W I D E _ L A T I N _ 1 --
-- --
-- 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 provides definitions analogous to those in the RM defined
-- package Ada.Characters.Latin_1 except that the type of the constants
-- is Wide_Character instead of Character. The provision of this package
-- is in accordance with the implementation permission in RM (A.3.3(27)).
package Ada.Characters.Wide_Latin_1 is
pragma Pure;
------------------------
-- Control Characters --
------------------------
NUL : constant Wide_Character := Wide_Character'Val (0);
SOH : constant Wide_Character := Wide_Character'Val (1);
STX : constant Wide_Character := Wide_Character'Val (2);
ETX : constant Wide_Character := Wide_Character'Val (3);
EOT : constant Wide_Character := Wide_Character'Val (4);
ENQ : constant Wide_Character := Wide_Character'Val (5);
ACK : constant Wide_Character := Wide_Character'Val (6);
BEL : constant Wide_Character := Wide_Character'Val (7);
BS : constant Wide_Character := Wide_Character'Val (8);
HT : constant Wide_Character := Wide_Character'Val (9);
LF : constant Wide_Character := Wide_Character'Val (10);
VT : constant Wide_Character := Wide_Character'Val (11);
FF : constant Wide_Character := Wide_Character'Val (12);
CR : constant Wide_Character := Wide_Character'Val (13);
SO : constant Wide_Character := Wide_Character'Val (14);
SI : constant Wide_Character := Wide_Character'Val (15);
DLE : constant Wide_Character := Wide_Character'Val (16);
DC1 : constant Wide_Character := Wide_Character'Val (17);
DC2 : constant Wide_Character := Wide_Character'Val (18);
DC3 : constant Wide_Character := Wide_Character'Val (19);
DC4 : constant Wide_Character := Wide_Character'Val (20);
NAK : constant Wide_Character := Wide_Character'Val (21);
SYN : constant Wide_Character := Wide_Character'Val (22);
ETB : constant Wide_Character := Wide_Character'Val (23);
CAN : constant Wide_Character := Wide_Character'Val (24);
EM : constant Wide_Character := Wide_Character'Val (25);
SUB : constant Wide_Character := Wide_Character'Val (26);
ESC : constant Wide_Character := Wide_Character'Val (27);
FS : constant Wide_Character := Wide_Character'Val (28);
GS : constant Wide_Character := Wide_Character'Val (29);
RS : constant Wide_Character := Wide_Character'Val (30);
US : constant Wide_Character := Wide_Character'Val (31);
-------------------------------------
-- ISO 646 Graphic Wide_Characters --
-------------------------------------
Space : constant Wide_Character := ' '; -- WC'Val(32)
Exclamation : constant Wide_Character := '!'; -- WC'Val(33)
Quotation : constant Wide_Character := '"'; -- WC'Val(34)
Number_Sign : constant Wide_Character := '#'; -- WC'Val(35)
Dollar_Sign : constant Wide_Character := '$'; -- WC'Val(36)
Percent_Sign : constant Wide_Character := '%'; -- WC'Val(37)
Ampersand : constant Wide_Character := '&'; -- WC'Val(38)
Apostrophe : constant Wide_Character := '''; -- WC'Val(39)
Left_Parenthesis : constant Wide_Character := '('; -- WC'Val(40)
Right_Parenthesis : constant Wide_Character := ')'; -- WC'Val(41)
Asterisk : constant Wide_Character := '*'; -- WC'Val(42)
Plus_Sign : constant Wide_Character := '+'; -- WC'Val(43)
Comma : constant Wide_Character := ','; -- WC'Val(44)
Hyphen : constant Wide_Character := '-'; -- WC'Val(45)
Minus_Sign : Wide_Character renames Hyphen;
Full_Stop : constant Wide_Character := '.'; -- WC'Val(46)
Solidus : constant Wide_Character := '/'; -- WC'Val(47)
-- Decimal digits '0' though '9' are at positions 48 through 57
Colon : constant Wide_Character := ':'; -- WC'Val(58)
Semicolon : constant Wide_Character := ';'; -- WC'Val(59)
Less_Than_Sign : constant Wide_Character := '<'; -- WC'Val(60)
Equals_Sign : constant Wide_Character := '='; -- WC'Val(61)
Greater_Than_Sign : constant Wide_Character := '>'; -- WC'Val(62)
Question : constant Wide_Character := '?'; -- WC'Val(63)
Commercial_At : constant Wide_Character := '@'; -- WC'Val(64)
-- Letters 'A' through 'Z' are at positions 65 through 90
Left_Square_Bracket : constant Wide_Character := '['; -- WC'Val (91)
Reverse_Solidus : constant Wide_Character := '\'; -- WC'Val (92)
Right_Square_Bracket : constant Wide_Character := ']'; -- WC'Val (93)
Circumflex : constant Wide_Character := '^'; -- WC'Val (94)
Low_Line : constant Wide_Character := '_'; -- WC'Val (95)
Grave : constant Wide_Character := '`'; -- WC'Val (96)
LC_A : constant Wide_Character := 'a'; -- WC'Val (97)
LC_B : constant Wide_Character := 'b'; -- WC'Val (98)
LC_C : constant Wide_Character := 'c'; -- WC'Val (99)
LC_D : constant Wide_Character := 'd'; -- WC'Val (100)
LC_E : constant Wide_Character := 'e'; -- WC'Val (101)
LC_F : constant Wide_Character := 'f'; -- WC'Val (102)
LC_G : constant Wide_Character := 'g'; -- WC'Val (103)
LC_H : constant Wide_Character := 'h'; -- WC'Val (104)
LC_I : constant Wide_Character := 'i'; -- WC'Val (105)
LC_J : constant Wide_Character := 'j'; -- WC'Val (106)
LC_K : constant Wide_Character := 'k'; -- WC'Val (107)
LC_L : constant Wide_Character := 'l'; -- WC'Val (108)
LC_M : constant Wide_Character := 'm'; -- WC'Val (109)
LC_N : constant Wide_Character := 'n'; -- WC'Val (110)
LC_O : constant Wide_Character := 'o'; -- WC'Val (111)
LC_P : constant Wide_Character := 'p'; -- WC'Val (112)
LC_Q : constant Wide_Character := 'q'; -- WC'Val (113)
LC_R : constant Wide_Character := 'r'; -- WC'Val (114)
LC_S : constant Wide_Character := 's'; -- WC'Val (115)
LC_T : constant Wide_Character := 't'; -- WC'Val (116)
LC_U : constant Wide_Character := 'u'; -- WC'Val (117)
LC_V : constant Wide_Character := 'v'; -- WC'Val (118)
LC_W : constant Wide_Character := 'w'; -- WC'Val (119)
LC_X : constant Wide_Character := 'x'; -- WC'Val (120)
LC_Y : constant Wide_Character := 'y'; -- WC'Val (121)
LC_Z : constant Wide_Character := 'z'; -- WC'Val (122)
Left_Curly_Bracket : constant Wide_Character := '{'; -- WC'Val (123)
Vertical_Line : constant Wide_Character := '|'; -- WC'Val (124)
Right_Curly_Bracket : constant Wide_Character := '}'; -- WC'Val (125)
Tilde : constant Wide_Character := '~'; -- WC'Val (126)
DEL : constant Wide_Character := Wide_Character'Val (127);
--------------------------------------
-- ISO 6429 Control Wide_Characters --
--------------------------------------
IS4 : Wide_Character renames FS;
IS3 : Wide_Character renames GS;
IS2 : Wide_Character renames RS;
IS1 : Wide_Character renames US;
Reserved_128 : constant Wide_Character := Wide_Character'Val (128);
Reserved_129 : constant Wide_Character := Wide_Character'Val (129);
BPH : constant Wide_Character := Wide_Character'Val (130);
NBH : constant Wide_Character := Wide_Character'Val (131);
Reserved_132 : constant Wide_Character := Wide_Character'Val (132);
NEL : constant Wide_Character := Wide_Character'Val (133);
SSA : constant Wide_Character := Wide_Character'Val (134);
ESA : constant Wide_Character := Wide_Character'Val (135);
HTS : constant Wide_Character := Wide_Character'Val (136);
HTJ : constant Wide_Character := Wide_Character'Val (137);
VTS : constant Wide_Character := Wide_Character'Val (138);
PLD : constant Wide_Character := Wide_Character'Val (139);
PLU : constant Wide_Character := Wide_Character'Val (140);
RI : constant Wide_Character := Wide_Character'Val (141);
SS2 : constant Wide_Character := Wide_Character'Val (142);
SS3 : constant Wide_Character := Wide_Character'Val (143);
DCS : constant Wide_Character := Wide_Character'Val (144);
PU1 : constant Wide_Character := Wide_Character'Val (145);
PU2 : constant Wide_Character := Wide_Character'Val (146);
STS : constant Wide_Character := Wide_Character'Val (147);
CCH : constant Wide_Character := Wide_Character'Val (148);
MW : constant Wide_Character := Wide_Character'Val (149);
SPA : constant Wide_Character := Wide_Character'Val (150);
EPA : constant Wide_Character := Wide_Character'Val (151);
SOS : constant Wide_Character := Wide_Character'Val (152);
Reserved_153 : constant Wide_Character := Wide_Character'Val (153);
SCI : constant Wide_Character := Wide_Character'Val (154);
CSI : constant Wide_Character := Wide_Character'Val (155);
ST : constant Wide_Character := Wide_Character'Val (156);
OSC : constant Wide_Character := Wide_Character'Val (157);
PM : constant Wide_Character := Wide_Character'Val (158);
APC : constant Wide_Character := Wide_Character'Val (159);
-----------------------------------
-- Other Graphic Wide_Characters --
-----------------------------------
-- Wide_Character positions 160 (16#A0#) .. 175 (16#AF#)
No_Break_Space : constant Wide_Character := Wide_Character'Val (160);
NBSP : Wide_Character renames No_Break_Space;
Inverted_Exclamation : constant Wide_Character := Wide_Character'Val (161);
Cent_Sign : constant Wide_Character := Wide_Character'Val (162);
Pound_Sign : constant Wide_Character := Wide_Character'Val (163);
Currency_Sign : constant Wide_Character := Wide_Character'Val (164);
Yen_Sign : constant Wide_Character := Wide_Character'Val (165);
Broken_Bar : constant Wide_Character := Wide_Character'Val (166);
Section_Sign : constant Wide_Character := Wide_Character'Val (167);
Diaeresis : constant Wide_Character := Wide_Character'Val (168);
Copyright_Sign : constant Wide_Character := Wide_Character'Val (169);
Feminine_Ordinal_Indicator
: constant Wide_Character := Wide_Character'Val (170);
Left_Angle_Quotation : constant Wide_Character := Wide_Character'Val (171);
Not_Sign : constant Wide_Character := Wide_Character'Val (172);
Soft_Hyphen : constant Wide_Character := Wide_Character'Val (173);
Registered_Trade_Mark_Sign
: constant Wide_Character := Wide_Character'Val (174);
Macron : constant Wide_Character := Wide_Character'Val (175);
-- Wide_Character positions 176 (16#B0#) .. 191 (16#BF#)
Degree_Sign : constant Wide_Character := Wide_Character'Val (176);
Ring_Above : Wide_Character renames Degree_Sign;
Plus_Minus_Sign : constant Wide_Character := Wide_Character'Val (177);
Superscript_Two : constant Wide_Character := Wide_Character'Val (178);
Superscript_Three : constant Wide_Character := Wide_Character'Val (179);
Acute : constant Wide_Character := Wide_Character'Val (180);
Micro_Sign : constant Wide_Character := Wide_Character'Val (181);
Pilcrow_Sign : constant Wide_Character := Wide_Character'Val (182);
Paragraph_Sign : Wide_Character renames Pilcrow_Sign;
Middle_Dot : constant Wide_Character := Wide_Character'Val (183);
Cedilla : constant Wide_Character := Wide_Character'Val (184);
Superscript_One : constant Wide_Character := Wide_Character'Val (185);
Masculine_Ordinal_Indicator
: constant Wide_Character := Wide_Character'Val (186);
Right_Angle_Quotation
: constant Wide_Character := Wide_Character'Val (187);
Fraction_One_Quarter : constant Wide_Character := Wide_Character'Val (188);
Fraction_One_Half : constant Wide_Character := Wide_Character'Val (189);
Fraction_Three_Quarters
: constant Wide_Character := Wide_Character'Val (190);
Inverted_Question : constant Wide_Character := Wide_Character'Val (191);
-- Wide_Character positions 192 (16#C0#) .. 207 (16#CF#)
UC_A_Grave : constant Wide_Character := Wide_Character'Val (192);
UC_A_Acute : constant Wide_Character := Wide_Character'Val (193);
UC_A_Circumflex : constant Wide_Character := Wide_Character'Val (194);
UC_A_Tilde : constant Wide_Character := Wide_Character'Val (195);
UC_A_Diaeresis : constant Wide_Character := Wide_Character'Val (196);
UC_A_Ring : constant Wide_Character := Wide_Character'Val (197);
UC_AE_Diphthong : constant Wide_Character := Wide_Character'Val (198);
UC_C_Cedilla : constant Wide_Character := Wide_Character'Val (199);
UC_E_Grave : constant Wide_Character := Wide_Character'Val (200);
UC_E_Acute : constant Wide_Character := Wide_Character'Val (201);
UC_E_Circumflex : constant Wide_Character := Wide_Character'Val (202);
UC_E_Diaeresis : constant Wide_Character := Wide_Character'Val (203);
UC_I_Grave : constant Wide_Character := Wide_Character'Val (204);
UC_I_Acute : constant Wide_Character := Wide_Character'Val (205);
UC_I_Circumflex : constant Wide_Character := Wide_Character'Val (206);
UC_I_Diaeresis : constant Wide_Character := Wide_Character'Val (207);
-- Wide_Character positions 208 (16#D0#) .. 223 (16#DF#)
UC_Icelandic_Eth : constant Wide_Character := Wide_Character'Val (208);
UC_N_Tilde : constant Wide_Character := Wide_Character'Val (209);
UC_O_Grave : constant Wide_Character := Wide_Character'Val (210);
UC_O_Acute : constant Wide_Character := Wide_Character'Val (211);
UC_O_Circumflex : constant Wide_Character := Wide_Character'Val (212);
UC_O_Tilde : constant Wide_Character := Wide_Character'Val (213);
UC_O_Diaeresis : constant Wide_Character := Wide_Character'Val (214);
Multiplication_Sign : constant Wide_Character := Wide_Character'Val (215);
UC_O_Oblique_Stroke : constant Wide_Character := Wide_Character'Val (216);
UC_U_Grave : constant Wide_Character := Wide_Character'Val (217);
UC_U_Acute : constant Wide_Character := Wide_Character'Val (218);
UC_U_Circumflex : constant Wide_Character := Wide_Character'Val (219);
UC_U_Diaeresis : constant Wide_Character := Wide_Character'Val (220);
UC_Y_Acute : constant Wide_Character := Wide_Character'Val (221);
UC_Icelandic_Thorn : constant Wide_Character := Wide_Character'Val (222);
LC_German_Sharp_S : constant Wide_Character := Wide_Character'Val (223);
-- Wide_Character positions 224 (16#E0#) .. 239 (16#EF#)
LC_A_Grave : constant Wide_Character := Wide_Character'Val (224);
LC_A_Acute : constant Wide_Character := Wide_Character'Val (225);
LC_A_Circumflex : constant Wide_Character := Wide_Character'Val (226);
LC_A_Tilde : constant Wide_Character := Wide_Character'Val (227);
LC_A_Diaeresis : constant Wide_Character := Wide_Character'Val (228);
LC_A_Ring : constant Wide_Character := Wide_Character'Val (229);
LC_AE_Diphthong : constant Wide_Character := Wide_Character'Val (230);
LC_C_Cedilla : constant Wide_Character := Wide_Character'Val (231);
LC_E_Grave : constant Wide_Character := Wide_Character'Val (232);
LC_E_Acute : constant Wide_Character := Wide_Character'Val (233);
LC_E_Circumflex : constant Wide_Character := Wide_Character'Val (234);
LC_E_Diaeresis : constant Wide_Character := Wide_Character'Val (235);
LC_I_Grave : constant Wide_Character := Wide_Character'Val (236);
LC_I_Acute : constant Wide_Character := Wide_Character'Val (237);
LC_I_Circumflex : constant Wide_Character := Wide_Character'Val (238);
LC_I_Diaeresis : constant Wide_Character := Wide_Character'Val (239);
-- Wide_Character positions 240 (16#F0#) .. 255 (16#FF)
LC_Icelandic_Eth : constant Wide_Character := Wide_Character'Val (240);
LC_N_Tilde : constant Wide_Character := Wide_Character'Val (241);
LC_O_Grave : constant Wide_Character := Wide_Character'Val (242);
LC_O_Acute : constant Wide_Character := Wide_Character'Val (243);
LC_O_Circumflex : constant Wide_Character := Wide_Character'Val (244);
LC_O_Tilde : constant Wide_Character := Wide_Character'Val (245);
LC_O_Diaeresis : constant Wide_Character := Wide_Character'Val (246);
Division_Sign : constant Wide_Character := Wide_Character'Val (247);
LC_O_Oblique_Stroke : constant Wide_Character := Wide_Character'Val (248);
LC_U_Grave : constant Wide_Character := Wide_Character'Val (249);
LC_U_Acute : constant Wide_Character := Wide_Character'Val (250);
LC_U_Circumflex : constant Wide_Character := Wide_Character'Val (251);
LC_U_Diaeresis : constant Wide_Character := Wide_Character'Val (252);
LC_Y_Acute : constant Wide_Character := Wide_Character'Val (253);
LC_Icelandic_Thorn : constant Wide_Character := Wide_Character'Val (254);
LC_Y_Diaeresis : constant Wide_Character := Wide_Character'Val (255);
end Ada.Characters.Wide_Latin_1;
|
------------------------------------------------------------------------------
-- --
-- THIS IS AN AUTOMATICALLY GENERATED FILE! DO NOT EDIT! --
-- --
-- WAVEFILES --
-- --
-- Wavefile I/O operations for PCM buffers --
-- --
-- The MIT License (MIT) --
-- --
-- Copyright (c) 2015 -- 2020 Gustavo A. Hoffmann --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining --
-- a copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, sublicense, and / or sell copies of the Software, and to --
-- permit persons to whom the Software is furnished to do so, subject to --
-- the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be --
-- included in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, --
-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY --
-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, --
-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE --
-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
------------------------------------------------------------------------------
generic
#if NUM_TYPE'Defined and then (NUM_TYPE = "FLOAT") then
type PCM_Sample is digits <>;
#else
type PCM_Sample is delta <>;
#end if;
type Channel_Range is (<>);
type PCM_MC_Sample is array (Channel_Range range <>) of PCM_Sample;
#if NUM_TYPE'Defined and then (NUM_TYPE = "FLOAT") then
package Audio.Wavefiles.Generic_Float_PCM_IO is
#else
package Audio.Wavefiles.Generic_Fixed_PCM_IO is
#end if;
function Get
(WF : in out Wavefile) return PCM_MC_Sample
with Inline, Pre => Mode (WF) = In_File;
procedure Get
(WF : in out Wavefile;
PCM : out PCM_MC_Sample)
with Inline, Pre => Mode (WF) = In_File;
procedure Put
(WF : in out Wavefile;
PCM : PCM_MC_Sample)
with Pre => Mode (WF) = Out_File;
#if NUM_TYPE'Defined and then (NUM_TYPE = "FLOAT") then
end Audio.Wavefiles.Generic_Float_PCM_IO;
#else
end Audio.Wavefiles.Generic_Fixed_PCM_IO;
#end if;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- O S I N T --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Fmap; use Fmap;
with Gnatvsn; use Gnatvsn;
with Hostparm;
with Namet; use Namet;
with Opt; use Opt;
with Output; use Output;
with Sdefault; use Sdefault;
with Table;
with Targparm; use Targparm;
with System.Case_Util; use System.Case_Util;
with Unchecked_Conversion;
with GNAT.HTable;
package body Osint is
Running_Program : Program_Type := Unspecified;
-- comment required here ???
Program_Set : Boolean := False;
-- comment required here ???
Std_Prefix : String_Ptr;
-- Standard prefix, computed dynamically the first time Relocate_Path
-- is called, and cached for subsequent calls.
Empty : aliased String := "";
No_Dir : constant String_Ptr := Empty'Access;
-- Used in Locate_File as a fake directory when Name is already an
-- absolute path.
-------------------------------------
-- Use of Name_Find and Name_Enter --
-------------------------------------
-- This package creates a number of source, ALI and object file names
-- that are used to locate the actual file and for the purpose of
-- message construction. These names need not be accessible by Name_Find,
-- and can be therefore created by using routine Name_Enter. The files in
-- question are file names with a prefix directory (ie the files not
-- in the current directory). File names without a prefix directory are
-- entered with Name_Find because special values might be attached to
-- the various Info fields of the corresponding name table entry.
-----------------------
-- Local Subprograms --
-----------------------
function Append_Suffix_To_File_Name
(Name : Name_Id;
Suffix : String) return Name_Id;
-- Appends Suffix to Name and returns the new name
function OS_Time_To_GNAT_Time (T : OS_Time) return Time_Stamp_Type;
-- Convert OS format time to GNAT format time stamp
function Concat (String_One : String; String_Two : String) return String;
-- Concatenates 2 strings and returns the result of the concatenation
function Executable_Prefix return String_Ptr;
-- Returns the name of the root directory where the executable is stored.
-- The executable must be located in a directory called "bin", or
-- under root/lib/gcc-lib/..., or under root/libexec/gcc/... Thus, if
-- the executable is stored in directory "/foo/bar/bin", this routine
-- returns "/foo/bar/". Return "" if the location is not recognized
-- as described above.
function Update_Path (Path : String_Ptr) return String_Ptr;
-- Update the specified path to replace the prefix with the location
-- where GNAT is installed. See the file prefix.c in GCC for details.
procedure Write_With_Check (A : Address; N : Integer);
-- Writes N bytes from buffer starting at address A to file whose FD is
-- stored in Output_FD, and whose file name is stored as a File_Name_Type
-- in Output_File_Name. A check is made for disk full, and if this is
-- detected, the file being written is deleted, and a fatal error is
-- signalled.
function Locate_File
(N : File_Name_Type;
T : File_Type;
Dir : Natural;
Name : String) return File_Name_Type;
-- See if the file N whose name is Name exists in directory Dir. Dir is
-- an index into the Lib_Search_Directories table if T = Library.
-- Otherwise if T = Source, Dir is an index into the
-- Src_Search_Directories table. Returns the File_Name_Type of the
-- full file name if file found, or No_File if not found.
function C_String_Length (S : Address) return Integer;
-- Returns length of a C string. Returns zero for a null address
function To_Path_String_Access
(Path_Addr : Address;
Path_Len : Integer) return String_Access;
-- Converts a C String to an Ada String. Are we doing this to avoid
-- withing Interfaces.C.Strings ???
------------------------------
-- Other Local Declarations --
------------------------------
EOL : constant Character := ASCII.LF;
-- End of line character
Number_File_Names : Int := 0;
-- The total number of file names found on command line and placed in
-- File_Names.
Look_In_Primary_Directory_For_Current_Main : Boolean := False;
-- When this variable is True, Find_File will only look in
-- the Primary_Directory for the Current_Main file.
-- This variable is always True for the compiler.
-- It is also True for gnatmake, when the soucr name given
-- on the command line has directory information.
Current_Full_Source_Name : File_Name_Type := No_File;
Current_Full_Source_Stamp : Time_Stamp_Type := Empty_Time_Stamp;
Current_Full_Lib_Name : File_Name_Type := No_File;
Current_Full_Lib_Stamp : Time_Stamp_Type := Empty_Time_Stamp;
Current_Full_Obj_Name : File_Name_Type := No_File;
Current_Full_Obj_Stamp : Time_Stamp_Type := Empty_Time_Stamp;
-- Respectively full name (with directory info) and time stamp of
-- the latest source, library and object files opened by Read_Source_File
-- and Read_Library_Info.
------------------
-- Search Paths --
------------------
Primary_Directory : constant := 0;
-- This is index in the tables created below for the first directory to
-- search in for source or library information files. This is the
-- directory containing the latest main input file (a source file for
-- the compiler or a library file for the binder).
package Src_Search_Directories is new Table.Table (
Table_Component_Type => String_Ptr,
Table_Index_Type => Natural,
Table_Low_Bound => Primary_Directory,
Table_Initial => 10,
Table_Increment => 100,
Table_Name => "Osint.Src_Search_Directories");
-- Table of names of directories in which to search for source (Compiler)
-- files. This table is filled in the order in which the directories are
-- to be searched, and then used in that order.
package Lib_Search_Directories is new Table.Table (
Table_Component_Type => String_Ptr,
Table_Index_Type => Natural,
Table_Low_Bound => Primary_Directory,
Table_Initial => 10,
Table_Increment => 100,
Table_Name => "Osint.Lib_Search_Directories");
-- Table of names of directories in which to search for library (Binder)
-- files. This table is filled in the order in which the directories are
-- to be searched and then used in that order. The reason for having two
-- distinct tables is that we need them both in gnatmake.
---------------------
-- File Hash Table --
---------------------
-- The file hash table is provided to free the programmer from any
-- efficiency concern when retrieving full file names or time stamps of
-- source files. If the programmer calls Source_File_Data (Cache => True)
-- he is guaranteed that the price to retrieve the full name (ie with
-- directory info) or time stamp of the file will be payed only once,
-- the first time the full name is actually searched (or the first time
-- the time stamp is actually retrieved). This is achieved by employing
-- a hash table that stores as a key the File_Name_Type of the file and
-- associates to that File_Name_Type the full file name of the file and its
-- time stamp.
File_Cache_Enabled : Boolean := False;
-- Set to true if you want the enable the file data caching mechanism
type File_Hash_Num is range 0 .. 1020;
function File_Hash (F : File_Name_Type) return File_Hash_Num;
-- Compute hash index for use by Simple_HTable
package File_Name_Hash_Table is new GNAT.HTable.Simple_HTable (
Header_Num => File_Hash_Num,
Element => File_Name_Type,
No_Element => No_File,
Key => File_Name_Type,
Hash => File_Hash,
Equal => "=");
package File_Stamp_Hash_Table is new GNAT.HTable.Simple_HTable (
Header_Num => File_Hash_Num,
Element => Time_Stamp_Type,
No_Element => Empty_Time_Stamp,
Key => File_Name_Type,
Hash => File_Hash,
Equal => "=");
function Smart_Find_File
(N : File_Name_Type;
T : File_Type) return File_Name_Type;
-- Exactly like Find_File except that if File_Cache_Enabled is True this
-- routine looks first in the hash table to see if the full name of the
-- file is already available.
function Smart_File_Stamp
(N : File_Name_Type;
T : File_Type) return Time_Stamp_Type;
-- Takes the same parameter as the routine above (N is a file name
-- without any prefix directory information) and behaves like File_Stamp
-- except that if File_Cache_Enabled is True this routine looks first in
-- the hash table to see if the file stamp of the file is already
-- available.
-----------------------------
-- Add_Default_Search_Dirs --
-----------------------------
procedure Add_Default_Search_Dirs is
Search_Dir : String_Access;
Search_Path : String_Access;
Path_File_Name : String_Access;
procedure Add_Search_Dir
(Search_Dir : String;
Additional_Source_Dir : Boolean);
procedure Add_Search_Dir
(Search_Dir : String_Access;
Additional_Source_Dir : Boolean);
-- Add a source search dir or a library search dir, depending on the
-- value of Additional_Source_Dir.
procedure Get_Dirs_From_File (Additional_Source_Dir : Boolean);
-- Open a path file and read the directory to search, one per line
function Get_Libraries_From_Registry return String_Ptr;
-- On Windows systems, get the list of installed standard libraries
-- from the registry key:
-- HKEY_LOCAL_MACHINE\SOFTWARE\Ada Core Technologies\
-- GNAT\Standard Libraries
-- Return an empty string on other systems
--------------------
-- Add_Search_Dir --
--------------------
procedure Add_Search_Dir
(Search_Dir : String;
Additional_Source_Dir : Boolean)
is
begin
if Additional_Source_Dir then
Add_Src_Search_Dir (Search_Dir);
else
Add_Lib_Search_Dir (Search_Dir);
end if;
end Add_Search_Dir;
procedure Add_Search_Dir
(Search_Dir : String_Access;
Additional_Source_Dir : Boolean)
is
begin
if Additional_Source_Dir then
Add_Src_Search_Dir (Search_Dir.all);
else
Add_Lib_Search_Dir (Search_Dir.all);
end if;
end Add_Search_Dir;
------------------------
-- Get_Dirs_From_File --
------------------------
procedure Get_Dirs_From_File (Additional_Source_Dir : Boolean) is
File_FD : File_Descriptor;
Buffer : String (1 .. Path_File_Name'Length + 1);
Len : Natural;
Actual_Len : Natural;
S : String_Access;
Curr : Natural;
First : Natural;
Ch : Character;
Status : Boolean;
-- For the call to Close
begin
-- Construct a C compatible character string buffer
Buffer (1 .. Buffer'Last - 1) := Path_File_Name.all;
Buffer (Buffer'Last) := ASCII.NUL;
File_FD := Open_Read (Buffer'Address, Binary);
-- If we cannot open the file, we ignore it, we don't fail
if File_FD = Invalid_FD then
return;
end if;
Len := Integer (File_Length (File_FD));
S := new String (1 .. Len);
-- Read the file. Note that the loop is not necessary since the
-- whole file is read at once except on VMS.
Curr := 1;
Actual_Len := Len;
while Curr <= Len and then Actual_Len /= 0 loop
Actual_Len := Read (File_FD, S (Curr)'Address, Len);
Curr := Curr + Actual_Len;
end loop;
-- We are done with the file, so we close it
Close (File_FD, Status);
-- We ignore any error here, because we have successfully read the
-- file.
-- Now, we read line by line
First := 1;
Curr := 0;
while Curr < Len loop
Ch := S (Curr + 1);
if Ch = ASCII.CR or else Ch = ASCII.LF
or else Ch = ASCII.FF or else Ch = ASCII.VT
then
if First <= Curr then
Add_Search_Dir (S (First .. Curr), Additional_Source_Dir);
end if;
First := Curr + 2;
end if;
Curr := Curr + 1;
end loop;
-- Last line is a special case, if the file does not end with
-- an end of line mark.
if First <= S'Last then
Add_Search_Dir (S (First .. S'Last), Additional_Source_Dir);
end if;
end Get_Dirs_From_File;
---------------------------------
-- Get_Libraries_From_Registry --
---------------------------------
function Get_Libraries_From_Registry return String_Ptr is
function C_Get_Libraries_From_Registry return Address;
pragma Import (C, C_Get_Libraries_From_Registry,
"__gnat_get_libraries_from_registry");
function Strlen (Str : Address) return Integer;
pragma Import (C, Strlen, "strlen");
procedure Strncpy (X : Address; Y : Address; Length : Integer);
pragma Import (C, Strncpy, "strncpy");
Result_Ptr : Address;
Result_Length : Integer;
Out_String : String_Ptr;
begin
Result_Ptr := C_Get_Libraries_From_Registry;
Result_Length := Strlen (Result_Ptr);
Out_String := new String (1 .. Result_Length);
Strncpy (Out_String.all'Address, Result_Ptr, Result_Length);
return Out_String;
end Get_Libraries_From_Registry;
-- Start of processing for Add_Default_Search_Dirs
begin
-- After the locations specified on the command line, the next places
-- to look for files are the directories specified by the appropriate
-- environment variable. Get this value, extract the directory names
-- and store in the tables.
-- Check for eventual project path file env vars
Path_File_Name := Getenv (Project_Include_Path_File);
if Path_File_Name'Length > 0 then
Get_Dirs_From_File (Additional_Source_Dir => True);
end if;
Path_File_Name := Getenv (Project_Objects_Path_File);
if Path_File_Name'Length > 0 then
Get_Dirs_From_File (Additional_Source_Dir => False);
end if;
-- On VMS, don't expand the logical name (e.g. environment variable),
-- just put it into Unix (e.g. canonical) format. System services
-- will handle the expansion as part of the file processing.
for Additional_Source_Dir in False .. True loop
if Additional_Source_Dir then
Search_Path := Getenv (Ada_Include_Path);
if Search_Path'Length > 0 then
if Hostparm.OpenVMS then
Search_Path := To_Canonical_Path_Spec ("ADA_INCLUDE_PATH:");
else
Search_Path := To_Canonical_Path_Spec (Search_Path.all);
end if;
end if;
else
Search_Path := Getenv (Ada_Objects_Path);
if Search_Path'Length > 0 then
if Hostparm.OpenVMS then
Search_Path := To_Canonical_Path_Spec ("ADA_OBJECTS_PATH:");
else
Search_Path := To_Canonical_Path_Spec (Search_Path.all);
end if;
end if;
end if;
Get_Next_Dir_In_Path_Init (Search_Path);
loop
Search_Dir := Get_Next_Dir_In_Path (Search_Path);
exit when Search_Dir = null;
Add_Search_Dir (Search_Dir, Additional_Source_Dir);
end loop;
end loop;
-- For the compiler, if --RTS= was specified, add the runtime
-- directories.
if RTS_Src_Path_Name /= null and then
RTS_Lib_Path_Name /= null
then
Add_Search_Dirs (RTS_Src_Path_Name, Include);
Add_Search_Dirs (RTS_Lib_Path_Name, Objects);
else
if not Opt.No_Stdinc then
-- For WIN32 systems, look for any system libraries defined in
-- the registry. These are added to both source and object
-- directories.
Search_Path := String_Access (Get_Libraries_From_Registry);
Get_Next_Dir_In_Path_Init (Search_Path);
loop
Search_Dir := Get_Next_Dir_In_Path (Search_Path);
exit when Search_Dir = null;
Add_Search_Dir (Search_Dir, False);
Add_Search_Dir (Search_Dir, True);
end loop;
-- The last place to look are the defaults
Search_Path :=
Read_Default_Search_Dirs
(String_Access (Update_Path (Search_Dir_Prefix)),
Include_Search_File,
String_Access (Update_Path (Include_Dir_Default_Name)));
Get_Next_Dir_In_Path_Init (Search_Path);
loop
Search_Dir := Get_Next_Dir_In_Path (Search_Path);
exit when Search_Dir = null;
Add_Search_Dir (Search_Dir, True);
end loop;
end if;
if not Opt.No_Stdlib and not Opt.RTS_Switch then
Search_Path :=
Read_Default_Search_Dirs
(String_Access (Update_Path (Search_Dir_Prefix)),
Objects_Search_File,
String_Access (Update_Path (Object_Dir_Default_Name)));
Get_Next_Dir_In_Path_Init (Search_Path);
loop
Search_Dir := Get_Next_Dir_In_Path (Search_Path);
exit when Search_Dir = null;
Add_Search_Dir (Search_Dir, False);
end loop;
end if;
end if;
end Add_Default_Search_Dirs;
--------------
-- Add_File --
--------------
procedure Add_File (File_Name : String; Index : Int := No_Index) is
begin
Number_File_Names := Number_File_Names + 1;
-- As Add_File may be called for mains specified inside
-- a project file, File_Names may be too short and needs
-- to be extended.
if Number_File_Names > File_Names'Last then
File_Names := new File_Name_Array'(File_Names.all & File_Names.all);
File_Indexes :=
new File_Index_Array'(File_Indexes.all & File_Indexes.all);
end if;
File_Names (Number_File_Names) := new String'(File_Name);
File_Indexes (Number_File_Names) := Index;
end Add_File;
------------------------
-- Add_Lib_Search_Dir --
------------------------
procedure Add_Lib_Search_Dir (Dir : String) is
begin
if Dir'Length = 0 then
Fail ("missing library directory name");
end if;
Lib_Search_Directories.Increment_Last;
Lib_Search_Directories.Table (Lib_Search_Directories.Last) :=
Normalize_Directory_Name (Dir);
end Add_Lib_Search_Dir;
---------------------
-- Add_Search_Dirs --
---------------------
procedure Add_Search_Dirs
(Search_Path : String_Ptr;
Path_Type : Search_File_Type)
is
Current_Search_Path : String_Access;
begin
Get_Next_Dir_In_Path_Init (String_Access (Search_Path));
loop
Current_Search_Path :=
Get_Next_Dir_In_Path (String_Access (Search_Path));
exit when Current_Search_Path = null;
if Path_Type = Include then
Add_Src_Search_Dir (Current_Search_Path.all);
else
Add_Lib_Search_Dir (Current_Search_Path.all);
end if;
end loop;
end Add_Search_Dirs;
------------------------
-- Add_Src_Search_Dir --
------------------------
procedure Add_Src_Search_Dir (Dir : String) is
begin
if Dir'Length = 0 then
Fail ("missing source directory name");
end if;
Src_Search_Directories.Increment_Last;
Src_Search_Directories.Table (Src_Search_Directories.Last) :=
Normalize_Directory_Name (Dir);
end Add_Src_Search_Dir;
--------------------------------
-- Append_Suffix_To_File_Name --
--------------------------------
function Append_Suffix_To_File_Name
(Name : Name_Id;
Suffix : String) return Name_Id
is
begin
Get_Name_String (Name);
Name_Buffer (Name_Len + 1 .. Name_Len + Suffix'Length) := Suffix;
Name_Len := Name_Len + Suffix'Length;
return Name_Find;
end Append_Suffix_To_File_Name;
---------------------
-- C_String_Length --
---------------------
function C_String_Length (S : Address) return Integer is
function Strlen (S : Address) return Integer;
pragma Import (C, Strlen, "strlen");
begin
if S = Null_Address then
return 0;
else
return Strlen (S);
end if;
end C_String_Length;
------------------------------
-- Canonical_Case_File_Name --
------------------------------
-- For now, we only deal with the case of a-z. Eventually we should
-- worry about other Latin-1 letters on systems that support this ???
procedure Canonical_Case_File_Name (S : in out String) is
begin
if not File_Names_Case_Sensitive then
for J in S'Range loop
if S (J) in 'A' .. 'Z' then
S (J) := Character'Val (
Character'Pos (S (J)) +
Character'Pos ('a') -
Character'Pos ('A'));
end if;
end loop;
end if;
end Canonical_Case_File_Name;
------------
-- Concat --
------------
function Concat (String_One : String; String_Two : String) return String is
Buffer : String (1 .. String_One'Length + String_Two'Length);
begin
Buffer (1 .. String_One'Length) := String_One;
Buffer (String_One'Length + 1 .. Buffer'Last) := String_Two;
return Buffer;
end Concat;
---------------------------
-- Create_File_And_Check --
---------------------------
procedure Create_File_And_Check
(Fdesc : out File_Descriptor;
Fmode : Mode)
is
begin
Output_File_Name := Name_Enter;
Fdesc := Create_File (Name_Buffer'Address, Fmode);
if Fdesc = Invalid_FD then
Fail ("Cannot create: ", Name_Buffer (1 .. Name_Len));
end if;
end Create_File_And_Check;
------------------------
-- Current_File_Index --
------------------------
function Current_File_Index return Int is
begin
return File_Indexes (Current_File_Name_Index);
end Current_File_Index;
--------------------------------
-- Current_Library_File_Stamp --
--------------------------------
function Current_Library_File_Stamp return Time_Stamp_Type is
begin
return Current_Full_Lib_Stamp;
end Current_Library_File_Stamp;
-------------------------------
-- Current_Object_File_Stamp --
-------------------------------
function Current_Object_File_Stamp return Time_Stamp_Type is
begin
return Current_Full_Obj_Stamp;
end Current_Object_File_Stamp;
-------------------------------
-- Current_Source_File_Stamp --
-------------------------------
function Current_Source_File_Stamp return Time_Stamp_Type is
begin
return Current_Full_Source_Stamp;
end Current_Source_File_Stamp;
----------------------------
-- Dir_In_Obj_Search_Path --
----------------------------
function Dir_In_Obj_Search_Path (Position : Natural) return String_Ptr is
begin
if Opt.Look_In_Primary_Dir then
return
Lib_Search_Directories.Table (Primary_Directory + Position - 1);
else
return Lib_Search_Directories.Table (Primary_Directory + Position);
end if;
end Dir_In_Obj_Search_Path;
----------------------------
-- Dir_In_Src_Search_Path --
----------------------------
function Dir_In_Src_Search_Path (Position : Natural) return String_Ptr is
begin
if Opt.Look_In_Primary_Dir then
return
Src_Search_Directories.Table (Primary_Directory + Position - 1);
else
return Src_Search_Directories.Table (Primary_Directory + Position);
end if;
end Dir_In_Src_Search_Path;
---------------------
-- Executable_Name --
---------------------
function Executable_Name (Name : File_Name_Type) return File_Name_Type is
Exec_Suffix : String_Access;
begin
if Name = No_File then
return No_File;
end if;
Get_Name_String (Name);
Exec_Suffix := Get_Executable_Suffix;
for J in Exec_Suffix'Range loop
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := Exec_Suffix (J);
end loop;
Free (Exec_Suffix);
return Name_Enter;
end Executable_Name;
-----------------------
-- Executable_Prefix --
-----------------------
function Executable_Prefix return String_Ptr is
function Get_Install_Dir (Exec : String) return String_Ptr;
-- S is the executable name preceeded by the absolute or relative
-- path, e.g. "c:\usr\bin\gcc.exe" or "..\bin\gcc".
---------------------
-- Get_Install_Dir --
---------------------
function Get_Install_Dir (Exec : String) return String_Ptr is
begin
for J in reverse Exec'Range loop
if Is_Directory_Separator (Exec (J)) then
if J < Exec'Last - 5 then
if (To_Lower (Exec (J + 1)) = 'l'
and then To_Lower (Exec (J + 2)) = 'i'
and then To_Lower (Exec (J + 3)) = 'b')
or else
(To_Lower (Exec (J + 1)) = 'b'
and then To_Lower (Exec (J + 2)) = 'i'
and then To_Lower (Exec (J + 3)) = 'n')
then
return new String'(Exec (Exec'First .. J));
end if;
end if;
end if;
end loop;
return new String'("");
end Get_Install_Dir;
-- Start of processing for Executable_Prefix
begin
if Exec_Name = null then
Exec_Name := new String (1 .. Len_Arg (0));
Osint.Fill_Arg (Exec_Name (1)'Address, 0);
end if;
-- First determine if a path prefix was placed in front of the
-- executable name.
for J in reverse Exec_Name'Range loop
if Is_Directory_Separator (Exec_Name (J)) then
return Get_Install_Dir (Exec_Name.all);
end if;
end loop;
-- If we come here, the user has typed the executable name with no
-- directory prefix.
return Get_Install_Dir
(GNAT.OS_Lib.Locate_Exec_On_Path (Exec_Name.all).all);
end Executable_Prefix;
------------------
-- Exit_Program --
------------------
procedure Exit_Program (Exit_Code : Exit_Code_Type) is
begin
-- The program will exit with the following status:
-- 0 if the object file has been generated (with or without warnings)
-- 1 if recompilation was not needed (smart recompilation)
-- 2 if gnat1 has been killed by a signal (detected by GCC)
-- 4 for a fatal error
-- 5 if there were errors
-- 6 if no code has been generated (spec)
-- Note that exit code 3 is not used and must not be used as this is
-- the code returned by a program aborted via C abort() routine on
-- Windows. GCC checks for that case and thinks that the child process
-- has been aborted. This code (exit code 3) used to be the code used
-- for E_No_Code, but E_No_Code was changed to 6 for this reason.
case Exit_Code is
when E_Success => OS_Exit (0);
when E_Warnings => OS_Exit (0);
when E_No_Compile => OS_Exit (1);
when E_Fatal => OS_Exit (4);
when E_Errors => OS_Exit (5);
when E_No_Code => OS_Exit (6);
when E_Abort => OS_Abort;
end case;
end Exit_Program;
----------
-- Fail --
----------
procedure Fail (S1 : String; S2 : String := ""; S3 : String := "") is
begin
-- We use Output in case there is a special output set up.
-- In this case Set_Standard_Error will have no immediate effect.
Set_Standard_Error;
Osint.Write_Program_Name;
Write_Str (": ");
Write_Str (S1);
Write_Str (S2);
Write_Str (S3);
Write_Eol;
Exit_Program (E_Fatal);
end Fail;
---------------
-- File_Hash --
---------------
function File_Hash (F : File_Name_Type) return File_Hash_Num is
begin
return File_Hash_Num (Int (F) rem File_Hash_Num'Range_Length);
end File_Hash;
----------------
-- File_Stamp --
----------------
function File_Stamp (Name : File_Name_Type) return Time_Stamp_Type is
begin
if Name = No_File then
return Empty_Time_Stamp;
end if;
Get_Name_String (Name);
if not Is_Regular_File (Name_Buffer (1 .. Name_Len)) then
return Empty_Time_Stamp;
else
Name_Buffer (Name_Len + 1) := ASCII.NUL;
return OS_Time_To_GNAT_Time (File_Time_Stamp (Name_Buffer));
end if;
end File_Stamp;
---------------
-- Find_File --
---------------
function Find_File
(N : File_Name_Type;
T : File_Type) return File_Name_Type
is
begin
Get_Name_String (N);
declare
File_Name : String renames Name_Buffer (1 .. Name_Len);
File : File_Name_Type := No_File;
Last_Dir : Natural;
begin
-- If we are looking for a config file, look only in the current
-- directory, i.e. return input argument unchanged. Also look
-- only in the current directory if we are looking for a .dg
-- file (happens in -gnatD mode)
if T = Config
or else (Debug_Generated_Code
and then Name_Len > 3
and then
(Name_Buffer (Name_Len - 2 .. Name_Len) = ".dg"
or else
(Hostparm.OpenVMS and then
Name_Buffer (Name_Len - 2 .. Name_Len) = "_dg")))
then
return N;
-- If we are trying to find the current main file just look in the
-- directory where the user said it was.
elsif Look_In_Primary_Directory_For_Current_Main
and then Current_Main = N
then
return Locate_File (N, T, Primary_Directory, File_Name);
-- Otherwise do standard search for source file
else
-- Check the mapping of this file name
File := Mapped_Path_Name (N);
-- If the file name is mapped to a path name, return the
-- corresponding path name
if File /= No_File then
-- For locally removed file, Error_Name is returned; then
-- return No_File, indicating the file is not a source.
if File = Error_Name then
return No_File;
else
return File;
end if;
end if;
-- First place to look is in the primary directory (i.e. the same
-- directory as the source) unless this has been disabled with -I-
if Opt.Look_In_Primary_Dir then
File := Locate_File (N, T, Primary_Directory, File_Name);
if File /= No_File then
return File;
end if;
end if;
-- Finally look in directories specified with switches -I/-aI/-aO
if T = Library then
Last_Dir := Lib_Search_Directories.Last;
else
Last_Dir := Src_Search_Directories.Last;
end if;
for D in Primary_Directory + 1 .. Last_Dir loop
File := Locate_File (N, T, D, File_Name);
if File /= No_File then
return File;
end if;
end loop;
return No_File;
end if;
end;
end Find_File;
-----------------------
-- Find_Program_Name --
-----------------------
procedure Find_Program_Name is
Command_Name : String (1 .. Len_Arg (0));
Cindex1 : Integer := Command_Name'First;
Cindex2 : Integer := Command_Name'Last;
begin
Fill_Arg (Command_Name'Address, 0);
-- The program name might be specified by a full path name. However,
-- we don't want to print that all out in an error message, so the
-- path might need to be stripped away.
for J in reverse Cindex1 .. Cindex2 loop
if Is_Directory_Separator (Command_Name (J)) then
Cindex1 := J + 1;
exit;
end if;
end loop;
-- Command_Name(Cindex1 .. Cindex2) is now the equivalent of the
-- POSIX command "basename argv[0]"
-- Strip off any versioning information such as found on VMS.
-- This would take the form of TOOL.exe followed by a ";" or "."
-- and a sequence of one or more numbers.
if Command_Name (Cindex2) in '0' .. '9' then
for J in reverse Cindex1 .. Cindex2 loop
if Command_Name (J) = '.' or Command_Name (J) = ';' then
Cindex2 := J - 1;
exit;
end if;
exit when Command_Name (J) not in '0' .. '9';
end loop;
end if;
-- Strip off any executable extension (usually nothing or .exe)
-- but formally reported by autoconf in the variable EXEEXT
if Cindex2 - Cindex1 >= 4 then
if To_Lower (Command_Name (Cindex2 - 3)) = '.'
and then To_Lower (Command_Name (Cindex2 - 2)) = 'e'
and then To_Lower (Command_Name (Cindex2 - 1)) = 'x'
and then To_Lower (Command_Name (Cindex2)) = 'e'
then
Cindex2 := Cindex2 - 4;
end if;
end if;
Name_Len := Cindex2 - Cindex1 + 1;
Name_Buffer (1 .. Name_Len) := Command_Name (Cindex1 .. Cindex2);
end Find_Program_Name;
------------------------
-- Full_Lib_File_Name --
------------------------
function Full_Lib_File_Name (N : File_Name_Type) return File_Name_Type is
begin
return Find_File (N, Library);
end Full_Lib_File_Name;
----------------------------
-- Full_Library_Info_Name --
----------------------------
function Full_Library_Info_Name return File_Name_Type is
begin
return Current_Full_Lib_Name;
end Full_Library_Info_Name;
---------------------------
-- Full_Object_File_Name --
---------------------------
function Full_Object_File_Name return File_Name_Type is
begin
return Current_Full_Obj_Name;
end Full_Object_File_Name;
----------------------
-- Full_Source_Name --
----------------------
function Full_Source_Name return File_Name_Type is
begin
return Current_Full_Source_Name;
end Full_Source_Name;
----------------------
-- Full_Source_Name --
----------------------
function Full_Source_Name (N : File_Name_Type) return File_Name_Type is
begin
return Smart_Find_File (N, Source);
end Full_Source_Name;
-------------------
-- Get_Directory --
-------------------
function Get_Directory (Name : File_Name_Type) return File_Name_Type is
begin
Get_Name_String (Name);
for J in reverse 1 .. Name_Len loop
if Is_Directory_Separator (Name_Buffer (J)) then
Name_Len := J;
return Name_Find;
end if;
end loop;
Name_Len := Hostparm.Normalized_CWD'Length;
Name_Buffer (1 .. Name_Len) := Hostparm.Normalized_CWD;
return Name_Find;
end Get_Directory;
--------------------------
-- Get_Next_Dir_In_Path --
--------------------------
Search_Path_Pos : Integer;
-- Keeps track of current position in search path. Initialized by the
-- call to Get_Next_Dir_In_Path_Init, updated by Get_Next_Dir_In_Path.
function Get_Next_Dir_In_Path
(Search_Path : String_Access) return String_Access
is
Lower_Bound : Positive := Search_Path_Pos;
Upper_Bound : Positive;
begin
loop
while Lower_Bound <= Search_Path'Last
and then Search_Path.all (Lower_Bound) = Path_Separator
loop
Lower_Bound := Lower_Bound + 1;
end loop;
exit when Lower_Bound > Search_Path'Last;
Upper_Bound := Lower_Bound;
while Upper_Bound <= Search_Path'Last
and then Search_Path.all (Upper_Bound) /= Path_Separator
loop
Upper_Bound := Upper_Bound + 1;
end loop;
Search_Path_Pos := Upper_Bound;
return new String'(Search_Path.all (Lower_Bound .. Upper_Bound - 1));
end loop;
return null;
end Get_Next_Dir_In_Path;
-------------------------------
-- Get_Next_Dir_In_Path_Init --
-------------------------------
procedure Get_Next_Dir_In_Path_Init (Search_Path : String_Access) is
begin
Search_Path_Pos := Search_Path'First;
end Get_Next_Dir_In_Path_Init;
--------------------------------------
-- Get_Primary_Src_Search_Directory --
--------------------------------------
function Get_Primary_Src_Search_Directory return String_Ptr is
begin
return Src_Search_Directories.Table (Primary_Directory);
end Get_Primary_Src_Search_Directory;
------------------------
-- Get_RTS_Search_Dir --
------------------------
function Get_RTS_Search_Dir
(Search_Dir : String;
File_Type : Search_File_Type) return String_Ptr
is
procedure Get_Current_Dir
(Dir : System.Address;
Length : System.Address);
pragma Import (C, Get_Current_Dir, "__gnat_get_current_dir");
Max_Path : Integer;
pragma Import (C, Max_Path, "__gnat_max_path_len");
-- Maximum length of a path name
Current_Dir : String_Ptr;
Default_Search_Dir : String_Access;
Default_Suffix_Dir : String_Access;
Local_Search_Dir : String_Access;
Norm_Search_Dir : String_Access;
Result_Search_Dir : String_Access;
Search_File : String_Access;
Temp_String : String_Ptr;
begin
-- Add a directory separator at the end of the directory if necessary
-- so that we can directly append a file to the directory
if Search_Dir (Search_Dir'Last) /= Directory_Separator then
Local_Search_Dir := new String'
(Concat (Search_Dir, String'(1 => Directory_Separator)));
else
Local_Search_Dir := new String'(Search_Dir);
end if;
if File_Type = Include then
Search_File := Include_Search_File;
Default_Suffix_Dir := new String'("adainclude");
else
Search_File := Objects_Search_File;
Default_Suffix_Dir := new String'("adalib");
end if;
Norm_Search_Dir := To_Canonical_Path_Spec (Local_Search_Dir.all);
if Is_Absolute_Path (Norm_Search_Dir.all) then
-- We first verify if there is a directory Include_Search_Dir
-- containing default search directories
Result_Search_Dir
:= Read_Default_Search_Dirs (Norm_Search_Dir,
Search_File,
null);
Default_Search_Dir := new String'
(Concat (Norm_Search_Dir.all, Default_Suffix_Dir.all));
Free (Norm_Search_Dir);
if Result_Search_Dir /= null then
return String_Ptr (Result_Search_Dir);
elsif Is_Directory (Default_Search_Dir.all) then
return String_Ptr (Default_Search_Dir);
else
return null;
end if;
-- Search in the current directory
else
-- Get the current directory
declare
Buffer : String (1 .. Max_Path + 2);
Path_Len : Natural := Max_Path;
begin
Get_Current_Dir (Buffer'Address, Path_Len'Address);
if Buffer (Path_Len) /= Directory_Separator then
Path_Len := Path_Len + 1;
Buffer (Path_Len) := Directory_Separator;
end if;
Current_Dir := new String'(Buffer (1 .. Path_Len));
end;
Norm_Search_Dir :=
new String'(Concat (Current_Dir.all, Local_Search_Dir.all));
Result_Search_Dir :=
Read_Default_Search_Dirs (Norm_Search_Dir, Search_File, null);
Default_Search_Dir :=
new String'
(Concat (Norm_Search_Dir.all, Default_Suffix_Dir.all));
Free (Norm_Search_Dir);
if Result_Search_Dir /= null then
return String_Ptr (Result_Search_Dir);
elsif Is_Directory (Default_Search_Dir.all) then
return String_Ptr (Default_Search_Dir);
else
-- Search in Search_Dir_Prefix/Search_Dir
Norm_Search_Dir :=
new String'
(Concat (Update_Path (Search_Dir_Prefix).all,
Local_Search_Dir.all));
Result_Search_Dir :=
Read_Default_Search_Dirs (Norm_Search_Dir, Search_File, null);
Default_Search_Dir :=
new String'
(Concat (Norm_Search_Dir.all, Default_Suffix_Dir.all));
Free (Norm_Search_Dir);
if Result_Search_Dir /= null then
return String_Ptr (Result_Search_Dir);
elsif Is_Directory (Default_Search_Dir.all) then
return String_Ptr (Default_Search_Dir);
else
-- We finally search in Search_Dir_Prefix/rts-Search_Dir
Temp_String :=
new String'
(Concat (Update_Path (Search_Dir_Prefix).all, "rts-"));
Norm_Search_Dir :=
new String'(Concat (Temp_String.all, Local_Search_Dir.all));
Result_Search_Dir :=
Read_Default_Search_Dirs (Norm_Search_Dir, Search_File, null);
Default_Search_Dir :=
new String'
(Concat (Norm_Search_Dir.all, Default_Suffix_Dir.all));
Free (Norm_Search_Dir);
if Result_Search_Dir /= null then
return String_Ptr (Result_Search_Dir);
elsif Is_Directory (Default_Search_Dir.all) then
return String_Ptr (Default_Search_Dir);
else
return null;
end if;
end if;
end if;
end if;
end Get_RTS_Search_Dir;
--------------------------------
-- Include_Dir_Default_Prefix --
--------------------------------
function Include_Dir_Default_Prefix return String is
Include_Dir : String_Access :=
String_Access (Update_Path (Include_Dir_Default_Name));
begin
if Include_Dir = null then
return "";
else
declare
Result : constant String := Include_Dir.all;
begin
Free (Include_Dir);
return Result;
end;
end if;
end Include_Dir_Default_Prefix;
----------------
-- Initialize --
----------------
procedure Initialize is
begin
Number_File_Names := 0;
Current_File_Name_Index := 0;
Src_Search_Directories.Init;
Lib_Search_Directories.Init;
-- Start off by setting all suppress options to False, these will
-- be reset later (turning some on if -gnato is not specified, and
-- turning all of them on if -gnatp is specified).
Suppress_Options := (others => False);
-- Reserve the first slot in the search paths table. This is the
-- directory of the main source file or main library file and is
-- filled in by each call to Next_Main_Source/Next_Main_Lib_File with
-- the directory specified for this main source or library file. This
-- is the directory which is searched first by default. This default
-- search is inhibited by the option -I- for both source and library
-- files.
Src_Search_Directories.Set_Last (Primary_Directory);
Src_Search_Directories.Table (Primary_Directory) := new String'("");
Lib_Search_Directories.Set_Last (Primary_Directory);
Lib_Search_Directories.Table (Primary_Directory) := new String'("");
end Initialize;
----------------------------
-- Is_Directory_Separator --
----------------------------
function Is_Directory_Separator (C : Character) return Boolean is
begin
-- In addition to the default directory_separator allow the '/' to
-- act as separator since this is allowed in MS-DOS, Windows 95/NT,
-- and OS2 ports. On VMS, the situation is more complicated because
-- there are two characters to check for.
return
C = Directory_Separator
or else C = '/'
or else (Hostparm.OpenVMS
and then (C = ']' or else C = ':'));
end Is_Directory_Separator;
-------------------------
-- Is_Readonly_Library --
-------------------------
function Is_Readonly_Library (File : File_Name_Type) return Boolean is
begin
Get_Name_String (File);
pragma Assert (Name_Buffer (Name_Len - 3 .. Name_Len) = ".ali");
return not Is_Writable_File (Name_Buffer (1 .. Name_Len));
end Is_Readonly_Library;
-------------------
-- Lib_File_Name --
-------------------
function Lib_File_Name
(Source_File : File_Name_Type;
Munit_Index : Nat := 0) return File_Name_Type
is
begin
Get_Name_String (Source_File);
for J in reverse 2 .. Name_Len loop
if Name_Buffer (J) = '.' then
Name_Len := J - 1;
exit;
end if;
end loop;
if Munit_Index /= 0 then
Add_Char_To_Name_Buffer (Multi_Unit_Index_Character);
Add_Nat_To_Name_Buffer (Munit_Index);
end if;
Add_Char_To_Name_Buffer ('.');
Add_Str_To_Name_Buffer (ALI_Suffix.all);
return Name_Find;
end Lib_File_Name;
------------------------
-- Library_File_Stamp --
------------------------
function Library_File_Stamp (N : File_Name_Type) return Time_Stamp_Type is
begin
return File_Stamp (Find_File (N, Library));
end Library_File_Stamp;
-----------------
-- Locate_File --
-----------------
function Locate_File
(N : File_Name_Type;
T : File_Type;
Dir : Natural;
Name : String) return File_Name_Type
is
Dir_Name : String_Ptr;
begin
-- If Name is already an absolute path, do not look for a directory
if Is_Absolute_Path (Name) then
Dir_Name := No_Dir;
elsif T = Library then
Dir_Name := Lib_Search_Directories.Table (Dir);
else pragma Assert (T /= Config);
Dir_Name := Src_Search_Directories.Table (Dir);
end if;
declare
Full_Name : String (1 .. Dir_Name'Length + Name'Length);
begin
Full_Name (1 .. Dir_Name'Length) := Dir_Name.all;
Full_Name (Dir_Name'Length + 1 .. Full_Name'Length) := Name;
if not Is_Regular_File (Full_Name) then
return No_File;
else
-- If the file is in the current directory then return N itself
if Dir_Name'Length = 0 then
return N;
else
Name_Len := Full_Name'Length;
Name_Buffer (1 .. Name_Len) := Full_Name;
return Name_Enter;
end if;
end if;
end;
end Locate_File;
-------------------------------
-- Matching_Full_Source_Name --
-------------------------------
function Matching_Full_Source_Name
(N : File_Name_Type;
T : Time_Stamp_Type) return File_Name_Type
is
begin
Get_Name_String (N);
declare
File_Name : constant String := Name_Buffer (1 .. Name_Len);
File : File_Name_Type := No_File;
Last_Dir : Natural;
begin
if Opt.Look_In_Primary_Dir then
File := Locate_File (N, Source, Primary_Directory, File_Name);
if File /= No_File and then T = File_Stamp (N) then
return File;
end if;
end if;
Last_Dir := Src_Search_Directories.Last;
for D in Primary_Directory + 1 .. Last_Dir loop
File := Locate_File (N, Source, D, File_Name);
if File /= No_File and then T = File_Stamp (File) then
return File;
end if;
end loop;
return No_File;
end;
end Matching_Full_Source_Name;
----------------
-- More_Files --
----------------
function More_Files return Boolean is
begin
return (Current_File_Name_Index < Number_File_Names);
end More_Files;
-------------------------------
-- Nb_Dir_In_Obj_Search_Path --
-------------------------------
function Nb_Dir_In_Obj_Search_Path return Natural is
begin
if Opt.Look_In_Primary_Dir then
return Lib_Search_Directories.Last - Primary_Directory + 1;
else
return Lib_Search_Directories.Last - Primary_Directory;
end if;
end Nb_Dir_In_Obj_Search_Path;
-------------------------------
-- Nb_Dir_In_Src_Search_Path --
-------------------------------
function Nb_Dir_In_Src_Search_Path return Natural is
begin
if Opt.Look_In_Primary_Dir then
return Src_Search_Directories.Last - Primary_Directory + 1;
else
return Src_Search_Directories.Last - Primary_Directory;
end if;
end Nb_Dir_In_Src_Search_Path;
--------------------
-- Next_Main_File --
--------------------
function Next_Main_File return File_Name_Type is
File_Name : String_Ptr;
Dir_Name : String_Ptr;
Fptr : Natural;
begin
pragma Assert (More_Files);
Current_File_Name_Index := Current_File_Name_Index + 1;
-- Get the file and directory name
File_Name := File_Names (Current_File_Name_Index);
Fptr := File_Name'First;
for J in reverse File_Name'Range loop
if File_Name (J) = Directory_Separator
or else File_Name (J) = '/'
then
if J = File_Name'Last then
Fail ("File name missing");
end if;
Fptr := J + 1;
exit;
end if;
end loop;
-- Save name of directory in which main unit resides for use in
-- locating other units
Dir_Name := new String'(File_Name (File_Name'First .. Fptr - 1));
case Running_Program is
when Compiler =>
Src_Search_Directories.Table (Primary_Directory) := Dir_Name;
Look_In_Primary_Directory_For_Current_Main := True;
when Make =>
Src_Search_Directories.Table (Primary_Directory) := Dir_Name;
if Fptr > File_Name'First then
Look_In_Primary_Directory_For_Current_Main := True;
end if;
when Binder | Gnatls =>
Dir_Name := Normalize_Directory_Name (Dir_Name.all);
Lib_Search_Directories.Table (Primary_Directory) := Dir_Name;
when Unspecified =>
null;
end case;
Name_Len := File_Name'Last - Fptr + 1;
Name_Buffer (1 .. Name_Len) := File_Name (Fptr .. File_Name'Last);
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Current_Main := File_Name_Type (Name_Find);
-- In the gnatmake case, the main file may have not have the
-- extension. Try ".adb" first then ".ads"
if Running_Program = Make then
declare
Orig_Main : constant File_Name_Type := Current_Main;
begin
if Strip_Suffix (Orig_Main) = Orig_Main then
Current_Main := Append_Suffix_To_File_Name (Orig_Main, ".adb");
if Full_Source_Name (Current_Main) = No_File then
Current_Main :=
Append_Suffix_To_File_Name (Orig_Main, ".ads");
if Full_Source_Name (Current_Main) = No_File then
Current_Main := Orig_Main;
end if;
end if;
end if;
end;
end if;
return Current_Main;
end Next_Main_File;
------------------------------
-- Normalize_Directory_Name --
------------------------------
function Normalize_Directory_Name (Directory : String) return String_Ptr is
function Is_Quoted (Path : String) return Boolean;
pragma Inline (Is_Quoted);
-- Returns true if Path is quoted (either double or single quotes)
---------------
-- Is_Quoted --
---------------
function Is_Quoted (Path : String) return Boolean is
First : constant Character := Path (Path'First);
Last : constant Character := Path (Path'Last);
begin
if (First = ''' and then Last = ''')
or else
(First = '"' and then Last = '"')
then
return True;
else
return False;
end if;
end Is_Quoted;
Result : String_Ptr;
-- Start of processing for Normalize_Directory_Name
begin
if Directory'Length = 0 then
Result := new String'(Hostparm.Normalized_CWD);
elsif Is_Directory_Separator (Directory (Directory'Last)) then
Result := new String'(Directory);
elsif Is_Quoted (Directory) then
-- This is a quoted string, it certainly means that the directory
-- contains some spaces for example. We can safely remove the quotes
-- here as the OS_Lib.Normalize_Arguments will be called before any
-- spawn routines. This ensure that quotes will be added when needed.
Result := new String (1 .. Directory'Length - 1);
Result (1 .. Directory'Length - 1) :=
Directory (Directory'First + 1 .. Directory'Last - 1);
Result (Result'Last) := Directory_Separator;
else
Result := new String (1 .. Directory'Length + 1);
Result (1 .. Directory'Length) := Directory;
Result (Directory'Length + 1) := Directory_Separator;
end if;
return Result;
end Normalize_Directory_Name;
---------------------
-- Number_Of_Files --
---------------------
function Number_Of_Files return Int is
begin
return Number_File_Names;
end Number_Of_Files;
-------------------------------
-- Object_Dir_Default_Prefix --
-------------------------------
function Object_Dir_Default_Prefix return String is
Object_Dir : String_Access :=
String_Access (Update_Path (Object_Dir_Default_Name));
begin
if Object_Dir = null then
return "";
else
declare
Result : constant String := Object_Dir.all;
begin
Free (Object_Dir);
return Result;
end;
end if;
end Object_Dir_Default_Prefix;
----------------------
-- Object_File_Name --
----------------------
function Object_File_Name (N : File_Name_Type) return File_Name_Type is
begin
if N = No_File then
return No_File;
end if;
Get_Name_String (N);
Name_Len := Name_Len - ALI_Suffix'Length - 1;
for J in Target_Object_Suffix'Range loop
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := Target_Object_Suffix (J);
end loop;
return Name_Enter;
end Object_File_Name;
--------------------------
-- OS_Time_To_GNAT_Time --
--------------------------
function OS_Time_To_GNAT_Time (T : OS_Time) return Time_Stamp_Type is
GNAT_Time : Time_Stamp_Type;
Y : Year_Type;
Mo : Month_Type;
D : Day_Type;
H : Hour_Type;
Mn : Minute_Type;
S : Second_Type;
begin
GM_Split (T, Y, Mo, D, H, Mn, S);
Make_Time_Stamp
(Year => Nat (Y),
Month => Nat (Mo),
Day => Nat (D),
Hour => Nat (H),
Minutes => Nat (Mn),
Seconds => Nat (S),
TS => GNAT_Time);
return GNAT_Time;
end OS_Time_To_GNAT_Time;
------------------
-- Program_Name --
------------------
function Program_Name (Nam : String) return String_Access is
Res : String_Access;
begin
-- Get the name of the current program being executed
Find_Program_Name;
-- Find the target prefix if any, for the cross compilation case
-- for instance in "alpha-dec-vxworks-gcc" the target prefix is
-- "alpha-dec-vxworks-"
while Name_Len > 0 loop
-- All done if we find the last hyphen
if Name_Buffer (Name_Len) = '-' then
exit;
-- If directory separator found, we don't want to look further
-- since in this case, no prefix has been found.
elsif Is_Directory_Separator (Name_Buffer (Name_Len)) then
Name_Len := 0;
exit;
end if;
Name_Len := Name_Len - 1;
end loop;
-- Create the new program name
Res := new String (1 .. Name_Len + Nam'Length);
Res.all (1 .. Name_Len) := Name_Buffer (1 .. Name_Len);
Res.all (Name_Len + 1 .. Name_Len + Nam'Length) := Nam;
return Res;
end Program_Name;
------------------------------
-- Read_Default_Search_Dirs --
------------------------------
function Read_Default_Search_Dirs
(Search_Dir_Prefix : String_Access;
Search_File : String_Access;
Search_Dir_Default_Name : String_Access) return String_Access
is
Prefix_Len : constant Integer := Search_Dir_Prefix.all'Length;
Buffer : String (1 .. Prefix_Len + Search_File.all'Length + 1);
File_FD : File_Descriptor;
S, S1 : String_Access;
Len : Integer;
Curr : Integer;
Actual_Len : Integer;
J1 : Integer;
Prev_Was_Separator : Boolean;
Nb_Relative_Dir : Integer;
function Is_Relative (S : String; K : Positive) return Boolean;
pragma Inline (Is_Relative);
-- Returns True if a relative directory specification is found
-- in S at position K, False otherwise.
-----------------
-- Is_Relative --
-----------------
function Is_Relative (S : String; K : Positive) return Boolean is
begin
return not Is_Absolute_Path (S (K .. S'Last));
end Is_Relative;
-- Start of processing for Read_Default_Search_Dirs
begin
-- Construct a C compatible character string buffer
Buffer (1 .. Search_Dir_Prefix.all'Length)
:= Search_Dir_Prefix.all;
Buffer (Search_Dir_Prefix.all'Length + 1 .. Buffer'Last - 1)
:= Search_File.all;
Buffer (Buffer'Last) := ASCII.NUL;
File_FD := Open_Read (Buffer'Address, Binary);
if File_FD = Invalid_FD then
return Search_Dir_Default_Name;
end if;
Len := Integer (File_Length (File_FD));
-- An extra character for a trailing Path_Separator is allocated
S := new String (1 .. Len + 1);
S (Len + 1) := Path_Separator;
-- Read the file. Note that the loop is not necessary since the
-- whole file is read at once except on VMS.
Curr := 1;
Actual_Len := Len;
while Actual_Len /= 0 loop
Actual_Len := Read (File_FD, S (Curr)'Address, Len);
Curr := Curr + Actual_Len;
end loop;
-- Process the file, translating line and file ending
-- control characters to a path separator character.
Prev_Was_Separator := True;
Nb_Relative_Dir := 0;
for J in 1 .. Len loop
if S (J) in ASCII.NUL .. ASCII.US
or else S (J) = ' '
then
S (J) := Path_Separator;
end if;
if S (J) = Path_Separator then
Prev_Was_Separator := True;
else
if Prev_Was_Separator and then Is_Relative (S.all, J) then
Nb_Relative_Dir := Nb_Relative_Dir + 1;
end if;
Prev_Was_Separator := False;
end if;
end loop;
if Nb_Relative_Dir = 0 then
return S;
end if;
-- Add the Search_Dir_Prefix to all relative paths
S1 := new String (1 .. S'Length + Nb_Relative_Dir * Prefix_Len);
J1 := 1;
Prev_Was_Separator := True;
for J in 1 .. Len + 1 loop
if S (J) = Path_Separator then
Prev_Was_Separator := True;
else
if Prev_Was_Separator and then Is_Relative (S.all, J) then
S1 (J1 .. J1 + Prefix_Len - 1) := Search_Dir_Prefix.all;
J1 := J1 + Prefix_Len;
end if;
Prev_Was_Separator := False;
end if;
S1 (J1) := S (J);
J1 := J1 + 1;
end loop;
Free (S);
return S1;
end Read_Default_Search_Dirs;
-----------------------
-- Read_Library_Info --
-----------------------
function Read_Library_Info
(Lib_File : File_Name_Type;
Fatal_Err : Boolean := False) return Text_Buffer_Ptr
is
Lib_FD : File_Descriptor;
-- The file descriptor for the current library file. A negative value
-- indicates failure to open the specified source file.
Text : Text_Buffer_Ptr;
-- Allocated text buffer
Status : Boolean;
-- For the calls to Close
begin
Current_Full_Lib_Name := Find_File (Lib_File, Library);
Current_Full_Obj_Name := Object_File_Name (Current_Full_Lib_Name);
if Current_Full_Lib_Name = No_File then
if Fatal_Err then
Fail ("Cannot find: ", Name_Buffer (1 .. Name_Len));
else
Current_Full_Obj_Stamp := Empty_Time_Stamp;
return null;
end if;
end if;
Get_Name_String (Current_Full_Lib_Name);
Name_Buffer (Name_Len + 1) := ASCII.NUL;
-- Open the library FD, note that we open in binary mode, because as
-- documented in the spec, the caller is expected to handle either
-- DOS or Unix mode files, and there is no point in wasting time on
-- text translation when it is not required.
Lib_FD := Open_Read (Name_Buffer'Address, Binary);
if Lib_FD = Invalid_FD then
if Fatal_Err then
Fail ("Cannot open: ", Name_Buffer (1 .. Name_Len));
else
Current_Full_Obj_Stamp := Empty_Time_Stamp;
return null;
end if;
end if;
-- Check for object file consistency if requested
if Opt.Check_Object_Consistency then
Current_Full_Lib_Stamp := File_Stamp (Current_Full_Lib_Name);
Current_Full_Obj_Stamp := File_Stamp (Current_Full_Obj_Name);
if Current_Full_Obj_Stamp (1) = ' ' then
-- When the library is readonly, always assume that
-- the object is consistent.
if Is_Readonly_Library (Current_Full_Lib_Name) then
Current_Full_Obj_Stamp := Current_Full_Lib_Stamp;
elsif Fatal_Err then
Get_Name_String (Current_Full_Obj_Name);
Close (Lib_FD, Status);
-- No need to check the status, we fail anyway
Fail ("Cannot find: ", Name_Buffer (1 .. Name_Len));
else
Current_Full_Obj_Stamp := Empty_Time_Stamp;
Close (Lib_FD, Status);
-- No need to check the status, we return null anyway
return null;
end if;
end if;
end if;
-- Read data from the file
declare
Len : constant Integer := Integer (File_Length (Lib_FD));
-- Length of source file text. If it doesn't fit in an integer
-- we're probably stuck anyway (>2 gigs of source seems a lot!)
Actual_Len : Integer := 0;
Lo : constant Text_Ptr := 0;
-- Low bound for allocated text buffer
Hi : Text_Ptr := Text_Ptr (Len);
-- High bound for allocated text buffer. Note length is Len + 1
-- which allows for extra EOF character at the end of the buffer.
begin
-- Allocate text buffer. Note extra character at end for EOF
Text := new Text_Buffer (Lo .. Hi);
-- Some systems (e.g. VMS) have file types that require one
-- read per line, so read until we get the Len bytes or until
-- there are no more characters.
Hi := Lo;
loop
Actual_Len := Read (Lib_FD, Text (Hi)'Address, Len);
Hi := Hi + Text_Ptr (Actual_Len);
exit when Actual_Len = Len or Actual_Len <= 0;
end loop;
Text (Hi) := EOF;
end;
-- Read is complete, close file and we are done
Close (Lib_FD, Status);
-- The status should never be False. But, if it is, what can we do?
-- So, we don't test it.
return Text;
end Read_Library_Info;
----------------------
-- Read_Source_File --
----------------------
procedure Read_Source_File
(N : File_Name_Type;
Lo : Source_Ptr;
Hi : out Source_Ptr;
Src : out Source_Buffer_Ptr;
T : File_Type := Source)
is
Source_File_FD : File_Descriptor;
-- The file descriptor for the current source file. A negative value
-- indicates failure to open the specified source file.
Len : Integer;
-- Length of file. Assume no more than 2 gigabytes of source!
Actual_Len : Integer;
Status : Boolean;
-- For the call to Close
-- LLVM local
pragma Warnings (Off, Status);
begin
Current_Full_Source_Name := Find_File (N, T);
Current_Full_Source_Stamp := File_Stamp (Current_Full_Source_Name);
if Current_Full_Source_Name = No_File then
-- If we were trying to access the main file and we could not
-- find it we have an error.
if N = Current_Main then
Get_Name_String (N);
Fail ("Cannot find: ", Name_Buffer (1 .. Name_Len));
end if;
Src := null;
Hi := No_Location;
return;
end if;
Get_Name_String (Current_Full_Source_Name);
Name_Buffer (Name_Len + 1) := ASCII.NUL;
-- Open the source FD, note that we open in binary mode, because as
-- documented in the spec, the caller is expected to handle either
-- DOS or Unix mode files, and there is no point in wasting time on
-- text translation when it is not required.
Source_File_FD := Open_Read (Name_Buffer'Address, Binary);
if Source_File_FD = Invalid_FD then
Src := null;
Hi := No_Location;
return;
end if;
-- Prepare to read data from the file
Len := Integer (File_Length (Source_File_FD));
-- Set Hi so that length is one more than the physical length,
-- allowing for the extra EOF character at the end of the buffer
Hi := Lo + Source_Ptr (Len);
-- Do the actual read operation
declare
subtype Actual_Source_Buffer is Source_Buffer (Lo .. Hi);
-- Physical buffer allocated
type Actual_Source_Ptr is access Actual_Source_Buffer;
-- This is the pointer type for the physical buffer allocated
Actual_Ptr : constant Actual_Source_Ptr := new Actual_Source_Buffer;
-- And this is the actual physical buffer
begin
-- Allocate source buffer, allowing extra character at end for EOF
-- Some systems (e.g. VMS) have file types that require one
-- read per line, so read until we get the Len bytes or until
-- there are no more characters.
Hi := Lo;
loop
Actual_Len := Read (Source_File_FD, Actual_Ptr (Hi)'Address, Len);
Hi := Hi + Source_Ptr (Actual_Len);
exit when Actual_Len = Len or Actual_Len <= 0;
end loop;
Actual_Ptr (Hi) := EOF;
-- Now we need to work out the proper virtual origin pointer to
-- return. This is exactly Actual_Ptr (0)'Address, but we have
-- to be careful to suppress checks to compute this address.
declare
pragma Suppress (All_Checks);
pragma Warnings (Off);
-- This use of unchecked conversion is aliasing safe
function To_Source_Buffer_Ptr is new
Unchecked_Conversion (Address, Source_Buffer_Ptr);
pragma Warnings (On);
begin
Src := To_Source_Buffer_Ptr (Actual_Ptr (0)'Address);
end;
end;
-- Read is complete, get time stamp and close file and we are done
Close (Source_File_FD, Status);
-- The status should never be False. But, if it is, what can we do?
-- So, we don't test it.
end Read_Source_File;
-------------------
-- Relocate_Path --
-------------------
function Relocate_Path
(Prefix : String;
Path : String) return String_Ptr
is
S : String_Ptr;
procedure set_std_prefix (S : String; Len : Integer);
pragma Import (C, set_std_prefix);
begin
if Std_Prefix = null then
Std_Prefix := Executable_Prefix;
if Std_Prefix.all /= "" then
-- Remove trailing directory separator when calling set_std_prefix
set_std_prefix (Std_Prefix.all, Std_Prefix'Length - 1);
end if;
end if;
if Path (Prefix'Range) = Prefix then
if Std_Prefix.all /= "" then
S := new String
(1 .. Std_Prefix'Length + Path'Last - Prefix'Last);
S (1 .. Std_Prefix'Length) := Std_Prefix.all;
S (Std_Prefix'Length + 1 .. S'Last) :=
Path (Prefix'Last + 1 .. Path'Last);
return S;
end if;
end if;
return new String'(Path);
end Relocate_Path;
-----------------
-- Set_Program --
-----------------
procedure Set_Program (P : Program_Type) is
begin
if Program_Set then
Fail ("Set_Program called twice");
end if;
Program_Set := True;
Running_Program := P;
end Set_Program;
----------------
-- Shared_Lib --
----------------
function Shared_Lib (Name : String) return String is
Library : String (1 .. Name'Length + Library_Version'Length + 3);
-- 3 = 2 for "-l" + 1 for "-" before lib version
begin
Library (1 .. 2) := "-l";
Library (3 .. 2 + Name'Length) := Name;
Library (3 + Name'Length) := '-';
Library (4 + Name'Length .. Library'Last) := Library_Version;
if OpenVMS_On_Target then
for K in Library'First + 2 .. Library'Last loop
if Library (K) = '.' or else Library (K) = '-' then
Library (K) := '_';
end if;
end loop;
end if;
return Library;
end Shared_Lib;
----------------------
-- Smart_File_Stamp --
----------------------
function Smart_File_Stamp
(N : File_Name_Type;
T : File_Type) return Time_Stamp_Type
is
Time_Stamp : Time_Stamp_Type;
begin
if not File_Cache_Enabled then
return File_Stamp (Find_File (N, T));
end if;
Time_Stamp := File_Stamp_Hash_Table.Get (N);
if Time_Stamp (1) = ' ' then
Time_Stamp := File_Stamp (Smart_Find_File (N, T));
File_Stamp_Hash_Table.Set (N, Time_Stamp);
end if;
return Time_Stamp;
end Smart_File_Stamp;
---------------------
-- Smart_Find_File --
---------------------
function Smart_Find_File
(N : File_Name_Type;
T : File_Type) return File_Name_Type
is
Full_File_Name : File_Name_Type;
begin
if not File_Cache_Enabled then
return Find_File (N, T);
end if;
Full_File_Name := File_Name_Hash_Table.Get (N);
if Full_File_Name = No_File then
Full_File_Name := Find_File (N, T);
File_Name_Hash_Table.Set (N, Full_File_Name);
end if;
return Full_File_Name;
end Smart_Find_File;
----------------------
-- Source_File_Data --
----------------------
procedure Source_File_Data (Cache : Boolean) is
begin
File_Cache_Enabled := Cache;
end Source_File_Data;
-----------------------
-- Source_File_Stamp --
-----------------------
function Source_File_Stamp (N : File_Name_Type) return Time_Stamp_Type is
begin
return Smart_File_Stamp (N, Source);
end Source_File_Stamp;
---------------------
-- Strip_Directory --
---------------------
function Strip_Directory (Name : File_Name_Type) return File_Name_Type is
begin
Get_Name_String (Name);
for J in reverse 1 .. Name_Len - 1 loop
-- If we find the last directory separator
if Is_Directory_Separator (Name_Buffer (J)) then
-- Return the part of Name that follows this last directory
-- separator.
Name_Buffer (1 .. Name_Len - J) := Name_Buffer (J + 1 .. Name_Len);
Name_Len := Name_Len - J;
return Name_Find;
end if;
end loop;
-- There were no directory separator, just return Name
return Name;
end Strip_Directory;
------------------
-- Strip_Suffix --
------------------
function Strip_Suffix (Name : File_Name_Type) return File_Name_Type is
begin
Get_Name_String (Name);
for J in reverse 2 .. Name_Len loop
-- If we found the last '.', return part of Name that precedes it
if Name_Buffer (J) = '.' then
Name_Len := J - 1;
return Name_Enter;
end if;
end loop;
return Name;
end Strip_Suffix;
---------------------------
-- To_Canonical_Dir_Spec --
---------------------------
function To_Canonical_Dir_Spec
(Host_Dir : String;
Prefix_Style : Boolean) return String_Access
is
function To_Canonical_Dir_Spec
(Host_Dir : Address;
Prefix_Flag : Integer) return Address;
pragma Import (C, To_Canonical_Dir_Spec, "__gnat_to_canonical_dir_spec");
C_Host_Dir : String (1 .. Host_Dir'Length + 1);
Canonical_Dir_Addr : Address;
Canonical_Dir_Len : Integer;
begin
C_Host_Dir (1 .. Host_Dir'Length) := Host_Dir;
C_Host_Dir (C_Host_Dir'Last) := ASCII.NUL;
if Prefix_Style then
Canonical_Dir_Addr := To_Canonical_Dir_Spec (C_Host_Dir'Address, 1);
else
Canonical_Dir_Addr := To_Canonical_Dir_Spec (C_Host_Dir'Address, 0);
end if;
Canonical_Dir_Len := C_String_Length (Canonical_Dir_Addr);
if Canonical_Dir_Len = 0 then
return null;
else
return To_Path_String_Access (Canonical_Dir_Addr, Canonical_Dir_Len);
end if;
exception
when others =>
Fail ("erroneous directory spec: ", Host_Dir);
return null;
end To_Canonical_Dir_Spec;
---------------------------
-- To_Canonical_File_List --
---------------------------
function To_Canonical_File_List
(Wildcard_Host_File : String;
Only_Dirs : Boolean) return String_Access_List_Access
is
function To_Canonical_File_List_Init
(Host_File : Address;
Only_Dirs : Integer) return Integer;
pragma Import (C, To_Canonical_File_List_Init,
"__gnat_to_canonical_file_list_init");
function To_Canonical_File_List_Next return Address;
pragma Import (C, To_Canonical_File_List_Next,
"__gnat_to_canonical_file_list_next");
procedure To_Canonical_File_List_Free;
pragma Import (C, To_Canonical_File_List_Free,
"__gnat_to_canonical_file_list_free");
Num_Files : Integer;
C_Wildcard_Host_File : String (1 .. Wildcard_Host_File'Length + 1);
begin
C_Wildcard_Host_File (1 .. Wildcard_Host_File'Length) :=
Wildcard_Host_File;
C_Wildcard_Host_File (C_Wildcard_Host_File'Last) := ASCII.NUL;
-- Do the expansion and say how many there are
Num_Files := To_Canonical_File_List_Init
(C_Wildcard_Host_File'Address, Boolean'Pos (Only_Dirs));
declare
Canonical_File_List : String_Access_List (1 .. Num_Files);
Canonical_File_Addr : Address;
Canonical_File_Len : Integer;
begin
-- Retrieve the expanded directoy names and build the list
for J in 1 .. Num_Files loop
Canonical_File_Addr := To_Canonical_File_List_Next;
Canonical_File_Len := C_String_Length (Canonical_File_Addr);
Canonical_File_List (J) := To_Path_String_Access
(Canonical_File_Addr, Canonical_File_Len);
end loop;
-- Free up the storage
To_Canonical_File_List_Free;
return new String_Access_List'(Canonical_File_List);
end;
end To_Canonical_File_List;
----------------------------
-- To_Canonical_File_Spec --
----------------------------
function To_Canonical_File_Spec
(Host_File : String) return String_Access
is
function To_Canonical_File_Spec (Host_File : Address) return Address;
pragma Import
(C, To_Canonical_File_Spec, "__gnat_to_canonical_file_spec");
C_Host_File : String (1 .. Host_File'Length + 1);
Canonical_File_Addr : Address;
Canonical_File_Len : Integer;
begin
C_Host_File (1 .. Host_File'Length) := Host_File;
C_Host_File (C_Host_File'Last) := ASCII.NUL;
Canonical_File_Addr := To_Canonical_File_Spec (C_Host_File'Address);
Canonical_File_Len := C_String_Length (Canonical_File_Addr);
if Canonical_File_Len = 0 then
return null;
else
return To_Path_String_Access
(Canonical_File_Addr, Canonical_File_Len);
end if;
exception
when others =>
Fail ("erroneous file spec: ", Host_File);
return null;
end To_Canonical_File_Spec;
----------------------------
-- To_Canonical_Path_Spec --
----------------------------
function To_Canonical_Path_Spec
(Host_Path : String) return String_Access
is
function To_Canonical_Path_Spec (Host_Path : Address) return Address;
pragma Import
(C, To_Canonical_Path_Spec, "__gnat_to_canonical_path_spec");
C_Host_Path : String (1 .. Host_Path'Length + 1);
Canonical_Path_Addr : Address;
Canonical_Path_Len : Integer;
begin
C_Host_Path (1 .. Host_Path'Length) := Host_Path;
C_Host_Path (C_Host_Path'Last) := ASCII.NUL;
Canonical_Path_Addr := To_Canonical_Path_Spec (C_Host_Path'Address);
Canonical_Path_Len := C_String_Length (Canonical_Path_Addr);
-- Return a null string (vice a null) for zero length paths, for
-- compatibility with getenv().
return To_Path_String_Access (Canonical_Path_Addr, Canonical_Path_Len);
exception
when others =>
Fail ("erroneous path spec: ", Host_Path);
return null;
end To_Canonical_Path_Spec;
---------------------------
-- To_Host_Dir_Spec --
---------------------------
function To_Host_Dir_Spec
(Canonical_Dir : String;
Prefix_Style : Boolean) return String_Access
is
function To_Host_Dir_Spec
(Canonical_Dir : Address;
Prefix_Flag : Integer) return Address;
pragma Import (C, To_Host_Dir_Spec, "__gnat_to_host_dir_spec");
C_Canonical_Dir : String (1 .. Canonical_Dir'Length + 1);
Host_Dir_Addr : Address;
Host_Dir_Len : Integer;
begin
C_Canonical_Dir (1 .. Canonical_Dir'Length) := Canonical_Dir;
C_Canonical_Dir (C_Canonical_Dir'Last) := ASCII.NUL;
if Prefix_Style then
Host_Dir_Addr := To_Host_Dir_Spec (C_Canonical_Dir'Address, 1);
else
Host_Dir_Addr := To_Host_Dir_Spec (C_Canonical_Dir'Address, 0);
end if;
Host_Dir_Len := C_String_Length (Host_Dir_Addr);
if Host_Dir_Len = 0 then
return null;
else
return To_Path_String_Access (Host_Dir_Addr, Host_Dir_Len);
end if;
end To_Host_Dir_Spec;
----------------------------
-- To_Host_File_Spec --
----------------------------
function To_Host_File_Spec
(Canonical_File : String) return String_Access
is
function To_Host_File_Spec (Canonical_File : Address) return Address;
pragma Import (C, To_Host_File_Spec, "__gnat_to_host_file_spec");
C_Canonical_File : String (1 .. Canonical_File'Length + 1);
Host_File_Addr : Address;
Host_File_Len : Integer;
begin
C_Canonical_File (1 .. Canonical_File'Length) := Canonical_File;
C_Canonical_File (C_Canonical_File'Last) := ASCII.NUL;
Host_File_Addr := To_Host_File_Spec (C_Canonical_File'Address);
Host_File_Len := C_String_Length (Host_File_Addr);
if Host_File_Len = 0 then
return null;
else
return To_Path_String_Access
(Host_File_Addr, Host_File_Len);
end if;
end To_Host_File_Spec;
---------------------------
-- To_Path_String_Access --
---------------------------
function To_Path_String_Access
(Path_Addr : Address;
Path_Len : Integer) return String_Access
is
subtype Path_String is String (1 .. Path_Len);
type Path_String_Access is access Path_String;
function Address_To_Access is new
Unchecked_Conversion (Source => Address,
Target => Path_String_Access);
Path_Access : constant Path_String_Access :=
Address_To_Access (Path_Addr);
Return_Val : String_Access;
begin
Return_Val := new String (1 .. Path_Len);
for J in 1 .. Path_Len loop
Return_Val (J) := Path_Access (J);
end loop;
return Return_Val;
end To_Path_String_Access;
-----------------
-- Update_Path --
-----------------
function Update_Path (Path : String_Ptr) return String_Ptr is
function C_Update_Path (Path, Component : Address) return Address;
pragma Import (C, C_Update_Path, "update_path");
function Strlen (Str : Address) return Integer;
pragma Import (C, Strlen, "strlen");
procedure Strncpy (X : Address; Y : Address; Length : Integer);
pragma Import (C, Strncpy, "strncpy");
In_Length : constant Integer := Path'Length;
In_String : String (1 .. In_Length + 1);
Component_Name : aliased String := "GCC" & ASCII.NUL;
Result_Ptr : Address;
Result_Length : Integer;
Out_String : String_Ptr;
begin
In_String (1 .. In_Length) := Path.all;
In_String (In_Length + 1) := ASCII.NUL;
Result_Ptr := C_Update_Path (In_String'Address,
Component_Name'Address);
Result_Length := Strlen (Result_Ptr);
Out_String := new String (1 .. Result_Length);
Strncpy (Out_String.all'Address, Result_Ptr, Result_Length);
return Out_String;
end Update_Path;
----------------
-- Write_Info --
----------------
procedure Write_Info (Info : String) is
begin
Write_With_Check (Info'Address, Info'Length);
Write_With_Check (EOL'Address, 1);
end Write_Info;
------------------------
-- Write_Program_Name --
------------------------
procedure Write_Program_Name is
Save_Buffer : constant String (1 .. Name_Len) :=
Name_Buffer (1 .. Name_Len);
begin
Find_Program_Name;
-- Convert the name to lower case so error messages are the same on
-- all systems.
for J in 1 .. Name_Len loop
if Name_Buffer (J) in 'A' .. 'Z' then
Name_Buffer (J) :=
Character'Val (Character'Pos (Name_Buffer (J)) + 32);
end if;
end loop;
Write_Str (Name_Buffer (1 .. Name_Len));
-- Restore Name_Buffer which was clobbered by the call to
-- Find_Program_Name
Name_Len := Save_Buffer'Last;
Name_Buffer (1 .. Name_Len) := Save_Buffer;
end Write_Program_Name;
----------------------
-- Write_With_Check --
----------------------
procedure Write_With_Check (A : Address; N : Integer) is
Ignore : Boolean;
begin
if N = Write (Output_FD, A, N) then
return;
else
Write_Str ("error: disk full writing ");
Write_Name_Decoded (Output_File_Name);
Write_Eol;
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := ASCII.NUL;
Delete_File (Name_Buffer'Address, Ignore);
Exit_Program (E_Fatal);
end if;
end Write_With_Check;
----------------------------
-- Package Initialization --
----------------------------
begin
Initialization : declare
function Get_Default_Identifier_Character_Set return Character;
pragma Import (C, Get_Default_Identifier_Character_Set,
"__gnat_get_default_identifier_character_set");
-- Function to determine the default identifier character set,
-- which is system dependent. See Opt package spec for a list of
-- the possible character codes and their interpretations.
function Get_Maximum_File_Name_Length return Int;
pragma Import (C, Get_Maximum_File_Name_Length,
"__gnat_get_maximum_file_name_length");
-- Function to get maximum file name length for system
begin
Identifier_Character_Set := Get_Default_Identifier_Character_Set;
Maximum_File_Name_Length := Get_Maximum_File_Name_Length;
-- Following should be removed by having above function return
-- Integer'Last as indication of no maximum instead of -1 ???
if Maximum_File_Name_Length = -1 then
Maximum_File_Name_Length := Int'Last;
end if;
Src_Search_Directories.Set_Last (Primary_Directory);
Src_Search_Directories.Table (Primary_Directory) := new String'("");
Lib_Search_Directories.Set_Last (Primary_Directory);
Lib_Search_Directories.Table (Primary_Directory) := new String'("");
Osint.Initialize;
end Initialization;
end Osint;
|
-- This spec has been automatically generated from STM32F303xE.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.IWDG is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype KR_KEY_Field is STM32_SVD.UInt16;
-- Key register
type KR_Register is record
-- Write-only. Key value
KEY : KR_KEY_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for KR_Register use record
KEY at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype PR_PR_Field is STM32_SVD.UInt3;
-- Prescaler register
type PR_Register is record
-- Prescaler divider
PR : PR_PR_Field := 16#0#;
-- unspecified
Reserved_3_31 : STM32_SVD.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PR_Register use record
PR at 0 range 0 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype RLR_RL_Field is STM32_SVD.UInt12;
-- Reload register
type RLR_Register is record
-- Watchdog counter reload value
RL : RLR_RL_Field := 16#FFF#;
-- unspecified
Reserved_12_31 : STM32_SVD.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RLR_Register use record
RL at 0 range 0 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
subtype SR_PVU_Field is STM32_SVD.Bit;
subtype SR_RVU_Field is STM32_SVD.Bit;
subtype SR_WVU_Field is STM32_SVD.Bit;
-- Status register
type SR_Register is record
-- Read-only. Watchdog prescaler value update
PVU : SR_PVU_Field;
-- Read-only. Watchdog counter reload value update
RVU : SR_RVU_Field;
-- Read-only. Watchdog counter window value update
WVU : SR_WVU_Field;
-- unspecified
Reserved_3_31 : STM32_SVD.UInt29;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
PVU at 0 range 0 .. 0;
RVU at 0 range 1 .. 1;
WVU at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype WINR_WIN_Field is STM32_SVD.UInt12;
-- Window register
type WINR_Register is record
-- Watchdog counter window value
WIN : WINR_WIN_Field := 16#FFF#;
-- unspecified
Reserved_12_31 : STM32_SVD.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for WINR_Register use record
WIN at 0 range 0 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Independent watchdog
type IWDG_Peripheral is record
-- Key register
KR : aliased KR_Register;
-- Prescaler register
PR : aliased PR_Register;
-- Reload register
RLR : aliased RLR_Register;
-- Status register
SR : aliased SR_Register;
-- Window register
WINR : aliased WINR_Register;
end record
with Volatile;
for IWDG_Peripheral use record
KR at 16#0# range 0 .. 31;
PR at 16#4# range 0 .. 31;
RLR at 16#8# range 0 .. 31;
SR at 16#C# range 0 .. 31;
WINR at 16#10# range 0 .. 31;
end record;
-- Independent watchdog
IWDG_Periph : aliased IWDG_Peripheral
with Import, Address => System'To_Address (16#40003000#);
end STM32_SVD.IWDG;
|
-- with i.physics.Object;
-- with i.physics.Joint;
with ada.strings.unbounded;
package physics.Motor is
type Item is abstract tagged
record
Name : ada.strings.unbounded.unbounded_String;
is_Enabled : Boolean := False;
end record;
procedure update (Self : in out Item) is abstract;
-- class Motor
-- {
-- public:
--
-- /// Returns true if this Motor depends on the given Solid.
-- virtual bool internal_dependsOnSolid(Solid* s);
--
-- /// Returns true if this Motor depends on the given Joint.
-- virtual bool internal_dependsOnJoint(Joint* j);
-- }
--
-- #endif
procedure dummy;
end physics.Motor;
|
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Definitions;
with Program.Element_Vectors;
with Program.Lexical_Elements;
with Program.Elements.Identifiers;
package Program.Elements.Task_Definitions is
pragma Pure (Program.Elements.Task_Definitions);
type Task_Definition is
limited interface and Program.Elements.Definitions.Definition;
type Task_Definition_Access is access all Task_Definition'Class
with Storage_Size => 0;
not overriding function Visible_Declarations
(Self : Task_Definition)
return Program.Element_Vectors.Element_Vector_Access is abstract;
not overriding function Private_Declarations
(Self : Task_Definition)
return Program.Element_Vectors.Element_Vector_Access is abstract;
not overriding function End_Name
(Self : Task_Definition)
return Program.Elements.Identifiers.Identifier_Access is abstract;
type Task_Definition_Text is limited interface;
type Task_Definition_Text_Access is access all Task_Definition_Text'Class
with Storage_Size => 0;
not overriding function To_Task_Definition_Text
(Self : aliased in out Task_Definition)
return Task_Definition_Text_Access is abstract;
not overriding function Private_Token
(Self : Task_Definition_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function End_Token
(Self : Task_Definition_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Task_Definitions;
|
-----------------------------------------------------------------------
-- Writer Tests - Unit tests for ASF.Contexts.Writer
-- Copyright (C) 2009, 2010, 2011, 2012, 2013, 2018, 2020 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Text_IO;
with Ada.Calendar;
with Ada.Unchecked_Deallocation;
with Util.Test_Caller;
package body ASF.Contexts.Writer.Tests is
use Util.Tests;
procedure Free_Writer is
new Ada.Unchecked_Deallocation (Object => Test_Writer'Class,
Name => Test_Writer_Access);
procedure Initialize (Stream : in out Test_Writer;
Content_Type : in String;
Encoding : in String;
Size : in Natural) is
Output : ASF.Streams.Print_Stream;
begin
Stream.Content.Initialize (Size => Size);
Output.Initialize (Stream.Content'Unchecked_Access);
Stream.Initialize (Content_Type, Encoding, Output);
end Initialize;
overriding
procedure Write (Stream : in out Test_Writer;
Buffer : in Ada.Streams.Stream_Element_Array) is
begin
for I in Buffer'Range loop
Append (Stream.Response, Character'Val (Buffer (I)));
end loop;
end Write;
overriding
procedure Flush (Stream : in out Test_Writer) is
begin
Response_Writer (Stream).Flush;
Stream.Content.Flush (Into => Stream.Response);
end Flush;
-- Set up performed before each test case
overriding
procedure Set_Up (T : in out Test) is
begin
T.Writer := new Test_Writer;
-- use a small buffer to test the flush
T.Writer.Initialize ("text/xml", "UTF-8", 1024);
end Set_Up;
-- Tear down performed after each test case
overriding
procedure Tear_Down (T : in out Test) is
begin
Free_Writer (T.Writer);
end Tear_Down;
-- Test the Start/Write/End_Element methods
procedure Test_Write_Element (T : in out Test) is
begin
T.Writer.Start_Element ("p");
T.Writer.Start_Element ("b");
T.Writer.Write_Element ("i", "italic within a bold");
T.Writer.End_Element ("b");
T.Writer.End_Element ("p");
-- T.Writer.Flush;
Assert_Equals (T, "<p><b><i>italic within a bold</i></b></p>",
T.Writer.Response);
T.Writer.Response := To_Unbounded_String ("");
T.Writer.Start_Element ("div");
T.Writer.Write_Attribute ("title", "A ""S&'%^&<>");
T.Writer.Write_Attribute ("id", "23");
T.Writer.End_Element ("div");
-- T.Writer.Flush;
Assert_Equals (T, "<div title=""A "S&'%^&<>"" id=""23""></div>",
T.Writer.Response);
end Test_Write_Element;
-- Test the Write_Char/Text methods
procedure Test_Write_Text (T : in out Test) is
use Ada.Calendar;
Start : Ada.Calendar.Time;
D : Duration;
begin
Start := Ada.Calendar.Clock;
T.Writer.Start_Element ("p");
T.Writer.Write_Char ('<');
T.Writer.Write_Char ('>');
T.Writer.Write_Char ('~');
T.Writer.Start_Element ("i");
T.Writer.Write_Text ("""A' <>&");
T.Writer.End_Element ("i");
T.Writer.End_Element ("p");
-- T.Writer.Flush;
D := Ada.Calendar.Clock - Start;
Ada.Text_IO.Put_Line ("Write text: " & Duration'Image (D));
Assert_Equals (T, "<p><>~<i>""A' <>&</i></p>",
T.Writer.Response);
end Test_Write_Text;
package Caller is new Util.Test_Caller (Test, "Contexts.Writer");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
-- To document what is tested, register the test methods for each
-- operation that is tested.
Caller.Add_Test (Suite, "Test ASF.Contexts.Writer.Start_Element",
Test_Write_Element'Access);
Caller.Add_Test (Suite, "Test ASF.Contexts.Writer.End_Element",
Test_Write_Element'Access);
Caller.Add_Test (Suite, "Test ASF.Contexts.Writer.Write_Element",
Test_Write_Element'Access);
Caller.Add_Test (Suite, "Test ASF.Contexts.Writer.Write_Attribute",
Test_Write_Element'Access);
Caller.Add_Test (Suite, "Test ASF.Contexts.Writer.Write_Text",
Test_Write_Text'Access);
Caller.Add_Test (Suite, "Test ASF.Contexts.Writer.Write_Char",
Test_Write_Text'Access);
end Add_Tests;
end ASF.Contexts.Writer.Tests;
|
-- I2Cdev library collection - HM5_883L I2C device class
-- Based on Honeywell HM5_883L datasheet, 102_010 (Form 900_405 Rev B)
-- 6/122_012 by Jeff Rowberg <jeff@rowberg.net>
-- Updates should (hopefully) always be available at https:--github.com/jrowberg/i2cdevlib
--
-- Changelog:
-- 2_012-06-12 - fixed swapped Y/Z axes
-- 2_011-08-22 - small Doxygen comment fixes
-- 2_011-07-31 - initial release
-- ======================
--I2Cdev device library code is placed under the MIT license
--Copyright (c)2_012 Jeff Rowberg
--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, FROM : ARISING,
--OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
--THE SOFTWARE.
--========================
--
with HMC5883L.Register; use HMC5883L.Register;
with HIL.I2C; use HIL.I2C;
with HIL; use HIL;
with Ada.Unchecked_Conversion;
package body HMC5883L.Driver with SPARK_Mode,
Refined_State => (State => (buffer, mode))
is
procedure writeByteToDevice(register : Unsigned_8; data : Unsigned_8) is
data_tx : constant HIL.I2C.Data_Type(1 .. 2) := (1 => Byte( register ), 2 => Byte( data ) );
begin
HIL.I2C.write(HIL.I2C.MAGNETOMETER, data_tx);
end writeByteToDevice;
procedure writeBytesToDevice(register : Unsigned_8; length : Natural; data : Buffer_Type) is
data_tx : HIL.I2C.Data_Type(1 .. data'length + 1) := Byte( register ) & HIL.I2C.Data_Type( data );
begin
HIL.I2C.write(HIL.I2C.MAGNETOMETER, data_tx );
end writeBytesToDevice;
procedure readByteFromDevice(register : Unsigned_8; data : out Unsigned_8) is
data_tx : HIL.I2C.Data_Type(1 .. 1) := (1 => Byte( register ) );
data_rx : HIL.I2C.Data_Type(1 .. 1);
begin
-- HIL.I2C.write(HIL.I2C.MAGNETOMETER, data_tx);
-- HIL.I2C.read(HIL.I2C.MAGNETOMETER, data_rx);
HIL.I2C.transfer(HIL.I2C.MAGNETOMETER, data_tx, data_rx);
data := Unsigned_8( data_rx(1) );
end readByteFromDevice;
procedure readBytesFromDevice(register : Unsigned_8; length : Natural; data : out HIL.I2C.Data_Type) is
data_tx : HIL.I2C.Data_Type(1 .. 1) := (1 => Byte( register ) );
data_rx : HIL.I2C.Data_Type(1 .. length);
begin
-- HIL.I2C.write(HIL.I2C.MAGNETOMETER, data_tx);
-- HIL.I2C.read(HIL.I2C.MAGNETOMETER, data_rx );
HIL.I2C.transfer(HIL.I2C.MAGNETOMETER, data_tx, data_rx);
data := data_rx;
end readBytesFromDevice;
procedure writeBits(register : Unsigned_8; start_index : Unsigned_8_Bit_Index; length : Natural; value : Unsigned_8) is
data : Unsigned_8;
begin
readByteFromDevice(register, data);
HIL.write_Bits(data, start_index, length, Integer( value ) );
writeByteToDevice(register, data);
end writeBits;
procedure readBits(register : Unsigned_8; start_index : Unsigned_8_Bit_Index; length : Natural; value : out Unsigned_8) is
data : Unsigned_8;
begin
readByteFromDevice(register, data);
value := Unsigned_8( HIL.read_Bits(data, start_index, length) );
end readBits;
procedure readBit(register : Unsigned_8; bit_index : Unsigned_8_Bit_Index; result : out Boolean) is
data : Unsigned_8;
begin
readByteFromDevice(register, data);
result := HIL.read_Bits(data, bit_index, 1) = 1;
end readBit;
--* Power on and prepare for general usage.
-- This will prepare the magnetometer with default settings, ready for single-
-- use mode (very low power requirements). Default settings include 8-sample
-- averaging, 15 Hz data output rate, normal measurement bias, a,d1_090 gain (in
-- terms of LSB/Gauss). Be sure to adjust any settings you need specifically
-- after initialization, especially the gain settings if you happen to be seeing
-- a lot of 4_096 values (see the datasheet for mor information).
--
procedure initialize is
begin
-- write CONFIG_A register
writeByteToDevice(HMC5883L_RA_CONFIG_A,
(Shift_Left( HMC5883L_AVERAGING_8, (HMC5883L_CRA_AVERAGE_BIT - HMC5883L_CRA_AVERAGE_LENGTH + 1) ) or
Shift_Left( HMC5883L_RATE_15, (HMC5883L_CRA_RATE_BIT - HMC5883L_CRA_RATE_LENGTH + 1)) or
Shift_Left( HMC5883L_BIAS_NORMAL, (HMC5883L_CRA_BIAS_BIT - HMC5883L_CRA_BIAS_LENGTH + 1))
));
-- write CONFIG_B register
setGain(HMC5883L_GAIN_1090);
-- write MODE register
setMode(HMC5883L_MODE_SINGLE);
end initialize;
--* Verify the I2C connection.
-- Make sure the device is connected and responds as expected.
-- @return True if connection is valid, false otherwise
--
function testConnection return Boolean with SPARK_Mode => Off is
buf : HIL.I2C.Data_Type(1 .. 3);
begin
readBytesFromDevice(HMC5883L_RA_IDA, 3, buf);
return (buf(1) = Character'Pos('H') and then buf(2) = Character'Pos('4') and then buf(3) = Character'Pos('3'));
end testConnection;
-- CONFIG_A register
--* Get number of samples averaged per measurement.
-- @return Current samples averaged per measurement (0-3 for 1/2/4/8 respectively)
-- @see HMC5883L_AVERAGING_8
-- @see HMC5883L_RA_CONFIG_A
-- @see HMC5883L_CRA_AVERAGE_BIT
-- @see HMC5883L_CRA_AVERAGE_LENGTH
--
function getSampleAveraging return Unsigned_8 with SPARK_Mode => Off is
result : Unsigned_8;
begin
readBits(HMC5883L_RA_CONFIG_A, HMC5883L_CRA_AVERAGE_BIT, HMC5883L_CRA_AVERAGE_LENGTH, result);
return result;
end getSampleAveraging;
--* Set number of samples averaged per measurement.
-- @param averaging New samples averaged per measurement setting(0-3 for 1/2/4/8 respectively)
-- @see HMC5883L_RA_CONFIG_A
-- @see HMC5883L_CRA_AVERAGE_BIT
-- @see HMC5883L_CRA_AVERAGE_LENGTH
--
procedure setSampleAveraging(averaging : Unsigned_8) is
begin
writeBits(HMC5883L_RA_CONFIG_A, HMC5883L_CRA_AVERAGE_BIT, HMC5883L_CRA_AVERAGE_LENGTH, averaging);
end setSampleAveraging;
--* Get data output rate value.
-- The Table below shows all selectable output rates in continuous measurement
-- mode. All three channels shall be measured within a given output rate. Other
-- output rates with maximum rate of 160 Hz can be achieved by monitoring DRDY
-- interrupt pin in single measurement mode.
--
-- Value or Typical Data Output Rate (Hz)
-- ------+------------------------------
-- 0 or 0.75
-- 1 or 1.5
-- 2 or 3
-- 3 or 7.5
-- 4 or 15 (Default)
-- 5 or 30
-- 6 or 75
-- 7 or Not used
--
-- @return Current rate of data output to registers
-- @see HMC5883L_RATE_15
-- @see HMC5883L_RA_CONFIG_A
-- @see HMC5883L_CRA_RATE_BIT
-- @see HMC5883L_CRA_RATE_LENGTH
--
procedure getDataRate(rate : out Unsigned_8) is
begin
readBits(HMC5883L_RA_CONFIG_A, HMC5883L_CRA_RATE_BIT, HMC5883L_CRA_RATE_LENGTH, rate);
end getDataRate;
--* Set data output rate value.
-- @param rate Rate of data output to registers
-- @see getDataRate
-- @see HMC5883L_RATE_15
-- @see HMC5883L_RA_CONFIG_A
-- @see HMC5883L_CRA_RATE_BIT
-- @see HMC5883L_CRA_RATE_LENGTH
--
procedure setDataRate(rate : Unsigned_8) is
begin
writeBits(HMC5883L_RA_CONFIG_A, HMC5883L_CRA_RATE_BIT, HMC5883L_CRA_RATE_LENGTH, rate);
end setDataRate;
--* Get measurement bias value.
-- @return Current bias value (0-2 for normal/positive/negative respectively)
-- @see HMC5883L_BIAS_NORMAL
-- @see HMC5883L_RA_CONFIG_A
-- @see HMC5883L_CRA_BIAS_BIT
-- @see HMC5883L_CRA_BIAS_LENGTH
procedure getMeasurementBias( bias : out Unsigned_8) is
begin
readBits(HMC5883L_RA_CONFIG_A, HMC5883L_CRA_BIAS_BIT, HMC5883L_CRA_BIAS_LENGTH, bias);
end getMeasurementBias;
--* Set measurement bias value.
-- @param bias New bias value (0-2 for normal/positive/negative respectively)
-- @see HMC5883L_BIAS_NORMAL
-- @see HMC5883L_RA_CONFIG_A
-- @see HMC5883L_CRA_BIAS_BIT
-- @see HMC5883L_CRA_BIAS_LENGTH
procedure setMeasurementBias(bias : Unsigned_8) is
begin
writeBits(HMC5883L_RA_CONFIG_A, HMC5883L_CRA_BIAS_BIT, HMC5883L_CRA_BIAS_LENGTH, bias);
end setMeasurementBias;
-- CONFIG_B register
--* Get magnetic field gain value.
-- The table below shows nominal gain settings. Use the "Gain" column to convert
-- counts to Gauss. Choose a lower gain value (higher GN#) when total field
-- strength causes overflow in one of the data output registers (saturation).
-- The data output range for all settings is 16#F800#-16#07FF# (2_048 -2_047).
--
-- Value or Field Range or Gain (LSB/Gauss)
-- ------+-------------+-----------------
-- 0 or +/- 0.88 Ga or1_370
-- 1 or +/- 1.3 Ga or1_090 (Default)
-- 2 or +/- 1.9 Ga or 820
-- 3 or +/- 2.5 Ga or 660
-- 4 or +/- 4.0 Ga or 440
-- 5 or +/- 4.7 Ga or 390
-- 6 or +/- 5.6 Ga or 330
-- 7 or +/- 8.1 Ga or 230
--
-- @return Current magnetic field gain value
-- @see HMC5883L_GAIN_1090
-- @see HMC5883L_RA_CONFIG_B
-- @see HMC5883L_CRB_GAIN_BIT
-- @see HMC5883L_CRB_GAIN_LENGTH
--
procedure getGain( gain : out Unsigned_8 ) is
begin
readBits(HMC5883L_RA_CONFIG_B, HMC5883L_CRB_GAIN_BIT, HMC5883L_CRB_GAIN_LENGTH, gain);
end getGain;
--* Set magnetic field gain value.
-- @param gain New magnetic field gain value
-- @see getGain
-- @see HMC5883L_RA_CONFIG_B
-- @see HMC5883L_CRB_GAIN_BIT
-- @see HMC5883L_CRB_GAIN_LENGTH
--
procedure setGain(gain : Unsigned_8) is
begin
-- use this method to guarantee that bits 4-0 are set to zero, which is a
-- requirement specified in the datasheet; it's actually more efficient than
-- using the I2Cdev.writeBits method
writeByteToDevice(HMC5883L_RA_CONFIG_B,
Shift_Left( gain, (HMC5883L_CRB_GAIN_BIT - HMC5883L_CRB_GAIN_LENGTH + 1)));
end setGain;
-- MODE register
--* Get measurement mode.
-- In continuous-measurement mode, the device continuously performs measurements
-- and places the result in the data register. RDY goes high when new data is
-- placed in all three registers. After a power-on or a write to the mode or
-- configuration register, the first measurement set is available from all three
-- data output registers after a period of 2/fDO and subsequent measurements are
-- available at a frequency of fDO, where fDO is the frequency of data output.
--
-- When single-measurement mode (default) is selected, device performs a single
-- measurement, sets RDY high and returned to idle mode. Mode register returns
-- to idle mode bit values. The measurement remains in the data output register
-- and RDY remains high until the data output register is read or another
-- measurement is performed.
--
-- @return Current measurement mode
-- @see HMC5883L_MODE_CONTINUOUS
-- @see HMC5883L_MODE_SINGLE
-- @see HMC5883L_MODE_IDLE
-- @see HMC5883L_RA_MODE
-- @see HMC5883L_MODEREG_BIT
-- @see HMC5883L_MODEREG_LENGTH
--
procedure getMode( mode : out Unsigned_8) is
begin
readBits(HMC5883L_RA_MODE, HMC5883L_MODEREG_BIT, HMC5883L_MODEREG_LENGTH, mode);
end getMode;
--* Set measurement mode.
-- @param newMode New measurement mode
-- @see getMode
-- @see HMC5883L_MODE_CONTINUOUS
-- @see HMC5883L_MODE_SINGLE
-- @see HMC5883L_MODE_IDLE
-- @see HMC5883L_RA_MODE
-- @see HMC5883L_MODEREG_BIT
-- @see HMC5883L_MODEREG_LENGTH
--
procedure setMode(newMode : Unsigned_8) is
begin
-- use this method to guarantee that bits 7-2 are set to zero, which is a
-- requirement specified in the datasheet; it's actually more efficient than
-- using the I2Cdev.writeBits method
writeByteToDevice(HMC5883L_RA_MODE,
Shift_Left(newMode, (HMC5883L_MODEREG_BIT - HMC5883L_MODEREG_LENGTH + 1)));
mode := newMode; -- track to tell if we have to clear bit 7 after a read
end setMode;
-- DATA* registers
--* Get 3-axis heading measurements.
-- In the event the ADC reading overflows or underflows for the given channel,
-- or if there is a math overflow during the bias measurement, this data
-- register will contain the value 4_096. This register value will clear when
-- after the next valid measurement is made. Note that this method automatically
-- clears the appropriate bit in the MODE register if Single mode is active.
-- @param x 16-bit signed integer container for X-axis heading
-- @param y 16-bit signed integer container for Y-axis heading
-- @param z 16-bit signed integer container for Z-axis heading
-- @see HMC5883L_RA_DATAX_H
--
procedure getHeading(x : out Integer_16; y : out Integer_16; z : out Integer_16) is
buf : HIL.I2C.Data_Type(1 .. 6);
byte2 : HIL.I2C.Data_Type(1 .. 2);
subtype Byte_2 is HIL.I2C.Data_Type(1 .. 2);
function Convert is new Ada.Unchecked_Conversion (Source => Byte_2,
Target => Integer_16);
begin
readBytesFromDevice(HMC5883L_RA_DATAX_H, 6, buf); -- SDA fails to go high again
if (mode = HMC5883L_MODE_SINGLE) then
writeByteToDevice(HMC5883L_RA_MODE, Shift_Left( HMC5883L_MODE_SINGLE, (HMC5883L_MODEREG_BIT - HMC5883L_MODEREG_LENGTH + 1)));
null;
end if;
byte2 := (1 => buf(2), 2 => buf(1));
x := Convert( byte2 );
byte2 := (1 => buf(4), 2 => buf(3));
z := Convert( byte2 );
byte2 := (1 => buf(6), 2 => buf(5));
y := Convert( byte2 );
end getHeading;
--* Get X-axis heading measurement.
-- @return 16-bit signed integer with X-axis heading
-- @see HMC5883L_RA_DATAX_H
--
procedure getHeadingX(x : out Integer_16) is
begin
-- -- each axis read requires that ALL axis registers be read, even if only
-- -- one is used; this was not done ineffiently in the code by accident
-- readBytesFromDevice(HMC5883L_RA_DATAX_H, 6, buffer);
-- if (mode = HMC5883L_MODE_SINGLE) then
-- writeByteToDevice(HMC5883L_RA_MODE,
-- Shift_Left( HMC5883L_MODE_SINGLE, (HMC5883L_MODEREG_BIT - HMC5883L_MODEREG_LENGTH + 1)));
-- end if;
x := Integer_16( buffer(1)) *2**8 + Integer_16( buffer(2) );
end getHeadingX;
--* Get Y-axis heading measurement.
-- @return 16-bit signed integer with Y-axis heading
-- @see HMC5883L_RA_DATAY_H
--
procedure getHeadingY(y : out Integer_16) is
begin
-- each axis read requires that ALL axis registers be read, even if only
-- one is used; this was not done ineffiently in the code by accident
-- readBytesFromDevice(HMC5883L_RA_DATAX_H, 6, buffer);
-- if (mode = HMC5883L_MODE_SINGLE) then
-- writeByteToDevice(HMC5883L_RA_MODE, Shift_Left(HMC5883L_MODE_SINGLE, (HMC5883L_MODEREG_BIT - HMC5883L_MODEREG_LENGTH + 1)));
-- end if;
y := Integer_16( buffer(5)) *2**8 + Integer_16( buffer(6) );
end getHeadingY;
--* Get Z-axis heading measurement.
-- @return 16-bit signed integer with Z-axis heading
-- @see HMC5883L_RA_DATAZ_H
--
procedure getHeadingZ(z : out Integer_16) is
begin
-- each axis read requires that ALL axis registers be read, even if only
-- one is used; this was not done ineffiently in the code by accident
-- readBytesFromDevice(HMC5883L_RA_DATAX_H, 6, buffer);
--
-- if (mode = HMC5883L_MODE_SINGLE) then
-- writeByteToDevice(HMC5883L_RA_MODE, Shift_Left(HMC5883L_MODE_SINGLE, (HMC5883L_MODEREG_BIT - HMC5883L_MODEREG_LENGTH + 1)));
-- end if;
z := Integer_16( buffer(3)) *2**8 + Integer_16( buffer(4) );
end getHeadingZ;
-- STATUS register
--* Get data output register lock status.
-- This bit is set when this some but not all for of the six data output
-- registers have been read. When this bit is set, the six data output registers
-- are locked and any new data will not be placed in these register until one of
-- three conditions are met: one, all six bytes have been read or the mode
-- changed, two, the mode is changed, or three, the measurement configuration is
-- changed.
-- @return Data output register lock status
-- @see HMC5883L_RA_STATUS
-- @see HMC5883L_STATUS_LOCK_BIT
--
function getLockStatus return Boolean with SPARK_Mode => Off is
data : Boolean;
begin
readBit(HMC5883L_RA_STATUS, HMC5883L_STATUS_LOCK_BIT, data);
return data;
end getLockStatus;
--* Get data ready status.
-- This bit is set when data is written to all six data registers, and cleared
-- when the device initiates a write to the data output registers and after one
-- or more of the data output registers are written to. When RDY bit is clear it
-- shall remain cleared for 250 us. DRDY pin can be used as an alternative to
-- the status register for monitoring the device for measurement data.
-- @return Data ready status
-- @see HMC5883L_RA_STATUS
-- @see HMC5883L_STATUS_READY_BIT
--
function getReadyStatus return Boolean with SPARK_Mode => Off is
result : Boolean;
begin
readBit(HMC5883L_RA_STATUS, HMC5883L_STATUS_READY_BIT, result);
return result;
end getReadyStatus;
-- ID* registers
--* Get identification byte A
-- @return IDA byte (should be01_001_000, ASCII value 'H')
--
function getIDA return Unsigned_8 with SPARK_Mode => Off is
begin
readByteFromDevice(HMC5883L_RA_IDA, buffer(1));
return buffer(1);
end getIDA;
--* Get identification byte B
-- @return IDA byte (should be00_110_100, ASCII value '4')
--
function getIDB return Unsigned_8 with SPARK_Mode => Off is
result : Unsigned_8;
begin
readByteFromDevice(HMC5883L_RA_IDB, result);
return result;
end getIDB;
--* Get identification byte C
-- @return IDA byte (should be00_110_011, ASCII value '3')
--
function getIDC return Unsigned_8 with SPARK_Mode => Off is
result : Unsigned_8;
begin
readByteFromDevice(HMC5883L_RA_IDC, result);
return result;
end getIDC;
end HMC5883L.Driver;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- A continuation is a syntactic way to define continuations of different
-- branches of an alternative combined fragment. Continuations is intuitively
-- similar to labels representing intermediate points in a flow of control.
------------------------------------------------------------------------------
with AMF.UML.Interaction_Fragments;
package AMF.UML.Continuations is
pragma Preelaborate;
type UML_Continuation is limited interface
and AMF.UML.Interaction_Fragments.UML_Interaction_Fragment;
type UML_Continuation_Access is
access all UML_Continuation'Class;
for UML_Continuation_Access'Storage_Size use 0;
not overriding function Get_Setting
(Self : not null access constant UML_Continuation)
return Boolean is abstract;
-- Getter of Continuation::setting.
--
-- True: when the Continuation is at the end of the enclosing
-- InteractionFragment and False when it is in the beginning.
not overriding procedure Set_Setting
(Self : not null access UML_Continuation;
To : Boolean) is abstract;
-- Setter of Continuation::setting.
--
-- True: when the Continuation is at the end of the enclosing
-- InteractionFragment and False when it is in the beginning.
end AMF.UML.Continuations;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S T R I N G S . W I D E _ S E A R C H --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-1997 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains the search functions from Ada.Strings.Wide_Fixed.
-- They are separated out because they are shared by Ada.Strings.Wide_Bounded
-- and Ada.Strings.Wide_Unbounded, and we don't want to drag other irrelevant
-- stuff from Ada.Strings.Wide_Fixed when using the other two packages. We
-- make this a private package, since user programs should access these
-- subprograms via one of the standard string packages.
with Ada.Strings.Wide_Maps;
private package Ada.Strings.Wide_Search is
pragma Preelaborate (Wide_Search);
function Index (Source : in Wide_String;
Pattern : in Wide_String;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping :=
Wide_Maps.Identity)
return Natural;
function Index (Source : in Wide_String;
Pattern : in Wide_String;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Natural;
function Index (Source : in Wide_String;
Set : in Wide_Maps.Wide_Character_Set;
Test : in Membership := Inside;
Going : in Direction := Forward)
return Natural;
function Index_Non_Blank (Source : in Wide_String;
Going : in Direction := Forward)
return Natural;
function Count (Source : in Wide_String;
Pattern : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping :=
Wide_Maps.Identity)
return Natural;
function Count (Source : in Wide_String;
Pattern : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Natural;
function Count (Source : in Wide_String;
Set : in Wide_Maps.Wide_Character_Set)
return Natural;
procedure Find_Token (Source : in Wide_String;
Set : in Wide_Maps.Wide_Character_Set;
Test : in Membership;
First : out Positive;
Last : out Natural);
end Ada.Strings.Wide_Search;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . V A L _ L L U --
-- --
-- S p e c --
-- --
-- $Revision: 2 $ --
-- --
-- Copyright (c) 1992,1993,1994 NYU, All Rights Reserved --
-- --
-- The GNAT library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU Library General Public License as published by --
-- the Free Software Foundation; either version 2, or (at your option) any --
-- later version. The GNAT library is distributed in the hope that it will --
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- Library General Public License for more details. You should have --
-- received a copy of the GNU Library General Public License along with --
-- the GNAT library; see the file COPYING.LIB. If not, write to the Free --
-- Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
-- --
------------------------------------------------------------------------------
with System.Unsigned_Types;
package System.Val_LLU is
pragma Pure (Val_LLU);
function Scan_Long_Long_Unsigned
(Str : String;
Ptr : access Positive'Base;
Max : Positive'Base)
return System.Unsigned_Types.Long_Long_Unsigned;
-- This function scans the string starting at Str (Ptr.all) for a valid
-- integer according to the syntax described in (RM 3.5(43)). The substring
-- scanned extends no further than Str (Max). There are three cases for the
-- return:
--
-- If a valid integer is found after scanning past any initial spaces, then
-- Ptr.all is updated past the last character of the integer (but trailing
-- spaces are not scanned out).
--
-- If no valid integer is found, then Ptr.all points either to an initial
-- non-digit character, or to Max + 1 if the field is all spaces and the
-- exception Constraint_Error is raised.
--
-- If a syntactically valid integer is scanned, but the value is out of
-- range, or, in the based case, the base value is out of range or there
-- is an out of range digit, then Ptr.all points past the integer, and
-- Constraint_Error is raised. Note that if a minus sign is present, and
-- the integer value is non-zero, then constraint error will be raised.
--
-- Note: these rules correspond to the requirements for leaving the pointer
-- positioned in Text_Io.Get
--
-- Note: if Str is null, i.e. if Max is less than Ptr, then this is a
-- special case of an all-blank string, and Ptr is unchanged, and hence
-- is greater than Max as required in this case.
function Value_Long_Long_Unsigned
(Str : String)
return System.Unsigned_Types.Long_Long_Unsigned;
-- Used in computing X'Value (Str) where X is a modular integer type whose
-- modulus exceeds the range of System.Unsigned_Types.Unsigned. Str is the
-- string argument of the attribute. Constraint_Error is raised if the
-- string is malformed, or if the value is out of range.
end System.Val_LLU;
|
-- Copyright 2013-2014 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package Callee is
procedure Increment (Val : in out Float; Msg : String);
end Callee;
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <denkpadje@gmail.com>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package Orka.Cameras.Rotate_Around_Cameras is
pragma Preelaborate;
type Rotate_Around_Camera is new Third_Person_Camera with private;
procedure Set_Angles
(Object : in out Rotate_Around_Camera;
Alpha : Angle;
Beta : Angle);
procedure Set_Radius
(Object : in out Rotate_Around_Camera;
Radius : Distance);
procedure Change_Orientation
(Object : in out Rotate_Around_Camera;
Value : Vector4);
overriding
function View_Matrix (Object : Rotate_Around_Camera) return Transforms.Matrix4;
overriding
function View_Matrix_Inverse (Object : Rotate_Around_Camera) return Transforms.Matrix4;
overriding
function View_Position (Object : Rotate_Around_Camera) return Vector4;
overriding
procedure Update (Object : in out Rotate_Around_Camera; Delta_Time : Duration);
overriding
function Create_Camera (Lens : Camera_Lens) return Rotate_Around_Camera;
private
type Rotate_Around_Camera is new Third_Person_Camera with record
Alpha : Angle := 0.0;
Beta : Angle := 0.0;
Radius : Distance := 1.0;
Updater : Change_Updater_Ptr := new Change_Updater;
end record;
end Orka.Cameras.Rotate_Around_Cameras;
|
------------------------------------------------------------------------------
-- --
-- File: --
-- formatted_output-modular_output.adb --
-- --
-- Description: --
-- Formatted_Output.Modular_Output generic package body --
-- --
-- Author: --
-- Eugene Nonko, cm@liceum.secna.ru --
-- --
-- Revision history: --
-- 27/01/99 - original --
-- 16/03/99 - added support for justification characters --
-- --
------------------------------------------------------------------------------
with Ada.Text_IO,
Ada.Strings,
Ada.Strings.Fixed,
Ada.Strings.Unbounded;
use Ada.Text_IO,
Ada.Strings,
Ada.Strings.Fixed,
Ada.Strings.Unbounded;
package body Formatted_Output.Modular_Output is
package Item_Type_IO is new Modular_IO (Item_Type);
use Item_Type_IO;
function Format
(Value : Item_Type; Initial_Width : Integer;
Leading_Zero : Boolean; Base : Integer;
Justification : Alignment) return String is
Img : String (1 .. Maximal_Item_Length);
Width, Real_Width : Integer;
Pre_First, Last, Current : Natural;
begin -- Format
Put (Img, Value, Base);
if Base = 10 then
Last := Maximal_Item_Length;
else
Last := Maximal_Item_Length - 1;
end if;
Pre_First := Last;
while Img (Pre_First) /= ' ' and then Img (Pre_First) /= '#' loop
Pre_First := Pre_First - 1;
end loop;
Real_Width := Last - Pre_First;
if Initial_Width < Real_Width then
Width := Real_Width;
else
Width := Initial_Width;
end if;
declare
S : String (1 .. Width);
begin
Move (Img (Pre_First + 1 .. Last), S,
Justify => Justification, Pad => Filler);
if Leading_Zero then
Current := 1;
while S (Current) = Filler loop
S (Current) := '0';
Current := Current + 1;
end loop;
end if;
return S;
end;
end Format;
function "&" (Fmt : Format_Type; Value : Item_Type) return Format_Type is
Command_Start : constant Integer := Scan_To_Percent_Sign (Fmt);
Leading_Zero : Boolean := False;
Width : Integer := 0;
Digit_Occured, Justification_Changed : Boolean := False;
Justification : Alignment := Right;
Fmt_Copy : Unbounded_String;
begin -- "&"
if Command_Start /= 0 then
Fmt_Copy := Unbounded_String (Fmt);
for I in Command_Start + 1 .. Length (Fmt_Copy) loop
case Element (Fmt_Copy, I) is
when 'd' =>
Replace_Slice (Fmt_Copy, Command_Start, I,
Format (Value, Width, Leading_Zero, 10, Justification));
return Format_Type (Fmt_Copy);
when 'x' =>
Replace_Slice (Fmt_Copy, Command_Start, I,
Format (Value, Width, Leading_Zero, 16, Justification));
return Format_Type (Fmt_Copy);
when 'o' =>
Replace_Slice (Fmt_Copy, Command_Start, I,
Format (Value, Width, Leading_Zero, 8, Justification));
return Format_Type (Fmt_Copy);
when 'b' =>
Replace_Slice (Fmt_Copy, Command_Start, I,
Format (Value, Width, Leading_Zero, 2, Justification));
return Format_Type (Fmt_Copy);
when '-' | '+' | '*' =>
if Justification_Changed or else Digit_Occured then
raise Format_Error;
end if;
Justification_Changed := True;
case Element (Fmt_Copy, I) is
when '-' =>
Justification := Left;
when '+' =>
Justification := Right;
when '*' =>
Justification := Center;
when others =>
null;
end case;
when '0' .. '9' =>
Digit_Occured := True;
if Width = 0 and then Element (Fmt_Copy, I) = '0' then
Leading_Zero := True;
else
Width := Width * 10
+ Character'Pos (Element (Fmt_Copy, I))
- Character'Pos ('0');
end if;
when others =>
raise Format_Error;
end case;
end loop;
end if;
raise Format_Error;
end "&";
end Formatted_Output.Modular_Output;
|
-- parse_args_suite-parse_args_tests.adb
-- Unit tests for the Parse_Args project
-- Copyright (c) 2016, James Humphry
--
-- 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.
with System.Assertions;
with AUnit.Assertions;
with Parse_Args;
with Parse_Args.Testable;
package body Parse_Args_Suite.Parse_Args_Tests is
use AUnit.Assertions;
use Parse_Args;
use Parse_Args.Testable;
--------------------
-- Register_Tests --
--------------------
procedure Register_Tests (T: in out Parse_Args_Test) is
use AUnit.Test_Cases.Registration;
begin
Register_Routine (T, Check_Basics'Access,
"Check basic functionality");
Register_Routine (T, Check_Boolean_Usage'Access,
"Check Boolean option functionality");
Register_Routine (T, Check_Repeated_Usage'Access,
"Check Repeated option functionality");
Register_Routine (T, Check_Integer_Usage'Access,
"Check Integer option functionality");
Register_Routine (T, Check_String_Usage'Access,
"Check String option functionality");
end Register_Tests;
----------
-- Name --
----------
function Name (T : Parse_Args_Test) return Test_String is
pragma Unreferenced (T);
begin
return Format ("Tests of Parse_Args package functionality");
end Name;
------------
-- Set_Up --
------------
procedure Set_Up (T : in out Parse_Args_Test) is
pragma Unreferenced (T);
begin
null;
end Set_Up;
------------------
-- Check_Basics --
------------------
procedure Check_Basics (T : in out Test_Cases.Test_Case'Class) is
pragma Unreferenced(T);
function Setup_AP return Testable_Argument_Parser is
begin
return Result : Testable_Argument_Parser do
Result.Add_Option(O => Make_Boolean_Option(False),
Name => "foo",
Short_Option => 'f');
Result.Add_Option(O => Make_Boolean_Option(False),
Name => "bar",
Short_Option => 'b');
Result.Add_Option(O => Make_Boolean_Option(False),
Name => "baz",
Short_Option => 'z');
Result.Set_Command_Name("parse_args_tests");
end return;
end Setup_AP;
begin
declare
AP : Testable_Argument_Parser := Setup_AP;
Catch_Message_Too_Soon : Boolean := False;
Catch_Repeated_Parsing : Boolean := False;
Catch_No_Such_Argument : Boolean := False;
begin
AP.Clear_Arguments;
AP.Append_Arguments((+"--foo",
+"-b"));
Assert(AP.Ready, "New Argument_Parser not ready for use");
begin
declare
Dummy : String := AP.Parse_Message;
begin
null;
end;
exception
when Program_Error | System.Assertions.Assert_Failure =>
Catch_Message_Too_Soon := True;
end;
Assert(Catch_Message_Too_Soon,
"Returned a parse message before the parse has taken place");
AP.Parse_Command_Line;
Assert(AP.Parse_Success, "Argument_Parser did not parse successfully: " &
AP.Parse_Message);
begin
AP.Parse_Command_Line;
exception
when Program_Error | System.Assertions.Assert_Failure =>
Catch_Repeated_Parsing := True;
end;
Assert(Catch_Repeated_Parsing,
"Did not object to Parse_Command_Line being called twice");
Assert(AP.Command_Name = "parse_args_tests",
"Cannot retrieve command name");
Assert(AP.Get("foo").Set,
"Boolean option bar incorrectly not marked as set");
Assert(AP.Get("bar").Set,
"Boolean option bar incorrectly not marked as set");
Assert(not AP.Get("baz").Set,
"Boolean option baz incorrectly marked as set");
begin
declare
Dummy : Boolean := AP.Boolean_Value("nosuch");
begin
null;
end;
exception
when Constraint_Error =>
Catch_No_Such_Argument := True;
end;
Assert(Catch_No_Such_Argument,
"Returned a value for a non-existent option");
end;
end Check_Basics;
-------------------------
-- Check_Boolean_Usage --
-------------------------
procedure Check_Boolean_Usage (T : in out Test_Cases.Test_Case'Class) is
pragma Unreferenced(T);
function Setup_AP return Testable_Argument_Parser is
begin
return Result : Testable_Argument_Parser do
Result.Add_Option(O => Make_Boolean_Option(False),
Name => "foo",
Short_Option => 'f');
Result.Add_Option(O => Make_Boolean_Option(True),
Name => "bar",
Short_Option => 'b');
Result.Add_Option(O => Make_Boolean_Option(False),
Name => "baz",
Short_Option => 'z',
Long_Option => "-");
Result.Add_Option(O => Make_Boolean_Option(False),
Name => "bork",
Short_Option => '-',
Long_Option => "borkable");
Result.Set_Command_Name("parse_args_tests");
end return;
end Setup_AP;
begin
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Arguments((+"--foo",
+"-b",
+"--borkable"));
AP.Parse_Command_Line;
Assert(AP.Parse_Success, "Argument_Parser did not parse successfully: " &
AP.Parse_Message);
Assert(AP.Boolean_Value("foo"),
"Boolean option foo (default false) not toggled");
Assert(not AP.Boolean_Value("bar"),
"Boolean option bar (default true) not toggled via short option");
Assert(AP.Boolean_Value("bork"),
"Boolean option bork (default false) not toggled via renamed long option");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Argument("-bz");
AP.Parse_Command_Line;
Assert(AP.Parse_Success, "Argument_Parser did not parse successfully");
Assert(not AP.Boolean_Value("foo"),
"Boolean option foo (default false) set despite not being present in option group");
Assert(not AP.Boolean_Value("bar"),
"Boolean option bar (default true) not toggled via short option group");
Assert(AP.Get("baz").Set,
"Boolean option baz (default false) not toggled via short option group");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Arguments((+"--nonesuch", +"--foo"));
AP.Parse_Command_Line;
Assert(not AP.Parse_Success,
"Parse successful despite passing non-existent long option");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Arguments((+"-n", +"--foo"));
AP.Parse_Command_Line;
Assert(not AP.Parse_Success,
"Parse successful despite passing non-existent short option");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Argument("-fnz");
AP.Parse_Command_Line;
Assert(not AP.Parse_Success,
"Parse successful despite passing non-existent grouped short option");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Arguments((+"--foo", +"invalidarg"));
AP.Parse_Command_Line;
Assert(not AP.Parse_Success,
"Parse successful despite passing an argument to a Boolean option");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Argument("--baz");
AP.Parse_Command_Line;
Assert(not AP.Parse_Success,
"Parse successful despite using a long option name on a short-name only option");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Argument("--bork");
AP.Parse_Command_Line;
Assert(not AP.Parse_Success,
"Parse successful despite using the underlying option name for a renamed long option");
end;
end Check_Boolean_Usage;
--------------------------
-- Check_Repeated_Usage --
--------------------------
procedure Check_Repeated_Usage (T : in out Test_Cases.Test_Case'Class) is
pragma Unreferenced(T);
function Setup_AP return Testable_Argument_Parser is
begin
return Result : Testable_Argument_Parser do
Result.Add_Option(O => Make_Repeated_Option,
Name => "foo",
Short_Option => 'f');
Result.Add_Option(O => Make_Repeated_Option,
Name => "bar",
Short_Option => 'b');
Result.Add_Option(O => Make_Repeated_Option(5),
Name => "baz",
Short_Option => 'z');
Result.Add_Option(O => Make_Boolean_Option,
Name => "snafu",
Short_Option => 's');
Result.Set_Command_Name("parse_args_tests");
end return;
end Setup_AP;
begin
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Arguments((+"--foo",
+"--foo",
+"-b", +"-b"));
AP.Parse_Command_Line;
Assert(AP.Parse_Success, "Argument_Parser did not parse successfully: " &
AP.Parse_Message);
Assert(AP.Integer_Value("foo") = 2,
"Repeated options (using long option type) not working");
Assert(AP.Integer_Value("bar") = 2,
"Repeated options (using short option type) not working");
Assert(AP.Integer_Value("baz") = 5,
"Repeated options defaults not working");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Arguments((+"-fbfb",
+"--baz",
+"-z", +"-z"));
AP.Parse_Command_Line;
Assert(AP.Parse_Success, "Argument_Parser did not parse successfully: " &
AP.Parse_Message);
Assert(AP.Integer_Value("foo") = 2,
"Repeated options (using short option group) not working");
Assert(AP.Integer_Value("bar") = 2,
"Repeated options (using short option group) not working");
Assert(AP.Integer_Value("baz") = 8,
"Repeated optionsw with a default and mixed long and short " &
"options are not working");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Arguments((+"-fz",
+"--snafu",
+"--baz",
+"-z",
+"-z",
+"--foo"));
AP.Parse_Command_Line;
Assert(AP.Parse_Success, "Argument_Parser did not parse successfully: " &
AP.Parse_Message);
Assert(AP.Integer_Value("foo") = 2,
"Repeated options (using short option group) not working");
Assert(AP.Integer_Value("bar") = 0,
"Repeated options (with no default set and not invoked) not " &
"returning 0 when retrieved");
Assert(AP.Integer_Value("baz") = 9,
"Repeated optionsw with a default and mixed long and short " &
"options are not working");
end;
end Check_Repeated_Usage;
-------------------------
-- Check_Integer_Usage --
-------------------------
procedure Check_Integer_Usage (T : in out Test_Cases.Test_Case'Class) is
pragma Unreferenced(T);
function Setup_AP return Testable_Argument_Parser is
begin
return Result : Testable_Argument_Parser do
Result.Add_Option(O => Make_Integer_Option,
Name => "foo",
Short_Option => 'f');
Result.Add_Option(O => Make_Natural_Option,
Name => "bar",
Short_Option => 'b');
Result.Add_Option(O => Make_Positive_Option,
Name => "baz",
Short_Option => 'z');
Result.Add_Option(O => Make_Integer_Option(Default => 15,
Min => 10,
Max => 20),
Name => "coz",
Short_Option => 'c');
Result.Add_Option(O => Make_Boolean_Option,
Name => "door",
Short_Option => 'd');
Result.Set_Command_Name("parse_args_tests");
end return;
end Setup_AP;
Catch_No_Such_Argument : Boolean := False;
begin
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Arguments((+"--foo", +"5",
+"-c", +"12"));
AP.Parse_Command_Line;
Assert(AP.Parse_Success, "Argument_Parser did not parse successfully: " &
AP.Parse_Message);
Assert(AP.Integer_Value("foo") = 5,
"Integer option (long form) not working");
Assert(AP.Integer_Value("bar") = 0,
"Natural Option default not correct");
Assert(AP.Integer_Value("baz") = 1,
"Positive option default not correct");
Assert(AP.Integer_Value("coz") = 12,
"Integer option (short form) with custom range not working");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Arguments((+"-f", +"-7"));
AP.Append_Arguments((+"-z", +"16#FF#"));
AP.Parse_Command_Line;
Assert(AP.Parse_Success, "Argument_Parser did not parse successfully: " &
AP.Parse_Message);
Assert(AP.Integer_Value("foo") = -7,
"Positive option did not accept negative input");
Assert(AP.Integer_Value("baz") = 255,
"Positive option did not accept hex input");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Arguments((+"-df", +"8"));
AP.Parse_Command_Line;
Assert(AP.Parse_Success, "Argument_Parser did not parse successfully: " &
AP.Parse_Message);
Assert(AP.Integer_Value("foo") = 8,
"Integer option (short group) not working");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Arguments((+"-z", +"0"));
AP.Parse_Command_Line;
Assert(not AP.Parse_Success,
"Argument parser did not reject 0 as input for Positive option");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Arguments((+"-c", +"8"));
AP.Parse_Command_Line;
Assert(not AP.Parse_Success,
"Argument parser did not reject out-of range value for " &
"customised Integer option");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Arguments((+"-f", +"--bar", +"8"));
AP.Parse_Command_Line;
Assert(not AP.Parse_Success,
"Argument parser did not reject missing option value for an" &
"Integer option");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Arguments((+"-fb", +"8"));
AP.Parse_Command_Line;
Assert(not AP.Parse_Success,
"Argument parser did not reject missing option value for an" &
"Integer option as part of a short option group");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Arguments((+"-f", +"8",
+"--foo", +"9"));
AP.Parse_Command_Line;
Assert(not AP.Parse_Success,
"Argument parser did not reject specifying an Integer option" &
"twice.");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Parse_Command_Line;
declare
Dummy : Integer := AP.Integer_Value("nosuch");
begin
null;
end;
exception
when Constraint_Error =>
Catch_No_Such_Argument := True;
end;
Assert(Catch_No_Such_Argument,
"Returned a value for a non-existent integer option");
end Check_Integer_Usage;
------------------------
-- Check_String_Usage --
------------------------
procedure Check_String_Usage (T : in out Test_Cases.Test_Case'Class) is
pragma Unreferenced(T);
function Setup_AP return Testable_Argument_Parser is
begin
return Result : Testable_Argument_Parser do
Result.Add_Option(O => Make_String_Option,
Name => "foo",
Short_Option => 'f');
Result.Add_Option(O => Make_String_Option(Default => "Hello"),
Name => "bar",
Short_Option => 'b');
Result.Add_Option(O => Make_String_Option,
Name => "baz",
Short_Option => 'z');
Result.Set_Command_Name("parse_args_tests");
end return;
end Setup_AP;
Catch_No_Such_Argument : Boolean := False;
begin
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Clear_Arguments;
AP.Append_Arguments((+"--foo", +"5",
+"-z", +"Goodbye"));
AP.Parse_Command_Line;
Assert(AP.Parse_Success, "Argument_Parser did not parse successfully: " &
AP.Parse_Message);
Assert(AP.String_Value("foo") = "5",
"String option (long form) not working");
Assert(AP.String_Value("bar") = "Hello",
"String Option default not correct");
Assert(AP.String_Value("baz") = "Goodbye",
"String option (short form) not working");
end;
declare
AP : Testable_Argument_Parser := Setup_AP;
begin
AP.Parse_Command_Line;
declare
Dummy :String := AP.String_Value("nosuch");
begin
null;
end;
exception
when Constraint_Error =>
Catch_No_Such_Argument := True;
end;
Assert(Catch_No_Such_Argument,
"Returned a value for a non-existent string option");
end Check_String_Usage;
end Parse_Args_Suite.Parse_Args_Tests;
|
------------------------------------------------------------------------------
-- G E L A A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
with Ada.Unchecked_Conversion;
package body Gela.Hash.SHA is
------------
-- Update --
------------
procedure Update
(This : in out Hasher'Class;
Value : in String)
is
use Ada.Streams;
subtype C_Array is
Ada.Streams.Stream_Element_Array
(1 .. Value'Size / Stream_Element'Size);
function To_Array is
new Ada.Unchecked_Conversion (String, C_Array);
begin
Update (This, To_Array (Value));
end Update;
-----------------
-- Wide_Update --
-----------------
procedure Wide_Update
(This : in out Hasher'Class;
Value : in Wide_String)
is
use Ada.Streams;
subtype C_Array is
Ada.Streams.Stream_Element_Array
(1 .. Value'Size / Stream_Element'Size);
function To_Array is
new Ada.Unchecked_Conversion (Wide_String, C_Array);
begin
Update (This, To_Array (Value));
end Wide_Update;
----------------------
-- Wide_Wide_Update --
----------------------
procedure Wide_Wide_Update
(This : in out Hasher'Class;
Value : in Wide_Wide_String)
is
use Ada.Streams;
subtype C_Array is
Ada.Streams.Stream_Element_Array
(1 .. Value'Size / Stream_Element'Size);
function To_Array is
new Ada.Unchecked_Conversion (Wide_Wide_String, C_Array);
begin
Update (This, To_Array (Value));
end Wide_Wide_Update;
end Gela.Hash.SHA;
------------------------------------------------------------------------------
-- Copyright (c) 2006, Andry Ogorodnik
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- * this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- * notice, this list of conditions and the following disclaimer in the
-- * documentation and/or other materials provided with the distribution.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013, Maxim Reznik
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * Neither the name of the Maxim Reznik, IE nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
|
package body System.File_IO is
procedure Check_File_Open (File : File_Control_Block.AFCB_Ptr) is
begin
raise Program_Error; -- unimplemented
end Check_File_Open;
end System.File_IO;
|
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
limited with Program.Compilations;
limited with Program.Library_Items;
limited with Program.Library_Unit_Bodies;
limited with Program.Library_Unit_Declarations;
limited with Program.Subunits;
with Program.Element_Vectors;
with Program.Elements;
package Program.Compilation_Units is
pragma Pure;
-- A specific Compilation_Unit value is valid (usable) for as long as the
-- Context variable, used to create it, remains open. Once an Context is
-- closed, all associated Compilation_Unit values become invalid. It is
-- erroneous to use an invalid Compilation_Unit value.
type Compilation_Unit is limited interface;
-- The Ada Compilation Unit abstraction:
--
-- The text of a program is submitted to the compiler in one or more
-- compilations. Each compilation is a succession of compilation units.
--
-- Compilation units are composed of three distinct parts:
--
-- a) A context clause.
--
-- b) The declaration of a library_item or unit.
--
-- c) Pragmas that apply to the compilation, of which the unit is a part.
--
-- The context clause contains zero or more with clauses, use clauses,
-- pragma elaborates, and possibly other pragmas.
--
-- We treat Pragmas that appear immediately after the context clause and
-- before the subsequent declaration part as belonging to the context
-- clause part.
--
-- The declaration associated with a compilation unit is one of: a package,
-- a procedure, a function, a generic, or a subunit for normal units.
--
-- The abstract type Compilation_Unit is a handle for compilation units as
-- a whole. An object of the type Compilation_Unit deals with the external
-- view of compilation units such as their relationships with other units
-- or their compilation attributes.
type Compilation_Unit_Access is access all Compilation_Unit'Class
with Storage_Size => 0;
function Assigned (Self : access Compilation_Unit'Class) return Boolean
is (Self /= null);
not overriding function Compilation (Self : access Compilation_Unit)
return Program.Compilations.Compilation_Access is abstract;
-- Return corresponding compilation
not overriding function Full_Name
(Self : access Compilation_Unit) return Text is abstract;
-- Returns the string image of the fully expanded Ada name of the given
-- compilation unit. This may be a simple name ("A") of a root library
-- unit, or an expanded name ("A.B") of a subunit or non-root child unit.
-- An expanded name shall contain the full parent_unit_name as its prefix.
-- Returns an empty string for the predefined Standard library unit.
not overriding function Context_Clause_Elements
(Self : access Compilation_Unit)
return Program.Element_Vectors.Element_Vector_Access is abstract;
-- with Post'Class =>
-- (Context_Clause_Elements'Result.Is_Empty
-- or else (for all X in Context_Clause_Elements'Result.Each_Element
-- => X.Element.Is_Pragma
-- or X.Element.Is_With_Clause
-- or X.Element.Is_Use_Clause));
-- Returns a list of with clauses, use clauses, and pragmas that explicitly
-- appear in the context clause of the compilation unit, in their order of
-- appearance.
not overriding function Unit_Declaration (Self : access Compilation_Unit)
return not null Program.Elements.Element_Access is abstract
with Post'Class => (Unit_Declaration'Result.Is_Declaration);
-- Returns the element representing the declaration of the compilation_unit
not overriding function Is_Subunit_Unit
(Self : Compilation_Unit) return Boolean is abstract;
-- Return True if Self is a subunit.
function Is_Subunit
(Self : Compilation_Unit'Class) return Boolean
is (Self.Is_Subunit_Unit);
-- Return True if Self is a subunit.
function To_Subunit (Self : access Compilation_Unit'Class)
return Program.Subunits.Subunit_Access
with Pre => Self.Is_Subunit;
-- Convert to the subunit type.
not overriding function Is_Library_Item_Unit
(Self : Compilation_Unit) return Boolean is abstract;
-- Return True if Self is a library_item.
function Is_Library_Item
(Self : Compilation_Unit'Class) return Boolean
is (Self.Is_Library_Item_Unit);
-- Return True if Self is a library_item.
function To_Library_Item (Self : access Compilation_Unit'Class)
return Program.Library_Items.Library_Item_Access
with Pre => Self.Is_Library_Item;
-- Convert to the library_item type.
not overriding function Is_Library_Unit_Body_Unit
(Self : Compilation_Unit) return Boolean is abstract;
-- Return True if Self is a library_unit_body.
function Is_Library_Unit_Body
(Self : Compilation_Unit'Class) return Boolean
is (Self.Is_Library_Unit_Body_Unit);
-- Return True if Self is a library_unit_body.
function To_Library_Unit_Body (Self : access Compilation_Unit'Class)
return Program.Library_Unit_Bodies.Library_Unit_Body_Access
with Pre => Self.Is_Library_Unit_Body;
-- Convert to the library_unit_body type.
not overriding function Is_Library_Unit_Declaration_Unit
(Self : Compilation_Unit) return Boolean is abstract;
-- Return True if Self is a library_unit_declaration.
function Is_Library_Unit_Declaration
(Self : Compilation_Unit'Class) return Boolean
is (Self.Is_Library_Unit_Declaration_Unit);
-- Return True if Self is a library_unit_declaration.
function To_Library_Unit_Declaration (Self : access Compilation_Unit'Class)
return Program.Library_Unit_Declarations.Library_Unit_Declaration_Access
with Pre => Self.Is_Library_Unit_Declaration;
-- Convert to the library_unit_declaration type.
end Program.Compilation_Units;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 5 4 --
-- --
-- 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_54 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_54;
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_54 or SetU_54 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_54 --
------------
function Get_54 (Arr : System.Address; N : Natural) return Bits_54 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_54;
-------------
-- GetU_54 --
-------------
function GetU_54 (Arr : System.Address; N : Natural) return Bits_54 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_54;
------------
-- Set_54 --
------------
procedure Set_54 (Arr : System.Address; N : Natural; E : Bits_54) 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_54;
-------------
-- SetU_54 --
-------------
procedure SetU_54 (Arr : System.Address; N : Natural; E : Bits_54) 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_54;
end System.Pack_54;
|
------------------------------------------------------------------------------
-- --
-- Ada binding for OpenGL/WebGL --
-- --
-- Examples Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 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. --
-- --
------------------------------------------------------------------------------
package Pyramid is
pragma Pure;
end Pyramid;
|
-- { dg-do compile }
with Pack10_Pkg; use Pack10_Pkg;
package Pack10 is
type Boolean_Vector is array (Positive range <>) of Boolean;
type Packed_Boolean_Vector is new Boolean_Vector;
pragma Pack (Packed_Boolean_Vector);
procedure My_Proc is new Proc (Packed_Boolean_Vector);
end Pack10;
|
------------------------------------------------------------------------------
-- --
-- Ada binding for OpenGL/WebGL --
-- --
-- Examples Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 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. --
-- --
------------------------------------------------------------------------------
with OpenGL.Contexts.Internals;
with OpenGL.Textures;
with GLFW;
with Pyramid.Programs;
procedure Pyramid.Driver is
use type OpenGL.GLfloat;
Points : constant Pyramid.Programs.Vertex_Data_Array
:= (((0.0, 0.5, 0.0), (0.5, 1.0)),
((0.5, -0.5, 0.0), (1.0, 0.0)),
((-0.5, -0.5, 0.0), (0.0, 0.0)));
Img : constant array (1 .. 9, 1 .. 3) of OpenGL.GLubyte :=
((255, 0, 0), (127, 0, 0), (0, 0, 127),
(127, 255, 0), (0, 127, 0), (0, 0, 127),
(32, 0, 255), (0, 0, 127), (0,0, 127));
Unit : constant OpenGL.Texture_Unit := 0;
Context : OpenGL.Contexts.OpenGL_Context;
Buffer :
Pyramid.Programs.Vertex_Data_Buffers.OpenGL_Buffer (OpenGL.Vertex);
Program : Pyramid.Programs.Pyramid_Program;
Texture : OpenGL.Textures.OpenGL_Texture (OpenGL.Texture_2D);
begin
Context.Create;
Context.Functions.Enable (OpenGL.GL_DEPTH_TEST);
Buffer.Create;
Buffer.Bind;
Buffer.Allocate (Points);
Texture.Create;
Texture.Bind (Unit);
Texture.Set_Image_2D
(0, OpenGL.GL_RGB, 3, 3, OpenGL.GL_UNSIGNED_BYTE, Img'Address);
Texture.Set_Parameter (OpenGL.GL_TEXTURE_MIN_FILTER, OpenGL.GL_LINEAR);
Texture.Set_Parameter (OpenGL.GL_TEXTURE_MAG_FILTER, OpenGL.GL_LINEAR);
Program.Initialize;
Program.Bind;
Program.Set_Vertex_Data_Buffer (Buffer);
Program.Set_Texture_Unit (Unit);
declare
use type OpenGL.GLbitfield;
Clear_Flag : OpenGL.Clear_Buffer_Mask :=
OpenGL.GL_DEPTH_BUFFER_BIT + OpenGL.GL_COLOR_BUFFER_BIT;
Window : GLFW.GLFWwindow_Access :=
OpenGL.Contexts.Internals.Current_GLFW_Context;
begin
while GLFW.glfwWindowShouldClose (Window) in 0 loop
Context.Functions.Clear (Clear_Flag);
Context.Functions.Draw_Arrays (OpenGL.GL_TRIANGLES, 0, Points'Length);
GLFW.glfwPollEvents;
GLFW.glfwSwapBuffers (Window);
end loop;
end;
end Pyramid.Driver;
|
with Ada.Text_IO; use Ada.Text_IO;
with Quaternions;
procedure Test_Quaternion is
package Float_Quaternion is new Quaternions (Float);
use Float_Quaternion;
q : Quaternion := (1.0, 2.0, 3.0, 4.0);
q1 : Quaternion := (2.0, 3.0, 4.0, 5.0);
q2 : Quaternion := (3.0, 4.0, 5.0, 6.0);
r : Float := 7.0;
begin
Put_Line ("q = " & Image (q));
Put_Line ("q1 = " & Image (q1));
Put_Line ("q2 = " & Image (q2));
Put_Line ("r =" & Float'Image (r));
Put_Line ("abs q =" & Float'Image (abs q));
Put_Line ("abs q1 =" & Float' Image (abs q1));
Put_Line ("abs q2 =" & Float' Image (abs q2));
Put_Line ("-q = " & Image (-q));
Put_Line ("conj q = " & Image (Conj (q)));
Put_Line ("q1 + q2 = " & Image (q1 + q2));
Put_Line ("q2 + q1 = " & Image (q2 + q1));
Put_Line ("q * r = " & Image (q * r));
Put_Line ("r * q = " & Image (r * q));
Put_Line ("q1 * q2 = " & Image (q1 * q2));
Put_Line ("q2 * q1 = " & Image (q2 * q1));
end Test_Quaternion;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- ADA.NUMERICS.GENERIC_ELEMENTARY_FUNCTIONS --
-- --
-- S p e c --
-- --
-- $Revision: 2 $ --
-- --
-- This specification is adapted from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
generic
type Float_Type is digits <>;
package Ada.Numerics.Generic_Elementary_Functions is
pragma Pure (Generic_Elementary_Functions);
function Sqrt (X : Float_Type'Base) return Float_Type'Base;
function Log (X : Float_Type'Base) return Float_Type'Base;
function Log (X, Base : Float_Type'Base) return Float_Type'Base;
function Exp (X : Float_Type'Base) return Float_Type'Base;
function "**" (Left, Right : Float_Type'Base) return Float_Type'Base;
function Sin (X : Float_Type'Base) return Float_Type'Base;
function Sin (X, Cycle : Float_Type'Base) return Float_Type'Base;
function Cos (X : Float_Type'Base) return Float_Type'Base;
function Cos (X, Cycle : Float_Type'Base) return Float_Type'Base;
function Tan (X : Float_Type'Base) return Float_Type'Base;
function Tan (X, Cycle : Float_Type'Base) return Float_Type'Base;
function Cot (X : Float_Type'Base) return Float_Type'Base;
function Cot (X, Cycle : Float_Type'Base) return Float_Type'Base;
function Arcsin (X : Float_Type'Base) return Float_Type'Base;
function Arcsin (X, Cycle : Float_Type'Base) return Float_Type'Base;
function Arccos (X : Float_Type'Base) return Float_Type'Base;
function Arccos (X, Cycle : Float_Type'Base) return Float_Type'Base;
function Arctan
(Y : Float_Type'Base;
X : Float_Type'Base := 1.0)
return Float_Type'Base;
function Arctan
(Y : Float_Type'Base;
X : Float_Type'Base := 1.0;
Cycle : Float_Type'Base)
return Float_Type'Base;
function Arccot
(X : Float_Type'Base;
Y : Float_Type'Base := 1.0)
return Float_Type'Base;
function Arccot
(X : Float_Type'Base;
Y : Float_Type'Base := 1.0;
Cycle : Float_Type'Base)
return Float_Type'Base;
function Sinh (X : Float_Type'Base) return Float_Type'Base;
function Cosh (X : Float_Type'Base) return Float_Type'Base;
function Tanh (X : Float_Type'Base) return Float_Type'Base;
function Coth (X : Float_Type'Base) return Float_Type'Base;
function Arcsinh (X : Float_Type'Base) return Float_Type'Base;
function Arccosh (X : Float_Type'Base) return Float_Type'Base;
function Arctanh (X : Float_Type'Base) return Float_Type'Base;
function Arccoth (X : Float_Type'Base) return Float_Type'Base;
end Ada.Numerics.Generic_Elementary_Functions;
|
-- Copyright 2012-2021 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package body Pck is
procedure Do_Nothing is
begin
null;
end Do_Nothing;
end Pck;
|
-- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
with Ada.Containers.Hashed_Maps;
with Ada.Directories;
with Ada.Exceptions;
with Ada.Characters.Handling;
with Ada.Strings.Fixed;
with Ada.Text_IO;
with Tokenization;
package body Specs is
use Ada.Text_IO;
use Ada.Containers;
procedure Wrong_Token (Cur : Tokenization.Token; Message : String) is
begin
raise Parsing_Error with Message & ": " & Tokenization.To_String (Cur);
end Wrong_Token;
function Indexed_Name (Prefix : Character; Index : Positive) return String is
Img : constant String := Index'Img;
begin
return Prefix & Img (Img'First + 1 .. Img'Last);
end Indexed_Name;
procedure Put_Signature (File : in out File_Type; Sig: Signature;
Real_Names : Boolean) is
Index : Positive := 1;
First : Boolean;
begin
if Param_Lists.Length (Sig.Params) > 0 then
Put (File, " (");
for Param of Sig.Params loop
if Index > 1 then
Put (File, "; ");
end if;
First := True;
for Name of Param.Names loop
if First then
First := False;
else
Put (File, ", ");
end if;
if Real_Names then
Put (File, Name);
else
Put (File, Indexed_Name ('P', Index));
end if;
Index := Index + 1;
end loop;
Put (File, " : ");
case Param.Mode is
when Mode_In => null;
when Mode_Out => Put (File, "out ");
when Mode_In_Out => Put (File, "in out ");
when Mode_Access => Put (File, "access ");
when Mode_Access_Constant => Put (File, "access constant ");
end case;
Put (File, To_String (Param.Type_Name));
end loop;
Put (File, ')');
end if;
if Length (Sig.Return_Type) > 0 then
Put (File, " return " & To_String (Sig.Return_Type));
end if;
end Put_Signature;
procedure Parse_File (Proc : in out Processor; Path : String) is
use Tokenization;
use Ada.Exceptions;
function Symbol_Hash (S : Symbol_Id) return Ada.Containers.Hash_Type is
(Ada.Containers.Hash_Type (S));
package Symbol_To_Index is new Ada.Containers.Hashed_Maps
(Tokenization.Symbol_Id, Positive, Symbol_Hash, Tokenization."=");
Subroutine_Defs : Symbol_To_Index.Map;
T : Tokenizer := Tokenize (Path);
Data : Spec_Data := Spec_Data'(File_Base_Name => To_Unbounded_String
(Ada.Directories.Base_Name (Path)), others => <>);
function Get_Name (Start : Token; Name : out Unbounded_String)
return Token is
-- returns the first token after the name
Recent_Was_Identifier : Boolean := True;
begin
if Start.Kind /= Identifier then
Wrong_Token (Start, "Unexpected token (expected identifier)");
end if;
Name := To_Unbounded_String (Start.Content);
loop
declare
Cur : constant Token := Next (T);
begin
if Recent_Was_Identifier then
if Cur.Kind /= Delimiter or Cur.Content /= "." then
return Copy (Cur);
end if;
elsif Cur.Kind /= Identifier or else Is_Keyword (Cur.Id) then
Wrong_Token (Cur, "Unexpected token (expected identifier))");
end if;
Recent_Was_Identifier := not Recent_Was_Identifier;
Name := Name & Cur.Content;
end;
end loop;
end Get_Name;
procedure Process_With is
Previous_Was_Id : Boolean := True;
Content : Unbounded_String := To_Unbounded_String ("with");
begin
loop
declare
Cur : constant Token := Next (T);
begin
exit when Cur.Kind = Delimiter and Cur.Content = ";";
if Previous_Was_Id and Cur.Kind = Identifier then
Content := Content & ' ';
end if;
Content := Content & Cur.Content;
Previous_Was_Id := Cur.Kind = Identifier;
end;
end loop;
Data.Withs.Append (To_String (Content) & ";");
end Process_With;
procedure Gen_Copy_Item (Start : Token) is
Previous_Was_Id : Boolean := True;
Content : Unbounded_String := To_Unbounded_String (Start.Content);
begin
loop
declare
Cur : constant Token := Next (T);
begin
exit when Paren_Depth (T) = 0 and Cur.Kind = Delimiter and
Cur.Content = ";";
if Previous_Was_Id and Cur.Kind = Identifier then
Content := Content & ' ';
end if;
Content := Content & Cur.Content;
Previous_Was_Id := Cur.Kind = Identifier;
end;
end loop;
Data.Items.Append (Body_Item'(Kind => Copy,
To_Copy => Content & ";"));
end Gen_Copy_Item;
procedure Gen_Subprogram_Item (Start : Token) is
Sig : Signature;
Read_Property : access function return String;
function Read_Parenthesed_Name return String is
Open_Paren : constant Token := Next (T);
Name_String : constant Token := Next (T);
Close_Paren : constant Token := Next (T);
begin
if Open_Paren.Kind /= Delimiter or else
Open_Paren.Content /= "(" then
Wrong_Token (Open_Paren, "Unexpected token, expected `(`");
elsif Name_String.Kind /= String_Literal then
Wrong_Token (Name_String, "Unexpected token, expected string");
elsif Close_Paren.Kind /= Delimiter or else
Close_Paren.Content /= ")" then
Wrong_Token (Close_Paren, "Unexpected token, expected `)`");
end if;
return Name_String.Content;
end Read_Parenthesed_Name;
function Read_Aspect_Value return String is
Arrow : constant Token := Next (T);
Value : constant Token := Next (T);
begin
if Arrow.Kind /= Delimiter or else Arrow.Content /= "=>" then
Wrong_Token (Arrow, "Unexpected token, expected `=>`");
elsif Value.Kind /= String_Literal then
Wrong_Token (Value, "Unexpected token, expected string");
end if;
return Value.Content;
end Read_Aspect_Value;
procedure Finish_Sig (From : Token) is
procedure Start_Properties (Starting : Token) is
begin
if Starting.Kind = Identifier then
case Starting.Id is
when Keyword_With =>
Read_Property := Read_Aspect_Value'Access;
return;
when Keyword_Is =>
Read_Property := Read_Parenthesed_Name'Access;
return;
when others => null;
end case;
end if;
Wrong_Token (Starting,
"Unexpected token (expected ""with"" or ""is"")");
end Start_Properties;
begin
case Start.Id is
when Keyword_Procedure => Start_Properties (From);
when Keyword_Function =>
if From.Kind /= Identifier or else From.Id /= Keyword_Return then
Wrong_Token (From, "Unexpected token (expected ""return"")");
end if;
declare
After : constant Token := Get_Name (Next (T), Sig.Return_Type);
begin
Start_Properties (After);
end;
when others => null;
end case;
end Finish_Sig;
function Param_Names return String_Lists.Vector is
begin
return Ret : String_Lists.Vector do
loop
declare
Cur : constant Token := Next (T);
begin
if Cur.Kind /= Identifier then
Wrong_Token (Cur, "Unexpected token (expected identifier)");
end if;
Ret.Append (Cur.Content);
end;
declare
Cur : constant Token := Next (T);
begin
if Cur.Kind /= Delimiter then
Wrong_Token (Cur, "Unexpected token (expected delimiter)");
end if;
exit when Cur.Content = ":";
if Cur.Content /= "," then
Wrong_Token (Cur, "Unexpected token (expected `,`)");
end if;
end;
end loop;
end return;
end Param_Names;
function Param_Type (Mode : out Param_Mode;
Name : out Unbounded_String) return Token is
-- returns the next token
In_Seen, Out_Seen, Access_Seen, Constant_Seen : Boolean := False;
begin
loop
declare
Cur : constant Token := Next (T);
begin
if Cur.Kind /= Identifier then
Wrong_Token (Cur, "Unexpected token (expected param type)");
end if;
case Cur.Id is
when Keyword_In =>
if In_Seen then
raise Parsing_Error with "Duplicate `in`!";
end if;
In_Seen := True;
when Keyword_Out =>
if Out_Seen then
raise Parsing_Error with "Duplicate `in`!";
end if;
Out_Seen := True;
when Keyword_Access =>
if Access_Seen then
raise Parsing_Error with "Duplicate `in`!";
end if;
Access_Seen := True;
when Keyword_Constant =>
if Constant_Seen then
raise Parsing_Error with "Duplicate `constant`!";
elsif not Access_Seen then
raise Parsing_Error with "`constant` is illegal here!";
end if;
Constant_Seen := True;
when others =>
if Access_Seen then
if In_Seen or Out_Seen then
raise Parsing_Error with
"No `in` or `out` allowed together with `access`!";
end if;
if Constant_Seen then
Mode := Mode_Access_Constant;
else
Mode := Mode_Access;
end if;
elsif Out_Seen then
if In_Seen then
Mode := Mode_In_Out;
else
Mode := Mode_Out;
end if;
else
Mode := Mode_In;
end if;
return Get_Name (Cur, Name);
end case;
end;
end loop;
end Param_Type;
procedure Read_Param_List is
begin
loop
declare
Param : Parameter :=
Parameter'(Names => Param_Names, others => <>);
After : constant Token :=
Param_Type (Param.Mode, Param.Type_Name);
begin
Sig.Params.Append (Param);
if After.Kind /= Delimiter or
(After.Content /= ";" and After.Content /= ")") then
Wrong_Token (After,
"Unexpected token (expected `;` or `)`)");
end if;
exit when After.Content = ")";
end;
end loop;
end Read_Param_List;
function Singleton (Sig : Signature) return Sig_Lists.Vector is
begin
return Ret : Sig_Lists.Vector do
Ret.Append (Sig);
end return;
end Singleton;
function Expand (List : Sig_Lists.Vector; Sig : Signature)
return Sig_Lists.Vector is
begin
return Ret : Sig_Lists.Vector := List do
Ret.Append (Sig);
end return;
end Expand;
Name_Token : constant Token := Next (T);
Name : constant String := Name_Token.Content;
Kind_Seen : Boolean := False;
Wrappers : String_Lists.Vector;
Wrapper_Pos : Natural := 0;
begin
if Name_Token.Kind /= Identifier then
Wrong_Token (Name_Token, "Unexpected token (expected identifier)");
end if;
declare
Cur : constant Token := Next (T);
begin
if Cur.Kind /= Delimiter or else Cur.Content /= "(" then
Finish_Sig (Cur);
else
Read_Param_List;
Finish_Sig (Next (T));
end if;
end;
<<istoken>>
declare
Cur : constant Token := Next (T);
begin
if Cur.Kind /= Identifier then
Wrong_Token (Cur, "Unexpected token (expected `Static` or `Dynamic`)");
end if;
case Cur.Id is
when Keyword_Static =>
if Kind_Seen then
Wrong_Token (Cur, "Duplicate kind; only one of (`Static`, `Dynamic`) allowed.");
else
Kind_Seen := True;
end if;
declare
use type Symbol_To_Index.Cursor;
Pos : constant Symbol_To_Index.Cursor :=
Subroutine_Defs.Find (Name_Token.Id);
begin
if Pos = Symbol_To_Index.No_Element then
Data.Items.Append (Body_Item'(
Kind => Static, S_Name => To_Unbounded_String (Name),
S_GL_Name => To_Unbounded_String (Read_Property.all),
Sigs => Singleton (Sig)
));
Subroutine_Defs.Insert (Name_Token.Id,
Positive (Data.Items.Length));
else
declare
Item_Pos : constant Positive :=
Symbol_To_Index.Element (Pos);
Old : constant Body_Item :=
Data.Items.Element (Item_Pos);
GL_Name : constant Unbounded_String :=
To_Unbounded_String (Read_Property.all);
begin
if Old.Kind /= Static then
raise Parsing_Error with "Name """ & Name &
""" has previous definition which is not Static!";
elsif Old.S_GL_Name /= GL_Name then
raise Parsing_Error with """" & Name &
""" has previous definition with OpenGL name """ &
To_String (Old.S_GL_Name) & """ which differs from """ &
To_String (GL_Name) & """!";
end if;
Data.Items.Replace_Element (Symbol_To_Index.Element (Pos),
Body_Item'(
Kind => Static,
S_Name => To_Unbounded_String (Name),
S_GL_Name => GL_Name,
Sigs => Expand (Old.Sigs, Sig)
));
Wrapper_Pos := Item_Pos;
end;
end if;
end;
when Keyword_Dynamic =>
if Kind_Seen then
Wrong_Token (Cur, "Duplicate kind; only one of (`Static`, `Dynamic`) allowed.");
else
Kind_Seen := True;
end if;
declare
Sig_Id : Positive := 1;
begin
while Natural (Sig_Id) <= Natural (Proc.Dynamic_Subprogram_Types.Length)
loop
exit when Proc.Dynamic_Subprogram_Types.Element (Sig_Id) =
Sig;
Sig_Id := Sig_Id + 1;
end loop;
if Natural (Sig_Id) > Natural (Proc.Dynamic_Subprogram_Types.Length) then
Proc.Dynamic_Subprogram_Types.Append (Sig);
end if;
Data.Items.Append (Body_Item'(
Kind => Dynamic,
D_Name => To_Unbounded_String (Name),
D_GL_Name => To_Unbounded_String (Read_Property.all),
Sig_Id => Sig_Id
));
end;
when Keyword_Wrapper =>
Wrappers.Append (Read_Property.all);
when others =>
Wrong_Token (Cur,
"Unexpected identifier (expected `Static` or `Dynamic`)");
end case;
declare
Cur : constant Token := Next (T);
begin
if Cur.Kind /= Delimiter then
Wrong_Token (Cur, "Unexpected token (expected `;` or `,`)");
elsif Cur.Content = "," then
goto istoken;
elsif Cur.Content /= ";" then
Wrong_Token (Cur, "Unexpected token (expected `;` or `,`)");
end if;
end;
if Wrapper_Pos = 0 then
Data.Wrappers.Append (Wrappers);
else
Data.Wrappers.Replace_Element (Wrapper_Pos,
String_Lists."&" (Data.Wrappers.Element (Wrapper_Pos),
Wrappers));
end if;
end;
end Gen_Subprogram_Item;
procedure Gen_Use is
Tmp : Unbounded_String := To_Unbounded_String ("");
begin
loop
declare
Ident : constant Token := Next (T);
begin
if Ident.Kind /= Identifier or else Is_Keyword (Ident.Id) then
Wrong_Token (Ident, "Unexpected token, expected identifier");
end if;
Append (Tmp, Ident.Content);
end;
declare
Delim : constant Token := Next (T);
begin
if Delim.Kind /= Delimiter then
Wrong_Token (Delim, "Unexpected token, expected `;` or `.`");
elsif Delim.Content = ";" then
exit;
elsif Delim.Content = "." then
Append (Tmp, '.');
else
Wrong_Token (Delim, "Unexpected token, expected `;` or `.`");
end if;
end;
end loop;
Data.Uses.Append (To_String (Tmp));
end Gen_Use;
begin
loop
<<continue1>>
declare
Cur : constant Token := Next (T);
begin
if Cur.Kind = Identifier then
case Cur.Id is
when Keyword_With => Process_With;
when Keyword_Spec => exit;
when others =>
Wrong_Token (Cur,
"Unexpected identifier (expected `with` or `spec`)");
end case;
elsif Cur.Kind = Comment then
goto continue1;
else
Wrong_Token (Cur, "Unexpected token (expected identifier)");
end if;
end;
end loop;
declare
Cur : constant Token := Get_Name (Next (T), Data.Name);
begin
if Cur.Kind /= Identifier or else Cur.Id /= Keyword_Is then
Wrong_Token(Cur, "Unexpected token (expected `is`)");
end if;
end;
Put_Line ("Processing spec """ & To_String (Data.Name) & """");
loop
<<continue2>>
declare
Cur : constant Token := Next (T);
begin
if Cur.Kind = Comment then
goto continue2;
elsif Cur.Kind /= Identifier then
Wrong_Token (Cur, "Unexpected token (expected identifier)");
end if;
case Cur.Id is
when Keyword_Pragma | Keyword_Type | Keyword_Subtype =>
Gen_Copy_Item (Cur);
when Keyword_Function | Keyword_Procedure =>
Gen_Subprogram_Item (Cur);
when Keyword_Use => Gen_Use;
when Keyword_End => exit;
when others =>
Wrong_Token (Cur, "Unexpected identifier (expected keyword)");
end case;
end;
end loop;
declare
End_Name : Unbounded_String;
Cur : constant Token := Get_Name (Next (T), End_Name);
begin
if End_Name /= Data.Name then
raise Parsing_Error with "Wrong spec name after `end` (expected """ &
To_String (Data.Name) & """, got """ & To_String (End_Name) & """).";
end if;
if Cur.Kind /= Delimiter or else Cur.Content /= ";" then
Wrong_Token (Cur, "Unexpected token (expected `;`)");
end if;
end;
Proc.List.Append (Data);
exception when Error : Parsing_Error | Tokenization.Tokenization_Error =>
raise Parsing_Error with "Parsing error at line" & Line (T)'Img &
", column" & Column (T)'Img & ":" & Character'Val (10) &
Exception_Message (Error);
end Parse_File;
function First (Proc : Processor) return Spec is
begin
if Proc.List.Length > 0 then
return 1;
else
return No_Spec;
end if;
end First;
function Next (Proc : Processor; Cur : Spec) return Spec is
begin
if Cur = No_Spec then
raise Constraint_Error;
end if;
return Ret : Spec := Cur + 1 do
if Count_Type (Ret) > Proc.List.Length then
Ret := No_Spec;
end if;
end return;
end Next;
procedure Write_API (Proc : Processor; Cur : Spec;
Dir_Path : String) is
use Ada.Directories;
Target : File_Type;
Data : constant Spec_Data := Proc.List.Element (Cur);
Name : constant String := To_String (Data.Name);
File_Name : constant String :=
Compose (Dir_Path, To_String (Data.File_Base_Name), "ads");
Is_Root : constant Boolean := Name = "GL.API";
begin
Put_Line ("Writing API file for spec """ &
To_String (Data.Name) & """: " & File_Name);
Create (Target, Out_File, File_Name);
Put_Line (Target, "-- part of OpenGLAda, (c) 2017 Felix Krause");
Put_Line (Target, "-- released under the terms of the MIT license, see the file ""COPYING""");
Put_Line (Target, "-- Autogenerated by Generate, do not edit");
for With_Stmt of Data.Withs loop
Put_Line (Target, With_Stmt);
end loop;
Put_Line (Target,
(if Is_Root then "private " else "") & "package " & Name & " is");
Put_Line (Target, " pragma Preelaborate;");
for Use_Item of Data.Uses loop
Put_Line (Target, " use " & Use_Item & ";");
end loop;
if Is_Root then
declare
Sig_Id : Positive := 1;
begin
for Sig of Proc.Dynamic_Subprogram_Types loop
declare
Type_Name : constant String := Indexed_Name ('T', Sig_Id);
Is_Function : constant Boolean := Length (Sig.Return_Type) > 0;
begin
Put (Target, " type " & Type_Name & " is access ");
Put (Target, (if Is_Function then "function" else "procedure"));
Put_Signature (Target,
Proc.Dynamic_Subprogram_Types.Element (Sig_Id), False);
Put_Line (Target, ";");
Put_Line (Target, " pragma Convention (StdCall, " & Type_Name & ");");
end;
Sig_Id := Sig_Id + 1;
end loop;
end;
end if;
for Item of Data.Items loop
case Item.Kind is
when Copy =>
Put_Line (Target, " " & To_String (Item.To_Copy));
when Static =>
declare
Sub_Name : constant String := To_String (Item.S_Name);
begin
for Sig of Item.Sigs loop
if Length (Sig.Return_Type) = 0 then
Put (Target, " procedure " & Sub_Name);
else
Put (Target, " function " & Sub_Name);
end if;
Put_Signature (Target, Sig, True);
Put_Line (Target, ";");
end loop;
Put_Line (Target, " pragma Import (StdCall, " & Sub_Name &
", """ & To_String (Item.S_GL_Name) & """);");
end;
when Dynamic =>
declare
Sub_Name : constant String := To_String (Item.D_Name);
Type_Name : constant String := Indexed_Name ('T', Item.Sig_Id);
begin
Put_Line (Target, " " & Sub_Name & " : " & Type_Name & ";");
end;
end case;
end loop;
Put_Line (Target, "end " & Name & ";");
Close (Target);
end Write_API;
procedure Write_Init (Proc : Processor; Dir_Path : String) is
Target : File_Type;
procedure Write_Header is
begin
Put_Line (Target, "-- Autogenerated by Generate, do not edit");
Put_Line (Target, "with System;");
Put_Line (Target, "with Ada.Unchecked_Conversion;");
Put_Line (Target, "private with GL.API.Subprogram_Reference;");
for Spec_Data of Proc.List loop
Put_Line (Target, "private with " & To_String (Spec_Data.Name) & ";");
end loop;
Put_Line (Target, "procedure GL.Load_Function_Pointers is");
Put_Line (Target, " use GL.API;");
Put_Line (Target, " generic");
Put_Line (Target, " type Function_Reference is private;");
Put_Line (Target, " function Load (Function_Name : String) return Function_Reference;");
Put_Line (Target, " pragma Inline (Load);");
Put_Line (Target, " function Load (Function_Name : String) return Function_Reference is");
Put_Line (Target, " function As_Function_Reference is new Ada.Unchecked_Conversion (");
Put_Line (Target, " Source => System.Address, Target => Function_Reference);");
Put_Line (Target, " use type System.Address;");
Put_Line (Target, " Raw : System.Address := Subprogram_Reference (Function_Name);");
Put_Line (Target, " begin");
Put_Line (Target, " if Raw = System.Null_Address then");
Put_Line (Target, " Raw := Subprogram_Reference (Function_Name & ""ARB"");");
Put_Line (Target, " if Raw = System.Null_Address then");
Put_Line (Target, " Raw := Subprogram_Reference (Function_Name & ""EXT"");");
Put_Line (Target, " end if;");
Put_Line (Target, " end if;");
Put_Line (Target, " return As_Function_Reference (Raw);");
Put_Line (Target, " end Load;");
end Write_Header;
Index : Positive := 1;
begin
Put_Line ("Writing procedure ""GL.Init""");
Create (Target, Out_File, Ada.Directories.Compose (Dir_Path, "gl-load_function_pointers.adb"));
Write_Header;
for Sub_Type of Proc.Dynamic_Subprogram_Types loop
Put_Line (Target, " function Load_" & Indexed_Name ('T', Index) &
" is new Load (" & Indexed_Name ('T', Index) & ");");
Index := Index + 1;
end loop;
Put_Line (Target, "begin");
for Data of Proc.List loop
declare
Spec_Name : constant String := To_String (Data.Name);
begin
for Item of Data.Items loop
if Item.Kind = Dynamic then
Put_Line (Target, " " & Spec_Name &
'.' & To_String (Item.D_Name) & " := Load_" &
Indexed_Name ('T', Item.Sig_Id) & " (""" &
To_String (Item.D_GL_Name) & """);");
end if;
end loop;
end;
end loop;
Put_Line (Target, "end GL.Load_Function_Pointers;");
Close (Target);
end Write_Init;
procedure Write_Wrapper_Table (Proc : Processor;
Dir_Path, Interface_Folder : String) is
Target : File_Type;
procedure Write_Header is
begin
Put_Line (Target, "---");
Put_Line (Target, "layout: default");
Put_Line (Target, "title: OpenGL Mapping");
Put_Line (Target, "permalink: mapping.html");
Put_Line (Target, "---");
Put_Line (Target, "<!-- Autogenerated by generate tool, do not edit -->");
New_Line (Target);
Put_Line (Target, "| OpenGL Function Name | OpenGLAda Wrapper");
Put_Line (Target, "|----------------------+------------------");
end Write_Header;
function Get_Wrapper_Link (Qualified_Name : String) return String is
use Ada.Characters.Handling;
Prefix : constant String := "https://github.com/flyx/OpenGLAda/blob/master/src/gl/interface/";
File_Name : Unbounded_String := To_Unbounded_String (0);
Subroutine_Name : Unbounded_String := To_Unbounded_String (0);
begin
for Index in Qualified_Name'Range loop
case Qualified_Name (Index) is
when '.' =>
if Length (File_Name) > 0 then
Append (File_Name, "-");
end if;
Append (File_Name, Subroutine_Name);
Subroutine_Name := To_Unbounded_String (0);
when others =>
Append (Subroutine_Name, To_Lower (Qualified_Name (Index)));
end case;
end loop;
Append (File_Name, ".ads");
declare
use Tokenization;
use Ada.Strings;
T : Tokenizer := Tokenize
(Ada.Directories.Compose (Interface_Folder, To_String (File_Name)));
Requested_Id : Symbol_Id;
begin
Register_Symbol (T, To_String (Subroutine_Name), Requested_Id);
loop
declare
Cur : constant Token := Next (T);
begin
if Cur.Kind = Identifier and then Cur.Id = Requested_Id
then
return Prefix & To_String (File_Name) & "#L" &
Fixed.Trim (Line (T)'Img, Left);
elsif Cur.Kind = Stream_End then
exit;
end if;
end;
end loop;
raise Parsing_Error with "Cannot find symbol " &
To_String (Subroutine_Name) & " in file " &
To_String (File_Name);
end;
end Get_Wrapper_Link;
begin
Put_Line ("Writing wrapper list");
Create (Target, Out_File, Ada.Directories.Compose (Dir_Path, "WrapperList.md"));
Write_Header;
for Data of Proc.List loop
for Index in Integer (Positive'First) .. Integer (Data.Items.Length) loop
declare
Item : constant Body_Item := Data.Items.Element (Index);
GL_Name : constant String := To_String (
if Item.Kind = Static then Item.S_GL_Name else Item.D_GL_Name);
Wrappers : constant String_Lists.Vector :=
Data.Wrappers.Element (Index);
begin
if Wrappers.Length > 0 then
Put (Target, "| `" & GL_Name & "` | ");
declare
First : Boolean := True;
begin
for Wrapper of Wrappers loop
if First then
First := False;
else
Put (Target, " <br/> ");
end if;
Put (Target,
"[" & Wrapper & "](" & Get_Wrapper_Link (Wrapper) &
")");
end loop;
end;
New_Line (Target);
end if;
end;
end loop;
end loop;
Close (Target);
end Write_Wrapper_Table;
end Specs;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . S T A C K _ C H E C K I N G . O P E R A T I O N S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1999-2009, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides a implementation of stack checking operations using
-- comparison with stack base and limit.
pragma Restrictions (No_Elaboration_Code);
-- We want to guarantee the absence of elaboration code because the binder
-- does not handle references to this package.
pragma Polling (Off);
-- Turn off polling, we do not want polling to take place during stack
-- checking operations. It causes infinite loops and other problems.
with System.Storage_Elements;
package System.Stack_Checking.Operations is
pragma Preelaborate;
procedure Update_Stack_Cache (Stack : Stack_Access);
-- Set the stack cache for the current task. Note that this is only for
-- optimization purposes, nothing can be assumed about the contents of the
-- cache at any time, see Set_Stack_Info.
--
-- The stack cache should contain the bounds of the current task. But
-- because the RTS is not aware of task switches, the stack cache may be
-- incorrect. So when the stack pointer is not within the bounds of the
-- stack cache, Stack_Check first update the cache (which is a costly
-- operation hence the need of a cache).
procedure Invalidate_Stack_Cache (Any_Stack : Stack_Access);
-- Invalidate cache entries for the task T that owns Any_Stack. This causes
-- the Set_Stack_Info function to be called during the next stack check
-- done by T. This can be used to interrupt task T asynchronously.
-- Stack_Check should be called in loops for this to work reliably.
function Stack_Check (Stack_Address : System.Address) return Stack_Access;
-- This version of Stack_Check should not be inlined
procedure Notify_Stack_Attributes
(Initial_SP : System.Address;
Size : System.Storage_Elements.Storage_Offset);
-- Register Initial_SP as the initial stack pointer value for the current
-- task when it starts and Size as the associated stack area size. This
-- should be called once, after the soft-links have been initialized and
-- prior to the first "Stack_Check" call.
private
Cache : aliased Stack_Access := Null_Stack;
pragma Export (C, Cache, "_gnat_stack_cache");
pragma Export (C, Stack_Check, "_gnat_stack_check");
end System.Stack_Checking.Operations;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S T R I N G S . B O U N D E D --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body Ada.Strings.Bounded is
package body Generic_Bounded_Length is
-- The subprograms in this body are those for which there is no
-- Bounded_String input, and hence no implicit information on the
-- maximum size. This means that the maximum size has to be passed
-- explicitly to the routine in Superbounded.
---------
-- "*" --
---------
function "*"
(Left : Natural;
Right : Character) return Bounded_String
is
begin
return Times (Left, Right, Max_Length);
end "*";
function "*"
(Left : Natural;
Right : String) return Bounded_String
is
begin
return Times (Left, Right, Max_Length);
end "*";
---------------
-- Replicate --
---------------
function Replicate
(Count : Natural;
Item : Character;
Drop : Strings.Truncation := Strings.Error) return Bounded_String
is
begin
return Super_Replicate (Count, Item, Drop, Max_Length);
end Replicate;
function Replicate
(Count : Natural;
Item : String;
Drop : Strings.Truncation := Strings.Error) return Bounded_String
is
begin
return Super_Replicate (Count, Item, Drop, Max_Length);
end Replicate;
-----------------------
-- To_Bounded_String --
-----------------------
function To_Bounded_String
(Source : String;
Drop : Strings.Truncation := Strings.Error) return Bounded_String
is
begin
return To_Super_String (Source, Max_Length, Drop);
end To_Bounded_String;
end Generic_Bounded_Length;
end Ada.Strings.Bounded;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 1 9 --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Storage_Elements;
with System.Unsigned_Types;
package body System.Pack_19 is
subtype Bit_Order is System.Bit_Order;
Reverse_Bit_Order : constant Bit_Order :=
Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
subtype Ofs is System.Storage_Elements.Storage_Offset;
subtype Uns is System.Unsigned_Types.Unsigned;
subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
use type System.Storage_Elements.Storage_Offset;
use type System.Unsigned_Types.Unsigned;
type Cluster is record
E0, E1, E2, E3, E4, E5, E6, E7 : Bits_19;
end record;
for Cluster use record
E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
end record;
for Cluster'Size use Bits * 8;
for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
1 +
1 * Boolean'Pos (Bits mod 2 = 0) +
2 * Boolean'Pos (Bits mod 4 = 0));
-- Use maximum possible alignment, given the bit field size, since this
-- will result in the most efficient code possible for the field.
type Cluster_Ref is access Cluster;
type Rev_Cluster is new Cluster
with Bit_Order => Reverse_Bit_Order,
Scalar_Storage_Order => Reverse_Bit_Order;
type Rev_Cluster_Ref is access Rev_Cluster;
------------
-- Get_19 --
------------
function Get_19
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_19
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => return RC.E0;
when 1 => return RC.E1;
when 2 => return RC.E2;
when 3 => return RC.E3;
when 4 => return RC.E4;
when 5 => return RC.E5;
when 6 => return RC.E6;
when 7 => return RC.E7;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end if;
end Get_19;
------------
-- Set_19 --
------------
procedure Set_19
(Arr : System.Address;
N : Natural;
E : Bits_19;
Rev_SSO : Boolean)
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => RC.E0 := E;
when 1 => RC.E1 := E;
when 2 => RC.E2 := E;
when 3 => RC.E3 := E;
when 4 => RC.E4 := E;
when 5 => RC.E5 := E;
when 6 => RC.E6 := E;
when 7 => RC.E7 := E;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end if;
end Set_19;
end System.Pack_19;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <vgodunko@gmail.com> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
package body Matreshka.DOM_Entities is
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Entity_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
Visitor.Enter_Entity
(XML.DOM.Entities.DOM_Entity_Access (Self), Control);
end Enter_Node;
-------------------
-- Get_Node_Name --
-------------------
overriding function Get_Node_Name
(Self : not null access constant Entity_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
raise Program_Error;
return League.Strings.Empty_Universal_String;
end Get_Node_Name;
-------------------
-- Get_Node_Type --
-------------------
overriding function Get_Node_Type
(Self : not null access constant Entity_Node) return XML.DOM.Node_Type
is
pragma Unreferenced (Self);
begin
return XML.DOM.Entity_Node;
end Get_Node_Type;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Entity_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
Visitor.Leave_Entity
(XML.DOM.Entities.DOM_Entity_Access (Self), Control);
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Entity_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
Iterator.Visit_Entity
(Visitor, XML.DOM.Entities.DOM_Entity_Access (Self), Control);
end Visit_Node;
end Matreshka.DOM_Entities;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- A U N I T . T E S T S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2009-2011, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- 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 is maintained by AdaCore (http://www.adacore.com). --
-- --
------------------------------------------------------------------------------
with AUnit.Simple_Test_Cases; use AUnit.Simple_Test_Cases;
package body AUnit.Test_Filters is
function Starts_With (Str : String; Prefix : String) return Boolean;
-- Whether Str starts with Prefix
-----------------
-- Starts_With --
-----------------
function Starts_With (Str : String; Prefix : String) return Boolean is
begin
if Str'Length < Prefix'Length then
return False;
end if;
return Str (Str'First .. Str'First + Prefix'Length - 1) = Prefix;
end Starts_With;
--------------
-- Set_Name --
--------------
procedure Set_Name (Filter : in out Name_Filter; Name : String) is
begin
Message_Free (Filter.Name);
Filter.Name := Format (Name);
end Set_Name;
---------------
-- Is_Active --
---------------
function Is_Active
(Filter : Name_Filter;
T : AUnit.Tests.Test'Class) return Boolean is
begin
if Filter.Name = null
or else Filter.Name.all = ""
then
return True;
end if;
if T not in AUnit.Simple_Test_Cases.Test_Case'Class
or else Name (AUnit.Simple_Test_Cases.Test_Case'Class (T)) = null
then
-- There is no name, so it doesn't match the filter
return False;
end if;
if Routine_Name (AUnit.Simple_Test_Cases.Test_Case'Class (T)) = null then
return Starts_With
(Name (AUnit.Simple_Test_Cases.Test_Case'Class (T)).all,
Filter.Name.all);
else
return Starts_With
(Name (AUnit.Simple_Test_Cases.Test_Case'Class (T)).all
& " : "
& Routine_Name (AUnit.Simple_Test_Cases.Test_Case'Class (T)).all,
Filter.Name.all);
end if;
end Is_Active;
end AUnit.Test_Filters;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- S Y S T E M . W I D _ W C H A R --
-- --
-- S p e c --
-- --
-- $Revision: 2 $ --
-- --
-- Copyright (c) 1992,1993,1994 NYU, All Rights Reserved --
-- --
-- The GNAT library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU Library General Public License as published by --
-- the Free Software Foundation; either version 2, or (at your option) any --
-- later version. The GNAT library is distributed in the hope that it will --
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- Library General Public License for more details. You should have --
-- received a copy of the GNU Library General Public License along with --
-- the GNAT library; see the file COPYING.LIB. If not, write to the Free --
-- Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
-- --
------------------------------------------------------------------------------
-- This package contains the routine used for Wide_Character'Width
with System.WCh_Con;
package System.Wid_WChar is
pragma Pure (Wid_WChar);
function Width_Wide_Character
(Lo, Hi : Wide_Character;
EM : System.WCh_Con.WC_Encoding_Method)
return Natural;
-- Compute Width attribute for non-static type derived from Wide_Character.
-- The arguments are the low and high bounds for the type. EM is the
-- wide-character encoding method.
end System.Wid_WChar;
|
-- Copyright 2008 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
First : Character := ASCII.NUL;
Last : Character := ASCII.NUL;
Length : Integer := 0;
procedure Call_Me (Str : String);
end Pck;
|
with Chebyshev, Ada.Text_IO, Numerics;
use Chebyshev, Ada.Text_IO, Numerics;
procedure Chebyshev_Test is
use Real_IO, Int_IO, Real_Functions;
N : constant Nat := 41;
L : constant Real := -0.45;
R : constant Real := 4.7;
X : Real_Vector := Chebyshev_Gauss_Lobatto (N, L, R);
F : Real_Vector (X'Range);
A : Real_Vector (X'Range);
Y : Real_Vector (1 .. 27);
Z : Real;
W : Real;
function Test (X : in Real) return Real is
begin
return X * Exp (-X) * Cos (4.0 * X) + Sin (X) ** 2 / (X + 1.0);
end Test;
begin
for I in X'Range loop
F (I) := Test (X (I));
end loop;
A := CGL_Transform (F);
for I in Y'Range loop
Y (I) := L + (R - L) * Real (I - 1) / Real (Y'Length - 1);
Z := Test (Y (I));
W := Interpolate (A, Y (I), L, R);
Put (Y (I), Aft => 3, Exp => 0); Put (", ");
Put (Z, Aft => 5, Exp => 0); Put (", ");
Put (W, Aft => 5, Exp => 0); Put (", ");
Put (100.0 * (Z - W) / (abs (Z) + 1.0e-10), Aft => 4, Exp => 0); New_Line;
end loop;
null;
end Chebyshev_Test;
|
with Resources7;
with Ada.Command_Line;
with Ada.Text_IO;
procedure Test7 is
use Resources7;
C : Content_Access := Get_Content ("config/test7.xml");
begin
if C = null then
Ada.Text_IO.Put_Line ("FAIL: No content 'config/test7.xml'");
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
return;
end if;
if C'Length /= 22 then
Ada.Text_IO.Put_Line ("FAIL: Invalid length for 'config/test7.xml'");
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
end if;
C := Get_Content ("CONFIG/TEST7.XML");
if C = null then
Ada.Text_IO.Put_Line ("FAIL: No content 'config/test7.xml'");
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
return;
end if;
C := Get_Content ("CoNfIg/TeSt7.XmL");
if C = null then
Ada.Text_IO.Put_Line ("FAIL: No content 'config/test7.xml'");
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
return;
end if;
Ada.Text_IO.Put ("PASS: ");
Ada.Text_IO.Put_Line (C.all);
end Test7;
|
pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
package avx512vlbwintrin_h is
-- Copyright (C) 2014-2017 Free Software Foundation, Inc.
-- This file is part of GCC.
-- GCC 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, or (at your option)
-- any later version.
-- GCC 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.
-- 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/>.
-- skipped func _mm256_mask_mov_epi8
-- skipped func _mm256_maskz_mov_epi8
-- skipped func _mm_mask_mov_epi8
-- skipped func _mm_maskz_mov_epi8
-- skipped func _mm256_mask_storeu_epi8
-- skipped func _mm_mask_storeu_epi8
-- skipped func _mm256_mask_loadu_epi16
-- skipped func _mm256_maskz_loadu_epi16
-- skipped func _mm_mask_loadu_epi16
-- skipped func _mm_maskz_loadu_epi16
-- skipped func _mm256_mask_mov_epi16
-- skipped func _mm256_maskz_mov_epi16
-- skipped func _mm_mask_mov_epi16
-- skipped func _mm_maskz_mov_epi16
-- skipped func _mm256_mask_loadu_epi8
-- skipped func _mm256_maskz_loadu_epi8
-- skipped func _mm_mask_loadu_epi8
-- skipped func _mm_maskz_loadu_epi8
-- skipped func _mm256_cvtepi16_epi8
-- skipped func _mm256_mask_cvtepi16_epi8
-- skipped func _mm256_maskz_cvtepi16_epi8
-- skipped func _mm_cvtsepi16_epi8
-- skipped func _mm_mask_cvtsepi16_epi8
-- skipped func _mm_maskz_cvtsepi16_epi8
-- skipped func _mm256_cvtsepi16_epi8
-- skipped func _mm256_mask_cvtsepi16_epi8
-- skipped func _mm256_maskz_cvtsepi16_epi8
-- skipped func _mm_cvtusepi16_epi8
-- skipped func _mm_mask_cvtusepi16_epi8
-- skipped func _mm_maskz_cvtusepi16_epi8
-- skipped func _mm256_cvtusepi16_epi8
-- skipped func _mm256_mask_cvtusepi16_epi8
-- skipped func _mm256_maskz_cvtusepi16_epi8
-- skipped func _mm256_mask_broadcastb_epi8
-- skipped func _mm256_maskz_broadcastb_epi8
-- skipped func _mm256_mask_set1_epi8
-- skipped func _mm256_maskz_set1_epi8
-- skipped func _mm_mask_broadcastb_epi8
-- skipped func _mm_maskz_broadcastb_epi8
-- skipped func _mm_mask_set1_epi8
-- skipped func _mm_maskz_set1_epi8
-- skipped func _mm256_mask_broadcastw_epi16
-- skipped func _mm256_maskz_broadcastw_epi16
-- skipped func _mm256_mask_set1_epi16
-- skipped func _mm256_maskz_set1_epi16
-- skipped func _mm_mask_broadcastw_epi16
-- skipped func _mm_maskz_broadcastw_epi16
-- skipped func _mm_mask_set1_epi16
-- skipped func _mm_maskz_set1_epi16
-- skipped func _mm256_permutexvar_epi16
-- skipped func _mm256_maskz_permutexvar_epi16
-- skipped func _mm256_mask_permutexvar_epi16
-- skipped func _mm_permutexvar_epi16
-- skipped func _mm_maskz_permutexvar_epi16
-- skipped func _mm_mask_permutexvar_epi16
-- skipped func _mm256_permutex2var_epi16
-- idx
-- skipped func _mm256_mask_permutex2var_epi16
-- idx
-- skipped func _mm256_mask2_permutex2var_epi16
-- idx
-- skipped func _mm256_maskz_permutex2var_epi16
-- idx
-- skipped func _mm_permutex2var_epi16
-- idx
-- skipped func _mm_mask_permutex2var_epi16
-- idx
-- skipped func _mm_mask2_permutex2var_epi16
-- idx
-- skipped func _mm_maskz_permutex2var_epi16
-- idx
-- skipped func _mm256_mask_maddubs_epi16
-- skipped func _mm256_maskz_maddubs_epi16
-- skipped func _mm_mask_maddubs_epi16
-- skipped func _mm_maskz_maddubs_epi16
-- skipped func _mm256_mask_madd_epi16
-- skipped func _mm256_maskz_madd_epi16
-- skipped func _mm_mask_madd_epi16
-- skipped func _mm_maskz_madd_epi16
-- skipped func _mm_movepi8_mask
-- skipped func _mm256_movepi8_mask
-- skipped func _mm_movepi16_mask
-- skipped func _mm256_movepi16_mask
-- skipped func _mm_movm_epi8
-- skipped func _mm256_movm_epi8
-- skipped func _mm_movm_epi16
-- skipped func _mm256_movm_epi16
-- skipped func _mm_test_epi8_mask
-- skipped func _mm_mask_test_epi8_mask
-- skipped func _mm256_test_epi8_mask
-- skipped func _mm256_mask_test_epi8_mask
-- skipped func _mm_test_epi16_mask
-- skipped func _mm_mask_test_epi16_mask
-- skipped func _mm256_test_epi16_mask
-- skipped func _mm256_mask_test_epi16_mask
-- skipped func _mm256_maskz_min_epu16
-- skipped func _mm256_mask_min_epu16
-- skipped func _mm_maskz_min_epu16
-- skipped func _mm_mask_min_epu16
-- skipped func _mm256_maskz_min_epi16
-- skipped func _mm256_mask_min_epi16
-- skipped func _mm256_maskz_max_epu8
-- skipped func _mm256_mask_max_epu8
-- skipped func _mm_maskz_max_epu8
-- skipped func _mm_mask_max_epu8
-- skipped func _mm256_maskz_max_epi8
-- skipped func _mm256_mask_max_epi8
-- skipped func _mm_maskz_max_epi8
-- skipped func _mm_mask_max_epi8
-- skipped func _mm256_maskz_min_epu8
-- skipped func _mm256_mask_min_epu8
-- skipped func _mm_maskz_min_epu8
-- skipped func _mm_mask_min_epu8
-- skipped func _mm256_maskz_min_epi8
-- skipped func _mm256_mask_min_epi8
-- skipped func _mm_maskz_min_epi8
-- skipped func _mm_mask_min_epi8
-- skipped func _mm256_maskz_max_epi16
-- skipped func _mm256_mask_max_epi16
-- skipped func _mm_maskz_max_epi16
-- skipped func _mm_mask_max_epi16
-- skipped func _mm256_maskz_max_epu16
-- skipped func _mm256_mask_max_epu16
-- skipped func _mm_maskz_max_epu16
-- skipped func _mm_mask_max_epu16
-- skipped func _mm_maskz_min_epi16
-- skipped func _mm_mask_min_epi16
-- skipped func _mm256_cmpneq_epi8_mask
-- skipped func _mm256_cmplt_epi8_mask
-- skipped func _mm256_cmpge_epi8_mask
-- skipped func _mm256_cmple_epi8_mask
-- skipped func _mm256_cmpneq_epi16_mask
-- skipped func _mm256_cmplt_epi16_mask
-- skipped func _mm256_cmpge_epi16_mask
-- skipped func _mm256_cmple_epi16_mask
-- skipped func _mm_cmpneq_epu8_mask
-- skipped func _mm_cmplt_epu8_mask
-- skipped func _mm_cmpge_epu8_mask
-- skipped func _mm_cmple_epu8_mask
-- skipped func _mm_cmpneq_epu16_mask
-- skipped func _mm_cmplt_epu16_mask
-- skipped func _mm_cmpge_epu16_mask
-- skipped func _mm_cmple_epu16_mask
-- skipped func _mm_cmpneq_epi8_mask
-- skipped func _mm_cmplt_epi8_mask
-- skipped func _mm_cmpge_epi8_mask
-- skipped func _mm_cmple_epi8_mask
-- skipped func _mm_cmpneq_epi16_mask
-- skipped func _mm_cmplt_epi16_mask
-- skipped func _mm_cmpge_epi16_mask
-- skipped func _mm_cmple_epi16_mask
-- skipped func _mm256_mask_mulhrs_epi16
-- skipped func _mm256_maskz_mulhrs_epi16
-- skipped func _mm256_mask_mulhi_epu16
-- skipped func _mm256_maskz_mulhi_epu16
-- skipped func _mm256_mask_mulhi_epi16
-- skipped func _mm256_maskz_mulhi_epi16
-- skipped func _mm_mask_mulhi_epi16
-- skipped func _mm_maskz_mulhi_epi16
-- skipped func _mm_mask_mulhi_epu16
-- skipped func _mm_maskz_mulhi_epu16
-- skipped func _mm_mask_mulhrs_epi16
-- skipped func _mm_maskz_mulhrs_epi16
-- skipped func _mm256_mask_mullo_epi16
-- skipped func _mm256_maskz_mullo_epi16
-- skipped func _mm_mask_mullo_epi16
-- skipped func _mm_maskz_mullo_epi16
-- skipped func _mm256_mask_cvtepi8_epi16
-- skipped func _mm256_maskz_cvtepi8_epi16
-- skipped func _mm_mask_cvtepi8_epi16
-- skipped func _mm_maskz_cvtepi8_epi16
-- skipped func _mm256_mask_cvtepu8_epi16
-- skipped func _mm256_maskz_cvtepu8_epi16
-- skipped func _mm_mask_cvtepu8_epi16
-- skipped func _mm_maskz_cvtepu8_epi16
-- skipped func _mm256_mask_avg_epu8
-- skipped func _mm256_maskz_avg_epu8
-- skipped func _mm_mask_avg_epu8
-- skipped func _mm_maskz_avg_epu8
-- skipped func _mm256_mask_avg_epu16
-- skipped func _mm256_maskz_avg_epu16
-- skipped func _mm_mask_avg_epu16
-- skipped func _mm_maskz_avg_epu16
-- skipped func _mm256_mask_add_epi8
-- skipped func _mm256_maskz_add_epi8
-- skipped func _mm256_mask_add_epi16
-- skipped func _mm256_maskz_add_epi16
-- skipped func _mm256_mask_adds_epi8
-- skipped func _mm256_maskz_adds_epi8
-- skipped func _mm256_mask_adds_epi16
-- skipped func _mm256_maskz_adds_epi16
-- skipped func _mm256_mask_adds_epu8
-- skipped func _mm256_maskz_adds_epu8
-- skipped func _mm256_mask_adds_epu16
-- skipped func _mm256_maskz_adds_epu16
-- skipped func _mm256_mask_sub_epi8
-- skipped func _mm256_maskz_sub_epi8
-- skipped func _mm256_mask_sub_epi16
-- skipped func _mm256_maskz_sub_epi16
-- skipped func _mm256_mask_subs_epi8
-- skipped func _mm256_maskz_subs_epi8
-- skipped func _mm256_mask_subs_epi16
-- skipped func _mm256_maskz_subs_epi16
-- skipped func _mm256_mask_subs_epu8
-- skipped func _mm256_maskz_subs_epu8
-- skipped func _mm256_mask_subs_epu16
-- skipped func _mm256_maskz_subs_epu16
-- skipped func _mm_mask_add_epi8
-- skipped func _mm_maskz_add_epi8
-- skipped func _mm_mask_add_epi16
-- skipped func _mm_maskz_add_epi16
-- skipped func _mm256_mask_unpackhi_epi8
-- skipped func _mm256_maskz_unpackhi_epi8
-- skipped func _mm_mask_unpackhi_epi8
-- skipped func _mm_maskz_unpackhi_epi8
-- skipped func _mm256_mask_unpackhi_epi16
-- skipped func _mm256_maskz_unpackhi_epi16
-- skipped func _mm_mask_unpackhi_epi16
-- skipped func _mm_maskz_unpackhi_epi16
-- skipped func _mm256_mask_unpacklo_epi8
-- skipped func _mm256_maskz_unpacklo_epi8
-- skipped func _mm_mask_unpacklo_epi8
-- skipped func _mm_maskz_unpacklo_epi8
-- skipped func _mm256_mask_unpacklo_epi16
-- skipped func _mm256_maskz_unpacklo_epi16
-- skipped func _mm_mask_unpacklo_epi16
-- skipped func _mm_maskz_unpacklo_epi16
-- skipped func _mm_cmpeq_epi8_mask
-- skipped func _mm_cmpeq_epu8_mask
-- skipped func _mm_mask_cmpeq_epu8_mask
-- skipped func _mm_mask_cmpeq_epi8_mask
-- skipped func _mm256_cmpeq_epu8_mask
-- skipped func _mm256_cmpeq_epi8_mask
-- skipped func _mm256_mask_cmpeq_epu8_mask
-- skipped func _mm256_mask_cmpeq_epi8_mask
-- skipped func _mm_cmpeq_epu16_mask
-- skipped func _mm_cmpeq_epi16_mask
-- skipped func _mm_mask_cmpeq_epu16_mask
-- skipped func _mm_mask_cmpeq_epi16_mask
-- skipped func _mm256_cmpeq_epu16_mask
-- skipped func _mm256_cmpeq_epi16_mask
-- skipped func _mm256_mask_cmpeq_epu16_mask
-- skipped func _mm256_mask_cmpeq_epi16_mask
-- skipped func _mm_cmpgt_epu8_mask
-- skipped func _mm_cmpgt_epi8_mask
-- skipped func _mm_mask_cmpgt_epu8_mask
-- skipped func _mm_mask_cmpgt_epi8_mask
-- skipped func _mm256_cmpgt_epu8_mask
-- skipped func _mm256_cmpgt_epi8_mask
-- skipped func _mm256_mask_cmpgt_epu8_mask
-- skipped func _mm256_mask_cmpgt_epi8_mask
-- skipped func _mm_cmpgt_epu16_mask
-- skipped func _mm_cmpgt_epi16_mask
-- skipped func _mm_mask_cmpgt_epu16_mask
-- skipped func _mm_mask_cmpgt_epi16_mask
-- skipped func _mm256_cmpgt_epu16_mask
-- skipped func _mm256_cmpgt_epi16_mask
-- skipped func _mm256_mask_cmpgt_epu16_mask
-- skipped func _mm256_mask_cmpgt_epi16_mask
-- skipped func _mm_testn_epi8_mask
-- skipped func _mm_mask_testn_epi8_mask
-- skipped func _mm256_testn_epi8_mask
-- skipped func _mm256_mask_testn_epi8_mask
-- skipped func _mm_testn_epi16_mask
-- skipped func _mm_mask_testn_epi16_mask
-- skipped func _mm256_testn_epi16_mask
-- skipped func _mm256_mask_testn_epi16_mask
-- skipped func _mm256_mask_shuffle_epi8
-- skipped func _mm256_maskz_shuffle_epi8
-- skipped func _mm_mask_shuffle_epi8
-- skipped func _mm_maskz_shuffle_epi8
-- skipped func _mm256_maskz_packs_epi16
-- skipped func _mm256_mask_packs_epi16
-- skipped func _mm_maskz_packs_epi16
-- skipped func _mm_mask_packs_epi16
-- skipped func _mm256_maskz_packus_epi16
-- skipped func _mm256_mask_packus_epi16
-- skipped func _mm_maskz_packus_epi16
-- skipped func _mm_mask_packus_epi16
-- skipped func _mm256_mask_abs_epi8
-- skipped func _mm256_maskz_abs_epi8
-- skipped func _mm_mask_abs_epi8
-- skipped func _mm_maskz_abs_epi8
-- skipped func _mm256_mask_abs_epi16
-- skipped func _mm256_maskz_abs_epi16
-- skipped func _mm_mask_abs_epi16
-- skipped func _mm_maskz_abs_epi16
-- skipped func _mm256_cmpneq_epu8_mask
-- skipped func _mm256_cmplt_epu8_mask
-- skipped func _mm256_cmpge_epu8_mask
-- skipped func _mm256_cmple_epu8_mask
-- skipped func _mm256_cmpneq_epu16_mask
-- skipped func _mm256_cmplt_epu16_mask
-- skipped func _mm256_cmpge_epu16_mask
-- skipped func _mm256_cmple_epu16_mask
-- skipped func _mm256_mask_storeu_epi16
-- skipped func _mm_mask_storeu_epi16
-- skipped func _mm_mask_adds_epi16
-- skipped func _mm_mask_subs_epi8
-- skipped func _mm_maskz_subs_epi8
-- skipped func _mm_mask_subs_epi16
-- skipped func _mm_maskz_subs_epi16
-- skipped func _mm_mask_subs_epu8
-- skipped func _mm_maskz_subs_epu8
-- skipped func _mm_mask_subs_epu16
-- skipped func _mm_maskz_subs_epu16
-- skipped func _mm256_mask_srl_epi16
-- skipped func _mm256_maskz_srl_epi16
-- skipped func _mm_mask_srl_epi16
-- skipped func _mm_maskz_srl_epi16
-- skipped func _mm256_mask_sra_epi16
-- skipped func _mm256_maskz_sra_epi16
-- skipped func _mm_mask_sra_epi16
-- skipped func _mm_maskz_sra_epi16
-- skipped func _mm_maskz_adds_epi16
-- skipped func _mm_mask_adds_epu8
-- skipped func _mm_maskz_adds_epu8
-- skipped func _mm_mask_adds_epu16
-- skipped func _mm_maskz_adds_epu16
-- skipped func _mm_mask_sub_epi8
-- skipped func _mm_maskz_sub_epi8
-- skipped func _mm_mask_sub_epi16
-- skipped func _mm_maskz_sub_epi16
-- skipped func _mm_mask_adds_epi8
-- skipped func _mm_maskz_adds_epi8
-- skipped func _mm_cvtepi16_epi8
-- skipped func _mm_mask_cvtepi16_epi8
-- skipped func _mm_maskz_cvtepi16_epi8
-- skipped func _mm256_srav_epi16
-- skipped func _mm256_mask_srav_epi16
-- skipped func _mm256_maskz_srav_epi16
-- skipped func _mm_srav_epi16
-- skipped func _mm_mask_srav_epi16
-- skipped func _mm_maskz_srav_epi16
-- skipped func _mm256_srlv_epi16
-- skipped func _mm256_mask_srlv_epi16
-- skipped func _mm256_maskz_srlv_epi16
-- skipped func _mm_srlv_epi16
-- skipped func _mm_mask_srlv_epi16
-- skipped func _mm_maskz_srlv_epi16
-- skipped func _mm256_sllv_epi16
-- skipped func _mm256_mask_sllv_epi16
-- skipped func _mm256_maskz_sllv_epi16
-- skipped func _mm_sllv_epi16
-- skipped func _mm_mask_sllv_epi16
-- skipped func _mm_maskz_sllv_epi16
-- skipped func _mm_mask_sll_epi16
-- skipped func _mm_maskz_sll_epi16
-- skipped func _mm256_mask_sll_epi16
-- skipped func _mm256_maskz_sll_epi16
-- skipped func _mm256_maskz_packus_epi32
-- skipped func _mm256_mask_packus_epi32
-- skipped func _mm_maskz_packus_epi32
-- skipped func _mm_mask_packus_epi32
-- skipped func _mm256_maskz_packs_epi32
-- skipped func _mm256_mask_packs_epi32
-- skipped func _mm_maskz_packs_epi32
-- skipped func _mm_mask_packs_epi32
-- skipped func _mm_mask_cmpneq_epu8_mask
-- skipped func _mm_mask_cmplt_epu8_mask
-- skipped func _mm_mask_cmpge_epu8_mask
-- skipped func _mm_mask_cmple_epu8_mask
-- skipped func _mm_mask_cmpneq_epu16_mask
-- skipped func _mm_mask_cmplt_epu16_mask
-- skipped func _mm_mask_cmpge_epu16_mask
-- skipped func _mm_mask_cmple_epu16_mask
-- skipped func _mm_mask_cmpneq_epi8_mask
-- skipped func _mm_mask_cmplt_epi8_mask
-- skipped func _mm_mask_cmpge_epi8_mask
-- skipped func _mm_mask_cmple_epi8_mask
-- skipped func _mm_mask_cmpneq_epi16_mask
-- skipped func _mm_mask_cmplt_epi16_mask
-- skipped func _mm_mask_cmpge_epi16_mask
-- skipped func _mm_mask_cmple_epi16_mask
-- skipped func _mm256_mask_cmpneq_epu8_mask
-- skipped func _mm256_mask_cmplt_epu8_mask
-- skipped func _mm256_mask_cmpge_epu8_mask
-- skipped func _mm256_mask_cmple_epu8_mask
-- skipped func _mm256_mask_cmpneq_epu16_mask
-- skipped func _mm256_mask_cmplt_epu16_mask
-- skipped func _mm256_mask_cmpge_epu16_mask
-- skipped func _mm256_mask_cmple_epu16_mask
-- skipped func _mm256_mask_cmpneq_epi8_mask
-- skipped func _mm256_mask_cmplt_epi8_mask
-- skipped func _mm256_mask_cmpge_epi8_mask
-- skipped func _mm256_mask_cmple_epi8_mask
-- skipped func _mm256_mask_cmpneq_epi16_mask
-- skipped func _mm256_mask_cmplt_epi16_mask
-- skipped func _mm256_mask_cmpge_epi16_mask
-- skipped func _mm256_mask_cmple_epi16_mask
end avx512vlbwintrin_h;
|
-- Copyright (c) 1990 Regents of the University of California.
-- All rights reserved.
--
-- This software was developed by John Self of the Arcadia project
-- at the University of California, Irvine.
--
-- 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.
-- TITLE character classes routines
-- AUTHOR: John Self (UCI)
-- DESCRIPTION routines for character classes like [abc]
-- $Header: /dc/uc/self/arcadia/aflex/ada/src/RCS/cclB.a,v 1.7 1993/04/27 23:17:15 self Exp $
with misc_defs, text_io, misc, tstring; use misc_defs, text_io;
package body ccl is
-- ccladd - add a single character to a ccl
procedure CCLADD(CCLP : in INTEGER;
CH : in CHARACTER) is
IND, LEN, NEWPOS : INTEGER;
begin
LEN := CCLLEN(CCLP);
IND := CCLMAP(CCLP);
-- check to see if the character is already in the ccl
for I in 0 .. LEN - 1 loop
if (CCLTBL(IND + I) = CH) then
return;
end if;
end loop;
NEWPOS := IND + LEN;
if (NEWPOS >= CURRENT_MAX_CCL_TBL_SIZE) then
CURRENT_MAX_CCL_TBL_SIZE := CURRENT_MAX_CCL_TBL_SIZE +
MAX_CCL_TBL_SIZE_INCREMENT;
NUM_REALLOCS := NUM_REALLOCS + 1;
REALLOCATE_CHARACTER_ARRAY(CCLTBL, CURRENT_MAX_CCL_TBL_SIZE);
end if;
CCLLEN(CCLP) := LEN + 1;
CCLTBL(NEWPOS) := CH;
end CCLADD;
-- cclinit - make an empty ccl
function CCLINIT return INTEGER is
begin
LASTCCL := LASTCCL + 1;
if (LASTCCL >= CURRENT_MAXCCLS) then
CURRENT_MAXCCLS := CURRENT_MAXCCLS + MAX_CCLS_INCREMENT;
NUM_REALLOCS := NUM_REALLOCS + 1;
REALLOCATE_INTEGER_ARRAY(CCLMAP, CURRENT_MAXCCLS);
REALLOCATE_INTEGER_ARRAY(CCLLEN, CURRENT_MAXCCLS);
REALLOCATE_INTEGER_ARRAY(CCLNG, CURRENT_MAXCCLS);
end if;
if (LASTCCL = 1) then
-- we're making the first ccl
CCLMAP(LASTCCL) := 0;
else
-- the new pointer is just past the end of the last ccl. Since
-- the cclmap points to the \first/ character of a ccl, adding the
-- length of the ccl to the cclmap pointer will produce a cursor
-- to the first free space
CCLMAP(LASTCCL) := CCLMAP(LASTCCL - 1) + CCLLEN(LASTCCL - 1);
end if;
CCLLEN(LASTCCL) := 0;
CCLNG(LASTCCL) := 0;
-- ccl's start out life un-negated
return LASTCCL;
end CCLINIT;
-- cclnegate - negate a ccl
procedure CCLNEGATE(CCLP : in INTEGER) is
begin
CCLNG(CCLP) := 1;
end CCLNEGATE;
-- list_character_set - list the members of a set of characters in CCL form
--
-- writes to the given file a character-class representation of those
-- characters present in the given set. A character is present if it
-- has a non-zero value in the set array.
procedure LIST_CHARACTER_SET(F : in FILE_TYPE;
CSET : in C_SIZE_BOOL_ARRAY) is
I, START_CHAR : INTEGER;
begin
TEXT_IO.PUT(F, '[');
I := 1;
while (I <= CSIZE) loop
if (CSET(I)) then
START_CHAR := I;
TEXT_IO.PUT(F, ' ');
TSTRING.PUT(F, MISC.READABLE_FORM(CHARACTER'VAL(I)));
I := I + 1;
while ((I <= CSIZE) and then (CSET(I))) loop
I := I + 1;
end loop;
if (I - 1 > START_CHAR) then
-- this was a run
TEXT_IO.PUT(F, "-");
TSTRING.PUT(F, MISC.READABLE_FORM(CHARACTER'VAL(I - 1)));
end if;
TEXT_IO.PUT(F, ' ');
end if;
I := I + 1;
end loop;
TEXT_IO.PUT(F, ']');
end LIST_CHARACTER_SET;
end ccl;
|
------------------------------------------------------------------------------
-- --
-- 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$
------------------------------------------------------------------------------
with League.Strings;
package SOAPConf.Testcases is
pragma Preelaborate;
type Testcase_Data is record
Message_A : League.Strings.Universal_String;
Message_C : League.Strings.Universal_String;
end record;
end SOAPConf.Testcases;
|
-- This spec has been automatically generated from STM32F40x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.EXTI is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- IMR_MR array
type IMR_MR_Field_Array is array (0 .. 22) of Boolean
with Component_Size => 1, Size => 23;
-- Type definition for IMR_MR
type IMR_MR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : HAL.UInt23;
when True =>
-- MR as an array
Arr : IMR_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 23;
for IMR_MR_Field use record
Val at 0 range 0 .. 22;
Arr at 0 range 0 .. 22;
end record;
-- Interrupt mask register (EXTI_IMR)
type IMR_Register is record
-- Interrupt Mask on line 0
MR : IMR_MR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IMR_Register use record
MR at 0 range 0 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- EMR_MR array
type EMR_MR_Field_Array is array (0 .. 22) of Boolean
with Component_Size => 1, Size => 23;
-- Type definition for EMR_MR
type EMR_MR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : HAL.UInt23;
when True =>
-- MR as an array
Arr : EMR_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 23;
for EMR_MR_Field use record
Val at 0 range 0 .. 22;
Arr at 0 range 0 .. 22;
end record;
-- Event mask register (EXTI_EMR)
type EMR_Register is record
-- Event Mask on line 0
MR : EMR_MR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EMR_Register use record
MR at 0 range 0 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- RTSR_TR array
type RTSR_TR_Field_Array is array (0 .. 22) of Boolean
with Component_Size => 1, Size => 23;
-- Type definition for RTSR_TR
type RTSR_TR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- TR as a value
Val : HAL.UInt23;
when True =>
-- TR as an array
Arr : RTSR_TR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 23;
for RTSR_TR_Field use record
Val at 0 range 0 .. 22;
Arr at 0 range 0 .. 22;
end record;
-- Rising Trigger selection register (EXTI_RTSR)
type RTSR_Register is record
-- Rising trigger event configuration of line 0
TR : RTSR_TR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTSR_Register use record
TR at 0 range 0 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- FTSR_TR array
type FTSR_TR_Field_Array is array (0 .. 22) of Boolean
with Component_Size => 1, Size => 23;
-- Type definition for FTSR_TR
type FTSR_TR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- TR as a value
Val : HAL.UInt23;
when True =>
-- TR as an array
Arr : FTSR_TR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 23;
for FTSR_TR_Field use record
Val at 0 range 0 .. 22;
Arr at 0 range 0 .. 22;
end record;
-- Falling Trigger selection register (EXTI_FTSR)
type FTSR_Register is record
-- Falling trigger event configuration of line 0
TR : FTSR_TR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FTSR_Register use record
TR at 0 range 0 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- SWIER array
type SWIER_Field_Array is array (0 .. 22) of Boolean
with Component_Size => 1, Size => 23;
-- Type definition for SWIER
type SWIER_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- SWIER as a value
Val : HAL.UInt23;
when True =>
-- SWIER as an array
Arr : SWIER_Field_Array;
end case;
end record
with Unchecked_Union, Size => 23;
for SWIER_Field use record
Val at 0 range 0 .. 22;
Arr at 0 range 0 .. 22;
end record;
-- Software interrupt event register (EXTI_SWIER)
type SWIER_Register is record
-- Software Interrupt on line 0
SWIER : SWIER_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SWIER_Register use record
SWIER at 0 range 0 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- PR array
type PR_Field_Array is array (0 .. 22) of Boolean
with Component_Size => 1, Size => 23;
-- Type definition for PR
type PR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PR as a value
Val : HAL.UInt23;
when True =>
-- PR as an array
Arr : PR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 23;
for PR_Field use record
Val at 0 range 0 .. 22;
Arr at 0 range 0 .. 22;
end record;
-- Pending register (EXTI_PR)
type PR_Register is record
-- Pending bit 0
PR : PR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PR_Register use record
PR at 0 range 0 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- External interrupt/event controller
type EXTI_Peripheral is record
-- Interrupt mask register (EXTI_IMR)
IMR : aliased IMR_Register;
-- Event mask register (EXTI_EMR)
EMR : aliased EMR_Register;
-- Rising Trigger selection register (EXTI_RTSR)
RTSR : aliased RTSR_Register;
-- Falling Trigger selection register (EXTI_FTSR)
FTSR : aliased FTSR_Register;
-- Software interrupt event register (EXTI_SWIER)
SWIER : aliased SWIER_Register;
-- Pending register (EXTI_PR)
PR : aliased PR_Register;
end record
with Volatile;
for EXTI_Peripheral use record
IMR at 16#0# range 0 .. 31;
EMR at 16#4# range 0 .. 31;
RTSR at 16#8# range 0 .. 31;
FTSR at 16#C# range 0 .. 31;
SWIER at 16#10# range 0 .. 31;
PR at 16#14# range 0 .. 31;
end record;
-- External interrupt/event controller
EXTI_Periph : aliased EXTI_Peripheral
with Import, Address => System'To_Address (16#40013C00#);
end STM32_SVD.EXTI;
|
-- Taken from https://www.adaic.org/resources/add_content/standards/05rm/html/RM-10-1-3.html
package body Parent is
Variable : String := "Hello, there.";
procedure Inner is separate;
end Parent;
with Ada.Text_IO;
separate(Parent)
procedure Inner is
begin
Ada.Text_IO.Put_Line(Variable);
end Inner;
|
with
GL.Binding,
GL.lean,
Interfaces.c.Pointers,
ada.unchecked_Conversion,
ada.unchecked_Deallocation;
package body GLU
--
-- This is a direct port of parts of Mesa GLU 'mipmap.c' file.
--
-- Only declarations involved in 'gluScaleImage' are currently ported.
-- Other areas may be later ported at need.
--
-- Currently supports only GL datatypes allowed in the 'lean' profile.
--
is
use GL.lean,
Interfaces;
use type GLint,
GLenum,
GLfloat;
-- GLubyte
--
type GLubtye_array is array (C.size_t range <>) of aliased GLubyte;
package GLubyte_Pointers is new C.Pointers (Index => C.size_t,
Element => GLubyte,
Element_Array => GLubtye_array,
Default_Terminator => 0);
subtype GLubyte_view is GLubyte_Pointers.Pointer;
function to_GLubyte_view is new ada.unchecked_Conversion (system.Address, GLubyte_view);
-- GLushort
--
package GLushort_Pointers is new C.Pointers (Index => C.size_t,
Element => GLushort,
Element_Array => GLushort_array,
Default_Terminator => 0);
subtype GLushort_view is GLushort_Pointers.Pointer;
function to_GLushort_view is new ada.unchecked_Conversion (system.Address, GLushort_view);
function to_GLushort_view is new ada.unchecked_Conversion (GLubyte_view, GLushort_view);
type GLushort_array_view is access all GLushort_array;
-- GLbyte
--
type GLbyte_view is access all GLbyte;
function to_GLbyte_view is new ada.unchecked_Conversion (GLubyte_view, GLbyte_view);
-- Pixel storage modes
--
type PixelStorageModes is
record
pack_alignment,
pack_row_length,
pack_skip_rows,
pack_skip_pixels,
pack_lsb_first,
pack_swap_bytes,
pack_skip_images,
pack_image_height,
unpack_alignment,
unpack_row_length,
unpack_skip_rows,
unpack_skip_pixels,
unpack_lsb_first,
unpack_swap_bytes,
unpack_skip_images,
unpack_image_height : aliased GLint;
end record;
-- Type_Widget
--
type widget_Kind is (ub, us, ui, b, s, i, f);
type uchar_array is array (C.size_t range <>) of C.unsigned_char;
type char_array is array (C.size_t range <>) of C.char;
type short_array is array (C.size_t range <>) of C.short;
type Type_Widget (Kind : widget_Kind := widget_Kind'First) is
record
case Kind
is
when ub => ub : uchar_array (0 .. 3);
when us => us : GLushort_array (0 .. 1);
when ui => ui : c.unsigned;
when b => b : char_array (0 .. 3);
when s => s : short_array (0 .. 1);
when i => i : C.int;
when f => f : GLfloat;
end case;
end record;
pragma Unchecked_Union (Type_Widget);
function legalFormat (Format : in GLenum) return Boolean
is
begin
case Format
is
when GL_ALPHA
| GL_RGB
| GL_RGBA
| GL_LUMINANCE
| GL_LUMINANCE_ALPHA =>
return True;
when others =>
return False;
end case;
end legalFormat;
function legalType (gl_Type : in GLenum) return Boolean
is
begin
case gl_Type
is
when GL_BYTE
| GL_UNSIGNED_BYTE
| GL_SHORT
| GL_UNSIGNED_SHORT
| GL_INT
| GL_UNSIGNED_INT
| GL_FLOAT
| GL_UNSIGNED_SHORT_5_6_5
| GL_UNSIGNED_SHORT_4_4_4_4
| GL_UNSIGNED_SHORT_5_5_5_1 =>
return True;
when others =>
return False;
end case;
end legalType;
function isTypePackedPixel (gl_Type : in GLenum) return Boolean
is
pragma assert (legalType (gl_Type));
begin
case gl_Type
is
when GL_UNSIGNED_SHORT_5_6_5
| GL_UNSIGNED_SHORT_4_4_4_4
| GL_UNSIGNED_SHORT_5_5_5_1 =>
return True;
when others =>
return False;
end case;
end isTypePackedPixel;
-- Determines if the packed pixel type is compatible with the format.
--
function isLegalFormatForPackedPixelType (format,
gl_Type : in GLenum) return Boolean
is
begin
-- If not a packed pixel type then return true.
--
if not isTypePackedPixel (gl_Type)
then
return True;
end if;
-- 3_3_2/2_3_3_REV & 5_6_5/5_6_5_REV are only compatible with RGB
--
if gl_Type = GL_UNSIGNED_SHORT_5_6_5
and format /= GL_RGB
then
return False;
end if;
-- 4_4_4_4 & 5_5_5_1 are only compatible with RGBA.
--
if ( gl_Type = GL_UNSIGNED_SHORT_4_4_4_4
or gl_Type = GL_UNSIGNED_SHORT_5_5_5_1)
and format /= GL_RGBA
then
return False;
end if;
return True;
end isLegalFormatForPackedPixelType;
-- Return the number of bytes per element, based on the element type.
--
function bytes_per_element (gl_Type : in GLenum) return GLfloat
is
begin
case gl_Type
is
when GL_UNSIGNED_SHORT => return GLfloat (GLushort'Size / 8);
when GL_SHORT => return GLfloat (GLshort 'Size / 8);
when GL_UNSIGNED_BYTE => return GLfloat (GLubyte 'Size / 8);
when GL_BYTE => return GLfloat (GLbyte 'Size / 8);
when GL_INT => return GLfloat (GLint 'Size / 8);
when GL_UNSIGNED_INT => return GLfloat (GLuint 'Size / 8);
when GL_FLOAT => return GLfloat (GLfloat 'Size / 8);
when GL_UNSIGNED_SHORT_5_6_5
| GL_UNSIGNED_SHORT_4_4_4_4
| GL_UNSIGNED_SHORT_5_5_5_1 => return GLfloat (GLushort'Size / 8);
when others => return 4.0;
end case;
end bytes_per_element;
-- Return the number of elements per group of a specified format.
--
function elements_per_group (format, gl_Type : in GLenum) return GLint
is
begin
-- If the type is packedpixels then answer is 1 (ignore format).
--
if gl_Type = GL_UNSIGNED_SHORT_5_6_5
or gl_Type = GL_UNSIGNED_SHORT_4_4_4_4
or gl_Type = GL_UNSIGNED_SHORT_5_5_5_1
then
return 1;
end if;
-- Types are not packed pixels, so get elements per group.
--
case format
is
when GL_RGB => return 3;
when GL_LUMINANCE_ALPHA => return 2;
when GL_RGBA => return 4;
when others => return 1;
end case;
end elements_per_group;
-- Compute memory required for internal packed array of data of given type and format.
--
function image_size (width, height : in GLint;
format, gl_Type : in GLenum) return c.size_t
is
pragma assert (width > 0);
pragma assert (height > 0);
bytes_per_row : constant GLint := GLint (bytes_per_element (gl_Type)) * width;
components : constant GLint := elements_per_group (format, gl_Type);
begin
return c.size_t (bytes_per_row * height * components);
end image_size;
procedure retrieveStoreModes (psm : in out PixelStorageModes)
is
use gl.Binding;
begin
glGetIntegerv (GL_UNPACK_ALIGNMENT, psm.unpack_alignment'Access);
psm.unpack_row_length := 0;
psm.unpack_skip_rows := 0;
psm.unpack_skip_pixels := 0;
psm.unpack_lsb_first := 0;
psm.unpack_swap_bytes := 0;
glGetIntegerv (GL_PACK_ALIGNMENT, psm.pack_alignment'Access);
psm.pack_row_length := 0;
psm.pack_skip_rows := 0;
psm.pack_skip_pixels := 0;
psm.pack_lsb_first := 0;
psm.pack_swap_bytes := 0;
end retrieveStoreModes;
function GLU_SWAP_2_BYTES (s : in system.Address) return GLushort
is
use GLubyte_Pointers;
s0 : constant GLubyte_view := to_GLubyte_view (s) + 0;
s1 : constant GLubyte_view := to_GLubyte_view (s) + 1;
begin
return GLushort ( shift_Left (Unsigned_16 (s1.all), 8)
or Unsigned_16 (s0.all));
end GLU_SWAP_2_BYTES;
-- #define __GLU_SWAP_2_BYTES(s)\
-- (GLushort) ( ((GLushort) ((const GLubyte*) (s)) [1]) << 8 | ((const GLubyte*) (s)) [0] )
function GLU_SWAP_4_BYTES (s : in system.Address) return GLushort
is
use GLubyte_Pointers;
s0 : constant GLubyte_view := to_GLubyte_view (s) + 0;
s1 : constant GLubyte_view := to_GLubyte_view (s) + 1;
s2 : constant GLubyte_view := to_GLubyte_view (s) + 2;
s3 : constant GLubyte_view := to_GLubyte_view (s) + 3;
begin
return GLushort ( shift_Left (Unsigned_32 (s3.all), 24)
or shift_Left (Unsigned_32 (s2.all), 16)
or shift_Left (Unsigned_32 (s1.all), 8)
or Unsigned_32 (s0.all));
end GLU_SWAP_4_BYTES;
-- #define __GLU_SWAP_4_BYTES(s)\
-- (GLuint)(((GLuint)((const GLubyte*)(s))[3])<<24 | \
-- ((GLuint)((const GLubyte*)(s))[2])<<16 | \
-- ((GLuint)((const GLubyte*)(s))[1])<<8 |
-- ((const GLubyte*)(s))[0])
procedure extract565 (isSwap : in GLint;
packedPixel : in system.Address;
extractComponents : out GLfloat_array)
is
use type GLushort;
ushort : GLushort;
begin
if isSwap /= 0 then
ushort := GLU_SWAP_2_BYTES (packedPixel);
else
ushort := to_GLushort_view (packedPixel).all;
end if;
-- 11111000,00000000 == 0xf800
-- 00000111,11100000 == 0x07e0
-- 00000000,00011111 == 0x001f
--
extractComponents (0) := GLfloat (shift_Right (Unsigned_16 (ushort and 16#f800#), 11)) / 31.0; -- 31 = 2^5-1
extractComponents (1) := GLfloat (shift_Right (Unsigned_16 (ushort and 16#07e0#), 5)) / 63.0; -- 63 = 2^6-1
extractComponents (2) := GLfloat ( ushort and 16#001f#) / 31.0;
end extract565;
procedure extract4444 (isSwap : in GLint;
packedPixel : in system.Address;
extractComponents : out GLfloat_array)
is
use type GLushort;
ushort : GLushort;
begin
if isSwap /= 0 then
ushort := GLU_SWAP_2_BYTES (packedPixel);
else
ushort := to_GLushort_view (packedPixel).all;
end if;
-- 11110000,00000000 == 0xf000
-- 00001111,00000000 == 0x0f00
-- 00000000,11110000 == 0x00f0
-- 00000000,00001111 == 0x000f
--
extractComponents (0) := GLfloat (shift_Right (Unsigned_16 (ushort and 16#f000#), 12)) / 15.0; -- 15 = 2^4-1
extractComponents (1) := GLfloat (shift_Right (Unsigned_16 (ushort and 16#0f00#), 8)) / 15.0;
extractComponents (2) := GLfloat (shift_Right (Unsigned_16 (ushort and 16#00f0#), 4)) / 15.0;
extractComponents (3) := GLfloat ( ushort and 16#000f#) / 15.0;
end extract4444;
procedure extract5551 (isSwap : in GLint;
packedPixel : in system.Address;
extractComponents : out GLfloat_array)
is
use type GLushort;
ushort : GLushort;
begin
if isSwap /= 0 then
ushort := GLU_SWAP_2_BYTES (packedPixel);
else
ushort := to_GLushort_view (packedPixel).all;
end if;
-- 11111000,00000000 == 0xf800
-- 00000111,11000000 == 0x07c0
-- 00000000,00111110 == 0x003e
-- 00000000,00000001 == 0x0001
--
extractComponents (0) := GLfloat (shift_Right (Unsigned_16 (ushort and 16#f800#), 11)) / 31.0; -- 31 = 2^5-1
extractComponents (1) := GLfloat (shift_Right (Unsigned_16 (ushort and 16#07c0#), 6)) / 31.0;
extractComponents (2) := GLfloat (shift_Right (Unsigned_16 (ushort and 16#003e#), 1)) / 31.0;
extractComponents (3) := GLfloat ( ushort and 16#0001#);
end extract5551;
procedure shove565 (shoveComponents : in GLfloat_array;
index : in GLint;
packedPixel : in system.Address)
is
use GLushort_Pointers;
use type GLushort;
the_Pixel : constant GLushort_view := to_GLushort_view (packedPixel) + C.ptrdiff_t (index);
begin
-- 11111000,00000000 == 0xf800
-- 00000111,11100000 == 0x07e0
-- 00000000,00011111 == 0x001f
pragma assert (0.0 <= shoveComponents(0) and shoveComponents(0) <= 1.0);
pragma assert (0.0 <= shoveComponents(1) and shoveComponents(1) <= 1.0);
pragma assert (0.0 <= shoveComponents(2) and shoveComponents(2) <= 1.0);
-- due to limited precision, need to round before shoving
--
the_Pixel.all := GLushort (shift_Left (Unsigned_16 (shoveComponents (0) * 31.0 + 0.5), 11) and 16#f800#);
the_Pixel.all := the_Pixel.all or GLushort (shift_Left (Unsigned_16 (shoveComponents (1) * 63.0 + 0.5), 5) and 16#07e0#);
the_Pixel.all := the_Pixel.all or GLushort ( Unsigned_16 (shoveComponents (2) * 31.0 + 0.5) and 16#001f#);
end shove565;
procedure shove4444 (shoveComponents : in GLfloat_array;
index : in GLint;
packedPixel : in system.Address)
is
use GLushort_Pointers;
use type GLushort;
the_Pixel : constant GLushort_view := to_GLushort_view (packedPixel) + C.ptrdiff_t (index);
begin
pragma assert (0.0 <= shoveComponents (0) and shoveComponents (0) <= 1.0);
pragma assert (0.0 <= shoveComponents (1) and shoveComponents (1) <= 1.0);
pragma assert (0.0 <= shoveComponents (2) and shoveComponents (2) <= 1.0);
pragma assert (0.0 <= shoveComponents (3) and shoveComponents (3) <= 1.0);
-- due to limited precision, need to round before shoving
--
the_Pixel.all := GLushort (shift_Left (Unsigned_16 (shoveComponents (0) * 15.0 + 0.5), 12) and 16#f000#);
the_Pixel.all := the_Pixel.all or GLushort (shift_Left (Unsigned_16 (shoveComponents (1) * 15.0 + 0.5), 8) and 16#0f00#);
the_Pixel.all := the_Pixel.all or GLushort (shift_Left (Unsigned_16 (shoveComponents (2) * 15.0 + 0.5), 4) and 16#00f0#);
the_Pixel.all := the_Pixel.all or GLushort ( Unsigned_16 (shoveComponents (3) * 15.0 + 0.5) and 16#000f#);
end shove4444;
procedure shove5551 (shoveComponents : in GLfloat_array;
index : in GLint;
packedPixel : in system.Address)
is
use GLushort_Pointers;
use type GLushort;
the_Pixel : constant GLushort_view := to_GLushort_view (packedPixel) + C.ptrdiff_t (index);
begin
-- 11111000,00000000 == 0xf800
-- 00000111,11000000 == 0x07c0
-- 00000000,00111110 == 0x003e
-- 00000000,00000001 == 0x0001
pragma assert (0.0 <= shoveComponents (0) and shoveComponents (0) <= 1.0);
pragma assert (0.0 <= shoveComponents (1) and shoveComponents (1) <= 1.0);
pragma assert (0.0 <= shoveComponents (2) and shoveComponents (2) <= 1.0);
pragma assert (0.0 <= shoveComponents (3) and shoveComponents (3) <= 1.0);
-- due to limited precision, need to round before shoving
--
the_Pixel.all := GLushort (shift_Left (Unsigned_16 (shoveComponents (0) * 31.0 + 0.5), 11) and 16#f800#);
the_Pixel.all := the_Pixel.all or GLushort (shift_Left (Unsigned_16 (shoveComponents (1) * 31.0 + 0.5), 6) and 16#07c0#);
the_Pixel.all := the_Pixel.all or GLushort (shift_Left (Unsigned_16 (shoveComponents (2) * 31.0 + 0.5), 1) and 16#003e#);
the_Pixel.all := the_Pixel.all or GLushort ( Unsigned_16 (shoveComponents (3) + 0.5) and 16#0001#);
end shove5551;
-- Extract array from user's data applying all pixel store modes.
-- The internal format used is an array of unsigned shorts.
--
procedure fill_image (psm : in PixelStorageModes;
width, height : in GLint;
format : in GLenum;
gl_Type : in GLenum;
index_format : in Boolean;
userdata : in System.Address;
newimage : in GLushort_array_view)
is
use GLubyte_Pointers,
GLushort_Pointers;
use type GLushort;
components,
element_size,
rowsize,
padding,
groups_per_line,
group_size,
elements_per_line : GLint;
start : GLubyte_view;
iter : GLubyte_view;
iter2 : GLushort_view;
myswap_bytes : GLint;
function to_GLubyte_view is new ada.Unchecked_Conversion (System.Address, GLubyte_view);
begin
myswap_bytes := psm.unpack_swap_bytes;
components := elements_per_group (format, gl_Type);
if psm.unpack_row_length > 0 then
groups_per_line := psm.unpack_row_length;
else
groups_per_line := width;
end if;
element_size := GLint (bytes_per_element (gl_Type));
group_size := element_size * components;
if element_size = 1 then
myswap_bytes := 0;
end if;
rowsize := groups_per_line * group_size;
padding := rowsize mod psm.unpack_alignment;
if padding /= 0 then
rowsize := rowsize + psm.unpack_alignment - padding;
end if;
-- start := (const GLubyte *) userdata + psm->unpack_skip_rows * rowsize
start := to_GLubyte_view (userdata)
+ C.ptrdiff_t ( psm.unpack_skip_rows * rowsize
+ psm.unpack_skip_pixels * group_size);
elements_per_line := width * components;
iter2 := newimage (newimage'First)'Access;
for i in 0 .. height - 1
loop
iter := start;
for j in 0 .. elements_per_line - 1
loop
declare
widget : Type_Widget;
extractComponents : GLfloat_array (0 .. 3);
begin
case gl_Type
is
when GL_UNSIGNED_BYTE =>
if index_format then
iter2.all := GLushort (iter.all);
iter2 := iter2 + 1;
else
iter2.all := GLushort (iter.all) * 257;
iter2 := iter2 + 1;
end if;
when GL_BYTE =>
if index_format then
iter2.all := GLushort (to_GLbyte_view (iter).all);
iter2 := iter2 + 1;
else
-- rough approx
iter2.all := GLushort (to_GLbyte_view (iter).all) * 516;
iter2 := iter2 + 1;
end if;
when GL_UNSIGNED_SHORT_5_6_5 =>
extract565 (myswap_bytes, iter.all'Address, extractComponents);
for k in C.size_t' (0) .. 2 loop
iter2.all := GLushort (extractComponents (k) * 65535.0);
iter2 := iter2 + 1;
end loop;
when GL_UNSIGNED_SHORT_4_4_4_4 =>
extract4444 (myswap_bytes, iter.all'Address, extractComponents);
for k in C.size_t' (0) .. 3 loop
iter2.all := GLushort (extractComponents (k) * 65535.0);
iter2 := iter2 + 1;
end loop;
when GL_UNSIGNED_SHORT_5_5_5_1 =>
extract5551 (myswap_bytes, iter.all'Address, extractComponents);
for k in C.size_t' (0) .. 3 loop
iter2.all := GLushort (extractComponents (k) * 65535.0);
iter2 := iter2 + 1;
end loop;
when GL_UNSIGNED_SHORT
| GL_SHORT =>
if myswap_bytes /= 0 then
widget.ub (0) := GLubyte_view (iter + 1).all;
widget.ub (1) := GLubyte_view (iter + 0).all;
else
widget.ub (0) := GLubyte_view (iter + 0).all;
widget.ub (1) := GLubyte_view (iter + 1).all;
end if;
if gl_Type = GL_SHORT then
if index_format then
iter2.all := GLushort (widget.s (0));
iter2 := iter2 + 1;
else
-- rough approx
iter2.all := GLushort (widget.s(0)) * 2;
iter2 := iter2 + 1;
end if;
else
iter2.all := widget.us (0);
iter2 := iter2 + 1;
end if;
when GL_INT
| GL_UNSIGNED_INT
| GL_FLOAT =>
if myswap_bytes /= 0 then
widget.ub(0) := GLubyte_view (iter + 3).all;
widget.ub(1) := GLubyte_view (iter + 2).all;
widget.ub(2) := GLubyte_view (iter + 1).all;
widget.ub(3) := GLubyte_view (iter + 0).all;
else
widget.ub(0) := GLubyte_view (iter + 0).all;
widget.ub(1) := GLubyte_view (iter + 1).all;
widget.ub(2) := GLubyte_view (iter + 2).all;
widget.ub(3) := GLubyte_view (iter + 3).all;
end if;
if gl_Type = GL_FLOAT then
if index_format then
iter2.all := GLushort (widget.f);
iter2 := iter2 + 1;
else
iter2.all := GLushort (65535.0 * widget.f);
iter2 := iter2 + 1;
end if;
elsif gl_Type = GL_UNSIGNED_INT then
if index_format then
iter2.all := GLushort (widget.ui);
iter2 := iter2 + 1;
else
iter2.all := GLushort (shift_Right (Unsigned_32 (widget.ui), 16));
iter2 := iter2 + 1;
end if;
else
if index_format then
iter2.all := GLushort (widget.i);
iter2 := iter2 + 1;
else
iter2.all := GLushort (shift_Right (Unsigned_32 (widget.i), 15));
iter2 := iter2 + 1;
end if;
end if;
when others =>
raise GLU_INVALID_TYPE;
end case;
iter := iter + C.ptrdiff_t (element_size);
end;
end loop; -- for j
start := start + C.ptrdiff_t (rowsize);
-- want 'iter' pointing at start, not within, row for assertion purposes
iter := start;
end loop; -- for i
-- iterators should be one byte past end
--
if not isTypePackedPixel (gl_Type) then
pragma assert (iter2 = newimage (C.size_t (width * height * components))'Access);
else
pragma assert (iter2 = newimage (C.size_t (width * height * elements_per_group (format, 0)))'Access);
end if;
pragma assert (iter = to_GLubyte_view (userdata) + C.ptrdiff_t ( rowsize * height
+ psm.unpack_skip_rows * rowsize
+ psm.unpack_skip_pixels * group_size));
end fill_image;
-- Insert array into user's data applying all pixel store modes.
-- The internal format is an array of unsigned shorts.
-- empty_image() because it is the opposite of fill_image().
--
procedure empty_image (psm : in PixelStorageModes;
width, height : in GLint;
format : in GLenum;
gl_Type : in GLenum;
index_format : in Boolean;
oldimage : in GLushort_array_view;
userdata : in System.Address)
is
use GLubyte_Pointers,
GLushort_Pointers;
use type GLushort;
components,
element_size,
rowsize,
padding,
groups_per_line,
group_size,
elements_per_line : GLint;
start : GLubyte_view;
iter : GLubyte_view;
iter2 : GLushort_view;
myswap_bytes : GLint;
shoveComponents : GLfloat_array (0 .. 3);
begin
myswap_bytes := psm.pack_swap_bytes;
components := elements_per_group (format, gl_Type);
if psm.pack_row_length > 0 then
groups_per_line := psm.pack_row_length;
else
groups_per_line := width;
end if;
element_size := GLint (bytes_per_element (gl_Type));
group_size := element_size * components;
if element_size = 1 then
myswap_bytes := 0;
end if;
rowsize := groups_per_line * group_size;
padding := (rowsize mod psm.pack_alignment);
if padding /= 0 then
rowsize := rowsize + psm.pack_alignment - padding;
end if;
start := to_GLubyte_view (userdata)
+ C.ptrdiff_t ( psm.pack_skip_rows * rowsize
+ psm.pack_skip_pixels * group_size);
elements_per_line := width * components;
iter2 := oldimage (oldimage'First)'Access;
for i in 0 .. height - 1
loop
iter := start;
for j in 0 .. elements_per_line - 1
loop
declare
widget : Type_Widget;
begin
case gl_Type
is
when GL_UNSIGNED_BYTE =>
if index_format then
iter.all := GLubyte (iter2.all);
iter2 := iter2 + 1;
else
iter.all := GLubyte (shift_Right (Unsigned_16 (iter2.all), 8));
iter2 := iter2 + 1;
end if;
when GL_BYTE =>
if index_format then
to_GLbyte_view (iter).all := GLbyte (iter2.all);
iter2 := iter2 + 1;
else
to_GLbyte_view (iter).all := GLbyte (shift_Right (Unsigned_16 (iter2.all), 9));
iter2 := iter2 + 1;
end if;
when GL_UNSIGNED_SHORT_5_6_5 =>
for k in C.size_t' (0) .. 2 loop
shoveComponents (k) := GLfloat (iter2.all) / 65535.0;
iter2 := iter2 + 1;
end loop;
shove565 (shoveComponents, 0, widget.us (0)'Address);
if myswap_bytes /= 0 then
GLubyte_view (iter + 0).all := widget.ub (1);
GLubyte_view (iter + 1).all := widget.ub (0);
else
to_GLushort_view (iter).all := widget.us (0);
end if;
when GL_UNSIGNED_SHORT_4_4_4_4 =>
for k in C.size_t' (0) .. 3 loop
shoveComponents (k) := GLfloat (iter2.all) / 65535.0;
iter2 := iter2 + 1;
end loop;
shove4444 (shoveComponents, 0, widget.us (0)'Address);
if myswap_bytes /= 0 then
GLubyte_view (iter + 0).all := widget.ub (1);
GLubyte_view (iter + 1).all := widget.ub (0);
else
to_GLushort_view (iter).all := widget.us (0);
end if;
when GL_UNSIGNED_SHORT_5_5_5_1 =>
for k in C.size_t' (0) .. 3 loop
shoveComponents (k) := GLfloat (iter2.all) / 65535.0;
iter2 := iter2 + 1;
end loop;
shove5551 (shoveComponents, 0, widget.us (0)'Address);
if myswap_bytes /= 0 then
GLubyte_view (iter + 0).all := widget.ub (1);
GLubyte_view (iter + 1).all := widget.ub (0);
else
to_GLushort_view (iter).all := widget.us (0);
end if;
when GL_UNSIGNED_SHORT
| GL_SHORT =>
if gl_Type = GL_SHORT then
if index_format then
widget.s (0) := GLshort (iter2.all);
iter2 := iter2 + 1;
else
widget.s (0) := GLshort (shift_Right (Unsigned_16 (iter2.all), 1));
iter2 := iter2 + 1;
end if;
else
widget.us (0) := iter2.all;
iter2 := iter2 + 1;
end if;
if myswap_bytes /= 0 then
GLubyte_view (iter + 0).all := widget.ub (1);
GLubyte_view (iter + 1).all := widget.ub (0);
else
GLubyte_view (iter + 0).all := widget.ub (0);
GLubyte_view (iter + 1).all := widget.ub (1);
end if;
when GL_INT
| GL_UNSIGNED_INT
| GL_FLOAT =>
if gl_Type = GL_FLOAT then
if index_format then
widget.f := GLfloat (iter2.all);
iter2 := iter2 + 1;
else
widget.f := GLfloat (iter2.all) / 65535.0;
iter2 := iter2 + 1;
end if;
elsif gl_Type = GL_UNSIGNED_INT then
if index_format then
widget.ui := GLuint (iter2.all);
iter2 := iter2 + 1;
else
widget.ui := GLuint (iter2.all) * 65537;
iter2 := iter2 + 1;
end if;
else
if index_format then
widget.i := GLint (iter2.all);
iter2 := iter2 + 1;
else
widget.i := GLint ((GLuint (iter2.all) * 65537) / 2);
iter2 := iter2 + 1;
end if;
end if;
if myswap_bytes /= 0 then
GLubyte_view (iter + 3).all := widget.ub (0);
GLubyte_view (iter + 2).all := widget.ub (1);
GLubyte_view (iter + 1).all := widget.ub (2);
GLubyte_view (iter + 0).all := widget.ub (3);
else
GLubyte_view (iter + 0).all := widget.ub (0);
GLubyte_view (iter + 1).all := widget.ub (1);
GLubyte_view (iter + 2).all := widget.ub (2);
GLubyte_view (iter + 3).all := widget.ub (3);
end if;
when others =>
raise GLU_INVALID_TYPE;
end case;
iter := iter + C.ptrdiff_t (element_size);
end;
end loop; -- for j
start := start + C.ptrdiff_t (rowsize);
-- want 'iter' pointing at start, not within, row for assertion purposes
iter := start;
end loop; -- for i
-- iterators should be one byte past end
--
if not isTypePackedPixel (gl_Type) then
pragma assert (iter2 = oldimage (C.size_t (width * height * components))'Access);
else
pragma assert (iter2 = oldimage (C.size_t (width * height * elements_per_group (format, 0)))'Access);
end if;
pragma assert ( iter = to_GLubyte_view (userdata) + C.ptrdiff_t ( rowsize * height
+ psm.pack_skip_rows * rowsize
+ psm.pack_skip_pixels * group_size) );
end empty_image;
procedure halveImage (components : in GLint;
width : in GLuint;
height : in GLuint;
datain : in GLushort_view;
dataout : in GLushort_view)
is
use GLushort_Pointers;
use type GLushort;
newwidth,
newheight : GLint;
the_delta : GLint;
s, t : GLushort_view;
begin
newwidth := GLint (width) / 2;
newheight := GLint (height) / 2;
the_delta := GLint (width) * components;
s := dataout;
t := datain;
-- Piece o' cake !
--
for i in 0 .. newheight - 1
loop
for j in 0 .. newwidth - 1
loop
for k in 0 .. components - 1
loop
s.all := ( GLushort_view (t + 0 ).all
+ GLushort_view (t + C.ptrdiff_t (components) ).all
+ GLushort_view (t + C.ptrdiff_t (the_delta) ).all
+ GLushort_view (t + C.ptrdiff_t (the_delta + components)).all
+ 2)
/ 4;
s := s + 1;
t := t + 1;
end loop;
t := t + C.ptrdiff_t (components);
end loop;
t := t + C.ptrdiff_t (the_delta);
end loop;
end halveImage;
procedure scale_internal (components : in GLint;
widthin : in GLint;
heightin : in GLint;
datain : in GLushort_view;
widthout : in GLint;
heightout : in GLint;
dataout : in GLushort_view)
is
use GLushort_Pointers;
x, lowx, highx, convx, halfconvx : GLfloat;
y, lowy, highy, convy, halfconvy : GLfloat;
xpercent, ypercent : GLfloat;
percent : GLfloat;
-- Max components in a format is 4, so...
totals : GLfloat_array (0 .. 3);
area : GLfloat;
yint, xint, xindex, yindex : GLint;
temp : GLint;
begin
if widthin = widthout * 2
and heightin = heightout * 2
then
halveImage (components,
GLuint (widthin),
GLuint (heightin),
datain,
dataout);
return;
end if;
convy := GLfloat (heightin) / GLfloat (heightout);
convx := GLfloat (widthin) / GLfloat (widthout);
halfconvx := convx / 2.0;
halfconvy := convy / 2.0;
for i in 0 .. heightout - 1
loop
y := convy * (GLfloat (i) + 0.5);
if heightin > heightout then
highy := y + halfconvy;
lowy := y - halfconvy;
else
highy := y + 0.5;
lowy := y - 0.5;
end if;
for j in 0 .. widthout - 1
loop
x := convx * (GLfloat (j) + 0.5);
if widthin > widthout then
highx := x + halfconvx;
lowx := x - halfconvx;
else
highx := x + 0.5;
lowx := x - 0.5;
end if;
-- Ok, now apply box filter to box that goes from (lowx, lowy)
-- to (highx, highy) on input data into this pixel on output data.
--
totals := (others => 0.0);
area := 0.0;
y := lowy;
yint := GLint (GLfloat'Floor (y));
while y < highy
loop
yindex := (yint + heightin) mod heightin;
if highy < GLfloat (yint + 1) then
ypercent := highy - y;
else
ypercent := GLfloat (yint + 1) - y;
end if;
x := lowx;
xint := GLint (GLfloat'Floor (x));
while x < highx
loop
xindex := (xint + widthin) mod widthin;
if highx < GLfloat (xint + 1) then
xpercent := highx - x;
else
xpercent := GLfloat (xint + 1) - x;
end if;
percent := xpercent * ypercent;
area := area + percent;
temp := (xindex + (yindex * widthin)) * components;
for k in 0 .. C.size_t (components - 1) loop
totals (k) := totals (k) + GLfloat (GLushort_view (datain + C.ptrdiff_t (temp) + C.ptrdiff_t (k)).all)
* percent;
end loop;
xint := xint + 1;
x := GLfloat (xint);
end loop;
yint := yint + 1;
y := GLfloat (yint);
end loop;
temp := (j + (i * widthout)) * components;
for k in 0 .. C.size_t (components - 1) loop
declare
Data : GLfloat := (totals (k) + 0.5) / area; -- totals[] should be rounded in the case of enlarging an RGB
-- ramp when the type is 332 or 4444
begin
Data := GLfloat'Min (Data,
GLfloat (GLushort'Last));
GLushort_view (dataout
+ C.ptrdiff_t (temp)
+ C.ptrdiff_t (k )).all := GLushort (Data);
end;
end loop;
end loop; -- for j
end loop; -- for i
end scale_internal;
function is_index (format : in GLenum) return Boolean -- TODO: Remove this, it doesn't apply to 'lean' GL types.
is
begin
return False; -- format == GL_COLOR_INDEX || format = GL_STENCIL_INDEX;
end is_index;
procedure gluScaleImage (format : in GLenum;
widthin : in GLsizei;
heightin : in GLsizei;
typein : in GLenum;
datain : in System.Address;
widthout : in GLsizei;
heightout : in GLsizei;
typeout : in GLenum;
dataout : in System.Address)
is
procedure free is new ada.unchecked_Deallocation (GLushort_array, GLushort_array_view);
components : GLint;
beforeImage : GLushort_array_view;
afterImage : GLushort_array_view;
psm : PixelStorageModes;
begin
if widthin = 0
or heightin = 0
or widthout = 0
or heightout = 0
then
return;
end if;
if widthin < 0
or heightin < 0
or widthout < 0
or heightout < 0
then
raise GLU_INVALID_VALUE;
end if;
if not legalFormat (format)
or not legalType (typein)
or not legalType (typeout)
then
raise GLU_INVALID_ENUM;
end if;
if not isLegalFormatForPackedPixelType (format, typein)
then
raise GLU_INVALID_OPERATION;
end if;
if not isLegalFormatForPackedPixelType (format, typeout)
then
raise GLU_INVALID_OPERATION;
end if;
declare
use type C.size_t;
before_Size : constant C.size_t := image_size (widthin, heightin, format, GL_UNSIGNED_SHORT);
after_Size : constant C.size_t := image_size (widthout, heightout, format, GL_UNSIGNED_SHORT);
begin
beforeImage := new GLushort_array (0 .. before_Size - 1);
afterImage := new GLushort_array (0 .. after_Size - 1);
end;
retrieveStoreModes (psm);
fill_image (psm,
widthin, heightin,
format,
typein,
is_index (format),
datain,
beforeImage);
components := elements_per_group (format, 0);
scale_internal (components,
widthin, heightin,
beforeImage (beforeImage'First)'Access,
widthout, heightout,
afterImage (afterImage'First)'Access);
empty_image (psm,
widthout, heightout,
format,
typeout,
is_index (format),
afterImage,
dataout);
free (beforeImage);
free (afterImage);
end gluScaleImage;
end GLU;
|
with Lv.Area;
with System;
package Lv.Hal.Indev is
type Indev_Type_T is (Type_None,
Type_Pointer,
Type_Keypad,
Type_Button,
Type_Encoder);
type Indev_State_T is (State_Rel, State_Pr);
type Indev_Data_T_Union (Discr : unsigned := 0) is record
case Discr is
when 0 =>
Point : aliased Lv.Area.Point_T;
when 1 =>
Key : aliased Uint32_T;
when 2 =>
Btn : aliased Uint32_T;
when others =>
Enc_Diff : aliased Int16_T;
end case;
end record;
pragma Convention (C_Pass_By_Copy, Indev_Data_T_Union);
pragma Unchecked_Union (Indev_Data_T_Union);
type Indev_Data_T is record
Union : aliased Indev_Data_T_Union;
User_Data : System.Address;
State : aliased Indev_State_T;
end record;
pragma Convention (C_Pass_By_Copy, Indev_Data_T);
type Indev_Drv_T is record
C_Type : aliased Indev_Type_T;
Read : access function (Data : access Indev_Data_T) return U_Bool;
User_Data : System.Address;
end record;
pragma Convention (C_Pass_By_Copy, Indev_Drv_T);
type Indev_T is private;
-- Initialize an input device driver with default values.
-- It is used to surly have known values in the fields ant not memory junk.
-- After it you can set the fields.
-- @param driver pointer to driver variable to initialize
procedure Init_Drv (Driver : access Indev_Drv_T);
-- Register an initialized input device driver.
-- @param driver pointer to an initialized 'lv_indev_drv_t' variable (can be local variable)
-- @return pointer to the new input device or NULL on error
function Register
(Driver : access Indev_Drv_T) return Indev_T;
-- Get the next input device.
-- @param indev pointer to the current input device. NULL to initialize.
-- @return the next input devise or NULL if no more. Gives the first input device when the parameter is NULL
function Next
(Indev : access Indev_T) return access Indev_T;
-- Read data from an input device.
-- @param indev pointer to an input device
-- @param data input device will write its data here
-- @return false: no more data; true: there more data to read (buffered)
function Read
(Indev : access Indev_T;
Data : access Indev_Data_T) return U_Bool;
private
type Indev_T is new System.Address;
-------------
-- Imports --
-------------
pragma Import (C, Init_Drv, "lv_indev_drv_init");
pragma Import (C, Register, "lv_indev_drv_register");
pragma Import (C, Next, "lv_indev_next");
pragma Import (C, Read, "lv_indev_read");
for Indev_Type_T'Size use 8;
for Indev_Type_T use
(Type_None => 0,
Type_Pointer => 1,
Type_Keypad => 2,
Type_Button => 3,
Type_Encoder => 4);
for Indev_State_T'Size use 8;
for Indev_State_T use (State_Rel => 0, State_Pr => 1);
end Lv.Hal.Indev;
|
package Problem_14 is
procedure Solve;
end Problem_14;
|
package GESTE_Fonts.FreeMonoBold8pt7b is
Font : constant Bitmap_Font_Ref;
private
FreeMonoBold8pt7bBitmaps : aliased constant Font_Bitmap := (
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#03#, 16#00#, 16#C0#,
16#30#, 16#0C#, 16#03#, 16#00#, 16#C0#, 16#00#, 16#0C#, 16#03#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#36#, 16#0C#,
16#83#, 16#20#, 16#48#, 16#12#, 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#1A#, 16#06#, 16#81#, 16#21#, 16#FE#, 16#7F#, 16#85#, 16#87#, 16#F1#,
16#FC#, 16#36#, 16#0D#, 16#83#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#30#, 16#1F#, 16#0F#, 16#C2#, 16#30#, 16#C0#, 16#3E#, 16#03#,
16#C6#, 16#11#, 16#8C#, 16#7E#, 16#03#, 16#00#, 16#C0#, 16#30#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#38#, 16#09#, 16#04#, 16#40#, 16#90#,
16#3F#, 16#0E#, 16#04#, 16#E0#, 16#24#, 16#09#, 16#03#, 16#80#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#83#,
16#E0#, 16#C0#, 16#30#, 16#0E#, 16#06#, 16#F1#, 16#98#, 16#7F#, 16#0F#,
16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#,
16#03#, 16#00#, 16#C0#, 16#20#, 16#08#, 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#03#, 16#00#, 16#80#, 16#60#, 16#10#, 16#0C#, 16#03#, 16#00#,
16#C0#, 16#30#, 16#04#, 16#01#, 16#80#, 16#60#, 16#0C#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#30#, 16#0C#, 16#01#, 16#80#, 16#60#, 16#18#,
16#02#, 16#00#, 16#80#, 16#20#, 16#18#, 16#06#, 16#03#, 16#00#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#08#, 16#03#, 16#07#, 16#F0#,
16#FC#, 16#1C#, 16#0D#, 16#81#, 16#20#, 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#03#,
16#00#, 16#C0#, 16#30#, 16#7F#, 16#9F#, 16#E0#, 16#C0#, 16#30#, 16#0C#,
16#03#, 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#00#,
16#00#, 16#18#, 16#06#, 16#01#, 16#00#, 16#40#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#9F#,
16#E0#, 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#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#03#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#04#, 16#03#, 16#00#, 16#80#,
16#60#, 16#18#, 16#0C#, 16#03#, 16#01#, 16#80#, 16#60#, 16#30#, 16#0C#,
16#06#, 16#01#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#78#, 16#3E#,
16#0C#, 16#C6#, 16#11#, 16#84#, 16#61#, 16#18#, 16#46#, 16#10#, 16#CC#,
16#3E#, 16#07#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#1C#, 16#0F#, 16#02#, 16#C0#, 16#30#, 16#0C#, 16#03#, 16#00#,
16#C0#, 16#30#, 16#7F#, 16#1F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#70#, 16#7E#, 16#18#, 16#C0#, 16#30#, 16#0C#, 16#06#,
16#03#, 16#01#, 16#80#, 16#C0#, 16#7F#, 16#1F#, 16#C0#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#F8#, 16#3F#, 16#00#, 16#C0#, 16#30#,
16#38#, 16#0E#, 16#00#, 16#C0#, 16#10#, 16#0C#, 16#7F#, 16#0F#, 16#80#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#,
16#80#, 16#A0#, 16#68#, 16#12#, 16#08#, 16#87#, 16#F1#, 16#FC#, 16#0F#,
16#03#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#3F#, 16#0F#, 16#C3#, 16#00#, 16#F8#, 16#3F#, 16#00#, 16#40#, 16#11#,
16#0C#, 16#7F#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#1C#, 16#1F#, 16#86#, 16#03#, 16#00#, 16#F8#, 16#3F#, 16#0C#,
16#43#, 16#18#, 16#C4#, 16#1F#, 16#07#, 16#80#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#1F#, 16#C0#, 16#30#, 16#0C#,
16#02#, 16#01#, 16#80#, 16#60#, 16#30#, 16#0C#, 16#02#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#78#, 16#3F#, 16#08#, 16#C6#,
16#10#, 16#8C#, 16#3E#, 16#0F#, 16#C6#, 16#31#, 16#8C#, 16#3F#, 16#07#,
16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#78#, 16#3F#,
16#0C#, 16#C2#, 16#18#, 16#CE#, 16#3F#, 16#87#, 16#40#, 16#30#, 16#1C#,
16#3E#, 16#0F#, 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#30#, 16#0C#, 16#00#, 16#00#,
16#00#, 16#00#, 16#0C#, 16#03#, 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#60#, 16#18#,
16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#06#, 16#01#, 16#00#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#,
16#1C#, 16#1C#, 16#1C#, 16#01#, 16#C0#, 16#1C#, 16#01#, 16#80#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#01#, 16#FE#, 16#7F#, 16#80#, 16#07#, 16#F9#, 16#FE#, 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#06#, 16#00#, 16#E0#, 16#1E#, 16#01#, 16#E0#, 16#E0#,
16#E0#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#1E#, 16#0F#, 16#C2#, 16#30#, 16#0C#, 16#0E#, 16#03#,
16#00#, 16#00#, 16#00#, 16#0C#, 16#03#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#70#, 16#3E#, 16#0C#, 16#C6#, 16#11#, 16#9C#,
16#4F#, 16#12#, 16#44#, 16#91#, 16#BC#, 16#67#, 16#08#, 16#03#, 16#F0#,
16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7C#, 16#1F#, 16#01#,
16#E0#, 16#58#, 16#36#, 16#0C#, 16#C7#, 16#F1#, 16#FE#, 16#F3#, 16#FC#,
16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FE#,
16#3F#, 16#C6#, 16#11#, 16#84#, 16#7F#, 16#1F#, 16#C6#, 16#19#, 16#86#,
16#FF#, 16#BF#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#1F#, 16#8F#, 16#E6#, 16#19#, 16#00#, 16#40#, 16#10#, 16#04#,
16#01#, 16#80#, 16#3F#, 16#87#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#FE#, 16#3F#, 16#C6#, 16#31#, 16#86#, 16#61#,
16#98#, 16#66#, 16#19#, 16#8C#, 16#FF#, 16#3F#, 16#80#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#3F#, 16#C6#, 16#11#,
16#90#, 16#7C#, 16#1F#, 16#06#, 16#59#, 16#86#, 16#FF#, 16#BF#, 16#E0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#BF#,
16#E6#, 16#19#, 16#90#, 16#7C#, 16#1F#, 16#06#, 16#41#, 16#80#, 16#FC#,
16#3F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#1F#, 16#8F#, 16#E6#, 16#19#, 16#00#, 16#40#, 16#11#, 16#E4#, 16#79#,
16#86#, 16#7F#, 16#87#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#77#, 16#9D#, 16#E2#, 16#10#, 16#84#, 16#3F#, 16#0F#,
16#C2#, 16#10#, 16#84#, 16#F7#, 16#BD#, 16#E0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#1F#, 16#C0#, 16#C0#, 16#30#,
16#0C#, 16#03#, 16#00#, 16#C0#, 16#30#, 16#7F#, 16#1F#, 16#C0#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#C7#, 16#F0#,
16#30#, 16#0C#, 16#03#, 16#00#, 16#C4#, 16#31#, 16#0C#, 16#7E#, 16#0F#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FB#,
16#BE#, 16#E6#, 16#71#, 16#B0#, 16#7C#, 16#1F#, 16#86#, 16#61#, 16#8C#,
16#FB#, 16#FE#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#7C#, 16#1F#, 16#03#, 16#00#, 16#C0#, 16#30#, 16#0C#, 16#03#,
16#08#, 16#C2#, 16#7F#, 16#9F#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#E1#, 16#F8#, 16#F7#, 16#39#, 16#CE#, 16#5F#,
16#97#, 16#64#, 16#D9#, 16#06#, 16#F3#, 16#FC#, 16#F0#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E7#, 16#BD#, 16#E7#, 16#19#,
16#E6#, 16#7D#, 16#9B#, 16#66#, 16#79#, 16#9E#, 16#F3#, 16#BC#, 16#60#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#0F#,
16#C6#, 16#39#, 16#06#, 16#C0#, 16#B0#, 16#24#, 16#19#, 16#8E#, 16#3F#,
16#07#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#FE#, 16#3F#, 16#C6#, 16#31#, 16#84#, 16#63#, 16#1F#, 16#C7#, 16#E1#,
16#80#, 16#FC#, 16#3F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#1E#, 16#0F#, 16#C6#, 16#39#, 16#06#, 16#C0#, 16#B0#,
16#24#, 16#19#, 16#8E#, 16#3F#, 16#07#, 16#83#, 16#F8#, 16#FE#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#FE#, 16#3F#, 16#C6#, 16#31#, 16#8C#,
16#7F#, 16#1F#, 16#86#, 16#61#, 16#8C#, 16#F1#, 16#FC#, 16#70#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#0F#, 16#C6#,
16#11#, 16#80#, 16#3E#, 16#07#, 16#C0#, 16#31#, 16#86#, 16#7F#, 16#17#,
16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7F#,
16#9F#, 16#E4#, 16#D9#, 16#36#, 16#0C#, 16#03#, 16#00#, 16#C0#, 16#30#,
16#3F#, 16#0F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#F7#, 16#BD#, 16#E6#, 16#11#, 16#84#, 16#61#, 16#18#, 16#46#,
16#11#, 16#8C#, 16#3F#, 16#07#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#F3#, 16#FC#, 16#F6#, 16#19#, 16#84#, 16#33#,
16#0C#, 16#81#, 16#60#, 16#78#, 16#1C#, 16#03#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F3#, 16#FC#, 16#F4#, 16#19#,
16#36#, 16#6D#, 16#9F#, 16#E7#, 16#71#, 16#DC#, 16#73#, 16#0C#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F3#, 16#BC#,
16#E3#, 16#30#, 16#78#, 16#1C#, 16#07#, 16#03#, 16#60#, 16#CC#, 16#F3#,
16#BC#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#F3#, 16#BC#, 16#E3#, 16#30#, 16#D8#, 16#1C#, 16#03#, 16#00#, 16#C0#,
16#30#, 16#3F#, 16#0F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#3F#, 16#0F#, 16#C2#, 16#30#, 16#98#, 16#0C#, 16#06#,
16#03#, 16#10#, 16#C4#, 16#7F#, 16#1F#, 16#C0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#03#, 16#80#, 16#C0#, 16#30#,
16#0C#, 16#03#, 16#00#, 16#C0#, 16#30#, 16#0C#, 16#03#, 16#00#, 16#F0#,
16#3C#, 16#00#, 16#00#, 16#00#, 16#01#, 16#80#, 16#20#, 16#0C#, 16#01#,
16#00#, 16#60#, 16#08#, 16#03#, 16#00#, 16#C0#, 16#18#, 16#06#, 16#00#,
16#C0#, 16#30#, 16#04#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3C#,
16#0F#, 16#00#, 16#C0#, 16#30#, 16#0C#, 16#03#, 16#00#, 16#C0#, 16#30#,
16#0C#, 16#03#, 16#03#, 16#C0#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#08#, 16#07#, 16#01#, 16#E0#, 16#CC#, 16#61#, 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#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#FF#,
16#00#, 16#00#, 16#00#, 16#00#, 16#40#, 16#18#, 16#03#, 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#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#F8#, 16#7F#, 16#0F#, 16#C7#, 16#F1#, 16#8C#, 16#7F#,
16#8F#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#E0#, 16#38#, 16#06#, 16#01#, 16#F8#, 16#7F#, 16#18#, 16#66#, 16#09#,
16#86#, 16#FF#, 16#3F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#7F#, 16#98#,
16#64#, 16#01#, 16#82#, 16#7F#, 16#87#, 16#C0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#E0#, 16#18#, 16#F6#,
16#7F#, 16#98#, 16#E4#, 16#19#, 16#8E#, 16#7F#, 16#CF#, 16#70#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#78#, 16#7F#, 16#18#, 16#47#, 16#F9#, 16#FE#, 16#7F#, 16#8F#,
16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#,
16#87#, 16#E1#, 16#81#, 16#FC#, 16#7F#, 16#06#, 16#01#, 16#80#, 16#60#,
16#7F#, 16#1F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F6#, 16#7F#, 16#98#, 16#C4#,
16#11#, 16#8C#, 16#7F#, 16#0F#, 16#40#, 16#30#, 16#FC#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#E0#, 16#38#, 16#02#, 16#00#, 16#B8#, 16#3F#,
16#0C#, 16#C2#, 16#10#, 16#84#, 16#F7#, 16#BD#, 16#E0#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#06#, 16#00#, 16#00#,
16#F0#, 16#3C#, 16#03#, 16#00#, 16#C0#, 16#30#, 16#7F#, 16#9F#, 16#E0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#03#,
16#00#, 16#00#, 16#F8#, 16#3E#, 16#00#, 16#80#, 16#20#, 16#08#, 16#02#,
16#00#, 16#80#, 16#21#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#60#, 16#18#, 16#02#, 16#00#, 16#9C#, 16#27#, 16#0B#, 16#03#, 16#80#,
16#B8#, 16#67#, 16#99#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#3C#, 16#0F#, 16#00#, 16#C0#, 16#30#, 16#0C#, 16#03#,
16#00#, 16#C0#, 16#30#, 16#7F#, 16#9F#, 16#E0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#EC#,
16#FF#, 16#93#, 16#64#, 16#D9#, 16#36#, 16#ED#, 16#FB#, 16#F0#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#01#, 16#B8#, 16#7F#, 16#08#, 16#C2#, 16#10#, 16#84#, 16#F3#, 16#BC#,
16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#78#, 16#7F#, 16#18#, 16#64#, 16#19#, 16#86#,
16#7F#, 16#07#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#B8#, 16#FF#, 16#98#, 16#66#,
16#09#, 16#86#, 16#7F#, 16#9B#, 16#86#, 16#03#, 16#E0#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F7#, 16#7F#,
16#F0#, 16#CC#, 16#13#, 16#8C#, 16#7F#, 16#0F#, 16#40#, 16#10#, 16#1F#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#,
16#CE#, 16#7F#, 16#87#, 16#01#, 16#00#, 16#40#, 16#7F#, 16#1F#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#7C#, 16#3F#, 16#18#, 16#43#, 16#F1#, 16#84#, 16#7F#,
16#1F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#20#, 16#08#, 16#02#, 16#03#, 16#F8#, 16#FE#, 16#08#, 16#02#, 16#00#,
16#84#, 16#3F#, 16#07#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#9C#, 16#E7#, 16#08#,
16#42#, 16#10#, 16#8C#, 16#3F#, 16#8F#, 16#60#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#DF#,
16#F7#, 16#C8#, 16#C3#, 16#20#, 16#58#, 16#1C#, 16#03#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#03#, 16#CE#, 16#E3#, 16#DB#, 16#67#, 16#D0#, 16#FC#, 16#37#, 16#0C#,
16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#01#, 16#DE#, 16#73#, 16#87#, 16#81#, 16#C0#, 16#F8#,
16#73#, 16#BD#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#CE#, 16#F3#, 16#98#, 16#C3#,
16#30#, 16#58#, 16#1C#, 16#03#, 16#01#, 16#83#, 16#F0#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FC#, 16#3F#,
16#09#, 16#80#, 16#C0#, 16#E0#, 16#7F#, 16#1F#, 16#C0#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#03#, 16#80#, 16#C0#,
16#30#, 16#0C#, 16#0E#, 16#03#, 16#80#, 16#30#, 16#0C#, 16#03#, 16#00#,
16#E0#, 16#18#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#03#,
16#00#, 16#C0#, 16#30#, 16#0C#, 16#03#, 16#00#, 16#C0#, 16#30#, 16#0C#,
16#03#, 16#00#, 16#C0#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#38#, 16#0E#, 16#00#, 16#C0#, 16#30#, 16#0C#, 16#03#, 16#80#, 16#E0#,
16#30#, 16#0C#, 16#03#, 16#03#, 16#80#, 16#E0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#7C#, 16#03#,
16#E0#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#);
Font_D : aliased constant Bitmap_Font :=
(
Bytes_Per_Glyph => 20,
Glyph_Width => 10,
Glyph_Height => 16,
Data => FreeMonoBold8pt7bBitmaps'Access);
Font : constant Bitmap_Font_Ref := Font_D'Access;
end GESTE_Fonts.FreeMonoBold8pt7b;
|
------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Text_IO.Integer_IO --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright 2020 Thomas E. Dickey --
-- Copyright 1999-2003,2009 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
-- $Revision: 1.12 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Ada.Text_IO;
with Terminal_Interface.Curses.Text_IO.Aux;
package body Terminal_Interface.Curses.Text_IO.Integer_IO is
package Aux renames Terminal_Interface.Curses.Text_IO.Aux;
package IIO is new Ada.Text_IO.Integer_IO (Num);
procedure Put
(Win : Window;
Item : Num;
Width : Field := Default_Width;
Base : Number_Base := Default_Base)
is
Buf : String (1 .. Field'Last);
begin
IIO.Put (Buf, Item, Base);
Aux.Put_Buf (Win, Buf, Width);
end Put;
procedure Put
(Item : Num;
Width : Field := Default_Width;
Base : Number_Base := Default_Base)
is
begin
Put (Get_Window, Item, Width, Base);
end Put;
end Terminal_Interface.Curses.Text_IO.Integer_IO;
|
-- Display_NORX_Traces
-- A utility to display traces of the encryption process for the test vectors
-- suggested in Appendix A of the NORX specification
-- Copyright (c) 2016, James Humphry - see LICENSE file for details
with System.Storage_Elements;
with NORX;
generic
with package NORX_Package is new NORX(<>);
Test_Message_Length : System.Storage_Elements.Storage_Offset := 128;
procedure Display_NORX_Traces;
|
function Duplication ( T: Tomb ) return Boolean is
J: Index := T'First;
Re: Boolean := False;
begin
for I in T'Range loop
if T(Mh) < T(I) then
Mh := I;
end if;
end loop;
return Mh;
end Duplication;
|
------------------------------------------------------------------------------
-- --
-- Ada binding for OpenGL/WebGL --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
with Web.HTML.Images;
private with Web.GL.Rendering_Contexts;
private with Web.GL.Textures;
package OpenGL.Textures is
pragma Preelaborate;
type OpenGL_Texture (Texture_Type : OpenGL.Texture_Type) is
tagged limited private;
function Create (Self : in out OpenGL_Texture'Class) return Boolean;
procedure Create (Self : in out OpenGL_Texture'Class);
procedure Delete (Self : in out OpenGL_Texture'Class);
function Is_Created (Self : OpenGL_Texture'Class) return Boolean;
-- Returns True if the underlying OpenGL texture object has been created.
procedure Bind (Self : in out OpenGL_Texture'Class);
-- Binds this texture to the currently active texture unit ready for
-- rendering.
-- function Bind
-- (Self : in out OpenGL_Texture'Class;
-- Unit : Texture_Unit) return Boolean;
-- procedure Bind
-- (Self : in out OpenGL_Texture'Class;
-- Unit : Texture_Unit);
-- -- Binds this texture to texture unit Unit ready for rendering.
--
-- procedure Release (Self : in out OpenGL_Texture'Class);
procedure Set_Data
(Self : in out OpenGL_Texture'Class;
Image : Web.HTML.Images.HTML_Image_Element'Class;
Generate_Mip_Map : Boolean := True);
-- procedure Set_Image_2D
-- (Self : in out OpenGL_Texture'Class;
-- Level : OpenGL.GLint;
-- Format : OpenGL.GLenum;
-- Width : OpenGL.GLsizei;
-- Height : OpenGL.GLsizei;
-- Data_Type : OpenGL.GLenum);
--
-- procedure Set_Parameter
-- (Self : in out OpenGL_Texture'Class;
-- Parameter : OpenGL.GLenum;
-- Value : OpenGL.GLenum);
private
type OpenGL_Texture (Texture_Type : OpenGL.Texture_Type) is
tagged limited record
Texture : Web.GL.Textures.WebGL_Texture;
Context : Web.GL.Rendering_Contexts.WebGL_Rendering_Context;
end record;
end OpenGL.Textures;
|
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.CONTAINERS.GENERIC_ANONYMOUS_ARRAY_SORT --
-- --
-- B o d y --
-- --
-- Copyright (C) 2004-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
-- This unit was originally a GNAT-specific addition to Ada 2005. A unit
-- providing the same feature, Ada.Containers.Generic_Sort, was defined for
-- Ada 2012. We retain Generic_Anonymous_Array_Sort for compatibility, but
-- implement it in terms of the official unit, Generic_Sort.
with Ada.Containers.Generic_Sort;
procedure Ada.Containers.Generic_Anonymous_Array_Sort
(First, Last : Index_Type'Base)
is
procedure Sort is new Ada.Containers.Generic_Sort
(Index_Type => Index_Type,
Before => Less,
Swap => Swap);
begin
Sort (First, Last);
end Ada.Containers.Generic_Anonymous_Array_Sort;
|
-- Copyright (C) 2019 Thierry Rascle <thierr26@free.fr>
-- MIT license. Please refer to the LICENSE file.
with Ada.Tags; use Ada.Tags;
with Apsepp.Generic_Prot_Integer;
private with Ada.Containers.Hashed_Maps,
Apsepp.Containers,
Apsepp.Tags;
package Apsepp.Test_Node_Class is
-- Evaluate the pre-conditions and class-wide pre-conditions in this
-- package.
pragma Assertion_Policy (Pre'Class => Check);
type Test_Outcome is (Failed, Passed);
type Run_Kind is (Check_Cond, Assert_Cond_And_Run_Test);
function Check_Cond_Run (Kind : Run_Kind) return Boolean
is (case Kind is
when Check_Cond => True,
when Assert_Cond_And_Run_Test => False);
type Test_Node_Count is new Natural;
subtype Test_Node_Index is Test_Node_Count range 1 .. Test_Node_Count'Last;
type Test_Routine_Count is new Natural;
subtype Test_Routine_Index
is Test_Routine_Count range 1 .. Test_Routine_Count'Last;
type Test_Routine is not null access procedure;
procedure Null_Test_Routine is null;
type Test_Assert_Count is new Natural;
package Prot_Test_Assert_Count
is new Generic_Prot_Integer (Test_Assert_Count);
subtype O_P_I_Test_Assert_Count is Prot_Test_Assert_Count.O_P_I_Type;
type Routine_State is record
Routine_Index : Test_Routine_Index;
Assert_Count : O_P_I_Test_Assert_Count;
Assert_Outcome : Test_Outcome;
end record;
type Tag_Routine_State is record
T : Tag;
S : Routine_State;
end record;
-- TODOC: A test node must not have two children with the same tag.
-- <2019-03-02>
-- TODOC: A runner must make sure that only one test node with a given tag
-- is running at a given time. <2019-03-02>
type Test_Node_Interfa is limited interface;
-- PORT: Type_Invariant'Class aspect causes compiler error.
-- 8.3.0 (x86_64-linux-gnu) GCC error:
-- in gnat_to_gnu_entity, at ada/gcc-interface/decl.c:425
-- <2019-06-10>
-- with Type_Invariant'Class
-- => (for all K_1 in 1 .. Test_Node_Interfa.Child_Count
-- => (for all K_2 in 1 .. Test_Node_Interfa.Child_Count
-- => K_2 = K_1 or else Test_Node_Interfa.Child (K_1)'Tag
-- /=
-- Test_Node_Interfa.Child (K_2)'Tag))
-- and then
-- (
-- Test_Node_Interfa.Has_Early_Test
-- or else
-- Test_Node_Interfa.Early_Run_Done
-- );
type Test_Node_Access is not null access all Test_Node_Interfa'Class;
type Test_Node_Array
is array (Test_Node_Index range <>) of Test_Node_Access;
type Test_Node_Array_Access is access Test_Node_Array;
not overriding
function Child_Count (Obj : Test_Node_Interfa)
return Test_Node_Count is abstract;
not overriding
function Child (Obj : Test_Node_Interfa;
K : Test_Node_Index) return Test_Node_Access is abstract
with Pre'Class => K <= Obj.Child_Count;
not overriding
function Routine_Count (Obj : Test_Node_Interfa) return Test_Routine_Count
is abstract;
not overriding
function Routine (Obj : Test_Node_Interfa;
K : Test_Routine_Index) return Test_Routine is abstract
with Pre'Class => K <= Obj.Routine_Count;
-- TODOC: Never called in implementations where Routine_Count returns 0.
-- <2019-03-19>
not overriding
procedure Setup_Routine (Obj : Test_Node_Interfa) is null;
not overriding
function No_Subtasking (Obj : Test_Node_Interfa)
return Boolean is abstract;
not overriding
function Has_Early_Test
(Obj : Test_Node_Interfa) return Boolean is abstract;
not overriding
function Early_Run_Done (Obj : Test_Node_Interfa) return Boolean
is abstract;
not overriding
procedure Early_Run (Obj : in out Test_Node_Interfa) is abstract
with Pre'Class => not Obj.Early_Run_Done,
Post'Class => Obj.Early_Run_Done;
not overriding
procedure Run
(Obj : in out Test_Node_Interfa;
Outcome : out Test_Outcome;
Kind : Run_Kind := Assert_Cond_And_Run_Test)
is abstract
with Post'Class => (case Kind is
when Check_Cond =>
True,
when Assert_Cond_And_Run_Test =>
Obj.Has_Early_Test xor Obj.Early_Run_Done);
procedure Run_Test_Routines (Obj : Test_Node_Interfa'Class;
Outcome : out Test_Outcome;
Kind : Run_Kind)
with Pre => Kind = Assert_Cond_And_Run_Test;
procedure Assert (Node_Tag : Tag; Cond : Boolean; Message : String := "");
private
use Ada.Containers,
Apsepp.Containers,
Apsepp.Tags;
package Routine_State_Hashed_Maps
is new Ada.Containers.Hashed_Maps (Key_Type => Tag,
Element_Type => Routine_State,
Hash => Tag_Hash,
Equivalent_Keys => "=");
type Tag_Routine_State_Array
is array (Index_Type range <>) of Tag_Routine_State;
----------------------------------------------------------------------------
protected Routine_State_Map_Handler is
procedure Reset_Routine_State (Node_Tag : Tag;
Routine_Index : Test_Routine_Index)
with Pre => Node_Tag /= No_Tag,
Post => Invariant;
procedure Increment_Assert_Count (Node_Tag : Tag)
with Pre => Node_Tag /= No_Tag,
Post => Invariant;
procedure Set_Failed_Outcome (Node_Tag : Tag)
with Pre => Node_Tag /= No_Tag,
Post => Invariant;
procedure Get_Assert_Count (Node_Tag : Tag;
Routine_Index : out Test_Routine_Index;
Count : out O_P_I_Test_Assert_Count)
with Pre => Node_Tag /= No_Tag,
Post => Invariant;
procedure Get_Assert_Outcome (Node_Tag : Tag;
Outcome : out Test_Outcome)
with Pre => Node_Tag /= No_Tag,
Post => Invariant;
procedure Delete (Node_Tag : Tag)
with Pre => Node_Tag /= No_Tag,
Post => Invariant;
function Invariant return Boolean;
function Count return Count_Type;
function To_Array return Tag_Routine_State_Array
with Post => To_Array'Result'First = 1
and then
To_Array'Result'Length = Count
and then
(for all R of To_Array'Result => R.T /= No_Tag);
private
T : Tag;
S : Routine_State;
M : Routine_State_Hashed_Maps.Map;
end Routine_State_Map_Handler;
----------------------------------------------------------------------------
end Apsepp.Test_Node_Class;
|
-- PR tree-optimization/71083
package Loop_Optimization23_Pkg is
type Nibble is mod 2**4;
type Int24 is mod 2**24;
type StructA is record
a : Nibble;
b : Int24;
end record;
pragma Pack(StructA);
type StructB is record
a : Nibble;
b : StructA;
end record;
pragma Pack(StructB);
type ArrayOfStructB is array(0..100) of StructB;
procedure Foo (X : in out ArrayOfStructB);
end Loop_Optimization23_Pkg;
|
--
-- Uwe R. Zimmer, Australia, 2015
--
with Ada.Task_Identification; use Ada.Task_Identification;
with Swarm_Configuration; use Swarm_Configuration;
with Swarm_Control; use Swarm_Control;
with Swarm_Data; use Swarm_Data;
with Swarm_Structures; use Swarm_Structures;
package body Vehicle_Interface is
use Swarm_Vectors;
-----------
-- State --
-----------
function Position return Positions is
(Swarm_Monitor.Position (Current_Task).all.Read);
function Velocity return Velocities is
(Swarm_Monitor.Velocity (Current_Task).all.Read);
function Acceleration return Accelerations is
(Swarm_Monitor.Acceleration (Current_Task).all.Read);
--------------
-- Steering --
--------------
procedure Set_Destination (V : Vector_3D) is
begin
Swarm_Monitor.Controls (Current_Task).all.Set_Steering (V);
end Set_Destination;
--------------
-- Thruttle --
--------------
procedure Set_Throttle (T : Throttle_T) is
begin
Swarm_Monitor.Controls (Current_Task).all.Set_Throttle (T);
end Set_Throttle;
function Throttle_Is_On_Idle return Boolean is
(Swarm_Monitor.Controls (Current_Task).all.Read_Throttle = Idle_Throttle);
---------------
-- Messaging --
---------------
procedure Send (Message : Inter_Vehicle_Messages) is
begin
Swarm_Monitor.Comms (Current_Task).all.Send (Message);
end Send;
procedure Receive (Message : out Inter_Vehicle_Messages) is
begin
Swarm_Monitor.Comms (Current_Task).all.Receive (Message);
end Receive;
function Messages_Waiting return Boolean is
(Swarm_Monitor.Comms (Current_Task).all.Has_Incoming_Messages);
------------
-- Energy --
------------
function Current_Charge return Vehicle_Charges is
(Swarm_Monitor.Charge (Current_Task).Level);
function Current_Discharge_Per_Sec return Real is
(Charging_Setup.Constant_Discharge_Rate_Per_Sec + Charging_Setup.Propulsion_Discharge_Rate_Per_Sec * abs (Acceleration));
function Energy_Globes_Around return Energy_Globes is
Globes_Found : Natural := 0;
Globes_Detected : array (Globes'Range) of Boolean := (others => False);
This_Element_Position : constant Positions := Position;
begin
for Globe_Ix in Globes'Range loop
if abs (This_Element_Position - Globes (Globe_Ix).Position.all.Read) <= Energy_Globe_Detection then
Globes_Detected (Globe_Ix) := True;
Globes_Found := Globes_Found + 1;
end if;
end loop;
declare
Found_Globes : Energy_Globes (1 .. Globes_Found);
Found_Globes_Ix : Natural := Globes'First;
begin
for Globe_Ix in Globes'Range loop
if Globes_Detected (Globe_Ix) then
Found_Globes (Found_Globes_Ix) := (Position => Globes (Globe_Ix).Position.all.Read,
Velocity => Globes (Globe_Ix).Velocity.all.Read);
Found_Globes_Ix := Found_Globes_Ix + 1;
end if;
end loop;
return Found_Globes;
end;
end Energy_Globes_Around;
--
procedure Wait_For_Next_Physics_Update is
begin
Simulator_Tick.Wait_For_Next_Tick;
end Wait_For_Next_Physics_Update;
-----------------
-- Termination --
-----------------
protected body Flight_Termination is
entry Stop when True is
begin
requeue Swarm_Monitor.Process_abort.all.Wait with abort;
end Stop;
end Flight_Termination;
--
end Vehicle_Interface;
|
------------------------------------------------------------------------------
-- --
-- Common UUID Handling Package --
-- - RFC 4122 Implementation - --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Version 4 (Random) UUID Generation Package --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2021 ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai (ANNEXI-STRAYLINE) --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of 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. --
-- --
------------------------------------------------------------------------------
package body UUIDs.Version_4 is
-- State Management --
----------------
-- Initialize --
----------------
function Initialize (Seed: Natural) return Generator is
begin
return Gen: Generator do
Gen_64.Reset (Gen => Gen.Gen, Initiator => Seed);
end return;
end;
----------------------------------------------------------------------
function Initialize (From_State: State) return Generator is
begin
return Gen: Generator do
Gen_64.Reset (Gen => Gen.Gen, From_State => From_State.Gen_State);
end return;
end;
----------
-- Save --
----------
procedure Save (Gen: in Generator; To_State: out State) is
begin
Gen_64.Save (Gen => Gen.Gen, To_State => To_State.Gen_State);
end;
-----------
-- Reset --
-----------
procedure Reset (Gen: in out Generator; Seed: in Integer) is
begin
Gen_64.Reset (Gen => Gen.Gen, Initiator => Seed);
end;
----------------------------------------------------------------------
procedure Reset (Gen: in out Generator; From_State: in State) is
begin
Gen_64.Reset (Gen => Gen.Gen, From_State => From_State.Gen_State);
end;
-----------------
-- Random_UUID --
-----------------
function Random_UUID (Gen: Generator) return UUID is
use Interfaces;
Rand_Hi: Unsigned_64 := Gen_64.Random (Gen.Gen);
Rand_Lo: Unsigned_64 := Gen_64.Random (Gen.Gen);
ID: UUID;
begin
-- The basic strategy is to generate two 64-bit values, and them overlay
-- them onto the UUID value, before editing the specific bits we need to
-- as per RFC 4122
ID.time_low := Bitfield_32 (Rand_Hi and 16#ffff_ffff#);
Rand_Hi := Shift_Right (Rand_Hi, 32);
ID.time_mid := Bitfield_16 (Rand_Hi and 16#ffff#);
Rand_Hi := Shift_Right (Rand_Hi, 16);
-- Set the four most significant bits (bits 12 through 15) of the
-- time_hi_and_version field to the 4-bit version number from
-- Section 4.1.3. (2#0100# i.e. 4)
ID.time_hi_and_version := Bitfield_16 (Rand_Hi and 16#0fff#);
ID.time_hi_and_version := ID.time_hi_and_version or 16#4000#;
-- RFC4122: "Set the two most significant bits (bits 6 and 7) of the
-- clock_seq_hi_and_reserved to zero and one, respectively.
ID.clock_seq_hi_and_reserved := Bitfield_8 (Rand_Lo and 2#0011_1111#);
ID.clock_seq_hi_and_reserved
:= ID.clock_seq_hi_and_reserved or 2#1000_0000#;
Rand_Lo := Shift_Right (Rand_Lo, 8);
ID.clock_seq_low := Bitfield_8 (Rand_Lo and 16#ff#);
Rand_Lo := Shift_Right (Rand_Lo, 8);
ID.node := Bitfield_48 (Rand_Lo and 16#ffff_ffff_ffff#);
return ID;
end Random_UUID;
end UUIDs.Version_4;
|
procedure Procedure_Renaming is
procedure Do_It is
begin
null;
end;
procedure Do_That renames Do_It;
begin
Do_That;
end Procedure_Renaming;
|
with Ada.Command_Line;
with Ada.Exceptions;
with Ada.Text_IO;
procedure lovelace is
end lovelace;
|
------------------------------------------------------------------------------
-- --
-- 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.Definitions.Component_Definition is
function Initialize
(Engine : access Engines.Contexts.Context;
Element : Asis.Definition;
Name : Engines.Text_Property) return League.Strings.Universal_String;
function Bounds
(Engine : access Engines.Contexts.Context;
Element : Asis.Definition;
Name : Engines.Text_Property) return League.Strings.Universal_String;
function Size
(Engine : access Engines.Contexts.Context;
Element : Asis.Definition;
Name : Engines.Text_Property) return League.Strings.Universal_String
renames Bounds;
function Alignment
(Engine : access Engines.Contexts.Context;
Element : Asis.Definition;
Name : Engines.Integer_Property) return Integer;
function Is_Simple_Ref
(Engine : access Engines.Contexts.Context;
Element : Asis.Declaration;
Name : Engines.Boolean_Property) return Boolean;
end Properties.Definitions.Component_Definition;
|
--
-- Copyright (c) 2015, John Leimon <jleimon@gmail.com>
--
-- 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.
--
pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
package x86_64_linux_gnu_bits_confname_h is
end x86_64_linux_gnu_bits_confname_h;
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="11">
<syndb class_id="0" tracking_level="0" version="0">
<userIPLatency>-1</userIPLatency>
<userIPName/>
<cdfg class_id="1" tracking_level="1" version="0" object_id="_0">
<name>matrixmul</name>
<ret_bitwidth>0</ret_bitwidth>
<ports class_id="2" tracking_level="0" version="0">
<count>3</count>
<item_version>0</item_version>
<item class_id="3" tracking_level="1" version="0" object_id="_1">
<Value class_id="4" tracking_level="0" version="0">
<Obj class_id="5" tracking_level="0" version="0">
<type>1</type>
<id>1</id>
<name>a</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo class_id="6" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>a</originalName>
<rtlName/>
<coreName>FIFO</coreName>
</Obj>
<bitwidth>24</bitwidth>
</Value>
<direction>0</direction>
<if_type>3</if_type>
<array_size>0</array_size>
<bit_vecs class_id="7" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_2">
<Value>
<Obj>
<type>1</type>
<id>2</id>
<name>b</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>b</originalName>
<rtlName/>
<coreName>FIFO</coreName>
</Obj>
<bitwidth>24</bitwidth>
</Value>
<direction>0</direction>
<if_type>3</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_3">
<Value>
<Obj>
<type>1</type>
<id>3</id>
<name>res</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>res</originalName>
<rtlName/>
<coreName>FIFO</coreName>
</Obj>
<bitwidth>16</bitwidth>
</Value>
<direction>1</direction>
<if_type>3</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
</ports>
<nodes class_id="8" tracking_level="0" version="0">
<count>104</count>
<item_version>0</item_version>
<item class_id="9" tracking_level="1" version="0" object_id="_4">
<Value>
<Obj>
<type>0</type>
<id>4</id>
<name>a_row_0</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>a_row[0]</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>130</item>
</oprand_edges>
<opcode>alloca</opcode>
</item>
<item class_id_reference="9" object_id="_5">
<Value>
<Obj>
<type>0</type>
<id>5</id>
<name>a_row_1_1</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>a_row[1]</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>131</item>
</oprand_edges>
<opcode>alloca</opcode>
</item>
<item class_id_reference="9" object_id="_6">
<Value>
<Obj>
<type>0</type>
<id>6</id>
<name>a_row_2_1</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>a_row[2]</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>132</item>
</oprand_edges>
<opcode>alloca</opcode>
</item>
<item class_id_reference="9" object_id="_7">
<Value>
<Obj>
<type>0</type>
<id>7</id>
<name>b_copy_0_2_3</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>b_copy[0][2]</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>133</item>
</oprand_edges>
<opcode>alloca</opcode>
</item>
<item class_id_reference="9" object_id="_8">
<Value>
<Obj>
<type>0</type>
<id>8</id>
<name>b_copy_0_2_6</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>b_copy[0][2]</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>134</item>
</oprand_edges>
<opcode>alloca</opcode>
</item>
<item class_id_reference="9" object_id="_9">
<Value>
<Obj>
<type>0</type>
<id>9</id>
<name>b_copy_0_2_1</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>b_copy[0][2]</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>135</item>
</oprand_edges>
<opcode>alloca</opcode>
</item>
<item class_id_reference="9" object_id="_10">
<Value>
<Obj>
<type>0</type>
<id>10</id>
<name>b_copy_1_2_3</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>b_copy[1][2]</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>136</item>
</oprand_edges>
<opcode>alloca</opcode>
</item>
<item class_id_reference="9" object_id="_11">
<Value>
<Obj>
<type>0</type>
<id>11</id>
<name>b_copy_1_2_6</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>b_copy[1][2]</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>137</item>
</oprand_edges>
<opcode>alloca</opcode>
</item>
<item class_id_reference="9" object_id="_12">
<Value>
<Obj>
<type>0</type>
<id>12</id>
<name>b_copy_1_2_1</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>b_copy[1][2]</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>138</item>
</oprand_edges>
<opcode>alloca</opcode>
</item>
<item class_id_reference="9" object_id="_13">
<Value>
<Obj>
<type>0</type>
<id>13</id>
<name>b_copy_2_2_3</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>b_copy[2][2]</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>139</item>
</oprand_edges>
<opcode>alloca</opcode>
</item>
<item class_id_reference="9" object_id="_14">
<Value>
<Obj>
<type>0</type>
<id>14</id>
<name>b_copy_2_2_6</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>b_copy[2][2]</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>140</item>
</oprand_edges>
<opcode>alloca</opcode>
</item>
<item class_id_reference="9" object_id="_15">
<Value>
<Obj>
<type>0</type>
<id>15</id>
<name>b_copy_2_2_1</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>b_copy[2][2]</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>141</item>
</oprand_edges>
<opcode>alloca</opcode>
</item>
<item class_id_reference="9" object_id="_16">
<Value>
<Obj>
<type>0</type>
<id>23</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>63</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item class_id="11" tracking_level="0" version="0">
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second class_id="12" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="13" tracking_level="0" version="0">
<first class_id="14" tracking_level="0" version="0">
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>63</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>142</item>
</oprand_edges>
<opcode>br</opcode>
</item>
<item class_id_reference="9" object_id="_17">
<Value>
<Obj>
<type>0</type>
<id>25</id>
<name>indvar_flatten</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>4</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>144</item>
<item>145</item>
<item>146</item>
<item>147</item>
</oprand_edges>
<opcode>phi</opcode>
</item>
<item class_id_reference="9" object_id="_18">
<Value>
<Obj>
<type>0</type>
<id>26</id>
<name>i</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>2</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>149</item>
<item>150</item>
<item>151</item>
<item>152</item>
</oprand_edges>
<opcode>phi</opcode>
</item>
<item class_id_reference="9" object_id="_19">
<Value>
<Obj>
<type>0</type>
<id>27</id>
<name>j</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>j</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>2</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>153</item>
<item>154</item>
<item>155</item>
<item>156</item>
</oprand_edges>
<opcode>phi</opcode>
</item>
<item class_id_reference="9" object_id="_20">
<Value>
<Obj>
<type>0</type>
<id>28</id>
<name>exitcond_flatten</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName>exitcond_flatten_fu_166_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>157</item>
<item>159</item>
</oprand_edges>
<opcode>icmp</opcode>
</item>
<item class_id_reference="9" object_id="_21">
<Value>
<Obj>
<type>0</type>
<id>29</id>
<name>indvar_flatten_next</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName>indvar_flatten_next_fu_172_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>4</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>160</item>
<item>162</item>
</oprand_edges>
<opcode>add</opcode>
</item>
<item class_id_reference="9" object_id="_22">
<Value>
<Obj>
<type>0</type>
<id>30</id>
<name/>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>163</item>
<item>164</item>
<item>165</item>
</oprand_edges>
<opcode>br</opcode>
</item>
<item class_id_reference="9" object_id="_23">
<Value>
<Obj>
<type>0</type>
<id>34</id>
<name>exitcond</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>exitcond_fu_178_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>331</item>
<item>333</item>
</oprand_edges>
<opcode>icmp</opcode>
</item>
<item class_id_reference="9" object_id="_24">
<Value>
<Obj>
<type>0</type>
<id>35</id>
<name>j_mid2</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>j_mid2_fu_184_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>2</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>334</item>
<item>335</item>
<item>336</item>
</oprand_edges>
<opcode>select</opcode>
</item>
<item class_id_reference="9" object_id="_25">
<Value>
<Obj>
<type>0</type>
<id>36</id>
<name>i_s</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>63</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>63</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>i_s_fu_192_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>2</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>337</item>
<item>338</item>
</oprand_edges>
<opcode>add</opcode>
</item>
<item class_id_reference="9" object_id="_26">
<Value>
<Obj>
<type>0</type>
<id>37</id>
<name>i_mid2</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>i_mid2_fu_198_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>2</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>339</item>
<item>340</item>
<item>341</item>
</oprand_edges>
<opcode>select</opcode>
</item>
<item class_id_reference="9" object_id="_27">
<Value>
<Obj>
<type>0</type>
<id>38</id>
<name>tmp</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>75</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>75</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>tmp_fu_206_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>342</item>
<item>343</item>
</oprand_edges>
<opcode>icmp</opcode>
</item>
<item class_id_reference="9" object_id="_28">
<Value>
<Obj>
<type>0</type>
<id>42</id>
<name>tmp_3</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>70</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>70</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>tmp_3_fu_212_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>344</item>
<item>345</item>
</oprand_edges>
<opcode>icmp</opcode>
</item>
<item class_id_reference="9" object_id="_29">
<Value>
<Obj>
<type>0</type>
<id>43</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>70</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>70</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>346</item>
<item>347</item>
<item>348</item>
</oprand_edges>
<opcode>br</opcode>
</item>
<item class_id_reference="9" object_id="_30">
<Value>
<Obj>
<type>0</type>
<id>45</id>
<name>a_read</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>72</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>72</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>24</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>167</item>
<item>168</item>
</oprand_edges>
<opcode>read</opcode>
</item>
<item class_id_reference="9" object_id="_31">
<Value>
<Obj>
<type>0</type>
<id>46</id>
<name>a_row_0_1</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>72</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>72</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>a_row[0]</originalName>
<rtlName>a_row_0_1_fu_224_p1</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>169</item>
</oprand_edges>
<opcode>trunc</opcode>
</item>
<item class_id_reference="9" object_id="_32">
<Value>
<Obj>
<type>0</type>
<id>47</id>
<name>a_row_1</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>72</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>72</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>a_row[1]</originalName>
<rtlName>a_row_1_1_fu_70</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>171</item>
<item>172</item>
<item>174</item>
<item>176</item>
</oprand_edges>
<opcode>partselect</opcode>
</item>
<item class_id_reference="9" object_id="_33">
<Value>
<Obj>
<type>0</type>
<id>48</id>
<name>a_row_2</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>72</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>72</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>a_row[2]</originalName>
<rtlName>a_row_2_1_fu_74</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>177</item>
<item>178</item>
<item>180</item>
<item>182</item>
</oprand_edges>
<opcode>partselect</opcode>
</item>
<item class_id_reference="9" object_id="_34">
<Value>
<Obj>
<type>0</type>
<id>49</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>72</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>72</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>183</item>
<item>184</item>
</oprand_edges>
<opcode>store</opcode>
</item>
<item class_id_reference="9" object_id="_35">
<Value>
<Obj>
<type>0</type>
<id>50</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>72</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>72</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>185</item>
<item>186</item>
</oprand_edges>
<opcode>store</opcode>
</item>
<item class_id_reference="9" object_id="_36">
<Value>
<Obj>
<type>0</type>
<id>51</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>72</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>72</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>187</item>
<item>188</item>
</oprand_edges>
<opcode>store</opcode>
</item>
<item class_id_reference="9" object_id="_37">
<Value>
<Obj>
<type>0</type>
<id>52</id>
<name/>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>189</item>
</oprand_edges>
<opcode>br</opcode>
</item>
<item class_id_reference="9" object_id="_38">
<Value>
<Obj>
<type>0</type>
<id>54</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>75</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>75</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>190</item>
<item>191</item>
<item>192</item>
</oprand_edges>
<opcode>br</opcode>
</item>
<item class_id_reference="9" object_id="_39">
<Value>
<Obj>
<type>0</type>
<id>56</id>
<name>b_copy_0_2_3_load</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>193</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_40">
<Value>
<Obj>
<type>0</type>
<id>57</id>
<name>b_copy_0_2_6_load</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>194</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_41">
<Value>
<Obj>
<type>0</type>
<id>58</id>
<name>b_copy_0_2_1_load</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>195</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_42">
<Value>
<Obj>
<type>0</type>
<id>59</id>
<name>b_copy_1_2_3_load</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>196</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_43">
<Value>
<Obj>
<type>0</type>
<id>60</id>
<name>b_copy_1_2_6_load</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>197</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_44">
<Value>
<Obj>
<type>0</type>
<id>61</id>
<name>b_copy_1_2_1_load</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>198</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_45">
<Value>
<Obj>
<type>0</type>
<id>62</id>
<name>b_copy_2_2_3_load</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>199</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_46">
<Value>
<Obj>
<type>0</type>
<id>63</id>
<name>b_copy_2_2_6_load</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>200</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_47">
<Value>
<Obj>
<type>0</type>
<id>64</id>
<name>b_copy_2_2_1_load</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>201</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_48">
<Value>
<Obj>
<type>0</type>
<id>65</id>
<name>b_read</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>77</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>77</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>24</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>202</item>
<item>203</item>
</oprand_edges>
<opcode>read</opcode>
</item>
<item class_id_reference="9" object_id="_49">
<Value>
<Obj>
<type>0</type>
<id>66</id>
<name>b_copy_0_2_9</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>77</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>77</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[0][2]</originalName>
<rtlName>b_copy_0_2_9_fu_285_p1</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>204</item>
</oprand_edges>
<opcode>trunc</opcode>
</item>
<item class_id_reference="9" object_id="_50">
<Value>
<Obj>
<type>0</type>
<id>67</id>
<name>sel_tmp</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>sel_tmp_fu_289_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>205</item>
<item>207</item>
</oprand_edges>
<opcode>icmp</opcode>
</item>
<item class_id_reference="9" object_id="_51">
<Value>
<Obj>
<type>0</type>
<id>68</id>
<name>b_copy_0_2</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[0][2]</originalName>
<rtlName>b_copy_0_2_fu_294_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>208</item>
<item>209</item>
<item>210</item>
</oprand_edges>
<opcode>select</opcode>
</item>
<item class_id_reference="9" object_id="_52">
<Value>
<Obj>
<type>0</type>
<id>69</id>
<name>b_copy_0_2_2</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>70</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>70</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[0][2]</originalName>
<rtlName>b_copy_0_2_2_fu_302_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>211</item>
<item>212</item>
<item>213</item>
</oprand_edges>
<opcode>select</opcode>
</item>
<item class_id_reference="9" object_id="_53">
<Value>
<Obj>
<type>0</type>
<id>70</id>
<name>b_copy_0_2_4</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[0][2]</originalName>
<rtlName>b_copy_0_2_4_fu_309_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>214</item>
<item>215</item>
<item>216</item>
</oprand_edges>
<opcode>select</opcode>
</item>
<item class_id_reference="9" object_id="_54">
<Value>
<Obj>
<type>0</type>
<id>71</id>
<name>b_copy_0_2_5</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>70</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>70</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[0][2]</originalName>
<rtlName>b_copy_0_2_5_fu_317_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>217</item>
<item>218</item>
<item>219</item>
</oprand_edges>
<opcode>select</opcode>
</item>
<item class_id_reference="9" object_id="_55">
<Value>
<Obj>
<type>0</type>
<id>72</id>
<name>b_copy_0_2_7</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>70</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>70</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[0][2]</originalName>
<rtlName>b_copy_0_2_7_fu_324_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>220</item>
<item>221</item>
<item>222</item>
</oprand_edges>
<opcode>select</opcode>
</item>
<item class_id_reference="9" object_id="_56">
<Value>
<Obj>
<type>0</type>
<id>73</id>
<name>b_copy_1_2_9</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>77</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>77</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[1][2]</originalName>
<rtlName>b_copy_1_2_9_fu_331_p4</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>223</item>
<item>224</item>
<item>225</item>
<item>226</item>
</oprand_edges>
<opcode>partselect</opcode>
</item>
<item class_id_reference="9" object_id="_57">
<Value>
<Obj>
<type>0</type>
<id>74</id>
<name>b_copy_1_2</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[1][2]</originalName>
<rtlName>b_copy_1_2_fu_341_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>227</item>
<item>228</item>
<item>229</item>
</oprand_edges>
<opcode>select</opcode>
</item>
<item class_id_reference="9" object_id="_58">
<Value>
<Obj>
<type>0</type>
<id>75</id>
<name>b_copy_1_2_2</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>70</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>70</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[1][2]</originalName>
<rtlName>b_copy_1_2_2_fu_349_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>230</item>
<item>231</item>
<item>232</item>
</oprand_edges>
<opcode>select</opcode>
</item>
<item class_id_reference="9" object_id="_59">
<Value>
<Obj>
<type>0</type>
<id>76</id>
<name>b_copy_1_2_4</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[1][2]</originalName>
<rtlName>b_copy_1_2_4_fu_356_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>233</item>
<item>234</item>
<item>235</item>
</oprand_edges>
<opcode>select</opcode>
</item>
<item class_id_reference="9" object_id="_60">
<Value>
<Obj>
<type>0</type>
<id>77</id>
<name>b_copy_1_2_5</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>70</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>70</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[1][2]</originalName>
<rtlName>b_copy_1_2_5_fu_364_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>236</item>
<item>237</item>
<item>238</item>
</oprand_edges>
<opcode>select</opcode>
</item>
<item class_id_reference="9" object_id="_61">
<Value>
<Obj>
<type>0</type>
<id>78</id>
<name>b_copy_1_2_7</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>70</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>70</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[1][2]</originalName>
<rtlName>b_copy_1_2_7_fu_371_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>239</item>
<item>240</item>
<item>241</item>
</oprand_edges>
<opcode>select</opcode>
</item>
<item class_id_reference="9" object_id="_62">
<Value>
<Obj>
<type>0</type>
<id>79</id>
<name>b_copy_2_2_9</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>77</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>77</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[2][2]</originalName>
<rtlName>b_copy_2_2_9_fu_378_p4</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>242</item>
<item>243</item>
<item>244</item>
<item>245</item>
</oprand_edges>
<opcode>partselect</opcode>
</item>
<item class_id_reference="9" object_id="_63">
<Value>
<Obj>
<type>0</type>
<id>80</id>
<name>b_copy_2_2</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[2][2]</originalName>
<rtlName>b_copy_2_2_fu_388_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>246</item>
<item>247</item>
<item>248</item>
</oprand_edges>
<opcode>select</opcode>
</item>
<item class_id_reference="9" object_id="_64">
<Value>
<Obj>
<type>0</type>
<id>81</id>
<name>b_copy_2_2_2</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>70</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>70</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[2][2]</originalName>
<rtlName>b_copy_2_2_2_fu_396_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>249</item>
<item>250</item>
<item>251</item>
</oprand_edges>
<opcode>select</opcode>
</item>
<item class_id_reference="9" object_id="_65">
<Value>
<Obj>
<type>0</type>
<id>82</id>
<name>b_copy_2_2_4</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[2][2]</originalName>
<rtlName>b_copy_2_2_4_fu_403_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>252</item>
<item>253</item>
<item>254</item>
</oprand_edges>
<opcode>select</opcode>
</item>
<item class_id_reference="9" object_id="_66">
<Value>
<Obj>
<type>0</type>
<id>83</id>
<name>b_copy_2_2_5</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>70</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>70</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[2][2]</originalName>
<rtlName>b_copy_2_2_5_fu_411_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>255</item>
<item>256</item>
<item>257</item>
</oprand_edges>
<opcode>select</opcode>
</item>
<item class_id_reference="9" object_id="_67">
<Value>
<Obj>
<type>0</type>
<id>84</id>
<name>b_copy_2_2_7</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>70</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>70</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>b_copy[2][2]</originalName>
<rtlName>b_copy_2_2_7_fu_418_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>258</item>
<item>259</item>
<item>260</item>
</oprand_edges>
<opcode>select</opcode>
</item>
<item class_id_reference="9" object_id="_68">
<Value>
<Obj>
<type>0</type>
<id>85</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>77</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>77</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>261</item>
<item>262</item>
<item>431</item>
</oprand_edges>
<opcode>store</opcode>
</item>
<item class_id_reference="9" object_id="_69">
<Value>
<Obj>
<type>0</type>
<id>86</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>77</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>77</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>263</item>
<item>264</item>
<item>432</item>
</oprand_edges>
<opcode>store</opcode>
</item>
<item class_id_reference="9" object_id="_70">
<Value>
<Obj>
<type>0</type>
<id>87</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>77</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>77</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>265</item>
<item>266</item>
<item>433</item>
</oprand_edges>
<opcode>store</opcode>
</item>
<item class_id_reference="9" object_id="_71">
<Value>
<Obj>
<type>0</type>
<id>88</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>77</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>77</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>267</item>
<item>268</item>
<item>434</item>
</oprand_edges>
<opcode>store</opcode>
</item>
<item class_id_reference="9" object_id="_72">
<Value>
<Obj>
<type>0</type>
<id>89</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>77</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>77</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>269</item>
<item>270</item>
<item>435</item>
</oprand_edges>
<opcode>store</opcode>
</item>
<item class_id_reference="9" object_id="_73">
<Value>
<Obj>
<type>0</type>
<id>90</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>77</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>77</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>271</item>
<item>272</item>
<item>436</item>
</oprand_edges>
<opcode>store</opcode>
</item>
<item class_id_reference="9" object_id="_74">
<Value>
<Obj>
<type>0</type>
<id>91</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>77</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>77</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>273</item>
<item>274</item>
<item>437</item>
</oprand_edges>
<opcode>store</opcode>
</item>
<item class_id_reference="9" object_id="_75">
<Value>
<Obj>
<type>0</type>
<id>92</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>77</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>77</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>275</item>
<item>276</item>
<item>438</item>
</oprand_edges>
<opcode>store</opcode>
</item>
<item class_id_reference="9" object_id="_76">
<Value>
<Obj>
<type>0</type>
<id>93</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>77</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>77</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>277</item>
<item>278</item>
<item>439</item>
</oprand_edges>
<opcode>store</opcode>
</item>
<item class_id_reference="9" object_id="_77">
<Value>
<Obj>
<type>0</type>
<id>94</id>
<name/>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>279</item>
</oprand_edges>
<opcode>br</opcode>
</item>
<item class_id_reference="9" object_id="_78">
<Value>
<Obj>
<type>0</type>
<id>96</id>
<name>a_row_0_load</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>82</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>82</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>280</item>
<item>442</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_79">
<Value>
<Obj>
<type>0</type>
<id>97</id>
<name>a_row_1_1_load</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>82</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>82</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>281</item>
<item>441</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_80">
<Value>
<Obj>
<type>0</type>
<id>98</id>
<name>a_row_2_1_load</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>82</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>82</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>282</item>
<item>440</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_81">
<Value>
<Obj>
<type>0</type>
<id>99</id>
<name>b_copy_0_2_3_load_1</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>283</item>
<item>451</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_82">
<Value>
<Obj>
<type>0</type>
<id>100</id>
<name>b_copy_0_2_6_load_1</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>284</item>
<item>450</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_83">
<Value>
<Obj>
<type>0</type>
<id>101</id>
<name>b_copy_0_2_1_load_1</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>285</item>
<item>449</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_84">
<Value>
<Obj>
<type>0</type>
<id>102</id>
<name>b_copy_1_2_3_load_1</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>286</item>
<item>448</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_85">
<Value>
<Obj>
<type>0</type>
<id>103</id>
<name>b_copy_1_2_6_load_1</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>287</item>
<item>447</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_86">
<Value>
<Obj>
<type>0</type>
<id>104</id>
<name>b_copy_1_2_1_load_1</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>288</item>
<item>446</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_87">
<Value>
<Obj>
<type>0</type>
<id>105</id>
<name>b_copy_2_2_3_load_1</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>289</item>
<item>445</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_88">
<Value>
<Obj>
<type>0</type>
<id>106</id>
<name>b_copy_2_2_6_load_1</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>290</item>
<item>444</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_89">
<Value>
<Obj>
<type>0</type>
<id>107</id>
<name>b_copy_2_2_1_load_1</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>291</item>
<item>443</item>
</oprand_edges>
<opcode>load</opcode>
</item>
<item class_id_reference="9" object_id="_90">
<Value>
<Obj>
<type>0</type>
<id>108</id>
<name>tmp_s</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>82</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>82</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>16</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>292</item>
</oprand_edges>
<opcode>sext</opcode>
</item>
<item class_id_reference="9" object_id="_91">
<Value>
<Obj>
<type>0</type>
<id>109</id>
<name>tmp_1</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>matrixmul_mux_3to1_sel2_8_1_U0</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>5</count>
<item_version>0</item_version>
<item>294</item>
<item>295</item>
<item>296</item>
<item>297</item>
<item>298</item>
</oprand_edges>
<opcode>mux</opcode>
</item>
<item class_id_reference="9" object_id="_92">
<Value>
<Obj>
<type>0</type>
<id>110</id>
<name>tmp_5</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>82</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>82</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>16</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>299</item>
</oprand_edges>
<opcode>sext</opcode>
</item>
<item class_id_reference="9" object_id="_93">
<Value>
<Obj>
<type>0</type>
<id>111</id>
<name>tmp_6</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>82</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>82</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>matrixmul_mac_muladd_8s_8s_16s_16_1_U3</rtlName>
<coreName/>
</Obj>
<bitwidth>16</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>300</item>
<item>301</item>
</oprand_edges>
<opcode>mul</opcode>
</item>
<item class_id_reference="9" object_id="_94">
<Value>
<Obj>
<type>0</type>
<id>112</id>
<name>tmp_5_1</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>82</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>82</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>16</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>302</item>
</oprand_edges>
<opcode>sext</opcode>
</item>
<item class_id_reference="9" object_id="_95">
<Value>
<Obj>
<type>0</type>
<id>113</id>
<name>tmp_7</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>matrixmul_mux_3to1_sel2_8_1_U1</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>5</count>
<item_version>0</item_version>
<item>303</item>
<item>304</item>
<item>305</item>
<item>306</item>
<item>307</item>
</oprand_edges>
<opcode>mux</opcode>
</item>
<item class_id_reference="9" object_id="_96">
<Value>
<Obj>
<type>0</type>
<id>114</id>
<name>tmp_8_1</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>82</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>82</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>16</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>308</item>
</oprand_edges>
<opcode>sext</opcode>
</item>
<item class_id_reference="9" object_id="_97">
<Value>
<Obj>
<type>0</type>
<id>115</id>
<name>tmp_10_1</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>82</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>82</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>grp_fu_580_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>16</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>309</item>
<item>310</item>
</oprand_edges>
<opcode>mul</opcode>
</item>
<item class_id_reference="9" object_id="_98">
<Value>
<Obj>
<type>0</type>
<id>116</id>
<name>tmp_5_2</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>82</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>82</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>16</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>311</item>
</oprand_edges>
<opcode>sext</opcode>
</item>
<item class_id_reference="9" object_id="_99">
<Value>
<Obj>
<type>0</type>
<id>117</id>
<name>tmp_8</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>matrixmul_mux_3to1_sel2_8_1_U2</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>5</count>
<item_version>0</item_version>
<item>312</item>
<item>313</item>
<item>314</item>
<item>315</item>
<item>316</item>
</oprand_edges>
<opcode>mux</opcode>
</item>
<item class_id_reference="9" object_id="_100">
<Value>
<Obj>
<type>0</type>
<id>118</id>
<name>tmp_8_2</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>82</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>82</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>16</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>317</item>
</oprand_edges>
<opcode>sext</opcode>
</item>
<item class_id_reference="9" object_id="_101">
<Value>
<Obj>
<type>0</type>
<id>119</id>
<name>tmp_10_2</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>82</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>82</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>matrixmul_mac_muladd_8s_8s_16s_16_1_U4</rtlName>
<coreName/>
</Obj>
<bitwidth>16</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>318</item>
<item>319</item>
</oprand_edges>
<opcode>mul</opcode>
</item>
<item class_id_reference="9" object_id="_102">
<Value>
<Obj>
<type>0</type>
<id>120</id>
<name>tmp9</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>82</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>82</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>matrixmul_mac_muladd_8s_8s_16s_16_1_U4</rtlName>
<coreName/>
</Obj>
<bitwidth>16</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>320</item>
<item>321</item>
</oprand_edges>
<opcode>add</opcode>
</item>
<item class_id_reference="9" object_id="_103">
<Value>
<Obj>
<type>0</type>
<id>121</id>
<name>tmp_11_2</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>82</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>82</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>matrixmul_mac_muladd_8s_8s_16s_16_1_U3</rtlName>
<coreName/>
</Obj>
<bitwidth>16</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>322</item>
<item>323</item>
</oprand_edges>
<opcode>add</opcode>
</item>
<item class_id_reference="9" object_id="_104">
<Value>
<Obj>
<type>0</type>
<id>122</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>82</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>82</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>325</item>
<item>326</item>
<item>327</item>
</oprand_edges>
<opcode>write</opcode>
</item>
<item class_id_reference="9" object_id="_105">
<Value>
<Obj>
<type>0</type>
<id>124</id>
<name>j_1</name>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>j</originalName>
<rtlName>j_1_fu_218_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>2</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>328</item>
<item>329</item>
</oprand_edges>
<opcode>add</opcode>
</item>
<item class_id_reference="9" object_id="_106">
<Value>
<Obj>
<type>0</type>
<id>125</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>330</item>
</oprand_edges>
<opcode>br</opcode>
</item>
<item class_id_reference="9" object_id="_107">
<Value>
<Obj>
<type>0</type>
<id>127</id>
<name/>
<fileName>matrixmul.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>85</lineNumber>
<contextFuncName>matrixmul</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab2</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>matrixmul.cpp</first>
<second>matrixmul</second>
</first>
<second>85</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>0</count>
<item_version>0</item_version>
</oprand_edges>
<opcode>ret</opcode>
</item>
</nodes>
<consts class_id="15" tracking_level="0" version="0">
<count>11</count>
<item_version>0</item_version>
<item class_id="16" tracking_level="1" version="0" object_id="_108">
<Value>
<Obj>
<type>2</type>
<id>129</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>1</content>
</item>
<item class_id_reference="16" object_id="_109">
<Value>
<Obj>
<type>2</type>
<id>143</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>4</bitwidth>
</Value>
<const_type>0</const_type>
<content>0</content>
</item>
<item class_id_reference="16" object_id="_110">
<Value>
<Obj>
<type>2</type>
<id>148</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>2</bitwidth>
</Value>
<const_type>0</const_type>
<content>0</content>
</item>
<item class_id_reference="16" object_id="_111">
<Value>
<Obj>
<type>2</type>
<id>158</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>4</bitwidth>
</Value>
<const_type>0</const_type>
<content>9</content>
</item>
<item class_id_reference="16" object_id="_112">
<Value>
<Obj>
<type>2</type>
<id>161</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>4</bitwidth>
</Value>
<const_type>0</const_type>
<content>1</content>
</item>
<item class_id_reference="16" object_id="_113">
<Value>
<Obj>
<type>2</type>
<id>173</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>8</content>
</item>
<item class_id_reference="16" object_id="_114">
<Value>
<Obj>
<type>2</type>
<id>175</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>15</content>
</item>
<item class_id_reference="16" object_id="_115">
<Value>
<Obj>
<type>2</type>
<id>179</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>16</content>
</item>
<item class_id_reference="16" object_id="_116">
<Value>
<Obj>
<type>2</type>
<id>181</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>23</content>
</item>
<item class_id_reference="16" object_id="_117">
<Value>
<Obj>
<type>2</type>
<id>206</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>2</bitwidth>
</Value>
<const_type>0</const_type>
<content>1</content>
</item>
<item class_id_reference="16" object_id="_118">
<Value>
<Obj>
<type>2</type>
<id>332</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>2</bitwidth>
</Value>
<const_type>0</const_type>
<content>3</content>
</item>
</consts>
<blocks class_id="17" tracking_level="0" version="0">
<count>8</count>
<item_version>0</item_version>
<item class_id="18" tracking_level="1" version="0" object_id="_119">
<Obj>
<type>3</type>
<id>24</id>
<name/>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>13</count>
<item_version>0</item_version>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>11</item>
<item>12</item>
<item>13</item>
<item>14</item>
<item>15</item>
<item>23</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_120">
<Obj>
<type>3</type>
<id>31</id>
<name/>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>6</count>
<item_version>0</item_version>
<item>25</item>
<item>26</item>
<item>27</item>
<item>28</item>
<item>29</item>
<item>30</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_121">
<Obj>
<type>3</type>
<id>44</id>
<name>.reset</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>7</count>
<item_version>0</item_version>
<item>34</item>
<item>35</item>
<item>36</item>
<item>37</item>
<item>38</item>
<item>42</item>
<item>43</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_122">
<Obj>
<type>3</type>
<id>53</id>
<name>.preheader5.0</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>8</count>
<item_version>0</item_version>
<item>45</item>
<item>46</item>
<item>47</item>
<item>48</item>
<item>49</item>
<item>50</item>
<item>51</item>
<item>52</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_123">
<Obj>
<type>3</type>
<id>55</id>
<name>.loopexit6</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>1</count>
<item_version>0</item_version>
<item>54</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_124">
<Obj>
<type>3</type>
<id>95</id>
<name>.preheader.preheader_ifconv</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>39</count>
<item_version>0</item_version>
<item>56</item>
<item>57</item>
<item>58</item>
<item>59</item>
<item>60</item>
<item>61</item>
<item>62</item>
<item>63</item>
<item>64</item>
<item>65</item>
<item>66</item>
<item>67</item>
<item>68</item>
<item>69</item>
<item>70</item>
<item>71</item>
<item>72</item>
<item>73</item>
<item>74</item>
<item>75</item>
<item>76</item>
<item>77</item>
<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>
<item>90</item>
<item>91</item>
<item>92</item>
<item>93</item>
<item>94</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_125">
<Obj>
<type>3</type>
<id>126</id>
<name>.loopexit</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>29</count>
<item_version>0</item_version>
<item>96</item>
<item>97</item>
<item>98</item>
<item>99</item>
<item>100</item>
<item>101</item>
<item>102</item>
<item>103</item>
<item>104</item>
<item>105</item>
<item>106</item>
<item>107</item>
<item>108</item>
<item>109</item>
<item>110</item>
<item>111</item>
<item>112</item>
<item>113</item>
<item>114</item>
<item>115</item>
<item>116</item>
<item>117</item>
<item>118</item>
<item>119</item>
<item>120</item>
<item>121</item>
<item>122</item>
<item>124</item>
<item>125</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_126">
<Obj>
<type>3</type>
<id>128</id>
<name/>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>1</count>
<item_version>0</item_version>
<item>127</item>
</node_objs>
</item>
</blocks>
<edges class_id="19" tracking_level="0" version="0">
<count>226</count>
<item_version>0</item_version>
<item class_id="20" tracking_level="1" version="0" object_id="_127">
<id>130</id>
<edge_type>1</edge_type>
<source_obj>129</source_obj>
<sink_obj>4</sink_obj>
</item>
<item class_id_reference="20" object_id="_128">
<id>131</id>
<edge_type>1</edge_type>
<source_obj>129</source_obj>
<sink_obj>5</sink_obj>
</item>
<item class_id_reference="20" object_id="_129">
<id>132</id>
<edge_type>1</edge_type>
<source_obj>129</source_obj>
<sink_obj>6</sink_obj>
</item>
<item class_id_reference="20" object_id="_130">
<id>133</id>
<edge_type>1</edge_type>
<source_obj>129</source_obj>
<sink_obj>7</sink_obj>
</item>
<item class_id_reference="20" object_id="_131">
<id>134</id>
<edge_type>1</edge_type>
<source_obj>129</source_obj>
<sink_obj>8</sink_obj>
</item>
<item class_id_reference="20" object_id="_132">
<id>135</id>
<edge_type>1</edge_type>
<source_obj>129</source_obj>
<sink_obj>9</sink_obj>
</item>
<item class_id_reference="20" object_id="_133">
<id>136</id>
<edge_type>1</edge_type>
<source_obj>129</source_obj>
<sink_obj>10</sink_obj>
</item>
<item class_id_reference="20" object_id="_134">
<id>137</id>
<edge_type>1</edge_type>
<source_obj>129</source_obj>
<sink_obj>11</sink_obj>
</item>
<item class_id_reference="20" object_id="_135">
<id>138</id>
<edge_type>1</edge_type>
<source_obj>129</source_obj>
<sink_obj>12</sink_obj>
</item>
<item class_id_reference="20" object_id="_136">
<id>139</id>
<edge_type>1</edge_type>
<source_obj>129</source_obj>
<sink_obj>13</sink_obj>
</item>
<item class_id_reference="20" object_id="_137">
<id>140</id>
<edge_type>1</edge_type>
<source_obj>129</source_obj>
<sink_obj>14</sink_obj>
</item>
<item class_id_reference="20" object_id="_138">
<id>141</id>
<edge_type>1</edge_type>
<source_obj>129</source_obj>
<sink_obj>15</sink_obj>
</item>
<item class_id_reference="20" object_id="_139">
<id>142</id>
<edge_type>2</edge_type>
<source_obj>31</source_obj>
<sink_obj>23</sink_obj>
</item>
<item class_id_reference="20" object_id="_140">
<id>144</id>
<edge_type>1</edge_type>
<source_obj>143</source_obj>
<sink_obj>25</sink_obj>
</item>
<item class_id_reference="20" object_id="_141">
<id>145</id>
<edge_type>2</edge_type>
<source_obj>24</source_obj>
<sink_obj>25</sink_obj>
</item>
<item class_id_reference="20" object_id="_142">
<id>146</id>
<edge_type>1</edge_type>
<source_obj>29</source_obj>
<sink_obj>25</sink_obj>
</item>
<item class_id_reference="20" object_id="_143">
<id>147</id>
<edge_type>2</edge_type>
<source_obj>126</source_obj>
<sink_obj>25</sink_obj>
</item>
<item class_id_reference="20" object_id="_144">
<id>149</id>
<edge_type>1</edge_type>
<source_obj>148</source_obj>
<sink_obj>26</sink_obj>
</item>
<item class_id_reference="20" object_id="_145">
<id>150</id>
<edge_type>2</edge_type>
<source_obj>24</source_obj>
<sink_obj>26</sink_obj>
</item>
<item class_id_reference="20" object_id="_146">
<id>151</id>
<edge_type>1</edge_type>
<source_obj>37</source_obj>
<sink_obj>26</sink_obj>
</item>
<item class_id_reference="20" object_id="_147">
<id>152</id>
<edge_type>2</edge_type>
<source_obj>126</source_obj>
<sink_obj>26</sink_obj>
</item>
<item class_id_reference="20" object_id="_148">
<id>153</id>
<edge_type>1</edge_type>
<source_obj>148</source_obj>
<sink_obj>27</sink_obj>
</item>
<item class_id_reference="20" object_id="_149">
<id>154</id>
<edge_type>2</edge_type>
<source_obj>24</source_obj>
<sink_obj>27</sink_obj>
</item>
<item class_id_reference="20" object_id="_150">
<id>155</id>
<edge_type>1</edge_type>
<source_obj>124</source_obj>
<sink_obj>27</sink_obj>
</item>
<item class_id_reference="20" object_id="_151">
<id>156</id>
<edge_type>2</edge_type>
<source_obj>126</source_obj>
<sink_obj>27</sink_obj>
</item>
<item class_id_reference="20" object_id="_152">
<id>157</id>
<edge_type>1</edge_type>
<source_obj>25</source_obj>
<sink_obj>28</sink_obj>
</item>
<item class_id_reference="20" object_id="_153">
<id>159</id>
<edge_type>1</edge_type>
<source_obj>158</source_obj>
<sink_obj>28</sink_obj>
</item>
<item class_id_reference="20" object_id="_154">
<id>160</id>
<edge_type>1</edge_type>
<source_obj>25</source_obj>
<sink_obj>29</sink_obj>
</item>
<item class_id_reference="20" object_id="_155">
<id>162</id>
<edge_type>1</edge_type>
<source_obj>161</source_obj>
<sink_obj>29</sink_obj>
</item>
<item class_id_reference="20" object_id="_156">
<id>163</id>
<edge_type>1</edge_type>
<source_obj>28</source_obj>
<sink_obj>30</sink_obj>
</item>
<item class_id_reference="20" object_id="_157">
<id>164</id>
<edge_type>2</edge_type>
<source_obj>44</source_obj>
<sink_obj>30</sink_obj>
</item>
<item class_id_reference="20" object_id="_158">
<id>165</id>
<edge_type>2</edge_type>
<source_obj>128</source_obj>
<sink_obj>30</sink_obj>
</item>
<item class_id_reference="20" object_id="_159">
<id>168</id>
<edge_type>1</edge_type>
<source_obj>1</source_obj>
<sink_obj>45</sink_obj>
</item>
<item class_id_reference="20" object_id="_160">
<id>169</id>
<edge_type>1</edge_type>
<source_obj>45</source_obj>
<sink_obj>46</sink_obj>
</item>
<item class_id_reference="20" object_id="_161">
<id>172</id>
<edge_type>1</edge_type>
<source_obj>45</source_obj>
<sink_obj>47</sink_obj>
</item>
<item class_id_reference="20" object_id="_162">
<id>174</id>
<edge_type>1</edge_type>
<source_obj>173</source_obj>
<sink_obj>47</sink_obj>
</item>
<item class_id_reference="20" object_id="_163">
<id>176</id>
<edge_type>1</edge_type>
<source_obj>175</source_obj>
<sink_obj>47</sink_obj>
</item>
<item class_id_reference="20" object_id="_164">
<id>178</id>
<edge_type>1</edge_type>
<source_obj>45</source_obj>
<sink_obj>48</sink_obj>
</item>
<item class_id_reference="20" object_id="_165">
<id>180</id>
<edge_type>1</edge_type>
<source_obj>179</source_obj>
<sink_obj>48</sink_obj>
</item>
<item class_id_reference="20" object_id="_166">
<id>182</id>
<edge_type>1</edge_type>
<source_obj>181</source_obj>
<sink_obj>48</sink_obj>
</item>
<item class_id_reference="20" object_id="_167">
<id>183</id>
<edge_type>1</edge_type>
<source_obj>48</source_obj>
<sink_obj>49</sink_obj>
</item>
<item class_id_reference="20" object_id="_168">
<id>184</id>
<edge_type>1</edge_type>
<source_obj>6</source_obj>
<sink_obj>49</sink_obj>
</item>
<item class_id_reference="20" object_id="_169">
<id>185</id>
<edge_type>1</edge_type>
<source_obj>47</source_obj>
<sink_obj>50</sink_obj>
</item>
<item class_id_reference="20" object_id="_170">
<id>186</id>
<edge_type>1</edge_type>
<source_obj>5</source_obj>
<sink_obj>50</sink_obj>
</item>
<item class_id_reference="20" object_id="_171">
<id>187</id>
<edge_type>1</edge_type>
<source_obj>46</source_obj>
<sink_obj>51</sink_obj>
</item>
<item class_id_reference="20" object_id="_172">
<id>188</id>
<edge_type>1</edge_type>
<source_obj>4</source_obj>
<sink_obj>51</sink_obj>
</item>
<item class_id_reference="20" object_id="_173">
<id>189</id>
<edge_type>2</edge_type>
<source_obj>55</source_obj>
<sink_obj>52</sink_obj>
</item>
<item class_id_reference="20" object_id="_174">
<id>190</id>
<edge_type>1</edge_type>
<source_obj>38</source_obj>
<sink_obj>54</sink_obj>
</item>
<item class_id_reference="20" object_id="_175">
<id>191</id>
<edge_type>2</edge_type>
<source_obj>126</source_obj>
<sink_obj>54</sink_obj>
</item>
<item class_id_reference="20" object_id="_176">
<id>192</id>
<edge_type>2</edge_type>
<source_obj>95</source_obj>
<sink_obj>54</sink_obj>
</item>
<item class_id_reference="20" object_id="_177">
<id>193</id>
<edge_type>1</edge_type>
<source_obj>7</source_obj>
<sink_obj>56</sink_obj>
</item>
<item class_id_reference="20" object_id="_178">
<id>194</id>
<edge_type>1</edge_type>
<source_obj>8</source_obj>
<sink_obj>57</sink_obj>
</item>
<item class_id_reference="20" object_id="_179">
<id>195</id>
<edge_type>1</edge_type>
<source_obj>9</source_obj>
<sink_obj>58</sink_obj>
</item>
<item class_id_reference="20" object_id="_180">
<id>196</id>
<edge_type>1</edge_type>
<source_obj>10</source_obj>
<sink_obj>59</sink_obj>
</item>
<item class_id_reference="20" object_id="_181">
<id>197</id>
<edge_type>1</edge_type>
<source_obj>11</source_obj>
<sink_obj>60</sink_obj>
</item>
<item class_id_reference="20" object_id="_182">
<id>198</id>
<edge_type>1</edge_type>
<source_obj>12</source_obj>
<sink_obj>61</sink_obj>
</item>
<item class_id_reference="20" object_id="_183">
<id>199</id>
<edge_type>1</edge_type>
<source_obj>13</source_obj>
<sink_obj>62</sink_obj>
</item>
<item class_id_reference="20" object_id="_184">
<id>200</id>
<edge_type>1</edge_type>
<source_obj>14</source_obj>
<sink_obj>63</sink_obj>
</item>
<item class_id_reference="20" object_id="_185">
<id>201</id>
<edge_type>1</edge_type>
<source_obj>15</source_obj>
<sink_obj>64</sink_obj>
</item>
<item class_id_reference="20" object_id="_186">
<id>203</id>
<edge_type>1</edge_type>
<source_obj>2</source_obj>
<sink_obj>65</sink_obj>
</item>
<item class_id_reference="20" object_id="_187">
<id>204</id>
<edge_type>1</edge_type>
<source_obj>65</source_obj>
<sink_obj>66</sink_obj>
</item>
<item class_id_reference="20" object_id="_188">
<id>205</id>
<edge_type>1</edge_type>
<source_obj>35</source_obj>
<sink_obj>67</sink_obj>
</item>
<item class_id_reference="20" object_id="_189">
<id>207</id>
<edge_type>1</edge_type>
<source_obj>206</source_obj>
<sink_obj>67</sink_obj>
</item>
<item class_id_reference="20" object_id="_190">
<id>208</id>
<edge_type>1</edge_type>
<source_obj>67</source_obj>
<sink_obj>68</sink_obj>
</item>
<item class_id_reference="20" object_id="_191">
<id>209</id>
<edge_type>1</edge_type>
<source_obj>58</source_obj>
<sink_obj>68</sink_obj>
</item>
<item class_id_reference="20" object_id="_192">
<id>210</id>
<edge_type>1</edge_type>
<source_obj>66</source_obj>
<sink_obj>68</sink_obj>
</item>
<item class_id_reference="20" object_id="_193">
<id>211</id>
<edge_type>1</edge_type>
<source_obj>42</source_obj>
<sink_obj>69</sink_obj>
</item>
<item class_id_reference="20" object_id="_194">
<id>212</id>
<edge_type>1</edge_type>
<source_obj>58</source_obj>
<sink_obj>69</sink_obj>
</item>
<item class_id_reference="20" object_id="_195">
<id>213</id>
<edge_type>1</edge_type>
<source_obj>68</source_obj>
<sink_obj>69</sink_obj>
</item>
<item class_id_reference="20" object_id="_196">
<id>214</id>
<edge_type>1</edge_type>
<source_obj>67</source_obj>
<sink_obj>70</sink_obj>
</item>
<item class_id_reference="20" object_id="_197">
<id>215</id>
<edge_type>1</edge_type>
<source_obj>66</source_obj>
<sink_obj>70</sink_obj>
</item>
<item class_id_reference="20" object_id="_198">
<id>216</id>
<edge_type>1</edge_type>
<source_obj>57</source_obj>
<sink_obj>70</sink_obj>
</item>
<item class_id_reference="20" object_id="_199">
<id>217</id>
<edge_type>1</edge_type>
<source_obj>42</source_obj>
<sink_obj>71</sink_obj>
</item>
<item class_id_reference="20" object_id="_200">
<id>218</id>
<edge_type>1</edge_type>
<source_obj>57</source_obj>
<sink_obj>71</sink_obj>
</item>
<item class_id_reference="20" object_id="_201">
<id>219</id>
<edge_type>1</edge_type>
<source_obj>70</source_obj>
<sink_obj>71</sink_obj>
</item>
<item class_id_reference="20" object_id="_202">
<id>220</id>
<edge_type>1</edge_type>
<source_obj>42</source_obj>
<sink_obj>72</sink_obj>
</item>
<item class_id_reference="20" object_id="_203">
<id>221</id>
<edge_type>1</edge_type>
<source_obj>66</source_obj>
<sink_obj>72</sink_obj>
</item>
<item class_id_reference="20" object_id="_204">
<id>222</id>
<edge_type>1</edge_type>
<source_obj>56</source_obj>
<sink_obj>72</sink_obj>
</item>
<item class_id_reference="20" object_id="_205">
<id>224</id>
<edge_type>1</edge_type>
<source_obj>65</source_obj>
<sink_obj>73</sink_obj>
</item>
<item class_id_reference="20" object_id="_206">
<id>225</id>
<edge_type>1</edge_type>
<source_obj>173</source_obj>
<sink_obj>73</sink_obj>
</item>
<item class_id_reference="20" object_id="_207">
<id>226</id>
<edge_type>1</edge_type>
<source_obj>175</source_obj>
<sink_obj>73</sink_obj>
</item>
<item class_id_reference="20" object_id="_208">
<id>227</id>
<edge_type>1</edge_type>
<source_obj>67</source_obj>
<sink_obj>74</sink_obj>
</item>
<item class_id_reference="20" object_id="_209">
<id>228</id>
<edge_type>1</edge_type>
<source_obj>61</source_obj>
<sink_obj>74</sink_obj>
</item>
<item class_id_reference="20" object_id="_210">
<id>229</id>
<edge_type>1</edge_type>
<source_obj>73</source_obj>
<sink_obj>74</sink_obj>
</item>
<item class_id_reference="20" object_id="_211">
<id>230</id>
<edge_type>1</edge_type>
<source_obj>42</source_obj>
<sink_obj>75</sink_obj>
</item>
<item class_id_reference="20" object_id="_212">
<id>231</id>
<edge_type>1</edge_type>
<source_obj>61</source_obj>
<sink_obj>75</sink_obj>
</item>
<item class_id_reference="20" object_id="_213">
<id>232</id>
<edge_type>1</edge_type>
<source_obj>74</source_obj>
<sink_obj>75</sink_obj>
</item>
<item class_id_reference="20" object_id="_214">
<id>233</id>
<edge_type>1</edge_type>
<source_obj>67</source_obj>
<sink_obj>76</sink_obj>
</item>
<item class_id_reference="20" object_id="_215">
<id>234</id>
<edge_type>1</edge_type>
<source_obj>73</source_obj>
<sink_obj>76</sink_obj>
</item>
<item class_id_reference="20" object_id="_216">
<id>235</id>
<edge_type>1</edge_type>
<source_obj>60</source_obj>
<sink_obj>76</sink_obj>
</item>
<item class_id_reference="20" object_id="_217">
<id>236</id>
<edge_type>1</edge_type>
<source_obj>42</source_obj>
<sink_obj>77</sink_obj>
</item>
<item class_id_reference="20" object_id="_218">
<id>237</id>
<edge_type>1</edge_type>
<source_obj>60</source_obj>
<sink_obj>77</sink_obj>
</item>
<item class_id_reference="20" object_id="_219">
<id>238</id>
<edge_type>1</edge_type>
<source_obj>76</source_obj>
<sink_obj>77</sink_obj>
</item>
<item class_id_reference="20" object_id="_220">
<id>239</id>
<edge_type>1</edge_type>
<source_obj>42</source_obj>
<sink_obj>78</sink_obj>
</item>
<item class_id_reference="20" object_id="_221">
<id>240</id>
<edge_type>1</edge_type>
<source_obj>73</source_obj>
<sink_obj>78</sink_obj>
</item>
<item class_id_reference="20" object_id="_222">
<id>241</id>
<edge_type>1</edge_type>
<source_obj>59</source_obj>
<sink_obj>78</sink_obj>
</item>
<item class_id_reference="20" object_id="_223">
<id>243</id>
<edge_type>1</edge_type>
<source_obj>65</source_obj>
<sink_obj>79</sink_obj>
</item>
<item class_id_reference="20" object_id="_224">
<id>244</id>
<edge_type>1</edge_type>
<source_obj>179</source_obj>
<sink_obj>79</sink_obj>
</item>
<item class_id_reference="20" object_id="_225">
<id>245</id>
<edge_type>1</edge_type>
<source_obj>181</source_obj>
<sink_obj>79</sink_obj>
</item>
<item class_id_reference="20" object_id="_226">
<id>246</id>
<edge_type>1</edge_type>
<source_obj>67</source_obj>
<sink_obj>80</sink_obj>
</item>
<item class_id_reference="20" object_id="_227">
<id>247</id>
<edge_type>1</edge_type>
<source_obj>64</source_obj>
<sink_obj>80</sink_obj>
</item>
<item class_id_reference="20" object_id="_228">
<id>248</id>
<edge_type>1</edge_type>
<source_obj>79</source_obj>
<sink_obj>80</sink_obj>
</item>
<item class_id_reference="20" object_id="_229">
<id>249</id>
<edge_type>1</edge_type>
<source_obj>42</source_obj>
<sink_obj>81</sink_obj>
</item>
<item class_id_reference="20" object_id="_230">
<id>250</id>
<edge_type>1</edge_type>
<source_obj>64</source_obj>
<sink_obj>81</sink_obj>
</item>
<item class_id_reference="20" object_id="_231">
<id>251</id>
<edge_type>1</edge_type>
<source_obj>80</source_obj>
<sink_obj>81</sink_obj>
</item>
<item class_id_reference="20" object_id="_232">
<id>252</id>
<edge_type>1</edge_type>
<source_obj>67</source_obj>
<sink_obj>82</sink_obj>
</item>
<item class_id_reference="20" object_id="_233">
<id>253</id>
<edge_type>1</edge_type>
<source_obj>79</source_obj>
<sink_obj>82</sink_obj>
</item>
<item class_id_reference="20" object_id="_234">
<id>254</id>
<edge_type>1</edge_type>
<source_obj>63</source_obj>
<sink_obj>82</sink_obj>
</item>
<item class_id_reference="20" object_id="_235">
<id>255</id>
<edge_type>1</edge_type>
<source_obj>42</source_obj>
<sink_obj>83</sink_obj>
</item>
<item class_id_reference="20" object_id="_236">
<id>256</id>
<edge_type>1</edge_type>
<source_obj>63</source_obj>
<sink_obj>83</sink_obj>
</item>
<item class_id_reference="20" object_id="_237">
<id>257</id>
<edge_type>1</edge_type>
<source_obj>82</source_obj>
<sink_obj>83</sink_obj>
</item>
<item class_id_reference="20" object_id="_238">
<id>258</id>
<edge_type>1</edge_type>
<source_obj>42</source_obj>
<sink_obj>84</sink_obj>
</item>
<item class_id_reference="20" object_id="_239">
<id>259</id>
<edge_type>1</edge_type>
<source_obj>79</source_obj>
<sink_obj>84</sink_obj>
</item>
<item class_id_reference="20" object_id="_240">
<id>260</id>
<edge_type>1</edge_type>
<source_obj>62</source_obj>
<sink_obj>84</sink_obj>
</item>
<item class_id_reference="20" object_id="_241">
<id>261</id>
<edge_type>1</edge_type>
<source_obj>81</source_obj>
<sink_obj>85</sink_obj>
</item>
<item class_id_reference="20" object_id="_242">
<id>262</id>
<edge_type>1</edge_type>
<source_obj>15</source_obj>
<sink_obj>85</sink_obj>
</item>
<item class_id_reference="20" object_id="_243">
<id>263</id>
<edge_type>1</edge_type>
<source_obj>83</source_obj>
<sink_obj>86</sink_obj>
</item>
<item class_id_reference="20" object_id="_244">
<id>264</id>
<edge_type>1</edge_type>
<source_obj>14</source_obj>
<sink_obj>86</sink_obj>
</item>
<item class_id_reference="20" object_id="_245">
<id>265</id>
<edge_type>1</edge_type>
<source_obj>84</source_obj>
<sink_obj>87</sink_obj>
</item>
<item class_id_reference="20" object_id="_246">
<id>266</id>
<edge_type>1</edge_type>
<source_obj>13</source_obj>
<sink_obj>87</sink_obj>
</item>
<item class_id_reference="20" object_id="_247">
<id>267</id>
<edge_type>1</edge_type>
<source_obj>75</source_obj>
<sink_obj>88</sink_obj>
</item>
<item class_id_reference="20" object_id="_248">
<id>268</id>
<edge_type>1</edge_type>
<source_obj>12</source_obj>
<sink_obj>88</sink_obj>
</item>
<item class_id_reference="20" object_id="_249">
<id>269</id>
<edge_type>1</edge_type>
<source_obj>77</source_obj>
<sink_obj>89</sink_obj>
</item>
<item class_id_reference="20" object_id="_250">
<id>270</id>
<edge_type>1</edge_type>
<source_obj>11</source_obj>
<sink_obj>89</sink_obj>
</item>
<item class_id_reference="20" object_id="_251">
<id>271</id>
<edge_type>1</edge_type>
<source_obj>78</source_obj>
<sink_obj>90</sink_obj>
</item>
<item class_id_reference="20" object_id="_252">
<id>272</id>
<edge_type>1</edge_type>
<source_obj>10</source_obj>
<sink_obj>90</sink_obj>
</item>
<item class_id_reference="20" object_id="_253">
<id>273</id>
<edge_type>1</edge_type>
<source_obj>69</source_obj>
<sink_obj>91</sink_obj>
</item>
<item class_id_reference="20" object_id="_254">
<id>274</id>
<edge_type>1</edge_type>
<source_obj>9</source_obj>
<sink_obj>91</sink_obj>
</item>
<item class_id_reference="20" object_id="_255">
<id>275</id>
<edge_type>1</edge_type>
<source_obj>71</source_obj>
<sink_obj>92</sink_obj>
</item>
<item class_id_reference="20" object_id="_256">
<id>276</id>
<edge_type>1</edge_type>
<source_obj>8</source_obj>
<sink_obj>92</sink_obj>
</item>
<item class_id_reference="20" object_id="_257">
<id>277</id>
<edge_type>1</edge_type>
<source_obj>72</source_obj>
<sink_obj>93</sink_obj>
</item>
<item class_id_reference="20" object_id="_258">
<id>278</id>
<edge_type>1</edge_type>
<source_obj>7</source_obj>
<sink_obj>93</sink_obj>
</item>
<item class_id_reference="20" object_id="_259">
<id>279</id>
<edge_type>2</edge_type>
<source_obj>126</source_obj>
<sink_obj>94</sink_obj>
</item>
<item class_id_reference="20" object_id="_260">
<id>280</id>
<edge_type>1</edge_type>
<source_obj>4</source_obj>
<sink_obj>96</sink_obj>
</item>
<item class_id_reference="20" object_id="_261">
<id>281</id>
<edge_type>1</edge_type>
<source_obj>5</source_obj>
<sink_obj>97</sink_obj>
</item>
<item class_id_reference="20" object_id="_262">
<id>282</id>
<edge_type>1</edge_type>
<source_obj>6</source_obj>
<sink_obj>98</sink_obj>
</item>
<item class_id_reference="20" object_id="_263">
<id>283</id>
<edge_type>1</edge_type>
<source_obj>7</source_obj>
<sink_obj>99</sink_obj>
</item>
<item class_id_reference="20" object_id="_264">
<id>284</id>
<edge_type>1</edge_type>
<source_obj>8</source_obj>
<sink_obj>100</sink_obj>
</item>
<item class_id_reference="20" object_id="_265">
<id>285</id>
<edge_type>1</edge_type>
<source_obj>9</source_obj>
<sink_obj>101</sink_obj>
</item>
<item class_id_reference="20" object_id="_266">
<id>286</id>
<edge_type>1</edge_type>
<source_obj>10</source_obj>
<sink_obj>102</sink_obj>
</item>
<item class_id_reference="20" object_id="_267">
<id>287</id>
<edge_type>1</edge_type>
<source_obj>11</source_obj>
<sink_obj>103</sink_obj>
</item>
<item class_id_reference="20" object_id="_268">
<id>288</id>
<edge_type>1</edge_type>
<source_obj>12</source_obj>
<sink_obj>104</sink_obj>
</item>
<item class_id_reference="20" object_id="_269">
<id>289</id>
<edge_type>1</edge_type>
<source_obj>13</source_obj>
<sink_obj>105</sink_obj>
</item>
<item class_id_reference="20" object_id="_270">
<id>290</id>
<edge_type>1</edge_type>
<source_obj>14</source_obj>
<sink_obj>106</sink_obj>
</item>
<item class_id_reference="20" object_id="_271">
<id>291</id>
<edge_type>1</edge_type>
<source_obj>15</source_obj>
<sink_obj>107</sink_obj>
</item>
<item class_id_reference="20" object_id="_272">
<id>292</id>
<edge_type>1</edge_type>
<source_obj>96</source_obj>
<sink_obj>108</sink_obj>
</item>
<item class_id_reference="20" object_id="_273">
<id>295</id>
<edge_type>1</edge_type>
<source_obj>99</source_obj>
<sink_obj>109</sink_obj>
</item>
<item class_id_reference="20" object_id="_274">
<id>296</id>
<edge_type>1</edge_type>
<source_obj>100</source_obj>
<sink_obj>109</sink_obj>
</item>
<item class_id_reference="20" object_id="_275">
<id>297</id>
<edge_type>1</edge_type>
<source_obj>101</source_obj>
<sink_obj>109</sink_obj>
</item>
<item class_id_reference="20" object_id="_276">
<id>298</id>
<edge_type>1</edge_type>
<source_obj>35</source_obj>
<sink_obj>109</sink_obj>
</item>
<item class_id_reference="20" object_id="_277">
<id>299</id>
<edge_type>1</edge_type>
<source_obj>109</source_obj>
<sink_obj>110</sink_obj>
</item>
<item class_id_reference="20" object_id="_278">
<id>300</id>
<edge_type>1</edge_type>
<source_obj>108</source_obj>
<sink_obj>111</sink_obj>
</item>
<item class_id_reference="20" object_id="_279">
<id>301</id>
<edge_type>1</edge_type>
<source_obj>110</source_obj>
<sink_obj>111</sink_obj>
</item>
<item class_id_reference="20" object_id="_280">
<id>302</id>
<edge_type>1</edge_type>
<source_obj>97</source_obj>
<sink_obj>112</sink_obj>
</item>
<item class_id_reference="20" object_id="_281">
<id>304</id>
<edge_type>1</edge_type>
<source_obj>102</source_obj>
<sink_obj>113</sink_obj>
</item>
<item class_id_reference="20" object_id="_282">
<id>305</id>
<edge_type>1</edge_type>
<source_obj>103</source_obj>
<sink_obj>113</sink_obj>
</item>
<item class_id_reference="20" object_id="_283">
<id>306</id>
<edge_type>1</edge_type>
<source_obj>104</source_obj>
<sink_obj>113</sink_obj>
</item>
<item class_id_reference="20" object_id="_284">
<id>307</id>
<edge_type>1</edge_type>
<source_obj>35</source_obj>
<sink_obj>113</sink_obj>
</item>
<item class_id_reference="20" object_id="_285">
<id>308</id>
<edge_type>1</edge_type>
<source_obj>113</source_obj>
<sink_obj>114</sink_obj>
</item>
<item class_id_reference="20" object_id="_286">
<id>309</id>
<edge_type>1</edge_type>
<source_obj>112</source_obj>
<sink_obj>115</sink_obj>
</item>
<item class_id_reference="20" object_id="_287">
<id>310</id>
<edge_type>1</edge_type>
<source_obj>114</source_obj>
<sink_obj>115</sink_obj>
</item>
<item class_id_reference="20" object_id="_288">
<id>311</id>
<edge_type>1</edge_type>
<source_obj>98</source_obj>
<sink_obj>116</sink_obj>
</item>
<item class_id_reference="20" object_id="_289">
<id>313</id>
<edge_type>1</edge_type>
<source_obj>105</source_obj>
<sink_obj>117</sink_obj>
</item>
<item class_id_reference="20" object_id="_290">
<id>314</id>
<edge_type>1</edge_type>
<source_obj>106</source_obj>
<sink_obj>117</sink_obj>
</item>
<item class_id_reference="20" object_id="_291">
<id>315</id>
<edge_type>1</edge_type>
<source_obj>107</source_obj>
<sink_obj>117</sink_obj>
</item>
<item class_id_reference="20" object_id="_292">
<id>316</id>
<edge_type>1</edge_type>
<source_obj>35</source_obj>
<sink_obj>117</sink_obj>
</item>
<item class_id_reference="20" object_id="_293">
<id>317</id>
<edge_type>1</edge_type>
<source_obj>117</source_obj>
<sink_obj>118</sink_obj>
</item>
<item class_id_reference="20" object_id="_294">
<id>318</id>
<edge_type>1</edge_type>
<source_obj>116</source_obj>
<sink_obj>119</sink_obj>
</item>
<item class_id_reference="20" object_id="_295">
<id>319</id>
<edge_type>1</edge_type>
<source_obj>118</source_obj>
<sink_obj>119</sink_obj>
</item>
<item class_id_reference="20" object_id="_296">
<id>320</id>
<edge_type>1</edge_type>
<source_obj>115</source_obj>
<sink_obj>120</sink_obj>
</item>
<item class_id_reference="20" object_id="_297">
<id>321</id>
<edge_type>1</edge_type>
<source_obj>119</source_obj>
<sink_obj>120</sink_obj>
</item>
<item class_id_reference="20" object_id="_298">
<id>322</id>
<edge_type>1</edge_type>
<source_obj>120</source_obj>
<sink_obj>121</sink_obj>
</item>
<item class_id_reference="20" object_id="_299">
<id>323</id>
<edge_type>1</edge_type>
<source_obj>111</source_obj>
<sink_obj>121</sink_obj>
</item>
<item class_id_reference="20" object_id="_300">
<id>326</id>
<edge_type>1</edge_type>
<source_obj>3</source_obj>
<sink_obj>122</sink_obj>
</item>
<item class_id_reference="20" object_id="_301">
<id>327</id>
<edge_type>1</edge_type>
<source_obj>121</source_obj>
<sink_obj>122</sink_obj>
</item>
<item class_id_reference="20" object_id="_302">
<id>328</id>
<edge_type>1</edge_type>
<source_obj>35</source_obj>
<sink_obj>124</sink_obj>
</item>
<item class_id_reference="20" object_id="_303">
<id>329</id>
<edge_type>1</edge_type>
<source_obj>206</source_obj>
<sink_obj>124</sink_obj>
</item>
<item class_id_reference="20" object_id="_304">
<id>330</id>
<edge_type>2</edge_type>
<source_obj>31</source_obj>
<sink_obj>125</sink_obj>
</item>
<item class_id_reference="20" object_id="_305">
<id>331</id>
<edge_type>1</edge_type>
<source_obj>27</source_obj>
<sink_obj>34</sink_obj>
</item>
<item class_id_reference="20" object_id="_306">
<id>333</id>
<edge_type>1</edge_type>
<source_obj>332</source_obj>
<sink_obj>34</sink_obj>
</item>
<item class_id_reference="20" object_id="_307">
<id>334</id>
<edge_type>1</edge_type>
<source_obj>34</source_obj>
<sink_obj>35</sink_obj>
</item>
<item class_id_reference="20" object_id="_308">
<id>335</id>
<edge_type>1</edge_type>
<source_obj>148</source_obj>
<sink_obj>35</sink_obj>
</item>
<item class_id_reference="20" object_id="_309">
<id>336</id>
<edge_type>1</edge_type>
<source_obj>27</source_obj>
<sink_obj>35</sink_obj>
</item>
<item class_id_reference="20" object_id="_310">
<id>337</id>
<edge_type>1</edge_type>
<source_obj>26</source_obj>
<sink_obj>36</sink_obj>
</item>
<item class_id_reference="20" object_id="_311">
<id>338</id>
<edge_type>1</edge_type>
<source_obj>206</source_obj>
<sink_obj>36</sink_obj>
</item>
<item class_id_reference="20" object_id="_312">
<id>339</id>
<edge_type>1</edge_type>
<source_obj>34</source_obj>
<sink_obj>37</sink_obj>
</item>
<item class_id_reference="20" object_id="_313">
<id>340</id>
<edge_type>1</edge_type>
<source_obj>36</source_obj>
<sink_obj>37</sink_obj>
</item>
<item class_id_reference="20" object_id="_314">
<id>341</id>
<edge_type>1</edge_type>
<source_obj>26</source_obj>
<sink_obj>37</sink_obj>
</item>
<item class_id_reference="20" object_id="_315">
<id>342</id>
<edge_type>1</edge_type>
<source_obj>37</source_obj>
<sink_obj>38</sink_obj>
</item>
<item class_id_reference="20" object_id="_316">
<id>343</id>
<edge_type>1</edge_type>
<source_obj>148</source_obj>
<sink_obj>38</sink_obj>
</item>
<item class_id_reference="20" object_id="_317">
<id>344</id>
<edge_type>1</edge_type>
<source_obj>35</source_obj>
<sink_obj>42</sink_obj>
</item>
<item class_id_reference="20" object_id="_318">
<id>345</id>
<edge_type>1</edge_type>
<source_obj>148</source_obj>
<sink_obj>42</sink_obj>
</item>
<item class_id_reference="20" object_id="_319">
<id>346</id>
<edge_type>1</edge_type>
<source_obj>42</source_obj>
<sink_obj>43</sink_obj>
</item>
<item class_id_reference="20" object_id="_320">
<id>347</id>
<edge_type>2</edge_type>
<source_obj>55</source_obj>
<sink_obj>43</sink_obj>
</item>
<item class_id_reference="20" object_id="_321">
<id>348</id>
<edge_type>2</edge_type>
<source_obj>53</source_obj>
<sink_obj>43</sink_obj>
</item>
<item class_id_reference="20" object_id="_322">
<id>421</id>
<edge_type>2</edge_type>
<source_obj>24</source_obj>
<sink_obj>31</sink_obj>
</item>
<item class_id_reference="20" object_id="_323">
<id>422</id>
<edge_type>2</edge_type>
<source_obj>31</source_obj>
<sink_obj>128</sink_obj>
</item>
<item class_id_reference="20" object_id="_324">
<id>423</id>
<edge_type>2</edge_type>
<source_obj>31</source_obj>
<sink_obj>44</sink_obj>
</item>
<item class_id_reference="20" object_id="_325">
<id>424</id>
<edge_type>2</edge_type>
<source_obj>44</source_obj>
<sink_obj>53</sink_obj>
</item>
<item class_id_reference="20" object_id="_326">
<id>425</id>
<edge_type>2</edge_type>
<source_obj>44</source_obj>
<sink_obj>55</sink_obj>
</item>
<item class_id_reference="20" object_id="_327">
<id>426</id>
<edge_type>2</edge_type>
<source_obj>53</source_obj>
<sink_obj>55</sink_obj>
</item>
<item class_id_reference="20" object_id="_328">
<id>427</id>
<edge_type>2</edge_type>
<source_obj>55</source_obj>
<sink_obj>95</sink_obj>
</item>
<item class_id_reference="20" object_id="_329">
<id>428</id>
<edge_type>2</edge_type>
<source_obj>55</source_obj>
<sink_obj>126</sink_obj>
</item>
<item class_id_reference="20" object_id="_330">
<id>429</id>
<edge_type>2</edge_type>
<source_obj>95</source_obj>
<sink_obj>126</sink_obj>
</item>
<item class_id_reference="20" object_id="_331">
<id>430</id>
<edge_type>2</edge_type>
<source_obj>126</source_obj>
<sink_obj>31</sink_obj>
</item>
<item class_id_reference="20" object_id="_332">
<id>431</id>
<edge_type>4</edge_type>
<source_obj>64</source_obj>
<sink_obj>85</sink_obj>
</item>
<item class_id_reference="20" object_id="_333">
<id>432</id>
<edge_type>4</edge_type>
<source_obj>63</source_obj>
<sink_obj>86</sink_obj>
</item>
<item class_id_reference="20" object_id="_334">
<id>433</id>
<edge_type>4</edge_type>
<source_obj>62</source_obj>
<sink_obj>87</sink_obj>
</item>
<item class_id_reference="20" object_id="_335">
<id>434</id>
<edge_type>4</edge_type>
<source_obj>61</source_obj>
<sink_obj>88</sink_obj>
</item>
<item class_id_reference="20" object_id="_336">
<id>435</id>
<edge_type>4</edge_type>
<source_obj>60</source_obj>
<sink_obj>89</sink_obj>
</item>
<item class_id_reference="20" object_id="_337">
<id>436</id>
<edge_type>4</edge_type>
<source_obj>59</source_obj>
<sink_obj>90</sink_obj>
</item>
<item class_id_reference="20" object_id="_338">
<id>437</id>
<edge_type>4</edge_type>
<source_obj>58</source_obj>
<sink_obj>91</sink_obj>
</item>
<item class_id_reference="20" object_id="_339">
<id>438</id>
<edge_type>4</edge_type>
<source_obj>57</source_obj>
<sink_obj>92</sink_obj>
</item>
<item class_id_reference="20" object_id="_340">
<id>439</id>
<edge_type>4</edge_type>
<source_obj>56</source_obj>
<sink_obj>93</sink_obj>
</item>
<item class_id_reference="20" object_id="_341">
<id>440</id>
<edge_type>4</edge_type>
<source_obj>49</source_obj>
<sink_obj>98</sink_obj>
</item>
<item class_id_reference="20" object_id="_342">
<id>441</id>
<edge_type>4</edge_type>
<source_obj>50</source_obj>
<sink_obj>97</sink_obj>
</item>
<item class_id_reference="20" object_id="_343">
<id>442</id>
<edge_type>4</edge_type>
<source_obj>51</source_obj>
<sink_obj>96</sink_obj>
</item>
<item class_id_reference="20" object_id="_344">
<id>443</id>
<edge_type>4</edge_type>
<source_obj>85</source_obj>
<sink_obj>107</sink_obj>
</item>
<item class_id_reference="20" object_id="_345">
<id>444</id>
<edge_type>4</edge_type>
<source_obj>86</source_obj>
<sink_obj>106</sink_obj>
</item>
<item class_id_reference="20" object_id="_346">
<id>445</id>
<edge_type>4</edge_type>
<source_obj>87</source_obj>
<sink_obj>105</sink_obj>
</item>
<item class_id_reference="20" object_id="_347">
<id>446</id>
<edge_type>4</edge_type>
<source_obj>88</source_obj>
<sink_obj>104</sink_obj>
</item>
<item class_id_reference="20" object_id="_348">
<id>447</id>
<edge_type>4</edge_type>
<source_obj>89</source_obj>
<sink_obj>103</sink_obj>
</item>
<item class_id_reference="20" object_id="_349">
<id>448</id>
<edge_type>4</edge_type>
<source_obj>90</source_obj>
<sink_obj>102</sink_obj>
</item>
<item class_id_reference="20" object_id="_350">
<id>449</id>
<edge_type>4</edge_type>
<source_obj>91</source_obj>
<sink_obj>101</sink_obj>
</item>
<item class_id_reference="20" object_id="_351">
<id>450</id>
<edge_type>4</edge_type>
<source_obj>92</source_obj>
<sink_obj>100</sink_obj>
</item>
<item class_id_reference="20" object_id="_352">
<id>451</id>
<edge_type>4</edge_type>
<source_obj>93</source_obj>
<sink_obj>99</sink_obj>
</item>
</edges>
</cdfg>
<cdfg_regions class_id="21" tracking_level="0" version="0">
<count>4</count>
<item_version>0</item_version>
<item class_id="22" tracking_level="1" version="0" object_id="_353">
<mId>1</mId>
<mTag>matrixmul</mTag>
<mType>0</mType>
<sub_regions>
<count>3</count>
<item_version>0</item_version>
<item>2</item>
<item>3</item>
<item>4</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>13</mMinLatency>
<mMaxLatency>-1</mMaxLatency>
<mIsDfPipe>0</mIsDfPipe>
<mDfPipe class_id="-1"/>
</item>
<item class_id_reference="22" object_id="_354">
<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>24</item>
</basic_blocks>
<mII>-1</mII>
<mDepth>-1</mDepth>
<mMinTripCount>-1</mMinTripCount>
<mMaxTripCount>-1</mMaxTripCount>
<mMinLatency>0</mMinLatency>
<mMaxLatency>-1</mMaxLatency>
<mIsDfPipe>0</mIsDfPipe>
<mDfPipe class_id="-1"/>
</item>
<item class_id_reference="22" object_id="_355">
<mId>3</mId>
<mTag>Row_Col</mTag>
<mType>1</mType>
<sub_regions>
<count>0</count>
<item_version>0</item_version>
</sub_regions>
<basic_blocks>
<count>6</count>
<item_version>0</item_version>
<item>31</item>
<item>44</item>
<item>53</item>
<item>55</item>
<item>95</item>
<item>126</item>
</basic_blocks>
<mII>1</mII>
<mDepth>4</mDepth>
<mMinTripCount>9</mMinTripCount>
<mMaxTripCount>9</mMaxTripCount>
<mMinLatency>11</mMinLatency>
<mMaxLatency>-1</mMaxLatency>
<mIsDfPipe>0</mIsDfPipe>
<mDfPipe class_id="-1"/>
</item>
<item class_id_reference="22" object_id="_356">
<mId>4</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>128</item>
</basic_blocks>
<mII>-1</mII>
<mDepth>-1</mDepth>
<mMinTripCount>-1</mMinTripCount>
<mMaxTripCount>-1</mMaxTripCount>
<mMinLatency>0</mMinLatency>
<mMaxLatency>-1</mMaxLatency>
<mIsDfPipe>0</mIsDfPipe>
<mDfPipe class_id="-1"/>
</item>
</cdfg_regions>
<fsm class_id="24" tracking_level="1" version="0" object_id="_357">
<states class_id="25" tracking_level="0" version="0">
<count>6</count>
<item_version>0</item_version>
<item class_id="26" tracking_level="1" version="0" object_id="_358">
<id>1</id>
<operations class_id="27" tracking_level="0" version="0">
<count>20</count>
<item_version>0</item_version>
<item class_id="28" tracking_level="1" version="0" object_id="_359">
<id>4</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_360">
<id>5</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_361">
<id>6</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_362">
<id>7</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_363">
<id>8</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_364">
<id>9</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_365">
<id>10</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_366">
<id>11</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_367">
<id>12</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_368">
<id>13</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_369">
<id>14</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_370">
<id>15</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_371">
<id>16</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_372">
<id>17</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_373">
<id>18</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_374">
<id>19</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_375">
<id>20</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_376">
<id>21</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_377">
<id>22</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_378">
<id>23</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
<item class_id_reference="26" object_id="_379">
<id>2</id>
<operations>
<count>14</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_380">
<id>25</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_381">
<id>26</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_382">
<id>27</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_383">
<id>28</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_384">
<id>29</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_385">
<id>30</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_386">
<id>34</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_387">
<id>35</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_388">
<id>36</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_389">
<id>37</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_390">
<id>38</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_391">
<id>42</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_392">
<id>54</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_393">
<id>124</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
<item class_id_reference="26" object_id="_394">
<id>3</id>
<operations>
<count>46</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_395">
<id>43</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_396">
<id>45</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_397">
<id>46</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_398">
<id>47</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_399">
<id>48</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_400">
<id>49</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_401">
<id>50</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_402">
<id>56</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_403">
<id>57</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_404">
<id>58</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_405">
<id>59</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_406">
<id>60</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_407">
<id>61</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_408">
<id>62</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_409">
<id>63</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_410">
<id>64</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_411">
<id>65</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_412">
<id>66</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_413">
<id>67</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_414">
<id>68</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_415">
<id>69</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_416">
<id>70</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_417">
<id>71</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_418">
<id>72</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_419">
<id>73</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_420">
<id>74</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_421">
<id>75</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_422">
<id>76</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_423">
<id>77</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_424">
<id>78</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_425">
<id>79</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_426">
<id>80</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_427">
<id>81</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_428">
<id>82</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_429">
<id>83</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_430">
<id>84</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_431">
<id>85</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_432">
<id>86</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_433">
<id>87</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_434">
<id>88</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_435">
<id>89</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_436">
<id>90</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_437">
<id>91</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_438">
<id>92</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_439">
<id>93</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_440">
<id>94</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
<item class_id_reference="26" object_id="_441">
<id>4</id>
<operations>
<count>23</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_442">
<id>51</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_443">
<id>52</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_444">
<id>97</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_445">
<id>98</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_446">
<id>99</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_447">
<id>100</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_448">
<id>101</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_449">
<id>102</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_450">
<id>103</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_451">
<id>104</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_452">
<id>105</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_453">
<id>106</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_454">
<id>107</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_455">
<id>109</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_456">
<id>112</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_457">
<id>113</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_458">
<id>114</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_459">
<id>115</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_460">
<id>116</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_461">
<id>117</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_462">
<id>118</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_463">
<id>119</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_464">
<id>120</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
<item class_id_reference="26" object_id="_465">
<id>5</id>
<operations>
<count>13</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_466">
<id>32</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_467">
<id>33</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_468">
<id>39</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_469">
<id>40</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_470">
<id>41</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_471">
<id>96</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_472">
<id>108</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_473">
<id>110</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_474">
<id>111</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_475">
<id>121</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_476">
<id>122</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_477">
<id>123</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_478">
<id>125</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
<item class_id_reference="26" object_id="_479">
<id>6</id>
<operations>
<count>1</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_480">
<id>127</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
</states>
<transitions class_id="29" tracking_level="0" version="0">
<count>6</count>
<item_version>0</item_version>
<item class_id="30" tracking_level="1" version="0" object_id="_481">
<inState>1</inState>
<outState>2</outState>
<condition class_id="31" tracking_level="0" version="0">
<id>69</id>
<sop class_id="32" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="33" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</item>
</sop>
</condition>
</item>
<item class_id_reference="30" object_id="_482">
<inState>3</inState>
<outState>4</outState>
<condition>
<id>85</id>
<sop>
<count>1</count>
<item_version>0</item_version>
<item>
<count>0</count>
<item_version>0</item_version>
</item>
</sop>
</condition>
</item>
<item class_id_reference="30" object_id="_483">
<inState>4</inState>
<outState>5</outState>
<condition>
<id>86</id>
<sop>
<count>1</count>
<item_version>0</item_version>
<item>
<count>0</count>
<item_version>0</item_version>
</item>
</sop>
</condition>
</item>
<item class_id_reference="30" object_id="_484">
<inState>5</inState>
<outState>2</outState>
<condition>
<id>87</id>
<sop>
<count>1</count>
<item_version>0</item_version>
<item>
<count>0</count>
<item_version>0</item_version>
</item>
</sop>
</condition>
</item>
<item class_id_reference="30" object_id="_485">
<inState>2</inState>
<outState>6</outState>
<condition>
<id>84</id>
<sop>
<count>1</count>
<item_version>0</item_version>
<item>
<count>1</count>
<item_version>0</item_version>
<item class_id="34" tracking_level="0" version="0">
<first class_id="35" tracking_level="0" version="0">
<first>28</first>
<second>0</second>
</first>
<second>0</second>
</item>
</item>
</sop>
</condition>
</item>
<item class_id_reference="30" object_id="_486">
<inState>2</inState>
<outState>3</outState>
<condition>
<id>88</id>
<sop>
<count>1</count>
<item_version>0</item_version>
<item>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>28</first>
<second>0</second>
</first>
<second>1</second>
</item>
</item>
</sop>
</condition>
</item>
</transitions>
</fsm>
<res class_id="36" tracking_level="1" version="0" object_id="_487">
<dp_component_resource class_id="37" tracking_level="0" version="0">
<count>5</count>
<item_version>0</item_version>
<item class_id="38" tracking_level="0" version="0">
<first>matrixmul_mac_muladd_8s_8s_16s_16_1_U3 (matrixmul_mac_muladd_8s_8s_16s_16_1)</first>
<second class_id="39" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="40" tracking_level="0" version="0">
<first>DSP48E</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>matrixmul_mac_muladd_8s_8s_16s_16_1_U4 (matrixmul_mac_muladd_8s_8s_16s_16_1)</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>DSP48E</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>matrixmul_mux_3to1_sel2_8_1_U0 (matrixmul_mux_3to1_sel2_8_1)</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>0</second>
</item>
</second>
</item>
<item>
<first>matrixmul_mux_3to1_sel2_8_1_U1 (matrixmul_mux_3to1_sel2_8_1)</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>0</second>
</item>
</second>
</item>
<item>
<first>matrixmul_mux_3to1_sel2_8_1_U2 (matrixmul_mux_3to1_sel2_8_1)</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>0</second>
</item>
</second>
</item>
</dp_component_resource>
<dp_expression_resource>
<count>28</count>
<item_version>0</item_version>
<item>
<first>ap_sig_bdd_67 ( or ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>ap_sig_bdd_77 ( and ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>b_copy_0_2_2_fu_302_p3 ( Select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>(2P2)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_0_2_4_fu_309_p3 ( Select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>(2P2)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_0_2_5_fu_317_p3 ( Select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>(2P2)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_0_2_7_fu_324_p3 ( Select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>(2P2)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_0_2_fu_294_p3 ( Select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>(2P2)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_1_2_2_fu_349_p3 ( Select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>(2P2)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_1_2_4_fu_356_p3 ( Select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>(2P2)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_1_2_5_fu_364_p3 ( Select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>(2P2)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_1_2_7_fu_371_p3 ( Select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>(2P2)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_1_2_fu_341_p3 ( Select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>(2P2)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_2_2_2_fu_396_p3 ( Select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>(2P2)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_2_2_4_fu_403_p3 ( Select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>(2P2)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_2_2_5_fu_411_p3 ( Select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>(2P2)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_2_2_7_fu_418_p3 ( Select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>(2P2)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_2_2_fu_388_p3 ( Select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>(2P2)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>exitcond_flatten_fu_166_p2 ( icmp ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>4</second>
</item>
<item>
<first>(1P1)</first>
<second>4</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>exitcond_fu_178_p2 ( icmp ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>2</second>
</item>
<item>
<first>(1P1)</first>
<second>2</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>grp_fu_580_p2 ( * ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>8</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>DSP48E</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>0</second>
</item>
</second>
</item>
<item>
<first>i_mid2_fu_198_p3 ( Select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>2</second>
</item>
<item>
<first>(2P2)</first>
<second>2</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>i_s_fu_192_p2 ( + ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>2</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>indvar_flatten_next_fu_172_p2 ( + ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>4</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>4</second>
</item>
</second>
</item>
<item>
<first>j_1_fu_218_p2 ( + ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>2</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>j_mid2_fu_184_p3 ( Select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>(2P2)</first>
<second>2</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>sel_tmp_fu_289_p2 ( icmp ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>2</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>tmp_3_fu_212_p2 ( icmp ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>2</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>tmp_fu_206_p2 ( icmp ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>2</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>1</second>
</item>
</second>
</item>
</dp_expression_resource>
<dp_fifo_resource>
<count>0</count>
<item_version>0</item_version>
</dp_fifo_resource>
<dp_memory_resource>
<count>0</count>
<item_version>0</item_version>
</dp_memory_resource>
<dp_multiplexer_resource>
<count>6</count>
<item_version>0</item_version>
<item>
<first>ap_NS_fsm</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>4</second>
</item>
<item>
<first>(1Bits)</first>
<second>1</second>
</item>
<item>
<first>(2Count)</first>
<second>4</second>
</item>
<item>
<first>LUT</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>ap_reg_ppiten_pp0_it3</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>2</second>
</item>
<item>
<first>(1Bits)</first>
<second>1</second>
</item>
<item>
<first>(2Count)</first>
<second>2</second>
</item>
<item>
<first>LUT</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>i_phi_fu_148_p4</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>2</second>
</item>
<item>
<first>(1Bits)</first>
<second>2</second>
</item>
<item>
<first>(2Count)</first>
<second>4</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>i_reg_144</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>2</second>
</item>
<item>
<first>(1Bits)</first>
<second>2</second>
</item>
<item>
<first>(2Count)</first>
<second>4</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>indvar_flatten_reg_133</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>2</second>
</item>
<item>
<first>(1Bits)</first>
<second>4</second>
</item>
<item>
<first>(2Count)</first>
<second>8</second>
</item>
<item>
<first>LUT</first>
<second>4</second>
</item>
</second>
</item>
<item>
<first>j_reg_155</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>2</second>
</item>
<item>
<first>(1Bits)</first>
<second>2</second>
</item>
<item>
<first>(2Count)</first>
<second>4</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
</dp_multiplexer_resource>
<dp_register_resource>
<count>30</count>
<item_version>0</item_version>
<item>
<first>a_row_0_1_reg_713</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>8</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>a_row_0_fu_66</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>8</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>a_row_1_1_fu_70</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>8</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>a_row_2_1_fu_74</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>8</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>ap_CS_fsm</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>3</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>3</second>
</item>
</second>
</item>
<item>
<first>ap_reg_ppiten_pp0_it0</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>ap_reg_ppiten_pp0_it1</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>ap_reg_ppiten_pp0_it2</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>ap_reg_ppiten_pp0_it3</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>ap_reg_ppstg_j_mid2_reg_678_pp0_it1</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>2</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>ap_reg_ppstg_tmp_3_reg_695_pp0_it1</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>b_copy_0_2_1_fu_86</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>8</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_0_2_3_fu_78</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>8</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_0_2_6_fu_82</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>8</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_1_2_1_fu_98</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>8</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_1_2_3_fu_90</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>8</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_1_2_6_fu_94</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>8</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_2_2_1_fu_110</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>8</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_2_2_3_fu_102</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>8</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>b_copy_2_2_6_fu_106</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>8</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>exitcond_flatten_reg_669</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>i_mid2_reg_686</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>2</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>i_reg_144</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>2</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>indvar_flatten_reg_133</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>4</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>4</second>
</item>
</second>
</item>
<item>
<first>j_mid2_reg_678</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>2</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>j_reg_155</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>2</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>tmp9_reg_723</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>16</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>16</second>
</item>
</second>
</item>
<item>
<first>tmp_1_reg_718</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>8</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>tmp_3_reg_695</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>tmp_reg_691</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
</dp_register_resource>
<dp_component_map class_id="41" tracking_level="0" version="0">
<count>5</count>
<item_version>0</item_version>
<item class_id="42" tracking_level="0" version="0">
<first>matrixmul_mac_muladd_8s_8s_16s_16_1_U3 (matrixmul_mac_muladd_8s_8s_16s_16_1)</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>111</item>
<item>121</item>
</second>
</item>
<item>
<first>matrixmul_mac_muladd_8s_8s_16s_16_1_U4 (matrixmul_mac_muladd_8s_8s_16s_16_1)</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>119</item>
<item>120</item>
</second>
</item>
<item>
<first>matrixmul_mux_3to1_sel2_8_1_U0 (matrixmul_mux_3to1_sel2_8_1)</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>109</item>
</second>
</item>
<item>
<first>matrixmul_mux_3to1_sel2_8_1_U1 (matrixmul_mux_3to1_sel2_8_1)</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>113</item>
</second>
</item>
<item>
<first>matrixmul_mux_3to1_sel2_8_1_U2 (matrixmul_mux_3to1_sel2_8_1)</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>117</item>
</second>
</item>
</dp_component_map>
<dp_expression_map>
<count>26</count>
<item_version>0</item_version>
<item>
<first>b_copy_0_2_2_fu_302_p3 ( Select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>69</item>
</second>
</item>
<item>
<first>b_copy_0_2_4_fu_309_p3 ( Select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>70</item>
</second>
</item>
<item>
<first>b_copy_0_2_5_fu_317_p3 ( Select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>71</item>
</second>
</item>
<item>
<first>b_copy_0_2_7_fu_324_p3 ( Select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>72</item>
</second>
</item>
<item>
<first>b_copy_0_2_fu_294_p3 ( Select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>68</item>
</second>
</item>
<item>
<first>b_copy_1_2_2_fu_349_p3 ( Select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>75</item>
</second>
</item>
<item>
<first>b_copy_1_2_4_fu_356_p3 ( Select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>76</item>
</second>
</item>
<item>
<first>b_copy_1_2_5_fu_364_p3 ( Select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>77</item>
</second>
</item>
<item>
<first>b_copy_1_2_7_fu_371_p3 ( Select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>78</item>
</second>
</item>
<item>
<first>b_copy_1_2_fu_341_p3 ( Select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>74</item>
</second>
</item>
<item>
<first>b_copy_2_2_2_fu_396_p3 ( Select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>81</item>
</second>
</item>
<item>
<first>b_copy_2_2_4_fu_403_p3 ( Select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>82</item>
</second>
</item>
<item>
<first>b_copy_2_2_5_fu_411_p3 ( Select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>83</item>
</second>
</item>
<item>
<first>b_copy_2_2_7_fu_418_p3 ( Select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>84</item>
</second>
</item>
<item>
<first>b_copy_2_2_fu_388_p3 ( Select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>80</item>
</second>
</item>
<item>
<first>exitcond_flatten_fu_166_p2 ( icmp ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>28</item>
</second>
</item>
<item>
<first>exitcond_fu_178_p2 ( icmp ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>34</item>
</second>
</item>
<item>
<first>grp_fu_580_p2 ( * ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>115</item>
</second>
</item>
<item>
<first>i_mid2_fu_198_p3 ( Select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>37</item>
</second>
</item>
<item>
<first>i_s_fu_192_p2 ( + ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>36</item>
</second>
</item>
<item>
<first>indvar_flatten_next_fu_172_p2 ( + ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>29</item>
</second>
</item>
<item>
<first>j_1_fu_218_p2 ( + ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>124</item>
</second>
</item>
<item>
<first>j_mid2_fu_184_p3 ( Select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>35</item>
</second>
</item>
<item>
<first>sel_tmp_fu_289_p2 ( icmp ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>67</item>
</second>
</item>
<item>
<first>tmp_3_fu_212_p2 ( icmp ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>42</item>
</second>
</item>
<item>
<first>tmp_fu_206_p2 ( icmp ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>38</item>
</second>
</item>
</dp_expression_map>
<dp_fifo_map>
<count>0</count>
<item_version>0</item_version>
</dp_fifo_map>
<dp_memory_map>
<count>0</count>
<item_version>0</item_version>
</dp_memory_map>
</res>
<node_label_latency class_id="43" tracking_level="0" version="0">
<count>104</count>
<item_version>0</item_version>
<item class_id="44" tracking_level="0" version="0">
<first>4</first>
<second class_id="45" tracking_level="0" version="0">
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>5</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>6</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>7</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>8</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>9</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>10</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>11</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>12</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>13</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>14</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>15</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>23</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>25</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>26</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>27</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>28</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>29</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>30</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>34</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>35</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>36</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>37</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>38</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>42</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>43</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>45</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>46</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>47</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>48</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>49</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>50</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>51</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>52</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>54</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>56</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>57</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>58</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>59</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>60</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>61</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>62</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>63</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>64</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>65</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>66</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>67</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>68</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>69</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>70</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>71</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>72</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>73</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>74</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>75</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>76</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>77</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>78</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>79</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>80</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>81</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>82</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>83</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>84</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>85</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>86</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>87</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>88</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>89</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>90</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>91</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>92</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>93</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>94</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>96</first>
<second>
<first>4</first>
<second>0</second>
</second>
</item>
<item>
<first>97</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>98</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>99</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>100</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>101</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>102</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>103</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>104</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>105</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>106</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>107</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>108</first>
<second>
<first>4</first>
<second>0</second>
</second>
</item>
<item>
<first>109</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>110</first>
<second>
<first>4</first>
<second>0</second>
</second>
</item>
<item>
<first>111</first>
<second>
<first>4</first>
<second>0</second>
</second>
</item>
<item>
<first>112</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>113</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>114</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>115</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>116</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>117</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>118</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>119</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>120</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>121</first>
<second>
<first>4</first>
<second>0</second>
</second>
</item>
<item>
<first>122</first>
<second>
<first>4</first>
<second>0</second>
</second>
</item>
<item>
<first>124</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>125</first>
<second>
<first>4</first>
<second>0</second>
</second>
</item>
<item>
<first>127</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
</node_label_latency>
<bblk_ent_exit class_id="46" tracking_level="0" version="0">
<count>8</count>
<item_version>0</item_version>
<item class_id="47" tracking_level="0" version="0">
<first>24</first>
<second class_id="48" tracking_level="0" version="0">
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>31</first>
<second>
<first>1</first>
<second>1</second>
</second>
</item>
<item>
<first>44</first>
<second>
<first>1</first>
<second>4</second>
</second>
</item>
<item>
<first>53</first>
<second>
<first>2</first>
<second>3</second>
</second>
</item>
<item>
<first>55</first>
<second>
<first>1</first>
<second>1</second>
</second>
</item>
<item>
<first>95</first>
<second>
<first>2</first>
<second>2</second>
</second>
</item>
<item>
<first>126</first>
<second>
<first>1</first>
<second>4</second>
</second>
</item>
<item>
<first>128</first>
<second>
<first>2</first>
<second>2</second>
</second>
</item>
</bblk_ent_exit>
<regions class_id="49" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="50" tracking_level="1" version="0" object_id="_488">
<region_name>Row_Col</region_name>
<basic_blocks>
<count>6</count>
<item_version>0</item_version>
<item>31</item>
<item>44</item>
<item>53</item>
<item>55</item>
<item>95</item>
<item>126</item>
</basic_blocks>
<nodes>
<count>0</count>
<item_version>0</item_version>
</nodes>
<anchor_node>-1</anchor_node>
<region_type>8</region_type>
<interval>1</interval>
<pipe_depth>4</pipe_depth>
</item>
</regions>
<dp_fu_nodes class_id="51" tracking_level="0" version="0">
<count>94</count>
<item_version>0</item_version>
<item class_id="52" tracking_level="0" version="0">
<first>66</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>4</item>
</second>
</item>
<item>
<first>70</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>5</item>
</second>
</item>
<item>
<first>74</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>6</item>
</second>
</item>
<item>
<first>78</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>7</item>
</second>
</item>
<item>
<first>82</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>8</item>
</second>
</item>
<item>
<first>86</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>9</item>
</second>
</item>
<item>
<first>90</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>10</item>
</second>
</item>
<item>
<first>94</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>11</item>
</second>
</item>
<item>
<first>98</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>12</item>
</second>
</item>
<item>
<first>102</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>13</item>
</second>
</item>
<item>
<first>106</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>14</item>
</second>
</item>
<item>
<first>110</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>15</item>
</second>
</item>
<item>
<first>114</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>45</item>
</second>
</item>
<item>
<first>120</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>65</item>
</second>
</item>
<item>
<first>126</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>122</item>
</second>
</item>
<item>
<first>137</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>25</item>
</second>
</item>
<item>
<first>148</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>26</item>
</second>
</item>
<item>
<first>159</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>27</item>
</second>
</item>
<item>
<first>166</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>28</item>
</second>
</item>
<item>
<first>172</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>29</item>
</second>
</item>
<item>
<first>178</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>34</item>
</second>
</item>
<item>
<first>184</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>35</item>
</second>
</item>
<item>
<first>192</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>36</item>
</second>
</item>
<item>
<first>198</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>37</item>
</second>
</item>
<item>
<first>206</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>38</item>
</second>
</item>
<item>
<first>212</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>42</item>
</second>
</item>
<item>
<first>218</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>124</item>
</second>
</item>
<item>
<first>224</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>46</item>
</second>
</item>
<item>
<first>228</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>47</item>
</second>
</item>
<item>
<first>238</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>48</item>
</second>
</item>
<item>
<first>248</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>49</item>
</second>
</item>
<item>
<first>253</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>50</item>
</second>
</item>
<item>
<first>258</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>56</item>
</second>
</item>
<item>
<first>261</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>57</item>
</second>
</item>
<item>
<first>264</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>58</item>
</second>
</item>
<item>
<first>267</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>59</item>
</second>
</item>
<item>
<first>270</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>60</item>
</second>
</item>
<item>
<first>273</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>61</item>
</second>
</item>
<item>
<first>276</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>62</item>
</second>
</item>
<item>
<first>279</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>63</item>
</second>
</item>
<item>
<first>282</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>64</item>
</second>
</item>
<item>
<first>285</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>66</item>
</second>
</item>
<item>
<first>289</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>67</item>
</second>
</item>
<item>
<first>294</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>68</item>
</second>
</item>
<item>
<first>302</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>69</item>
</second>
</item>
<item>
<first>309</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>70</item>
</second>
</item>
<item>
<first>317</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>71</item>
</second>
</item>
<item>
<first>324</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>72</item>
</second>
</item>
<item>
<first>331</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>73</item>
</second>
</item>
<item>
<first>341</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>74</item>
</second>
</item>
<item>
<first>349</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>75</item>
</second>
</item>
<item>
<first>356</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>76</item>
</second>
</item>
<item>
<first>364</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>77</item>
</second>
</item>
<item>
<first>371</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>78</item>
</second>
</item>
<item>
<first>378</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>79</item>
</second>
</item>
<item>
<first>388</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>80</item>
</second>
</item>
<item>
<first>396</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>81</item>
</second>
</item>
<item>
<first>403</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>82</item>
</second>
</item>
<item>
<first>411</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>83</item>
</second>
</item>
<item>
<first>418</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>84</item>
</second>
</item>
<item>
<first>425</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>85</item>
</second>
</item>
<item>
<first>430</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>86</item>
</second>
</item>
<item>
<first>435</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>87</item>
</second>
</item>
<item>
<first>440</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>88</item>
</second>
</item>
<item>
<first>445</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>89</item>
</second>
</item>
<item>
<first>450</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>90</item>
</second>
</item>
<item>
<first>455</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>91</item>
</second>
</item>
<item>
<first>460</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>92</item>
</second>
</item>
<item>
<first>465</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>93</item>
</second>
</item>
<item>
<first>470</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>51</item>
</second>
</item>
<item>
<first>474</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>97</item>
</second>
</item>
<item>
<first>477</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>98</item>
</second>
</item>
<item>
<first>480</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>99</item>
</second>
</item>
<item>
<first>483</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>100</item>
</second>
</item>
<item>
<first>486</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>101</item>
</second>
</item>
<item>
<first>489</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>102</item>
</second>
</item>
<item>
<first>492</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>103</item>
</second>
</item>
<item>
<first>495</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>104</item>
</second>
</item>
<item>
<first>498</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>105</item>
</second>
</item>
<item>
<first>501</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>106</item>
</second>
</item>
<item>
<first>504</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>107</item>
</second>
</item>
<item>
<first>507</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>109</item>
</second>
</item>
<item>
<first>518</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>112</item>
</second>
</item>
<item>
<first>522</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>113</item>
</second>
</item>
<item>
<first>533</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>114</item>
</second>
</item>
<item>
<first>537</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>115</item>
</second>
</item>
<item>
<first>543</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>116</item>
</second>
</item>
<item>
<first>547</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>117</item>
</second>
</item>
<item>
<first>558</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>118</item>
</second>
</item>
<item>
<first>562</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>96</item>
</second>
</item>
<item>
<first>565</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>108</item>
</second>
</item>
<item>
<first>569</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>110</item>
</second>
</item>
<item>
<first>572</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>111</item>
<item>121</item>
</second>
</item>
<item>
<first>580</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>119</item>
<item>120</item>
</second>
</item>
</dp_fu_nodes>
<dp_fu_nodes_expression class_id="54" tracking_level="0" version="0">
<count>58</count>
<item_version>0</item_version>
<item class_id="55" tracking_level="0" version="0">
<first>a_row_0_1_fu_224</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>46</item>
</second>
</item>
<item>
<first>a_row_0_fu_66</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>4</item>
</second>
</item>
<item>
<first>a_row_1_1_fu_70</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>5</item>
</second>
</item>
<item>
<first>a_row_1_fu_228</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>47</item>
</second>
</item>
<item>
<first>a_row_2_1_fu_74</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>6</item>
</second>
</item>
<item>
<first>a_row_2_fu_238</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>48</item>
</second>
</item>
<item>
<first>b_copy_0_2_1_fu_86</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>9</item>
</second>
</item>
<item>
<first>b_copy_0_2_2_fu_302</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>69</item>
</second>
</item>
<item>
<first>b_copy_0_2_3_fu_78</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>7</item>
</second>
</item>
<item>
<first>b_copy_0_2_4_fu_309</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>70</item>
</second>
</item>
<item>
<first>b_copy_0_2_5_fu_317</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>71</item>
</second>
</item>
<item>
<first>b_copy_0_2_6_fu_82</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>8</item>
</second>
</item>
<item>
<first>b_copy_0_2_7_fu_324</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>72</item>
</second>
</item>
<item>
<first>b_copy_0_2_9_fu_285</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>66</item>
</second>
</item>
<item>
<first>b_copy_0_2_fu_294</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>68</item>
</second>
</item>
<item>
<first>b_copy_1_2_1_fu_98</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>12</item>
</second>
</item>
<item>
<first>b_copy_1_2_2_fu_349</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>75</item>
</second>
</item>
<item>
<first>b_copy_1_2_3_fu_90</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>10</item>
</second>
</item>
<item>
<first>b_copy_1_2_4_fu_356</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>76</item>
</second>
</item>
<item>
<first>b_copy_1_2_5_fu_364</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>77</item>
</second>
</item>
<item>
<first>b_copy_1_2_6_fu_94</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>11</item>
</second>
</item>
<item>
<first>b_copy_1_2_7_fu_371</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>78</item>
</second>
</item>
<item>
<first>b_copy_1_2_9_fu_331</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>73</item>
</second>
</item>
<item>
<first>b_copy_1_2_fu_341</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>74</item>
</second>
</item>
<item>
<first>b_copy_2_2_1_fu_110</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>15</item>
</second>
</item>
<item>
<first>b_copy_2_2_2_fu_396</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>81</item>
</second>
</item>
<item>
<first>b_copy_2_2_3_fu_102</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>13</item>
</second>
</item>
<item>
<first>b_copy_2_2_4_fu_403</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>82</item>
</second>
</item>
<item>
<first>b_copy_2_2_5_fu_411</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>83</item>
</second>
</item>
<item>
<first>b_copy_2_2_6_fu_106</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>14</item>
</second>
</item>
<item>
<first>b_copy_2_2_7_fu_418</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>84</item>
</second>
</item>
<item>
<first>b_copy_2_2_9_fu_378</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>79</item>
</second>
</item>
<item>
<first>b_copy_2_2_fu_388</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>80</item>
</second>
</item>
<item>
<first>exitcond_flatten_fu_166</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>28</item>
</second>
</item>
<item>
<first>exitcond_fu_178</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>34</item>
</second>
</item>
<item>
<first>grp_fu_572</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>111</item>
<item>121</item>
</second>
</item>
<item>
<first>grp_fu_580</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>119</item>
<item>120</item>
</second>
</item>
<item>
<first>i_mid2_fu_198</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>37</item>
</second>
</item>
<item>
<first>i_phi_fu_148</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>26</item>
</second>
</item>
<item>
<first>i_s_fu_192</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>36</item>
</second>
</item>
<item>
<first>indvar_flatten_next_fu_172</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>29</item>
</second>
</item>
<item>
<first>indvar_flatten_phi_fu_137</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>25</item>
</second>
</item>
<item>
<first>j_1_fu_218</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>124</item>
</second>
</item>
<item>
<first>j_mid2_fu_184</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>35</item>
</second>
</item>
<item>
<first>j_phi_fu_159</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>27</item>
</second>
</item>
<item>
<first>sel_tmp_fu_289</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>67</item>
</second>
</item>
<item>
<first>tmp_10_1_fu_537</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>115</item>
</second>
</item>
<item>
<first>tmp_1_fu_507</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>109</item>
</second>
</item>
<item>
<first>tmp_3_fu_212</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>42</item>
</second>
</item>
<item>
<first>tmp_5_1_fu_518</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>112</item>
</second>
</item>
<item>
<first>tmp_5_2_fu_543</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>116</item>
</second>
</item>
<item>
<first>tmp_5_fu_569</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>110</item>
</second>
</item>
<item>
<first>tmp_7_fu_522</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>113</item>
</second>
</item>
<item>
<first>tmp_8_1_fu_533</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>114</item>
</second>
</item>
<item>
<first>tmp_8_2_fu_558</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>118</item>
</second>
</item>
<item>
<first>tmp_8_fu_547</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>117</item>
</second>
</item>
<item>
<first>tmp_fu_206</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>38</item>
</second>
</item>
<item>
<first>tmp_s_fu_565</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>108</item>
</second>
</item>
</dp_fu_nodes_expression>
<dp_fu_nodes_module>
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes_module>
<dp_fu_nodes_io>
<count>36</count>
<item_version>0</item_version>
<item>
<first>a_read_read_fu_114</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>45</item>
</second>
</item>
<item>
<first>a_row_0_load_load_fu_562</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>96</item>
</second>
</item>
<item>
<first>a_row_1_1_load_load_fu_474</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>97</item>
</second>
</item>
<item>
<first>a_row_2_1_load_load_fu_477</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>98</item>
</second>
</item>
<item>
<first>b_copy_0_2_1_load_1_load_fu_486</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>101</item>
</second>
</item>
<item>
<first>b_copy_0_2_1_load_load_fu_264</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>58</item>
</second>
</item>
<item>
<first>b_copy_0_2_3_load_1_load_fu_480</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>99</item>
</second>
</item>
<item>
<first>b_copy_0_2_3_load_load_fu_258</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>56</item>
</second>
</item>
<item>
<first>b_copy_0_2_6_load_1_load_fu_483</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>100</item>
</second>
</item>
<item>
<first>b_copy_0_2_6_load_load_fu_261</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>57</item>
</second>
</item>
<item>
<first>b_copy_1_2_1_load_1_load_fu_495</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>104</item>
</second>
</item>
<item>
<first>b_copy_1_2_1_load_load_fu_273</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>61</item>
</second>
</item>
<item>
<first>b_copy_1_2_3_load_1_load_fu_489</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>102</item>
</second>
</item>
<item>
<first>b_copy_1_2_3_load_load_fu_267</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>59</item>
</second>
</item>
<item>
<first>b_copy_1_2_6_load_1_load_fu_492</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>103</item>
</second>
</item>
<item>
<first>b_copy_1_2_6_load_load_fu_270</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>60</item>
</second>
</item>
<item>
<first>b_copy_2_2_1_load_1_load_fu_504</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>107</item>
</second>
</item>
<item>
<first>b_copy_2_2_1_load_load_fu_282</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>64</item>
</second>
</item>
<item>
<first>b_copy_2_2_3_load_1_load_fu_498</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>105</item>
</second>
</item>
<item>
<first>b_copy_2_2_3_load_load_fu_276</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>62</item>
</second>
</item>
<item>
<first>b_copy_2_2_6_load_1_load_fu_501</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>106</item>
</second>
</item>
<item>
<first>b_copy_2_2_6_load_load_fu_279</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>63</item>
</second>
</item>
<item>
<first>b_read_read_fu_120</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>65</item>
</second>
</item>
<item>
<first>stg_120_write_fu_126</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>122</item>
</second>
</item>
<item>
<first>stg_46_store_fu_248</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>49</item>
</second>
</item>
<item>
<first>stg_47_store_fu_253</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>50</item>
</second>
</item>
<item>
<first>stg_77_store_fu_425</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>85</item>
</second>
</item>
<item>
<first>stg_78_store_fu_430</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>86</item>
</second>
</item>
<item>
<first>stg_79_store_fu_435</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>87</item>
</second>
</item>
<item>
<first>stg_80_store_fu_440</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>88</item>
</second>
</item>
<item>
<first>stg_81_store_fu_445</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>89</item>
</second>
</item>
<item>
<first>stg_82_store_fu_450</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>90</item>
</second>
</item>
<item>
<first>stg_83_store_fu_455</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>91</item>
</second>
</item>
<item>
<first>stg_84_store_fu_460</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>92</item>
</second>
</item>
<item>
<first>stg_85_store_fu_465</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>93</item>
</second>
</item>
<item>
<first>stg_87_store_fu_470</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>51</item>
</second>
</item>
</dp_fu_nodes_io>
<return_ports>
<count>0</count>
<item_version>0</item_version>
</return_ports>
<dp_mem_port_nodes class_id="56" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_mem_port_nodes>
<dp_reg_nodes>
<count>25</count>
<item_version>0</item_version>
<item>
<first>133</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>25</item>
</second>
</item>
<item>
<first>144</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>26</item>
</second>
</item>
<item>
<first>155</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>27</item>
</second>
</item>
<item>
<first>588</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>4</item>
</second>
</item>
<item>
<first>594</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>5</item>
</second>
</item>
<item>
<first>600</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>6</item>
</second>
</item>
<item>
<first>606</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>7</item>
</second>
</item>
<item>
<first>613</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>8</item>
</second>
</item>
<item>
<first>620</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>9</item>
</second>
</item>
<item>
<first>627</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>10</item>
</second>
</item>
<item>
<first>634</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>11</item>
</second>
</item>
<item>
<first>641</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>12</item>
</second>
</item>
<item>
<first>648</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>13</item>
</second>
</item>
<item>
<first>655</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>14</item>
</second>
</item>
<item>
<first>662</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>15</item>
</second>
</item>
<item>
<first>669</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>28</item>
</second>
</item>
<item>
<first>673</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>29</item>
</second>
</item>
<item>
<first>678</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>35</item>
</second>
</item>
<item>
<first>686</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>37</item>
</second>
</item>
<item>
<first>691</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>38</item>
</second>
</item>
<item>
<first>695</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>42</item>
</second>
</item>
<item>
<first>708</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>124</item>
</second>
</item>
<item>
<first>713</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>46</item>
</second>
</item>
<item>
<first>718</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>109</item>
</second>
</item>
<item>
<first>723</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>120</item>
</second>
</item>
</dp_reg_nodes>
<dp_regname_nodes>
<count>25</count>
<item_version>0</item_version>
<item>
<first>a_row_0_1_reg_713</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>46</item>
</second>
</item>
<item>
<first>a_row_0_reg_588</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>4</item>
</second>
</item>
<item>
<first>a_row_1_1_reg_594</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>5</item>
</second>
</item>
<item>
<first>a_row_2_1_reg_600</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>6</item>
</second>
</item>
<item>
<first>b_copy_0_2_1_reg_620</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>9</item>
</second>
</item>
<item>
<first>b_copy_0_2_3_reg_606</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>7</item>
</second>
</item>
<item>
<first>b_copy_0_2_6_reg_613</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>8</item>
</second>
</item>
<item>
<first>b_copy_1_2_1_reg_641</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>12</item>
</second>
</item>
<item>
<first>b_copy_1_2_3_reg_627</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>10</item>
</second>
</item>
<item>
<first>b_copy_1_2_6_reg_634</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>11</item>
</second>
</item>
<item>
<first>b_copy_2_2_1_reg_662</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>15</item>
</second>
</item>
<item>
<first>b_copy_2_2_3_reg_648</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>13</item>
</second>
</item>
<item>
<first>b_copy_2_2_6_reg_655</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>14</item>
</second>
</item>
<item>
<first>exitcond_flatten_reg_669</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>28</item>
</second>
</item>
<item>
<first>i_mid2_reg_686</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>37</item>
</second>
</item>
<item>
<first>i_reg_144</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>26</item>
</second>
</item>
<item>
<first>indvar_flatten_next_reg_673</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>29</item>
</second>
</item>
<item>
<first>indvar_flatten_reg_133</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>25</item>
</second>
</item>
<item>
<first>j_1_reg_708</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>124</item>
</second>
</item>
<item>
<first>j_mid2_reg_678</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>35</item>
</second>
</item>
<item>
<first>j_reg_155</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>27</item>
</second>
</item>
<item>
<first>tmp9_reg_723</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>120</item>
</second>
</item>
<item>
<first>tmp_1_reg_718</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>109</item>
</second>
</item>
<item>
<first>tmp_3_reg_695</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>42</item>
</second>
</item>
<item>
<first>tmp_reg_691</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>38</item>
</second>
</item>
</dp_regname_nodes>
<dp_reg_phi>
<count>3</count>
<item_version>0</item_version>
<item>
<first>133</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>25</item>
</second>
</item>
<item>
<first>144</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>26</item>
</second>
</item>
<item>
<first>155</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>27</item>
</second>
</item>
</dp_reg_phi>
<dp_regname_phi>
<count>3</count>
<item_version>0</item_version>
<item>
<first>i_reg_144</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>26</item>
</second>
</item>
<item>
<first>indvar_flatten_reg_133</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>25</item>
</second>
</item>
<item>
<first>j_reg_155</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>27</item>
</second>
</item>
</dp_regname_phi>
<dp_port_io_nodes class_id="57" tracking_level="0" version="0">
<count>3</count>
<item_version>0</item_version>
<item class_id="58" tracking_level="0" version="0">
<first>a</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>read</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>45</item>
</second>
</item>
</second>
</item>
<item>
<first>b</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>read</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>65</item>
</second>
</item>
</second>
</item>
<item>
<first>res</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>write</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>122</item>
</second>
</item>
</second>
</item>
</dp_port_io_nodes>
<port2core class_id="59" tracking_level="0" version="0">
<count>3</count>
<item_version>0</item_version>
<item class_id="60" tracking_level="0" version="0">
<first>1</first>
<second>FIFO</second>
</item>
<item>
<first>2</first>
<second>FIFO</second>
</item>
<item>
<first>3</first>
<second>FIFO</second>
</item>
</port2core>
<node2core>
<count>0</count>
<item_version>0</item_version>
</node2core>
</syndb>
</boost_serialization>
|
package body EU_Projects.Nodes.Timed_Nodes is
procedure Due_On (Item : in out Timed_Node;
Time : in String)
is
begin
Item.Expected_Raw := To_Unbounded_String (Time);
-- Times.Time_Expressions.Symbolic (Time);
end Due_On;
procedure Parse_Raw_Expressions (Item : in out Timed_Node;
Vars : Times.Time_Expressions.Parsing.Symbol_Table)
is
use Times.Time_Expressions.Parsing;
To_Parse : constant String :=
(if Item.Expected_Raw = Event_Names.Default_Time
then
After (Timed_Node'Class (Item).Dependency_List,
Timed_Node'Class (Item).Dependency_Ready_Var)
else
To_String (Item.Expected_Raw));
begin
Item.Expected_Symbolic := Parse (Input => To_Parse,
Symbols => Vars);
end Parse_Raw_Expressions;
overriding procedure Fix_Instant
(Item : in out Timed_Node;
Var : Simple_Identifier;
Value : Times.Instant)
is
begin
if Var = Event_Names.Event_Time_Name then
Item.Expected_On := Value;
else
raise Unknown_Instant_Var with To_String (Var);
end if;
Item.Fixed := True;
end Fix_Instant;
--------------
-- Is_Fixed --
--------------
overriding function Is_Fixed (Item : Timed_Node;
Var : Simple_Identifier)
return Boolean
is
begin
if Var = Event_Names.Event_Time_Name then
return Item.Fixed;
else
raise Unknown_Var with To_String (Var);
end if;
end Is_Fixed;
end EU_Projects.Nodes.Timed_Nodes;
|
-- $Id: General.mi,v 1.5 1994/06/13 09:41:43 grosch rel $
-- $Log: General.mi,v $
-- Ich, Doktor Josef Grosch, Informatiker, Aug. 1994
-- General Subroutines: minimum, maximum, binary logarithm, and power of 2
package body General is
-- Returns the minimum of 'a' and 'b'.
function Min (a, b: Integer) return Integer is
begin
if a <= b then
return a;
else
return b;
end if;
end Min;
-- Returns the maximum of 'a' and 'b'.
function Max (a, b: Integer) return Integer is
begin
if a >= b then
return a;
else
return b;
end if;
end Max;
-- Returns the logarithm to the base 2 of 'x'.
function Log2 (x: Integer) return Integer is
z : Integer := x;
y : Integer := 0;
begin
if z >= 65536 then y := y + 16; z := z / 65536; end if;
if z >= 256 then y := y + 8; z := z / 256; end if;
if z >= 16 then y := y + 4; z := z / 16; end if;
if z >= 4 then y := y + 2; z := z / 4; end if;
if z >= 2 then y := y + 1; z := z / 2; end if;
return y;
end Log2;
-- Returns the number of the lowest bit set in 'x'.
function AntiLog (x: Integer) return Integer is
z : Integer := x;
y : Integer := 0;
begin
if (z mod 65536) = 0 then y := y + 16; z := z / 65536; end if;
if (z mod 256) = 0 then y := y + 8; z := z / 256; end if;
if (z mod 16) = 0 then y := y + 4; z := z / 16; end if;
if (z mod 4) = 0 then y := y + 2; z := z / 4; end if;
if (z mod 2) = 0 then y := y + 1; z := z / 2; end if;
return y;
end AntiLog;
-- Returns 2 to the power of 'x'.
function Exp2 (x: Integer) return Integer is
z : Integer := x;
y : Integer := 1;
begin
if z >= 16 then z := z - 16; y := y * 65536; end if;
if z >= 8 then z := z - 8; y := y * 256; end if;
if z >= 4 then z := z - 4; y := y * 16; end if;
if z >= 2 then z := z - 2; y := y * 4; end if;
if z >= 1 then z := z - 1; y := y * 2; end if;
return y;
end Exp2;
-- Returns 10 to the power of 'x'.
function Exp10 (x: Integer) return Float is
z : Integer := abs (x);
y : Float := 1.0;
negative : Boolean := x < 0;
begin
-- if z >= 64 then z := z - 64; y := y * 1.0E64; end if; too big
if z >= 32 then z := z - 32; y := y * 1.0E32; end if;
if z >= 16 then z := z - 16; y := y * 1.0E16; end if;
if z >= 8 then z := z - 8; y := y * 1.0E8 ; end if;
if z >= 4 then z := z - 4; y := y * 1.0E4 ; end if;
if z >= 2 then z := z - 2; y := y * 1.0E2 ; end if;
if z >= 1 then z := z - 1; y := y * 1.0E1 ; end if;
if negative then return 1.0 / y; else return y; end if;
end Exp10;
end General;
|
-- -----------------------------------------------------------------------------
-- Copyright (C) 2003-2019 Stichting Mapcode Foundation (http://www.mapcode.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.
-- -----------------------------------------------------------------------------
-- Utilities for handling languages
package Language_Utils is
-- The unicode sequence to provide a language name in its language
-- A Unicode number
subtype Unicode_Number is Natural range 0 .. 16#10FFFF#;
type Unicode_Sequence is array (Positive range <>) of Unicode_Number;
function To_Unicode (Str : String) return Unicode_Sequence;
-- A variable unicode sequence stored
Text_Max_Length : constant := 15;
subtype Text_Len is Natural range 0 .. Text_Max_Length;
type Text (Len : Text_Len := 0) is record
Txt : Unicode_Sequence (1 .. Len);
end record;
-- The descriptor of a language
-- Char set of a language
-- Array (A..Z, 0..9) of wide characters
subtype Char_Set is Wide_String (1 .. 36);
-- Array of codes for a language and construction of char set
subtype Char_Code_Range is Natural
range 0 .. Wide_Character'Pos (Wide_Character'Last);
type Char_Code is array (Char_Set'Range) of Char_Code_Range;
-- The descriptor
type Language_Desc (Len : Text_Len := 0) is record
-- The name of the language in it own language
Name : Text (Len);
-- The conversion characters in the language for A .. Z, 0 .. 9
Set : Char_Set;
-- First and last character of the set
First, Last : Wide_Character;
end record;
function Build_Desc (Name : Unicode_Sequence;
Code : Char_Code) return Language_Desc;
end Language_Utils;
|
with Ada.Text_IO; use Ada.Text_IO;
with Test_Directories; use Test_Directories;
with File_Block_Drivers; use File_Block_Drivers;
with File_IO; use File_IO;
with Filesystem.FAT; use Filesystem.FAT;
with HAL.Filesystem;
with GNAT.MD5; use GNAT.MD5;
with Ada.Streams;
with Compare_Files;
procedure TC_FAT_Write is
use type HAL.Filesystem.Status_Code;
package Hash renames GNAT.MD5;
Test_File_Size : constant := 2000;
function Write_File (Filename : String) return String;
function Check_File (Filename : String; Md5 : String) return Boolean;
function Delete_Tree (Filename : String) return Boolean;
function Check_Read_Test_Dir return Boolean;
----------------
-- Write_File --
----------------
function Write_File (Filename : String) return String is
FD : File_Descriptor;
Status : Status_Code;
Context : aliased GNAT.MD5.Context := GNAT.MD5.Initial_Context;
Buffer : Ada.Streams.Stream_Element_Array (1 .. Test_File_Size);
Last : Ada.Streams.Stream_Element_Offset;
Size : File_Size;
begin
Status := Open (FD, Filename, Write_Only);
if Status /= OK then
Put_Line ("Cannot open file: '" & Filename & "'");
Put_Line ("Status: " & Status'Img);
return "";
end if;
Size := Buffer'Length;
Buffer := (others => 42);
Last := Ada.Streams.Stream_Element_Offset (Size);
Hash.Update (Context, Buffer (1 .. Last));
if Write (FD, Buffer'Address, Size) /= Size then
Put_Line ("Cannot write file: '" & Filename & "'");
Put_Line ("Status: " & Status'Img);
return "";
end if;
Close (FD);
return Hash.Digest (Context);
end Write_File;
----------------
-- Check_File --
----------------
function Check_File (Filename : String;
Md5 : String)
return Boolean
is
FD : File_Descriptor;
Status : Status_Code;
begin
Status := Open (FD, Filename, Read_Only);
if Status /= OK then
Put_Line ("Cannot open file: '" & Filename & "'");
Put_Line ("Status: " & Status'Img);
return False;
end if;
if Size (FD) /= Test_File_Size then
Put_Line ("Error: wrong file size: " & Size (FD)'Img &
" (expected " & Test_File_Size'Img & ")");
return False;
end if;
declare
Hash_Str : constant String := Compare_Files.Compute_Hash (FD);
begin
if Hash_Str /= Md5 then
Put_Line ("Error: Hash is different than filename");
return False;
else
return True;
end if;
end;
end Check_File;
-----------------
-- Delete_Tree --
-----------------
function Delete_Tree (Filename : String) return Boolean is
Dir : Directory_Descriptor;
Status : Status_Code;
begin
Status := Open (Dir, Filename);
if Status /= OK then
Put_Line ("Cannot open directory: '" & Filename & "'");
Put_Line ("Status: " & Status'Img);
return False;
end if;
loop
declare
Ent : constant Directory_Entry := Read (Dir);
begin
if Ent /= Invalid_Dir_Entry then
declare
Sub : constant String := Filename & "/" & Ent.Name;
begin
if Ent.Name = "." or else Ent.Name = ".." then
null; -- do nothing
elsif Ent.Subdirectory then
if not Delete_Tree (Sub) then
return False;
end if;
elsif not Ent.Symlink then
Status := Unlink (Sub);
if Status /= OK then
Put_Line ("Cannot delete file: '" & Sub & "' :" &
Status'Img);
return False;
end if;
end if;
end;
else
exit;
end if;
end;
end loop;
Status := Remove_Directory (Filename);
if Status /= OK then
Put_Line ("Cannot delete dir: '" & Filename & "' :" & Status'Img);
return False;
else
return True;
end if;
end Delete_Tree;
-------------------------
-- Check_Read_Test_Dir --
-------------------------
function Check_Read_Test_Dir return Boolean is
Dir : Directory_Descriptor;
Status : Status_Code;
Filename : constant String := "/disk_img/read_test/";
begin
Status := Open (Dir, Filename);
if Status /= OK then
Put_Line ("Cannot open directory: '" & Filename & "'");
Put_Line ("Status: " & Status'Img);
return False;
else
Close (Dir);
return True;
end if;
end Check_Read_Test_Dir;
Disk_Img_Path : constant String := "/" & Test_Dir_Mount_Name & "/fat.fs";
Copy_Disk_Img_Path : constant String := "/" & Test_Dir_Mount_Name & "/obj/fat.fs.copy";
Disk : aliased File_Block_Driver;
FAT_FS : access FAT_Filesystem;
Status : Status_Code;
HALFS_Status : HAL.Filesystem.Status_Code;
begin
Test_Directories.Mount_Test_Directory;
-- Make a copy of the disk image
if Copy_File (Disk_Img_Path, Copy_Disk_Img_Path) /= OK then
raise Program_Error with "Cannot copy disk image";
end if;
Status := Disk.Open (Copy_Disk_Img_Path, Read_Write);
if Status /= OK then
Put_Line ("Cannot open disk image '" & Copy_Disk_Img_Path & "': " &
Status'Img);
return;
end if;
declare
begin
FAT_FS := new FAT_Filesystem;
HALFS_Status := Open (Controller => Disk'Unchecked_Access,
LBA => 0,
FS => FAT_FS.all);
if HALFS_Status /= HAL.Filesystem.OK then
Put_Line ("Cannot open FAT FS - Status:" & HALFS_Status'Img);
return;
end if;
Status := Mount_Volume (Mount_Point => "disk_img",
FS => FAT_FS);
if Status /= OK then
Put_Line ("Cannot mount volume - Status: " & Status'Img);
return;
end if;
-- Check if the "read_test" directory is here
if Check_Read_Test_Dir then
Put_Line ("PASS");
else
Put_Line ("FAIL");
end if;
-- Make some room for the file that we will create
if not Delete_Tree ("/disk_img/read_test/lvl1_b") then
Put_Line ("Cannot delete directory lvl1_b");
end if;
if not Delete_Tree ("/disk_img/read_test/lvl1_c") then
Put_Line ("Cannot delete directory lvl1_c");
end if;
if Check_File (Filename => "/disk_img/write_test",
Md5 => Write_File ("/disk_img/write_test"))
then
Put_Line ("PASS");
else
Put_Line ("FAIL");
end if;
-- Check if the "read_test" directory is still here
if Check_Read_Test_Dir then
Put_Line ("PASS");
else
Put_Line ("FAIL");
end if;
end;
end TC_FAT_Write;
|
pragma License (Unrestricted);
-- implementation unit
package System.UTF_Conversions.From_16_To_32 is
pragma Pure;
pragma Suppress (All_Checks); -- for instantiation
procedure Convert is
new Convert_Procedure (
Wide_Character,
Wide_String,
Wide_Wide_Character,
Wide_Wide_String,
From_UTF_16,
To_UTF_32);
function Convert is
new Convert_Function (
Wide_Character,
Wide_String,
Wide_Wide_Character,
Wide_Wide_String,
Expanding_From_16_To_32,
Convert);
end System.UTF_Conversions.From_16_To_32;
|
-----------------------------------------------------------------------
-- asf-routes -- Request routing
-- Copyright (C) 2015, 2016, 2017, 2018, 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.Strings.Unbounded;
with Servlet.Routes.Servlets;
package ASF.Routes is
type Faces_Route_Type is new Servlet.Routes.Servlets.Servlet_Route_Type with record
View : Ada.Strings.Unbounded.Unbounded_String;
end record;
type Faces_Route_Type_Access is access all Faces_Route_Type'Class;
subtype Route_Type is Servlet.Routes.Route_Type;
subtype Route_Type_Access is Servlet.Routes.Route_Type_Access;
subtype Route_Type_Accessor is Servlet.Routes.Route_Type_Accessor;
subtype Route_Type_Ref is Servlet.Routes.Route_Type_Ref;
subtype Route_Context_Type is Servlet.Routes.Route_Context_Type;
package Route_Type_Refs renames Servlet.Routes.Route_Type_Refs;
end ASF.Routes;
|
with Ada.text_IO;
-- testing attributes 'Value and 'Image as applied to Integer
procedure HelloEx1 is
A,B,C : Integer;
begin
A := Integer'Value ( Ada.text_IO.Get_Line);
B := Integer'Value ( Ada.text_IO.Get_Line);
C := A + B ;
if c = 0 then
Ada.text_IO.Put_Line ("Result is 0 ");
elsif C > 0 then
Ada.text_IO.Put_Line ("Positive Result : " & Integer'Image(C));
else
Ada.text_IO.Put_Line ("negative Result : " & Integer'Image(C));
end if;
end HelloEx1;
|
------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2013, 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. --
-- --
------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
package body Memwrite is
Flash_Limit : constant := 16#30_0000#;
procedure Init is
begin
null;
end Init;
procedure Reset_To_Sram is
SYS_CPURSTCR : Unsigned_32;
for SYS_CPURSTCR'Address use System'To_Address (16#ffff_ffcc#);
pragma Volatile (SYS_CPURSTCR);
pragma Import (Ada, SYS_CPURSTCR);
SYS_BMMCR1 : Unsigned_32;
for SYS_BMMCR1'Address use System'To_Address (16#ffff_ffc4#);
pragma Volatile (SYS_BMMCR1);
pragma Import (Ada, SYS_BMMCR1);
begin
SYS_BMMCR1 := 5;
SYS_CPURSTCR := 1;
loop
null;
end loop;
end Reset_To_Sram;
procedure Flush is
function To_Unsigned_32 is new Ada.Unchecked_Conversion
(System.Address, Unsigned_32);
begin
if Exec_Addr < Flash_Limit then
Exec_Addr := To_Unsigned_32 (Reset_To_Sram'Address);
end if;
end Flush;
procedure Write (Addr : Unsigned_32; Content : Storage_Array) is
Addr1 : Unsigned_32 := Addr;
begin
if Addr1 < Flash_Limit then
-- Want to write in flash. Write in SRAM instead and we will remap
-- sram to flash just before execution
Addr1 := 16#0800_0000# + Addr1;
end if;
declare
Ram_Content : Storage_Array (Content'Range);
for Ram_Content'Address use System'To_Address (Addr1);
pragma Import (Ada, Ram_Content);
begin
Ram_Content := Content;
-- Sync cache ???
end;
end Write;
end Memwrite;
|
package Numeric_Tests is
function Is_Numeric (Item : in String) return Boolean;
end Numeric_Tests;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- M A K E --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Command_Line; use Ada.Command_Line;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with GNAT.OS_Lib; use GNAT.OS_Lib;
with ALI; use ALI;
with ALI.Util; use ALI.Util;
with Csets;
with Debug;
with Fname; use Fname;
with Fname.SF; use Fname.SF;
with Fname.UF; use Fname.UF;
with Gnatvsn; use Gnatvsn;
with Hostparm; use Hostparm;
with Makeusg;
with MLib.Prj;
with MLib.Tgt;
with MLib.Utl;
with Namet; use Namet;
with Opt; use Opt;
with Osint; use Osint;
with Gnatvsn;
with Output; use Output;
with Prj; use Prj;
with Prj.Com;
with Prj.Env;
with Prj.Ext;
with Prj.Pars;
with Prj.Util;
with SFN_Scan;
with Sinput.L;
with Snames; use Snames;
with Stringt; use Stringt;
with Table;
with Types; use Types;
with Switch; use Switch;
with System.WCh_Con; use System.WCh_Con;
package body Make is
use ASCII;
-- Make control characters visible
Standard_Library_Package_Body_Name : constant String := "s-stalib.adb";
-- Every program depends on this package, that must then be checked,
-- especially when -f and -a are used.
-------------------------
-- Note on terminology --
-------------------------
-- In this program, we use the phrase "termination" of a file name to
-- refer to the suffix that appears after the unit name portion. Very
-- often this is simply the extension, but in some cases, the sequence
-- may be more complex, for example in main.1.ada, the termination in
-- this name is ".1.ada" and in main_.ada the termination is "_.ada".
-------------------------------------
-- Queue (Q) Manipulation Routines --
-------------------------------------
-- The Q is used in Compile_Sources below. Its implementation uses the
-- GNAT generic package Table (basically an extensible array). Q_Front
-- points to the first valid element in the Q, whereas Q.First is the first
-- element ever enqueued, while Q.Last - 1 is the last element in the Q.
--
-- +---+--------------+---+---+---+-----------+---+--------
-- Q | | ........ | | | | ....... | |
-- +---+--------------+---+---+---+-----------+---+--------
-- ^ ^ ^
-- Q.First Q_Front Q.Last - 1
--
-- The elements comprised between Q.First and Q_Front - 1 are the
-- elements that have been enqueued and then dequeued, while the
-- elements between Q_Front and Q.Last - 1 are the elements currently
-- in the Q. When the Q is initialized Q_Front = Q.First = Q.Last.
-- After Compile_Sources has terminated its execution, Q_Front = Q.Last
-- and the elements contained between Q.Front and Q.Last-1 are those that
-- were explored and thus marked by Compile_Sources. Whenever the Q is
-- reinitialized, the elements between Q.First and Q.Last - 1 are unmarked.
procedure Init_Q;
-- Must be called to (re)initialize the Q.
procedure Insert_Q
(Source_File : File_Name_Type;
Source_Unit : Unit_Name_Type := No_Name);
-- Inserts Source_File at the end of Q. Provide Source_Unit when
-- possible for external use (gnatdist).
function Empty_Q return Boolean;
-- Returns True if Q is empty.
procedure Extract_From_Q
(Source_File : out File_Name_Type;
Source_Unit : out Unit_Name_Type);
-- Extracts the first element from the Q.
procedure Insert_Project_Sources
(The_Project : Project_Id;
Into_Q : Boolean);
-- If Into_Q is True, insert all sources of the project file that are not
-- already marked into the Q. If Into_Q is False, call Osint.Add_File for
-- all sources of the project file.
First_Q_Initialization : Boolean := True;
-- Will be set to false after Init_Q has been called once.
Q_Front : Natural;
-- Points to the first valid element in the Q.
Unique_Compile : Boolean := False;
type Q_Record is record
File : File_Name_Type;
Unit : Unit_Name_Type;
end record;
-- File is the name of the file to compile. Unit is for gnatdist
-- use in order to easily get the unit name of a file to compile
-- when its name is krunched or declared in gnat.adc.
package Q is new Table.Table (
Table_Component_Type => Q_Record,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 4000,
Table_Increment => 100,
Table_Name => "Make.Q");
-- This is the actual Q.
-- The following instantiations and variables are necessary to save what
-- is found on the command line, in case there is a project file specified.
package Saved_Gcc_Switches is new Table.Table (
Table_Component_Type => String_Access,
Table_Index_Type => Integer,
Table_Low_Bound => 1,
Table_Initial => 20,
Table_Increment => 100,
Table_Name => "Make.Saved_Gcc_Switches");
package Saved_Binder_Switches is new Table.Table (
Table_Component_Type => String_Access,
Table_Index_Type => Integer,
Table_Low_Bound => 1,
Table_Initial => 20,
Table_Increment => 100,
Table_Name => "Make.Saved_Binder_Switches");
package Saved_Linker_Switches is new Table.Table
(Table_Component_Type => String_Access,
Table_Index_Type => Integer,
Table_Low_Bound => 1,
Table_Initial => 20,
Table_Increment => 100,
Table_Name => "Make.Saved_Linker_Switches");
package Saved_Make_Switches is new Table.Table
(Table_Component_Type => String_Access,
Table_Index_Type => Integer,
Table_Low_Bound => 1,
Table_Initial => 20,
Table_Increment => 100,
Table_Name => "Make.Saved_Make_Switches");
Saved_Maximum_Processes : Natural := 0;
Saved_WC_Encoding_Method : WC_Encoding_Method := WC_Encoding_Method'First;
Saved_WC_Encoding_Method_Set : Boolean := False;
type Arg_List_Ref is access Argument_List;
The_Saved_Gcc_Switches : Arg_List_Ref;
Project_File_Name : String_Access := null;
Current_Verbosity : Prj.Verbosity := Prj.Default;
Main_Project : Prj.Project_Id := No_Project;
procedure Add_Source_Dir (N : String);
-- Call Add_Src_Search_Dir.
-- Output one line when in verbose mode.
procedure Add_Source_Directories is
new Prj.Env.For_All_Source_Dirs (Action => Add_Source_Dir);
procedure Add_Object_Dir (N : String);
-- Call Add_Lib_Search_Dir.
-- Output one line when in verbose mode.
procedure Add_Object_Directories is
new Prj.Env.For_All_Object_Dirs (Action => Add_Object_Dir);
type Bad_Compilation_Info is record
File : File_Name_Type;
Unit : Unit_Name_Type;
Found : Boolean;
end record;
-- File is the name of the file for which a compilation failed.
-- Unit is for gnatdist use in order to easily get the unit name
-- of a file when its name is krunched or declared in gnat.adc.
-- Found is False if the compilation failed because the file could
-- not be found.
package Bad_Compilation is new Table.Table (
Table_Component_Type => Bad_Compilation_Info,
Table_Index_Type => Natural,
Table_Low_Bound => 1,
Table_Initial => 20,
Table_Increment => 100,
Table_Name => "Make.Bad_Compilation");
-- Full name of all the source files for which compilation fails.
type Special_Argument is record
File : String_Access;
Args : Argument_List_Access;
end record;
-- File is the name of the file for which a special set of compilation
-- arguments (Args) is required.
package Special_Args is new Table.Table (
Table_Component_Type => Special_Argument,
Table_Index_Type => Natural,
Table_Low_Bound => 1,
Table_Initial => 20,
Table_Increment => 100,
Table_Name => "Make.Special_Args");
-- Compilation arguments of all the source files for which an entry has
-- been found in the project file.
Original_Ada_Include_Path : constant String_Access :=
Getenv ("ADA_INCLUDE_PATH");
Original_Ada_Objects_Path : constant String_Access :=
Getenv ("ADA_OBJECTS_PATH");
Current_Ada_Include_Path : String_Access := null;
Current_Ada_Objects_Path : String_Access := null;
Max_Line_Length : constant := 127;
-- Maximum number of characters per line, when displaying a path
Do_Compile_Step : Boolean := True;
Do_Bind_Step : Boolean := True;
Do_Link_Step : Boolean := True;
-- Flags to indicate what step should be executed.
-- Can be set to False with the switches -c, -b and -l.
-- These flags are reset to True for each invokation of procedure Gnatmake.
----------------------
-- Marking Routines --
----------------------
procedure Mark (Source_File : File_Name_Type);
-- Mark Source_File. Marking is used to signal that Source_File has
-- already been inserted in the Q.
function Is_Marked (Source_File : File_Name_Type) return Boolean;
-- Returns True if Source_File was previously marked.
procedure Unmark (Source_File : File_Name_Type);
-- Unmarks Source_File.
-------------------
-- Misc Routines --
-------------------
procedure List_Depend;
-- Prints to standard output the list of object dependencies. This list
-- can be used directly in a Makefile. A call to Compile_Sources must
-- precede the call to List_Depend. Also because this routine uses the
-- ALI files that were originally loaded and scanned by Compile_Sources,
-- no additional ALI files should be scanned between the two calls (i.e.
-- between the call to Compile_Sources and List_Depend.)
procedure Inform (N : Name_Id := No_Name; Msg : String);
-- Prints out the program name followed by a colon, N and S.
procedure List_Bad_Compilations;
-- Prints out the list of all files for which the compilation failed.
procedure Verbose_Msg
(N1 : Name_Id;
S1 : String;
N2 : Name_Id := No_Name;
S2 : String := "";
Prefix : String := " -> ");
-- If the verbose flag (Verbose_Mode) is set then print Prefix to standard
-- output followed by N1 and S1. If N2 /= No_Name then N2 is then printed
-- after S1. S2 is printed last. Both N1 and N2 are printed in quotation
-- marks.
-----------------------
-- Gnatmake Routines --
-----------------------
subtype Lib_Mark_Type is Byte;
Ada_Lib_Dir : constant Lib_Mark_Type := 1;
GNAT_Lib_Dir : constant Lib_Mark_Type := 2;
-- Note that the notion of GNAT lib dir is no longer used. The code
-- related to it has not been removed to give an idea on how to use
-- the directory prefix marking mechanism.
-- An Ada library directory is a directory containing ali and object
-- files but no source files for the bodies (the specs can be in the
-- same or some other directory). These directories are specified
-- in the Gnatmake command line with the switch "-Adir" (to specify the
-- spec location -Idir cab be used). Gnatmake skips the missing sources
-- whose ali are in Ada library directories. For an explanation of why
-- Gnatmake behaves that way, see the spec of Make.Compile_Sources.
-- The directory lookup penalty is incurred every single time this
-- routine is called.
function Is_External_Assignment (Argv : String) return Boolean;
-- Verify that an external assignment switch is syntactically correct.
-- Correct forms are
-- -Xname=value
-- -X"name=other value"
-- Assumptions: 'First = 1, Argv (1 .. 2) = "-X"
-- When this function returns True, the external assignment has
-- been entered by a call to Prj.Ext.Add, so that in a project
-- file, External ("name") will return "value".
function In_Ada_Lib_Dir (File : File_Name_Type) return Boolean;
-- Get directory prefix of this file and get lib mark stored in name
-- table for this directory. Then check if an Ada lib mark has been set.
procedure Mark_Dir_Path
(Path : String_Access;
Mark : Lib_Mark_Type);
-- Invoke Mark_Directory on each directory of the path.
procedure Mark_Directory
(Dir : String;
Mark : Lib_Mark_Type);
-- Store Dir in name table and set lib mark as name info to identify
-- Ada libraries.
function Object_File_Name (Source : String) return String;
-- Returns the object file name suitable for switch -o.
procedure Set_Ada_Paths
(For_Project : Prj.Project_Id;
Including_Libraries : Boolean);
-- Set, if necessary, env. variables ADA_INCLUDE_PATH and
-- ADA_OBJECTS_PATH.
--
-- Note: this will modify these environment variables only
-- for the current gnatmake process and all of its children
-- (invocations of the compiler, the binder and the linker).
-- The caller process ADA_INCLUDE_PATH and ADA_OBJECTS_PATH are
-- not affected.
function Switches_Of
(Source_File : Name_Id;
Source_File_Name : String;
Naming : Naming_Data;
In_Package : Package_Id;
Allow_ALI : Boolean)
return Variable_Value;
-- Return the switches for the source file in the specified package
-- of a project file. If the Source_File ends with a standard GNAT
-- extension (".ads" or ".adb"), try first the full name, then the
-- name without the extension. If there is no switches for either
-- names, try the default switches for Ada. If all failed, return
-- No_Variable_Value.
procedure Test_If_Relative_Path (Switch : String_Access);
-- Test if Switch is a relative search path switch.
-- Fail if it is. This subprogram is only called
-- when using project files.
procedure Set_Library_For
(Project : Project_Id;
There_Are_Libraries : in out Boolean);
-- If Project is a library project, add the correct
-- -L and -l switches to the linker invocation.
procedure Set_Libraries is
new For_Every_Project_Imported (Boolean, Set_Library_For);
-- Add the -L and -l switches to the linker for all
-- of the library projects.
----------------------------------------------------
-- Compiler, Binder & Linker Data and Subprograms --
----------------------------------------------------
Gcc : String_Access := Program_Name ("gcc");
Gnatbind : String_Access := Program_Name ("gnatbind");
Gnatlink : String_Access := Program_Name ("gnatlink");
-- Default compiler, binder, linker programs
Saved_Gcc : String_Access := null;
Saved_Gnatbind : String_Access := null;
Saved_Gnatlink : String_Access := null;
-- Given by the command line. Will be used, if non null.
Gcc_Path : String_Access :=
GNAT.OS_Lib.Locate_Exec_On_Path (Gcc.all);
Gnatbind_Path : String_Access :=
GNAT.OS_Lib.Locate_Exec_On_Path (Gnatbind.all);
Gnatlink_Path : String_Access :=
GNAT.OS_Lib.Locate_Exec_On_Path (Gnatlink.all);
-- Path for compiler, binder, linker programs, defaulted now for gnatdist.
-- Changed later if overridden on command line.
Comp_Flag : constant String_Access := new String'("-c");
Output_Flag : constant String_Access := new String'("-o");
Ada_Flag_1 : constant String_Access := new String'("-x");
Ada_Flag_2 : constant String_Access := new String'("ada");
No_gnat_adc : constant String_Access := new String'("-gnatA");
GNAT_Flag : constant String_Access := new String'("-gnatpg");
Do_Not_Check_Flag : constant String_Access := new String'("-x");
Object_Suffix : constant String := Get_Object_Suffix.all;
Executable_Suffix : constant String := Get_Executable_Suffix.all;
Display_Executed_Programs : Boolean := True;
-- Set to True if name of commands should be output on stderr.
Output_File_Name_Seen : Boolean := False;
-- Set to True after having scanned the file_name for
-- switch "-o file_name"
type Make_Program_Type is (None, Compiler, Binder, Linker);
Program_Args : Make_Program_Type := None;
-- Used to indicate if we are scanning gnatmake, gcc, gnatbind, or gnatbind
-- options within the gnatmake command line.
-- Used in Scan_Make_Arg only, but must be a global variable.
procedure Add_Switches
(The_Package : Package_Id;
File_Name : String;
Program : Make_Program_Type);
procedure Add_Switch
(S : String_Access;
Program : Make_Program_Type;
Append_Switch : Boolean := True;
And_Save : Boolean := True);
procedure Add_Switch
(S : String;
Program : Make_Program_Type;
Append_Switch : Boolean := True;
And_Save : Boolean := True);
-- Make invokes one of three programs (the compiler, the binder or the
-- linker). For the sake of convenience, some program specific switches
-- can be passed directly on the gnatmake commande line. This procedure
-- records these switches so that gnamake can pass them to the right
-- program. S is the switch to be added at the end of the command line
-- for Program if Append_Switch is True. If Append_Switch is False S is
-- added at the beginning of the command line.
procedure Check
(Lib_File : File_Name_Type;
ALI : out ALI_Id;
O_File : out File_Name_Type;
O_Stamp : out Time_Stamp_Type);
-- Determines whether the library file Lib_File is up-to-date or not. The
-- full name (with path information) of the object file corresponding to
-- Lib_File is returned in O_File. Its time stamp is saved in O_Stamp.
-- ALI is the ALI_Id corresponding to Lib_File. If Lib_File in not
-- up-to-date, then the corresponding source file needs to be recompiled.
-- In this case ALI = No_ALI_Id.
procedure Check_Linker_Options
(E_Stamp : Time_Stamp_Type;
O_File : out File_Name_Type;
O_Stamp : out Time_Stamp_Type);
-- Checks all linker options for linker files that are newer
-- than E_Stamp. If such objects are found, the youngest object
-- is returned in O_File and its stamp in O_Stamp.
--
-- If no obsolete linker files were found, the first missing
-- linker file is returned in O_File and O_Stamp is empty.
-- Otherwise O_File is No_File.
procedure Display (Program : String; Args : Argument_List);
-- Displays Program followed by the arguments in Args if variable
-- Display_Executed_Programs is set. The lower bound of Args must be 1.
--------------------
-- Add_Object_Dir --
--------------------
procedure Add_Object_Dir (N : String) is
begin
Add_Lib_Search_Dir (N);
if Opt.Verbose_Mode then
Write_Str ("Adding object directory """);
Write_Str (N);
Write_Str (""".");
Write_Eol;
end if;
end Add_Object_Dir;
--------------------
-- Add_Source_Dir --
--------------------
procedure Add_Source_Dir (N : String) is
begin
Add_Src_Search_Dir (N);
if Opt.Verbose_Mode then
Write_Str ("Adding source directory """);
Write_Str (N);
Write_Str (""".");
Write_Eol;
end if;
end Add_Source_Dir;
----------------
-- Add_Switch --
----------------
procedure Add_Switch
(S : String_Access;
Program : Make_Program_Type;
Append_Switch : Boolean := True;
And_Save : Boolean := True)
is
generic
with package T is new Table.Table (<>);
procedure Generic_Position (New_Position : out Integer);
-- Generic procedure that allocates a position for S in T at the
-- beginning or the end, depending on the boolean Append_Switch.
----------------------
-- Generic_Position --
----------------------
procedure Generic_Position (New_Position : out Integer) is
begin
T.Increment_Last;
if Append_Switch then
New_Position := Integer (T.Last);
else
for J in reverse T.Table_Index_Type'Succ (T.First) .. T.Last loop
T.Table (J) := T.Table (T.Table_Index_Type'Pred (J));
end loop;
New_Position := Integer (T.First);
end if;
end Generic_Position;
procedure Gcc_Switches_Pos is new Generic_Position (Gcc_Switches);
procedure Binder_Switches_Pos is new Generic_Position (Binder_Switches);
procedure Linker_Switches_Pos is new Generic_Position (Linker_Switches);
procedure Saved_Gcc_Switches_Pos is new
Generic_Position (Saved_Gcc_Switches);
procedure Saved_Binder_Switches_Pos is new
Generic_Position (Saved_Binder_Switches);
procedure Saved_Linker_Switches_Pos is new
Generic_Position (Saved_Linker_Switches);
New_Position : Integer;
-- Start of processing for Add_Switch
begin
if And_Save then
case Program is
when Compiler =>
Saved_Gcc_Switches_Pos (New_Position);
Saved_Gcc_Switches.Table (New_Position) := S;
when Binder =>
Saved_Binder_Switches_Pos (New_Position);
Saved_Binder_Switches.Table (New_Position) := S;
when Linker =>
Saved_Linker_Switches_Pos (New_Position);
Saved_Linker_Switches.Table (New_Position) := S;
when None =>
raise Program_Error;
end case;
else
case Program is
when Compiler =>
Gcc_Switches_Pos (New_Position);
Gcc_Switches.Table (New_Position) := S;
when Binder =>
Binder_Switches_Pos (New_Position);
Binder_Switches.Table (New_Position) := S;
when Linker =>
Linker_Switches_Pos (New_Position);
Linker_Switches.Table (New_Position) := S;
when None =>
raise Program_Error;
end case;
end if;
end Add_Switch;
procedure Add_Switch
(S : String;
Program : Make_Program_Type;
Append_Switch : Boolean := True;
And_Save : Boolean := True)
is
begin
Add_Switch (S => new String'(S),
Program => Program,
Append_Switch => Append_Switch,
And_Save => And_Save);
end Add_Switch;
------------------
-- Add_Switches --
------------------
procedure Add_Switches
(The_Package : Package_Id;
File_Name : String;
Program : Make_Program_Type)
is
Switches : Variable_Value;
Switch_List : String_List_Id;
Element : String_Element;
begin
if File_Name'Length > 0 then
Name_Len := File_Name'Length;
Name_Buffer (1 .. Name_Len) := File_Name;
Switches :=
Switches_Of
(Source_File => Name_Find,
Source_File_Name => File_Name,
Naming => Projects.Table (Main_Project).Naming,
In_Package => The_Package,
Allow_ALI =>
Program = Binder or else Program = Linker);
case Switches.Kind is
when Undefined =>
null;
when List =>
Program_Args := Program;
Switch_List := Switches.Values;
while Switch_List /= Nil_String loop
Element := String_Elements.Table (Switch_List);
String_To_Name_Buffer (Element.Value);
if Name_Len > 0 then
if Opt.Verbose_Mode then
Write_Str (" Adding ");
Write_Line (Name_Buffer (1 .. Name_Len));
end if;
Scan_Make_Arg
(Name_Buffer (1 .. Name_Len),
And_Save => False);
end if;
Switch_List := Element.Next;
end loop;
when Single =>
Program_Args := Program;
String_To_Name_Buffer (Switches.Value);
if Name_Len > 0 then
if Opt.Verbose_Mode then
Write_Str (" Adding ");
Write_Line (Name_Buffer (1 .. Name_Len));
end if;
Scan_Make_Arg
(Name_Buffer (1 .. Name_Len), And_Save => False);
end if;
end case;
end if;
end Add_Switches;
----------
-- Bind --
----------
procedure Bind (ALI_File : File_Name_Type; Args : Argument_List) is
Bind_Args : Argument_List (1 .. Args'Last + 2);
Bind_Last : Integer;
Success : Boolean;
begin
pragma Assert (Args'First = 1);
-- Optimize the simple case where the gnatbind command line looks like
-- gnatbind -aO. -I- file.ali --into-> gnatbind file.adb
if Args'Length = 2
and then Args (Args'First).all = "-aO" & Normalized_CWD
and then Args (Args'Last).all = "-I-"
and then ALI_File = Strip_Directory (ALI_File)
then
Bind_Last := Args'First - 1;
else
Bind_Last := Args'Last;
Bind_Args (Args'Range) := Args;
end if;
-- It is completely pointless to re-check source file time stamps.
-- This has been done already by gnatmake
Bind_Last := Bind_Last + 1;
Bind_Args (Bind_Last) := Do_Not_Check_Flag;
Get_Name_String (ALI_File);
Bind_Last := Bind_Last + 1;
Bind_Args (Bind_Last) := new String'(Name_Buffer (1 .. Name_Len));
Display (Gnatbind.all, Bind_Args (Args'First .. Bind_Last));
if Gnatbind_Path = null then
Osint.Fail ("error, unable to locate " & Gnatbind.all);
end if;
GNAT.OS_Lib.Spawn
(Gnatbind_Path.all, Bind_Args (Args'First .. Bind_Last), Success);
if not Success then
raise Bind_Failed;
end if;
end Bind;
-----------
-- Check --
-----------
procedure Check
(Lib_File : File_Name_Type;
ALI : out ALI_Id;
O_File : out File_Name_Type;
O_Stamp : out Time_Stamp_Type)
is
function First_New_Spec (A : ALI_Id) return File_Name_Type;
-- Looks in the with table entries of A and returns the spec file name
-- of the first withed unit (subprogram) for which no spec existed when
-- A was generated but for which there exists one now, implying that A
-- is now obsolete. If no such unit is found No_File is returned.
-- Otherwise the spec file name of the unit is returned.
--
-- **WARNING** in the event of Uname format modifications, one *MUST*
-- make sure this function is also updated.
--
-- Note: This function should really be in ali.adb and use Uname
-- services, but this causes the whole compiler to be dragged along
-- for gnatbind and gnatmake.
--------------------
-- First_New_Spec --
--------------------
function First_New_Spec (A : ALI_Id) return File_Name_Type is
Spec_File_Name : File_Name_Type := No_File;
function New_Spec (Uname : Unit_Name_Type) return Boolean;
-- Uname is the name of the spec or body of some ada unit.
-- This function returns True if the Uname is the name of a body
-- which has a spec not mentioned inali file A. If True is returned
-- Spec_File_Name above is set to the name of this spec file.
--------------
-- New_Spec --
--------------
function New_Spec (Uname : Unit_Name_Type) return Boolean is
Spec_Name : Unit_Name_Type;
File_Name : File_Name_Type;
begin
-- Test whether Uname is the name of a body unit (ie ends with %b)
Get_Name_String (Uname);
pragma
Assert (Name_Len > 2 and then Name_Buffer (Name_Len - 1) = '%');
if Name_Buffer (Name_Len) /= 'b' then
return False;
end if;
-- Convert unit name into spec name
-- ??? this code seems dubious in presence of pragma
-- Source_File_Name since there is no more direct relationship
-- between unit name and file name.
-- ??? Further, what about alternative subunit naming
Name_Buffer (Name_Len) := 's';
Spec_Name := Name_Find;
File_Name := Get_File_Name (Spec_Name, Subunit => False);
-- Look if File_Name is mentioned in A's sdep list.
-- If not look if the file exists. If it does return True.
for D in
ALIs.Table (A).First_Sdep .. ALIs.Table (A).Last_Sdep
loop
if Sdep.Table (D).Sfile = File_Name then
return False;
end if;
end loop;
if Full_Source_Name (File_Name) /= No_File then
Spec_File_Name := File_Name;
return True;
end if;
return False;
end New_Spec;
-- Start of processing for First_New_Spec
begin
U_Chk : for U in
ALIs.Table (A).First_Unit .. ALIs.Table (A).Last_Unit
loop
exit U_Chk when Units.Table (U).Utype = Is_Body_Only
and then New_Spec (Units.Table (U).Uname);
for W in Units.Table (U).First_With
..
Units.Table (U).Last_With
loop
exit U_Chk when
Withs.Table (W).Afile /= No_File
and then New_Spec (Withs.Table (W).Uname);
end loop;
end loop U_Chk;
return Spec_File_Name;
end First_New_Spec;
---------------------------------
-- Data declarations for Check --
---------------------------------
Full_Lib_File : File_Name_Type;
-- Full name of current library file
Full_Obj_File : File_Name_Type;
-- Full name of the object file corresponding to Lib_File.
Lib_Stamp : Time_Stamp_Type;
-- Time stamp of the current ada library file.
Obj_Stamp : Time_Stamp_Type;
-- Time stamp of the current object file.
Modified_Source : File_Name_Type;
-- The first source in Lib_File whose current time stamp differs
-- from that stored in Lib_File.
New_Spec : File_Name_Type;
-- If Lib_File contains in its W (with) section a body (for a
-- subprogram) for which there exists a spec and the spec did not
-- appear in the Sdep section of Lib_File, New_Spec contains the file
-- name of this new spec.
Source_Name : Name_Id;
Text : Text_Buffer_Ptr;
Prev_Switch : Character;
-- First character of previous switch processed
Arg : Arg_Id := Arg_Id'First;
-- Current index in Args.Table for a given unit (init to stop warning)
Switch_Found : Boolean;
-- True if a given switch has been found
Num_Args : Integer;
-- Number of compiler arguments processed
Special_Arg : Argument_List_Access;
-- Special arguments if any of a given compilation file
-- Start of processing for Check
begin
pragma Assert (Lib_File /= No_File);
Text := Read_Library_Info (Lib_File);
Full_Lib_File := Full_Library_Info_Name;
Full_Obj_File := Full_Object_File_Name;
Lib_Stamp := Current_Library_File_Stamp;
Obj_Stamp := Current_Object_File_Stamp;
if Full_Lib_File = No_File then
Verbose_Msg (Lib_File, "being checked ...", Prefix => " ");
else
Verbose_Msg (Full_Lib_File, "being checked ...", Prefix => " ");
end if;
ALI := No_ALI_Id;
O_File := Full_Obj_File;
O_Stamp := Obj_Stamp;
if Text = null then
if Full_Lib_File = No_File then
Verbose_Msg (Lib_File, "missing.");
elsif Obj_Stamp (Obj_Stamp'First) = ' ' then
Verbose_Msg (Full_Obj_File, "missing.");
else
Verbose_Msg
(Full_Lib_File, "(" & String (Lib_Stamp) & ") newer than",
Full_Obj_File, "(" & String (Obj_Stamp) & ")");
end if;
else
ALI := Scan_ALI (Lib_File, Text, Ignore_ED => False, Err => True);
Free (Text);
if ALI = No_ALI_Id then
Verbose_Msg (Full_Lib_File, "incorrectly formatted ALI file");
return;
elsif ALIs.Table (ALI).Ver (1 .. ALIs.Table (ALI).Ver_Len) /=
Library_Version
then
Verbose_Msg (Full_Lib_File, "compiled with old GNAT version");
ALI := No_ALI_Id;
return;
end if;
-- Don't take Ali file into account if it was generated without
-- object.
if Opt.Operating_Mode /= Opt.Check_Semantics
and then ALIs.Table (ALI).No_Object
then
Verbose_Msg (Full_Lib_File, "has no corresponding object");
ALI := No_ALI_Id;
return;
end if;
-- Check for matching compiler switches if needed
if Opt.Check_Switches then
Prev_Switch := ASCII.Nul;
Num_Args := 0;
Get_Name_String (ALIs.Table (ALI).Sfile);
for J in 1 .. Special_Args.Last loop
if Special_Args.Table (J).File.all =
Name_Buffer (1 .. Name_Len)
then
Special_Arg := Special_Args.Table (J).Args;
exit;
end if;
end loop;
if Main_Project /= No_Project then
null;
end if;
if Special_Arg = null then
for J in Gcc_Switches.First .. Gcc_Switches.Last loop
-- Skip non switches, -I and -o switches
if (Gcc_Switches.Table (J) (1) = '-'
or else
Gcc_Switches.Table (J) (1) = Switch_Character)
and then Gcc_Switches.Table (J) (2) /= 'o'
and then Gcc_Switches.Table (J) (2) /= 'I'
then
Num_Args := Num_Args + 1;
-- Comparing switches is delicate because gcc reorders
-- a number of switches, according to lang-specs.h, but
-- gnatmake doesn't have the sufficient knowledge to
-- perform the same reordering. Instead, we ignore orders
-- between different "first letter" switches, but keep
-- orders between same switches, e.g -O -O2 is different
-- than -O2 -O, but -g -O is equivalent to -O -g.
if Gcc_Switches.Table (J) (2) /= Prev_Switch then
Prev_Switch := Gcc_Switches.Table (J) (2);
Arg :=
Units.Table (ALIs.Table (ALI).First_Unit).First_Arg;
end if;
Switch_Found := False;
for K in Arg ..
Units.Table (ALIs.Table (ALI).First_Unit).Last_Arg
loop
if Gcc_Switches.Table (J).all = Args.Table (K).all then
Arg := K + 1;
Switch_Found := True;
exit;
end if;
end loop;
if not Switch_Found then
if Opt.Verbose_Mode then
Verbose_Msg (ALIs.Table (ALI).Sfile,
"switch mismatch");
end if;
ALI := No_ALI_Id;
return;
end if;
end if;
end loop;
-- Special_Arg is non-null
else
for J in Special_Arg'Range loop
-- Skip non switches, -I and -o switches
if (Special_Arg (J) (1) = '-'
or else Special_Arg (J) (1) = Switch_Character)
and then Special_Arg (J) (2) /= 'o'
and then Special_Arg (J) (2) /= 'I'
then
Num_Args := Num_Args + 1;
if Special_Arg (J) (2) /= Prev_Switch then
Prev_Switch := Special_Arg (J) (2);
Arg :=
Units.Table (ALIs.Table (ALI).First_Unit).First_Arg;
end if;
Switch_Found := False;
for K in Arg ..
Units.Table (ALIs.Table (ALI).First_Unit).Last_Arg
loop
if Special_Arg (J).all = Args.Table (K).all then
Arg := K + 1;
Switch_Found := True;
exit;
end if;
end loop;
if not Switch_Found then
if Opt.Verbose_Mode then
Verbose_Msg (ALIs.Table (ALI).Sfile,
"switch mismatch");
end if;
ALI := No_ALI_Id;
return;
end if;
end if;
end loop;
end if;
if Num_Args /=
Integer (Units.Table (ALIs.Table (ALI).First_Unit).Last_Arg -
Units.Table (ALIs.Table (ALI).First_Unit).First_Arg + 1)
then
if Opt.Verbose_Mode then
Verbose_Msg (ALIs.Table (ALI).Sfile,
"different number of switches");
end if;
ALI := No_ALI_Id;
return;
end if;
end if;
-- Get the source files and their time stamps. Note that some
-- sources may be missing if ALI is out-of-date.
Set_Source_Table (ALI);
Modified_Source := Time_Stamp_Mismatch (ALI);
if Modified_Source /= No_File then
ALI := No_ALI_Id;
if Opt.Verbose_Mode then
Source_Name := Full_Source_Name (Modified_Source);
if Source_Name /= No_File then
Verbose_Msg (Source_Name, "time stamp mismatch");
else
Verbose_Msg (Modified_Source, "missing");
end if;
end if;
else
New_Spec := First_New_Spec (ALI);
if New_Spec /= No_File then
ALI := No_ALI_Id;
if Opt.Verbose_Mode then
Source_Name := Full_Source_Name (New_Spec);
if Source_Name /= No_File then
Verbose_Msg (Source_Name, "new spec");
else
Verbose_Msg (New_Spec, "old spec missing");
end if;
end if;
end if;
end if;
end if;
end Check;
--------------------------
-- Check_Linker_Options --
--------------------------
procedure Check_Linker_Options
(E_Stamp : Time_Stamp_Type;
O_File : out File_Name_Type;
O_Stamp : out Time_Stamp_Type)
is
procedure Check_File (File : File_Name_Type);
-- Update O_File and O_Stamp if the given file is younger than E_Stamp
-- and O_Stamp, or if O_File is No_File and File does not exist.
function Get_Library_File (Name : String) return File_Name_Type;
-- Return the full file name including path of a library based
-- on the name specified with the -l linker option, using the
-- Ada object path. Return No_File if no such file can be found.
type Char_Array is array (Natural) of Character;
type Char_Array_Access is access constant Char_Array;
Template : Char_Array_Access;
pragma Import (C, Template, "__gnat_library_template");
----------------
-- Check_File --
----------------
procedure Check_File (File : File_Name_Type) is
Stamp : Time_Stamp_Type;
Name : File_Name_Type := File;
begin
Get_Name_String (Name);
-- Remove any trailing NUL characters
while Name_Len >= Name_Buffer'First
and then Name_Buffer (Name_Len) = NUL
loop
Name_Len := Name_Len - 1;
end loop;
if Name_Len <= 0 then
return;
elsif Name_Buffer (1) = Get_Switch_Character
or else Name_Buffer (1) = '-'
then
-- Do not check if File is a switch other than "-l"
if Name_Buffer (2) /= 'l' then
return;
end if;
-- The argument is a library switch, get actual name. It
-- is necessary to make a copy of the relevant part of
-- Name_Buffer as Get_Library_Name uses Name_Buffer as well.
declare
Base_Name : constant String := Name_Buffer (3 .. Name_Len);
begin
Name := Get_Library_File (Base_Name);
end;
if Name = No_File then
return;
end if;
end if;
Stamp := File_Stamp (Name);
-- Find the youngest object file that is younger than the
-- executable. If no such file exist, record the first object
-- file that is not found.
if (O_Stamp < Stamp and then E_Stamp < Stamp)
or else (O_File = No_File and then Stamp (Stamp'First) = ' ')
then
O_Stamp := Stamp;
O_File := Name;
-- Strip the trailing NUL if present
Get_Name_String (O_File);
if Name_Buffer (Name_Len) = NUL then
Name_Len := Name_Len - 1;
O_File := Name_Find;
end if;
end if;
end Check_File;
----------------------
-- Get_Library_Name --
----------------------
-- See comments in a-adaint.c about template syntax
function Get_Library_File (Name : String) return File_Name_Type is
File : File_Name_Type := No_File;
begin
Name_Len := 0;
for Ptr in Template'Range loop
case Template (Ptr) is
when '*' =>
Add_Str_To_Name_Buffer (Name);
when ';' =>
File := Full_Lib_File_Name (Name_Find);
exit when File /= No_File;
Name_Len := 0;
when NUL =>
exit;
when others =>
Add_Char_To_Name_Buffer (Template (Ptr));
end case;
end loop;
-- The for loop exited because the end of the template
-- was reached. File contains the last possible file name
-- for the library.
if File = No_File and then Name_Len > 0 then
File := Full_Lib_File_Name (Name_Find);
end if;
return File;
end Get_Library_File;
-- Start of processing for Check_Linker_Options
begin
O_File := No_File;
O_Stamp := (others => ' ');
-- Process linker options from the ALI files.
for Opt in 1 .. Linker_Options.Last loop
Check_File (Linker_Options.Table (Opt).Name);
end loop;
-- Process options given on the command line.
for Opt in Linker_Switches.First .. Linker_Switches.Last loop
-- Check if the previous Opt has one of the two switches
-- that take an extra parameter. (See GCC manual.)
if Opt = Linker_Switches.First
or else (Linker_Switches.Table (Opt - 1).all /= "-u"
and then
Linker_Switches.Table (Opt - 1).all /= "-Xlinker")
then
Name_Len := 0;
Add_Str_To_Name_Buffer (Linker_Switches.Table (Opt).all);
Check_File (Name_Find);
end if;
end loop;
end Check_Linker_Options;
---------------------
-- Compile_Sources --
---------------------
procedure Compile_Sources
(Main_Source : File_Name_Type;
Args : Argument_List;
First_Compiled_File : out Name_Id;
Most_Recent_Obj_File : out Name_Id;
Most_Recent_Obj_Stamp : out Time_Stamp_Type;
Main_Unit : out Boolean;
Compilation_Failures : out Natural;
Check_Readonly_Files : Boolean := False;
Do_Not_Execute : Boolean := False;
Force_Compilations : Boolean := False;
Keep_Going : Boolean := False;
In_Place_Mode : Boolean := False;
Initialize_ALI_Data : Boolean := True;
Max_Process : Positive := 1)
is
function Compile
(S : Name_Id;
L : Name_Id;
Args : Argument_List)
return Process_Id;
-- Compiles S using Args. If S is a GNAT predefined source
-- "-gnatpg" is added to Args. Non blocking call. L corresponds to the
-- expected library file name. Process_Id of the process spawned to
-- execute the compile.
type Compilation_Data is record
Pid : Process_Id;
Full_Source_File : File_Name_Type;
Lib_File : File_Name_Type;
Source_Unit : Unit_Name_Type;
end record;
Running_Compile : array (1 .. Max_Process) of Compilation_Data;
-- Used to save information about outstanding compilations.
Outstanding_Compiles : Natural := 0;
-- Current number of outstanding compiles
Source_Unit : Unit_Name_Type;
-- Current source unit
Source_File : File_Name_Type;
-- Current source file
Full_Source_File : File_Name_Type;
-- Full name of the current source file
Lib_File : File_Name_Type;
-- Current library file
Full_Lib_File : File_Name_Type;
-- Full name of the current library file
Obj_File : File_Name_Type;
-- Full name of the object file corresponding to Lib_File.
Obj_Stamp : Time_Stamp_Type;
-- Time stamp of the current object file.
Sfile : File_Name_Type;
-- Contains the source file of the units withed by Source_File
ALI : ALI_Id;
-- ALI Id of the current ALI file
Compilation_OK : Boolean;
Need_To_Compile : Boolean;
Pid : Process_Id;
Text : Text_Buffer_Ptr;
Data : Prj.Project_Data;
Arg_Index : Natural;
-- Index in Special_Args.Table of a given compilation file
Need_To_Check_Standard_Library : Boolean := Check_Readonly_Files;
procedure Add_Process
(Pid : Process_Id;
Sfile : File_Name_Type;
Afile : File_Name_Type;
Uname : Unit_Name_Type);
-- Adds process Pid to the current list of outstanding compilation
-- processes and record the full name of the source file Sfile that
-- we are compiling, the name of its library file Afile and the
-- name of its unit Uname.
procedure Await_Compile
(Sfile : out File_Name_Type;
Afile : out File_Name_Type;
Uname : out Unit_Name_Type;
OK : out Boolean);
-- Awaits that an outstanding compilation process terminates. When
-- it does set Sfile to the name of the source file that was compiled
-- Afile to the name of its library file and Uname to the name of its
-- unit. Note that this time stamp can be used to check whether the
-- compilation did generate an object file. OK is set to True if the
-- compilation succeeded. Note that Sfile, Afile and Uname could be
-- resp. No_File, No_File and No_Name if there were no compilations
-- to wait for.
procedure Collect_Arguments_And_Compile;
-- Collect arguments from project file (if any) and compile
package Good_ALI is new Table.Table (
Table_Component_Type => ALI_Id,
Table_Index_Type => Natural,
Table_Low_Bound => 1,
Table_Initial => 50,
Table_Increment => 100,
Table_Name => "Make.Good_ALI");
-- Contains the set of valid ALI files that have not yet been scanned.
procedure Record_Good_ALI (A : ALI_Id);
-- Records in the previous set the Id of an ALI file.
function Good_ALI_Present return Boolean;
-- Returns True if any ALI file was recorded in the previous set.
function Get_Next_Good_ALI return ALI_Id;
-- Returns the next good ALI_Id record;
procedure Record_Failure
(File : File_Name_Type;
Unit : Unit_Name_Type;
Found : Boolean := True);
-- Records in the previous table that the compilation for File failed.
-- If Found is False then the compilation of File failed because we
-- could not find it. Records also Unit when possible.
function Bad_Compilation_Count return Natural;
-- Returns the number of compilation failures.
procedure Debug_Msg (S : String; N : Name_Id);
-- If Debug.Debug_Flag_W is set outputs string S followed by name N.
function Configuration_Pragmas_Switch
(For_Project : Project_Id)
return Argument_List;
-- Return an argument list of one element, if there is a configuration
-- pragmas file to be specified for For_Project,
-- otherwise return an empty argument list.
-----------------
-- Add_Process --
-----------------
procedure Add_Process
(Pid : Process_Id;
Sfile : File_Name_Type;
Afile : File_Name_Type;
Uname : Unit_Name_Type)
is
OC1 : constant Positive := Outstanding_Compiles + 1;
begin
pragma Assert (OC1 <= Max_Process);
pragma Assert (Pid /= Invalid_Pid);
Running_Compile (OC1).Pid := Pid;
Running_Compile (OC1).Full_Source_File := Sfile;
Running_Compile (OC1).Lib_File := Afile;
Running_Compile (OC1).Source_Unit := Uname;
Outstanding_Compiles := OC1;
end Add_Process;
--------------------
-- Await_Compile --
-------------------
procedure Await_Compile
(Sfile : out File_Name_Type;
Afile : out File_Name_Type;
Uname : out File_Name_Type;
OK : out Boolean)
is
Pid : Process_Id;
begin
pragma Assert (Outstanding_Compiles > 0);
Sfile := No_File;
Afile := No_File;
Uname := No_Name;
OK := False;
Wait_Process (Pid, OK);
if Pid = Invalid_Pid then
return;
end if;
for J in Running_Compile'First .. Outstanding_Compiles loop
if Pid = Running_Compile (J).Pid then
Sfile := Running_Compile (J).Full_Source_File;
Afile := Running_Compile (J).Lib_File;
Uname := Running_Compile (J).Source_Unit;
-- To actually remove this Pid and related info from
-- Running_Compile replace its entry with the last valid
-- entry in Running_Compile.
if J = Outstanding_Compiles then
null;
else
Running_Compile (J) :=
Running_Compile (Outstanding_Compiles);
end if;
Outstanding_Compiles := Outstanding_Compiles - 1;
return;
end if;
end loop;
raise Program_Error;
end Await_Compile;
---------------------------
-- Bad_Compilation_Count --
---------------------------
function Bad_Compilation_Count return Natural is
begin
return Bad_Compilation.Last - Bad_Compilation.First + 1;
end Bad_Compilation_Count;
-----------------------------------
-- Collect_Arguments_And_Compile --
-----------------------------------
procedure Collect_Arguments_And_Compile is
begin
-- If no project file is used, then just call Compile with
-- the specified Args.
if Main_Project = No_Project then
Pid := Compile (Full_Source_File, Lib_File, Args);
-- A project file was used
else
-- First check if the current source is an immediate
-- source of a project file.
if Opt.Verbose_Mode then
Write_Eol;
Write_Line ("Establishing Project context.");
end if;
declare
Source_File_Name : constant String :=
Name_Buffer (1 .. Name_Len);
Current_Project : Prj.Project_Id;
Path_Name : File_Name_Type := Source_File;
Compiler_Package : Prj.Package_Id;
Switches : Prj.Variable_Value;
Object_File : String_Access;
begin
if Opt.Verbose_Mode then
Write_Str ("Checking if the Project File exists for """);
Write_Str (Source_File_Name);
Write_Line (""".");
end if;
Prj.Env.
Get_Reference
(Source_File_Name => Source_File_Name,
Project => Current_Project,
Path => Path_Name);
if Current_Project = No_Project then
-- The current source is not an immediate source of any
-- project file. Call Compile with the specified Args plus
-- the saved gcc switches.
if Opt.Verbose_Mode then
Write_Str ("No Project File.");
Write_Eol;
end if;
Pid := Compile
(Full_Source_File,
Lib_File,
Args & The_Saved_Gcc_Switches.all);
-- We now know the project of the current source
else
-- Set ADA_INCLUDE_PATH and ADA_OBJECTS_PATH if the project
-- has changed.
-- Note: this will modify these environment variables only
-- for the current gnatmake process and all of its children
-- (invocations of the compiler, the binder and the linker).
-- The caller's ADA_INCLUDE_PATH and ADA_OBJECTS_PATH are
-- not affected.
Set_Ada_Paths (Current_Project, True);
Data := Projects.Table (Current_Project);
-- Check if it is a library project that needs to be
-- processed, only if it is not the main project.
if MLib.Tgt.Libraries_Are_Supported
and then Current_Project /= Main_Project
and then Data.Library
and then not Data.Flag1
then
-- Add to the Q all sources of the project that have
-- not been marked
Insert_Project_Sources
(The_Project => Current_Project, Into_Q => True);
-- Now mark the project as processed
Data.Flag1 := True;
Projects.Table (Current_Project).Flag1 := True;
end if;
Get_Name_String (Data.Object_Directory);
if Name_Buffer (Name_Len) = '/'
or else Name_Buffer (Name_Len) = Directory_Separator
then
Object_File :=
new String'
(Name_Buffer (1 .. Name_Len) &
Object_File_Name (Source_File_Name));
else
Object_File :=
new String'
(Name_Buffer (1 .. Name_Len) &
Directory_Separator &
Object_File_Name (Source_File_Name));
end if;
if Opt.Verbose_Mode then
Write_Str ("Project file is """);
Write_Str (Get_Name_String (Data.Name));
Write_Str (""".");
Write_Eol;
end if;
-- We know look for package Compiler
-- and get the switches from this package.
if Opt.Verbose_Mode then
Write_Str ("Checking package Compiler.");
Write_Eol;
end if;
Compiler_Package :=
Prj.Util.Value_Of
(Name => Name_Compiler,
In_Packages => Data.Decl.Packages);
if Compiler_Package /= No_Package then
if Opt.Verbose_Mode then
Write_Str ("Getting the switches.");
Write_Eol;
end if;
-- If package Gnatmake.Compiler exists, we get
-- the specific switches for the current source,
-- or the global switches, if any.
Switches := Switches_Of
(Source_File => Source_File,
Source_File_Name => Source_File_Name,
Naming =>
Projects.Table (Current_Project).Naming,
In_Package => Compiler_Package,
Allow_ALI => False);
end if;
case Switches.Kind is
-- We have a list of switches. We add to Args
-- these switches, plus the saved gcc switches.
when List =>
declare
Current : String_List_Id := Switches.Values;
Element : String_Element;
Number : Natural := 0;
begin
while Current /= Nil_String loop
Element := String_Elements.Table (Current);
Number := Number + 1;
Current := Element.Next;
end loop;
declare
New_Args : Argument_List (1 .. Number);
begin
Current := Switches.Values;
for Index in New_Args'Range loop
Element := String_Elements.Table (Current);
String_To_Name_Buffer (Element.Value);
New_Args (Index) :=
new String' (Name_Buffer (1 .. Name_Len));
Test_If_Relative_Path (New_Args (Index));
Current := Element.Next;
end loop;
Pid := Compile
(Path_Name,
Lib_File,
Args & Output_Flag & Object_File &
Configuration_Pragmas_Switch
(Current_Project) &
New_Args & The_Saved_Gcc_Switches.all);
end;
end;
-- We have a single switch. We add to Args
-- this switch, plus the saved gcc switches.
when Single =>
String_To_Name_Buffer (Switches.Value);
declare
New_Args : constant Argument_List :=
(1 => new String'
(Name_Buffer (1 .. Name_Len)));
begin
Test_If_Relative_Path (New_Args (1));
Pid := Compile
(Path_Name,
Lib_File,
Args &
Output_Flag &
Object_File &
New_Args &
Configuration_Pragmas_Switch (Current_Project) &
The_Saved_Gcc_Switches.all);
end;
-- We have no switches from Gnatmake.Compiler.
-- We add to Args the saved gcc switches.
when Undefined =>
if Opt.Verbose_Mode then
Write_Str ("There are no switches.");
Write_Eol;
end if;
Pid := Compile
(Path_Name,
Lib_File,
Args & Output_Flag & Object_File &
Configuration_Pragmas_Switch (Current_Project) &
The_Saved_Gcc_Switches.all);
end case;
end if;
end;
end if;
end Collect_Arguments_And_Compile;
-------------
-- Compile --
-------------
function Compile (S : Name_Id; L : Name_Id; Args : Argument_List)
return Process_Id
is
Comp_Args : Argument_List (Args'First .. Args'Last + 7);
Comp_Next : Integer := Args'First;
Comp_Last : Integer;
function Ada_File_Name (Name : Name_Id) return Boolean;
-- Returns True if Name is the name of an ada source file
-- (i.e. suffix is .ads or .adb)
-------------------
-- Ada_File_Name --
-------------------
function Ada_File_Name (Name : Name_Id) return Boolean is
begin
Get_Name_String (Name);
return
Name_Len > 4
and then Name_Buffer (Name_Len - 3 .. Name_Len - 1) = ".ad"
and then (Name_Buffer (Name_Len) = 'b'
or else
Name_Buffer (Name_Len) = 's');
end Ada_File_Name;
-- Start of processing for Compile
begin
Comp_Args (Comp_Next) := Comp_Flag;
Comp_Next := Comp_Next + 1;
-- Optimize the simple case where the gcc command line looks like
-- gcc -c -I. ... -I- file.adb --into-> gcc -c ... file.adb
if Args (Args'First).all = "-I" & Normalized_CWD
and then Args (Args'Last).all = "-I-"
and then S = Strip_Directory (S)
then
Comp_Last := Comp_Next + Args'Length - 3;
Comp_Args (Comp_Next .. Comp_Last) :=
Args (Args'First + 1 .. Args'Last - 1);
else
Comp_Last := Comp_Next + Args'Length - 1;
Comp_Args (Comp_Next .. Comp_Last) := Args;
end if;
-- Set -gnatpg for predefined files (for this purpose the renamings
-- such as Text_IO do not count as predefined). Note that we strip
-- the directory name from the source file name becase the call to
-- Fname.Is_Predefined_File_Name cannot deal with directory prefixes.
declare
Fname : constant File_Name_Type := Strip_Directory (S);
begin
if Is_Predefined_File_Name (Fname, False) then
if Check_Readonly_Files then
Comp_Last := Comp_Last + 1;
Comp_Args (Comp_Last) := GNAT_Flag;
else
Fail
("not allowed to compile """ &
Get_Name_String (Fname) &
"""; use -a switch.");
end if;
end if;
end;
-- Now check if the file name has one of the suffixes familiar to
-- the gcc driver. If this is not the case then add the ada flag
-- "-x ada".
if not Ada_File_Name (S) then
Comp_Last := Comp_Last + 1;
Comp_Args (Comp_Last) := Ada_Flag_1;
Comp_Last := Comp_Last + 1;
Comp_Args (Comp_Last) := Ada_Flag_2;
end if;
if L /= Strip_Directory (L) then
-- Build -o argument.
Get_Name_String (L);
for J in reverse 1 .. Name_Len loop
if Name_Buffer (J) = '.' then
Name_Len := J + Object_Suffix'Length - 1;
Name_Buffer (J .. Name_Len) := Object_Suffix;
exit;
end if;
end loop;
Comp_Last := Comp_Last + 1;
Comp_Args (Comp_Last) := Output_Flag;
Comp_Last := Comp_Last + 1;
Comp_Args (Comp_Last) := new String'(Name_Buffer (1 .. Name_Len));
end if;
Get_Name_String (S);
Comp_Last := Comp_Last + 1;
Comp_Args (Comp_Last) := new String'(Name_Buffer (1 .. Name_Len));
Display (Gcc.all, Comp_Args (Args'First .. Comp_Last));
if Gcc_Path = null then
Osint.Fail ("error, unable to locate " & Gcc.all);
end if;
return
GNAT.OS_Lib.Non_Blocking_Spawn
(Gcc_Path.all, Comp_Args (Args'First .. Comp_Last));
end Compile;
----------------------------------
-- Configuration_Pragmas_Switch --
----------------------------------
function Configuration_Pragmas_Switch
(For_Project : Project_Id)
return Argument_List
is
begin
Prj.Env.Create_Config_Pragmas_File (For_Project, Main_Project);
if Projects.Table (For_Project).Config_File_Name /= No_Name then
return
(1 => new String'("-gnatec" &
Get_Name_String
(Projects.Table (For_Project).Config_File_Name)));
else
return (1 .. 0 => null);
end if;
end Configuration_Pragmas_Switch;
---------------
-- Debug_Msg --
---------------
procedure Debug_Msg (S : String; N : Name_Id) is
begin
if Debug.Debug_Flag_W then
Write_Str (" ... ");
Write_Str (S);
Write_Str (" ");
Write_Name (N);
Write_Eol;
end if;
end Debug_Msg;
-----------------------
-- Get_Next_Good_ALI --
-----------------------
function Get_Next_Good_ALI return ALI_Id is
ALI : ALI_Id;
begin
pragma Assert (Good_ALI_Present);
ALI := Good_ALI.Table (Good_ALI.Last);
Good_ALI.Decrement_Last;
return ALI;
end Get_Next_Good_ALI;
----------------------
-- Good_ALI_Present --
----------------------
function Good_ALI_Present return Boolean is
begin
return Good_ALI.First <= Good_ALI.Last;
end Good_ALI_Present;
--------------------
-- Record_Failure --
--------------------
procedure Record_Failure
(File : File_Name_Type;
Unit : Unit_Name_Type;
Found : Boolean := True)
is
begin
Bad_Compilation.Increment_Last;
Bad_Compilation.Table (Bad_Compilation.Last) := (File, Unit, Found);
end Record_Failure;
---------------------
-- Record_Good_ALI --
---------------------
procedure Record_Good_ALI (A : ALI_Id) is
begin
Good_ALI.Increment_Last;
Good_ALI.Table (Good_ALI.Last) := A;
end Record_Good_ALI;
-- Start of processing for Compile_Sources
begin
pragma Assert (Args'First = 1);
-- Package and Queue initializations.
Good_ALI.Init;
Bad_Compilation.Init;
Output.Set_Standard_Error;
Init_Q;
if Initialize_ALI_Data then
Initialize_ALI;
Initialize_ALI_Source;
end if;
-- The following two flags affect the behavior of ALI.Set_Source_Table.
-- We set Opt.Check_Source_Files to True to ensure that source file
-- time stamps are checked, and we set Opt.All_Sources to False to
-- avoid checking the presence of the source files listed in the
-- source dependency section of an ali file (which would be a mistake
-- since the ali file may be obsolete).
Opt.Check_Source_Files := True;
Opt.All_Sources := False;
-- If the main source is marked, there is nothing to compile.
-- This can happen when we have several main subprograms.
-- For the first main, we always insert in the Q.
if not Is_Marked (Main_Source) then
Insert_Q (Main_Source);
Mark (Main_Source);
end if;
First_Compiled_File := No_File;
Most_Recent_Obj_File := No_File;
Main_Unit := False;
-- Keep looping until there is no more work to do (the Q is empty)
-- and all the outstanding compilations have terminated
Make_Loop : while not Empty_Q or else Outstanding_Compiles > 0 loop
-- If the user does not want to keep going in case of errors then
-- wait for the remaining outstanding compiles and then exit.
if Bad_Compilation_Count > 0 and then not Keep_Going then
while Outstanding_Compiles > 0 loop
Await_Compile
(Full_Source_File, Lib_File, Source_Unit, Compilation_OK);
if not Compilation_OK then
Record_Failure (Full_Source_File, Source_Unit);
end if;
end loop;
exit Make_Loop;
end if;
-- PHASE 1: Check if there is more work that we can do (ie the Q
-- is non empty). If there is, do it only if we have not yet used
-- up all the available processes.
if not Empty_Q and then Outstanding_Compiles < Max_Process then
Extract_From_Q (Source_File, Source_Unit);
Full_Source_File := Osint.Full_Source_Name (Source_File);
Lib_File := Osint.Lib_File_Name (Source_File);
Full_Lib_File := Osint.Full_Lib_File_Name (Lib_File);
-- If the library file is an Ada library skip it
if Full_Lib_File /= No_File
and then In_Ada_Lib_Dir (Full_Lib_File)
then
Verbose_Msg (Lib_File, "is in an Ada library", Prefix => " ");
-- If the library file is a read-only library skip it
elsif Full_Lib_File /= No_File
and then not Check_Readonly_Files
and then Is_Readonly_Library (Full_Lib_File)
then
Verbose_Msg
(Lib_File, "is a read-only library", Prefix => " ");
-- The source file that we are checking cannot be located
elsif Full_Source_File = No_File then
Record_Failure (Source_File, Source_Unit, False);
-- Source and library files can be located but are internal
-- files
elsif not Check_Readonly_Files
and then Full_Lib_File /= No_File
and then Is_Internal_File_Name (Source_File)
then
if Force_Compilations then
Fail
("not allowed to compile """ &
Get_Name_String (Source_File) &
"""; use -a switch.");
end if;
Verbose_Msg
(Lib_File, "is an internal library", Prefix => " ");
-- The source file that we are checking can be located
else
-- Don't waste any time if we have to recompile anyway
Obj_Stamp := Empty_Time_Stamp;
Need_To_Compile := Force_Compilations;
if not Force_Compilations then
Check (Lib_File, ALI, Obj_File, Obj_Stamp);
Need_To_Compile := (ALI = No_ALI_Id);
end if;
if not Need_To_Compile then
-- The ALI file is up-to-date. Record its Id.
Record_Good_ALI (ALI);
-- Record the time stamp of the most recent object file
-- as long as no (re)compilations are needed.
if First_Compiled_File = No_File
and then (Most_Recent_Obj_File = No_File
or else Obj_Stamp > Most_Recent_Obj_Stamp)
then
Most_Recent_Obj_File := Obj_File;
Most_Recent_Obj_Stamp := Obj_Stamp;
end if;
else
-- Is this the first file we have to compile?
if First_Compiled_File = No_File then
First_Compiled_File := Full_Source_File;
Most_Recent_Obj_File := No_File;
if Do_Not_Execute then
exit Make_Loop;
end if;
end if;
if In_Place_Mode then
-- If the library file was not found, then save the
-- library file near the source file.
if Full_Lib_File = No_File then
Get_Name_String (Full_Source_File);
for J in reverse 1 .. Name_Len loop
if Name_Buffer (J) = '.' then
Name_Buffer (J + 1 .. J + 3) := "ali";
Name_Len := J + 3;
exit;
end if;
end loop;
Lib_File := Name_Find;
-- If the library file was found, then save the
-- library file in the same place.
else
Lib_File := Full_Lib_File;
end if;
end if;
-- Check for special compilation flags
Arg_Index := 0;
Get_Name_String (Source_File);
-- Start the compilation and record it. We can do this
-- because there is at least one free process.
Collect_Arguments_And_Compile;
-- Make sure we could successfully start the compilation
if Pid = Invalid_Pid then
Record_Failure (Full_Source_File, Source_Unit);
else
Add_Process
(Pid, Full_Source_File, Lib_File, Source_Unit);
end if;
end if;
end if;
end if;
-- PHASE 2: Now check if we should wait for a compilation to
-- finish. This is the case if all the available processes are
-- busy compiling sources or there is nothing else to do
-- (that is the Q is empty and there are no good ALIs to process).
if Outstanding_Compiles = Max_Process
or else (Empty_Q
and then not Good_ALI_Present
and then Outstanding_Compiles > 0)
then
Await_Compile
(Full_Source_File, Lib_File, Source_Unit, Compilation_OK);
if not Compilation_OK then
Record_Failure (Full_Source_File, Source_Unit);
else
-- Re-read the updated library file
Text := Read_Library_Info (Lib_File);
-- If no ALI file was generated by this compilation nothing
-- more to do, otherwise scan the ali file and record it.
-- If the scan fails, a previous ali file is inconsistent with
-- the unit just compiled.
if Text /= null then
ALI :=
Scan_ALI (Lib_File, Text, Ignore_ED => False, Err => True);
if ALI = No_ALI_Id then
Inform
(Lib_File, "incompatible ALI file, please recompile");
Record_Failure (Full_Source_File, Source_Unit);
else
Free (Text);
Record_Good_ALI (ALI);
end if;
-- If we could not read the ALI file that was just generated
-- then there could be a problem reading either the ALI or the
-- corresponding object file (if Opt.Check_Object_Consistency
-- is set Read_Library_Info checks that the time stamp of the
-- object file is more recent than that of the ALI). For an
-- example of problems caught by this test see [6625-009].
else
Inform
(Lib_File,
"WARNING: ALI or object file not found after compile");
Record_Failure (Full_Source_File, Source_Unit);
end if;
end if;
end if;
exit Make_Loop when Unique_Compile;
-- PHASE 3: Check if we recorded good ALI files. If yes process
-- them now in the order in which they have been recorded. There
-- are two occasions in which we record good ali files. The first is
-- in phase 1 when, after scanning an existing ALI file we realise
-- it is up-to-date, the second instance is after a successful
-- compilation.
while Good_ALI_Present loop
ALI := Get_Next_Good_ALI;
-- If we are processing the library file corresponding to the
-- main source file check if this source can be a main unit.
if ALIs.Table (ALI).Sfile = Main_Source then
Main_Unit := ALIs.Table (ALI).Main_Program /= None;
end if;
-- The following adds the standard library (s-stalib) to the
-- list of files to be handled by gnatmake: this file and any
-- files it depends on are always included in every bind,
-- except in No_Run_Time mode, even if they are not
-- in the explicit dependency list.
-- However, to avoid annoying output about s-stalib.ali being
-- read only, when "-v" is used, we add the standard library
-- only when "-a" is used.
if Need_To_Check_Standard_Library then
Need_To_Check_Standard_Library := False;
if not ALIs.Table (ALI).No_Run_Time then
declare
Sfile : Name_Id;
begin
Name_Len := Standard_Library_Package_Body_Name'Length;
Name_Buffer (1 .. Name_Len) :=
Standard_Library_Package_Body_Name;
Sfile := Name_Enter;
if not Is_Marked (Sfile) then
Insert_Q (Sfile);
Mark (Sfile);
end if;
end;
end if;
end if;
-- Now insert in the Q the unmarked source files (i.e. those
-- which have neever been inserted in the Q and hence never
-- considered).
for J in
ALIs.Table (ALI).First_Unit .. ALIs.Table (ALI).Last_Unit
loop
for K in
Units.Table (J).First_With .. Units.Table (J).Last_With
loop
Sfile := Withs.Table (K).Sfile;
if Sfile = No_File then
Debug_Msg ("Skipping generic:", Withs.Table (K).Uname);
elsif Is_Marked (Sfile) then
Debug_Msg ("Skipping marked file:", Sfile);
elsif not Check_Readonly_Files
and then Is_Internal_File_Name (Sfile)
then
Debug_Msg ("Skipping internal file:", Sfile);
else
Insert_Q (Sfile, Withs.Table (K).Uname);
Mark (Sfile);
end if;
end loop;
end loop;
end loop;
if Opt.Display_Compilation_Progress then
Write_Str ("completed ");
Write_Int (Int (Q_Front));
Write_Str (" out of ");
Write_Int (Int (Q.Last));
Write_Str (" (");
Write_Int (Int ((Q_Front * 100) / (Q.Last - Q.First)));
Write_Str ("%)...");
Write_Eol;
end if;
end loop Make_Loop;
Compilation_Failures := Bad_Compilation_Count;
-- Compilation is finished
-- Delete any temporary configuration pragma file
if Main_Project /= No_Project then
declare
Success : Boolean;
begin
for Project in 1 .. Projects.Last loop
if Projects.Table (Project).Config_File_Temp then
if Opt.Verbose_Mode then
Write_Str ("Deleting temp configuration file """);
Write_Str (Get_Name_String
(Projects.Table (Project).Config_File_Name));
Write_Line ("""");
end if;
Delete_File
(Name => Get_Name_String
(Projects.Table (Project).Config_File_Name),
Success => Success);
-- Make sure that we don't have a config file for this
-- project, in case when there are several mains.
-- In this case, we will recreate another config file:
-- we cannot reuse the one that we just deleted!
Projects.Table (Project).Config_Checked := False;
Projects.Table (Project).Config_File_Name := No_Name;
Projects.Table (Project).Config_File_Temp := False;
end if;
end loop;
end;
end if;
end Compile_Sources;
-------------
-- Display --
-------------
procedure Display (Program : String; Args : Argument_List) is
begin
pragma Assert (Args'First = 1);
if Display_Executed_Programs then
Write_Str (Program);
for J in Args'Range loop
Write_Str (" ");
Write_Str (Args (J).all);
end loop;
Write_Eol;
end if;
end Display;
----------------------
-- Display_Commands --
----------------------
procedure Display_Commands (Display : Boolean := True) is
begin
Display_Executed_Programs := Display;
end Display_Commands;
-------------
-- Empty_Q --
-------------
function Empty_Q return Boolean is
begin
if Debug.Debug_Flag_P then
Write_Str (" Q := [");
for J in Q_Front .. Q.Last - 1 loop
Write_Str (" ");
Write_Name (Q.Table (J).File);
Write_Eol;
Write_Str (" ");
end loop;
Write_Str ("]");
Write_Eol;
end if;
return Q_Front >= Q.Last;
end Empty_Q;
---------------------
-- Extract_Failure --
---------------------
procedure Extract_Failure
(File : out File_Name_Type;
Unit : out Unit_Name_Type;
Found : out Boolean)
is
begin
File := Bad_Compilation.Table (Bad_Compilation.Last).File;
Unit := Bad_Compilation.Table (Bad_Compilation.Last).Unit;
Found := Bad_Compilation.Table (Bad_Compilation.Last).Found;
Bad_Compilation.Decrement_Last;
end Extract_Failure;
--------------------
-- Extract_From_Q --
--------------------
procedure Extract_From_Q
(Source_File : out File_Name_Type;
Source_Unit : out Unit_Name_Type)
is
File : constant File_Name_Type := Q.Table (Q_Front).File;
Unit : constant Unit_Name_Type := Q.Table (Q_Front).Unit;
begin
if Debug.Debug_Flag_Q then
Write_Str (" Q := Q - [ ");
Write_Name (File);
Write_Str (" ]");
Write_Eol;
end if;
Q_Front := Q_Front + 1;
Source_File := File;
Source_Unit := Unit;
end Extract_From_Q;
--------------
-- Gnatmake --
--------------
procedure Gnatmake is
Main_Source_File : File_Name_Type;
-- The source file containing the main compilation unit
Compilation_Failures : Natural;
Is_Main_Unit : Boolean;
-- Set to True by Compile_Sources if the Main_Source_File can be a
-- main unit.
Main_ALI_File : File_Name_Type;
-- The ali file corresponding to Main_Source_File
Executable : File_Name_Type := No_File;
-- The file name of an executable
Non_Std_Executable : Boolean := False;
-- Non_Std_Executable is set to True when there is a possibility
-- that the linker will not choose the correct executable file name.
Executable_Obsolete : Boolean := False;
-- Executable_Obsolete is set to True for the first obsolete main
-- and is never reset to False. Any subsequent main will always
-- be rebuild (if we rebuild mains), even in the case when it is not
-- really necessary, because it is too hard to decide.
Mapping_File_Name : Temp_File_Name;
-- The name of the temporary mapping file that is copmmunicated
-- to the compiler through a -gnatem switch, when using project files.
begin
Do_Compile_Step := True;
Do_Bind_Step := True;
Do_Link_Step := True;
Make.Initialize;
if Hostparm.Java_VM then
Gcc := new String'("jgnat");
Gnatbind := new String'("jgnatbind");
Gnatlink := new String '("jgnatlink");
-- Do not check for an object file (".o") when compiling to
-- Java bytecode since ".class" files are generated instead.
Opt.Check_Object_Consistency := False;
end if;
if Opt.Verbose_Mode then
Write_Eol;
Write_Str ("GNATMAKE ");
Write_Str (Gnatvsn.Gnat_Version_String);
Write_Str (" Copyright 1995-2001 Free Software Foundation, Inc.");
Write_Eol;
end if;
-- If no mains have been specified on the command line,
-- and we are using a project file, we either find the main(s)
-- in the attribute Main of the main project, or we put all
-- the sources of the project file as mains.
if Main_Project /= No_Project and then Osint.Number_Of_Files = 0 then
Name_Len := 4;
Name_Buffer (1 .. 4) := "main";
declare
Main_Id : constant Name_Id := Name_Find;
Mains : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Variable_Name => Main_Id,
In_Variables =>
Projects.Table (Main_Project).Decl.Attributes);
Value : String_List_Id := Mains.Values;
begin
-- The attribute Main is an empty list or not specified,
-- or else gnatmake was invoked with the switch "-u".
if Value = Prj.Nil_String or else Unique_Compile then
-- First make sure that the binder and the linker
-- will not be invoked.
Do_Bind_Step := False;
Do_Link_Step := False;
-- Put all the sources in the queue
Insert_Project_Sources
(The_Project => Main_Project, Into_Q => False);
else
-- The attribute Main is not an empty list.
-- Put all the main subprograms in the list as if there were
-- specified on the command line.
while Value /= Prj.Nil_String loop
String_To_Name_Buffer (String_Elements.Table (Value).Value);
Osint.Add_File (Name_Buffer (1 .. Name_Len));
Value := String_Elements.Table (Value).Next;
end loop;
end if;
end;
end if;
-- Output usage information if no files. Note that this can happen
-- in the case of a project file that contains only subunits.
if Osint.Number_Of_Files = 0 then
Makeusg;
Exit_Program (E_Fatal);
end if;
-- If -l was specified behave as if -n was specified
if Opt.List_Dependencies then
Opt.Do_Not_Execute := True;
end if;
-- Note that Osint.Next_Main_Source will always return the (possibly
-- abbreviated file) without any directory information.
Main_Source_File := Next_Main_Source;
if Project_File_Name = null then
Add_Switch ("-I-", Compiler, And_Save => True);
Add_Switch ("-I-", Binder, And_Save => True);
if Opt.Look_In_Primary_Dir then
Add_Switch
("-I" &
Normalize_Directory_Name
(Get_Primary_Src_Search_Directory.all).all,
Compiler, Append_Switch => False,
And_Save => False);
Add_Switch ("-aO" & Normalized_CWD,
Binder,
Append_Switch => False,
And_Save => False);
end if;
end if;
-- If the user wants a program without a main subprogram, add the
-- appropriate switch to the binder.
if Opt.No_Main_Subprogram then
Add_Switch ("-z", Binder, And_Save => True);
end if;
if Main_Project /= No_Project then
Change_Dir
(Get_Name_String (Projects.Table (Main_Project).Object_Directory));
-- Find the file name of the main unit
declare
Main_Source_File_Name : constant String :=
Get_Name_String (Main_Source_File);
Main_Unit_File_Name : constant String :=
Prj.Env.File_Name_Of_Library_Unit_Body
(Name => Main_Source_File_Name,
Project => Main_Project);
The_Packages : constant Package_Id :=
Projects.Table (Main_Project).Decl.Packages;
Gnatmake : constant Prj.Package_Id :=
Prj.Util.Value_Of
(Name => Name_Builder,
In_Packages => The_Packages);
Binder_Package : constant Prj.Package_Id :=
Prj.Util.Value_Of
(Name => Name_Binder,
In_Packages => The_Packages);
Linker_Package : constant Prj.Package_Id :=
Prj.Util.Value_Of
(Name => Name_Linker,
In_Packages => The_Packages);
begin
-- We fail if we cannot find the main source file
-- as an immediate source of the main project file.
if Main_Unit_File_Name = "" then
Fail ('"' & Main_Source_File_Name &
""" is not a unit of project " &
Project_File_Name.all & ".");
else
-- Remove any directory information from the main
-- source file name.
declare
Pos : Natural := Main_Unit_File_Name'Last;
begin
loop
exit when Pos < Main_Unit_File_Name'First or else
Main_Unit_File_Name (Pos) = Directory_Separator;
Pos := Pos - 1;
end loop;
Name_Len := Main_Unit_File_Name'Last - Pos;
Name_Buffer (1 .. Name_Len) :=
Main_Unit_File_Name
(Pos + 1 .. Main_Unit_File_Name'Last);
Main_Source_File := Name_Find;
-- We only output the main source file if there is only one
if Opt.Verbose_Mode and then Osint.Number_Of_Files = 1 then
Write_Str ("Main source file: """);
Write_Str (Main_Unit_File_Name
(Pos + 1 .. Main_Unit_File_Name'Last));
Write_Line (""".");
end if;
end;
end if;
-- If there is a package gnatmake in the main project file, add
-- the switches from it. We also add the switches from packages
-- gnatbind and gnatlink, if any.
if Gnatmake /= No_Package then
-- If there is only one main, we attempt to get the gnatmake
-- switches for this main (if any). If there are no specific
-- switch for this particular main, get the general gnatmake
-- switches (if any).
if Osint.Number_Of_Files = 1 then
if Opt.Verbose_Mode then
Write_Str ("Adding gnatmake switches for """);
Write_Str (Main_Unit_File_Name);
Write_Line (""".");
end if;
Add_Switches
(File_Name => Main_Unit_File_Name,
The_Package => Gnatmake,
Program => None);
else
-- If there are several mains, we always get the general
-- gnatmake switches (if any).
-- Note: As there is never a source with name " ",
-- we are guaranteed to always get the gneneral switches.
Add_Switches
(File_Name => " ",
The_Package => Gnatmake,
Program => None);
end if;
end if;
if Binder_Package /= No_Package then
-- If there is only one main, we attempt to get the gnatbind
-- switches for this main (if any). If there are no specific
-- switch for this particular main, get the general gnatbind
-- switches (if any).
if Osint.Number_Of_Files = 1 then
if Opt.Verbose_Mode then
Write_Str ("Adding binder switches for """);
Write_Str (Main_Unit_File_Name);
Write_Line (""".");
end if;
Add_Switches
(File_Name => Main_Unit_File_Name,
The_Package => Binder_Package,
Program => Binder);
else
-- If there are several mains, we always get the general
-- gnatbind switches (if any).
-- Note: As there is never a source with name " ",
-- we are guaranteed to always get the gneneral switches.
Add_Switches
(File_Name => " ",
The_Package => Binder_Package,
Program => Binder);
end if;
end if;
if Linker_Package /= No_Package then
-- If there is only one main, we attempt to get the
-- gnatlink switches for this main (if any). If there are
-- no specific switch for this particular main, we get the
-- general gnatlink switches (if any).
if Osint.Number_Of_Files = 1 then
if Opt.Verbose_Mode then
Write_Str ("Adding linker switches for""");
Write_Str (Main_Unit_File_Name);
Write_Line (""".");
end if;
Add_Switches
(File_Name => Main_Unit_File_Name,
The_Package => Linker_Package,
Program => Linker);
else
-- If there are several mains, we always get the general
-- gnatlink switches (if any).
-- Note: As there is never a source with name " ",
-- we are guaranteed to always get the general switches.
Add_Switches
(File_Name => " ",
The_Package => Linker_Package,
Program => Linker);
end if;
end if;
end;
end if;
Display_Commands (not Opt.Quiet_Output);
-- We now put in the Binder_Switches and Linker_Switches tables,
-- the binder and linker switches of the command line that have been
-- put in the Saved_ tables. If a project file was used, then the
-- command line switches will follow the project file switches.
for J in 1 .. Saved_Binder_Switches.Last loop
Add_Switch
(Saved_Binder_Switches.Table (J),
Binder,
And_Save => False);
end loop;
for J in 1 .. Saved_Linker_Switches.Last loop
Add_Switch
(Saved_Linker_Switches.Table (J),
Linker,
And_Save => False);
end loop;
-- If no project file is used, we just put the gcc switches
-- from the command line in the Gcc_Switches table.
if Main_Project = No_Project then
for J in 1 .. Saved_Gcc_Switches.Last loop
Add_Switch
(Saved_Gcc_Switches.Table (J),
Compiler,
And_Save => False);
end loop;
else
-- And we put the command line gcc switches in the variable
-- The_Saved_Gcc_Switches. They are going to be used later
-- in procedure Compile_Sources.
The_Saved_Gcc_Switches :=
new Argument_List (1 .. Saved_Gcc_Switches.Last + 2);
for J in 1 .. Saved_Gcc_Switches.Last loop
The_Saved_Gcc_Switches (J) := Saved_Gcc_Switches.Table (J);
Test_If_Relative_Path (The_Saved_Gcc_Switches (J));
end loop;
-- We never use gnat.adc when a project file is used
The_Saved_Gcc_Switches (The_Saved_Gcc_Switches'Last - 1) :=
No_gnat_adc;
-- Create a temporary mapping file and add the switch -gnatem
-- with its name to the compiler.
Prj.Env.Create_Mapping_File (Name => Mapping_File_Name);
The_Saved_Gcc_Switches (The_Saved_Gcc_Switches'Last) :=
new String'("-gnatem" & Mapping_File_Name);
-- Check if there are any relative search paths in the switches.
-- Fail if there is one.
for J in 1 .. Gcc_Switches.Last loop
Test_If_Relative_Path (Gcc_Switches.Table (J));
end loop;
for J in 1 .. Binder_Switches.Last loop
Test_If_Relative_Path (Binder_Switches.Table (J));
end loop;
for J in 1 .. Linker_Switches.Last loop
Test_If_Relative_Path (Linker_Switches.Table (J));
end loop;
end if;
-- If there was a --GCC, --GNATBIND or --GNATLINK switch on
-- the command line, then we have to use it, even if there was
-- another switch in the project file.
if Saved_Gcc /= null then
Gcc := Saved_Gcc;
end if;
if Saved_Gnatbind /= null then
Gnatbind := Saved_Gnatbind;
end if;
if Saved_Gnatlink /= null then
Gnatlink := Saved_Gnatlink;
end if;
Gcc_Path := GNAT.OS_Lib.Locate_Exec_On_Path (Gcc.all);
Gnatbind_Path := GNAT.OS_Lib.Locate_Exec_On_Path (Gnatbind.all);
Gnatlink_Path := GNAT.OS_Lib.Locate_Exec_On_Path (Gnatlink.all);
-- If we have specified -j switch both from the project file
-- and on the command line, the one from the command line takes
-- precedence.
if Saved_Maximum_Processes = 0 then
Saved_Maximum_Processes := Opt.Maximum_Processes;
end if;
-- If either -c, -b or -l has been specified, we will not necessarily
-- execute all steps.
if Compile_Only or else Bind_Only or else Link_Only then
Do_Compile_Step := Do_Compile_Step and Compile_Only;
Do_Bind_Step := Do_Bind_Step and Bind_Only;
Do_Link_Step := Do_Link_Step and Link_Only;
-- If -c has been specified, but not -b, ignore any potential -l
if Do_Compile_Step and then not Do_Bind_Step then
Do_Link_Step := False;
end if;
end if;
-- Here is where the make process is started
-- We do the same process for each main
Multiple_Main_Loop : for N_File in 1 .. Osint.Number_Of_Files loop
if Do_Compile_Step then
Recursive_Compilation_Step : declare
Args : Argument_List (1 .. Gcc_Switches.Last);
First_Compiled_File : Name_Id;
Youngest_Obj_File : Name_Id;
Youngest_Obj_Stamp : Time_Stamp_Type;
Executable_Stamp : Time_Stamp_Type;
-- Executable is the final executable program.
begin
Executable := No_File;
Non_Std_Executable := False;
for J in 1 .. Gcc_Switches.Last loop
Args (J) := Gcc_Switches.Table (J);
end loop;
-- Look inside the linker switches to see if the name
-- of the final executable program was specified.
for
J in reverse Linker_Switches.First .. Linker_Switches.Last
loop
if Linker_Switches.Table (J).all = Output_Flag.all then
pragma Assert (J < Linker_Switches.Last);
-- We cannot specify a single executable for several
-- main subprograms!
if Osint.Number_Of_Files > 1 then
Fail
("cannot specify a single executable " &
"for several mains");
end if;
Name_Len := Linker_Switches.Table (J + 1)'Length;
Name_Buffer (1 .. Name_Len) :=
Linker_Switches.Table (J + 1).all;
-- If target has an executable suffix and it has not been
-- specified then it is added here.
if Executable_Suffix'Length /= 0
and then Linker_Switches.Table (J + 1)
(Name_Len - Executable_Suffix'Length + 1
.. Name_Len) /= Executable_Suffix
then
Name_Buffer (Name_Len + 1 ..
Name_Len + Executable_Suffix'Length) :=
Executable_Suffix;
Name_Len := Name_Len + Executable_Suffix'Length;
end if;
Executable := Name_Enter;
Verbose_Msg (Executable, "final executable");
end if;
end loop;
-- If the name of the final executable program was not
-- specified then construct it from the main input file.
if Executable = No_File then
if Main_Project = No_Project then
Executable :=
Executable_Name (Strip_Suffix (Main_Source_File));
else
-- If we are using a project file, we attempt to
-- remove the body (or spec) termination of the main
-- subprogram. We find it the the naming scheme of the
-- project file. This will avoid to generate an
-- executable "main.2" for a main subprogram
-- "main.2.ada", when the body termination is ".2.ada".
declare
Body_Append : constant String :=
Get_Name_String
(Projects.Table
(Main_Project).
Naming.Current_Impl_Suffix);
Spec_Append : constant String :=
Get_Name_String
(Projects.Table
(Main_Project).
Naming.Current_Spec_Suffix);
begin
Get_Name_String (Main_Source_File);
if Name_Len > Body_Append'Length
and then Name_Buffer
(Name_Len - Body_Append'Length + 1 .. Name_Len) =
Body_Append
then
-- We have found the body termination. We remove it
-- add the executable termination, if any.
Name_Len := Name_Len - Body_Append'Length;
Executable := Executable_Name (Name_Find);
elsif Name_Len > Spec_Append'Length
and then
Name_Buffer
(Name_Len - Spec_Append'Length + 1 .. Name_Len) =
Spec_Append
then
-- We have found the spec termination. We remove
-- it, add the executable termination, if any.
Name_Len := Name_Len - Spec_Append'Length;
Executable := Executable_Name (Name_Find);
else
Executable :=
Executable_Name (Strip_Suffix (Main_Source_File));
end if;
end;
end if;
end if;
if Main_Project /= No_Project then
declare
Exec_File_Name : constant String :=
Get_Name_String (Executable);
begin
if not Is_Absolute_Path (Exec_File_Name) then
for Index in Exec_File_Name'Range loop
if Exec_File_Name (Index) = Directory_Separator then
Fail ("relative executable (""" &
Exec_File_Name &
""") with directory part not allowed " &
"when using project files");
end if;
end loop;
Get_Name_String (Projects.Table
(Main_Project).Exec_Directory);
if
Name_Buffer (Name_Len) /= Directory_Separator
then
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := Directory_Separator;
end if;
Name_Buffer (Name_Len + 1 ..
Name_Len + Exec_File_Name'Length) :=
Exec_File_Name;
Name_Len := Name_Len + Exec_File_Name'Length;
Executable := Name_Find;
Non_Std_Executable := True;
end if;
end;
end if;
-- Now we invoke Compile_Sources for the current main
Compile_Sources
(Main_Source => Main_Source_File,
Args => Args,
First_Compiled_File => First_Compiled_File,
Most_Recent_Obj_File => Youngest_Obj_File,
Most_Recent_Obj_Stamp => Youngest_Obj_Stamp,
Main_Unit => Is_Main_Unit,
Compilation_Failures => Compilation_Failures,
Check_Readonly_Files => Opt.Check_Readonly_Files,
Do_Not_Execute => Opt.Do_Not_Execute,
Force_Compilations => Opt.Force_Compilations,
In_Place_Mode => Opt.In_Place_Mode,
Keep_Going => Opt.Keep_Going,
Initialize_ALI_Data => True,
Max_Process => Saved_Maximum_Processes);
if Opt.Verbose_Mode then
Write_Str ("End of compilation");
Write_Eol;
end if;
if Compilation_Failures /= 0 then
List_Bad_Compilations;
raise Compilation_Failed;
end if;
-- Regenerate libraries, if any and if object files
-- have been regenerated
if Main_Project /= No_Project
and then MLib.Tgt.Libraries_Are_Supported
then
for Proj in Projects.First .. Projects.Last loop
if Proj /= Main_Project
and then Projects.Table (Proj).Flag1
then
MLib.Prj.Build_Library (For_Project => Proj);
end if;
end loop;
end if;
if Opt.List_Dependencies then
if First_Compiled_File /= No_File then
Inform
(First_Compiled_File,
"must be recompiled. Can't generate dependence list.");
else
List_Depend;
end if;
elsif First_Compiled_File = No_File
and then not Do_Bind_Step
and then not Opt.Quiet_Output
and then Osint.Number_Of_Files = 1
then
if Unique_Compile then
Inform (Msg => "object up to date.");
else
Inform (Msg => "objects up to date.");
end if;
elsif Opt.Do_Not_Execute
and then First_Compiled_File /= No_File
then
Write_Name (First_Compiled_File);
Write_Eol;
end if;
-- Stop after compile step if any of:
-- 1) -n (Do_Not_Execute) specified
-- 2) -l (List_Dependencies) specified (also sets
-- Do_Not_Execute above, so this is probably superfluous).
-- 3) -c (Compile_Only) specified, but not -b (Bind_Only)
-- 4) Made unit cannot be a main unit
if (Opt.Do_Not_Execute
or Opt.List_Dependencies
or not Do_Bind_Step
or not Is_Main_Unit)
and then not No_Main_Subprogram
then
if Osint.Number_Of_Files = 1 then
exit Multiple_Main_Loop;
else
goto Next_Main;
end if;
end if;
-- If the objects were up-to-date check if the executable file
-- is also up-to-date. For now always bind and link on the JVM
-- since there is currently no simple way to check the
-- up-to-date status of objects
if not Hostparm.Java_VM
and then First_Compiled_File = No_File
then
Executable_Stamp := File_Stamp (Executable);
-- Once Executable_Obsolete is set to True, it is never
-- reset to False, because it is too hard to accurately
-- decide if a subsequent main need to be rebuilt or not.
Executable_Obsolete :=
Executable_Obsolete
or else Youngest_Obj_Stamp > Executable_Stamp;
if not Executable_Obsolete then
-- If no Ada object files obsolete the executable, check
-- for younger or missing linker files.
Check_Linker_Options
(Executable_Stamp,
Youngest_Obj_File,
Youngest_Obj_Stamp);
Executable_Obsolete := Youngest_Obj_File /= No_File;
end if;
-- Return if the executable is up to date
-- and otherwise motivate the relink/rebind.
if not Executable_Obsolete then
if not Opt.Quiet_Output then
Inform (Executable, "up to date.");
end if;
if Osint.Number_Of_Files = 1 then
exit Multiple_Main_Loop;
else
goto Next_Main;
end if;
end if;
if Executable_Stamp (1) = ' ' then
Verbose_Msg (Executable, "missing.", Prefix => " ");
elsif Youngest_Obj_Stamp (1) = ' ' then
Verbose_Msg
(Youngest_Obj_File,
"missing.",
Prefix => " ");
elsif Youngest_Obj_Stamp > Executable_Stamp then
Verbose_Msg
(Youngest_Obj_File,
"(" & String (Youngest_Obj_Stamp) & ") newer than",
Executable,
"(" & String (Executable_Stamp) & ")");
else
Verbose_Msg
(Executable, "needs to be rebuild.",
Prefix => " ");
end if;
end if;
end Recursive_Compilation_Step;
end if;
-- If we are here, it means that we need to rebuilt the current
-- main. So we set Executable_Obsolete to True to make sure that
-- the subsequent mains will be rebuilt.
Executable_Obsolete := True;
Main_ALI_In_Place_Mode_Step :
declare
ALI_File : File_Name_Type;
Src_File : File_Name_Type;
begin
Src_File := Strip_Directory (Main_Source_File);
ALI_File := Lib_File_Name (Src_File);
Main_ALI_File := Full_Lib_File_Name (ALI_File);
-- When In_Place_Mode, the library file can be located in the
-- Main_Source_File directory which may not be present in the
-- library path. In this case, use the corresponding library file
-- name.
if Main_ALI_File = No_File and then Opt.In_Place_Mode then
Get_Name_String (Get_Directory (Full_Source_Name (Src_File)));
Get_Name_String_And_Append (ALI_File);
Main_ALI_File := Name_Find;
Main_ALI_File := Full_Lib_File_Name (Main_ALI_File);
end if;
if Main_ALI_File = No_File then
Fail ("could not find the main ALI file");
end if;
end Main_ALI_In_Place_Mode_Step;
if Do_Bind_Step then
Bind_Step : declare
Args : Argument_List
(Binder_Switches.First .. Binder_Switches.Last);
begin
-- Get all the binder switches
for J in Binder_Switches.First .. Binder_Switches.Last loop
Args (J) := Binder_Switches.Table (J);
end loop;
if Main_Project /= No_Project then
-- Put all the source directories in ADA_INCLUDE_PATH,
-- and all the object directories in ADA_OBJECTS_PATH
Set_Ada_Paths (Main_Project, False);
end if;
Bind (Main_ALI_File, Args);
end Bind_Step;
end if;
if Do_Link_Step then
Link_Step : declare
There_Are_Libraries : Boolean := False;
Linker_Switches_Last : constant Integer := Linker_Switches.Last;
begin
if Main_Project /= No_Project then
if MLib.Tgt.Libraries_Are_Supported then
Set_Libraries (Main_Project, There_Are_Libraries);
end if;
if There_Are_Libraries then
-- Add -L<lib_dir> -lgnarl -lgnat -Wl,-rpath,<lib_dir>
Linker_Switches.Increment_Last;
Linker_Switches.Table (Linker_Switches.Last) :=
new String'("-L" & MLib.Utl.Lib_Directory);
Linker_Switches.Increment_Last;
Linker_Switches.Table (Linker_Switches.Last) :=
new String'("-lgnarl");
Linker_Switches.Increment_Last;
Linker_Switches.Table (Linker_Switches.Last) :=
new String'("-lgnat");
declare
Option : constant String_Access :=
MLib.Tgt.Linker_Library_Path_Option
(MLib.Utl.Lib_Directory);
begin
if Option /= null then
Linker_Switches.Increment_Last;
Linker_Switches.Table (Linker_Switches.Last) :=
Option;
end if;
end;
end if;
-- Put the object directories in ADA_OBJECTS_PATH
Set_Ada_Paths (Main_Project, False);
end if;
declare
Args : Argument_List
(Linker_Switches.First .. Linker_Switches.Last + 2);
Last_Arg : Integer := Linker_Switches.First - 1;
Skip : Boolean := False;
begin
-- Get all the linker switches
for J in Linker_Switches.First .. Linker_Switches.Last loop
if Skip then
Skip := False;
elsif Non_Std_Executable
and then Linker_Switches.Table (J).all = "-o"
then
Skip := True;
else
Last_Arg := Last_Arg + 1;
Args (Last_Arg) := Linker_Switches.Table (J);
end if;
end loop;
-- And invoke the linker
if Non_Std_Executable then
Last_Arg := Last_Arg + 1;
Args (Last_Arg) := new String'("-o");
Last_Arg := Last_Arg + 1;
Args (Last_Arg) :=
new String'(Get_Name_String (Executable));
Link (Main_ALI_File, Args (Args'First .. Last_Arg));
else
Link
(Main_ALI_File,
Args (Args'First .. Last_Arg));
end if;
end;
Linker_Switches.Set_Last (Linker_Switches_Last);
end Link_Step;
end if;
-- We go to here when we skip the bind and link steps.
<<Next_Main>>
-- We go to the next main, if we did not process the last one
if N_File < Osint.Number_Of_Files then
Main_Source_File := Next_Main_Source;
if Main_Project /= No_Project then
-- Find the file name of the main unit
declare
Main_Source_File_Name : constant String :=
Get_Name_String (Main_Source_File);
Main_Unit_File_Name : constant String :=
Prj.Env.
File_Name_Of_Library_Unit_Body
(Name => Main_Source_File_Name,
Project => Main_Project);
begin
-- We fail if we cannot find the main source file
-- as an immediate source of the main project file.
if Main_Unit_File_Name = "" then
Fail ('"' & Main_Source_File_Name &
""" is not a unit of project " &
Project_File_Name.all & ".");
else
-- Remove any directory information from the main
-- source file name.
declare
Pos : Natural := Main_Unit_File_Name'Last;
begin
loop
exit when Pos < Main_Unit_File_Name'First
or else
Main_Unit_File_Name (Pos) = Directory_Separator;
Pos := Pos - 1;
end loop;
Name_Len := Main_Unit_File_Name'Last - Pos;
Name_Buffer (1 .. Name_Len) :=
Main_Unit_File_Name
(Pos + 1 .. Main_Unit_File_Name'Last);
Main_Source_File := Name_Find;
end;
end if;
end;
end if;
end if;
end loop Multiple_Main_Loop;
-- Delete the temporary mapping file that was created if we are
-- using project files.
if Main_Project /= No_Project then
declare
Success : Boolean;
begin
Delete_File (Name => Mapping_File_Name, Success => Success);
end;
end if;
Exit_Program (E_Success);
exception
when Bind_Failed =>
Osint.Fail ("*** bind failed.");
when Compilation_Failed =>
Exit_Program (E_Fatal);
when Link_Failed =>
Osint.Fail ("*** link failed.");
when X : others =>
Write_Line (Exception_Information (X));
Osint.Fail ("INTERNAL ERROR. Please report.");
end Gnatmake;
--------------------
-- In_Ada_Lib_Dir --
--------------------
function In_Ada_Lib_Dir (File : File_Name_Type) return Boolean is
D : constant Name_Id := Get_Directory (File);
B : constant Byte := Get_Name_Table_Byte (D);
begin
return (B and Ada_Lib_Dir) /= 0;
end In_Ada_Lib_Dir;
------------
-- Inform --
------------
procedure Inform (N : Name_Id := No_Name; Msg : String) is
begin
Osint.Write_Program_Name;
Write_Str (": ");
if N /= No_Name then
Write_Str ("""");
Write_Name (N);
Write_Str (""" ");
end if;
Write_Str (Msg);
Write_Eol;
end Inform;
------------
-- Init_Q --
------------
procedure Init_Q is
begin
First_Q_Initialization := False;
Q_Front := Q.First;
Q.Set_Last (Q.First);
end Init_Q;
----------------
-- Initialize --
----------------
procedure Initialize is
Next_Arg : Positive;
begin
-- Override default initialization of Check_Object_Consistency
-- since this is normally False for GNATBIND, but is True for
-- GNATMAKE since we do not need to check source consistency
-- again once GNATMAKE has looked at the sources to check.
Opt.Check_Object_Consistency := True;
-- Package initializations. The order of calls is important here.
Output.Set_Standard_Error;
Osint.Initialize (Osint.Make);
Gcc_Switches.Init;
Binder_Switches.Init;
Linker_Switches.Init;
Csets.Initialize;
Namet.Initialize;
Snames.Initialize;
Prj.Initialize;
Next_Arg := 1;
Scan_Args : while Next_Arg <= Argument_Count loop
Scan_Make_Arg (Argument (Next_Arg), And_Save => True);
Next_Arg := Next_Arg + 1;
end loop Scan_Args;
if Usage_Requested then
Makeusg;
end if;
-- Test for trailing -o switch
if Opt.Output_File_Name_Present
and then not Output_File_Name_Seen
then
Fail ("output file name missing after -o");
end if;
if Project_File_Name /= null then
-- A project file was specified by a -P switch
if Opt.Verbose_Mode then
Write_Eol;
Write_Str ("Parsing Project File """);
Write_Str (Project_File_Name.all);
Write_Str (""".");
Write_Eol;
end if;
-- Avoid looking in the current directory for ALI files
-- Opt.Look_In_Primary_Dir := False;
-- Set the project parsing verbosity to whatever was specified
-- by a possible -vP switch.
Prj.Pars.Set_Verbosity (To => Current_Verbosity);
-- Parse the project file.
-- If there is an error, Main_Project will still be No_Project.
Prj.Pars.Parse
(Project => Main_Project,
Project_File_Name => Project_File_Name.all);
if Main_Project = No_Project then
Fail ("""" & Project_File_Name.all &
""" processing failed");
end if;
if Opt.Verbose_Mode then
Write_Eol;
Write_Str ("Parsing of Project File """);
Write_Str (Project_File_Name.all);
Write_Str (""" is finished.");
Write_Eol;
end if;
-- We add the source directories and the object directories
-- to the search paths.
Add_Source_Directories (Main_Project);
Add_Object_Directories (Main_Project);
end if;
Osint.Add_Default_Search_Dirs;
-- Mark the GNAT libraries if needed.
-- Source file lookups should be cached for efficiency.
-- Source files are not supposed to change.
Osint.Source_File_Data (Cache => True);
-- Read gnat.adc file to initialize Fname.UF
Fname.UF.Initialize;
begin
Fname.SF.Read_Source_File_Name_Pragmas;
exception
when Err : SFN_Scan.Syntax_Error_In_GNAT_ADC =>
Osint.Fail (Exception_Message (Err));
end;
end Initialize;
-----------------------------------
-- Insert_Project_Sources_Into_Q --
-----------------------------------
procedure Insert_Project_Sources
(The_Project : Project_Id;
Into_Q : Boolean)
is
Unit : Com.Unit_Data;
Sfile : Name_Id;
begin
-- For all the sources in the project files,
for Id in Com.Units.First .. Com.Units.Last loop
Unit := Com.Units.Table (Id);
Sfile := No_Name;
-- If there is a source for the body,
if Unit.File_Names (Com.Body_Part).Name /= No_Name then
-- And it is a source of the specified project
if Unit.File_Names (Com.Body_Part).Project = The_Project then
-- If we don't have a spec, we cannot consider the source
-- if it is a subunit
if Unit.File_Names (Com.Specification).Name = No_Name then
declare
Src_Ind : Source_File_Index;
begin
Src_Ind := Sinput.L.Load_Source_File
(Unit.File_Names (Com.Body_Part).Name);
-- If it is a subunit, discard it
if Sinput.L.Source_File_Is_Subunit (Src_Ind) then
Sfile := No_Name;
else
Sfile := Unit.File_Names (Com.Body_Part).Name;
end if;
end;
else
Sfile := Unit.File_Names (Com.Body_Part).Name;
end if;
end if;
elsif Unit.File_Names (Com.Specification).Name /= No_Name
and then Unit.File_Names (Com.Specification).Project = The_Project
then
-- If there is no source for the body, but there is a source
-- for the spec, then we take this one.
Sfile := Unit.File_Names (Com.Specification).Name;
end if;
-- If Into_Q is True, we insert into the Q
if Into_Q then
-- For the first source inserted into the Q, we need
-- to initialize the Q, but not for the subsequent sources.
if First_Q_Initialization then
Init_Q;
end if;
-- And of course, we only insert in the Q if the source
-- is not marked.
if Sfile /= No_Name and then not Is_Marked (Sfile) then
Insert_Q (Sfile);
Mark (Sfile);
end if;
elsif Sfile /= No_Name then
-- If Into_Q is False, we add the source as it it were
-- specified on the command line.
Osint.Add_File (Get_Name_String (Sfile));
end if;
end loop;
end Insert_Project_Sources;
--------------
-- Insert_Q --
--------------
procedure Insert_Q
(Source_File : File_Name_Type;
Source_Unit : Unit_Name_Type := No_Name)
is
begin
if Debug.Debug_Flag_Q then
Write_Str (" Q := Q + [ ");
Write_Name (Source_File);
Write_Str (" ] ");
Write_Eol;
end if;
Q.Table (Q.Last).File := Source_File;
Q.Table (Q.Last).Unit := Source_Unit;
Q.Increment_Last;
end Insert_Q;
----------------------------
-- Is_External_Assignment --
----------------------------
function Is_External_Assignment (Argv : String) return Boolean is
Start : Positive := 3;
Finish : Natural := Argv'Last;
Equal_Pos : Natural;
begin
if Argv'Last < 5 then
return False;
elsif Argv (3) = '"' then
if Argv (Argv'Last) /= '"' or else Argv'Last < 7 then
return False;
else
Start := 4;
Finish := Argv'Last - 1;
end if;
end if;
Equal_Pos := Start;
while Equal_Pos <= Finish and then Argv (Equal_Pos) /= '=' loop
Equal_Pos := Equal_Pos + 1;
end loop;
if Equal_Pos = Start
or else Equal_Pos >= Finish
then
return False;
else
Prj.Ext.Add
(External_Name => Argv (Start .. Equal_Pos - 1),
Value => Argv (Equal_Pos + 1 .. Finish));
return True;
end if;
end Is_External_Assignment;
---------------
-- Is_Marked --
---------------
function Is_Marked (Source_File : File_Name_Type) return Boolean is
begin
return Get_Name_Table_Byte (Source_File) /= 0;
end Is_Marked;
----------
-- Link --
----------
procedure Link (ALI_File : File_Name_Type; Args : Argument_List) is
Link_Args : Argument_List (Args'First .. Args'Last + 1);
Success : Boolean;
begin
Link_Args (Args'Range) := Args;
Get_Name_String (ALI_File);
Link_Args (Args'Last + 1) := new String'(Name_Buffer (1 .. Name_Len));
Display (Gnatlink.all, Link_Args);
if Gnatlink_Path = null then
Osint.Fail ("error, unable to locate " & Gnatlink.all);
end if;
GNAT.OS_Lib.Spawn (Gnatlink_Path.all, Link_Args, Success);
if not Success then
raise Link_Failed;
end if;
end Link;
---------------------------
-- List_Bad_Compilations --
---------------------------
procedure List_Bad_Compilations is
begin
for J in Bad_Compilation.First .. Bad_Compilation.Last loop
if Bad_Compilation.Table (J).File = No_File then
null;
elsif not Bad_Compilation.Table (J).Found then
Inform (Bad_Compilation.Table (J).File, "not found");
else
Inform (Bad_Compilation.Table (J).File, "compilation error");
end if;
end loop;
end List_Bad_Compilations;
-----------------
-- List_Depend --
-----------------
procedure List_Depend is
Lib_Name : Name_Id;
Obj_Name : Name_Id;
Src_Name : Name_Id;
Len : Natural;
Line_Pos : Natural;
Line_Size : constant := 77;
begin
Set_Standard_Output;
for A in ALIs.First .. ALIs.Last loop
Lib_Name := ALIs.Table (A).Afile;
-- We have to provide the full library file name in In_Place_Mode
if Opt.In_Place_Mode then
Lib_Name := Full_Lib_File_Name (Lib_Name);
end if;
Obj_Name := Object_File_Name (Lib_Name);
Write_Name (Obj_Name);
Write_Str (" :");
Get_Name_String (Obj_Name);
Len := Name_Len;
Line_Pos := Len + 2;
for D in ALIs.Table (A).First_Sdep .. ALIs.Table (A).Last_Sdep loop
Src_Name := Sdep.Table (D).Sfile;
if Is_Internal_File_Name (Src_Name)
and then not Check_Readonly_Files
then
null;
else
if not Opt.Quiet_Output then
Src_Name := Full_Source_Name (Src_Name);
end if;
Get_Name_String (Src_Name);
Len := Name_Len;
if Line_Pos + Len + 1 > Line_Size then
Write_Str (" \");
Write_Eol;
Line_Pos := 0;
end if;
Line_Pos := Line_Pos + Len + 1;
Write_Str (" ");
Write_Name (Src_Name);
end if;
end loop;
Write_Eol;
end loop;
Set_Standard_Error;
end List_Depend;
----------
-- Mark --
----------
procedure Mark (Source_File : File_Name_Type) is
begin
Set_Name_Table_Byte (Source_File, 1);
end Mark;
-------------------
-- Mark_Dir_Path --
-------------------
procedure Mark_Dir_Path
(Path : String_Access;
Mark : Lib_Mark_Type)
is
Dir : String_Access;
begin
if Path /= null then
Osint.Get_Next_Dir_In_Path_Init (Path);
loop
Dir := Osint.Get_Next_Dir_In_Path (Path);
exit when Dir = null;
Mark_Directory (Dir.all, Mark);
end loop;
end if;
end Mark_Dir_Path;
--------------------
-- Mark_Directory --
--------------------
procedure Mark_Directory
(Dir : String;
Mark : Lib_Mark_Type)
is
N : Name_Id;
B : Byte;
begin
-- Dir last character is supposed to be a directory separator.
Name_Len := Dir'Length;
Name_Buffer (1 .. Name_Len) := Dir;
if not Is_Directory_Separator (Name_Buffer (Name_Len)) then
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := Directory_Separator;
end if;
-- Add flags to the already existing flags
N := Name_Find;
B := Get_Name_Table_Byte (N);
Set_Name_Table_Byte (N, B or Mark);
end Mark_Directory;
----------------------
-- Object_File_Name --
----------------------
function Object_File_Name (Source : String) return String is
Pos : Natural := Source'Last;
begin
while Pos >= Source'First and then
Source (Pos) /= '.' loop
Pos := Pos - 1;
end loop;
if Pos >= Source'First then
Pos := Pos - 1;
end if;
return Source (Source'First .. Pos) & Object_Suffix;
end Object_File_Name;
-------------------
-- Scan_Make_Arg --
-------------------
procedure Scan_Make_Arg (Argv : String; And_Save : Boolean) is
begin
pragma Assert (Argv'First = 1);
if Argv'Length = 0 then
return;
end if;
-- If the previous switch has set the Output_File_Name_Present
-- flag (that is we have seen a -o), then the next argument is
-- the name of the output executable.
if Opt.Output_File_Name_Present and then not Output_File_Name_Seen then
Output_File_Name_Seen := True;
if Argv (1) = Switch_Character or else Argv (1) = '-' then
Fail ("output file name missing after -o");
else
Add_Switch ("-o", Linker, And_Save => And_Save);
-- Automatically add the executable suffix if it has not been
-- specified explicitly.
if Executable_Suffix'Length /= 0
and then Argv (Argv'Last - Executable_Suffix'Length + 1
.. Argv'Last) /= Executable_Suffix
then
Add_Switch
(Argv & Executable_Suffix,
Linker,
And_Save => And_Save);
else
Add_Switch (Argv, Linker, And_Save => And_Save);
end if;
end if;
-- Then check if we are dealing with a -cargs, -bargs or -largs
elsif (Argv (1) = Switch_Character or else Argv (1) = '-')
and then (Argv (2 .. Argv'Last) = "cargs"
or else Argv (2 .. Argv'Last) = "bargs"
or else Argv (2 .. Argv'Last) = "largs"
or else Argv (2 .. Argv'Last) = "margs")
then
case Argv (2) is
when 'c' => Program_Args := Compiler;
when 'b' => Program_Args := Binder;
when 'l' => Program_Args := Linker;
when 'm' => Program_Args := None;
when others =>
raise Program_Error;
end case;
-- A special test is needed for the -o switch within a -largs
-- since that is another way to specify the name of the final
-- executable.
elsif Program_Args = Linker
and then (Argv (1) = Switch_Character or else Argv (1) = '-')
and then Argv (2 .. Argv'Last) = "o"
then
Fail ("switch -o not allowed within a -largs. Use -o directly.");
-- Check to see if we are reading switches after a -cargs,
-- -bargs or -largs switch. If yes save it.
elsif Program_Args /= None then
-- Check to see if we are reading -I switches in order
-- to take into account in the src & lib search directories.
if Argv'Length > 2 and then Argv (1 .. 2) = "-I" then
if Argv (3 .. Argv'Last) = "-" then
Opt.Look_In_Primary_Dir := False;
elsif Program_Args = Compiler then
if Argv (3 .. Argv'Last) /= "-" then
Add_Src_Search_Dir (Argv (3 .. Argv'Last));
end if;
elsif Program_Args = Binder then
Add_Lib_Search_Dir (Argv (3 .. Argv'Last));
end if;
end if;
Add_Switch (Argv, Program_Args, And_Save => And_Save);
-- Handle non-default compiler, binder, linker
elsif Argv'Length > 2 and then Argv (1 .. 2) = "--" then
if Argv'Length > 6
and then Argv (1 .. 6) = "--GCC="
then
declare
Program_Args : Argument_List_Access :=
Argument_String_To_List
(Argv (7 .. Argv'Last));
begin
if And_Save then
Saved_Gcc := new String'(Program_Args.all (1).all);
else
Gcc := new String'(Program_Args.all (1).all);
end if;
for J in 2 .. Program_Args.all'Last loop
Add_Switch
(Program_Args.all (J).all,
Compiler,
And_Save => And_Save);
end loop;
end;
elsif Argv'Length > 11
and then Argv (1 .. 11) = "--GNATBIND="
then
declare
Program_Args : Argument_List_Access :=
Argument_String_To_List
(Argv (12 .. Argv'Last));
begin
if And_Save then
Saved_Gnatbind := new String'(Program_Args.all (1).all);
else
Gnatbind := new String'(Program_Args.all (1).all);
end if;
for J in 2 .. Program_Args.all'Last loop
Add_Switch
(Program_Args.all (J).all, Binder, And_Save => And_Save);
end loop;
end;
elsif Argv'Length > 11
and then Argv (1 .. 11) = "--GNATLINK="
then
declare
Program_Args : Argument_List_Access :=
Argument_String_To_List
(Argv (12 .. Argv'Last));
begin
if And_Save then
Saved_Gnatlink := new String'(Program_Args.all (1).all);
else
Gnatlink := new String'(Program_Args.all (1).all);
end if;
for J in 2 .. Program_Args.all'Last loop
Add_Switch (Program_Args.all (J).all, Linker);
end loop;
end;
else
Fail ("unknown switch: ", Argv);
end if;
-- If we have seen a regular switch process it
elsif Argv (1) = Switch_Character or else Argv (1) = '-' then
if Argv'Length = 1 then
Fail ("switch character cannot be followed by a blank");
-- -I-
elsif Argv (2 .. Argv'Last) = "I-" then
Opt.Look_In_Primary_Dir := False;
-- Forbid -?- or -??- where ? is any character
elsif (Argv'Length = 3 and then Argv (3) = '-')
or else (Argv'Length = 4 and then Argv (4) = '-')
then
Fail ("trailing ""-"" at the end of ", Argv, " forbidden.");
-- -Idir
elsif Argv (2) = 'I' then
Add_Src_Search_Dir (Argv (3 .. Argv'Last));
Add_Lib_Search_Dir (Argv (3 .. Argv'Last));
Add_Switch (Argv, Compiler, And_Save => And_Save);
Add_Switch ("-aO" & Argv (3 .. Argv'Last),
Binder,
And_Save => And_Save);
-- No need to pass any source dir to the binder
-- since gnatmake call it with the -x flag
-- (ie do not check source time stamp)
-- -aIdir (to gcc this is like a -I switch)
elsif Argv'Length >= 3 and then Argv (2 .. 3) = "aI" then
Add_Src_Search_Dir (Argv (4 .. Argv'Last));
Add_Switch ("-I" & Argv (4 .. Argv'Last),
Compiler,
And_Save => And_Save);
-- -aOdir
elsif Argv'Length >= 3 and then Argv (2 .. 3) = "aO" then
Add_Lib_Search_Dir (Argv (4 .. Argv'Last));
Add_Switch (Argv, Binder, And_Save => And_Save);
-- -aLdir (to gnatbind this is like a -aO switch)
elsif Argv'Length >= 3 and then Argv (2 .. 3) = "aL" then
Mark_Directory (Argv (4 .. Argv'Last), Ada_Lib_Dir);
Add_Lib_Search_Dir (Argv (4 .. Argv'Last));
Add_Switch ("-aO" & Argv (4 .. Argv'Last),
Binder,
And_Save => And_Save);
-- -Adir (to gnatbind this is like a -aO switch, to gcc like a -I)
elsif Argv (2) = 'A' then
Mark_Directory (Argv (3 .. Argv'Last), Ada_Lib_Dir);
Add_Src_Search_Dir (Argv (3 .. Argv'Last));
Add_Lib_Search_Dir (Argv (3 .. Argv'Last));
Add_Switch ("-I" & Argv (3 .. Argv'Last),
Compiler,
And_Save => And_Save);
Add_Switch ("-aO" & Argv (3 .. Argv'Last),
Binder,
And_Save => And_Save);
-- -Ldir
elsif Argv (2) = 'L' then
Add_Switch (Argv, Linker, And_Save => And_Save);
-- For -gxxxxx,-pg : give the switch to both the compiler and the
-- linker (except for -gnatxxx which is only for the compiler)
elsif
(Argv (2) = 'g' and then (Argv'Last < 5
or else Argv (2 .. 5) /= "gnat"))
or else Argv (2 .. Argv'Last) = "pg"
then
Add_Switch (Argv, Compiler, And_Save => And_Save);
Add_Switch (Argv, Linker, And_Save => And_Save);
-- -d
elsif Argv (2) = 'd'
and then Argv'Last = 2
then
Opt.Display_Compilation_Progress := True;
-- -j (need to save the result)
elsif Argv (2) = 'j' then
Scan_Make_Switches (Argv);
if And_Save then
Saved_Maximum_Processes := Maximum_Processes;
end if;
-- -m
elsif Argv (2) = 'm'
and then Argv'Last = 2
then
Opt.Minimal_Recompilation := True;
-- -u
elsif Argv (2) = 'u'
and then Argv'Last = 2
then
Unique_Compile := True;
Opt.Compile_Only := True;
Do_Bind_Step := False;
Do_Link_Step := False;
-- -Pprj (only once, and only on the command line)
elsif Argv'Last > 2
and then Argv (2) = 'P'
then
if Project_File_Name /= null then
Fail ("cannot have several project files specified");
elsif not And_Save then
-- It could be a tool other than gnatmake (i.e, gnatdist)
-- or a -P switch inside a project file.
Fail
("either the tool is not ""project-aware"" or " &
"a project file is specified inside a project file");
else
Project_File_Name := new String' (Argv (3 .. Argv'Last));
end if;
-- -S (Assemble)
-- Since no object file is created, don't check object
-- consistency.
elsif Argv (2) = 'S'
and then Argv'Last = 2
then
Opt.Check_Object_Consistency := False;
Add_Switch (Argv, Compiler, And_Save => And_Save);
-- -vPx (verbosity of the parsing of the project files)
elsif Argv'Last = 4
and then Argv (2 .. 3) = "vP"
and then Argv (4) in '0' .. '2'
then
if And_Save then
case Argv (4) is
when '0' =>
Current_Verbosity := Prj.Default;
when '1' =>
Current_Verbosity := Prj.Medium;
when '2' =>
Current_Verbosity := Prj.High;
when others =>
null;
end case;
end if;
-- -Wx (need to save the result)
elsif Argv (2) = 'W' then
Scan_Make_Switches (Argv);
if And_Save then
Saved_WC_Encoding_Method := Wide_Character_Encoding_Method;
Saved_WC_Encoding_Method_Set := True;
end if;
-- -Xext=val (External assignment)
elsif Argv (2) = 'X'
and then Is_External_Assignment (Argv)
then
-- Is_External_Assignment has side effects
-- when it returns True;
null;
-- If -gnath is present, then generate the usage information
-- right now for the compiler, and do not pass this option
-- on to the compiler calls.
elsif Argv = "-gnath" then
null;
-- If -gnatc is specified, make sure the bind step and the link
-- step are not executed.
elsif Argv'Length >= 6 and then Argv (2 .. 6) = "gnatc" then
-- If -gnatc is specified, make sure the bind step and the link
-- step are not executed.
Add_Switch (Argv, Compiler, And_Save => And_Save);
Opt.Operating_Mode := Opt.Check_Semantics;
Opt.Check_Object_Consistency := False;
Opt.Compile_Only := True;
Do_Bind_Step := False;
Do_Link_Step := False;
elsif Argv (2 .. Argv'Last) = "nostdlib" then
-- Don't pass -nostdlib to gnatlink, it will disable
-- linking with all standard library files.
Opt.No_Stdlib := True;
Add_Switch (Argv, Binder, And_Save => And_Save);
elsif Argv (2 .. Argv'Last) = "nostdinc" then
-- Pass -nostdinv to the Compiler and to gnatbind
Opt.No_Stdinc := True;
Add_Switch (Argv, Compiler, And_Save => And_Save);
Add_Switch (Argv, Binder, And_Save => And_Save);
-- By default all switches with more than one character
-- or one character switches which are not in 'a' .. 'z'
-- (except 'M') are passed to the compiler, unless we are dealing
-- with a debug switch (starts with 'd')
elsif Argv (2) /= 'd'
and then Argv (2 .. Argv'Last) /= "M"
and then (Argv'Length > 2 or else Argv (2) not in 'a' .. 'z')
then
Add_Switch (Argv, Compiler, And_Save => And_Save);
-- All other options are handled by Scan_Make_Switches
else
Scan_Make_Switches (Argv);
end if;
-- If not a switch it must be a file name
else
Set_Main_File_Name (Argv);
end if;
end Scan_Make_Arg;
-------------------
-- Set_Ada_Paths --
-------------------
procedure Set_Ada_Paths
(For_Project : Prj.Project_Id;
Including_Libraries : Boolean)
is
New_Ada_Include_Path : constant String_Access :=
Prj.Env.Ada_Include_Path (For_Project);
New_Ada_Objects_Path : constant String_Access :=
Prj.Env.Ada_Objects_Path
(For_Project, Including_Libraries);
begin
-- If ADA_INCLUDE_PATH needs to be changed (we are not using the same
-- project file), set the new ADA_INCLUDE_PATH
if New_Ada_Include_Path /= Current_Ada_Include_Path then
Current_Ada_Include_Path := New_Ada_Include_Path;
if Original_Ada_Include_Path'Length = 0 then
Setenv ("ADA_INCLUDE_PATH",
New_Ada_Include_Path.all);
else
-- If there existed an ADA_INCLUDE_PATH at the invocation of
-- gnatmake, concatenate new ADA_INCLUDE_PATH with the original.
Setenv ("ADA_INCLUDE_PATH",
Original_Ada_Include_Path.all &
Path_Separator &
New_Ada_Include_Path.all);
end if;
if Opt.Verbose_Mode then
declare
Include_Path : constant String_Access :=
Getenv ("ADA_INCLUDE_PATH");
begin
-- Display the new ADA_INCLUDE_PATH
Write_Str ("ADA_INCLUDE_PATH = """);
Prj.Util.Write_Str
(S => Include_Path.all,
Max_Length => Max_Line_Length,
Separator => Path_Separator);
Write_Str ("""");
Write_Eol;
end;
end if;
end if;
-- If ADA_OBJECTS_PATH needs to be changed (we are not using the same
-- project file), set the new ADA_OBJECTS_PATH
if New_Ada_Objects_Path /= Current_Ada_Objects_Path then
Current_Ada_Objects_Path := New_Ada_Objects_Path;
if Original_Ada_Objects_Path'Length = 0 then
Setenv ("ADA_OBJECTS_PATH",
New_Ada_Objects_Path.all);
else
-- If there existed an ADA_OBJECTS_PATH at the invocation of
-- gnatmake, concatenate new ADA_OBJECTS_PATH with the original.
Setenv ("ADA_OBJECTS_PATH",
Original_Ada_Objects_Path.all &
Path_Separator &
New_Ada_Objects_Path.all);
end if;
if Opt.Verbose_Mode then
declare
Objects_Path : constant String_Access :=
Getenv ("ADA_OBJECTS_PATH");
begin
-- Display the new ADA_OBJECTS_PATH
Write_Str ("ADA_OBJECTS_PATH = """);
Prj.Util.Write_Str
(S => Objects_Path.all,
Max_Length => Max_Line_Length,
Separator => Path_Separator);
Write_Str ("""");
Write_Eol;
end;
end if;
end if;
end Set_Ada_Paths;
---------------------
-- Set_Library_For --
---------------------
procedure Set_Library_For
(Project : Project_Id;
There_Are_Libraries : in out Boolean)
is
begin
-- Case of library project
if Projects.Table (Project).Library then
There_Are_Libraries := True;
-- Add the -L switch
Linker_Switches.Increment_Last;
Linker_Switches.Table (Linker_Switches.Last) :=
new String'("-L" &
Get_Name_String
(Projects.Table (Project).Library_Dir));
-- Add the -l switch
Linker_Switches.Increment_Last;
Linker_Switches.Table (Linker_Switches.Last) :=
new String'("-l" &
Get_Name_String
(Projects.Table (Project).Library_Name));
-- Add the Wl,-rpath switch if library non static
if Projects.Table (Project).Library_Kind /= Static then
declare
Option : constant String_Access :=
MLib.Tgt.Linker_Library_Path_Option
(Get_Name_String
(Projects.Table (Project).Library_Dir));
begin
if Option /= null then
Linker_Switches.Increment_Last;
Linker_Switches.Table (Linker_Switches.Last) :=
Option;
end if;
end;
end if;
end if;
end Set_Library_For;
-----------------
-- Switches_Of --
-----------------
function Switches_Of
(Source_File : Name_Id;
Source_File_Name : String;
Naming : Naming_Data;
In_Package : Package_Id;
Allow_ALI : Boolean)
return Variable_Value
is
Switches : Variable_Value;
Defaults : constant Array_Element_Id :=
Prj.Util.Value_Of
(Name => Name_Default_Switches,
In_Arrays =>
Packages.Table (In_Package).Decl.Arrays);
Switches_Array : constant Array_Element_Id :=
Prj.Util.Value_Of
(Name => Name_Switches,
In_Arrays =>
Packages.Table (In_Package).Decl.Arrays);
begin
Switches :=
Prj.Util.Value_Of
(Index => Source_File,
In_Array => Switches_Array);
if Switches = Nil_Variable_Value then
declare
Name : String (1 .. Source_File_Name'Length + 3);
Last : Positive := Source_File_Name'Length;
Spec_Suffix : constant String :=
Get_Name_String (Naming.Current_Spec_Suffix);
Impl_Suffix : constant String :=
Get_Name_String (Naming.Current_Impl_Suffix);
Truncated : Boolean := False;
begin
Name (1 .. Last) := Source_File_Name;
if Last > Impl_Suffix'Length
and then Name (Last - Impl_Suffix'Length + 1 .. Last) =
Impl_Suffix
then
Truncated := True;
Last := Last - Impl_Suffix'Length;
end if;
if not Truncated
and then Last > Spec_Suffix'Length
and then Name (Last - Spec_Suffix'Length + 1 .. Last) =
Spec_Suffix
then
Truncated := True;
Last := Last - Spec_Suffix'Length;
end if;
if Truncated then
Name_Len := Last;
Name_Buffer (1 .. Name_Len) := Name (1 .. Last);
Switches :=
Prj.Util.Value_Of
(Index => Name_Find,
In_Array => Switches_Array);
if Switches = Nil_Variable_Value then
Last := Source_File_Name'Length;
while Name (Last) /= '.' loop
Last := Last - 1;
end loop;
Name (Last + 1 .. Last + 3) := "ali";
Name_Len := Last + 3;
Name_Buffer (1 .. Name_Len) := Name (1 .. Name_Len);
Switches :=
Prj.Util.Value_Of
(Index => Name_Find,
In_Array => Switches_Array);
end if;
end if;
end;
end if;
if Switches = Nil_Variable_Value then
Switches := Prj.Util.Value_Of
(Index => Name_Ada, In_Array => Defaults);
end if;
return Switches;
end Switches_Of;
---------------------------
-- Test_If_Relative_Path --
---------------------------
procedure Test_If_Relative_Path (Switch : String_Access) is
begin
if Switch /= null then
declare
Sw : String (1 .. Switch'Length);
Start : Positive;
begin
Sw := Switch.all;
if Sw (1) = '-' then
if Sw'Length >= 3
and then (Sw (2) = 'A'
or else Sw (2) = 'I'
or else Sw (2) = 'L')
then
Start := 3;
if Sw = "-I-" then
return;
end if;
elsif Sw'Length >= 4
and then (Sw (2 .. 3) = "aL"
or else Sw (2 .. 3) = "aO"
or else Sw (2 .. 3) = "aI")
then
Start := 4;
else
return;
end if;
if not Is_Absolute_Path (Sw (Start .. Sw'Last)) then
Fail ("relative search path switches (""" &
Sw & """) are not allowed when using project files");
end if;
end if;
end;
end if;
end Test_If_Relative_Path;
------------
-- Unmark --
------------
procedure Unmark (Source_File : File_Name_Type) is
begin
Set_Name_Table_Byte (Source_File, 0);
end Unmark;
-----------------
-- Verbose_Msg --
-----------------
procedure Verbose_Msg
(N1 : Name_Id;
S1 : String;
N2 : Name_Id := No_Name;
S2 : String := "";
Prefix : String := " -> ")
is
begin
if not Opt.Verbose_Mode then
return;
end if;
Write_Str (Prefix);
Write_Str ("""");
Write_Name (N1);
Write_Str (""" ");
Write_Str (S1);
if N2 /= No_Name then
Write_Str (" """);
Write_Name (N2);
Write_Str (""" ");
end if;
Write_Str (S2);
Write_Eol;
end Verbose_Msg;
end Make;
|
with vectores; use vectores;
function esta_en_vector_ordenado (n: in Integer; V: in Vector_De_Enteros) return Boolean is
-- pre: V contiene al menos un elemento (V'Last >= 1)
-- V esta ordenado ascendentemente:
-- V(i) <= V(i+1), 1 <= i < V'last
-- post: el resultado es True si N esta en V y False si no
-- El algoritmo es eficiente aprovechando que V esta ordenado
rdo: Boolean;
I: Integer;
begin
rdo:= False;
I:= V'First;
while (rdo=False and I<=V'Last) and then n>=V(I) loop
if V(I)=n then
rdo:= True;
end if;
I:=I+1;
end loop;
return rdo;
end esta_en_vector_ordenado;
|
------------------------------------------------------------------------------
-- G E L A A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
-- Purpose:
with Gela.Embeded_Links.Caches;
generic
type Element is private;
type Hash_Type is range <>;
with function Hash (Item : Element) return Hash_Type is <>;
with function "=" (Left, Right : Element) return Boolean is <>;
package Gela.Containers.Caches is
type Cache (Size : Hash_Type) is limited private;
function Preferred_Size (Size : Hash_Type) return Hash_Type;
procedure Add
(Container : in out Cache;
Object : in Element);
procedure Remove
(Container : in out Cache;
Object : in Element);
procedure Find
(Container : in out Cache;
Object : in out Element;
Found : out Boolean;
Touch : in Boolean := True);
private
type Node;
type Node_Access is access all Node;
type Node is record
Next_Hash : Node_Access;
Next : Node_Access;
Prev : Node_Access;
Data : Element;
end record;
function Hash (Object : Node) return Hash_Type;
function Get_Next_Hash (Item : Node_Access) return Node_Access;
procedure Set_Next_Hash (Item, Next : Node_Access);
function Get_Next (Item : Node_Access) return Node_Access;
procedure Set_Next (Item, Next : Node_Access);
function Get_Prev (Item : Node_Access) return Node_Access;
procedure Set_Prev (Item, Prev : Node_Access);
function "=" (Left, Right : Node) return Boolean;
pragma Inline (Hash);
pragma Inline (Get_Next_Hash);
pragma Inline (Set_Next_Hash);
pragma Inline (Get_Next);
pragma Inline (Set_Next);
pragma Inline (Get_Prev);
pragma Inline (Set_Prev);
pragma Inline ("=");
package EL_Caches is
new Gela.Embeded_Links.Caches (Node, Node_Access, Hash_Type);
type Cache (Size : Hash_Type) is record
Data : EL_Caches.Cache (Size);
Free : Node_Access;
end record;
end Gela.Containers.Caches;
------------------------------------------------------------------------------
-- Copyright (c) 2006, Maxim Reznik
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * Neither the name of the Maxim Reznik, IE nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
|
with
interfaces.C,
ada.Streams.Stream_IO,
ada.Containers.Vectors,
ada.Containers.Hashed_Maps,
ada.Unchecked_Conversion,
ada.Directories,
System.Parameters;
with Ada.Text_IO;
package body AdaM.Factory
is
type Storer is access procedure;
type Restorer is access procedure;
package storer_Vectors is new ada.Containers.Vectors (Positive, Storer);
package restorer_Vectors is new ada.Containers.Vectors (Positive, Restorer);
all_Storers : storer_Vectors.Vector;
all_Restorers : restorer_Vectors.Vector;
procedure register_Storer (the_Storer : access procedure)
is
begin
all_Storers.append (the_Storer);
end register_Storer;
procedure register_Restorer (the_Restorer : access procedure)
is
begin
all_Restorers.append (the_Restorer);
end register_Restorer;
type to_View_function is access function (Id : in AdaM.Id) return Any_view;
function Hash is new ada.Unchecked_Conversion (ada.Tags.Tag, ada.Containers.Hash_Type);
use type ada.Tags.Tag;
package tag_Maps_of_to_View_function is new ada.Containers.Hashed_Maps (Key_Type => ada.Tags.Tag,
Element_Type => to_View_function,
Hash => Hash,
Equivalent_Keys => "=");
tag_Map_of_to_View_function : tag_Maps_of_to_View_function.Map;
procedure register_to_view_Function (the_Tag : in ada.Tags.Tag;
the_Function : access function (Id : in AdaM.Id) return Any_view)
is
begin
tag_Map_of_to_View_function.insert (the_Tag, the_Function);
end register_to_view_Function;
function to_View (Id : in AdaM.Id; Tag : in ada.Tags.Tag) return Any_view
is
use tag_Maps_of_to_View_function;
the_Function : constant to_View_function := Element (tag_Map_of_to_View_function.Find (Tag));
begin
return the_Function (Id);
end to_View;
-- Pools
--
package body Pools
is
use Interfaces.C;
-- Arrays and Pointers for our Pool.
--
subtype item_Id is AdaM.Id range 1 .. AdaM.Id'Last;
type Items is array (item_Id range <>) of aliased Item;
type Addr is mod 2 ** System.Parameters.ptr_bits;
function to_Addr is new Ada.Unchecked_Conversion (View, Addr);
function to_Ptrdiff is new Ada.Unchecked_Conversion (Addr, Interfaces.C.ptrdiff_t);
Elmt_Size : constant ptrdiff_t := (Items'Component_Size + System.Storage_Unit - 1)
/ System.Storage_Unit;
function "-" (Left : in View;
Right : in View) return ptrdiff_t
is
begin
if Left = null
or else Right = null
then
raise constraint_Error;
end if;
return To_Ptrdiff (To_Addr (Left) - To_Addr (Right))
/ Elmt_Size;
end "-";
-- The storage pool.
--
Pool : Items (1 .. item_Id (max_Items));
pool_Last : AdaM.Id := null_Id;
stored_record_Version : Positive;
function storage_record_Version return Positive
is
begin
return stored_record_Version;
end storage_record_Version;
package view_Vectors is new ada.Containers.Vectors (Positive, View);
freed_Views : view_Vectors.Vector;
-- 'View' to 'Id' Resolution.
--
function to_View (Id : in AdaM.Id) return View
is
begin
return Pool (Id)'Access;
end to_View;
function to_View (Id : in AdaM.Id) return Any_view
is
begin
if Id not in item_Id
then
raise Constraint_Error with "AdaM.Factory ~ Bad pool Id (" & item_Id'Image (Id) & ") for pool " & pool_Name;
end if;
declare
the_View : constant View := Pool (Id)'Access;
begin
return Any_view (the_View);
end;
end to_View;
function to_Id (From : in View) return AdaM.Id
is
Start : constant View := Pool (Pool'First)'Access;
the_Id : constant AdaM.Id := AdaM.Id (From - Start) + 1;
begin
if the_Id not in item_Id
then
raise Constraint_Error with "AdaM.Factory ~ Bad pool Id (" & item_Id'Image (the_Id) & ") for pool " & pool_Name;
end if;
return the_Id;
end to_Id;
function new_Item return View
is
new_View : View;
begin
if freed_Views.Is_Empty
then
pool_Last := pool_Last + 1;
new_View := Pool (pool_Last)'Access;
else
new_View := freed_Views.last_Element;
freed_Views.delete_Last;
end if;
return new_View;
end new_Item;
procedure free (Self : in out View)
is
begin
freed_Views.append (Self);
Self := null;
end free;
-- Persistence
--
procedure restore
is
begin
ada.Text_IO.put ("Restoring pool " & pool_Name);
-- Restore storage pool state.
--
declare
use Ada.Streams.Stream_IO;
the_File : File_Type;
the_Stream : Stream_access;
begin
open (the_File, in_File, storage_Folder & "/" & pool_Name & ".pool-state");
the_Stream := Stream (the_File);
Positive 'read (the_Stream, stored_record_Version);
AdaM.Id 'read (the_Stream, pool_Last);
view_Vectors.Vector'read (the_Stream, freed_Views);
close (the_File);
exception
when Name_Error =>
null;
end;
-- Restore storage pool array.
--
declare
use ada.Streams.Stream_IO;
the_File : File_Type;
the_Stream : Stream_access;
begin
open (the_File, in_File, storage_Folder & "/" & pool_Name & ".pool-store");
the_Stream := Stream (the_File);
for i in 1 .. pool_Last
loop
declare
use view_Vectors;
Cursor : constant view_Vectors.Cursor := freed_Views.Find (to_View (i));
begin
if not has_Element (Cursor)
then
Item'read (the_Stream, Pool (i));
end if;
end;
end loop;
close (the_File);
exception
when Name_Error =>
null;
end;
ada.Text_IO.put_Line ("... restored");
end restore;
procedure store
is
begin
-- Store storage pool array.
--
declare
use ada.Streams.Stream_IO;
the_File : File_Type;
the_Stream : Stream_access;
begin
create (the_File, out_File, storage_Folder & "/" & pool_Name & ".pool-store");
the_Stream := Stream (the_File);
for i in 1 .. pool_Last
loop
declare
use view_Vectors;
Cursor : constant view_Vectors.Cursor := freed_Views.Find (to_View (i));
begin
if not has_Element (Cursor)
then
Item'write (the_Stream, Pool (i));
end if;
end;
end loop;
close (the_File);
end;
-- Store storage pool state.
--
declare
use ada.Streams.Stream_IO;
the_File : File_Type;
the_Stream : Stream_access;
begin
create (the_File, out_File, storage_Folder & "/" & pool_Name & ".pool-state");
the_Stream := Stream (the_File);
Positive 'write (the_Stream, record_Version);
AdaM.Id 'write (the_Stream, pool_Last);
view_Vectors.Vector'write (the_Stream, freed_Views);
close (the_File);
end;
end store;
-- View Streaming
--
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View)
is
use Ada.Tags;
begin
if Self = null
then
AdaM.Id'write (Stream, null_Id);
return;
end if;
AdaM.Id'write (Stream, Self.Id);
String 'output (Stream, external_Tag (Self.all'Tag));
end View_write;
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View)
is
Id : AdaM.Id;
begin
AdaM.Id'read (Stream, Id);
if Id = null_Id
then
Self := null;
return;
end if;
declare
use Ada.Tags;
the_String : constant String := String'Input (Stream); -- Read tag as string from stream.
the_Tag : constant Tag := Descendant_Tag (the_String, Item'Tag); -- Convert to a tag.
begin
Self := View (AdaM.Factory.to_View (Id, the_Tag));
end;
end View_read;
use Ada.Directories;
begin
register_Storer ( store'Access);
register_Restorer (restore'Access);
register_to_view_Function (Item'Tag, Pools.to_View'Access);
if not Exists (storage_Folder)
then
create_Directory (storage_Folder);
end if;
end Pools;
procedure close
is
use storer_Vectors;
Cursor : storer_Vectors.Cursor := all_Storers.First;
begin
while has_Element (Cursor)
loop
Element (Cursor).all;
next (Cursor);
end loop;
end close;
procedure open
is
use restorer_Vectors;
Cursor : restorer_Vectors.Cursor := all_Restorers.First;
begin
while has_Element (Cursor)
loop
Element (Cursor).all;
next (Cursor);
end loop;
end open;
end AdaM.Factory;
|
-----------------------------------------------------------------------
-- AWA.Permissions.Models -- AWA.Permissions.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 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.
-----------------------------------------------------------------------
pragma Warnings (Off);
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with ADO.Queries;
with ADO.Queries.Loaders;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Basic.Lists;
pragma Warnings (On);
package AWA.Permissions.Models is
pragma Style_Checks ("-mr");
type ACL_Ref is new ADO.Objects.Object_Ref with null record;
type Permission_Ref is new ADO.Objects.Object_Ref with null record;
-- --------------------
-- The ACL table records permissions which are granted for a user to access a given database entity.
-- --------------------
-- Create an object key for ACL.
function ACL_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for ACL from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function ACL_Key (Id : in String) return ADO.Objects.Object_Key;
Null_ACL : constant ACL_Ref;
function "=" (Left, Right : ACL_Ref'Class) return Boolean;
-- Set the ACL identifier
procedure Set_Id (Object : in out Acl_Ref;
Value : in ADO.Identifier);
-- Get the ACL identifier
function Get_Id (Object : in Acl_Ref)
return ADO.Identifier;
-- Set the entity identifier to which the ACL applies
procedure Set_Entity_Id (Object : in out Acl_Ref;
Value : in ADO.Identifier);
-- Get the entity identifier to which the ACL applies
function Get_Entity_Id (Object : in Acl_Ref)
return ADO.Identifier;
-- Set the writeable flag
procedure Set_Writeable (Object : in out Acl_Ref;
Value : in Boolean);
-- Get the writeable flag
function Get_Writeable (Object : in Acl_Ref)
return Boolean;
--
procedure Set_User_Id (Object : in out Acl_Ref;
Value : in ADO.Identifier);
--
function Get_User_Id (Object : in Acl_Ref)
return ADO.Identifier;
--
procedure Set_Workspace_Id (Object : in out Acl_Ref;
Value : in ADO.Identifier);
--
function Get_Workspace_Id (Object : in Acl_Ref)
return ADO.Identifier;
-- Set the entity type concerned by the ACL.
procedure Set_Entity_Type (Object : in out Acl_Ref;
Value : in ADO.Entity_Type);
-- Get the entity type concerned by the ACL.
function Get_Entity_Type (Object : in Acl_Ref)
return ADO.Entity_Type;
-- Set the permission that is granted.
procedure Set_Permission (Object : in out Acl_Ref;
Value : in ADO.Identifier);
-- Get the permission that is granted.
function Get_Permission (Object : in Acl_Ref)
return ADO.Identifier;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Acl_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Acl_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Acl_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Acl_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Acl_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Acl_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
ACL_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Acl_Ref);
-- Copy of the object.
procedure Copy (Object : in Acl_Ref;
Into : in out Acl_Ref);
-- --------------------
-- The permission table lists all the application permissions that are defined.
-- This is a system table shared by every user and workspace.
-- The list of permission is fixed and never changes.
-- --------------------
-- Create an object key for Permission.
function Permission_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Permission from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Permission_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Permission : constant Permission_Ref;
function "=" (Left, Right : Permission_Ref'Class) return Boolean;
-- Set the permission database identifier.
procedure Set_Id (Object : in out Permission_Ref;
Value : in ADO.Identifier);
-- Get the permission database identifier.
function Get_Id (Object : in Permission_Ref)
return ADO.Identifier;
-- Set the permission name
procedure Set_Name (Object : in out Permission_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Permission_Ref;
Value : in String);
-- Get the permission name
function Get_Name (Object : in Permission_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Permission_Ref)
return String;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Permission_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Permission_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Permission_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Permission_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Permission_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Permission_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
PERMISSION_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Permission_Ref);
-- Copy of the object.
procedure Copy (Object : in Permission_Ref;
Into : in out Permission_Ref);
Query_Check_Entity_Permission : constant ADO.Queries.Query_Definition_Access;
Query_Remove_Permission : constant ADO.Queries.Query_Definition_Access;
Query_Remove_Entity_Permission : constant ADO.Queries.Query_Definition_Access;
Query_Remove_User_Permission : constant ADO.Queries.Query_Definition_Access;
private
ACL_NAME : aliased constant String := "awa_acl";
COL_0_1_NAME : aliased constant String := "id";
COL_1_1_NAME : aliased constant String := "entity_id";
COL_2_1_NAME : aliased constant String := "writeable";
COL_3_1_NAME : aliased constant String := "user_id";
COL_4_1_NAME : aliased constant String := "workspace_id";
COL_5_1_NAME : aliased constant String := "entity_type";
COL_6_1_NAME : aliased constant String := "permission";
ACL_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 7,
Table => ACL_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access,
3 => COL_2_1_NAME'Access,
4 => COL_3_1_NAME'Access,
5 => COL_4_1_NAME'Access,
6 => COL_5_1_NAME'Access,
7 => COL_6_1_NAME'Access
)
);
ACL_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= ACL_DEF'Access;
Null_ACL : constant ACL_Ref
:= ACL_Ref'(ADO.Objects.Object_Ref with null record);
type Acl_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => ACL_DEF'Access)
with record
Entity_Id : ADO.Identifier;
Writeable : Boolean;
User_Id : ADO.Identifier;
Workspace_Id : ADO.Identifier;
Entity_Type : ADO.Entity_Type;
Permission : ADO.Identifier;
end record;
type Acl_Access is access all Acl_Impl;
overriding
procedure Destroy (Object : access Acl_Impl);
overriding
procedure Find (Object : in out Acl_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Acl_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Acl_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Acl_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Acl_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Acl_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Acl_Ref'Class;
Impl : out Acl_Access);
PERMISSION_NAME : aliased constant String := "awa_permission";
COL_0_2_NAME : aliased constant String := "id";
COL_1_2_NAME : aliased constant String := "name";
PERMISSION_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 2,
Table => PERMISSION_NAME'Access,
Members => (
1 => COL_0_2_NAME'Access,
2 => COL_1_2_NAME'Access
)
);
PERMISSION_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= PERMISSION_DEF'Access;
Null_Permission : constant Permission_Ref
:= Permission_Ref'(ADO.Objects.Object_Ref with null record);
type Permission_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => PERMISSION_DEF'Access)
with record
Name : Ada.Strings.Unbounded.Unbounded_String;
end record;
type Permission_Access is access all Permission_Impl;
overriding
procedure Destroy (Object : access Permission_Impl);
overriding
procedure Find (Object : in out Permission_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Permission_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Permission_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Permission_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Permission_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Permission_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Permission_Ref'Class;
Impl : out Permission_Access);
package File_1 is
new ADO.Queries.Loaders.File (Path => "permissions.xml",
Sha1 => "9B2B599473F75F92CB5AB5045675E4CCEF926543");
package Def_Check_Entity_Permission is
new ADO.Queries.Loaders.Query (Name => "check-entity-permission",
File => File_1.File'Access);
Query_Check_Entity_Permission : constant ADO.Queries.Query_Definition_Access
:= Def_Check_Entity_Permission.Query'Access;
package Def_Remove_Permission is
new ADO.Queries.Loaders.Query (Name => "remove-permission",
File => File_1.File'Access);
Query_Remove_Permission : constant ADO.Queries.Query_Definition_Access
:= Def_Remove_Permission.Query'Access;
package Def_Remove_Entity_Permission is
new ADO.Queries.Loaders.Query (Name => "remove-entity-permission",
File => File_1.File'Access);
Query_Remove_Entity_Permission : constant ADO.Queries.Query_Definition_Access
:= Def_Remove_Entity_Permission.Query'Access;
package Def_Remove_User_Permission is
new ADO.Queries.Loaders.Query (Name => "remove-user-permission",
File => File_1.File'Access);
Query_Remove_User_Permission : constant ADO.Queries.Query_Definition_Access
:= Def_Remove_User_Permission.Query'Access;
end AWA.Permissions.Models;
|
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . F O R M A L _ O R D E R E D _ M A P S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2015, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
------------------------------------------------------------------------------
-- This spec is derived from package Ada.Containers.Bounded_Ordered_Maps in
-- the Ada 2012 RM. The modifications are meant to facilitate formal proofs by
-- making it easier to express properties, and by making the specification of
-- this unit compatible with SPARK 2014. Note that the API of this unit may be
-- subject to incompatible changes as SPARK 2014 evolves.
-- The modifications are:
-- A parameter for the container is added to every function reading the
-- content of a container: Key, Element, Next, Query_Element, Previous,
-- Has_Element, Iterate, Reverse_Iterate. This change is motivated by the
-- need to have cursors which are valid on different containers (typically a
-- container C and its previous version C'Old) for expressing properties,
-- which is not possible if cursors encapsulate an access to the underlying
-- container. The operators "<" and ">" that could not be modified that way
-- have been removed.
-- There are four new functions:
-- function Strict_Equal (Left, Right : Map) return Boolean;
-- function Overlap (Left, Right : Map) return Boolean;
-- function First_To_Previous (Container : Map; Current : Cursor)
-- return Map;
-- function Current_To_Last (Container : Map; Current : Cursor)
-- return Map;
-- See detailed specifications for these subprograms
private with Ada.Containers.Red_Black_Trees;
generic
type Key_Type is private;
type Element_Type is private;
with function "<" (Left, Right : Key_Type) return Boolean is <>;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Formal_Ordered_Maps with
Pure,
SPARK_Mode
is
pragma Annotate (GNATprove, External_Axiomatization);
pragma Annotate (CodePeer, Skip_Analysis);
function Equivalent_Keys (Left, Right : Key_Type) return Boolean with
Global => null;
type Map (Capacity : Count_Type) is private with
Iterable => (First => First,
Next => Next,
Has_Element => Has_Element,
Element => Element),
Default_Initial_Condition => Is_Empty (Map);
pragma Preelaborable_Initialization (Map);
type Cursor is private;
pragma Preelaborable_Initialization (Cursor);
Empty_Map : constant Map;
No_Element : constant Cursor;
function "=" (Left, Right : Map) return Boolean with
Global => null;
function Length (Container : Map) return Count_Type with
Global => null;
function Is_Empty (Container : Map) return Boolean with
Global => null;
procedure Clear (Container : in out Map) with
Global => null;
procedure Assign (Target : in out Map; Source : Map) with
Global => null,
Pre => Target.Capacity >= Length (Source);
function Copy (Source : Map; Capacity : Count_Type := 0) return Map with
Global => null,
Pre => Capacity = 0 or else Capacity >= Source.Capacity;
function Key (Container : Map; Position : Cursor) return Key_Type with
Global => null,
Pre => Has_Element (Container, Position);
function Element
(Container : Map;
Position : Cursor) return Element_Type
with
Global => null,
Pre => Has_Element (Container, Position);
procedure Replace_Element
(Container : in out Map;
Position : Cursor;
New_Item : Element_Type)
with
Global => null,
Pre => Has_Element (Container, Position);
procedure Move (Target : in out Map; Source : in out Map) with
Global => null,
Pre => Target.Capacity >= Length (Source);
procedure Insert
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type;
Position : out Cursor;
Inserted : out Boolean)
with
Global => null,
Pre => Length (Container) < Container.Capacity;
procedure Insert
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type)
with
Global => null,
Pre => Length (Container) < Container.Capacity
and then (not Contains (Container, Key));
procedure Include
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type)
with
Global => null,
Pre => Length (Container) < Container.Capacity;
procedure Replace
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type)
with
Global => null,
Pre => Contains (Container, Key);
procedure Exclude (Container : in out Map; Key : Key_Type) with
Global => null;
procedure Delete (Container : in out Map; Key : Key_Type) with
Global => null,
Pre => Contains (Container, Key);
procedure Delete (Container : in out Map; Position : in out Cursor) with
Global => null,
Pre => Has_Element (Container, Position);
procedure Delete_First (Container : in out Map) with
Global => null;
procedure Delete_Last (Container : in out Map) with
Global => null;
function First (Container : Map) return Cursor with
Global => null;
function First_Element (Container : Map) return Element_Type with
Global => null,
Pre => not Is_Empty (Container);
function First_Key (Container : Map) return Key_Type with
Global => null,
Pre => not Is_Empty (Container);
function Last (Container : Map) return Cursor with
Global => null;
function Last_Element (Container : Map) return Element_Type with
Global => null,
Pre => not Is_Empty (Container);
function Last_Key (Container : Map) return Key_Type with
Global => null,
Pre => not Is_Empty (Container);
function Next (Container : Map; Position : Cursor) return Cursor with
Global => null,
Pre => Has_Element (Container, Position) or else Position = No_Element;
procedure Next (Container : Map; Position : in out Cursor) with
Global => null,
Pre => Has_Element (Container, Position) or else Position = No_Element;
function Previous (Container : Map; Position : Cursor) return Cursor with
Global => null,
Pre => Has_Element (Container, Position) or else Position = No_Element;
procedure Previous (Container : Map; Position : in out Cursor) with
Global => null,
Pre => Has_Element (Container, Position) or else Position = No_Element;
function Find (Container : Map; Key : Key_Type) return Cursor with
Global => null;
function Element (Container : Map; Key : Key_Type) return Element_Type with
Global => null,
Pre => Contains (Container, Key);
function Floor (Container : Map; Key : Key_Type) return Cursor with
Global => null;
function Ceiling (Container : Map; Key : Key_Type) return Cursor with
Global => null;
function Contains (Container : Map; Key : Key_Type) return Boolean with
Global => null;
function Has_Element (Container : Map; Position : Cursor) return Boolean
with
Global => null;
function Strict_Equal (Left, Right : Map) return Boolean with
Ghost,
Global => null;
-- Strict_Equal returns True if the containers are physically equal, i.e.
-- they are structurally equal (function "=" returns True) and that they
-- have the same set of cursors.
function First_To_Previous (Container : Map; Current : Cursor) return Map
with
Ghost,
Global => null,
Pre => Has_Element (Container, Current) or else Current = No_Element;
function Current_To_Last (Container : Map; Current : Cursor) return Map
with
Ghost,
Global => null,
Pre => Has_Element (Container, Current) or else Current = No_Element;
-- First_To_Previous returns a container containing all elements preceding
-- Current (excluded) in Container. Current_To_Last returns a container
-- containing all elements following Current (included) in Container.
-- These two new functions can be used to express invariant properties in
-- loops which iterate over containers. First_To_Previous returns the part
-- of the container already scanned and Current_To_Last the part not
-- scanned yet.
function Overlap (Left, Right : Map) return Boolean with
Global => null;
-- Overlap returns True if the containers have common keys
private
pragma SPARK_Mode (Off);
pragma Inline (Next);
pragma Inline (Previous);
subtype Node_Access is Count_Type;
use Red_Black_Trees;
type Node_Type is record
Has_Element : Boolean := False;
Parent : Node_Access := 0;
Left : Node_Access := 0;
Right : Node_Access := 0;
Color : Red_Black_Trees.Color_Type := Red;
Key : Key_Type;
Element : Element_Type;
end record;
package Tree_Types is
new Ada.Containers.Red_Black_Trees.Generic_Bounded_Tree_Types (Node_Type);
type Map (Capacity : Count_Type) is
new Tree_Types.Tree_Type (Capacity) with null record;
type Cursor is record
Node : Node_Access;
end record;
Empty_Map : constant Map := (Capacity => 0, others => <>);
No_Element : constant Cursor := (Node => 0);
end Ada.Containers.Formal_Ordered_Maps;
|
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired)
--
-- Copyright William A. Whitaker (1936–2010)
--
-- This is a free program, which means it is proper to copy it and pass
-- it on to your friends. Consider it a developmental item for which
-- there is no charge. However, just for form, it is Copyrighted
-- (c). Permission is hereby freely given for any and all use of program
-- and data. You can sell it as your own, but at least tell me.
--
-- This version is distributed without obligation, but the developer
-- would appreciate comments and suggestions.
--
-- All parts of the WORDS system, source code and data files, are made freely
-- available to anyone who wishes to use them, for whatever purpose.
with Text_IO; use Text_IO;
with Latin_Utils.Strings_Package; use Latin_Utils.Strings_Package;
procedure Page2htm is
Line : String (1 .. 300) := (others => ' ');
Last : Integer := 0;
Input, Output : File_Type;
begin
Put_Line ("DICTPAGE.RAW (sorted) -> DICTPAGE.HTM");
Put_Line ("For use in preparing a DICTPAGE.HTM after" &
" running DICTPAGE and sorting.");
Open (Input, In_File, "DICTPAGE.RAW");
Create (Output, Out_File, "DICTPAGE.HTM");
while not End_Of_File (Input) loop
Get_Line (Input, Line, Last);
if Line (1) /= '#' then
Put_Line ("BAD LINE >" & Line (1 .. Last));
end if;
for I in 1 .. Last loop
if Line (I) = '[' then
Put (Output, "<B>" & Line (2 .. I - 1) & "</B> ");
Put_Line (Output, Trim (Line (I .. I + 6) & "<BR>"));
end if;
if Line (I .. I + 1) = "::" then
Put_Line (Output, Trim (Line (I + 2 .. Last)) & "<BR>");
exit;
end if;
end loop; -- On LINE
end loop; -- On file
end Page2htm;
|
--
-- Jan & Uwe R. Zimmer, Australia, July 2011
--
with GL, GL.Materials, GLOBE_3D.Math;
package body Cube_P is
-- Pretty output: FALSE
use GL, GL.Materials, GLOBE_3D, GLOBE_3D.Math;
-- begin Separator # 1
-- VRML: [# triangle mesh
-- ]
matos_1 : constant Material_type := (ambient => (0.0, 0.0, 0.0, 1.0),
specular => (0.0, 0.0, 0.0, 1.0),
diffuse => (1.0, 1.0, 1.0, 1.0),
emission => (0.0, 0.0, 0.0, 1.0),
shininess => 128.0);
matos_red : constant Material_type := (ambient => (0.0, 0.0, 0.0, 1.0),
specular => (0.0, 0.0, 0.0, 1.0),
diffuse => (1.0, 0.0, 0.0, 1.0),
emission => (0.0, 0.0, 0.0, 1.0),
shininess => 128.0);
matos_blue : constant Material_type := (ambient => (0.0, 0.0, 0.0, 1.0),
specular => (0.0, 0.0, 0.0, 1.0),
diffuse => (0.0, 0.0, 1.0, 1.0),
emission => (0.0, 0.0, 0.0, 1.0),
shininess => 128.0);
coord_1 : constant Point_3D_array :=
((0.0, 0.0, 0.0), -- VRML: [# coord point 0
-- ]
(0.0, 0.0, 1.0), (1.0, 0.0, 0.0), (1.0, 0.0, 1.0), (1.0, 0.0, 0.0),
(1.0, 0.0, 1.0), (1.0, 1.0, 0.0), (1.0, 1.0, 1.0), (1.0, 1.0, 0.0), (1.0, 1.0, 1.0),
(0.0, 1.0, 0.0), (0.0, 1.0, 1.0), (0.0, 1.0, 0.0), (0.0, 1.0, 1.0), (0.0, 0.0, 0.0),
(0.0, 0.0, 1.0), (0.0, 0.0, 0.0), (1.0, 0.0, 0.0), (1.0, 1.0, 0.0), (0.0, 1.0, 0.0),
(0.0, 0.0, 1.0), (1.0, 0.0, 1.0), (1.0, 1.0, 1.0), (0.0, 1.0, 1.0) -- 24
);
-- VRML: [# 24 vertices
-- ]
-- begin Separator # 2
-- VRML: [#triangle mesh
-- ]
idx_2 : constant Idx_4_array_array :=
((1, 3, 4, 0), -- VRML: [# triangle 0
-- ]
(1, 4, 2, 0), (5, 7, 8, 0), (5, 8, 6, 0), (9, 11, 12, 0), (9, 12, 10, 0), (13, 15, 16, 0), (13, 16, 14, 0),
(18, 17, 20, 0), (20, 19, 18, 0), (22, 24, 21, 0), (24, 22, 23, 0) -- 12
);
-- VRML: [# 12 triangles
-- ]
-- last index now: 0
-- end Separator # 2
-- VRML: [#triangle mesh
-- ]
-- last index now: 0
-- end Separator # 2
-- VRML: [# triangle mesh
-- ]
procedure Create (object : in out GLOBE_3D.p_Object_3D;
object_scale : GLOBE_3D.Real;
centre : GLOBE_3D.Point_3D)
is
face_0 : Face_type; -- takes defaults values
begin
object :=
new Object_3D (Max_points => 24, Max_faces => 12);
object.all.Centre := centre;
Set_name (object.all, "insect_body");
face_0.skin := material_only;
face_0.material := VRML_Defaults;
-- Creating separator # 1
if Almost_zero (object_scale - 1.0) then
object.all.Point (1 .. 24) := coord_1;
else
for p in 1 .. 24 loop
object.all.Point (0 + p) := object_scale * coord_1 (p);
end loop;
end if;
face_0.material := matos_1;
-- Creating separator # 2
for f in 1 .. 12 loop
face_0.P := idx_2 (f);
object.all.face (0 + f) := face_0;
end loop;
for f in 9 .. 10 loop
object.all.face (f).material := matos_red;
end loop;
for f in 11 .. 12 loop
object.all.face (f).material := matos_blue;
end loop;
end Create;
end Cube_P;
-- Converted by Wrl2Ada
|
with AUnit.Assertions; use AUnit.Assertions;
package body Day.Test is
procedure Test_Part1 (T : in out AUnit.Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
t1 : constant Natural := count_tiles("test1.txt");
begin
Assert(t1 = 10, "Wrong number, expected 10, got" & t1'IMAGE);
end Test_Part1;
procedure Test_Part2 (T : in out AUnit.Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
t1 : constant Natural := evolve_tiles("test1.txt", 100);
begin
Assert(t1 = 2208, "Wrong number, expected 2208, got" & t1'IMAGE);
end Test_Part2;
function Name (T : Test) return AUnit.Message_String is
pragma Unreferenced (T);
begin
return AUnit.Format ("Test Day package");
end Name;
procedure Register_Tests (T : in out Test) is
use AUnit.Test_Cases.Registration;
begin
Register_Routine (T, Test_Part1'Access, "Test Part 1");
Register_Routine (T, Test_Part2'Access, "Test Part 2");
end Register_Tests;
end Day.Test;
|
-----------------------------------------------------------------------
-- ado-audits -- Auditing support
-- Copyright (C) 2018 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Util.Beans.Objects.Time;
with ADO.Utils;
package body ADO.Audits is
use Ada.Strings.Unbounded;
use type ADO.Schemas.Column_Index;
use type Ada.Calendar.Time;
package UBOT renames Util.Beans.Objects.Time;
procedure Free is
new Ada.Unchecked_Deallocation (Object => Audit_Array,
Name => Audit_Array_Access);
procedure Save (Object : in out Auditable_Object_Record'Class;
Session : in out ADO.Sessions.Master_Session'Class) is
Manager : constant access Audit_Manager'Class := Session.Get_Audit_Manager;
Audits : constant Audit_Array_Access := Object.Audits;
Last : Audit_Info_Index;
begin
if Manager /= null and Audits /= null then
Last := 1;
for Pos in Audits'Range loop
exit when Audits (Pos).Field = 0;
Last := Pos;
end loop;
Manager.Save (Session, Object, Audits (1 .. Last));
end if;
Free (Object.Audits);
end Save;
-- --------------------
-- Record an audit information for a field.
-- --------------------
procedure Audit_Field (Object : in out Auditable_Object_Record;
Field : in ADO.Schemas.Column_Index;
Old_Value : in UBO.Object;
New_Value : in UBO.Object) is
Audits : Audit_Array_Access := Object.Audits;
begin
if Audits = null then
Audits := new Audit_Array (1 .. Audit_Info_Index (Object.With_Audit.Count));
Object.Audits := Audits;
end if;
for Pos in Object.Audits'Range loop
if Audits (Pos).Field = Field then
Audits (Pos).New_Value := New_Value;
return;
end if;
if Audits (Pos).Field = 0 then
Audits (Pos).Field := Field;
Audits (Pos).Old_Value := Old_Value;
Audits (Pos).New_Value := New_Value;
return;
end if;
end loop;
end Audit_Field;
-- --------------------
-- Release the object.
-- --------------------
overriding
procedure Finalize (Object : in out Auditable_Object_Record) is
begin
Free (Object.Audits);
ADO.Objects.Finalize (ADO.Objects.Object_Record (Object));
end Finalize;
procedure Set_Field_Unbounded_String (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out Ada.Strings.Unbounded.Unbounded_String;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
begin
if Into /= Value then
Object.Audit_Field (Field, UBO.To_Object (Into), UBO.To_Object (Value));
Into := Value;
Object.Set_Field (Field);
end if;
end Set_Field_Unbounded_String;
procedure Set_Field_String (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out Ada.Strings.Unbounded.Unbounded_String;
Value : in String) is
begin
if Into /= Value then
Object.Audit_Field (Field, UBO.To_Object (Into), UBO.To_Object (Value));
Ada.Strings.Unbounded.Set_Unbounded_String (Into, Value);
Object.Set_Field (Field);
end if;
end Set_Field_String;
procedure Set_Field_String (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out ADO.Nullable_String;
Value : in String) is
begin
if Into.Is_Null or else Into.Value /= Value then
if Into.Is_Null then
Object.Audit_Field (Field, UBO.Null_Object, UBO.To_Object (Value));
else
Object.Audit_Field (Field, UBO.To_Object (Into.Value), UBO.To_Object (Value));
end if;
Into.Is_Null := False;
Ada.Strings.Unbounded.Set_Unbounded_String (Into.Value, Value);
Object.Set_Field (Field);
end if;
end Set_Field_String;
procedure Set_Field_String (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out ADO.Nullable_String;
Value : in ADO.Nullable_String) is
begin
if Into.Is_Null then
if not Value.Is_Null then
Object.Audit_Field (Field, UBO.Null_Object, UBO.To_Object (Value.Value));
Into := Value;
Object.Set_Field (Field);
end if;
elsif Value.Is_Null then
Object.Audit_Field (Field, UBO.To_Object (Into.Value), UBO.Null_Object);
Into := Value;
Object.Set_Field (Field);
elsif Into.Value /= Value.Value then
Object.Audit_Field (Field, UBO.To_Object (Into.Value), UBO.To_Object (Value.Value));
Into := Value;
Object.Set_Field (Field);
end if;
end Set_Field_String;
procedure Set_Field_Time (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out Ada.Calendar.Time;
Value : in Ada.Calendar.Time) is
begin
if Into /= Value then
Object.Audit_Field (Field, UBOT.To_Object (Into), UBOT.To_Object (Value));
Into := Value;
Object.Set_Field (Field);
end if;
end Set_Field_Time;
procedure Set_Field_Time (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out ADO.Nullable_Time;
Value : in ADO.Nullable_Time) is
begin
if Into.Is_Null then
if not Value.Is_Null then
Object.Audit_Field (Field, UBO.Null_Object, UBOT.To_Object (Value.Value));
Into := Value;
Object.Set_Field (Field);
end if;
elsif Value.Is_Null then
Object.Audit_Field (Field, UBOT.To_Object (Into.Value), UBO.Null_Object);
Into := Value;
Object.Set_Field (Field);
elsif Into.Value /= Value.Value then
Object.Audit_Field (Field, UBOT.To_Object (Into.Value), UBOT.To_Object (Value.Value));
Into := Value;
Object.Set_Field (Field);
end if;
end Set_Field_Time;
procedure Set_Field_Integer (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out Integer;
Value : in Integer) is
begin
if Into /= Value then
Object.Audit_Field (Field, UBO.To_Object (Into), UBO.To_Object (Value));
Into := Value;
Object.Set_Field (Field);
end if;
end Set_Field_Integer;
procedure Set_Field_Integer (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out ADO.Nullable_Integer;
Value : in ADO.Nullable_Integer) is
begin
if Into.Is_Null then
if not Value.Is_Null then
Object.Audit_Field (Field, UBO.Null_Object, UBO.To_Object (Value.Value));
Into := Value;
Object.Set_Field (Field);
end if;
elsif Value.Is_Null then
Object.Audit_Field (Field, UBO.To_Object (Into.Value), UBO.Null_Object);
Into := Value;
Object.Set_Field (Field);
elsif Into.Value /= Value.Value then
Object.Audit_Field (Field, UBO.To_Object (Into.Value), UBO.To_Object (Value.Value));
Into := Value;
Object.Set_Field (Field);
end if;
end Set_Field_Integer;
procedure Set_Field_Natural (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out Natural;
Value : in Natural) is
begin
if Into /= Value then
Object.Audit_Field (Field, UBO.To_Object (Into), UBO.To_Object (Value));
Into := Value;
Object.Set_Field (Field);
end if;
end Set_Field_Natural;
procedure Set_Field_Positive (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out Positive;
Value : in Positive) is
begin
if Into /= Value then
Object.Audit_Field (Field, UBO.To_Object (Into), UBO.To_Object (Value));
Into := Value;
Object.Set_Field (Field);
end if;
end Set_Field_Positive;
procedure Set_Field_Boolean (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out Boolean;
Value : in Boolean) is
begin
if Into /= Value then
Object.Audit_Field (Field, UBO.To_Object (Into), UBO.To_Object (Value));
Into := Value;
Object.Set_Field (Field);
end if;
end Set_Field_Boolean;
procedure Set_Field_Float (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out Float;
Value : in Float) is
begin
if Into /= Value then
Object.Audit_Field (Field, UBO.To_Object (Into), UBO.To_Object (Value));
Into := Value;
Object.Set_Field (Field);
end if;
end Set_Field_Float;
procedure Set_Field_Long_Float (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out Long_Float;
Value : in Long_Float) is
begin
if Into /= Value then
Object.Audit_Field (Field, UBO.To_Object (Into), UBO.To_Object (Value));
Into := Value;
Object.Set_Field (Field);
end if;
end Set_Field_Long_Float;
procedure Set_Field_Object (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out ADO.Objects.Object_Ref'Class;
Value : in ADO.Objects.Object_Ref'Class) is
use type ADO.Objects.Object_Ref;
begin
if Into /= Value then
Object.Audit_Field (Field, ADO.Objects.To_Object (Into.Get_Key),
ADO.Objects.To_Object (Value.Get_Key));
ADO.Objects.Set_Field_Object (Object, Field, Into, Value);
end if;
end Set_Field_Object;
procedure Set_Field_Identifier (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out ADO.Identifier;
Value : in ADO.Identifier) is
begin
if Into /= Value then
Object.Audit_Field (Field, Utils.To_Object (Into), Utils.To_Object (Value));
Into := Value;
Object.Set_Field (Field);
end if;
end Set_Field_Identifier;
procedure Set_Field_Entity_Type (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out ADO.Entity_Type;
Value : in ADO.Entity_Type) is
begin
if Into /= Value then
Object.Audit_Field (Field, UBO.To_Object (Natural (Into)),
UBO.To_Object (Natural (Value)));
Into := Value;
Object.Set_Field (Field);
end if;
end Set_Field_Entity_Type;
procedure Set_Field_Entity_Type (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out ADO.Nullable_Entity_Type;
Value : in ADO.Nullable_Entity_Type) is
begin
if Into.Is_Null then
if not Value.Is_Null then
Object.Audit_Field (Field, UBO.Null_Object, UBO.To_Object (Natural (Value.Value)));
Into := Value;
Object.Set_Field (Field);
end if;
elsif Value.Is_Null then
Object.Audit_Field (Field, UBO.To_Object (Natural (Into.Value)), UBO.Null_Object);
Into := Value;
Object.Set_Field (Field);
elsif Into.Value /= Value.Value then
Object.Audit_Field (Field, UBO.To_Object (Natural (Into.Value)),
UBO.To_Object (Natural (Value.Value)));
Into := Value;
Object.Set_Field (Field);
end if;
end Set_Field_Entity_Type;
procedure Set_Field_Key_Value (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Value : in ADO.Identifier) is
begin
if Object.Get_Key_Value /= Value then
Object.Audit_Field (Field, ADO.Objects.To_Object (Object.Get_Key),
Utils.To_Object (Value));
ADO.Objects.Set_Key_Value (Object, Value);
Object.Set_Field (Field);
end if;
end Set_Field_Key_Value;
procedure Set_Field_Key_Value (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Value : in String) is
begin
if Object.Get_Key_Value /= Value then
Object.Audit_Field (Field, ADO.Objects.To_Object (Object.Get_Key),
UBO.To_Object (Value));
ADO.Objects.Set_Key_Value (Object, Value);
Object.Set_Field (Field);
end if;
end Set_Field_Key_Value;
procedure Set_Field_Key_Value (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
begin
if Object.Get_Key_Value /= Value then
Object.Audit_Field (Field, ADO.Objects.To_Object (Object.Get_Key),
UBO.To_Object (Value));
ADO.Objects.Set_Key_Value (Object, Value);
Object.Set_Field (Field);
end if;
end Set_Field_Key_Value;
procedure Set_Field_Operation (Object : in out Auditable_Object_Record'Class;
Field : in Column_Index;
Into : in out T;
Value : in T) is
begin
if Into /= Value then
Object.Audit_Field (Field, To_Object (Into), To_Object (Value));
Into := Value;
Object.Set_Field (Field);
end if;
end Set_Field_Operation;
end ADO.Audits;
|
package Vect16 is
type Sarray is array (1 .. 4) of Long_Float;
for Sarray'Alignment use 16;
procedure Add_Sub (X, Y : Sarray; R,S : out Sarray);
end Vect16;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y M B O L S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2003-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 allows the creation of symbol files to be used for linking
-- libraries. The format of symbol files depends on the platform, so there is
-- several implementations of the body.
with GNAT.Dynamic_Tables;
with System.OS_Lib; use System.OS_Lib;
package Symbols is
type Policy is
-- Symbol policy
(Autonomous,
-- Create a symbol file without considering any reference
Compliant,
-- Either create a symbol file with the same major and minor IDs if
-- all symbols are already found in the reference file or with an
-- incremented minor ID, if not.
Controlled,
-- Fail if symbols are not the same as those in the reference file
Restricted,
-- Restrict the symbols to those in the symbol file. Fail if some
-- symbols in the symbol file are not exported from the object files.
Direct);
-- The reference symbol file is copied to the symbol file
type Symbol_Kind is (Data, Proc);
-- To distinguish between the different kinds of symbols
type Symbol_Data is record
Name : String_Access;
Kind : Symbol_Kind := Data;
Present : Boolean := True;
end record;
-- Data (name and kind) for each of the symbols
package Symbol_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Symbol_Data,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 100,
Table_Increment => 100);
-- The symbol tables
Original_Symbols : Symbol_Table.Instance;
-- The symbols, if any, found in the reference symbol table
Complete_Symbols : Symbol_Table.Instance;
-- The symbols, if any, found in the objects files
procedure Initialize
(Symbol_File : String;
Reference : String;
Symbol_Policy : Policy;
Quiet : Boolean;
Version : String;
Success : out Boolean);
-- Initialize a symbol file. This procedure must be called before
-- Processing any object file. Depending on the platforms and the
-- circumstances, additional messages may be issued if Quiet is False.
package Processing is
-- This package, containing a single visible procedure Process, exists
-- so that it can be a subunits, for some platforms, the body of package
-- Symbols is common, while the subunit Processing is not.
procedure Process
(Object_File : String;
Success : out Boolean);
-- Get the symbols from an object file. Success is set to True if the
-- object file exists and has the expected format.
end Processing;
procedure Finalize
(Quiet : Boolean;
Success : out Boolean);
-- Finalize the symbol file. This procedure should be called after
-- Initialize (once) and Process (one or more times). If Success is
-- True, the symbol file is written and closed, ready to be used for
-- linking the library. Depending on the platforms and the circumstances,
-- additional messages may be issued if Quiet is False.
end Symbols;
|
-- C95095E.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 OVERLOADED SUBPROGRAM AND ENTRY DECLARATIONS
-- ARE PERMITTED IN WHICH THERE IS A MINIMAL
-- DIFFERENCE BETWEEN THE DECLARATIONS.
-- (E) A SUBPROGRAM IS DECLARED IN AN OUTER DECLARATIVE PART,
-- AN ENTRY IN A TASK, AND ONE HAS ONE MORE PARAMETER
-- THAN THE OTHER; THE OMITTED PARAMETER HAS A DEFAULT VALUE.
-- JWC 7/30/85
-- JRK 10/2/85
WITH REPORT; USE REPORT;
PROCEDURE C95095E IS
BEGIN
TEST ("C95095E", "SUBPROGRAM/ENTRY OVERLOADING WITH " &
"MINIMAL DIFFERENCES ALLOWED");
--------------------------------------------------
-- A SUBPROGRAM IS IN AN OUTER DECLARATIVE
-- PART, AN ENTRY IN A TASK, AND ONE
-- HAS ONE MORE PARAMETER (WITH A DEFAULT
-- VALUE) THAN THE OTHER.
DECLARE
S : STRING (1..3) := "123";
PROCEDURE E (I1, I2, I3 : INTEGER := 1) IS
C : CONSTANT STRING := "CXA";
BEGIN
S (I3) := C (I3);
END E;
TASK T IS
ENTRY E (I1, I2 : INTEGER := 1);
END T;
TASK BODY T IS
BEGIN
ACCEPT E (I1, I2 : INTEGER := 1) DO
S (2) := 'B';
END E;
END T;
BEGIN
E (1, 2, 3);
T.E (1, 2);
E (1, 2);
IF S /= "CBA" THEN
FAILED ("PROCEDURES/ENTRIES DIFFERING " &
"ONLY IN EXISTENCE OF ONE " &
"DEFAULT-VALUED PARAMETER CAUSED " &
"CONFUSION");
END IF;
END;
--------------------------------------------------
RESULT;
END C95095E;
|
-- Copyright 2015-2017 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with System;
package Pck is
subtype Small_Type is Integer range 0 .. 10;
type Record_Type (I : Small_Type := 0) is record
S : String (1 .. I);
end record;
function Ident (R : Record_Type) return Record_Type;
type Array_Type is array (Integer range <>) of Record_Type;
procedure Do_Nothing (A : System.Address);
A1 : Array_Type := (1 => (I => 0, S => <>),
2 => (I => 1, S => "A"),
3 => (I => 2, S => "AB"));
A2 : Array_Type := (1 => (I => 2, S => "AB"),
2 => (I => 1, S => "A"),
3 => (I => 0, S => <>));
end Pck;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . N U M E R I C S . R E A L _ A R R A Y S --
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
with Ada.Numerics.Generic_Real_Arrays;
package Ada.Numerics.Real_Arrays is
new Ada.Numerics.Generic_Real_Arrays (Float);
pragma Pure (Real_Arrays);
|
private
with
eGL;
package openGL.Display
--
-- Models an openGL display.
--
is
type Item is tagged private;
function Default return Item;
private
type Item is tagged
record
Thin : eGL.EGLDisplay;
Version_major,
Version_minor : aliased eGL.EGLint;
end record;
end openGL.Display;
|
------------------------------------------------------------------------------
-- --
-- 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 STMicroelectronics nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
-- --
-- This file is based on: --
-- --
-- @file stm32f429i_discovery_ts.c --
-- @author MCD Application Team --
-- @version V1.1.0 --
-- @date 19-June-2014 --
-- @brief This file provides a set of functions needed to manage Touch --
-- screen available with STMPE811 IO Expander device mounted on --
-- STM32F429I-Discovery Kit. --
-- --
-- COPYRIGHT(c) 2014 STMicroelectronics --
------------------------------------------------------------------------------
package body BB_Pico_Bsp.STMPE811 is
pragma Style_Checks ("M120");
pragma Warnings (Off, "constant * is not referenced");
-- Control Registers
IOE_REG_SYS_CTRL1 : constant UInt8 := 16#03#;
IOE_REG_SYS_CTRL2 : constant UInt8 := 16#04#;
IOE_REG_SPI_CFG : constant UInt8 := 16#08#;
-- Touch Panel Registers
IOE_REG_TSC_CTRL : constant UInt8 := 16#40#;
IOE_REG_TSC_CFG : constant UInt8 := 16#41#;
IOE_REG_WDM_TR_X : constant UInt8 := 16#42#;
IOE_REG_WDM_TR_Y : constant UInt8 := 16#44#;
IOE_REG_WDM_BL_X : constant UInt8 := 16#46#;
IOE_REG_WDM_BL_Y : constant UInt8 := 16#48#;
IOE_REG_FIFO_TH : constant UInt8 := 16#4A#;
IOE_REG_FIFO_STA : constant UInt8 := 16#4B#;
IOE_REG_FIFO_SIZE : constant UInt8 := 16#4C#;
IOE_REG_TSC_DATA_X : constant UInt8 := 16#4D#;
IOE_REG_TSC_DATA_Y : constant UInt8 := 16#4F#;
IOE_REG_TSC_DATA_Z : constant UInt8 := 16#51#;
IOE_REG_TSC_DATA_XYZ : constant UInt8 := 16#52#;
IOE_REG_TSC_FRACT_Z : constant UInt8 := 16#56#;
IOE_REG_TSC_DATA : constant UInt8 := 16#57#;
IOE_REG_TSC_I_DRIVE : constant UInt8 := 16#58#;
IOE_REG_TSC_SHIELD : constant UInt8 := 16#59#;
-- IOE GPIO Registers
IOE_REG_GPIO_SET_PIN : constant UInt8 := 16#10#;
IOE_REG_GPIO_CLR_PIN : constant UInt8 := 16#11#;
IOE_REG_GPIO_MP_STA : constant UInt8 := 16#12#;
IOE_REG_GPIO_DIR : constant UInt8 := 16#13#;
IOE_REG_GPIO_ED : constant UInt8 := 16#14#;
IOE_REG_GPIO_RE : constant UInt8 := 16#15#;
IOE_REG_GPIO_FE : constant UInt8 := 16#16#;
IOE_REG_GPIO_AF : constant UInt8 := 16#17#;
-- IOE Functions
IOE_ADC_FCT : constant UInt8 := 16#01#;
IOE_TSC_FCT : constant UInt8 := 16#02#;
IOE_IO_FCT : constant UInt8 := 16#04#;
-- ADC Registers
IOE_REG_ADC_INT_EN : constant UInt8 := 16#0E#;
IOE_REG_ADC_INT_STA : constant UInt8 := 16#0F#;
IOE_REG_ADC_CTRL1 : constant UInt8 := 16#20#;
IOE_REG_ADC_CTRL2 : constant UInt8 := 16#21#;
IOE_REG_ADC_CAPT : constant UInt8 := 16#22#;
IOE_REG_ADC_DATA_CH0 : constant UInt8 := 16#30#;
IOE_REG_ADC_DATA_CH1 : constant UInt8 := 16#32#;
IOE_REG_ADC_DATA_CH2 : constant UInt8 := 16#34#;
IOE_REG_ADC_DATA_CH3 : constant UInt8 := 16#36#;
IOE_REG_ADC_DATA_CH4 : constant UInt8 := 16#38#;
IOE_REG_ADC_DATA_CH5 : constant UInt8 := 16#3A#;
IOE_REG_ADC_DATA_CH6 : constant UInt8 := 16#3B#;
IOE_REG_ADC_DATA_CH7 : constant UInt8 := 16#3C#;
-- Interrupt Control Registers
IOE_REG_INT_CTRL : constant UInt8 := 16#09#;
IOE_REG_INT_EN : constant UInt8 := 16#0A#;
IOE_REG_INT_STA : constant UInt8 := 16#0B#;
IOE_REG_GPIO_INT_EN : constant UInt8 := 16#0C#;
IOE_REG_GPIO_INT_STA : constant UInt8 := 16#0D#;
-- touch Panel Pins
TOUCH_YD : constant UInt8 := 16#02#;
TOUCH_XD : constant UInt8 := 16#04#;
TOUCH_YU : constant UInt8 := 16#08#;
TOUCH_XU : constant UInt8 := 16#10#;
TOUCH_IO_ALL : constant UInt8 :=
TOUCH_YD or TOUCH_XD or TOUCH_YU or TOUCH_XU;
pragma Warnings (On, "constant * is not referenced");
---------------
-- Read_Data --
---------------
function Read_Data (This : in out STMPE811_Device;
Data_Addr : UInt8;
Length : Natural)
return TSC_Data
is
Data : TSC_Data (1 .. Length);
Addr : UInt8 := Data_Addr;
begin
for Elt of Data loop
Elt := This.Read_Register (Addr);
Addr := Addr + 1;
end loop;
return Data;
end Read_Data;
-------------------
-- Read_Register --
-------------------
function Read_Register (This : STMPE811_Device;
Reg_Addr : UInt8)
return UInt8
is
Data : TSC_Data (1 .. 1);
Status : SPI_Status;
begin
This.Chip_Select.Clear;
This.Port.Transmit (SPI_Data_8b'(16#80# or Reg_Addr, 0), Status);
if Status /= Ok then
raise Program_Error with "Timeout while reading TC data";
end if;
This.Port.Receive (Data, Status);
if Status /= Ok then
raise Program_Error with "Timeout while reading TC data";
end if;
This.Chip_Select.Set;
return Data (Data'First);
end Read_Register;
--------------------
-- Write_Register --
--------------------
procedure Write_Register (This : in out STMPE811_Device;
Reg_Addr : UInt8;
Data : UInt8)
is
Status : SPI_Status;
begin
This.Chip_Select.Clear;
This.Port.Transmit (SPI_Data_8b'(Reg_Addr, Data), Status);
if Status /= Ok then
raise Program_Error with "Timeout while reading TC data";
end if;
This.Chip_Select.Set;
end Write_Register;
---------------
-- IOE_Reset --
---------------
procedure IOE_Reset (This : in out STMPE811_Device) is
Discard : UInt8;
begin
This.Write_Register (IOE_REG_SYS_CTRL1, 16#02#);
-- Give some time for the reset
This.Time.Delay_Milliseconds (10);
for X in UInt8 range 0 .. 64 loop
Discard := This.Read_Register (X);
end loop;
This.Write_Register (IOE_REG_SYS_CTRL2, 16#00#);
end IOE_Reset;
--------------------------
-- IOE_Function_Command --
--------------------------
procedure IOE_Function_Command (This : in out STMPE811_Device;
Func : UInt8;
Enabled : Boolean)
is
Reg : UInt8 := This.Read_Register (IOE_REG_SYS_CTRL2);
begin
-- CTRL2 functions are disabled when corresponding bit is set
if Enabled then
Reg := Reg and (not Func);
else
Reg := Reg or Func;
end if;
This.Write_Register (IOE_REG_SYS_CTRL2, Reg);
end IOE_Function_Command;
-------------------
-- IOE_AF_Config --
-------------------
procedure IOE_AF_Config (This : in out STMPE811_Device;
Pin : UInt8;
Enabled : Boolean) is
Reg : UInt8 := This.Read_Register (IOE_REG_GPIO_AF);
begin
if Enabled then
Reg := Reg or Pin;
else
Reg := Reg and (not Pin);
end if;
This.Write_Register (IOE_REG_GPIO_AF, Reg);
end IOE_AF_Config;
----------------
-- Get_IOE_ID --
----------------
function Get_IOE_ID (This : in out STMPE811_Device) return UInt16 is
begin
return (UInt16 (This.Read_Register (0)) * (2**8))
or UInt16 (This.Read_Register (1));
end Get_IOE_ID;
----------------
-- Initialize --
----------------
function Initialize (This : in out STMPE811_Device) return Boolean
is
Discard : UInt8;
begin
This.Write_Register (IOE_REG_SYS_CTRL1, 16#02#);
-- Give some time for the reset
This.Time.Delay_Milliseconds (10);
for X in UInt8 range 0 .. 64 loop
Discard := This.Read_Register (X);
end loop;
declare
Id : constant UInt16 := This.Get_IOE_ID;
begin
if Id /= 16#0811# then
return False;
end if;
end;
-- This.Write_Register (IOE_REG_SYS_CTRL2, 16#00#);
--
-- loop
-- This.Write_Register (IOE_REG_TSC_CTRL, 16#01#); -- XYZ | EN
--
-- exit when This.Read_Register (IOE_REG_TSC_CTRL) = 16#01#;
-- end loop;
--
-- This.Write_Register (IOE_REG_INT_EN, 16#01#);
--
-- This.Write_Register (IOE_REG_ADC_CTRL1, Shift_Left (6, 4));
-- This.Write_Register (IOE_REG_ADC_CTRL2, 16#02#);
--
-- This.Write_Register (IOE_REG_TSC_CFG, 16#A4#);
--
-- This.Write_Register (IOE_REG_TSC_FRACT_Z, 16#06#);
--
-- This.Write_Register (IOE_REG_FIFO_TH, 1);
-- This.Write_Register (IOE_REG_FIFO_STA, 1);
-- This.Write_Register (IOE_REG_FIFO_STA, 0);
--
-- This.Write_Register (IOE_REG_TSC_I_DRIVE, 1);
--
-- This.Write_Register (IOE_REG_INT_STA, 16#FF#);
-- This.Write_Register (IOE_REG_INT_CTRL, 16#05#);
--
This.IOE_Function_Command (IOE_ADC_FCT, True);
This.IOE_Function_Command (IOE_TSC_FCT, True);
This.Write_Register (IOE_REG_ADC_CTRL1, 16#49#);
This.Time.Delay_Milliseconds (2);
This.Write_Register (IOE_REG_ADC_CTRL2, 16#01#);
This.IOE_AF_Config (TOUCH_IO_ALL, False);
This.Write_Register (IOE_REG_TSC_CFG, 16#9A#);
This.Write_Register (IOE_REG_FIFO_TH, 16#01#);
This.Write_Register (IOE_REG_FIFO_STA, 16#01#);
This.Write_Register (IOE_REG_FIFO_TH, 16#00#);
This.Write_Register (IOE_REG_TSC_FRACT_Z, 16#00#);
This.Write_Register (IOE_REG_TSC_I_DRIVE, 16#01#);
This.Write_Register (IOE_REG_TSC_CTRL, 16#01#);
This.Write_Register (IOE_REG_INT_STA, 16#FF#);
return True;
end Initialize;
----------------
-- Set_Bounds --
----------------
overriding
procedure Set_Bounds (This : in out STMPE811_Device;
Width : Natural;
Height : Natural;
Swap : HAL.Touch_Panel.Swap_State)
is
begin
This.LCD_Natural_Width := Width;
This.LCD_Natural_Height := Height;
This.Swap := Swap;
end Set_Bounds;
-------------------------
-- Active_Touch_Points --
-------------------------
overriding
function Active_Touch_Points (This : in out STMPE811_Device)
return Touch_Identifier
is
Val : constant UInt8 := This.Read_Register (IOE_REG_FIFO_SIZE);
begin
if Val = 0 then
This.Write_Register (IOE_REG_FIFO_STA, 16#01#);
This.Write_Register (IOE_REG_FIFO_STA, 16#00#);
return 0;
else
return 1;
end if;
end Active_Touch_Points;
---------------------
-- Get_Touch_Point --
---------------------
overriding
function Get_Touch_Point (This : in out STMPE811_Device;
Touch_Id : Touch_Identifier)
return TP_Touch_State
is
State : TP_Touch_State;
Raw_X : UInt32;
Raw_Y : UInt32;
Raw_Z : UInt32;
X : Integer;
Y : Integer;
Tmp : Integer;
begin
-- Check Touch detected bit in CTRL register
if Touch_Id /= 1 or else This.Active_Touch_Points = 0 then
return (0, 0, 0);
end if;
loop
declare
Data_X : constant TSC_Data := This.Read_Data (IOE_REG_TSC_DATA_X, 2);
Data_Y : constant TSC_Data := This.Read_Data (IOE_REG_TSC_DATA_Y, 2);
Data_Z : constant TSC_Data := This.Read_Data (IOE_REG_TSC_DATA_Z, 1);
Z_Frac : constant TSC_Data := This.Read_Data (IOE_REG_TSC_FRACT_Z, 1);
begin
Raw_X := 2 ** 12 -
(Shift_Left (UInt32 (Data_X (1)) and 16#0F#, 8) or UInt32 (Data_X (2)));
Raw_Y :=
Shift_Left (UInt32 (Data_Y (1)) and 16#0F#, 8) or UInt32 (Data_Y (2));
Raw_Z :=
Shift_Right (UInt32 (Data_Z (1)), Natural (Z_Frac (1) and 2#111#));
end;
exit when This.Read_Register (IOE_REG_FIFO_SIZE) = 0;
end loop;
-- Now we adapt the 12 bit resolution to the LCD width.
X :=
Integer
(Shift_Right (Raw_X * (UInt32 (This.LCD_Natural_Width) + 32), 12));
X := X - 16;
X := Integer'Max (X, 0);
X := Integer'Min (X, This.LCD_Natural_Width - 1);
-- Do the same for Y
Y := Integer (Raw_Y);
Y := Y - 360;
Y := Y / 11;
Y := Integer'Max (Y, 0);
Y := Integer'Min (Y, This.LCD_Natural_Height - 1);
-- ??? There seems to be a strange behavior of this touch panel where
-- sometimes it reports dummy points at X = LCD_Natural_Width.
-- Let's filter this out
if X = This.LCD_Natural_Width - 1 then
return (0, 0, 0);
end if;
if (This.Swap and Invert_X) /= 0 then
X := This.LCD_Natural_Width - X - 1;
end if;
if (This.Swap and Invert_Y) /= 0 then
Y := This.LCD_Natural_Height - Y - 1;
end if;
if (This.Swap and Swap_XY) /= 0 then
Tmp := X;
X := Y;
Y := Tmp;
end if;
State.X := X;
State.Y := Y;
State.Weight := Integer'Max (Integer (Raw_Z), 8);
This.Write_Register (IOE_REG_FIFO_STA, 16#01#);
This.Write_Register (IOE_REG_FIFO_STA, 16#00#);
return State;
end Get_Touch_Point;
--------------------------
-- Get_All_Touch_Points --
--------------------------
overriding
function Get_All_Touch_Points
(This : in out STMPE811_Device)
return HAL.Touch_Panel.TP_State
is
N_Touch : constant Natural := This.Active_Touch_Points;
State : TP_State (1 .. N_Touch);
begin
if N_Touch = 0 then
return (1 .. 0 => <>);
end if;
for J in State'Range loop
State (J) := This.Get_Touch_Point (J);
end loop;
return State;
end Get_All_Touch_Points;
end BB_Pico_Bsp.STMPE811;
|
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Nodes.Case_Statements is
function Create
(Case_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Selecting_Expression : not null Program.Elements.Expressions
.Expression_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Paths : not null Program.Elements.Case_Paths
.Case_Path_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Case_Token_2 : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Case_Statement is
begin
return Result : Case_Statement :=
(Case_Token => Case_Token,
Selecting_Expression => Selecting_Expression, Is_Token => Is_Token,
Paths => Paths, End_Token => End_Token, Case_Token_2 => Case_Token_2,
Semicolon_Token => Semicolon_Token, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Selecting_Expression : not null Program.Elements.Expressions
.Expression_Access;
Paths : not null Program.Elements.Case_Paths
.Case_Path_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Case_Statement is
begin
return Result : Implicit_Case_Statement :=
(Selecting_Expression => Selecting_Expression, Paths => Paths,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Selecting_Expression
(Self : Base_Case_Statement)
return not null Program.Elements.Expressions.Expression_Access is
begin
return Self.Selecting_Expression;
end Selecting_Expression;
overriding function Paths
(Self : Base_Case_Statement)
return not null Program.Elements.Case_Paths.Case_Path_Vector_Access is
begin
return Self.Paths;
end Paths;
overriding function Case_Token
(Self : Case_Statement)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Case_Token;
end Case_Token;
overriding function Is_Token
(Self : Case_Statement)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Is_Token;
end Is_Token;
overriding function End_Token
(Self : Case_Statement)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.End_Token;
end End_Token;
overriding function Case_Token_2
(Self : Case_Statement)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Case_Token_2;
end Case_Token_2;
overriding function Semicolon_Token
(Self : Case_Statement)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Semicolon_Token;
end Semicolon_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Case_Statement)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Case_Statement)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Case_Statement)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : in out Base_Case_Statement'Class) is
begin
Set_Enclosing_Element (Self.Selecting_Expression, Self'Unchecked_Access);
for Item in Self.Paths.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
null;
end Initialize;
overriding function Is_Case_Statement
(Self : Base_Case_Statement)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Case_Statement;
overriding function Is_Statement
(Self : Base_Case_Statement)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Statement;
overriding procedure Visit
(Self : not null access Base_Case_Statement;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Case_Statement (Self);
end Visit;
overriding function To_Case_Statement_Text
(Self : in out Case_Statement)
return Program.Elements.Case_Statements.Case_Statement_Text_Access is
begin
return Self'Unchecked_Access;
end To_Case_Statement_Text;
overriding function To_Case_Statement_Text
(Self : in out Implicit_Case_Statement)
return Program.Elements.Case_Statements.Case_Statement_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Case_Statement_Text;
end Program.Nodes.Case_Statements;
|
-- This spec has been automatically generated from cm4f.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package Cortex_M_SVD.Debug is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Debug Fault Status Register
type DFSR_Register is record
HALTED : Boolean := False;
-- BKPT instruction executed or breakpoint match in FPB.
BKPT : Boolean := False;
-- Data Watchpoint and Trace trap. Indicates that the core halted due to
-- at least one DWT trap event.
DWTTRAP : Boolean := False;
-- Vector catch triggered. Corresponding FSR will contain the primary
-- cause of the exception.
VCATCH : Boolean := False;
-- An asynchronous exception generated due to the assertion of EDBGRQ.
EXTERNAL : Boolean := False;
-- unspecified
Reserved_5_31 : HAL.UInt27 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DFSR_Register use record
HALTED at 0 range 0 .. 0;
BKPT at 0 range 1 .. 1;
DWTTRAP at 0 range 2 .. 2;
VCATCH at 0 range 3 .. 3;
EXTERNAL at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
-------------------------------
-- DHCSR cluster's Registers --
-------------------------------
type Read_DHCSR_Register is record
-- Read-only.
C_DEBUGGEN : Boolean;
-- Read-only.
C_HALT : Boolean;
-- Read-only.
C_STEP : Boolean;
-- Read-only.
C_MASKINTS : Boolean;
-- unspecified
Reserved_4_4 : HAL.Bit;
-- Read-only.
C_SNAPSTALL : Boolean;
-- unspecified
Reserved_6_15 : HAL.UInt10;
-- Read-only.
S_REGRDY : Boolean;
-- Read-only.
S_HALT : Boolean;
-- Read-only.
S_SLEEP : Boolean;
-- Read-only.
S_LOCKUP : Boolean;
-- unspecified
Reserved_20_23 : HAL.UInt4;
-- Read-only.
S_RETIRE_ST : Boolean;
-- Read-only.
S_RESET_ST : Boolean;
-- unspecified
Reserved_26_31 : HAL.UInt6;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for Read_DHCSR_Register use record
C_DEBUGGEN at 0 range 0 .. 0;
C_HALT at 0 range 1 .. 1;
C_STEP at 0 range 2 .. 2;
C_MASKINTS at 0 range 3 .. 3;
Reserved_4_4 at 0 range 4 .. 4;
C_SNAPSTALL at 0 range 5 .. 5;
Reserved_6_15 at 0 range 6 .. 15;
S_REGRDY at 0 range 16 .. 16;
S_HALT at 0 range 17 .. 17;
S_SLEEP at 0 range 18 .. 18;
S_LOCKUP at 0 range 19 .. 19;
Reserved_20_23 at 0 range 20 .. 23;
S_RETIRE_ST at 0 range 24 .. 24;
S_RESET_ST at 0 range 25 .. 25;
Reserved_26_31 at 0 range 26 .. 31;
end record;
subtype Write_DHCSR_S_RESET_ST_Field is HAL.UInt16;
type Write_DHCSR_Register is record
-- Write-only.
C_DEBUGGEN : Boolean := False;
-- Write-only.
C_HALT : Boolean := False;
-- Write-only.
C_STEP : Boolean := False;
-- Write-only.
C_MASKINTS : Boolean := False;
-- unspecified
Reserved_4_4 : HAL.Bit := 16#0#;
-- Write-only.
C_SNAPSTALL : Boolean := False;
-- unspecified
Reserved_6_15 : HAL.UInt10 := 16#0#;
-- Write-only. Debug Key. The value 0xA05F must be written to enable
-- write accesses to bits [15:0], otherwise the write access will be
-- ignored. Read behavior of bits [31:16] is as listed below.
S_RESET_ST : Write_DHCSR_S_RESET_ST_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for Write_DHCSR_Register use record
C_DEBUGGEN at 0 range 0 .. 0;
C_HALT at 0 range 1 .. 1;
C_STEP at 0 range 2 .. 2;
C_MASKINTS at 0 range 3 .. 3;
Reserved_4_4 at 0 range 4 .. 4;
C_SNAPSTALL at 0 range 5 .. 5;
Reserved_6_15 at 0 range 6 .. 15;
S_RESET_ST at 0 range 16 .. 31;
end record;
type DHCSR_Disc is
(
Mode_1,
Mode_2);
-- Debug Halting Control and Status Register
type DHCSR_Cluster
(Discriminent : DHCSR_Disc := Mode_1)
is record
case Discriminent is
when Mode_1 =>
Read : aliased Read_DHCSR_Register;
when Mode_2 =>
Write : aliased Write_DHCSR_Register;
end case;
end record
with Unchecked_Union, Volatile, Size => 32;
for DHCSR_Cluster use record
Read at 0 range 0 .. 31;
Write at 0 range 0 .. 31;
end record;
type DCRSR_HALTED_Field is
(
Register_0,
Register_1,
Register_2,
Register_3,
Register_4,
Register_5,
Register_6,
Register_7,
Register_8,
Register_9,
Register_10,
Register_11,
Register_12,
Current_Sp,
Link_Rregister,
Debug_Return_Address,
XPsr,
Msp,
Psp,
Control_Faultmask_Basepri_Primask)
with Size => 5;
for DCRSR_HALTED_Field use
(Register_0 => 0,
Register_1 => 1,
Register_2 => 2,
Register_3 => 3,
Register_4 => 4,
Register_5 => 5,
Register_6 => 6,
Register_7 => 7,
Register_8 => 8,
Register_9 => 9,
Register_10 => 10,
Register_11 => 11,
Register_12 => 12,
Current_Sp => 13,
Link_Rregister => 14,
Debug_Return_Address => 15,
XPsr => 16,
Msp => 17,
Psp => 18,
Control_Faultmask_Basepri_Primask => 19);
type DCRSR_REGWnR_Field is
(
Read,
Write)
with Size => 1;
for DCRSR_REGWnR_Field use
(Read => 0,
Write => 1);
-- Debug Core Register Selector Register: The DCRSR write-only register
-- generates a handshake to the core to transfer the selected register
-- to/from the DCRDR. The DHCSR S_REGRDY bit is cleared when the DCRSR is
-- written, and remains clear until the core transaction completes. This
-- register is only accessible from Debug state.
type DCRSR_Register is record
-- Write-only.
HALTED : DCRSR_HALTED_Field := Cortex_M_SVD.Debug.Register_0;
-- unspecified
Reserved_5_15 : HAL.UInt11 := 16#0#;
-- Write-only.
REGWnR : DCRSR_REGWnR_Field := Cortex_M_SVD.Debug.Read;
-- unspecified
Reserved_17_31 : HAL.UInt15 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DCRSR_Register use record
HALTED at 0 range 0 .. 4;
Reserved_5_15 at 0 range 5 .. 15;
REGWnR at 0 range 16 .. 16;
Reserved_17_31 at 0 range 17 .. 31;
end record;
-- Debug Exception and Monitor Control Register
type DEMCR_Register is record
VC_CORERESET : Boolean := False;
-- unspecified
Reserved_1_3 : HAL.UInt3 := 16#0#;
VC_MMERR : Boolean := False;
VC_NOCPERR : Boolean := False;
VC_CHKERR : Boolean := False;
VC_STATERR : Boolean := False;
VC_BUSERR : Boolean := False;
VC_INTERR : Boolean := False;
VC_HARDERR : Boolean := False;
-- unspecified
Reserved_11_15 : HAL.UInt5 := 16#0#;
MON_EN : Boolean := False;
MON_PEND : Boolean := False;
MON_STEP : Boolean := False;
MON_REQ : Boolean := False;
-- unspecified
Reserved_20_23 : HAL.UInt4 := 16#0#;
TRCENA : Boolean := False;
-- unspecified
Reserved_25_31 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DEMCR_Register use record
VC_CORERESET at 0 range 0 .. 0;
Reserved_1_3 at 0 range 1 .. 3;
VC_MMERR at 0 range 4 .. 4;
VC_NOCPERR at 0 range 5 .. 5;
VC_CHKERR at 0 range 6 .. 6;
VC_STATERR at 0 range 7 .. 7;
VC_BUSERR at 0 range 8 .. 8;
VC_INTERR at 0 range 9 .. 9;
VC_HARDERR at 0 range 10 .. 10;
Reserved_11_15 at 0 range 11 .. 15;
MON_EN at 0 range 16 .. 16;
MON_PEND at 0 range 17 .. 17;
MON_STEP at 0 range 18 .. 18;
MON_REQ at 0 range 19 .. 19;
Reserved_20_23 at 0 range 20 .. 23;
TRCENA at 0 range 24 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
type Debug_Peripheral is record
-- Debug Fault Status Register
DFSR : aliased DFSR_Register;
-- Debug Halting Control and Status Register
DHCSR : aliased DHCSR_Cluster;
-- Debug Core Register Selector Register: The DCRSR write-only register
-- generates a handshake to the core to transfer the selected register
-- to/from the DCRDR. The DHCSR S_REGRDY bit is cleared when the DCRSR
-- is written, and remains clear until the core transaction completes.
-- This register is only accessible from Debug state.
DCRSR : aliased DCRSR_Register;
-- Debug Core Register Data Register
DCRDR : aliased HAL.UInt32;
-- Debug Exception and Monitor Control Register
DEMCR : aliased DEMCR_Register;
end record
with Volatile;
for Debug_Peripheral use record
DFSR at 16#30# range 0 .. 31;
DHCSR at 16#F0# range 0 .. 31;
DCRSR at 16#F4# range 0 .. 31;
DCRDR at 16#F8# range 0 .. 31;
DEMCR at 16#FC# range 0 .. 31;
end record;
Debug_Periph : aliased Debug_Peripheral
with Import, Address => Debug_Base;
end Cortex_M_SVD.Debug;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.