content
stringlengths
23
1.05M
with Ada.Text_IO; procedure Reproduce is type String_T is new String; function "+" (Left : String) return String_T is (String_T(Left)); function "+" (Left : String_T; Right : String) return String_T is (String_T(String (Left) & Right)); generic Description : String_T; package Generic_G is procedure Go; end Generic_G; package body Generic_G is procedure Go is begin Ada.Text_IO.Put_Line (String (Description)); end Go; end Generic_G; package Impl is procedure Go; end Impl; package body Impl is package Generic1 is new Generic_G (Description => +"; " +":"); procedure Go renames Generic1.Go; end Impl; begin Impl.Go; end Reproduce;
-- SPDX-FileCopyrightText: 2022 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Regions.Contexts.Environments.Package_Nodes; package body Regions.Contexts.Environments.Nodes is type Entity_Access is access all Regions.Entities.Entity'Class; --------------- -- Empty_Map -- --------------- function Empty_Map (Self : access Environment_Node) return Node_Maps.Map is begin return Node_Maps.Empty_Map (Self.Context.Version'Access); end Empty_Map; ---------------- -- Get_Entity -- ---------------- function Get_Entity (Self : in out Environment_Node'Class; Name : Selected_Entity_Name) return Regions.Entities.Entity_Access is Cached : constant Entity_Maps.Cursor := Self.Cache.Find (Name); Item : Entity_Access; Result : Regions.Entities.Entity_Access; begin if Entity_Maps.Has_Element (Cached) then return Entity_Maps.Element (Cached); elsif Self.Nodes.Contains (Name) then -- Node := Self.Nodes.Element (Name); Item := new Package_Nodes.Package_Entity' (Env => Self'Unchecked_Access, Name => Name); Result := Regions.Entities.Entity_Access (Item); Self.Cache.Insert (Name, Result); return Result; else return null; end if; end Get_Entity; ---------------- -- Rerference -- ---------------- procedure Reference (Self : in out Environment_Node'Class) is begin Self.Counter := Self.Counter + 1; end Reference; ----------------- -- Unreference -- ----------------- procedure Unreference (Self : in out Environment_Node'Class; Last : out Boolean) is begin Last := Self.Counter <= 1; if Last then Self.Counter := 0; else Self.Counter := Self.Counter - 1; end if; end Unreference; end Regions.Contexts.Environments.Nodes;
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2013 Felix Krause <contact@flyx.org> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with GL.Buffers; with GL.Low_Level.Enums; with GL.Objects.Textures; with GL.Pixels.Extensions; with GL.Types.Colors; private with GL.Enums; package GL.Objects.Framebuffers is pragma Preelaborate; use all type GL.Low_Level.Enums.Texture_Kind; type Framebuffer_Status is (Undefined, Complete, Incomplete_Attachment, Incomplete_Missing_Attachment, Incomplete_Draw_Buffer, Incomplete_Read_Buffer, Unsupported, Incomplete_Multisample, Incomplete_Layer_Targets); type Attachment_Point is (Depth_Stencil_Attachment, Color_Attachment_0, Color_Attachment_1, Color_Attachment_2, Color_Attachment_3, Color_Attachment_4, Color_Attachment_5, Color_Attachment_6, Color_Attachment_7, Color_Attachment_8, Color_Attachment_9, Color_Attachment_10, Color_Attachment_11, Color_Attachment_12, Color_Attachment_13, Color_Attachment_14, Color_Attachment_15, Depth_Attachment, Stencil_Attachment); type Default_Attachment_Point is (Front_Left, Front_Right, Back_Left, Back_Right, Depth, Stencil); type Attachment_List is array (Positive range <>) of Attachment_Point; type Default_Attachment_List is array (Positive range <>) of Default_Attachment_Point; function Valid_Attachment (Attachment : Attachment_Point; Texture : Textures.Texture) return Boolean with Pre => not Texture.Compressed and Texture.Allocated; type Framebuffer is new GL_Object with private; overriding procedure Initialize_Id (Object : in out Framebuffer); overriding procedure Delete_Id (Object : in out Framebuffer); overriding function Identifier (Object : Framebuffer) return Types.Debug.Identifier is (Types.Debug.Framebuffer); procedure Set_Draw_Buffer (Object : Framebuffer; Selector : Buffers.Color_Buffer_Selector) with Pre => (if Object = Default_Framebuffer then Selector in Buffers.Default_Color_Buffer_Selector | Buffers.None else Selector in Buffers.Explicit_Color_Buffer_Selector | Buffers.None); procedure Set_Draw_Buffers (Object : Framebuffer; List : Buffers.Color_Buffer_List) with Pre => (if Object = Default_Framebuffer then (for all S of List => S in Buffers.Default_Color_Buffer_Selector | Buffers.None) else (for all S of List => S in Buffers.Explicit_Color_Buffer_Selector | Buffers.None)); procedure Set_Read_Buffer (Object : Framebuffer; Selector : Buffers.Color_Buffer_Selector) with Pre => (if Object = Default_Framebuffer then Selector in Buffers.Default_Color_Buffer_Selector | Buffers.None else Selector in Buffers.Explicit_Color_Buffer_Selector | Buffers.None); procedure Attach_Texture (Object : Framebuffer; Attachment : Attachment_Point; Texture : Textures.Texture; Level : Textures.Mipmap_Level) with Pre => Object /= Default_Framebuffer and Valid_Attachment (Attachment, Texture) and (if Texture.Kind in Texture_2D_Multisample | Texture_2D_Multisample_Array then Level = 0); procedure Attach_Texture_Layer (Object : Framebuffer; Attachment : Attachment_Point; Texture : Textures.Texture; Level : Textures.Mipmap_Level; Layer : Natural) with Pre => Object /= Default_Framebuffer and Valid_Attachment (Attachment, Texture) and Texture.Layered; procedure Detach (Object : Framebuffer; Attachment : Attachment_Point) with Pre => Object /= Default_Framebuffer; procedure Invalidate_Data (Object : Framebuffer; Attachments : Attachment_List) with Pre => Object /= Default_Framebuffer; procedure Invalidate_Sub_Data (Object : Framebuffer; Attachments : Attachment_List; X, Y : Int; Width, Height : Size) with Pre => Object /= Default_Framebuffer; procedure Invalidate_Data (Object : Framebuffer; Attachments : Default_Attachment_List) with Pre => Object = Default_Framebuffer; procedure Invalidate_Sub_Data (Object : Framebuffer; Attachments : Default_Attachment_List; X, Y : Int; Width, Height : Size) with Pre => Object = Default_Framebuffer; ---------------------------------------------------------------------------- procedure Set_Default_Width (Object : Framebuffer; Value : Size) with Pre => Object /= Default_Framebuffer; procedure Set_Default_Height (Object : Framebuffer; Value : Size) with Pre => Object /= Default_Framebuffer; procedure Set_Default_Layers (Object : Framebuffer; Value : Size) with Pre => Object /= Default_Framebuffer; procedure Set_Default_Samples (Object : Framebuffer; Value : Size) with Pre => Object /= Default_Framebuffer; procedure Set_Default_Fixed_Sample_Locations (Object : Framebuffer; Value : Boolean) with Pre => Object /= Default_Framebuffer; function Default_Width (Object : Framebuffer) return Size with Pre => Object /= Default_Framebuffer; function Default_Height (Object : Framebuffer) return Size with Pre => Object /= Default_Framebuffer; function Default_Layers (Object : Framebuffer) return Size with Pre => Object /= Default_Framebuffer; function Default_Samples (Object : Framebuffer) return Size with Pre => Object /= Default_Framebuffer; function Default_Fixed_Sample_Locations (Object : Framebuffer) return Boolean with Pre => Object /= Default_Framebuffer; ---------------------------------------------------------------------------- function Max_Framebuffer_Width return Size with Post => Max_Framebuffer_Width'Result >= 16_384; function Max_Framebuffer_Height return Size with Post => Max_Framebuffer_Height'Result >= 16_384; function Max_Framebuffer_Layers return Size with Post => Max_Framebuffer_Layers'Result >= 2_048; function Max_Framebuffer_Samples return Size with Post => Max_Framebuffer_Samples'Result >= 4; procedure Blit (Read_Object, Draw_Object : Framebuffer; Src_X0, Src_Y0, Src_X1, Src_Y1, Dst_X0, Dst_Y0, Dst_X1, Dst_Y1 : Int; Mask : Buffers.Buffer_Bits; Filter : Textures.Magnifying_Function); -- Copy a rectangle of pixels in Read_Object framebuffer to a region -- in Draw_Object framebuffer procedure Clear_Color_Buffer (Object : Framebuffer; Index : Buffers.Draw_Buffer_Index; Format_Type : Pixels.Extensions.Format_Type; Value : Colors.Color); procedure Clear_Depth_Buffer (Object : Framebuffer; Value : Buffers.Depth); procedure Clear_Stencil_Buffer (Object : Framebuffer; Value : Buffers.Stencil_Index); procedure Clear_Depth_And_Stencil_Buffer (Object : Framebuffer; Depth_Value : Buffers.Depth; Stencil_Value : Buffers.Stencil_Index); type Framebuffer_Target (<>) is tagged limited private; procedure Bind (Target : Framebuffer_Target; Object : Framebuffer'Class); function Status (Object : Framebuffer; Target : Framebuffer_Target'Class) return Framebuffer_Status; Read_Target : constant Framebuffer_Target; Draw_Target : constant Framebuffer_Target; function Default_Framebuffer return Framebuffer; private for Framebuffer_Status use (Undefined => 16#8219#, Complete => 16#8CD5#, Incomplete_Attachment => 16#8CD6#, Incomplete_Missing_Attachment => 16#8CD7#, Incomplete_Draw_Buffer => 16#8CDB#, Incomplete_Read_Buffer => 16#8CDC#, Unsupported => 16#8CDD#, Incomplete_Multisample => 16#8D56#, Incomplete_Layer_Targets => 16#8DA8#); for Framebuffer_Status'Size use Low_Level.Enum'Size; for Attachment_Point use (Depth_Stencil_Attachment => 16#821A#, Color_Attachment_0 => 16#8CE0#, Color_Attachment_1 => 16#8CE1#, Color_Attachment_2 => 16#8CE2#, Color_Attachment_3 => 16#8CE3#, Color_Attachment_4 => 16#8CE4#, Color_Attachment_5 => 16#8CE5#, Color_Attachment_6 => 16#8CE6#, Color_Attachment_7 => 16#8CE7#, Color_Attachment_8 => 16#8CE8#, Color_Attachment_9 => 16#8CE9#, Color_Attachment_10 => 16#8CEA#, Color_Attachment_11 => 16#8CEB#, Color_Attachment_12 => 16#8CEC#, Color_Attachment_13 => 16#8CED#, Color_Attachment_14 => 16#8CEE#, Color_Attachment_15 => 16#8CEF#, Depth_Attachment => 16#8D00#, Stencil_Attachment => 16#8D20#); for Attachment_Point'Size use Low_Level.Enum'Size; for Default_Attachment_Point use (Front_Left => 16#0400#, Front_Right => 16#0401#, Back_Left => 16#0402#, Back_Right => 16#0403#, Depth => 16#1801#, Stencil => 16#1802#); for Default_Attachment_Point'Size use Low_Level.Enum'Size; pragma Convention (C, Attachment_List); pragma Convention (C, Default_Attachment_List); type Framebuffer is new GL_Object with null record; type Framebuffer_Target (Kind : Enums.Framebuffer_Kind) is tagged limited null record; Read_Target : constant Framebuffer_Target := Framebuffer_Target'(Kind => Enums.Read); Draw_Target : constant Framebuffer_Target := Framebuffer_Target'(Kind => Enums.Draw); end GL.Objects.Framebuffers;
----------------------------------------------------------------------- -- util-events-timers -- Timer list management -- 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. ----------------------------------------------------------------------- with Ada.Unchecked_Deallocation; with Util.Log.Loggers; package body Util.Events.Timers is use type Ada.Real_Time.Time; Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Util.Events.Timers"); procedure Free is new Ada.Unchecked_Deallocation (Object => Timer_Node, Name => Timer_Node_Access); -- ----------------------- -- Repeat the timer. -- ----------------------- procedure Repeat (Event : in out Timer_Ref; In_Time : in Ada.Real_Time.Time_Span) is Timer : constant Timer_Node_Access := Event.Value; begin if Timer /= null and then Timer.List /= null then Timer.List.Add (Timer, Timer.Deadline + In_Time); end if; end Repeat; -- ----------------------- -- Cancel the timer. -- ----------------------- procedure Cancel (Event : in out Timer_Ref) is begin if Event.Value /= null and then Event.Value.List /= null then Event.Value.List.all.Cancel (Event.Value); Event.Value.List := null; end if; end Cancel; -- ----------------------- -- Check if the timer is ready to be executed. -- ----------------------- function Is_Scheduled (Event : in Timer_Ref) return Boolean is begin return Event.Value /= null and then Event.Value.List /= null; end Is_Scheduled; -- ----------------------- -- Returns the deadline time for the timer execution. -- Returns Time'Last if the timer is not scheduled. -- ----------------------- function Time_Of_Event (Event : in Timer_Ref) return Ada.Real_Time.Time is begin return (if Event.Value /= null then Event.Value.Deadline else Ada.Real_Time.Time_Last); end Time_Of_Event; -- ----------------------- -- Set a timer to be called at the given time. -- ----------------------- procedure Set_Timer (List : in out Timer_List; Handler : in Timer_Access; Event : in out Timer_Ref'Class; At_Time : in Ada.Real_Time.Time) is Timer : Timer_Node_Access := Event.Value; begin if Timer = null then Event.Value := new Timer_Node; Timer := Event.Value; end if; Timer.Handler := Handler; -- Cancel the timer if it is part of another timer manager. if Timer.List /= null and Timer.List /= List.Manager'Unchecked_Access then Timer.List.Cancel (Timer); end if; -- Update the timer. Timer.List := List.Manager'Unchecked_Access; List.Manager.Add (Timer, At_Time); end Set_Timer; -- ----------------------- -- Set a timer to be called after the given time span. -- ----------------------- procedure Set_Timer (List : in out Timer_List; Handler : in Timer_Access; Event : in out Timer_Ref'Class; In_Time : in Ada.Real_Time.Time_Span) is begin List.Set_Timer (Handler, Event, Ada.Real_Time.Clock + In_Time); end Set_Timer; -- ----------------------- -- Process the timer handlers that have passed the deadline and return the next -- deadline. The <tt>Max_Count</tt> parameter allows to limit the number of timer handlers -- that are called by operation. The default is not limited. -- ----------------------- procedure Process (List : in out Timer_List; Timeout : out Ada.Real_Time.Time; Max_Count : in Natural := Natural'Last) is Timer : Timer_Ref; Now : constant Ada.Real_Time.Time := Ada.Real_Time.Clock; begin for Count in 1 .. Max_Count loop List.Manager.Find_Next (Now, Timeout, Timer); exit when Timer.Value = null; begin Timer.Value.Handler.Time_Handler (Timer); exception when E : others => Timer_List'Class (List).Error (Timer.Value.Handler, E); end; Timer.Finalize; end loop; end Process; -- ----------------------- -- Procedure called when a timer handler raises an exception. -- The default operation reports an error in the logs. This procedure can be -- overriden to implement specific error handling. -- ----------------------- procedure Error (List : in out Timer_List; Handler : in Timer_Access; E : in Ada.Exceptions.Exception_Occurrence) is pragma Unreferenced (List, Handler); begin Log.Error ("Timer handler raised an exception", E, True); end Error; overriding procedure Adjust (Object : in out Timer_Ref) is begin if Object.Value /= null then Util.Concurrent.Counters.Increment (Object.Value.Counter); end if; end Adjust; overriding procedure Finalize (Object : in out Timer_Ref) is Is_Zero : Boolean; begin if Object.Value /= null then Util.Concurrent.Counters.Decrement (Object.Value.Counter, Is_Zero); if Is_Zero then Free (Object.Value); else Object.Value := null; end if; end if; end Finalize; protected body Timer_Manager is procedure Remove (Timer : in Timer_Node_Access) is begin if List = Timer then List := Timer.Next; Timer.Prev := null; if List /= null then List.Prev := null; end if; elsif Timer.Prev /= null then Timer.Prev.Next := Timer.Next; Timer.Next.Prev := Timer.Prev; else return; end if; Timer.Next := null; Timer.Prev := null; Timer.List := null; end Remove; -- ----------------------- -- Add a timer. -- ----------------------- procedure Add (Timer : in Timer_Node_Access; Deadline : in Ada.Real_Time.Time) is Current : Timer_Node_Access := List; Prev : Timer_Node_Access; begin Util.Concurrent.Counters.Increment (Timer.Counter); if Timer.List /= null then Remove (Timer); end if; Timer.Deadline := Deadline; while Current /= null loop if Current.Deadline > Deadline then if Prev = null then List := Timer; else Prev.Next := Timer; end if; Timer.Next := Current; Current.Prev := Timer; return; end if; Prev := Current; Current := Current.Next; end loop; if Prev = null then List := Timer; Timer.Prev := null; else Prev.Next := Timer; Timer.Prev := Prev; end if; Timer.Next := null; end Add; -- ----------------------- -- Cancel a timer. -- ----------------------- procedure Cancel (Timer : in out Timer_Node_Access) is Is_Zero : Boolean; begin if Timer.List = null then return; end if; Remove (Timer); Util.Concurrent.Counters.Decrement (Timer.Counter, Is_Zero); if Is_Zero then Free (Timer); end if; end Cancel; -- ----------------------- -- Find the next timer to be executed before the given time or return the next deadline. -- ----------------------- procedure Find_Next (Before : in Ada.Real_Time.Time; Deadline : out Ada.Real_Time.Time; Timer : in out Timer_Ref) is begin if List = null then Deadline := Ada.Real_Time.Time_Last; elsif List.Deadline < Before then Timer.Value := List; List := List.Next; if List /= null then List.Prev := null; Deadline := List.Deadline; else Deadline := Ada.Real_Time.Time_Last; end if; else Deadline := List.Deadline; end if; end Find_Next; end Timer_Manager; overriding procedure Finalize (Object : in out Timer_List) is Timer : Timer_Ref; Timeout : Ada.Real_Time.Time; begin loop Object.Manager.Find_Next (Ada.Real_Time.Time_Last, Timeout, Timer); exit when Timer.Value = null; Timer.Finalize; end loop; end Finalize; end Util.Events.Timers;
generic -- low: integer; --lowerbound of stack --up: integer; -- upperbound of stack max: integer; type item is private; -- type of stack package gstack is procedure tpush(x: in item); procedure tpop(x: out item); procedure spush(x: in item); procedure spop(x: out item); function spaceAvail return Boolean; private type entries is array( integer range <>) of item; end gstack;
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Ada.Containers.Hashed_Maps; package body Coroutines.Polling is use type Interfaces.C.int; function epoll_create1 (Flag : Interfaces.C.int) return Interfaces.C.int with Import, Convention => C, External_Name => "epoll_create1"; pragma Warnings (Off); EPOLL_CLOEXEC : constant := 8#02000000#; EPOLLIN : constant := 16#001#; EPOLLPRI : constant := 16#002#; EPOLLOUT : constant := 16#004#; EPOLLRDNORM : constant := 16#040#; EPOLLRDBAND : constant := 16#080#; EPOLLWRNORM : constant := 16#100#; EPOLLWRBAND : constant := 16#200#; EPOLLMSG : constant := 16#400#; EPOLLERR : constant := 16#008#; EPOLLHUP : constant := 16#010#; EPOLLRDHUP : constant := 16#2000#; -- EPOLLEXCLUSIVE = 1u << 28, EPOLLEXCLUSIVE : constant := 16#1000_0000#; -- EPOLLWAKEUP = 1u << 29, EPOLLWAKEUP : constant := 16#2000_0000#; -- EPOLLONESHOT = 1u << 30, EPOLLONESHOT : constant := 16#4000_0000#; -- EPOLLET = 1u << 31 EPOLLET : constant := 16#8000_0000#; EPOLL_CTL_ADD : constant := 1; EPOLL_CTL_DEL : constant := 2; EPOLL_CTL_MOD : constant := 3; pragma Warnings (On); type Polling_Manager; type Polling_Manager_Access is access all Polling_Manager'Class; type Polling_Event is new Event_Object with record FD : Polling.FD; Events : Polling_Kind_Set; Context : Coroutines.Context; Manager : Polling_Manager_Access; Ready : Boolean := False; Active : Boolean := False; -- Already in epfd Drop : Boolean := False; -- Already in epfd, but should not end record; overriding procedure Activate (Self : in out Polling_Event); overriding function Ready (Self : Polling_Event) return Boolean; overriding procedure Deactivate (Self : in out Polling_Event); type Polling_Event_Access is access all Polling_Event; function Hash (Value : FD) return Ada.Containers.Hash_Type is (Ada.Containers.Hash_Type'Mod (Value)); type epoll_event is record events : Interfaces.Unsigned_32; data : Polling_Event_Access; end record with Convention => C, Size => 12 * 8, Alignment => 4; for epoll_event use record events at 0 range 0 .. 31; data at 4 range 64 - Long_Integer'Size .. 63; end record; function epoll_ctl (epfd : Interfaces.C.int; op : Interfaces.C.int; fd : Interfaces.C.int; event : epoll_event) return Interfaces.C.int with Import, Convention => C, External_Name => "epoll_ctl"; type epoll_event_array is array (Ada.Containers.Count_Type range <>) of epoll_event with Alignment => 4, Component_Size => 12 * 8; function epoll_wait (epfd : Interfaces.C.int; events : out epoll_event_array; maxevents : Interfaces.C.int; timeout : Interfaces.C.int) return Interfaces.C.int with Import, Convention => C, External_Name => "epoll_wait"; package Event_Maps is new Ada.Containers.Hashed_Maps (Key_Type => FD, Element_Type => Polling_Event_Access, Hash => Hash, Equivalent_Keys => Interfaces.C."="); package Event_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Polling_Event_Access); type Polling_Manager is new Coroutine_Manager with record epfd : FD; Active : Event_Maps.Map; -- Events in epfd Unused : Event_Vectors.Vector; -- Events not in epfd end record; overriding procedure Get_Always_Ready_Event (Self : in out Polling_Manager; Result : out Event_Id); overriding procedure New_Round (Self : in out Polling_Manager; Queue : in out Context_Vectors.Vector; Timeout : Duration); function To_C (Value : Polling_Kind_Set) return Interfaces.Unsigned_32; Manager : aliased Polling_Manager; -------------- -- Activate -- -------------- overriding procedure Activate (Self : in out Polling_Event) is Error : Interfaces.C.int; begin if not Self.Active then Error := epoll_ctl (epfd => Self.Manager.epfd, op => EPOLL_CTL_ADD, fd => Self.FD, event => (To_C (Self.Events), Self'Unchecked_Access)); pragma Assert (Error = 0); Self.Active := True; Self.Manager.Active.Insert (Self.FD, Self'Unchecked_Access); end if; end Activate; ---------------- -- Deactivate -- ---------------- overriding procedure Deactivate (Self : in out Polling_Event) is begin Self.Drop := True; end Deactivate; ---------------------------- -- Get_Always_Ready_Event -- ---------------------------- overriding procedure Get_Always_Ready_Event (Self : in out Polling_Manager; Result : out Event_Id) is begin raise Constraint_Error; end Get_Always_Ready_Event; ---------------- -- Initialize -- ---------------- procedure Initialize is begin pragma Assert (Coroutines.Manager = null, "Register Pooling first!"); Coroutines.Manager := Manager'Access; Manager.epfd := epoll_create1 (EPOLL_CLOEXEC); end Initialize; --------------- -- New_Round -- --------------- overriding procedure New_Round (Self : in out Polling_Manager; Queue : in out Context_Vectors.Vector; Timeout : Duration) is Error : Interfaces.C.int; Last : constant Positive := Self.Unused.Last_Index + 1; begin -- Remove unused FD from epfd for J of Self.Active loop if J.Drop then Error := epoll_ctl (epfd => Self.epfd, op => EPOLL_CTL_DEL, fd => J.FD, event => (0, null)); pragma Assert (Error = 0); Self.Unused.Append (J); end if; end loop; -- Remove unused FD from Active for J in Last .. Self.Unused.Last_Index loop Self.Active.Delete (Self.Unused (J).FD); end loop; declare Events : epoll_event_array (1 .. Self.Active.Length); begin Error := epoll_wait (epfd => Self.epfd, events => Events, maxevents => Events'Length, timeout => Interfaces.C.int (1000.0 * Timeout)); if Error >= 0 then for J in 1 .. Ada.Containers.Count_Type (Error) loop Queue.Append (Events (J).data.Context); Events (J).data.Ready := True; end loop; end if; end; end New_Round; ----------- -- Ready -- ----------- overriding function Ready (Self : Polling_Event) return Boolean is begin return Self.Ready; end Ready; ---------- -- To_C -- ---------- function To_C (Value : Polling_Kind_Set) return Interfaces.Unsigned_32 is use type Interfaces.Unsigned_32; Mapping : constant array (Polling_Kind) of Interfaces.Unsigned_32 := (Input => EPOLLIN, Output => EPOLLOUT, Error => EPOLLERR, Close => EPOLLHUP); Result : Interfaces.Unsigned_32 := 0; begin for J in Value'Range loop if Value (J) then Result := Result + Mapping (J); end if; end loop; return Result; end To_C; ----------- -- Watch -- ----------- function Watch (File : FD; Events : Polling_Kind_Set) return Event_Id is Cursor : constant Event_Maps.Cursor := Manager.Active.Find (File); Result : Polling_Event_Access; Error : Interfaces.C.int; begin if Event_Maps.Has_Element (Cursor) then Result := Event_Maps.Element (Cursor); Result.Context := Current_Context; Result.Ready := False; Result.Drop := False; if Result.Events = Events then return Event_Id (Result); else Error := epoll_ctl (epfd => Manager.epfd, op => EPOLL_CTL_DEL, fd => File, event => (0, null)); pragma Assert (Error = 0); end if; elsif Manager.Unused.Is_Empty then Result := new Polling_Event; else Result := Manager.Unused.Last_Element; Manager.Unused.Delete_Last; end if; Result.all := (Event_Object with FD => File, Events => Events, Context => Current_Context, Manager => Manager'Access, Ready => False, Active => False, Drop => False); return Event_Id (Result); end Watch; end Coroutines.Polling;
With System.Storage_Elements, Risi_Script.Types.Implementation.Creators, Risi_Script.Types.Internals, Ada.Containers, Ada.Strings.Unbounded, Ada.Strings.Fixed; Separate(Risi_Script.Types.Implementation) Package Body Conversions is Use Risi_Script.Types.Implementation.Creators; Use Type Ada.Containers.Count_Type; Package SE renames System.Storage_Elements; Type Braket_Style is ( Round, Square, Curly ); --------------------- -- UTIL FUNCTIONS -- --------------------- Function "+"( S : String ) return Ada.Strings.Unbounded.Unbounded_String renames Ada.Strings.Unbounded.To_Unbounded_String; Function "+"( S : Ada.Strings.Unbounded.Unbounded_String ) return String renames Ada.Strings.Unbounded.To_String; Function Trim( S : String ) return Ada.Strings.Unbounded.Unbounded_String is Use Ada.Strings.Unbounded, Ada.Strings.Fixed, Ada.Strings; begin Return + Trim(Side => Left, Source => S); end Trim; Function To_Address( X : SE.integer_Address ) return System.Address renames SE.To_Address; Generic Type X is private; Default : X; with Function Value( S : String ) return X; Function Parse_String( S : String_Type ) return X; Function Parse_String( S : String_Type ) return X is begin return Result : X := Default do Result:= Value( +S ); exception when others => null; end return; end Parse_String; Function Bracket( S : String; Style : Braket_Style ) return String is (case Style is when Round => '(' & S & ')', when Square => '[' & S & ']', when Curly => '{' & S & '}' ); Function Bracket( S : Unbounded_String; Style : Braket_Style ) return Unbounded_String is (case Style is when Round => '(' & S & ')', when Square => '[' & S & ']', when Curly => '{' & S & '}' ); ---------------------- -- INSTANTIATIONS -- ---------------------- Function As_Array is new To_Array(Integer_Type); Function As_Array is new To_Array(Real_Type); Function As_Array is new To_Array(Pointer_Type); Function As_Array is new To_Array(Fixed_Type); Function As_Array is new To_Array(Boolean_Type); Function As_Array is new To_Array(Func_Type); Function As_Hash is new To_Hash(Integer_Type); Function As_Hash is new To_Hash(Real_Type); Function As_Hash is new To_Hash(Pointer_Type); Function As_Hash is new To_Hash(Fixed_Type); Function As_Hash is new To_Hash(Boolean_Type); Function As_Hash is new To_Hash(Func_Type); Function Parse is new Parse_String( Integer_Type, 0, Integer_Type'Value ); Function Parse is new Parse_String( Real_Type, 0.0, Real_Type'Value ); Function Parse is new Parse_String( Fixed_Type, 0.0, Fixed_Type'Value ); Function Parse is new Parse_String( Boolean_Type, True, Boolean_Type'Value ); ---------------------- -- IMPLEMENTATION -- ---------------------- Function Convert(Value : Integer_Type ) return Array_Type renames As_Array; Function Convert(Value : Integer_Type ) return Hash_Type renames As_Hash; Function Convert(Value : Integer_Type ) return String_Type is ( Trim( Integer_Type'Image(Value) ) ); Function Convert(Value : Integer_Type ) return Real_Type is ( Real_Type(Value) ); -- Function Convert(Value : Integer_Type ) return Pointer_Type; -- Function Convert(Value : Integer_Type ) return Reference_Type; Function Convert(Value : Integer_Type ) return Fixed_Type is (if abs Value in 0..99_999_999_999_999 then Fixed_Type(Value) elsif Value > 0 then Fixed_Type'Last else Fixed_Type'First ); Function Convert(Value : Integer_Type ) return Boolean_Type is ( Boolean_Type(Value in 0..Integer_Type'Last) ); -- Function Convert(Value : Integer_Type ) return Func_Type; -- Function Convert(Value : Array_Type ) return Integer_Type is ( Integer_Type( Value.Length ) ); Function Convert(Value : Array_Type ) return Hash_Type is Function Internal_Convert(Value : Array_Type; Offset : Integer) return Hash_Type is begin Return Result : Hash_Type do for C in Value.Iterate loop declare Use Hash, List; K : constant String := Natural'Image(To_Index(C) + Offset); V : Representation renames Value(C); begin if Get_Enumeration(V) /= RT_Array then Result.Include( K, V ); else Result.Include( K, Internal_Create( Internal_Convert(V.Array_Value, Offset+1) ) ); end if; end; end loop; end return; end Internal_Convert; begin Return Internal_Convert( Value, -1 ); end Convert; Function Convert(Value : Array_Type ) return String_Type is Use Ada.Strings.Unbounded; Working : Unbounded_String; begin for Item in value.iterate loop declare Key : Positive renames List.To_Index(Item); Last : constant Boolean := Key = Value.Last_Index; Value : constant String := Image( List.Element( Item ) ); begin Append( Source => Working, New_Item => Value & (if not Last then ", " else "") ); end; end loop; Return Bracket( Working, Square ); end Convert; Function Convert(Value : Array_Type ) return Real_Type is ( Real_Type(Value.Length) ); -- Function Convert(Value : Array_Type ) return Pointer_Type; -- Function Convert(Value : Array_Type ) return Reference_Type; Function Convert(Value : Array_Type ) return Fixed_Type is ( Fixed_Type(Value.Length) ); Function Convert(Value : Array_Type ) return Boolean_Type is ( Boolean_Type(Value.Length > 0) ); -- Function Convert(Value : Array_Type ) return Func_Type; -- Function Convert(Value : Hash_Type ) return Integer_Type is ( Integer_Type(Value.Length) ); Function Convert(Value : Hash_Type ) return Array_Type is begin Return Result : Array_Type do for Item of Value loop Result.Append( Item ); end loop; end return; end Convert; Function Convert(Value : Hash_Type ) return String_Type is use Ada.Strings.Unbounded, Hash; Working : Unbounded_String; begin for E in Value.Iterate loop Append( Source => Working, New_Item => '"' & Key(E) & '"' & " => " & Image(Element(E)) & (if E /= Value.Last then ", " else "") ); end loop; return Working; end Convert; Function Convert(Value : Hash_Type ) return Real_Type is ( Real_Type(Value.Length) ); -- Function Convert(Value : Hash_Type ) return Pointer_Type; -- Function Convert(Value : Hash_Type ) return Reference_Type; Function Convert(Value : Hash_Type ) return Fixed_Type is ( Fixed_Type(Value.Length) ); Function Convert(Value : Hash_Type ) return Boolean_Type is ( Boolean_Type(Value.Length > 0) ); -- Function Convert(Value : Hash_Type ) return Func_Type; -- Function Convert(Value : String_Type ) return Integer_Type renames Parse; -- Function Convert(Value : String_Type ) return Array_Type; -- Function Convert(Value : String_Type ) return Hash_Type; Function Convert(Value : String_Type ) return Real_Type renames Parse; -- Function Convert(Value : String_Type ) return Pointer_Type; -- Function Convert(Value : String_Type ) return Reference_Type; Function Convert(Value : String_Type ) return Fixed_Type renames Parse; Function Convert(Value : String_Type ) return Boolean_Type renames Parse; -- Function Convert(Value : String_Type ) return Func_Type; -- Function Convert(Value : Real_Type ) return Integer_Type is First : Constant Real_Type:= Real_Type(Integer_Type'First); Last : Constant Real_Type:= Real_Type(Integer_Type'Last); Subtype Int_Range is Real_Type range First..Last; begin return (if Value in Int_Range then Integer_Type(Value) elsif Value > Last then Integer_Type'Last else Integer_Type'First ); end convert; Function Convert(Value : Real_Type ) return Array_Type renames As_Array; Function Convert(Value : Real_Type ) return Hash_Type renames As_Hash; Function Convert(Value : Real_Type ) return String_Type is ( Trim( Real_Type'Image(Value) ) ); -- Function Convert(Value : Real_Type ) return Pointer_Type; -- Function Convert(Value : Real_Type ) return Reference_Type; Function Convert(Value : Real_Type ) return Fixed_Type is First : Constant Real_Type:= Real_Type(Fixed_Type'First); Last : constant Real_Type:= Real_Type(Fixed_Type'Last); subtype Fixed_Range is Real_Type range First..Last; begin return (if Value in Fixed_Range then Fixed_Type( Value ) elsif Value > Last then Fixed_Type'Last else Fixed_Type'First ); end Convert; Function Convert(Value : Real_Type ) return Boolean_Type is ( Boolean_Type(Value in 0.0..Real_Type'Last) ); -- Function Convert(Value : Real_Type ) return Func_Type; -- -- Function Convert(Value : Pointer_Type ) return Integer_Type; -- Function Convert(Value : Pointer_Type ) return Array_Type; -- Function Convert(Value : Pointer_Type ) return Hash_Type; -- Function Convert(Value : Pointer_Type ) return String_Type; -- Function Convert(Value : Pointer_Type ) return Real_Type; -- Function Convert(Value : Pointer_Type ) return Pointer_Type; -- Function Convert(Value : Pointer_Type ) return Reference_Type; -- Function Convert(Value : Pointer_Type ) return Fixed_Type; -- Function Convert(Value : Pointer_Type ) return Boolean_Type; -- Function Convert(Value : Pointer_Type ) return Func_Type; -- Function Convert(Value : Reference_Type ) return Integer_Type is (case Get_Enumeration(Value) is when RT_Integer => Convert(Value), when RT_Array => Convert(Value), when RT_Hash => Convert(Value), when RT_String => Convert(Value), when RT_Real => Convert(Value), when RT_Pointer => Convert(Value), when RT_Reference => Convert(Value), when RT_Fixed => Convert(Value), when RT_Boolean => Convert(Value), when RT_Func => Convert(Value) ); -- Function Convert(Value : Reference_Type ) return Array_Type; -- Function Convert(Value : Reference_Type ) return Hash_Type; -- Function Convert(Value : Reference_Type ) return String_Type; -- Function Convert(Value : Reference_Type ) return Real_Type; -- Function Convert(Value : Reference_Type ) return Pointer_Type; -- Function Convert(Value : Reference_Type ) return Fixed_Type; -- Function Convert(Value : Reference_Type ) return Boolean_Type; -- Function Convert(Value : Reference_Type ) return Func_Type; Function Convert(Value : Fixed_Type ) return Integer_Type is ( Integer_Type(Value) ); Function Convert(Value : Fixed_Type ) return Array_Type renames As_Array; Function Convert(Value : Fixed_Type ) return Hash_Type renames As_Hash; Function Convert(Value : Fixed_Type ) return String_Type is ( Trim( Fixed_Type'Image(Value) ) ); Function Convert(Value : Fixed_Type ) return Real_Type is ( Real_Type(Value) ); -- Function Convert(Value : Fixed_Type ) return Pointer_Type; -- Function Convert(Value : Fixed_Type ) return Reference_Type; Function Convert(Value : Fixed_Type ) return Boolean_Type is ( Boolean_Type(Value in 0.0..Fixed_Type'Last) ); -- Function Convert(Value : Fixed_Type ) return Func_Type; Function Convert(Value : Boolean_Type ) return Integer_Type is (If Value = True then 1 else -1); Function Convert(Value : Boolean_Type ) return Array_Type renames As_Array; Function Convert(Value : Boolean_Type ) return Hash_Type renames As_Hash; Function Convert(Value : Boolean_Type ) return String_Type is (+(if Value = True then "TRUE" else "FALSE")); Function Convert(Value : Boolean_Type ) return Real_Type is (if Value = True then 1.0 else -1.0); Function Convert(Value : Boolean_Type ) return Pointer_Type is (if Value = True then Pointer_Type(System.Null_Address) else Pointer_Type( To_Address(SE.Integer_Address'Last) ) ); -- Function Convert(Value : Boolean_Type ) return Reference_Type; Function Convert(Value : Boolean_Type ) return Fixed_Type is (If Value = True then 1.0 else -1.0); -- Function Convert(Value : Boolean_Type ) return Func_Type; -- Function Convert(Value : Func_Type ) return Integer_Type; -- Function Convert(Value : Func_Type ) return Array_Type; -- Function Convert(Value : Func_Type ) return Hash_Type; -- Function Convert(Value : Func_Type ) return String_Type; -- Function Convert(Value : Func_Type ) return Real_Type; -- Function Convert(Value : Func_Type ) return Pointer_Type; -- Function Convert(Value : Func_Type ) return Reference_Type; -- Function Convert(Value : Func_Type ) return Fixed_Type; -- Function Convert(Value : Func_Type ) return Boolean_Type; -- End Conversions;
-- Institution: Technische Universität München -- Department: Realtime Computer Systems (RCS) -- Project: StratoX -- -- Authors: Emanuel Regnath (emanuel.regnath@tum.de) with HIL.Devices; -- @summary -- Target-independent specification for HIL of I2C package HIL.I2C with SPARK_Mode => On is -- type Port_Type is limited interface; -- -- type Configuration_Type is null record; -- -- procedure configure(Port : Port_Type; Config : Configuration_Type) is abstract; -- subtype Data_Type is Unsigned_8_Array; type Device_Type is new HIL.Devices.Device_Type_I2C; is_Init : Boolean := False with Ghost; procedure initialize with --Pre => is_Init = False, Post => is_Init; procedure write (Device : in Device_Type; Data : in Data_Type) with Pre => is_Init; procedure read (Device : in Device_Type; Data : out Data_Type) with Pre => is_Init; procedure transfer (Device : in Device_Type; Data_TX : in Data_Type; Data_RX : out Data_Type) with Pre => is_Init; end HIL.I2C;
pragma License (Unrestricted); -- specialized for Windows private with System.Interrupt_Numbers; package Ada.Interrupts.Names is -- This package is system-specific. SIGINT : constant Interrupt_Id; SIGILL : constant Interrupt_Id; SIGABRT_COMPAT : constant Interrupt_Id; SIGFPE : constant Interrupt_Id; SIGSEGV : constant Interrupt_Id; SIGTERM : constant Interrupt_Id; SIGBREAK : constant Interrupt_Id; SIGABRT : constant Interrupt_Id; -- SIGABRT2 : constant Interrupt_Id renames SIGABRT; First_Interrupt_Id : constant Interrupt_Id; Last_Interrupt_Id : constant Interrupt_Id; private SIGINT : constant Interrupt_Id := 2; SIGILL : constant Interrupt_Id := 4; SIGABRT_COMPAT : constant Interrupt_Id := 6; SIGFPE : constant Interrupt_Id := 8; SIGSEGV : constant Interrupt_Id := 11; SIGTERM : constant Interrupt_Id := 15; SIGBREAK : constant Interrupt_Id := 21; SIGABRT : constant Interrupt_Id := 22; First_Interrupt_Id : constant Interrupt_Id := System.Interrupt_Numbers.First_Interrupt_Id; Last_Interrupt_Id : constant Interrupt_Id := System.Interrupt_Numbers.Last_Interrupt_Id; end Ada.Interrupts.Names;
-- Copyright (C) 2019 Thierry Rascle <thierr26@free.fr> -- MIT license. Please refer to the LICENSE file. private with Apsepp.Generic_Shared_Instance; with Apsepp.Scope_Bound_Locks; use Apsepp.Scope_Bound_Locks; generic type Fixture_Type is tagged limited private; type Fixture_Type_Access is not null access all Fixture_Type; with function Default_Allocator return Fixture_Type_Access; Lock_CB, Unlock_CB : SB_Lock_CB := null; package Apsepp.Generic_Fixture is function Instance return Fixture_Type_Access; private package Shared_Instance is new Generic_Shared_Instance (Instance_Ancestor_Type => Fixture_Type, Lock_CB => Lock_CB, Unlock_CB => Unlock_CB); end Apsepp.Generic_Fixture;
with copia_examenes; use copia_examenes; procedure rellenar_aula_1 (Aula_1: out T_Aula) is begin --Rellenar el aula_1 fila 1 ------------------------------- aula_1(1,1).Ocupada:=True; Aula_1(1,1).Ident:=111; Aula_1(1,1).Ex.Num_palabras_diferentes:=5; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(1,1).Ex.Palabras(1).Palabra:="I "; Aula_1(1,1).Ex.Palabras(1).n_apariciones:=4; Aula_1(1,1).Ex.Palabras(2).Palabra:="Indice "; Aula_1(1,1).Ex.palabras(2).n_apariciones:=5; Aula_1(1,1).Ex.Palabras(3).Palabra:="var3 "; Aula_1(1,1).Ex.palabras(3).n_apariciones:=7; Aula_1(1,1).Ex.Palabras(4).Palabra:="var5 "; Aula_1(1,1).Ex.palabras(4).n_apariciones:=9; Aula_1(1,1).Ex.Palabras(5).Palabra:="var7 "; Aula_1(1,1).Ex.palabras(5).n_apariciones:=2; aula_1(1,2).Ocupada:=true; Aula_1(1,2).Ident:=112; Aula_1(1,2).Ex.Num_palabras_diferentes:=5; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(1,2).Ex.Palabras(1).Palabra:="elem "; Aula_1(1,2).Ex.Palabras(1).n_apariciones:=7; Aula_1(1,2).Ex.Palabras(2).Palabra:="Indice2 "; Aula_1(1,2).Ex.palabras(2).n_apariciones:=5; Aula_1(1,2).Ex.Palabras(3).Palabra:="j "; Aula_1(1,2).Ex.palabras(3).n_apariciones:=9; Aula_1(1,2).Ex.Palabras(4).Palabra:="x "; Aula_1(1,2).Ex.palabras(4).n_apariciones:=2; Aula_1(1,2).Ex.Palabras(5).Palabra:="z "; Aula_1(1,2).Ex.palabras(5).n_apariciones:=2; aula_1(1,3).Ocupada:=True; Aula_1(1,3).Ident:=113; Aula_1(1,3).Ex.Num_palabras_diferentes:=5; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(1,3).Ex.Palabras(1).Palabra:="elem "; Aula_1(1,3).Ex.Palabras(1).n_apariciones:=7; Aula_1(1,3).Ex.Palabras(2).Palabra:="Indice2 "; Aula_1(1,3).Ex.palabras(2).n_apariciones:=5; Aula_1(1,3).Ex.Palabras(3).Palabra:="j "; Aula_1(1,3).Ex.palabras(3).n_apariciones:=2; Aula_1(1,3).Ex.Palabras(4).Palabra:="var3 "; Aula_1(1,3).Ex.palabras(4).n_apariciones:=9; Aula_1(1,3).Ex.Palabras(5).Palabra:="var19 "; Aula_1(1,3).Ex.palabras(5).n_apariciones:=9; aula_1(1,4).Ocupada:=True; Aula_1(1,4).Ident:=114; Aula_1(1,4).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(1,4).Ex.Palabras(1).Palabra:="cont "; Aula_1(1,4).Ex.Palabras(1).n_apariciones:=2; Aula_1(1,4).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(1,4).Ex.palabras(2).n_apariciones:=3; Aula_1(1,4).Ex.Palabras(3).Palabra:="j "; Aula_1(1,4).Ex.palabras(3).n_apariciones:=6; Aula_1(1,4).Ex.Palabras(4).Palabra:="w "; Aula_1(1,4).Ex.palabras(4).n_apariciones:=4; Aula_1(1,4).Ex.Palabras(5).Palabra:="z1 "; Aula_1(1,4).Ex.Palabras(5).n_apariciones:=7; Aula_1(1,4).Ex.Palabras(6).Palabra:="z5 "; Aula_1(1,4).Ex.palabras(6).n_apariciones:=3; aula_1(1,5).Ocupada:=True; Aula_1(1,5).Ident:=115; Aula_1(1,5).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(1,5).Ex.Palabras(1).Palabra:="c "; Aula_1(1,5).Ex.Palabras(1).n_apariciones:=1; Aula_1(1,5).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(1,5).Ex.palabras(2).n_apariciones:=2; Aula_1(1,5).Ex.Palabras(3).Palabra:="j "; Aula_1(1,5).Ex.palabras(3).n_apariciones:=6; Aula_1(1,5).Ex.Palabras(4).Palabra:="a "; Aula_1(1,5).Ex.palabras(4).n_apariciones:=4; Aula_1(1,5).Ex.Palabras(5).Palabra:="b "; Aula_1(1,5).Ex.Palabras(5).n_apariciones:=1; Aula_1(1,5).Ex.Palabras(6).Palabra:="c "; Aula_1(1,5).Ex.palabras(6).n_apariciones:=1; aula_1(1,6).Ocupada:=false; aula_1(1,7).Ocupada:=false; aula_1(1,8).Ocupada:=false; aula_1(1,9).Ocupada:=True; Aula_1(1,9).Ident:=119; Aula_1(1,9).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(1,9).Ex.Palabras(1).Palabra:="cont "; Aula_1(1,9).Ex.Palabras(1).n_apariciones:=2; Aula_1(1,9).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(1,9).Ex.palabras(2).n_apariciones:=3; Aula_1(1,9).Ex.Palabras(3).Palabra:="j "; Aula_1(1,9).Ex.palabras(3).n_apariciones:=6; Aula_1(1,9).Ex.Palabras(4).Palabra:="w "; Aula_1(1,9).Ex.palabras(4).n_apariciones:=4; Aula_1(1,9).Ex.Palabras(5).Palabra:="z1 "; Aula_1(1,9).Ex.Palabras(5).n_apariciones:=7; Aula_1(1,9).Ex.Palabras(6).Palabra:="z5 "; Aula_1(1,9).Ex.palabras(6).n_apariciones:=3; aula_1(1,10).Ocupada:=True; Aula_1(1,10).Ident:=1110; Aula_1(1,10).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(1,10).Ex.Palabras(1).Palabra:="c "; Aula_1(1,10).Ex.Palabras(1).n_apariciones:=1; Aula_1(1,10).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(1,10).Ex.palabras(2).n_apariciones:=2; Aula_1(1,10).Ex.Palabras(3).Palabra:="j "; Aula_1(1,10).Ex.palabras(3).n_apariciones:=6; Aula_1(1,10).Ex.Palabras(4).Palabra:="a "; Aula_1(1,10).Ex.palabras(4).n_apariciones:=4; Aula_1(1,10).Ex.Palabras(5).Palabra:="b "; Aula_1(1,10).Ex.Palabras(5).n_apariciones:=1; Aula_1(1,10).Ex.Palabras(6).Palabra:="c "; Aula_1(1,10).Ex.palabras(6).n_apariciones:=1; --rellenando_las palabras y sus frecuencias --Rellenar el aula_1 fila 2 ---------------------------------- aula_1(2,1).Ocupada:=true; Aula_1(2,1).Ident:=221; Aula_1(2,1).Ex.Num_palabras_diferentes:=4; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(2,1).Ex.Palabras(1).Palabra:="I "; Aula_1(2,1).Ex.Palabras(1).n_apariciones:=2; Aula_1(2,1).Ex.Palabras(2).Palabra:="Indice "; Aula_1(2,1).Ex.palabras(2).n_apariciones:=5; Aula_1(2,1).Ex.Palabras(3).Palabra:="var3 "; Aula_1(2,1).Ex.palabras(3).n_apariciones:=7; Aula_1(2,1).Ex.Palabras(4).Palabra:="var5 "; Aula_1(2,1).Ex.palabras(4).n_apariciones:=9; -- aula_1(2,2).Ocupada:=True; Aula_1(2,2).Ident:=222; Aula_1(2,2).Ex.Num_palabras_diferentes:=4; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(2,2).Ex.Palabras(1).Palabra:="elem "; Aula_1(2,2).Ex.Palabras(1).n_apariciones:=2; Aula_1(2,2).Ex.Palabras(2).Palabra:="Indice2 "; Aula_1(2,2).Ex.palabras(2).n_apariciones:=5; Aula_1(2,2).Ex.Palabras(3).Palabra:="j "; Aula_1(2,2).Ex.palabras(3).n_apariciones:=9; Aula_1(2,2).Ex.Palabras(4).Palabra:="x "; Aula_1(2,2).Ex.palabras(4).n_apariciones:=7; aula_1(2,3).Ocupada:=True; Aula_1(2,3).Ident:=223; Aula_1(2,3).Ex.Num_palabras_diferentes:=5; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(2,3).Ex.Palabras(1).Palabra:="elem "; Aula_1(2,3).Ex.Palabras(1).n_apariciones:=7; Aula_1(2,3).Ex.Palabras(2).Palabra:="Indice2 "; Aula_1(2,3).Ex.palabras(2).n_apariciones:=5; Aula_1(2,3).Ex.Palabras(3).Palabra:="j "; Aula_1(2,3).Ex.palabras(3).n_apariciones:=2; Aula_1(2,3).Ex.Palabras(4).Palabra:="var3 "; Aula_1(2,3).Ex.palabras(4).n_apariciones:=9; Aula_1(2,3).Ex.Palabras(5).Palabra:="var19 "; Aula_1(2,3).Ex.palabras(5).n_apariciones:=9; aula_1(2,4).Ocupada:=false; aula_1(2,4).Ocupada:=false; aula_1(2,4).Ocupada:=false; aula_1(2,5).Ocupada:=True; Aula_1(2,5).Ident:=225; Aula_1(2,5).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(2,5).Ex.Palabras(1).Palabra:="cont "; Aula_1(2,5).Ex.Palabras(1).n_apariciones:=2; Aula_1(2,5).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(2,5).Ex.palabras(2).n_apariciones:=5; Aula_1(2,5).Ex.Palabras(3).Palabra:="j "; Aula_1(2,5).Ex.palabras(3).n_apariciones:=5; Aula_1(2,5).Ex.Palabras(4).Palabra:="w "; Aula_1(2,5).Ex.palabras(4).n_apariciones:=4; Aula_1(2,5).Ex.Palabras(5).Palabra:="z1 "; Aula_1(2,5).Ex.Palabras(5).n_apariciones:=4; Aula_1(2,5).Ex.Palabras(6).Palabra:="z5 "; Aula_1(2,5).Ex.palabras(6).n_apariciones:=3; aula_1(2,6).Ocupada:=True; Aula_1(2,6).Ident:=226; Aula_1(2,6).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(2,6).Ex.Palabras(1).Palabra:="c "; Aula_1(2,6).Ex.Palabras(1).n_apariciones:=2; Aula_1(2,6).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(2,6).Ex.palabras(2).n_apariciones:=2; Aula_1(2,6).Ex.Palabras(3).Palabra:="j "; Aula_1(2,6).Ex.palabras(3).n_apariciones:=5; Aula_1(2,6).Ex.Palabras(4).Palabra:="f "; Aula_1(2,6).Ex.palabras(4).n_apariciones:=5; Aula_1(2,6).Ex.Palabras(5).Palabra:="v "; Aula_1(2,6).Ex.Palabras(5).n_apariciones:=4; Aula_1(2,6).Ex.Palabras(6).Palabra:="z "; Aula_1(2,6).Ex.palabras(6).n_apariciones:=3; aula_1(2,7).Ocupada:=false; aula_1(2,8).Ocupada:=false; aula_1(2,9).Ocupada:=true; Aula_1(2,9).Ident:=229; Aula_1(2,9).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(2,9).Ex.Palabras(1).Palabra:="c "; Aula_1(2,9).Ex.Palabras(1).n_apariciones:=5; Aula_1(2,9).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(2,9).Ex.palabras(2).n_apariciones:=2; Aula_1(2,9).Ex.Palabras(3).Palabra:="j "; Aula_1(2,9).Ex.palabras(3).n_apariciones:=2; Aula_1(2,9).Ex.Palabras(4).Palabra:="f "; Aula_1(2,9).Ex.palabras(4).n_apariciones:=2; Aula_1(2,9).Ex.Palabras(5).Palabra:="v "; Aula_1(2,9).Ex.Palabras(5).n_apariciones:=4; Aula_1(2,9).Ex.Palabras(6).Palabra:="z "; Aula_1(2,9).Ex.palabras(6).n_apariciones:=3; aula_1(2,10).Ocupada:=True; Aula_1(2,10).Ident:=2210; Aula_1(2,10).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(2,10).Ex.Palabras(1).Palabra:="c "; Aula_1(2,10).Ex.Palabras(1).n_apariciones:=2; Aula_1(2,10).Ex.Palabras(2).Palabra:="cont3 "; Aula_1(2,10).Ex.palabras(2).n_apariciones:=2; Aula_1(2,10).Ex.Palabras(3).Palabra:="j "; Aula_1(2,10).Ex.palabras(3).n_apariciones:=2; Aula_1(2,10).Ex.Palabras(4).Palabra:="f "; Aula_1(2,10).Ex.palabras(4).n_apariciones:=5; Aula_1(2,10).Ex.Palabras(5).Palabra:="v "; Aula_1(2,10).Ex.Palabras(5).n_apariciones:=4; Aula_1(2,10).Ex.Palabras(6).Palabra:="z "; Aula_1(2,10).Ex.palabras(6).n_apariciones:=3; --rellenar aula_1 fila 3 ------------------------- aula_1(3,1).Ocupada:=True; Aula_1(3,1).Ident:=331; Aula_1(3,1).Ex.Num_palabras_diferentes:=5; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(3,1).Ex.Palabras(1).Palabra:="I "; Aula_1(3,1).Ex.Palabras(1).n_apariciones:=2; Aula_1(3,1).Ex.Palabras(2).Palabra:="ind "; Aula_1(3,1).Ex.palabras(2).n_apariciones:=3; Aula_1(3,1).Ex.Palabras(3).Palabra:="var3 "; Aula_1(3,1).Ex.palabras(3).n_apariciones:=7; Aula_1(3,1).Ex.Palabras(4).Palabra:="var5 "; Aula_1(3,1).Ex.palabras(4).n_apariciones:=9; Aula_1(3,1).Ex.Palabras(5).Palabra:="var7 "; Aula_1(3,1).Ex.palabras(5).n_apariciones:=2; aula_1(3,2).Ocupada:=True; Aula_1(3,2).Ident:=332; Aula_1(3,2).Ex.Num_palabras_diferentes:=5; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(3,2).Ex.Palabras(1).Palabra:="elem "; Aula_1(3,2).Ex.Palabras(1).n_apariciones:=7; Aula_1(3,2).Ex.Palabras(2).Palabra:="Indice2 "; Aula_1(3,2).Ex.palabras(2).n_apariciones:=5; Aula_1(3,2).Ex.Palabras(3).Palabra:="j "; Aula_1(3,2).Ex.palabras(3).n_apariciones:=9; Aula_1(3,2).Ex.Palabras(4).Palabra:="x "; Aula_1(3,2).Ex.palabras(4).n_apariciones:=7; Aula_1(3,2).Ex.Palabras(5).Palabra:="z "; Aula_1(3,2).Ex.palabras(5).n_apariciones:=2; aula_1(3,3).Ocupada:=True; Aula_1(3,3).Ident:=333; Aula_1(3,3).Ex.Num_palabras_diferentes:=5; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(3,3).Ex.Palabras(1).Palabra:="elem "; Aula_1(3,3).Ex.Palabras(1).n_apariciones:=7; Aula_1(3,3).Ex.Palabras(2).Palabra:="Indice2 "; Aula_1(3,3).Ex.palabras(2).n_apariciones:=5; Aula_1(3,3).Ex.Palabras(3).Palabra:="j "; Aula_1(3,3).Ex.palabras(3).n_apariciones:=2; Aula_1(3,3).Ex.Palabras(4).Palabra:="var3 "; Aula_1(3,3).Ex.palabras(4).n_apariciones:=8; Aula_1(3,3).Ex.Palabras(5).Palabra:="var19 "; Aula_1(3,3).Ex.palabras(5).n_apariciones:=9; aula_1(3,4).Ocupada:=True; Aula_1(3,4).Ident:=334; Aula_1(3,4).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(3,4).Ex.Palabras(1).Palabra:="cont "; Aula_1(3,4).Ex.Palabras(1).n_apariciones:=2; Aula_1(3,4).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(3,4).Ex.palabras(2).n_apariciones:=3; Aula_1(3,4).Ex.Palabras(3).Palabra:="j "; Aula_1(3,4).Ex.palabras(3).n_apariciones:=6; Aula_1(3,4).Ex.Palabras(4).Palabra:="w "; Aula_1(3,4).Ex.palabras(4).n_apariciones:=4; Aula_1(3,4).Ex.Palabras(5).Palabra:="z1 "; Aula_1(3,4).Ex.Palabras(5).n_apariciones:=8; Aula_1(3,4).Ex.Palabras(6).Palabra:="z5 "; Aula_1(3,4).Ex.palabras(6).n_apariciones:=8; aula_1(3,5).Ocupada:=True; Aula_1(3,5).Ident:=335; Aula_1(3,5).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(3,5).Ex.Palabras(1).Palabra:="c "; Aula_1(3,5).Ex.Palabras(1).n_apariciones:=1; Aula_1(3,5).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(3,5).Ex.palabras(2).n_apariciones:=2; Aula_1(3,5).Ex.Palabras(3).Palabra:="j "; Aula_1(3,5).Ex.palabras(3).n_apariciones:=6; Aula_1(3,5).Ex.Palabras(4).Palabra:="a "; Aula_1(3,5).Ex.palabras(4).n_apariciones:=4; Aula_1(3,5).Ex.Palabras(5).Palabra:="b "; Aula_1(3,5).Ex.Palabras(5).n_apariciones:=1; Aula_1(3,5).Ex.Palabras(6).Palabra:="c "; Aula_1(3,5).Ex.palabras(6).n_apariciones:=1; aula_1(3,6).Ocupada:=false; aula_1(3,7).Ocupada:=false; aula_1(3,8).Ocupada:=false; aula_1(3,9).Ocupada:=false; aula_1(3,10).Ocupada:=false; --rellenar aula_1 fila 4 --------------------------- aula_1(4,1).Ocupada:=True; Aula_1(4,1).Ident:=441; Aula_1(4,1).Ex.Num_palabras_diferentes:=5; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(4,1).Ex.Palabras(1).Palabra:="I "; Aula_1(4,1).Ex.Palabras(1).n_apariciones:=2; Aula_1(4,1).Ex.Palabras(2).Palabra:="Indice "; Aula_1(4,1).Ex.palabras(2).n_apariciones:=3; Aula_1(4,1).Ex.Palabras(3).Palabra:="var3 "; Aula_1(4,1).Ex.palabras(3).n_apariciones:=7; Aula_1(4,1).Ex.Palabras(4).Palabra:="var5 "; Aula_1(4,1).Ex.palabras(4).n_apariciones:=9; Aula_1(4,1).Ex.Palabras(5).Palabra:="var7 "; Aula_1(4,1).Ex.palabras(5).n_apariciones:=2; aula_1(4,2).Ocupada:=True; Aula_1(4,2).Ident:=442; Aula_1(4,2).Ex.Num_palabras_diferentes:=5; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(4,2).Ex.Palabras(1).Palabra:="elem "; Aula_1(4,2).Ex.Palabras(1).n_apariciones:=7; Aula_1(4,2).Ex.Palabras(2).Palabra:="Indice2 "; Aula_1(4,2).Ex.palabras(2).n_apariciones:=5; Aula_1(4,2).Ex.Palabras(3).Palabra:="j "; Aula_1(4,2).Ex.palabras(3).n_apariciones:=9; Aula_1(4,2).Ex.Palabras(4).Palabra:="x "; Aula_1(4,2).Ex.palabras(4).n_apariciones:=3; Aula_1(4,2).Ex.Palabras(5).Palabra:="z "; Aula_1(4,2).Ex.palabras(5).n_apariciones:=2; aula_1(4,3).Ocupada:=True; Aula_1(4,3).Ident:=443; Aula_1(4,3).Ex.Num_palabras_diferentes:=5; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(4,3).Ex.Palabras(1).Palabra:="elem "; Aula_1(4,3).Ex.Palabras(1).n_apariciones:=7; Aula_1(4,3).Ex.Palabras(2).Palabra:="Indice2 "; Aula_1(4,3).Ex.palabras(2).n_apariciones:=5; Aula_1(4,3).Ex.Palabras(3).Palabra:="j "; Aula_1(4,3).Ex.palabras(3).n_apariciones:=2; Aula_1(4,3).Ex.Palabras(4).Palabra:="var3 "; Aula_1(4,3).Ex.palabras(4).n_apariciones:=3; Aula_1(4,3).Ex.Palabras(5).Palabra:="var19 "; Aula_1(4,3).Ex.palabras(5).n_apariciones:=3; aula_1(4,4).Ocupada:=True; Aula_1(4,4).Ident:=444; Aula_1(4,4).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(4,4).Ex.Palabras(1).Palabra:="cont "; Aula_1(4,4).Ex.Palabras(1).n_apariciones:=2; Aula_1(4,4).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(4,4).Ex.palabras(2).n_apariciones:=3; Aula_1(4,4).Ex.Palabras(3).Palabra:="j "; Aula_1(4,4).Ex.palabras(3).n_apariciones:=1; Aula_1(4,4).Ex.Palabras(4).Palabra:="w "; Aula_1(4,4).Ex.palabras(4).n_apariciones:=4; Aula_1(4,4).Ex.Palabras(5).Palabra:="z1 "; Aula_1(4,4).Ex.Palabras(5).n_apariciones:=5; Aula_1(4,4).Ex.Palabras(6).Palabra:="z5 "; Aula_1(4,4).Ex.palabras(6).n_apariciones:=5; aula_1(4,5).Ocupada:=True; Aula_1(4,5).Ident:=445; Aula_1(4,5).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(4,5).Ex.Palabras(1).Palabra:="c "; Aula_1(4,5).Ex.Palabras(1).n_apariciones:=1; Aula_1(4,5).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(4,5).Ex.palabras(2).n_apariciones:=2; Aula_1(4,5).Ex.Palabras(3).Palabra:="j "; Aula_1(4,5).Ex.palabras(3).n_apariciones:=8; Aula_1(4,5).Ex.Palabras(4).Palabra:="a "; Aula_1(4,5).Ex.palabras(4).n_apariciones:=3; Aula_1(4,5).Ex.Palabras(5).Palabra:="b "; Aula_1(4,5).Ex.Palabras(5).n_apariciones:=6; Aula_1(4,5).Ex.Palabras(6).Palabra:="c "; Aula_1(4,5).Ex.palabras(6).n_apariciones:=9; aula_1(4,6).Ocupada:=false; aula_1(4,7).Ocupada:=false; aula_1(4,8).Ocupada:=false; aula_1(4,9).Ocupada:=false; aula_1(4,10).Ocupada:=false; --rellenar aula_1 fila 5 ------------------------ aula_1(5,1).Ocupada:=True; Aula_1(5,1).Ident:=551; Aula_1(5,1).Ex.Num_palabras_diferentes:=5; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(5,1).Ex.Palabras(1).Palabra:="I "; Aula_1(5,1).Ex.Palabras(1).n_apariciones:=2; Aula_1(5,1).Ex.Palabras(2).Palabra:="Indice "; Aula_1(5,1).Ex.palabras(2).n_apariciones:=3; Aula_1(5,1).Ex.Palabras(3).Palabra:="var3 "; Aula_1(5,1).Ex.palabras(3).n_apariciones:=7; Aula_1(5,1).Ex.Palabras(4).Palabra:="var5 "; Aula_1(5,1).Ex.palabras(4).n_apariciones:=9; Aula_1(5,1).Ex.Palabras(5).Palabra:="var7 "; Aula_1(5,1).Ex.palabras(5).n_apariciones:=2; aula_1(5,2).Ocupada:=True; Aula_1(5,2).Ident:=552; Aula_1(5,2).Ex.Num_palabras_diferentes:=5; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(5,2).Ex.Palabras(1).Palabra:="elem "; Aula_1(5,2).Ex.Palabras(1).n_apariciones:=7; Aula_1(5,2).Ex.Palabras(2).Palabra:="Indice2 "; Aula_1(5,2).Ex.palabras(2).n_apariciones:=5; Aula_1(5,2).Ex.Palabras(3).Palabra:="j "; Aula_1(5,2).Ex.palabras(3).n_apariciones:=9; Aula_1(5,2).Ex.Palabras(4).Palabra:="x "; Aula_1(5,2).Ex.palabras(4).n_apariciones:=2; Aula_1(5,2).Ex.Palabras(5).Palabra:="z "; Aula_1(5,2).Ex.palabras(5).n_apariciones:=2; aula_1(5,3).Ocupada:=True; Aula_1(5,3).Ident:=553; Aula_1(5,3).Ex.Num_palabras_diferentes:=5; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(5,3).Ex.Palabras(1).Palabra:="elem "; Aula_1(5,3).Ex.Palabras(1).n_apariciones:=7; Aula_1(5,3).Ex.Palabras(2).Palabra:="Indice2 "; Aula_1(5,3).Ex.palabras(2).n_apariciones:=5; Aula_1(5,3).Ex.Palabras(3).Palabra:="j "; Aula_1(5,3).Ex.palabras(3).n_apariciones:=2; Aula_1(5,3).Ex.Palabras(4).Palabra:="var3 "; Aula_1(5,3).Ex.palabras(4).n_apariciones:=9; Aula_1(5,3).Ex.Palabras(5).Palabra:="var19 "; Aula_1(5,3).Ex.palabras(5).n_apariciones:=9; aula_1(5,4).Ocupada:=True; Aula_1(5,4).Ident:=554; Aula_1(5,4).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(5,4).Ex.Palabras(1).Palabra:="cont "; Aula_1(5,4).Ex.Palabras(1).n_apariciones:=2; Aula_1(5,4).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(5,4).Ex.palabras(2).n_apariciones:=3; Aula_1(5,4).Ex.Palabras(3).Palabra:="j "; Aula_1(5,4).Ex.palabras(3).n_apariciones:=6; Aula_1(5,4).Ex.Palabras(4).Palabra:="w "; Aula_1(5,4).Ex.palabras(4).n_apariciones:=4; Aula_1(5,4).Ex.Palabras(5).Palabra:="z1 "; Aula_1(5,4).Ex.Palabras(5).n_apariciones:=7; Aula_1(5,4).Ex.Palabras(6).Palabra:="z5 "; Aula_1(5,4).Ex.palabras(6).n_apariciones:=3; aula_1(5,5).Ocupada:=True; Aula_1(5,5).Ident:=555; Aula_1(5,5).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(5,5).Ex.Palabras(1).Palabra:="c "; Aula_1(5,5).Ex.Palabras(1).n_apariciones:=1; Aula_1(5,5).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(5,5).Ex.palabras(2).n_apariciones:=2; Aula_1(5,5).Ex.Palabras(3).Palabra:="j "; Aula_1(5,5).Ex.palabras(3).n_apariciones:=6; Aula_1(5,5).Ex.Palabras(4).Palabra:="a "; Aula_1(5,5).Ex.palabras(4).n_apariciones:=4; Aula_1(5,5).Ex.Palabras(5).Palabra:="b "; Aula_1(5,5).Ex.Palabras(5).n_apariciones:=1; Aula_1(5,5).Ex.Palabras(6).Palabra:="c "; Aula_1(5,5).Ex.palabras(6).n_apariciones:=1; aula_1(5,6).Ocupada:=false; aula_1(5,7).Ocupada:=false; aula_1(5,8).Ocupada:=false; aula_1(5,9).Ocupada:=false; aula_1(5,10).Ocupada:=false; aula_1(6,1).Ocupada:=false; aula_1(6,2).Ocupada:=false; aula_1(6,3).Ocupada:=false; aula_1(6,4).Ocupada:=false; aula_1(6,5).Ocupada:=false; aula_1(6,6).Ocupada:=false; aula_1(6,7).Ocupada:=false; aula_1(6,8).Ocupada:=false; aula_1(6,9).Ocupada:=false; aula_1(6,10).Ocupada:=false; aula_1(7,1).Ocupada:=false; aula_1(7,2).Ocupada:=false; aula_1(7,3).Ocupada:=false; aula_1(7,4).Ocupada:=false; aula_1(7,5).Ocupada:=false; aula_1(7,6).Ocupada:=false; aula_1(7,7).Ocupada:=false; aula_1(7,8).Ocupada:=false; aula_1(7,9).Ocupada:=false; aula_1(7,10).Ocupada:=false; aula_1(8,1).Ocupada:=false; aula_1(8,2).Ocupada:=false; aula_1(8,3).Ocupada:=false; aula_1(8,4).Ocupada:=false; aula_1(8,5).Ocupada:=false; aula_1(8,6).Ocupada:=false; aula_1(8,7).Ocupada:=false; aula_1(8,8).Ocupada:=false; aula_1(8,9).Ocupada:=false; aula_1(8,10).Ocupada:=false; --Rellenar el aula_1 fila 1 ------------------------------- aula_1(9,1).Ocupada:=True; Aula_1(9,1).Ident:=991; Aula_1(9,1).Ex.Num_palabras_diferentes:=5; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(9,1).Ex.Palabras(1).Palabra:="I "; Aula_1(9,1).Ex.Palabras(1).n_apariciones:=2; Aula_1(9,1).Ex.Palabras(2).Palabra:="Indice "; Aula_1(9,1).Ex.palabras(2).n_apariciones:=5; Aula_1(9,1).Ex.Palabras(3).Palabra:="var3 "; Aula_1(9,1).Ex.palabras(3).n_apariciones:=7; Aula_1(9,1).Ex.Palabras(4).Palabra:="var5 "; Aula_1(9,1).Ex.palabras(4).n_apariciones:=9; Aula_1(9,1).Ex.Palabras(5).Palabra:="var7 "; Aula_1(9,1).Ex.palabras(5).n_apariciones:=2; aula_1(9,2).Ocupada:=true; Aula_1(9,2).Ident:=992; Aula_1(9,2).Ex.Num_palabras_diferentes:=5; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(9,2).Ex.Palabras(1).Palabra:="elem "; Aula_1(9,2).Ex.Palabras(1).n_apariciones:=7; Aula_1(9,2).Ex.Palabras(2).Palabra:="Indice2 "; Aula_1(9,2).Ex.palabras(2).n_apariciones:=5; Aula_1(9,2).Ex.Palabras(3).Palabra:="j "; Aula_1(9,2).Ex.palabras(3).n_apariciones:=9; Aula_1(9,2).Ex.Palabras(4).Palabra:="x "; Aula_1(9,2).Ex.palabras(4).n_apariciones:=2; Aula_1(9,2).Ex.Palabras(5).Palabra:="z "; Aula_1(9,2).Ex.palabras(5).n_apariciones:=2; aula_1(9,3).Ocupada:=True; Aula_1(9,3).Ident:=993; Aula_1(9,3).Ex.Num_palabras_diferentes:=5; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(9,3).Ex.Palabras(1).Palabra:="elem "; Aula_1(9,3).Ex.Palabras(1).n_apariciones:=7; Aula_1(9,3).Ex.Palabras(2).Palabra:="Indice2 "; Aula_1(9,3).Ex.palabras(2).n_apariciones:=5; Aula_1(9,3).Ex.Palabras(3).Palabra:="j "; Aula_1(9,3).Ex.palabras(3).n_apariciones:=2; Aula_1(9,3).Ex.Palabras(4).Palabra:="var3 "; Aula_1(9,3).Ex.palabras(4).n_apariciones:=7; Aula_1(9,3).Ex.Palabras(5).Palabra:="var19 "; Aula_1(9,3).Ex.palabras(5).n_apariciones:=9; aula_1(9,4).Ocupada:=True; Aula_1(9,4).Ident:=994; Aula_1(9,4).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(9,4).Ex.Palabras(1).Palabra:="cont "; Aula_1(9,4).Ex.Palabras(1).n_apariciones:=2; Aula_1(9,4).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(9,4).Ex.palabras(2).n_apariciones:=3; Aula_1(9,4).Ex.Palabras(3).Palabra:="j "; Aula_1(9,4).Ex.palabras(3).n_apariciones:=6; Aula_1(9,4).Ex.Palabras(4).Palabra:="w "; Aula_1(9,4).Ex.palabras(4).n_apariciones:=4; Aula_1(9,4).Ex.Palabras(5).Palabra:="z1 "; Aula_1(9,4).Ex.Palabras(5).n_apariciones:=7; Aula_1(9,4).Ex.Palabras(6).Palabra:="z5 "; Aula_1(9,4).Ex.palabras(6).n_apariciones:=3; aula_1(9,5).Ocupada:=True; Aula_1(9,5).Ident:=995; Aula_1(9,5).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(9,5).Ex.Palabras(1).Palabra:="c "; Aula_1(9,5).Ex.Palabras(1).n_apariciones:=1; Aula_1(9,5).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(9,5).Ex.palabras(2).n_apariciones:=2; Aula_1(9,5).Ex.Palabras(3).Palabra:="j "; Aula_1(9,5).Ex.palabras(3).n_apariciones:=6; Aula_1(9,5).Ex.Palabras(4).Palabra:="a "; Aula_1(9,5).Ex.palabras(4).n_apariciones:=4; Aula_1(9,5).Ex.Palabras(5).Palabra:="b "; Aula_1(9,5).Ex.Palabras(5).n_apariciones:=1; Aula_1(9,5).Ex.Palabras(6).Palabra:="c "; Aula_1(9,5).Ex.palabras(6).n_apariciones:=1; aula_1(9,6).Ocupada:=false; aula_1(9,7).Ocupada:=false; aula_1(9,8).Ocupada:=false; aula_1(9,9).Ocupada:=True; Aula_1(9,9).Ident:=999; Aula_1(9,9).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(9,9).Ex.Palabras(1).Palabra:="cont "; Aula_1(9,9).Ex.Palabras(1).n_apariciones:=2; Aula_1(9,9).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(9,9).Ex.palabras(2).n_apariciones:=3; Aula_1(9,9).Ex.Palabras(3).Palabra:="j "; Aula_1(9,9).Ex.palabras(3).n_apariciones:=6; Aula_1(9,9).Ex.Palabras(4).Palabra:="w "; Aula_1(9,9).Ex.palabras(4).n_apariciones:=4; Aula_1(9,9).Ex.Palabras(5).Palabra:="z1 "; Aula_1(9,9).Ex.Palabras(5).n_apariciones:=7; Aula_1(9,9).Ex.Palabras(6).Palabra:="z5 "; Aula_1(9,9).Ex.palabras(6).n_apariciones:=3; aula_1(9,10).Ocupada:=True; Aula_1(9,10).Ident:=9910; Aula_1(9,10).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(9,10).Ex.Palabras(1).Palabra:="c "; Aula_1(9,10).Ex.Palabras(1).n_apariciones:=2; Aula_1(9,10).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(9,10).Ex.palabras(2).n_apariciones:=3; Aula_1(9,10).Ex.Palabras(3).Palabra:="j "; Aula_1(9,10).Ex.palabras(3).n_apariciones:=6; Aula_1(9,10).Ex.Palabras(4).Palabra:="a "; Aula_1(9,10).Ex.palabras(4).n_apariciones:=4; Aula_1(9,10).Ex.Palabras(5).Palabra:="b "; Aula_1(9,10).Ex.Palabras(5).n_apariciones:=7; Aula_1(9,10).Ex.Palabras(6).Palabra:="c "; Aula_1(9,10).Ex.palabras(6).n_apariciones:=3; --rellenando_las palabras y sus frecuencias --Rellenar el aula_1 fila 2 ---------------------------------- aula_1(10,1).Ocupada:=true; Aula_1(10,1).Ident:=1011; Aula_1(10,1).Ex.Num_palabras_diferentes:=4; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(10,1).Ex.Palabras(1).Palabra:="I "; Aula_1(10,1).Ex.Palabras(1).n_apariciones:=2; Aula_1(10,1).Ex.Palabras(2).Palabra:="Indice "; Aula_1(10,1).Ex.palabras(2).n_apariciones:=5; Aula_1(10,1).Ex.Palabras(3).Palabra:="var3 "; Aula_1(10,1).Ex.palabras(3).n_apariciones:=7; Aula_1(10,1).Ex.Palabras(4).Palabra:="var5 "; Aula_1(10,1).Ex.palabras(4).n_apariciones:=9; -- aula_1(10,2).Ocupada:=True; Aula_1(10,2).Ident:=1012; Aula_1(10,2).Ex.Num_palabras_diferentes:=4; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(10,2).Ex.Palabras(1).Palabra:="elem "; Aula_1(10,2).Ex.Palabras(1).n_apariciones:=2; Aula_1(10,2).Ex.Palabras(2).Palabra:="Indice2 "; Aula_1(10,2).Ex.palabras(2).n_apariciones:=5; Aula_1(10,2).Ex.Palabras(3).Palabra:="j "; Aula_1(10,2).Ex.palabras(3).n_apariciones:=9; Aula_1(10,2).Ex.Palabras(4).Palabra:="x "; Aula_1(10,2).Ex.palabras(4).n_apariciones:=7; aula_1(10,3).Ocupada:=True; Aula_1(10,3).Ident:=1013; Aula_1(10,3).Ex.Num_palabras_diferentes:=5; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(10,3).Ex.Palabras(1).Palabra:="elem "; Aula_1(10,3).Ex.Palabras(1).n_apariciones:=7; Aula_1(10,3).Ex.Palabras(2).Palabra:="Indice2 "; Aula_1(10,3).Ex.palabras(2).n_apariciones:=5; Aula_1(10,3).Ex.Palabras(3).Palabra:="j "; Aula_1(10,3).Ex.palabras(3).n_apariciones:=2; Aula_1(10,3).Ex.Palabras(4).Palabra:="var3 "; Aula_1(10,3).Ex.palabras(4).n_apariciones:=9; Aula_1(10,3).Ex.Palabras(5).Palabra:="var19 "; Aula_1(10,3).Ex.palabras(5).n_apariciones:=9; aula_1(10,4).Ocupada:=false; aula_1(10,4).Ocupada:=false; aula_1(10,4).Ocupada:=false; aula_1(10,5).Ocupada:=True; Aula_1(10,5).Ident:=1015; Aula_1(10,5).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(10,5).Ex.Palabras(1).Palabra:="cont "; Aula_1(10,5).Ex.Palabras(1).n_apariciones:=2; Aula_1(10,5).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(10,5).Ex.palabras(2).n_apariciones:=5; Aula_1(10,5).Ex.Palabras(3).Palabra:="j "; Aula_1(10,5).Ex.palabras(3).n_apariciones:=5; Aula_1(10,5).Ex.Palabras(4).Palabra:="w "; Aula_1(10,5).Ex.palabras(4).n_apariciones:=4; Aula_1(10,5).Ex.Palabras(5).Palabra:="z1 "; Aula_1(10,5).Ex.Palabras(5).n_apariciones:=4; Aula_1(10,5).Ex.Palabras(6).Palabra:="z5 "; Aula_1(10,5).Ex.palabras(6).n_apariciones:=3; aula_1(10,6).Ocupada:=True; Aula_1(10,6).Ident:=1016; Aula_1(10,6).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(10,6).Ex.Palabras(1).Palabra:="c "; Aula_1(10,6).Ex.Palabras(1).n_apariciones:=2; Aula_1(10,6).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(10,6).Ex.palabras(2).n_apariciones:=2; Aula_1(10,6).Ex.Palabras(3).Palabra:="j "; Aula_1(10,6).Ex.palabras(3).n_apariciones:=5; Aula_1(10,6).Ex.Palabras(4).Palabra:="f "; Aula_1(10,6).Ex.palabras(4).n_apariciones:=5; Aula_1(10,6).Ex.Palabras(5).Palabra:="v "; Aula_1(10,6).Ex.Palabras(5).n_apariciones:=4; Aula_1(10,6).Ex.Palabras(6).Palabra:="z "; Aula_1(10,6).Ex.palabras(6).n_apariciones:=3; aula_1(10,7).Ocupada:=false; aula_1(10,8).Ocupada:=false; aula_1(10,9).Ocupada:=true; Aula_1(10,9).Ident:=1019; Aula_1(10,9).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(10,9).Ex.Palabras(1).Palabra:="c "; Aula_1(10,9).Ex.Palabras(1).n_apariciones:=5; Aula_1(10,9).Ex.Palabras(2).Palabra:="cont2 "; Aula_1(10,9).Ex.palabras(2).n_apariciones:=2; Aula_1(10,9).Ex.Palabras(3).Palabra:="j "; Aula_1(10,9).Ex.palabras(3).n_apariciones:=2; Aula_1(10,9).Ex.Palabras(4).Palabra:="f "; Aula_1(10,9).Ex.palabras(4).n_apariciones:=2; Aula_1(10,9).Ex.Palabras(5).Palabra:="v "; Aula_1(10,9).Ex.Palabras(5).n_apariciones:=4; Aula_1(10,9).Ex.Palabras(6).Palabra:="z "; Aula_1(10,9).Ex.palabras(6).n_apariciones:=3; aula_1(10,10).Ocupada:=True; Aula_1(10,10).Ident:=10110; Aula_1(10,10).Ex.Num_palabras_diferentes:=6; --rellenando_las palabras y sus frecuencias --0123456789 Aula_1(10,10).Ex.Palabras(1).Palabra:="c "; Aula_1(10,10).Ex.Palabras(1).n_apariciones:=2; Aula_1(10,10).Ex.Palabras(2).Palabra:="cont3 "; Aula_1(10,10).Ex.palabras(2).n_apariciones:=3; Aula_1(10,10).Ex.Palabras(3).Palabra:="j "; Aula_1(10,10).Ex.palabras(3).n_apariciones:=6; Aula_1(10,10).Ex.Palabras(4).Palabra:="f "; Aula_1(10,10).Ex.palabras(4).n_apariciones:=4; Aula_1(10,10).Ex.Palabras(5).Palabra:="v "; Aula_1(10,10).Ex.Palabras(5).n_apariciones:=7; Aula_1(10,10).Ex.Palabras(6).Palabra:="z "; Aula_1(10,10).Ex.palabras(6).n_apariciones:=3; end rellenar_aula_1;
with foo; use foo; with Interfaces; use Interfaces; -- GNATprove GPL 2016 seems to miss a failed precondition check -- in the call at line 18. Reason is insufficient knowledge on -- others=>, causing a false negative there, which in turn hides -- a serious bug. -- Fixed in GNATprove Pro 18 (and presumably later in GPL 2017) procedure main with SPARK_Mode is -- inlined callee procedure bar (d : out Data_Type) is begin --pragma Assert (d'Length > 0); d := (others => 0); -- with this, GNATprove does not find violation in line 18 pragma Annotate (GNATprove, False_Positive, "length check might fail", "insufficient solver knowledge"); pragma Assert_And_Cut (d'Length >= 0); --d (d'First) := 0; -- with this, GNATprove indeed finds a violation in line 18 end bar; arr : Data_Type (0 .. 91) := (others => 0); i32 : Integer_32; begin bar (arr); -- essential i32 := foo.toInteger_32 (arr (60 .. 64)); -- length check proved, but actually exception end main;
-- Body of package Scaliger ---------------------------------------------------------------------------- -- Copyright Miletus 2015 -- 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: -- 1. The above copyright notice and this permission notice shall be included -- in all copies or substantial portions of the Software. -- 2. Changes with respect to any former version shall be documented. -- -- The software is provided "as is", without warranty of any kind, -- express of implied, including but not limited to the warranties of -- merchantability, fitness for a particular purpose and noninfringement. -- In no event shall the authors of 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. -- Inquiries: www.calendriermilesien.org ------------------------------------------------------------------------------- Package body Scaliger is function Fractionnal_day_of (My_duration : Historical_Duration) return Fractional_day_duration is begin return My_duration / 86400.0; end Fractionnal_day_of; function Convert_from_julian_day (Display : Fractional_day_duration) return Historical_Duration is -- The fractional part of the julian day is displayed as a decimal figure -- and is stored as an integer number of the "delta", -- delta being in negative power of 2, -- whereas the number of seconds in a day, 86400, is not a power of 2. -- Multiplying this figure by 86400 is multiplying the delta by the same. -- So we use floating number multiplication -- to convert the fractional part from (fractional) day to seconds Day : Integer := Integer (Display); -- extract integer part of Julian Day Time_in_day : Fractional_day_duration := Display - Fractional_day_duration (Day); -- in fixed-point day Pad : Float := Float (Time_in_day); Julian_hours : Historical_Duration := Historical_Duration (Pad * 86400.0); begin return Historical_Duration (Day * 86400) + Julian_hours; end Convert_from_julian_day; end Scaliger;
with Ada.Text_IO, Mod_Inv; procedure Chin_Rema is N: array(Positive range <>) of Positive := (3, 5, 7); A: array(Positive range <>) of Positive := (2, 3, 2); Tmp: Positive; Prod: Positive := 1; Sum: Natural := 0; begin for I in N'Range loop Prod := Prod * N(I); end loop; for I in A'Range loop Tmp := Prod / N(I); Sum := Sum + A(I) * Mod_Inv.Inverse(Tmp, N(I)) * Tmp; end loop; Ada.Text_IO.Put_Line(Integer'Image(Sum mod Prod)); end Chin_Rema;
------------------------------------------------------------------------- -- GL.Errors - error support sub - programs. -- -- Copyright (c) Rod Kay 2007 -- AUSTRALIA -- Permission granted to use this software, without any warranty, -- for any purpose, provided this copyright note remains attached -- and unmodified if sources are distributed further. ------------------------------------------------------------------------- package GL.Errors is openGL_Error : exception; function Current return String; -- -- returns a descriptive string of the last occuring openGL error. -- returns "", when no error exists. -- clears any existing error. procedure log (Prefix : String := ""); -- -- displays 'Current' error via ada.Text_IO.put_Line. -- clears any existing error. -- raises 'openGL_Error' when an opengl error has been detected. procedure log (Prefix : String := ""; error_Occurred : out Boolean); -- -- displays 'Current' via ada.Text_IO.put_Line. -- clears any existing error. -- sets error_Occurred to true, if a GL error was detected. end GL.Errors;
with OpenAL.Types; package OpenAL.Listener is -- -- API -- -- -- Position -- -- proc_map : alListener3f procedure Set_Position_Float (X : in Types.Float_t; Y : in Types.Float_t; Z : in Types.Float_t); -- proc_map : alListener3i procedure Set_Position_Discrete (X : in Types.Integer_t; Y : in Types.Integer_t; Z : in Types.Integer_t); -- proc_map : alListenerfv procedure Set_Position_Float_List (Position : in Types.Vector_3f_t); -- proc_map : alListeneriv procedure Set_Position_Discrete_List (Position : in Types.Vector_3i_t); -- proc_map : alGetListener3f procedure Get_Position_Float (X : out Types.Float_t; Y : out Types.Float_t; Z : out Types.Float_t); -- proc_map : alGetListener3i procedure Get_Position_Discrete (X : out Types.Integer_t; Y : out Types.Integer_t; Z : out Types.Integer_t); -- proc_map : alGetListenerfv procedure Get_Position_Float_List (Position : out Types.Vector_3f_t); -- proc_map : alGetListeneriv procedure Get_Position_Discrete_List (Position : out Types.Vector_3i_t); -- -- Velocity -- -- proc_map : alListener3f procedure Set_Velocity_Float (X : in Types.Float_t; Y : in Types.Float_t; Z : in Types.Float_t); -- proc_map : alListener3i procedure Set_Velocity_Discrete (X : in Types.Integer_t; Y : in Types.Integer_t; Z : in Types.Integer_t); -- proc_map : alListenerfv procedure Set_Velocity_Float_List (Velocity : in Types.Vector_3f_t); -- proc_map : alListeneriv procedure Set_Velocity_Discrete_List (Velocity : in Types.Vector_3i_t); -- proc_map : alGetListener3f procedure Get_Velocity_Float (X : out Types.Float_t; Y : out Types.Float_t; Z : out Types.Float_t); -- proc_map : alGetListener3i procedure Get_Velocity_Discrete (X : out Types.Integer_t; Y : out Types.Integer_t; Z : out Types.Integer_t); -- proc_map : alGetListenerfv procedure Get_Velocity_Float_List (Velocity : out Types.Vector_3f_t); -- proc_map : alGetListeneriv procedure Get_Velocity_Discrete_List (Velocity : out Types.Vector_3i_t); -- -- Gain -- -- proc_map : alListener procedure Set_Gain (Gain : in Types.Float_t); -- proc_map : alGetListener procedure Get_Gain (Gain : out Types.Float_t); -- -- Orientation -- -- proc_map : alListener procedure Set_Orientation_Float (Forward : in Types.Vector_3f_t; Up : in Types.Vector_3f_t); -- proc_map : alListener procedure Set_Orientation_Discrete (Forward : in Types.Vector_3i_t; Up : in Types.Vector_3i_t); -- proc_map : alGetListener procedure Get_Orientation_Float (Forward : out Types.Vector_3f_t; Up : out Types.Vector_3f_t); -- proc_map : alGetListener procedure Get_Orientation_Discrete (Forward : out Types.Vector_3i_t; Up : out Types.Vector_3i_t); end OpenAL.Listener;
-- C48009F.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. --* -- FOR ALLOCATORS OF THE FORM "NEW T'(X)", CHECK THAT CONSTRAINT_ERROR -- IS RAISED IF T IS A CONSTRAINED OR UNCONSTRAINED MULTI-DIMENSIONAL -- ARRAY TYPE AND ALL COMPONENTS OF X DO NOT HAVE THE SAME LENGTH OR -- BOUNDS. -- RM 01/08/80 -- NL 10/13/81 -- SPS 10/26/82 -- JBG 03/03/83 -- EG 07/05/84 WITH REPORT; PROCEDURE C48009F IS USE REPORT; BEGIN TEST("C48009F","FOR ALLOCATORS OF THE FORM 'NEW T'(X)', CHECK " & "THAT CONSTRAINT_ERROR IS RAISED WHEN " & "X IS AN ILL-FORMED MULTIDIMENSIONAL AGGREGATE"); DECLARE TYPE TG00 IS ARRAY( 4..2 ) OF INTEGER; TYPE TG10 IS ARRAY( 1..2 ) OF INTEGER; TYPE TG20 IS ARRAY( INTEGER RANGE <> ) OF INTEGER; TYPE TG0 IS ARRAY( 3..2 ) OF TG00; TYPE TG1 IS ARRAY( 1..2 ) OF TG10; TYPE TG2 IS ARRAY( INTEGER RANGE <> ) OF TG20(1..3); TYPE ATG0 IS ACCESS TG0; TYPE ATG1 IS ACCESS TG1; TYPE ATG2 IS ACCESS TG2; VG0 : ATG0; VG1 : ATG1; VG2 : ATG2; BEGIN BEGIN VG0 := NEW TG0 '( 5..4 => ( 3..1 => 2 ) ); FAILED ("NO EXCEPTION RAISED - CASE 0"); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED( "WRONG EXCEPTION RAISED - CASE 0" ); END; BEGIN VG1 := NEW TG1 '( ( 1 , 2 ) , ( 3 , 4 , 5 ) ); FAILED ("NO EXCEPTION RAISED - CASE 1"); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED( "WRONG EXCEPTION RAISED - CASE 1" ); END; BEGIN VG2 := NEW TG2'( 1 => ( 1..2 => 7) , 2 => ( 1..3 => 7)); FAILED ("NO EXCEPTION RAISED - CASE 2"); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED( "WRONG EXCEPTION RAISED - CASE 2" ); END; END; RESULT; END C48009F;
type Days is (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday); Today : Days; case Today is when Saturday | Sunday => null; when Monday => Compute_Starting_Balance; when Friday => Compute_Ending_Balance; when others => Accumulate_Sales; end case;
-- { dg-do run } -- { dg-options "-O2" } -- This is an optimization test and its failure is only a missed optimization. -- For technical reasons it cannot pass with SJLJ exceptions. with Raise_From_Pure; use Raise_From_Pure; procedure test_raise_from_pure is K : Integer; begin K := Raise_CE_If_0 (0); end;
----------------------------------------------------------------------- -- components-widgets-tabs -- Tab views and tabs -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Beans.Objects; with ASF.Components.Base; with ASF.Contexts.Writer; package body ASF.Components.Widgets.Tabs is -- ------------------------------ -- Render the tab start. -- ------------------------------ overriding procedure Encode_Begin (UI : in UITab; Context : in out ASF.Contexts.Faces.Faces_Context'Class) is Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer; begin if UI.Is_Rendered (Context) then Writer.Start_Element ("div"); Writer.Write_Attribute ("id", UI.Get_Client_Id); end if; end Encode_Begin; -- ------------------------------ -- Render the tab close. -- ------------------------------ overriding procedure Encode_End (UI : in UITab; Context : in out ASF.Contexts.Faces.Faces_Context'Class) is Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer; begin if UI.Is_Rendered (Context) then Writer.End_Element ("div"); end if; end Encode_End; -- ------------------------------ -- Render the tab list and prepare to render the tab contents. -- ------------------------------ overriding procedure Encode_Begin (UI : in UITabView; Context : in out ASF.Contexts.Faces.Faces_Context'Class) is procedure Render_Tab (T : in Components.Base.UIComponent_Access); Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer; procedure Render_Tab (T : in Components.Base.UIComponent_Access) is Id : constant Unbounded_String := T.Get_Client_Id; begin if T.all in UITab'Class then Writer.Start_Element ("li"); Writer.Start_Element ("a"); Writer.Write_Attribute ("href", "#" & To_String (Id)); Writer.Write_Text (T.Get_Attribute ("title", Context)); Writer.End_Element ("a"); Writer.End_Element ("li"); end if; end Render_Tab; procedure Render_Tabs is new ASF.Components.Base.Iterate (Process => Render_Tab); begin if UI.Is_Rendered (Context) then declare use Util.Beans.Objects; Id : constant Unbounded_String := UI.Get_Client_Id; Effect : constant Object := UI.Get_Attribute (Context, Name => EFFECT_ATTR_NAME); Collapse : constant Boolean := UI.Get_Attribute (COLLAPSIBLE_ATTR_NAME, Context); begin Writer.Start_Element ("div"); Writer.Write_Attribute ("id", Id); Writer.Start_Element ("ul"); Render_Tabs (UI); Writer.End_Element ("ul"); Writer.Queue_Script ("$(""#"); Writer.Queue_Script (Id); Writer.Queue_Script (""").tabs({"); if Collapse then Writer.Queue_Script ("collapsible: true"); end if; if not Is_Empty (Effect) then if Collapse then Writer.Queue_Script (","); end if; Writer.Queue_Script ("show:{effect:"""); Writer.Queue_Script (Effect); Writer.Queue_Script (""",duration:"); Writer.Queue_Script (UI.Get_Attribute (DURATION_ATTR_NAME, Context, "500")); Writer.Queue_Script ("}"); end if; Writer.Queue_Script ("});"); end; end if; end Encode_Begin; -- ------------------------------ -- Render the tab view close. -- ------------------------------ overriding procedure Encode_End (UI : in UITabView; Context : in out ASF.Contexts.Faces.Faces_Context'Class) is Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer; begin if UI.Is_Rendered (Context) then Writer.End_Element ("div"); end if; end Encode_End; -- ------------------------------ -- Render the accordion list and prepare to render the tab contents. -- ------------------------------ overriding procedure Encode_Children (UI : in UIAccordion; Context : in out ASF.Contexts.Faces.Faces_Context'Class) is procedure Render_Tab (T : in Components.Base.UIComponent_Access); Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer; procedure Render_Tab (T : in Components.Base.UIComponent_Access) is begin if T.all in UITab'Class then Writer.Start_Element ("h3"); Writer.Write_Text (T.Get_Attribute ("title", Context)); Writer.End_Element ("h3"); T.Encode_All (Context); end if; end Render_Tab; procedure Render_Tabs is new ASF.Components.Base.Iterate (Process => Render_Tab); begin if UI.Is_Rendered (Context) then declare use Util.Beans.Objects; Id : constant Unbounded_String := UI.Get_Client_Id; Effect : constant Object := UI.Get_Attribute (Context, Name => EFFECT_ATTR_NAME); Collapse : constant Boolean := UI.Get_Attribute (COLLAPSIBLE_ATTR_NAME, Context); begin Writer.Start_Element ("div"); Writer.Write_Attribute ("id", Id); Render_Tabs (UI); Writer.End_Element ("div"); Writer.Queue_Script ("$(""#"); Writer.Queue_Script (Id); Writer.Queue_Script (""").accordion({"); if Collapse then Writer.Queue_Script ("collapsible: true"); end if; if not Is_Empty (Effect) then if Collapse then Writer.Queue_Script (","); end if; Writer.Queue_Script ("show:{effect:"""); Writer.Queue_Script (Effect); Writer.Queue_Script (""",duration:"); Writer.Queue_Script (UI.Get_Attribute (DURATION_ATTR_NAME, Context, "500")); Writer.Queue_Script ("}"); end if; Writer.Queue_Script ("});"); end; end if; end Encode_Children; end ASF.Components.Widgets.Tabs;
pragma Ada_2012; with Ada.Text_IO; use Ada.Text_IO; with EU_Projects.Nodes.Partners; with EU_Projects.Nodes.Action_Nodes.WPs; with EU_Projects.Nodes.Action_Nodes.Tasks; with Project_Processor.Processors.Processor_Tables; with EU_Projects.Times; package body Project_Processor.Processors.Dumping is use EU_Projects.Projects; ------------ -- Create -- ------------ overriding function Create (Params : not null access Processor_Parameter) return Processor_Type is pragma Unreferenced (Params); Result:Processor_Type; begin return Result; end Create; procedure Print_Partners (Input : EU_Projects.Projects.Project_Descriptor) is use EU_Projects.Nodes.Partners; procedure Print_Partner (Partner : Partner_Access) is use EU_Projects.Nodes; begin Put_Line ("[PARTNER]"); Put_Line (" Name : " & Partner.Name); Put_Line (" Label : " & To_String (Partner.Label)); Put_Line (" short : " & Partner.Short_Name); Put_Line ("[/ PARTNER]"); end Print_Partner; begin for Idx in Input.All_Partners loop Print_Partner (Element (Idx)); end loop; end Print_Partners; procedure Print_WPs (Input : EU_Projects.Projects.Project_Descriptor) is use EU_Projects.Nodes.Action_Nodes.WPs; use EU_Projects.Nodes.Action_Nodes.Tasks; procedure Print_WP (WP : Project_WP_Access) is use EU_Projects.Nodes; procedure Print_Times (N : Action_Nodes.Action_Node'Class; Tab : String) is use EU_Projects.Times; begin Put_Line (Tab & "begin : " & Image (N.Starting_Time)); Put_Line (Tab & "end : " & Image (N.Ending_Time)); end Print_Times; procedure Print_Efforts (N : Action_Nodes.Action_Node'Class; Tab : String) is begin Put_Line (Tab & "[efforts]"); for Pos in Input.All_Partners loop Put_Line (Tab & " " & To_String (Element (Pos).Label) & " : " & N.Effort_Of (Partners.Partner_Label (Element (Pos).Label))'image); end loop; Put_Line (Tab & "[/ efforts]"); end Print_Efforts; procedure Print_Task (Tsk : Project_Task_Access) is begin Put_Line (" [Task]"); Put_Line (" Name : " & tsk.Name); Put_Line (" Label : " & To_String (tsk.Label)); Put_Line (" short : " & tsk.Short_Name); Print_Times (Tsk.all, " "); Print_Efforts (Tsk.all, " "); Put_Line (" [/ Task]"); end Print_Task; begin Put_Line ("[WP]"); Put_Line (" Name : " & WP.Name); Put_Line (" Label : " & To_String (WP.Label)); Put_Line (" short : " & WP.Short_Name); Print_Times (WP.all, " "); Print_Efforts (WP.all, " "); for Idx in WP.All_Tasks loop Print_Task (Element (Idx)); end loop; Put_Line ("[/ WP]"); end Print_WP; begin for Idx in Input.All_WPs loop Print_WP (Element (Idx)); end loop; end Print_WPs; ------------- -- Process -- ------------- overriding procedure Process (Processor : Processor_Type; Input : EU_Projects.Projects.Project_Descriptor) is pragma Unreferenced (Processor); begin Print_Partners (Input); Print_WPs (Input); -- Print_Deliverables (Input); -- Print_Milestones (Input); end Process; begin Processor_Tables.Register (ID => To_Id ("dump"), Tag => Processor_Type'Tag); end Project_Processor.Processors.Dumping;
-- Shoot'n'loot -- Copyright (c) 2020 Fabien Chouteau with HAL; use HAL; with Levels; with Player; with Render; with Monsters; with Chests; with Score_Display; with Sound; with PyGamer.Controls; use PyGamer; with GESTE_Config; use GESTE_Config; with GESTE; with GESTE.Tile_Bank; with GESTE.Grid; with Game_Assets; with Game_Assets.Tileset; with Game_Assets.Tileset_Collisions; with Game_Assets.title_screen; package body Game is Tile_Bank : aliased GESTE.Tile_Bank.Instance (Game_Assets.Tileset.Tiles'Access, Game_Assets.Tileset_Collisions.Tiles'Access, Game_Assets.Palette'Access); Gameover_Grid : aliased GESTE.Grid.Instance (Game_Assets.title_screen.Gameover.Data'Access, Tile_Bank'Access); Victory_Grid : aliased GESTE.Grid.Instance (Game_Assets.title_screen.Victory.Data'Access, Tile_Bank'Access); Back_Grid : aliased GESTE.Grid.Instance (Game_Assets.title_screen.Back.Data'Access, Tile_Bank'Access); procedure Game_Over; procedure Victory (Time_In_Game : Time.Time_Ms); --------------- -- Game_Over -- --------------- procedure Game_Over is Period : constant Time.Time_Ms := 1000 / 60; Next_Release : Time.Time_Ms; begin Sound.Play_Gameover; Gameover_Grid.Move ((0, 0)); GESTE.Add (Gameover_Grid'Access, 10); Render.Render_All (Render.Background_Color); Next_Release := Time.Clock + Period; loop Controls.Scan; if (for some Button in Controls.Buttons => Controls.Falling (Button)) then GESTE.Remove_All; return; end if; Sound.Tick; Time.Delay_Until (Next_Release); Next_Release := Next_Release + Period; end loop; end Game_Over; ------------- -- Victory -- ------------- procedure Victory (Time_In_Game : Time.Time_Ms) is Period : constant Time.Time_Ms := 1000 / 60; Next_Release : Time.Time_Ms; begin Sound.Play_Victory; GESTE.Remove_All; Back_Grid.Move ((0, 0)); GESTE.Add (Back_Grid'Access, 1); Victory_Grid.Move ((0, 0)); GESTE.Add (Victory_Grid'Access, 2); Score_Display.Init ((10 * Tile_Size, 12 * Tile_Size)); Score_Display.Update (Time_In_Game); Render.Scroll_New_Scene (Render.Background_Color); Next_Release := Time.Clock + Period; loop Controls.Scan; if (for some Button in Controls.Buttons => Controls.Falling (Button)) then return; end if; Sound.Tick; Time.Delay_Until (Next_Release); Next_Release := Next_Release + Period; end loop; end Victory; --------------- -- Game_Loop -- --------------- function Game_Loop (Time_In_Game : in out PyGamer.Time.Time_Ms) return Boolean is use type Levels.Level_Id; Current_Level : Levels.Level_Id := Levels.Lvl_0; Period : constant Time.Time_Ms := 1000 / 60; Next_Release : Time.Time_Ms; Frame_Count : UInt32 := 0; Exit_Open : Boolean := False; begin Time_In_Game := 0; Levels.Enter (Current_Level); Score_Display.Update (Time_In_Game); Render.Scroll_New_Scene (Render.Background_Color); Next_Release := Time.Clock + Period; loop -- Check game-over if not Player.Is_Alive then Game_Over; return False; end if; -- Open exit and check victory if not Exit_Open and then Chests.All_Open and then Monsters.All_Killed then Exit_Open := True; Levels.Open_Exit; end if; if Exit_Open then if Levels.Test_Exit (Player.Position) then Sound.Play_Exit_Taken; if Current_Level = Levels.Level_Id'Last then Victory (Time_In_Game); return True; end if; Current_Level := Levels.Level_Id'Succ (Current_Level); Levels.Enter (Current_Level); Exit_Open := False; Score_Display.Update (Time_In_Game); Render.Scroll_New_Scene (Render.Background_Color); Next_Release := Time.Clock + Period; end if; end if; Controls.Scan; if Controls.Falling (Controls.A) then Player.Jump; end if; if Controls.Falling (Controls.B) then Player.Fire; end if; if Controls.Pressed (Controls.Left) then Player.Move_Left; end if; if Controls.Pressed (Controls.Right) then Player.Move_Right; end if; Player.Update; Monsters.Update; Chests.Check_Chest_Found (Player.Position); Chests.Update; Score_Display.Update (Time_In_Game); Render.Render_Dirty (Render.Background_Color); Frame_Count := Frame_Count + 1; Sound.Tick; Time.Delay_Until (Next_Release); Next_Release := Next_Release + Period; Time_In_Game := Time_In_Game + Period; end loop; end Game_Loop; end Game;
------------------------------------------------------------------------------ -- -- -- tiled-code-gen -- -- -- -- Copyright (C) 2018 Fabien Chouteau -- -- -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Ada.Directories; with Ada.Text_IO; with PDF_Out; use PDF_Out; with TCG.Palette; with TCG.Tilesets; with TCG.Tile_Layers; with TCG.Utils; package body TCG.Outputs.PDF is use type Palette.Color_Id; use type Palette.ARGB_Color; use type Tilesets.Master_Tile_Id; function Convert (C : Palette.ARGB_Color) return PDF_Out.Color_Type; procedure Draw_Square (Outfile : in out PDF_Out_File; Rect : Rectangle; Color : Color_Type); procedure Put_Palette_Info (Outfile : in out PDF_Out_File; Rect_Size : Real := 60.0; Colors_Per_Line : Natural := 3); procedure Draw_Tile (Outfile : in out PDF_Out_File; Id : Tilesets.Master_Tile_Id; Rect : Rectangle); procedure Put_Master_Tileset (Outfile : in out PDF_Out_File; Tile_Size : Real := 130.0; Tiles_Per_Line : Natural := 2); procedure Draw_Tile_Collision (Outfile : in out PDF_Out_File; Id : Tilesets.Master_Tile_Id; Rect : Rectangle); procedure Put_Master_Tileset_Collisions (Outfile : in out PDF_Out_File; Tile_Size : Real := 130.0; Tiles_Per_Line : Natural := 2); procedure Put_Map (Outfile : in out PDF_Out_File; M : Maps.Map); ------------- -- Convert -- ------------- function Convert (C : Palette.ARGB_Color) return PDF_Out.Color_Type is R : constant Real := Real (C.R) / Real (Palette.Component'Last); G : constant Real := Real (C.G) / Real (Palette.Component'Last); B : constant Real := Real (C.B) / Real (Palette.Component'Last); begin return (R, G, B); end Convert; ----------------- -- Draw_Square -- ----------------- procedure Draw_Square (Outfile : in out PDF_Out_File; Rect : Rectangle; Color : PDF_Out.Color_Type) is begin PDF_Out.Color (Outfile, Color); Draw (Outfile, Rect, fill); end Draw_Square; ---------------------- -- Put_Palette_Info -- ---------------------- procedure Put_Palette_Info (Outfile : in out PDF_Out_File; Rect_Size : Real := 60.0; Colors_Per_Line : Natural := 3) is Layout : constant Rectangle := PDF_Out.Layout (Outfile); Top_Margin : constant Real := 100.0; Left_Margin : constant Real := Rect_Size; Spacing : constant Real := (Layout.width - Left_Margin) / Real (Colors_Per_Line); X : Real := Layout.x_min + Left_Margin; Y : Real := Layout.y_min + Layout.height - Rect_Size - Top_Margin; Cnt : Natural := 1; C : Palette.ARGB_Color; begin Font_Size (Outfile, 40.0); Put_Line (Outfile, "Color Palette"); Font_Size (Outfile, 11.0); for Id in Palette.First_Id .. Palette.Last_Id loop C := Palette.Convert (Id); Draw_Square (Outfile, (X, Y, Rect_Size, Rect_Size), Convert (C)); Color (Outfile, PDF_Out.black); Put_XY (Outfile, X + Rect_Size * 1.3, Y + Rect_Size * 0.8, "Color #" & Id'Img); New_Line (Outfile); Put_Line (Outfile, "R:" & C.R'Img); Put_Line (Outfile, "G:" & C.G'Img); Put_Line (Outfile, "B:" & C.B'Img); if Palette.Transparent = Id then Put_Line (Outfile, "Transparent"); end if; if Cnt mod Colors_Per_Line = 0 then Y := Y - (Rect_Size + 20.0); X := Layout.x_min + Left_Margin; if Y <= Top_Margin then New_Page (Outfile); Y := Layout.y_min + Layout.height - Rect_Size - Top_Margin; end if; else X := X + Spacing; end if; Cnt := Cnt + 1; end loop; end Put_Palette_Info; --------------- -- Draw_Tile -- --------------- procedure Draw_Tile (Outfile : in out PDF_Out_File; Id : Tilesets.Master_Tile_Id; Rect : Rectangle) is Pix_W : constant Real := Rect.width / Real (Tilesets.Tile_Width); Pix_H : constant Real := Rect.height / Real (Tilesets.Tile_Height); C : Palette.ARGB_Color; begin for PX in 1 .. Tilesets.Tile_Width loop for PY in 1 .. Tilesets.Tile_Height loop C := Tilesets.Pix (Id, PX, (Tilesets.Tile_Height - PY + 1)); if C /= Palette.Transparent then Draw_Square (Outfile, (Rect.x_min + Real (PX - 1) * Pix_W, Rect.y_min + Real (PY - 1) * Pix_H, Pix_W, Pix_H), Convert (C)); end if; end loop; end loop; end Draw_Tile; ------------------------ -- Put_Master_Tileset -- ------------------------ procedure Put_Master_Tileset (Outfile : in out PDF_Out_File; Tile_Size : Real := 130.0; Tiles_Per_Line : Natural := 2) is Layout : constant Rectangle := PDF_Out.Layout (Outfile); Top_Margin : constant Real := 100.0; Left_Margin : constant Real := 50.0; Spacing : constant Real := (Layout.width - Left_Margin) / Real (Tiles_Per_Line); X : Real := Layout.x_min + Left_Margin; Y : Real := Layout.y_min + Layout.height - Tile_Size - Top_Margin; Cnt : Natural := 1; begin Font_Size (Outfile, 40.0); Put_Line (Outfile, "Tileset"); Font_Size (Outfile, 12.0); for Id in Tilesets.First_Id .. Tilesets.Last_Id loop if Id /= Tilesets.No_Tile then Draw_Tile (Outfile, Id, (X, Y, Tile_Size, Tile_Size)); end if; Color (Outfile, PDF_Out.black); Draw (Outfile, (X, Y, Tile_Size, Tile_Size), stroke); Put_XY (Outfile, X + Tile_Size * 1.1, Y + Tile_Size * 0.8, "Tile #" & Id'Img); New_Line (Outfile); if Id = Tilesets.No_Tile then Put_Line (Outfile, "No tile"); end if; New_Line (Outfile); if Cnt mod Tiles_Per_Line = 0 then Y := Y - (Tile_Size + 20.0); X := Layout.x_min + Left_Margin; if Y <= Top_Margin then New_Page (Outfile); Y := Layout.y_min + Layout.height - Tile_Size - Top_Margin; end if; else X := X + Spacing; end if; Cnt := Cnt + 1; end loop; end Put_Master_Tileset; ------------------------- -- Draw_Tile_Collision -- ------------------------- procedure Draw_Tile_Collision (Outfile : in out PDF_Out_File; Id : Tilesets.Master_Tile_Id; Rect : Rectangle) is Pix_W : constant Real := Rect.width / Real (Tilesets.Tile_Width); Pix_H : constant Real := Rect.height / Real (Tilesets.Tile_Height); begin for PX in 1 .. Tilesets.Tile_Width loop for PY in 1 .. Tilesets.Tile_Height loop if Tilesets.Collision (Id, PX, (Tilesets.Tile_Height - PY + 1)) then Draw_Square (Outfile, (Rect.x_min + Real (PX - 1) * Pix_W, Rect.y_min + Real (PY - 1) * Pix_H, Pix_W, Pix_H), (1.0, 0.0, 0.0)); end if; end loop; end loop; end Draw_Tile_Collision; ----------------------------------- -- Put_Master_Tileset_Collisions -- ----------------------------------- procedure Put_Master_Tileset_Collisions (Outfile : in out PDF_Out_File; Tile_Size : Real := 130.0; Tiles_Per_Line : Natural := 2) is Layout : constant Rectangle := PDF_Out.Layout (Outfile); Top_Margin : constant Real := 100.0; Left_Margin : constant Real := 50.0; Spacing : constant Real := (Layout.width - Left_Margin) / Real (Tiles_Per_Line); X : Real := Layout.x_min + Left_Margin; Y : Real := Layout.y_min + Layout.height - Tile_Size - Top_Margin; Cnt : Natural := 1; begin Font_Size (Outfile, 40.0); Put_Line (Outfile, "Tileset collisions"); Font_Size (Outfile, 12.0); for Id in Tilesets.First_Id .. Tilesets.Last_Id loop if Id /= Tilesets.No_Tile then Draw_Tile_Collision (Outfile, Id, (X, Y, Tile_Size, Tile_Size)); end if; Color (Outfile, PDF_Out.black); Draw (Outfile, (X, Y, Tile_Size, Tile_Size), stroke); Put_XY (Outfile, X + Tile_Size * 1.1, Y + Tile_Size * 0.8, "Tile #" & Id'Img); New_Line (Outfile); if Id = Tilesets.No_Tile then Put_Line (Outfile, "No tile"); end if; New_Line (Outfile); if Cnt mod Tiles_Per_Line = 0 then Y := Y - (Tile_Size + 20.0); X := Layout.x_min + Left_Margin; if Y <= Top_Margin then New_Page (Outfile); Y := Layout.y_min + Layout.height - Tile_Size - Top_Margin; end if; else X := X + Spacing; end if; Cnt := Cnt + 1; end loop; end Put_Master_Tileset_Collisions; ------------- -- Put_Map -- ------------- procedure Put_Map (Outfile : in out PDF_Out_File; M : Maps.Map) is Tile_Width : constant Natural := Maps.Tile_Width (M); Tile_Height : constant Natural := Maps.Tile_Height (M); Width : constant Natural := Maps.Width (M) * Tile_Width; Height : constant Natural := Maps.Height (M) * Tile_Height; Layout : constant Rectangle := PDF_Out.Layout (Outfile); Pix_W : constant Real := Layout.width / Real (Width); Pix_H : constant Real := Layout.height / Real (Height); Pix_Size : constant Real := Real'Min (Pix_W, Pix_H); C : Palette.ARGB_Color; T_Id : Tilesets.Master_Tile_Id; begin New_Page (Outfile); for Y in reverse 0 .. Height - 1 loop for X in 0 .. Width - 1 loop C := Palette.Transparent; for L in reverse Maps.First_Layer (M) .. Maps.Last_Layer (M) loop T_Id := Maps.Master_Tile (M, Tile_Layers.Tile (Maps.Layer (M, L), 1 + X / Tile_Width, 1 + Y / Tile_Height)); if T_Id /= Tilesets.No_Tile then C := Tilesets.Pix (T_Id, 1 + X mod Tile_Width, 1 + Y mod Tile_Height); end if; if C /= Palette.Transparent then Draw_Square (Outfile, (Layout.x_min + Real (X) * Pix_Size, Layout.y_min + Real (Width - 1 - Y) * Pix_Size, Pix_Size, Pix_Size), Convert (C)); exit; end if; end loop; end loop; end loop; Color (Outfile, PDF_Out.black); Font_Size (Outfile, 20.0); Put_XY (Outfile, 50.0, Layout.y_min + Layout.height - 30.0, Maps.Name (M)); New_Line (Outfile); Font_Size (Outfile, 12.0); for L in reverse Maps.First_Layer (M) .. Maps.Last_Layer (M) loop Put_Line (Outfile, " - " & Tile_Layers.Name (Maps.Layer (M, L))); end loop; end Put_Map; ----------------- -- Gen_PDF_Doc -- ----------------- procedure Gen_PDF_Doc (Directory : String; Filename : String; Map_List : TCG.Maps.List.List) is Outfile : PDF_Out_File; begin if not TCG.Utils.Make_Dir (Directory) then Ada.Text_IO.Put_Line (Ada.Text_IO.Standard_Error, "Cannot create directory for documentation: '" & Directory & "'"); return; end if; Create (Outfile, Ada.Directories.Compose (Directory, Filename)); Title (Outfile, ""); Subject (Outfile, ""); Keywords (Outfile, "Tiled, maps, sprites, palette"); Creator_Application (Outfile, "Tiled_Code_Gen"); Page_Setup (Outfile, A4_portrait); Put_Palette_Info (Outfile); New_Page (Outfile); Put_Master_Tileset (Outfile, Tile_Size => 50.0, Tiles_Per_Line => 5); New_Page (Outfile); Put_Master_Tileset_Collisions (Outfile, Tile_Size => 50.0, Tiles_Per_Line => 5); for M of Map_List loop Put_Map (Outfile, M); end loop; Close (Outfile); end Gen_PDF_Doc; end TCG.Outputs.PDF;
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2021 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Interfaces.C; private with Ada.Finalization; package Event_Device is pragma Pure; type Unsigned_8 is mod 2 ** 8 with Size => 8; type Unsigned_16 is mod 2 ** 16 with Size => 16; function Hex_Image (Value : Unsigned_8) return String; function Hex_Image (Value : Unsigned_16) return String; type Device_ID is record Bus, Vendor, Product, Version : Unsigned_16; end record with Convention => C_Pass_By_Copy; function GUID (ID : Device_ID) return String; type Axis_Info is record Value, Minimum, Maximum, Fuzz, Flat, Resolution : Integer; end record with Convention => C_Pass_By_Copy; type Event_Kind is (Synchronization, Key, Relative, Absolute, Miscellaneous, Switch, LED, Sound, Repeat, Force_Feedback, Power, Feedback_Status); type Synchronization_Kind is (Report, Config, MT_Report, Dropped); type Key_Info_Kind is (Button_South, Button_East, Button_North, Button_West, Button_Trigger_Left_1, Button_Trigger_Right_1, Button_Trigger_Left_2, Button_Trigger_Right_2, Button_Select, Button_Start, Button_Mode, Button_Thumb_Left, Button_Thumb_Right); type Key_Kind is new Key_Info_Kind; type Relative_Axis_Info_Kind is (X, Y, Z, Rx, Ry, Rz, Horizontal_Wheel, Diagonal, Wheel, Misc, Wheel_High_Res, Horizontal_Wheel_High_Res); type Relative_Axis_Kind is new Relative_Axis_Info_Kind; type Absolute_Axis_Info_Kind is (X, Y, Z, Rx, Ry, Rz, Throttle, Rudder, Wheel, Gas, Brake, Hat_0X, Hat_0Y, Hat_1X, Hat_1Y, Hat_2X, Hat_2Y, Hat_3X, Hat_3Y, Pressure, Distance, Tilt_X, Tilt_Y, Tool_Width, Volume, Misc, MT_Slot, MT_Touch_Major, MT_Touch_Minor, MT_Width_Major, MT_Width_Minor, MT_Orientation, MT_Position_X, MT_Position_Y, MT_Tool_Type, MT_Blob_ID, MT_Tracking_ID, MT_Pressure, MT_Distance, MT_Tool_X, MT_Tool_Y); type Absolute_Axis_Kind is new Absolute_Axis_Info_Kind; type Switch_Kind is (Lid, Tablet_Mode, Headphone_Insert, Rfkill_all, Microphone_Insert, Dock, Lineout_Insert, Jack_Physical_Insert, Video_Out_Insert, Camera_Lens_Cover, Keypad_Slide, Front_Proximity, Rotate_Lock, Line_In_Insert, Mute_Device, Pen_Inserted, Machine_Cover); type Miscellaneous_Kind is (Serial, Pulse_LED, Gesture, Raw, Scan, Timestamp); type LED_Kind is (Num_Lock, Caps_Lock, Scroll_Lock, Compose, Kana, Sleep, Suspend, Mute, Misc, Mail, Charging); type Repeat_Kind is (Repeat_Delay, Repeat_Period); type Sound_Kind is (Click, Bell, Tone); type Force_Feedback_Kind is (Rumble, Periodic, Constant_V, Spring, Friction, Damper, Inertia, Ramp, Square, Triangle, Sine, Saw_Up, Saw_Down, Custom, Gain, Auto_Center); type Synchronization_Features is array (Synchronization_Kind) of Boolean with Component_Size => 1; type Key_Features is array (Key_Kind) of Boolean with Component_Size => 1; type Relative_Axis_Features is array (Relative_Axis_Kind) of Boolean with Component_Size => 1; type Absolute_Axis_Features is array (Absolute_Axis_Kind) of Boolean with Component_Size => 1; type Switch_Features is array (Switch_Kind) of Boolean with Component_Size => 1; type Miscellaneous_Features is array (Miscellaneous_Kind) of Boolean with Component_Size => 1; type LED_Features is array (LED_Kind) of Boolean with Component_Size => 1; type Repeat_Features is array (Repeat_Kind) of Boolean with Component_Size => 1; type Sound_Features is array (Sound_Kind) of Boolean with Component_Size => 1; type Force_Feedback_Features is array (Force_Feedback_Kind) of Boolean with Component_Size => 1; type Device_Properties is record Pointer : Boolean := False; Direct : Boolean := False; Button_Pad : Boolean := False; Semi_Multi_Touch : Boolean := False; Top_Button_Pad : Boolean := False; Pointing_Stick : Boolean := False; Accelerometer : Boolean := False; end record; type Device_Events is record Synchronization : Boolean := False; Keys : Boolean := False; Relative_Axes : Boolean := False; Absolute_Axes : Boolean := False; Miscellaneous : Boolean := False; Switches : Boolean := False; LEDs : Boolean := False; Sound : Boolean := False; Repeat : Boolean := False; Force_Feedback : Boolean := False; Power : Boolean := False; Feedback_Status : Boolean := False; end record; ---------------------------------------------------------------------------- type Input_Device is tagged limited private; function Name (Object : Input_Device) return String with Pre => Object.Is_Open; function ID (Object : Input_Device) return Device_ID with Pre => Object.Is_Open; function Location (Object : Input_Device) return String with Pre => Object.Is_Open; function Unique_ID (Object : Input_Device) return String with Pre => Object.Is_Open; ---------------------------------------------------------------------------- type Key_State is (Released, Pressed); type Key_Values is array (Key_Kind) of Key_State; type Relative_Axis_Values is array (Relative_Axis_Kind) of Integer; type Absolute_Axis_Values is array (Absolute_Axis_Kind) of Integer; type State is record Keys : Key_Values := (others => Released); Relative : Relative_Axis_Values := (others => 0); Absolute : Absolute_Axis_Values := (others => 0); Time : Duration := 0.0; end record; type Read_Result is (Error, Would_Block, OK); function Read (Object : Input_Device; Value : out State) return Read_Result with Pre => Object.Is_Open; -- Read keys, relative, and absolute axes of device and return whether -- reading was successful -- -- Resolution of accelerometer and gyro axes: -- -- Accelerometer No accelerometer -- ------------- -------- -- X/Y/Z: units/g units/mm -- Rx/Ry/Rz: units/deg/s units/rad function Axis (Object : Input_Device; Axis : Absolute_Axis_Kind) return Axis_Info with Pre => Object.Is_Open; function Key_Statuses (Object : Input_Device) return Key_Features with Pre => Object.Is_Open; function LED_Statuses (Object : Input_Device) return LED_Features with Pre => Object.Is_Open; function Sound_Statuses (Object : Input_Device) return Sound_Features with Pre => Object.Is_Open; function Switch_Statuses (Object : Input_Device) return Switch_Features with Pre => Object.Is_Open; ---------------------------------------------------------------------------- function Force_Feedback_Effects (Object : Input_Device) return Natural with Pre => Object.Is_Open; -- Return the number of concurrent force-feedback effects that -- the device supports type Force_Feedback_Gain is delta 0.01 digits 3 range 0.0 .. 1.0; type Force_Feedback_Auto_Center is delta 0.01 digits 3 range 0.0 .. 1.0; procedure Set_Force_Feedback_Gain (Object : Input_Device; Value : Force_Feedback_Gain); procedure Set_Force_Feedback_Auto_Center (Object : Input_Device; Value : Force_Feedback_Auto_Center); type Force_Feedback_Effect_ID is range -1 .. 95 with Size => Interfaces.C.short'Size; subtype Uploaded_Force_Feedback_Effect_ID is Force_Feedback_Effect_ID range 0 .. Force_Feedback_Effect_ID'Last; function Play_Force_Feedback_Effect (Object : Input_Device; Identifier : Uploaded_Force_Feedback_Effect_ID; Count : Natural := 1) return Boolean; -- Play a force feedback effect and return whether playing is successful ---------------------------------------------------------------------------- function Properties (Object : Input_Device) return Device_Properties with Pre => Object.Is_Open; function Events (Object : Input_Device) return Device_Events with Pre => Object.Is_Open; function Features (Object : Input_Device) return Synchronization_Features with Pre => Object.Is_Open; function Features (Object : Input_Device) return Key_Features with Pre => Object.Is_Open; function Features (Object : Input_Device) return Relative_Axis_Features with Pre => Object.Is_Open; function Features (Object : Input_Device) return Absolute_Axis_Features with Pre => Object.Is_Open; function Features (Object : Input_Device) return Switch_Features with Pre => Object.Is_Open; function Features (Object : Input_Device) return Miscellaneous_Features with Pre => Object.Is_Open; function Features (Object : Input_Device) return LED_Features with Pre => Object.Is_Open; function Features (Object : Input_Device) return Repeat_Features with Pre => Object.Is_Open; function Features (Object : Input_Device) return Sound_Features with Pre => Object.Is_Open; function Features (Object : Input_Device) return Force_Feedback_Features with Pre => Object.Is_Open; ---------------------------------------------------------------------------- function Is_Open (Object : Input_Device) return Boolean; function Open (Object : in out Input_Device; File_Name : String; Blocking : Boolean := True) return Boolean with Pre => not Object.Is_Open; procedure Close (Object : in out Input_Device) with Pre => Object.Is_Open; private type File_Descriptor is new Integer; type Input_Device is limited new Ada.Finalization.Limited_Controlled with record FD : File_Descriptor := -1; Open : Boolean := False; end record; overriding procedure Finalize (Object : in out Input_Device); type Unsigned_64 is mod 2 ** 64 with Size => 64; for Device_Properties use record Pointer at 0 range 0 .. 0; Direct at 0 range 1 .. 1; Button_Pad at 0 range 2 .. 2; Semi_Multi_Touch at 0 range 3 .. 3; Top_Button_Pad at 0 range 4 .. 4; Pointing_Stick at 0 range 5 .. 5; Accelerometer at 0 range 6 .. 6; end record; for Device_Properties'Size use 32; for Device_Events use record Synchronization at 0 range 0 .. 0; Keys at 0 range 1 .. 1; Relative_Axes at 0 range 2 .. 2; Absolute_Axes at 0 range 3 .. 3; Miscellaneous at 0 range 4 .. 4; Switches at 0 range 5 .. 5; LEDs at 0 range 17 .. 17; Sound at 0 range 18 .. 18; Repeat at 0 range 20 .. 20; Force_Feedback at 0 range 21 .. 21; Power at 0 range 22 .. 22; Feedback_Status at 0 range 23 .. 23; end record; for Device_Events'Size use 32; for Event_Kind use (Synchronization => 16#00#, Key => 16#01#, Relative => 16#02#, Absolute => 16#03#, Miscellaneous => 16#04#, Switch => 16#05#, LED => 16#11#, Sound => 16#12#, Repeat => 16#14#, Force_Feedback => 16#15#, Power => 16#16#, Feedback_Status => 16#17#); for Event_Kind'Size use Interfaces.C.unsigned_short'Size; for Synchronization_Kind use (Report => 0, Config => 1, MT_Report => 2, Dropped => 3); for Synchronization_Kind'Size use 16; -- Representation clause for the *_Info_Kind types are needed -- because of holes in the representation values for Key_Info_Kind use (Button_South => 16#130#, Button_East => 16#131#, Button_North => 16#133#, Button_West => 16#134#, Button_Trigger_Left_1 => 16#136#, Button_Trigger_Right_1 => 16#137#, Button_Trigger_Left_2 => 16#138#, Button_Trigger_Right_2 => 16#139#, Button_Select => 16#13A#, Button_Start => 16#13B#, Button_Mode => 16#13C#, Button_Thumb_Left => 16#13D#, Button_Thumb_Right => 16#13E#); for Key_Info_Kind'Size use 16; for Key_Kind'Size use Key_Info_Kind'Size; for Relative_Axis_Info_Kind use (X => 16#00#, Y => 16#01#, Z => 16#02#, Rx => 16#03#, Ry => 16#04#, Rz => 16#05#, Horizontal_Wheel => 16#06#, Diagonal => 16#07#, Wheel => 16#08#, Misc => 16#09#, Wheel_High_Res => 16#0B#, Horizontal_Wheel_High_Res => 16#0C#); for Relative_Axis_Info_Kind'Size use 16; for Relative_Axis_Kind'Size use Relative_Axis_Info_Kind'Size; for Absolute_Axis_Info_Kind use (X => 16#00#, Y => 16#01#, Z => 16#02#, Rx => 16#03#, Ry => 16#04#, Rz => 16#05#, Throttle => 16#06#, Rudder => 16#07#, Wheel => 16#08#, Gas => 16#09#, Brake => 16#0A#, Hat_0X => 16#10#, Hat_0Y => 16#11#, Hat_1X => 16#12#, Hat_1Y => 16#13#, Hat_2X => 16#14#, Hat_2Y => 16#15#, Hat_3X => 16#16#, Hat_3Y => 16#17#, Pressure => 16#18#, Distance => 16#19#, Tilt_X => 16#1A#, Tilt_Y => 16#1B#, Tool_Width => 16#1C#, Volume => 16#20#, Misc => 16#28#, MT_Slot => 16#2F#, MT_Touch_Major => 16#30#, MT_Touch_Minor => 16#31#, MT_Width_Major => 16#32#, MT_Width_Minor => 16#33#, MT_Orientation => 16#34#, MT_Position_X => 16#35#, MT_Position_Y => 16#36#, MT_Tool_Type => 16#37#, MT_Blob_ID => 16#38#, MT_Tracking_ID => 16#39#, MT_Pressure => 16#3A#, MT_Distance => 16#3B#, MT_Tool_X => 16#3C#, MT_Tool_Y => 16#3D#); for Absolute_Axis_Info_Kind'Size use 64; for Absolute_Axis_Kind'Size use Absolute_Axis_Info_Kind'Size; for Switch_Kind use (Lid => 16#00#, Tablet_Mode => 16#01#, Headphone_Insert => 16#02#, Rfkill_all => 16#03#, Microphone_Insert => 16#04#, Dock => 16#05#, Lineout_Insert => 16#06#, Jack_Physical_Insert => 16#07#, Video_Out_Insert => 16#08#, Camera_Lens_Cover => 16#09#, Keypad_Slide => 16#0A#, Front_Proximity => 16#0B#, Rotate_Lock => 16#0C#, Line_In_Insert => 16#0D#, Mute_Device => 16#0E#, Pen_Inserted => 16#0F#, Machine_Cover => 16#10#); for Switch_Kind'Size use 17; for Miscellaneous_Kind use (Serial => 16#00#, Pulse_LED => 16#01#, Gesture => 16#02#, Raw => 16#03#, Scan => 16#04#, Timestamp => 16#05#); for Miscellaneous_Kind'Size use 8; for LED_Kind use (Num_Lock => 16#00#, Caps_Lock => 16#01#, Scroll_Lock => 16#02#, Compose => 16#03#, Kana => 16#04#, Sleep => 16#05#, Suspend => 16#06#, Mute => 16#07#, Misc => 16#08#, Mail => 16#09#, Charging => 16#0A#); for LED_Kind'Size use 16; for Repeat_Kind use (Repeat_Delay => 16#00#, Repeat_Period => 16#01#); for Repeat_Kind'Size use 2; for Sound_Kind use (Click => 16#00#, Bell => 16#01#, Tone => 16#02#); for Sound_Kind'Size use 8; end Event_Device;
-- Copyright 2016,2017 Steven Stewart-Gallus -- -- 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; with Ada.Unchecked_Conversion; with Ada.Numerics.Elementary_Functions; private with Interfaces.C.Strings; private with Interfaces.C; private with Pulse.Context; private with Pulse.Def; private with Pulse.Error; private with Pulse.Mainloop; private with Pulse.Mainloop.API; private with Pulse.Proplist; private with Pulse.Sample; private with Pulse.Stream; private with Linted.Errors; private with Linted.KOs; private with Linted.Stdio; private with Libc.Stddef; package body Linted.Audio with Spark_Mode => Off is use Interfaces.C.Strings; use Interfaces.C; use Pulse.Context; use Pulse.Def; use Pulse.Error; use Pulse.Mainloop; use Pulse.Mainloop.API; use Pulse.Proplist; use Pulse.Sample; use Pulse.Stream; use type Errors.Error; A_TONE : constant Float := 440.0; SAMPLE_RATE : constant Float := 44100.0; GREATEST_PERIOD : constant Float := 1000.0 * (SAMPLE_RATE / A_TONE); Sampledata : array (0 .. Integer (GREATEST_PERIOD) - 1) of aliased short; Test_Sample_Spec : constant pa_sample_spec := (format => PA_SAMPLE_S16LE, rate => unsigned (SAMPLE_RATE), channels => 1); function Square_Wave (II : Integer; Freq : Float; Amplitude : Float; Sample : Float) return Float; function Triangle_Wave (II : Integer; Freq : Float; Amplitude : Float; Sample : Float) return Float; function Sin_Wave (II : Integer; Freq : Float; Amplitude : Float; Sample : Float) return Float; procedure On_Notify (c : pa_context_access; userdata : System.Address); pragma Convention (C, On_Notify); task Main_Task; task body Main_Task is Mainloop : pa_mainloop_access; Context : pa_context_access; Retval : int; begin for II in Sampledata'Range loop Sampledata (II) := short (Triangle_Wave (II, A_TONE, 8000.0, SAMPLE_RATE) * Square_Wave (II, A_TONE / 100.0, 1.0, SAMPLE_RATE) * Sin_Wave (II, A_TONE / 1000.0, 1.0, SAMPLE_RATE)); end loop; Mainloop := pa_mainloop_new; if null = Mainloop then raise Storage_Error with "Cannot create a mainloop"; end if; declare Proplist : pa_proplist_access; Role_Str : chars_ptr; Role : chars_ptr; Game_Name : chars_ptr; begin Proplist := pa_proplist_new; if null = Proplist then raise Storage_Error with "Cannot create a property list"; end if; Role_Str := New_String ("PULSE_PROP_media.role"); Role := New_String ("game"); if 0 < pa_proplist_sets (Proplist, Role, Role_Str) then raise Storage_Error with "Cannot set property list values"; end if; Free (Role); Free (Role_Str); Game_Name := New_String ("Linted"); Context := pa_context_new_with_proplist (pa_mainloop_get_api (Mainloop), Game_Name, Proplist); if null = Context then raise Storage_Error with "Cannot create a new context"; end if; Free (Game_Name); pa_proplist_free (Proplist); end; pa_context_set_state_callback (Context, On_Notify'Access, System.Null_Address); if pa_context_connect (Context, Null_Ptr, PA_CONTEXT_NOAUTOSPAWN, null) < 0 then raise Program_Error with Value (pa_strerror (pa_context_errno (Context))); end if; if pa_mainloop_run (Mainloop, Retval) < 0 then raise Program_Error with Value (pa_strerror (pa_context_errno (Context))); end if; pa_context_unref (Context); pa_mainloop_free (Mainloop); end Main_Task; function Square_Wave (II : Integer; Freq : Float; Amplitude : Float; Sample : Float) return Float is Frequency : constant Float := Freq / Sample; Period : constant Float := 1.0 / Frequency; begin return Amplitude * ((Float (II mod Integer (Period)) + (Period / 2.0)) / Period); end Square_Wave; function Triangle_Wave (II : Integer; Freq : Float; Amplitude : Float; Sample : Float) return Float is Frequency : constant Float := Freq / Sample; Period : constant Float := 1.0 / Frequency; begin return Amplitude * Float (II mod Integer (Period)) / Period; end Triangle_Wave; function Sin_Wave (II : Integer; Freq : Float; Amplitude : Float; Sample : Float) return Float is Frequency : constant Float := Freq / Sample; Tau : constant Float := 6.28318530718; begin return Amplitude * Ada.Numerics.Elementary_Functions.Sin (Tau * Frequency * Float (II)); end Sin_Wave; procedure On_Ready (c : pa_context_access); procedure On_Notify (c : pa_context_access; userdata : System.Address) is begin case pa_context_get_state (c) is when PA_CONTEXT_UNCONNECTED => Stdio.Write_Line (KOs.Standard_Error, "Unconnected"); when PA_CONTEXT_CONNECTING => Stdio.Write_Line (KOs.Standard_Error, "Connecting"); when PA_CONTEXT_AUTHORIZING => Stdio.Write_Line (KOs.Standard_Error, "Authorizing"); when PA_CONTEXT_SETTING_NAME => Stdio.Write_Line (KOs.Standard_Error, "Setting Name"); when PA_CONTEXT_READY => Stdio.Write_Line (KOs.Standard_Error, "Ready"); On_Ready (c); when PA_CONTEXT_FAILED => Stdio.Write_Line (KOs.Standard_Error, "Failed"); when PA_CONTEXT_TERMINATED => Stdio.Write_Line (KOs.Standard_Error, "Terminated"); end case; end On_Notify; procedure On_Ok_To_Write (s : pa_stream_access; nbytes : Libc.Stddef.size_t; userdata : System.Address); pragma Convention (C, On_Ok_To_Write); procedure On_Ready (c : pa_context_access) is Stream : pa_stream_access; Buffer_Attr : pa_buffer_attr; Latency : constant unsigned_long := 20000; Stream_Name : chars_ptr; begin Stream_Name := New_String ("Background Music"); Stream := pa_stream_new (c, Stream_Name, Test_Sample_Spec, null); Free (Stream_Name); pa_stream_set_write_callback (Stream, On_Ok_To_Write'Access, System.Null_Address); Buffer_Attr.maxlength := unsigned (pa_usec_to_bytes (Latency, Test_Sample_Spec)); Buffer_Attr.minreq := unsigned (pa_usec_to_bytes (0, Test_Sample_Spec)); Buffer_Attr.prebuf := -1; Buffer_Attr.tlength := unsigned (pa_usec_to_bytes (Latency, Test_Sample_Spec)); if pa_stream_connect_playback (Stream, Null_Ptr, Buffer_Attr, PA_STREAM_INTERPOLATE_TIMING or PA_STREAM_ADJUST_LATENCY or PA_STREAM_AUTO_TIMING_UPDATE, null, System.Null_Address) < 0 then raise Program_Error with "pa_stream_connect_playback: " & Value (pa_strerror (pa_context_errno (c))); end if; end On_Ready; Sampleoffs : Libc.Stddef.size_t := 0; procedure On_Ok_To_Write (s : pa_stream_access; nbytes : Libc.Stddef.size_t; userdata : System.Address) is Mybytes : Libc.Stddef.size_t := nbytes; begin if Sampleoffs * 2 + Mybytes > Libc.Stddef.size_t (GREATEST_PERIOD) * 2 then Sampleoffs := 0; end if; if Mybytes > Libc.Stddef.size_t (GREATEST_PERIOD) * 2 then Mybytes := Libc.Stddef.size_t (GREATEST_PERIOD) * 2; end if; if pa_stream_write (s, Sampledata (Integer (Sampleoffs))'Address, Mybytes, null, 0, PA_SEEK_RELATIVE) < 0 then raise Program_Error with "pa_stream_write"; end if; Sampleoffs := Sampleoffs + nbytes / 2; end On_Ok_To_Write; end Linted.Audio;
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- ncurses -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 2000-2004,2006 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno <aldomel@ix.netcom.com> 2000 -- Version Control -- $Revision: 1.5 $ -- $Date: 2006/06/25 14:24:40 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; with ncurses2.genericPuts; with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Ada.Strings.Unbounded; with Ada.Strings.Fixed; procedure ncurses2.acs_display is use Int_IO; procedure show_upper_chars (first : Integer); function show_1_acs (N : Integer; name : String; code : Attributed_Character) return Integer; procedure show_acs_chars; procedure show_upper_chars (first : Integer) is C1 : constant Boolean := (first = 128); last : constant Integer := first + 31; package p is new ncurses2.genericPuts (200); use p; use p.BS; use Ada.Strings.Unbounded; tmpa : Unbounded_String; tmpb : BS.Bounded_String; begin Erase; Switch_Character_Attribute (Attr => (Bold_Character => True, others => False)); Move_Cursor (Line => 0, Column => 20); tmpa := To_Unbounded_String ("Display of "); if C1 then tmpa := tmpa & "C1"; else tmpa := tmpa & "GR"; end if; tmpa := tmpa & " Character Codes "; myPut (tmpb, first); Append (tmpa, To_String (tmpb)); Append (tmpa, " to "); myPut (tmpb, last); Append (tmpa, To_String (tmpb)); Add (Str => To_String (tmpa)); Switch_Character_Attribute (On => False, Attr => (Bold_Character => True, others => False)); Refresh; for code in first .. last loop declare row : constant Line_Position := Line_Position (4 + ((code - first) mod 16)); col : constant Column_Position := Column_Position (((code - first) / 16) * Integer (Columns) / 2); tmp3 : String (1 .. 3); tmpx : String (1 .. Integer (Columns / 4)); reply : Key_Code; begin Put (tmp3, code); myPut (tmpb, code, 16); tmpa := To_Unbounded_String (tmp3 & " (" & To_String (tmpb) & ')'); Ada.Strings.Fixed.Move (To_String (tmpa), tmpx, Justify => Ada.Strings.Right); Add (Line => row, Column => col, Str => tmpx & ' ' & ':' & ' '); if C1 then Set_NoDelay_Mode (Mode => True); end if; Add_With_Immediate_Echo (Ch => Code_To_Char (Key_Code (code))); -- TODO check this if C1 then reply := Getchar; while reply /= Key_None loop Add (Ch => Code_To_Char (reply)); Nap_Milli_Seconds (10); reply := Getchar; end loop; Set_NoDelay_Mode (Mode => False); end if; end; end loop; end show_upper_chars; function show_1_acs (N : Integer; name : String; code : Attributed_Character) return Integer is height : constant Integer := 16; row : constant Line_Position := Line_Position (4 + (N mod height)); col : constant Column_Position := Column_Position ((N / height) * Integer (Columns) / 2); tmpx : String (1 .. Integer (Columns) / 3); begin Ada.Strings.Fixed.Move (name, tmpx, Justify => Ada.Strings.Right, Drop => Ada.Strings.Left); Add (Line => row, Column => col, Str => tmpx & ' ' & ':' & ' '); -- we need more room than C because our identifiers are longer -- 22 chars actually Add (Ch => code); return N + 1; end show_1_acs; procedure show_acs_chars is n : Integer; begin Erase; Switch_Character_Attribute (Attr => (Bold_Character => True, others => False)); Add (Line => 0, Column => 20, Str => "Display of the ACS Character Set"); Switch_Character_Attribute (On => False, Attr => (Bold_Character => True, others => False)); Refresh; -- the following is useful to generate the below -- grep '^[ ]*ACS_' ../src/terminal_interface-curses.ads | -- awk '{print "n := show_1_acs(n, \""$1"\", ACS_Map("$1"));"}' n := show_1_acs (0, "ACS_Upper_Left_Corner", ACS_Map (ACS_Upper_Left_Corner)); n := show_1_acs (n, "ACS_Lower_Left_Corner", ACS_Map (ACS_Lower_Left_Corner)); n := show_1_acs (n, "ACS_Upper_Right_Corner", ACS_Map (ACS_Upper_Right_Corner)); n := show_1_acs (n, "ACS_Lower_Right_Corner", ACS_Map (ACS_Lower_Right_Corner)); n := show_1_acs (n, "ACS_Left_Tee", ACS_Map (ACS_Left_Tee)); n := show_1_acs (n, "ACS_Right_Tee", ACS_Map (ACS_Right_Tee)); n := show_1_acs (n, "ACS_Bottom_Tee", ACS_Map (ACS_Bottom_Tee)); n := show_1_acs (n, "ACS_Top_Tee", ACS_Map (ACS_Top_Tee)); n := show_1_acs (n, "ACS_Horizontal_Line", ACS_Map (ACS_Horizontal_Line)); n := show_1_acs (n, "ACS_Vertical_Line", ACS_Map (ACS_Vertical_Line)); n := show_1_acs (n, "ACS_Plus_Symbol", ACS_Map (ACS_Plus_Symbol)); n := show_1_acs (n, "ACS_Scan_Line_1", ACS_Map (ACS_Scan_Line_1)); n := show_1_acs (n, "ACS_Scan_Line_9", ACS_Map (ACS_Scan_Line_9)); n := show_1_acs (n, "ACS_Diamond", ACS_Map (ACS_Diamond)); n := show_1_acs (n, "ACS_Checker_Board", ACS_Map (ACS_Checker_Board)); n := show_1_acs (n, "ACS_Degree", ACS_Map (ACS_Degree)); n := show_1_acs (n, "ACS_Plus_Minus", ACS_Map (ACS_Plus_Minus)); n := show_1_acs (n, "ACS_Bullet", ACS_Map (ACS_Bullet)); n := show_1_acs (n, "ACS_Left_Arrow", ACS_Map (ACS_Left_Arrow)); n := show_1_acs (n, "ACS_Right_Arrow", ACS_Map (ACS_Right_Arrow)); n := show_1_acs (n, "ACS_Down_Arrow", ACS_Map (ACS_Down_Arrow)); n := show_1_acs (n, "ACS_Up_Arrow", ACS_Map (ACS_Up_Arrow)); n := show_1_acs (n, "ACS_Board_Of_Squares", ACS_Map (ACS_Board_Of_Squares)); n := show_1_acs (n, "ACS_Lantern", ACS_Map (ACS_Lantern)); n := show_1_acs (n, "ACS_Solid_Block", ACS_Map (ACS_Solid_Block)); n := show_1_acs (n, "ACS_Scan_Line_3", ACS_Map (ACS_Scan_Line_3)); n := show_1_acs (n, "ACS_Scan_Line_7", ACS_Map (ACS_Scan_Line_7)); n := show_1_acs (n, "ACS_Less_Or_Equal", ACS_Map (ACS_Less_Or_Equal)); n := show_1_acs (n, "ACS_Greater_Or_Equal", ACS_Map (ACS_Greater_Or_Equal)); n := show_1_acs (n, "ACS_PI", ACS_Map (ACS_PI)); n := show_1_acs (n, "ACS_Not_Equal", ACS_Map (ACS_Not_Equal)); n := show_1_acs (n, "ACS_Sterling", ACS_Map (ACS_Sterling)); end show_acs_chars; c1 : Key_Code; c : Character := 'a'; begin loop case c is when 'a' => show_acs_chars; when '0' | '1' | '2' | '3' => show_upper_chars (ctoi (c) * 32 + 128); when others => null; end case; Add (Line => Lines - 3, Column => 0, Str => "Note: ANSI terminals may not display C1 characters."); Add (Line => Lines - 2, Column => 0, Str => "Select: a=ACS, 0=C1, 1,2,3=GR characters, q=quit"); Refresh; c1 := Getchar; c := Code_To_Char (c1); exit when c = 'q' or c = 'x'; end loop; Pause; Erase; End_Windows; end ncurses2.acs_display;
package gel.Remote -- -- Provides a namespace for remote GEL classes. -- is pragma Pure; end gel.Remote;
with Ada.Text_IO; use Ada.Text_IO; with hetro_stack; with hetro_stack_elems; use hetro_stack_elems; with Ada.Calendar; use Ada.Calendar; procedure driver is package IIO is new Ada.Text_IO.Integer_IO(Integer); use IIO; -- Will Satisfy Formal Parameter for generic instatntiation. -- Vehicle'Class will allow this to be extended to all the derivatives of Vehicle. procedure CPrint(Pt: Vehicle'Class) is begin Print(Pt); -- Calling Overloaded Prints in hetro_stack_elem (dVehicle's Print and it's derivatices) end CPrint; function Comp(Obj1,Obj2 : in Vehicle'Class) return Boolean is begin return Compare(Obj1,Obj2); end Comp; package SS is new hetro_Stack(Vehicle,Comp); use SS; procedure PrintAllList is new PrintList(CPrint); VehicleStack, PlaneStack : hetroStack; Size: Integer := 0; CarObj: CarRecPtr; PlaneObj: PlaneRecPtr; CarRef: aliased CarRec; VPoint : access Vehicle'Class; begin SetHeadNode(VehicleStack); -- Creates List Head (Car). SetHeadNode(PlaneStack); -- Creates List Head (Plane). -- (a) 4 Door Ford, Insert Rear CarObj := new CarRec'(VehicleType => Car, NumOfDoors => 4, Manf => "FORD ") ; PushRear(VehicleStack, ItemPt(CarObj)); --Print(CarObj.all); -- (b) 2 Door Ford, Insert Front CarObj := new CarRec'(VehicleType => Car, NumOfDoors => 2, Manf => "FORD ") ; PushFront(VehicleStack, ItemPt(CarObj)); --Print(CarObj.all); -- (c) 2 Door GMC, Insert Rear. CarObj := new CarRec'(VehicleType => Car, NumOfDoors => 2, Manf => "GMC ") ; PushRear(VehicleStack, ItemPt(CarObj)); --Print(CarObj.all); -- (d) 2 Door Ram, Insert Rear. CarObj := new CarRec'(VehicleType => Car, NumOfDoors => 2, Manf => "RAM ") ; PushRear(VehicleStack, ItemPt(CarObj)); --Print(CarObj.all); --(e) 3 Door Chevy, Insert Front. CarObj := new CarRec'(VehicleType => Car, NumOfDoors => 3, Manf => "CHEVY") ; PushFront(VehicleStack, ItemPt(CarObj)); --Print(CarObj.all); --(f) Car List Size Size := StackSize(VehicleStack); put_line("Car List Size: "); put(Size,0);new_line; put_line("-----------------------------------------------------------------------------------"); --(g) Contents of Car List put_line("Car List: "); --put_line("-----------------------------------------------------------------------------------"); PrintAllList(VehicleStack); --(h) Find First Ford and Delete CarRef := CarRec'(VehicleType => Car, NumOfDoors => 0, Manf => "FORD "); VPoint := RemoveSpecificNode(VehicleStack, CarRef'Access); --put_line("Been Removed"); --Print(VPoint.all); --(I) Car List Size Size := StackSize(VehicleStack); put_line("Car List Size: "); put(Size,0);new_line; put_line("-----------------------------------------------------------------------------------"); --(J) Conttents of Car List put_line("Car List: "); --put_line("-----------------------------------------------------------------------------------"); PrintAllList(VehicleStack); --(K) Boeing, 3 Doors, 6 Engines, Insert Front PlaneObj := new PlaneRec'(VehicleType => Plane, NumOfDoors => 3, Manf => "BOEING ", NumOfEngines => 6) ; PushFront(PlaneStack, ItemPt(PlaneObj)); --(L) Piper, 2 Doors, 1 Engine, Insert Front. PlaneObj := new PlaneRec'(VehicleType => Plane, NumOfDoors => 2, Manf => "PIPER ", NumOfEngines => 1) ; PushFront(PlaneStack, ItemPt(PlaneObj)); --(M) Cessna, 4 Doors, 4 Engines, Insert Front PlaneObj := new PlaneRec'(VehicleType => Plane, NumOfDoors => 4, Manf => "CESSNA ", NumOfEngines => 4) ; PushFront(PlaneStack, ItemPt(PlaneObj)); -- Size of Plane List Size := StackSize(PlaneStack); put_line("Plane List Size: "); put(Size,0);new_line; put_line("-----------------------------------------------------------------------------------"); --(N) Contents of Plane List put_line("Plane List: "); PrintAllList(PlaneStack); end driver;
pragma Style_Checks (Off); -- This spec has been automatically generated from STM32H743x.svd pragma Restrictions (No_Elaboration_Code); with HAL; with System; package STM32_SVD.OPAMP is pragma Preelaborate; --------------- -- Registers -- --------------- subtype OPAMP1_CSR_VP_SEL_Field is HAL.UInt2; subtype OPAMP1_CSR_VM_SEL_Field is HAL.UInt2; subtype OPAMP1_CSR_CALSEL_Field is HAL.UInt2; subtype OPAMP1_CSR_PGA_GAIN_Field is HAL.UInt4; -- OPAMP1 control/status register type OPAMP1_CSR_Register is record -- Operational amplifier Enable OPAEN : Boolean := False; -- Force internal reference on VP (reserved for test FORCE_VP : Boolean := False; -- Operational amplifier PGA mode VP_SEL : OPAMP1_CSR_VP_SEL_Field := 16#0#; -- unspecified Reserved_4_4 : HAL.Bit := 16#0#; -- Inverting input selection VM_SEL : OPAMP1_CSR_VM_SEL_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Operational amplifier high-speed mode OPAHSM : Boolean := False; -- unspecified Reserved_9_10 : HAL.UInt2 := 16#0#; -- Calibration mode enabled CALON : Boolean := False; -- Calibration selection CALSEL : OPAMP1_CSR_CALSEL_Field := 16#0#; -- allows to switch from AOP offset trimmed values to AOP offset PGA_GAIN : OPAMP1_CSR_PGA_GAIN_Field := 16#0#; -- User trimming enable USERTRIM : Boolean := False; -- unspecified Reserved_19_28 : HAL.UInt10 := 16#0#; -- OPAMP calibration reference voltage output control (reserved for -- test) TSTREF : Boolean := False; -- Operational amplifier calibration output CALOUT : Boolean := False; -- unspecified Reserved_31_31 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for OPAMP1_CSR_Register use record OPAEN at 0 range 0 .. 0; FORCE_VP at 0 range 1 .. 1; VP_SEL at 0 range 2 .. 3; Reserved_4_4 at 0 range 4 .. 4; VM_SEL at 0 range 5 .. 6; Reserved_7_7 at 0 range 7 .. 7; OPAHSM at 0 range 8 .. 8; Reserved_9_10 at 0 range 9 .. 10; CALON at 0 range 11 .. 11; CALSEL at 0 range 12 .. 13; PGA_GAIN at 0 range 14 .. 17; USERTRIM at 0 range 18 .. 18; Reserved_19_28 at 0 range 19 .. 28; TSTREF at 0 range 29 .. 29; CALOUT at 0 range 30 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; subtype OPAMP1_OTR_TRIMOFFSETN_Field is HAL.UInt5; subtype OPAMP1_OTR_TRIMOFFSETP_Field is HAL.UInt5; -- OPAMP1 offset trimming register in normal mode type OPAMP1_OTR_Register is record -- Trim for NMOS differential pairs TRIMOFFSETN : OPAMP1_OTR_TRIMOFFSETN_Field := 16#0#; -- unspecified Reserved_5_7 : HAL.UInt3 := 16#0#; -- Trim for PMOS differential pairs TRIMOFFSETP : OPAMP1_OTR_TRIMOFFSETP_Field := 16#0#; -- unspecified Reserved_13_31 : HAL.UInt19 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for OPAMP1_OTR_Register use record TRIMOFFSETN at 0 range 0 .. 4; Reserved_5_7 at 0 range 5 .. 7; TRIMOFFSETP at 0 range 8 .. 12; Reserved_13_31 at 0 range 13 .. 31; end record; subtype OPAMP1_HSOTR_TRIMHSOFFSETN_Field is HAL.UInt5; subtype OPAMP1_HSOTR_TRIMHSOFFSETP_Field is HAL.UInt5; -- OPAMP1 offset trimming register in low-power mode type OPAMP1_HSOTR_Register is record -- Trim for NMOS differential pairs TRIMHSOFFSETN : OPAMP1_HSOTR_TRIMHSOFFSETN_Field := 16#0#; -- unspecified Reserved_5_7 : HAL.UInt3 := 16#0#; -- Trim for PMOS differential pairs TRIMHSOFFSETP : OPAMP1_HSOTR_TRIMHSOFFSETP_Field := 16#0#; -- unspecified Reserved_13_31 : HAL.UInt19 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for OPAMP1_HSOTR_Register use record TRIMHSOFFSETN at 0 range 0 .. 4; Reserved_5_7 at 0 range 5 .. 7; TRIMHSOFFSETP at 0 range 8 .. 12; Reserved_13_31 at 0 range 13 .. 31; end record; subtype OPAMP2_CSR_VM_SEL_Field is HAL.UInt2; subtype OPAMP2_CSR_CALSEL_Field is HAL.UInt2; subtype OPAMP2_CSR_PGA_GAIN_Field is HAL.UInt4; -- OPAMP2 control/status register type OPAMP2_CSR_Register is record -- Operational amplifier Enable OPAEN : Boolean := False; -- Force internal reference on VP (reserved for test) FORCE_VP : Boolean := False; -- unspecified Reserved_2_4 : HAL.UInt3 := 16#0#; -- Inverting input selection VM_SEL : OPAMP2_CSR_VM_SEL_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Operational amplifier high-speed mode OPAHSM : Boolean := False; -- unspecified Reserved_9_10 : HAL.UInt2 := 16#0#; -- Calibration mode enabled CALON : Boolean := False; -- Calibration selection CALSEL : OPAMP2_CSR_CALSEL_Field := 16#0#; -- Operational amplifier Programmable amplifier gain value PGA_GAIN : OPAMP2_CSR_PGA_GAIN_Field := 16#0#; -- User trimming enable USERTRIM : Boolean := False; -- unspecified Reserved_19_28 : HAL.UInt10 := 16#0#; -- OPAMP calibration reference voltage output control (reserved for -- test) TSTREF : Boolean := False; -- Operational amplifier calibration output CALOUT : Boolean := False; -- unspecified Reserved_31_31 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for OPAMP2_CSR_Register use record OPAEN at 0 range 0 .. 0; FORCE_VP at 0 range 1 .. 1; Reserved_2_4 at 0 range 2 .. 4; VM_SEL at 0 range 5 .. 6; Reserved_7_7 at 0 range 7 .. 7; OPAHSM at 0 range 8 .. 8; Reserved_9_10 at 0 range 9 .. 10; CALON at 0 range 11 .. 11; CALSEL at 0 range 12 .. 13; PGA_GAIN at 0 range 14 .. 17; USERTRIM at 0 range 18 .. 18; Reserved_19_28 at 0 range 19 .. 28; TSTREF at 0 range 29 .. 29; CALOUT at 0 range 30 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; subtype OPAMP2_OTR_TRIMOFFSETN_Field is HAL.UInt5; subtype OPAMP2_OTR_TRIMOFFSETP_Field is HAL.UInt5; -- OPAMP2 offset trimming register in normal mode type OPAMP2_OTR_Register is record -- Trim for NMOS differential pairs TRIMOFFSETN : OPAMP2_OTR_TRIMOFFSETN_Field := 16#0#; -- unspecified Reserved_5_7 : HAL.UInt3 := 16#0#; -- Trim for PMOS differential pairs TRIMOFFSETP : OPAMP2_OTR_TRIMOFFSETP_Field := 16#0#; -- unspecified Reserved_13_31 : HAL.UInt19 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for OPAMP2_OTR_Register use record TRIMOFFSETN at 0 range 0 .. 4; Reserved_5_7 at 0 range 5 .. 7; TRIMOFFSETP at 0 range 8 .. 12; Reserved_13_31 at 0 range 13 .. 31; end record; subtype OPAMP2_HSOTR_TRIMHSOFFSETN_Field is HAL.UInt5; subtype OPAMP2_HSOTR_TRIMHSOFFSETP_Field is HAL.UInt5; -- OPAMP2 offset trimming register in low-power mode type OPAMP2_HSOTR_Register is record -- Trim for NMOS differential pairs TRIMHSOFFSETN : OPAMP2_HSOTR_TRIMHSOFFSETN_Field := 16#0#; -- unspecified Reserved_5_7 : HAL.UInt3 := 16#0#; -- Trim for PMOS differential pairs TRIMHSOFFSETP : OPAMP2_HSOTR_TRIMHSOFFSETP_Field := 16#0#; -- unspecified Reserved_13_31 : HAL.UInt19 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for OPAMP2_HSOTR_Register use record TRIMHSOFFSETN at 0 range 0 .. 4; Reserved_5_7 at 0 range 5 .. 7; TRIMHSOFFSETP at 0 range 8 .. 12; Reserved_13_31 at 0 range 13 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Operational amplifiers type OPAMP_Peripheral is record -- OPAMP1 control/status register OPAMP1_CSR : aliased OPAMP1_CSR_Register; -- OPAMP1 offset trimming register in normal mode OPAMP1_OTR : aliased OPAMP1_OTR_Register; -- OPAMP1 offset trimming register in low-power mode OPAMP1_HSOTR : aliased OPAMP1_HSOTR_Register; -- OPAMP2 control/status register OPAMP2_CSR : aliased OPAMP2_CSR_Register; -- OPAMP2 offset trimming register in normal mode OPAMP2_OTR : aliased OPAMP2_OTR_Register; -- OPAMP2 offset trimming register in low-power mode OPAMP2_HSOTR : aliased OPAMP2_HSOTR_Register; end record with Volatile; for OPAMP_Peripheral use record OPAMP1_CSR at 16#0# range 0 .. 31; OPAMP1_OTR at 16#4# range 0 .. 31; OPAMP1_HSOTR at 16#8# range 0 .. 31; OPAMP2_CSR at 16#10# range 0 .. 31; OPAMP2_OTR at 16#14# range 0 .. 31; OPAMP2_HSOTR at 16#18# range 0 .. 31; end record; -- Operational amplifiers OPAMP_Periph : aliased OPAMP_Peripheral with Import, Address => OPAMP_Base; end STM32_SVD.OPAMP;
-- This spec has been automatically generated from STM32L5x2.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.GTZC is pragma Preelaborate; --------------- -- Registers -- --------------- -- MPCBB control register type MPCBB1_CR_Register is record -- LCK LCK : Boolean := False; -- unspecified Reserved_1_29 : HAL.UInt29 := 16#0#; -- INVSECSTATE INVSECSTATE : Boolean := False; -- SRWILADIS SRWILADIS : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for MPCBB1_CR_Register use record LCK at 0 range 0 .. 0; Reserved_1_29 at 0 range 1 .. 29; INVSECSTATE at 0 range 30 .. 30; SRWILADIS at 0 range 31 .. 31; end record; -- MPCBB1_LCKVTR1_LCKSB array type MPCBB1_LCKVTR1_LCKSB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- MPCBB control register type MPCBB1_LCKVTR1_Register (As_Array : Boolean := False) is record case As_Array is when False => -- LCKSB as a value Val : HAL.UInt32; when True => -- LCKSB as an array Arr : MPCBB1_LCKVTR1_LCKSB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_LCKVTR1_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_LCKVTR2_LCKSB array type MPCBB1_LCKVTR2_LCKSB_Field_Array is array (32 .. 63) of Boolean with Component_Size => 1, Size => 32; -- MPCBB control register type MPCBB1_LCKVTR2_Register (As_Array : Boolean := False) is record case As_Array is when False => -- LCKSB as a value Val : HAL.UInt32; when True => -- LCKSB as an array Arr : MPCBB1_LCKVTR2_LCKSB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_LCKVTR2_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR0_B array type MPCBB1_VCTR0_B_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR0_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR0_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR0_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR1_B array type MPCBB1_VCTR1_B_Field_Array is array (32 .. 63) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR1_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR1_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR1_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR2_B array type MPCBB1_VCTR2_B_Field_Array is array (64 .. 95) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR2_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR2_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR2_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR3_B array type MPCBB1_VCTR3_B_Field_Array is array (96 .. 127) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR3_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR3_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR3_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR4_B array type MPCBB1_VCTR4_B_Field_Array is array (128 .. 159) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR4_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR4_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR4_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR5_B array type MPCBB1_VCTR5_B_Field_Array is array (160 .. 191) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR5_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR5_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR5_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR6_B array type MPCBB1_VCTR6_B_Field_Array is array (192 .. 223) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR6_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR6_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR6_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR7_B array type MPCBB1_VCTR7_B_Field_Array is array (224 .. 255) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR7_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR7_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR7_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR8_B array type MPCBB1_VCTR8_B_Field_Array is array (256 .. 287) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR8_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR8_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR8_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR9_B array type MPCBB1_VCTR9_B_Field_Array is array (288 .. 319) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR9_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR9_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR9_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR10_B array type MPCBB1_VCTR10_B_Field_Array is array (320 .. 351) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR10_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR10_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR10_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR11_B array type MPCBB1_VCTR11_B_Field_Array is array (352 .. 383) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR11_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR11_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR11_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR12_B array type MPCBB1_VCTR12_B_Field_Array is array (384 .. 415) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR12_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR12_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR12_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR13_B array type MPCBB1_VCTR13_B_Field_Array is array (416 .. 447) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR13_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR13_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR13_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR14_B array type MPCBB1_VCTR14_B_Field_Array is array (448 .. 479) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR14_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR14_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR14_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR15_B array type MPCBB1_VCTR15_B_Field_Array is array (480 .. 511) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR15_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR15_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR15_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR16_B array type MPCBB1_VCTR16_B_Field_Array is array (512 .. 543) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR16_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR16_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR16_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR17_B array type MPCBB1_VCTR17_B_Field_Array is array (544 .. 575) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR17_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR17_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR17_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR18_B array type MPCBB1_VCTR18_B_Field_Array is array (576 .. 607) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR18_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR18_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR18_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR19_B array type MPCBB1_VCTR19_B_Field_Array is array (608 .. 639) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR19_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR19_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR19_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR20_B array type MPCBB1_VCTR20_B_Field_Array is array (640 .. 671) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR20_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR20_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR20_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR21_B array type MPCBB1_VCTR21_B_Field_Array is array (672 .. 703) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR21_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR21_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR21_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR22_B array type MPCBB1_VCTR22_B_Field_Array is array (704 .. 735) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR22_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR22_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR22_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR23_B array type MPCBB1_VCTR23_B_Field_Array is array (736 .. 767) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR23_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR23_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR23_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR24_B array type MPCBB1_VCTR24_B_Field_Array is array (768 .. 799) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR24_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR24_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR24_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR25_B array type MPCBB1_VCTR25_B_Field_Array is array (800 .. 831) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR25_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR25_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR25_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR26_B array type MPCBB1_VCTR26_B_Field_Array is array (832 .. 863) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR26_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR26_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR26_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR27_B array type MPCBB1_VCTR27_B_Field_Array is array (864 .. 895) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR27_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR27_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR27_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR28_B array type MPCBB1_VCTR28_B_Field_Array is array (896 .. 927) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR28_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR28_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR28_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR29_B array type MPCBB1_VCTR29_B_Field_Array is array (928 .. 959) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR29_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR29_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR29_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR30_B array type MPCBB1_VCTR30_B_Field_Array is array (960 .. 991) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR30_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR30_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR30_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR31_B array type MPCBB1_VCTR31_B_Field_Array is array (992 .. 1023) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR31_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR31_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR31_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR32_B array type MPCBB1_VCTR32_B_Field_Array is array (1024 .. 1055) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR32_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR32_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR32_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR33_B array type MPCBB1_VCTR33_B_Field_Array is array (1056 .. 1087) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR33_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR33_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR33_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR34_B array type MPCBB1_VCTR34_B_Field_Array is array (1088 .. 1119) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR34_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR34_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR34_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR35_B array type MPCBB1_VCTR35_B_Field_Array is array (1120 .. 1151) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR35_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR35_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR35_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR36_B array type MPCBB1_VCTR36_B_Field_Array is array (1152 .. 1183) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR36_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR36_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR36_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR37_B array type MPCBB1_VCTR37_B_Field_Array is array (1184 .. 1215) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR37_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR37_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR37_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR38_B array type MPCBB1_VCTR38_B_Field_Array is array (1216 .. 1247) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR38_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR38_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR38_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR39_B array type MPCBB1_VCTR39_B_Field_Array is array (1248 .. 1279) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR39_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR39_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR39_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR40_B array type MPCBB1_VCTR40_B_Field_Array is array (1280 .. 1311) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR40_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR40_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR40_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR41_B array type MPCBB1_VCTR41_B_Field_Array is array (1312 .. 1343) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR41_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR41_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR41_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR42_B array type MPCBB1_VCTR42_B_Field_Array is array (1344 .. 1375) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR42_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR42_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR42_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR43_B array type MPCBB1_VCTR43_B_Field_Array is array (1376 .. 1407) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR43_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR43_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR43_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR44_B array type MPCBB1_VCTR44_B_Field_Array is array (1408 .. 1439) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR44_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR44_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR44_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR45_B array type MPCBB1_VCTR45_B_Field_Array is array (1440 .. 1471) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR45_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR45_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR45_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR46_B array type MPCBB1_VCTR46_B_Field_Array is array (1472 .. 1503) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR46_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR46_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR46_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR47_B array type MPCBB1_VCTR47_B_Field_Array is array (1504 .. 1535) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR47_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR47_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR47_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR48_B array type MPCBB1_VCTR48_B_Field_Array is array (1536 .. 1567) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR48_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR48_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR48_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR49_B array type MPCBB1_VCTR49_B_Field_Array is array (1568 .. 1599) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR49_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR49_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR49_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR50_B array type MPCBB1_VCTR50_B_Field_Array is array (1600 .. 1631) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR50_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR50_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR50_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR51_B array type MPCBB1_VCTR51_B_Field_Array is array (1632 .. 1663) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR51_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR51_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR51_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR52_B array type MPCBB1_VCTR52_B_Field_Array is array (1664 .. 1695) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR52_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR52_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR52_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR53_B array type MPCBB1_VCTR53_B_Field_Array is array (1696 .. 1727) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR53_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR53_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR53_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR54_B array type MPCBB1_VCTR54_B_Field_Array is array (1728 .. 1759) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR54_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR54_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR54_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR55_B array type MPCBB1_VCTR55_B_Field_Array is array (1760 .. 1791) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR55_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR55_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR55_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR56_B array type MPCBB1_VCTR56_B_Field_Array is array (1792 .. 1823) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR56_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR56_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR56_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR57_B array type MPCBB1_VCTR57_B_Field_Array is array (1824 .. 1855) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR57_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR57_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR57_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR58_B array type MPCBB1_VCTR58_B_Field_Array is array (1856 .. 1887) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR58_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR58_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR58_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR59_B array type MPCBB1_VCTR59_B_Field_Array is array (1888 .. 1919) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR59_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR59_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR59_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR60_B array type MPCBB1_VCTR60_B_Field_Array is array (1920 .. 1951) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR60_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR60_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR60_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR61_B array type MPCBB1_VCTR61_B_Field_Array is array (1952 .. 1983) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR61_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR61_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR61_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR62_B array type MPCBB1_VCTR62_B_Field_Array is array (1984 .. 2015) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR62_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR62_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR62_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB1_VCTR63_B array type MPCBB1_VCTR63_B_Field_Array is array (2016 .. 2047) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB1_VCTR63_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB1_VCTR63_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB1_VCTR63_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB control register type MPCBB2_CR_Register is record -- LCK LCK : Boolean := False; -- unspecified Reserved_1_29 : HAL.UInt29 := 16#0#; -- INVSECSTATE INVSECSTATE : Boolean := False; -- SRWILADIS SRWILADIS : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for MPCBB2_CR_Register use record LCK at 0 range 0 .. 0; Reserved_1_29 at 0 range 1 .. 29; INVSECSTATE at 0 range 30 .. 30; SRWILADIS at 0 range 31 .. 31; end record; -- MPCBB2_LCKVTR1_LCKSB array type MPCBB2_LCKVTR1_LCKSB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- MPCBB control register type MPCBB2_LCKVTR1_Register (As_Array : Boolean := False) is record case As_Array is when False => -- LCKSB as a value Val : HAL.UInt32; when True => -- LCKSB as an array Arr : MPCBB2_LCKVTR1_LCKSB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_LCKVTR1_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_LCKVTR2_LCKSB array type MPCBB2_LCKVTR2_LCKSB_Field_Array is array (32 .. 63) of Boolean with Component_Size => 1, Size => 32; -- MPCBB control register type MPCBB2_LCKVTR2_Register (As_Array : Boolean := False) is record case As_Array is when False => -- LCKSB as a value Val : HAL.UInt32; when True => -- LCKSB as an array Arr : MPCBB2_LCKVTR2_LCKSB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_LCKVTR2_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR0_B array type MPCBB2_VCTR0_B_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR0_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR0_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR0_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR1_B array type MPCBB2_VCTR1_B_Field_Array is array (32 .. 63) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR1_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR1_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR1_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR2_B array type MPCBB2_VCTR2_B_Field_Array is array (64 .. 95) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR2_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR2_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR2_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR3_B array type MPCBB2_VCTR3_B_Field_Array is array (96 .. 127) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR3_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR3_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR3_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR4_B array type MPCBB2_VCTR4_B_Field_Array is array (128 .. 159) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR4_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR4_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR4_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR5_B array type MPCBB2_VCTR5_B_Field_Array is array (160 .. 191) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR5_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR5_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR5_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR6_B array type MPCBB2_VCTR6_B_Field_Array is array (192 .. 223) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR6_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR6_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR6_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR7_B array type MPCBB2_VCTR7_B_Field_Array is array (224 .. 255) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR7_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR7_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR7_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR8_B array type MPCBB2_VCTR8_B_Field_Array is array (256 .. 287) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR8_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR8_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR8_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR9_B array type MPCBB2_VCTR9_B_Field_Array is array (288 .. 319) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR9_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR9_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR9_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR10_B array type MPCBB2_VCTR10_B_Field_Array is array (320 .. 351) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR10_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR10_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR10_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR11_B array type MPCBB2_VCTR11_B_Field_Array is array (352 .. 383) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR11_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR11_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR11_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR12_B array type MPCBB2_VCTR12_B_Field_Array is array (384 .. 415) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR12_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR12_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR12_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR13_B array type MPCBB2_VCTR13_B_Field_Array is array (416 .. 447) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR13_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR13_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR13_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR14_B array type MPCBB2_VCTR14_B_Field_Array is array (448 .. 479) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR14_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR14_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR14_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR15_B array type MPCBB2_VCTR15_B_Field_Array is array (480 .. 511) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR15_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR15_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR15_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR16_B array type MPCBB2_VCTR16_B_Field_Array is array (512 .. 543) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR16_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR16_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR16_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR17_B array type MPCBB2_VCTR17_B_Field_Array is array (544 .. 575) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR17_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR17_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR17_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR18_B array type MPCBB2_VCTR18_B_Field_Array is array (576 .. 607) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR18_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR18_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR18_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR19_B array type MPCBB2_VCTR19_B_Field_Array is array (608 .. 639) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR19_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR19_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR19_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR20_B array type MPCBB2_VCTR20_B_Field_Array is array (640 .. 671) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR20_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR20_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR20_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR21_B array type MPCBB2_VCTR21_B_Field_Array is array (672 .. 703) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR21_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR21_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR21_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR22_B array type MPCBB2_VCTR22_B_Field_Array is array (704 .. 735) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR22_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR22_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR22_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR23_B array type MPCBB2_VCTR23_B_Field_Array is array (736 .. 767) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR23_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR23_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR23_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR24_B array type MPCBB2_VCTR24_B_Field_Array is array (768 .. 799) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR24_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR24_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR24_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR25_B array type MPCBB2_VCTR25_B_Field_Array is array (800 .. 831) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR25_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR25_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR25_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR26_B array type MPCBB2_VCTR26_B_Field_Array is array (832 .. 863) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR26_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR26_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR26_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR27_B array type MPCBB2_VCTR27_B_Field_Array is array (864 .. 895) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR27_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR27_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR27_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR28_B array type MPCBB2_VCTR28_B_Field_Array is array (896 .. 927) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR28_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR28_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR28_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR29_B array type MPCBB2_VCTR29_B_Field_Array is array (928 .. 959) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR29_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR29_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR29_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR30_B array type MPCBB2_VCTR30_B_Field_Array is array (960 .. 991) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR30_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR30_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR30_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR31_B array type MPCBB2_VCTR31_B_Field_Array is array (992 .. 1023) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR31_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR31_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR31_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR32_B array type MPCBB2_VCTR32_B_Field_Array is array (1024 .. 1055) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR32_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR32_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR32_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR33_B array type MPCBB2_VCTR33_B_Field_Array is array (1056 .. 1087) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR33_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR33_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR33_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR34_B array type MPCBB2_VCTR34_B_Field_Array is array (1088 .. 1119) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR34_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR34_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR34_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR35_B array type MPCBB2_VCTR35_B_Field_Array is array (1120 .. 1151) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR35_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR35_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR35_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR36_B array type MPCBB2_VCTR36_B_Field_Array is array (1152 .. 1183) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR36_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR36_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR36_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR37_B array type MPCBB2_VCTR37_B_Field_Array is array (1184 .. 1215) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR37_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR37_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR37_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR38_B array type MPCBB2_VCTR38_B_Field_Array is array (1216 .. 1247) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR38_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR38_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR38_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR39_B array type MPCBB2_VCTR39_B_Field_Array is array (1248 .. 1279) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR39_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR39_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR39_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR40_B array type MPCBB2_VCTR40_B_Field_Array is array (1280 .. 1311) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR40_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR40_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR40_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR41_B array type MPCBB2_VCTR41_B_Field_Array is array (1312 .. 1343) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR41_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR41_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR41_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR42_B array type MPCBB2_VCTR42_B_Field_Array is array (1344 .. 1375) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR42_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR42_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR42_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR43_B array type MPCBB2_VCTR43_B_Field_Array is array (1376 .. 1407) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR43_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR43_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR43_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR44_B array type MPCBB2_VCTR44_B_Field_Array is array (1408 .. 1439) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR44_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR44_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR44_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR45_B array type MPCBB2_VCTR45_B_Field_Array is array (1440 .. 1471) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR45_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR45_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR45_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR46_B array type MPCBB2_VCTR46_B_Field_Array is array (1472 .. 1503) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR46_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR46_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR46_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR47_B array type MPCBB2_VCTR47_B_Field_Array is array (1504 .. 1535) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR47_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR47_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR47_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR48_B array type MPCBB2_VCTR48_B_Field_Array is array (1536 .. 1567) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR48_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR48_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR48_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR49_B array type MPCBB2_VCTR49_B_Field_Array is array (1568 .. 1599) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR49_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR49_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR49_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR50_B array type MPCBB2_VCTR50_B_Field_Array is array (1600 .. 1631) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR50_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR50_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR50_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR51_B array type MPCBB2_VCTR51_B_Field_Array is array (1632 .. 1663) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR51_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR51_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR51_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR52_B array type MPCBB2_VCTR52_B_Field_Array is array (1664 .. 1695) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR52_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR52_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR52_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR53_B array type MPCBB2_VCTR53_B_Field_Array is array (1696 .. 1727) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR53_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR53_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR53_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR54_B array type MPCBB2_VCTR54_B_Field_Array is array (1728 .. 1759) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR54_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR54_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR54_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR55_B array type MPCBB2_VCTR55_B_Field_Array is array (1760 .. 1791) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR55_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR55_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR55_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR56_B array type MPCBB2_VCTR56_B_Field_Array is array (1792 .. 1823) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR56_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR56_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR56_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR57_B array type MPCBB2_VCTR57_B_Field_Array is array (1824 .. 1855) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR57_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR57_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR57_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR58_B array type MPCBB2_VCTR58_B_Field_Array is array (1856 .. 1887) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR58_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR58_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR58_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR59_B array type MPCBB2_VCTR59_B_Field_Array is array (1888 .. 1919) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR59_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR59_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR59_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR60_B array type MPCBB2_VCTR60_B_Field_Array is array (1920 .. 1951) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR60_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR60_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR60_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR61_B array type MPCBB2_VCTR61_B_Field_Array is array (1952 .. 1983) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR61_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR61_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR61_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR62_B array type MPCBB2_VCTR62_B_Field_Array is array (1984 .. 2015) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR62_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR62_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR62_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- MPCBB2_VCTR63_B array type MPCBB2_VCTR63_B_Field_Array is array (2016 .. 2047) of Boolean with Component_Size => 1, Size => 32; -- MPCBBx vector register type MPCBB2_VCTR63_Register (As_Array : Boolean := False) is record case As_Array is when False => -- B as a value Val : HAL.UInt32; when True => -- B as an array Arr : MPCBB2_VCTR63_B_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MPCBB2_VCTR63_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- TZIC interrupt enable register 1 type IER1_Register is record -- TIM2IE TIM2IE : Boolean := False; -- TIM3IE TIM3IE : Boolean := False; -- TIM4IE TIM4IE : Boolean := False; -- TIM5IE TIM5IE : Boolean := False; -- TIM6IE TIM6IE : Boolean := False; -- TIM7IE TIM7IE : Boolean := False; -- WWDGIE WWDGIE : Boolean := False; -- IWDGIE IWDGIE : Boolean := False; -- SPI2IE SPI2IE : Boolean := False; -- SPI3IE SPI3IE : Boolean := False; -- USART2IE USART2IE : Boolean := False; -- USART3IE USART3IE : Boolean := False; -- UART4IE UART4IE : Boolean := False; -- UART5IE UART5IE : Boolean := False; -- I2C1IE I2C1IE : Boolean := False; -- I2C2IE I2C2IE : Boolean := False; -- I2C3IE I2C3IE : Boolean := False; -- CRSIE CRSIE : Boolean := False; -- DACIE DACIE : Boolean := False; -- OPAMPIE OPAMPIE : Boolean := False; -- LPTIM1IE LPTIM1IE : Boolean := False; -- LPUART1IE LPUART1IE : Boolean := False; -- I2C4IE I2C4IE : Boolean := False; -- LPTIM2IE LPTIM2IE : Boolean := False; -- LPTIM3IE LPTIM3IE : Boolean := False; -- FDCAN1IE FDCAN1IE : Boolean := False; -- USBFSIE USBFSIE : Boolean := False; -- UCPD1IE UCPD1IE : Boolean := False; -- VREFBUFIE VREFBUFIE : Boolean := False; -- COMPIE COMPIE : Boolean := False; -- TIM1IE TIM1IE : Boolean := False; -- SPI1IE SPI1IE : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for IER1_Register use record TIM2IE at 0 range 0 .. 0; TIM3IE at 0 range 1 .. 1; TIM4IE at 0 range 2 .. 2; TIM5IE at 0 range 3 .. 3; TIM6IE at 0 range 4 .. 4; TIM7IE at 0 range 5 .. 5; WWDGIE at 0 range 6 .. 6; IWDGIE at 0 range 7 .. 7; SPI2IE at 0 range 8 .. 8; SPI3IE at 0 range 9 .. 9; USART2IE at 0 range 10 .. 10; USART3IE at 0 range 11 .. 11; UART4IE at 0 range 12 .. 12; UART5IE at 0 range 13 .. 13; I2C1IE at 0 range 14 .. 14; I2C2IE at 0 range 15 .. 15; I2C3IE at 0 range 16 .. 16; CRSIE at 0 range 17 .. 17; DACIE at 0 range 18 .. 18; OPAMPIE at 0 range 19 .. 19; LPTIM1IE at 0 range 20 .. 20; LPUART1IE at 0 range 21 .. 21; I2C4IE at 0 range 22 .. 22; LPTIM2IE at 0 range 23 .. 23; LPTIM3IE at 0 range 24 .. 24; FDCAN1IE at 0 range 25 .. 25; USBFSIE at 0 range 26 .. 26; UCPD1IE at 0 range 27 .. 27; VREFBUFIE at 0 range 28 .. 28; COMPIE at 0 range 29 .. 29; TIM1IE at 0 range 30 .. 30; SPI1IE at 0 range 31 .. 31; end record; -- TZIC interrupt enable register 2 type IER2_Register is record -- TIM8IE TIM8IE : Boolean := False; -- USART1IE USART1IE : Boolean := False; -- TIM15IE TIM15IE : Boolean := False; -- TIM16IE TIM16IE : Boolean := False; -- TIM17IE TIM17IE : Boolean := False; -- SAI1IE SAI1IE : Boolean := False; -- SAI2IE SAI2IE : Boolean := False; -- DFSDM1IE DFSDM1IE : Boolean := False; -- CRCIE CRCIE : Boolean := False; -- TSCIE TSCIE : Boolean := False; -- ICACHEIE ICACHEIE : Boolean := False; -- ADCIE ADCIE : Boolean := False; -- AESIE AESIE : Boolean := False; -- HASHIE HASHIE : Boolean := False; -- RNGIE RNGIE : Boolean := False; -- PKAIE PKAIE : Boolean := False; -- SDMMC1IE SDMMC1IE : Boolean := False; -- FMC_REGIE FMC_REGIE : Boolean := False; -- OCTOSPI1_REGIE OCTOSPI1_REGIE : Boolean := False; -- RTCIE RTCIE : Boolean := False; -- PWRIE PWRIE : Boolean := False; -- SYSCFGIE SYSCFGIE : Boolean := False; -- DMA1IE DMA1IE : Boolean := False; -- DMA2IE DMA2IE : Boolean := False; -- DMAMUX1IE DMAMUX1IE : Boolean := False; -- RCCIE RCCIE : Boolean := False; -- FLASHIE FLASHIE : Boolean := False; -- FLASH_REGIE FLASH_REGIE : Boolean := False; -- EXTIIE EXTIIE : Boolean := False; -- OTFDEC1IE OTFDEC1IE : Boolean := False; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for IER2_Register use record TIM8IE at 0 range 0 .. 0; USART1IE at 0 range 1 .. 1; TIM15IE at 0 range 2 .. 2; TIM16IE at 0 range 3 .. 3; TIM17IE at 0 range 4 .. 4; SAI1IE at 0 range 5 .. 5; SAI2IE at 0 range 6 .. 6; DFSDM1IE at 0 range 7 .. 7; CRCIE at 0 range 8 .. 8; TSCIE at 0 range 9 .. 9; ICACHEIE at 0 range 10 .. 10; ADCIE at 0 range 11 .. 11; AESIE at 0 range 12 .. 12; HASHIE at 0 range 13 .. 13; RNGIE at 0 range 14 .. 14; PKAIE at 0 range 15 .. 15; SDMMC1IE at 0 range 16 .. 16; FMC_REGIE at 0 range 17 .. 17; OCTOSPI1_REGIE at 0 range 18 .. 18; RTCIE at 0 range 19 .. 19; PWRIE at 0 range 20 .. 20; SYSCFGIE at 0 range 21 .. 21; DMA1IE at 0 range 22 .. 22; DMA2IE at 0 range 23 .. 23; DMAMUX1IE at 0 range 24 .. 24; RCCIE at 0 range 25 .. 25; FLASHIE at 0 range 26 .. 26; FLASH_REGIE at 0 range 27 .. 27; EXTIIE at 0 range 28 .. 28; OTFDEC1IE at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; -- TZIC interrupt enable register 3 type IER3_Register is record -- TZSCIE TZSCIE : Boolean := False; -- TZICIE TZICIE : Boolean := False; -- MPCWM1IE MPCWM1IE : Boolean := False; -- MPCWM2IE MPCWM2IE : Boolean := False; -- MPCBB1IE MPCBB1IE : Boolean := False; -- MPCBB1_REGIE MPCBB1_REGIE : Boolean := False; -- MPCBB2IE MPCBB2IE : Boolean := False; -- MPCBB2_REGIE MPCBB2_REGIE : Boolean := False; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for IER3_Register use record TZSCIE at 0 range 0 .. 0; TZICIE at 0 range 1 .. 1; MPCWM1IE at 0 range 2 .. 2; MPCWM2IE at 0 range 3 .. 3; MPCBB1IE at 0 range 4 .. 4; MPCBB1_REGIE at 0 range 5 .. 5; MPCBB2IE at 0 range 6 .. 6; MPCBB2_REGIE at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- TZIC interrupt status register 1 type MISR1_Register is record -- Read-only. TIM2F TIM2F : Boolean; -- Read-only. TIM3F TIM3F : Boolean; -- Read-only. TIM4F TIM4F : Boolean; -- Read-only. TIM5F TIM5F : Boolean; -- Read-only. TIM6F TIM6F : Boolean; -- Read-only. TIM7F TIM7F : Boolean; -- Read-only. WWDGF WWDGF : Boolean; -- Read-only. IWDGF IWDGF : Boolean; -- Read-only. SPI2F SPI2F : Boolean; -- Read-only. SPI3F SPI3F : Boolean; -- Read-only. USART2F USART2F : Boolean; -- Read-only. USART3F USART3F : Boolean; -- Read-only. UART4F UART4F : Boolean; -- Read-only. UART5F UART5F : Boolean; -- Read-only. I2C1F I2C1F : Boolean; -- Read-only. I2C2F I2C2F : Boolean; -- Read-only. I2C3F I2C3F : Boolean; -- Read-only. CRSF CRSF : Boolean; -- Read-only. DACF DACF : Boolean; -- Read-only. OPAMPF OPAMPF : Boolean; -- Read-only. LPTIM1F LPTIM1F : Boolean; -- Read-only. LPUART1F LPUART1F : Boolean; -- Read-only. I2C4F I2C4F : Boolean; -- Read-only. LPTIM2F LPTIM2F : Boolean; -- Read-only. LPTIM3F LPTIM3F : Boolean; -- Read-only. FDCAN1F FDCAN1F : Boolean; -- Read-only. USBFSF USBFSF : Boolean; -- Read-only. UCPD1F UCPD1F : Boolean; -- Read-only. VREFBUFF VREFBUFF : Boolean; -- Read-only. COMPF COMPF : Boolean; -- Read-only. TIM1F TIM1F : Boolean; -- Read-only. SPI1F SPI1F : Boolean; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for MISR1_Register use record TIM2F at 0 range 0 .. 0; TIM3F at 0 range 1 .. 1; TIM4F at 0 range 2 .. 2; TIM5F at 0 range 3 .. 3; TIM6F at 0 range 4 .. 4; TIM7F at 0 range 5 .. 5; WWDGF at 0 range 6 .. 6; IWDGF at 0 range 7 .. 7; SPI2F at 0 range 8 .. 8; SPI3F at 0 range 9 .. 9; USART2F at 0 range 10 .. 10; USART3F at 0 range 11 .. 11; UART4F at 0 range 12 .. 12; UART5F at 0 range 13 .. 13; I2C1F at 0 range 14 .. 14; I2C2F at 0 range 15 .. 15; I2C3F at 0 range 16 .. 16; CRSF at 0 range 17 .. 17; DACF at 0 range 18 .. 18; OPAMPF at 0 range 19 .. 19; LPTIM1F at 0 range 20 .. 20; LPUART1F at 0 range 21 .. 21; I2C4F at 0 range 22 .. 22; LPTIM2F at 0 range 23 .. 23; LPTIM3F at 0 range 24 .. 24; FDCAN1F at 0 range 25 .. 25; USBFSF at 0 range 26 .. 26; UCPD1F at 0 range 27 .. 27; VREFBUFF at 0 range 28 .. 28; COMPF at 0 range 29 .. 29; TIM1F at 0 range 30 .. 30; SPI1F at 0 range 31 .. 31; end record; -- TZIC interrupt status register 2 type MISR2_Register is record -- TIM8F TIM8F : Boolean := False; -- USART1F USART1F : Boolean := False; -- TIM15F TIM15F : Boolean := False; -- TIM16F TIM16F : Boolean := False; -- TIM17F TIM17F : Boolean := False; -- SAI1F SAI1F : Boolean := False; -- SAI2F SAI2F : Boolean := False; -- DFSDM1F DFSDM1F : Boolean := False; -- CRCF CRCF : Boolean := False; -- TSCF TSCF : Boolean := False; -- ICACHEF ICACHEF : Boolean := False; -- ADCF ADCF : Boolean := False; -- AESF AESF : Boolean := False; -- HASHF HASHF : Boolean := False; -- RNGF RNGF : Boolean := False; -- PKAF PKAF : Boolean := False; -- SDMMC1F SDMMC1F : Boolean := False; -- FMC_REGF FMC_REGF : Boolean := False; -- OCTOSPI1_REGF OCTOSPI1_REGF : Boolean := False; -- RTCF RTCF : Boolean := False; -- PWRF PWRF : Boolean := False; -- SYSCFGF SYSCFGF : Boolean := False; -- DMA1F DMA1F : Boolean := False; -- DMA2F DMA2F : Boolean := False; -- DMAMUX1F DMAMUX1F : Boolean := False; -- RCCF RCCF : Boolean := False; -- FLASHF FLASHF : Boolean := False; -- FLASH_REGF FLASH_REGF : Boolean := False; -- EXTIF EXTIF : Boolean := False; -- OTFDEC1F OTFDEC1F : Boolean := False; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for MISR2_Register use record TIM8F at 0 range 0 .. 0; USART1F at 0 range 1 .. 1; TIM15F at 0 range 2 .. 2; TIM16F at 0 range 3 .. 3; TIM17F at 0 range 4 .. 4; SAI1F at 0 range 5 .. 5; SAI2F at 0 range 6 .. 6; DFSDM1F at 0 range 7 .. 7; CRCF at 0 range 8 .. 8; TSCF at 0 range 9 .. 9; ICACHEF at 0 range 10 .. 10; ADCF at 0 range 11 .. 11; AESF at 0 range 12 .. 12; HASHF at 0 range 13 .. 13; RNGF at 0 range 14 .. 14; PKAF at 0 range 15 .. 15; SDMMC1F at 0 range 16 .. 16; FMC_REGF at 0 range 17 .. 17; OCTOSPI1_REGF at 0 range 18 .. 18; RTCF at 0 range 19 .. 19; PWRF at 0 range 20 .. 20; SYSCFGF at 0 range 21 .. 21; DMA1F at 0 range 22 .. 22; DMA2F at 0 range 23 .. 23; DMAMUX1F at 0 range 24 .. 24; RCCF at 0 range 25 .. 25; FLASHF at 0 range 26 .. 26; FLASH_REGF at 0 range 27 .. 27; EXTIF at 0 range 28 .. 28; OTFDEC1F at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; -- TZIC interrupt status register 3 type MISR3_Register is record -- TZSCF TZSCF : Boolean := False; -- TZICF TZICF : Boolean := False; -- MPCWM1F MPCWM1F : Boolean := False; -- MPCWM2F MPCWM2F : Boolean := False; -- MPCBB1F MPCBB1F : Boolean := False; -- MPCBB1_REGF MPCBB1_REGF : Boolean := False; -- MPCBB2F MPCBB2F : Boolean := False; -- MPCBB2_REGF MPCBB2_REGF : Boolean := False; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for MISR3_Register use record TZSCF at 0 range 0 .. 0; TZICF at 0 range 1 .. 1; MPCWM1F at 0 range 2 .. 2; MPCWM2F at 0 range 3 .. 3; MPCBB1F at 0 range 4 .. 4; MPCBB1_REGF at 0 range 5 .. 5; MPCBB2F at 0 range 6 .. 6; MPCBB2_REGF at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- TZIC interrupt clear register 1 type ICR1_Register is record -- Write-only. TIM2FC TIM2FC : Boolean := False; -- Write-only. TIM3FC TIM3FC : Boolean := False; -- Write-only. TIM4FC TIM4FC : Boolean := False; -- Write-only. TIM5FC TIM5FC : Boolean := False; -- Write-only. TIM6FC TIM6FC : Boolean := False; -- Write-only. TIM7FC TIM7FC : Boolean := False; -- Write-only. WWDGFC WWDGFC : Boolean := False; -- Write-only. IWDGFC IWDGFC : Boolean := False; -- Write-only. SPI2FC SPI2FC : Boolean := False; -- Write-only. SPI3FC SPI3FC : Boolean := False; -- Write-only. USART2FC USART2FC : Boolean := False; -- Write-only. USART3FC USART3FC : Boolean := False; -- Write-only. UART4FC UART4FC : Boolean := False; -- Write-only. UART5FC UART5FC : Boolean := False; -- Write-only. I2C1FC I2C1FC : Boolean := False; -- Write-only. I2C2FC I2C2FC : Boolean := False; -- Write-only. I2C3FC I2C3FC : Boolean := False; -- Write-only. CRSFC CRSFC : Boolean := False; -- Write-only. DACFC DACFC : Boolean := False; -- Write-only. OPAMPFC OPAMPFC : Boolean := False; -- Write-only. LPTIM1FC LPTIM1FC : Boolean := False; -- Write-only. LPUART1FC LPUART1FC : Boolean := False; -- Write-only. I2C4FC I2C4FC : Boolean := False; -- Write-only. LPTIM2FC LPTIM2FC : Boolean := False; -- Write-only. LPTIM3FC LPTIM3FC : Boolean := False; -- Write-only. FDCAN1FC FDCAN1FC : Boolean := False; -- Write-only. USBFSFC USBFSFC : Boolean := False; -- Write-only. UCPD1FC UCPD1FC : Boolean := False; -- Write-only. VREFBUFFC VREFBUFFC : Boolean := False; -- Write-only. COMPFC COMPFC : Boolean := False; -- Write-only. TIM1FC TIM1FC : Boolean := False; -- Write-only. SPI1FC SPI1FC : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ICR1_Register use record TIM2FC at 0 range 0 .. 0; TIM3FC at 0 range 1 .. 1; TIM4FC at 0 range 2 .. 2; TIM5FC at 0 range 3 .. 3; TIM6FC at 0 range 4 .. 4; TIM7FC at 0 range 5 .. 5; WWDGFC at 0 range 6 .. 6; IWDGFC at 0 range 7 .. 7; SPI2FC at 0 range 8 .. 8; SPI3FC at 0 range 9 .. 9; USART2FC at 0 range 10 .. 10; USART3FC at 0 range 11 .. 11; UART4FC at 0 range 12 .. 12; UART5FC at 0 range 13 .. 13; I2C1FC at 0 range 14 .. 14; I2C2FC at 0 range 15 .. 15; I2C3FC at 0 range 16 .. 16; CRSFC at 0 range 17 .. 17; DACFC at 0 range 18 .. 18; OPAMPFC at 0 range 19 .. 19; LPTIM1FC at 0 range 20 .. 20; LPUART1FC at 0 range 21 .. 21; I2C4FC at 0 range 22 .. 22; LPTIM2FC at 0 range 23 .. 23; LPTIM3FC at 0 range 24 .. 24; FDCAN1FC at 0 range 25 .. 25; USBFSFC at 0 range 26 .. 26; UCPD1FC at 0 range 27 .. 27; VREFBUFFC at 0 range 28 .. 28; COMPFC at 0 range 29 .. 29; TIM1FC at 0 range 30 .. 30; SPI1FC at 0 range 31 .. 31; end record; -- TZIC interrupt clear register 2 type ICR2_Register is record -- TIM8FC TIM8FC : Boolean := False; -- USART1FC USART1FC : Boolean := False; -- TIM15FC TIM15FC : Boolean := False; -- TIM16FC TIM16FC : Boolean := False; -- TIM17FC TIM17FC : Boolean := False; -- SAI1FC SAI1FC : Boolean := False; -- SAI2FC SAI2FC : Boolean := False; -- DFSDM1FC DFSDM1FC : Boolean := False; -- CRCFC CRCFC : Boolean := False; -- TSCFC TSCFC : Boolean := False; -- ICACHEFC ICACHEFC : Boolean := False; -- ADCFC ADCFC : Boolean := False; -- AESFC AESFC : Boolean := False; -- HASHFC HASHFC : Boolean := False; -- RNGFC RNGFC : Boolean := False; -- PKAFC PKAFC : Boolean := False; -- SDMMC1FC SDMMC1FC : Boolean := False; -- FMC_REGFC FMC_REGFC : Boolean := False; -- OCTOSPI1_REGFC OCTOSPI1_REGFC : Boolean := False; -- RTCFC RTCFC : Boolean := False; -- PWRFC PWRFC : Boolean := False; -- SYSCFGFC SYSCFGFC : Boolean := False; -- DMA1FC DMA1FC : Boolean := False; -- DMA2FC DMA2FC : Boolean := False; -- DMAMUX1FC DMAMUX1FC : Boolean := False; -- RCCFC RCCFC : Boolean := False; -- FLASHFC FLASHFC : Boolean := False; -- FLASH_REGFC FLASH_REGFC : Boolean := False; -- EXTIFC EXTIFC : Boolean := False; -- OTFDEC1FC OTFDEC1FC : Boolean := False; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ICR2_Register use record TIM8FC at 0 range 0 .. 0; USART1FC at 0 range 1 .. 1; TIM15FC at 0 range 2 .. 2; TIM16FC at 0 range 3 .. 3; TIM17FC at 0 range 4 .. 4; SAI1FC at 0 range 5 .. 5; SAI2FC at 0 range 6 .. 6; DFSDM1FC at 0 range 7 .. 7; CRCFC at 0 range 8 .. 8; TSCFC at 0 range 9 .. 9; ICACHEFC at 0 range 10 .. 10; ADCFC at 0 range 11 .. 11; AESFC at 0 range 12 .. 12; HASHFC at 0 range 13 .. 13; RNGFC at 0 range 14 .. 14; PKAFC at 0 range 15 .. 15; SDMMC1FC at 0 range 16 .. 16; FMC_REGFC at 0 range 17 .. 17; OCTOSPI1_REGFC at 0 range 18 .. 18; RTCFC at 0 range 19 .. 19; PWRFC at 0 range 20 .. 20; SYSCFGFC at 0 range 21 .. 21; DMA1FC at 0 range 22 .. 22; DMA2FC at 0 range 23 .. 23; DMAMUX1FC at 0 range 24 .. 24; RCCFC at 0 range 25 .. 25; FLASHFC at 0 range 26 .. 26; FLASH_REGFC at 0 range 27 .. 27; EXTIFC at 0 range 28 .. 28; OTFDEC1FC at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; -- TZIC interrupt clear register 3 type ICR3_Register is record -- TZSCFC TZSCFC : Boolean := False; -- TZICFC TZICFC : Boolean := False; -- MPCWM1FC MPCWM1FC : Boolean := False; -- MPCWM2FC MPCWM2FC : Boolean := False; -- MPCBB1FC MPCBB1FC : Boolean := False; -- MPCBB1_REGFC MPCBB1_REGFC : Boolean := False; -- MPCBB2FC MPCBB2FC : Boolean := False; -- MPCBB2_REGFC MPCBB2_REGFC : Boolean := False; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ICR3_Register use record TZSCFC at 0 range 0 .. 0; TZICFC at 0 range 1 .. 1; MPCWM1FC at 0 range 2 .. 2; MPCWM2FC at 0 range 3 .. 3; MPCBB1FC at 0 range 4 .. 4; MPCBB1_REGFC at 0 range 5 .. 5; MPCBB2FC at 0 range 6 .. 6; MPCBB2_REGFC at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- TZSC control register type TZSC_CR_Register is record -- LCK LCK : Boolean := False; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TZSC_CR_Register use record LCK at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- TZSC secure configuration register 1 type TZSC_SECCFGR1_Register is record -- TIM2SEC TIM2SEC : Boolean := False; -- TIM3SEC TIM3SEC : Boolean := False; -- TIM4SEC TIM4SEC : Boolean := False; -- TIM5SEC TIM5SEC : Boolean := False; -- TIM6SEC TIM6SEC : Boolean := False; -- TIM7SEC TIM7SEC : Boolean := False; -- WWDGSEC WWDGSEC : Boolean := False; -- IWDGSEC IWDGSEC : Boolean := False; -- SPI2SEC SPI2SEC : Boolean := False; -- SPI3SEC SPI3SEC : Boolean := False; -- USART2SEC USART2SEC : Boolean := False; -- USART3SEC USART3SEC : Boolean := False; -- UART4SEC UART4SEC : Boolean := False; -- UART5SEC UART5SEC : Boolean := False; -- I2C1SEC I2C1SEC : Boolean := False; -- I2C2SEC I2C2SEC : Boolean := False; -- I2C3SEC I2C3SEC : Boolean := False; -- CRSSEC CRSSEC : Boolean := False; -- DACSEC DACSEC : Boolean := False; -- OPAMPSEC OPAMPSEC : Boolean := False; -- LPTIM1SEC LPTIM1SEC : Boolean := False; -- LPUART1SEC LPUART1SEC : Boolean := False; -- I2C4SEC I2C4SEC : Boolean := False; -- LPTIM2SEC LPTIM2SEC : Boolean := False; -- LPTIM3SEC LPTIM3SEC : Boolean := False; -- FDCAN1SEC FDCAN1SEC : Boolean := False; -- USBFSSEC USBFSSEC : Boolean := False; -- UCPD1SEC UCPD1SEC : Boolean := False; -- VREFBUFSEC VREFBUFSEC : Boolean := False; -- COMPSEC COMPSEC : Boolean := False; -- TIM1SEC TIM1SEC : Boolean := False; -- SPI1SEC SPI1SEC : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TZSC_SECCFGR1_Register use record TIM2SEC at 0 range 0 .. 0; TIM3SEC at 0 range 1 .. 1; TIM4SEC at 0 range 2 .. 2; TIM5SEC at 0 range 3 .. 3; TIM6SEC at 0 range 4 .. 4; TIM7SEC at 0 range 5 .. 5; WWDGSEC at 0 range 6 .. 6; IWDGSEC at 0 range 7 .. 7; SPI2SEC at 0 range 8 .. 8; SPI3SEC at 0 range 9 .. 9; USART2SEC at 0 range 10 .. 10; USART3SEC at 0 range 11 .. 11; UART4SEC at 0 range 12 .. 12; UART5SEC at 0 range 13 .. 13; I2C1SEC at 0 range 14 .. 14; I2C2SEC at 0 range 15 .. 15; I2C3SEC at 0 range 16 .. 16; CRSSEC at 0 range 17 .. 17; DACSEC at 0 range 18 .. 18; OPAMPSEC at 0 range 19 .. 19; LPTIM1SEC at 0 range 20 .. 20; LPUART1SEC at 0 range 21 .. 21; I2C4SEC at 0 range 22 .. 22; LPTIM2SEC at 0 range 23 .. 23; LPTIM3SEC at 0 range 24 .. 24; FDCAN1SEC at 0 range 25 .. 25; USBFSSEC at 0 range 26 .. 26; UCPD1SEC at 0 range 27 .. 27; VREFBUFSEC at 0 range 28 .. 28; COMPSEC at 0 range 29 .. 29; TIM1SEC at 0 range 30 .. 30; SPI1SEC at 0 range 31 .. 31; end record; -- TZSC secure configuration register 2 type TZSC_SECCFGR2_Register is record -- TIM8SEC TIM8SEC : Boolean := False; -- USART1SEC USART1SEC : Boolean := False; -- TIM15SEC TIM15SEC : Boolean := False; -- TIM16SEC TIM16SEC : Boolean := False; -- TIM17SEC TIM17SEC : Boolean := False; -- SAI1SEC SAI1SEC : Boolean := False; -- SAI2SEC SAI2SEC : Boolean := False; -- DFSDM1SEC DFSDM1SEC : Boolean := False; -- CRCSEC CRCSEC : Boolean := False; -- TSCSEC TSCSEC : Boolean := False; -- ICACHESEC ICACHESEC : Boolean := False; -- ADCSEC ADCSEC : Boolean := False; -- AESSEC AESSEC : Boolean := False; -- HASHSEC HASHSEC : Boolean := False; -- RNGSEC RNGSEC : Boolean := False; -- PKASEC PKASEC : Boolean := False; -- SDMMC1SEC SDMMC1SEC : Boolean := False; -- FSMC_REGSEC FSMC_REGSEC : Boolean := False; -- OCTOSPI1_REGSEC OCTOSPI1_REGSEC : Boolean := False; -- unspecified Reserved_19_31 : HAL.UInt13 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TZSC_SECCFGR2_Register use record TIM8SEC at 0 range 0 .. 0; USART1SEC at 0 range 1 .. 1; TIM15SEC at 0 range 2 .. 2; TIM16SEC at 0 range 3 .. 3; TIM17SEC at 0 range 4 .. 4; SAI1SEC at 0 range 5 .. 5; SAI2SEC at 0 range 6 .. 6; DFSDM1SEC at 0 range 7 .. 7; CRCSEC at 0 range 8 .. 8; TSCSEC at 0 range 9 .. 9; ICACHESEC at 0 range 10 .. 10; ADCSEC at 0 range 11 .. 11; AESSEC at 0 range 12 .. 12; HASHSEC at 0 range 13 .. 13; RNGSEC at 0 range 14 .. 14; PKASEC at 0 range 15 .. 15; SDMMC1SEC at 0 range 16 .. 16; FSMC_REGSEC at 0 range 17 .. 17; OCTOSPI1_REGSEC at 0 range 18 .. 18; Reserved_19_31 at 0 range 19 .. 31; end record; -- TZSC privilege configuration register 1 type TZSC_PRIVCFGR1_Register is record -- TIM2PRIV TIM2PRIV : Boolean := False; -- TIM3PRIV TIM3PRIV : Boolean := False; -- TIM4PRIV TIM4PRIV : Boolean := False; -- TIM5PRIV TIM5PRIV : Boolean := False; -- TIM6PRIV TIM6PRIV : Boolean := False; -- TIM7PRIV TIM7PRIV : Boolean := False; -- WWDGPRIV WWDGPRIV : Boolean := False; -- IWDGPRIV IWDGPRIV : Boolean := False; -- SPI2PRIV SPI2PRIV : Boolean := False; -- SPI3PRIV SPI3PRIV : Boolean := False; -- USART2PRIV USART2PRIV : Boolean := False; -- USART3PRIV USART3PRIV : Boolean := False; -- UART4PRIV UART4PRIV : Boolean := False; -- UART5PRIV UART5PRIV : Boolean := False; -- I2C1PRIV I2C1PRIV : Boolean := False; -- I2C2PRIV I2C2PRIV : Boolean := False; -- I2C3PRIV I2C3PRIV : Boolean := False; -- CRSPRIV CRSPRIV : Boolean := False; -- DACPRIV DACPRIV : Boolean := False; -- OPAMPPRIV OPAMPPRIV : Boolean := False; -- LPTIM1PRIV LPTIM1PRIV : Boolean := False; -- LPUART1PRIV LPUART1PRIV : Boolean := False; -- I2C4PRIV I2C4PRIV : Boolean := False; -- LPTIM2PRIV LPTIM2PRIV : Boolean := False; -- LPTIM3PRIV LPTIM3PRIV : Boolean := False; -- FDCAN1PRIV FDCAN1PRIV : Boolean := False; -- USBFSPRIV USBFSPRIV : Boolean := False; -- UCPD1PRIV UCPD1PRIV : Boolean := False; -- VREFBUFPRIV VREFBUFPRIV : Boolean := False; -- COMPPRIV COMPPRIV : Boolean := False; -- TIM1PRIV TIM1PRIV : Boolean := False; -- SPI1PRIV SPI1PRIV : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TZSC_PRIVCFGR1_Register use record TIM2PRIV at 0 range 0 .. 0; TIM3PRIV at 0 range 1 .. 1; TIM4PRIV at 0 range 2 .. 2; TIM5PRIV at 0 range 3 .. 3; TIM6PRIV at 0 range 4 .. 4; TIM7PRIV at 0 range 5 .. 5; WWDGPRIV at 0 range 6 .. 6; IWDGPRIV at 0 range 7 .. 7; SPI2PRIV at 0 range 8 .. 8; SPI3PRIV at 0 range 9 .. 9; USART2PRIV at 0 range 10 .. 10; USART3PRIV at 0 range 11 .. 11; UART4PRIV at 0 range 12 .. 12; UART5PRIV at 0 range 13 .. 13; I2C1PRIV at 0 range 14 .. 14; I2C2PRIV at 0 range 15 .. 15; I2C3PRIV at 0 range 16 .. 16; CRSPRIV at 0 range 17 .. 17; DACPRIV at 0 range 18 .. 18; OPAMPPRIV at 0 range 19 .. 19; LPTIM1PRIV at 0 range 20 .. 20; LPUART1PRIV at 0 range 21 .. 21; I2C4PRIV at 0 range 22 .. 22; LPTIM2PRIV at 0 range 23 .. 23; LPTIM3PRIV at 0 range 24 .. 24; FDCAN1PRIV at 0 range 25 .. 25; USBFSPRIV at 0 range 26 .. 26; UCPD1PRIV at 0 range 27 .. 27; VREFBUFPRIV at 0 range 28 .. 28; COMPPRIV at 0 range 29 .. 29; TIM1PRIV at 0 range 30 .. 30; SPI1PRIV at 0 range 31 .. 31; end record; -- TZSC privilege configuration register 2 type TZSC_PRIVCFGR2_Register is record -- TIM8PRIV TIM8PRIV : Boolean := False; -- USART1PRIV USART1PRIV : Boolean := False; -- TIM15PRIV TIM15PRIV : Boolean := False; -- TIM16PRIV TIM16PRIV : Boolean := False; -- TIM17PRIV TIM17PRIV : Boolean := False; -- SAI1PRIV SAI1PRIV : Boolean := False; -- SAI2PRIV SAI2PRIV : Boolean := False; -- DFSDM1PRIV DFSDM1PRIV : Boolean := False; -- CRCPRIV CRCPRIV : Boolean := False; -- TSCPRIV TSCPRIV : Boolean := False; -- ICACHEPRIV ICACHEPRIV : Boolean := False; -- ADCPRIV ADCPRIV : Boolean := False; -- AESPRIV AESPRIV : Boolean := False; -- HASHPRIV HASHPRIV : Boolean := False; -- RNGPRIV RNGPRIV : Boolean := False; -- PKAPRIV PKAPRIV : Boolean := False; -- SDMMC1PRIV SDMMC1PRIV : Boolean := False; -- FSMC_REGPRIV FSMC_REGPRIV : Boolean := False; -- OCTOSPI1_REGRIV OCTOSPI1_REGPRIV : Boolean := False; -- unspecified Reserved_19_31 : HAL.UInt13 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TZSC_PRIVCFGR2_Register use record TIM8PRIV at 0 range 0 .. 0; USART1PRIV at 0 range 1 .. 1; TIM15PRIV at 0 range 2 .. 2; TIM16PRIV at 0 range 3 .. 3; TIM17PRIV at 0 range 4 .. 4; SAI1PRIV at 0 range 5 .. 5; SAI2PRIV at 0 range 6 .. 6; DFSDM1PRIV at 0 range 7 .. 7; CRCPRIV at 0 range 8 .. 8; TSCPRIV at 0 range 9 .. 9; ICACHEPRIV at 0 range 10 .. 10; ADCPRIV at 0 range 11 .. 11; AESPRIV at 0 range 12 .. 12; HASHPRIV at 0 range 13 .. 13; RNGPRIV at 0 range 14 .. 14; PKAPRIV at 0 range 15 .. 15; SDMMC1PRIV at 0 range 16 .. 16; FSMC_REGPRIV at 0 range 17 .. 17; OCTOSPI1_REGPRIV at 0 range 18 .. 18; Reserved_19_31 at 0 range 19 .. 31; end record; subtype TZSC_MPCWM1_NSWMR1_NSWM1STRT_Field is HAL.UInt11; subtype TZSC_MPCWM1_NSWMR1_NSWM1LGTH_Field is HAL.UInt12; -- TZSC external memory non-secure watermark register 1 type TZSC_MPCWM1_NSWMR1_Register is record -- NSWM1STRT NSWM1STRT : TZSC_MPCWM1_NSWMR1_NSWM1STRT_Field := 16#0#; -- unspecified Reserved_11_15 : HAL.UInt5 := 16#0#; -- NSWM1LGTH NSWM1LGTH : TZSC_MPCWM1_NSWMR1_NSWM1LGTH_Field := 16#0#; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TZSC_MPCWM1_NSWMR1_Register use record NSWM1STRT at 0 range 0 .. 10; Reserved_11_15 at 0 range 11 .. 15; NSWM1LGTH at 0 range 16 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; subtype TZSC_MPCWM1_NSWMR2_NSWM2STRT_Field is HAL.UInt11; subtype TZSC_MPCWM1_NSWMR2_NSWM2LGTH_Field is HAL.UInt12; -- TZSC external memory non-secure watermark register 1 type TZSC_MPCWM1_NSWMR2_Register is record -- NSWM2STRT NSWM2STRT : TZSC_MPCWM1_NSWMR2_NSWM2STRT_Field := 16#0#; -- unspecified Reserved_11_15 : HAL.UInt5 := 16#0#; -- NSWM2LGTH NSWM2LGTH : TZSC_MPCWM1_NSWMR2_NSWM2LGTH_Field := 16#0#; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TZSC_MPCWM1_NSWMR2_Register use record NSWM2STRT at 0 range 0 .. 10; Reserved_11_15 at 0 range 11 .. 15; NSWM2LGTH at 0 range 16 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; subtype TZSC_MPCWM2_NSWMR1_NSWM1STRT_Field is HAL.UInt11; subtype TZSC_MPCWM2_NSWMR1_NSWM1LGTH_Field is HAL.UInt12; -- TZSC external memory non-secure watermark register 1 type TZSC_MPCWM2_NSWMR1_Register is record -- NSWM1STRT NSWM1STRT : TZSC_MPCWM2_NSWMR1_NSWM1STRT_Field := 16#0#; -- unspecified Reserved_11_15 : HAL.UInt5 := 16#0#; -- NSWM1LGTH NSWM1LGTH : TZSC_MPCWM2_NSWMR1_NSWM1LGTH_Field := 16#0#; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TZSC_MPCWM2_NSWMR1_Register use record NSWM1STRT at 0 range 0 .. 10; Reserved_11_15 at 0 range 11 .. 15; NSWM1LGTH at 0 range 16 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; subtype TZSC_MPCWM2_NSWMR2_NSWM2STRT_Field is HAL.UInt11; subtype TZSC_MPCWM2_NSWMR2_NSWM2LGTH_Field is HAL.UInt12; -- TZSC external memory non-secure watermark register 2 type TZSC_MPCWM2_NSWMR2_Register is record -- NSWM2STRT NSWM2STRT : TZSC_MPCWM2_NSWMR2_NSWM2STRT_Field := 16#0#; -- unspecified Reserved_11_15 : HAL.UInt5 := 16#0#; -- NSWM2LGTH NSWM2LGTH : TZSC_MPCWM2_NSWMR2_NSWM2LGTH_Field := 16#0#; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TZSC_MPCWM2_NSWMR2_Register use record NSWM2STRT at 0 range 0 .. 10; Reserved_11_15 at 0 range 11 .. 15; NSWM2LGTH at 0 range 16 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; subtype TZSC_MPCWM3_NSWMR1_NSWM2STRT_Field is HAL.UInt11; subtype TZSC_MPCWM3_NSWMR1_NSWM2LGTH_Field is HAL.UInt12; -- TZSC external memory non-secure watermark register 2 type TZSC_MPCWM3_NSWMR1_Register is record -- NSWM2STRT NSWM2STRT : TZSC_MPCWM3_NSWMR1_NSWM2STRT_Field := 16#0#; -- unspecified Reserved_11_15 : HAL.UInt5 := 16#0#; -- NSWM2LGTH NSWM2LGTH : TZSC_MPCWM3_NSWMR1_NSWM2LGTH_Field := 16#0#; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TZSC_MPCWM3_NSWMR1_Register use record NSWM2STRT at 0 range 0 .. 10; Reserved_11_15 at 0 range 11 .. 15; NSWM2LGTH at 0 range 16 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- MPCBB1 type MPCBB1_Peripheral is record -- MPCBB control register MPCBB1_CR : aliased MPCBB1_CR_Register; -- MPCBB control register MPCBB1_LCKVTR1 : aliased MPCBB1_LCKVTR1_Register; -- MPCBB control register MPCBB1_LCKVTR2 : aliased MPCBB1_LCKVTR2_Register; -- MPCBBx vector register MPCBB1_VCTR0 : aliased MPCBB1_VCTR0_Register; -- MPCBBx vector register MPCBB1_VCTR1 : aliased MPCBB1_VCTR1_Register; -- MPCBBx vector register MPCBB1_VCTR2 : aliased MPCBB1_VCTR2_Register; -- MPCBBx vector register MPCBB1_VCTR3 : aliased MPCBB1_VCTR3_Register; -- MPCBBx vector register MPCBB1_VCTR4 : aliased MPCBB1_VCTR4_Register; -- MPCBBx vector register MPCBB1_VCTR5 : aliased MPCBB1_VCTR5_Register; -- MPCBBx vector register MPCBB1_VCTR6 : aliased MPCBB1_VCTR6_Register; -- MPCBBx vector register MPCBB1_VCTR7 : aliased MPCBB1_VCTR7_Register; -- MPCBBx vector register MPCBB1_VCTR8 : aliased MPCBB1_VCTR8_Register; -- MPCBBx vector register MPCBB1_VCTR9 : aliased MPCBB1_VCTR9_Register; -- MPCBBx vector register MPCBB1_VCTR10 : aliased MPCBB1_VCTR10_Register; -- MPCBBx vector register MPCBB1_VCTR11 : aliased MPCBB1_VCTR11_Register; -- MPCBBx vector register MPCBB1_VCTR12 : aliased MPCBB1_VCTR12_Register; -- MPCBBx vector register MPCBB1_VCTR13 : aliased MPCBB1_VCTR13_Register; -- MPCBBx vector register MPCBB1_VCTR14 : aliased MPCBB1_VCTR14_Register; -- MPCBBx vector register MPCBB1_VCTR15 : aliased MPCBB1_VCTR15_Register; -- MPCBBx vector register MPCBB1_VCTR16 : aliased MPCBB1_VCTR16_Register; -- MPCBBx vector register MPCBB1_VCTR17 : aliased MPCBB1_VCTR17_Register; -- MPCBBx vector register MPCBB1_VCTR18 : aliased MPCBB1_VCTR18_Register; -- MPCBBx vector register MPCBB1_VCTR19 : aliased MPCBB1_VCTR19_Register; -- MPCBBx vector register MPCBB1_VCTR20 : aliased MPCBB1_VCTR20_Register; -- MPCBBx vector register MPCBB1_VCTR21 : aliased MPCBB1_VCTR21_Register; -- MPCBBx vector register MPCBB1_VCTR22 : aliased MPCBB1_VCTR22_Register; -- MPCBBx vector register MPCBB1_VCTR23 : aliased MPCBB1_VCTR23_Register; -- MPCBBx vector register MPCBB1_VCTR24 : aliased MPCBB1_VCTR24_Register; -- MPCBBx vector register MPCBB1_VCTR25 : aliased MPCBB1_VCTR25_Register; -- MPCBBx vector register MPCBB1_VCTR26 : aliased MPCBB1_VCTR26_Register; -- MPCBBx vector register MPCBB1_VCTR27 : aliased MPCBB1_VCTR27_Register; -- MPCBBx vector register MPCBB1_VCTR28 : aliased MPCBB1_VCTR28_Register; -- MPCBBx vector register MPCBB1_VCTR29 : aliased MPCBB1_VCTR29_Register; -- MPCBBx vector register MPCBB1_VCTR30 : aliased MPCBB1_VCTR30_Register; -- MPCBBx vector register MPCBB1_VCTR31 : aliased MPCBB1_VCTR31_Register; -- MPCBBx vector register MPCBB1_VCTR32 : aliased MPCBB1_VCTR32_Register; -- MPCBBx vector register MPCBB1_VCTR33 : aliased MPCBB1_VCTR33_Register; -- MPCBBx vector register MPCBB1_VCTR34 : aliased MPCBB1_VCTR34_Register; -- MPCBBx vector register MPCBB1_VCTR35 : aliased MPCBB1_VCTR35_Register; -- MPCBBx vector register MPCBB1_VCTR36 : aliased MPCBB1_VCTR36_Register; -- MPCBBx vector register MPCBB1_VCTR37 : aliased MPCBB1_VCTR37_Register; -- MPCBBx vector register MPCBB1_VCTR38 : aliased MPCBB1_VCTR38_Register; -- MPCBBx vector register MPCBB1_VCTR39 : aliased MPCBB1_VCTR39_Register; -- MPCBBx vector register MPCBB1_VCTR40 : aliased MPCBB1_VCTR40_Register; -- MPCBBx vector register MPCBB1_VCTR41 : aliased MPCBB1_VCTR41_Register; -- MPCBBx vector register MPCBB1_VCTR42 : aliased MPCBB1_VCTR42_Register; -- MPCBBx vector register MPCBB1_VCTR43 : aliased MPCBB1_VCTR43_Register; -- MPCBBx vector register MPCBB1_VCTR44 : aliased MPCBB1_VCTR44_Register; -- MPCBBx vector register MPCBB1_VCTR45 : aliased MPCBB1_VCTR45_Register; -- MPCBBx vector register MPCBB1_VCTR46 : aliased MPCBB1_VCTR46_Register; -- MPCBBx vector register MPCBB1_VCTR47 : aliased MPCBB1_VCTR47_Register; -- MPCBBx vector register MPCBB1_VCTR48 : aliased MPCBB1_VCTR48_Register; -- MPCBBx vector register MPCBB1_VCTR49 : aliased MPCBB1_VCTR49_Register; -- MPCBBx vector register MPCBB1_VCTR50 : aliased MPCBB1_VCTR50_Register; -- MPCBBx vector register MPCBB1_VCTR51 : aliased MPCBB1_VCTR51_Register; -- MPCBBx vector register MPCBB1_VCTR52 : aliased MPCBB1_VCTR52_Register; -- MPCBBx vector register MPCBB1_VCTR53 : aliased MPCBB1_VCTR53_Register; -- MPCBBx vector register MPCBB1_VCTR54 : aliased MPCBB1_VCTR54_Register; -- MPCBBx vector register MPCBB1_VCTR55 : aliased MPCBB1_VCTR55_Register; -- MPCBBx vector register MPCBB1_VCTR56 : aliased MPCBB1_VCTR56_Register; -- MPCBBx vector register MPCBB1_VCTR57 : aliased MPCBB1_VCTR57_Register; -- MPCBBx vector register MPCBB1_VCTR58 : aliased MPCBB1_VCTR58_Register; -- MPCBBx vector register MPCBB1_VCTR59 : aliased MPCBB1_VCTR59_Register; -- MPCBBx vector register MPCBB1_VCTR60 : aliased MPCBB1_VCTR60_Register; -- MPCBBx vector register MPCBB1_VCTR61 : aliased MPCBB1_VCTR61_Register; -- MPCBBx vector register MPCBB1_VCTR62 : aliased MPCBB1_VCTR62_Register; -- MPCBBx vector register MPCBB1_VCTR63 : aliased MPCBB1_VCTR63_Register; end record with Volatile; for MPCBB1_Peripheral use record MPCBB1_CR at 16#0# range 0 .. 31; MPCBB1_LCKVTR1 at 16#10# range 0 .. 31; MPCBB1_LCKVTR2 at 16#14# range 0 .. 31; MPCBB1_VCTR0 at 16#100# range 0 .. 31; MPCBB1_VCTR1 at 16#104# range 0 .. 31; MPCBB1_VCTR2 at 16#108# range 0 .. 31; MPCBB1_VCTR3 at 16#10C# range 0 .. 31; MPCBB1_VCTR4 at 16#110# range 0 .. 31; MPCBB1_VCTR5 at 16#114# range 0 .. 31; MPCBB1_VCTR6 at 16#118# range 0 .. 31; MPCBB1_VCTR7 at 16#11C# range 0 .. 31; MPCBB1_VCTR8 at 16#120# range 0 .. 31; MPCBB1_VCTR9 at 16#124# range 0 .. 31; MPCBB1_VCTR10 at 16#128# range 0 .. 31; MPCBB1_VCTR11 at 16#12C# range 0 .. 31; MPCBB1_VCTR12 at 16#130# range 0 .. 31; MPCBB1_VCTR13 at 16#134# range 0 .. 31; MPCBB1_VCTR14 at 16#138# range 0 .. 31; MPCBB1_VCTR15 at 16#13C# range 0 .. 31; MPCBB1_VCTR16 at 16#140# range 0 .. 31; MPCBB1_VCTR17 at 16#144# range 0 .. 31; MPCBB1_VCTR18 at 16#148# range 0 .. 31; MPCBB1_VCTR19 at 16#14C# range 0 .. 31; MPCBB1_VCTR20 at 16#150# range 0 .. 31; MPCBB1_VCTR21 at 16#154# range 0 .. 31; MPCBB1_VCTR22 at 16#158# range 0 .. 31; MPCBB1_VCTR23 at 16#15C# range 0 .. 31; MPCBB1_VCTR24 at 16#160# range 0 .. 31; MPCBB1_VCTR25 at 16#164# range 0 .. 31; MPCBB1_VCTR26 at 16#168# range 0 .. 31; MPCBB1_VCTR27 at 16#16C# range 0 .. 31; MPCBB1_VCTR28 at 16#170# range 0 .. 31; MPCBB1_VCTR29 at 16#174# range 0 .. 31; MPCBB1_VCTR30 at 16#178# range 0 .. 31; MPCBB1_VCTR31 at 16#17C# range 0 .. 31; MPCBB1_VCTR32 at 16#180# range 0 .. 31; MPCBB1_VCTR33 at 16#184# range 0 .. 31; MPCBB1_VCTR34 at 16#188# range 0 .. 31; MPCBB1_VCTR35 at 16#18C# range 0 .. 31; MPCBB1_VCTR36 at 16#190# range 0 .. 31; MPCBB1_VCTR37 at 16#194# range 0 .. 31; MPCBB1_VCTR38 at 16#198# range 0 .. 31; MPCBB1_VCTR39 at 16#19C# range 0 .. 31; MPCBB1_VCTR40 at 16#1A0# range 0 .. 31; MPCBB1_VCTR41 at 16#1A4# range 0 .. 31; MPCBB1_VCTR42 at 16#1A8# range 0 .. 31; MPCBB1_VCTR43 at 16#1AC# range 0 .. 31; MPCBB1_VCTR44 at 16#1B0# range 0 .. 31; MPCBB1_VCTR45 at 16#1B4# range 0 .. 31; MPCBB1_VCTR46 at 16#1B8# range 0 .. 31; MPCBB1_VCTR47 at 16#1BC# range 0 .. 31; MPCBB1_VCTR48 at 16#1C0# range 0 .. 31; MPCBB1_VCTR49 at 16#1C4# range 0 .. 31; MPCBB1_VCTR50 at 16#1C8# range 0 .. 31; MPCBB1_VCTR51 at 16#1CC# range 0 .. 31; MPCBB1_VCTR52 at 16#1D0# range 0 .. 31; MPCBB1_VCTR53 at 16#1D4# range 0 .. 31; MPCBB1_VCTR54 at 16#1D8# range 0 .. 31; MPCBB1_VCTR55 at 16#1DC# range 0 .. 31; MPCBB1_VCTR56 at 16#1E0# range 0 .. 31; MPCBB1_VCTR57 at 16#1E4# range 0 .. 31; MPCBB1_VCTR58 at 16#1E8# range 0 .. 31; MPCBB1_VCTR59 at 16#1EC# range 0 .. 31; MPCBB1_VCTR60 at 16#1F0# range 0 .. 31; MPCBB1_VCTR61 at 16#1F4# range 0 .. 31; MPCBB1_VCTR62 at 16#1F8# range 0 .. 31; MPCBB1_VCTR63 at 16#1FC# range 0 .. 31; end record; -- MPCBB1 MPCBB1_Periph : aliased MPCBB1_Peripheral with Import, Address => System'To_Address (16#40032C00#); -- MPCBB1 SEC_MPCBB1_Periph : aliased MPCBB1_Peripheral with Import, Address => System'To_Address (16#50032C00#); -- MPCBB2 type MPCBB2_Peripheral is record -- MPCBB control register MPCBB2_CR : aliased MPCBB2_CR_Register; -- MPCBB control register MPCBB2_LCKVTR1 : aliased MPCBB2_LCKVTR1_Register; -- MPCBB control register MPCBB2_LCKVTR2 : aliased MPCBB2_LCKVTR2_Register; -- MPCBBx vector register MPCBB2_VCTR0 : aliased MPCBB2_VCTR0_Register; -- MPCBBx vector register MPCBB2_VCTR1 : aliased MPCBB2_VCTR1_Register; -- MPCBBx vector register MPCBB2_VCTR2 : aliased MPCBB2_VCTR2_Register; -- MPCBBx vector register MPCBB2_VCTR3 : aliased MPCBB2_VCTR3_Register; -- MPCBBx vector register MPCBB2_VCTR4 : aliased MPCBB2_VCTR4_Register; -- MPCBBx vector register MPCBB2_VCTR5 : aliased MPCBB2_VCTR5_Register; -- MPCBBx vector register MPCBB2_VCTR6 : aliased MPCBB2_VCTR6_Register; -- MPCBBx vector register MPCBB2_VCTR7 : aliased MPCBB2_VCTR7_Register; -- MPCBBx vector register MPCBB2_VCTR8 : aliased MPCBB2_VCTR8_Register; -- MPCBBx vector register MPCBB2_VCTR9 : aliased MPCBB2_VCTR9_Register; -- MPCBBx vector register MPCBB2_VCTR10 : aliased MPCBB2_VCTR10_Register; -- MPCBBx vector register MPCBB2_VCTR11 : aliased MPCBB2_VCTR11_Register; -- MPCBBx vector register MPCBB2_VCTR12 : aliased MPCBB2_VCTR12_Register; -- MPCBBx vector register MPCBB2_VCTR13 : aliased MPCBB2_VCTR13_Register; -- MPCBBx vector register MPCBB2_VCTR14 : aliased MPCBB2_VCTR14_Register; -- MPCBBx vector register MPCBB2_VCTR15 : aliased MPCBB2_VCTR15_Register; -- MPCBBx vector register MPCBB2_VCTR16 : aliased MPCBB2_VCTR16_Register; -- MPCBBx vector register MPCBB2_VCTR17 : aliased MPCBB2_VCTR17_Register; -- MPCBBx vector register MPCBB2_VCTR18 : aliased MPCBB2_VCTR18_Register; -- MPCBBx vector register MPCBB2_VCTR19 : aliased MPCBB2_VCTR19_Register; -- MPCBBx vector register MPCBB2_VCTR20 : aliased MPCBB2_VCTR20_Register; -- MPCBBx vector register MPCBB2_VCTR21 : aliased MPCBB2_VCTR21_Register; -- MPCBBx vector register MPCBB2_VCTR22 : aliased MPCBB2_VCTR22_Register; -- MPCBBx vector register MPCBB2_VCTR23 : aliased MPCBB2_VCTR23_Register; -- MPCBBx vector register MPCBB2_VCTR24 : aliased MPCBB2_VCTR24_Register; -- MPCBBx vector register MPCBB2_VCTR25 : aliased MPCBB2_VCTR25_Register; -- MPCBBx vector register MPCBB2_VCTR26 : aliased MPCBB2_VCTR26_Register; -- MPCBBx vector register MPCBB2_VCTR27 : aliased MPCBB2_VCTR27_Register; -- MPCBBx vector register MPCBB2_VCTR28 : aliased MPCBB2_VCTR28_Register; -- MPCBBx vector register MPCBB2_VCTR29 : aliased MPCBB2_VCTR29_Register; -- MPCBBx vector register MPCBB2_VCTR30 : aliased MPCBB2_VCTR30_Register; -- MPCBBx vector register MPCBB2_VCTR31 : aliased MPCBB2_VCTR31_Register; -- MPCBBx vector register MPCBB2_VCTR32 : aliased MPCBB2_VCTR32_Register; -- MPCBBx vector register MPCBB2_VCTR33 : aliased MPCBB2_VCTR33_Register; -- MPCBBx vector register MPCBB2_VCTR34 : aliased MPCBB2_VCTR34_Register; -- MPCBBx vector register MPCBB2_VCTR35 : aliased MPCBB2_VCTR35_Register; -- MPCBBx vector register MPCBB2_VCTR36 : aliased MPCBB2_VCTR36_Register; -- MPCBBx vector register MPCBB2_VCTR37 : aliased MPCBB2_VCTR37_Register; -- MPCBBx vector register MPCBB2_VCTR38 : aliased MPCBB2_VCTR38_Register; -- MPCBBx vector register MPCBB2_VCTR39 : aliased MPCBB2_VCTR39_Register; -- MPCBBx vector register MPCBB2_VCTR40 : aliased MPCBB2_VCTR40_Register; -- MPCBBx vector register MPCBB2_VCTR41 : aliased MPCBB2_VCTR41_Register; -- MPCBBx vector register MPCBB2_VCTR42 : aliased MPCBB2_VCTR42_Register; -- MPCBBx vector register MPCBB2_VCTR43 : aliased MPCBB2_VCTR43_Register; -- MPCBBx vector register MPCBB2_VCTR44 : aliased MPCBB2_VCTR44_Register; -- MPCBBx vector register MPCBB2_VCTR45 : aliased MPCBB2_VCTR45_Register; -- MPCBBx vector register MPCBB2_VCTR46 : aliased MPCBB2_VCTR46_Register; -- MPCBBx vector register MPCBB2_VCTR47 : aliased MPCBB2_VCTR47_Register; -- MPCBBx vector register MPCBB2_VCTR48 : aliased MPCBB2_VCTR48_Register; -- MPCBBx vector register MPCBB2_VCTR49 : aliased MPCBB2_VCTR49_Register; -- MPCBBx vector register MPCBB2_VCTR50 : aliased MPCBB2_VCTR50_Register; -- MPCBBx vector register MPCBB2_VCTR51 : aliased MPCBB2_VCTR51_Register; -- MPCBBx vector register MPCBB2_VCTR52 : aliased MPCBB2_VCTR52_Register; -- MPCBBx vector register MPCBB2_VCTR53 : aliased MPCBB2_VCTR53_Register; -- MPCBBx vector register MPCBB2_VCTR54 : aliased MPCBB2_VCTR54_Register; -- MPCBBx vector register MPCBB2_VCTR55 : aliased MPCBB2_VCTR55_Register; -- MPCBBx vector register MPCBB2_VCTR56 : aliased MPCBB2_VCTR56_Register; -- MPCBBx vector register MPCBB2_VCTR57 : aliased MPCBB2_VCTR57_Register; -- MPCBBx vector register MPCBB2_VCTR58 : aliased MPCBB2_VCTR58_Register; -- MPCBBx vector register MPCBB2_VCTR59 : aliased MPCBB2_VCTR59_Register; -- MPCBBx vector register MPCBB2_VCTR60 : aliased MPCBB2_VCTR60_Register; -- MPCBBx vector register MPCBB2_VCTR61 : aliased MPCBB2_VCTR61_Register; -- MPCBBx vector register MPCBB2_VCTR62 : aliased MPCBB2_VCTR62_Register; -- MPCBBx vector register MPCBB2_VCTR63 : aliased MPCBB2_VCTR63_Register; end record with Volatile; for MPCBB2_Peripheral use record MPCBB2_CR at 16#0# range 0 .. 31; MPCBB2_LCKVTR1 at 16#10# range 0 .. 31; MPCBB2_LCKVTR2 at 16#14# range 0 .. 31; MPCBB2_VCTR0 at 16#100# range 0 .. 31; MPCBB2_VCTR1 at 16#104# range 0 .. 31; MPCBB2_VCTR2 at 16#108# range 0 .. 31; MPCBB2_VCTR3 at 16#10C# range 0 .. 31; MPCBB2_VCTR4 at 16#110# range 0 .. 31; MPCBB2_VCTR5 at 16#114# range 0 .. 31; MPCBB2_VCTR6 at 16#118# range 0 .. 31; MPCBB2_VCTR7 at 16#11C# range 0 .. 31; MPCBB2_VCTR8 at 16#120# range 0 .. 31; MPCBB2_VCTR9 at 16#124# range 0 .. 31; MPCBB2_VCTR10 at 16#128# range 0 .. 31; MPCBB2_VCTR11 at 16#12C# range 0 .. 31; MPCBB2_VCTR12 at 16#130# range 0 .. 31; MPCBB2_VCTR13 at 16#134# range 0 .. 31; MPCBB2_VCTR14 at 16#138# range 0 .. 31; MPCBB2_VCTR15 at 16#13C# range 0 .. 31; MPCBB2_VCTR16 at 16#140# range 0 .. 31; MPCBB2_VCTR17 at 16#144# range 0 .. 31; MPCBB2_VCTR18 at 16#148# range 0 .. 31; MPCBB2_VCTR19 at 16#14C# range 0 .. 31; MPCBB2_VCTR20 at 16#150# range 0 .. 31; MPCBB2_VCTR21 at 16#154# range 0 .. 31; MPCBB2_VCTR22 at 16#158# range 0 .. 31; MPCBB2_VCTR23 at 16#15C# range 0 .. 31; MPCBB2_VCTR24 at 16#160# range 0 .. 31; MPCBB2_VCTR25 at 16#164# range 0 .. 31; MPCBB2_VCTR26 at 16#168# range 0 .. 31; MPCBB2_VCTR27 at 16#16C# range 0 .. 31; MPCBB2_VCTR28 at 16#170# range 0 .. 31; MPCBB2_VCTR29 at 16#174# range 0 .. 31; MPCBB2_VCTR30 at 16#178# range 0 .. 31; MPCBB2_VCTR31 at 16#17C# range 0 .. 31; MPCBB2_VCTR32 at 16#180# range 0 .. 31; MPCBB2_VCTR33 at 16#184# range 0 .. 31; MPCBB2_VCTR34 at 16#188# range 0 .. 31; MPCBB2_VCTR35 at 16#18C# range 0 .. 31; MPCBB2_VCTR36 at 16#190# range 0 .. 31; MPCBB2_VCTR37 at 16#194# range 0 .. 31; MPCBB2_VCTR38 at 16#198# range 0 .. 31; MPCBB2_VCTR39 at 16#19C# range 0 .. 31; MPCBB2_VCTR40 at 16#1A0# range 0 .. 31; MPCBB2_VCTR41 at 16#1A4# range 0 .. 31; MPCBB2_VCTR42 at 16#1A8# range 0 .. 31; MPCBB2_VCTR43 at 16#1AC# range 0 .. 31; MPCBB2_VCTR44 at 16#1B0# range 0 .. 31; MPCBB2_VCTR45 at 16#1B4# range 0 .. 31; MPCBB2_VCTR46 at 16#1B8# range 0 .. 31; MPCBB2_VCTR47 at 16#1BC# range 0 .. 31; MPCBB2_VCTR48 at 16#1C0# range 0 .. 31; MPCBB2_VCTR49 at 16#1C4# range 0 .. 31; MPCBB2_VCTR50 at 16#1C8# range 0 .. 31; MPCBB2_VCTR51 at 16#1CC# range 0 .. 31; MPCBB2_VCTR52 at 16#1D0# range 0 .. 31; MPCBB2_VCTR53 at 16#1D4# range 0 .. 31; MPCBB2_VCTR54 at 16#1D8# range 0 .. 31; MPCBB2_VCTR55 at 16#1DC# range 0 .. 31; MPCBB2_VCTR56 at 16#1E0# range 0 .. 31; MPCBB2_VCTR57 at 16#1E4# range 0 .. 31; MPCBB2_VCTR58 at 16#1E8# range 0 .. 31; MPCBB2_VCTR59 at 16#1EC# range 0 .. 31; MPCBB2_VCTR60 at 16#1F0# range 0 .. 31; MPCBB2_VCTR61 at 16#1F4# range 0 .. 31; MPCBB2_VCTR62 at 16#1F8# range 0 .. 31; MPCBB2_VCTR63 at 16#1FC# range 0 .. 31; end record; -- MPCBB2 MPCBB2_Periph : aliased MPCBB2_Peripheral with Import, Address => System'To_Address (16#40033000#); -- MPCBB2 SEC_MPCBB2_Periph : aliased MPCBB2_Peripheral with Import, Address => System'To_Address (16#50033000#); -- TZIC type SEC_TZIC_Peripheral is record -- TZIC interrupt enable register 1 IER1 : aliased IER1_Register; -- TZIC interrupt enable register 2 IER2 : aliased IER2_Register; -- TZIC interrupt enable register 3 IER3 : aliased IER3_Register; -- TZIC interrupt status register 1 MISR1 : aliased MISR1_Register; -- TZIC interrupt status register 2 MISR2 : aliased MISR2_Register; -- TZIC interrupt status register 3 MISR3 : aliased MISR3_Register; -- TZIC interrupt clear register 1 ICR1 : aliased ICR1_Register; -- TZIC interrupt clear register 2 ICR2 : aliased ICR2_Register; -- TZIC interrupt clear register 3 ICR3 : aliased ICR3_Register; end record with Volatile; for SEC_TZIC_Peripheral use record IER1 at 16#0# range 0 .. 31; IER2 at 16#4# range 0 .. 31; IER3 at 16#8# range 0 .. 31; MISR1 at 16#10# range 0 .. 31; MISR2 at 16#14# range 0 .. 31; MISR3 at 16#18# range 0 .. 31; ICR1 at 16#20# range 0 .. 31; ICR2 at 16#24# range 0 .. 31; ICR3 at 16#28# range 0 .. 31; end record; -- TZIC SEC_TZIC_Periph : aliased SEC_TZIC_Peripheral with Import, Address => System'To_Address (16#50032800#); -- TZIC TZIC_Periph : aliased SEC_TZIC_Peripheral with Import, Address => System'To_Address (16#40032800#); -- TZSC type SEC_TZSC_Peripheral is record -- TZSC control register TZSC_CR : aliased TZSC_CR_Register; -- TZSC secure configuration register 1 TZSC_SECCFGR1 : aliased TZSC_SECCFGR1_Register; -- TZSC secure configuration register 2 TZSC_SECCFGR2 : aliased TZSC_SECCFGR2_Register; -- TZSC privilege configuration register 1 TZSC_PRIVCFGR1 : aliased TZSC_PRIVCFGR1_Register; -- TZSC privilege configuration register 2 TZSC_PRIVCFGR2 : aliased TZSC_PRIVCFGR2_Register; -- TZSC external memory non-secure watermark register 1 TZSC_MPCWM1_NSWMR1 : aliased TZSC_MPCWM1_NSWMR1_Register; -- TZSC external memory non-secure watermark register 1 TZSC_MPCWM1_NSWMR2 : aliased TZSC_MPCWM1_NSWMR2_Register; -- TZSC external memory non-secure watermark register 1 TZSC_MPCWM2_NSWMR1 : aliased TZSC_MPCWM2_NSWMR1_Register; -- TZSC external memory non-secure watermark register 2 TZSC_MPCWM2_NSWMR2 : aliased TZSC_MPCWM2_NSWMR2_Register; -- TZSC external memory non-secure watermark register 2 TZSC_MPCWM3_NSWMR1 : aliased TZSC_MPCWM3_NSWMR1_Register; end record with Volatile; for SEC_TZSC_Peripheral use record TZSC_CR at 16#0# range 0 .. 31; TZSC_SECCFGR1 at 16#10# range 0 .. 31; TZSC_SECCFGR2 at 16#14# range 0 .. 31; TZSC_PRIVCFGR1 at 16#20# range 0 .. 31; TZSC_PRIVCFGR2 at 16#24# range 0 .. 31; TZSC_MPCWM1_NSWMR1 at 16#30# range 0 .. 31; TZSC_MPCWM1_NSWMR2 at 16#34# range 0 .. 31; TZSC_MPCWM2_NSWMR1 at 16#38# range 0 .. 31; TZSC_MPCWM2_NSWMR2 at 16#3C# range 0 .. 31; TZSC_MPCWM3_NSWMR1 at 16#40# range 0 .. 31; end record; -- TZSC SEC_TZSC_Periph : aliased SEC_TZSC_Peripheral with Import, Address => System'To_Address (16#50032400#); -- TZSC TZSC_Periph : aliased SEC_TZSC_Peripheral with Import, Address => System'To_Address (16#40032400#); end STM32_SVD.GTZC;
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2016 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with GL.Objects.Textures; with GL.Types.Colors; package GL.Objects.Samplers is pragma Preelaborate; type Sampler is new GL_Object with private; type Sampler_Array is array (Positive range <>) of Sampler; procedure Bind (Object : Sampler; Unit : Textures.Texture_Unit); procedure Bind (Objects : Sampler_Array; First_Unit : Textures.Texture_Unit); overriding procedure Initialize_Id (Object : in out Sampler); overriding procedure Delete_Id (Object : in out Sampler); overriding function Identifier (Object : Sampler) return Types.Debug.Identifier is (Types.Debug.Sampler); ----------------------------------------------------------------------------- -- Sampler Parameters -- ----------------------------------------------------------------------------- use GL.Objects.Textures; procedure Set_Minifying_Filter (Object : Sampler; Filter : Minifying_Function); procedure Set_Magnifying_Filter (Object : Sampler; Filter : Magnifying_Function); procedure Set_Minimum_LoD (Object : Sampler; Level : Double); procedure Set_Maximum_LoD (Object : Sampler; Level : Double); procedure Set_LoD_Bias (Object : Sampler; Level : Double); -- Adjust the selection of a mipmap image. A positive level will -- cause larger mipmaps to be selected. A too large bias can -- result in visual aliasing, but if the bias is small enough it -- can make the texture look a bit sharper. procedure Set_Seamless_Filtering (Object : Sampler; Enable : Boolean); -- Enable seamless cubemap filtering -- -- Texture must be a Texture_Cube_Map or Texture_Cube_Map_Array. -- -- Note: this procedure requires the ARB_seamless_cubemap_per_texture -- extension. If this extension is not available, you can enable seamless -- filtering globally via GL.Toggles. procedure Set_Max_Anisotropy (Object : Sampler; Degree : Double) with Pre => Degree >= 1.0; -- Set the maximum amount of anisotropy filtering to reduce the blurring -- of textures (caused by mipmap filtering) that are viewed at an -- oblique angle. -- -- For best results, combine the use of anisotropy filtering with -- a Linear_Mipmap_Linear minification filter and a Linear maxification -- filter. ----------------------------------------------------------------------------- function Minifying_Filter (Object : Sampler) return Minifying_Function; -- Return the minification function (default is Nearest_Mipmap_Linear) function Magnifying_Filter (Object : Sampler) return Magnifying_Function; -- Return the magnification function (default is Linear) function Minimum_LoD (Object : Sampler) return Double; -- Return the minimum LOD (default is -1000) function Maximum_LoD (Object : Sampler) return Double; -- Return the maximum LOD (default is 1000) function LoD_Bias (Object : Sampler) return Double; -- Return the LOD bias for the selection of a mipmap (default is 0.0) function Seamless_Filtering (Object : Sampler) return Boolean; -- Return whether seamless filtering is enabled for cube map -- textures (default is False) function Max_Anisotropy (Object : Sampler) return Double with Post => Max_Anisotropy'Result >= 1.0; ----------------------------------------------------------------------------- procedure Set_X_Wrapping (Object : Sampler; Mode : Wrapping_Mode); procedure Set_Y_Wrapping (Object : Sampler; Mode : Wrapping_Mode); procedure Set_Z_Wrapping (Object : Sampler; Mode : Wrapping_Mode); function X_Wrapping (Object : Sampler) return Wrapping_Mode; -- Return the wrapping mode for the X direction (default is Repeat) function Y_Wrapping (Object : Sampler) return Wrapping_Mode; -- Return the wrapping mode for the Y direction (default is Repeat) function Z_Wrapping (Object : Sampler) return Wrapping_Mode; -- Return the wrapping mode for the Z direction (default is Repeat) ----------------------------------------------------------------------------- procedure Set_Border_Color (Object : Sampler; Color : Colors.Border_Color); procedure Set_Compare_X_To_Texture (Object : Sampler; Enabled : Boolean); procedure Set_Compare_Function (Object : Sampler; Func : Compare_Function); function Border_Color (Object : Sampler) return Colors.Border_Color; function Compare_X_To_Texture_Enabled (Object : Sampler) return Boolean; -- Return whether to enable comparing (default is False) function Current_Compare_Function (Object : Sampler) return Compare_Function; -- Return the comparison function (default is LEqual) private type Sampler is new GL_Object with null record; end GL.Objects.Samplers;
-- SPDX-FileCopyrightText: 2020 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ---------------------------------------------------------------- with League.String_Vectors; with League.JSON.Objects; with League.JSON.Values; with Jupyter.Kernels; procedure Magics.Gprbuild_Options (IO_Pub : not null Jupyter.Kernels.IO_Pub_Access; Silent : Boolean; Options : in out League.String_Vectors.Universal_String_Vector; Section : League.Strings.Universal_String; Args : League.String_Vectors.Universal_String_Vector) is Result : League.Strings.Universal_String; Data : League.JSON.Objects.JSON_Object; begin if Args.Is_Empty then Options.Clear; else Options.Append (Args); end if; if not Silent then if Options.Is_Empty then Result.Append ("Now there is no "); Result.Append (Section); Result.Append ("options"); else Result.Append ("Now "); Result.Append (Section); Result.Append (" options are: "); Result.Append (Options.Join (" ")); end if; Data.Insert (+"text/plain", League.JSON.Values.To_JSON_Value (Result)); IO_Pub.Execute_Result (Data => Data, Metadata => League.JSON.Objects.Empty_JSON_Object, Transient => League.JSON.Objects.Empty_JSON_Object); end if; end Magics.Gprbuild_Options;
-- UnZip.Decompress.Huffman --------------------------- -- Huffman tree generation and deletion. -- Originally from info - zip's unzip, data structure rewritten by G. de Montmollin private package UnZip.Decompress.Huffman is type HufT_table; type p_HufT_table is access HufT_table; type HufT is record extra_bits : Natural; bits : Natural; n : Natural; next_table : p_HufT_table; end record; invalid : constant := 99; -- invalid value for extra bits type HufT_table is array (Integer range <>) of aliased HufT; type p_HufT is access all HufT; -- Linked list just for destroying Huffman tables type Table_list; type p_Table_list is access Table_list; type Table_list is record table : p_HufT_table; next : p_Table_list; end record; type Length_array is array (Integer range <>) of Natural; empty : constant Length_array (1 .. 0) := (others => 0); -- Free huffman tables starting with table where t points to procedure HufT_free (tl : in out p_Table_list); -- Build huffman table from code lengths given by array b.all procedure HufT_build (b : Length_array; s : Integer; d, e : Length_array; tl : out p_Table_list; m : in out Integer; huft_incomplete : out Boolean); -- Possible exceptions occuring in huft_build huft_error, -- bad tree constructed huft_out_of_memory : exception; -- not enough memory end UnZip.Decompress.Huffman;
-- { dg-do compile } -- { dg-options "-gnatws" } with System.Storage_Elements; use System.Storage_Elements; with Unchecked_Conversion; with Slice7_Pkg; use Slice7_Pkg; procedure Slice7 is type Discrete_Type is range 1 .. 32; Max_Byte_Count : constant := 4; subtype Byte_Count_Type is Storage_Offset range 1..Max_Byte_Count; subtype Buffer_Type is Storage_Array (Byte_Count_Type); function Convert_Put is new Unchecked_Conversion (Integer, Buffer_Type); function Set_Buffer_Size return Byte_Count_Type is begin return 4; end; Buffer_Size : constant Byte_Count_Type := Set_Buffer_Size; Buffer_End : constant Byte_Count_Type := Max_Byte_Count; Buffer_Start : constant Byte_Count_Type := Buffer_End - Buffer_Size + 1; Obj : Discrete_Type; begin Put (Convert_Put(Discrete_Type'Pos (Obj))); Put (Convert_Put(Discrete_Type'Pos (Obj)) (Buffer_Start..Buffer_End)); Put (Convert_Put(Discrete_Type'Pos (Obj) - Discrete_Type'Pos (Discrete_Type'First)) (Buffer_Start..Buffer_End)); end;
------------------------------------------------------------------------------ -- 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) $: package body Asis.Gela.Scanners is ----------- -- Enter -- ----------- procedure Enter (Object : in out Scanner; State : in Scanner_Tables.State) is begin Object.Start := State; end Enter; ---------------- -- Next_Token -- ---------------- procedure Next_Token (Object : in out Scanner; Token : out Gela.Scanner_Tables.Token) is use type Scanner_Tables.State; use type Scanner_Tables.Token; use type Character_Class_Buffers.Character_Class; Error : constant Scanner_Tables.State := Scanner_Tables.State'Last; Surrogate : constant Character_Class_Buffers.Character_Class := Character_Class_Buffers.Character_Class'Last - 1; Current_State : Scanner_Tables.State := Object.Start; Result : Scanner_Tables.Token := Scanner_Tables.Error; Class : Character_Class_Buffers.Character_Class; Position : Source_Buffers.Cursor := Object.To; Accepted : Scanner_Tables.Token; Sur_Count : Natural := 0; begin Object.From := Position; loop Character_Class_Buffers.Get (Object.Classes, Class); if Class = Character_Class_Buffers.End_Of_Buffer then Classificators.Read (Object.Classificator.all, Object.Input, Object.Classes); else Current_State := Scanner_Tables.Switch (Current_State, Class); exit when Current_State = Error; Source_Buffers.Next (Position); Accepted := Scanner_Tables.Accepted (Current_State); Sur_Count := Sur_Count + Boolean'Pos (Class = Surrogate); if Accepted /= Scanner_Tables.Error then Result := Accepted; Character_Class_Buffers.Mark (Object.Classes); Object.To := Position; Object.Surrogates := Sur_Count; end if; end if; end loop; Character_Class_Buffers.Back_To_Mark (Object.Classes); Token := Result; end Next_Token; ------------------ -- Token_Length -- ------------------ function Token_Length (Object : Scanner) return Positive is use type Source_Buffers.Cursor; begin return Object.To - Object.From - Object.Surrogates; end Token_Length; ---------------- -- Token_Span -- ---------------- procedure Token_Span (Object : in Scanner; From : out Source_Buffers.Cursor; To : out Source_Buffers.Cursor) is begin From := Object.From; To := Object.To; end Token_Span; ---------------- -- Initialize -- ---------------- procedure Initialize (Object : out Scanner; Cursor : in Source_Buffers.Cursor) is begin Object.Start := Scanner_Tables.Default; Object.Input := Cursor; Object.From := Cursor; Object.To := Cursor; end Initialize; end Asis.Gela.Scanners; ------------------------------------------------------------------------------ -- Copyright (c) 2008-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. ------------------------------------------------------------------------------
------------------------------------------------------------------------------ -- -- -- Simple HTTP -- -- -- -- Basic HTTP 1.1 support for API endpoints -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- 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 the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Ada.Streams; with Ada.Strings.Bounded; with Ada.Strings.Bounded.Hash; with Ada.Containers.Bounded_Hashed_Sets; with Simple_HTTP.RFC_7230_7231; generic Path_Bounds : in Positive := 200; -- This the bounds for the actual path component of a Request URI Field_Bounds: in Positive := 80; Value_Bounds: in Positive := 200; -- These are the bounds for the Field and Value strings for both -- the Headers, and for Request URI query components. Header_Limit: in Ada.Containers.Count_Type := 20; -- This is the maximum number of Headers that can be in a message Query_Limit : in Ada.Containers.Count_Type := 20; -- This is the maximum number of Queries that can be in a Request message Query_Fields_Case_Insensitive: in Boolean := False; -- RFC 2616 requres that header fields are case-insensitive, but no such -- provision is made for queries. If true, all query field names will be -- converted to lower-case, including when used in a search. -- -- The prevailing consensus seems to suggest that queries fields follow -- generally the convention of common programming languages used by APIs, -- which are typically case-sensistive. Slowloris_Timeout: in Duration := 10.0; -- This is the _total_ amount of time that any messare 'Read or 'Input -- operation can take to complete. This should be combined with a similar -- timeout value for source stream itself, if possible, to mitigate -- slowloris attacks. Whitespace_Limit: in Positive := 60; -- This is the maximum number of consecutive "LWS" whitespace characters -- that may appear when skipping whitespace during parsing of an HTTP -- message. package Simple_HTTP.HTTP_Message_Processor is use type Ada.Containers.Hash_Type; use type Ada.Containers.Count_Type; ------------------ -- HTTP_Message -- ------------------ type HTTP_Message_Status is (OK, -- Message is valid Timeout, -- Message took too long to complete (Slowloris_Timeout exceeded) Too_Much_Whitespace, -- Whitespace_Limit was exceeded. Bad_Input, -- A general violation of the input data was encountered. Bad_Version, -- Message version was not HTTP 1.1. -- These messages are still parsed as if they are HTTP 1.1, -- and so the user can decide how they wish to proceed Bad_Method, -- The given request method was not recognized. Bad_Status, -- The given reply status value was out of range or of an unexpected -- format Bad_URI, -- The format of the request URI was invalid Bad_Query, -- This typicaly means a query without a field name was found in the URI, -- an empty query was found, or a duplicate. -- For example "GET /index.html?=1337", "GET /?x=y&&", or "GET /?x=y&x=q" URI_Too_Long, -- The URI of the request was longer than Path_Bounds Bad_Header, -- The format of a Header was incorrect Header_Field_Too_Long, -- The header's field was longer than Field_Bounds Header_Value_Too_Long, -- The header's value was longer than Value_Bounds Too_Many_Headers); -- Header_Capacity was exceeded type HTTP_Message is abstract tagged private; -- HTTP_Message is the root type for both HTTP_Request and HTTP_Response -- messages. function Status (Message: HTTP_Message) return HTTP_Message_Status; procedure Clear_Headers (Message: in out HTTP_Message); -- Removes all Headers from Message. function Header_Count (Message: HTTP_Message) return Ada.Containers.Count_Type; -- Returns the number of headers contained in the Message procedure Add_Header (Message : in out HTTP_Message; Field, Value : in String) with Pre => Header_Count (Message) < Header_Limit and Field'Length > 0 and Value'Length > 0; -- Adds a specified Header to Message. If this exceeds the the capacity -- of Message, or if Name or Value are null strings, Constraint_Error is -- raised. -- -- If Field already exists in the message, Value is appended to the current -- value, immediately after a ','. This is the convention specified in -- RFC 7230-3.2.2, and preserves the order. Note that "Set-Cookie" (RFC6265) -- would need separate treatment. This parser does not treat "Set-Cookie" -- specially, so it will collapse multiple "Set-Cookies". See RFC7230-3.2.2 -- for additional commentary on this issue. -- -- Note that the 'Read and 'Input operations invoke (in effect) Add_Header, -- and will therefore also obey the order of multiple instances of the same -- header Field name. -- -- RFC 7230 specifies that header field names are case-insensitive (Section -- 3.2). Therefore, Field is automatically converted to lower-case. -- -- Add_Header does not validate the contents of Field or Value, however, -- 'Input/'Read does. It is therefore important that the user ensure that -- the contents of Field and Value are valid (including being properly -- escaped) when adding them programatically. -- -- Notes: -- * Headers will be stored (and output) in an arbitrary order. -- * 'Input/'Read does NOT support "obsolete line folding". Such input will -- result in a Bad_Header status. function Header_Value (Message: HTTP_Message; Field: String) return String; -- Returns the Value of the specific Field. If the specified Field does not -- exist, a null String is returned. Field is case-insensitive. Note that -- header fields without a value are not accepted. procedure Iterate_Headers (Message: in HTTP_Message; Process: not null access procedure (Field, Value: in String)); -- Invokes Process for each header, in an arbitrary order. ------------------ -- HTTP_Request -- ------------------ type HTTP_Request is new HTTP_Message with private; function Method (Request: HTTP_Request) return RFC_7230_7231.Request_Method; procedure Set_Method (Request: in out HTTP_Request; Method : in RFC_7230_7231.Request_Method); -- Note that extension-methods are not supported by this implementation. -- Any such methods will cause the HTTP_Request to be invalid. function Base_URI (Request: HTTP_Request) return String; procedure Set_Base_URI (Request: in out HTTP_Request; URI : in String); -- Returns/Sets the part of the RFC2396 URI containing "scheme", "authority" -- and "net_path" / "abs_path" components of the as any user and authority -- components, if given. These components may be seperatedly identified and -- stripped via specialized functions in the RFC_2396 package. Base_URI -- shall not contain any query components when set. -- -- During HTTP_Request'Read/'Input, the Query components are specially -- parsed and removed from the URI. During 'Write/'Output, any query -- components are added to the Request-Line URI automatically. -- -- Note that fragments are not supported or recognized by this -- implementation. The presence of a fragment in Set_Base_URI will cause -- Constraint_Error. For 'Input/'Read, fragments are stripped from -- HTTP_Request URIs and discarded. function Query_Count (Request: HTTP_Request) return Ada.Containers.Count_Type; -- Returns the number of queries contained in the Request procedure Clear_Queries (Request: in out HTTP_Request); -- Removes all queries from the request procedure Add_Query (Request : in out HTTP_Request; Field, Value: in String) with Pre => Query_Count (Request) < Query_Limit and Field'Length > 0; -- Adds a specified query to Request. If this exceeds the the capacity -- of Request, or if Name or Value are null strings, Constraint_Error is -- raised. -- -- Note: See the formal parameter Query_Fields_Case_Insensitive for -- details on the case handling of query Field names. -- -- Note that headers will be stored (and output) in an arbitrary order. function Query_Exists (Request: HTTP_Request; Field: String) return Boolean; -- Returns True if Field exists as a query. function Query (Request: HTTP_Request; Field: String) return String; -- Returns the Value for the given Field. If no such Query exits, -- a null String is returned. Note that a query might exist, but have -- a nil value. See Query_Exists to differentiate these cases. procedure Iterate_Queries (Request: in HTTP_Request; Process: not null access procedure (Field, Value: in String)); -- Invokes Process for each query, in an arbitrary order. procedure Write_Request (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Request: in HTTP_Request) with Pre => Request.Status = OK; procedure Read_Request (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Request: out HTTP_Request); function Input_Request (Stream: not null access Ada.Streams.Root_Stream_Type'Class) return HTTP_Request; for HTTP_Request'Write use Write_Request; for HTTP_Request'Output use Write_Request; for HTTP_Request'Read use Read_Request; for HTTP_Request'Input use Input_Request; -- Read and Input will mark the Request as invalid immediately upon receipt -- of any invalidating data, and will not continue to read the stream. -- -- Note that headers are always converted to lower-case ------------------- -- HTTP_Response -- ------------------- type HTTP_Response is new HTTP_Message with private; function Status_Code (Response: HTTP_Response) return RFC_7230_7231.Response_Status; function Reason_Phrase (Response: HTTP_Response) return String; -- Note that the Status_Phrase is limited to a maximum of 200 characters, -- and will be truncated if exceeded. procedure Set_Standard_Status (Response: in out HTTP_Response; Code : in RFC_7230_7231.Standard_Response_Status); -- Sets the response code and phrase, based on the code. Code must be -- one of the standard codes defined in RFC 7231, else Constraint_Error -- is explicitly raised (assuming predicate checking is not enabled). procedure Set_Explicit_Status (Response: in out HTTP_Response; Code : in RFC_7230_7231.Response_Status; Phrase : in String) with Pre => Phrase'Length <= 200; procedure Write_Response (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Response: in HTTP_Response); procedure Read_Response (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Response: out HTTP_Response); function Input_Response (Stream: not null access Ada.Streams.Root_Stream_Type'Class) return HTTP_Response; for HTTP_Response'Write use Write_Response; for HTTP_Response'Output use Write_Response; for HTTP_Response'Read use Read_Response; for HTTP_Response'Input use Input_Response; private package Field_Strings is new Ada.Strings.Bounded.Generic_Bounded_Length (Field_Bounds); package Value_Strings is new Ada.Strings.Bounded.Generic_Bounded_Length (Value_Bounds); package Path_Strings is new Ada.Strings.Bounded.Generic_Bounded_Length (Path_Bounds); package Phrase_Strings is new Ada.Strings.Bounded.Generic_Bounded_Length (200); ------------------ -- HTTP_Message -- ------------------ type HTTP_Header is record Field: Field_Strings.Bounded_String; Value: Value_Strings.Bounded_String; end record; function Header_Field_Hash is new Ada.Strings.Bounded.Hash (Field_Strings); function HTTP_Header_Hash (Header: HTTP_Header) return Ada.Containers.Hash_Type is (Header_Field_Hash (Header.Field)); function Equivalent_Header (Left, Right: HTTP_Header) return Boolean is (Field_Strings."=" (Left.Field, Right.Field)); package Header_Sets is new Ada.Containers.Bounded_Hashed_Sets (Element_Type => HTTP_Header, Hash => HTTP_Header_Hash, Equivalent_Elements => Equivalent_Header); Default_Header_Set_Modulus: constant Ada.Containers.Hash_Type := Header_Sets.Default_Modulus (Header_Limit); subtype Header_Set is Header_Sets.Set (Capacity => Header_Limit, Modulus => Default_Header_Set_Modulus); type HTTP_Message is abstract tagged record Status : HTTP_Message_Status; Headers: Header_Set; end record; ------------------ -- HTTP_Request -- ------------------ Default_Query_Set_Modulus: constant Ada.Containers.Hash_Type := Header_Sets.Default_Modulus (Query_Limit); subtype Query_Set is Header_Sets.Set (Capacity => Query_Limit, Modulus => Default_Query_Set_Modulus); type HTTP_Request is new HTTP_Message with record Method : RFC_7230_7231.Request_Method; URI : Path_Strings.Bounded_String; Queries : Query_Set; end record; ------------------- -- HTTP_Response -- ------------------- type HTTP_Response is new HTTP_Message with record Status_Code : RFC_7230_7231.Response_Status; Reason_Phrase: Phrase_Strings.Bounded_String; end record; end Simple_HTTP.HTTP_Message_Processor;
-- AD7203B.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT THE PREFIX OF THE 'SIZE' ATTRIBUTE CAN BE AN OBJECT, -- A TYPE, OR A SUBTYPE. -- HISTORY: -- BCB 09/27/88 CREATED ORIGINAL TEST BY MODIFYING AND RENAMING -- CD7203B.ADA. WITH SYSTEM; WITH REPORT; USE REPORT; PROCEDURE AD7203B IS TYPE I_REC IS RECORD I1, I2 : INTEGER; END RECORD; I : INTEGER; I_A : ARRAY (1 ..5) OF INTEGER; I_R : I_REC; I_SIZE : INTEGER := I'SIZE; I_A_SIZE : INTEGER := I_A'SIZE; I_R_SIZE : INTEGER := I_R'SIZE; I_A_1_SIZE : INTEGER := I_A(1)'SIZE; I_R_I1_SIZE : INTEGER := I_R.I1'SIZE; TYPE FIXED IS DELTA 0.01 RANGE -1.0 .. 1.0; TYPE FXD_REC IS RECORD FXD1, FXD2 : FIXED; END RECORD; FXD : FIXED; FXD_A : ARRAY (1 .. 5) OF FIXED; FXD_R : FXD_REC; FXD_SIZE : INTEGER := FXD'SIZE; FXD_A_SIZE : INTEGER := FXD_A'SIZE; FXD_R_SIZE : INTEGER := FXD_R'SIZE; FXD_A_1_SIZE : INTEGER := FXD_A(1)'SIZE; FXD_R_FXD1_SIZE : INTEGER := FXD_R.FXD1'SIZE; TYPE FLT_REC IS RECORD FLT1, FLT2 : FLOAT; END RECORD; FLT : FLOAT; FLT_A : ARRAY (1 .. 5) OF FLOAT; FLT_R : FLT_REC; FLT_SIZE : INTEGER := FLT'SIZE; FLT_A_SIZE : INTEGER := FLT_A'SIZE; FLT_R_SIZE : INTEGER := FLT_R'SIZE; FLT_A_1_SIZE : INTEGER := FLT_A(1)'SIZE; FLT_R_FLT1_SIZE : INTEGER := FLT_R.FLT1'SIZE; SUBTYPE TINY_INT IS INTEGER RANGE 0 .. 255; TYPE TI_REC IS RECORD TI1, TI2 : TINY_INT; END RECORD; TI : TINY_INT; TI_A : ARRAY (1 .. 5) OF TINY_INT; TI_R : TI_REC; TINY_INT_SIZE : INTEGER := TINY_INT'SIZE; TI_SIZE : INTEGER := TI'SIZE; TI_A_SIZE : INTEGER := TI_A'SIZE; TI_R_SIZE : INTEGER := TI_R'SIZE; TI_A_1_SIZE : INTEGER := TI_A(1)'SIZE; TI_R_TI1_SIZE : INTEGER := TI_R.TI1'SIZE; TYPE STR IS ARRAY (TINY_INT RANGE <>) OF CHARACTER; TYPE STR_2 IS ARRAY (1 .. 127) OF CHARACTER; TYPE STR_REC IS RECORD S1, S2 : STR (TINY_INT'FIRST .. TINY_INT'LAST); END RECORD; S : STR (TINY_INT'FIRST .. TINY_INT'LAST); S_A : ARRAY (1 .. 5) OF STR (TINY_INT'FIRST .. TINY_INT'LAST); S_R : STR_REC; STR_2_SIZE : INTEGER := STR_2'SIZE; S_SIZE : INTEGER := S'SIZE; S_A_SIZE : INTEGER := S_A'SIZE; S_R_SIZE : INTEGER := S_R'SIZE; S_A_1_SIZE : INTEGER := S_A(1)'SIZE; S_R_S1_SIZE : INTEGER := S_R.S1'SIZE; TYPE C_REC IS RECORD C1, C2 : CHARACTER; END RECORD; C : CHARACTER; C_A : ARRAY (1 .. 5) OF CHARACTER; C_R : C_REC; C_SIZE : INTEGER := C'SIZE; C_A_SIZE : INTEGER := C_A'SIZE; C_R_SIZE : INTEGER := C_R'SIZE; C_A_1_SIZE : INTEGER := C_A(1)'SIZE; C_R_C1_SIZE : INTEGER := C_R.C1'SIZE; TYPE B_REC IS RECORD B1, B2 : BOOLEAN; END RECORD; B : BOOLEAN; B_A : ARRAY (1 .. 5) OF BOOLEAN; B_R : B_REC; B_SIZE : INTEGER := B'SIZE; B_A_SIZE : INTEGER := B_A'SIZE; B_R_SIZE : INTEGER := B_R'SIZE; B_A_1_SIZE : INTEGER := B_A(1)'SIZE; B_R_B1_SIZE : INTEGER := B_R.B1'SIZE; TYPE DISCR IS RANGE 1 .. 2; TYPE DISCR_REC (D : DISCR := 1) IS RECORD CASE D IS WHEN 1 => C1_I : INTEGER; WHEN 2 => C2_I1 : INTEGER; C2_I2 : INTEGER; END CASE; END RECORD; DR_UC : DISCR_REC; DR_C : DISCR_REC (2); DR_A : ARRAY (1 .. 5) OF DISCR_REC; DR_UC_SIZE : INTEGER := DR_UC'SIZE; DR_C_SIZE : INTEGER := DR_C'SIZE; DR_A_SIZE : INTEGER := DR_A'SIZE; DR_UC_C1_I_SIZE : INTEGER := DR_UC.C1_I'SIZE; DR_A_1_SIZE : INTEGER := DR_A(1)'SIZE; TYPE ENUM IS (E1, E2, E3, E4); TYPE ENUM_REC IS RECORD E1, E2 : ENUM; END RECORD; E : ENUM; E_A : ARRAY (1 .. 5) OF ENUM; E_R : ENUM_REC; E_SIZE : INTEGER := E'SIZE; E_A_SIZE : INTEGER := E_A'SIZE; E_R_SIZE : INTEGER := E_R'SIZE; E_A_1_SIZE : INTEGER := E_A(1)'SIZE; E_R_E1_SIZE : INTEGER := E_R.E1'SIZE; TASK TYPE TSK IS END TSK; TYPE TSK_REC IS RECORD TSK1, TSK2 : TSK; END RECORD; T : TSK; T_A : ARRAY (1 .. 5) OF TSK; T_R : TSK_REC; T_SIZE : INTEGER := T'SIZE; T_A_SIZE : INTEGER := T_A'SIZE; T_R_SIZE : INTEGER := T_R'SIZE; T_A_1_SIZE : INTEGER := T_A(1)'SIZE; T_R_TSK1_SIZE : INTEGER := T_R.TSK1'SIZE; TYPE ACC IS ACCESS INTEGER; TYPE ACC_REC IS RECORD A1, A2 : ACC; END RECORD; A : ACC; A_A : ARRAY (1 .. 5) OF ACC; A_R : ACC_REC; A_SIZE : INTEGER := A'SIZE; A_A_SIZE : INTEGER := A_A'SIZE; A_R_SIZE : INTEGER := A_R'SIZE; A_A_1_SIZE : INTEGER := A_A(1)'SIZE; A_R_A1_SIZE : INTEGER := A_R.A1'SIZE; PACKAGE PK IS TYPE PRV IS PRIVATE; TYPE PRV_REC IS RECORD P1, P2 : PRV; END RECORD; TYPE LPRV IS LIMITED PRIVATE; TYPE LPRV_REC IS RECORD LP1, LP2 : LPRV; END RECORD; PRIVATE TYPE PRV IS NEW INTEGER; TYPE LPRV IS NEW INTEGER; END PK; USE PK; P : PRV; P_A : ARRAY (1 .. 5) OF PRV; P_R : PRV_REC; P_SIZE : INTEGER := P'SIZE; P_A_SIZE : INTEGER := P_A'SIZE; P_R_SIZE : INTEGER := P_R'SIZE; P_A_1_SIZE : INTEGER := P_A(1)'SIZE; P_R_P1_SIZE : INTEGER := P_R.P1'SIZE; LP : LPRV; LP_A : ARRAY (1 .. 5) OF LPRV; LP_R : LPRV_REC; LP_SIZE : INTEGER := LP'SIZE; LP_A_SIZE : INTEGER := LP_A'SIZE; LP_R_SIZE : INTEGER := LP_R'SIZE; LP_A_1_SIZE : INTEGER := LP_A(1)'SIZE; LP_R_LP1_SIZE : INTEGER := LP_R.LP1'SIZE; TASK BODY TSK IS BEGIN NULL; END TSK; BEGIN TEST ("AD7203B", "CHECK THAT THE PREFIX OF THE 'SIZE' ATTRIBUTE " & "CAN BE AN OBJECT, A TYPE, OR A SUBTYPE"); RESULT; END AD7203B;
------------------------------------------------------------------------------ -- -- -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- A D A . I N T E R R U P T S . N A M E S -- -- -- -- S p e c -- -- -- -- $Revision$ -- -- -- Copyright (C) 1991-2001 Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 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. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the VxWorks version of this package. -- -- The following signals are reserved by the run time: -- -- SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGABRT -- -- The pragma Unreserve_All_Interrupts affects the following signal(s): -- -- none -- This target-dependent package spec contains names of interrupts -- supported by the local system. with System.OS_Interface; with System.VxWorks; package Ada.Interrupts.Names is subtype Hardware_Interrupts is Interrupt_ID range Interrupt_ID'First .. System.OS_Interface.Max_HW_Interrupt; -- Range of values that can be used for hardware interrupts. -- The following constants can be used for software interrupts mapped to -- user-level signals: SIGHUP : constant Interrupt_ID; -- hangup SIGINT : constant Interrupt_ID; -- interrupt SIGQUIT : constant Interrupt_ID; -- quit SIGILL : constant Interrupt_ID; -- illegal instruction (not reset) SIGTRAP : constant Interrupt_ID; -- trace trap (not reset) SIGIOT : constant Interrupt_ID; -- IOT instruction SIGABRT : constant Interrupt_ID; -- used by abort, replace SIGIOT SIGEMT : constant Interrupt_ID; -- EMT instruction SIGFPE : constant Interrupt_ID; -- floating point exception SIGKILL : constant Interrupt_ID; -- kill (cannot be caught or ignored) SIGBUS : constant Interrupt_ID; -- bus error SIGSEGV : constant Interrupt_ID; -- segmentation violation SIGSYS : constant Interrupt_ID; -- bad argument to system call SIGPIPE : constant Interrupt_ID; -- no one to read it SIGALRM : constant Interrupt_ID; -- alarm clock SIGTERM : constant Interrupt_ID; -- software termination signal from kill SIGURG : constant Interrupt_ID; -- urgent condition on IO channel SIGSTOP : constant Interrupt_ID; -- stop (cannot be caught or ignored) SIGTSTP : constant Interrupt_ID; -- user stop requested from tty SIGCONT : constant Interrupt_ID; -- stopped process has been continued SIGCHLD : constant Interrupt_ID; -- child status change SIGTTIN : constant Interrupt_ID; -- background tty read attempted SIGTTOU : constant Interrupt_ID; -- background tty write attempted SIGIO : constant Interrupt_ID; -- input/output possible, SIGXCPU : constant Interrupt_ID; -- CPU time limit exceeded SIGXFSZ : constant Interrupt_ID; -- filesize limit exceeded SIGVTALRM : constant Interrupt_ID; -- virtual timer expired SIGPROF : constant Interrupt_ID; -- profiling timer expired SIGWINCH : constant Interrupt_ID; -- window size change SIGUSR1 : constant Interrupt_ID; -- user defined signal 1 SIGUSR2 : constant Interrupt_ID; -- user defined signal 2 private Signal_Base : constant := System.VxWorks.Num_HW_Interrupts; SIGHUP : constant Interrupt_ID := 1 + Signal_Base; SIGINT : constant Interrupt_ID := 2 + Signal_Base; SIGQUIT : constant Interrupt_ID := 3 + Signal_Base; SIGILL : constant Interrupt_ID := 4 + Signal_Base; SIGTRAP : constant Interrupt_ID := 5 + Signal_Base; SIGIOT : constant Interrupt_ID := 6 + Signal_Base; SIGABRT : constant Interrupt_ID := 6 + Signal_Base; SIGEMT : constant Interrupt_ID := 7 + Signal_Base; SIGFPE : constant Interrupt_ID := 8 + Signal_Base; SIGKILL : constant Interrupt_ID := 9 + Signal_Base; SIGBUS : constant Interrupt_ID := 10 + Signal_Base; SIGSEGV : constant Interrupt_ID := 11 + Signal_Base; SIGSYS : constant Interrupt_ID := 12 + Signal_Base; SIGPIPE : constant Interrupt_ID := 13 + Signal_Base; SIGALRM : constant Interrupt_ID := 14 + Signal_Base; SIGTERM : constant Interrupt_ID := 15 + Signal_Base; SIGURG : constant Interrupt_ID := 16 + Signal_Base; SIGSTOP : constant Interrupt_ID := 17 + Signal_Base; SIGTSTP : constant Interrupt_ID := 18 + Signal_Base; SIGCONT : constant Interrupt_ID := 19 + Signal_Base; SIGCHLD : constant Interrupt_ID := 20 + Signal_Base; SIGTTIN : constant Interrupt_ID := 21 + Signal_Base; SIGTTOU : constant Interrupt_ID := 22 + Signal_Base; SIGIO : constant Interrupt_ID := 23 + Signal_Base; SIGXCPU : constant Interrupt_ID := 24 + Signal_Base; SIGXFSZ : constant Interrupt_ID := 25 + Signal_Base; SIGVTALRM : constant Interrupt_ID := 26 + Signal_Base; SIGPROF : constant Interrupt_ID := 27 + Signal_Base; SIGWINCH : constant Interrupt_ID := 28 + Signal_Base; SIGUSR1 : constant Interrupt_ID := 30 + Signal_Base; SIGUSR2 : constant Interrupt_ID := 31 + Signal_Base; end Ada.Interrupts.Names;
-- -- 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 stdint_h is -- unsupported macro: INT8_MIN (-128) -- unsupported macro: INT16_MIN (-32767-1) -- unsupported macro: INT32_MIN (-2147483647-1) -- unsupported macro: INT64_MIN (-__INT64_C(9223372036854775807)-1) -- unsupported macro: INT8_MAX (127) -- unsupported macro: INT16_MAX (32767) -- unsupported macro: INT32_MAX (2147483647) -- unsupported macro: INT64_MAX (__INT64_C(9223372036854775807)) -- unsupported macro: UINT8_MAX (255) -- unsupported macro: UINT16_MAX (65535) -- unsupported macro: UINT32_MAX (4294967295U) -- unsupported macro: UINT64_MAX (__UINT64_C(18446744073709551615)) -- unsupported macro: INT_LEAST8_MIN (-128) -- unsupported macro: INT_LEAST16_MIN (-32767-1) -- unsupported macro: INT_LEAST32_MIN (-2147483647-1) -- unsupported macro: INT_LEAST64_MIN (-__INT64_C(9223372036854775807)-1) -- unsupported macro: INT_LEAST8_MAX (127) -- unsupported macro: INT_LEAST16_MAX (32767) -- unsupported macro: INT_LEAST32_MAX (2147483647) -- unsupported macro: INT_LEAST64_MAX (__INT64_C(9223372036854775807)) -- unsupported macro: UINT_LEAST8_MAX (255) -- unsupported macro: UINT_LEAST16_MAX (65535) -- unsupported macro: UINT_LEAST32_MAX (4294967295U) -- unsupported macro: UINT_LEAST64_MAX (__UINT64_C(18446744073709551615)) -- unsupported macro: INT_FAST8_MIN (-128) -- unsupported macro: INT_FAST16_MIN (-9223372036854775807L-1) -- unsupported macro: INT_FAST32_MIN (-9223372036854775807L-1) -- unsupported macro: INT_FAST64_MIN (-__INT64_C(9223372036854775807)-1) -- unsupported macro: INT_FAST8_MAX (127) -- unsupported macro: INT_FAST16_MAX (9223372036854775807L) -- unsupported macro: INT_FAST32_MAX (9223372036854775807L) -- unsupported macro: INT_FAST64_MAX (__INT64_C(9223372036854775807)) -- unsupported macro: UINT_FAST8_MAX (255) -- unsupported macro: UINT_FAST16_MAX (18446744073709551615UL) -- unsupported macro: UINT_FAST32_MAX (18446744073709551615UL) -- unsupported macro: UINT_FAST64_MAX (__UINT64_C(18446744073709551615)) -- unsupported macro: INTPTR_MIN (-9223372036854775807L-1) -- unsupported macro: INTPTR_MAX (9223372036854775807L) -- unsupported macro: UINTPTR_MAX (18446744073709551615UL) -- unsupported macro: INTMAX_MIN (-__INT64_C(9223372036854775807)-1) -- unsupported macro: INTMAX_MAX (__INT64_C(9223372036854775807)) -- unsupported macro: UINTMAX_MAX (__UINT64_C(18446744073709551615)) -- unsupported macro: PTRDIFF_MIN (-9223372036854775807L-1) -- unsupported macro: PTRDIFF_MAX (9223372036854775807L) -- unsupported macro: SIG_ATOMIC_MIN (-2147483647-1) -- unsupported macro: SIG_ATOMIC_MAX (2147483647) -- unsupported macro: SIZE_MAX (18446744073709551615UL) -- unsupported macro: WCHAR_MIN __WCHAR_MIN -- unsupported macro: WCHAR_MAX __WCHAR_MAX -- unsupported macro: WINT_MIN (0u) -- unsupported macro: WINT_MAX (4294967295u) -- arg-macro: procedure INT8_C (c) -- c -- arg-macro: procedure INT16_C (c) -- c -- arg-macro: procedure INT32_C (c) -- c -- unsupported macro: INT64_C(c) c ## L -- arg-macro: procedure UINT8_C (c) -- c -- arg-macro: procedure UINT16_C (c) -- c -- unsupported macro: UINT32_C(c) c ## U -- unsupported macro: UINT64_C(c) c ## UL -- unsupported macro: INTMAX_C(c) c ## L -- unsupported macro: UINTMAX_C(c) c ## UL subtype int8_t is signed_char; -- /usr/include/stdint.h:36 subtype int16_t is short; -- /usr/include/stdint.h:37 subtype int32_t is int; -- /usr/include/stdint.h:38 subtype int64_t is long; -- /usr/include/stdint.h:40 subtype uint8_t is unsigned_char; -- /usr/include/stdint.h:48 subtype uint16_t is unsigned_short; -- /usr/include/stdint.h:49 subtype uint32_t is unsigned; -- /usr/include/stdint.h:51 subtype uint64_t is unsigned_long; -- /usr/include/stdint.h:55 subtype int_least8_t is signed_char; -- /usr/include/stdint.h:65 subtype int_least16_t is short; -- /usr/include/stdint.h:66 subtype int_least32_t is int; -- /usr/include/stdint.h:67 subtype int_least64_t is long; -- /usr/include/stdint.h:69 subtype uint_least8_t is unsigned_char; -- /usr/include/stdint.h:76 subtype uint_least16_t is unsigned_short; -- /usr/include/stdint.h:77 subtype uint_least32_t is unsigned; -- /usr/include/stdint.h:78 subtype uint_least64_t is unsigned_long; -- /usr/include/stdint.h:80 subtype int_fast8_t is signed_char; -- /usr/include/stdint.h:90 subtype int_fast16_t is long; -- /usr/include/stdint.h:92 subtype int_fast32_t is long; -- /usr/include/stdint.h:93 subtype int_fast64_t is long; -- /usr/include/stdint.h:94 subtype uint_fast8_t is unsigned_char; -- /usr/include/stdint.h:103 subtype uint_fast16_t is unsigned_long; -- /usr/include/stdint.h:105 subtype uint_fast32_t is unsigned_long; -- /usr/include/stdint.h:106 subtype uint_fast64_t is unsigned_long; -- /usr/include/stdint.h:107 subtype intptr_t is long; -- /usr/include/stdint.h:119 subtype uintptr_t is unsigned_long; -- /usr/include/stdint.h:122 subtype intmax_t is long; -- /usr/include/stdint.h:134 subtype uintmax_t is unsigned_long; -- /usr/include/stdint.h:135 end stdint_h;
with BDD.Asserts; use BDD.Asserts; package body RTCH.Colours.Steps is procedure Given_Colour_C (Red, Green, Blue : Float) is begin C := Make_Colour (Red, Green, Blue); end Given_Colour_C; procedure Then_C_Red_Is (Red : Float) is begin Assert (C.Red = Red); end Then_C_Red_Is; procedure And_C_Green_Is (Green : Float) is begin Assert (C.Green = Green); end And_C_Green_Is; procedure And_C_Blue_Is (Blue : Float) is begin Assert (C.Blue = Blue); end And_C_Blue_Is; procedure Given_Colour_C1 (Red, Green, Blue : Float) is begin C1 := Make_Colour (Red, Green, Blue); end Given_Colour_C1; procedure Given_Colour_C2 (Red, Green, Blue : Float) is begin C2 := Make_Colour (Red, Green, Blue); end Given_Colour_C2; procedure Then_C1_Add_C2_Is_Colour (Red, Green, Blue : Float) is begin Assert (C1 + C2 = Make_Colour (Red, Green, Blue)); end Then_C1_Add_C2_Is_Colour; procedure Then_C1_Sub_C2_Is_Colour (Red, Green, Blue : Float) is begin Assert (C1 - C2 = Make_Colour (Red, Green, Blue)); end Then_C1_Sub_C2_Is_Colour; procedure Then_C_Times_Scalar_Is_Colour (Scalar, Red, Green, Blue : Float) is begin Assert (C * Scalar = Make_Colour (Red, Green, Blue)); end Then_C_Times_Scalar_Is_Colour; procedure Then_C1_Times_C2_Is_Colour (Red, Green, Blue : Float) is begin Assert (C1 * C2 = Make_Colour (Red, Green, Blue)); end Then_C1_Times_C2_Is_Colour; end RTCH.Colours.Steps;
with Ada.Text_IO; use Ada.Text_IO; procedure Lunch is -- Enumeration type type Lunch_Spot_t is (WS, Nine, Home); type Day_t is (Sun, Mon, Tue, Wed, Thu, Fri, Sat); -- Subtype Weekday_t is a constrained Day_t subtype Weekday_t is Day_t range Mon .. Fri; -- Declaring a fixed-size array Where_To_Eat : array(Day_t) of Lunch_Spot_t; begin -- Array is the same size as number of Day_t values Where_To_Eat := (Home, Nine, WS, Nine, WS, Nine, Home); -- Can loop over a fixed-size array, or over a type/subtype itself for Day in Weekday_t loop case Where_To_Eat (Day) is when Home => Put_Line("Eating at home."); when Nine => Put_Line("Eating on 9."); when WS => Put_Line("Eating at Wise Sons"); -- case statement must include all cases end case; end loop; end Lunch;
with Licensing_Raw; package Licensing with Preelaborate is type Licenses is new Licensing_Raw.Licenses; end Licensing;
procedure Exit_Statement is begin Loop_1 : loop exit; exit when True; exit Loop_1; end loop Loop_1; end Exit_Statement;
with Ada.Text_IO; use Ada.Text_IO; procedure Long_Division is package Int_IO is new Ada.Text_IO.Integer_IO (Integer); use Int_IO; type Degrees is range -1 .. Integer'Last; subtype Valid_Degrees is Degrees range 0 .. Degrees'Last; type Polynom is array (Valid_Degrees range <>) of Integer; function Degree (P : Polynom) return Degrees is begin for I in reverse P'Range loop if P (I) /= 0 then return I; end if; end loop; return -1; end Degree; function Shift_Right (P : Polynom; D : Valid_Degrees) return Polynom is Result : Polynom (0 .. P'Last + D) := (others => 0); begin Result (Result'Last - P'Length + 1 .. Result'Last) := P; return Result; end Shift_Right; function "*" (Left : Polynom; Right : Integer) return Polynom is Result : Polynom (Left'Range); begin for I in Result'Range loop Result (I) := Left (I) * Right; end loop; return Result; end "*"; function "-" (Left, Right : Polynom) return Polynom is Result : Polynom (Left'Range); begin for I in Result'Range loop if I in Right'Range then Result (I) := Left (I) - Right (I); else Result (I) := Left (I); end if; end loop; return Result; end "-"; procedure Poly_Long_Division (Num, Denom : Polynom; Q, R : out Polynom) is N : Polynom := Num; D : Polynom := Denom; begin if Degree (D) < 0 then raise Constraint_Error; end if; Q := (others => 0); while Degree (N) >= Degree (D) loop declare T : Polynom := Shift_Right (D, Degree (N) - Degree (D)); begin Q (Degree (N) - Degree (D)) := N (Degree (N)) / T (Degree (T)); T := T * Q (Degree (N) - Degree (D)); N := N - T; end; end loop; R := N; end Poly_Long_Division; procedure Output (P : Polynom) is First : Boolean := True; begin for I in reverse P'Range loop if P (I) /= 0 then if First then First := False; else Put (" + "); end if; if I > 0 then if P (I) /= 1 then Put (P (I), 0); Put ("*"); end if; Put ("x"); if I > 1 then Put ("^"); Put (Integer (I), 0); end if; elsif P (I) /= 0 then Put (P (I), 0); end if; end if; end loop; New_Line; end Output; Test_N : constant Polynom := (0 => -42, 1 => 0, 2 => -12, 3 => 1); Test_D : constant Polynom := (0 => -3, 1 => 1); Test_Q : Polynom (Test_N'Range); Test_R : Polynom (Test_N'Range); begin Poly_Long_Division (Test_N, Test_D, Test_Q, Test_R); Put_Line ("Dividing Polynoms:"); Put ("N: "); Output (Test_N); Put ("D: "); Output (Test_D); Put_Line ("-------------------------"); Put ("Q: "); Output (Test_Q); Put ("R: "); Output (Test_R); end Long_Division;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- System.Atomic_Operations.Modular_Arithmetic -- -- -- -- B o d y -- -- -- -- Copyright (C) 2019-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with System.Atomic_Primitives; use System.Atomic_Primitives; with System.Atomic_Operations.Exchange; with Interfaces.C; use Interfaces; package body System.Atomic_Operations.Modular_Arithmetic is package Exchange is new System.Atomic_Operations.Exchange (Atomic_Type); ---------------- -- Atomic_Add -- ---------------- procedure Atomic_Add (Item : aliased in out Atomic_Type; Value : Atomic_Type) is Ignore : constant Atomic_Type := Atomic_Fetch_And_Add (Item, Value); begin null; end Atomic_Add; --------------------- -- Atomic_Subtract -- --------------------- procedure Atomic_Subtract (Item : aliased in out Atomic_Type; Value : Atomic_Type) is Ignore : constant Atomic_Type := Atomic_Fetch_And_Subtract (Item, Value); begin null; end Atomic_Subtract; -------------------------- -- Atomic_Fetch_And_Add -- -------------------------- function Atomic_Fetch_And_Add (Item : aliased in out Atomic_Type; Value : Atomic_Type) return Atomic_Type is pragma Warnings (Off); function Atomic_Fetch_Add_1 (Ptr : System.Address; Val : Atomic_Type; Model : Mem_Model := Seq_Cst) return Atomic_Type; pragma Import (Intrinsic, Atomic_Fetch_Add_1, "__atomic_fetch_add_1"); function Atomic_Fetch_Add_2 (Ptr : System.Address; Val : Atomic_Type; Model : Mem_Model := Seq_Cst) return Atomic_Type; pragma Import (Intrinsic, Atomic_Fetch_Add_2, "__atomic_fetch_add_2"); function Atomic_Fetch_Add_4 (Ptr : System.Address; Val : Atomic_Type; Model : Mem_Model := Seq_Cst) return Atomic_Type; pragma Import (Intrinsic, Atomic_Fetch_Add_4, "__atomic_fetch_add_4"); function Atomic_Fetch_Add_8 (Ptr : System.Address; Val : Atomic_Type; Model : Mem_Model := Seq_Cst) return Atomic_Type; pragma Import (Intrinsic, Atomic_Fetch_Add_8, "__atomic_fetch_add_8"); pragma Warnings (On); begin -- Use the direct intrinsics when possible, and fallback to -- compare-and-exchange otherwise. -- Also suppress spurious warnings. pragma Warnings (Off); if Atomic_Type'Base'Last = Atomic_Type'Last and then Atomic_Type'First = 0 and then Atomic_Type'Last in 2 ** 8 - 1 | 2 ** 16 - 1 | 2 ** 32 - 1 | 2 ** 64 - 1 then pragma Warnings (On); case Unsigned_64 (Atomic_Type'Last) is when 2 ** 8 - 1 => return Atomic_Fetch_Add_1 (Item'Address, Value); when 2 ** 16 - 1 => return Atomic_Fetch_Add_2 (Item'Address, Value); when 2 ** 32 - 1 => return Atomic_Fetch_Add_4 (Item'Address, Value); when 2 ** 64 - 1 => return Atomic_Fetch_Add_8 (Item'Address, Value); when others => raise Program_Error; end case; else declare Old_Value : aliased Atomic_Type := Item; New_Value : Atomic_Type := Old_Value + Value; begin -- Keep iterating until the exchange succeeds while not Exchange.Atomic_Compare_And_Exchange (Item, Old_Value, New_Value) loop New_Value := Old_Value + Value; end loop; return Old_Value; end; end if; end Atomic_Fetch_And_Add; ------------------------------- -- Atomic_Fetch_And_Subtract -- ------------------------------- function Atomic_Fetch_And_Subtract (Item : aliased in out Atomic_Type; Value : Atomic_Type) return Atomic_Type is pragma Warnings (Off); function Atomic_Fetch_Sub_1 (Ptr : System.Address; Val : Atomic_Type; Model : Mem_Model := Seq_Cst) return Atomic_Type; pragma Import (Intrinsic, Atomic_Fetch_Sub_1, "__atomic_fetch_sub_1"); function Atomic_Fetch_Sub_2 (Ptr : System.Address; Val : Atomic_Type; Model : Mem_Model := Seq_Cst) return Atomic_Type; pragma Import (Intrinsic, Atomic_Fetch_Sub_2, "__atomic_fetch_sub_2"); function Atomic_Fetch_Sub_4 (Ptr : System.Address; Val : Atomic_Type; Model : Mem_Model := Seq_Cst) return Atomic_Type; pragma Import (Intrinsic, Atomic_Fetch_Sub_4, "__atomic_fetch_sub_4"); function Atomic_Fetch_Sub_8 (Ptr : System.Address; Val : Atomic_Type; Model : Mem_Model := Seq_Cst) return Atomic_Type; pragma Import (Intrinsic, Atomic_Fetch_Sub_8, "__atomic_fetch_sub_8"); pragma Warnings (On); begin -- Use the direct intrinsics when possible, and fallback to -- compare-and-exchange otherwise. -- Also suppress spurious warnings. pragma Warnings (Off); if Atomic_Type'Base'Last = Atomic_Type'Last and then Atomic_Type'First = 0 and then Atomic_Type'Last in 2 ** 8 - 1 | 2 ** 16 - 1 | 2 ** 32 - 1 | 2 ** 64 - 1 then pragma Warnings (On); case Unsigned_64 (Atomic_Type'Last) is when 2 ** 8 - 1 => return Atomic_Fetch_Sub_1 (Item'Address, Value); when 2 ** 16 - 1 => return Atomic_Fetch_Sub_2 (Item'Address, Value); when 2 ** 32 - 1 => return Atomic_Fetch_Sub_4 (Item'Address, Value); when 2 ** 64 - 1 => return Atomic_Fetch_Sub_8 (Item'Address, Value); when others => raise Program_Error; end case; else declare Old_Value : aliased Atomic_Type := Item; New_Value : Atomic_Type := Old_Value - Value; begin -- Keep iterating until the exchange succeeds while not Exchange.Atomic_Compare_And_Exchange (Item, Old_Value, New_Value) loop New_Value := Old_Value - Value; end loop; return Old_Value; end; end if; end Atomic_Fetch_And_Subtract; ------------------ -- Is_Lock_Free -- ------------------ function Is_Lock_Free (Item : aliased Atomic_Type) return Boolean is pragma Unreferenced (Item); use type Interfaces.C.size_t; begin return Boolean (Atomic_Always_Lock_Free (Atomic_Type'Object_Size / 8)); end Is_Lock_Free; end System.Atomic_Operations.Modular_Arithmetic;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- M L I B -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1999-2001, Ada Core Technologies, 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. -- -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ with Ada.Characters.Handling; use Ada.Characters.Handling; with Opt; with Osint; use Osint; with Output; use Output; with MLib.Utl; package body MLib is package Tools renames MLib.Utl; ------------------- -- Build_Library -- ------------------- procedure Build_Library (Ofiles : Argument_List; Afiles : Argument_List; Output_File : String; Output_Dir : String) is use GNAT.OS_Lib; begin if not Opt.Quiet_Output then Write_Line ("building a library..."); Write_Str (" make "); Write_Line (Output_File); end if; Tools.Ar (Output_Dir & "/lib" & Output_File & ".a", Objects => Ofiles); end Build_Library; ------------------------ -- Check_Library_Name -- ------------------------ procedure Check_Library_Name (Name : String) is begin if Name'Length = 0 then Fail ("library name cannot be empty"); end if; if Name'Length > Max_Characters_In_Library_Name then Fail ("illegal library name """, Name, """: too long"); end if; if not Is_Letter (Name (Name'First)) then Fail ("illegal library name """, Name, """: should start with a letter"); end if; for Index in Name'Range loop if not Is_Alphanumeric (Name (Index)) then Fail ("illegal library name """, Name, """: should include only letters and digits"); end if; end loop; end Check_Library_Name; end MLib;
-- { dg-do run } procedure BIP_Aggregate_Bug is package Limited_Types is type Lim_Tagged is tagged limited record Root_Comp : Integer; end record; type Lim_Ext is new Lim_Tagged with record Ext_Comp : Integer; end record; function Func_Lim_Tagged (Choice : Integer) return Lim_Tagged'Class; end Limited_Types; package body Limited_Types is function Func_Lim_Tagged (Choice : Integer) return Lim_Tagged'Class is begin case Choice is when 111 => return Lim_Ext'(Root_Comp => Choice, Ext_Comp => Choice); when 222 => return Result : Lim_Tagged'Class := Lim_Ext'(Root_Comp => Choice, Ext_Comp => Choice); when others => return Lim_Tagged'(Root_Comp => Choice); end case; end Func_Lim_Tagged; end Limited_Types; use Limited_Types; LT_Root : Lim_Tagged'Class := Func_Lim_Tagged (Choice => 999); LT_Ext1 : Lim_Tagged'Class := Func_Lim_Tagged (Choice => 111); LT_Ext2 : Lim_Tagged'Class := Func_Lim_Tagged (Choice => 222); begin if LT_Root.Root_Comp /= 999 or else Lim_Ext (LT_Ext1).Ext_Comp /= 111 or else Lim_Ext (LT_Ext2).Ext_Comp /= 222 then raise Program_Error; end if; end BIP_Aggregate_Bug;
with Libadalang.Analysis; use Libadalang.Analysis; with Rejuvenation.Navigation; use Rejuvenation.Navigation; with Rewriters; use Rewriters; package Rewriters_Minimal_Parentheses is type Rewriter_Minimal_Parentheses is new Rewriter with private; overriding function Rewrite (RMP : Rewriter_Minimal_Parentheses; Node : Ada_Node'Class; Top_Level : Boolean := True) return String; overriding function Rewrite_Context (RMP : Rewriter_Minimal_Parentheses; Node : Ada_Node'Class) return Ada_Node with Post => Is_Reflexive_Ancestor (Rewrite_Context'Result, Node); function Make_Rewriter_Minimal_Parentheses return Rewriter_Minimal_Parentheses; private type Rewriter_Minimal_Parentheses is new Rewriter with null record; function Make_Rewriter_Minimal_Parentheses return Rewriter_Minimal_Parentheses is (Rewriter with null record); end Rewriters_Minimal_Parentheses;
-- { dg-do run } with Init9; use Init9; with Ada.Numerics; use Ada.Numerics; with Text_IO; use Text_IO; with Dump; procedure T9 is Local_R1 : R1; Local_R2 : R2; begin Local_R1.F := My_R1.F + 1.0; Put ("Local_R1 :"); Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements); New_Line; -- { dg-output "Local_R1 : 8c 16 22 aa fd 90 10 40.*\n" } Local_R2.F := My_R2.F + 1.0; Put ("Local_R2 :"); Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements); New_Line; -- { dg-output "Local_R2 : 40 10 90 fd aa 22 16 8c.*\n" } Local_R1.F := Pi; Put ("Local_R1 :"); Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements); New_Line; -- { dg-output "Local_R1 : 18 2d 44 54 fb 21 09 40.*\n" } Local_R2.F := Pi; Put ("Local_R2 :"); Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements); New_Line; -- { dg-output "Local_R2 : 40 09 21 fb 54 44 2d 18.*\n" } Local_R1.F := Local_R1.F + 1.0; Put ("Local_R1 :"); Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements); New_Line; -- { dg-output "Local_R1 : 8c 16 22 aa fd 90 10 40.*\n" } Local_R2.F := Local_R2.F + 1.0; Put ("Local_R2 :"); Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements); New_Line; -- { dg-output "Local_R2 : 40 10 90 fd aa 22 16 8c.*\n" } end;
pragma SPARK_Mode; with Sparkduino; use Sparkduino; with Types; use Types; package body Zumo_Pushbutton is Zumo_Button : constant := 12; Zumo_Button_Pullup : constant PinMode := INPUT_PULLUP; Zumo_Button_Default_Pinval : constant DigPinValue := HIGH; procedure Init is begin Initd := True; SetPinMode (Pin => Zumo_Button, Mode => PinMode'Pos (Zumo_Button_Pullup)); DelayMicroseconds (Time => 5); end Init; function IsPressed return Boolean is begin return DigitalRead (Pin => Zumo_Button) /= DigPinValue'Pos (Zumo_Button_Default_Pinval); end IsPressed; procedure WaitForPress is begin loop while not IsPressed loop null; end loop; SysDelay (Time => 10); exit when IsPressed; end loop; end WaitForPress; procedure WaitForRelease is begin loop while IsPressed loop null; end loop; SysDelay (Time => 10); exit when not IsPressed; end loop; end WaitForRelease; procedure WaitForButton is begin WaitForPress; WaitForRelease; end WaitForButton; end Zumo_Pushbutton;
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Declarations; with Program.Elements.Defining_Identifiers; with Program.Lexical_Elements; with Program.Elements.Expressions; package Program.Elements.Generalized_Iterator_Specifications is pragma Pure (Program.Elements.Generalized_Iterator_Specifications); type Generalized_Iterator_Specification is limited interface and Program.Elements.Declarations.Declaration; type Generalized_Iterator_Specification_Access is access all Generalized_Iterator_Specification'Class with Storage_Size => 0; not overriding function Name (Self : Generalized_Iterator_Specification) return not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access is abstract; not overriding function Iterator_Name (Self : Generalized_Iterator_Specification) return not null Program.Elements.Expressions.Expression_Access is abstract; not overriding function Has_Reverse (Self : Generalized_Iterator_Specification) return Boolean is abstract; type Generalized_Iterator_Specification_Text is limited interface; type Generalized_Iterator_Specification_Text_Access is access all Generalized_Iterator_Specification_Text'Class with Storage_Size => 0; not overriding function To_Generalized_Iterator_Specification_Text (Self : in out Generalized_Iterator_Specification) return Generalized_Iterator_Specification_Text_Access is abstract; not overriding function In_Token (Self : Generalized_Iterator_Specification_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Reverse_Token (Self : Generalized_Iterator_Specification_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Generalized_Iterator_Specifications;
with NRF52_DK.Time; use NRF52_DK.Time; with HAL; use HAL; package body sensor is function Distance(TrigPin, EchoPin : NRF52_DK.IOs.Pin_Id) return Float is TimeNow : Time_Ms; --Maximum distance of sensor is 400cm = 23200uS. We add a 1ms margin on top of that DeadlineMicroseconds : constant Integer := 5800; Duration_Result : Time_Ms; Pulse : Boolean; DistanceLimit : constant Float := 100.0; begin TimeNow := NRF52_DK.Time.Clock; NRF52_DK.IOs.Set(TrigPin, False); NRF52_DK.Time.Delay_Ms(UInt64 (2 / 1000)); NRF52_DK.IOs.Set(TrigPin, True); NRF52_DK.Time.Delay_Ms (UInt64 (2 / 1000)); NRF52_DK.IOs.Set(TrigPin, False); --There must be no interrupts between these parts. Pulse := NRF52_DK.IOs.Set(EchoPin); while Pulse = NRF52_DK.IOs.Set(EchoPin) loop --Wait for the analog signal to change from low - high or high - low null; end loop; Duration_Result := (NRF52_DK.Time.Clock - TimeNow); return (Float(Duration_Result) / 58.0) * 1000000.0; -- https://github.com/gamegine/HCSR04-ultrasonic-sensor-lib/blob/master/src/HCSR04.cpp return -1.0; --Something went wrong if we end up here! end Distance; end sensor;
-- Based on AdaCore's Ada Drivers Library, -- see https://github.com/AdaCore/Ada_Drivers_Library, -- checkout 93b5f269341f970698af18f9182fac82a0be66c3. -- Copyright (C) Adacore -- -- Institution: Technische Universität München -- Department: Real-Time Computer Systems (RCS) -- Project: StratoX -- Authors: Martin Becker (becker@rcs.ei.tum.de) with Ada.Interrupts.Names; with STM32.GPIO; with STM32.DMA; use STM32.DMA; with STM32.Device; use STM32.Device; with STM32_SVD.SDIO; -- @summary -- Mapping of system resources for Pixracer V1 -- -- based on https://raw.githubusercontent.com/AdaCore/Ada_Drivers_Library/ -- master/examples/sdcard/src/stm32f7/device_sd_configuration.ads. package Media_Reader.SDCard.Config is SD_Pins : constant STM32.GPIO.GPIO_Points := (PC8, PC9, PC10, PC11, PC12, PD2); -- manual: 8x data, 1xCK, 1x CMD -- PC8=D0, PC9=D1, PC10=D2, PC11=D3, PC12=CK, PD2=CMD --SD_Detect_Pin : constant STM32.GPIO.GPIO_Point := PC11; -- no card detect pin on pixracer -- DMA: DMA2 (Stream 3 or Stream 6) with Channel4 SD_DMA : DMA_Controller renames DMA_2; SD_DMA_Rx_Channel : constant DMA_Channel_Selector := Channel_4; SD_DMA_Rx_Stream : constant DMA_Stream_Selector := Stream_3; Rx_IRQ : Ada.Interrupts.Interrupt_ID renames Ada.Interrupts.Names.DMA2_Stream3_Interrupt; SD_DMA_Tx_Channel : constant DMA_Channel_Selector := Channel_4; SD_DMA_Tx_Stream : constant DMA_Stream_Selector := Stream_6; Tx_IRQ : Ada.Interrupts.Interrupt_ID renames Ada.Interrupts.Names.DMA2_Stream6_Interrupt; SD_Interrupt : Ada.Interrupts.Interrupt_ID renames Ada.Interrupts.Names.SDIO_Interrupt; SD_Device : STM32_SVD.SDIO.SDIO_Peripheral renames STM32_SVD.SDIO.SDIO_Periph; procedure Enable_Clock_Device; procedure Reset_Device; end Media_Reader.SDCard.Config;
-- Package: Semaphores package Semaphores is protected type CountingSemaphore(Max: Natural; Initial: Natural) is entry Wait; entry Signal; private Count : Natural := Initial; --number of keys available MaxCount : Natural := Max; --total number of keys end CountingSemaphore; end Semaphores;
------------------------------------------------------------------------------ -- Copyright (c) 2013-2015, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ with Natools.S_Expressions.Parsers; package body Natools.S_Expressions.Test_Tools is Hex_Digits : constant String := "0123456789ABCDEF"; function Encode_Hex (Value : Offset; Length : Positive) return String; function Hex_Slice (Address : Offset; Address_Length : Positive; Data : Atom; Width : Positive) return String; function Is_Printable (Data : Octet) return Boolean; function Is_Printable (Data : Atom) return Boolean; -- Return whether Data can be dumped directed as a String or Character ------------------------------ -- Local Helper Subprograms -- ------------------------------ function Encode_Hex (Value : Offset; Length : Positive) return String is I : Natural := Length; Digit : Natural; Current : Offset := Value; begin return Result : String (1 .. Length) := (others => '0') do while Current /= 0 and I /= 0 loop Digit := Natural (Current mod 16); Result (I) := Hex_Digits (Hex_Digits'First + Digit); I := I - 1; Current := Current / 16; end loop; end return; end Encode_Hex; function Hex_Slice (Address : Offset; Address_Length : Positive; Data : Atom; Width : Positive) return String is Total_Length : constant Positive := Address_Length + 4 + 4 * Width; Hex_Start : constant Positive := Address_Length + 2; Raw_Start : constant Positive := Hex_Start + 3 * Width + 1; Digit : Octet; begin return Result : String (1 .. Total_Length) := (others => ' ') do Result (1 .. Address_Length) := Encode_Hex (Address, Address_Length); for I in 0 .. Width - 1 loop exit when Data'First + Offset (I) not in Data'Range; Digit := Data (Data'First + Offset (I)); Result (Hex_Start + 3 * I) := Hex_Digits (Hex_Digits'First + Natural (Digit / 16)); Result (Hex_Start + 3 * I + 1) := Hex_Digits (Hex_Digits'First + Natural (Digit mod 16)); if Is_Printable (Digit) then Result (Raw_Start + I) := Character'Val (Digit); else Result (Raw_Start + I) := '.'; end if; end loop; end return; end Hex_Slice; function Is_Printable (Data : Octet) return Boolean is begin return Data in 32 .. 127; end Is_Printable; function Is_Printable (Data : Atom) return Boolean is begin if Data'Length > 100 then return False; end if; for I in Data'Range loop if not Is_Printable (Data (I)) then return False; end if; end loop; return True; end Is_Printable; ------------------ -- Public Tools -- ------------------ procedure Dump_Atom (Report : in out NT.Reporter'Class; Data : in Atom; Label : in String := "") is I, Length : Offset := 0; begin if Is_Printable (Data) then if Label'Length > 0 then Report.Info (Label & ": """ & To_String (Data) & '"'); else Report.Info ('"' & To_String (Data) & '"'); end if; else if Label'Length > 0 then Report.Info (Label & ":" & Natural'Image (Data'Length) & " octets"); end if; while I < Data'Length loop Length := Offset'Min (16, Data'Length - I); Report.Info (Hex_Slice (I, 8, Data (Data'First + I .. Data'First + I + Length - 1), 16)); I := I + 16; end loop; end if; end Dump_Atom; procedure Dump_Atom -- Cut and pasted code because generics crash gnat (Test : in out NT.Test; Data : in Atom; Label : in String := "") is I, Length : Offset := 0; begin if Is_Printable (Data) then if Label'Length > 0 then Test.Info (Label & ": """ & To_String (Data) & '"'); else Test.Info ('"' & To_String (Data) & '"'); end if; else if Label'Length > 0 then Test.Info (Label & ":" & Natural'Image (Data'Length) & " octets"); end if; while I < Data'Length loop Length := Offset'Min (16, Data'Length - I); Test.Info (Hex_Slice (I, 8, Data (Data'First + I .. Data'First + I + Length - 1), 16)); I := I + 16; end loop; end if; end Dump_Atom; procedure Test_Atom (Report : in out NT.Reporter'Class; Test_Name : in String; Expected : in Atom; Found : in Atom) is begin if Found = Expected then Report.Item (Test_Name, NT.Success); else Report.Item (Test_Name, NT.Fail); Dump_Atom (Report, Found, "Found"); Dump_Atom (Report, Expected, "Expected"); end if; end Test_Atom; procedure Test_Atom (Test : in out NT.Test; Expected : in Atom; Found : in Atom) is begin if Found /= Expected then Test.Fail; Dump_Atom (Test, Found, "Found"); Dump_Atom (Test, Expected, "Expected"); end if; end Test_Atom; procedure Test_Atom_Accessors (Test : in out NT.Test; Tested : in Descriptor'Class; Expected : in Atom; Expected_Level : in Integer := -1; Context : in String := "") is Context_Given : Boolean := Context = ""; procedure Fail_With_Context; procedure Fail_With_Context is begin if not Context_Given then Test.Fail (Context); Context_Given := True; else Test.Fail; end if; end Fail_With_Context; Print_Expected : Boolean := False; begin if Tested.Current_Event /= Events.Add_Atom then if Context /= "" then Test.Error (Context); end if; Test.Error ("Test_Atom_Accessors called with current event " & Events.Event'Image (Tested.Current_Event)); return; end if; if Expected_Level >= 0 then Current_Level_Test : declare Level : constant Natural := Tested.Current_Level; begin if Level /= Expected_Level then Fail_With_Context; Test.Info ("Current_Level is" & Integer'Image (Level) & ", expected" & Integer'Image (Expected_Level)); end if; end Current_Level_Test; end if; Current_Atom_Test : declare Current_Atom : constant Atom := Tested.Current_Atom; begin if Current_Atom /= Expected then Print_Expected := True; Fail_With_Context; Dump_Atom (Test, Current_Atom, "Current_Atom"); end if; end Current_Atom_Test; Query_Atom_Test : declare procedure Process (Data : in Atom); Calls : Natural := 0; Buffer : Atom_Buffers.Atom_Buffer; procedure Process (Data : in Atom) is begin Calls := Calls + 1; Buffer.Append (Data); end Process; begin Tested.Query_Atom (Process'Access); if Calls = 0 then Fail_With_Context; Test.Info ("Query_Atom did not call Process"); elsif Calls > 1 then Fail_With_Context; Test.Info ("Query_Atom called Process" & Integer'Image (Calls) & " times"); Print_Expected := True; Dump_Atom (Test, Buffer.Data, "Buffer"); elsif Buffer.Data /= Expected then Print_Expected := True; Fail_With_Context; Dump_Atom (Test, Buffer.Data, "Query_Atom"); end if; end Query_Atom_Test; Long_Read_Atom_Test : declare Buffer : Atom (21 .. Expected'Length + 30); Length : Count; begin Tested.Read_Atom (Buffer, Length); if Buffer (Buffer'First .. Buffer'First + Length - 1) /= Expected then Print_Expected := True; Fail_With_Context; Dump_Atom (Test, Buffer (Buffer'First .. Buffer'First + Length - 1), "Read_Atom"); end if; end Long_Read_Atom_Test; Short_Read_Atom_Test : declare Buffer : Atom (11 .. Expected'Length / 2 + 10); Length : Count; begin Tested.Read_Atom (Buffer, Length); if Expected (Expected'First .. Expected'First + Buffer'Length - 1) /= Buffer then Print_Expected := True; Fail_With_Context; Dump_Atom (Test, Buffer, "Short Read_Atom"); end if; end Short_Read_Atom_Test; if Print_Expected then Dump_Atom (Test, Expected, "Expected"); end if; end Test_Atom_Accessors; procedure Test_Atom_Accessor_Exceptions (Test : in out NT.Test; Tested : in Descriptor'Class; Context : in String := "") is Context_Given : Boolean := Context = ""; procedure Fail_With_Context; procedure Fail_With_Context is begin if not Context_Given then Test.Fail (Context); Context_Given := True; else Test.Fail; end if; end Fail_With_Context; begin if Tested.Current_Event = Events.Add_Atom then if Context /= "" then Test.Error (Context); end if; Test.Error ("Test_Atom_Accessor_Exceptions during Events.Add_Atom"); return; end if; Current_Atom_Test : begin declare Data : constant Atom := Tested.Current_Atom; begin Fail_With_Context; Test.Info ("No exception raised in Current_Atom"); Dump_Atom (Test, Data, "Returned value"); end; exception when Program_Error => null; when Error : others => Fail_With_Context; Test.Info ("Wrong exception raised in Current_Atom"); Test.Report_Exception (Error, NT.Fail); end Current_Atom_Test; Query_Atom_Test : declare procedure Process (Data : in Atom); Calls : Natural := 0; Buffer : Atom_Buffers.Atom_Buffer; procedure Process (Data : in Atom) is begin Calls := Calls + 1; Buffer.Append (Data); end Process; begin Tested.Query_Atom (Process'Access); Fail_With_Context; Test.Info ("No exception raised in Query_Atom"); Dump_Atom (Test, Buffer.Data, "Buffer from" & Natural'Image (Calls) & " calls"); exception when Program_Error => null; when Error : others => Fail_With_Context; Test.Info ("Wrong exception raised in Query_Atom"); Test.Report_Exception (Error, NT.Fail); end Query_Atom_Test; Read_Atom_Test : declare Buffer : Atom (0 .. 31) := (others => 46); Length : Count; begin Tested.Read_Atom (Buffer, Length); Fail_With_Context; Test.Info ("No exception raised in Read_Atom"); Test.Info ("Returned Length:" & Count'Image (Length)); Dump_Atom (Test, Buffer, "Output Buffer"); exception when Program_Error => null; when Error : others => Fail_With_Context; Test.Info ("Wrong exception raised in Read_Atom"); Test.Report_Exception (Error, NT.Fail); end Read_Atom_Test; end Test_Atom_Accessor_Exceptions; procedure Next_And_Check (Test : in out NT.Test; Tested : in out Descriptor'Class; Expected : in Events.Event; Level : in Natural; Context : in String := "") is Event : Events.Event; begin Tested.Next (Event); if Event /= Expected then if Context /= "" then Test.Fail (Context); end if; Test.Fail ("Found event " & Events.Event'Image (Event) & ", expected " & Events.Event'Image (Expected)); elsif Tested.Current_Level /= Level then if Context /= "" then Test.Fail (Context); end if; Test.Fail ("Found event " & Events.Event'Image (Event) & " at level" & Integer'Image (Tested.Current_Level) & ", expected" & Integer'Image (Level)); end if; end Next_And_Check; procedure Next_And_Check (Test : in out NT.Test; Tested : in out Descriptor'Class; Expected : in Atom; Level : in Natural; Context : in String := "") is Event : Events.Event; begin Tested.Next (Event); if Event /= Events.Add_Atom then if Context /= "" then Test.Fail (Context); end if; Test.Fail ("Found event " & Events.Event'Image (Event) & ", expected Add_Atom"); else Test_Tools.Test_Atom_Accessors (Test, Tested, Expected, Level, Context); end if; end Next_And_Check; function To_S_Expression (Text : String) return Caches.Reference is begin return To_S_Expression (To_Atom (Text)); end To_S_Expression; function To_S_Expression (Data : Atom) return Caches.Reference is Stream : aliased Memory_Stream; Parser : Parsers.Stream_Parser (Stream'Access); begin Stream.Write (Data); Parser.Next; return Caches.Move (Parser); end To_S_Expression; ------------------- -- Memory Stream -- ------------------- overriding procedure Read (Stream : in out Memory_Stream; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is begin Last := Item'First - 1; while Last + 1 in Item'Range and then Stream.Read_Pointer < Stream.Internal.Length loop Stream.Read_Pointer := Stream.Read_Pointer + 1; Last := Last + 1; Item (Last) := Stream.Internal.Element (Stream.Read_Pointer); end loop; end Read; overriding procedure Write (Stream : in out Memory_Stream; Item : in Ada.Streams.Stream_Element_Array) is begin if Stream.Read_Pointer >= Stream.Internal.Length then Stream.Internal.Soft_Reset; Stream.Read_Pointer := 0; end if; Stream.Internal.Append (Item); if not Stream.Mismatch then for I in Item'Range loop if Stream.Expect_Pointer + 1 > Stream.Expected.Length or else Stream.Expected.Element (Stream.Expect_Pointer + 1) /= Item (I) then Stream.Mismatch := True; exit; end if; Stream.Expect_Pointer := Stream.Expect_Pointer + 1; end loop; end if; end Write; function Get_Data (Stream : Memory_Stream) return Atom is begin return Stream.Internal.Data; end Get_Data; function Unread_Data (Stream : Memory_Stream) return Atom is begin if Stream.Read_Pointer < Stream.Internal.Length then return Stream.Internal.Raw_Query.Data.all (Stream.Read_Pointer + 1 .. Stream.Internal.Length); else return Null_Atom; end if; end Unread_Data; procedure Set_Data (Stream : in out Memory_Stream; Data : in Atom) is begin Stream.Internal.Soft_Reset; Stream.Internal.Append (Data); end Set_Data; function Unread_Expected (Stream : Memory_Stream) return Atom is begin if Stream.Expect_Pointer < Stream.Expected.Length then return Stream.Expected.Raw_Query.Data.all (Stream.Expect_Pointer + 1 .. Stream.Expected.Length); else return Null_Atom; end if; end Unread_Expected; procedure Set_Expected (Stream : in out Memory_Stream; Data : in Atom; Reset_Mismatch : in Boolean := True) is begin Stream.Expected.Soft_Reset; Stream.Expected.Append (Data); Stream.Expect_Pointer := 0; if Reset_Mismatch then Stream.Mismatch := False; end if; end Set_Expected; function Has_Mismatch (Stream : Memory_Stream) return Boolean is begin return Stream.Mismatch; end Has_Mismatch; procedure Reset_Mismatch (Stream : in out Memory_Stream) is begin Stream.Mismatch := False; end Reset_Mismatch; function Mismatch_Index (Stream : Memory_Stream) return Count is begin if Stream.Mismatch then return Stream.Expect_Pointer + 1; else return 0; end if; end Mismatch_Index; procedure Check_Stream (Stream : in Test_Tools.Memory_Stream; Test : in out NT.Test) is begin if Stream.Has_Mismatch or else Stream.Unread_Expected /= Null_Atom then if Stream.Has_Mismatch then Test.Fail ("Mismatch at position" & Count'Image (Stream.Mismatch_Index)); declare Stream_Data : Atom renames Stream.Get_Data; begin Test_Tools.Dump_Atom (Test, Stream_Data (Stream_Data'First .. Stream.Mismatch_Index - 1), "Matching data"); Test_Tools.Dump_Atom (Test, Stream_Data (Stream.Mismatch_Index .. Stream_Data'Last), "Mismatching data"); end; end if; if Stream.Unread_Expected /= Null_Atom then Test.Fail; Test_Tools.Dump_Atom (Test, Stream.Unread_Expected, "Left to expect"); end if; end if; end Check_Stream; end Natools.S_Expressions.Test_Tools;
-- Institution: Technische Universitaet Muenchen -- Department: Realtime Computer Systems (RCS) -- Project: StratoX -- Author: Martin Becker (becker@rcs.ei.tum.de) -- with Ada.Tags; package body ULog.Identifiers is procedure Register (The_Tag : Ada.Tags.Tag; Code : Character) is begin null; -- TODO end Register; function Decode (Code : Character) return Ada.Tags.Tag is begin return Ada.Tags.No_Tag; -- TODO end Decode; end ULog.Identifiers;
-- Lua.Util -- Utility routines to go with the Ada 2012 Lua interface -- Copyright (c) 2015, James Humphry - see LICENSE for terms package Lua.Util is -- Print the stack out to the console procedure Print_Stack(L : in Lua_State'Class); end Lua.Util;
-- -- -- package Copyright (c) Dmitry A. Kazakov -- -- Parsers.Generic_Source Luebeck -- -- Interface Winter, 2004 -- -- -- -- Last revision : 19:57 14 Sep 2019 -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public License as -- -- published by the Free Software Foundation; either version 2 of -- -- the License, or (at your option) any later version. This library -- -- is distributed in the hope that it will be useful, but WITHOUT -- -- ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have -- -- received a copy of the GNU General Public License along with -- -- this library; if not, write to the Free Software Foundation, -- -- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- --____________________________________________________________________-- -- -- This generic package provides abstract interface for the source code -- readers. The package is abstract and provides no functionality. An -- instance should implement its interface by defining the generic -- parameters: -- -- (o) Source_Type is the type of code source. An implementation -- should maintain two source code cursors (pointers); -- (o) Location_Type is the type used for source code locations. A -- source code location refers a code slice. The slice may occupy -- several line if the source is multiline; -- (o) Line_Ptr_Type is the pointer type to refer source lines. -- -- The following generic formal subroutines are used to manipulate -- source code: -- -- (o) End_Of returns True at the source end; -- (o) Get_Backup_Pointer is used to get the saved cursor. It is one -- to which Reset_Pointer would return, see below. At the source -- end 1 is the result; -- (o) Get_Line is a function to get the current source code line. It -- remains valid until the first call to Next_Line. End_Error is -- propagated when the source end was reached either because the -- source is empty or because of a call to Next_Line before; -- (o) Get_Line is another variant in the form of procedure. It is -- similar to Get_Line but returns a pointer to the buffer -- containing the current source code line, the current cursor -- position in that buffer and the position of the last character -- in the buffer. It might be more efficient than Get_Line if the -- compiler optimization is not great. The pointer returned may -- refer to a string longer that the current line. The -- implementation shall ensure equivalence of the value returned -- in the Pointer parameter to one returned by Get_Pointer and -- accepted by Set_Pointer. Usually it is achieved when the -- function Get_Line returns a slice of the buffer returned by the -- procedure Get_Line. Note that in Ada string slicing does not -- shift the lower bound of the result to 1. Thus it is safe to -- use plain slicing there. Like the function, the procedure -- Get_Line raises End_Error at the source end or else when the -- source is empty; -- (o) Get_Pointer is used to get the current cursor. The result is an -- index in the current line which would be returned by Get_Line. -- It is in the range Line'First..Line'Last+1 provided that Line -- is the value of Get_Line. The character pointed by Get_Pointer -- is the first one to parse. The characters before are the -- recognized ones. At the source end 1 is the result; -- (o) Link gets the source code location. A location specifies a -- source code slice between two cursors. The second cursor is one -- returned by Get_Pointer. The first cursor is the previous value -- of the second one. The slice in between is usually the last -- recognized lexical token. It includes the character pointed by -- the first cursor, and does not one pointed by the second one. -- Empty slices are allowed, so Link should never fail even at the -- end of a source; -- (o) Next_Line is used to advance to the next source line. After -- successful completion Get_Line can be used to access the newly -- read source line. Both cursors are set to Get_Line'First. So -- when the line is not empty Get_Pointer will return the index of -- the first character in the new source line. Data_Error is -- propagated on I/O errors. End_Error is propagated when the -- source end is reached; -- (o) Reset_Pointer is used to move the second cursor back to the -- first cursor. The depth of the "unget" need not to be deeper -- than 1. Consequent calls to Reset_Pointer may have no effect. -- It is also not required to implement return to the previous -- line; -- (o) Set_Pointer move the second cursor forward. The new position -- should be in the range between the position returned by -- Get_Pointer and the position following the last character of -- the current line, i.e. Get_Line (Code)'Last + 1. Otherwise -- Layout_Error is propagated; -- -- The following generic formal subroutines are used to manipulate -- source code locations: -- -- (o) Image returns a text description of a location. The result is -- a string; -- (o) "&" is used to combine two, usually adjacent a source code -- locations. The result is a consecutive code fragment containing -- positions from both Left and Right locations. For example if -- Left and Right are locations of "(" and ")" then the result is -- everything in the brackets including the brackets. -- -- The following small example illustrates an implementation of a -- routine to skip spaces in the source line: -- -- procedure Skip (Code : in out Source_Type) is -- Line : String renames Get_Line (Code); -- Pointer : Integer := Get_Pointer (Code); -- begin -- while Pointer <= Line'Last and then Line (Pointer) = ' ' loop -- Pointer := Pointer + 1; -- end loop; -- Set_Pointer (Code, Pointer); -- end Skip; -- -- Should Link (Code) be called immediately after this implementation -- of Skip it would return a location identifying the blank slice -- matched by Skip in the source code line. The same example using -- Get_Line_Ptr instead of Get_Line: -- -- procedure Skip (Code : in out Source_Type) is -- Line : Line_Ptr_Type; -- Pointer : Integer; -- Last : Integer; -- begin -- Get_Line (Line, Pointer, Last); -- while Pointer <= Last and then Line (Pointer) = ' ' loop -- Pointer := Pointer + 1; -- end loop; -- Set_Pointer (Code, Pointer); -- end Skip; -- generic type Source_Type (<>) is limited private; type Line_Ptr_Type is access constant String; type Location_Type is private; with function End_Of (Link : Source_Type) return Boolean is <>; with function Get_Line (Code : Source_Type) return String is <>; with procedure Get_Line ( Code : Source_Type; Line : out Line_Ptr_Type; Pointer : out Integer; Last : out Integer ) is <>; with function Get_Pointer (Code : Source_Type) return Integer is <>; with function Get_Backup_Pointer (Code : Source_Type) return Integer is <>; with function Image (Link : Location_Type) return String is <>; with function Link (Code : Source_Type) return Location_Type is <>; with procedure Next_Line (Code : in out Source_Type) is <>; with procedure Reset_Pointer (Code : in out Source_Type) is <>; with procedure Set_Pointer ( Code : in out Source_Type; Pointer : Integer ) is <>; with function "&" (Left, Right : Location_Type) return Location_Type is <>; package Parsers.Generic_Source is end Parsers.Generic_Source;
-- $Header: /cf/ua/arcadia/alex-ayacc/ayacc/src/RCS/ayacc_separates.a,v 1.1 88/08/08 12:07:39 arcadia Exp $ -- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- The primary authors of ayacc were David Taback and Deepak Tolani. -- Enhancements were made by Ronald J. Schmalz. -- -- Send requests for ayacc information to ayacc-info@ics.uci.edu -- Send bug reports for ayacc to ayacc-bugs@ics.uci.edu -- -- Redistribution and use in source and binary forms are permitted -- provided that the above copyright notice and this paragraph are -- duplicated in all such forms and that any documentation, -- advertising materials, and other materials related to such -- distribution and use acknowledge that the software was developed -- by the University of California, Irvine. The name of the -- University may not be used to endorse or promote products derived -- from this software without specific prior written permission. -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- Module : ayacc_separates.ada -- Component of : ayacc -- Version : 1.2 -- Date : 11/21/86 12:28:51 -- SCCS File : disk21~/rschm/hasee/sccs/ayacc/sccs/sxayacc_separates.ada -- $Header: /cf/ua/arcadia/alex-ayacc/ayacc/src/RCS/ayacc_separates.a,v 1.1 88/08/08 12:07:39 arcadia Exp $ -- $Log: ayacc_separates.a,v $ --Revision 1.1 88/08/08 12:07:39 arcadia --Initial revision -- -- Revision 0.0 86/02/19 18:36:14 ada -- -- These files comprise the initial version of Ayacc -- designed and implemented by David Taback and Deepak Tolani. -- Ayacc has been compiled and tested under the Verdix Ada compiler -- version 4.06 on a vax 11/750 running Unix 4.2BSD. -- -- Revision 0.1 88/03/16 -- Additional argument added to allow user to specify file extension -- to be used for generated Ada files. -- kn with String_Pkg; use String_Pkg; separate (Ayacc) procedure Initialize is use Ayacc_File_Names, Options; Input_File, Extension, Options : String_Type := Create (""); type Switch is ( On , Off ); C_Lex_Flag, Debug_Flag, Summary_Flag, -- UMASS CODES : Error_Recovery_Flag, -- END OF UMASS CODES. Verbose_Flag : Switch; Invalid_Command_Line : exception; procedure Get_Arguments (File : out String_Type; C_Lex : out Switch; Debug : out Switch; Summary : out Switch; Verbose : out Switch; -- UMASS CODES : Error_Recovery : out Switch; -- END OF UMASS CODES. Extension : out String_Type) is separate; begin Get_Arguments (Input_File, C_Lex_Flag, Debug_Flag, Summary_Flag, Verbose_Flag, -- UMASS CODES : Error_Recovery_Flag, -- END OF UMASS CODES. Extension); New_Line; Put_Line (" Ayacc (File => """ & Value (Input_File) & ""","); Put_Line (" C_Lex => " & Value (Mixed (Switch'Image(C_Lex_Flag))) & ','); Put_Line (" Debug => " & Value (Mixed (Switch'Image(Debug_Flag))) & ','); Put_Line (" Summary => " & Value (Mixed (Switch'Image(Summary_Flag))) & ','); Put_Line (" Verbose => " & Value (Mixed (Switch'Image(Verbose_Flag))) & ","); -- UMASS CODES : Put_Line (" Error_Recovery => " & Value (Mixed (Switch'Image(Error_Recovery_Flag))) & ");"); -- END OF UMASS CODES. New_Line; if C_Lex_Flag = On then Options := Options & Create ("i"); end if; if Debug_Flag = On then Options := Options & Create ("d"); end if; if Summary_Flag = On then Options := Options & Create ("s"); end if; if Verbose_Flag = On then Options := Options & Create ("v"); end if; -- UMASS CODES : if Error_Recovery_Flag = On then Options := Options & Create ("e"); end if; -- END OF UMASS CODES. Set_File_Names (Value (Input_File), Value(Extension)); Set_Options (Value (Options)); exception when Invalid_Command_Line => raise Illegal_Argument_List; end Initialize;
------------------------------------------------------------------------------- -- This file is part of libsparkcrypto. -- -- Copyright (C) 2010, Alexander Senier -- Copyright (C) 2010, secunet Security Networks AG -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- -- * Neither the name of the nor the names of its contributors may be used -- to endorse or promote products derived from this software without -- specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS -- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------- with LSC.Internal.Types; use type LSC.Internal.Types.Index; use type LSC.Internal.Types.Word32; use type LSC.Internal.Types.Word64; ------------------------------------------------------------------------------- -- The SHA-256 hash algorithm -- -- <ul> -- <li> -- <a href="http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf"> -- FIPS PUB 180-3, Secure Hash Standard (SHS), National Institute of Standards -- and Technology, U.S. Department of Commerce, October 2008. </a> -- </li> -- </ul> ------------------------------------------------------------------------------- package LSC.Internal.SHA256 is pragma Pure; -- SHA-256 context type Context_Type is private; -- Index for SHA-256 block subtype Block_Index is Types.Index range 0 .. 15; -- SHA-256 block subtype Block_Type is Types.Word32_Array_Type (Block_Index); -- SHA-256 block size Block_Size : constant := 512; -- Index for SHA-256 hash subtype SHA256_Hash_Index is Types.Index range 0 .. 7; -- SHA-256 hash subtype SHA256_Hash_Type is Types.Word32_Array_Type (SHA256_Hash_Index); -- SHA-256 block length subtype Block_Length_Type is Types.Word32 range 0 .. Block_Size - 1; -- Index for SHA-256 message -- -- A SHA-256 message can be at most 2^64 bit long. As one block has 512 bit, -- this makes 2^55 blocks. type Message_Index is range 0 .. 2 ** 55 - 1; -- SHA-256 message type Message_Type is array (Message_Index range <>) of Block_Type; -- Initialize SHA-256 context. function SHA256_Context_Init return Context_Type; -- Update SHA-256 @Context@ with message block @Block@. procedure Context_Update (Context : in out Context_Type; Block : in Block_Type) with Depends => (Context =>+ Block); pragma Inline (Context_Update); -- Finalize SHA-256 @Context@ using @Length@ bits of final message block -- @Block@. procedure Context_Finalize (Context : in out Context_Type; Block : in Block_Type; Length : in Block_Length_Type) with Depends => (Context =>+ (Block, Length)); -- Return SHA-256 hash from @Context@. function SHA256_Get_Hash (Context : Context_Type) return SHA256_Hash_Type; procedure Hash_Context (Message : in Message_Type; Length : in LSC.Internal.SHA256.Message_Index; Ctx : in out Context_Type) with Depends => (Ctx =>+ (Message, Length)), Pre => Message'First <= Message'Last and Length / Block_Size + (if Length mod Block_Size = 0 then 0 else 1) <= Message'Length; -- Compute hash value of @Length@ bits of @Message@. function Hash (Message : Message_Type; Length : LSC.Internal.SHA256.Message_Index) return SHA256_Hash_Type with Pre => Message'First <= Message'Last and Length / Block_Size + (if Length mod Block_Size = 0 then 0 else 1) <= Message'Length; -- Empty block Null_Block : constant Block_Type; -- Empty Hash SHA256_Null_Hash : constant SHA256_Hash_Type; private type Data_Length is record LSW : Types.Word32; MSW : Types.Word32; end record; subtype Schedule_Index is Types.Index range 0 .. 63; subtype Schedule_Type is Types.Word32_Array_Type (Schedule_Index); Null_Schedule : constant Schedule_Type := Schedule_Type'(Schedule_Index => 0); type Context_Type is record Length : Data_Length; H : SHA256_Hash_Type; W : Schedule_Type; end record; Null_Block : constant Block_Type := Block_Type'(Block_Index => 0); SHA256_Null_Hash : constant SHA256_Hash_Type := SHA256_Hash_Type'(SHA256_Hash_Index => 0); end LSC.Internal.SHA256;
with Ada.Numerics.Generic_Elementary_Functions; package body Simple_Math is package Math is new Ada.Numerics.Generic_Elementary_Functions (Float_T); -- Sqrt should raise our exception when X < 0 and -- the square root of X otherwise function Sqrt (X : Float_T) return Float_T is begin return Math.Sqrt (X); -- not fully implemented end Sqrt; -- Square should raise our exception when X*X is too large and -- the X*X otherwise function Square (X : Float_T) return Float_T is begin return X * X; end Square; function Multiply (L, R : Float_T) return Float_T is begin return L * R; end Multiply; function Divide (N, D : Float_T) return Float_T is begin return N / D; end Divide; end Simple_Math;
with Ada.Containers.Vectors; with Parser; use Parser; package X86Parser is type Instr is record size : integer; line : Parts; end record; package Instr_Vector is new Ada.Containers.Vectors ( Index_Type => Natural, Element_Type => Instr ); use Instr_Vector; function Get_Instr_Size(Input : Parts_Vector.Vector) return Instr_Vector.Vector; function Get_Total_Size(Input : Instr_Vector.Vector) return Integer; function Pass1(Input : Instr_Vector.Vector) return Instr_Vector.Vector; procedure Instr_Debug(Input : Instr_Vector.Vector); end X86Parser;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . B B . P R O T E C T I O N -- -- -- -- S p e c -- -- -- -- Copyright (C) 1999-2002 Universidad Politecnica de Madrid -- -- Copyright (C) 2003-2004 The European Space Agency -- -- Copyright (C) 2003-2005, AdaCore -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- -- The porting of GNARL to bare board targets was initially developed by -- -- the Real-Time Systems Group at the Technical University of Madrid. -- -- -- ------------------------------------------------------------------------------ -- This package provides the functionality required to protect the data -- handled by the low level tasking system. package System.BB.Protection is pragma Preelaborate; procedure Enter_Kernel; pragma Inline (Enter_Kernel); -- This procedure is executed to signal the access to kernel data. Its use -- protect the consistence of the kernel. Interrupts are disabled while -- kernel data is being accessed. procedure Leave_Kernel; -- Leave_Kernel must be called when the access to kernel data finishes. -- Interrupts are enable to the appropriate level (according to the active -- priority of the running thread). end System.BB.Protection;
-- { dg-do compile } -- { dg-options "-O" } with Ada.Containers.Ordered_Sets; with Ada.Strings.Unbounded; procedure Opt33 is type Rec is record Name : Ada.Strings.Unbounded.Unbounded_String; end record; function "<" (Left : Rec; Right : Rec) return Boolean; package My_Ordered_Sets is new Ada.Containers.Ordered_Sets (Rec); protected type Data is procedure Do_It; private Set : My_Ordered_Sets.Set; end Data; function "<" (Left : Rec; Right : Rec) return Boolean is begin return False; end "<"; protected body Data is procedure Do_It is procedure Dummy (Position : My_Ordered_Sets.Cursor) is begin null; end; begin Set.Iterate (Dummy'Access); end; end Data; begin null; end;
with bullet_physics.Space, box2d_physics .Space; package body physics.Forge is ---------- --- Space -- function new_Space (Kind : in space_Kind) return Space.view is Self : Space.view; begin case Kind is when Bullet => Self := Space.view' (new bullet_physics.Space.item' (bullet_physics.Space.to_Space)); when Box2d => Self := Space.view' (new box2d_physics.Space.item' (box2d_physics.Space.to_Space)); end case; return Self; end new_Space; end physics.Forge;
with Ada.Numerics.Big_Numbers.Big_Integers; use Ada.Numerics.Big_Numbers.Big_Integers; package Fibonacci is function Fib_Iter (N : Natural) return Big_Natural; function Fib_Naive (N : Natural) return Natural; function Fib_Recur (N : Natural) return Big_Natural; function Big_Natural_Image (N : Big_Natural) return String; end Fibonacci;
-- Generic spec for Audio drivers -- /!\ This is work in progress and not at a real Hardware Abstraction Layer with Ada.Interrupts.Names; with Interfaces; use Interfaces; with STM32.DMA; package HAL.Audio is Audio_Out_DMA_Interrupt : Ada.Interrupts.Interrupt_ID renames Ada.Interrupts.Names.DMA2_Stream4_Interrupt; type Audio_Buffer is array (Natural range <>) of Integer_16 with Component_Size => 16, Alignment => 32; type Audio_Volume is new Natural range 0 .. 100; type Audio_Frequency is (Audio_Freq_8kHz, Audio_Freq_11kHz, Audio_Freq_16kHz, Audio_Freq_22kHz, Audio_Freq_44kHz, Audio_Freq_48kHz, Audio_Freq_96kHz) with Size => 32; for Audio_Frequency use (Audio_Freq_8kHz => 8_000, Audio_Freq_11kHz => 11_025, Audio_Freq_16kHz => 16_000, Audio_Freq_22kHz => 22_050, Audio_Freq_44kHz => 44_100, Audio_Freq_48kHz => 48_000, Audio_Freq_96kHz => 96_000); type DMA_Error is (FIFO_Error, Direct_Mode_Error, Transfer_Error); procedure Initialize_Audio_Out (Volume : Audio_Volume; Frequency : Audio_Frequency); function DMA_Out_Status (Flag : STM32.DMA.DMA_Status_Flag) return Boolean; procedure DMA_Out_Clear_Status (Flag : STM32.DMA.DMA_Status_Flag); procedure Play (Buffer : Audio_Buffer); procedure Change_Buffer (Buffer : Audio_Buffer); procedure Pause; procedure Resume; procedure Stop; procedure Set_Volume (Volume : Audio_Volume); procedure Set_Frequency (Frequency : Audio_Frequency); end HAL.Audio;
-- { dg-do compile } -- { dg-options "-gnatws" } -- { dg-options "-gnatws -flto" { target lto } } with Lto3_Pkg1; package Lto3 is package P is new Lto3_Pkg1 (Id_T => Natural); end Lto3;
-- -- \brief AUnit test program -- \author Alexander Senier -- \date 2019-01-03 -- with GNAT.IO; with AUnit; procedure Main is use GNAT.IO; begin Put_Line ("No AUnit test, yet."); end Main;
with Ada.Calendar; use Ada.Calendar; with Ada.Text_Io; use Ada.Text_Io; with Sigint_Handler; use Sigint_Handler; procedure Signals is task Counter is entry Stop; end Counter; task body Counter is Current_Count : Natural := 0; begin loop select accept Stop; exit; or delay 0.5; end select; Current_Count := Current_Count + 1; Put_Line(Natural'Image(Current_Count)); end loop; end Counter; task Sig_Handler; task body Sig_Handler is Start_Time : Time := Clock; Sig_Time : Time; begin Handler.Wait; Sig_Time := Clock; Counter.Stop; Put_Line("Program execution took" & Duration'Image(Sig_Time - Start_Time) & " seconds"); end Sig_Handler; begin null; end Signals;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . S A M 4 S -- -- -- -- S p e c -- -- -- -- Copyright (C) 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. -- -- -- ------------------------------------------------------------------------------ -- This file provides register definitions for the SAM4S (ARM Cortex M4) -- microcontrollers from Atmel. Definitions are taken from 'SAM4S Series' -- datasheet (document 11100E-ATARM-24-Jul-13). package System.SAM4S is pragma No_Elaboration_Code_All; -- Allow user code with pragma No_Elaboration_Code_All to use this package pragma Preelaborate (System.SAM4S); pragma Suppress (Alignment_Check); -- Avoid any warnings for address clauses on variables of type record. type Word is mod 2**32; -- Define address bases for various peripherals Peripheral_Base : constant := 16#4000_0000#; SPI_Base : constant := Peripheral_Base + 16#8000#; System_Controller_Base : constant := Peripheral_Base + 16#e_0000#; PMC_Base : constant := System_Controller_Base + 16#0400#; UART0_Base : constant := System_Controller_Base + 16#0600#; UART1_Base : constant := System_Controller_Base + 16#0800#; EFC0_Base : constant := System_Controller_Base + 16#0A00#; EFC1_Base : constant := System_Controller_Base + 16#0C00#; PIOA_Base : constant := System_Controller_Base + 16#0e00#; PIOB_Base : constant := System_Controller_Base + 16#1000#; PIOC_Base : constant := System_Controller_Base + 16#1200#; WDT_Base : constant := System_Controller_Base + 16#1450#; --------------------------------- -- Power Management Controller -- --------------------------------- type PMC_Registers is record PMC_SCER : Word; PMC_SCDR : Word; PMC_SCSR : Word; Pad0 : Word; PMC_PCER0 : Word; PMC_PCDR0 : Word; PMC_PCSR0 : Word; Pad1 : Word; CKGR_MOR : Word; CKGR_MCFR : Word; CKGR_PLLAR : Word; CKGR_PLLBR : Word; PMC_MCKR : Word; Pad3_4 : Word; PMC_USB : Word; Pad3_C : Word; PMC_PCK0 : Word; PMC_PCK1 : Word; PMC_PCK2 : Word; Pad4_C : Word; Pad5_0 : Word; Pad5_4 : Word; Pad5_8 : Word; Pad5_C : Word; PMC_IER : Word; PMC_IDR : Word; PMC_SR : Word; PMC_IMR : Word; PMC_FSMR : Word; PMC_FSPR : Word; PMC_FOCR : Word; Pad7_C : Word; -- Not complete end record; PMC : PMC_Registers with Volatile, Import, Address => System'To_Address (PMC_Base); -- Constants for the CKGR MOR register package CKGR_MOR is CFDEN : constant := 2 ** 25; MOSCSEL : constant := 2 ** 24; KEY : constant := 16#37# * 2 ** 16; MOSCXTST : constant := 2 ** 8; MOSCRCEN : constant := 2 ** 3; WAITMODE : constant := 2 ** 2; MOSCXTBY : constant := 2 ** 1; MOSCXTEN : constant := 2 ** 0; end CKGR_MOR; -- Constants for the PMC SR register package PMC_SR is MCKRDY : constant := 2 ** 3; LOCKB : constant := 2 ** 2; LOCKA : constant := 2 ** 1; MOSCXTS : constant := 2 ** 0; end PMC_SR; -- Constants for the CKGR PLLAR and PLLBR registers package CKGR_PLLxR is DIV : constant := 2 ** 0; PLLCOUNT : constant := 2 ** 8; MUL : constant := 2 ** 16; ONE : constant := 2 ** 29; end CKGR_PLLxR; -- Constants for the PMC MCKR register package PMC_MCKR is PLLBDIV2 : constant := 2 ** 13; PLLADIV2 : constant := 2 ** 12; PRES_Mask : constant := 2#111# * 2 ** 4; CLK_1 : constant := 0 * 2 ** 4; CLK_2 : constant := 1 * 2 ** 4; CLK_4 : constant := 2 * 2 ** 4; CLK_8 : constant := 3 * 2 ** 4; CLK_16 : constant := 4 * 2 ** 4; CLK_32 : constant := 5 * 2 ** 4; CLK_64 : constant := 6 * 2 ** 4; CLK_3 : constant := 7 * 2 ** 4; CSS_Mask : constant := 2#11# * 2 ** 0; SLOW_CLK : constant := 0 * 2 ** 0; MAIN_CLK : constant := 1 * 2 ** 0; PLLA_CLK : constant := 2 * 2 ** 0; PLLB_CLK : constant := 3 * 2 ** 0; end PMC_MCKR; ---------------------------------------- -- Enhanced Embedded Flash Controller -- ---------------------------------------- type EEFC_Registers is record EEFC_FMR : Word; EEFC_FCR : Word; EEFC_FSR : Word; EEFC_FFR : Word; end record; -- Constants for the EEFC FMR register package EEFC_FMR is FRDY : constant := 2 ** 0; FWS : constant := 2 ** 8; SCOD : constant := 2 ** 16; FAM : constant := 2 ** 24; CLOE : constant := 2 ** 26; end EEFC_FMR; EFC0 : EEFC_Registers with Volatile, Import, Address => System'To_Address (EFC0_Base); -------------------------------------- -- Parallel Input/Output Controller -- -------------------------------------- type PIO_Registers is record PER : Word; PDR : Word; PSR : Word; Pad0 : Word; OER : Word; ODR : Word; OSR : Word; Pad1 : Word; IFER : Word; IFDR : Word; IFSR : Word; Pad2 : Word; SODR : Word; CODR : Word; ODSR : Word; PDSR : Word; IER : Word; IDR : Word; IMR : Word; ISR : Word; MDER : Word; MDDR : Word; MDSR : Word; Pad5 : Word; PUDR : Word; PUER : Word; PUSR : Word; Pad6 : Word; ABCDSR1 : Word; ABCDSR2 : Word; Pad7_8 : Word; Pad7_C : Word; IFSCDR : Word; IFSCER : Word; IFSCSR : Word; SCDR : Word; PPDDR : Word; PPDER : Word; PPDSR : Word; Pad9 : Word; OWER : Word; OWDR : Word; OWSR : Word; Pada : Word; AIMER : Word; AIMDR : Word; AIMMR : Word; Padb : Word; ESR : Word; LSR : Word; ELSR : Word; Padc : Word; FELLSR : Word; REHLSR : Word; FRLHSR : Word; Padd : Word; LOCKSR : Word; WPMR : Word; WPSR : Word; PadE_C : Word; end record; PIOA : PIO_Registers with Volatile, Import, Address => System'To_Address (PIOA_Base); PIOB : PIO_Registers with Volatile, Import, Address => System'To_Address (PIOB_Base); PIOC : PIO_Registers with Volatile, Import, Address => System'To_Address (PIOC_Base); PIOA_ID : constant := 11; PIOB_ID : constant := 12; PIOC_ID : constant := 13; ---------------------------------- -- Serial Peripheral Interface -- ---------------------------------- type SPI_Registers is record SPI_CR : Word; SPI_MR : Word; SPI_RDR : Word; SPI_TDR : Word; SPI_SR : Word; SPI_IER : Word; SPI_IDR : Word; SPI_IMR : Word; Pad_20 : Word; Pad_24 : Word; Pad_28 : Word; Pad_2c : Word; SPI_CSR0 : Word; SPI_CSR1 : Word; SPI_CSR2 : Word; SPI_CSR3 : Word; -- ... end record; -- Constants for the SPI CR register package SPI_CR is SPIEN : constant := 2 ** 0; SPIDIS : constant := 2 ** 1; SWRST : constant := 2 ** 7; LASTXFER : constant := 2 ** 24; end SPI_CR; -- Constants for the SPI MR register package SPI_MR is MSTR : constant := 2 ** 0; PS : constant := 2 ** 1; PCSDEC : constant := 2 ** 2; MODFDIS : constant := 2 ** 4; WDRBT : constant := 2 ** 5; LLB : constant := 2 ** 7; PCS : constant := 2 ** 16; PCS_Mask : constant := 2#1111# * PCS; DLYBCS : constant := 2 ** 16; DLYBCS_Mask : constant := 16#ff# * DLYBCS; end SPI_MR; -- Constants for the SPI TDR register package SPI_TDR is TD : constant := 2 ** 0; PCS : constant := 2 ** 16; LASTXFER : constant := 2 ** 24; end SPI_TDR; -- Constants for the SPI SR register; also used by the SPI IER, IDR and -- IMR registers. package SPI_SR is RDRF : constant := 2 ** 0; TDRE : constant := 2 ** 1; MODF : constant := 2 ** 2; OVRES : constant := 2 ** 3; ENDRX : constant := 2 ** 4; ENDTX : constant := 2 ** 5; RXBUFF : constant := 2 ** 6; TXBUFE : constant := 2 ** 7; NSSR : constant := 2 ** 8; TXEMPTY : constant := 2 ** 9; UNDES : constant := 2 ** 10; SPIENS : constant := 2 ** 16; end SPI_SR; -- Constants for the SPI CSR register package SPI_CSR is CPOL : constant := 2 ** 0; NCPHA : constant := 2 ** 1; CSNAAT : constant := 2 ** 2; CSAAT : constant := 2 ** 3; BITS : constant := 2 ** 4; SCBR : constant := 2 ** 8; DLYBS : constant := 2 ** 16; DLYBCT : constant := 2 ** 24; end SPI_CSR; SPI : SPI_Registers with Volatile, Import, Address => System'To_Address (SPI_Base); SPI_ID : constant := 21; -------------------- -- Watchdog Timer -- -------------------- type WDT_Registers is record WDT_CR : Word; WDT_MR : Word; WDT_SR : Word; end record; -- Constants for the WDT CR register package WDT_CR is KEY : constant := 16#a5_00_00_00#; WDRSTT : constant := 2 ** 0; end WDT_CR; -- Constants for the WDT MR register package WDT_MR is WDV : constant := 2 ** 0; WDFIEN : constant := 2 ** 2; WDRSTEN : constant := 2 ** 13; WDDPROC : constant := 2 ** 14; WDDIS : constant := 2 ** 15; WDD : constant := 2 ** 16; WDDBGHLT : constant := 2 ** 13; WDIDLEHLT : constant := 2 ** 13; end WDT_MR; WDT : WDT_Registers with Volatile, Import, Address => System'To_Address (WDT_Base); ------------------------------------------------- -- Universal Asynchronous Receiver Transmitter -- ------------------------------------------------- type UART_Registers is record UART_CR : Word; UART_MR : Word; UART_IER : Word; UART_IDR : Word; UART_IMR : Word; UART_SR : Word; UART_RHR : Word; UART_THR : Word; UART_BRGR : Word; end record; -- Constants for the UART CR register package UART_CR is RSTRX : constant := 2 ** 2; RSTTX : constant := 2 ** 3; RXEN : constant := 2 ** 4; RXDIS : constant := 2 ** 5; TXEN : constant := 2 ** 6; TXDIS : constant := 2 ** 7; RSTSTA : constant := 2 ** 8; end UART_CR; -- Constants for the UART MR register package UART_MR is CHMODE_NORMAL : constant := 0 * 2 ** 14; CHMODE_AUTOMATIC : constant := 1 * 2 ** 14; CHMODE_LOCAL_LOOPBACK : constant := 2 * 2 ** 14; CHMODE_REMOTE_LOOPBACK : constant := 3 * 2 ** 14; PAR_EVEN : constant := 0 * 2 ** 9; PAR_ODD : constant := 1 * 2 ** 9; PAR_SPACE : constant := 2 * 2 ** 9; PAR_MARK : constant := 3 * 2 ** 9; PAR_NO : constant := 4 * 2 ** 9; end UART_MR; -- Constants for the UART SR register package UART_SR is RXRDY : constant := 2 ** 0; TXRDY : constant := 2 ** 1; ENDRX : constant := 2 ** 3; ENDTX : constant := 2 ** 4; OVRE : constant := 2 ** 5; FRAME : constant := 2 ** 6; PARE : constant := 2 ** 7; TXEMPTY : constant := 2 ** 9; TXBUFE : constant := 2 ** 11; RXBUFF : constant := 2 ** 12; end UART_SR; UART0 : UART_Registers with Volatile, Import, Address => System'To_Address (UART0_Base); UART1 : UART_Registers with Volatile, Import, Address => System'To_Address (UART1_Base); UART0_ID : constant := 8; UART1_ID : constant := 9; end System.SAM4S;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- M D L L -- -- -- -- S p e c -- -- -- -- $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. -- -- -- ------------------------------------------------------------------------------ -- This package provides the core high level routines used by GNATDLL -- to build Windows DLL with GNAT.OS_Lib; package MDLL is subtype Argument_List is GNAT.OS_Lib.Argument_List; subtype Argument_List_Access is GNAT.OS_Lib.Argument_List_Access; Null_Argument_List : constant Argument_List := (1 .. 0 => new String'("")); Null_Argument_List_Access : Argument_List_Access := new Argument_List (1 .. 0); Tools_Error : exception; Verbose : Boolean := False; Quiet : Boolean := False; -- Kill_Suffix is used by dlltool to know whether or not the @nn suffix -- should be removed from the exported names. When Kill_Suffix is set to -- True then dlltool -k option is used. Kill_Suffix : Boolean := False; procedure Build_Dynamic_Library (Ofiles : Argument_List; Afiles : Argument_List; Options : Argument_List; Bargs_Options : Argument_List; Largs_Options : Argument_List; Lib_Filename : String; Def_Filename : String; Lib_Address : String := ""; Build_Import : Boolean := False; Relocatable : Boolean := False); -- Build a DLL and the import library to link against the DLL. -- this function handles relocatable and non relocatable DLL. -- If the Afiles argument list contains some Ada units then it will -- generate the right adainit and adafinal and integrate it in the DLL. -- If the Afiles argument list is empty (there is only some object files -- provided) then it will not try to build a binder file. This is ok to -- build DLL containing no Ada code. procedure Build_Import_Library (Lib_Filename : String; Def_Filename : String); -- Build an import library (.a) from a definition files. An import library -- is needed to link against a DLL. end MDLL;
package Gm_Unit_Rank_Types is -- This type defines an extended numeric ranking. 0 indicates no -- rank, 1 is the highest rank and 99 is the lowest rank. -- subtype Extended_Numeric_Rank_Type is Integer range 0 .. 99; -- The following constant defines the value returned when a given -- object is not described in a particular Guidance and therefore has -- no rank value. -- No_Numeric_Rank : constant Extended_Numeric_Rank_Type := 0; -- This type defines a numeric ranking. 1 is the highest rank and 99 is -- the lowest rank. -- subtype Numeric_Rank_Type is Extended_Numeric_Rank_Type range 1 .. 99; Default_Numeric_Rank : constant Numeric_Rank_Type := 1; -- This type defines an extended ranking. The numeric ranking is -- supplemented by the values of Restricted, Not Applicable, and -- Blank. -- type Rank_Type is (Unknown, Restricted, Not_Applicable, Zero, One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Eleven, Twelve, Thirteen, Fourteen, Fifteen, Sixteen, Seventeen, Eighteen, Nineteen, Twenty, Twenty_One, Twenty_Two, Twenty_Three, Twenty_Four, Twenty_Five, Twenty_Six, Twenty_Seven, Twenty_Eight, Twenty_Nine, Thirty, Thirty_One, Thirty_Two, Thirty_Three, Thirty_Four, Thirty_Five, Thirty_Six, Thirty_Seven, Thirty_Eight, Thirty_Nine, Forty, Forty_One, Forty_Two, Forty_Three, Forty_Four, Forty_Five, Forty_Six, Forty_Seven, Forty_Eight, Forty_Nine, Fifty, Fifty_One, Fifty_Two, Fifty_Three, Fifty_Four, Fifty_Five, Fifty_Six, Fifty_Seven, Fifty_Eight, Fifty_Nine, Sixty, Sixty_One, Sixty_Two, Sixty_Three, Sixty_Four, Sixty_Five, Sixty_Six, Sixty_Seven, Sixty_Eight, Sixty_Nine, Seventy, Seventy_One, Seventy_Two, Seventy_Three, Seventy_Four, Seventy_Five, Seventy_Six, Seventy_Seven, Seventy_Eight, Seventy_Nine, Eighty, Eighty_One, Eighty_Two, Eighty_Three, Eighty_Four, Eighty_Five, Eighty_Six, Eighty_Seven, Eighty_Eight, Eighty_Nine, Ninety, Ninety_One, Ninety_Two, Ninety_Three, Ninety_Four, Ninety_Five, Ninety_Six, Ninety_Seven, Ninety_Eight, Ninety_Nine); Default_Rank : constant Rank_Type := Unknown; -- This type defines a system unit and its associated numeric rank. -- type Unit_Numeric_Rank_Type is record Unit : Integer; Rank : Numeric_Rank_Type; end record; Default_Unit_Numeric_Rank : constant Unit_Numeric_Rank_Type := Unit_Numeric_Rank_Type'(Unit => 0, Rank => Default_Numeric_Rank); -- This type defines a system unit and its associated extended rank. -- type Unit_Rank_Type is record Unit : Integer; Rank : Rank_Type; end record; Default_Unit_Rank : constant Unit_Rank_Type := Unit_Rank_Type'(Unit => 0, Rank => Default_Rank); end Gm_Unit_Rank_Types;
with Protypo.Api.Engine_Values.Handlers; with Protypo.Api.Engine_Values.Parameter_Lists; with Ada.Tags; private package Protypo.Code_Trees.Interpreter.String_Interpolation_Handlers is use type Ada.Tags.Tag; type String_Interpolator is new Handlers.Function_Interface with private; function Create (Interp : Interpreter_Access) return Handlers.Function_Interface_Access with Post => Create'Result'Tag = String_Interpolator'Tag; function Process (Fun : String_Interpolator; Parameter : Engine_Value_Vectors.Vector) return Engine_Value_Vectors.Vector; function Signature (Fun : String_Interpolator) return Parameter_Lists.Parameter_Signature; private type String_Interpolator is new Handlers.Function_Interface with record Status : Interpreter_Access; end record; end Protypo.Code_Trees.Interpreter.String_Interpolation_Handlers;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . O S _ I N T E R F A C E -- -- -- -- S p e c -- -- -- -- Copyright (C) 1991-1994, Florida State University -- -- Copyright (C) 1995-2016, 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. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the VxWorks version of this package -- This package encapsulates all direct interfaces to OS services that are -- needed by the tasking run-time (libgnarl). -- PLEASE DO NOT add any with-clauses to this package or remove the pragma -- Preelaborate. This package is designed to be a bottom-level (leaf) package. with Interfaces.C; with System.VxWorks; with System.VxWorks.Ext; with System.Multiprocessors; package System.OS_Interface is pragma Preelaborate; subtype int is Interfaces.C.int; subtype unsigned is Interfaces.C.unsigned; subtype short is Short_Integer; type unsigned_int is mod 2 ** int'Size; type long is new Long_Integer; type unsigned_long is mod 2 ** long'Size; type long_long is new Long_Long_Integer; type unsigned_long_long is mod 2 ** long_long'Size; type size_t is mod 2 ** Standard'Address_Size; ----------- -- Errno -- ----------- function errno return int; pragma Import (C, errno, "errnoGet"); EINTR : constant := 4; EAGAIN : constant := 35; ENOMEM : constant := 12; EINVAL : constant := 22; ETIMEDOUT : constant := 60; FUNC_ERR : constant := -1; ---------------------------- -- Signals and interrupts -- ---------------------------- NSIG : constant := 64; -- Number of signals on the target OS type Signal is new int range 0 .. Interfaces.C."-" (NSIG, 1); Max_HW_Interrupt : constant := System.VxWorks.Num_HW_Interrupts - 1; type HW_Interrupt is new int range 0 .. Max_HW_Interrupt; Max_Interrupt : constant := Max_HW_Interrupt; subtype Interrupt_Range is Natural range 0 .. Max_HW_Interrupt; -- For s-interr -- Signals common to Vxworks 5.x and 6.x SIGILL : constant := 4; -- illegal instruction (not reset when caught) SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future SIGFPE : constant := 8; -- floating point exception SIGBUS : constant := 10; -- bus error SIGSEGV : constant := 11; -- segmentation violation -- Signals specific to VxWorks 6.x SIGHUP : constant := 1; -- hangup SIGINT : constant := 2; -- interrupt SIGQUIT : constant := 3; -- quit SIGTRAP : constant := 5; -- trace trap (not reset when caught) SIGEMT : constant := 7; -- EMT instruction SIGKILL : constant := 9; -- kill SIGFMT : constant := 12; -- STACK FORMAT ERROR (not posix) SIGPIPE : constant := 13; -- write on a pipe with no one to read it SIGALRM : constant := 14; -- alarm clock SIGTERM : constant := 15; -- software termination signal from kill SIGCNCL : constant := 16; -- pthreads cancellation signal SIGSTOP : constant := 17; -- sendable stop signal not from tty SIGTSTP : constant := 18; -- stop signal from tty SIGCONT : constant := 19; -- continue a stopped process SIGCHLD : constant := 20; -- to parent on child stop or exit SIGTTIN : constant := 21; -- to readers pgrp upon background tty read SIGTTOU : constant := 22; -- like TTIN for output SIGRES1 : constant := 23; -- reserved signal number (Not POSIX) SIGRES2 : constant := 24; -- reserved signal number (Not POSIX) SIGRES3 : constant := 25; -- reserved signal number (Not POSIX) SIGRES4 : constant := 26; -- reserved signal number (Not POSIX) SIGRES5 : constant := 27; -- reserved signal number (Not POSIX) SIGRES6 : constant := 28; -- reserved signal number (Not POSIX) SIGRES7 : constant := 29; -- reserved signal number (Not POSIX) SIGUSR1 : constant := 30; -- user defined signal 1 SIGUSR2 : constant := 31; -- user defined signal 2 SIGPOLL : constant := 32; -- pollable event SIGPROF : constant := 33; -- profiling timer expired SIGSYS : constant := 34; -- bad system call SIGURG : constant := 35; -- high bandwidth data is available at socket SIGVTALRM : constant := 36; -- virtual timer expired SIGXCPU : constant := 37; -- CPU time limit exceeded SIGXFSZ : constant := 38; -- file size time limit exceeded SIGEVTS : constant := 39; -- signal event thread send SIGEVTD : constant := 40; -- signal event thread delete SIGRTMIN : constant := 48; -- Realtime signal min SIGRTMAX : constant := 63; -- Realtime signal max ----------------------------------- -- Signal processing definitions -- ----------------------------------- -- The how in sigprocmask() SIG_BLOCK : constant := 1; SIG_UNBLOCK : constant := 2; SIG_SETMASK : constant := 3; -- The sa_flags in struct sigaction SA_SIGINFO : constant := 16#0002#; SA_ONSTACK : constant := 16#0004#; SIG_DFL : constant := 0; SIG_IGN : constant := 1; type sigset_t is private; type struct_sigaction is record sa_handler : System.Address; sa_mask : sigset_t; sa_flags : int; end record; pragma Convention (C, struct_sigaction); type struct_sigaction_ptr is access all struct_sigaction; function sigaddset (set : access sigset_t; sig : Signal) return int; pragma Import (C, sigaddset, "sigaddset"); function sigdelset (set : access sigset_t; sig : Signal) return int; pragma Import (C, sigdelset, "sigdelset"); function sigfillset (set : access sigset_t) return int; pragma Import (C, sigfillset, "sigfillset"); function sigismember (set : access sigset_t; sig : Signal) return int; pragma Import (C, sigismember, "sigismember"); function sigemptyset (set : access sigset_t) return int; pragma Import (C, sigemptyset, "sigemptyset"); function sigaction (sig : Signal; act : struct_sigaction_ptr; oact : struct_sigaction_ptr) return int; pragma Import (C, sigaction, "sigaction"); type isr_address is access procedure (sig : int); pragma Convention (C, isr_address); function c_signal (sig : Signal; handler : isr_address) return isr_address; pragma Import (C, c_signal, "signal"); function pthread_sigmask (how : int; set : access sigset_t; oset : access sigset_t) return int; pragma Import (C, pthread_sigmask, "sigprocmask"); subtype t_id is System.VxWorks.Ext.t_id; subtype Thread_Id is t_id; -- Thread_Id and t_id are VxWorks identifiers for tasks. This value, -- although represented as a Long_Integer, is in fact an address. With -- some BSPs, this address can have a value sufficiently high that the -- Thread_Id becomes negative: this should not be considered as an error. function kill (pid : t_id; sig : Signal) return int; pragma Inline (kill); function getpid return t_id renames System.VxWorks.Ext.getpid; function Task_Stop (tid : t_id) return int renames System.VxWorks.Ext.Task_Stop; -- If we are in the kernel space, stop the task whose t_id is given in -- parameter in such a way that it can be examined by the debugger. This -- typically maps to taskSuspend on VxWorks 5 and to taskStop on VxWorks 6. function Task_Cont (tid : t_id) return int renames System.VxWorks.Ext.Task_Cont; -- If we are in the kernel space, continue the task whose t_id is given -- in parameter if it has been stopped previously to be examined by the -- debugger (e.g. by taskStop). It typically maps to taskResume on VxWorks -- 5 and to taskCont on VxWorks 6. function Int_Lock return int renames System.VxWorks.Ext.Int_Lock; -- If we are in the kernel space, lock interrupts. It typically maps to -- intLock. function Int_Unlock (Old : int) return int renames System.VxWorks.Ext.Int_Unlock; -- If we are in the kernel space, unlock interrupts. It typically maps to -- intUnlock. The parameter Old is only used on PowerPC where it contains -- the returned value from Int_Lock (the old MPSR). ---------- -- Time -- ---------- type time_t is new unsigned_long; type timespec is record ts_sec : time_t; ts_nsec : long; end record; pragma Convention (C, timespec); type clockid_t is new int; function To_Duration (TS : timespec) return Duration; pragma Inline (To_Duration); function To_Timespec (D : Duration) return timespec; pragma Inline (To_Timespec); -- Convert a Duration value to a timespec value. Note that in VxWorks, -- timespec is always non-negative (since time_t is defined above as -- unsigned long). This means that there is a potential problem if a -- negative argument is passed for D. However, in actual usage, the -- value of the input argument D is always non-negative, so no problem -- arises in practice. function To_Clock_Ticks (D : Duration) return int; -- Convert a duration value (in seconds) into clock ticks function clock_gettime (clock_id : clockid_t; tp : access timespec) return int; pragma Import (C, clock_gettime, "clock_gettime"); ---------------------- -- Utility Routines -- ---------------------- function To_VxWorks_Priority (Priority : int) return int; pragma Inline (To_VxWorks_Priority); -- Convenience routine to convert between VxWorks priority and Ada priority -------------------------- -- VxWorks specific API -- -------------------------- subtype STATUS is int; -- Equivalent of the C type STATUS OK : constant STATUS := 0; ERROR : constant STATUS := Interfaces.C.int (-1); function taskIdVerify (tid : t_id) return STATUS; pragma Import (C, taskIdVerify, "taskIdVerify"); function taskIdSelf return t_id; pragma Import (C, taskIdSelf, "taskIdSelf"); function taskOptionsGet (tid : t_id; pOptions : access int) return int; pragma Import (C, taskOptionsGet, "taskOptionsGet"); function taskSuspend (tid : t_id) return int; pragma Import (C, taskSuspend, "taskSuspend"); function taskResume (tid : t_id) return int; pragma Import (C, taskResume, "taskResume"); function taskIsSuspended (tid : t_id) return int; pragma Import (C, taskIsSuspended, "taskIsSuspended"); function taskDelay (ticks : int) return int; pragma Import (C, taskDelay, "taskDelay"); function sysClkRateGet return int; pragma Import (C, sysClkRateGet, "sysClkRateGet"); -- VxWorks 5.x specific functions -- Must not be called from run-time for versions that do not support -- taskVarLib: eg VxWorks 6 RTPs function taskVarAdd (tid : t_id; pVar : access System.Address) return int; pragma Import (C, taskVarAdd, "taskVarAdd"); function taskVarDelete (tid : t_id; pVar : access System.Address) return int; pragma Import (C, taskVarDelete, "taskVarDelete"); function taskVarSet (tid : t_id; pVar : access System.Address; value : System.Address) return int; pragma Import (C, taskVarSet, "taskVarSet"); function taskVarGet (tid : t_id; pVar : access System.Address) return int; pragma Import (C, taskVarGet, "taskVarGet"); -- VxWorks 6.x specific functions -- Can only be called from the VxWorks 6 run-time libary that supports -- tlsLib, and not by the VxWorks 6.6 SMP library function tlsKeyCreate return int; pragma Import (C, tlsKeyCreate, "tlsKeyCreate"); function tlsValueGet (key : int) return System.Address; pragma Import (C, tlsValueGet, "tlsValueGet"); function tlsValueSet (key : int; value : System.Address) return STATUS; pragma Import (C, tlsValueSet, "tlsValueSet"); -- Option flags for taskSpawn VX_UNBREAKABLE : constant := 16#0002#; VX_FP_PRIVATE_ENV : constant := 16#0080#; VX_NO_STACK_FILL : constant := 16#0100#; function taskSpawn (name : System.Address; -- Pointer to task name priority : int; options : int; stacksize : size_t; start_routine : System.Address; arg1 : System.Address; arg2 : int := 0; arg3 : int := 0; arg4 : int := 0; arg5 : int := 0; arg6 : int := 0; arg7 : int := 0; arg8 : int := 0; arg9 : int := 0; arg10 : int := 0) return t_id; pragma Import (C, taskSpawn, "taskSpawn"); procedure taskDelete (tid : t_id); pragma Import (C, taskDelete, "taskDelete"); function Set_Time_Slice (ticks : int) return int renames System.VxWorks.Ext.Set_Time_Slice; -- Calls kernelTimeSlice under VxWorks 5.x, VxWorks 653, or in VxWorks 6 -- kernel apps. Returns ERROR for RTPs, VxWorks 5 /CERT function taskPriorityGet (tid : t_id; pPriority : access int) return int; pragma Import (C, taskPriorityGet, "taskPriorityGet"); function taskPrioritySet (tid : t_id; newPriority : int) return int; pragma Import (C, taskPrioritySet, "taskPrioritySet"); -- Semaphore creation flags SEM_Q_FIFO : constant := 0; SEM_Q_PRIORITY : constant := 1; SEM_DELETE_SAFE : constant := 4; -- only valid for binary semaphore SEM_INVERSION_SAFE : constant := 8; -- only valid for binary semaphore -- Semaphore initial state flags SEM_EMPTY : constant := 0; SEM_FULL : constant := 1; -- Semaphore take (semTake) time constants WAIT_FOREVER : constant := -1; NO_WAIT : constant := 0; -- Error codes (errno). The lower level 16 bits are the error code, with -- the upper 16 bits representing the module number in which the error -- occurred. By convention, the module number is 0 for UNIX errors. VxWorks -- reserves module numbers 1-500, with the remaining module numbers being -- available for user applications. M_objLib : constant := 61 * 2**16; -- semTake() failure with ticks = NO_WAIT S_objLib_OBJ_UNAVAILABLE : constant := M_objLib + 2; -- semTake() timeout with ticks > NO_WAIT S_objLib_OBJ_TIMEOUT : constant := M_objLib + 4; subtype SEM_ID is System.VxWorks.Ext.SEM_ID; -- typedef struct semaphore *SEM_ID; -- We use two different kinds of VxWorks semaphores: mutex and binary -- semaphores. A null ID is returned when a semaphore cannot be created. function semBCreate (options : int; initial_state : int) return SEM_ID; pragma Import (C, semBCreate, "semBCreate"); -- Create a binary semaphore. Return ID, or 0 if memory could not -- be allocated. function semMCreate (options : int) return SEM_ID; pragma Import (C, semMCreate, "semMCreate"); function semDelete (Sem : SEM_ID) return int renames System.VxWorks.Ext.semDelete; -- Delete a semaphore function semGive (Sem : SEM_ID) return int; pragma Import (C, semGive, "semGive"); function semTake (Sem : SEM_ID; timeout : int) return int; pragma Import (C, semTake, "semTake"); -- Attempt to take binary semaphore. Error is returned if operation -- times out function semFlush (SemID : SEM_ID) return STATUS; pragma Import (C, semFlush, "semFlush"); -- Release all threads blocked on the semaphore ------------------------------------------------------------ -- Binary Semaphore Wrapper to Support interrupt Tasks -- ------------------------------------------------------------ type Binary_Semaphore_Id is new Long_Integer; function Binary_Semaphore_Create return Binary_Semaphore_Id; pragma Inline (Binary_Semaphore_Create); function Binary_Semaphore_Delete (ID : Binary_Semaphore_Id) return int; pragma Inline (Binary_Semaphore_Delete); function Binary_Semaphore_Obtain (ID : Binary_Semaphore_Id) return int; pragma Inline (Binary_Semaphore_Obtain); function Binary_Semaphore_Release (ID : Binary_Semaphore_Id) return int; pragma Inline (Binary_Semaphore_Release); function Binary_Semaphore_Flush (ID : Binary_Semaphore_Id) return int; pragma Inline (Binary_Semaphore_Flush); ------------------------------------------------------------ -- Hardware Interrupt Wrappers to Support Interrupt Tasks -- ------------------------------------------------------------ type Interrupt_Handler is access procedure (parameter : System.Address); pragma Convention (C, Interrupt_Handler); type Interrupt_Vector is new System.Address; function Interrupt_Connect (Vector : Interrupt_Vector; Handler : Interrupt_Handler; Parameter : System.Address := System.Null_Address) return int; pragma Inline (Interrupt_Connect); -- Use this to set up an user handler. The routine installs a user handler -- which is invoked after the OS has saved enough context for a high-level -- language routine to be safely invoked. function Interrupt_Context return int; pragma Inline (Interrupt_Context); -- Return 1 if executing in an interrupt context; return 0 if executing in -- a task context. function Interrupt_Number_To_Vector (intNum : int) return Interrupt_Vector; pragma Inline (Interrupt_Number_To_Vector); -- Convert a logical interrupt number to the hardware interrupt vector -- number used to connect the interrupt. -------------------------------- -- Processor Affinity for SMP -- -------------------------------- function taskCpuAffinitySet (tid : t_id; CPU : int) return int renames System.VxWorks.Ext.taskCpuAffinitySet; -- For SMP run-times the affinity to CPU. -- For uniprocessor systems return ERROR status. function taskMaskAffinitySet (tid : t_id; CPU_Set : unsigned) return int renames System.VxWorks.Ext.taskMaskAffinitySet; -- For SMP run-times the affinity to CPU_Set. -- For uniprocessor systems return ERROR status. --------------------- -- Multiprocessors -- --------------------- function Current_CPU return Multiprocessors.CPU; -- Return the id of the current CPU private type pid_t is new int; ERROR_PID : constant pid_t := -1; type sigset_t is new System.VxWorks.Ext.sigset_t; end System.OS_Interface;
------------------------------------------------------------------------------ -- Copyright (c) 2013-2016, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ with Ada.Strings.Fixed; package body Natools.String_Slices.Slice_Sets is package Fixed renames Ada.Strings.Fixed; --------------------------- -- Range_Set subprograms -- --------------------------- function Is_Overlapping (Bounds : String_Range; Set : Range_Set) return Boolean is Cursor : Range_Sets.Cursor := Set.Floor (Bounds); begin if Range_Sets.Has_Element (Cursor) then if Bounds.First <= Last (Range_Sets.Element (Cursor)) then return True; end if; Range_Sets.Next (Cursor); else Cursor := Set.First; end if; if Range_Sets.Has_Element (Cursor) and then Range_Sets.Element (Cursor).First <= Last (Bounds) then return True; end if; return False; end Is_Overlapping; function Is_Valid (Set : Range_Set) return Boolean is Cursor : Range_Sets.Cursor := Set.First; Prev, Cur : String_Range; begin if not Range_Sets.Has_Element (Cursor) then return True; end if; Prev := Range_Sets.Element (Cursor); if Prev.Length = 0 then return False; end if; Range_Sets.Next (Cursor); while Range_Sets.Has_Element (Cursor) loop Cur := Range_Sets.Element (Cursor); if Cur.Length = 0 then return False; end if; pragma Assert (Prev.First <= Cur.First); if Is_In (Last (Prev), Cur) then return False; end if; Prev := Cur; Range_Sets.Next (Cursor); end loop; return True; end Is_Valid; function Total_Span (Set : Range_Set) return String_Range is Result : String_Range := (1, 0); Cursor : Range_Sets.Cursor := Set.First; begin if not Range_Sets.Has_Element (Cursor) then return Result; end if; Result.First := Range_Sets.Element (Cursor).First; Cursor := Set.Last; Set_Last (Result, Last (Range_Sets.Element (Cursor))); return Result; end Total_Span; procedure Include_Range (Set : in out Range_Set; Bounds : in String_Range) is Cursor : Range_Sets.Cursor := Set.Floor (Bounds); Next : Range_Sets.Cursor; Actual : String_Range := Bounds; R : String_Range; begin if Range_Sets.Has_Element (Cursor) then R := Range_Sets.Element (Cursor); Next := Range_Sets.Next (Cursor); -- Do nothing if the given range is already covered if Is_Subrange (Actual, R) then return; end if; -- Merge with previous range if overlapping if Is_In (Actual.First, R) then Set_First (Actual, R.First); Set.Delete (Cursor); end if; else Next := Set.First; end if; while Range_Sets.Has_Element (Next) loop Cursor := Next; R := Range_Sets.Element (Cursor); exit when not Is_In (R.First, Actual); Next := Range_Sets.Next (Cursor); if Is_Subrange (R, Actual) then Set.Delete (Cursor); else pragma Assert (Last (R) > Last (Actual)); Set_Last (Actual, Last (R)); Set.Delete (Cursor); end if; end loop; Set.Insert (Actual); pragma Assert (Is_Valid (Set)); end Include_Range; procedure Exclude_Range (Set : in out Range_Set; Bounds : in String_Range) is Cursor : Range_Sets.Cursor; R : String_Range; begin if Bounds.Length = 0 then return; end if; Cursor := Set.Floor (Bounds); if Range_Sets.Has_Element (Cursor) then R := Range_Sets.Element (Cursor); if R.First < Bounds.First then if Is_In (Bounds.First, R) then if Is_In (Last (Bounds) + 1, R) then Set.Insert (To_Range (Last (Bounds) + 1, Last (R))); end if; Set_Last (R, Bounds.First - 1); pragma Assert (R.Length > 0); Set.Replace_Element (Cursor, R); end if; Range_Sets.Next (Cursor); end if; else Cursor := Set.First; end if; while Range_Sets.Has_Element (Cursor) and then Is_Subrange (Range_Sets.Element (Cursor), Bounds) loop declare Next : constant Range_Sets.Cursor := Range_Sets.Next (Cursor); begin Set.Delete (Cursor); Cursor := Next; end; end loop; if Range_Sets.Has_Element (Cursor) and then Is_In (Last (Bounds) + 1, Range_Sets.Element (Cursor)) then R := Range_Sets.Element (Cursor); Set_First (R, Last (Bounds) + 1); Set.Replace_Element (Cursor, R); end if; pragma Assert (Is_Valid (Set)); end Exclude_Range; ------------------------------- -- Public helper subprograms -- ------------------------------- function "<" (Left, Right : String_Range) return Boolean is begin return Left.First < Right.First; end "<"; ---------------------------- -- Conversion subprograms -- ---------------------------- function To_Slice (S : Slice_Set) return Slice is use type Ada.Containers.Count_Type; begin if S.Ref.Is_Empty then return Null_Slice; end if; if S.Bounds.Is_Empty then return Slice'(Bounds => (1, 0), Ref => S.Ref); elsif S.Bounds.Length = 1 then return Slice'(Bounds => S.Bounds.First_Element, Ref => S.Ref); end if; return To_Slice (To_String (S)); end To_Slice; function To_Slice_Set (S : String) return Slice_Set is function Factory return String; function Factory return String is begin return S; end Factory; Result : Slice_Set; begin Result.Ref := String_Refs.Create (Factory'Access); if S'Length > 0 then Result.Bounds.Insert ((S'First, S'Length)); end if; return Result; end To_Slice_Set; function To_Slice_Set (S : Slice) return Slice_Set is Result : Slice_Set; begin Result.Ref := S.Ref; if S.Bounds.Length > 0 then Result.Bounds.Insert (S.Bounds); end if; return Result; end To_Slice_Set; function To_String (Set : Slice_Set) return String is Cursor : Range_Sets.Cursor := Set.Bounds.First; R : String_Range; I : Positive := 1; begin return Result : String (1 .. Set.Total_Length) do while Range_Sets.Has_Element (Cursor) loop R := Range_Sets.Element (Cursor); Result (I .. I + R.Length - 1) := Set.Ref.Query.Data.all (R.First .. Last (R)); I := I + R.Length; Range_Sets.Next (Cursor); end loop; pragma Assert (I = Result'Last + 1); end return; end To_String; function To_String (Set : Slice_Set; Subrange : String_Range) return String is begin return Set.Subset (Subrange).To_String; end To_String; function To_String (Set : Slice_Set; First : Positive; Last : Natural) return String is begin return Set.Subset (To_Range (First, Last)).To_String; end To_String; --------------------------------- -- Basic slice-set subprograms -- --------------------------------- procedure Clear (Set : in out Slice_Set) is begin Set.Bounds.Clear; end Clear; function Element (Set : Slice_Set; Index : Positive) return Character is begin if not Is_In (Set, Index) then raise Constraint_Error; end if; return Set.Ref.Query.Data.all (Index); end Element; function First (Set : Slice_Set) return Positive is Cursor : constant Range_Sets.Cursor := Set.Bounds.First; begin if Range_Sets.Has_Element (Cursor) then return Range_Sets.Element (Cursor).First; else return 1; end if; end First; function Is_Empty (Set : Slice_Set) return Boolean is begin return Set.Bounds.Is_Empty; end Is_Empty; function Is_In (Set : Slice_Set; Index : Natural) return Boolean is Cursor : Range_Sets.Cursor; begin if Index = 0 or else Set.Ref.Is_Empty or else Set.Bounds.Is_Empty then return False; end if; Cursor := Set.Bounds.Floor ((Index, 0)); return Range_Sets.Has_Element (Cursor) and then Is_In (Index, Range_Sets.Element (Cursor)); end Is_In; function Is_Null (Set : Slice_Set) return Boolean is begin return Set.Ref.Is_Empty; end Is_Null; function Is_Valid (Set : Slice_Set) return Boolean is begin if Set.Ref.Is_Empty then return Set.Bounds.Is_Empty; else return Is_Subrange (Total_Span (Set.Bounds), Get_Range (Set.Ref.Query.Data.all)) and then Is_Valid (Set.Bounds); end if; end Is_Valid; function Last (Set : Slice_Set) return Natural is Cursor : constant Range_Sets.Cursor := Set.Bounds.Last; begin if Range_Sets.Has_Element (Cursor) then return Last (Range_Sets.Element (Cursor)); else return 0; end if; end Last; -- Multistep version: -- function Next (Set : Slice_Set; Index : Natural; Steps : Positive := 1) -- return Natural -- is -- Cursor : Range_Sets.Cursor; -- Target : Positive := Index + Steps; -- Skipped : Natural; -- R : String_Range; -- begin -- if Index = 0 or else Set.Ref.Is_Empty or else Set.Bounds.Is_Empty then -- raise Constraint_Error; -- end if; -- -- Cursor := Set.Bounds.Floor ((Index, 0)); -- -- if not Range_Sets.Has_Element (Cursor) then -- raise Constraint_Error with "Next with index out of bounds"; -- end if; -- -- R := Range_Sets.Element (Cursor); -- loop -- if Is_In (Target, R) then -- return Target; -- end if; -- -- Skipped := Last (R) + 1; -- Range_Sets.Next (Cursor); -- exit when not Range_Sets.Has_Element (Cursor); -- R := Range_Sets.Element (Cursor); -- Skipped := R.First - Skipped; -- Target := Target + Skipped; -- end loop; -- -- return 0; -- end Next; function Next (Set : Slice_Set; Index : Natural) return Natural is Cursor : Range_Sets.Cursor; begin if Index = 0 or else Set.Ref.Is_Empty or else Set.Bounds.Is_Empty then raise Constraint_Error; end if; Cursor := Set.Bounds.Floor ((Index, 0)); if not Range_Sets.Has_Element (Cursor) then raise Constraint_Error with "Next with index out of bounds"; end if; if Is_In (Index + 1, Range_Sets.Element (Cursor)) then return Index + 1; else Range_Sets.Next (Cursor); if Range_Sets.Has_Element (Cursor) then return Range_Sets.Element (Cursor).First; else return 0; end if; end if; end Next; procedure Next (Set : in Slice_Set; Index : in out Natural) is begin Index := Next (Set, Index); end Next; -- Multistep version: -- function Previous (Set : Slice_Set; Index : Natural; Steps : Positive := 1) -- return Natural -- is -- Cursor : Range_Sets.Cursor; -- Target : Positive; -- Prev_First : Positive; -- Skipped : Natural; -- R : String_Range; -- begin -- if Index = 0 or else Set.Ref.Is_Empty or else Set.Bounds.Is_Empty then -- raise Constraint_Error; -- end if; -- -- if Steps >= Index then -- return 0; -- end if; -- Target := Index - Steps; -- -- Cursor := Set.Bounds.Floor ((Index, 0)); -- if not Range_Sets.Has_Element (Cursor) then -- raise Constraint_Error with "Previous with index out of bounds"; -- end if; -- -- loop -- R := Range_Sets.Element (Cursor); -- if Is_In (Target, R) then -- return Target; -- end if; -- -- Prev_First := R.First; -- Range_Sets.Previous (Cursor); -- exit when not Range_Sets.Has_Element (Cursor); -- R := Range_Sets.Element (Cursor); -- -- Skipped := Prev_First - (Last (R) + 1); -- exit when Skipped >= Target; -- Target := Target - Skipped; -- end loop; -- -- return 0; -- end Previous; function Previous (Set : Slice_Set; Index : Natural) return Natural is Cursor : Range_Sets.Cursor; begin if Index = 0 or else Set.Ref.Is_Empty or else Set.Bounds.Is_Empty then raise Constraint_Error; end if; Cursor := Set.Bounds.Floor ((Index, 0)); if not Range_Sets.Has_Element (Cursor) then raise Constraint_Error with "Previous with index out of bounds"; end if; if Is_In (Index - 1, Range_Sets.Element (Cursor)) then return Index - 1; else Range_Sets.Previous (Cursor); if Range_Sets.Has_Element (Cursor) then return Last (Range_Sets.Element (Cursor)); else return 0; end if; end if; end Previous; procedure Previous (Set : in Slice_Set; Index : in out Natural) is begin Index := Previous (Set, Index); end Previous; function Total_Length (Set : Slice_Set) return Natural is Cursor : Range_Sets.Cursor := Set.Bounds.First; Result : Natural := 0; begin while Range_Sets.Has_Element (Cursor) loop Result := Result + Range_Sets.Element (Cursor).Length; Range_Sets.Next (Cursor); end loop; return Result; end Total_Length; ---------------------------- -- Operation on slice set -- ---------------------------- procedure Add_Slice (Set : in out Slice_Set; Bounds : in String_Range) is begin if Bounds.Length = 0 then return; end if; if Set.Ref.Is_Empty then raise Constraint_Error with "Cannot add range to null slice set"; end if; if not Is_Subrange (Bounds, Get_Range (Set.Ref.Query.Data.all)) then raise Constraint_Error with "Add slice outside of parent"; end if; if Is_Overlapping (Bounds, Set.Bounds) then raise Constraint_Error with "Add an overlapping slice to a set"; end if; Set.Bounds.Insert (Bounds); end Add_Slice; procedure Add_Slice (Set : in out Slice_Set; S : in Slice) is use type String_Refs.Immutable_Reference; begin if S.Bounds.Length = 0 then return; end if; if Set.Ref.Is_Empty then pragma Assert (Set.Bounds.Is_Empty); Set.Ref := S.Ref; Set.Bounds.Insert (S.Bounds); return; end if; if Set.Ref /= S.Ref then raise Constraint_Error with "Addition of an unrelated slice to a slice set"; end if; if Is_Overlapping (S.Bounds, Set.Bounds) then raise Constraint_Error with "Addition of an overlapping slice to a slice set"; end if; Set.Bounds.Insert (S.Bounds); end Add_Slice; procedure Add_Slice (Set : in out Slice_Set; First : in Positive; Last : in Natural) is begin Add_Slice (Set, To_Range (First, Last)); end Add_Slice; procedure Include_Slice (Set : in out Slice_Set; Bounds : in String_Range) is begin if Bounds.Length = 0 then return; end if; if Set.Ref.Is_Empty then raise Constraint_Error with "Cannot include range to null slice set"; end if; if not Is_Subrange (Bounds, Get_Range (Set.Ref.Query.Data.all)) then raise Constraint_Error with "Include slice outside of parent"; end if; Include_Range (Set.Bounds, Bounds); end Include_Slice; procedure Include_Slice (Set : in out Slice_Set; S : in Slice) is use type String_Refs.Immutable_Reference; begin if S.Bounds.Length = 0 then return; end if; if Set.Ref.Is_Empty then pragma Assert (Set.Bounds.Is_Empty); Set.Ref := S.Ref; Set.Bounds.Insert (S.Bounds); return; end if; if Set.Ref /= S.Ref then raise Constraint_Error with "Addition of an unrelated slice to a slice set"; end if; Include_Range (Set.Bounds, S.Bounds); end Include_Slice; procedure Include_Slice (Set : in out Slice_Set; First : in Positive; Last : in Natural) is begin Include_Slice (Set, To_Range (First, Last)); end Include_Slice; procedure Exclude_Slice (Set : in out Slice_Set; Bounds : in String_Range) is begin if Bounds.Length = 0 then return; end if; if Set.Ref.Is_Empty then raise Constraint_Error with "Cannot exclude range from null slice set"; end if; Exclude_Range (Set.Bounds, Bounds); end Exclude_Slice; procedure Exclude_Slice (Set : in out Slice_Set; First : in Positive; Last : in Natural) is begin Exclude_Slice (Set, To_Range (First, Last)); end Exclude_Slice; procedure Restrict (Set : in out Slice_Set; Bounds : in String_Range) is begin if Set.Ref.Is_Empty then raise Constraint_Error with "Cannot restrict null slice set"; end if; if Bounds.Length = 0 then Set.Bounds.Clear; else declare Set_First : constant Positive := Set.First; Set_Last : constant Natural := Set.Last; begin if Set_First < Bounds.First then Exclude_Range (Set.Bounds, To_Range (Set_First, Bounds.First - 1)); end if; if Set_Last > Last (Bounds) then Exclude_Range (Set.Bounds, To_Range (Last (Bounds) + 1, Set_Last)); end if; end; end if; end Restrict; procedure Restrict (Set : in out Slice_Set; First : in Positive; Last : in Natural) is begin Restrict (Set, To_Range (First, Last)); end Restrict; function Subset (Set : Slice_Set; Bounds : String_Range) return Slice_Set is Result : Slice_Set; Cursor : Range_Sets.Cursor; R : String_Range; begin if Set.Ref.Is_Empty then raise Constraint_Error with "Subset of null slice set"; end if; Result.Ref := Set.Ref; if Bounds.Length = 0 or else Set.Bounds.Is_Empty then return Result; end if; Cursor := Set.Bounds.Floor (Bounds); if Range_Sets.Has_Element (Cursor) then R := Range_Sets.Element (Cursor); if R.First < Bounds.First then if Is_In (Bounds.First, R) then Set_First (R, Bounds.First); if Is_In (Last (Bounds), R) then Set_Last (R, Last (Bounds)); end if; Result.Bounds.Insert (R); end if; Range_Sets.Next (Cursor); end if; else Cursor := Set.Bounds.First; end if; while Range_Sets.Has_Element (Cursor) loop R := Range_Sets.Element (Cursor); if Is_Subrange (R, Bounds) then Result.Bounds.Insert (R); else if Is_In (Last (Bounds), R) then Set_Last (R, Last (Bounds)); Result.Bounds.Insert (R); end if; exit; end if; Range_Sets.Next (Cursor); end loop; return Result; end Subset; function Subset (Set : Slice_Set; First : Positive; Last : Natural) return Slice_Set is begin return Subset (Set, To_Range (First, Last)); end Subset; procedure Cut_Before (Set : in out Slice_Set; Index : in Positive) is Cursor : Range_Sets.Cursor; Lower, Upper : String_Range; begin if Set.Ref.Is_Empty or else Set.Bounds.Is_Empty then raise Constraint_Error; end if; Cursor := Set.Bounds.Floor ((Index, 0)); if not Range_Sets.Has_Element (Cursor) then raise Constraint_Error; end if; Lower := Range_Sets.Element (Cursor); if not Is_In (Index, Lower) then raise Constraint_Error; end if; if Lower.First = Index then return; -- nothing to do end if; Upper := Lower; Set_Last (Lower, Index - 1); Set_First (Upper, Index); Set.Bounds.Delete (Cursor); Set.Bounds.Insert (Lower); Set.Bounds.Insert (Upper); end Cut_Before; --------------- -- Iterators -- --------------- procedure Trim_Slices (Set : in out Slice_Set; Trim : not null access function (Slice : String) return String_Range) is Cursor : Range_Sets.Cursor := Set.Bounds.First; Old_Range, New_Range : String_Range; begin while Range_Sets.Has_Element (Cursor) loop Old_Range := Range_Sets.Element (Cursor); New_Range := Trim.all (Set.Ref.Query.Data.all (Old_Range.First .. Last (Old_Range))); if New_Range.Length = 0 then declare Next : constant Range_Sets.Cursor := Range_Sets.Next (Cursor); begin Set.Bounds.Delete (Cursor); Cursor := Next; end; else if not Is_Subrange (New_Range, Old_Range) then raise Constraint_Error with "Trim not returning a subrange"; end if; Set.Bounds.Replace_Element (Cursor, New_Range); Range_Sets.Next (Cursor); end if; end loop; end Trim_Slices; procedure Query_Slices (Set : in Slice_Set; Process : not null access procedure (S : in Slice)) is Cursor : Range_Sets.Cursor := Set.Bounds.First; begin while Range_Sets.Has_Element (Cursor) loop Process.all (Slice'(Range_Sets.Element (Cursor), Set.Ref)); Range_Sets.Next (Cursor); end loop; end Query_Slices; ---------------------- -- Search functions -- ---------------------- function Find_Slice (Set : Slice_Set; From : Positive; Test : not null access function (Slice : String) return Boolean; Going : Ada.Strings.Direction := Ada.Strings.Forward) return String_Range is Cursor : Range_Sets.Cursor; Update : access procedure (C : in out Range_Sets.Cursor); R : String_Range; begin if Set.Ref.Is_Empty then raise Constraint_Error with "Find_Slice on null slice set"; end if; case Going is when Ada.Strings.Forward => Update := Range_Sets.Next'Access; when Ada.Strings.Backward => Update := Range_Sets.Previous'Access; end case; Cursor := Set.Bounds.Floor ((From, 0)); while Range_Sets.Has_Element (Cursor) loop R := Range_Sets.Element (Cursor); if Test.all (Set.Ref.Query.Data.all (R.First .. Last (R))) then return R; end if; Update.all (Cursor); end loop; return (1, 0); end Find_Slice; function Find_Slice (Set : Slice_Set; Test : not null access function (Slice : String) return Boolean; Going : Ada.Strings.Direction := Ada.Strings.Forward) return String_Range is begin case Going is when Ada.Strings.Forward => return Find_Slice (Set, Set.First, Test, Going); when Ada.Strings.Backward => return Find_Slice (Set, Set.Last, Test, Going); end case; end Find_Slice; function Index (Source : Slice_Set; Set : Ada.Strings.Maps.Character_Set; From : Positive; Test : Ada.Strings.Membership := Ada.Strings.Inside; Going : Ada.Strings.Direction := Ada.Strings.Forward) return Natural is Cursor : Range_Sets.Cursor; Update : access procedure (C : in out Range_Sets.Cursor); R : String_Range; Result : Natural := 0; begin case Going is when Ada.Strings.Forward => Update := Range_Sets.Next'Access; when Ada.Strings.Backward => Update := Range_Sets.Previous'Access; end case; Cursor := Source.Bounds.Floor ((From, 0)); if not Range_Sets.Has_Element (Cursor) then raise Ada.Strings.Index_Error; end if; R := Range_Sets.Element (Cursor); if Is_In (From, R) then Result := Fixed.Index (Source.Ref.Query.Data.all (R.First .. Last (R)), Set, From, Test, Going); end if; while Result = 0 loop Update.all (Cursor); if not Range_Sets.Has_Element (Cursor) then return 0; end if; R := Range_Sets.Element (Cursor); Result := Fixed.Index (Source.Ref.Query.Data.all (R.First .. Last (R)), Set, Test, Going); end loop; return Result; end Index; function Index (Source : Slice_Set; Set : Ada.Strings.Maps.Character_Set; Test : Ada.Strings.Membership := Ada.Strings.Inside; Going : Ada.Strings.Direction := Ada.Strings.Forward) return Natural is begin case Going is when Ada.Strings.Forward => return Index (Source, Set, Source.First, Test, Going); when Ada.Strings.Backward => return Index (Source, Set, Source.Last, Test, Going); end case; end Index; end Natools.String_Slices.Slice_Sets;
private package Protypo.Code_Trees.Interpreter.Statements is procedure Run (Status : Interpreter_Access; Program : not null Node_Access) with Pre => Program.Class in Statement_Classes; procedure Run (Status : Interpreter_Access; Program : Node_Vectors.Vector); procedure Do_Procedure_Call (Status : Interpreter_Access; Name : Unbounded_id; Params : Node_Vectors.Vector); -- Why do we export this? Because the "capture" in the expression -- evaluation package needs to call a procedure end Protypo.Code_Trees.Interpreter.Statements;
------------------------------------------------------------------------------ -- -- -- Common UUID Handling Package -- -- - RFC 4122 Implementation - -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2018-2020 ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * Richard Wai, Ensi Martini, Aninda Poddar, Noshen Atashe -- -- (ANNEXI-STRAYLINE) -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with System; with Ada.Exceptions; use Ada; with Hex.Modular_Codec; package body UUIDs is -- Portability Constraints -- ----------------------------- -- The bitwise manipulation conventions of this package assumes that -- Storage_Unit is 8 bits. For other machines, the relevant Record -- Representation Clause position values should be modified as appropriate -- for this package, and all relevant child packages pragma Assert (Check => System.Storage_Unit = 8, Message => "This package requires a target with an 8-bit " & "Storage_Element size."); package HMC_48 is new Hex.Modular_Codec(Bitfield_48, 48); package HMC_32 is new Hex.Modular_Codec(Bitfield_32, 32); package HMC_16 is new Hex.Modular_Codec(Bitfield_16, 16); package HMC_8 is new Hex.Modular_Codec(Bitfield_8, 8); -- -- UUID Comparison and Equality Operators -- --------- -- ">" -- --------- function ">"(Left, Right: UUID) return Boolean is begin if Left.time_low > Right.time_low then return True; elsif Left.time_low = Right.time_low then if Left.time_mid > Right.time_mid then return True; elsif Left.time_mid = Right.time_mid then if Left.time_hi_and_version > Right.time_hi_and_version then return True; elsif Left.time_hi_and_version = Right.time_hi_and_version then if Left.clock_seq_hi_and_reserved > Right.clock_seq_hi_and_reserved then return True; elsif Left.clock_seq_hi_and_reserved = Right.clock_seq_hi_and_reserved then if Left.clock_seq_low > Right.clock_seq_low then return True; elsif Left.clock_seq_low = Right.clock_seq_low then if Left.node > Right.node then return True; end if; end if; end if; end if; end if; end if; return False; end ">"; --------- -- "<" -- --------- function "<"(Left, Right: UUID) return Boolean is begin if Left.time_low < Right.time_low then return True; elsif Left.time_low = Right.time_low then if Left.time_mid < Right.time_mid then return True; elsif Left.time_mid = Right.time_mid then if Left.time_hi_and_version < Right.time_hi_and_version then return True; elsif Left.time_hi_and_version = Right.time_hi_and_version then if Left.clock_seq_hi_and_reserved < Right.clock_seq_hi_and_reserved then return True; elsif Left.clock_seq_hi_and_reserved = Right.clock_seq_hi_and_reserved then if Left.clock_seq_low < Right.clock_seq_low then return True; elsif Left.clock_seq_low = Right.clock_seq_low then if Left.node < Right.node then return True; end if; end if; end if; end if; end if; end if; return False; end "<"; -- -- UUID Encode/Decode Operations -- ------------ -- Encode -- ------------ function Encode (ID : UUID) return UUID_String is use Hex; Output : UUID_String; -- We need to have zero-filled values of the exact length in -- all cases Hex_8 : String (1 .. HMC_8.Max_Nibbles); Hex_16: String (1 .. HMC_16.Max_Nibbles); Hex_32: String (1 .. HMC_32.Max_Nibbles); Hex_48: String (1 .. HMC_48.Max_Nibbles); begin -- time_low HMC_32.Encode (Value => ID.time_low, Buffer => Hex_32); Output(UUID_String_time_low) := Hex_32; Output(UUID_String_Hyphen_1) := "-"; -- time_mid HMC_16.Encode (Value => ID.time_mid, Buffer => Hex_16); Output(UUID_String_time_mid) := Hex_16; Output(UUID_String_Hyphen_2) := "-"; -- time_high_and_version HMC_16.Encode (Value => ID.time_hi_and_version, Buffer => Hex_16); Output(UUID_String_time_high_and_version) := Hex_16; Output(UUID_String_Hyphen_3) := "-"; -- clock_seq_and_reserved HMC_8.Encode (Value => ID.clock_seq_hi_and_reserved, Buffer => Hex_8); Output(UUID_String_clock_seq_and_reserved) := Hex_8; -- clock_seq_low HMC_8.Encode (Value => ID.clock_seq_low, Buffer => Hex_8); Output(UUID_String_clock_seq_low) := Hex_8; Output(UUID_String_Hyphen_4) := "-"; -- node HMC_48.Encode (Value => ID.node, Buffer => Hex_48); Output(UUID_String_node) := Hex_48; return Output; end Encode; ------------ -- Decode -- ------------ function Decode (ID_String: UUID_String) return UUID is Output_UUID : UUID; Basic_Error: constant String := "String is not a valid UUID value. "; procedure Assert_Hex (Candidate: String) with Inline is begin if not Hex.Valid_Hex_String (Candidate) then raise UUID_Format_Error with Basic_Error & "Expected hexadecimal."; end if; end; procedure Assert_Length (Candidate: String; Expected: Positive) with Inline is begin -- This assertion should technically not possibly fail.. But -- above all else it will be stable, since the lengths are set -- by the spec of this package. This is a good candidate to -- remove as an optimization if Candidate'Length /= Expected then raise UUID_Format_Error with Basic_Error & "Field is not the correct length"; end if; end; begin if ID_String(UUID_String_Hyphen_1) /= "-" or else ID_String(UUID_String_Hyphen_2) /= "-" or else ID_String(UUID_String_Hyphen_3) /= "-" or else ID_String(UUID_String_Hyphen_4) /= "-" then raise UUID_Format_Error with "String is not a valid UUID value. Hyphens are missing, or " & "incorrectly placed."; end if; -- We need to ensure we can satisfy the preconditions of the Decode -- subprogram of the Hex codecs -- time_low field -- declare TLS: String renames ID_String(UUID_String_time_low); begin Assert_Hex (TLS); Assert_Length (TLS, HMC_32.Max_Nibbles); Output_UUID.time_low := HMC_32.Decode (TLS); end; -- time_mid field -- declare TMS: String renames ID_String(UUID_String_time_mid); begin Assert_Hex (TMS); Assert_Length (TMS, HMC_16.Max_Nibbles); Output_UUID.time_mid := HMC_16.Decode (TMS); end; -- time_hi_and_Version field -- declare THVS: String renames ID_String(UUID_String_time_high_and_version); begin Assert_Hex (THVS); Assert_Length (THVS, HMC_16.Max_Nibbles); Output_UUID.time_hi_and_version := HMC_16.Decode (THVS); end; -- clock_seq_hi_and_reserved field -- declare CSHRS: String renames ID_String(UUID_String_clock_seq_and_reserved); begin Assert_Hex (CSHRS); Assert_Length (CSHRS, HMC_8.Max_Nibbles); Output_UUID.clock_seq_hi_and_reserved := HMC_8.Decode (CSHRS); end; -- clock_seq_low field -- declare CSLS: String renames ID_String(UUID_String_clock_seq_low); begin Assert_Hex (CSLS); Assert_Length (CSLS, HMC_8.Max_Nibbles); Output_UUID.clock_seq_low := HMC_8.Decode (CSLS); end; -- node field -- declare NS: String renames ID_String(UUID_String_node); begin Assert_Hex (NS); Assert_Length (NS, HMC_48.Max_Nibbles); Output_UUID.node := HMC_48.Decode (NS); end; return Output_UUID; end Decode; -- -- Hashing -- ---------- -- Hash -- ---------- function Hash (ID: UUID) return Ada.Containers.Hash_Type is use Ada.Containers; begin return Result: Hash_Type do Result := Hash_Type'Mod (ID.time_low); Result := Result xor Hash_Type'Mod (ID.time_mid); Result := Result xor Hash_Type'Mod (ID.time_hi_and_version); Result := Result xor Hash_Type'Mod (ID.clock_seq_hi_and_reserved); Result := Result xor Hash_Type'Mod (ID.clock_seq_low); Result := Result xor Hash_Type'Mod (ID.node); end return; end; -- -- Binary IO -- -- On the wire, the UUID needs to be packed into a 128-bit value. Since -- ultimately going to be translating into contigious octets, we really need -- to construct each one at a time. -- -- For reference, the conceptual in-memory representation of the full -- value would look like this, Bit_Order => high High_Order_First -- -- for Wire_UUID use -- record -- time_low at 0 range 0 .. 31; -- time_mid at 0 range 32 .. 47; -- time_hi_and_version at 0 range 48 .. 63; -- clock_seq_hi_and_reserved at 8 range 0 .. 7; -- clock_seq_low at 8 range 8 .. 15; -- node at 8 range 16 .. 63; -- end record; pragma Assert (Check => Ada.Streams.Stream_Element'Modulus = Interfaces.Unsigned_8'Modulus, Message => "Warning Stream output might not be contiguous."); --------------- -- To_Binary -- --------------- function To_Binary (ID: in UUID) return Binary_UUID is use Interfaces; Accumulator: Unsigned_8; Arranger_32: Unsigned_32; Arranger_64: Unsigned_64; Current_Octet: Integer := UUID_Binary_MSB; procedure Push_Accumulator (Target: in out Binary_UUID) with Inline is begin Target (Current_Octet) := Accumulator; Current_Octet := Current_Octet - 1; end; begin -- We'll construct it in big-endian order, just to be logically -- consistent return Bin: Binary_UUID do -- Take advantage of build-in-place, if available Arranger_32 := Unsigned_32 (ID.time_low); for I in reverse 0 .. 3 loop Accumulator := Unsigned_8 (Shift_Right (Arranger_32, 8 * I) and 16#ff#); Push_Accumulator (Bin); end loop; Arranger_32 := Unsigned_32 (ID.time_mid); for I in reverse 0 .. 1 loop Accumulator := Unsigned_8 (Shift_Right (Arranger_32, 8 * I) and 16#ff#); Push_Accumulator (Bin); end loop; Arranger_32 := Unsigned_32 (ID.time_hi_and_version); for I in reverse 0 .. 1 loop Accumulator := Unsigned_8 (Shift_Right (Arranger_32, 8 * I) and 16#ff#); Push_Accumulator (Bin); end loop; Accumulator := Unsigned_8 (ID.clock_seq_hi_and_reserved); Push_Accumulator (Bin); Accumulator := Unsigned_8 (ID.clock_seq_low); Push_Accumulator (Bin); Arranger_64 := Unsigned_64 (ID.node); for I in reverse 0 .. 5 loop Accumulator := Unsigned_8 (Shift_Right (Arranger_64, 8 * I) and 16#ff#); Push_Accumulator (Bin); end loop; end return; end To_Binary; ----------------- -- From_Binary -- ----------------- function From_Binary (ID: in Binary_UUID) return UUID is use Interfaces; Current_Octet: Integer := UUID_Binary_MSB; function Pop_Accumulator return Unsigned_8 with Inline is begin Current_Octet := Current_Octet - 1; return ID (Current_Octet + 1); end; Accumulator: Unsigned_8; Arranger_32: Unsigned_32; Arranger_64: Unsigned_64; begin return ID: UUID do -- Simply reverse To_Binary Arranger_32 := 0; for I in 0 .. 3 loop Accumulator := Pop_Accumulator; Arranger_32 := Shift_Left (Arranger_32, 8); Arranger_32 := Arranger_32 + Unsigned_32 (Accumulator); end loop; ID.time_low := Bitfield_32 (Arranger_32); Arranger_32 := 0; for I in 0 .. 1 loop Accumulator := Pop_Accumulator; Arranger_32 := Shift_Left (Arranger_32, 8); Arranger_32 := Arranger_32 + Unsigned_32 (Accumulator); end loop; ID.time_mid := Bitfield_16 (Arranger_32); Arranger_32 := 0; for I in 0 .. 1 loop Accumulator := Pop_Accumulator; Arranger_32 := Shift_Left (Arranger_32, 8); Arranger_32 := Arranger_32 + Unsigned_32 (Accumulator); end loop; ID.time_hi_and_version := Bitfield_16 (Arranger_32); Accumulator := Pop_Accumulator; ID.clock_seq_hi_and_reserved := Bitfield_8 (Accumulator); Accumulator := Pop_Accumulator; ID.clock_seq_low := Bitfield_8 (Accumulator); Arranger_64 := 0; for I in 0 .. 5 loop Accumulator := Pop_Accumulator; Arranger_64 := Shift_Left (Arranger_64, 8); Arranger_64 := Arranger_64 + Unsigned_64 (Accumulator); end loop; ID.node := Bitfield_48 (Arranger_64); end return; end From_Binary; ----------- -- Write -- ----------- procedure Write (Stream: not null access Ada.Streams.Root_Stream_Type'Class; ID : in UUID) is Bin: constant Binary_UUID := To_Binary (ID); begin for Octet of reverse Bin loop Interfaces.Unsigned_8'Write (Stream, Octet); end loop; end; ---------- -- Read -- ---------- procedure Read (Stream: not null access Ada.Streams.Root_Stream_Type'Class; ID : out UUID) is Bin: Binary_UUID; begin for Octet of reverse Bin loop Interfaces.Unsigned_8'Read (Stream, Octet); end loop; ID := From_Binary (Bin); end; ------------- -- Version -- ------------- function Version (ID: UUID) return UUID_Version is begin return UUID_Version((ID.time_hi_and_version and 16#f000#) / 2 ** 12); -- This will do a run-time check, and if it fails, Constraint_Error will -- be raised into this function, which we can then catch in a catch-all -- handler exception when others => return 0; end Version; end UUIDs;
with Ada.Text_IO; use Ada.Text_IO; procedure Challenge_399_Easy is function Letter_Sum( A : String ) return Integer is Base : constant Integer := (Character'pos('a') - 1); Sum : Integer := 0; begin for I in A'Range loop Sum := Sum + Character'pos(A(I)) - Base; end loop; return Sum; end Letter_Sum; begin Put_Line(Integer'Image(Letter_Sum("microspectrophotometries"))); end Challenge_399_Easy;
-- { dg-do compile } package Atomic2 is type Rec1 is record C : Character; I : Integer; pragma Atomic (I); end record; for Rec1 use record C at 0 range 0 .. 7; I at 1 range 0 .. 31; -- { dg-error "position of atomic field" } end record; type Rec2 is record C : Character; I : Integer; pragma Atomic (I); end record; pragma Pack (Rec2); type My_Int is new Integer; for My_Int'Alignment use 1; pragma Atomic (My_Int); -- { dg-error "atomic access" } end Atomic2;
with C.signal; package body System.Interrupt_Management.Operations is use type C.signed_int; procedure Set_Interrupt_Mask (Mask : access Interrupt_Mask) is begin Set_Interrupt_Mask (Mask => Mask, OMask => null); end Set_Interrupt_Mask; procedure Set_Interrupt_Mask ( Mask : access Interrupt_Mask; OMask : access Interrupt_Mask) is errno : C.signed_int; begin errno := C.signal.sigprocmask (C.signal.SIG_SETMASK, Mask, OMask); if errno /= 0 then raise Program_Error; end if; end Set_Interrupt_Mask; procedure Get_Interrupt_Mask (Mask : access Interrupt_Mask) is begin Set_Interrupt_Mask (Mask => null, OMask => Mask); end Get_Interrupt_Mask; procedure Fill_Interrupt_Mask (Mask : access Interrupt_Mask) is Dummy : C.signed_int; begin Dummy := C.signal.sigfillset (Mask); end Fill_Interrupt_Mask; procedure Add_To_Interrupt_Mask ( Mask : access Interrupt_Mask; Interrupt : Interrupt_ID) is Dummy : C.signed_int; begin Dummy := C.signal.sigaddset (Mask, Interrupt); end Add_To_Interrupt_Mask; procedure Copy_Interrupt_Mask ( X : out Interrupt_Mask; Y : Interrupt_Mask) is begin X := Y; end Copy_Interrupt_Mask; end System.Interrupt_Management.Operations;
with Ada.Containers.Vectors; with Ada.Strings.Unbounded; with Rule; use Rule; package Planet is package SU renames Ada.Strings.Unbounded; package Origin_Define is type Object is tagged private; function Build (name : String; colony : Integer; starship : Integer; station : Integer) return Object; function "=" (Left, Right : Object) return Boolean; function show (planet: in Object) return String; procedure attack (planet: in out Object); private type Object is tagged record Name : SU.Unbounded_String; Damage: Boolean; Colony: Integer; Starship: Integer; Station: Integer; end record; end Origin_Define; subtype Object is Origin_Define.Object; function Build (name : String; colony : Integer; starship : Integer; station : Integer) return Object renames Origin_Define.Build; subtype Planet_Range is Positive range 1 .. 10; package Vectors is new Ada.Containers.Vectors (Element_Type => Origin_Define.Object, Index_Type => Planet_Range, "=" => Origin_Define."="); subtype Vector is Vectors.Vector; end Planet;
with Date_Package; use Date_Package; package Person_Handling is type Person is private; function "="(Person1, Person2: in Person) return Boolean; function ">"(Person1, Person2: in Person) return Boolean; function "<"(Person1, Person2: in Person) return Boolean; procedure Put(Pers: in Person); procedure Get(Pers: out Person); private type Person is record Name: String(1..20); Address: String(1..20); Birth: Date_Type; Name_Length: Integer; Address_Length: Integer; end record; end Person_Handling;
package body Q_CSV is --================================================================== function F_LINE (V_LINE : String; V_SEPARATOR : Character := ';') return T_ROW is (V_LENGTH => V_LINE'LENGTH, R_STR => V_LINE, R_FIRST => V_LINE'FIRST, R_LAST => V_LINE'LAST, R_NEXT => V_LINE'FIRST, R_SEP => V_SEPARATOR); function F_ITEM (V_ROW : T_ROW) return STRING is (V_ROW.R_STR (V_ROW.R_FIRST .. V_ROW.R_LAST)); function F_NEXT (V_ROW : in out T_ROW) return BOOLEAN is V_LAST : NATURAL := V_ROW.R_NEXT; begin V_ROW.R_FIRST := V_ROW.R_NEXT; while V_LAST <= V_ROW.R_STR'LAST and then V_ROW.R_STR (V_Last) /= V_ROW.R_SEP loop -- find Separator V_LAST := V_LAST + 1; end loop; V_ROW.R_LAST := V_LAST - 1; V_ROW.R_NEXT := V_LAST + 1; return (V_ROW.R_FIRST <= V_ROW.R_STR'LAST); end F_NEXT; --================================================================== end Q_CSV;
-- sarge.ads - Specification file for the Sarge command line argument parser project. -- Revision 0 -- Notes: -- - -- 2019/04/10, Maya Posch with Ada.Strings use Ada.Strings with Ada.Containers.Vectors; with Ada.Containers.Indefinite_Ordered_Maps; use Ada.Containers; package Sarge is type Argument is record arg_short: string; arg_long: string; description: string; hasValue: boolean := Boolean.False; value: string; parsed: boolean := Boolean.False; end record; type Argument_Access is access all Argument; procedure setArgument(arg_short: in string, arg_long: in string, desc: in string, hasVal: in boolean); procedure setDescription(desc: in string); procedure setUsage(usage: in string); function parseArguments() return boolean; function getFlag(arg_flag: in string, arg_value: out arg_value) return boolean; function exists(arg_flag: in string) returns boolean; procedure printHelp(); function flagCount() return integer; function executableName() return string; private package arg_vector is new Vectors(Natural, Argument); args: arg_vector.vector; package argNames_map is new Indefinite_Ordered_Maps(string, Argument_Access); argNames: argNames_map.map; parsed: boolean; flagCounter: 0; execName: string; description: string; usage: string; end Sarge;
-- part of OpenGLAda, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" with Glfw.API; with Glfw.Enums; package body Glfw.Events.Mouse is function Pressed (Query : Button) return Boolean is begin return API.Get_Mouse_Button (Query) = Events.Press; end Pressed; procedure Get_Position (X, Y : out Coordinate) is begin API.Get_Mouse_Pos (X, Y); end Get_Position; procedure Set_Position (X, Y : Coordinate) is begin API.Set_Mouse_Pos (X, Y); end Set_Position; function Wheel return Wheel_Position is begin return API.Get_Mouse_Wheel; end Wheel; procedure Set_Wheel (Value : Wheel_Position) is begin API.Set_Mouse_Wheel (Value); end Set_Wheel; procedure Raw_Button_Callback (Subject : Button; Action : Button_State); procedure Raw_Position_Callback (X, Y : Coordinate); procedure Raw_Wheel_Callback (Pos : Wheel_Position); pragma Convention (C, Raw_Button_Callback); pragma Convention (C, Raw_Position_Callback); pragma Convention (C, Raw_Wheel_Callback); User_Button_Callback : Button_Callback; User_Position_Callback : Position_Callback; User_Wheel_Callback : Wheel_Callback; procedure Raw_Button_Callback (Subject : Button; Action : Button_State) is begin if User_Button_Callback /= null then User_Button_Callback (Subject, Action); end if; end Raw_Button_Callback; procedure Raw_Position_Callback (X, Y : Coordinate) is begin if User_Position_Callback /= null then User_Position_Callback (X, Y); end if; end Raw_Position_Callback; procedure Raw_Wheel_Callback (Pos : Wheel_Position) is begin if User_Wheel_Callback /= null then User_Wheel_Callback (Pos); end if; end Raw_Wheel_Callback; procedure Set_Button_Callback (Callback : Button_Callback) is begin User_Button_Callback := Callback; if Callback /= null then API.Set_Mouse_Button_Callback (Raw_Button_Callback'Access); else API.Set_Mouse_Button_Callback (null); end if; end Set_Button_Callback; procedure Set_Position_Callback (Callback : Position_Callback) is begin User_Position_Callback := Callback; if Callback /= null then API.Set_Mouse_Pos_Callback (Raw_Position_Callback'Access); else API.Set_Mouse_Pos_Callback (null); end if; end Set_Position_Callback; procedure Set_Wheel_Callback (Callback : Wheel_Callback) is begin User_Wheel_Callback := Callback; if Callback /= null then API.Set_Mouse_Wheel_Callback (Raw_Wheel_Callback'Access); else API.Set_Mouse_Wheel_Callback (null); end if; end Set_Wheel_Callback; procedure Toggle_Mouse_Cursor (Visible : Boolean) is begin if Visible then API.Enable (Enums.Mouse_Cursor); else API.Disable (Enums.Mouse_Cursor); end if; end Toggle_Mouse_Cursor; procedure Toggle_Sticky_Mouse_Buttons (Enable : Boolean) is begin if Enable then API.Enable (Enums.Sticky_Mouse_Buttons); else API.Disable (Enums.Sticky_Mouse_Buttons); end if; end Toggle_Sticky_Mouse_Buttons; end Glfw.Events.Mouse;
-- -- Copyright (C) 2021 Jeremy Grosser <jeremy@synack.me> -- -- SPDX-License-Identifier: BSD-3-Clause -- package body HT16K33 is procedure Initialize (This : in out Device) is Oscillator_On : constant I2C_Data (1 .. 1) := (1 => 16#21#); Display_On : constant I2C_Data (1 .. 1) := (1 => 16#81#); Row_Output : constant I2C_Data (1 .. 1) := (1 => 16#A0#); Status : I2C_Status := Err_Error; begin This.Port.Master_Transmit (This.Address, Oscillator_On, Status, Timeout => 10); This.Port.Master_Transmit (This.Address, Display_On, Status, Timeout => 10); This.Port.Master_Transmit (This.Address, Row_Output, Status, Timeout => 10); Set_Brightness (This, Brightness_Level'Last); Update (This); end Initialize; procedure Set_Brightness (This : in out Device; Level : Brightness_Level) is Data : constant I2C_Data (1 .. 1) := (1 => 16#E0# or Level); Status : I2C_Status := Err_Error; begin This.Port.Master_Transmit (This.Address, Data, Status, Timeout => 10); end Set_Brightness; procedure Update (This : in out Device) is Status : I2C_Status := Err_Error; begin This.Port.Master_Transmit (This.Address, This.Buffer, Status, Timeout => 100); end Update; procedure Set (This : in out Device; Num : Output_Index) is Index : constant Positive := (Num / 8) + 1; begin This.Buffer (Index) := This.Buffer (Index) or Shift_Left (1, Num mod 8); end Set; procedure Clear (This : in out Device; Num : Output_Index) is Index : constant Positive := (Num / 8) + 1; begin This.Buffer (Index) := This.Buffer (Index) and not Shift_Left (1, Num mod 8); end Clear; procedure Clear_All (This : in out Device) is begin This.Buffer := (others => 0); end Clear_All; end HT16K33;
----------------------------------------------------------------------- -- gen-commands-project -- Project creation command for dynamo -- Copyright (C) 2011, 2012, 2013, 2014 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.Directories; with Ada.Text_IO; with Gen.Artifacts; with GNAT.Command_Line; with GNAT.OS_Lib; with Util.Log.Loggers; with Util.Strings.Transforms; package body Gen.Commands.Project is use Util.Log; Log : constant Loggers.Logger := Loggers.Create ("Gen.Commands.Project"); -- ------------------------------ -- Generator Command -- ------------------------------ function Get_Name_From_Email (Email : in String) return String; -- ------------------------------ -- Get the user name from the email address. -- Returns the possible user name from his email address. -- ------------------------------ function Get_Name_From_Email (Email : in String) return String is Pos : Natural := Util.Strings.Index (Email, '<'); begin if Pos > 0 then return Email (Email'First .. Pos - 1); end if; Pos := Util.Strings.Index (Email, '@'); if Pos > 0 then return Email (Email'First .. Pos - 1); else return Email; end if; end Get_Name_From_Email; -- ------------------------------ -- Execute the command with the arguments. -- ------------------------------ procedure Execute (Cmd : in Command; Generator : in out Gen.Generator.Handler) is pragma Unreferenced (Cmd); use GNAT.Command_Line; Web_Flag : aliased Boolean := False; Tool_Flag : aliased Boolean := False; Ado_Flag : aliased Boolean := False; Gtk_Flag : aliased Boolean := False; begin -- If a dynamo.xml file exists, read it. if Ada.Directories.Exists ("dynamo.xml") then Generator.Read_Project ("dynamo.xml"); else Generator.Set_Project_Property ("license", "apache"); Generator.Set_Project_Property ("author", "unknown"); Generator.Set_Project_Property ("author_email", "unknown@company.com"); end if; -- Parse the command line loop case Getopt ("l: ? -web -tool -ado -gtk") is when ASCII.NUL => exit; when '-' => if Full_Switch = "-web" then Web_Flag := True; elsif Full_Switch = "-tool" then Tool_Flag := True; elsif Full_Switch = "-ado" then Ado_Flag := True; elsif Full_Switch = "-gtk" then Gtk_Flag := True; end if; when 'l' => declare L : constant String := Util.Strings.Transforms.To_Lower_Case (Parameter); begin Log.Info ("License {0}", L); if L = "apache" then Generator.Set_Project_Property ("license", "apache"); elsif L = "gpl" then Generator.Set_Project_Property ("license", "gpl"); elsif L = "gpl3" then Generator.Set_Project_Property ("license", "gpl3"); elsif L = "mit" then Generator.Set_Project_Property ("license", "mit"); elsif L = "bsd3" then Generator.Set_Project_Property ("license", "bsd3"); elsif L = "proprietary" then Generator.Set_Project_Property ("license", "proprietary"); else Generator.Error ("Invalid license: {0}", L); Generator.Error ("Valid licenses: apache, gpl, gpl3, mit, bsd3, proprietary"); return; end if; end; when others => null; end case; end loop; if not Web_Flag and not Ado_Flag and not Tool_Flag and not Gtk_Flag then Web_Flag := True; end if; declare Name : constant String := Get_Argument; Arg2 : constant String := Get_Argument; Arg3 : constant String := Get_Argument; begin if Name'Length = 0 then Generator.Error ("Missing project name"); Gen.Commands.Usage; return; end if; if Util.Strings.Index (Arg2, '@') > Arg2'First then Generator.Set_Project_Property ("author_email", Arg2); if Arg3'Length = 0 then Generator.Set_Project_Property ("author", Get_Name_From_Email (Arg2)); else Generator.Set_Project_Property ("author", Arg3); end if; elsif Util.Strings.Index (Arg3, '@') > Arg3'First then Generator.Set_Project_Property ("author", Arg2); Generator.Set_Project_Property ("author_email", Arg3); elsif Arg3'Length > 0 then Generator.Error ("The last argument should be the author's email address."); Gen.Commands.Usage; return; end if; Generator.Set_Project_Property ("is_web", Boolean'Image (Web_Flag)); Generator.Set_Project_Property ("is_tool", Boolean'Image (Tool_Flag)); Generator.Set_Project_Property ("is_ado", Boolean'Image (Ado_Flag)); Generator.Set_Project_Property ("is_gtk", Boolean'Image (Gtk_Flag)); Generator.Set_Project_Name (Name); Generator.Set_Force_Save (False); if Ado_Flag then Gen.Generator.Generate_All (Generator, Gen.Artifacts.ITERATION_TABLE, "project-ado"); elsif Gtk_Flag then Gen.Generator.Generate_All (Generator, Gen.Artifacts.ITERATION_TABLE, "project-gtk"); else Gen.Generator.Generate_All (Generator, Gen.Artifacts.ITERATION_TABLE, "project"); end if; Generator.Save_Project; declare use type GNAT.OS_Lib.String_Access; Path : constant GNAT.OS_Lib.String_Access := GNAT.OS_Lib.Locate_Exec_On_Path ("autoconf"); Args : GNAT.OS_Lib.Argument_List (1 .. 0); Status : Boolean; begin if Path = null then Generator.Error ("The 'autoconf' tool was not found. It is necessary to " & "generate the configure script."); Generator.Error ("Install 'autoconf' or launch it manually."); else Ada.Directories.Set_Directory (Generator.Get_Result_Directory); Log.Info ("Executing {0}", Path.all); GNAT.OS_Lib.Spawn (Path.all, Args, Status); if not Status then Generator.Error ("Execution of {0} failed", Path.all); end if; end if; end; end; end Execute; -- ------------------------------ -- Write the help associated with the command. -- ------------------------------ procedure Help (Cmd : in Command; Generator : in out Gen.Generator.Handler) is pragma Unreferenced (Cmd, Generator); use Ada.Text_IO; begin Put_Line ("create-project: Create a new Ada Web Application project"); Put_Line ("Usage: create-project [-l apache|gpl|gpl3|mit|bsd3|proprietary] [--web] [--tool]" & "[--ado] [--gtk] NAME [AUTHOR] [EMAIL]"); New_Line; Put_Line (" Creates a new AWA application with the name passed in NAME."); Put_Line (" The application license is controlled with the -l option. "); Put_Line (" License headers can use either the Apache, the MIT license, the BSD 3 clauses"); Put_Line (" license, the GNU licenses or a proprietary license."); Put_Line (" The author's name and email addresses are also reported in generated files."); New_Line; Put_Line (" --web Generate a Web application (the default)"); Put_Line (" --tool Generate a command line tool"); Put_Line (" --ado Generate a database tool operation for ADO"); Put_Line (" --gtk Generate a GtkAda project"); end Help; end Gen.Commands.Project;
------------------------------------------------------------------------------ -- 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.b256 is -- K Constants K : constant array (1 .. 64) of Interfaces.Unsigned_32 := (16#428a2f98#, 16#71374491#, 16#b5c0fbcf#, 16#e9b5dba5#, 16#3956c25b#, 16#59f111f1#, 16#923f82a4#, 16#ab1c5ed5#, 16#d807aa98#, 16#12835b01#, 16#243185be#, 16#550c7dc3#, 16#72be5d74#, 16#80deb1fe#, 16#9bdc06a7#, 16#c19bf174#, 16#e49b69c1#, 16#efbe4786#, 16#0fc19dc6#, 16#240ca1cc#, 16#2de92c6f#, 16#4a7484aa#, 16#5cb0a9dc#, 16#76f988da#, 16#983e5152#, 16#a831c66d#, 16#b00327c8#, 16#bf597fc7#, 16#c6e00bf3#, 16#d5a79147#, 16#06ca6351#, 16#14292967#, 16#27b70a85#, 16#2e1b2138#, 16#4d2c6dfc#, 16#53380d13#, 16#650a7354#, 16#766a0abb#, 16#81c2c92e#, 16#92722c85#, 16#a2bfe8a1#, 16#a81a664b#, 16#c24b8b70#, 16#c76c51a3#, 16#d192e819#, 16#d6990624#, 16#f40e3585#, 16#106aa070#, 16#19a4c116#, 16#1e376c08#, 16#2748774c#, 16#34b0bcb5#, 16#391c0cb3#, 16#4ed8aa4a#, 16#5b9cca4f#, 16#682e6ff3#, 16#748f82ee#, 16#78a5636f#, 16#84c87814#, 16#8cc70208#, 16#90befffa#, 16#a4506ceb#, 16#bef9a3f7#, 16#c67178f2#); Hex_Chars : constant array (Interfaces.Unsigned_32 range 0 .. 15) of Character := ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); -- Stream_Element_Array4 -- subtype Stream_Element_Array4 is Ada.Streams.Stream_Element_Array (1 .. 4); -- Endian -- function Endian (Value : in Stream_Element_Array4) return Interfaces.Unsigned_32; -- Sigma0 -- function Sigma0 (Value : in Interfaces.Unsigned_32) return Interfaces.Unsigned_32; -- Sigma1 -- function Sigma1 (Value : in Interfaces.Unsigned_32) return Interfaces.Unsigned_32; -- E0 -- function E0 (Value : in Interfaces.Unsigned_32) return Interfaces.Unsigned_32; -- E1 -- function E1 (Value : in Interfaces.Unsigned_32) return Interfaces.Unsigned_32; -- Ch -- function Ch (X, Y, Z : in Interfaces.Unsigned_32) return Interfaces.Unsigned_32; -- Maj -- function Maj (X, Y, Z : in Interfaces.Unsigned_32) return Interfaces.Unsigned_32; --------------- -- Calculate -- --------------- function Calculate (Value : in String) return SHA256 is H : Hasher_256; Res : SHA256; begin Update (H, Value); Result (H, Res); return Res; end Calculate; -------------------- -- Wide_Calculate -- -------------------- function Wide_Calculate (Value : in Wide_String) return SHA256 is H : Hasher_256; Res : SHA256; begin Wide_Update (H, Value); Result (H, Res); return Res; end Wide_Calculate; ------------------------- -- Wide_Wide_Calculate -- ------------------------- function Wide_Wide_Calculate (Value : in Wide_Wide_String) return SHA256 is H : Hasher_256; Res : SHA256; begin Wide_Wide_Update (H, Value); Result (H, Res); return Res; end Wide_Wide_Calculate; --------------- -- Calculate -- --------------- function Calculate (Value : in Ada.Streams.Stream_Element_Array) return SHA256 is H : Hasher_256; Res : SHA256; begin Update (H, Value); Result (H, Res); return Res; end Calculate; ------------ -- Update -- ------------ procedure Update (This : in out Hasher_256; Value : in Ada.Streams.Stream_Element_Array) is use Ada.Streams; Buffer : constant Stream_Element_Array := This.Internal_Buffer (1 .. This.Last) & Value; Index : Stream_Element_Offset := Buffer'First; begin while Index + 63 <= Buffer'Last loop Process (This, Buffer (Index .. Index + 63)); Index := Index + 64; end loop; This.Last := Buffer'Last - Index + 1; This.Internal_Buffer (1 .. This.Last) := Buffer (Index .. Buffer'Last); This.Length := This.Length + Value'Length; end Update; ------------- -- Process -- ------------- procedure Process (This : in out Hasher_256; Value : in Ada.Streams.Stream_Element_Array) is use Interfaces; use Ada.Streams; Hash : Hash_Array (1 .. 8) := This.Internal_Hash; W : Hash_Array (1 .. 64); Temp1, Temp2 : Interfaces.Unsigned_32; Position : Stream_Element_Offset; begin for Index in 1 .. 16 loop Position := Stream_Element_Offset (((Index - 1) * 4) + 1); W (Index) := Endian (Value (Position .. Position + 3)); end loop; for Index in 17 .. 64 loop W (Index) := Sigma1 (W (Index - 2)) + W (Index - 7) + Sigma0 (W (Index - 15)) + W (Index - 16); end loop; for Index in 1 .. 64 loop Temp1 := Hash (8) + E1 (Hash (5)) + Ch (Hash (5), Hash (6), Hash (7)) + K (Index) + W (Index); Temp2 := E0 (Hash (1)) + Maj (Hash (1), Hash (2), Hash (3)); Hash (8) := Hash (7); Hash (7) := Hash (6); Hash (6) := Hash (5); Hash (5) := Hash (4) + Temp1; Hash (4) := Hash (3); Hash (3) := Hash (2); Hash (2) := Hash (1); Hash (1) := Temp1 + Temp2; end loop; for Index in 1 .. 8 loop This.Internal_Hash (Index) := This.Internal_Hash (Index) + Hash (Index); end loop; end Process; ------------ -- Result -- ------------ procedure Result (This : in out Hasher_256; Value : out SHA256) is use Ada.Streams; use Interfaces; Last : Stream_Element_Array (1 .. 64) := (others => 0); Length : Unsigned_64 := Unsigned_64 (This.Length) * 8; Result_Position : Positive := Value'First; -- To_Hex -- procedure To_Hex (Item : in Unsigned_32) is V : Unsigned_32 := Item; Position : Integer := Result_Position + 7; begin for Index in 1 .. 4 loop Value (Position) := Hex_Chars (V and 16#0F#); Position := Position - 1; V := Shift_Right (V, 4); Value (Position) := Hex_Chars (V and 16#0F#); Position := Position - 1; V := Shift_Right (V, 4); end loop; Result_Position := Result_Position + 8; end To_Hex; begin Last (1 .. This.Last) := This.Internal_Buffer (1 .. This.Last); Last (This.Last + 1) := 16#80#; if This.Last > 55 then Process (This, Last); Last := (others => 0); end if; for Index in 57 .. 64 loop Last (Stream_Element_Offset (Index)) := Stream_Element ((Shift_Right (Length, (64 - Index) * 8)) and 16#FF#); end loop; Process (This, Last); for Index in 1 .. 8 loop To_Hex (This.Internal_Hash (Index)); end loop; end Result; ------------ -- Endian -- ------------ function Endian (Value : in Stream_Element_Array4) return Interfaces.Unsigned_32 is function To_I32 is new Ada.Unchecked_Conversion (Stream_Element_Array4, Interfaces.Unsigned_32); Temp : Stream_Element_Array4 := (Value (4), Value (3), Value (2), Value (1)); begin return To_I32 (Temp); end Endian; ------------ -- Sigma0 -- ------------ function Sigma0 (Value : in Interfaces.Unsigned_32) return Interfaces.Unsigned_32 is use Interfaces; begin return Rotate_Right (Value, 7) xor Rotate_Right (Value, 18) xor Shift_Right (Value, 3); end Sigma0; ------------ -- Sigma1 -- ------------ function Sigma1 (Value : in Interfaces.Unsigned_32) return Interfaces.Unsigned_32 is use Interfaces; begin return Rotate_Right (Value, 17) xor Rotate_Right (Value, 19) xor Shift_Right (Value, 10); end Sigma1; -------- -- E0 -- -------- function E0 (Value : in Interfaces.Unsigned_32) return Interfaces.Unsigned_32 is use Interfaces; begin return Rotate_Right (Value, 2) xor Rotate_Right (Value, 13) xor Rotate_Right (Value, 22); end E0; -------- -- E1 -- -------- function E1 (Value : in Interfaces.Unsigned_32) return Interfaces.Unsigned_32 is use Interfaces; begin return Rotate_Right (Value, 6) xor Rotate_Right (Value, 11) xor Rotate_Right (Value, 25); end E1; -------- -- Ch -- -------- function Ch (X, Y, Z : in Interfaces.Unsigned_32) return Interfaces.Unsigned_32 is use Interfaces; begin return (X and Y) xor ((not X) and Z); end Ch; --------- -- Maj -- --------- function Maj (X, Y, Z : in Interfaces.Unsigned_32) return Interfaces.Unsigned_32 is use Interfaces; begin return (X and Y) xor (X and Z) xor (Y and Z); end Maj; end Gela.Hash.SHA.b256; ------------------------------------------------------------------------------ -- 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. ------------------------------------------------------------------------------
-- C97113A.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 ALL CONDITIONS, OPEN DELAY ALTERNATIVE EXPRESSIONS, AND -- OPEN ENTRY FAMILY INDICES ARE EVALUATED (EVEN WHEN SOME (PERHAPS -- ALL BUT ONE) OF THE ALTERNATIVES CAN BE RULED OUT WITHOUT -- COMPLETING THE EVALUATIONS). -- RM 5/06/82 -- SPS 11/21/82 -- WRG 7/9/86 ADDED DELAY EXPRESSIONS AND ENTRY FAMILY INDICES. with Impdef; WITH REPORT; USE REPORT; PROCEDURE C97113A IS EXPR1_EVALUATED : BOOLEAN := FALSE; EXPR2_EVALUATED : BOOLEAN := FALSE; EXPR3_EVALUATED : BOOLEAN := FALSE; FUNCTION F1 RETURN BOOLEAN IS BEGIN EXPR1_EVALUATED := TRUE; RETURN TRUE; END F1; FUNCTION F2 (X : INTEGER) RETURN INTEGER IS BEGIN EXPR2_EVALUATED := TRUE; RETURN X; END F2; FUNCTION F3 (X : DURATION) RETURN DURATION IS BEGIN EXPR3_EVALUATED := TRUE; RETURN X; END F3; BEGIN TEST ("C97113A", "CHECK THAT ALL CONDITIONS, OPEN DELAY " & "ALTERNATIVE EXPRESSIONS, AND OPEN ENTRY " & "FAMILY INDICES ARE EVALUATED"); DECLARE TASK T IS ENTRY E1; ENTRY E2; ENTRY E3 (1..1); END T; TASK BODY T IS BEGIN --ENSURE THAT E1 HAS BEEN CALLED BEFORE PROCEEDING: WHILE E1'COUNT = 0 LOOP DELAY 1.0 * Impdef.One_Second; END LOOP; SELECT ACCEPT E1; OR WHEN F1 => ACCEPT E2; OR ACCEPT E3 ( F2(1) ); OR DELAY F3 ( 1.0 ) * Impdef.One_Second; END SELECT; END T; BEGIN T.E1; END; IF NOT EXPR1_EVALUATED THEN FAILED ("GUARD NOT EVALUATED"); END IF; IF NOT EXPR2_EVALUATED THEN FAILED ("ENTRY FAMILY INDEX NOT EVALUATED"); END IF; IF NOT EXPR3_EVALUATED THEN FAILED ("OPEN DELAY ALTERNATIVE EXPRESSION NOT EVALUATED"); END IF; RESULT; END C97113A;
with Ada.Integer_Text_IO; with Ada.Text_IO; package body Problem_08 is package IO renames Ada.Text_IO; package I_IO renames Ada.Integer_Text_IO; procedure Solve is Big_Num : constant String := "73167176531330624919225119674426574742355349194934" &"96983520312774506326239578318016984801869478851843" &"85861560789112949495459501737958331952853208805511" &"12540698747158523863050715693290963295227443043557" &"66896648950445244523161731856403098711121722383113" &"62229893423380308135336276614282806444486645238749" &"30358907296290491560440772390713810515859307960866" &"70172427121883998797908792274921901699720888093776" &"65727333001053367881220235421809751254540594752243" &"52584907711670556013604839586446706324415722155397" &"53697817977846174064955149290862569321978468622482" &"83972241375657056057490261407972968652414535100474" &"82166370484403199890008895243450658541227588666881" &"16427171479924442928230863465674813919123162824586" &"17866458359124566529476545682848912883142607690042" &"24219022671055626321111109370544217506941658960408" &"07198403850962455444362981230987879927244284909188" &"84580156166097919133875499200524063689912560717606" &"05886116467109405077541002256983155200055935729725" &"71636269561882670428252483600823257530420752963450"; type Last_5 is mod 5; numbers : Array (Last_5'Range) of Natural; numbers_index : Last_5 := Last_5'Last; biggest : Natural := 0; function Product_Of return Natural is product : Natural := 1; begin for index in numbers'Range loop declare number : constant Natural := numbers(index); begin product := product * number; end; end loop; return product; end; begin for index in Last_5'First .. Last_5'Last - 1 loop numbers(index) := Character'Pos(Big_Num(Big_Num'First + Integer(index))) - Character'Pos('0'); end loop; for index in Big_Num'First + Integer(numbers_index) .. Big_Num'Last loop numbers(numbers_index) := Character'Pos(Big_Num(index)) - Character'Pos('0'); numbers_index := numbers_index + 1; declare product : constant Natural := Product_Of; begin if product > biggest then biggest := product; end if; end; end loop; I_IO.Put(biggest); IO.New_Line; end Solve; end Problem_08;
-- Package to provide device-specific information. package Device is -- Supported devices. type Device_Type is ( ASIC, Virtex_4, Virtex_5, Virtex_6, Virtex_7 ); Invalid_Device : exception; -- Set the device to use. procedure Set_Device(name : in String); -- Set the number of address bits to use. procedure Set_Address_Bits(b : in Positive); -- Get the current device. function Get_Device return Device_Type; -- Get the width of a BRAM in bits. function Get_BRAM_Width return Positive; -- Get the depth of a BRAM in entries. function Get_BRAM_Depth return Positive; -- Get the maximum number of logic levels allowed. function Get_Max_Path return Positive; -- Get the number of address bits. function Get_Address_Bits return Positive; end Device;
package Mult with SPARK_Mode is function Mult (A : Natural; B : Natural) return Natural with SPARK_Mode, Pre => A < 32768 and B < 32768, Post => Mult'Result = A * B; end Mult;
-- Taken from altivec of GNAT examples (http://www.adacore.com/developers/code-samples/gnat-examples/) -- ==================================================================================================== -- This example shows how to create and manipulate vectors by the mean of high -- level views. with GNAT.Altivec; use GNAT.Altivec; with GNAT.Altivec.Conversions; use GNAT.Altivec.Conversions; with GNAT.Altivec.Vector_Operations; use GNAT.Altivec.Vector_Operations; with GNAT.Altivec.Vector_Types; use GNAT.Altivec.Vector_Types; with GNAT.Altivec.Vector_Views; use GNAT.Altivec.Vector_Views; with GNAT.IO; use GNAT.IO; procedure Altivec is View_A : constant VUI_View := (Values => (1, 2, 3, 4)); Vector_A : constant vector_unsigned_int := To_Vector (View_A); View_B : constant VUI_View := (Values => (1, 1, 1, 1)); Vector_B : constant vector_unsigned_int := To_Vector (View_B); Vector_C : vector_unsigned_int; View_C : VUI_View; begin Vector_C := vec_add (Vector_A, Vector_B); -- C = A + B View_C := To_View (Vector_C); for I in View_C.Values'Range loop Put_Line (unsigned_int'Image (View_C.Values (I))); end loop; end Altivec;
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package Program.Scanner_States is pragma Pure; type State is mod +86; subtype Looping_State is State range 0 .. 63; subtype Final_State is State range 36 .. State'Last - 1; Error_State : constant State := State'Last; Allow_Char : constant State := 0; INITIAL : constant State := 35; type Character_Class is mod +35; type Rule_Index is range 0 .. 38; end Program.Scanner_States;
with Ada.Containers.Hashed_Maps; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Strings.Unbounded.Hash; -- Basic support for .env files in Ada everyone was waiting for package Aids.Env is Syntax_Error : exception; package Env_Hashed_Map is new Ada.Containers.Hashed_Maps (Key_Type => Unbounded_String, Element_Type => Unbounded_String, Hash => Ada.Strings.Unbounded.Hash, Equivalent_Keys => "="); subtype Typ is Env_Hashed_Map.Map; function Slurp(File_Path: String) return Typ; function Find(Env: in Typ; Key: in Unbounded_String; Value: out Unbounded_String) return Boolean; end Aids.Env;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . B B . I N T E R R U P T S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1999-2002 Universidad Politecnica de Madrid -- -- Copyright (C) 2003-2005 The European Space Agency -- -- Copyright (C) 2003-2021, AdaCore -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- -- The port of GNARL to bare board targets was initially developed by the -- -- Real-Time Systems Group at the Technical University of Madrid. -- -- -- ------------------------------------------------------------------------------ pragma Restrictions (No_Elaboration_Code); with System.Storage_Elements; with System.BB.CPU_Primitives; with System.BB.CPU_Specific; with System.BB.Threads; with System.BB.Threads.Queues; with System.BB.Board_Support; with System.BB.Time; with System.Multiprocessors; package body System.BB.Interrupts is use System.Multiprocessors; use System.BB.Board_Support.Multiprocessors; use System.BB.Threads; use System.BB.Time; ---------------- -- Local data -- ---------------- type Stack_Space is new Storage_Elements.Storage_Array (1 .. Storage_Elements.Storage_Offset (Parameters.Interrupt_Stack_Size)); for Stack_Space'Alignment use CPU_Specific.Stack_Alignment; pragma Suppress_Initialization (Stack_Space); -- Type used to represent the stack area for each interrupt. The stack must -- be aligned to the CPU specific alignment to hold the largest registers. Interrupt_Stacks : array (CPU) of Stack_Space; pragma Linker_Section (Interrupt_Stacks, ".interrupt_stacks"); -- Array that contains the stack used for interrupts on each CPU. -- -- The interrupt stacks are assigned a special section so the linker script -- can put them at a specific place and avoid useless initialization. -- -- Having a separate interrupt stack (from user tasks stack) helps to -- reduce the memory footprint, as there is no need to reserve space for -- interrupts in user stacks. -- -- Because several interrupts can share the same priority and because there -- can be many priorities, we prefer not to have one stack per priority. -- Instead we have one interrupt stack per CPU. Such interrupts cannot be -- executing at the same time. -- -- An interrupt handler doesn't need to save non-volatile registers, -- because the interrupt is always completed before the interrupted task is -- resumed. This is obvious for non-interrupt-priority tasks and for -- active tasks at interrupt priority. The idle task (the one activated in -- System.BB.Protection.Leave_Kernel) cannot be at interrupt priority, as -- there is always one task not in the interrupt priority range (the -- environment task), and this one must be active or idle when a higher -- priority task is resumed. Interrupt_Stack_Table : array (CPU) of System.Address; pragma Export (Asm, Interrupt_Stack_Table, "interrupt_stack_table"); -- Table that contains a pointer to the top of the stack for each processor type Handlers_Table is array (Interrupt_ID) of Interrupt_Handler; -- Type used to represent the procedures used as interrupt handlers Interrupt_Handlers_Table : Handlers_Table := (others => null); -- Table containing handlers attached to the different external interrupts Interrupt_Being_Handled : array (CPU) of Any_Interrupt_ID := (others => No_Interrupt); pragma Volatile (Interrupt_Being_Handled); -- Interrupt_Being_Handled contains the interrupt currently being handled -- by each CPU in the system, if any. It is equal to No_Interrupt when no -- interrupt is handled. Its value is updated by the trap handler. -------------------- -- Attach_Handler -- -------------------- procedure Attach_Handler (Handler : not null Interrupt_Handler; Id : Interrupt_ID; Prio : Interrupt_Priority) is begin -- Check that we are attaching to a real interrupt pragma Assert (Id /= No_Interrupt); -- Check that no previous interrupt handler has been registered if Interrupt_Handlers_Table (Id) /= null then raise Program_Error; end if; -- Copy the user's handler to the appropriate place within the table Interrupt_Handlers_Table (Id) := Handler; -- The BSP determines the vector that will be called when the given -- interrupt occurs, and then installs the handler there. This may -- include programming the interrupt controller. Board_Support.Interrupts.Install_Interrupt_Handler (Id, Prio); end Attach_Handler; ----------------------- -- Current_Interrupt -- ----------------------- function Current_Interrupt return Any_Interrupt_ID is Result : constant Any_Interrupt_ID := Interrupt_Being_Handled (Current_CPU); begin if Threads.Thread_Self.In_Interrupt then pragma Assert (Result /= No_Interrupt); return Result; else return No_Interrupt; end if; end Current_Interrupt; ----------------------- -- Interrupt_Wrapper -- ----------------------- procedure Interrupt_Wrapper (Id : Interrupt_ID) is Self_Id : constant Threads.Thread_Id := Threads.Thread_Self; Caller_Priority : constant Integer := Threads.Get_Priority (Self_Id); Int_Priority : constant Interrupt_Priority := Board_Support.Interrupts.Priority_Of_Interrupt (Id); CPU_Id : constant CPU := Current_CPU; Previous_Int : constant Any_Interrupt_ID := Interrupt_Being_Handled (CPU_Id); Prev_In_Interr : constant Boolean := Self_Id.In_Interrupt; begin -- Update execution time for the interrupted task if Scheduling_Event_Hook /= null then Scheduling_Event_Hook.all; end if; -- Store the interrupt being handled Interrupt_Being_Handled (CPU_Id) := Id; -- Then, we must set the appropriate software priority corresponding -- to the interrupt being handled. It also deals with the appropriate -- interrupt masking. -- When this wrapper is called all interrupts are masked, and the active -- priority of the interrupted task must be lower than the priority of -- the interrupt (otherwise the interrupt would have been masked). The -- only exception to this is when a task is temporarily inserted in the -- ready queue because there is not a single task ready to execute; this -- temporarily inserted task may have a priority in the range of the -- interrupt priorities (it may be waiting in an entry for a protected -- handler), but interrupts would not be masked. pragma Assert (Caller_Priority <= Int_Priority or else Self_Id.State /= Runnable); Self_Id.In_Interrupt := True; Threads.Queues.Change_Priority (Self_Id, Int_Priority); CPU_Primitives.Enable_Interrupts (Int_Priority); -- Call the user handler if Interrupt_Handlers_Table (Id) = null then raise Program_Error with "No handler for interrupt" & Id'Img; else Interrupt_Handlers_Table (Id).all (Id); end if; CPU_Primitives.Disable_Interrupts; -- Update execution time for the interrupt. This must be done before -- changing priority (Scheduling_Event use priority to determine which -- task/interrupt will get the elapsed time). if Scheduling_Event_Hook /= null then Scheduling_Event_Hook.all; end if; -- Restore the software priority to the state before the interrupt -- happened. Interrupt unmasking is not done here (it will be done -- later by the interrupt epilogue). Threads.Queues.Change_Priority (Self_Id, Caller_Priority); -- Restore the interrupt that was being handled previously (if any) Interrupt_Being_Handled (CPU_Id) := Previous_Int; -- Restore previous interrupt number (which is False unless interrupt -- is nested). Self_Id.In_Interrupt := Prev_In_Interr; -- Switch back to previous priority -- -- The priority used (Caller_Priority) may not be correct if a task has -- been unblocked. But in that case, the task was blocked inside the -- kernel (so with interrupt disabled), and the correct priority will -- be set by Leave_Kernel. Board_Support.Interrupts.Set_Current_Priority (Caller_Priority); end Interrupt_Wrapper; ---------------------------- -- Within_Interrupt_Stack -- ---------------------------- function Within_Interrupt_Stack (Stack_Address : System.Address) return Boolean is (Current_Interrupt /= No_Interrupt and then Stack_Address in Interrupt_Stacks (CPU'First)(Stack_Space'First)'Address .. Interrupt_Stacks (CPU'Last)(Stack_Space'Last)'Address); --------------------------- -- Initialize_Interrupts -- --------------------------- procedure Initialize_Interrupts is begin for Proc in CPU loop CPU_Primitives.Initialize_Stack (Interrupt_Stacks (Proc)'Address, Stack_Space'Length, Interrupt_Stack_Table (Proc)); end loop; end Initialize_Interrupts; end System.BB.Interrupts;
package aIDE.Palette is type Item is abstract tagged private; type View is access all Item'Class; private type Item is abstract tagged record null; end record; procedure dummy; end aIDE.Palette;
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; package bits_types_struct_tm_h is -- ISO C `broken-down time' structure. -- Seconds. [0-60] (1 leap second) type tm is record tm_sec : aliased int; -- /usr/include/bits/types/struct_tm.h:9 tm_min : aliased int; -- /usr/include/bits/types/struct_tm.h:10 tm_hour : aliased int; -- /usr/include/bits/types/struct_tm.h:11 tm_mday : aliased int; -- /usr/include/bits/types/struct_tm.h:12 tm_mon : aliased int; -- /usr/include/bits/types/struct_tm.h:13 tm_year : aliased int; -- /usr/include/bits/types/struct_tm.h:14 tm_wday : aliased int; -- /usr/include/bits/types/struct_tm.h:15 tm_yday : aliased int; -- /usr/include/bits/types/struct_tm.h:16 tm_isdst : aliased int; -- /usr/include/bits/types/struct_tm.h:17 tm_gmtoff : aliased long; -- /usr/include/bits/types/struct_tm.h:20 tm_zone : Interfaces.C.Strings.chars_ptr; -- /usr/include/bits/types/struct_tm.h:21 end record with Convention => C_Pass_By_Copy; -- /usr/include/bits/types/struct_tm.h:7 -- Minutes. [0-59] -- Hours. [0-23] -- Day. [1-31] -- Month. [0-11] -- Year - 1900. -- Day of week. [0-6] -- Days in year.[0-365] -- DST. [-1/0/1] -- Seconds east of UTC. -- Timezone abbreviation. -- Seconds east of UTC. -- Timezone abbreviation. end bits_types_struct_tm_h;
with ada.text_io, ada.Integer_text_IO, Ada.Text_IO.Text_Streams, Ada.Strings.Fixed, Interfaces.C; use ada.text_io, ada.Integer_text_IO, Ada.Strings, Ada.Strings.Fixed, Interfaces.C; procedure euler27 is type stringptr is access all char_array; procedure PString(s : stringptr) is begin String'Write (Text_Streams.Stream (Current_Output), To_Ada(s.all)); end; procedure PInt(i : in Integer) is begin String'Write (Text_Streams.Stream (Current_Output), Trim(Integer'Image(i), Left)); end; type c is Array (Integer range <>) of Integer; type c_PTR is access c; function eratostene(t : in c_PTR; max0 : in Integer) return Integer is n : Integer; j : Integer; begin n := 0; for i in integer range 2..max0 - 1 loop if t(i) = i then n := n + 1; j := i * i; while j < max0 and then j > 0 loop t(j) := 0; j := j + i; end loop; end if; end loop; return n; end; function isPrime(d : in Integer; primes : in c_PTR; len : in Integer) return Boolean is n : Integer; i : Integer; begin n := d; i := 0; if n < 0 then n := (-n); end if; while primes(i) * primes(i) < n loop if n rem primes(i) = 0 then return FALSE; end if; i := i + 1; end loop; return TRUE; end; function test(a : in Integer; b : in Integer; primes : in c_PTR; len : in Integer) return Integer is j : Integer; begin for n in integer range 0..200 loop j := n * n + a * n + b; if not isPrime(j, primes, len) then return n; end if; end loop; return 200; end; result : Integer; primes : c_PTR; nprimes : Integer; n2 : Integer; n1 : Integer; mb : Integer; maximumprimes : Integer; max0 : Integer; ma : Integer; l : Integer; era : c_PTR; begin maximumprimes := 1000; era := new c (0..maximumprimes - 1); for j in integer range 0..maximumprimes - 1 loop era(j) := j; end loop; result := 0; max0 := 0; nprimes := eratostene(era, maximumprimes); primes := new c (0..nprimes - 1); for o in integer range 0..nprimes - 1 loop primes(o) := 0; end loop; l := 0; for k in integer range 2..maximumprimes - 1 loop if era(k) = k then primes(l) := k; l := l + 1; end if; end loop; PInt(l); PString(new char_array'( To_C(" == "))); PInt(nprimes); PString(new char_array'( To_C("" & Character'Val(10)))); ma := 0; mb := 0; for b in integer range 3..999 loop if era(b) = b then for a in integer range (-999)..999 loop n1 := test(a, b, primes, nprimes); n2 := test(a, (-b), primes, nprimes); if n1 > max0 then max0 := n1; result := a * b; ma := a; mb := b; end if; if n2 > max0 then max0 := n2; result := (-a) * b; ma := a; mb := (-b); end if; end loop; end if; end loop; PInt(ma); PString(new char_array'( To_C(" "))); PInt(mb); PString(new char_array'( To_C("" & Character'Val(10)))); PInt(max0); PString(new char_array'( To_C("" & Character'Val(10)))); PInt(result); PString(new char_array'( To_C("" & Character'Val(10)))); end;