repo_name
stringlengths
9
74
language
stringclasses
1 value
length_bytes
int64
11
9.34M
extension
stringclasses
2 values
content
stringlengths
11
9.34M
AdaCore/libadalang
Ada
567
adb
package body Renam is procedure P is R4 : Integer renames R (A => 4); --% node.p_is_constant_object R5 renames R (A => 5); --% node.p_is_constant_object Uno : Integer := R4; --% node.p_is_constant_object Dos : constant Integer := R4 * 2; --% node.p_is_constant_object begin null; end P; function R (A : Integer) return Integer is B : Integer renames A; --% node.p_is_constant_object C renames A; --% node.p_is_constant_object begin return A - 3; end R; end Renam;
io7m/coreland-lua-ada-load
Ada
1,176
adb
with Ada.Text_IO; with Test; procedure test0010 is package IO renames Ada.Text_IO; begin Test.Init ("test0010.lua"); declare procedure Process (Context : Test.Load.State_Access_t) is begin IO.Put_Line (Long_Integer'Image (Test.Load.Indexed_Local (Context, 1))); IO.Put_Line (Long_Integer'Image (Test.Load.Indexed_Local (Context, 2))); IO.Put_Line (Long_Integer'Image (Test.Load.Indexed_Local (Context, 3))); IO.Put_Line (Long_Integer'Image (Test.Load.Indexed_Local (Context, 4))); IO.Put_Line (Long_Integer'Image (Test.Load.Indexed_Local (Context, 5))); IO.Put_Line (Long_Integer'Image (Test.Load.Indexed_Local (Context, 6))); IO.Put_Line (Long_Integer'Image (Test.Load.Indexed_Local (Context, 7))); IO.Put_Line (Long_Integer'Image (Test.Load.Indexed_Local (Context, 8))); IO.Put_Line (Long_Integer'Image (Test.Load.Indexed_Local (Context, 9))); end Process; begin Test.Load.Table_Iterate (Test.Loader_Access, Process'Access); end; exception when Test.Load.Load_Error => IO.Put_Line ("fail: " & Test.Load.Error_String (Test.Loader_Access)); raise Test.Load.Load_Error; end test0010;
zhmu/ananas
Ada
17,559
adb
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E L I S T S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- WARNING: There is a C version of this package. Any changes to this -- source file must be properly reflected in the C header a-elists.h. with Alloc; with Debug; use Debug; with Output; use Output; with Table; package body Elists is ------------------------------------- -- Implementation of Element Lists -- ------------------------------------- -- Element lists are composed of three types of entities. The element -- list header, which references the first and last elements of the -- list, the elements themselves which are singly linked and also -- reference the nodes on the list, and finally the nodes themselves. -- The following diagram shows how an element list is represented: -- +----------------------------------------------------+ -- | +------------------------------------------+ | -- | | | | -- V | V | -- +-----|--+ +-------+ +-------+ +-------+ | -- | Elmt | | 1st | | 2nd | | Last | | -- | List |--->| Elmt |--->| Elmt ---...-->| Elmt ---+ -- | Header | | | | | | | | | | -- +--------+ +---|---+ +---|---+ +---|---+ -- | | | -- V V V -- +-------+ +-------+ +-------+ -- | | | | | | -- | Node1 | | Node2 | | Node3 | -- | | | | | | -- +-------+ +-------+ +-------+ -- The list header is an entry in the Elists table. The values used for -- the type Elist_Id are subscripts into this table. The First_Elmt field -- (Lfield1) points to the first element on the list, or to No_Elmt in the -- case of an empty list. Similarly the Last_Elmt field (Lfield2) points to -- the last element on the list or to No_Elmt in the case of an empty list. -- The elements themselves are entries in the Elmts table. The Next field -- of each entry points to the next element, or to the Elist header if this -- is the last item in the list. The Node field points to the node which -- is referenced by the corresponding list entry. ------------------------- -- Element List Tables -- ------------------------- type Elist_Header is record First : Elmt_Id; Last : Elmt_Id; end record; package Elists is new Table.Table ( Table_Component_Type => Elist_Header, Table_Index_Type => Elist_Id'Base, Table_Low_Bound => First_Elist_Id, Table_Initial => Alloc.Elists_Initial, Table_Increment => Alloc.Elists_Increment, Table_Name => "Elists"); type Elmt_Item is record Node : Node_Or_Entity_Id; Next : Union_Id; end record; package Elmts is new Table.Table ( Table_Component_Type => Elmt_Item, Table_Index_Type => Elmt_Id'Base, Table_Low_Bound => First_Elmt_Id, Table_Initial => Alloc.Elmts_Initial, Table_Increment => Alloc.Elmts_Increment, Table_Name => "Elmts"); ----------------- -- Append_Elmt -- ----------------- procedure Append_Elmt (N : Node_Or_Entity_Id; To : Elist_Id) is L : constant Elmt_Id := Elists.Table (To).Last; begin Elmts.Increment_Last; Elmts.Table (Elmts.Last).Node := N; Elmts.Table (Elmts.Last).Next := Union_Id (To); if L = No_Elmt then Elists.Table (To).First := Elmts.Last; else Elmts.Table (L).Next := Union_Id (Elmts.Last); end if; Elists.Table (To).Last := Elmts.Last; if Debug_Flag_N then Write_Str ("Append new element Elmt_Id = "); Write_Int (Int (Elmts.Last)); Write_Str (" to list Elist_Id = "); Write_Int (Int (To)); Write_Str (" referencing Node_Or_Entity_Id = "); Write_Int (Int (N)); Write_Eol; end if; end Append_Elmt; --------------------- -- Append_New_Elmt -- --------------------- procedure Append_New_Elmt (N : Node_Or_Entity_Id; To : in out Elist_Id) is begin if To = No_Elist then To := New_Elmt_List; end if; Append_Elmt (N, To); end Append_New_Elmt; ------------------------ -- Append_Unique_Elmt -- ------------------------ procedure Append_Unique_Elmt (N : Node_Or_Entity_Id; To : Elist_Id) is Elmt : Elmt_Id; begin Elmt := First_Elmt (To); loop if No (Elmt) then Append_Elmt (N, To); return; elsif Node (Elmt) = N then return; else Next_Elmt (Elmt); end if; end loop; end Append_Unique_Elmt; -------------- -- Contains -- -------------- function Contains (List : Elist_Id; N : Node_Or_Entity_Id) return Boolean is Elmt : Elmt_Id; begin if Present (List) then Elmt := First_Elmt (List); while Present (Elmt) loop if Node (Elmt) = N then return True; end if; Next_Elmt (Elmt); end loop; end if; return False; end Contains; -------------------- -- Elists_Address -- -------------------- function Elists_Address return System.Address is begin return Elists.Table (First_Elist_Id)'Address; end Elists_Address; ------------------- -- Elmts_Address -- ------------------- function Elmts_Address return System.Address is begin return Elmts.Table (First_Elmt_Id)'Address; end Elmts_Address; ---------------- -- First_Elmt -- ---------------- function First_Elmt (List : Elist_Id) return Elmt_Id is begin pragma Assert (List > Elist_Low_Bound); return Elists.Table (List).First; end First_Elmt; ---------------- -- Initialize -- ---------------- procedure Initialize is begin Elists.Init; Elmts.Init; end Initialize; ----------------------- -- Insert_Elmt_After -- ----------------------- procedure Insert_Elmt_After (N : Node_Or_Entity_Id; Elmt : Elmt_Id) is Nxt : constant Union_Id := Elmts.Table (Elmt).Next; begin pragma Assert (Elmt /= No_Elmt); Elmts.Increment_Last; Elmts.Table (Elmts.Last).Node := N; Elmts.Table (Elmts.Last).Next := Nxt; Elmts.Table (Elmt).Next := Union_Id (Elmts.Last); if Nxt in Elist_Range then Elists.Table (Elist_Id (Nxt)).Last := Elmts.Last; end if; end Insert_Elmt_After; ------------------------ -- Is_Empty_Elmt_List -- ------------------------ function Is_Empty_Elmt_List (List : Elist_Id) return Boolean is begin return Elists.Table (List).First = No_Elmt; end Is_Empty_Elmt_List; ------------------- -- Last_Elist_Id -- ------------------- function Last_Elist_Id return Elist_Id is begin return Elists.Last; end Last_Elist_Id; --------------- -- Last_Elmt -- --------------- function Last_Elmt (List : Elist_Id) return Elmt_Id is begin return Elists.Table (List).Last; end Last_Elmt; ------------------ -- Last_Elmt_Id -- ------------------ function Last_Elmt_Id return Elmt_Id is begin return Elmts.Last; end Last_Elmt_Id; ----------------- -- List_Length -- ----------------- function List_Length (List : Elist_Id) return Nat is Elmt : Elmt_Id; N : Nat; begin if List = No_Elist then return 0; else N := 0; Elmt := First_Elmt (List); loop if No (Elmt) then return N; else N := N + 1; Next_Elmt (Elmt); end if; end loop; end if; end List_Length; ---------- -- Lock -- ---------- procedure Lock is begin Elists.Release; Elists.Locked := True; Elmts.Release; Elmts.Locked := True; end Lock; -------------------- -- New_Copy_Elist -- -------------------- function New_Copy_Elist (List : Elist_Id) return Elist_Id is Result : Elist_Id; Elmt : Elmt_Id; begin if List = No_Elist then return No_Elist; -- Replicate the contents of the input list while preserving the -- original order. else Result := New_Elmt_List; Elmt := First_Elmt (List); while Present (Elmt) loop Append_Elmt (Node (Elmt), Result); Next_Elmt (Elmt); end loop; return Result; end if; end New_Copy_Elist; ------------------- -- New_Elmt_List -- ------------------- function New_Elmt_List return Elist_Id is begin Elists.Increment_Last; Elists.Table (Elists.Last).First := No_Elmt; Elists.Table (Elists.Last).Last := No_Elmt; if Debug_Flag_N then Write_Str ("Allocate new element list, returned ID = "); Write_Int (Int (Elists.Last)); Write_Eol; end if; return Elists.Last; end New_Elmt_List; ------------------- -- New_Elmt_List -- ------------------- function New_Elmt_List (Elmt1 : Node_Or_Entity_Id) return Elist_Id is L : constant Elist_Id := New_Elmt_List; begin Append_Elmt (Elmt1, L); return L; end New_Elmt_List; ------------------- -- New_Elmt_List -- ------------------- function New_Elmt_List (Elmt1 : Node_Or_Entity_Id; Elmt2 : Node_Or_Entity_Id) return Elist_Id is L : constant Elist_Id := New_Elmt_List (Elmt1); begin Append_Elmt (Elmt2, L); return L; end New_Elmt_List; ------------------- -- New_Elmt_List -- ------------------- function New_Elmt_List (Elmt1 : Node_Or_Entity_Id; Elmt2 : Node_Or_Entity_Id; Elmt3 : Node_Or_Entity_Id) return Elist_Id is L : constant Elist_Id := New_Elmt_List (Elmt1, Elmt2); begin Append_Elmt (Elmt3, L); return L; end New_Elmt_List; ------------------- -- New_Elmt_List -- ------------------- function New_Elmt_List (Elmt1 : Node_Or_Entity_Id; Elmt2 : Node_Or_Entity_Id; Elmt3 : Node_Or_Entity_Id; Elmt4 : Node_Or_Entity_Id) return Elist_Id is L : constant Elist_Id := New_Elmt_List (Elmt1, Elmt2, Elmt3); begin Append_Elmt (Elmt4, L); return L; end New_Elmt_List; --------------- -- Next_Elmt -- --------------- function Next_Elmt (Elmt : Elmt_Id) return Elmt_Id is N : constant Union_Id := Elmts.Table (Elmt).Next; begin if N in Elist_Range then return No_Elmt; else return Elmt_Id (N); end if; end Next_Elmt; procedure Next_Elmt (Elmt : in out Elmt_Id) is begin Elmt := Next_Elmt (Elmt); end Next_Elmt; -------- -- No -- -------- function No (List : Elist_Id) return Boolean is begin return List = No_Elist; end No; function No (Elmt : Elmt_Id) return Boolean is begin return Elmt = No_Elmt; end No; ---------- -- Node -- ---------- function Node (Elmt : Elmt_Id) return Node_Or_Entity_Id is begin if Elmt = No_Elmt then return Empty; else return Elmts.Table (Elmt).Node; end if; end Node; ---------------- -- Num_Elists -- ---------------- function Num_Elists return Nat is begin return Int (Elmts.Last) - Int (Elmts.First) + 1; end Num_Elists; ------------------ -- Prepend_Elmt -- ------------------ procedure Prepend_Elmt (N : Node_Or_Entity_Id; To : Elist_Id) is F : constant Elmt_Id := Elists.Table (To).First; begin Elmts.Increment_Last; Elmts.Table (Elmts.Last).Node := N; if F = No_Elmt then Elists.Table (To).Last := Elmts.Last; Elmts.Table (Elmts.Last).Next := Union_Id (To); else Elmts.Table (Elmts.Last).Next := Union_Id (F); end if; Elists.Table (To).First := Elmts.Last; end Prepend_Elmt; ------------------------- -- Prepend_Unique_Elmt -- ------------------------- procedure Prepend_Unique_Elmt (N : Node_Or_Entity_Id; To : Elist_Id) is begin if not Contains (To, N) then Prepend_Elmt (N, To); end if; end Prepend_Unique_Elmt; ------------- -- Present -- ------------- function Present (List : Elist_Id) return Boolean is begin return List /= No_Elist; end Present; function Present (Elmt : Elmt_Id) return Boolean is begin return Elmt /= No_Elmt; end Present; ------------ -- Remove -- ------------ procedure Remove (List : Elist_Id; N : Node_Or_Entity_Id) is Elmt : Elmt_Id; begin if Present (List) then Elmt := First_Elmt (List); while Present (Elmt) loop if Node (Elmt) = N then Remove_Elmt (List, Elmt); exit; end if; Next_Elmt (Elmt); end loop; end if; end Remove; ----------------- -- Remove_Elmt -- ----------------- procedure Remove_Elmt (List : Elist_Id; Elmt : Elmt_Id) is Nxt : Elmt_Id; Prv : Elmt_Id; begin Nxt := Elists.Table (List).First; -- Case of removing only element in the list if Elmts.Table (Nxt).Next in Elist_Range then pragma Assert (Nxt = Elmt); Elists.Table (List).First := No_Elmt; Elists.Table (List).Last := No_Elmt; -- Case of removing the first element in the list elsif Nxt = Elmt then Elists.Table (List).First := Elmt_Id (Elmts.Table (Nxt).Next); -- Case of removing second or later element in the list else loop Prv := Nxt; Nxt := Elmt_Id (Elmts.Table (Prv).Next); exit when Nxt = Elmt or else Elmts.Table (Nxt).Next in Elist_Range; end loop; pragma Assert (Nxt = Elmt); Elmts.Table (Prv).Next := Elmts.Table (Nxt).Next; if Elmts.Table (Prv).Next in Elist_Range then Elists.Table (List).Last := Prv; end if; end if; end Remove_Elmt; ---------------------- -- Remove_Last_Elmt -- ---------------------- procedure Remove_Last_Elmt (List : Elist_Id) is Nxt : Elmt_Id; Prv : Elmt_Id; begin Nxt := Elists.Table (List).First; -- Case of removing only element in the list if Elmts.Table (Nxt).Next in Elist_Range then Elists.Table (List).First := No_Elmt; Elists.Table (List).Last := No_Elmt; -- Case of at least two elements in list else loop Prv := Nxt; Nxt := Elmt_Id (Elmts.Table (Prv).Next); exit when Elmts.Table (Nxt).Next in Elist_Range; end loop; Elmts.Table (Prv).Next := Elmts.Table (Nxt).Next; Elists.Table (List).Last := Prv; end if; end Remove_Last_Elmt; ------------------ -- Replace_Elmt -- ------------------ procedure Replace_Elmt (Elmt : Elmt_Id; New_Node : Node_Or_Entity_Id) is begin Elmts.Table (Elmt).Node := New_Node; end Replace_Elmt; ------------ -- Unlock -- ------------ procedure Unlock is begin Elists.Locked := False; Elmts.Locked := False; end Unlock; end Elists;
albinjal/Ada_Project
Ada
774
ads
with Klient_assets_package; use Klient_assets_package; --graphics package Yatzy_graphics_package is --remove after tests type Protocoll_Type is array(1..15) of Integer; procedure update_protocoll(X_Start, Y_Start: in Integer; prot1, prot2: in Protocoll_Type); procedure dice (A, X_Start, Y_Start: in Integer); procedure background; procedure protocoll_background (X_Start, Y_Start: in Integer); procedure logo(X_Start, Y_Start : in Integer); Procedure logo_background (X_Start, Y_Start : in Integer); procedure place (avail_points : in Protocoll_Type; select_place : out Integer); procedure message (X_Start, Y_Start : in Integer; S : in String); procedure dice_placement (D1, D2, D3, D4, D5 : in Integer); private end Yatzy_graphics_package;
Fabien-Chouteau/pygamer-simulator
Ada
829
ads
with System; with HAL; with HAL.Bitmap; package PyGamer.Screen is Width : constant := 160; Height : constant := 128; procedure Set_Address (X_Start, X_End, Y_Start, Y_End : HAL.UInt16); procedure Start_Pixel_TX; procedure End_Pixel_TX; procedure Push_Pixels (Addr : System.Address; Len : Natural); -- Addr: pointer to a read-only buffer of Len pixels (16-bit RGB565) procedure Push_Pixels_Swap (Addr : System.Address; Len : Natural); -- Addr: pointer to a read-write buffer of Len pixels (16-bit RGB565) procedure Scroll (Val : HAL.UInt8); procedure Debug_Mode (Enabled : Boolean); -- DMA -- procedure Start_DMA (Addr : System.Address; Len : Natural); -- Addr: pointer to a read-only buffer of Len pixels (16-bit RGB565) procedure Wait_End_Of_DMA; end PyGamer.Screen;
AdaCore/libadalang
Ada
185
adb
function Ers return Integer is One : Integer := 1; begin return Result : constant Integer := One; --% node.find(lal.ExtendedReturnStmtObjectDecl).p_is_constant_object end Ers;
stcarrez/ada-awa
Ada
3,590
adb
----------------------------------------------------------------------- -- awa-modules-lifecycles -- Lifecycle listeners -- Copyright (C) 2012 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body AWA.Modules.Lifecycles is -- ------------------------------ -- Inform the the life cycle listeners registered in `List` that the item passed in `Item` -- has been created (calls `On_Create`). -- ------------------------------ procedure Notify_Create (Service : in AWA.Modules.Module_Manager'Class; Item : in Element_Type) is begin LF.Notify_Create (Service.Module.Listeners, Item); end Notify_Create; -- ------------------------------ -- Inform the the life cycle listeners registered in `List` that the item passed in `Item` -- has been created (calls `On_Create`). -- ------------------------------ procedure Notify_Create (Service : in AWA.Modules.Module'Class; Item : in Element_Type) is begin LF.Notify_Create (Service.Listeners, Item); end Notify_Create; -- ------------------------------ -- Inform the the life cycle listeners registered in `List` that the item passed in `Item` -- has been updated (calls `On_Update`). -- ------------------------------ procedure Notify_Update (Service : in AWA.Modules.Module_Manager'Class; Item : in Element_Type) is begin LF.Notify_Update (Service.Module.Listeners, Item); end Notify_Update; -- ------------------------------ -- Inform the the life cycle listeners registered in `List` that the item passed in `Item` -- has been updated (calls `On_Update`). -- ------------------------------ procedure Notify_Update (Service : in AWA.Modules.Module'Class; Item : in Element_Type) is begin LF.Notify_Update (Service.Listeners, Item); end Notify_Update; -- ------------------------------ -- Inform the the life cycle listeners registered in `List` that the item passed in `Item` -- has been deleted (calls `On_Delete`). -- ------------------------------ procedure Notify_Delete (Service : in AWA.Modules.Module_Manager'Class; Item : in Element_Type) is begin LF.Notify_Delete (Service.Module.Listeners, Item); end Notify_Delete; -- ------------------------------ -- Inform the the life cycle listeners registered in `List` that the item passed in `Item` -- has been deleted (calls `On_Delete`). -- ------------------------------ procedure Notify_Delete (Service : in AWA.Modules.Module'Class; Item : in Element_Type) is begin LF.Notify_Delete (Service.Listeners, Item); end Notify_Delete; end AWA.Modules.Lifecycles;
optikos/oasis
Ada
57,627
ads
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with System.Storage_Pools.Subpools; private with Program.Compilation_Units; private with Program.Element_Factories; private with Program.Elements; private package Program.Parsers.Nodes is pragma Preelaborate; type Node is private; type Node_Array is array (Positive range <>) of Node; None : constant Node; No_Token : constant Node; type Node_Factory (Comp : not null Program.Compilations.Compilation_Access; Subpool : not null System.Storage_Pools.Subpools.Subpool_Handle) is tagged limited private; function Token (Self : Node_Factory'Class; Value : not null Program.Lexical_Elements.Lexical_Element_Access) return Node; procedure Get_Compilation_Units (Value : Node; Units : out Program.Parsers.Unit_Vectors.Vector; Pragmas : out Program.Parsers.Element_Vectors.Vector); function Compilation (Self : Node_Factory'Class; Units : Node; Compilation_Pragmas : Node) return Node; function Abort_Statement (Self : Node_Factory'Class; Abort_Token : Node; Aborted_Tasks : Node; Semicolon_Token : Node) return Node; function Accept_Statement (Self : Node_Factory'Class; Accept_Token : Node; Accept_Entry_Direct_Name : Node; Left_Parenthesis_Token : Node; Accept_Entry_Index : Node; Right_Parenthesis_Token : Node; Lp_Token : Node; Accept_Parameters : Node; Rp_Token : Node; Do_Token : Node; Accept_Body_Statements : Node; Exception_Token : Node; Exception_Handlers : Node; End_Token : Node; Identifier_Token : Node; Semicolon_Token : Node) return Node; function Access_To_Function_Definition (Self : Node_Factory'Class; Not_Token : Node; Null_Token : Node; Access_Token : Node; Protected_Token : Node; Function_Token : Node; Lp_Token : Node; Access_To_Subprogram_Parameter_Profile : Node; Rp_Token : Node; Return_Token : Node; Return_Not_Token : Node; Return_Null_Token : Node; Access_To_Function_Result_Subtype : Node) return Node; function Access_To_Object_Definition (Self : Node_Factory'Class; Not_Token : Node; Null_Token : Node; Access_Token : Node; Constant_Token : Node; Subtype_Indication : Node) return Node; function Access_To_Procedure_Definition (Self : Node_Factory'Class; Not_Token : Node; Null_Token : Node; Access_Token : Node; Protected_Token : Node; Procedure_Token : Node; Lp_Token : Node; Access_To_Subprogram_Parameter_Profile : Node; Rp_Token : Node) return Node; function Allocator (Self : Node_Factory'Class; New_Token : Node; Left_Parenthesis_Token : Node; Subpool_Name : Node; Right_Parenthesis_Token : Node; Subtype_Or_Expression : Node) return Node; function Anonymous_Access_To_Function_Definition (Self : Node_Factory'Class; Not_Token : Node; Null_Token : Node; Access_Token : Node; Protected_Token : Node; Function_Token : Node; Lp_Token : Node; Access_To_Subprogram_Parameter_Profile : Node; Rp_Token : Node; Return_Token : Node; Return_Not_Token : Node; Return_Null_Token : Node; Access_To_Function_Result_Subtype : Node) return Node; function Anonymous_Access_To_Object_Definition (Self : Node_Factory'Class; Not_Token : Node; Null_Token : Node; Access_Token : Node; Constant_Token : Node; Anonymous_Access_To_Object_Subtype_Mark : Node) return Node; function Anonymous_Access_To_Procedure_Definition (Self : Node_Factory'Class; Not_Token : Node; Null_Token : Node; Access_Token : Node; Protected_Token : Node; Procedure_Token : Node; Lp_Token : Node; Access_To_Subprogram_Parameter_Profile : Node; Rp_Token : Node) return Node; function Aspect_Specification (Self : Node_Factory'Class; Aspect_Mark : Node; Arrow_Token : Node; Aspect_Definition : Node) return Node; function Assignment_Statement (Self : Node_Factory'Class; Assignment_Variable_Name : Node; Assignment_Token : Node; Assignment_Expression : Node; Semicolon_Token : Node) return Node; function Association (Self : Node_Factory'Class; Array_Component_Choices : Node; Arrow_Token : Node; Component_Expression : Node) return Node; function Association_List (Self : Node_Factory'Class; Left_Token : Node; Record_Component_Associations : Node; Right_Token : Node) return Node; function Asynchronous_Select (Self : Node_Factory'Class; Select_Token : Node; Asynchronous_Statement_Paths : Node; End_Token : Node; End_Select : Node; Semicolon_Token : Node) return Node; function At_Clause (Self : Node_Factory'Class; For_Token : Node; Representation_Clause_Name : Node; Use_Token : Node; At_Token : Node; Representation_Clause_Expression : Node; Semicolon_Token : Node) return Node; function Attribute_Definition_Clause (Self : Node_Factory'Class; For_Token : Node; Representation_Clause_Name : Node; Use_Token : Node; Representation_Clause_Expression : Node; Semicolon_Token : Node) return Node; function Attribute_Reference (Self : Node_Factory'Class; Prefix : Node; Apostrophe_Token : Node; Attribute_Designator_Identifier : Node; Attribute_Designator_Expressions : Node) return Node; function Block_Statement (Self : Node_Factory'Class; Statement_Identifier : Node; Colon_Token : Node; Declare_Token : Node; Block_Declarative_Items : Node; Begin_Token : Node; Block_Statements : Node; Exception_Token : Node; Exception_Handlers : Node; End_Token : Node; Identifier_Token : Node; Semicolon_Token : Node) return Node; function Box (Self : Node_Factory'Class; Box_Token : Node) return Node; function Case_Expression (Self : Node_Factory'Class; Case_Token : Node; Expression : Node; Is_Token : Node; Case_Expression_Paths : Node) return Node; function Case_Expression_Path (Self : Node_Factory'Class; When_Token : Node; Case_Path_Alternative_Choices : Node; Arrow_Token : Node; Dependent_Expression : Node) return Node; function Case_Path (Self : Node_Factory'Class; When_Token : Node; Variant_Choices : Node; Arrow_Token : Node; Sequence_Of_Statements : Node) return Node; function Case_Statement (Self : Node_Factory'Class; Case_Token : Node; Case_Expression : Node; Is_Token : Node; Case_Statement_Paths : Node; End_Token : Node; Endcase : Node; Semicolon_Token : Node) return Node; function Character_Literal (Self : Node_Factory'Class; Character_Literal_Token : Node) return Node; function Choice_Parameter_Specification (Self : Node_Factory'Class; Names : Node) return Node; function Compilation_Unit_Body (Self : Node_Factory'Class; Context_Clause_Elements : Node; Unit_Declaration : Node) return Node; function Compilation_Unit_Declaration (Self : Node_Factory'Class; Context_Clause_Elements : Node; Private_Token : Node; Unit_Declaration : Node) return Node; function Component_Clause (Self : Node_Factory'Class; Representation_Clause_Name : Node; At_Token : Node; Component_Clause_Position : Node; Range_Token : Node; Component_Clause_Range : Node; Semicolon_Token : Node) return Node; function Component_Declaration (Self : Node_Factory'Class; Names : Node; Colon_Token : Node; Object_Declaration_Subtype : Node; Assignment_Token : Node; Initialization_Expression : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Component_Definition (Self : Node_Factory'Class; Aliased_Token : Node; Subtype_Indication : Node) return Node; -- function Composite_Constraint -- (Self : Node_Factory'Class; -- Left_Token : Node; -- Associations : Node; -- Right_Token : Node) return Node; -- We call Function_Call instead -- function Composite_Subtype_Indication -- (Self : Node_Factory'Class; -- Not_Token : Node; -- Null_Token : Node; -- Subtype_Mark : Node; -- Composite_Constraint : Node) return Node; function Constrained_Array_Definition (Self : Node_Factory'Class; Array_Token : Node; Left_Token : Node; Discrete_Subtype_Definitions : Node; Right_Token : Node; Of_Token : Node; Array_Component_Definition : Node) return Node; function Decimal_Fixed_Point_Definition (Self : Node_Factory'Class; Delta_Token : Node; Delta_Expression : Node; Digits_Token : Node; Digits_Expression : Node; Real_Range_Constraint : Node) return Node; function Defining_Character_Literal (Self : Node_Factory'Class; Character_Literal : Node) return Node; function Defining_Enumeration_Literal (Self : Node_Factory'Class; Identifier : Node) return Node; -- function Defining_Expanded_Unit_Name -- (Self : Node_Factory'Class; -- Defining_Prefix : Node; -- Dot_Token : Node; -- Defining_Selector : Node) return Node; function Defining_Identifier (Self : Node_Factory'Class; Identifier_Token : Node) return Node; function Defining_Operator_Symbol (Self : Node_Factory'Class; Operator_Symbol_Token : Node) return Node; function Delay_Statement (Self : Node_Factory'Class; Delay_Token : Node; Until_Token : Node; Delay_Expression : Node; Semicolon_Token : Node) return Node; function Delta_Constraint (Self : Node_Factory'Class; Delta_Token : Node; Delta_Expression : Node; Real_Range_Constraint : Node) return Node; function Derived_Record_Definition (Self : Node_Factory'Class; Abstract_Token : Node; Limited_Token : Node; New_Token : Node; Parent_Subtype_Indication : Node; Progenitor_List : Node; With_Token : Node; Record_Definition : Node) return Node; function Derived_Type_Definition (Self : Node_Factory'Class; Abstract_Token : Node; Limited_Token : Node; New_Token : Node; Parent_Subtype_Indication : Node) return Node; function Digits_Constraint (Self : Node_Factory'Class; Digits_Token : Node; Digits_Expression : Node; Real_Range_Constraint : Node) return Node; function Discrete_Range_Attribute_Reference (Self : Node_Factory'Class; Range_Attribute : Node) return Node; function Discrete_Simple_Expression_Range (Self : Node_Factory'Class; Lower_Bound : Node; Double_Dot_Token : Node; Upper_Bound : Node) return Node; function Discrete_Subtype_Indication (Self : Node_Factory'Class; Subtype_Mark : Node; Subtype_Constraint : Node) return Node; function Discrete_Subtype_Indication_Dr (Self : Node_Factory'Class; Subtype_Mark : Node; Subtype_Constraint : Node) return Node; function Discriminant_Specification (Self : Node_Factory'Class; Names : Node; Colon_Token : Node; Not_Token : Node; Null_Token : Node; Object_Declaration_Subtype : Node; Assignment_Token : Node; Initialization_Expression : Node) return Node; function Element_Iterator_Specification (Self : Node_Factory'Class; Names : Node; Colon_Token : Node; Subtype_Indication : Node; Of_Token : Node; Reverse_Token : Node; Iteration_Scheme_Name : Node) return Node; function Else_Expression_Path (Self : Node_Factory'Class; Else_Token : Node; Dependent_Expression : Node) return Node; function Else_Path (Self : Node_Factory'Class; Else_Token : Node; Sequence_Of_Statements : Node) return Node; function Elsif_Expression_Path (Self : Node_Factory'Class; Elsif_Token : Node; Condition_Expression : Node; Then_Token : Node; Dependent_Expression : Node) return Node; function Elsif_Path (Self : Node_Factory'Class; Elsif_Token : Node; Condition_Expression : Node; Then_Token : Node; Sequence_Of_Statements : Node) return Node; function Entry_Body (Self : Node_Factory'Class; Entry_Token : Node; Names : Node; Left_Parenthesis_Token : Node; Entry_Index_Specification : Node; Right_Parenthesis_Token : Node; Lp_Token : Node; Parameter_Profile : Node; Rp_Token : Node; When_Token : Node; Entry_Barrier : Node; Is_Token : Node; Body_Declarative_Items : Node; Begin_Token : Node; Body_Statements : Node; Exception_Token : Node; Exception_Handlers : Node; End_Token : Node; Identifier_Token : Node; Semicolon_Token : Node) return Node; function Entry_Declaration (Self : Node_Factory'Class; Not_Token : Node; Overriding_Token : Node; Entry_Token : Node; Names : Node; Left_Parenthesis_Token : Node; Entry_Family_Definition : Node; Right_Parenthesis_Token : Node; Lp_Token : Node; Parameter_Profile : Node; Rp_Token : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Entry_Index_Specification (Self : Node_Factory'Class; For_Token : Node; Names : Node; In_Token : Node; Specification_Subtype_Definition : Node) return Node; function Enumeration_Literal_Specification (Self : Node_Factory'Class; Names : Node) return Node; function Enumeration_Type_Definition (Self : Node_Factory'Class; Left_Token : Node; Literals : Node; Right_Token : Node) return Node; function Exception_Declaration (Self : Node_Factory'Class; Names : Node; Colon_Token : Node; Exception_Token : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Exception_Handler (Self : Node_Factory'Class; When_Token : Node; Choice_Parameter_Specification : Node; Colon_Token : Node; Exception_Choices : Node; Arrow_Token : Node; Handler_Statements : Node) return Node; function Exception_Renaming_Declaration (Self : Node_Factory'Class; Names : Node; Colon_Token : Node; Exception_Token : Node; Renames_Token : Node; Renamed_Entity : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Exit_Statement (Self : Node_Factory'Class; Exit_Token : Node; Exit_Loop_Name : Node; When_Token : Node; Exit_Condition : Node; Semicolon_Token : Node) return Node; function Explicit_Dereference (Self : Node_Factory'Class; Prefix : Node; Dot_Token : Node; All_Token : Node) return Node; function Extended_Return_Statement (Self : Node_Factory'Class; Return_Token : Node; Return_Object_Specification : Node; Do_Token : Node; Extended_Return_Statements : Node; Exception_Token : Node; Exception_Handlers : Node; End_Token : Node; End_Return : Node; Semicolon_Token : Node) return Node; function Extension_Aggregate (Self : Node_Factory'Class; Left_Token : Node; Extension_Aggregate_Expression : Node; With_Token : Node; Record_Component_Associations : Node; Right_Token : Node) return Node; function Floating_Point_Definition (Self : Node_Factory'Class; Digits_Token : Node; Digits_Expression : Node; Real_Range_Constraint : Node) return Node; function For_Loop_Statement (Self : Node_Factory'Class; Statement_Identifier : Node; Colon_Token : Node; For_Token : Node; Loop_Parameter_Specification : Node; Loop_Token : Node; Loop_Statements : Node; End_Token : Node; End_Loop : Node; Identifier_Token : Node; Semicolon_Token : Node) return Node; function Formal_Access_To_Function_Definition (Self : Node_Factory'Class; Not_Token : Node; Null_Token : Node; Access_Token : Node; Protected_Token : Node; Function_Token : Node; Lp_Token : Node; Access_To_Subprogram_Parameter_Profile : Node; Rp_Token : Node; Return_Token : Node; Return_Not_Token : Node; Return_Null_Token : Node; Access_To_Function_Result_Subtype : Node) return Node; function Formal_Access_To_Object_Definition (Self : Node_Factory'Class; Not_Token : Node; Null_Token : Node; Access_Token : Node; Constant_Token : Node; Subtype_Indication : Node) return Node; function Formal_Access_To_Procedure_Definition (Self : Node_Factory'Class; Not_Token : Node; Null_Token : Node; Access_Token : Node; Protected_Token : Node; Procedure_Token : Node; Lp_Token : Node; Access_To_Subprogram_Parameter_Profile : Node; Rp_Token : Node) return Node; function Formal_Constrained_Array_Definition (Self : Node_Factory'Class; Array_Token : Node; Left_Token : Node; Discrete_Subtype_Definitions : Node; Right_Token : Node; Of_Token : Node; Array_Component_Definition : Node) return Node; function Formal_Decimal_Fixed_Point_Definition (Self : Node_Factory'Class; Delta_Token : Node; Delta_Box : Node; Digits_Token : Node; Digits_Box : Node) return Node; function Formal_Derived_Type_Definition (Self : Node_Factory'Class; Abstract_Token : Node; Limited_Token : Node; Synchronized_Token : Node; New_Token : Node; Subtype_Mark : Node; And_Token : Node; Progenitor_List : Node; With_Token : Node; Private_Token : Node; Aspect_Specifications : Node) return Node; function Formal_Discrete_Type_Definition (Self : Node_Factory'Class; Left_Parenthesis_Token : Node; Box_Token : Node; Right_Parenthesis_Token : Node) return Node; function Formal_Floating_Point_Definition (Self : Node_Factory'Class; Digits_Token : Node; Box_Token : Node) return Node; function Formal_Function_Declaration (Self : Node_Factory'Class; With_Token : Node; Function_Token : Node; Names : Node; Lp_Token : Node; Parameter_Profile : Node; Rp_Token : Node; Return_Token : Node; Return_Not_Token : Node; Return_Null_Token : Node; Result_Subtype : Node; Is_Token : Node; Abstract_Token : Node; Formal_Subprogram_Default : Node; Box_Token : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Formal_Incomplete_Type_Declaration (Self : Node_Factory'Class; Type_Token : Node; Names : Node; Discriminant_Part : Node; Is_Token : Node; Tagged_Token : Node; Semicolon_Token : Node) return Node; function Formal_Interface_Type_Definition (Self : Node_Factory'Class; Kind_Token : Node; Interface_Token : Node; Progenitor_List : Node) return Node; function Formal_Modular_Type_Definition (Self : Node_Factory'Class; Mod_Token : Node; Box_Token : Node) return Node; function Formal_Object_Declaration (Self : Node_Factory'Class; Names : Node; Colon_Token : Node; In_Token : Node; Out_Token : Node; Not_Token : Node; Null_Token : Node; Object_Declaration_Subtype : Node; Assignment_Token : Node; Initialization_Expression : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Formal_Ordinary_Fixed_Point_Definition (Self : Node_Factory'Class; Delta_Token : Node; Box_Token : Node) return Node; function Formal_Package_Declaration (Self : Node_Factory'Class; With_Token : Node; Package_Token : Node; Names : Node; Is_Token : Node; New_Token : Node; Generic_Unit_Name : Node; Left_Parenthesis_Token : Node; Generic_Actual_Part : Node; Right_Parenthesis_Token : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Formal_Private_Type_Definition (Self : Node_Factory'Class; Abstract_Token : Node; Tagged_Token : Node; Limited_Token : Node; Private_Token : Node) return Node; function Formal_Procedure_Declaration (Self : Node_Factory'Class; With_Token : Node; Procedure_Token : Node; Names : Node; Lp_Token : Node; Parameter_Profile : Node; Rp_Token : Node; Is_Token : Node; Abstract_Token : Node; Box_Token : Node; Null_Token : Node; Formal_Subprogram_Default : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Formal_Signed_Integer_Type_Definition (Self : Node_Factory'Class; Range_Token : Node; Box_Token : Node) return Node; function Formal_Type_Declaration (Self : Node_Factory'Class; Type_Token : Node; Names : Node; Discriminant_Part : Node; Is_Token : Node; Type_Declaration_View : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Formal_Unconstrained_Array_Definition (Self : Node_Factory'Class; Array_Token : Node; Left_Token : Node; Index_Subtype_Definitions : Node; Right_Token : Node; Of_Token : Node; Array_Component_Definition : Node) return Node; function Full_Type_Declaration (Self : Node_Factory'Class; Type_Token : Node; Names : Node; Discriminant_Part : Node; Is_Token : Node; Type_Declaration_View : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Function_Body (Self : Node_Factory'Class; Not_Token : Node; Overriding_Token : Node; Function_Token : Node; Names : Node; Lp_Token : Node; Parameter_Profile : Node; Rp_Token : Node; Return_Token : Node; Return_Not_Token : Node; Return_Null_Token : Node; Result_Subtype : Node; Aspect_Specifications : Node; Is_Token : Node; Body_Declarative_Items : Node; Begin_Token : Node; Body_Statements : Node; Exception_Token : Node; Exception_Handlers : Node; End_Token : Node; End_Name : Node; Semicolon_Token : Node) return Node; function Function_Call (Self : Node_Factory'Class; Prefix : Node; Function_Call_Parameters : Node) return Node; function Function_Declaration (Self : Node_Factory'Class; Not_Token : Node; Overriding_Token : Node; Function_Token : Node; Names : Node; Lp_Token : Node; Parameter_Profile : Node; Rp_Token : Node; Return_Token : Node; Return_Not_Token : Node; Return_Null_Token : Node; Result_Subtype : Node; Is_Token : Node; Abstract_Token : Node; Result_Expression : Node; Renames_Token : Node; Renamed_Entity : Node; Separate_Token : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Function_Instantiation (Self : Node_Factory'Class; Not_Token : Node; Overriding_Token : Node; Function_Token : Node; Names : Node; Is_Token : Node; New_Token : Node; Generic_Unit_Name : Node; Left_Parenthesis_Token : Node; Generic_Actual_Part : Node; Right_Parenthesis_Token : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; -- function Generalized_Iterator_Specification -- (Self : Node_Factory'Class; -- Names : Node; -- In_Token : Node; -- Reverse_Token : Node; -- Iteration_Scheme_Name : Node) return Node; function Generic_Association (Self : Node_Factory'Class; Formal_Parameter : Node; Arrow_Token : Node; Actual_Parameter : Node; Box_Token : Node) return Node; function Generic_Function_Declaration (Self : Node_Factory'Class; Generic_Token : Node; Generic_Formal_Part : Node; Function_Token : Node; Names : Node; Lp_Token : Node; Parameter_Profile : Node; Rp_Token : Node; Return_Token : Node; Return_Not_Token : Node; Return_Null_Token : Node; Result_Subtype : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Generic_Function_Renaming (Self : Node_Factory'Class; Generic_Token : Node; Generic_Formal_Part : Node; Function_Token : Node; Names : Node; Renames_Token : Node; Renamed_Entity : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Generic_Package_Declaration (Self : Node_Factory'Class; Generic_Token : Node; Generic_Formal_Part : Node; Package_Token : Node; Names : Node; Aspect_Specifications : Node; Is_Token : Node; Visible_Part_Declarative_Items : Node; Private_Token : Node; Private_Part_Declarative_Items : Node; End_Token : Node; End_Name : Node; Semicolon_Token : Node) return Node; function Generic_Package_Renaming (Self : Node_Factory'Class; Generic_Token : Node; Generic_Formal_Part : Node; Package_Token : Node; Names : Node; Renames_Token : Node; Renamed_Entity : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Generic_Procedure_Declaration (Self : Node_Factory'Class; Generic_Token : Node; Generic_Formal_Part : Node; Procedure_Token : Node; Names : Node; Lp_Token : Node; Parameter_Profile : Node; Rp_Token : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Generic_Procedure_Renaming (Self : Node_Factory'Class; Generic_Token : Node; Generic_Formal_Part : Node; Procedure_Token : Node; Names : Node; Renames_Token : Node; Renamed_Entity : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Goto_Statement (Self : Node_Factory'Class; Exit_Token : Node; Goto_Label : Node; Semicolon_Token : Node) return Node; function Identifier (Self : Node_Factory'Class; Identifier_Token : Node) return Node; function If_Expression (Self : Node_Factory'Class; Expression_Paths : Node) return Node; function If_Expression_Path (Self : Node_Factory'Class; If_Token : Node; Condition_Expression : Node; Then_Token : Node; Dependent_Expression : Node) return Node; function If_Path (Self : Node_Factory'Class; If_Token : Node; Condition_Expression : Node; Then_Token : Node; Sequence_Of_Statements : Node) return Node; function If_Statement (Self : Node_Factory'Class; Statement_Paths : Node; End_Token : Node; If_Token : Node; Semicolon_Token : Node) return Node; function Incomplete_Type_Declaration (Self : Node_Factory'Class; Type_Token : Node; Names : Node; Discriminant_Part : Node; Is_Token : Node; Type_Declaration_View : Node; Semicolon_Token : Node) return Node; function Incomplete_Type_Definition (Self : Node_Factory'Class; Tagged_Token : Node) return Node; function Interface_Type_Definition (Self : Node_Factory'Class; Kind_Token : Node; Interface_Token : Node; Progenitor_List : Node) return Node; function Known_Discriminant_Part (Self : Node_Factory'Class; Left_Parenthesis_Token : Node; Discriminants : Node; Right_Parenthesis_Token : Node) return Node; function Label_Decorator (Self : Node_Factory'Class; Label_Names : Node; Unlabeled_Statement : Node) return Node; function Loop_Parameter_Specification (Self : Node_Factory'Class; Names : Node; In_Token : Node; Reverse_Token : Node; Specification_Subtype_Definition : Node) return Node; function Loop_Statement (Self : Node_Factory'Class; Statement_Identifier : Node; Colon_Token : Node; Loop_Token : Node; Loop_Statements : Node; End_Token : Node; End_Loop : Node; Identifier_Token : Node; Semicolon_Token : Node) return Node; function Membership_Test (Self : Node_Factory'Class; Membership_Test_Expression : Node; Not_Token : Node; In_Token : Node; Membership_Test_Choices : Node) return Node; function Modular_Type_Definition (Self : Node_Factory'Class; Mod_Token : Node; Mod_Static_Expression : Node) return Node; function Null_Component (Self : Node_Factory'Class; Null_Token : Node; Semicolon_Token : Node) return Node; function Null_Literal (Self : Node_Factory'Class; Null_Literal_Token : Node) return Node; function Null_Record_Definition (Self : Node_Factory'Class; Null_Token : Node; Record_Token : Node) return Node; function Null_Statement (Self : Node_Factory'Class; Null_Token : Node; Semicolon_Token : Node) return Node; function Number_Declaration (Self : Node_Factory'Class; Names : Node; Colon_Token : Node; Constant_Token : Node; Assignment_Token : Node; Initialization_Expression : Node; Semicolon_Token : Node) return Node; function Numeric_Literal (Self : Node_Factory'Class; Numeric_Literal_Token : Node) return Node; function Object_Declaration (Self : Node_Factory'Class; Names : Node; Colon_Token : Node; Aliased_Token : Node; Constant_Token : Node; Object_Declaration_Subtype : Node; Assignment_Token : Node; Initialization_Expression : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Object_Renaming_Declaration (Self : Node_Factory'Class; Names : Node; Colon_Token : Node; Not_Token : Node; Null_Token : Node; Object_Declaration_Subtype : Node; Renames_Token : Node; Renamed_Entity : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Operator_Symbol (Self : Node_Factory'Class; Operator_Symbol_Token : Node) return Node; function Ordinary_Fixed_Point_Definition (Self : Node_Factory'Class; Delta_Token : Node; Delta_Expression : Node; Real_Range_Constraint : Node) return Node; function Others_Choice (Self : Node_Factory'Class; Others_Token : Node) return Node; function Package_Body (Self : Node_Factory'Class; Package_Token : Node; Body_Token : Node; Names : Node; Aspect_Specifications : Node; Is_Token : Node; Body_Declarative_Items : Node; Begin_Token : Node; Body_Statements : Node; Exception_Token : Node; Exception_Handlers : Node; End_Token : Node; End_Name : Node; Semicolon_Token : Node) return Node; function Package_Body_Stub (Self : Node_Factory'Class; Package_Token : Node; Body_Token : Node; Names : Node; Is_Token : Node; Separate_Token : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Package_Declaration (Self : Node_Factory'Class; Package_Token : Node; Names : Node; Aspect_Specifications : Node; Is_Token : Node; Visible_Part_Declarative_Items : Node; Private_Token : Node; Private_Part_Declarative_Items : Node; End_Token : Node; End_Name : Node; Semicolon_Token : Node) return Node; function Package_Instantiation (Self : Node_Factory'Class; Package_Token : Node; Names : Node; Is_Token : Node; New_Token : Node; Generic_Unit_Name : Node; Left_Parenthesis_Token : Node; Generic_Actual_Part : Node; Right_Parenthesis_Token : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Package_Renaming_Declaration (Self : Node_Factory'Class; Package_Token : Node; Names : Node; Renames_Token : Node; Renamed_Entity : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; -- function Parameter_Association -- (Self : Node_Factory'Class; -- Formal_Parameter : Node; -- Actual_Parameter : Node) return Node; function Parameter_Specification (Self : Node_Factory'Class; Names : Node; Colon_Token : Node; Aliased_Token : Node; In_Token : Node; Out_Token : Node; Not_Token : Node; Null_Token : Node; Object_Declaration_Subtype : Node; Assignment_Token : Node; Initialization_Expression : Node) return Node; -- function Parenthesized_Expression -- (Self : Node_Factory'Class; -- Left_Token : Node; -- Expression_Parenthesized : Node; -- Right_Token : Node) return Node; function Pragma_Argument_Association (Self : Node_Factory'Class; Formal_Parameter : Node; Arrow_Token : Node; Actual_Parameter : Node) return Node; function Pragma_Node (Self : Node_Factory'Class; Pragma_Token : Node; Formal_Parameter : Node; Left_Token : Node; Pragma_Argument_Associations : Node; Right_Token : Node; Semicolon_Token : Node) return Node; function Private_Extension_Declaration (Self : Node_Factory'Class; Type_Token : Node; Names : Node; Discriminant_Part : Node; Is_Token : Node; Type_Declaration_View : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Private_Extension_Definition (Self : Node_Factory'Class; Abstract_Token : Node; Limited_Token : Node; Synchronized_Token : Node; New_Token : Node; Ancestor_Subtype_Indication : Node; Progenitor_List : Node; With_Token : Node; Private_Token : Node) return Node; function Private_Type_Declaration (Self : Node_Factory'Class; Type_Token : Node; Names : Node; Discriminant_Part : Node; Is_Token : Node; Type_Declaration_View : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Private_Type_Definition (Self : Node_Factory'Class; Abstract_Token : Node; Tagged_Token : Node; Limited_Token : Node; Private_Token : Node) return Node; function Procedure_Body (Self : Node_Factory'Class; Not_Token : Node; Overriding_Token : Node; Procedure_Token : Node; Names : Node; Lp_Token : Node; Parameter_Profile : Node; Rp_Token : Node; Aspect_Specifications : Node; Is_Token : Node; Body_Declarative_Items : Node; Begin_Token : Node; Body_Statements : Node; Exception_Token : Node; Exception_Handlers : Node; End_Token : Node; End_Name : Node; Semicolon_Token : Node) return Node; function Procedure_Call_Statement (Self : Node_Factory'Class; Function_Call : Node; Semicolon_Token : Node) return Node; function Procedure_Declaration (Self : Node_Factory'Class; Not_Token : Node; Overriding_Token : Node; Procedure_Token : Node; Names : Node; Lp_Token : Node; Parameter_Profile : Node; Rp_Token : Node; Is_Token : Node; Abstract_Token : Node; Renames_Token : Node; Renamed_Entity : Node; Separate_Token : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Procedure_Instantiation (Self : Node_Factory'Class; Not_Token : Node; Overriding_Token : Node; Procedure_Token : Node; Names : Node; Is_Token : Node; New_Token : Node; Generic_Unit_Name : Node; Left_Parenthesis_Token : Node; Generic_Actual_Part : Node; Right_Parenthesis_Token : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Protected_Body (Self : Node_Factory'Class; Protected_Token : Node; Body_Token : Node; Names : Node; Aspect_Specifications : Node; Is_Token : Node; Protected_Operation_Items : Node; End_Token : Node; Identifier_Token : Node; Semicolon_Token : Node) return Node; function Protected_Body_Stub (Self : Node_Factory'Class; Protected_Token : Node; Body_Token : Node; Names : Node; Is_Token : Node; Separate_Token : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Protected_Definition (Self : Node_Factory'Class; Visible_Protected_Items : Node; Private_Token : Node; Private_Protected_Items : Node; End_Token : Node; Identifier_Token : Node) return Node; function Protected_Type_Declaration (Self : Node_Factory'Class; Protected_Token : Node; Type_Token : Node; Names : Node; Discriminant_Part : Node; Aspect_Specifications : Node; Is_Token : Node; New_Token : Node; Progenitor_List : Node; With_Token : Node; Type_Declaration_View : Node; Semicolon_Token : Node) return Node; function Qualified_Expression (Self : Node_Factory'Class; Converted_Or_Qualified_Subtype_Mark : Node; Apostrophe_Token : Node; Left_Parenthesis_Token : Node; Converted_Or_Qualified_Expression : Node; Right_Parenthesis_Token : Node) return Node; function Quantified_Expression (Self : Node_Factory'Class; For_Token : Node; Quantifier_Token : Node; Iterator_Specification : Node; Arrow_Token : Node; Predicate : Node) return Node; function Raise_Statement (Self : Node_Factory'Class; Raise_Token : Node; Raised_Exception : Node; With_Token : Node; Raise_Statement_Message : Node; Semicolon_Token : Node) return Node; function Range_Attribute_Reference (Self : Node_Factory'Class; Range_Attribute : Node) return Node; function Range_Attribute_Reference_Dr (Self : Node_Factory'Class; Range_Attribute : Node) return Node; -- function Record_Aggregate -- (Self : Node_Factory'Class; Associations : Node) return Node; function Real_Range_Specification (Self : Node_Factory'Class; Range_Token : Node; Lower_Bound : Node; Double_Dot_Token : Node; Upper_Bound : Node) return Node; function Record_Definition (Self : Node_Factory'Class; Record_Token : Node; Record_Components : Node; End_Token : Node; End_Record_Token : Node) return Node; function Record_Representation_Clause (Self : Node_Factory'Class; For_Token : Node; Representation_Clause_Name : Node; Use_Token : Node; Record_Token : Node; At_Token : Node; Mod_Token : Node; Mod_Clause_Expression : Node; Mod_Semicolon : Node; Component_Clauses : Node; End_Token : Node; End_Record : Node; Semicolon_Token : Node) return Node; function Record_Type_Definition (Self : Node_Factory'Class; Abstract_Token : Node; Tagged_Token : Node; Limited_Token : Node; Record_Definition : Node) return Node; function Requeue_Statement (Self : Node_Factory'Class; Requeue_Token : Node; Requeue_Entry_Name : Node; With_Token : Node; Abort_Token : Node; Semicolon_Token : Node) return Node; function Return_Object_Specification (Self : Node_Factory'Class; Names : Node; Colon_Token : Node; Aliased_Token : Node; Constant_Token : Node; Object_Declaration_Subtype : Node; Assignment_Token : Node; Initialization_Expression : Node) return Node; -- function Root_Type_Definition -- (Self : Node_Factory'Class; Dummy_Token : Node) return Node; -- function Scalar_Subtype_Indication -- (Self : Node_Factory'Class; -- Subtype_Mark : Node; -- Scalar_Constraint : Node) -- return Node; function Select_Or_Path (Self : Node_Factory'Class; Or_Token : Node; When_Token : Node; Guard : Node; Arrow_Token : Node; Sequence_Of_Statements : Node) return Node; function Selected_Component (Self : Node_Factory'Class; Prefix : Node; Dot_Token : Node; Selector : Node) return Node; function Selected_Identifier (Self : Node_Factory'Class; Prefix : Node; Dot_Token : Node; Selector : Node) return Node; function Selective_Accept (Self : Node_Factory'Class; Select_Token : Node; Selective_Statement_Paths : Node; End_Token : Node; End_Select : Node; Semicolon_Token : Node) return Node; function Short_Circuit (Self : Node_Factory'Class; Short_Circuit_Operation_Left_Expression : Node; And_Token : Node; Then_Token : Node; Short_Circuit_Operation_Right_Expression : Node) return Node; function Signed_Integer_Type_Definition (Self : Node_Factory'Class; Range_Token : Node; Lower_Bound : Node; Double_Dot_Token : Node; Upper_Bound : Node) return Node; function Simple_Expression_Range (Self : Node_Factory'Class; Lower_Bound : Node; Double_Dot_Token : Node; Upper_Bound : Node) return Node; function Simple_Expression_Range_Dr (Self : Node_Factory'Class; Lower_Bound : Node; Double_Dot_Token : Node; Upper_Bound : Node) return Node; function Simple_Return_Statement (Self : Node_Factory'Class; Return_Token : Node; Return_Expression : Node; Semicolon_Token : Node) return Node; function Single_Protected_Declaration (Self : Node_Factory'Class; Protected_Token : Node; Names : Node; Aspect_Specifications : Node; Is_Token : Node; New_Token : Node; Progenitor_List : Node; With_Token : Node; Object_Declaration_Subtype : Node; Semicolon_Token : Node) return Node; function Single_Task_Declaration (Self : Node_Factory'Class; Task_Token : Node; Names : Node; Aspect_Specifications : Node; Is_Token : Node; New_Token : Node; Progenitor_List : Node; With_Token : Node; Object_Declaration_Subtype : Node; Semicolon_Token : Node) return Node; -- function String_Literal -- (Self : Node_Factory'Class; -- String_Literal_Token : Node) return Node; function Subtype_Declaration (Self : Node_Factory'Class; Subtype_Token : Node; Names : Node; Is_Token : Node; Type_Declaration_View : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Subunit (Self : Node_Factory'Class; Context_Clause_Elements : Node; Separate_Token : Node; Left_Parenthesis_Token : Node; Parent_Unit_Name : Node; Right_Parenthesis_Token : Node; Unit_Declaration : Node) return Node; function Task_Body (Self : Node_Factory'Class; Task_Token : Node; Body_Token : Node; Names : Node; Aspect_Specifications : Node; Is_Token : Node; Body_Declarative_Items : Node; Begin_Token : Node; Body_Statements : Node; Exception_Token : Node; Exception_Handlers : Node; End_Token : Node; Identifier_Token : Node; Semicolon_Token : Node) return Node; function Task_Body_Stub (Self : Node_Factory'Class; Task_Token : Node; Body_Token : Node; Names : Node; Is_Token : Node; Separate_Token : Node; Aspect_Specifications : Node; Semicolon_Token : Node) return Node; function Task_Definition (Self : Node_Factory'Class; Visible_Task_Items : Node; Private_Token : Node; Private_Task_Items : Node; End_Token : Node; Identifier_Token : Node) return Node; function Task_Type_Declaration (Self : Node_Factory'Class; Task_Token : Node; Type_Token : Node; Names : Node; Discriminant_Part : Node; Aspect_Specifications : Node; Is_Token : Node; New_Token : Node; Progenitor_List : Node; With_Token : Node; Type_Declaration_View : Node; Semicolon_Token : Node) return Node; function Terminate_Alternative_Statement (Self : Node_Factory'Class; Terminate_Token : Node; Semicolon_Token : Node) return Node; function Then_Abort_Path (Self : Node_Factory'Class; Then_Token : Node; Abort_Token : Node; Sequence_Of_Statements : Node) return Node; function Unconstrained_Array_Definition (Self : Node_Factory'Class; Array_Token : Node; Left_Token : Node; Index_Subtype_Definitions : Node; Right_Token : Node; Of_Token : Node; Array_Component_Definition : Node) return Node; function Unknown_Discriminant_Part (Self : Node_Factory'Class; Left_Token : Node; Box_Token : Node; Right_Token : Node) return Node; function Use_Package_Clause (Self : Node_Factory'Class; Use_Token : Node; Clause_Names : Node; Semicolon_Token : Node) return Node; function Use_Type_Clause (Self : Node_Factory'Class; Use_Token : Node; All_Token : Node; Type_Token : Node; Type_Clause_Names : Node; Semicolon_Token : Node) return Node; function Variant (Self : Node_Factory'Class; When_Token : Node; Variant_Choices : Node; Arrow_Token : Node; Record_Components : Node) return Node; function Variant_Part (Self : Node_Factory'Class; Case_Token : Node; Discriminant_Direct_Name : Node; Is_Token : Node; Variants : Node; End_Token : Node; End_Case_Token : Node; Semicolon_Token : Node) return Node; function While_Loop_Statement (Self : Node_Factory'Class; Statement_Identifier : Node; Colon_Token : Node; While_Token : Node; While_Condition : Node; Loop_Token : Node; Loop_Statements : Node; End_Token : Node; End_Loop : Node; Identifier_Token : Node; Semicolon_Token : Node) return Node; function With_Clause (Self : Node_Factory'Class; Limited_Token : Node; Private_Token : Node; With_Token : Node; With_Clause_Names : Node; Semicolon_Token : Node) return Node; --------------------- -- Node sequences -- --------------------- function Aspect_Specification_Sequence (Self : Node_Factory'Class) return Node; function Association_Sequence (Self : Node_Factory'Class) return Node; function Basic_Declarative_Item_Sequence (Self : Node_Factory'Class) return Node; function Case_Expression_Path_Sequence (Self : Node_Factory'Class) return Node; function Case_Path_Sequence (Self : Node_Factory'Class) return Node; function Clause_Or_Pragma_Sequence (Self : Node_Factory'Class) return Node; function Compilation_Unit_Sequence (Self : Node_Factory'Class) return Node; function Component_Item_Sequence (Self : Node_Factory'Class) return Node; function Context_Item_Sequence (Self : Node_Factory'Class) return Node; function Declarative_Item_Sequence (Self : Node_Factory'Class) return Node; function Defining_Identifier_Sequence (Self : Node_Factory'Class) return Node; function Discrete_Choice_Sequence (Self : Node_Factory'Class) return Node; function Discrete_Subtype_Definition_Sequence (Self : Node_Factory'Class) return Node; function Discriminant_Specification_Sequence (Self : Node_Factory'Class) return Node; function Enumeration_Literal_Specification_Sequence (Self : Node_Factory'Class) return Node; function Exception_Choice_Sequence (Self : Node_Factory'Class) return Node; function Exception_Handler_Sequence (Self : Node_Factory'Class) return Node; function Generic_Association_Sequence (Self : Node_Factory'Class) return Node; function Generic_Formal_Sequence (Self : Node_Factory'Class) return Node; function If_Else_Expression_Path_Sequence (Self : Node_Factory'Class) return Node; function If_Elsif_Else_Path_Sequence (Self : Node_Factory'Class) return Node; function Membership_Choice_Sequence (Self : Node_Factory'Class) return Node; function Name_Sequence (Self : Node_Factory'Class) return Node; function Parameter_Specification_Sequence (Self : Node_Factory'Class) return Node; function Pragma_Argument_Association_Sequence (Self : Node_Factory'Class) return Node; function Program_Unit_Name_Sequence (Self : Node_Factory'Class) return Node; function Protected_Element_Declaration_Sequence (Self : Node_Factory'Class) return Node; function Protected_Operation_Declaration_Sequence (Self : Node_Factory'Class) return Node; function Protected_Operation_Item_Sequence (Self : Node_Factory'Class) return Node; function Select_Or_Else_Path_Sequence (Self : Node_Factory'Class) return Node; function Select_Then_Abort_Path_Sequence (Self : Node_Factory'Class) return Node; function Statement_Sequence (Self : Node_Factory'Class) return Node; function Subtype_Mark_Sequence (Self : Node_Factory'Class) return Node; function Task_Item_Sequence (Self : Node_Factory'Class) return Node; function Variant_Sequence (Self : Node_Factory'Class) return Node; ------------ -- Append -- ------------ procedure Append_Aspect_Specification (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Association (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Basic_Declarative_Item (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Case_Expression_Path (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Case_Path (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Clause_Or_Pragma (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Compilation_Unit (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Component_Item (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Context_Item (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Declarative_Item (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Defining_Identifier (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Discrete_Choice (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Discrete_Subtype_Definition (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Discriminant_Specification (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Enumeration_Literal_Specification (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Exception_Choice (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Exception_Handler (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Generic_Association (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Generic_Formal (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_If_Else_Expression_Path (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_If_Elsif_Else_Path (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Membership_Choice (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Name (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Parameter_Specification (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Pragma_Argument_Association (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Program_Unit_Name (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Protected_Element_Declaration (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Protected_Operation_Declaration (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Protected_Operation_Item (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Select_Or_Else_Path (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Select_Then_Abort_Path (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Statement (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Subtype_Mark (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Append_Variant (Self : Node_Factory'Class; List : in out Node; Item : Node); ------------- -- Prepend -- ------------- procedure Prepend_Aspect_Specification (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Case_Expression_Path (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Case_Path (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Compilation_Unit (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Component_Item (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Declarative_Item (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Defining_Identifier (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Discrete_Choice (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Discrete_Subtype_Definition (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Discriminant_Specification (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Enumeration_Literal_Specification (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Exception_Choice (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Generic_Association (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_If_Else_Expression_Path (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_If_Elsif_Else_Path (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Membership_Choice (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Name (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Parameter_Specification (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Pragma_Argument_Association (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Statement (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Subtype_Mark (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Association (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Select_Or_Else_Path (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Exception_Handler (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Task_Item (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Program_Unit_Name (Self : Node_Factory'Class; List : in out Node; Item : Node); procedure Prepend_Variant (Self : Node_Factory'Class; List : in out Node; Item : Node); ------------------- -- Special cases -- ------------------- function To_Defining_Program_Unit_Name (Self : Node_Factory'Class; Selected_Identifier : Node) return Node; -- Convert selected_identifier to defining_program_unit_name function Infix_Call (Self : Node_Factory'Class; Prefix, Left, Right : Node) return Node; function To_Aggregate_Or_Expression (Self : Node_Factory'Class; Association_List : Node) return Node; -- If Value is (X) return Parenthesized_Expression else -- return Record_Aggregate function To_Subtype_Indication (Self : Node_Factory'Class; Not_Token : Node; Null_Token : Node; Mark : Node; Constraint : Node) return Node; private type Node_Kind is (Token_Node, Element_Node, Element_Sequence_Node, Unit_Node, Unit_Sequence_Node, Compilation_Node); type Node (Kind : Node_Kind := Node_Kind'First) is record case Kind is when Token_Node => Token : Program.Lexical_Elements.Lexical_Element_Access; when Element_Node => Element : Program.Elements.Element_Access; when Element_Sequence_Node => Vector : aliased Element_Vectors.Vector; when Unit_Node => Unit : Program.Compilation_Units.Compilation_Unit_Access; when Unit_Sequence_Node => Units : aliased Unit_Vectors.Vector; when Compilation_Node => Root_Units : Unit_Vectors.Vector; Pragmas : Element_Vectors.Vector; end case; end record; type Node_Factory (Comp : not null Program.Compilations.Compilation_Access; Subpool : not null System.Storage_Pools.Subpools.Subpool_Handle) is tagged limited record EF : Program.Element_Factories.Element_Factory (Subpool); end record; None : constant Node := (Element_Node, null); No_Token : constant Node := (Token_Node, null); end Program.Parsers.Nodes;
reznikmm/matreshka
Ada
4,049
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Text_Numbered_Entries_Attributes; package Matreshka.ODF_Text.Numbered_Entries_Attributes is type Text_Numbered_Entries_Attribute_Node is new Matreshka.ODF_Text.Abstract_Text_Attribute_Node and ODF.DOM.Text_Numbered_Entries_Attributes.ODF_Text_Numbered_Entries_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Text_Numbered_Entries_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Text_Numbered_Entries_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Text.Numbered_Entries_Attributes;
jorge-real/TTS-Ravenscar
Ada
7,074
adb
------------------------------------------------------------ -- -- ADA REAL-TIME TIME-TRIGGERED SCHEDULING SUPPORT -- -- @file time_triggered_scheduling.adb -- -- @package Time_Triggered_Scheduling (BODY) -- -- @brief -- Ada Real-Time Time Triggered Scheduling support : Time Triggered Scheduling -- -- Ravenscar version -- ------------------------------------------------------------ with Ada.Task_Identification; use Ada.Task_Identification; with Ada.Synchronous_Task_Control; use Ada.Synchronous_Task_Control; package body Time_Triggered_Scheduling is -- Run time TT work info type Work_Control_Block is record Release_Point : Suspension_Object; Is_Running : Boolean := False; Work_Task_Id : Task_Id := Null_Task_Id; Last_Release : Time := Time_Last; end record; -- Array of Work_Control_Blocks WCB : array (Regular_Work_Id) of Work_Control_Block; -------------------------- -- Wait_For_Activation -- -------------------------- procedure Wait_For_Activation (Work_Id : Regular_Work_Id; When_Was_Released : out Time) is begin -- Register the Work_Id with the first task using it. -- Use of the Work_Id by another task breaks the model and causes PE if WCB (Work_Id).Work_Task_Id = Null_Task_Id then -- First time WFA called with this Work_Id -> Register caller WCB (Work_Id).Work_Task_Id := Current_Task; elsif WCB (Work_Id).Work_Task_Id /= Current_Task then -- Caller was not registered with this Work_Id raise Program_Error with ("Work_Id misuse"); end if; -- Caller is about to be suspended, hence not running WCB (Work_Id).Is_Running := False; Suspend_Until_True (WCB (Work_Id).Release_Point); -- Scheduler updated Last_Release when it released the worker task When_Was_Released := WCB (Work_Id).Last_Release; -- The worker is now released and starts running WCB (Work_Id).Is_Running := True; end Wait_For_Activation; ------------------------------ -- Time_Triggered_Scheduler -- ------------------------------ protected body Time_Triggered_Scheduler is -------------- -- Set_Plan -- -------------- procedure Set_Plan (TTP : in Time_Triggered_Plan_Access) is Now : constant Time := Clock; begin -- Take note of next plan to execute Next_Plan := TTP; -- Start new plan now if none is set. Otherwise, the scheduler will -- change to the Next_Plan at the end of the next mode change slot if Current_Plan = null then Change_Plan (Now); return; end if; -- Accept Set_Plan requests during a mode change slot (coming -- from ET tasks) and enforce the mode change at the end of it. -- Note that this point is reached only if there is currently -- a plan set, hence Current_Plan is not null if Current_Plan (Current_Slot_Index).Work_Id = Mode_Change_Slot then Change_Plan (Next_Slot_Release); end if; end Set_Plan; ----------------- -- Change_Plan -- ----------------- procedure Change_Plan (At_Time : Time) is begin Current_Plan := Next_Plan; Next_Plan := null; -- Setting both Current_ and Next_Slot_Index to 'First is consistent -- with the new slot TE handler for the first slot of a new plan. Current_Slot_Index := Current_Plan.all'First; Next_Slot_Index := Current_Plan.all'First; Next_Slot_Release := At_Time; NS_Event.Set_Handler (At_Time, NS_Handler_Access); end Change_Plan; ---------------- -- NS_Handler -- ---------------- procedure NS_Handler (Event : in out Timing_Event) is pragma Unreferenced (Event); Current_Work_Id : Any_Work_Id; Now : Time; begin Now := Next_Slot_Release; -- Check for overrun in the finishing slot. -- If this happens to be the first slot after a plan change, then -- an overrun from the last work of the old plan would have been -- detected at the start of the mode change slot. Current_Work_Id := Current_Plan (Current_Slot_Index).Work_Id; if Current_Work_Id in Regular_Work_Id and then WCB (Current_Work_Id).Is_Running then -- Overrun detected, raise PE raise Program_Error with ("Overrun detected in work " & Current_Work_Id'Image); end if; -- Update current slot index Current_Slot_Index := Next_Slot_Index; -- Compute next slot index if Next_Slot_Index < Current_Plan.all'Last then Next_Slot_Index := Next_Slot_Index + 1; else Next_Slot_Index := Current_Plan.all'First; end if; -- Compute next slot start time Next_Slot_Release := Next_Slot_Release + Current_Plan (Current_Slot_Index).Slot_Duration; -- Obtain current work id Current_Work_Id := Current_Plan (Current_Slot_Index).Work_Id; -- Process current slot actions -- Mode change slot case -- if Current_Work_Id = Mode_Change_Slot then if Next_Plan /= null then -- There's a pending plan change. It takes effect at the end of the MC slot Change_Plan (Next_Slot_Release); else -- Set the handler for the next scheduling point NS_Event.Set_Handler (Next_Slot_Release, NS_Handler_Access); end if; -- Empty slot case -- elsif Current_Work_Id = Empty_Slot then -- Set the handler for the next scheduling point NS_Event.Set_Handler (Next_Slot_Release, NS_Handler_Access); -- Regular slot case -- elsif Current_Work_Id in Regular_Work_Id'Range then -- Check whether the work's task has already registered. Raise PE otherwise if WCB (Current_Work_Id).Work_Task_Id = Null_Task_Id then raise Program_Error with ("Task not registered for Work_Id " & Current_Work_Id'Image); end if; -- Support for release time to measure release jitter of TT tasks WCB (Current_Work_Id).Last_Release := Now; -- Release task in charge of current work id Set_True (WCB (Current_Work_Id).Release_Point); -- Set the handler for the next scheduling point NS_Event.Set_Handler (Next_Slot_Release, NS_Handler_Access); else raise Program_Error with "Invalid Work Id"; end if; end NS_Handler; end Time_Triggered_Scheduler; ---------------- -- Set_Plan -- ---------------- procedure Set_Plan (TTP : in Time_Triggered_Plan_Access) is begin Time_Triggered_Scheduler.Set_Plan (TTP); end Set_Plan; end Time_Triggered_Scheduling;
skill-lang/adaCommon
Ada
1,541
ads
-- ___ _ ___ _ _ -- -- / __| |/ (_) | | Common SKilL implementation -- -- \__ \ ' <| | | |__ hashes used in skill -- -- |___/_|\_\_|_|____| by: Timm Felden -- -- -- pragma Ada_2012; with Ada.Containers; with Ada.Strings.Hash; with Skill.Types; with Skill.Types.Pools; with Ada.Unchecked_Conversion; with Interfaces; -- the trick of this package is to instantiate hash codes as Skill.hashes.hash -- independent of the type! :) package Skill.Hashes is -- pragma Preelaborate; pragma Warnings(Off); function Hash (Element : Skill.Types.String_Access) return Ada.Containers.Hash_Type is (Ada.Strings.Hash (Element.all)); function Hash (Element : Skill.Types.Pools.Pool) return Ada.Containers.Hash_Type is (Ada.Containers.Hash_Type(Element.Id)); function Hash (Element : Interfaces.Integer_8) return Ada.Containers.Hash_Type is (Ada.Containers.Hash_Type(Element)); function Hash (Element : Interfaces.Integer_16) return Ada.Containers.Hash_Type is (Ada.Containers.Hash_Type(Element)); function Hash (Element : Interfaces.Integer_32) return Ada.Containers.Hash_Type is (Ada.Containers.Hash_Type(Element)); function Hash is new Ada.Unchecked_Conversion(Interfaces.Integer_64, Ada.Containers.Hash_Type); end Skill.Hashes;
damaki/libkeccak
Ada
1,853
ads
------------------------------------------------------------------------------- -- Copyright (c) 2016, Daniel King -- 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. -- * The name of the copyright holder may not 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 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 AUnit.Test_Suites; use AUnit.Test_Suites; package Sponge_Suite is function Suite return Access_Test_Suite; end Sponge_Suite;
charlie5/lace
Ada
1,844
ads
with freeType_c.FT_GlyphSlot, openGL.GlyphImpl; package openGL.Glyph -- -- Glyph is the base class for openGL glyphs. -- -- It provides the interface between Freetype glyphs and their openGL -- renderable counterparts. -- -- This is an abstract class and derived classes must implement the 'Render' function. -- is type Item is abstract tagged private; --------- -- Forge -- procedure destruct (Self : in out Item); -------------- -- Attributes -- function Advance (Self : in Item) return Real; -- Return the advance width for this glyph. function BBox (Self : in Item) return Bounds; -- Return the bounding box for this glyph. function Error (Self : in Item) return GlyphImpl.Error_Kind; -- Return the current error code. -------------- --- Operations -- function render (Self : in Item; Pen : in Vector_3; renderMode : in Integer) return Vector_3 is abstract; -- -- Renders this glyph at the current pen position. -- -- Pen: The current pen position. -- renderMode: Render mode to display. --- -- Returns the advance distance for this glyph. private type Item is abstract tagged record Impl : GlyphImpl.view; -- Internal FTGL FTGlyph implementation object. For private use only. end record; procedure define (Self : in out Item; glyth_Slot : in freetype_c.FT_GlyphSlot.item); -- -- glyth_Slot: The Freetype glyph to be processed. procedure define (Self : in out Item; pImpl : in GlyphImpl.view); -- -- Internal FTGL FTGlyph constructor. For private use only. -- -- pImpl: An internal implementation object. Will be destroyed upon FTGlyph deletion. end openGL.Glyph;
zhmu/ananas
Ada
6,983
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . E X C E P T I O N S . L A S T _ C H A N C E _ H A N D L E R -- -- -- -- B o d y -- -- -- -- Copyright (C) 2003-2022, 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. -- -- -- ------------------------------------------------------------------------------ -- Default version for most targets with System.Standard_Library; use System.Standard_Library; with System.Soft_Links; use System; procedure Ada.Exceptions.Last_Chance_Handler (Except : Exception_Occurrence) is procedure Unhandled_Terminate; pragma No_Return (Unhandled_Terminate); pragma Import (C, Unhandled_Terminate, "__gnat_unhandled_terminate"); -- Perform system dependent shutdown code function Exception_Message_Length (X : Exception_Occurrence) return Natural; pragma Import (Ada, Exception_Message_Length, "__gnat_exception_msg_len"); procedure Append_Info_Exception_Message (X : Exception_Occurrence; Info : in out String; Ptr : in out Natural); pragma Import (Ada, Append_Info_Exception_Message, "__gnat_append_info_e_msg"); procedure Append_Info_Untailored_Exception_Information (X : Exception_Occurrence; Info : in out String; Ptr : in out Natural); pragma Import (Ada, Append_Info_Untailored_Exception_Information, "__gnat_append_info_u_e_info"); procedure To_Stderr (S : String); pragma Import (Ada, To_Stderr, "__gnat_to_stderr"); -- Little routine to output string to stderr Gnat_Argv : System.Address; pragma Import (C, Gnat_Argv, "gnat_argv"); procedure Fill_Arg (A : System.Address; Arg_Num : Integer); pragma Import (C, Fill_Arg, "__gnat_fill_arg"); function Len_Arg (Arg_Num : Integer) return Integer; pragma Import (C, Len_Arg, "__gnat_len_arg"); Ptr : Natural := 0; Nobuf : String (1 .. 0); Nline : constant String := String'(1 => ASCII.LF); -- Convenient shortcut begin -- Do not execute any task termination code when shutting down the system. -- The Adafinal procedure would execute the task termination routine for -- normal termination, but we have already executed the task termination -- procedure because of an unhandled exception. System.Soft_Links.Task_Termination_Handler := System.Soft_Links.Task_Termination_NT'Access; -- We shutdown the runtime now. The rest of the procedure needs to be -- careful not to use anything that would require runtime support. In -- particular, functions returning strings are banned since the sec stack -- is no longer functional. This is particularly important to note for the -- Exception_Information output. We used to allow the tailored version to -- show up here, which turned out to be a bad idea as it might involve a -- traceback decorator the length of which we don't control. Potentially -- heavy primary/secondary stack use or dynamic allocations right before -- this point are not welcome, moving the output before the finalization -- raises order of outputs concerns, and decorators are intended to only -- be used with exception traces, which should have been issued already. System.Standard_Library.Adafinal; -- Print a message only when exception traces are not active if Exception_Trace /= RM_Convention then null; -- Check for special case of raising _ABORT_SIGNAL, which is not -- really an exception at all. We recognize this by the fact that -- it is the only exception whose name starts with underscore. elsif To_Ptr (Except.Id.Full_Name) (1) = '_' then To_Stderr (Nline); To_Stderr ("Execution terminated by abort of environment task"); To_Stderr (Nline); -- If no tracebacks, we print the unhandled exception in the old style -- (i.e. the style used before ZCX was implemented). We do this to -- retain compatibility. elsif Except.Num_Tracebacks = 0 then To_Stderr (Nline); To_Stderr ("raised "); To_Stderr (To_Ptr (Except.Id.Full_Name) (1 .. Except.Id.Name_Length - 1)); if Exception_Message_Length (Except) /= 0 then To_Stderr (" : "); Append_Info_Exception_Message (Except, Nobuf, Ptr); end if; To_Stderr (Nline); -- Traceback exists else To_Stderr (Nline); if Gnat_Argv = System.Null_Address then To_Stderr ("Execution terminated by unhandled exception"); else declare Arg : aliased String (1 .. Len_Arg (0)); begin Fill_Arg (Arg'Address, 0); To_Stderr ("Execution of "); To_Stderr (Arg); To_Stderr (" terminated by unhandled exception"); end; end if; To_Stderr (Nline); Append_Info_Untailored_Exception_Information (Except, Nobuf, Ptr); end if; Unhandled_Terminate; end Ada.Exceptions.Last_Chance_Handler;
stcarrez/ada-wiki
Ada
8,395
adb
----------------------------------------------------------------------- -- wiki-filters-collectors -- Wiki word and link collectors -- Copyright (C) 2016, 2020, 2022 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body Wiki.Filters.Collectors is procedure Add_String (Into : in out WString_Maps.Map; Item : in Wiki.Strings.WString); procedure Add_String (Into : in out WString_Maps.Map; Item : in Wiki.Strings.WString) is procedure Increment (Key : in Wiki.Strings.WString; Value : in out Natural); procedure Increment (Key : in Wiki.Strings.WString; Value : in out Natural) is pragma Unreferenced (Key); begin Value := Value + 1; end Increment; Pos : constant WString_Maps.Cursor := Into.Find (Item); begin if WString_Maps.Has_Element (Pos) then Into.Update_Element (Pos, Increment'Access); else Into.Insert (Item, 1); end if; end Add_String; function Find (Map : in Collector_Type; Item : in Wiki.Strings.WString) return Cursor is begin return Map.Items.Find (Item); end Find; function Contains (Map : in Collector_Type; Item : in Wiki.Strings.WString) return Boolean is begin return Map.Items.Contains (Item); end Contains; procedure Iterate (Map : in Collector_Type; Process : not null access procedure (Pos : in Cursor)) is begin Map.Items.Iterate (Process); end Iterate; procedure Collect_Attribute (Filter : in out Collector_Type; Attributes : in Wiki.Attributes.Attribute_List; Name : in String) is Value : constant Wiki.Strings.WString := Wiki.Attributes.Get_Attribute (Attributes, Name); begin if Value'Length > 0 then Add_String (Filter.Items, Value); end if; end Collect_Attribute; -- ------------------------------ -- Word Collector type -- ------------------------------ procedure Collect_Words (Filter : in out Word_Collector_Type; Content : in Wiki.Strings.WString) is Pos : Natural := Content'First; Start : Natural := Content'First; C : Wiki.Strings.WChar; begin while Pos <= Content'Last loop C := Content (Pos); if Wiki.Strings.Is_Alphanumeric (C) then null; else if Start + 1 < Pos - 1 then Add_String (Filter.Items, Content (Start .. Pos - 1)); end if; Start := Pos + 1; end if; Pos := Pos + 1; end loop; if Start < Content'Last then Add_String (Filter.Items, Content (Start .. Content'Last)); end if; end Collect_Words; -- ------------------------------ -- Add a text content with the given format to the document. -- ------------------------------ overriding procedure Add_Text (Filter : in out Word_Collector_Type; Document : in out Wiki.Documents.Document; Text : in Wiki.Strings.WString; Format : in Wiki.Format_Map) is begin Filter.Collect_Words (Text); Filter_Type (Filter).Add_Text (Document, Text, Format); end Add_Text; -- ------------------------------ -- Add a link. -- ------------------------------ overriding procedure Add_Link (Filter : in out Word_Collector_Type; Document : in out Wiki.Documents.Document; Name : in Wiki.Strings.WString; Attributes : in out Wiki.Attributes.Attribute_List) is begin Filter_Type (Filter).Add_Link (Document, Name, Attributes); end Add_Link; -- ------------------------------ -- Add an image. -- ------------------------------ overriding procedure Add_Image (Filter : in out Word_Collector_Type; Document : in out Wiki.Documents.Document; Name : in Wiki.Strings.WString; Attributes : in out Wiki.Attributes.Attribute_List) is begin Filter_Type (Filter).Add_Image (Document, Name, Attributes); end Add_Image; -- ------------------------------ -- Add a quote. -- ------------------------------ overriding procedure Add_Quote (Filter : in out Word_Collector_Type; Document : in out Wiki.Documents.Document; Name : in Wiki.Strings.WString; Attributes : in out Wiki.Attributes.Attribute_List) is begin Filter_Type (Filter).Add_Quote (Document, Name, Attributes); end Add_Quote; -- ------------------------------ -- Add a text block that is pre-formatted. -- ------------------------------ overriding procedure Add_Preformatted (Filter : in out Word_Collector_Type; Document : in out Wiki.Documents.Document; Text : in Wiki.Strings.WString; Format : in Wiki.Strings.WString) is begin Filter.Collect_Words (Text); Filter_Type (Filter).Add_Preformatted (Document, Text, Format); end Add_Preformatted; -- ------------------------------ -- Add a link. -- ------------------------------ overriding procedure Add_Link (Filter : in out Link_Collector_Type; Document : in out Wiki.Documents.Document; Name : in Wiki.Strings.WString; Attributes : in out Wiki.Attributes.Attribute_List) is begin Collect_Attribute (Filter, Attributes, "href"); Filter_Type (Filter).Add_Link (Document, Name, Attributes); end Add_Link; -- ------------------------------ -- Push a HTML node with the given tag to the document. -- ------------------------------ overriding procedure Push_Node (Filter : in out Link_Collector_Type; Document : in out Wiki.Documents.Document; Tag : in Wiki.Html_Tag; Attributes : in out Wiki.Attributes.Attribute_List) is begin if Tag = A_TAG then Collect_Attribute (Filter, Attributes, "href"); end if; Filter_Type (Filter).Push_Node (Document, Tag, Attributes); end Push_Node; -- ------------------------------ -- Add an image. -- ------------------------------ overriding procedure Add_Image (Filter : in out Image_Collector_Type; Document : in out Wiki.Documents.Document; Name : in Wiki.Strings.WString; Attributes : in out Wiki.Attributes.Attribute_List) is begin Collect_Attribute (Filter, Attributes, "src"); Filter_Type (Filter).Add_Image (Document, Name, Attributes); end Add_Image; -- ------------------------------ -- Push a HTML node with the given tag to the document. -- ------------------------------ overriding procedure Push_Node (Filter : in out Image_Collector_Type; Document : in out Wiki.Documents.Document; Tag : in Wiki.Html_Tag; Attributes : in out Wiki.Attributes.Attribute_List) is begin if Tag = IMG_TAG then Collect_Attribute (Filter, Attributes, "src"); end if; Filter_Type (Filter).Push_Node (Document, Tag, Attributes); end Push_Node; end Wiki.Filters.Collectors;
Letractively/ada-ado
Ada
8,692
ads
----------------------------------------------------------------------- -- ADO SQL -- Basic SQL Generation -- Copyright (C) 2010, 2011, 2012 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Ada.Calendar; with Util.Strings; with ADO.Parameters; with ADO.Drivers.Dialects; -- Utilities for creating SQL queries and statements. package ADO.SQL is use Ada.Strings.Unbounded; function Escape (Str : in Unbounded_String) return String; function Escape (Str : in String) return String; -- -------------------- -- Buffer -- -------------------- -- The <b>Buffer</b> type allows to build easily an SQL statement. -- type Buffer is private; type Buffer_Access is access all Buffer; -- Clear the SQL buffer. procedure Clear (Target : in out Buffer); -- Append an SQL extract into the buffer. procedure Append (Target : in out Buffer; SQL : in String); -- Append a name in the buffer and escape that -- name if this is a reserved keyword. procedure Append_Name (Target : in out Buffer; Name : in String); -- Append a string value in the buffer and -- escape any special character if necessary. procedure Append_Value (Target : in out Buffer; Value : in String); -- Append a string value in the buffer and -- escape any special character if necessary. procedure Append_Value (Target : in out Buffer; Value : in Unbounded_String); -- Append the integer value in the buffer. procedure Append_Value (Target : in out Buffer; Value : in Long_Integer); -- Append the integer value in the buffer. procedure Append_Value (Target : in out Buffer; Value : in Integer); -- Append the identifier value in the buffer. procedure Append_Value (Target : in out Buffer; Value : in Identifier); -- Get the SQL string that was accumulated in the buffer. function To_String (From : in Buffer) return String; -- -------------------- -- Query -- -------------------- -- The <b>Query</b> type contains the elements for building and -- executing the request. This includes: -- <ul> -- <li>The SQL request (full request or a fragment)</li> -- <li>The SQL request parameters </li> -- <li>An SQL filter condition</li> -- </ul> -- type Query is new ADO.Parameters.List with record SQL : Buffer; Filter : Buffer; Join : Buffer; end record; type Query_Access is access all Query'Class; -- Clear the query object. overriding procedure Clear (Target : in out Query); -- Set the SQL dialect description object. procedure Set_Dialect (Target : in out Query; D : in ADO.Drivers.Dialects.Dialect_Access); procedure Set_Filter (Target : in out Query; Filter : in String); function Has_Filter (Source : in Query) return Boolean; function Get_Filter (Source : in Query) return String; -- Set the join condition. procedure Set_Join (Target : in out Query; Join : in String); -- Returns true if there is a join condition function Has_Join (Source : in Query) return Boolean; -- Get the join condition function Get_Join (Source : in Query) return String; -- Set the parameters from another parameter list. -- If the parameter list is a query object, also copy the filter part. procedure Set_Parameters (Params : in out Query; From : in ADO.Parameters.Abstract_List'Class); -- Expand the parameters into the query and return the expanded SQL query. function Expand (Source : in Query) return String; -- -------------------- -- Update Query -- -------------------- -- The <b>Update_Query</b> provides additional helper functions to construct -- and <i>insert</i> or an <i>update</i> statement. type Update_Query is new Query with private; type Update_Query_Access is access all Update_Query'Class; -- Set the SQL dialect description object. procedure Set_Dialect (Target : in out Update_Query; D : in ADO.Drivers.Dialects.Dialect_Access); -- Prepare the update/insert query to save the table field -- identified by <b>Name</b> and set it to the <b>Value</b>. procedure Save_Field (Update : in out Update_Query; Name : in String; Value : in Boolean); -- Prepare the update/insert query to save the table field -- identified by <b>Name</b> and set it to the <b>Value</b>. procedure Save_Field (Update : in out Update_Query; Name : in String; Value : in Integer); -- Prepare the update/insert query to save the table field -- identified by <b>Name</b> and set it to the <b>Value</b>. procedure Save_Field (Update : in out Update_Query; Name : in String; Value : in Long_Long_Integer); -- Prepare the update/insert query to save the table field -- identified by <b>Name</b> and set it to the <b>Value</b>. procedure Save_Field (Update : in out Update_Query; Name : in String; Value : in Identifier); -- Prepare the update/insert query to save the table field -- identified by <b>Name</b> and set it to the <b>Value</b>. procedure Save_Field (Update : in out Update_Query; Name : in String; Value : in Entity_Type); -- Prepare the update/insert query to save the table field -- identified by <b>Name</b> and set it to the <b>Value</b>. procedure Save_Field (Update : in out Update_Query; Name : in String; Value : in Ada.Calendar.Time); -- Prepare the update/insert query to save the table field -- identified by <b>Name</b> and set it to the <b>Value</b>. procedure Save_Field (Update : in out Update_Query; Name : in String; Value : in String); -- Prepare the update/insert query to save the table field -- identified by <b>Name</b> and set it to the <b>Value</b>. procedure Save_Field (Update : in out Update_Query; Name : in String; Value : in Unbounded_String); -- Prepare the update/insert query to save the table field -- identified by <b>Name</b> and set it to the <b>Value</b>. procedure Save_Field (Update : in out Update_Query; Name : in String; Value : in ADO.Blob_Ref); -- Prepare the update/insert query to save the table field -- identified by <b>Name</b> and set it to NULL. procedure Save_Null_Field (Update : in out Update_Query; Name : in String); -- Check if the update/insert query has some fields to update. function Has_Save_Fields (Update : in Update_Query) return Boolean; procedure Set_Insert_Mode (Update : in out Update_Query); procedure Append_Fields (Update : in out Update_Query; Mode : in Boolean := False); private type Buffer is new ADO.Parameters.List with record Buf : Unbounded_String; -- Dialect : ADO.Drivers.Dialects.Dialect_Access; end record; type Update_Query is new Query with record Pos : Natural := 0; Set_Fields : Buffer; Fields : Buffer; Is_Update_Stmt : Boolean := True; end record; type Dialect is tagged record Keywords : Util.Strings.String_Set.Set; end record; procedure Add_Field (Update : in out Update_Query'Class; Name : in String); end ADO.SQL;
zhmu/ananas
Ada
3,227
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 3 5 -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Handling of packed arrays with Component_Size = 35 package System.Pack_35 is pragma Preelaborate; Bits : constant := 35; type Bits_35 is mod 2 ** Bits; for Bits_35'Size use Bits; -- In all subprograms below, Rev_SSO is set True if the array has the -- non-default scalar storage order. function Get_35 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_35 with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is extracted and returned. procedure Set_35 (Arr : System.Address; N : Natural; E : Bits_35; Rev_SSO : Boolean) with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is set to the given value. end System.Pack_35;
AdaCore/libadalang
Ada
109
ads
generic type T is private; package B.C is function Foo return T; function Bar return Lol; end B.C;
AdaCore/langkit
Ada
4,848
ads
-- -- Copyright (C) 2014-2022, AdaCore -- SPDX-License-Identifier: Apache-2.0 -- with Ada.Strings; use Ada.Strings; with Ada.Strings.Fixed; with Langkit_Support.Text; use Langkit_Support.Text; -- This package provides types and associated operation to handle source -- locations. package Langkit_Support.Slocs is type Line_Number is mod 2 ** 32; type Column_Number is mod 2 ** 16; type Relative_Position is (Before, Inside, After); -- Where some source location is with respect to another/a source location -- range. type Source_Location is record Line : Line_Number; -- Line for this source location Column : Column_Number; -- Column for this source location end record; -- Type representing a location in the source type Source_Location_Range is record Start_Line, End_Line : Line_Number; -- Start and end lines for this source location Start_Column, End_Column : Column_Number; -- Start and end columns for this source location end record; -- Type representing a range in the source No_Source_Location : constant Source_Location := (0, 0); No_Source_Location_Range : constant Source_Location_Range := (0, 0, 0, 0); -------------------------- -- Constructors/getters -- -------------------------- function Start_Sloc (Sloc_Range : Source_Location_Range) return Source_Location is ((Line => Sloc_Range.Start_Line, Column => Sloc_Range.Start_Column)); function End_Sloc (Sloc_Range : Source_Location_Range) return Source_Location is ((Line => Sloc_Range.End_Line, Column => Sloc_Range.End_Column)); function Make_Range (Start_Sloc, End_Sloc : Source_Location) return Source_Location_Range is ((Start_Line => Start_Sloc.Line, End_Line => End_Sloc.Line, Start_Column => Start_Sloc.Column, End_Column => End_Sloc.Column)); -------------------------- -- Location comparisons -- -------------------------- function Compare (Reference, Compared : Source_Location) return Relative_Position with Pre => (Reference /= No_Source_Location and then Compared /= No_Source_Location); -- Tell where Compared is with respect to Reference (before, inside = same -- sloc, after). function "<" (L, R : Source_Location) return Boolean is (Compare (L, R) = After); function "<=" (L, R : Source_Location) return Boolean is (Compare (L, R) in After | Inside); function ">" (L, R : Source_Location) return Boolean is (Compare (L, R) = Before); function ">=" (L, R : Source_Location) return Boolean is (Compare (L, R) in Before | Inside); function Compare (Sloc_Range : Source_Location_Range; Sloc : Source_Location) return Relative_Position with Pre => (Sloc_Range /= No_Source_Location_Range and then Sloc /= No_Source_Location); -- Tell where Sloc is with respect to Sloc_Range ------------------------ -- String conversions -- ------------------------ -- All functions below assume that the textual representation of -- Source_Location values have the form "L:C" (L being the line number, C -- the column number) and Source_Location_Range have the form -- "L1:C1-L2:C2" (L1 and C1 are numbers for the start sloc, L2 and C2 are -- the numbers for the end sloc). function Image (Sloc : Source_Location) return String is (Ada.Strings.Fixed.Trim (Line_Number'Image (Sloc.Line), Left) & ':' & Ada.Strings.Fixed.Trim (Column_Number'Image (Sloc.Column), Left)); function Image (Sloc_Range : Source_Location_Range) return String is (Image (Start_Sloc (Sloc_Range)) & '-' & Image (End_Sloc (Sloc_Range))); function Image (Sloc : Source_Location) return Text_Type is (To_Text (Image (Sloc))); function Image (Sloc_Range : Source_Location_Range) return Text_Type is (To_Text (Image (Sloc_Range))); function Value (T : Text_Type) return Source_Location; function Value (S : String) return Source_Location is (Value (To_Text (S))); function Value (T : Text_Type) return Source_Location_Range; function Value (S : String) return Source_Location_Range is (Value (To_Text (S))); --------------------------------- -- Sloc computations from text -- --------------------------------- Default_Tab_Stop : constant Positive := 8; -- Value that will be used for the default tab stop if none is passed -- during the initialization of a ``Token_Data_Handler``. function Column_Count (Line : Text_Type; Tab_Stop : Positive := Default_Tab_Stop) return Column_Number; -- Return the number of columns in ``Line``, according to the given -- ``Tab_Stop`` to expand horizontal tabulations. end Langkit_Support.Slocs;
reznikmm/matreshka
Ada
5,196
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Generic_Collections; package AMF.UML.Opaque_Expressions.Collections is pragma Preelaborate; package UML_Opaque_Expression_Collections is new AMF.Generic_Collections (UML_Opaque_Expression, UML_Opaque_Expression_Access); type Set_Of_UML_Opaque_Expression is new UML_Opaque_Expression_Collections.Set with null record; Empty_Set_Of_UML_Opaque_Expression : constant Set_Of_UML_Opaque_Expression; type Ordered_Set_Of_UML_Opaque_Expression is new UML_Opaque_Expression_Collections.Ordered_Set with null record; Empty_Ordered_Set_Of_UML_Opaque_Expression : constant Ordered_Set_Of_UML_Opaque_Expression; type Bag_Of_UML_Opaque_Expression is new UML_Opaque_Expression_Collections.Bag with null record; Empty_Bag_Of_UML_Opaque_Expression : constant Bag_Of_UML_Opaque_Expression; type Sequence_Of_UML_Opaque_Expression is new UML_Opaque_Expression_Collections.Sequence with null record; Empty_Sequence_Of_UML_Opaque_Expression : constant Sequence_Of_UML_Opaque_Expression; private Empty_Set_Of_UML_Opaque_Expression : constant Set_Of_UML_Opaque_Expression := (UML_Opaque_Expression_Collections.Set with null record); Empty_Ordered_Set_Of_UML_Opaque_Expression : constant Ordered_Set_Of_UML_Opaque_Expression := (UML_Opaque_Expression_Collections.Ordered_Set with null record); Empty_Bag_Of_UML_Opaque_Expression : constant Bag_Of_UML_Opaque_Expression := (UML_Opaque_Expression_Collections.Bag with null record); Empty_Sequence_Of_UML_Opaque_Expression : constant Sequence_Of_UML_Opaque_Expression := (UML_Opaque_Expression_Collections.Sequence with null record); end AMF.UML.Opaque_Expressions.Collections;
reznikmm/matreshka
Ada
4,005
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Script_Language_Attributes; package Matreshka.ODF_Script.Language_Attributes is type Script_Language_Attribute_Node is new Matreshka.ODF_Script.Abstract_Script_Attribute_Node and ODF.DOM.Script_Language_Attributes.ODF_Script_Language_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Script_Language_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Script_Language_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Script.Language_Attributes;
adamkruszewski/qweyboard
Ada
921
ads
with Ada.Text_IO; with Ada.Strings.Unbounded; with Ada.Command_Line; with Languages_Parser; with Logging; package Configuration is use Ada.Strings.Unbounded; package CLI renames Ada.Command_Line; ARGUMENTS_ERROR : exception; type Settings is record Timeout : Duration := 0.5; Language_File_Name : Unbounded_String; Log_Level : Logging.Verbosity_Level := Logging.Log_Error; end record; procedure Get_Settings (Config : in out Settings); procedure Load_Language (Config : in out Settings); private function Get_Argument (Count : in out Positive; Flag : String; File_Name : in out Unbounded_String) return Boolean; function Get_Argument (Count : in out Positive; Flag : String; Verbosity : in out Logging.Verbosity_Level) return Boolean; function Get_Argument (Count : in out Positive; Flag : String; Timeout : in out Duration) return Boolean; end Configuration;
AaronC98/PlaneSystem
Ada
3,656
adb
------------------------------------------------------------------------------ -- Templates Parser -- -- -- -- Copyright (C) 2005-2012, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- 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/>. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with Ada.Task_Identification; package body Templates_Parser_Tasking is use Ada.Task_Identification; -- Simple semaphore protected Semaphore is entry Lock; procedure Unlock; private entry Lock_Internal; TID : Task_Id := Null_Task_Id; Lock_Count : Natural := 0; end Semaphore; ---------- -- Lock -- ---------- procedure Lock is begin Semaphore.Lock; end Lock; --------------- -- Semaphore -- --------------- protected body Semaphore is ---------- -- Lock -- ---------- entry Lock when True is begin if TID = Lock'Caller then Lock_Count := Lock_Count + 1; else requeue Lock_Internal; end if; end Lock; ------------------- -- Lock_Internal -- ------------------- entry Lock_Internal when Lock_Count = 0 is begin TID := Lock_Internal'Caller; Lock_Count := 1; end Lock_Internal; ------------ -- Unlock -- ------------ procedure Unlock is begin if TID = Current_Task then Lock_Count := Lock_Count - 1; else raise Tasking_Error; end if; end Unlock; end Semaphore; ------------ -- Unlock -- ------------ procedure Unlock is begin Semaphore.Unlock; end Unlock; end Templates_Parser_Tasking;
tum-ei-rcs/StratoX
Ada
4,953
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T A S K _ T E R M I N A T I O N -- -- -- -- B o d y -- -- -- -- Copyright (C) 2005-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- 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 is a simplified version of this package body to be used in when the -- Ravenscar profile and there are no exception handlers present (either of -- the restrictions No_Exception_Handlers or No_Exception_Propagation are in -- effect). This means that the only task termination cause that need to be -- taken into account is normal task termination (abort is not allowed by -- the Ravenscar profile and the restricted exception support does not -- include Exception_Occurrence). with System.Tasking; -- used for Task_Id -- Self -- Fall_Back_Handler with System.Task_Primitives.Operations; -- Used for Self -- Set_Priority -- Get_Priority with Unchecked_Conversion; package body Ada.Task_Termination is use System.Task_Primitives.Operations; use type Ada.Task_Identification.Task_Id; function To_TT is new Unchecked_Conversion (System.Tasking.Termination_Handler, Termination_Handler); function To_ST is new Unchecked_Conversion (Termination_Handler, System.Tasking.Termination_Handler); ----------------------------------- -- Current_Task_Fallback_Handler -- ----------------------------------- function Current_Task_Fallback_Handler return Termination_Handler is Self_Id : constant System.Tasking.Task_Id := Self; Caller_Priority : constant System.Any_Priority := Get_Priority (Self_Id); Result : Termination_Handler; begin -- Raise the priority to prevent race conditions when modifying -- System.Tasking.Fall_Back_Handler. Set_Priority (Self_Id, System.Any_Priority'Last); Result := To_TT (System.Tasking.Fall_Back_Handler); -- Restore the original priority Set_Priority (Self_Id, Caller_Priority); return Result; end Current_Task_Fallback_Handler; ------------------------------------- -- Set_Dependents_Fallback_Handler -- ------------------------------------- procedure Set_Dependents_Fallback_Handler (Handler : Termination_Handler) is Self_Id : constant System.Tasking.Task_Id := Self; Caller_Priority : constant System.Any_Priority := Get_Priority (Self_Id); begin -- Raise the priority to prevent race conditions when modifying -- System.Tasking.Fall_Back_Handler. Set_Priority (Self_Id, System.Any_Priority'Last); System.Tasking.Fall_Back_Handler := To_ST (Handler); -- Restore the original priority Set_Priority (Self_Id, Caller_Priority); end Set_Dependents_Fallback_Handler; end Ada.Task_Termination;
Asier98/AdaCar
Ada
338
adb
pragma Ada_2012; package body AdaCar.Parametros is --------------------------- -- Convertidor_Distancia -- --------------------------- function Convertidor_Distancia (Valor : Unidades_AI) return Unidades_Distancia is begin return Valor*Factor_Distancia; end Convertidor_Distancia; end AdaCar.Parametros;
Tim-Tom/project-euler
Ada
3,550
adb
with Ada.Text_IO; with Ada.Integer_Text_IO; with Ada.Containers.Ordered_Sets; package body Problem_33 is package IO renames Ada.Text_IO; package I_IO renames Ada.Integer_Text_IO; type SimpleRational is Record Numerator : Integer; Denominator : Integer; end Record; function "<"(left, right : SimpleRational) return Boolean is begin -- left < right. We can't do real less than because we're just inserting -- the same fraction over and over again. -- IO.Put_Line("Less-Comparing " & ToString(left) & " and " & ToString(right)); if left.Numerator = right.Numerator then return right.Denominator < left.Denominator; elsif left.Denominator = right.Denominator then return left.Numerator < right.Numerator; else return left.Numerator < right.Numerator; end if; end "<"; function "*"(left, right : SimpleRational) return SimpleRational is result : SimpleRational; begin result.Numerator := left.Numerator*right.Numerator; result.Denominator := left.Denominator*right.Denominator; -- This doesn't simplify most things, but it works for this problem :) if result.Denominator mod result.Numerator = 0 then result.Denominator := result.Denominator / result.Numerator; result.Numerator := 1; end if; return result; end "*"; Package RationalSet is new Ada.Containers.Ordered_Sets(SimpleRational); procedure Solve is result : SimpleRational := (0, 0); begin for denominator in 2 .. 9 loop for numerator in 1 .. denominator - 1 loop declare set : RationalSet.Set; base : constant SimpleRational := (numerator, denominator); begin for multiplier in 1 .. (99 / denominator) loop declare r : constant SimpleRational := (numerator*multiplier, denominator*multiplier); begin if r.Numerator >= 10 and r.Denominator >= 10 then declare num_ten : constant Integer := r.Numerator / 10; num_unit : constant Integer := r.Numerator mod 10; den_ten : constant Integer := r.Denominator / 10; den_unit : constant Integer := r.Denominator mod 10; check : SimpleRational := (0, 0); begin if num_ten = den_unit then check := (num_unit, den_ten); elsif num_unit = den_ten then check := (num_ten, den_unit); end if; if check.Denominator /= 0 and then set.Contains(check) then if result.Denominator = 0 then result := base; else result := result * base; end if; end if; end; elsif r.Numerator < 10 and r.Denominator < 10 then -- IO.Put_Line("Inserting " & ToString(r)); set.Insert(r); end if; end; end loop; end; end loop; end loop; I_IO.Put(result.Denominator); IO.New_Line; end Solve; end Problem_33;
reznikmm/matreshka
Ada
4,741
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Strings; with Matreshka.DOM_Attributes; with Matreshka.DOM_Elements; with Matreshka.DOM_Nodes; package Matreshka.ODF_Config is type Abstract_Config_Attribute_Node is abstract new Matreshka.DOM_Attributes.Abstract_Attribute_L2_Node with record Prefix : League.Strings.Universal_String; end record; overriding function Get_Namespace_URI (Self : not null access constant Abstract_Config_Attribute_Node) return League.Strings.Universal_String; type Abstract_Config_Element_Node is abstract new Matreshka.DOM_Elements.Abstract_Element_Node with record Prefix : League.Strings.Universal_String; end record; overriding function Get_Namespace_URI (Self : not null access constant Abstract_Config_Element_Node) return League.Strings.Universal_String; package Constructors is procedure Initialize (Self : not null access Abstract_Config_Attribute_Node'Class; Document : not null Matreshka.DOM_Nodes.Document_Access; Prefix : League.Strings.Universal_String) with Inline => True; procedure Initialize (Self : not null access Abstract_Config_Element_Node'Class; Document : not null Matreshka.DOM_Nodes.Document_Access; Prefix : League.Strings.Universal_String) with Inline => True; end Constructors; end Matreshka.ODF_Config;
AdaCore/gpr
Ada
1,078
adb
with p0_1; use p0_1; with p1_0; use p1_0; package body p0_0 is function p0_0_0 (Item : Integer) return Integer is Result : Long_Long_Integer; begin if Item < 0 then return -Item; end if; Result := Long_Long_Integer (p0_1_0 (Item - 1)) + Long_Long_Integer (p1_0_0 (Item - 2)); return Integer (Result rem Long_Long_Integer (Integer'Last)); end p0_0_0; function p0_0_1 (Item : Integer) return Integer is Result : Long_Long_Integer; begin if Item < 0 then return -Item; end if; Result := Long_Long_Integer (p0_1_1 (Item - 1)) + Long_Long_Integer (p1_0_1 (Item - 2)); return Integer (Result rem Long_Long_Integer (Integer'Last)); end p0_0_1; function p0_0_2 (Item : Integer) return Integer is Result : Long_Long_Integer; begin if Item < 0 then return -Item; end if; Result := Long_Long_Integer (p0_1_2 (Item - 1)) + Long_Long_Integer (p1_0_2 (Item - 2)); return Integer (Result rem Long_Long_Integer (Integer'Last)); end p0_0_2; end p0_0;
usainzg/EHU
Ada
2,645
ads
package Listas is type Lista is limited private; -- Tipo lista ordenada creciente procedure Crear_Vacia ( L : out Lista); -- Post: crea la lista vacia L procedure Colocar ( L : in out Lista; E : in Integer); -- Pre: L es una lista ordenada crecientemente -- Post: Coloca en orden creciente el elemento E en L si hay espacio en la lista -- Si la lista est� llena dar� un mensaje de Lista_Llena procedure Obtener_Primero ( L : in Lista; P: out Integer); -- Pre: L es una lista ordenada crecientemente -- Post: P es el primer elemento de la lista L, si L no est� vac�a. -- Si la lista est� vac�a dar� un mensaje de Lista_Vacia function Esta ( L : in Lista; N : in Integer) return Boolean; -- Post: True sii C esta en la lista L procedure Borrar_Primero ( L : in out Lista); -- Pre: L es una lista ordenada crecientemente -- Si la lista est� vac�a dar� un mensaje de Lista_Vacia function Es_Vacia ( L : in Lista) return Boolean; -- Pre: L es una lista ordenada crecientemente -- Post: True sii la lista L es vacia function Igual ( L1, L2 : in Lista) return Boolean; -- Pre: L1 y L2 son listas ordenadas -- Post: True sii L1 y L2 son iguales (representan listas iguales) procedure Copiar ( L1 : out Lista; L2 : in Lista); -- Pre: L2 es lista ordenada -- Post: L1 es una lista ordenada copia de L2. generic with function Filtro(I: Integer) return Boolean; Cuantos: in Integer; procedure Crear_Sublista( L : in Lista; Sl: out Lista ); -- Pre: L es una lista ordenada crecientemente -- Post: La sublista Sl esta formada por los n (donde n está condicionado por el parametro CUANTOS) -- primeros elementos pares de la lista L. -- Si no hay 4, la crear� con los elementos que pares que haya en L. private -- implementacion dinamica, ligadura simple type Nodo; type Lista is access Nodo; type Nodo is record Info : Integer; Sig : Lista; end record; end Listas;
jwarwick/aoc_2020
Ada
1,101
adb
with AUnit.Assertions; use AUnit.Assertions; package body Day.Test is procedure Test_Part1 (T : in out AUnit.Test_Cases.Test_Case'Class) is pragma Unreferenced (T); t1 : constant Natural := count_valid("test1.txt"); t2 : constant Natural := count_valid("test2.txt"); begin Assert(t1 = 2, "Wrong number, expected 2, got" & t1'IMAGE); Assert(t2 = 3, "Wrong number, expected 3, got" & t2'IMAGE); end Test_Part1; procedure Test_Part2 (T : in out AUnit.Test_Cases.Test_Case'Class) is pragma Unreferenced (T); t2 : constant Natural := count_valid_updated("test2.txt"); begin Assert(t2 = 12, "Wrong number, expected 12, got" & t2'IMAGE); end Test_Part2; function Name (T : Test) return AUnit.Message_String is pragma Unreferenced (T); begin return AUnit.Format ("Test Day package"); end Name; procedure Register_Tests (T : in out Test) is use AUnit.Test_Cases.Registration; begin Register_Routine (T, Test_Part1'Access, "Test Part 1"); Register_Routine (T, Test_Part2'Access, "Test Part 2"); end Register_Tests; end Day.Test;
DrenfongWong/tkm-rpc
Ada
2,600
adb
-- -- Copyright (C) 2013 Reto Buerki <[email protected]> -- Copyright (C) 2013 Adrian-Ken Rueegsegger <[email protected]> -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions -- are met: -- 1. Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- 2. Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- 3. Neither the name of the University 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 REGENTS 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 REGENTS 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 Tkmrpc.Request.Convert; with Tkmrpc.Response.Convert; procedure Tkmrpc.Process_Stream (Src : Address_Type; Recv_Data : Ada.Streams.Stream_Element_Array; Send_Data : out Ada.Streams.Stream_Element_Array; Send_Last : out Ada.Streams.Stream_Element_Offset) is pragma Unreferenced (Src); use type Ada.Streams.Stream_Element_Offset; Req : constant Tkmrpc.Request.Data_Type := Tkmrpc.Request.Convert.From_Stream (S => Recv_Data); Res : Tkmrpc.Response.Data_Type; begin begin Dispatch (Req => Req, Res => Res); exception when E : others => Exception_Handler (Ex => E); Res := Tkmrpc.Response.Null_Data; Res.Header.Request_Id := Req.Header.Request_Id; end; Send_Last := Res'Size / 8; Send_Data (Send_Data'First .. Send_Last) := Tkmrpc.Response.Convert.To_Stream (S => Res); end Tkmrpc.Process_Stream;
AdaCore/libadalang
Ada
329
adb
procedure Test is type A is tagged null record; type B is new A with record X : Integer; end record; function Foo return Boolean is (True); function Foo return A is (null record); function Foo return Integer is (0); Value : B := (Foo with X => 2); pragma Test_Statement; begin null; end Test;
reznikmm/matreshka
Ada
3,597
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Internals.Elements; function AMF.Elements.Hash (Item : Element_Access) return Ada.Containers.Hash_Type is begin return Ada.Containers.Hash_Type (AMF.Internals.Elements.Element_Base'Class (Item.all).Element); end AMF.Elements.Hash;
reznikmm/matreshka
Ada
4,671
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Presentation.Node_Type_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Presentation_Node_Type_Attribute_Node is begin return Self : Presentation_Node_Type_Attribute_Node do Matreshka.ODF_Presentation.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Presentation_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Presentation_Node_Type_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Node_Type_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Presentation_URI, Matreshka.ODF_String_Constants.Node_Type_Attribute, Presentation_Node_Type_Attribute_Node'Tag); end Matreshka.ODF_Presentation.Node_Type_Attributes;
sebsgit/textproc
Ada
6,407
adb
with cl_objects; with opencl; with System; with System.Address_To_Access_Conversions; package body PixelArray.Gpu is pragma Warnings(Off); package Pixel_Buffer_Conv is new System.Address_To_Access_Conversions(Object => Pixel_Buffer); pragma Warnings(On); function Get_Width(img: in GpuImage) return Natural is begin return img.width; end Get_Width; function Get_Height(img: in GpuImage) return Natural is begin return img.height; end Get_Height; function Get_Address(img: in out GpuImage) return System.Address is begin return img.data.Get_Address; end Get_Address; function Create(ctx: in out Context'Class; flags: opencl.Mem_Flags; width, height: in Positive; status: out opencl.Status) return GpuImage is final_flags: opencl.Mem_Flags := flags; begin final_flags(opencl.COPY_HOST_PTR) := False; final_flags(opencl.ALLOC_HOST_PTR) := True; return res: constant GpuImage := (data => ctx.Create_Buffer(flags => final_flags, size => width * height, host_ptr => System.Null_Address, result_status => status), width => width, height => height, max_size => width * height) do null; end return; end Create; function Upload(ctx: in out Context'Class; flags: opencl.Mem_Flags; image: in ImagePlane; status: out opencl.Status) return GpuImage is final_flags: opencl.Mem_Flags := flags; begin final_flags(opencl.COPY_HOST_PTR) := True; final_flags(opencl.ALLOC_HOST_PTR) := False; return res: constant GpuImage := (data => ctx.Create_Buffer(flags => final_flags, size => image.width * image.height, host_ptr => image.data(0)'Address, result_status => status), width => image.width, height => image.height, max_size => image.width * image.height) do null; end return; end Upload; function Download(queue: in out Command_Queue'Class; source: in out GpuImage; target: in out ImagePlane; status: out opencl.Status) return Event is ev_data: opencl.Events(1 .. 0); begin return Download(queue => queue, source => source, target => target, event_to_wait => ev_data, status => status); end Download; function Download(queue: in out Command_Queue'Class; source: in out GpuImage; target: in out ImagePlane; event_to_wait: in opencl.Events; status: out opencl.Status) return Event is begin return queue.Enqueue_Read(mem_ob => source.data, offset => 0, size => source.width * source.height, ptr => target.data(0)'Address, events_to_wait_for => event_to_wait, code => status); end Download; procedure Set_Size(source: in out GpuImage; context: in out cl_objects.Context'Class; width, height: in Positive) is cl_code: opencl.Status; begin if width /= source.Get_Width or height /= source.Get_Height then if width * height > source.max_size then cl_code := opencl.Release(source.data.Get_ID); source.data.Set_ID(opencl.Create_Buffer(ctx => context.Get_ID, flags => (opencl.ALLOC_HOST_PTR => True, others => False), size => width * height, host_ptr => System.Null_Address, result_status => cl_code)); source.max_size := width * height; end if; source.width := width; source.height := height; end if; end Set_Size; function Upload_Image(source: in out GpuImage; ctx: in out Context'Class; queue: in out Command_Queue; image: in ImagePlane) return opencl.Status is cl_code: opencl.Status := opencl.SUCCESS; do_upload: Boolean := True; begin if image.width /= source.Get_Width or image.height /= source.Get_Height then if image.width * image.height > source.max_size then cl_code := opencl.Release(source.data.Get_ID); source.data.Set_ID(opencl.Create_Buffer(ctx => ctx.Get_ID, flags => (opencl.COPY_HOST_PTR => True, others => False), size => image.width * image.height, host_ptr => image.data(0)'Address, result_status => cl_code)); do_upload := False; source.max_size := image.width * image.height; end if; source.width := image.width; source.height := image.height; end if; if do_upload then declare ev: cl_objects.Event := queue.Enqueue_Write(mem_ob => source.data, offset => 0, size => image.width * image.height, ptr => image.data(0)'Address, events_to_wait_for => opencl.no_events, code => cl_code); begin cl_code := ev.Wait; end; end if; return cl_code; end Upload_Image; end PixelArray.Gpu;
stcarrez/ada-el
Ada
911
ads
----------------------------------------------------------------------- -- el-methods -- Bean methods -- Copyright (C) 2010, 2021 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package EL.Methods is pragma Preelaborate; end EL.Methods;
AdaCore/libadalang
Ada
140
adb
with Wat; procedure Usealltype is use all type Wat.A; Inst : Wat.A; begin Prim (Inst); pragma Test_Statement; end Usealltype;
io7m/coreland-lua-ada-load
Ada
545
adb
with Ada.Strings.Unbounded; with Ada.Text_IO; with Test; procedure test0003 is package IO renames Ada.Text_IO; package UB_Strings renames Ada.Strings.Unbounded; begin Test.Init ("test0003.lua"); declare x : constant UB_Strings.Unbounded_String := Test.Load.Named_Local (Test.Loader_Access, "x"); begin IO.Put_Line ("x: " & UB_Strings.To_String (x)); end; exception when Test.Load.Load_Error => IO.Put_Line ("fail: " & Test.Load.Error_String (Test.Loader_Access)); raise Test.Load.Load_Error; end test0003;
usainzg/EHU
Ada
1,906
adb
WITH Ada.Text_Io; USE Ada.Text_Io; procedure Ver_Contiene_a is -- salida: 7 booleanos(SE) -- post: corresponden a cada uno de los casos de pruebas dise�ados. -- pre: { True } function Contiene_a ( S : String) return Boolean is -- EJERCICIO 3- ESPECIFICA E IMPLEMENTA recursivamente el subprograma -- Contiene_a que decide si el string S contiene el car�cter 'a'. BEGIN -- Completar if S'Size = 0 then return False; end if; if S(S'First) = 'a' then return True; end if; return Contiene_a(S(S'First + 1 .. S'Last)); end Contiene_a ; -- post: { True <=> Contiene_a(S) } begin Put_Line("-------------------------------------"); Put("La palabra vacia no contiene el caracter 'a': "); Put(Boolean'Image(Contiene_a(""))); New_Line; New_Line; New_Line; Put_Line("-------------------------------------"); Put_Line("Palabras de un caracter"); Put("-- La palabra de 1 caracter 'a' contiene el caracter 'a': "); Put(Boolean'Image(Contiene_a("a"))); New_Line; Put("-- La palabra de 1 caracter 'b' no contiene el caracter 'a': "); Put(Boolean'Image(Contiene_a("b"))); New_Line; New_Line; New_Line; Put_Line("-------------------------------------"); Put_Line("Palabras de varios caracteres"); Put("-- 'abcd' contiene el caracter 'a': "); Put(Boolean'Image(Contiene_a("abcd"))); New_Line; Put("-- 'dcba' contiene el caracter 'a': "); Put(Boolean'Image(Contiene_a("dcba"))); New_Line; Put("-- 'dcbabcd' contiene el caracter 'a': "); Put(Boolean'Image(Contiene_a("dcbabcd"))); New_Line; Put("-- Pero 'dcbbcd' no contiene el caracter 'a': "); Put(Boolean'Image(Contiene_a("dcbbcd"))); New_Line; Put_Line("-------------------------------------"); end Ver_Contiene_a;
godunko/adagl
Ada
11,806
adb
------------------------------------------------------------------------------ -- -- -- Ada binding for OpenGL/WebGL -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2016-2020, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with League.Strings; package body OpenGL.Contexts is use type WebAPI.WebGL.Rendering_Contexts.WebGL_Rendering_Context_Access; Current : OpenGL_Context_Access; ------------ -- Create -- ------------ function Create (Self : in out OpenGL_Context'Class; Canvas : not null WebAPI.HTML.Canvas_Elements.HTML_Canvas_Element_Access) return Boolean is begin Self.Functions.Context := WebAPI.WebGL.Rendering_Contexts.WebGL_Rendering_Context_Access (Canvas.Get_Context (League.Strings.To_Universal_String ("webgl"))); if Self.Functions.Context = null then -- Attempt to create WebGL context with 'old' identifier. Self.Functions.Context := WebAPI.WebGL.Rendering_Contexts.WebGL_Rendering_Context_Access (Canvas.Get_Context (League.Strings.To_Universal_String ("experimental-webgl"))); end if; return Self.Functions.Context /= null; end Create; ------------ -- Create -- ------------ procedure Create (Self : in out OpenGL_Context'Class; Canvas : not null WebAPI.HTML.Canvas_Elements.HTML_Canvas_Element_Access) is begin if not Self.Create (Canvas) then raise Program_Error; end if; end Create; --------------------- -- Current_Context -- --------------------- function Current_Context return OpenGL_Context_Access is begin return Current; end Current_Context; --------------- -- Functions -- --------------- function Functions (Self : in out OpenGL_Context'Class) return access OpenGL.Functions.OpenGL_Functions'Class is begin if Self.Functions.Context = null then return null; else return Self.Functions'Unchecked_Access; end if; end Functions; ------------------ -- Make_Current -- ------------------ procedure Make_Current (Self : in out OpenGL_Context'Class) is begin Current := Self'Unchecked_Access; end Make_Current; --------------------- -- WebGL_Functions -- --------------------- package body WebGL_Functions is ---------------- -- Blend_Func -- ---------------- overriding procedure Blend_Func (Self : WebGL_Functions; Source_Factor : OpenGL.GLenum; Destination_Factor : OpenGL.GLenum) is begin Self.Context.Blend_Func (WebAPI.WebGL.GLenum (Source_Factor), WebAPI.WebGL.GLenum (Destination_Factor)); end Blend_Func; ----------- -- Clear -- ----------- overriding procedure Clear (Self : WebGL_Functions; Mask : OpenGL.Clear_Buffer_Mask) is use type WebAPI.WebGL.GLbitfield; M : WebAPI.WebGL.GLbitfield := 0; begin if OpenGL.Is_Set (Mask, OpenGL.GL_COLOR_BUFFER_BIT) then M := M or WebAPI.WebGL.Rendering_Contexts.COLOR_BUFFER_BIT; end if; if OpenGL.Is_Set (Mask, OpenGL.GL_DEPTH_BUFFER_BIT) then M := M or WebAPI.WebGL.Rendering_Contexts.DEPTH_BUFFER_BIT; end if; if OpenGL.Is_Set (Mask, OpenGL.GL_STENCIL_BUFFER_BIT) then M := M or WebAPI.WebGL.Rendering_Contexts.STENCIL_BUFFER_BIT; end if; Self.Context.Clear (M); end Clear; ----------------- -- Clear_Color -- ----------------- overriding procedure Clear_Color (Self : WebGL_Functions; Red : OpenGL.GLfloat; Green : OpenGL.GLfloat; Blue : OpenGL.GLfloat; Alpha : OpenGL.GLfloat) is begin Self.Context.Clear_Color (WebAPI.WebGL.GLfloat (Red), WebAPI.WebGL.GLfloat (Green), WebAPI.WebGL.GLfloat (Blue), WebAPI.WebGL.GLfloat (Alpha)); end Clear_Color; ----------------- -- Clear_Depth -- ----------------- overriding procedure Clear_Depth (Self : WebGL_Functions; Depth : OpenGL.GLfloat) is begin Self.Context.Clear_Depth (WebAPI.WebGL.GLfloat (Depth)); end Clear_Depth; ---------------- -- Depth_Func -- ---------------- overriding procedure Depth_Func (Self : WebGL_Functions; Func : OpenGL.GLenum) is begin Self.Context.Depth_Func (WebAPI.WebGL.GLenum (Func)); end Depth_Func; ------------- -- Disable -- ------------- overriding procedure Disable (Self : WebGL_Functions; Capability : OpenGL.GLenum) is begin Self.Context.Disable (WebAPI.WebGL.GLenum (Capability)); end Disable; ----------------- -- Draw_Arrays -- ----------------- overriding procedure Draw_Arrays (Self : WebGL_Functions; Mode : OpenGL.GLenum; First : OpenGL.GLint; Count : OpenGL.GLsizei) is begin -- XXX A2JS: case expression can be replaced by Unchecked_Conversion Self.Context.Draw_Arrays ((case Mode is when GL_POINTS => WebAPI.WebGL.Rendering_Contexts.POINTS, when GL_LINE_STRIP => WebAPI.WebGL.Rendering_Contexts.LINE_STRIP, when GL_LINE_LOOP => WebAPI.WebGL.Rendering_Contexts.LINE_LOOP, when GL_LINES => WebAPI.WebGL.Rendering_Contexts.LINES, when GL_TRIANGLE_STRIP => WebAPI.WebGL.Rendering_Contexts.TRIANGLE_STRIP, when GL_TRIANGLE_FAN => WebAPI.WebGL.Rendering_Contexts.TRIANGLE_FAN, when GL_TRIANGLES => WebAPI.WebGL.Rendering_Contexts.TRIANGLES, when others => WebAPI.WebGL.Rendering_Contexts.POINTS), -- when others => raise Constrint_Error), WebAPI.WebGL.GLint (First), WebAPI.WebGL.GLsizei (Count)); end Draw_Arrays; ------------------- -- Draw_Elements -- ------------------- overriding procedure Draw_Elements (Self : WebGL_Functions; Mode : OpenGL.GLenum; Count : OpenGL.GLsizei; Data_Type : OpenGL.GLenum; Offset : OpenGL.GLintptr) is begin -- XXX A2JS: case expression can be replaced by Unchecked_Conversion Self.Context.Draw_Elements ((case Mode is when GL_POINTS => WebAPI.WebGL.Rendering_Contexts.POINTS, when GL_LINE_STRIP => WebAPI.WebGL.Rendering_Contexts.LINE_STRIP, when GL_LINE_LOOP => WebAPI.WebGL.Rendering_Contexts.LINE_LOOP, when GL_LINES => WebAPI.WebGL.Rendering_Contexts.LINES, when GL_TRIANGLE_STRIP => WebAPI.WebGL.Rendering_Contexts.TRIANGLE_STRIP, when GL_TRIANGLE_FAN => WebAPI.WebGL.Rendering_Contexts.TRIANGLE_FAN, when GL_TRIANGLES => WebAPI.WebGL.Rendering_Contexts.TRIANGLES, when others => WebAPI.WebGL.Rendering_Contexts.POINTS), -- when others => raise Constrint_Error), WebAPI.WebGL.GLsizei (Count), (case Data_Type is when GL_UNSIGNED_BYTE => WebAPI.WebGL.Rendering_Contexts.UNSIGNED_BYTE, when GL_UNSIGNED_SHORT => WebAPI.WebGL.Rendering_Contexts.UNSIGNED_SHORT, when others => WebAPI.WebGL.Rendering_Contexts.UNSIGNED_BYTE), -- when others => raise Constrint_Error), WebAPI.WebGL.GLintptr (Offset)); end Draw_Elements; ------------ -- Enable -- ------------ overriding procedure Enable (Self : WebGL_Functions; Capability : OpenGL.GLenum) is begin Self.Context.Enable (WebAPI.WebGL.GLenum (Capability)); end Enable; ------------ -- Finish -- ------------ overriding procedure Finish (Self : WebGL_Functions) is begin Self.Context.Finish; end Finish; ----------- -- Flush -- ----------- overriding procedure Flush (Self : WebGL_Functions) is begin Self.Context.Flush; end Flush; -------------- -- Viewport -- -------------- overriding procedure Viewport (Self : WebGL_Functions; X : OpenGL.GLint; Y : OpenGL.GLint; Width : OpenGL.GLsizei; Height : OpenGL.GLsizei) is begin Self.Context.Viewport (WebAPI.WebGL.GLint (X), WebAPI.WebGL.GLint (Y), WebAPI.WebGL.GLsizei (Width), WebAPI.WebGL.GLsizei (Height)); end Viewport; end WebGL_Functions; end OpenGL.Contexts;
tj800x/SPARKNaCl
Ada
16,122
ads
------------------------------------------------------------------------------ -- Copyright (c) 2020, Protean Code Limited -- All rights reserved. -- -- "Simplified" (2-Clause) BSD Licence -- -- 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. -- -- 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.Unchecked_Conversion; with Interfaces; use Interfaces; with Random; package SPARKNaCl with SPARK_Mode => On is --============================================== -- Exported types and constants -- -- These are needed by clients, or by the -- specifications of child packages --============================================== subtype Byte is Unsigned_8; subtype I32 is Integer_32; subtype N32 is I32 range 0 .. I32'Last; subtype I64 is Integer_64; subtype I64_Byte is I64 range 0 .. 255; subtype I64_Bit is I64 range 0 .. 1; -- Byte_Seq and constrained subtypes thereof type Byte_Seq is array (N32 range <>) of Byte; subtype Index_8 is I32 range 0 .. 7; subtype Index_16 is I32 range 0 .. 15; subtype Index_24 is I32 range 0 .. 23; subtype Index_32 is I32 range 0 .. 31; subtype Index_64 is I32 range 0 .. 63; subtype Bytes_8 is Byte_Seq (Index_8); subtype Bytes_16 is Byte_Seq (Index_16); subtype Bytes_24 is Byte_Seq (Index_24); subtype Bytes_32 is Byte_Seq (Index_32); subtype Bytes_64 is Byte_Seq (Index_64); Zero_Bytes_16 : constant Bytes_16 := (others => 0); Zero_Bytes_32 : constant Bytes_32 := (others => 0); -- A sequence of I64 values, but where each is limited to -- values 0 .. 255; type I64_Byte_Seq is array (N32 range <>) of I64_Byte; -- Sequences of I64 values and subtypes thereof type I64_Seq is array (N32 range <>) of I64; subtype I64_Seq_64 is I64_Seq (Index_64); -------------------------------------------------------- -- Constant time equality test -------------------------------------------------------- -- Primitive operation of Byte_Seq, so inheritable function Equal (X, Y : in Byte_Seq) return Boolean with Global => null, Pre => X'First = Y'First and X'Last = Y'Last, Post => Equal'Result = (for all I in X'Range => X (I) = Y (I)); -------------------------------------------------------- -- RNG -------------------------------------------------------- -- Primitive operation of Byte_Seq, so inheritable procedure Random_Bytes (R : out Byte_Seq) with Global => Random.Entropy; -------------------------------------------------------- -- Data sanitization -------------------------------------------------------- -- Primitive operation of Byte_Seq, so inheritable. -- In their "Volatiles are mis-compiled..." paper, -- Regehr et al. recommend that calls to such subprograms -- should never be in-lined as a way to prevent -- the incorrect optimization (to nothing) of such a call, -- so we apply No_Inline here. pragma Warnings (GNATProve, Off, "No_Inline"); procedure Sanitize (R : out Byte_Seq) with Global => null, No_Inline; private --============================================== -- Local types - visible below, in this package -- body and in the bodies of child packages --============================================== subtype U32 is Unsigned_32; subtype U64 is Unsigned_64; subtype Index_4 is I32 range 0 .. 3; subtype Index_15 is I32 range 0 .. 14; subtype Index_20 is I32 range 0 .. 19; subtype Index_31 is I32 range 0 .. 30; subtype Index_256 is I32 range 0 .. 255; subtype Bytes_4 is Byte_Seq (Index_4); subtype Bytes_256 is Byte_Seq (Index_256); type U32_Seq is array (N32 range <>) of U32; type U64_Seq is array (N32 range <>) of U64; subtype U32_Seq_4 is U32_Seq (Index_4); subtype U32_Seq_16 is U32_Seq (Index_16); subtype I64_Byte_Seq_32 is I64_Byte_Seq (Index_32); subtype U64_Seq_16 is U64_Seq (Index_16); subtype U64_Seq_8 is U64_Seq (Index_8); -- Constant Sigma used for initialization of Core Salsa20 -- function in both Stream and Cryptobox packages Sigma : constant Bytes_16 := (0 => Character'Pos ('e'), 1 => Character'Pos ('x'), 2 => Character'Pos ('p'), 3 => Character'Pos ('a'), 4 => Character'Pos ('n'), 5 => Character'Pos ('d'), 6 => Character'Pos (' '), 7 => Character'Pos ('3'), 8 => Character'Pos ('2'), 9 => Character'Pos ('-'), 10 => Character'Pos ('b'), 11 => Character'Pos ('y'), 12 => Character'Pos ('t'), 13 => Character'Pos ('e'), 14 => Character'Pos (' '), 15 => Character'Pos ('k')); ------------------------------------------------------------------------- -- Constants common to the whole library -- -- Some "Huffman-lite coding" is applied to names here - the most -- frequently used constants having abbreviated names. ------------------------------------------------------------------------- -- GF "Limbs" are stored modulo 65536 -- -- "LM" = "Limb Modulus" -- "LMM1" = "Limb Modulus Minus 1" LM : constant := 65536; LMM1 : constant := 65535; -- The modulus of curve 25519 is (2**255 - 19). -- In the reduction of GF values, we sometime need to multiply a limb -- value by 2**256 mod (2**255 - 19), which is actually equal to 38, -- since 2**256 = (2 * (2**255 - 19)) + 38 -- -- "R2256" = "Remainder of 2**256 (modulo 2**255-19)" R2256 : constant := 38; ------------------------------------------------------------------------- -- Bounds on All GF Limbs -- -- In the most general case, we define GF_Any_Limb so it can take -- on the value of any GF limb at any point including intermediate -- values inside the "*", "-" and "+" operations. -- -- Lower bound on GF_Any_Limb -- -- During a subtraction of a GF, a limb can also reach -65535, -- but this can be rounded down to -65536 by addition of a -1 carry, -- so the lower bound is -65536 -- -- Upper bound on GF_Any_Limb -- -- During the "reduction modulo 2**255-19" phase of the "*" -- operation, each limb GF (I) is added to R2256 * GF (I + 16) -- The worst-case upper bound of this result is when I = 0, -- where GF (0) has upper bound MGFLP and GF (16) has upper bound -- 15 * MGFLP. -- -- Therefore the upper bound of Any_GF_Limb is -- (R2256 * 15 + 1) * MGFLP = 571 * MGFLP ------------------------------------------------------------------------- -- "Maximum GF Limb Coefficient" MGFLC : constant := (R2256 * 15) + 1; -- In multiplying two normalized GFs, a simple product of -- two limbs is bounded to 65535**2. This comes up in -- predicates and subtypes below, so a named number here -- is called for. The name "MGFLP" is short for -- "Maximum GF Limb Product" MGFLP : constant := LMM1 * LMM1; subtype GF_Any_Limb is I64 range -LM .. (MGFLC * MGFLP); type GF is array (Index_16) of GF_Any_Limb; -- GF Product Accumulator - used in "*" to accumulate the -- intermediate results of Left * Right type GF_PA is array (Index_31) of GF_Any_Limb; ------------------------------------------------------------------------- subtype GF_Normal_Limb is I64 range 0 .. LMM1; subtype Normal_GF is GF with Dynamic_Predicate => (for all I in Index_16 => Normal_GF (I) in GF_Normal_Limb); ------------------------------------------------------------------------- ------------------------------------------------------------------------- -- Subtypes supporting "+" operation on GF -- -- In a "+" operation, intermediate result limbs peak at +131070, so subtype GF_Sum_Limb is I64 range 0 .. (LMM1 * 2); subtype Sum_GF is GF with Dynamic_Predicate => (for all I in Index_16 => Sum_GF (I) in GF_Sum_Limb); ------------------------------------------------------------------------- ------------------------------------------------------------------------- -- Subtypes supporting "-" operation on GF -- -- In a "-" operation, each limb of the intermediate result is -- increased by 65536 to make sure it's not negative, and one -- is taken off the next limb up to balance the value. -- -- This means that -- Limb 0 is in range (0 - 65535) + 65536 .. (65535 - 0) + 65536 -- which is 1 .. 131071 -- Limbs 1 .. 15 are in range (0 - 65535) + 65535 .. (65535 - 0) + 65535 -- which is 0 .. 131070 -- -- Finally, to balance the -1 value carried into limb 16, limb 0 -- is reduced by R2256, so... subtype Difference_GF is GF with Dynamic_Predicate => ((Difference_GF (0) in (1 - R2256) .. ((2 * LMM1) - R2256 + 1)) and (for all K in Index_16 range 1 .. 15 => Difference_GF (K) in 0 .. 2 * LMM1)); ------------------------------------------------------------------------- -- Subtypes supporting "*" operation on GF -- -- A GF which is the result of multiplying two other Normalized GFs, -- but BEFORE normalization is applied has the following bounds on -- its limbs. The upperbound on Limb 0 is MGFLC * MGFLP as in -- GF_Any_Limb, but the upper bound reduces by 37 * MGFLP -- for each limb onwards... -- -- Lower-bound here is 0 since "*" always takes Normal_GF -- parameters, so an intermediate limb can never be negative. subtype Product_GF is GF with Dynamic_Predicate => (for all I in Index_16 => Product_GF (I) >= 0 and Product_GF (I) <= (MGFLC - 37 * GF_Any_Limb (I)) * MGFLP); ---------------------------------------------------------------------- -- A "Seminormal GF" is the result of applying a single -- normalization step to a Product_GF -- -- Least Significant Limb ("LSL") of a Seminormal GF. -- LSL is initially normalized to 0 .. 65535, but gets -- R2256 * Carry added to it, where Carry is (Limb 15 / 65536) -- The upper-bound on Limb 15 is given by substituting I = 14 -- into the Dynamic_Predicate above, so -- (MGFLC - 37 * 14) * MGFLP = 53 * MGFLP -- See the body of Product_To_Seminormal for the full -- proof of this upper-bound subtype Seminormal_GF_LSL is I64 range 0 .. (LMM1 + R2256 * ((53 * MGFLP) / LM)); -- Limbs 1 though 15 are in 0 .. 65535, but the -- Least Significant Limb 0 is in GF_Seminormal_Product_LSL subtype Seminormal_GF is GF with Dynamic_Predicate => (Seminormal_GF (0) in Seminormal_GF_LSL and (for all I in Index_16 range 1 .. 15 => Seminormal_GF (I) in GF_Normal_Limb)); ------------------------------------------------------------------------ -- A "Nearly-normal GF" is the result of applying either: -- 1. TWO normalization steps to a Product_GF -- OR -- 2. ONE normalization step to the SUM of 2 normalized GFs -- OR -- 3. ONE normalization step to the DIFFERENCE of 2 normalized GFs -- -- The least-significant-limb is normalized to 0 .. 65535, but then -- has +R2256 or -R2256 added to it, so its range is... subtype Nearlynormal_GF is GF with Dynamic_Predicate => ((Nearlynormal_GF (0) in -R2256 .. LMM1 + R2256) and (for all K in Index_16 range 1 .. 15 => (Nearlynormal_GF (K) in GF_Normal_Limb))); ------------------------------------------------------------------------ --================================================= -- Constants, used in more than one child package --================================================= GF_0 : constant Normal_GF := (others => 0); GF_1 : constant Normal_GF := (1, others => 0); --================== -- Local functions --================== function To_U64 is new Ada.Unchecked_Conversion (I64, U64); function To_I64 is new Ada.Unchecked_Conversion (U64, I64); -- returns equivalent of X >> 16 in C, doing an arithmetic -- shift right when X is negative, assuming 2's complement -- representation function ASR_16 (X : in I64) return I64 is (To_I64 (Shift_Right_Arithmetic (To_U64 (X), 16))) with Post => (if X >= 0 then ASR_16'Result = X / LM else ASR_16'Result = ((X + 1) / LM) - 1); pragma Annotate (GNATprove, False_Positive, "postcondition might fail", "From definition of arithmetic shift right"); -- returns equivalent of X >> 8 in C, doing an arithmetic -- shift right when X is negative, assuming 2's complement -- representation function ASR_8 (X : in I64) return I64 is (To_I64 (Shift_Right_Arithmetic (To_U64 (X), 8))) with Post => (if X >= 0 then ASR_8'Result = X / 256 else ASR_8'Result = ((X + 1) / 256) - 1); pragma Annotate (GNATprove, False_Positive, "postcondition might fail", "From definition of arithmetic shift right"); -- returns equivalent of X >> 4 in C, doing an arithmetic -- shift right when X is negative, assuming 2's complement -- representation function ASR_4 (X : in I64) return I64 is (To_I64 (Shift_Right_Arithmetic (To_U64 (X), 4))) with Post => (if X >= 0 then ASR_4'Result = X / 16 else ASR_4'Result = ((X + 1) / 16) - 1); pragma Annotate (GNATprove, False_Positive, "postcondition might fail", "From definition of arithmetic shift right"); --=============================== -- Local subprogram declarations --=============================== function "+" (Left, Right : in Normal_GF) return Normal_GF with Global => null; function "-" (Left, Right : in Normal_GF) return Normal_GF with Global => null; function "*" (Left, Right : in Normal_GF) return Normal_GF with Global => null; function Square (A : in Normal_GF) return Normal_GF is (A * A) with Global => null; -- Additional sanitization procedures for local types procedure Sanitize_U64 (R : out U64) with Global => null, No_Inline; procedure Sanitize_GF (R : out GF) with Global => null, No_Inline, Post => R in Normal_GF; procedure Sanitize_GF_PA (R : out GF_PA) with Global => null, No_Inline; procedure Sanitize_I64_Seq (R : out I64_Seq) with Global => null, No_Inline; procedure Sanitize_Boolean (R : out Boolean) with Global => null, No_Inline; end SPARKNaCl;
wookey-project/ewok-legacy
Ada
11,893
ads
-- -- Copyright 2018 The wookey project team <[email protected]> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- with system; with types.c; package soc.rcc with spark_mode => off is ----------------------------------------- -- RCC clock control register (RCC_CR) -- ----------------------------------------- type t_RCC_CR is record HSION : boolean; -- Internal high-speed clock enable HSIRDY : boolean; -- Internal high-speed clock ready flag Reserved_2_2 : bit; HSITRIM : bits_5; -- Internal high-speed clock trimming HSICAL : unsigned_8; -- Internal high-speed clock calibration HSEON : boolean; -- HSE clock enable HSERDY : boolean; -- HSE clock ready flag HSEBYP : boolean; -- HSE clock bypassed (with an ext. clock) CSSON : boolean; -- Clock security system enable Reserved_20_23 : bits_4; PLLON : boolean; -- Main PLL enable PLLRDY : boolean; -- Main PLL clock ready flag PLLI2SON : boolean; -- PLLI2S enable PLLI2SRDY : boolean; -- PLLI2S clock ready flag PLLSAION : boolean; -- PLLSAI enable PLLSAIRDY : boolean; -- PLLSAI clock ready flag Reserved_30_31 : bits_2; end record with volatile_full_access, size => 32; for t_RCC_CR use record HSION at 0 range 0 .. 0; HSIRDY at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; HSITRIM at 0 range 3 .. 7; HSICAL at 0 range 8 .. 15; HSEON at 0 range 16 .. 16; HSERDY at 0 range 17 .. 17; HSEBYP at 0 range 18 .. 18; CSSON at 0 range 19 .. 19; Reserved_20_23 at 0 range 20 .. 23; PLLON at 0 range 24 .. 24; PLLRDY at 0 range 25 .. 25; PLLI2SON at 0 range 26 .. 26; PLLI2SRDY at 0 range 27 .. 27; PLLSAION at 0 range 28 .. 28; PLLSAIRDY at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; -------------------------------------------------- -- RCC PLL configuration register (RCC_PLLCFGR) -- -------------------------------------------------- type t_RCC_PLLCFGR is record PLLM : bits_6; PLLN : bits_9; PLLP : bits_2; PLLSRC : bit; PLLQ : bits_4; end record with size => 32, volatile_full_access; for t_RCC_PLLCFGR use record PLLM at 0 range 0 .. 5; PLLN at 0 range 6 .. 14; PLLP at 0 range 16 .. 17; PLLSRC at 0 range 22 .. 22; PLLQ at 0 range 24 .. 27; end record; PLLCFGR_RESET : constant unsigned_32 := 16#2400_3010#; ------------------------------------------------- -- RCC clock configuration register (RCC_CFGR) -- ------------------------------------------------- type t_RCC_CFGR is record SW : bits_2; -- System clock switch SWS : bits_2; -- System clock switch status HPRE : bits_4; -- AHB prescaler reserved_8_9 : bits_2; PPRE1 : bits_3; -- APB Low speed prescaler (APB1) PPRE2 : bits_3; -- APB high-speed prescaler (APB2) RTCPRE : bits_5; -- HSE division factor for RTC clock MCO1 : bits_2; -- Microcontroller clock output 1 I2SSCR : bit; -- I2S clock selection MCO1PRE : bits_3; -- MCO1 prescaler MCO2PRE : bits_3; -- MCO2 prescaler MCO2 : bits_2; -- Microcontroller clock output 2 end record with size => 32, volatile_full_access; for t_RCC_CFGR use record SW at 0 range 0 .. 1; SWS at 0 range 2 .. 3; HPRE at 0 range 4 .. 7; reserved_8_9 at 0 range 8 .. 9; PPRE1 at 0 range 10 .. 12; PPRE2 at 0 range 13 .. 15; RTCPRE at 0 range 16 .. 20; MCO1 at 0 range 21 .. 22; I2SSCR at 0 range 23 .. 23; MCO1PRE at 0 range 24 .. 26; MCO2PRE at 0 range 27 .. 29; MCO2 at 0 range 30 .. 31; end record; ------------------------------------------------------ -- RCC AHB1 peripheral clock register (RCC_AHB1ENR) -- ------------------------------------------------------ type t_RCC_AHB1ENR is record GPIOAEN : boolean; -- IO port A clock enable GPIOBEN : boolean; -- IO port B clock enable GPIOCEN : boolean; -- IO port C clock enable GPIODEN : boolean; -- IO port D clock enable GPIOEEN : boolean; -- IO port E clock enable GPIOFEN : boolean; -- IO port F clock enable GPIOGEN : boolean; -- IO port G clock enable GPIOHEN : boolean; -- IO port H clock enable GPIOIEN : boolean; -- IO port I clock enable reserved_9_11 : bits_3; CRCEN : boolean; -- CRC clock enable reserved_13_17 : bits_5; BKPSRAMEN : boolean; -- Backup SRAM interface clock enable reserved_19 : bit; CCMDATARAMEN : boolean; -- CCM data RAM clock enable DMA1EN : boolean; -- DMA1 clock enable DMA2EN : boolean; -- DMA2 clock enable reserved_23_24 : bit; ETHMACEN : boolean; -- Ethernet MAC clock enable ETHMACTXEN : boolean; -- Ethernet Transmission clock enable ETHMACRXEN : boolean; -- Ethernet Reception clock enable ETHMACPTPEN : boolean; -- Ethernet PTP clock enable OTGHSEN : boolean; -- USB OTG HS clock enable OTGHSULPIEN : boolean; -- USB OTG HSULPI clock enable reserved_31 : bit; end record with pack, size => 32, volatile_full_access; ------------------------------------------------------------- -- RCC AHB2 peripheral clock enable register (RCC_AHB2ENR) -- ------------------------------------------------------------- type t_RCC_AHB2ENR is record DCMIEN : boolean; -- DCMI clock enable reserved_1_3 : bits_3; CRYPEN : boolean; -- CRYP clock enable HASHEN : boolean; -- HASH clock enable RNGEN : boolean; -- RNG clock enable OTGFSEN : boolean; -- USB OTG Full Speed clock enable end record with size => 32, volatile_full_access; for t_RCC_AHB2ENR use record DCMIEN at 0 range 0 .. 0; reserved_1_3 at 0 range 1 .. 3; CRYPEN at 0 range 4 .. 4; HASHEN at 0 range 5 .. 5; RNGEN at 0 range 6 .. 6; OTGFSEN at 0 range 7 .. 7; end record; ------------------------------------------------------------- -- RCC APB1 peripheral clock enable register (RCC_APB1ENR) -- ------------------------------------------------------------- type t_RCC_APB1ENR is record TIM2EN : boolean; -- TIM2 clock enable TIM3EN : boolean; -- TIM3 clock enable TIM4EN : boolean; -- TIM4 clock enable TIM5EN : boolean; -- TIM5 clock enable TIM6EN : boolean; -- TIM6 clock enable TIM7EN : boolean; -- TIM7 clock enable TIM12EN : boolean; -- TIM12 clock enable TIM13EN : boolean; -- TIM13 clock enable TIM14EN : boolean; -- TIM14 clock enable reserved_9_10 : bits_2; WWDGEN : boolean; -- Window watchdog clock enable reserved_12_13 : bits_2; SPI2EN : boolean; -- SPI2 clock enable SPI3EN : boolean; -- SPI3 clock enable reserved_16 : boolean; USART2EN : boolean; -- USART2 clock enable USART3EN : boolean; -- USART3 clock enable UART4EN : boolean; -- UART4 clock enable UART5EN : boolean; -- UART5 clock enable I2C1EN : boolean; -- I2C1 clock enable I2C2EN : boolean; -- I2C2 clock enable I2C3EN : boolean; -- I2C3 clock enable reserved_24 : bit; CAN1EN : boolean; -- CAN 1 clock enable CAN2EN : boolean; -- CAN 2 clock enable reserved_27 : bit; PWREN : boolean; -- Power interface clock enable DACEN : boolean; -- DAC interface clock enable UART7EN : boolean; -- UART7 clock enable UART8EN : boolean; -- UART8 clock enable end record with pack, size => 32, volatile_full_access; ------------------------------------------------------------- -- RCC APB2 peripheral clock enable register (RCC_APB2ENR) -- ------------------------------------------------------------- type t_RCC_APB2ENR is record TIM1EN : boolean; -- TIM1 clock enable TIM8EN : boolean; -- TIM8 clock enable reserved_2_3 : bits_2; USART1EN : boolean; -- USART1 clock enable USART6EN : boolean; -- USART6 clock enable reserved_6_7 : bits_2; ADC1EN : boolean; -- ADC1 clock enable ADC2EN : boolean; -- ADC2 clock enable ADC3EN : boolean; -- ADC3 clock enable SDIOEN : boolean; -- SDIO clock enable SPI1EN : boolean; -- SPI1 clock enable reserved_13 : bit; SYSCFGEN : boolean; -- System configuration controller clock enable reserved_15 : bit; TIM9EN : boolean; -- TIM9 clock enable TIM10EN : boolean; -- TIM10 clock enable TIM11EN : boolean; -- TIM11 clock enable reserved_19_23 : bits_5; reserved_24_31 : unsigned_8; end record with pack, size => 32, volatile_full_access; -------------------- -- RCC peripheral -- -------------------- type t_RCC_peripheral is record CR : t_RCC_CR; PLLCFGR : t_RCC_PLLCFGR; CFGR : t_RCC_CFGR; CIR : unsigned_32; AHB1ENR : t_RCC_AHB1ENR; AHB2ENR : t_RCC_AHB2ENR; APB1ENR : t_RCC_APB1ENR; APB2ENR : t_RCC_APB2ENR; end record with volatile; for t_RCC_peripheral use record CR at 16#00# range 0 .. 31; PLLCFGR at 16#04# range 0 .. 31; CFGR at 16#08# range 0 .. 31; CIR at 16#0C# range 0 .. 31; AHB1ENR at 16#30# range 0 .. 31; AHB2ENR at 16#34# range 0 .. 31; APB1ENR at 16#40# range 0 .. 31; APB2ENR at 16#44# range 0 .. 31; end record; RCC : t_RCC_peripheral with import, volatile, address => system'to_address(16#4002_3800#); procedure reset with convention => c, export => true, external_name => "soc_rcc_reset"; function init (enable_hse : in types.c.bool; enable_pll : in types.c.bool) return types.c.t_retval with convention => c, export => true, external_name => "soc_rcc_setsysclock"; end soc.rcc;
zhmu/ananas
Ada
19,895
adb
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- B U T I L -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Opt; use Opt; with Output; use Output; with Unchecked_Deallocation; with GNAT; use GNAT; with System.OS_Lib; use System.OS_Lib; package body Butil is ----------------------- -- Local subprograms -- ----------------------- procedure Parse_Next_Unit_Name (Iter : in out Forced_Units_Iterator); -- Parse the name of the next available unit accessible through iterator -- Iter and save it in the iterator. function Read_Forced_Elab_Order_File return String_Ptr; -- Read the contents of the forced-elaboration-order file supplied to the -- binder via switch -f and return them as a string. Return null if the -- file is not available. -------------- -- Has_Next -- -------------- function Has_Next (Iter : Forced_Units_Iterator) return Boolean is begin return Present (Iter.Unit_Name); end Has_Next; ---------------------- -- Is_Internal_Unit -- ---------------------- -- Note: the reason we do not use the Fname package for this function -- is that it would drag too much junk into the binder. function Is_Internal_Unit return Boolean is begin return Is_Predefined_Unit or else (Name_Len > 4 and then (Name_Buffer (1 .. 5) = "gnat%" or else Name_Buffer (1 .. 5) = "gnat.")); end Is_Internal_Unit; ------------------------ -- Is_Predefined_Unit -- ------------------------ -- Note: the reason we do not use the Fname package for this function -- is that it would drag too much junk into the binder. function Is_Predefined_Unit return Boolean is L : Natural renames Name_Len; B : String renames Name_Buffer; begin return (L > 3 and then B (1 .. 4) = "ada.") or else (L > 6 and then B (1 .. 7) = "system.") or else (L > 10 and then B (1 .. 11) = "interfaces.") or else (L > 3 and then B (1 .. 4) = "ada%") or else (L > 8 and then B (1 .. 9) = "calendar%") or else (L > 9 and then B (1 .. 10) = "direct_io%") or else (L > 10 and then B (1 .. 11) = "interfaces%") or else (L > 13 and then B (1 .. 14) = "io_exceptions%") or else (L > 12 and then B (1 .. 13) = "machine_code%") or else (L > 13 and then B (1 .. 14) = "sequential_io%") or else (L > 6 and then B (1 .. 7) = "system%") or else (L > 7 and then B (1 .. 8) = "text_io%") or else (L > 20 and then B (1 .. 21) = "unchecked_conversion%") or else (L > 22 and then B (1 .. 23) = "unchecked_deallocation%") or else (L > 4 and then B (1 .. 5) = "gnat%") or else (L > 4 and then B (1 .. 5) = "gnat."); end Is_Predefined_Unit; -------------------------- -- Iterate_Forced_Units -- -------------------------- function Iterate_Forced_Units return Forced_Units_Iterator is Iter : Forced_Units_Iterator; begin Iter.Order := Read_Forced_Elab_Order_File; Parse_Next_Unit_Name (Iter); return Iter; end Iterate_Forced_Units; ---------- -- Next -- ---------- procedure Next (Iter : in out Forced_Units_Iterator; Unit_Name : out Unit_Name_Type; Unit_Line : out Logical_Line_Number) is begin if not Has_Next (Iter) then raise Iterator_Exhausted; end if; Unit_Line := Iter.Unit_Line; Unit_Name := Iter.Unit_Name; pragma Assert (Present (Unit_Name)); Parse_Next_Unit_Name (Iter); end Next; -------------------------- -- Parse_Next_Unit_Name -- -------------------------- procedure Parse_Next_Unit_Name (Iter : in out Forced_Units_Iterator) is Body_Suffix : constant String := " (body)"; Body_Type : constant String := "%b"; Body_Length : constant Positive := Body_Suffix'Length; Body_Offset : constant Natural := Body_Length - 1; Comment_Header : constant String := "--"; Comment_Offset : constant Natural := Comment_Header'Length - 1; Spec_Suffix : constant String := " (spec)"; Spec_Type : constant String := "%s"; Spec_Length : constant Positive := Spec_Suffix'Length; Spec_Offset : constant Natural := Spec_Length - 1; Index : Positive renames Iter.Order_Index; Line : Logical_Line_Number renames Iter.Order_Line; Order : String_Ptr renames Iter.Order; function At_Comment return Boolean; pragma Inline (At_Comment); -- Determine whether iterator Iter is positioned over the start of a -- comment. function At_Terminator return Boolean; pragma Inline (At_Terminator); -- Determine whether iterator Iter is positioned over a line terminator -- character. function At_Whitespace return Boolean; pragma Inline (At_Whitespace); -- Determine whether iterator Iter is positioned over a whitespace -- character. function Is_Terminator (C : Character) return Boolean; pragma Inline (Is_Terminator); -- Determine whether character C denotes a line terminator function Is_Whitespace (C : Character) return Boolean; pragma Inline (Is_Whitespace); -- Determine whether character C denotes a whitespace procedure Parse_Unit_Name; pragma Inline (Parse_Unit_Name); -- Find and parse the first available unit name procedure Skip_Comment; pragma Inline (Skip_Comment); -- Skip a comment by reaching a line terminator procedure Skip_Terminator; pragma Inline (Skip_Terminator); -- Skip a line terminator and deal with the logical line numbering procedure Skip_Whitespace; pragma Inline (Skip_Whitespace); -- Skip whitespace function Within_Order (Low_Offset : Natural := 0; High_Offset : Natural := 0) return Boolean; pragma Inline (Within_Order); -- Determine whether index of iterator Iter is still within the range of -- the order string. Low_Offset may be used to inspect the area that is -- less than the index. High_Offset may be used to inspect the area that -- is greater than the index. ---------------- -- At_Comment -- ---------------- function At_Comment return Boolean is begin -- The interator is over a comment when the index is positioned over -- the start of a comment header. -- -- unit (spec) -- comment -- ^ -- Index return Within_Order (High_Offset => Comment_Offset) and then Order (Index .. Index + Comment_Offset) = Comment_Header; end At_Comment; ------------------- -- At_Terminator -- ------------------- function At_Terminator return Boolean is begin return Within_Order and then Is_Terminator (Order (Index)); end At_Terminator; ------------------- -- At_Whitespace -- ------------------- function At_Whitespace return Boolean is begin return Within_Order and then Is_Whitespace (Order (Index)); end At_Whitespace; ------------------- -- Is_Terminator -- ------------------- function Is_Terminator (C : Character) return Boolean is begin -- Carriage return is treated intentionally as whitespace since it -- appears only on certain targets, while line feed is consistent on -- all of them. return C = ASCII.LF; end Is_Terminator; ------------------- -- Is_Whitespace -- ------------------- function Is_Whitespace (C : Character) return Boolean is begin return C = ' ' or else C = ASCII.CR -- carriage return or else C = ASCII.FF -- form feed or else C = ASCII.HT -- horizontal tab or else C = ASCII.VT; -- vertical tab end Is_Whitespace; --------------------- -- Parse_Unit_Name -- --------------------- procedure Parse_Unit_Name is pragma Assert (not At_Comment); pragma Assert (not At_Terminator); pragma Assert (not At_Whitespace); pragma Assert (Within_Order); procedure Find_End_Index_Of_Unit_Name; pragma Inline (Find_End_Index_Of_Unit_Name); -- Position the index of iterator Iter at the last character of the -- first available unit name. --------------------------------- -- Find_End_Index_Of_Unit_Name -- --------------------------------- procedure Find_End_Index_Of_Unit_Name is begin -- At this point the index points at the start of a unit name. The -- unit name may be legal, in which case it appears as: -- -- unit (body) -- -- However, it may also be illegal: -- -- unit without suffix -- unit with multiple prefixes (spec) -- -- In order to handle both forms, find the construct following the -- unit name. This is either a comment, a terminator, or the end -- of the order: -- -- unit (body) -- comment -- unit without suffix <terminator> -- unit with multiple prefixes (spec)<end of order> -- -- Once the construct is found, truncate the unit name by skipping -- all white space between the construct and the end of the unit -- name. -- Find the construct that follows the unit name while Within_Order loop if At_Comment then exit; elsif At_Terminator then exit; end if; Index := Index + 1; end loop; -- Position the index prior to the construct that follows the unit -- name. Index := Index - 1; -- Truncate towards the end of the unit name while Within_Order loop if At_Whitespace then Index := Index - 1; else exit; end if; end loop; end Find_End_Index_Of_Unit_Name; -- Local variables Start_Index : constant Positive := Index; End_Index : Positive; Is_Body : Boolean := False; Is_Spec : Boolean := False; -- Start of processing for Parse_Unit_Name begin Find_End_Index_Of_Unit_Name; End_Index := Index; pragma Assert (Start_Index <= End_Index); -- At this point the indices are positioned as follows: -- -- End_Index -- Index -- v -- unit (spec) -- comment -- ^ -- Start_Index -- Rewind the index, skipping over the legal suffixes -- -- Index End_Index -- v v -- unit (spec) -- comment -- ^ -- Start_Index if Within_Order (Low_Offset => Body_Offset) and then Order (Index - Body_Offset .. Index) = Body_Suffix then Is_Body := True; Index := Index - Body_Length; elsif Within_Order (Low_Offset => Spec_Offset) and then Order (Index - Spec_Offset .. Index) = Spec_Suffix then Is_Spec := True; Index := Index - Spec_Length; end if; -- Capture the line where the unit name is defined Iter.Unit_Line := Line; -- Transform the unit name to match the format recognized by the -- name table. if Is_Body then Iter.Unit_Name := Name_Find (Order (Start_Index .. Index) & Body_Type); elsif Is_Spec then Iter.Unit_Name := Name_Find (Order (Start_Index .. Index) & Spec_Type); -- Otherwise the unit name is illegal, so leave it as is else Iter.Unit_Name := Name_Find (Order (Start_Index .. Index)); end if; -- Advance the index past the unit name -- -- End_IndexIndex -- vv -- unit (spec) -- comment -- ^ -- Start_Index Index := End_Index + 1; end Parse_Unit_Name; ------------------ -- Skip_Comment -- ------------------ procedure Skip_Comment is begin pragma Assert (At_Comment); while Within_Order loop if At_Terminator then exit; end if; Index := Index + 1; end loop; end Skip_Comment; --------------------- -- Skip_Terminator -- --------------------- procedure Skip_Terminator is begin pragma Assert (At_Terminator); Index := Index + 1; Line := Line + 1; end Skip_Terminator; --------------------- -- Skip_Whitespace -- --------------------- procedure Skip_Whitespace is begin while Within_Order loop if At_Whitespace then Index := Index + 1; else exit; end if; end loop; end Skip_Whitespace; ------------------ -- Within_Order -- ------------------ function Within_Order (Low_Offset : Natural := 0; High_Offset : Natural := 0) return Boolean is begin return Order /= null and then Index - Low_Offset >= Order'First and then Index + High_Offset <= Order'Last; end Within_Order; -- Start of processing for Parse_Next_Unit_Name begin -- A line in the forced-elaboration-order file has the following -- grammar: -- -- LINE ::= -- [WHITESPACE] UNIT_NAME [WHITESPACE] [COMMENT] TERMINATOR -- -- WHITESPACE ::= -- <any whitespace character> -- | <carriage return> -- -- UNIT_NAME ::= -- UNIT_PREFIX [WHITESPACE] UNIT_SUFFIX -- -- UNIT_PREFIX ::= -- <any string> -- -- UNIT_SUFFIX ::= -- (body) -- | (spec) -- -- COMMENT ::= -- -- <any string> -- -- TERMINATOR ::= -- <line feed> -- <end of file> -- -- Items in <> brackets are semantic notions -- Assume that the order has no remaining units Iter.Unit_Line := No_Line_Number; Iter.Unit_Name := No_Unit_Name; -- Try to find the first available unit name from the current position -- of iteration. while Within_Order loop Skip_Whitespace; if At_Comment then Skip_Comment; elsif not Within_Order then exit; elsif At_Terminator then Skip_Terminator; else Parse_Unit_Name; exit; end if; end loop; end Parse_Next_Unit_Name; --------------------------------- -- Read_Forced_Elab_Order_File -- --------------------------------- function Read_Forced_Elab_Order_File return String_Ptr is procedure Free is new Unchecked_Deallocation (String, String_Ptr); Descr : File_Descriptor; Len : Natural; Len_Read : Natural; Result : String_Ptr; Success : Boolean; begin if Force_Elab_Order_File = null then return null; end if; -- Obtain and sanitize a descriptor to the elaboration-order file Descr := Open_Read (Force_Elab_Order_File.all, Binary); if Descr = Invalid_FD then return null; end if; -- Determine the size of the file, allocate a result large enough to -- house its contents, and read it. Len := Natural (File_Length (Descr)); if Len = 0 then return null; end if; Result := new String (1 .. Len); Len_Read := Read (Descr, Result (1)'Address, Len); -- The read failed to acquire the whole content of the file if Len_Read /= Len then Free (Result); return null; end if; Close (Descr, Success); -- The file failed to close if not Success then Free (Result); return null; end if; return Result; end Read_Forced_Elab_Order_File; ---------------- -- Uname_Less -- ---------------- function Uname_Less (U1, U2 : Unit_Name_Type) return Boolean is begin Get_Name_String (U1); declare U1_Name : constant String (1 .. Name_Len) := Name_Buffer (1 .. Name_Len); Min_Length : Natural; begin Get_Name_String (U2); if Name_Len < U1_Name'Last then Min_Length := Name_Len; else Min_Length := U1_Name'Last; end if; for J in 1 .. Min_Length loop if U1_Name (J) > Name_Buffer (J) then return False; elsif U1_Name (J) < Name_Buffer (J) then return True; end if; end loop; return U1_Name'Last < Name_Len; end; end Uname_Less; --------------------- -- Write_Unit_Name -- --------------------- procedure Write_Unit_Name (U : Unit_Name_Type) is begin Get_Name_String (U); Write_Str (Name_Buffer (1 .. Name_Len - 2)); if Name_Buffer (Name_Len) = 's' then Write_Str (" (spec)"); else Write_Str (" (body)"); end if; Name_Len := Name_Len + 5; end Write_Unit_Name; end Butil;
usainzg/EHU
Ada
120
ads
with Vectores_Genericos; package Vectores_Luminosidad is new Vectores_Genericos( Max => 10, Elemento => Float );
reznikmm/matreshka
Ada
4,899
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Generic_Collections; package AMF.UML.Variables.Collections is pragma Preelaborate; package UML_Variable_Collections is new AMF.Generic_Collections (UML_Variable, UML_Variable_Access); type Set_Of_UML_Variable is new UML_Variable_Collections.Set with null record; Empty_Set_Of_UML_Variable : constant Set_Of_UML_Variable; type Ordered_Set_Of_UML_Variable is new UML_Variable_Collections.Ordered_Set with null record; Empty_Ordered_Set_Of_UML_Variable : constant Ordered_Set_Of_UML_Variable; type Bag_Of_UML_Variable is new UML_Variable_Collections.Bag with null record; Empty_Bag_Of_UML_Variable : constant Bag_Of_UML_Variable; type Sequence_Of_UML_Variable is new UML_Variable_Collections.Sequence with null record; Empty_Sequence_Of_UML_Variable : constant Sequence_Of_UML_Variable; private Empty_Set_Of_UML_Variable : constant Set_Of_UML_Variable := (UML_Variable_Collections.Set with null record); Empty_Ordered_Set_Of_UML_Variable : constant Ordered_Set_Of_UML_Variable := (UML_Variable_Collections.Ordered_Set with null record); Empty_Bag_Of_UML_Variable : constant Bag_Of_UML_Variable := (UML_Variable_Collections.Bag with null record); Empty_Sequence_Of_UML_Variable : constant Sequence_Of_UML_Variable := (UML_Variable_Collections.Sequence with null record); end AMF.UML.Variables.Collections;
charlie5/cBound
Ada
1,667
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with swig; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_unmap_notify_event_t is -- Item -- type Item is record response_type : aliased Interfaces.Unsigned_8; pad0 : aliased Interfaces.Unsigned_8; sequence : aliased Interfaces.Unsigned_16; event : aliased xcb.xcb_window_t; window : aliased xcb.xcb_window_t; from_configure : aliased Interfaces.Unsigned_8; pad1 : aliased swig.int8_t_Array (0 .. 2); end record; -- Item_Array -- type Item_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_unmap_notify_event_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_unmap_notify_event_t.Item, Element_Array => xcb.xcb_unmap_notify_event_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_unmap_notify_event_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_unmap_notify_event_t.Pointer, Element_Array => xcb.xcb_unmap_notify_event_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_unmap_notify_event_t;
Maxelweb/concurrency-sandbox
Ada
1,263
ads
with Ada.Finalization; package SoE is -- process Odd will be activated as part of the elaboration -- of the enclosing package ----------------------------------- task Odd is -- we want the user to set the limit of the search range entry Set_Limit (User_Limit : Positive); end Odd; ----------------------------------- task type Sieve_T (Id : Positive) is entry Relay (Int : Positive); end Sieve_T; type Sieve_Ref is access Sieve_T; -- for terminating processes to express last wishes -- we need to place explicitly finalizable objects -- within the scope of tasks that may be finalized: -- in this way, the task finalization will first require finalization -- of all objects in its scope, which will occur by automatic -- invocation of the method Finalize on each such object ----------------------------------- type Last_Wishes_T is new Ada.Finalization.Limited_Controlled with record Id : Positive; end record; procedure Finalize (Last_Wishes : in out Last_Wishes_T); -- the type of finalizable objects must be an extension of this -- special type of the language ----------------------------------- end SoE;
bitslab/CompilerInterrupts
Ada
6,002
adb
---------------------------------------------------------------- -- ZLib for Ada thick binding. -- -- -- -- Copyright (C) 2002-2003 Dmitriy Anisimkov -- -- -- -- Open source license information is in the zlib.ads file. -- ---------------------------------------------------------------- -- $Id: zlib-streams.adb,v 1.1.1.1 2012/03/29 17:21:39 uid42307 Exp $ with Ada.Unchecked_Deallocation; package body ZLib.Streams is ----------- -- Close -- ----------- procedure Close (Stream : in out Stream_Type) is procedure Free is new Ada.Unchecked_Deallocation (Stream_Element_Array, Buffer_Access); begin if Stream.Mode = Out_Stream or Stream.Mode = Duplex then -- We should flush the data written by the writer. Flush (Stream, Finish); Close (Stream.Writer); end if; if Stream.Mode = In_Stream or Stream.Mode = Duplex then Close (Stream.Reader); Free (Stream.Buffer); end if; end Close; ------------ -- Create -- ------------ procedure Create (Stream : out Stream_Type; Mode : in Stream_Mode; Back : in Stream_Access; Back_Compressed : in Boolean; Level : in Compression_Level := Default_Compression; Strategy : in Strategy_Type := Default_Strategy; Header : in Header_Type := Default; Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset := Default_Buffer_Size; Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset := Default_Buffer_Size) is subtype Buffer_Subtype is Stream_Element_Array (1 .. Read_Buffer_Size); procedure Init_Filter (Filter : in out Filter_Type; Compress : in Boolean); ----------------- -- Init_Filter -- ----------------- procedure Init_Filter (Filter : in out Filter_Type; Compress : in Boolean) is begin if Compress then Deflate_Init (Filter, Level, Strategy, Header => Header); else Inflate_Init (Filter, Header => Header); end if; end Init_Filter; begin Stream.Back := Back; Stream.Mode := Mode; if Mode = Out_Stream or Mode = Duplex then Init_Filter (Stream.Writer, Back_Compressed); Stream.Buffer_Size := Write_Buffer_Size; else Stream.Buffer_Size := 0; end if; if Mode = In_Stream or Mode = Duplex then Init_Filter (Stream.Reader, not Back_Compressed); Stream.Buffer := new Buffer_Subtype; Stream.Rest_First := Stream.Buffer'Last + 1; Stream.Rest_Last := Stream.Buffer'Last; end if; end Create; ----------- -- Flush -- ----------- procedure Flush (Stream : in out Stream_Type; Mode : in Flush_Mode := Sync_Flush) is Buffer : Stream_Element_Array (1 .. Stream.Buffer_Size); Last : Stream_Element_Offset; begin loop Flush (Stream.Writer, Buffer, Last, Mode); Ada.Streams.Write (Stream.Back.all, Buffer (1 .. Last)); exit when Last < Buffer'Last; end loop; end Flush; ------------- -- Is_Open -- ------------- function Is_Open (Stream : Stream_Type) return Boolean is begin return Is_Open (Stream.Reader) or else Is_Open (Stream.Writer); end Is_Open; ---------- -- Read -- ---------- procedure Read (Stream : in out Stream_Type; Item : out Stream_Element_Array; Last : out Stream_Element_Offset) is procedure Read (Item : out Stream_Element_Array; Last : out Stream_Element_Offset); ---------- -- Read -- ---------- procedure Read (Item : out Stream_Element_Array; Last : out Stream_Element_Offset) is begin Ada.Streams.Read (Stream.Back.all, Item, Last); end Read; procedure Read is new ZLib.Read (Read => Read, Buffer => Stream.Buffer.all, Rest_First => Stream.Rest_First, Rest_Last => Stream.Rest_Last); begin Read (Stream.Reader, Item, Last); end Read; ------------------- -- Read_Total_In -- ------------------- function Read_Total_In (Stream : in Stream_Type) return Count is begin return Total_In (Stream.Reader); end Read_Total_In; -------------------- -- Read_Total_Out -- -------------------- function Read_Total_Out (Stream : in Stream_Type) return Count is begin return Total_Out (Stream.Reader); end Read_Total_Out; ----------- -- Write -- ----------- procedure Write (Stream : in out Stream_Type; Item : in Stream_Element_Array) is procedure Write (Item : in Stream_Element_Array); ----------- -- Write -- ----------- procedure Write (Item : in Stream_Element_Array) is begin Ada.Streams.Write (Stream.Back.all, Item); end Write; procedure Write is new ZLib.Write (Write => Write, Buffer_Size => Stream.Buffer_Size); begin Write (Stream.Writer, Item, No_Flush); end Write; -------------------- -- Write_Total_In -- -------------------- function Write_Total_In (Stream : in Stream_Type) return Count is begin return Total_In (Stream.Writer); end Write_Total_In; --------------------- -- Write_Total_Out -- --------------------- function Write_Total_Out (Stream : in Stream_Type) return Count is begin return Total_Out (Stream.Writer); end Write_Total_Out; end ZLib.Streams;
AdaCore/gpr
Ada
9,000
adb
-- -- Copyright (C) 2014-2022, AdaCore -- SPDX-License-Identifier: Apache-2.0 -- with Ada.Unchecked_Deallocation; with System; use System; with System.Memory; use System.Memory; package body Gpr_Parser_Support.Generic_Bump_Ptr is use Pages_Vector; procedure Dealloc is new Ada.Unchecked_Deallocation (Bump_Ptr_Pool_Type, Bump_Ptr_Pool); function Align (Size, Alignment : Storage_Offset) return Storage_Offset with Inline; ----------- -- Align -- ----------- function Align (Size, Alignment : Storage_Offset) return Storage_Offset is M : constant Storage_Offset := Size mod Alignment; begin if M = 0 then return Size; else return Size + (Alignment - M); end if; end Align; ------------ -- Create -- ------------ function Create return Bump_Ptr_Pool is begin return new Bump_Ptr_Pool_Type; end Create; ---------- -- Free -- ---------- procedure Free (Pool : in out Bump_Ptr_Pool) is begin if Pool = No_Pool then return; end if; -- Free every page allocated. -- -- TODO: Might be interesting at some point to keep a global cache of -- pages ourself, since we always use the same size. for PI in First_Index (Pool.Pages) .. Last_Index (Pool.Pages) loop Free (Get (Pool.Pages, PI)); end loop; Destroy (Pool.Pages); Dealloc (Pool); end Free; -------------- -- Allocate -- -------------- function Allocate (Pool : Bump_Ptr_Pool; S : Storage_Offset) return System.Address is Obj_Offset : Storage_Offset; begin -- If the required size is bigger than the page size, we'll allocate a -- special page the size of the required object. Basically we fall-back -- on regular alloc mechanism, but this ensures that we can handle all -- allocations transparently via this allocator. if S > Page_Size then declare Mem : constant System.Address := System.Memory.Alloc (size_t (S)); begin -- Append the allocated memory to the pool pages, so that it is -- freed on pool free, but don't touch at the current_page, so -- it can keep being used next time. Append (Pool.Pages, Mem); return Mem; end; end if; -- When we don't have enough space to allocate the chunk, allocate a new -- page. if Page_Size - Pool.Current_Offset < S then Pool.Current_Page := System.Memory.Alloc (System.Memory.size_t (Page_Size)); Append (Pool.Pages, Pool.Current_Page); Pool.Current_Offset := 0; end if; -- Allocation itself is as simple as bumping the offset pointer, and -- returning the old value. Obj_Offset := Pool.Current_Offset; Pool.Current_Offset := Pool.Current_Offset + S; return Pool.Current_Page + Obj_Offset; end Allocate; Pointer_Size : constant Storage_Offset := System.Address'Size / Storage_Unit; ----------- -- Alloc -- ----------- package body Alloc is -- All reads/writes on allocated objects will happen through -- Element_Access, so there should be no issue with strict aliasing. pragma Warnings (Off, "possible aliasing problem for type"); function To_Pointer is new Ada.Unchecked_Conversion (System.Address, Element_Access); pragma Warnings (On, "possible aliasing problem for type"); ----------- -- Alloc -- ----------- function Alloc (Pool : Bump_Ptr_Pool) return Element_Access is begin -- This function just queries the proper size of the Element_T type, -- and converts the return value to the proper access type. return To_Pointer (Allocate (Pool, Align (Element_T'Max_Size_In_Storage_Elements, Pointer_Size))); end Alloc; end Alloc; type Address_Access is access all System.Address; ------------------ -- Tagged_Alloc -- ------------------ package body Tagged_Alloc is T : aliased Element_T; package Gen_Alloc is new Gpr_Parser_Support.Generic_Bump_Ptr.Alloc (Element_T, Element_Access); function Dirty_Conv is new Ada.Unchecked_Conversion (Element_Access, Address_Access); ----------- -- Alloc -- ----------- function Alloc (Pool : Bump_Ptr_Pool) return Element_Access is -- This bit of code is actually quite funny. It is born out of the -- conflation of several unfortunate design choices in Ada: -- 1. The first one is that with Ada memory pools, you have to -- declare the memory pool of your access type at the point of -- definition of the access type. While this is fine and dandy for -- global pools, in our case, when we want a scoped pool that links a -- bunch of object's lifetime to another, this is highly unpractical. -- It would make us declare new types in the scopes where we create -- our object hierarchy, and do horrible casts everywhere. -- 2. As a savvy Ada programmer, we then envision encapsulating this -- logic in a generic. But this is impossible, because you cannot -- declare a representation clause on a type that is declared in -- the scope of a generic. -- 3. Ok, so you cannot encapsulate in a generic. Let's do a memory -- pool manually, like we'd do in C/C++. Problem is, you don't call -- the new operator to instantiate tagged objects, so your tagged -- objects are gonna have no tag! -- 3. No problem, let's hack around it by creating a temp variable of -- the type, and assigning to the newly allocated instance, so that -- the tag is gonna be copied! Except assignment doesn't copy tags in -- Ada. -- Hence we are reduced to this dirty hack, where we'll create a temp -- object, get the tag, and copy it manually in the newly created -- object. This is dirty and completely implementation dependent. -- So here be dragons. -- Post-Scriptum: As it turns out, Ada 2012 memory subpools are -- designed for exactly that purpose. This code survives because -- GNAT's implementation of subpools is on average 10 times slower -- than the ad-hoc allocation. Ret : constant Element_Access := Gen_Alloc.Alloc (Pool); T_Access : constant Element_Access := T'Unchecked_Access; Tag_From : constant Address_Access := Dirty_Conv (T_Access); Tag_To : constant Address_Access := Dirty_Conv (Ret); begin Ret.all := T; Tag_To.all := Tag_From.all; return Ret; end Alloc; end Tagged_Alloc; ----------------- -- Array_Alloc -- ----------------- package body Array_Alloc is ----------- -- Alloc -- ----------- function Alloc (Pool : Bump_Ptr_Pool; Length : Natural) return Element_Array_Access is Stride : constant Storage_Offset := Align (Element_T'Max_Size_In_Storage_Elements, Pointer_Size); Size : constant Storage_Offset := Stride * Storage_Offset (Length); begin return (if Length = 0 then Empty_Array_Access else To_Pointer (Allocate (Pool, Size))); end Alloc; end Array_Alloc; --------------------------- -- Allocate_From_Subpool -- --------------------------- overriding procedure Allocate_From_Subpool (Pool : in out Ada_Bump_Ptr_Pool; Storage_Address : out System.Address; Size_In_Storage_Elements : System.Storage_Elements.Storage_Count; Alignment : System.Storage_Elements.Storage_Count; Subpool : not null Subpool_Handle) is pragma Unreferenced (Pool); begin Storage_Address := Allocate (Bump_Ptr_Pool (Subpool), Align (Size_In_Storage_Elements, Alignment)); end Allocate_From_Subpool; -------------------- -- Create_Subpool -- -------------------- overriding function Create_Subpool (Pool : in out Ada_Bump_Ptr_Pool) return not null Subpool_Handle is Res : constant Bump_Ptr_Pool := Create; Subpool : constant Subpool_Handle := Subpool_Handle (Res); begin Set_Pool_Of_Subpool (Subpool, Pool); return Subpool; end Create_Subpool; ------------------------ -- Deallocate_Subpool -- ------------------------ overriding procedure Deallocate_Subpool (Pool : in out Ada_Bump_Ptr_Pool; Subpool : in out Subpool_Handle) is pragma Unreferenced (Pool); begin Free (Bump_Ptr_Pool (Subpool)); end Deallocate_Subpool; end Gpr_Parser_Support.Generic_Bump_Ptr;
stcarrez/mat
Ada
12,442
adb
----------------------------------------------------------------------- -- mat-targets-probes - Definition and Analysis of process start events -- Copyright (C) 2014, 2015, 2023 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- 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 Bfd; with ELF; with MAT.Formats; with MAT.Readers.Marshaller; package body MAT.Targets.Probes is M_PID : constant MAT.Events.Internal_Reference := 1; M_EXE : constant MAT.Events.Internal_Reference := 2; M_HEAP_START : constant MAT.Events.Internal_Reference := 3; M_HEAP_END : constant MAT.Events.Internal_Reference := 4; M_END : constant MAT.Events.Internal_Reference := 5; M_LIBNAME : constant MAT.Events.Internal_Reference := 6; M_LADDR : constant MAT.Events.Internal_Reference := 7; M_COUNT : constant MAT.Events.Internal_Reference := 8; M_TYPE : constant MAT.Events.Internal_Reference := 9; M_VADDR : constant MAT.Events.Internal_Reference := 10; M_SIZE : constant MAT.Events.Internal_Reference := 11; M_FLAGS : constant MAT.Events.Internal_Reference := 12; PID_NAME : aliased constant String := "pid"; EXE_NAME : aliased constant String := "exe"; HP_START_NAME : aliased constant String := "hp_start"; HP_END_NAME : aliased constant String := "hp_end"; END_NAME : aliased constant String := "end"; LIBNAME_NAME : aliased constant String := "libname"; LADDR_NAME : aliased constant String := "laddr"; COUNT_NAME : aliased constant String := "count"; TYPE_NAME : aliased constant String := "type"; VADDR_NAME : aliased constant String := "vaddr"; SIZE_NAME : aliased constant String := "size"; FLAGS_NAME : aliased constant String := "flags"; Process_Attributes : aliased constant MAT.Events.Attribute_Table := (1 => (Name => PID_NAME'Access, Size => 0, Kind => MAT.Events.T_SIZE_T, Ref => M_PID), 2 => (Name => EXE_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_EXE), 3 => (Name => HP_START_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_HEAP_START), 4 => (Name => HP_END_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_HEAP_END), 5 => (Name => END_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_END)); Library_Attributes : aliased constant MAT.Events.Attribute_Table := (1 => (Name => LIBNAME_NAME'Access, Size => 0, Kind => MAT.Events.T_SIZE_T, Ref => M_LIBNAME), 2 => (Name => LADDR_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_LADDR), 3 => (Name => COUNT_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_COUNT), 4 => (Name => TYPE_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_TYPE), 5 => (Name => VADDR_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_VADDR), 6 => (Name => SIZE_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_SIZE), 7 => (Name => FLAGS_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_FLAGS)); -- ------------------------------ -- Create a new process after the begin event is received from the event stream. -- ------------------------------ procedure Create_Process (Probe : in Process_Probe_Type; Pid : in MAT.Types.Target_Process_Ref; Path : in Ada.Strings.Unbounded.Unbounded_String) is begin Probe.Target.Create_Process (Pid => Pid, Path => Path, Process => Probe.Target.Current); Probe.Target.Process.Events := Probe.Events; Probe.Target.Process.Frames := Probe.Frames; MAT.Memory.Targets.Initialize (Memory => Probe.Target.Process.Memory, Manager => Probe.Manager.all); end Create_Process; procedure Probe_Begin (Probe : in Process_Probe_Type; Defs : in MAT.Events.Attribute_Table; Msg : in out MAT.Readers.Message; Event : in out MAT.Events.Target_Event_Type) is use type MAT.Types.Target_Addr; use type MAT.Events.Attribute_Type; Pid : MAT.Types.Target_Process_Ref := 0; Path : Ada.Strings.Unbounded.Unbounded_String; Heap : MAT.Memory.Region_Info; begin for I in Defs'Range loop declare Def : MAT.Events.Attribute renames Defs (I); begin case Def.Ref is when M_PID => Pid := MAT.Readers.Marshaller.Get_Target_Process_Ref (Msg, Def.Kind); when M_EXE => Path := MAT.Readers.Marshaller.Get_String (Msg); when M_HEAP_START => Heap.Start_Addr := MAT.Readers.Marshaller.Get_Target_Addr (Msg, Def.Kind); when M_HEAP_END => Heap.End_Addr := MAT.Readers.Marshaller.Get_Target_Addr (Msg, Def.Kind); when others => MAT.Readers.Marshaller.Skip (Msg, Def.Size); end case; end; end loop; Heap.Size := Heap.End_Addr - Heap.Start_Addr; Heap.Path := Ada.Strings.Unbounded.To_Unbounded_String ("[heap]"); Event.Addr := Heap.Start_Addr; Event.Size := Heap.Size; Probe.Create_Process (Pid, Path); Probe.Manager.Read_Message (Msg); Probe.Manager.Read_Event_Definitions (Msg); Probe.Target.Process.Memory.Add_Region (Heap); Probe.Target.Process.Endian := MAT.Readers.Get_Endian (Msg); if Probe.Manager.Get_Address_Size = MAT.Events.T_UINT32 then MAT.Formats.Set_Address_Size (8); else MAT.Formats.Set_Address_Size (16); end if; end Probe_Begin; -- ------------------------------ -- Extract the information from the 'library' event. -- ------------------------------ procedure Probe_Library (Probe : in Process_Probe_Type; Defs : in MAT.Events.Attribute_Table; Msg : in out MAT.Readers.Message; Event : in out MAT.Events.Target_Event_Type) is use type MAT.Types.Target_Addr; Count : MAT.Types.Target_Size := 0; Path : Ada.Strings.Unbounded.Unbounded_String; Addr : MAT.Types.Target_Addr; Pos : Natural := Defs'Last + 1; Offset : MAT.Types.Target_Addr; begin for I in Defs'Range loop declare Def : MAT.Events.Attribute renames Defs (I); begin case Def.Ref is when M_COUNT => Count := MAT.Readers.Marshaller.Get_Target_Size (Msg, Def.Kind); Pos := I + 1; exit; when M_LIBNAME => Path := MAT.Readers.Marshaller.Get_String (Msg); when M_LADDR => Addr := MAT.Readers.Marshaller.Get_Target_Addr (Msg, Def.Kind); when others => MAT.Readers.Marshaller.Skip (Msg, Def.Size); end case; end; end loop; Event.Addr := Addr; Event.Size := 0; for Region in 1 .. Count loop declare Region : MAT.Memory.Region_Info; Kind : ELF.Elf32_Word := 0; begin for I in Pos .. Defs'Last loop declare Def : MAT.Events.Attribute renames Defs (I); begin case Def.Ref is when M_SIZE => Region.Size := MAT.Readers.Marshaller.Get_Target_Size (Msg, Def.Kind); when M_VADDR => Region.Start_Addr := MAT.Readers.Marshaller.Get_Target_Addr (Msg, Def.Kind); when M_TYPE => Kind := MAT.Readers.Marshaller.Get_Target_Uint32 (Msg, Def.Kind); when M_FLAGS => Region.Flags := MAT.Readers.Marshaller.Get_Target_Uint32 (Msg, Def.Kind); when others => MAT.Readers.Marshaller.Skip (Msg, Def.Size); end case; end; end loop; if Kind = ELF.PT_LOAD then Region.Start_Addr := Addr + Region.Start_Addr; Region.End_Addr := Region.Start_Addr + Region.Size; if Ada.Strings.Unbounded.Length (Path) = 0 then Region.Path := Probe.Target.Process.Path; Offset := 0; else Region.Path := Path; Offset := Region.Start_Addr; end if; Event.Size := Event.Size + Region.Size; Region.Offset := Addr; Probe.Target.Process.Memory.Add_Region (Region); -- When auto-symbol loading is enabled, load the symbols associated with the -- shared libraries used by the program. if Probe.Target.Options.Load_Symbols then begin Probe.Target.Process.Symbols.Value.Load_Symbols (Region, Addr); exception when Bfd.OPEN_ERROR => Probe.Target.Console.Error ("Cannot open symbol library file '" & Ada.Strings.Unbounded.To_String (Region.Path) & "'"); end; end if; end if; end; end loop; end Probe_Library; overriding procedure Extract (Probe : in Process_Probe_Type; Params : in MAT.Events.Const_Attribute_Table_Access; Msg : in out MAT.Readers.Message_Type; Event : in out MAT.Events.Target_Event_Type) is use type MAT.Events.Probe_Index_Type; begin if Event.Index = MAT.Events.MSG_BEGIN then Probe.Probe_Begin (Params.all, Msg, Event); elsif Event.Index = MAT.Events.MSG_LIBRARY then Probe.Probe_Library (Params.all, Msg, Event); end if; end Extract; procedure Execute (Probe : in Process_Probe_Type; Event : in out MAT.Events.Target_Event_Type) is begin null; end Execute; -- ------------------------------ -- Register the reader to extract and analyze process events. -- ------------------------------ procedure Register (Into : in out MAT.Events.Probes.Probe_Manager_Type'Class; Probe : in Process_Probe_Type_Access) is begin Probe.Manager := Into'Unchecked_Access; Into.Register_Probe (Probe.all'Access, "begin", MAT.Events.MSG_BEGIN, Process_Attributes'Access); Into.Register_Probe (Probe.all'Access, "end", MAT.Events.MSG_END, Process_Attributes'Access); Into.Register_Probe (Probe.all'Access, "shlib", MAT.Events.MSG_LIBRARY, Library_Attributes'Access); end Register; -- ------------------------------ -- Initialize the target object to prepare for reading process events. -- ------------------------------ procedure Initialize (Target : in out Target_Type; Manager : in out MAT.Events.Probes.Probe_Manager_Type'Class) is Process_Probe : constant Process_Probe_Type_Access := new Process_Probe_Type; begin Process_Probe.Target := Target'Unrestricted_Access; Process_Probe.Events := Manager.Get_Target_Events; Process_Probe.Frames := Manager.Get_Target_Frames; Register (Manager, Process_Probe); end Initialize; end MAT.Targets.Probes;
reznikmm/matreshka
Ada
3,551
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with FastCGI.Application; package Matreshka.FastCGI.Streaming_Server is procedure Execute (Responder_Factory : Standard.FastCGI.Application.Responder_Factory); end Matreshka.FastCGI.Streaming_Server;
reznikmm/matreshka
Ada
5,035
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- An execution occurrence specification represents moments in time at which -- actions or behaviors start or finish. ------------------------------------------------------------------------------ limited with AMF.UML.Execution_Specifications; with AMF.UML.Occurrence_Specifications; package AMF.UML.Execution_Occurrence_Specifications is pragma Preelaborate; type UML_Execution_Occurrence_Specification is limited interface and AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification; type UML_Execution_Occurrence_Specification_Access is access all UML_Execution_Occurrence_Specification'Class; for UML_Execution_Occurrence_Specification_Access'Storage_Size use 0; not overriding function Get_Execution (Self : not null access constant UML_Execution_Occurrence_Specification) return AMF.UML.Execution_Specifications.UML_Execution_Specification_Access is abstract; -- Getter of ExecutionOccurrenceSpecification::execution. -- -- References the execution specification describing the execution that is -- started or finished at this execution event. not overriding procedure Set_Execution (Self : not null access UML_Execution_Occurrence_Specification; To : AMF.UML.Execution_Specifications.UML_Execution_Specification_Access) is abstract; -- Setter of ExecutionOccurrenceSpecification::execution. -- -- References the execution specification describing the execution that is -- started or finished at this execution event. end AMF.UML.Execution_Occurrence_Specifications;
reznikmm/matreshka
Ada
3,704
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Table_Execute_Attributes is pragma Preelaborate; type ODF_Table_Execute_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Table_Execute_Attribute_Access is access all ODF_Table_Execute_Attribute'Class with Storage_Size => 0; end ODF.DOM.Table_Execute_Attributes;
reznikmm/matreshka
Ada
4,010
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Strings.Wide_Wide_Fixed; with AMF.Holders.Unlimited_Naturals; separate (AMF.Internals.Factories.CMOF_Factories) function Convert_Unlimited_Natural_To_String (Value : League.Holders.Holder) return League.Strings.Universal_String is begin if AMF.Holders.Unlimited_Naturals.Element (Value).Unlimited then return League.Strings.To_Universal_String ("*"); else return League.Strings.To_Universal_String (Ada.Strings.Wide_Wide_Fixed.Trim (Natural'Wide_Wide_Image (AMF.Holders.Unlimited_Naturals.Element (Value).Value), Ada.Strings.Both)); end if; end Convert_Unlimited_Natural_To_String;
rveenker/sdlada
Ada
1,715
adb
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2020, Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- package body SDL.Video.Windows.Manager is function Get_WM_Info (Win : in Window; Info : out WM_Info) return Boolean is function SDL_Get_Window_WM_Info (W : in SDL.C_Pointers.Windows_Pointer; Info : out WM_Info) return SDL_Bool with Import => True, Convention => C, External_Name => "SDL_GetWindowWMInfo"; Result : SDL_Bool := SDL_Get_Window_WM_Info (Win.Internal, Info); begin return (if Result = SDL_True then True else False); end Get_WM_Info; end SDL.Video.Windows.Manager;
reznikmm/gela
Ada
6,724
ads
-- This package provides Environment_Set interface and its methods. with Gela.Defining_Name_Cursors; with Gela.Elements.Defining_Names; with Gela.Lexical_Types; with Gela.Semantic_Types; package Gela.Environments is pragma Preelaborate; type Environment_Set is limited interface; type Environment_Set_Access is access all Environment_Set'Class; for Environment_Set_Access'Storage_Size use 0; not overriding function Library_Level_Environment (Self : Environment_Set) return Gela.Semantic_Types.Env_Index is abstract; -- Return environment that incudes only library level names. not overriding function Add_With_Clause (Self : in out Environment_Set; Index : Gela.Semantic_Types.Env_Index; Symbol : Gela.Lexical_Types.Symbol) return Gela.Semantic_Types.Env_Index is abstract; -- Create new environment by adding with clause for given Symbol -- to provided env with given Index. Return index of created environment not overriding function Library_Unit_Environment (Self : access Environment_Set; Symbol : Gela.Lexical_Types.Symbol) return Gela.Semantic_Types.Env_Index is abstract; -- Return environment index corresponding to unit of given Symbol -- This environment points to region of corresponding declaration and -- includes all child units at the end of region. not overriding procedure Set_Library_Unit_Environment (Self : access Environment_Set; Symbol : Gela.Lexical_Types.Symbol; Value : Gela.Semantic_Types.Env_Index) is abstract; -- Save environment index as corresponding to unit of given Symbol -- After Value set as library unit environment for given Symbol -- any call to Add_Defining_Name will update mapping for the Symbol. not overriding function Direct_Visible (Self : access Environment_Set; Index : Gela.Semantic_Types.Env_Index; Symbol : Gela.Lexical_Types.Symbol) return Gela.Defining_Name_Cursors.Defining_Name_Cursor'Class is abstract; -- Return list of direct visible defining names from the environment -- pointed by Index with given Symbol. not overriding function Use_Visible (Self : access Environment_Set; Index : Gela.Semantic_Types.Env_Index; Symbol : Gela.Lexical_Types.Symbol) return Gela.Defining_Name_Cursors.Defining_Name_Cursor'Class is abstract; -- Return list of use visible defining names from the environment -- pointed by Index with given Symbol. not overriding function Visible (Self : access Environment_Set; Index : Gela.Semantic_Types.Env_Index; Region : Gela.Elements.Defining_Names.Defining_Name_Access; Symbol : Gela.Lexical_Types.Symbol; Found : access Boolean) return Gela.Defining_Name_Cursors.Defining_Name_Cursor'Class is abstract; -- Return list of defining names from the environment pointed by Index -- with given Symbol which visible inside declarative region corresponding -- to given Region name. Return Found = False if no such region found. -- If Region is null, use current (top) region to search in. not overriding function Add_Defining_Name (Self : in out Environment_Set; Index : Gela.Semantic_Types.Env_Index; Symbol : Gela.Lexical_Types.Symbol; Name : Gela.Elements.Defining_Names.Defining_Name_Access) return Gela.Semantic_Types.Env_Index is abstract; -- Create new environment by adding (Symbol, Name) to provided env with -- given Index. Return index of created environment not overriding function Add_Use_Package (Self : in out Environment_Set; Index : Gela.Semantic_Types.Env_Index; Name : Gela.Elements.Defining_Names.Defining_Name_Access) return Gela.Semantic_Types.Env_Index is abstract; -- Create new environment by adding use package <Name> to provided env -- with given Index. Return index of created environment not overriding function Add_Rename_Package (Self : in out Environment_Set; Index : Gela.Semantic_Types.Env_Index; Region : Gela.Elements.Defining_Names.Defining_Name_Access; Name : Gela.Elements.Defining_Names.Defining_Name_Access) return Gela.Semantic_Types.Env_Index is abstract; -- Create new environment by adding package <Region> renames <Name> to env -- with given Index. Return index of created environment not overriding function Add_Completion (Self : in out Environment_Set; Index : Gela.Semantic_Types.Env_Index; Name : Gela.Elements.Defining_Names.Defining_Name_Access; Completion : Gela.Elements.Defining_Names.Defining_Name_Access) return Gela.Semantic_Types.Env_Index is abstract; -- Create new environment by adding (Name -> Completion) mapping to -- provided env with given Index. Return index of created environment subtype Completion_Index is Natural range 0 .. 6; type Completion_Array is array (Completion_Index range <>) of Gela.Elements.Defining_Names.Defining_Name_Access; type Completion_List (Length : Completion_Index := 0) is record Data : Completion_Array (1 .. Length); end record; not overriding function Completions (Self : in out Environment_Set; Index : Gela.Semantic_Types.Env_Index; Name : Gela.Elements.Defining_Names.Defining_Name_Access) return Completion_List is abstract; -- Find completions for given Name in provided env with given Index. not overriding function Enter_Declarative_Region (Self : access Environment_Set; Index : Gela.Semantic_Types.Env_Index; Region : Gela.Elements.Defining_Names.Defining_Name_Access) return Gela.Semantic_Types.Env_Index is abstract; -- Create new environment by extending provided env with new empty -- declarative region named by Region defining name. -- Return index of created environment not overriding function Enter_Completion_Region (Self : access Environment_Set; Index : Gela.Semantic_Types.Env_Index; Region : Gela.Elements.Defining_Names.Defining_Name_Access) return Gela.Semantic_Types.Env_Index is abstract; -- Create new environment by extending provided env with completion of -- declarative region named by Region defining name. -- Return index of created environment not overriding function Leave_Declarative_Region (Self : access Environment_Set; Index : Gela.Semantic_Types.Env_Index) return Gela.Semantic_Types.Env_Index is abstract; -- Create new environment by closing top declarative region in provided env -- Return index of created environment end Gela.Environments;
tum-ei-rcs/StratoX
Ada
79,629
ads
-- -- Copyright (C) 2016, AdaCore -- -- This spec has been automatically generated from STM32F429x.svd pragma Ada_2012; with Interfaces.Bit_Types; with System; package Interfaces.STM32.RCC is pragma Preelaborate; pragma No_Elaboration_Code_All; --------------- -- Registers -- --------------- ----------------- -- CR_Register -- ----------------- subtype CR_HSION_Field is Interfaces.Bit_Types.Bit; subtype CR_HSIRDY_Field is Interfaces.Bit_Types.Bit; subtype CR_HSITRIM_Field is Interfaces.Bit_Types.UInt5; subtype CR_HSICAL_Field is Interfaces.Bit_Types.Byte; subtype CR_HSEON_Field is Interfaces.Bit_Types.Bit; subtype CR_HSERDY_Field is Interfaces.Bit_Types.Bit; subtype CR_HSEBYP_Field is Interfaces.Bit_Types.Bit; subtype CR_CSSON_Field is Interfaces.Bit_Types.Bit; subtype CR_PLLON_Field is Interfaces.Bit_Types.Bit; subtype CR_PLLRDY_Field is Interfaces.Bit_Types.Bit; subtype CR_PLLI2SON_Field is Interfaces.Bit_Types.Bit; subtype CR_PLLI2SRDY_Field is Interfaces.Bit_Types.Bit; -- clock control register type CR_Register is record -- Internal high-speed clock enable HSION : CR_HSION_Field := 16#1#; -- Read-only. Internal high-speed clock ready flag HSIRDY : CR_HSIRDY_Field := 16#1#; -- unspecified Reserved_2_2 : Interfaces.Bit_Types.Bit := 16#0#; -- Internal high-speed clock trimming HSITRIM : CR_HSITRIM_Field := 16#10#; -- Read-only. Internal high-speed clock calibration HSICAL : CR_HSICAL_Field := 16#0#; -- HSE clock enable HSEON : CR_HSEON_Field := 16#0#; -- Read-only. HSE clock ready flag HSERDY : CR_HSERDY_Field := 16#0#; -- HSE clock bypass HSEBYP : CR_HSEBYP_Field := 16#0#; -- Clock security system enable CSSON : CR_CSSON_Field := 16#0#; -- unspecified Reserved_20_23 : Interfaces.Bit_Types.UInt4 := 16#0#; -- Main PLL (PLL) enable PLLON : CR_PLLON_Field := 16#0#; -- Read-only. Main PLL (PLL) clock ready flag PLLRDY : CR_PLLRDY_Field := 16#0#; -- PLLI2S enable PLLI2SON : CR_PLLI2SON_Field := 16#0#; -- Read-only. PLLI2S clock ready flag PLLI2SRDY : CR_PLLI2SRDY_Field := 16#0#; -- unspecified Reserved_28_31 : Interfaces.Bit_Types.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR_Register use record HSION at 0 range 0 .. 0; HSIRDY at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; HSITRIM at 0 range 3 .. 7; HSICAL at 0 range 8 .. 15; HSEON at 0 range 16 .. 16; HSERDY at 0 range 17 .. 17; HSEBYP at 0 range 18 .. 18; CSSON at 0 range 19 .. 19; Reserved_20_23 at 0 range 20 .. 23; PLLON at 0 range 24 .. 24; PLLRDY at 0 range 25 .. 25; PLLI2SON at 0 range 26 .. 26; PLLI2SRDY at 0 range 27 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; ---------------------- -- PLLCFGR_Register -- ---------------------- subtype PLLCFGR_PLLM_Field is Interfaces.Bit_Types.UInt6; subtype PLLCFGR_PLLN_Field is Interfaces.Bit_Types.UInt9; subtype PLLCFGR_PLLP_Field is Interfaces.Bit_Types.UInt2; subtype PLLCFGR_PLLSRC_Field is Interfaces.Bit_Types.Bit; subtype PLLCFGR_PLLQ_Field is Interfaces.Bit_Types.UInt4; -- PLL configuration register type PLLCFGR_Register is record -- Division factor for the main PLL (PLL) and audio PLL (PLLI2S) input -- clock PLLM : PLLCFGR_PLLM_Field := 16#10#; -- Main PLL (PLL) multiplication factor for VCO PLLN : PLLCFGR_PLLN_Field := 16#C0#; -- unspecified Reserved_15_15 : Interfaces.Bit_Types.Bit := 16#0#; -- Main PLL (PLL) division factor for main system clock PLLP : PLLCFGR_PLLP_Field := 16#0#; -- unspecified Reserved_18_21 : Interfaces.Bit_Types.UInt4 := 16#0#; -- Main PLL(PLL) and audio PLL (PLLI2S) entry clock source PLLSRC : PLLCFGR_PLLSRC_Field := 16#0#; -- unspecified Reserved_23_23 : Interfaces.Bit_Types.Bit := 16#0#; -- Main PLL (PLL) division factor for USB OTG FS, SDIO and random number -- generator clocks PLLQ : PLLCFGR_PLLQ_Field := 16#4#; -- unspecified Reserved_28_31 : Interfaces.Bit_Types.UInt4 := 16#2#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PLLCFGR_Register use record PLLM at 0 range 0 .. 5; PLLN at 0 range 6 .. 14; Reserved_15_15 at 0 range 15 .. 15; PLLP at 0 range 16 .. 17; Reserved_18_21 at 0 range 18 .. 21; PLLSRC at 0 range 22 .. 22; Reserved_23_23 at 0 range 23 .. 23; PLLQ at 0 range 24 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; ------------------- -- CFGR_Register -- ------------------- subtype CFGR_SW_Field is Interfaces.Bit_Types.UInt2; subtype CFGR_SWS_Field is Interfaces.Bit_Types.UInt2; subtype CFGR_HPRE_Field is Interfaces.Bit_Types.UInt4; --------------- -- CFGR.PPRE -- --------------- -- CFGR_PPRE array element subtype CFGR_PPRE_Element is Interfaces.Bit_Types.UInt3; -- CFGR_PPRE array type CFGR_PPRE_Field_Array is array (1 .. 2) of CFGR_PPRE_Element with Component_Size => 3, Size => 6; -- Type definition for CFGR_PPRE type CFGR_PPRE_Field (As_Array : Boolean := False) is record case As_Array is when False => -- PPRE as a value Val : Interfaces.Bit_Types.UInt6; when True => -- PPRE as an array Arr : CFGR_PPRE_Field_Array; end case; end record with Unchecked_Union, Size => 6; for CFGR_PPRE_Field use record Val at 0 range 0 .. 5; Arr at 0 range 0 .. 5; end record; subtype CFGR_RTCPRE_Field is Interfaces.Bit_Types.UInt5; subtype CFGR_MCO1_Field is Interfaces.Bit_Types.UInt2; subtype CFGR_I2SSRC_Field is Interfaces.Bit_Types.Bit; subtype CFGR_MCO1PRE_Field is Interfaces.Bit_Types.UInt3; subtype CFGR_MCO2PRE_Field is Interfaces.Bit_Types.UInt3; subtype CFGR_MCO2_Field is Interfaces.Bit_Types.UInt2; -- clock configuration register type CFGR_Register is record -- System clock switch SW : CFGR_SW_Field := 16#0#; -- Read-only. System clock switch status SWS : CFGR_SWS_Field := 16#0#; -- AHB prescaler HPRE : CFGR_HPRE_Field := 16#0#; -- unspecified Reserved_8_9 : Interfaces.Bit_Types.UInt2 := 16#0#; -- APB Low speed prescaler (APB1) PPRE : CFGR_PPRE_Field := (As_Array => False, Val => 16#0#); -- HSE division factor for RTC clock RTCPRE : CFGR_RTCPRE_Field := 16#0#; -- Microcontroller clock output 1 MCO1 : CFGR_MCO1_Field := 16#0#; -- I2S clock selection I2SSRC : CFGR_I2SSRC_Field := 16#0#; -- MCO1 prescaler MCO1PRE : CFGR_MCO1PRE_Field := 16#0#; -- MCO2 prescaler MCO2PRE : CFGR_MCO2PRE_Field := 16#0#; -- Microcontroller clock output 2 MCO2 : CFGR_MCO2_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CFGR_Register use record SW at 0 range 0 .. 1; SWS at 0 range 2 .. 3; HPRE at 0 range 4 .. 7; Reserved_8_9 at 0 range 8 .. 9; PPRE at 0 range 10 .. 15; RTCPRE at 0 range 16 .. 20; MCO1 at 0 range 21 .. 22; I2SSRC at 0 range 23 .. 23; MCO1PRE at 0 range 24 .. 26; MCO2PRE at 0 range 27 .. 29; MCO2 at 0 range 30 .. 31; end record; ------------------ -- CIR_Register -- ------------------ subtype CIR_LSIRDYF_Field is Interfaces.Bit_Types.Bit; subtype CIR_LSERDYF_Field is Interfaces.Bit_Types.Bit; subtype CIR_HSIRDYF_Field is Interfaces.Bit_Types.Bit; subtype CIR_HSERDYF_Field is Interfaces.Bit_Types.Bit; subtype CIR_PLLRDYF_Field is Interfaces.Bit_Types.Bit; subtype CIR_PLLI2SRDYF_Field is Interfaces.Bit_Types.Bit; subtype CIR_PLLSAIRDYF_Field is Interfaces.Bit_Types.Bit; subtype CIR_CSSF_Field is Interfaces.Bit_Types.Bit; subtype CIR_LSIRDYIE_Field is Interfaces.Bit_Types.Bit; subtype CIR_LSERDYIE_Field is Interfaces.Bit_Types.Bit; subtype CIR_HSIRDYIE_Field is Interfaces.Bit_Types.Bit; subtype CIR_HSERDYIE_Field is Interfaces.Bit_Types.Bit; subtype CIR_PLLRDYIE_Field is Interfaces.Bit_Types.Bit; subtype CIR_PLLI2SRDYIE_Field is Interfaces.Bit_Types.Bit; subtype CIR_PLLSAIRDYIE_Field is Interfaces.Bit_Types.Bit; subtype CIR_LSIRDYC_Field is Interfaces.Bit_Types.Bit; subtype CIR_LSERDYC_Field is Interfaces.Bit_Types.Bit; subtype CIR_HSIRDYC_Field is Interfaces.Bit_Types.Bit; subtype CIR_HSERDYC_Field is Interfaces.Bit_Types.Bit; subtype CIR_PLLRDYC_Field is Interfaces.Bit_Types.Bit; subtype CIR_PLLI2SRDYC_Field is Interfaces.Bit_Types.Bit; subtype CIR_PLLSAIRDYC_Field is Interfaces.Bit_Types.Bit; subtype CIR_CSSC_Field is Interfaces.Bit_Types.Bit; -- clock interrupt register type CIR_Register is record -- Read-only. LSI ready interrupt flag LSIRDYF : CIR_LSIRDYF_Field := 16#0#; -- Read-only. LSE ready interrupt flag LSERDYF : CIR_LSERDYF_Field := 16#0#; -- Read-only. HSI ready interrupt flag HSIRDYF : CIR_HSIRDYF_Field := 16#0#; -- Read-only. HSE ready interrupt flag HSERDYF : CIR_HSERDYF_Field := 16#0#; -- Read-only. Main PLL (PLL) ready interrupt flag PLLRDYF : CIR_PLLRDYF_Field := 16#0#; -- Read-only. PLLI2S ready interrupt flag PLLI2SRDYF : CIR_PLLI2SRDYF_Field := 16#0#; -- Read-only. PLLSAI ready interrupt flag PLLSAIRDYF : CIR_PLLSAIRDYF_Field := 16#0#; -- Read-only. Clock security system interrupt flag CSSF : CIR_CSSF_Field := 16#0#; -- LSI ready interrupt enable LSIRDYIE : CIR_LSIRDYIE_Field := 16#0#; -- LSE ready interrupt enable LSERDYIE : CIR_LSERDYIE_Field := 16#0#; -- HSI ready interrupt enable HSIRDYIE : CIR_HSIRDYIE_Field := 16#0#; -- HSE ready interrupt enable HSERDYIE : CIR_HSERDYIE_Field := 16#0#; -- Main PLL (PLL) ready interrupt enable PLLRDYIE : CIR_PLLRDYIE_Field := 16#0#; -- PLLI2S ready interrupt enable PLLI2SRDYIE : CIR_PLLI2SRDYIE_Field := 16#0#; -- PLLSAI Ready Interrupt Enable PLLSAIRDYIE : CIR_PLLSAIRDYIE_Field := 16#0#; -- unspecified Reserved_15_15 : Interfaces.Bit_Types.Bit := 16#0#; -- Write-only. LSI ready interrupt clear LSIRDYC : CIR_LSIRDYC_Field := 16#0#; -- Write-only. LSE ready interrupt clear LSERDYC : CIR_LSERDYC_Field := 16#0#; -- Write-only. HSI ready interrupt clear HSIRDYC : CIR_HSIRDYC_Field := 16#0#; -- Write-only. HSE ready interrupt clear HSERDYC : CIR_HSERDYC_Field := 16#0#; -- Write-only. Main PLL(PLL) ready interrupt clear PLLRDYC : CIR_PLLRDYC_Field := 16#0#; -- Write-only. PLLI2S ready interrupt clear PLLI2SRDYC : CIR_PLLI2SRDYC_Field := 16#0#; -- Write-only. PLLSAI Ready Interrupt Clear PLLSAIRDYC : CIR_PLLSAIRDYC_Field := 16#0#; -- Write-only. Clock security system interrupt clear CSSC : CIR_CSSC_Field := 16#0#; -- unspecified Reserved_24_31 : Interfaces.Bit_Types.Byte := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CIR_Register use record LSIRDYF at 0 range 0 .. 0; LSERDYF at 0 range 1 .. 1; HSIRDYF at 0 range 2 .. 2; HSERDYF at 0 range 3 .. 3; PLLRDYF at 0 range 4 .. 4; PLLI2SRDYF at 0 range 5 .. 5; PLLSAIRDYF at 0 range 6 .. 6; CSSF at 0 range 7 .. 7; LSIRDYIE at 0 range 8 .. 8; LSERDYIE at 0 range 9 .. 9; HSIRDYIE at 0 range 10 .. 10; HSERDYIE at 0 range 11 .. 11; PLLRDYIE at 0 range 12 .. 12; PLLI2SRDYIE at 0 range 13 .. 13; PLLSAIRDYIE at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; LSIRDYC at 0 range 16 .. 16; LSERDYC at 0 range 17 .. 17; HSIRDYC at 0 range 18 .. 18; HSERDYC at 0 range 19 .. 19; PLLRDYC at 0 range 20 .. 20; PLLI2SRDYC at 0 range 21 .. 21; PLLSAIRDYC at 0 range 22 .. 22; CSSC at 0 range 23 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; ----------------------- -- AHB1RSTR_Register -- ----------------------- subtype AHB1RSTR_GPIOARST_Field is Interfaces.Bit_Types.Bit; subtype AHB1RSTR_GPIOBRST_Field is Interfaces.Bit_Types.Bit; subtype AHB1RSTR_GPIOCRST_Field is Interfaces.Bit_Types.Bit; subtype AHB1RSTR_GPIODRST_Field is Interfaces.Bit_Types.Bit; subtype AHB1RSTR_GPIOERST_Field is Interfaces.Bit_Types.Bit; subtype AHB1RSTR_GPIOFRST_Field is Interfaces.Bit_Types.Bit; subtype AHB1RSTR_GPIOGRST_Field is Interfaces.Bit_Types.Bit; subtype AHB1RSTR_GPIOHRST_Field is Interfaces.Bit_Types.Bit; subtype AHB1RSTR_GPIOIRST_Field is Interfaces.Bit_Types.Bit; subtype AHB1RSTR_GPIOJRST_Field is Interfaces.Bit_Types.Bit; subtype AHB1RSTR_GPIOKRST_Field is Interfaces.Bit_Types.Bit; subtype AHB1RSTR_CRCRST_Field is Interfaces.Bit_Types.Bit; subtype AHB1RSTR_DMA1RST_Field is Interfaces.Bit_Types.Bit; subtype AHB1RSTR_DMA2RST_Field is Interfaces.Bit_Types.Bit; subtype AHB1RSTR_DMA2DRST_Field is Interfaces.Bit_Types.Bit; subtype AHB1RSTR_ETHMACRST_Field is Interfaces.Bit_Types.Bit; subtype AHB1RSTR_OTGHSRST_Field is Interfaces.Bit_Types.Bit; -- AHB1 peripheral reset register type AHB1RSTR_Register is record -- IO port A reset GPIOARST : AHB1RSTR_GPIOARST_Field := 16#0#; -- IO port B reset GPIOBRST : AHB1RSTR_GPIOBRST_Field := 16#0#; -- IO port C reset GPIOCRST : AHB1RSTR_GPIOCRST_Field := 16#0#; -- IO port D reset GPIODRST : AHB1RSTR_GPIODRST_Field := 16#0#; -- IO port E reset GPIOERST : AHB1RSTR_GPIOERST_Field := 16#0#; -- IO port F reset GPIOFRST : AHB1RSTR_GPIOFRST_Field := 16#0#; -- IO port G reset GPIOGRST : AHB1RSTR_GPIOGRST_Field := 16#0#; -- IO port H reset GPIOHRST : AHB1RSTR_GPIOHRST_Field := 16#0#; -- IO port I reset GPIOIRST : AHB1RSTR_GPIOIRST_Field := 16#0#; -- IO port J reset GPIOJRST : AHB1RSTR_GPIOJRST_Field := 16#0#; -- IO port K reset GPIOKRST : AHB1RSTR_GPIOKRST_Field := 16#0#; -- unspecified Reserved_11_11 : Interfaces.Bit_Types.Bit := 16#0#; -- CRC reset CRCRST : AHB1RSTR_CRCRST_Field := 16#0#; -- unspecified Reserved_13_20 : Interfaces.Bit_Types.Byte := 16#0#; -- DMA2 reset DMA1RST : AHB1RSTR_DMA1RST_Field := 16#0#; -- DMA2 reset DMA2RST : AHB1RSTR_DMA2RST_Field := 16#0#; -- DMA2D reset DMA2DRST : AHB1RSTR_DMA2DRST_Field := 16#0#; -- unspecified Reserved_24_24 : Interfaces.Bit_Types.Bit := 16#0#; -- Ethernet MAC reset ETHMACRST : AHB1RSTR_ETHMACRST_Field := 16#0#; -- unspecified Reserved_26_28 : Interfaces.Bit_Types.UInt3 := 16#0#; -- USB OTG HS module reset OTGHSRST : AHB1RSTR_OTGHSRST_Field := 16#0#; -- unspecified Reserved_30_31 : Interfaces.Bit_Types.UInt2 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for AHB1RSTR_Register use record GPIOARST at 0 range 0 .. 0; GPIOBRST at 0 range 1 .. 1; GPIOCRST at 0 range 2 .. 2; GPIODRST at 0 range 3 .. 3; GPIOERST at 0 range 4 .. 4; GPIOFRST at 0 range 5 .. 5; GPIOGRST at 0 range 6 .. 6; GPIOHRST at 0 range 7 .. 7; GPIOIRST at 0 range 8 .. 8; GPIOJRST at 0 range 9 .. 9; GPIOKRST at 0 range 10 .. 10; Reserved_11_11 at 0 range 11 .. 11; CRCRST at 0 range 12 .. 12; Reserved_13_20 at 0 range 13 .. 20; DMA1RST at 0 range 21 .. 21; DMA2RST at 0 range 22 .. 22; DMA2DRST at 0 range 23 .. 23; Reserved_24_24 at 0 range 24 .. 24; ETHMACRST at 0 range 25 .. 25; Reserved_26_28 at 0 range 26 .. 28; OTGHSRST at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; ----------------------- -- AHB2RSTR_Register -- ----------------------- subtype AHB2RSTR_DCMIRST_Field is Interfaces.Bit_Types.Bit; subtype AHB2RSTR_RNGRST_Field is Interfaces.Bit_Types.Bit; subtype AHB2RSTR_OTGFSRST_Field is Interfaces.Bit_Types.Bit; -- AHB2 peripheral reset register type AHB2RSTR_Register is record -- Camera interface reset DCMIRST : AHB2RSTR_DCMIRST_Field := 16#0#; -- unspecified Reserved_1_5 : Interfaces.Bit_Types.UInt5 := 16#0#; -- Random number generator module reset RNGRST : AHB2RSTR_RNGRST_Field := 16#0#; -- USB OTG FS module reset OTGFSRST : AHB2RSTR_OTGFSRST_Field := 16#0#; -- unspecified Reserved_8_31 : Interfaces.Bit_Types.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for AHB2RSTR_Register use record DCMIRST at 0 range 0 .. 0; Reserved_1_5 at 0 range 1 .. 5; RNGRST at 0 range 6 .. 6; OTGFSRST at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; ----------------------- -- AHB3RSTR_Register -- ----------------------- subtype AHB3RSTR_FMCRST_Field is Interfaces.Bit_Types.Bit; -- AHB3 peripheral reset register type AHB3RSTR_Register is record -- Flexible memory controller module reset FMCRST : AHB3RSTR_FMCRST_Field := 16#0#; -- unspecified Reserved_1_31 : Interfaces.Bit_Types.UInt31 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for AHB3RSTR_Register use record FMCRST at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; ----------------------- -- APB1RSTR_Register -- ----------------------- subtype APB1RSTR_TIM2RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_TIM3RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_TIM4RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_TIM5RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_TIM6RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_TIM7RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_TIM12RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_TIM13RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_TIM14RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_WWDGRST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_SPI2RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_SPI3RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_UART2RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_UART3RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_UART4RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_UART5RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_I2C1RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_I2C2RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_I2C3RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_CAN1RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_CAN2RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_PWRRST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_DACRST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_UART7RST_Field is Interfaces.Bit_Types.Bit; subtype APB1RSTR_UART8RST_Field is Interfaces.Bit_Types.Bit; -- APB1 peripheral reset register type APB1RSTR_Register is record -- TIM2 reset TIM2RST : APB1RSTR_TIM2RST_Field := 16#0#; -- TIM3 reset TIM3RST : APB1RSTR_TIM3RST_Field := 16#0#; -- TIM4 reset TIM4RST : APB1RSTR_TIM4RST_Field := 16#0#; -- TIM5 reset TIM5RST : APB1RSTR_TIM5RST_Field := 16#0#; -- TIM6 reset TIM6RST : APB1RSTR_TIM6RST_Field := 16#0#; -- TIM7 reset TIM7RST : APB1RSTR_TIM7RST_Field := 16#0#; -- TIM12 reset TIM12RST : APB1RSTR_TIM12RST_Field := 16#0#; -- TIM13 reset TIM13RST : APB1RSTR_TIM13RST_Field := 16#0#; -- TIM14 reset TIM14RST : APB1RSTR_TIM14RST_Field := 16#0#; -- unspecified Reserved_9_10 : Interfaces.Bit_Types.UInt2 := 16#0#; -- Window watchdog reset WWDGRST : APB1RSTR_WWDGRST_Field := 16#0#; -- unspecified Reserved_12_13 : Interfaces.Bit_Types.UInt2 := 16#0#; -- SPI 2 reset SPI2RST : APB1RSTR_SPI2RST_Field := 16#0#; -- SPI 3 reset SPI3RST : APB1RSTR_SPI3RST_Field := 16#0#; -- unspecified Reserved_16_16 : Interfaces.Bit_Types.Bit := 16#0#; -- USART 2 reset UART2RST : APB1RSTR_UART2RST_Field := 16#0#; -- USART 3 reset UART3RST : APB1RSTR_UART3RST_Field := 16#0#; -- USART 4 reset UART4RST : APB1RSTR_UART4RST_Field := 16#0#; -- USART 5 reset UART5RST : APB1RSTR_UART5RST_Field := 16#0#; -- I2C 1 reset I2C1RST : APB1RSTR_I2C1RST_Field := 16#0#; -- I2C 2 reset I2C2RST : APB1RSTR_I2C2RST_Field := 16#0#; -- I2C3 reset I2C3RST : APB1RSTR_I2C3RST_Field := 16#0#; -- unspecified Reserved_24_24 : Interfaces.Bit_Types.Bit := 16#0#; -- CAN1 reset CAN1RST : APB1RSTR_CAN1RST_Field := 16#0#; -- CAN2 reset CAN2RST : APB1RSTR_CAN2RST_Field := 16#0#; -- unspecified Reserved_27_27 : Interfaces.Bit_Types.Bit := 16#0#; -- Power interface reset PWRRST : APB1RSTR_PWRRST_Field := 16#0#; -- DAC reset DACRST : APB1RSTR_DACRST_Field := 16#0#; -- UART7 reset UART7RST : APB1RSTR_UART7RST_Field := 16#0#; -- UART8 reset UART8RST : APB1RSTR_UART8RST_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for APB1RSTR_Register use record TIM2RST at 0 range 0 .. 0; TIM3RST at 0 range 1 .. 1; TIM4RST at 0 range 2 .. 2; TIM5RST at 0 range 3 .. 3; TIM6RST at 0 range 4 .. 4; TIM7RST at 0 range 5 .. 5; TIM12RST at 0 range 6 .. 6; TIM13RST at 0 range 7 .. 7; TIM14RST at 0 range 8 .. 8; Reserved_9_10 at 0 range 9 .. 10; WWDGRST at 0 range 11 .. 11; Reserved_12_13 at 0 range 12 .. 13; SPI2RST at 0 range 14 .. 14; SPI3RST at 0 range 15 .. 15; Reserved_16_16 at 0 range 16 .. 16; UART2RST at 0 range 17 .. 17; UART3RST at 0 range 18 .. 18; UART4RST at 0 range 19 .. 19; UART5RST at 0 range 20 .. 20; I2C1RST at 0 range 21 .. 21; I2C2RST at 0 range 22 .. 22; I2C3RST at 0 range 23 .. 23; Reserved_24_24 at 0 range 24 .. 24; CAN1RST at 0 range 25 .. 25; CAN2RST at 0 range 26 .. 26; Reserved_27_27 at 0 range 27 .. 27; PWRRST at 0 range 28 .. 28; DACRST at 0 range 29 .. 29; UART7RST at 0 range 30 .. 30; UART8RST at 0 range 31 .. 31; end record; ----------------------- -- APB2RSTR_Register -- ----------------------- subtype APB2RSTR_TIM1RST_Field is Interfaces.Bit_Types.Bit; subtype APB2RSTR_TIM8RST_Field is Interfaces.Bit_Types.Bit; subtype APB2RSTR_USART1RST_Field is Interfaces.Bit_Types.Bit; subtype APB2RSTR_USART6RST_Field is Interfaces.Bit_Types.Bit; subtype APB2RSTR_ADCRST_Field is Interfaces.Bit_Types.Bit; subtype APB2RSTR_SDIORST_Field is Interfaces.Bit_Types.Bit; subtype APB2RSTR_SPI1RST_Field is Interfaces.Bit_Types.Bit; subtype APB2RSTR_SPI4RST_Field is Interfaces.Bit_Types.Bit; subtype APB2RSTR_SYSCFGRST_Field is Interfaces.Bit_Types.Bit; subtype APB2RSTR_TIM9RST_Field is Interfaces.Bit_Types.Bit; subtype APB2RSTR_TIM10RST_Field is Interfaces.Bit_Types.Bit; subtype APB2RSTR_TIM11RST_Field is Interfaces.Bit_Types.Bit; subtype APB2RSTR_SPI5RST_Field is Interfaces.Bit_Types.Bit; subtype APB2RSTR_SPI6RST_Field is Interfaces.Bit_Types.Bit; subtype APB2RSTR_SAI1RST_Field is Interfaces.Bit_Types.Bit; subtype APB2RSTR_LTDCRST_Field is Interfaces.Bit_Types.Bit; -- APB2 peripheral reset register type APB2RSTR_Register is record -- TIM1 reset TIM1RST : APB2RSTR_TIM1RST_Field := 16#0#; -- TIM8 reset TIM8RST : APB2RSTR_TIM8RST_Field := 16#0#; -- unspecified Reserved_2_3 : Interfaces.Bit_Types.UInt2 := 16#0#; -- USART1 reset USART1RST : APB2RSTR_USART1RST_Field := 16#0#; -- USART6 reset USART6RST : APB2RSTR_USART6RST_Field := 16#0#; -- unspecified Reserved_6_7 : Interfaces.Bit_Types.UInt2 := 16#0#; -- ADC interface reset (common to all ADCs) ADCRST : APB2RSTR_ADCRST_Field := 16#0#; -- unspecified Reserved_9_10 : Interfaces.Bit_Types.UInt2 := 16#0#; -- SDIO reset SDIORST : APB2RSTR_SDIORST_Field := 16#0#; -- SPI 1 reset SPI1RST : APB2RSTR_SPI1RST_Field := 16#0#; -- SPI4 reset SPI4RST : APB2RSTR_SPI4RST_Field := 16#0#; -- System configuration controller reset SYSCFGRST : APB2RSTR_SYSCFGRST_Field := 16#0#; -- unspecified Reserved_15_15 : Interfaces.Bit_Types.Bit := 16#0#; -- TIM9 reset TIM9RST : APB2RSTR_TIM9RST_Field := 16#0#; -- TIM10 reset TIM10RST : APB2RSTR_TIM10RST_Field := 16#0#; -- TIM11 reset TIM11RST : APB2RSTR_TIM11RST_Field := 16#0#; -- unspecified Reserved_19_19 : Interfaces.Bit_Types.Bit := 16#0#; -- SPI5 reset SPI5RST : APB2RSTR_SPI5RST_Field := 16#0#; -- SPI6 reset SPI6RST : APB2RSTR_SPI6RST_Field := 16#0#; -- SAI1 reset SAI1RST : APB2RSTR_SAI1RST_Field := 16#0#; -- unspecified Reserved_23_25 : Interfaces.Bit_Types.UInt3 := 16#0#; -- LTDC reset LTDCRST : APB2RSTR_LTDCRST_Field := 16#0#; -- unspecified Reserved_27_31 : Interfaces.Bit_Types.UInt5 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for APB2RSTR_Register use record TIM1RST at 0 range 0 .. 0; TIM8RST at 0 range 1 .. 1; Reserved_2_3 at 0 range 2 .. 3; USART1RST at 0 range 4 .. 4; USART6RST at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; ADCRST at 0 range 8 .. 8; Reserved_9_10 at 0 range 9 .. 10; SDIORST at 0 range 11 .. 11; SPI1RST at 0 range 12 .. 12; SPI4RST at 0 range 13 .. 13; SYSCFGRST at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; TIM9RST at 0 range 16 .. 16; TIM10RST at 0 range 17 .. 17; TIM11RST at 0 range 18 .. 18; Reserved_19_19 at 0 range 19 .. 19; SPI5RST at 0 range 20 .. 20; SPI6RST at 0 range 21 .. 21; SAI1RST at 0 range 22 .. 22; Reserved_23_25 at 0 range 23 .. 25; LTDCRST at 0 range 26 .. 26; Reserved_27_31 at 0 range 27 .. 31; end record; ---------------------- -- AHB1ENR_Register -- ---------------------- subtype AHB1ENR_GPIOAEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_GPIOBEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_GPIOCEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_GPIODEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_GPIOEEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_GPIOFEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_GPIOGEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_GPIOHEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_GPIOIEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_GPIOJEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_GPIOKEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_CRCEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_BKPSRAMEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_CCMDATARAMEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_DMA1EN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_DMA2EN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_DMA2DEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_ETHMACEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_ETHMACTXEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_ETHMACRXEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_ETHMACPTPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_OTGHSEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1ENR_OTGHSULPIEN_Field is Interfaces.Bit_Types.Bit; -- AHB1 peripheral clock register type AHB1ENR_Register is record -- IO port A clock enable GPIOAEN : AHB1ENR_GPIOAEN_Field := 16#0#; -- IO port B clock enable GPIOBEN : AHB1ENR_GPIOBEN_Field := 16#0#; -- IO port C clock enable GPIOCEN : AHB1ENR_GPIOCEN_Field := 16#0#; -- IO port D clock enable GPIODEN : AHB1ENR_GPIODEN_Field := 16#0#; -- IO port E clock enable GPIOEEN : AHB1ENR_GPIOEEN_Field := 16#0#; -- IO port F clock enable GPIOFEN : AHB1ENR_GPIOFEN_Field := 16#0#; -- IO port G clock enable GPIOGEN : AHB1ENR_GPIOGEN_Field := 16#0#; -- IO port H clock enable GPIOHEN : AHB1ENR_GPIOHEN_Field := 16#0#; -- IO port I clock enable GPIOIEN : AHB1ENR_GPIOIEN_Field := 16#0#; -- IO port J clock enable GPIOJEN : AHB1ENR_GPIOJEN_Field := 16#0#; -- IO port K clock enable GPIOKEN : AHB1ENR_GPIOKEN_Field := 16#0#; -- unspecified Reserved_11_11 : Interfaces.Bit_Types.Bit := 16#0#; -- CRC clock enable CRCEN : AHB1ENR_CRCEN_Field := 16#0#; -- unspecified Reserved_13_17 : Interfaces.Bit_Types.UInt5 := 16#0#; -- Backup SRAM interface clock enable BKPSRAMEN : AHB1ENR_BKPSRAMEN_Field := 16#0#; -- unspecified Reserved_19_19 : Interfaces.Bit_Types.Bit := 16#0#; -- CCM data RAM clock enable CCMDATARAMEN : AHB1ENR_CCMDATARAMEN_Field := 16#1#; -- DMA1 clock enable DMA1EN : AHB1ENR_DMA1EN_Field := 16#0#; -- DMA2 clock enable DMA2EN : AHB1ENR_DMA2EN_Field := 16#0#; -- DMA2D clock enable DMA2DEN : AHB1ENR_DMA2DEN_Field := 16#0#; -- unspecified Reserved_24_24 : Interfaces.Bit_Types.Bit := 16#0#; -- Ethernet MAC clock enable ETHMACEN : AHB1ENR_ETHMACEN_Field := 16#0#; -- Ethernet Transmission clock enable ETHMACTXEN : AHB1ENR_ETHMACTXEN_Field := 16#0#; -- Ethernet Reception clock enable ETHMACRXEN : AHB1ENR_ETHMACRXEN_Field := 16#0#; -- Ethernet PTP clock enable ETHMACPTPEN : AHB1ENR_ETHMACPTPEN_Field := 16#0#; -- USB OTG HS clock enable OTGHSEN : AHB1ENR_OTGHSEN_Field := 16#0#; -- USB OTG HSULPI clock enable OTGHSULPIEN : AHB1ENR_OTGHSULPIEN_Field := 16#0#; -- unspecified Reserved_31_31 : Interfaces.Bit_Types.Bit := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for AHB1ENR_Register use record GPIOAEN at 0 range 0 .. 0; GPIOBEN at 0 range 1 .. 1; GPIOCEN at 0 range 2 .. 2; GPIODEN at 0 range 3 .. 3; GPIOEEN at 0 range 4 .. 4; GPIOFEN at 0 range 5 .. 5; GPIOGEN at 0 range 6 .. 6; GPIOHEN at 0 range 7 .. 7; GPIOIEN at 0 range 8 .. 8; GPIOJEN at 0 range 9 .. 9; GPIOKEN at 0 range 10 .. 10; Reserved_11_11 at 0 range 11 .. 11; CRCEN at 0 range 12 .. 12; Reserved_13_17 at 0 range 13 .. 17; BKPSRAMEN at 0 range 18 .. 18; Reserved_19_19 at 0 range 19 .. 19; CCMDATARAMEN at 0 range 20 .. 20; DMA1EN at 0 range 21 .. 21; DMA2EN at 0 range 22 .. 22; DMA2DEN at 0 range 23 .. 23; Reserved_24_24 at 0 range 24 .. 24; ETHMACEN at 0 range 25 .. 25; ETHMACTXEN at 0 range 26 .. 26; ETHMACRXEN at 0 range 27 .. 27; ETHMACPTPEN at 0 range 28 .. 28; OTGHSEN at 0 range 29 .. 29; OTGHSULPIEN at 0 range 30 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; ---------------------- -- AHB2ENR_Register -- ---------------------- subtype AHB2ENR_DCMIEN_Field is Interfaces.Bit_Types.Bit; subtype AHB2ENR_RNGEN_Field is Interfaces.Bit_Types.Bit; subtype AHB2ENR_OTGFSEN_Field is Interfaces.Bit_Types.Bit; -- AHB2 peripheral clock enable register type AHB2ENR_Register is record -- Camera interface enable DCMIEN : AHB2ENR_DCMIEN_Field := 16#0#; -- unspecified Reserved_1_5 : Interfaces.Bit_Types.UInt5 := 16#0#; -- Random number generator clock enable RNGEN : AHB2ENR_RNGEN_Field := 16#0#; -- USB OTG FS clock enable OTGFSEN : AHB2ENR_OTGFSEN_Field := 16#0#; -- unspecified Reserved_8_31 : Interfaces.Bit_Types.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for AHB2ENR_Register use record DCMIEN at 0 range 0 .. 0; Reserved_1_5 at 0 range 1 .. 5; RNGEN at 0 range 6 .. 6; OTGFSEN at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; ---------------------- -- AHB3ENR_Register -- ---------------------- subtype AHB3ENR_FMCEN_Field is Interfaces.Bit_Types.Bit; -- AHB3 peripheral clock enable register type AHB3ENR_Register is record -- Flexible memory controller module clock enable FMCEN : AHB3ENR_FMCEN_Field := 16#0#; -- unspecified Reserved_1_31 : Interfaces.Bit_Types.UInt31 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for AHB3ENR_Register use record FMCEN at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; ---------------------- -- APB1ENR_Register -- ---------------------- subtype APB1ENR_TIM2EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_TIM3EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_TIM4EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_TIM5EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_TIM6EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_TIM7EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_TIM12EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_TIM13EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_TIM14EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_WWDGEN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_SPI2EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_SPI3EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_USART2EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_USART3EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_UART4EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_UART5EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_I2C1EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_I2C2EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_I2C3EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_CAN1EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_CAN2EN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_PWREN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_DACEN_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_UART7ENR_Field is Interfaces.Bit_Types.Bit; subtype APB1ENR_UART8ENR_Field is Interfaces.Bit_Types.Bit; -- APB1 peripheral clock enable register type APB1ENR_Register is record -- TIM2 clock enable TIM2EN : APB1ENR_TIM2EN_Field := 16#0#; -- TIM3 clock enable TIM3EN : APB1ENR_TIM3EN_Field := 16#0#; -- TIM4 clock enable TIM4EN : APB1ENR_TIM4EN_Field := 16#0#; -- TIM5 clock enable TIM5EN : APB1ENR_TIM5EN_Field := 16#0#; -- TIM6 clock enable TIM6EN : APB1ENR_TIM6EN_Field := 16#0#; -- TIM7 clock enable TIM7EN : APB1ENR_TIM7EN_Field := 16#0#; -- TIM12 clock enable TIM12EN : APB1ENR_TIM12EN_Field := 16#0#; -- TIM13 clock enable TIM13EN : APB1ENR_TIM13EN_Field := 16#0#; -- TIM14 clock enable TIM14EN : APB1ENR_TIM14EN_Field := 16#0#; -- unspecified Reserved_9_10 : Interfaces.Bit_Types.UInt2 := 16#0#; -- Window watchdog clock enable WWDGEN : APB1ENR_WWDGEN_Field := 16#0#; -- unspecified Reserved_12_13 : Interfaces.Bit_Types.UInt2 := 16#0#; -- SPI2 clock enable SPI2EN : APB1ENR_SPI2EN_Field := 16#0#; -- SPI3 clock enable SPI3EN : APB1ENR_SPI3EN_Field := 16#0#; -- unspecified Reserved_16_16 : Interfaces.Bit_Types.Bit := 16#0#; -- USART 2 clock enable USART2EN : APB1ENR_USART2EN_Field := 16#0#; -- USART3 clock enable USART3EN : APB1ENR_USART3EN_Field := 16#0#; -- UART4 clock enable UART4EN : APB1ENR_UART4EN_Field := 16#0#; -- UART5 clock enable UART5EN : APB1ENR_UART5EN_Field := 16#0#; -- I2C1 clock enable I2C1EN : APB1ENR_I2C1EN_Field := 16#0#; -- I2C2 clock enable I2C2EN : APB1ENR_I2C2EN_Field := 16#0#; -- I2C3 clock enable I2C3EN : APB1ENR_I2C3EN_Field := 16#0#; -- unspecified Reserved_24_24 : Interfaces.Bit_Types.Bit := 16#0#; -- CAN 1 clock enable CAN1EN : APB1ENR_CAN1EN_Field := 16#0#; -- CAN 2 clock enable CAN2EN : APB1ENR_CAN2EN_Field := 16#0#; -- unspecified Reserved_27_27 : Interfaces.Bit_Types.Bit := 16#0#; -- Power interface clock enable PWREN : APB1ENR_PWREN_Field := 16#0#; -- DAC interface clock enable DACEN : APB1ENR_DACEN_Field := 16#0#; -- UART7 clock enable UART7ENR : APB1ENR_UART7ENR_Field := 16#0#; -- UART8 clock enable UART8ENR : APB1ENR_UART8ENR_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for APB1ENR_Register use record TIM2EN at 0 range 0 .. 0; TIM3EN at 0 range 1 .. 1; TIM4EN at 0 range 2 .. 2; TIM5EN at 0 range 3 .. 3; TIM6EN at 0 range 4 .. 4; TIM7EN at 0 range 5 .. 5; TIM12EN at 0 range 6 .. 6; TIM13EN at 0 range 7 .. 7; TIM14EN at 0 range 8 .. 8; Reserved_9_10 at 0 range 9 .. 10; WWDGEN at 0 range 11 .. 11; Reserved_12_13 at 0 range 12 .. 13; SPI2EN at 0 range 14 .. 14; SPI3EN at 0 range 15 .. 15; Reserved_16_16 at 0 range 16 .. 16; USART2EN at 0 range 17 .. 17; USART3EN at 0 range 18 .. 18; UART4EN at 0 range 19 .. 19; UART5EN at 0 range 20 .. 20; I2C1EN at 0 range 21 .. 21; I2C2EN at 0 range 22 .. 22; I2C3EN at 0 range 23 .. 23; Reserved_24_24 at 0 range 24 .. 24; CAN1EN at 0 range 25 .. 25; CAN2EN at 0 range 26 .. 26; Reserved_27_27 at 0 range 27 .. 27; PWREN at 0 range 28 .. 28; DACEN at 0 range 29 .. 29; UART7ENR at 0 range 30 .. 30; UART8ENR at 0 range 31 .. 31; end record; ---------------------- -- APB2ENR_Register -- ---------------------- subtype APB2ENR_TIM1EN_Field is Interfaces.Bit_Types.Bit; subtype APB2ENR_TIM8EN_Field is Interfaces.Bit_Types.Bit; subtype APB2ENR_USART1EN_Field is Interfaces.Bit_Types.Bit; subtype APB2ENR_USART6EN_Field is Interfaces.Bit_Types.Bit; subtype APB2ENR_ADC1EN_Field is Interfaces.Bit_Types.Bit; subtype APB2ENR_ADC2EN_Field is Interfaces.Bit_Types.Bit; subtype APB2ENR_ADC3EN_Field is Interfaces.Bit_Types.Bit; subtype APB2ENR_SDIOEN_Field is Interfaces.Bit_Types.Bit; subtype APB2ENR_SPI1EN_Field is Interfaces.Bit_Types.Bit; subtype APB2ENR_SPI4ENR_Field is Interfaces.Bit_Types.Bit; subtype APB2ENR_SYSCFGEN_Field is Interfaces.Bit_Types.Bit; subtype APB2ENR_TIM9EN_Field is Interfaces.Bit_Types.Bit; subtype APB2ENR_TIM10EN_Field is Interfaces.Bit_Types.Bit; subtype APB2ENR_TIM11EN_Field is Interfaces.Bit_Types.Bit; subtype APB2ENR_SPI5ENR_Field is Interfaces.Bit_Types.Bit; subtype APB2ENR_SPI6ENR_Field is Interfaces.Bit_Types.Bit; subtype APB2ENR_SAI1EN_Field is Interfaces.Bit_Types.Bit; subtype APB2ENR_LTDCEN_Field is Interfaces.Bit_Types.Bit; -- APB2 peripheral clock enable register type APB2ENR_Register is record -- TIM1 clock enable TIM1EN : APB2ENR_TIM1EN_Field := 16#0#; -- TIM8 clock enable TIM8EN : APB2ENR_TIM8EN_Field := 16#0#; -- unspecified Reserved_2_3 : Interfaces.Bit_Types.UInt2 := 16#0#; -- USART1 clock enable USART1EN : APB2ENR_USART1EN_Field := 16#0#; -- USART6 clock enable USART6EN : APB2ENR_USART6EN_Field := 16#0#; -- unspecified Reserved_6_7 : Interfaces.Bit_Types.UInt2 := 16#0#; -- ADC1 clock enable ADC1EN : APB2ENR_ADC1EN_Field := 16#0#; -- ADC2 clock enable ADC2EN : APB2ENR_ADC2EN_Field := 16#0#; -- ADC3 clock enable ADC3EN : APB2ENR_ADC3EN_Field := 16#0#; -- SDIO clock enable SDIOEN : APB2ENR_SDIOEN_Field := 16#0#; -- SPI1 clock enable SPI1EN : APB2ENR_SPI1EN_Field := 16#0#; -- SPI4 clock enable SPI4ENR : APB2ENR_SPI4ENR_Field := 16#0#; -- System configuration controller clock enable SYSCFGEN : APB2ENR_SYSCFGEN_Field := 16#0#; -- unspecified Reserved_15_15 : Interfaces.Bit_Types.Bit := 16#0#; -- TIM9 clock enable TIM9EN : APB2ENR_TIM9EN_Field := 16#0#; -- TIM10 clock enable TIM10EN : APB2ENR_TIM10EN_Field := 16#0#; -- TIM11 clock enable TIM11EN : APB2ENR_TIM11EN_Field := 16#0#; -- unspecified Reserved_19_19 : Interfaces.Bit_Types.Bit := 16#0#; -- SPI5 clock enable SPI5ENR : APB2ENR_SPI5ENR_Field := 16#0#; -- SPI6 clock enable SPI6ENR : APB2ENR_SPI6ENR_Field := 16#0#; -- SAI1 clock enable SAI1EN : APB2ENR_SAI1EN_Field := 16#0#; -- unspecified Reserved_23_25 : Interfaces.Bit_Types.UInt3 := 16#0#; -- LTDC clock enable LTDCEN : APB2ENR_LTDCEN_Field := 16#0#; -- unspecified Reserved_27_31 : Interfaces.Bit_Types.UInt5 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for APB2ENR_Register use record TIM1EN at 0 range 0 .. 0; TIM8EN at 0 range 1 .. 1; Reserved_2_3 at 0 range 2 .. 3; USART1EN at 0 range 4 .. 4; USART6EN at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; ADC1EN at 0 range 8 .. 8; ADC2EN at 0 range 9 .. 9; ADC3EN at 0 range 10 .. 10; SDIOEN at 0 range 11 .. 11; SPI1EN at 0 range 12 .. 12; SPI4ENR at 0 range 13 .. 13; SYSCFGEN at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; TIM9EN at 0 range 16 .. 16; TIM10EN at 0 range 17 .. 17; TIM11EN at 0 range 18 .. 18; Reserved_19_19 at 0 range 19 .. 19; SPI5ENR at 0 range 20 .. 20; SPI6ENR at 0 range 21 .. 21; SAI1EN at 0 range 22 .. 22; Reserved_23_25 at 0 range 23 .. 25; LTDCEN at 0 range 26 .. 26; Reserved_27_31 at 0 range 27 .. 31; end record; ------------------------ -- AHB1LPENR_Register -- ------------------------ subtype AHB1LPENR_GPIOALPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_GPIOBLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_GPIOCLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_GPIODLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_GPIOELPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_GPIOFLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_GPIOGLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_GPIOHLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_GPIOILPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_GPIOJLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_GPIOKLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_CRCLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_FLITFLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_SRAM1LPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_SRAM2LPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_BKPSRAMLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_SRAM3LPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_DMA1LPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_DMA2LPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_DMA2DLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_ETHMACLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_ETHMACTXLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_ETHMACRXLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_ETHMACPTPLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_OTGHSLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB1LPENR_OTGHSULPILPEN_Field is Interfaces.Bit_Types.Bit; -- AHB1 peripheral clock enable in low power mode register type AHB1LPENR_Register is record -- IO port A clock enable during sleep mode GPIOALPEN : AHB1LPENR_GPIOALPEN_Field := 16#1#; -- IO port B clock enable during Sleep mode GPIOBLPEN : AHB1LPENR_GPIOBLPEN_Field := 16#1#; -- IO port C clock enable during Sleep mode GPIOCLPEN : AHB1LPENR_GPIOCLPEN_Field := 16#1#; -- IO port D clock enable during Sleep mode GPIODLPEN : AHB1LPENR_GPIODLPEN_Field := 16#1#; -- IO port E clock enable during Sleep mode GPIOELPEN : AHB1LPENR_GPIOELPEN_Field := 16#1#; -- IO port F clock enable during Sleep mode GPIOFLPEN : AHB1LPENR_GPIOFLPEN_Field := 16#1#; -- IO port G clock enable during Sleep mode GPIOGLPEN : AHB1LPENR_GPIOGLPEN_Field := 16#1#; -- IO port H clock enable during Sleep mode GPIOHLPEN : AHB1LPENR_GPIOHLPEN_Field := 16#1#; -- IO port I clock enable during Sleep mode GPIOILPEN : AHB1LPENR_GPIOILPEN_Field := 16#1#; -- IO port J clock enable during Sleep mode GPIOJLPEN : AHB1LPENR_GPIOJLPEN_Field := 16#0#; -- IO port K clock enable during Sleep mode GPIOKLPEN : AHB1LPENR_GPIOKLPEN_Field := 16#0#; -- unspecified Reserved_11_11 : Interfaces.Bit_Types.Bit := 16#0#; -- CRC clock enable during Sleep mode CRCLPEN : AHB1LPENR_CRCLPEN_Field := 16#1#; -- unspecified Reserved_13_14 : Interfaces.Bit_Types.UInt2 := 16#0#; -- Flash interface clock enable during Sleep mode FLITFLPEN : AHB1LPENR_FLITFLPEN_Field := 16#1#; -- SRAM 1interface clock enable during Sleep mode SRAM1LPEN : AHB1LPENR_SRAM1LPEN_Field := 16#1#; -- SRAM 2 interface clock enable during Sleep mode SRAM2LPEN : AHB1LPENR_SRAM2LPEN_Field := 16#1#; -- Backup SRAM interface clock enable during Sleep mode BKPSRAMLPEN : AHB1LPENR_BKPSRAMLPEN_Field := 16#1#; -- SRAM 3 interface clock enable during Sleep mode SRAM3LPEN : AHB1LPENR_SRAM3LPEN_Field := 16#0#; -- unspecified Reserved_20_20 : Interfaces.Bit_Types.Bit := 16#0#; -- DMA1 clock enable during Sleep mode DMA1LPEN : AHB1LPENR_DMA1LPEN_Field := 16#1#; -- DMA2 clock enable during Sleep mode DMA2LPEN : AHB1LPENR_DMA2LPEN_Field := 16#1#; -- DMA2D clock enable during Sleep mode DMA2DLPEN : AHB1LPENR_DMA2DLPEN_Field := 16#0#; -- unspecified Reserved_24_24 : Interfaces.Bit_Types.Bit := 16#0#; -- Ethernet MAC clock enable during Sleep mode ETHMACLPEN : AHB1LPENR_ETHMACLPEN_Field := 16#1#; -- Ethernet transmission clock enable during Sleep mode ETHMACTXLPEN : AHB1LPENR_ETHMACTXLPEN_Field := 16#1#; -- Ethernet reception clock enable during Sleep mode ETHMACRXLPEN : AHB1LPENR_ETHMACRXLPEN_Field := 16#1#; -- Ethernet PTP clock enable during Sleep mode ETHMACPTPLPEN : AHB1LPENR_ETHMACPTPLPEN_Field := 16#1#; -- USB OTG HS clock enable during Sleep mode OTGHSLPEN : AHB1LPENR_OTGHSLPEN_Field := 16#1#; -- USB OTG HS ULPI clock enable during Sleep mode OTGHSULPILPEN : AHB1LPENR_OTGHSULPILPEN_Field := 16#1#; -- unspecified Reserved_31_31 : Interfaces.Bit_Types.Bit := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for AHB1LPENR_Register use record GPIOALPEN at 0 range 0 .. 0; GPIOBLPEN at 0 range 1 .. 1; GPIOCLPEN at 0 range 2 .. 2; GPIODLPEN at 0 range 3 .. 3; GPIOELPEN at 0 range 4 .. 4; GPIOFLPEN at 0 range 5 .. 5; GPIOGLPEN at 0 range 6 .. 6; GPIOHLPEN at 0 range 7 .. 7; GPIOILPEN at 0 range 8 .. 8; GPIOJLPEN at 0 range 9 .. 9; GPIOKLPEN at 0 range 10 .. 10; Reserved_11_11 at 0 range 11 .. 11; CRCLPEN at 0 range 12 .. 12; Reserved_13_14 at 0 range 13 .. 14; FLITFLPEN at 0 range 15 .. 15; SRAM1LPEN at 0 range 16 .. 16; SRAM2LPEN at 0 range 17 .. 17; BKPSRAMLPEN at 0 range 18 .. 18; SRAM3LPEN at 0 range 19 .. 19; Reserved_20_20 at 0 range 20 .. 20; DMA1LPEN at 0 range 21 .. 21; DMA2LPEN at 0 range 22 .. 22; DMA2DLPEN at 0 range 23 .. 23; Reserved_24_24 at 0 range 24 .. 24; ETHMACLPEN at 0 range 25 .. 25; ETHMACTXLPEN at 0 range 26 .. 26; ETHMACRXLPEN at 0 range 27 .. 27; ETHMACPTPLPEN at 0 range 28 .. 28; OTGHSLPEN at 0 range 29 .. 29; OTGHSULPILPEN at 0 range 30 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; ------------------------ -- AHB2LPENR_Register -- ------------------------ subtype AHB2LPENR_DCMILPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB2LPENR_RNGLPEN_Field is Interfaces.Bit_Types.Bit; subtype AHB2LPENR_OTGFSLPEN_Field is Interfaces.Bit_Types.Bit; -- AHB2 peripheral clock enable in low power mode register type AHB2LPENR_Register is record -- Camera interface enable during Sleep mode DCMILPEN : AHB2LPENR_DCMILPEN_Field := 16#1#; -- unspecified Reserved_1_5 : Interfaces.Bit_Types.UInt5 := 16#18#; -- Random number generator clock enable during Sleep mode RNGLPEN : AHB2LPENR_RNGLPEN_Field := 16#1#; -- USB OTG FS clock enable during Sleep mode OTGFSLPEN : AHB2LPENR_OTGFSLPEN_Field := 16#1#; -- unspecified Reserved_8_31 : Interfaces.Bit_Types.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for AHB2LPENR_Register use record DCMILPEN at 0 range 0 .. 0; Reserved_1_5 at 0 range 1 .. 5; RNGLPEN at 0 range 6 .. 6; OTGFSLPEN at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; ------------------------ -- AHB3LPENR_Register -- ------------------------ subtype AHB3LPENR_FMCLPEN_Field is Interfaces.Bit_Types.Bit; -- AHB3 peripheral clock enable in low power mode register type AHB3LPENR_Register is record -- Flexible memory controller module clock enable during Sleep mode FMCLPEN : AHB3LPENR_FMCLPEN_Field := 16#1#; -- unspecified Reserved_1_31 : Interfaces.Bit_Types.UInt31 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for AHB3LPENR_Register use record FMCLPEN at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; ------------------------ -- APB1LPENR_Register -- ------------------------ subtype APB1LPENR_TIM2LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_TIM3LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_TIM4LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_TIM5LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_TIM6LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_TIM7LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_TIM12LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_TIM13LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_TIM14LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_WWDGLPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_SPI2LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_SPI3LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_USART2LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_USART3LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_UART4LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_UART5LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_I2C1LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_I2C2LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_I2C3LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_CAN1LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_CAN2LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_PWRLPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_DACLPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_UART7LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB1LPENR_UART8LPEN_Field is Interfaces.Bit_Types.Bit; -- APB1 peripheral clock enable in low power mode register type APB1LPENR_Register is record -- TIM2 clock enable during Sleep mode TIM2LPEN : APB1LPENR_TIM2LPEN_Field := 16#1#; -- TIM3 clock enable during Sleep mode TIM3LPEN : APB1LPENR_TIM3LPEN_Field := 16#1#; -- TIM4 clock enable during Sleep mode TIM4LPEN : APB1LPENR_TIM4LPEN_Field := 16#1#; -- TIM5 clock enable during Sleep mode TIM5LPEN : APB1LPENR_TIM5LPEN_Field := 16#1#; -- TIM6 clock enable during Sleep mode TIM6LPEN : APB1LPENR_TIM6LPEN_Field := 16#1#; -- TIM7 clock enable during Sleep mode TIM7LPEN : APB1LPENR_TIM7LPEN_Field := 16#1#; -- TIM12 clock enable during Sleep mode TIM12LPEN : APB1LPENR_TIM12LPEN_Field := 16#1#; -- TIM13 clock enable during Sleep mode TIM13LPEN : APB1LPENR_TIM13LPEN_Field := 16#1#; -- TIM14 clock enable during Sleep mode TIM14LPEN : APB1LPENR_TIM14LPEN_Field := 16#1#; -- unspecified Reserved_9_10 : Interfaces.Bit_Types.UInt2 := 16#0#; -- Window watchdog clock enable during Sleep mode WWDGLPEN : APB1LPENR_WWDGLPEN_Field := 16#1#; -- unspecified Reserved_12_13 : Interfaces.Bit_Types.UInt2 := 16#0#; -- SPI2 clock enable during Sleep mode SPI2LPEN : APB1LPENR_SPI2LPEN_Field := 16#1#; -- SPI3 clock enable during Sleep mode SPI3LPEN : APB1LPENR_SPI3LPEN_Field := 16#1#; -- unspecified Reserved_16_16 : Interfaces.Bit_Types.Bit := 16#0#; -- USART2 clock enable during Sleep mode USART2LPEN : APB1LPENR_USART2LPEN_Field := 16#1#; -- USART3 clock enable during Sleep mode USART3LPEN : APB1LPENR_USART3LPEN_Field := 16#1#; -- UART4 clock enable during Sleep mode UART4LPEN : APB1LPENR_UART4LPEN_Field := 16#1#; -- UART5 clock enable during Sleep mode UART5LPEN : APB1LPENR_UART5LPEN_Field := 16#1#; -- I2C1 clock enable during Sleep mode I2C1LPEN : APB1LPENR_I2C1LPEN_Field := 16#1#; -- I2C2 clock enable during Sleep mode I2C2LPEN : APB1LPENR_I2C2LPEN_Field := 16#1#; -- I2C3 clock enable during Sleep mode I2C3LPEN : APB1LPENR_I2C3LPEN_Field := 16#1#; -- unspecified Reserved_24_24 : Interfaces.Bit_Types.Bit := 16#0#; -- CAN 1 clock enable during Sleep mode CAN1LPEN : APB1LPENR_CAN1LPEN_Field := 16#1#; -- CAN 2 clock enable during Sleep mode CAN2LPEN : APB1LPENR_CAN2LPEN_Field := 16#1#; -- unspecified Reserved_27_27 : Interfaces.Bit_Types.Bit := 16#0#; -- Power interface clock enable during Sleep mode PWRLPEN : APB1LPENR_PWRLPEN_Field := 16#1#; -- DAC interface clock enable during Sleep mode DACLPEN : APB1LPENR_DACLPEN_Field := 16#1#; -- UART7 clock enable during Sleep mode UART7LPEN : APB1LPENR_UART7LPEN_Field := 16#0#; -- UART8 clock enable during Sleep mode UART8LPEN : APB1LPENR_UART8LPEN_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for APB1LPENR_Register use record TIM2LPEN at 0 range 0 .. 0; TIM3LPEN at 0 range 1 .. 1; TIM4LPEN at 0 range 2 .. 2; TIM5LPEN at 0 range 3 .. 3; TIM6LPEN at 0 range 4 .. 4; TIM7LPEN at 0 range 5 .. 5; TIM12LPEN at 0 range 6 .. 6; TIM13LPEN at 0 range 7 .. 7; TIM14LPEN at 0 range 8 .. 8; Reserved_9_10 at 0 range 9 .. 10; WWDGLPEN at 0 range 11 .. 11; Reserved_12_13 at 0 range 12 .. 13; SPI2LPEN at 0 range 14 .. 14; SPI3LPEN at 0 range 15 .. 15; Reserved_16_16 at 0 range 16 .. 16; USART2LPEN at 0 range 17 .. 17; USART3LPEN at 0 range 18 .. 18; UART4LPEN at 0 range 19 .. 19; UART5LPEN at 0 range 20 .. 20; I2C1LPEN at 0 range 21 .. 21; I2C2LPEN at 0 range 22 .. 22; I2C3LPEN at 0 range 23 .. 23; Reserved_24_24 at 0 range 24 .. 24; CAN1LPEN at 0 range 25 .. 25; CAN2LPEN at 0 range 26 .. 26; Reserved_27_27 at 0 range 27 .. 27; PWRLPEN at 0 range 28 .. 28; DACLPEN at 0 range 29 .. 29; UART7LPEN at 0 range 30 .. 30; UART8LPEN at 0 range 31 .. 31; end record; ------------------------ -- APB2LPENR_Register -- ------------------------ subtype APB2LPENR_TIM1LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB2LPENR_TIM8LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB2LPENR_USART1LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB2LPENR_USART6LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB2LPENR_ADC1LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB2LPENR_ADC2LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB2LPENR_ADC3LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB2LPENR_SDIOLPEN_Field is Interfaces.Bit_Types.Bit; subtype APB2LPENR_SPI1LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB2LPENR_SPI4LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB2LPENR_SYSCFGLPEN_Field is Interfaces.Bit_Types.Bit; subtype APB2LPENR_TIM9LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB2LPENR_TIM10LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB2LPENR_TIM11LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB2LPENR_SPI5LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB2LPENR_SPI6LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB2LPENR_SAI1LPEN_Field is Interfaces.Bit_Types.Bit; subtype APB2LPENR_LTDCLPEN_Field is Interfaces.Bit_Types.Bit; -- APB2 peripheral clock enabled in low power mode register type APB2LPENR_Register is record -- TIM1 clock enable during Sleep mode TIM1LPEN : APB2LPENR_TIM1LPEN_Field := 16#1#; -- TIM8 clock enable during Sleep mode TIM8LPEN : APB2LPENR_TIM8LPEN_Field := 16#1#; -- unspecified Reserved_2_3 : Interfaces.Bit_Types.UInt2 := 16#0#; -- USART1 clock enable during Sleep mode USART1LPEN : APB2LPENR_USART1LPEN_Field := 16#1#; -- USART6 clock enable during Sleep mode USART6LPEN : APB2LPENR_USART6LPEN_Field := 16#1#; -- unspecified Reserved_6_7 : Interfaces.Bit_Types.UInt2 := 16#0#; -- ADC1 clock enable during Sleep mode ADC1LPEN : APB2LPENR_ADC1LPEN_Field := 16#1#; -- ADC2 clock enable during Sleep mode ADC2LPEN : APB2LPENR_ADC2LPEN_Field := 16#1#; -- ADC 3 clock enable during Sleep mode ADC3LPEN : APB2LPENR_ADC3LPEN_Field := 16#1#; -- SDIO clock enable during Sleep mode SDIOLPEN : APB2LPENR_SDIOLPEN_Field := 16#1#; -- SPI 1 clock enable during Sleep mode SPI1LPEN : APB2LPENR_SPI1LPEN_Field := 16#1#; -- SPI 4 clock enable during Sleep mode SPI4LPEN : APB2LPENR_SPI4LPEN_Field := 16#0#; -- System configuration controller clock enable during Sleep mode SYSCFGLPEN : APB2LPENR_SYSCFGLPEN_Field := 16#1#; -- unspecified Reserved_15_15 : Interfaces.Bit_Types.Bit := 16#0#; -- TIM9 clock enable during sleep mode TIM9LPEN : APB2LPENR_TIM9LPEN_Field := 16#1#; -- TIM10 clock enable during Sleep mode TIM10LPEN : APB2LPENR_TIM10LPEN_Field := 16#1#; -- TIM11 clock enable during Sleep mode TIM11LPEN : APB2LPENR_TIM11LPEN_Field := 16#1#; -- unspecified Reserved_19_19 : Interfaces.Bit_Types.Bit := 16#0#; -- SPI 5 clock enable during Sleep mode SPI5LPEN : APB2LPENR_SPI5LPEN_Field := 16#0#; -- SPI 6 clock enable during Sleep mode SPI6LPEN : APB2LPENR_SPI6LPEN_Field := 16#0#; -- SAI1 clock enable SAI1LPEN : APB2LPENR_SAI1LPEN_Field := 16#0#; -- unspecified Reserved_23_25 : Interfaces.Bit_Types.UInt3 := 16#0#; -- LTDC clock enable LTDCLPEN : APB2LPENR_LTDCLPEN_Field := 16#0#; -- unspecified Reserved_27_31 : Interfaces.Bit_Types.UInt5 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for APB2LPENR_Register use record TIM1LPEN at 0 range 0 .. 0; TIM8LPEN at 0 range 1 .. 1; Reserved_2_3 at 0 range 2 .. 3; USART1LPEN at 0 range 4 .. 4; USART6LPEN at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; ADC1LPEN at 0 range 8 .. 8; ADC2LPEN at 0 range 9 .. 9; ADC3LPEN at 0 range 10 .. 10; SDIOLPEN at 0 range 11 .. 11; SPI1LPEN at 0 range 12 .. 12; SPI4LPEN at 0 range 13 .. 13; SYSCFGLPEN at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; TIM9LPEN at 0 range 16 .. 16; TIM10LPEN at 0 range 17 .. 17; TIM11LPEN at 0 range 18 .. 18; Reserved_19_19 at 0 range 19 .. 19; SPI5LPEN at 0 range 20 .. 20; SPI6LPEN at 0 range 21 .. 21; SAI1LPEN at 0 range 22 .. 22; Reserved_23_25 at 0 range 23 .. 25; LTDCLPEN at 0 range 26 .. 26; Reserved_27_31 at 0 range 27 .. 31; end record; ------------------- -- BDCR_Register -- ------------------- subtype BDCR_LSEON_Field is Interfaces.Bit_Types.Bit; subtype BDCR_LSERDY_Field is Interfaces.Bit_Types.Bit; subtype BDCR_LSEBYP_Field is Interfaces.Bit_Types.Bit; ----------------- -- BDCR.RTCSEL -- ----------------- -- BDCR_RTCSEL array element subtype BDCR_RTCSEL_Element is Interfaces.Bit_Types.Bit; -- BDCR_RTCSEL array type BDCR_RTCSEL_Field_Array is array (0 .. 1) of BDCR_RTCSEL_Element with Component_Size => 1, Size => 2; -- Type definition for BDCR_RTCSEL type BDCR_RTCSEL_Field (As_Array : Boolean := False) is record case As_Array is when False => -- RTCSEL as a value Val : Interfaces.Bit_Types.UInt2; when True => -- RTCSEL as an array Arr : BDCR_RTCSEL_Field_Array; end case; end record with Unchecked_Union, Size => 2; for BDCR_RTCSEL_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; subtype BDCR_RTCEN_Field is Interfaces.Bit_Types.Bit; subtype BDCR_BDRST_Field is Interfaces.Bit_Types.Bit; -- Backup domain control register type BDCR_Register is record -- External low-speed oscillator enable LSEON : BDCR_LSEON_Field := 16#0#; -- Read-only. External low-speed oscillator ready LSERDY : BDCR_LSERDY_Field := 16#0#; -- External low-speed oscillator bypass LSEBYP : BDCR_LSEBYP_Field := 16#0#; -- unspecified Reserved_3_7 : Interfaces.Bit_Types.UInt5 := 16#0#; -- RTC clock source selection RTCSEL : BDCR_RTCSEL_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_10_14 : Interfaces.Bit_Types.UInt5 := 16#0#; -- RTC clock enable RTCEN : BDCR_RTCEN_Field := 16#0#; -- Backup domain software reset BDRST : BDCR_BDRST_Field := 16#0#; -- unspecified Reserved_17_31 : Interfaces.Bit_Types.UInt15 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BDCR_Register use record LSEON at 0 range 0 .. 0; LSERDY at 0 range 1 .. 1; LSEBYP at 0 range 2 .. 2; Reserved_3_7 at 0 range 3 .. 7; RTCSEL at 0 range 8 .. 9; Reserved_10_14 at 0 range 10 .. 14; RTCEN at 0 range 15 .. 15; BDRST at 0 range 16 .. 16; Reserved_17_31 at 0 range 17 .. 31; end record; ------------------ -- CSR_Register -- ------------------ subtype CSR_LSION_Field is Interfaces.Bit_Types.Bit; subtype CSR_LSIRDY_Field is Interfaces.Bit_Types.Bit; subtype CSR_RMVF_Field is Interfaces.Bit_Types.Bit; subtype CSR_BORRSTF_Field is Interfaces.Bit_Types.Bit; subtype CSR_PADRSTF_Field is Interfaces.Bit_Types.Bit; subtype CSR_PORRSTF_Field is Interfaces.Bit_Types.Bit; subtype CSR_SFTRSTF_Field is Interfaces.Bit_Types.Bit; subtype CSR_WDGRSTF_Field is Interfaces.Bit_Types.Bit; subtype CSR_WWDGRSTF_Field is Interfaces.Bit_Types.Bit; subtype CSR_LPWRRSTF_Field is Interfaces.Bit_Types.Bit; -- clock control & status register type CSR_Register is record -- Internal low-speed oscillator enable LSION : CSR_LSION_Field := 16#0#; -- Read-only. Internal low-speed oscillator ready LSIRDY : CSR_LSIRDY_Field := 16#0#; -- unspecified Reserved_2_23 : Interfaces.Bit_Types.UInt22 := 16#0#; -- Remove reset flag RMVF : CSR_RMVF_Field := 16#0#; -- BOR reset flag BORRSTF : CSR_BORRSTF_Field := 16#1#; -- PIN reset flag PADRSTF : CSR_PADRSTF_Field := 16#1#; -- POR/PDR reset flag PORRSTF : CSR_PORRSTF_Field := 16#1#; -- Software reset flag SFTRSTF : CSR_SFTRSTF_Field := 16#0#; -- Independent watchdog reset flag WDGRSTF : CSR_WDGRSTF_Field := 16#0#; -- Window watchdog reset flag WWDGRSTF : CSR_WWDGRSTF_Field := 16#0#; -- Low-power reset flag LPWRRSTF : CSR_LPWRRSTF_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CSR_Register use record LSION at 0 range 0 .. 0; LSIRDY at 0 range 1 .. 1; Reserved_2_23 at 0 range 2 .. 23; RMVF at 0 range 24 .. 24; BORRSTF at 0 range 25 .. 25; PADRSTF at 0 range 26 .. 26; PORRSTF at 0 range 27 .. 27; SFTRSTF at 0 range 28 .. 28; WDGRSTF at 0 range 29 .. 29; WWDGRSTF at 0 range 30 .. 30; LPWRRSTF at 0 range 31 .. 31; end record; -------------------- -- SSCGR_Register -- -------------------- subtype SSCGR_MODPER_Field is Interfaces.Bit_Types.UInt13; subtype SSCGR_INCSTEP_Field is Interfaces.Bit_Types.UInt15; subtype SSCGR_SPREADSEL_Field is Interfaces.Bit_Types.Bit; subtype SSCGR_SSCGEN_Field is Interfaces.Bit_Types.Bit; -- spread spectrum clock generation register type SSCGR_Register is record -- Modulation period MODPER : SSCGR_MODPER_Field := 16#0#; -- Incrementation step INCSTEP : SSCGR_INCSTEP_Field := 16#0#; -- unspecified Reserved_28_29 : Interfaces.Bit_Types.UInt2 := 16#0#; -- Spread Select SPREADSEL : SSCGR_SPREADSEL_Field := 16#0#; -- Spread spectrum modulation enable SSCGEN : SSCGR_SSCGEN_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SSCGR_Register use record MODPER at 0 range 0 .. 12; INCSTEP at 0 range 13 .. 27; Reserved_28_29 at 0 range 28 .. 29; SPREADSEL at 0 range 30 .. 30; SSCGEN at 0 range 31 .. 31; end record; ------------------------- -- PLLI2SCFGR_Register -- ------------------------- subtype PLLI2SCFGR_PLLI2SN_Field is Interfaces.Bit_Types.UInt9; subtype PLLI2SCFGR_PLLI2SQ_Field is Interfaces.Bit_Types.UInt4; subtype PLLI2SCFGR_PLLI2SR_Field is Interfaces.Bit_Types.UInt3; -- PLLI2S configuration register type PLLI2SCFGR_Register is record -- unspecified Reserved_0_5 : Interfaces.Bit_Types.UInt6 := 16#0#; -- PLLI2S multiplication factor for VCO PLLI2SN : PLLI2SCFGR_PLLI2SN_Field := 16#C0#; -- unspecified Reserved_15_23 : Interfaces.Bit_Types.UInt9 := 16#0#; -- PLLI2S division factor for SAI1 clock PLLI2SQ : PLLI2SCFGR_PLLI2SQ_Field := 16#0#; -- PLLI2S division factor for I2S clocks PLLI2SR : PLLI2SCFGR_PLLI2SR_Field := 16#2#; -- unspecified Reserved_31_31 : Interfaces.Bit_Types.Bit := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PLLI2SCFGR_Register use record Reserved_0_5 at 0 range 0 .. 5; PLLI2SN at 0 range 6 .. 14; Reserved_15_23 at 0 range 15 .. 23; PLLI2SQ at 0 range 24 .. 27; PLLI2SR at 0 range 28 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; ------------------------- -- PLLSAICFGR_Register -- ------------------------- subtype PLLSAICFGR_PLLSAIN_Field is Interfaces.Bit_Types.UInt9; subtype PLLSAICFGR_PLLSAIQ_Field is Interfaces.Bit_Types.UInt4; subtype PLLSAICFGR_PLLSAIR_Field is Interfaces.Bit_Types.UInt3; -- PLLSAICFGR type PLLSAICFGR_Register is record -- unspecified Reserved_0_5 : Interfaces.Bit_Types.UInt6 := 16#0#; -- PLLSAIN PLLSAIN : PLLSAICFGR_PLLSAIN_Field := 16#C0#; -- unspecified Reserved_15_23 : Interfaces.Bit_Types.UInt9 := 16#0#; -- PLLSAIN PLLSAIQ : PLLSAICFGR_PLLSAIQ_Field := 16#4#; -- PLLSAIN PLLSAIR : PLLSAICFGR_PLLSAIR_Field := 16#2#; -- unspecified Reserved_31_31 : Interfaces.Bit_Types.Bit := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PLLSAICFGR_Register use record Reserved_0_5 at 0 range 0 .. 5; PLLSAIN at 0 range 6 .. 14; Reserved_15_23 at 0 range 15 .. 23; PLLSAIQ at 0 range 24 .. 27; PLLSAIR at 0 range 28 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; ---------------------- -- DCKCFGR_Register -- ---------------------- subtype DCKCFGR_PLLI2SDIVQ_Field is Interfaces.Bit_Types.UInt5; subtype DCKCFGR_PLLSAIDIVQ_Field is Interfaces.Bit_Types.UInt5; subtype DCKCFGR_PLLSAIDIVR_Field is Interfaces.Bit_Types.UInt2; subtype DCKCFGR_SAI1ASRC_Field is Interfaces.Bit_Types.UInt2; subtype DCKCFGR_SAI1BSRC_Field is Interfaces.Bit_Types.UInt2; subtype DCKCFGR_TIMPRE_Field is Interfaces.Bit_Types.Bit; -- DCKCFGR type DCKCFGR_Register is record -- PLLI2SDIVQ PLLI2SDIVQ : DCKCFGR_PLLI2SDIVQ_Field := 16#0#; -- unspecified Reserved_5_7 : Interfaces.Bit_Types.UInt3 := 16#0#; -- PLLSAIDIVQ PLLSAIDIVQ : DCKCFGR_PLLSAIDIVQ_Field := 16#0#; -- unspecified Reserved_13_15 : Interfaces.Bit_Types.UInt3 := 16#0#; -- PLLSAIDIVR PLLSAIDIVR : DCKCFGR_PLLSAIDIVR_Field := 16#0#; -- unspecified Reserved_18_19 : Interfaces.Bit_Types.UInt2 := 16#0#; -- SAI1ASRC SAI1ASRC : DCKCFGR_SAI1ASRC_Field := 16#0#; -- SAI1BSRC SAI1BSRC : DCKCFGR_SAI1BSRC_Field := 16#0#; -- TIMPRE TIMPRE : DCKCFGR_TIMPRE_Field := 16#0#; -- unspecified Reserved_25_31 : Interfaces.Bit_Types.UInt7 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DCKCFGR_Register use record PLLI2SDIVQ at 0 range 0 .. 4; Reserved_5_7 at 0 range 5 .. 7; PLLSAIDIVQ at 0 range 8 .. 12; Reserved_13_15 at 0 range 13 .. 15; PLLSAIDIVR at 0 range 16 .. 17; Reserved_18_19 at 0 range 18 .. 19; SAI1ASRC at 0 range 20 .. 21; SAI1BSRC at 0 range 22 .. 23; TIMPRE at 0 range 24 .. 24; Reserved_25_31 at 0 range 25 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Reset and clock control type RCC_Peripheral is record -- clock control register CR : CR_Register; -- PLL configuration register PLLCFGR : PLLCFGR_Register; -- clock configuration register CFGR : CFGR_Register; -- clock interrupt register CIR : CIR_Register; -- AHB1 peripheral reset register AHB1RSTR : AHB1RSTR_Register; -- AHB2 peripheral reset register AHB2RSTR : AHB2RSTR_Register; -- AHB3 peripheral reset register AHB3RSTR : AHB3RSTR_Register; -- APB1 peripheral reset register APB1RSTR : APB1RSTR_Register; -- APB2 peripheral reset register APB2RSTR : APB2RSTR_Register; -- AHB1 peripheral clock register AHB1ENR : AHB1ENR_Register; -- AHB2 peripheral clock enable register AHB2ENR : AHB2ENR_Register; -- AHB3 peripheral clock enable register AHB3ENR : AHB3ENR_Register; -- APB1 peripheral clock enable register APB1ENR : APB1ENR_Register; -- APB2 peripheral clock enable register APB2ENR : APB2ENR_Register; -- AHB1 peripheral clock enable in low power mode register AHB1LPENR : AHB1LPENR_Register; -- AHB2 peripheral clock enable in low power mode register AHB2LPENR : AHB2LPENR_Register; -- AHB3 peripheral clock enable in low power mode register AHB3LPENR : AHB3LPENR_Register; -- APB1 peripheral clock enable in low power mode register APB1LPENR : APB1LPENR_Register; -- APB2 peripheral clock enabled in low power mode register APB2LPENR : APB2LPENR_Register; -- Backup domain control register BDCR : BDCR_Register; -- clock control & status register CSR : CSR_Register; -- spread spectrum clock generation register SSCGR : SSCGR_Register; -- PLLI2S configuration register PLLI2SCFGR : PLLI2SCFGR_Register; -- PLLSAICFGR PLLSAICFGR : PLLSAICFGR_Register; -- DCKCFGR DCKCFGR : DCKCFGR_Register; end record with Volatile; for RCC_Peripheral use record CR at 0 range 0 .. 31; PLLCFGR at 4 range 0 .. 31; CFGR at 8 range 0 .. 31; CIR at 12 range 0 .. 31; AHB1RSTR at 16 range 0 .. 31; AHB2RSTR at 20 range 0 .. 31; AHB3RSTR at 24 range 0 .. 31; APB1RSTR at 32 range 0 .. 31; APB2RSTR at 36 range 0 .. 31; AHB1ENR at 48 range 0 .. 31; AHB2ENR at 52 range 0 .. 31; AHB3ENR at 56 range 0 .. 31; APB1ENR at 64 range 0 .. 31; APB2ENR at 68 range 0 .. 31; AHB1LPENR at 80 range 0 .. 31; AHB2LPENR at 84 range 0 .. 31; AHB3LPENR at 88 range 0 .. 31; APB1LPENR at 96 range 0 .. 31; APB2LPENR at 100 range 0 .. 31; BDCR at 112 range 0 .. 31; CSR at 116 range 0 .. 31; SSCGR at 128 range 0 .. 31; PLLI2SCFGR at 132 range 0 .. 31; PLLSAICFGR at 136 range 0 .. 31; DCKCFGR at 140 range 0 .. 31; end record; -- Reset and clock control RCC_Periph : aliased RCC_Peripheral with Import, Address => RCC_Base; end Interfaces.STM32.RCC;
sungyeon/drake
Ada
331
ads
pragma License (Unrestricted); with Ada.Numerics.Generic_Complex_Elementary_Functions; with Ada.Numerics.Long_Long_Complex_Types; package Ada.Numerics.Long_Long_Complex_Elementary_Functions is new Generic_Complex_Elementary_Functions (Long_Long_Complex_Types); pragma Pure (Ada.Numerics.Long_Long_Complex_Elementary_Functions);
fnarenji/BoiteMaker
Ada
961
ads
with halfbox_panel; use halfbox_panel; with halfbox_info; use halfbox_info; package halfbox is type halfbox_t is record -- mesures de la demi-boite info : halfbox_info_t; -- face inférieure panel_bottom : halfbox_panel_t; -- face arrière panel_back : halfbox_panel_t; -- face avant panel_front : halfbox_panel_t; -- face gauche panel_left : halfbox_panel_t; -- face droite panel_right : halfbox_panel_t; end record; -- Obtient une demi-boite avec les mesures données function get_halfbox(width, length, height, thickness, queue_length : integer) return halfbox_t; -- Detruit la demi boite procedure destroy(halfbox : in out halfbox_t); -- Obtient une description texte de la demiboite function to_string(halfbox : halfbox_t) return string; end halfbox;
faelys/natools
Ada
2,363
ads
-- Generated at 2014-11-09 20:46:38 +0000 by Natools.Static_Hash_Maps -- from src/natools-static_hash_maps-s_expressions-hash_maps.sx private package Natools.Static_Hash_Maps.S_Expressions.Command_Maps is function To_Package_Command (Key : String) return Package_Command; function To_Map_Command (Key : String) return Map_Command; private Map_1_Key_0 : aliased constant String := "extra-declarations"; Map_1_Key_1 : aliased constant String := "extra-decl"; Map_1_Key_2 : aliased constant String := "private"; Map_1_Key_3 : aliased constant String := "public"; Map_1_Key_4 : aliased constant String := "pure"; Map_1_Key_5 : aliased constant String := "preelaborate"; Map_1_Key_6 : aliased constant String := "test-function"; Map_1_Keys : constant array (0 .. 6) of access constant String := (Map_1_Key_0'Access, Map_1_Key_1'Access, Map_1_Key_2'Access, Map_1_Key_3'Access, Map_1_Key_4'Access, Map_1_Key_5'Access, Map_1_Key_6'Access); Map_1_Elements : constant array (0 .. 6) of Package_Command := (Extra_Declarations, Extra_Declarations, Private_Child, Public_Child, Pure_Package, Preelaborate_Package, Test_Function); Map_2_Key_0 : aliased constant String := "definite"; Map_2_Key_1 : aliased constant String := "definite-elements"; Map_2_Key_2 : aliased constant String := "indefinite"; Map_2_Key_3 : aliased constant String := "indefinite-elements"; Map_2_Key_4 : aliased constant String := "hash-package"; Map_2_Key_5 : aliased constant String := "nodes"; Map_2_Key_6 : aliased constant String := "function"; Map_2_Key_7 : aliased constant String := "not-found"; Map_2_Keys : constant array (0 .. 7) of access constant String := (Map_2_Key_0'Access, Map_2_Key_1'Access, Map_2_Key_2'Access, Map_2_Key_3'Access, Map_2_Key_4'Access, Map_2_Key_5'Access, Map_2_Key_6'Access, Map_2_Key_7'Access); Map_2_Elements : constant array (0 .. 7) of Map_Command := (Definite_Elements, Definite_Elements, Indefinite_Elements, Indefinite_Elements, Hash_Package, Nodes, Function_Name, Not_Found); end Natools.Static_Hash_Maps.S_Expressions.Command_Maps;
persan/protobuf-ada
Ada
305
adb
with AUnit.Run; with AUnit.Reporter.Text; with Composite_Suite; ---------------- -- Pb_Harness -- ---------------- procedure PB_Harness is procedure Run is new AUnit.Run.Test_Runner (Composite_Suite.Suite); Reporter : AUnit.Reporter.Text.Text_Reporter; begin Run (Reporter); end PB_Harness;
pvrego/adaino
Ada
2,369
ads
-- ============================================================================= -- Package AVR.POWER_MANAGEMENT -- -- Handles the power management. -- - Sleep mode -- - Power reduction -- ============================================================================= package AVR.POWER_MANAGEMENT is type Sleep_Mode_Control_Register_Type is record SE : Boolean; -- Sleep Enable SM0 : Boolean; -- Sleep Mode Select Bit 0 SM1 : Boolean; -- Sleep Mode Select Bit 1 SM2 : Boolean; -- Sleep Mode Select Bit 2 Spare : Spare_Type (0 .. 3); end record; pragma Pack (Sleep_Mode_Control_Register_Type); for Sleep_Mode_Control_Register_Type'Size use BYTE_SIZE; Reg_SMCR : Sleep_Mode_Control_Register_Type; for Reg_SMCR'Address use System'To_Address (16#53#); type Power_Reduction_Register_0_Type is record PRADC : Boolean; -- Power Reduction ADC PRUSART0 : Boolean; -- Power Reduction USART0 PRSPI : Boolean; -- Power Reduction Serial Peripheral Interface PRTIM1 : Boolean; -- Power Reduction Timer/Counter 1 Spare : Spare_Type (0 .. 0); PRTIM0 : Boolean; -- Power Reduction Timer/Counter 0 PRTIM2 : Boolean; -- Power Reduction Timer/Counter 2 PRTWI : Boolean; -- Power Reduction TWI end record; pragma Pack (Power_Reduction_Register_0_Type); for Power_Reduction_Register_0_Type'Size use BYTE_SIZE; #if MCU="ATMEGA2560" then type Power_Reduction_Register_1_Type is record PRUSART1 : Boolean; -- Power Reduction USART 1 PRUSART2 : Boolean; -- Power Reduction USART 2 PRUSART3 : Boolean; -- Power Reduction USART 3 PRTIM3 : Boolean; -- Power Reductin Timer/Counter 3 PRTIM4 : Boolean; -- Power Reductin Timer/Counter 4 PRTIM5 : Boolean; -- Power Reductin Timer/Counter 5 Spare : Spare_Type (0 .. 1); end record; pragma Pack (Power_Reduction_Register_1_Type); for Power_Reduction_Register_1_Type'Size use BYTE_SIZE; #end if; Reg_PRR0 : Power_Reduction_Register_0_Type; for Reg_PRR0'Address use System'To_Address (16#64#); #if MCU="ATMEGA2560" then Reg_PRR1 : Power_Reduction_Register_0_Type; for Reg_PRR1'Address use System'To_Address (16#65#); #end if; end AVR.POWER_MANAGEMENT;
Fabien-Chouteau/shoot-n-loot
Ada
7,454
ads
with GESTE; with GESTE.Grid; pragma Style_Checks (Off); package Game_Assets.level_5 is -- level_5 Width : constant := 20; Height : constant := 16; Tile_Width : constant := 8; Tile_Height : constant := 8; -- Backcolor package Backcolor is Width : constant := 20; Height : constant := 20; Data : aliased GESTE.Grid.Grid_Data := (( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2)) ; end Backcolor; -- Back package Back is Width : constant := 20; Height : constant := 20; Data : aliased GESTE.Grid.Grid_Data := (( 10, 9, 78, 66, 66, 66, 66, 66, 79, 66, 66, 66, 66, 66, 79, 67), ( 9, 10, 80, 0, 0, 0, 0, 0, 61, 0, 0, 0, 0, 0, 61, 67), ( 10, 9, 80, 0, 0, 0, 0, 0, 61, 0, 0, 0, 0, 0, 61, 67), ( 9, 10, 80, 70, 70, 70, 70, 70, 61, 81, 70, 70, 70, 70, 61, 67), ( 10, 9, 80, 0, 0, 0, 0, 0, 61, 0, 0, 0, 0, 0, 61, 67), ( 9, 10, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 61, 67), ( 10, 9, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 61, 67), ( 9, 10, 80, 70, 82, 0, 0, 0, 0, 0, 49, 0, 0, 0, 61, 67), ( 10, 9, 80, 0, 0, 0, 0, 0, 0, 0, 61, 0, 0, 0, 61, 67), ( 9, 10, 80, 0, 0, 0, 0, 0, 0, 0, 61, 0, 0, 0, 61, 67), ( 10, 9, 80, 0, 0, 0, 0, 0, 0, 0, 61, 0, 0, 0, 61, 67), ( 9, 10, 80, 70, 82, 0, 0, 0, 0, 0, 72, 0, 0, 0, 61, 67), ( 10, 9, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 61, 67), ( 9, 10, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 50, 60, 67), ( 10, 9, 83, 50, 50, 51, 70, 82, 0, 0, 0, 0, 61, 10, 9, 0), ( 9, 10, 9, 10, 9, 80, 0, 0, 0, 0, 0, 0, 61, 9, 10, 0), ( 10, 9, 10, 9, 10, 80, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0), ( 9, 10, 9, 10, 9, 80, 70, 82, 0, 0, 0, 0, 61, 0, 10, 0), ( 10, 9, 10, 9, 10, 80, 0, 0, 0, 0, 0, 0, 61, 0, 9, 0), ( 9, 10, 9, 10, 9, 83, 50, 50, 50, 50, 50, 0, 60, 9, 10, 0)) ; end Back; -- Front package Front is Width : constant := 20; Height : constant := 20; Data : aliased GESTE.Grid.Grid_Data := (( 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), ( 0, 0, 0, 76, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0), ( 0, 0, 0, 76, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0), ( 0, 0, 0, 77, 82, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0), ( 0, 0, 0, 76, 0, 0, 0, 85, 0, 0, 0, 0, 0, 0, 0, 0), ( 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), ( 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), ( 0, 0, 0, 77, 0, 0, 0, 0, 0, 86, 0, 0, 0, 0, 0, 0), ( 0, 0, 0, 76, 0, 0, 0, 0, 0, 84, 0, 70, 70, 70, 0, 0), ( 0, 0, 0, 76, 0, 0, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0), ( 0, 0, 0, 76, 0, 0, 0, 0, 0, 84, 0, 70, 70, 70, 0, 0), ( 0, 0, 0, 77, 0, 0, 0, 0, 0, 85, 0, 0, 0, 0, 0, 0), ( 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), ( 0, 0, 0, 87, 75, 75, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0), ( 0, 0, 0, 0, 0, 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0), ( 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0), ( 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0), ( 0, 0, 0, 0, 0, 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0), ( 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0), ( 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0)) ; end Front; package Monsters is Objects : Object_Array := ( 0 => ( Kind => POINT_OBJ, Id => 8, Name => null, X => 5.60000E+01, Y => 1.12000E+02, Width => 8.00000E+00, Height => 8.00000E+00, Flip_Vertical => FALSE, Flip_Horizontal => FALSE, Tile_Id => 57, Str => null ), 1 => ( Kind => POINT_OBJ, Id => 15, Name => null, X => 6.40000E+01, Y => 8.00000E+01, Width => 8.00000E+00, Height => 8.00000E+00, Flip_Vertical => FALSE, Flip_Horizontal => FALSE, Tile_Id => 57, Str => null ) ); end Monsters; package Chests is Objects : Object_Array := ( 0 => ( Kind => POINT_OBJ, Id => 18, Name => null, X => 1.44000E+02, Y => 1.12000E+02, Width => 8.00000E+00, Height => 8.00000E+00, Flip_Vertical => FALSE, Flip_Horizontal => FALSE, Tile_Id => 3, Str => null ) ); end Chests; package Markers is Objects : Object_Array := ( 0 => ( Kind => POINT_OBJ, Id => 12, Name => new String'("Spawn"), X => 8.00000E+00, Y => 6.40000E+01, Width => 8.00000E+00, Height => 8.00000E+00, Flip_Vertical => FALSE, Flip_Horizontal => TRUE, Tile_Id => 4, Str => null ), 1 => ( Kind => POINT_OBJ, Id => 19, Name => new String'("Finish"), X => 1.52000E+02, Y => 9.60000E+01, Width => 8.00000E+00, Height => 8.00000E+00, Flip_Vertical => FALSE, Flip_Horizontal => FALSE, Tile_Id => 50, Str => null ) ); Spawn : aliased constant Object := ( Kind => POINT_OBJ, Id => 12, Name => new String'("Spawn"), X => 8.00000E+00, Y => 6.40000E+01, Width => 8.00000E+00, Height => 8.00000E+00, Flip_Vertical => FALSE, Flip_Horizontal => TRUE, Tile_Id => 4, Str => null ); Finish : aliased constant Object := ( Kind => POINT_OBJ, Id => 19, Name => new String'("Finish"), X => 1.52000E+02, Y => 9.60000E+01, Width => 8.00000E+00, Height => 8.00000E+00, Flip_Vertical => FALSE, Flip_Horizontal => FALSE, Tile_Id => 50, Str => null ); end Markers; end Game_Assets.level_5;
jhumphry/auto_counters
Ada
6,789
adb
-- Auto_Counters_Suite.C_Resources_Tests -- Unit tests for Auto_Counters Unique_C_Resources and Smart_C_Resources -- packages -- Copyright (c) 2016, James Humphry - see LICENSE file for details with AUnit.Assertions; with Unique_C_Resources; with Smart_C_Resources; with Basic_Counters; package body Auto_Counters_Suite.C_Resources_Tests is use AUnit.Assertions; Net_Resources_Allocated : Integer := 0; type Dummy_Resource is new Boolean; function Make_Resource return Dummy_Resource is begin Net_Resources_Allocated := Net_Resources_Allocated + 1; return True; end Make_Resource; procedure Release_Resource (X : in Dummy_Resource) is pragma Unreferenced (X); begin Net_Resources_Allocated := Net_Resources_Allocated - 1; end Release_Resource; package Unique_Dummy_Resources is new Unique_C_Resources(T => Dummy_Resource, Initialize => Make_Resource, Finalize => Release_Resource); subtype Unique_Dummy_Resource is Unique_Dummy_Resources.Unique_T; use type Unique_Dummy_Resources.Unique_T; subtype Unique_Dummy_Resource_No_Default is Unique_Dummy_Resources.Unique_T_No_Default; use type Unique_Dummy_Resources.Unique_T_No_Default; package Smart_Dummy_Resources is new Smart_C_Resources(T => Dummy_Resource, Initialize => Make_Resource, Finalize => Release_Resource, Counters => Basic_Counters.Basic_Counters_Spec); subtype Smart_Dummy_Resource is Smart_Dummy_Resources.Smart_T; use type Smart_Dummy_Resources.Smart_T; subtype Smart_Dummy_Resource_No_Default is Smart_Dummy_Resources.Smart_T_No_Default; use type Smart_Dummy_Resources.Smart_T_No_Default; -------------------- -- Register_Tests -- -------------------- procedure Register_Tests (T: in out C_Resource_Test) is use AUnit.Test_Cases.Registration; begin Register_Routine (T, Check_Unique_C_Resource'Access, "Check Unique_T C resource handling"); Register_Routine (T, Check_Smart_C_Resource'Access, "Check Smart_T C resource handling"); end Register_Tests; ---------- -- Name -- ---------- function Name (T : C_Resource_Test) return Test_String is pragma Unreferenced (T); begin return Format ("Tests of Unique_C_Resources and Smart_C_Resources"); end Name; ------------ -- Set_Up -- ------------ procedure Set_Up (T : in out C_Resource_Test) is begin null; end Set_Up; ----------------------------- -- Check_Unique_C_Resource -- ----------------------------- procedure Check_Unique_C_Resource (T : in out Test_Cases.Test_Case'Class) is pragma Unreferenced(T); begin Net_Resources_Allocated := 0; declare UDR1 : Unique_Dummy_Resource; begin Assert (Net_Resources_Allocated = 1, "Default initialization of a Unique_T did not call the " & "initialization routine"); Assert (UDR1.Element = True, "Default initialization of a Unique_T did not set up " & "the contents correctly"); end; Assert (Net_Resources_Allocated = 0, "Destruction of a Unique_T did not call the finalization " & "routine"); declare UDR2 : constant Unique_Dummy_Resource_No_Default := Unique_Dummy_Resources.Make_Unique_T(False); begin Assert (Net_Resources_Allocated = 0, "Non-default initialization of a Unique_T_No_Default called " & "the initialization routine"); Assert (UDR2.Element = False, "Default initialization of a Unique_T did not set up " & "the contents correctly"); end; Assert (Net_Resources_Allocated = -1, "Destruction of a Unique_T_No_Default did not call the " & "finalization routine"); end Check_Unique_C_Resource; ---------------------------- -- Check_Smart_C_Resource -- ---------------------------- procedure Check_Smart_C_Resource (T : in out Test_Cases.Test_Case'Class) is pragma Unreferenced(T); SDR1 : Smart_Dummy_Resource; begin Assert (SDR1.Element = True, "Default initialization of a Smart_T did not set up " & "the contents correctly"); Assert (SDR1.Unique, "Default initialization of a Smart_T did not set up " & "the reference counter properly"); Net_Resources_Allocated := 0; declare SDR2 : Smart_Dummy_Resource; begin Assert (Net_Resources_Allocated = 1, "Default initialization of a second independent Smart_T did " & "not call the initialization routine"); Assert (SDR2.Element = True, "Default initialization of a second independent Smart_T " & "did not set up the contents correctly"); Assert (SDR2.Use_Count = 1, "Default initialization of a second independent Smart_T " & "did not set up the reference counter properly"); end; Assert (Net_Resources_Allocated = 0, "Destruction of a second independent Smart_T did not call the " & "finalization routine"); declare SDR3 : constant Smart_Dummy_Resource_No_Default := Smart_Dummy_Resources.Make_Smart_T(False); begin Assert (SDR3.Element = False, "Explicit of a second independent Smart_T " & "did not set up the contents correctly"); end; Net_Resources_Allocated := 0; declare SDR4 : constant Smart_Dummy_Resource := SDR1; begin Assert (Net_Resources_Allocated = 0, "Copying a Smart_T called the initialization again"); Assert (SDR1 = SDR4, "Copying a Smart_T did not copy the contents"); Assert (SDR4.Use_Count = 2, "Copying a Smart_T did not increment the Use_Count"); end; Assert (SDR1.Use_Count = 1, "Destroying a copied Smart_T did not decrement the Use_Count"); Assert (Net_Resources_Allocated = 0, "Destruction of a copied Smart_T called the finalization " & "finalization routine although the original still exists"); end Check_Smart_C_Resource; end Auto_Counters_Suite.C_Resources_Tests ;
reznikmm/matreshka
Ada
3,987
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Chart_Stacked_Attributes; package Matreshka.ODF_Chart.Stacked_Attributes is type Chart_Stacked_Attribute_Node is new Matreshka.ODF_Chart.Abstract_Chart_Attribute_Node and ODF.DOM.Chart_Stacked_Attributes.ODF_Chart_Stacked_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Chart_Stacked_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Chart_Stacked_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Chart.Stacked_Attributes;
charlie5/cBound
Ada
1,443
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces.C; with xcb.xcb_coloritem_t; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_coloritem_iterator_t is -- Item -- type Item is record data : access xcb.xcb_coloritem_t.Item; the_rem : aliased Interfaces.C.int; index : aliased Interfaces.C.int; end record; -- Item_Array -- type Item_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_coloritem_iterator_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_coloritem_iterator_t.Item, Element_Array => xcb.xcb_coloritem_iterator_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_coloritem_iterator_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_coloritem_iterator_t.Pointer, Element_Array => xcb.xcb_coloritem_iterator_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_coloritem_iterator_t;
reznikmm/matreshka
Ada
4,819
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Internals.Utp_Elements; with AMF.UML.Properties; with AMF.Utp.SUTs; with AMF.Visitors; package AMF.Internals.Utp_SUTs is type Utp_SUT_Proxy is limited new AMF.Internals.Utp_Elements.Utp_Element_Proxy and AMF.Utp.SUTs.Utp_SUT with null record; overriding function Get_Base_Property (Self : not null access constant Utp_SUT_Proxy) return AMF.UML.Properties.UML_Property_Access; -- Getter of SUT::base_Property. -- overriding procedure Set_Base_Property (Self : not null access Utp_SUT_Proxy; To : AMF.UML.Properties.UML_Property_Access); -- Setter of SUT::base_Property. -- overriding procedure Enter_Element (Self : not null access constant Utp_SUT_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Leave_Element (Self : not null access constant Utp_SUT_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Visit_Element (Self : not null access constant Utp_SUT_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); end AMF.Internals.Utp_SUTs;
AdaCore/Ada_Drivers_Library
Ada
19,041
adb
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2019, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Filesystem; use Filesystem; with Filesystem.MBR; use Filesystem.MBR; with Filesystem.FAT; use Filesystem.FAT; with HAL.Filesystem; use HAL.Filesystem; with Ada.Unchecked_Conversion; package body File_IO is package HALFS renames HAL.Filesystem; function Convert is new Ada.Unchecked_Conversion (HALFS.Status_Code, Status_Code); function Convert is new Ada.Unchecked_Conversion (File_Mode, HALFS.File_Mode); function Convert is new Ada.Unchecked_Conversion (File_Size, HALFS.File_Size); function Convert is new Ada.Unchecked_Conversion (HALFS.File_Size, File_Size); function Convert is new Ada.Unchecked_Conversion (Seek_Mode, HALFS.Seek_Mode); type Mount_Record is record Is_Free : Boolean := True; Name : String (1 .. Max_Mount_Name_Length); Name_Len : Positive; FS : Any_Filesystem_Driver; end record; subtype Mount_Index is Integer range 0 .. Max_Mount_Points; subtype Valid_Mount_Index is Mount_Index range 1 .. Max_Mount_Points; type Mount_Array is array (Valid_Mount_Index) of Mount_Record; type VFS_Directory_Handle is new Directory_Handle with record Is_Free : Boolean := True; Mount_Id : Mount_Index; end record; overriding function Get_FS (Dir : VFS_Directory_Handle) return Any_Filesystem_Driver; -- Return the filesystem the handle belongs to. overriding function Read (Dir : in out VFS_Directory_Handle; Handle : out Any_Node_Handle) return HALFS.Status_Code; -- Reads the next directory entry. If no such entry is there, an error -- code is returned in Status. overriding procedure Reset (Dir : in out VFS_Directory_Handle); -- Resets the handle to the first node overriding procedure Close (Dir : in out VFS_Directory_Handle); -- Closes the handle, and free the associated resources. function Open (Path : String; Handle : out Any_Directory_Handle) return Status_Code; function Open (Path : String; Mode : File_Mode; Handle : out Any_File_Handle) return Status_Code; Mount_Points : Mount_Array; Handles : array (1 .. 2) of aliased VFS_Directory_Handle; function Name (Point : Mount_Record) return Mount_Path; procedure Set_Name (Point : in out Mount_Record; Path : Mount_Path); procedure Split (Path : String; FS : out Any_Filesystem_Driver; Start_Index : out Natural); ---------- -- Open -- ---------- function Open (File : in out File_Descriptor; Name : String; Mode : File_Mode) return Status_Code is Ret : Status_Code; begin if Is_Open (File) then return Invalid_Parameter; end if; Ret := Open (Name, Mode, File.Handle); if Ret /= OK then File.Handle := null; end if; return Ret; end Open; ----------- -- Close -- ----------- procedure Close (File : in out File_Descriptor) is begin if File.Handle /= null then File.Handle.Close; File.Handle := null; end if; end Close; ------------- -- Is_Open -- ------------- function Is_Open (File : File_Descriptor) return Boolean is (File.Handle /= null); ----------- -- Flush -- ----------- function Flush (File : File_Descriptor) return Status_Code is begin if File.Handle /= null then return Convert (File.Handle.Flush); else return Invalid_Parameter; end if; end Flush; ---------- -- Size -- ---------- function Size (File : File_Descriptor) return File_Size is begin if File.Handle = null then return 0; else return Convert (File.Handle.Size); end if; end Size; ---------- -- Read -- ---------- function Read (File : File_Descriptor; Addr : System.Address; Length : File_Size) return File_Size is Ret : HALFS.File_Size; Status : Status_Code; begin if File.Handle = null then return 0; end if; Ret := Convert (Length); Status := Convert (File.Handle.Read (Addr, Ret)); if Status /= OK then return 0; else return Convert (Ret); end if; end Read; ----------- -- Write -- ----------- function Write (File : File_Descriptor; Addr : System.Address; Length : File_Size) return File_Size is Ret : HALFS.File_Size; Status : Status_Code; begin if File.Handle = null then return 0; end if; Ret := Convert (Length); Status := Convert (File.Handle.Write (Addr, Ret)); if Status /= OK then return 0; else return Convert (Ret); end if; end Write; ------------ -- Offset -- ------------ function Offset (File : File_Descriptor) return File_Size is begin if File.Handle /= null then return Convert (File.Handle.Offset); else return 0; end if; end Offset; ---------- -- Seek -- ---------- function Seek (File : in out File_Descriptor; Origin : Seek_Mode; Amount : in out File_Size) return Status_Code is Ret : Status_Code; HALFS_Amount : HALFS.File_Size; begin if File.Handle /= null then HALFS_Amount := Convert (Amount); Ret := Convert (File.Handle.Seek (Convert (Origin), HALFS_Amount)); Amount := Convert (HALFS_Amount); return Ret; else return Invalid_Parameter; end if; end Seek; ------------------- -- Generic_Write -- ------------------- function Generic_Write (File : File_Descriptor; Value : T) return Status_Code is begin if File.Handle /= null then return Convert (File.Handle.Write (Value'Address, T'Size / 8)); else return Invalid_Parameter; end if; end Generic_Write; ------------------ -- Generic_Read -- ------------------ function Generic_Read (File : File_Descriptor; Value : out T) return Status_Code is L : HALFS.File_Size := T'Size / 8; begin if File.Handle /= null then return Convert (File.Handle.Read (Value'Address, L)); else return Invalid_Parameter; end if; end Generic_Read; ---------- -- Open -- ---------- function Open (Dir : in out Directory_Descriptor; Name : String) return Status_Code is Ret : Status_Code; begin if Dir.Handle /= null then return Invalid_Parameter; end if; Ret := Open (Name, Dir.Handle); if Ret /= OK then Dir.Handle := null; end if; return Ret; end Open; ----------- -- Close -- ----------- procedure Close (Dir : in out Directory_Descriptor) is begin if Dir.Handle /= null then Dir.Handle.Close; end if; end Close; ---------- -- Read -- ---------- function Read (Dir : in out Directory_Descriptor) return Directory_Entry is Node : Any_Node_Handle; Status : Status_Code; begin if Dir.Handle = null then return Invalid_Dir_Entry; end if; Status := Convert (Dir.Handle.Read (Node)); if Status /= OK then return Invalid_Dir_Entry; end if; declare Name : constant String := Node.Basename; Ret : Directory_Entry (Name_Length => Name'Length); begin Ret.Name := Name; Ret.Subdirectory := Node.Is_Subdirectory; Ret.Read_Only := Node.Is_Read_Only; Ret.Hidden := Node.Is_Hidden; Ret.Symlink := Node.Is_Symlink; Ret.Size := Convert (Node.Size); Node.Close; return Ret; end; end Read; ----------- -- Reset -- ----------- procedure Reset (Dir : in out Directory_Descriptor) is begin if Dir.Handle /= null then Dir.Handle.Reset; end if; end Reset; ----------------- -- Create_File -- ----------------- function Create_File (Path : String) return Status_Code is Idx : Natural; FS : Any_Filesystem_Driver; begin Split (Path, FS, Idx); if FS = null then return No_Such_Path; end if; return Convert (FS.Create_File (Path (Idx .. Path'Last))); end Create_File; ------------ -- Unlink -- ------------ function Unlink (Path : String) return Status_Code is Idx : Natural; FS : Any_Filesystem_Driver; begin Split (Path, FS, Idx); if FS = null then return No_Such_Path; end if; return Convert (FS.Unlink (Path (Idx .. Path'Last))); end Unlink; ---------------------- -- Remove_Directory -- ---------------------- function Remove_Directory (Path : String) return Status_Code is Idx : Natural; FS : Any_Filesystem_Driver; begin Split (Path, FS, Idx); if FS = null then return No_Such_Path; end if; return Convert (FS.Remove_Directory (Path (Idx .. Path'Last))); end Remove_Directory; --------------- -- Copy_File -- --------------- function Copy_File (Source_Path, Destination_Path : String; Buffer_Size : Positive := 512) return Status_Code is Src, Dst : File_Descriptor; Status : Status_Code; Buffer : HAL.UInt8_Array (1 .. Buffer_Size); Src_Len, Dst_Len : File_Size; begin Status := Open (Src, Source_Path, Read_Only); if Status /= OK then return Status; end if; Status := Create_File (Destination_Path); if Status /= OK then Close (Src); return Status; end if; Status := Open (Dst, Destination_Path, Write_Only); if Status /= OK then Close (Src); return Status; end if; loop Src_Len := Read (Src, Buffer'Address, Buffer'Length); exit when Src_Len = 0; Dst_Len := Write (Dst, Buffer'Address, Src_Len); if Dst_Len /= Src_Len then Close (Src); Close (Dst); return Input_Output_Error; end if; exit when Src_Len /= Buffer'Length; end loop; Close (Src); Close (Dst); return OK; end Copy_File; ---------- -- Name -- ---------- function Name (Point : Mount_Record) return Mount_Path is (Point.Name (1 .. Point.Name_Len)); -------------- -- Set_Name -- -------------- procedure Set_Name (Point : in out Mount_Record; Path : Mount_Path) is begin Point.Name (1 .. Path'Length) := Path; Point.Name_Len := Path'Length; end Set_Name; ----------- -- Split -- ----------- procedure Split (Path : String; FS : out Any_Filesystem_Driver; Start_Index : out Natural) is begin if Path'Length >= 1 and then Path (Path'First) /= '/' then FS := null; Start_Index := 0; return; end if; Start_Index := Path'Last + 1; for J in Path'First + 1 .. Path'Last loop if Path (J) = '/' then Start_Index := J; exit; end if; end loop; for M of Mount_Points loop if not M.Is_Free and then Name (M) = Path (Path'First + 1 .. Start_Index - 1) then FS := M.FS; return; end if; end loop; FS := null; Start_Index := 0; end Split; ------------------ -- Mount_Volume -- ------------------ function Mount_Volume (Mount_Point : Mount_Path; FS : Any_Filesystem_Driver) return Status_Code is Idx : Natural := 0; begin for P in Mount_Points'Range loop if not Mount_Points (P).Is_Free and then Name (Mount_Points (P)) = Mount_Point then return Already_Exists; elsif Idx = 0 and then Mount_Points (P).Is_Free then Idx := P; end if; end loop; if Idx = 0 then return Too_Many_Open_Files; end if; Mount_Points (Idx).Is_Free := False; Mount_Points (Idx).FS := FS; Set_Name (Mount_Points (Idx), Mount_Point); return OK; end Mount_Volume; ----------------- -- Mount_Drive -- ----------------- function Mount_Drive (Mount_Point : Mount_Path; Device : HAL.Block_Drivers.Any_Block_Driver) return Status_Code is MBR : Master_Boot_Record; Status : Status_Code; FAT_FS : FAT_Filesystem_Access; begin Status := Read (Device, MBR); if Status /= OK then return Status; end if; for P in Partition_Number'Range loop if Valid (MBR, P) and then Get_Type (MBR, P) in 6 | 11 .. 12 then Status := OK; FAT_FS := new FAT_Filesystem; Status := Convert (Open (Controller => Device, LBA => LBA (MBR, P), FS => FAT_FS.all)); return Mount_Volume (Mount_Point, HALFS.Any_Filesystem_Driver (FAT_FS)); end if; end loop; return No_Filesystem; end Mount_Drive; ------------- -- Unmount -- ------------- function Unmount (Mount_Point : Mount_Path) return Status_Code is begin for P in Mount_Points'Range loop if Name (Mount_Points (P)) = Mount_Point then Mount_Points (P).FS.Close; Mount_Points (P).Is_Free := True; return OK; end if; end loop; return Not_Mounted; end Unmount; ------------ -- Get_FS -- ------------ overriding function Get_FS (Dir : VFS_Directory_Handle) return Any_Filesystem_Driver is pragma Unreferenced (Dir); begin return null; end Get_FS; ---------- -- Read -- ---------- overriding function Read (Dir : in out VFS_Directory_Handle; Handle : out Any_Node_Handle) return HALFS.Status_Code is begin loop if Dir.Mount_Id = Mount_Points'Last then Handle := null; return No_More_Entries; end if; Dir.Mount_Id := Dir.Mount_Id + 1; if not Mount_Points (Dir.Mount_Id).Is_Free then return Mount_Points (Dir.Mount_Id).FS.Root_Node (Name (Mount_Points (Dir.Mount_Id)), Handle); end if; end loop; end Read; ----------- -- Reset -- ----------- overriding procedure Reset (Dir : in out VFS_Directory_Handle) is begin Dir.Mount_Id := 0; end Reset; ----------- -- Close -- ----------- overriding procedure Close (Dir : in out VFS_Directory_Handle) is begin Dir.Is_Free := True; end Close; ---------- -- Open -- ---------- function Open (Path : String; Mode : File_Mode; Handle : out Any_File_Handle) return Status_Code is Idx : Natural; FS : Any_Filesystem_Driver; begin Split (Path, FS, Idx); if FS = null then Handle := null; return No_Such_Path; end if; return Convert (FS.Open (Path (Idx .. Path'Last), Convert (Mode), Handle)); end Open; ---------- -- Open -- ---------- function Open (Path : String; Handle : out Any_Directory_Handle) return Status_Code is Idx : Natural; FS : Any_Filesystem_Driver; begin if Path = "/" then for J in Handles'Range loop if Handles (J).Is_Free then Handles (J).Is_Free := False; Handles (J).Mount_Id := 0; Handle := Handles (J)'Access; return OK; end if; end loop; Handle := null; return Too_Many_Open_Files; end if; Split (Path, FS, Idx); if FS = null then Handle := null; return No_Such_Path; end if; if Idx > Path'Last then return Convert (FS.Open ("/", Handle)); else return Convert (FS.Open (Path (Idx .. Path'Last), Handle)); end if; end Open; end File_IO;
DrenfongWong/tkm-rpc
Ada
397
ads
with Ada.Unchecked_Conversion; package Tkmrpc.Response.Ike.Nc_Reset.Convert is function To_Response is new Ada.Unchecked_Conversion ( Source => Nc_Reset.Response_Type, Target => Response.Data_Type); function From_Response is new Ada.Unchecked_Conversion ( Source => Response.Data_Type, Target => Nc_Reset.Response_Type); end Tkmrpc.Response.Ike.Nc_Reset.Convert;
sungyeon/drake
Ada
1,471
ads
pragma License (Unrestricted); -- runtime unit for ZCX with C.unwind; package System.Unwind.Searching is pragma Preelaborate; function Unwind_RaiseException ( exc : access C.unwind.struct_Unwind_Exception) return C.unwind.Unwind_Reason_Code renames C.unwind.Unwind_RaiseException; function Unwind_ForcedUnwind ( exc : access C.unwind.struct_Unwind_Exception; stop : C.unwind.Unwind_Stop_Fn; stop_argument : C.void_ptr) return C.unwind.Unwind_Reason_Code renames C.unwind.Unwind_ForcedUnwind; -- (a-exexpr-gcc.adb) Others_Value : aliased constant C.char := 'O' with Export, Convention => C, External_Name => "__gnat_others_value"; All_Others_Value : aliased constant C.char := 'A' with Export, Convention => C, External_Name => "__gnat_all_others_value"; -- personality function (raise-gcc.c) function Personality ( ABI_Version : C.signed_int; Phases : C.unwind.Unwind_Action; Exception_Class : C.unwind.Unwind_Exception_Class; Exception_Object : access C.unwind.struct_Unwind_Exception; Context : access C.unwind.struct_Unwind_Context) return C.unwind.Unwind_Reason_Code with Export, Convention => C, External_Name => "__gnat_personality_v0"; pragma Compile_Time_Error ( Personality'Access = C.unwind.Unwind_Personality_Fn'(null), "this expression is always false, for type check purpose"); end System.Unwind.Searching;
reznikmm/matreshka
Ada
4,574
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Svg.Hanging_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Svg_Hanging_Attribute_Node is begin return Self : Svg_Hanging_Attribute_Node do Matreshka.ODF_Svg.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Svg_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Svg_Hanging_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Hanging_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Svg_URI, Matreshka.ODF_String_Constants.Hanging_Attribute, Svg_Hanging_Attribute_Node'Tag); end Matreshka.ODF_Svg.Hanging_Attributes;
reznikmm/matreshka
Ada
4,779
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Db_Column_Definitions_Elements; package Matreshka.ODF_Db.Column_Definitions_Elements is type Db_Column_Definitions_Element_Node is new Matreshka.ODF_Db.Abstract_Db_Element_Node and ODF.DOM.Db_Column_Definitions_Elements.ODF_Db_Column_Definitions with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Db_Column_Definitions_Element_Node; overriding function Get_Local_Name (Self : not null access constant Db_Column_Definitions_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Db_Column_Definitions_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Db_Column_Definitions_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Db_Column_Definitions_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Db.Column_Definitions_Elements;
AaronC98/PlaneSystem
Ada
3,846
ads
------------------------------------------------------------------------------ -- Ada Web Server -- -- -- -- Copyright (C) 2003-2015, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- 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/>. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ -- Dispatcher for SOAP requests with AWS.Dispatchers; with AWS.Response; with AWS.Status; with SOAP.Message.Payload; with SOAP.WSDL.Schema; package SOAP.Dispatchers is type Handler is abstract new AWS.Dispatchers.Handler with private; -- This dispatcher will send SOAP and HTTP requests to different routines function Schema (Dispatcher : Handler; SOAPAction : String) return WSDL.Schema.Definition; -- Returns the schema for the given SOAPAction type SOAP_Callback is access function (SOAPAction : String; Payload : Message.Payload.Object; Request : AWS.Status.Data) return AWS.Response.Data; -- This is the SOAP Server callback type. SOAPAction is the HTTP header -- SOAPAction value, Payload is the parsed XML payload, request is the -- HTTP request status. function Dispatch_SOAP (Dispatcher : Handler; SOAPAction : String; Payload : Message.Payload.Object; Request : AWS.Status.Data) return AWS.Response.Data is abstract; -- This dispatch function is called for SOAP requests function Dispatch_HTTP (Dispatcher : Handler; Request : AWS.Status.Data) return AWS.Response.Data is abstract; -- This dispatch function is called for standard HTTP requests private overriding function Dispatch (Dispatcher : Handler; Request : AWS.Status.Data) return AWS.Response.Data; type Handler is abstract new AWS.Dispatchers.Handler with record Schema : WSDL.Schema.Definition; end record; end SOAP.Dispatchers;
godunko/adagl
Ada
5,197
ads
------------------------------------------------------------------------------ -- -- -- Ada binding for OpenGL/WebGL -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2016-2018, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with System.Storage_Elements; private with WebAPI.WebGL.Buffers; private with WebAPI.WebGL.Rendering_Contexts; generic type Element is private; type Index is (<>); type Element_Array is array (Index range <>) of Element; package OpenGL.Generic_Buffers is pragma Preelaborate; type OpenGL_Buffer (Buffer_Type : OpenGL.Buffer_Type) is tagged limited private; procedure Allocate (Self : in out OpenGL_Buffer'Class; Data : Element_Array); -- Allocates necessary space to the buffer, initialized to the contents of -- Data. Any previous contents will be removed. function Bind (Self : in out OpenGL_Buffer'Class) return Boolean; -- Binds the buffer associated with this object to the current OpenGL -- context. Returns False if binding was not possible. -- -- The buffer must be bound to the same OpenGL_Context current when Create -- was called. Otherwise, False will be returned from this function. procedure Bind (Self : in out OpenGL_Buffer'Class); -- Binds the buffer associated with this object to the current OpenGL -- context. Raise Program_Error if binding was not possible. -- -- The buffer must be bound to the same OpenGL_Context current when Create -- was called. Otherwise, Program_Error will be raised by this function. function Create (Self : in out OpenGL_Buffer'Class) return Boolean; -- Creates the buffer object in the OpenGL server. Returns True if the -- object was created; False otherwise. procedure Create (Self : in out OpenGL_Buffer'Class); -- Creates the buffer object in the OpenGL server. Raise Program_Error if -- the object was created; False otherwise. function Stride return System.Storage_Elements.Storage_Count; -- Returns offset between two elements in element array in storage units. private type OpenGL_Buffer (Buffer_Type : OpenGL.Buffer_Type) is tagged limited record Context : WebAPI.WebGL.Rendering_Contexts.WebGL_Rendering_Context_Access; Buffer : WebAPI.WebGL.Buffers.WebGL_Buffer_Access; end record; end OpenGL.Generic_Buffers;
reznikmm/matreshka
Ada
3,809
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Draw_Start_Line_Spacing_Horizontal_Attributes is pragma Preelaborate; type ODF_Draw_Start_Line_Spacing_Horizontal_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Draw_Start_Line_Spacing_Horizontal_Attribute_Access is access all ODF_Draw_Start_Line_Spacing_Horizontal_Attribute'Class with Storage_Size => 0; end ODF.DOM.Draw_Start_Line_Spacing_Horizontal_Attributes;
Vovanium/Encodings
Ada
1,149
adb
with Ada.Assertions; use Ada.Assertions; package body Encodings.Line_Endings.Generic_Strip_CR is procedure Convert( This: in out Coder; Source: in String_Type; Source_Last: out Natural; Target: out String_Type; Target_Last: out Natural ) is C: Character_Type; begin Source_Last := Source'First - 1; Target_Last := Target'First - 1; while Source_Last < Source'Last loop C := Source(Source_Last + 1); if This.Have_CR and C /= Line_Feed then -- emit CR not the part of CRLF sequence if Target_Last < Target'Last then Target_Last := Target_Last + 1; Target(Target_Last) := Carriage_Return; else return; end if; This.Have_CR := False; end if; if C = Carriage_Return then Assert(This.Have_CR = False, "Have should be cleared before or if condition shoudn't be true"); This.Have_CR := True; else This.Have_CR := False; if Target_Last < Target'Last then Target_Last := Target_Last + 1; Target(Target_Last) := C; else return; end if; end if; Source_Last := Source_Last + 1; end loop; end Convert; end Encodings.Line_Endings.Generic_Strip_CR;
annexi-strayline/ASAP-Unicode
Ada
3,499
ads
------------------------------------------------------------------------------ -- -- -- Unicode Utilities -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2019, 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. -- -- -- ------------------------------------------------------------------------------ package Unicode with Pure is Unicode_Replacement_Character: constant Wide_Wide_Character := Wide_Wide_Character'Val (16#FFFD#); -- This is the recomended character (U+FFFD) to fill in for an invalid -- encoding sequence end Unicode;
optikos/oasis
Ada
1,905
adb
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Ada.Characters.Conversions; with Ada.Command_Line; with Ada.Wide_Wide_Text_IO; with Program.Compilation_Unit_Vectors; with Program.Compilation_Units; with Program.Plain_Contexts; with Program.Visibility; with Program.Storage_Pools.Instance; pragma Unreferenced (Program.Storage_Pools.Instance); with Dump_Elements; procedure Dump_Tree is File : constant String := Ada.Command_Line.Argument (1); procedure Process_Units (List : Program.Compilation_Unit_Vectors.Compilation_Unit_Vector_Access); procedure Process_Unit (Unit : Program.Compilation_Units.Compilation_Unit_Access); procedure Process_Unit (Unit : Program.Compilation_Units.Compilation_Unit_Access) is begin Ada.Wide_Wide_Text_IO.Put_Line ("Unit: " & Unit.Full_Name); Dump_Elements.Print (Unit.Unit_Declaration); end Process_Unit; procedure Process_Units (List : Program.Compilation_Unit_Vectors.Compilation_Unit_Vector_Access) is begin for Cursor in List.Each_Unit loop Process_Unit (Cursor.Unit); end loop; end Process_Units; Ctx : aliased Program.Plain_Contexts.Context; Env : aliased Program.Visibility.Context; begin Ctx.Initialize; Ctx.Parse_File (Ada.Characters.Conversions.To_Wide_Wide_String (File), Env); -- Ada.Wide_Wide_Text_IO.Put_Line ("Compilation: " & C.Text_Name); -- Ada.Wide_Wide_Text_IO.Put_Line -- ("Total lines:" & Natural'Wide_Wide_Image (C.Line_Count)); -- Ada.Wide_Wide_Text_IO.Put_Line -- ("Total lexical elements:" -- & Natural'Wide_Wide_Image (C.Lexical_Element_Count)); Process_Units (Ctx.Library_Unit_Declarations); Process_Units (Ctx.Compilation_Unit_Bodies); end Dump_Tree;
Tim-Tom/scratch
Ada
18,205
adb
with Ada.Containers.Ordered_Sets; with Ada.Unchecked_Deallocation; with Ada.Containers.Generic_Array_Sort; with Ada.Text_IO; package body Decipherer is package Character_Sets is new Ada.Containers.Ordered_Sets(Element_Type => Encrypted_Char); package IO renames Ada.Text_IO; type Priority_Pair is record item, priority : Integer; end record; type Priority_Pair_Array is Array(Positive range <>) of Priority_Pair; function "<"(a, b : Priority_Pair) return Boolean is begin return a.priority > b.priority; end "<"; procedure Priority_Pair_Sort is new Ada.Containers.Generic_Array_Sort(Index_Type => Positive, Element_Type => Priority_Pair, Array_Type => Priority_Pair_Array); type Mapping_Candidates is Array(Positive range 1 .. 26) of Character; type Char_Possibilities is record c : Encrypted_Char; num_possible : Natural; possibilities : Mapping_Candidates; end record; type Word_Possibilities is record is_using_root : Boolean; words : Word_List.Word_Vector; end record; type Guess_Order_Array is Array(Positive range <>) of Positive; type Char_Possibilities_Array is Array(Positive range <>) of Char_Possibilities; type Word_Possibilities_Array is Array(Positive range <>) of Word_Possibilities; type Word_Inclusion is Array(Positive range <>, Positive range <>) of Natural; type Letter_Toggle is Array(Positive range <>) of Boolean; type Word_Toggle is Array(Positive range <>) of Boolean; package Word_Vectors renames Word_List.Word_Vectors; function "="(a, b: Word_Vectors.Cursor) return Boolean renames Word_Vectors."="; procedure Free_Word_Vector is new Ada.Unchecked_Deallocation(Object => Word_Vectors.Vector, Name => Word_List.Word_Vector); type Decipher_State (num_words : Positive; num_letters : Positive) is record candidates : Candidate_Set(1 .. num_words); characters : Char_Possibilities_Array(1 .. num_letters); words : Word_Possibilities_Array(1 .. num_words); inclusion : Word_Inclusion(1 .. num_letters, 1 .. num_words); guess_order : Guess_Order_Array(1 .. num_letters); results : Result_Vector; end record; function Image(ew: Encrypted_Word) return Word_List.Word is w : Word_List.Word; begin for i in ew'Range loop w(i) := Character(ew(i)); end loop; return w; end Image; function Get_Character_Index(state : Decipher_State; c : Encrypted_Char) return Positive is begin for ci in state.characters'Range loop if c = state.characters(ci).c then return ci; end if; end loop; raise Constraint_Error; end Get_Character_Index; function Is_Word_Valid(state : Decipher_State; candidate : Encrypted_Word; word : Word_List.Word) return Boolean is begin for i in candidate'Range loop exit when candidate(i) = ' '; declare ci : constant Positive := Get_Character_Index(state, candidate(i)); c : constant Character := word(i); cp : Char_Possibilities renames state.characters(ci); found : Boolean := False; begin if cp.num_possible = 1 then found := cp.possibilities(1) = c; elsif cp.num_possible = 26 then found := True; else for j in 1 .. cp.num_possible loop if cp.possibilities(j) = c then found := True; exit; end if; end loop; end if; if not found then return False; end if; end; end loop; return True; end Is_Word_Valid; procedure Filter_Word_List(state : Decipher_State; candidate : Encrypted_Word; initial : Word_List.Word_Vector; final : Word_List.Word_Vector) is cur : Word_Vectors.Cursor := initial.First; begin while cur /= Word_Vectors.No_Element loop if Is_Word_Valid(state, candidate, Word_Vectors.Element(cur)) then final.Append(Word_Vectors.Element(cur)); end if; cur := Word_Vectors.Next(cur); end loop; end Filter_Word_List; procedure Put_Possible(cp: Char_Possibilities) is begin for i in 1 .. cp.Num_Possible loop IO.Put(cp.possibilities(i)); end loop; IO.New_Line; end Put_Possible; procedure Put_Inclusion(state: Decipher_State) is begin for i in 1 .. state.Num_Letters loop IO.Put(Encrypted_Char'Image(state.characters(i).c) & ": "); for j in 1 .. state.Num_Words loop exit when state.inclusion(i, j) = 0; IO.Put(Natural'Image(state.inclusion(i, j))); end loop; IO.New_Line; end loop; end Put_Inclusion; procedure Put_Solution(state : Decipher_State) is begin IO.Put_Line("Found Solution"); for ci in 1 .. state.num_letters loop IO.Put(Character(state.characters(ci).c)); if state.characters(ci).num_possible /= 1 then IO.Put_Line(": Invalid State"); return; end if; end loop; IO.New_Line; for ci in 1 .. state.num_letters loop IO.Put(state.characters(ci).possibilities(1)); end loop; IO.New_Line; for wi in 1 .. state.num_words loop IO.Put(Image(state.candidates(wi)) & ": "); if Natural(state.words(wi).words.all.Length) = 1 then IO.Put_Line(state.words(wi).words.First_Element); else IO.Put_Line("*Invalid: " & Ada.Containers.Count_Type'Image(state.words(wi).words.all.Length) & " Words"); end if; end loop; IO.Put_Line("--------------------------"); end Put_Solution; procedure Make_Unique(state : in out Decipher_State; ci : Positive; success : out Boolean; changed : in out Letter_Toggle) is letter : constant Character := state.characters(ci).possibilities(1); begin success := True; -- IO.Put_Line("Determined that " & Encrypted_Char'Image(state.characters(ci).c) & " has to be a " & Character'Image(letter)); for i in state.characters'Range loop if i /= ci then declare cp : Char_Possibilities renames state.characters(i); begin for j in 1 .. cp.num_possible loop if cp.possibilities(j) = letter then if cp.num_possible = 1 then success := False; return; else -- IO.Put("Before: "); Put_Possible(cp); cp.possibilities(j .. cp.num_possible - 1) := cp.possibilities(j + 1 .. cp.num_possible); cp.num_possible := cp.num_possible - 1; -- IO.Put("After: "); Put_Possible(cp); changed(i) := True; if cp.num_possible = 1 then -- IO.Put_Line("Make_Unique from Make_Unique"); Make_Unique(state, i, success, changed); if not success then return; end if; end if; exit; end if; end if; end loop; end; end if; end loop; end Make_Unique; procedure Constrain_Letters(state : in out Decipher_State; wi : Positive; success : out Boolean; changed : in out Letter_Toggle) is ci : Positive; cur : Word_Vectors.Cursor := state.words(wi).words.all.First; word : Word_List.Word; seen : Array(Positive range 1 .. state.num_letters, Character range 'a' .. 'z') of Boolean := (others => (others => False)); used : Array(Positive range 1 .. state.num_letters) of Boolean := (others => False); begin success := True; while cur /= Word_Vectors.No_Element loop word := Word_Vectors.Element(cur); for i in word'Range loop exit when word(i) = ' '; ci := Get_Character_Index(state, state.candidates(wi)(i)); seen(ci, word(i)) := True; used(ci) := True; end loop; cur := Word_Vectors.Next(cur); end loop; for i in used'range loop if used(i) then -- IO.Put("Seen: "); -- for c in Character range 'a' .. 'z' loop -- if (seen(i, c)) then -- IO.Put(c); -- end if; -- end loop; -- IO.New_Line; declare cp : Char_Possibilities renames state.characters(i); shrunk : Boolean := False; write_head : Natural := 0; begin -- IO.Put("Before: "); Put_Possible(cp); for read_head in 1 .. cp.Num_Possible loop if seen(i, cp.possibilities(read_head)) then write_head := write_head + 1; if write_head /= read_head then cp.possibilities(write_head) := cp.possibilities(read_head); end if; else shrunk := True; end if; end loop; cp.Num_Possible := write_head; -- IO.Put("After: "); Put_Possible(cp); if Shrunk then changed(i) := True; if cp.Num_Possible = 0 then success := False; return; elsif cp.Num_Possible = 1 then -- IO.Put_Line("Make_Unique from Constrain_Letters"); Make_Unique(state, i, success, changed); if not success then return; end if; end if; end if; end; end if; end loop; end Constrain_Letters; procedure Check_Constraints(state : in out Decipher_State; changed : Letter_Toggle; success : out Boolean) is words : Word_Toggle(1 .. state.num_words) := (others => False); follow_up : Letter_Toggle(1 .. state.num_letters) := (others => False); any_changed : Boolean := False; begin success := True; for i in 1 .. state.num_letters loop if changed(i) then any_changed := True; for j in 1 .. state.num_words loop exit when state.inclusion(i, j) = 0; words(state.inclusion(i, j)) := True; end loop; end if; end loop; if not any_changed then return; end if; for i in 1 .. state.num_words loop if words(i) then declare new_words : Word_List.Word_Vector := new Word_Vectors.Vector; begin Filter_Word_List(state, state.candidates(i), state.words(i).words, new_words); if Natural(new_words.Length) = 0 then Free_Word_Vector(new_words); success := False; return; elsif Natural(new_words.Length) = Natural(state.words(i).words.Length) then -- IO.Put_Line("Word set for " & Positive'Image(i) & "(" & Image(state.candidates(i)) & ") did not shrink from " & Ada.Containers.Count_Type'Image(state.words(i).words.all.Length)); Free_Word_Vector(new_Words); else -- IO.Put_Line("Restricting word set for " & Positive'Image(i) & "(" & Image(state.candidates(i)) & ") from " & Ada.Containers.Count_Type'Image(state.words(i).words.all.Length) & " to " & Ada.Containers.Count_Type'Image(new_words.all.Length)); if state.words(i).is_using_root then state.words(i).is_using_root := False; else Free_Word_Vector(state.words(i).words); end if; state.words(i).words := new_words; Constrain_Letters(state, i, success, follow_up); if not success then return; end if; end if; end; end if; end loop; Check_Constraints(state, follow_up, success); end Check_Constraints; procedure Guess_Letter(state : in out Decipher_State; gi : Positive) is begin if gi > state.num_letters then declare result : Result_Set := (others => '.'); begin -- Put_Solution(state); for ci in 1 .. state.num_letters loop if state.characters(ci).num_possible /= 1 then raise Constraint_Error; end if; result(state.characters(ci).c) := state.characters(ci).possibilities(1); end loop; for wi in 1 .. state.num_words loop if Natural(state.words(wi).words.all.Length) /= 1 then raise Constraint_Error; end if; end loop; state.results.Append(result); end; else declare ci : constant Positive := state.guess_order(gi); begin if state.characters(ci).num_possible = 1 then -- Nothing to do, pass it up the line Guess_Letter(state, gi + 1); else declare success : Boolean; changed : Letter_Toggle(1 .. state.num_letters); characters : constant Char_Possibilities_Array := state.characters; words : constant Word_Possibilities_Array := state.words; cp : Char_Possibilities renames characters(ci); begin for mi in 1 .. cp.num_possible loop changed := (others => False); changed(ci) := True; state.characters(ci).possibilities(1) := characters(ci).possibilities(mi); -- IO.Put_Line("Guessing " & Character'Image(state.characters(ci).possibilities(mi)) & " for " & Encrypted_Char'Image(state.characters(ci).c)); state.characters(ci).num_possible := 1; for wi in 1 .. state.num_words loop state.words(wi).is_using_root := True; end loop; -- IO.Put_Line("Make_Unique from Guess_Letter"); Make_Unique(state, ci, success, changed); if success then Check_Constraints(state, changed, success); if success then Guess_Letter(state, gi + 1); end if; end if; for wi in 1 .. state.num_words loop if not state.words(wi).is_using_root then Free_Word_Vector(state.words(wi).words); end if; end loop; -- IO.Put_Line("Restore Letter guess for " & Positive'Image(ci)); state.characters := characters; state.words := words; end loop; end; end if; end; end if; end Guess_Letter; function Decipher(candidates: Candidate_Set; words: Word_List.Word_List) return Result_Vector is letters : Character_Sets.Set; begin for ci in candidates'Range loop for i in candidates(ci)'Range loop exit when candidates(ci)(i) = ' '; letters.Include(candidates(ci)(i)); end loop; end loop; declare num_words : constant Positive := Positive(candidates'Length); num_letters : constant Positive := Positive(letters.Length); state : Decipher_State(num_words, num_letters); cur : Character_Sets.Cursor := letters.First; inclusion_priority : Priority_Pair_Array(1 .. num_letters); begin state.candidates := candidates; state.inclusion := (others => (others => 0)); for i in 1 .. num_letters loop state.characters(i).c := Character_Sets.Element(cur); state.characters(i).num_possible := 26; inclusion_priority(i) := (item => i, priority => 0); for l in Character range 'a' .. 'z' loop state.characters(i).possibilities(Character'Pos(l) - Character'Pos('a') + 1) := l; end loop; cur := Character_Sets.Next(cur); end loop; for i in 1 .. num_words loop for l in candidates(Candidates'First + i - 1)'Range loop declare c : constant Encrypted_Char := candidates(Candidates'First + i - 1)(l); ci : Positive; begin exit when c = ' '; ci := Get_Character_Index(state, c); for mi in 1 .. num_words loop if state.inclusion(ci, mi) = 0 then state.inclusion(ci, mi) := i; inclusion_priority(ci).priority := mi; exit; elsif state.inclusion(ci, mi) = i then exit; end if; end loop; end; end loop; state.words(i).is_using_root := True; state.words(i).words := words.Element(Word_List.Make_Pattern(Image(candidates(i)))); end loop; Priority_Pair_Sort(inclusion_priority); -- Put_Inclusion(state); for i in inclusion_priority'range loop state.guess_order(i) := inclusion_priority(i).item; -- IO.Put_Line("Guess " & Integer'Image(i) & " is " & Encrypted_Char'Image(state.characters(inclusion_priority(i).item).c) & " with " & Integer'Image(inclusion_priority(i).priority) & " words connected to it"); end loop; Guess_Letter(state, 1); return state.results; end; end Decipher; end Decipherer;
godunko/adagl
Ada
4,592
ads
------------------------------------------------------------------------------ -- -- -- Ada binding for OpenGL/WebGL -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2016-2018, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ private with WebAPI.WebGL.Framebuffers; private with WebAPI.WebGL.Rendering_Contexts; with OpenGL.Renderbuffers; with OpenGL.Textures; package OpenGL.Framebuffers is pragma Preelaborate; type OpenGL_Framebuffer is tagged limited private; function Create (Self : in out OpenGL_Framebuffer'Class) return Boolean; procedure Create (Self : in out OpenGL_Framebuffer'Class); procedure Delete (Self : in out OpenGL_Framebuffer'Class); function Bind (Self : in out OpenGL_Framebuffer'Class) return Boolean; procedure Bind (Self : in out OpenGL_Framebuffer'Class); procedure Release (Self : in out OpenGL_Framebuffer'Class); procedure Read_Pixels (Self : in out OpenGL_Framebuffer'Class; X : OpenGL.GLint; Y : OpenGL.GLint; Width : OpenGL.GLsizei; Height : OpenGL.GLsizei; Data : out OpenGL.GLubyte_Vector_4_Array); procedure Set_Renderbuffer (Self : in out OpenGL_Framebuffer'Class; Renderbuffer : OpenGL.Renderbuffers.OpenGL_Renderbuffer'Class; Attachment : OpenGL.GLenum); procedure Set_Texture (Self : in out OpenGL_Framebuffer'Class; Texture : OpenGL.Textures.OpenGL_Texture'Class; Attachment : OpenGL.GLenum); private type OpenGL_Framebuffer is tagged limited record Framebuffer : WebAPI.WebGL.Framebuffers.WebGL_Framebuffer_Access; Context : WebAPI.WebGL.Rendering_Contexts.WebGL_Rendering_Context_Access; end record; end OpenGL.Framebuffers;
stcarrez/stm32-ui
Ada
5,593
adb
----------------------------------------------------------------------- -- ui -- User Interface Framework -- Copyright (C) 2016, 2017 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- 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 Bitmapped_Drawing; with BMP_Fonts; package body UI.Buttons is -- ------------------------------ -- Returns True if the button contains the given point. -- ------------------------------ function Contains (Button : in Button_Type; X, Y : in Natural) return Boolean is begin return X >= Button.Pos.X and Y >= Button.Pos.Y and X < Button.Pos.X + Button.Width and Y < Button.Pos.Y + Button.Height; end Contains; -- ------------------------------ -- Draw the button in its current state on the bitmap. -- ------------------------------ procedure Draw_Button (Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class; Button : in Button_Type) is Color : constant HAL.Bitmap.Bitmap_Color := (if Button.State = B_RELEASED then Background else Active_Background); begin Buffer.Set_Source (Color); Buffer.Fill_Rect (Area => (Position => (Button.Pos.X + 1, Button.Pos.Y + 1), Width => Button.Width - 2, Height => Button.Height - 2)); if Button.State = B_PRESSED then Buffer.Set_Source (HAL.Bitmap.Grey); Buffer.Draw_Rect (Area => (Position => (Button.Pos.X + 3, Button.Pos.Y + 3), Width => Button.Width - 5, Height => Button.Height - 6)); Buffer.Draw_Horizontal_Line (Pt => (Button.Pos.X + 2, Button.Pos.Y + 2), Width => Button.Width - 4); Buffer.Draw_Vertical_Line (Pt => (Button.Pos.X + 2, Button.Pos.Y + 2), Height => Button.Height - 4); end if; Bitmapped_Drawing.Draw_String (Buffer, Start => (Button.Pos.X + 4, Button.Pos.Y + 6), Msg => Button.Name (1 .. Button.Len), Font => BMP_Fonts.Font16x24, Foreground => (if Button.State = B_RELEASED then Foreground else Active_Foreground), Background => Color); end Draw_Button; -- ------------------------------ -- Layout and draw a list of buttons starting at the given top position. -- Each button is assigned the given width and height. -- ------------------------------ procedure Draw_Buttons (Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class; List : in out Button_Array; X : in Natural; Y : in Natural; Width : in Natural; Height : in Natural) is By : Natural := Y; begin for I in List'Range loop List (I).Width := Width; List (I).Height := Height; List (I).Pos := (X, By); Draw_Button (Buffer, List (I)); By := By + Height; end loop; end Draw_Buttons; -- ------------------------------ -- Set the active button in a list of button. Update <tt>Change</tt> to indicate whether -- some button state was changed and a redraw is necessary. -- ------------------------------ procedure Set_Active (List : in out Button_Array; Index : in Button_Event; Changed : out Boolean) is State : Button_State; begin Changed := False; for I in List'Range loop if List (I).State /= B_DISABLED then State := (if I = Index then B_PRESSED else B_RELEASED); if State /= List (I).State then List (I).State := State; Changed := True; end if; end if; end loop; end Set_Active; -- ------------------------------ -- Check the touch panel for a button being pressed. -- ------------------------------ procedure Get_Event (Buffer : in HAL.Bitmap.Bitmap_Buffer'Class; Touch : in out HAL.Touch_Panel.Touch_Panel_Device'Class; List : in Button_Array; Event : out Button_Event) is pragma Unreferenced (Buffer); State : constant HAL.Touch_Panel.TP_State := Touch.Get_All_Touch_Points; X : Natural; Y : Natural; begin if State'Length > 0 then X := State (State'First).X; Y := State (State'First).Y; for I in List'Range loop if X >= List (I).Pos.X and Y >= List (I).Pos.Y and X < List (I).Pos.X + List (I).Width and Y < List (I).Pos.Y + List (I).Height then Event := I; return; end if; end loop; end if; Event := NO_EVENT; end Get_Event; end UI.Buttons;
bracke/Ext2Dir
Ada
891
ads
-- StrongEd$WrapWidth=256 -- StrongEd$Mode=Ada -- with RASCAL.Utility; use RASCAL.Utility; package Main is type Names is array(natural range <>) of ustring; type Options is (Remove_Extension,Change_Name,Set_FileType, Set_Access,Remove_Original,Verbose,Help,Descend,Move_Sub_Content); type Bit_Array is array (Options'Range) of Boolean; type Path_Variables is (source,target); type String_Array is array (Path_Variables'Range) of ustring; Bits : Bit_Array := (others => false); Paths : String_Array := (U(""),U("")); -- procedure Main; -- procedure Proces_File(FilePath : in string; Target : in String); -- procedure Proces_Dir (Path : in String; Target : in String); -- procedure Help; ---- end Main;
reznikmm/matreshka
Ada
4,083
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Table_On_Update_Keep_Size_Attributes; package Matreshka.ODF_Table.On_Update_Keep_Size_Attributes is type Table_On_Update_Keep_Size_Attribute_Node is new Matreshka.ODF_Table.Abstract_Table_Attribute_Node and ODF.DOM.Table_On_Update_Keep_Size_Attributes.ODF_Table_On_Update_Keep_Size_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Table_On_Update_Keep_Size_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Table_On_Update_Keep_Size_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Table.On_Update_Keep_Size_Attributes;
sergev/vak-opensource
Ada
674
adb
with Stream; with System; with Ada.Unchecked_Conversion; package body Hello_Ada is x : Integer := 12345; procedure Start (console : Stream.Stream'Class) is function Address_To_Unsigned is new Ada.Unchecked_Conversion (Source => System.Address, Target => Stream.Unsigned); begin console.Put_String ("Hello, World!" & ASCII.LF & ASCII.NUL); console.Put_String ("Loaded at " & ASCII.NUL); console.Put_Unsigned (Address_To_Unsigned (Start'Address), 8, 16); console.Put_String (ASCII.LF & ASCII.NUL); console.Put_String ("Global variable x = " & ASCII.NUL); console.Put_Integer (x); console.Put_String (ASCII.LF & ASCII.NUL); end Start; end Hello_Ada;
reznikmm/matreshka
Ada
4,133
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Number_Transliteration_Language_Attributes; package Matreshka.ODF_Number.Transliteration_Language_Attributes is type Number_Transliteration_Language_Attribute_Node is new Matreshka.ODF_Number.Abstract_Number_Attribute_Node and ODF.DOM.Number_Transliteration_Language_Attributes.ODF_Number_Transliteration_Language_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Number_Transliteration_Language_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Number_Transliteration_Language_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Number.Transliteration_Language_Attributes;
charlie5/lace
Ada
2,747
adb
with openGL.Geometry.lit_colored, openGL.Primitive.indexed; package body openGL.Model.hexagon.lit_colored is --------- --- Forge -- function new_Hexagon (Radius : in Real; Face : in lit_colored.Face) return View is Self : constant View := new Item; begin Self.Radius := Radius; Self.Face := Face; return Self; end new_Hexagon; -------------- --- Attributes -- overriding function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class; Fonts : in Font.font_id_Map_of_font) return Geometry.views is pragma unreferenced (Textures, Fonts); use Geometry.lit_colored; the_Sites : constant hexagon.Sites := vertex_Sites (Self.Radius); the_Indices : aliased constant Indices := [1, 2, 3, 4, 5, 6, 7, 2]; function new_Face (Vertices : in geometry.lit_colored.Vertex_array) return Geometry.lit_colored.view is use Primitive; the_Geometry : constant Geometry.lit_colored.view := Geometry.lit_colored.new_Geometry; the_Primitive : constant Primitive.indexed.view := Primitive.indexed.new_Primitive (triangle_Fan, the_Indices); begin the_Geometry.Vertices_are (Vertices); the_Geometry.add (Primitive.view (the_Primitive)); return the_Geometry; end new_Face; upper_Face : Geometry.lit_colored.view; begin -- Upper Face -- declare the_Vertices : constant Geometry.lit_colored.Vertex_array := [1 => (Site => [0.0, 0.0, 0.0], Normal => Normal, Color => +Self.Face.center_Color, Shine => default_Shine), 2 => (Site => the_Sites (1), Normal => Normal, Color => +Self.Face.Colors (1), Shine => default_Shine), 3 => (Site => the_Sites (2), Normal => Normal, Color => +Self.Face.Colors (2), Shine => default_Shine), 4 => (Site => the_Sites (3), Normal => Normal, Color => +Self.Face.Colors (3), Shine => default_Shine), 5 => (Site => the_Sites (4), Normal => Normal, Color => +Self.Face.Colors (4), Shine => default_Shine), 6 => (Site => the_Sites (5), Normal => Normal, Color => +Self.Face.Colors (5), Shine => default_Shine), 7 => (Site => the_Sites (6), Normal => Normal, Color => +Self.Face.Colors (6), Shine => default_Shine)]; begin upper_Face := new_Face (Vertices => the_Vertices); end; return [1 => upper_Face.all'Access]; end to_GL_Geometries; end openGL.Model.hexagon.lit_colored;
tum-ei-rcs/StratoX
Ada
10,802
adb
------------------------------------------------------------------------------ -- -- -- 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-2016, 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_Primitives.Multiprocessors; with System.BB.Threads; with System.BB.Threads.Queues; with System.BB.Board_Support; with System.BB.Time; package body System.BB.Interrupts is use System.Multiprocessors; use System.BB.CPU_Primitives.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 8; -- Type used to represent the stack area for each interrupt. The stack must -- be aligned to 8 bytes to allow double word data movements. Interrupt_Stacks : array (CPU) of Stack_Space; pragma Linker_Section (Interrupt_Stacks, ".interrupt_stacks"); -- Array that contains the stack used for each interrupt priority on each -- CPU. Note that multiple interrupts with the same priority will share -- the same stack on a given CPU, as they never can both be executing at -- the same time. The interrupt stacks are assigned a special section, -- so the linker script can put them at a specific place and avoid useless -- initialization. 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 interrupt -- level on each CPU. type Handlers_Table is array (Interrupt_ID) of Interrupt_Handler; pragma Suppress_Initialization (Handlers_Table); -- Type used to represent the procedures used as interrupt handlers. -- We need to prevent initialization to avoid elaboration code, so we rely -- on default initialization to zero of uninitialized data. Interrupt_Handlers_Table : Handlers_Table; -- Table containing handlers attached to the different external interrupts Interrupt_Being_Handled : array (CPU) of 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. ----------------------- -- Local subprograms -- ----------------------- procedure Interrupt_Wrapper (Vector : CPU_Primitives.Vector_Id); -- This wrapper procedure is in charge of setting the appropriate -- software priorities before calling the user-defined 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); -- 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.Install_Interrupt_Handler (Interrupt_Wrapper'Address, Id, Prio); end Attach_Handler; ----------------------- -- Current_Interrupt -- ----------------------- function Current_Interrupt return Interrupt_ID is Result : constant 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 (Vector : CPU_Primitives.Vector_Id) is Self_Id : constant Threads.Thread_Id := Threads.Thread_Self; Caller_Priority : constant Integer := Threads.Get_Priority (Self_Id); Interrupt : constant Interrupt_ID := Board_Support.Get_Interrupt_Request (Vector); Int_Priority : constant Interrupt_Priority := Board_Support.Priority_Of_Interrupt (Interrupt); CPU_Id : constant CPU := Current_CPU; Previous_Int : constant Interrupt_ID := Interrupt_Being_Handled (CPU_Id); Prev_In_Interr : constant Boolean := Self_Id.In_Interrupt; begin -- Handle spurious interrupts, reported as No_Interrupt. If they must be -- cleared, this should be done in Get_Interrupt_Request. if Interrupt = No_Interrupt then return; end if; -- 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) := Interrupt; -- 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 Interrupt_Handlers_Table (Interrupt).all (Interrupt); 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; Self_Id.In_Interrupt := Prev_In_Interr; 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 use type System.Storage_Elements.Storage_Offset; begin for Proc in CPU'Range loop -- Store the pointer in the last double word Interrupt_Stack_Table (Proc) := Interrupt_Stacks (Proc)(Stack_Space'Last - 7)'Address; end loop; end Initialize_Interrupts; end System.BB.Interrupts;
francesco-bongiovanni/ewok-kernel
Ada
12,107
adb
-- -- Copyright 2018 The wookey project team <[email protected]> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- with ewok.syscalls; use ewok.syscalls; with ewok.tasks; use ewok.tasks; with ewok.devices; with ewok.exported.interrupts; use type ewok.exported.interrupts.t_interrupt_config_access; with ewok.interrupts; with ewok.layout; with ewok.sched; with ewok.syscalls.init; with ewok.syscalls.cfg; with ewok.syscalls.gettick; with ewok.syscalls.ipc; with ewok.syscalls.lock; with ewok.syscalls.reset; with ewok.syscalls.sleep; with ewok.syscalls.yield; with soc.interrupts; use type soc.interrupts.t_interrupt; with soc.nvic; with m4.cpu; with m4.cpu.instructions; with debug; #if CONFIG_DBGLEVEL > 6 with types.c; use types.c; #end if; package body ewok.softirq with spark_mode => off is package TSK renames ewok.tasks; procedure init is begin p_isr_requests.init (isr_queue); p_syscall_requests.init (syscall_queue); debug.log (debug.INFO, "SOFTIRQ subsystem initialized: syscalls and user IRQ/FIQ are handled out of interrupt mode."); end init; procedure push_isr (task_id : in ewok.tasks_shared.t_task_id; params : in t_isr_parameters) is req : constant t_isr_request := (task_id, WAITING, params); ok : boolean; begin p_isr_requests.write (isr_queue, req, ok); if not ok then debug.panic ("ewok.softirq.push_isr() failed. isr_queue is " & p_isr_requests.ring_state'image (p_isr_requests.state (isr_queue))); end if; ewok.tasks.set_state (ID_SOFTIRQ, TASK_MODE_MAINTHREAD, TASK_STATE_RUNNABLE); ewok.sched.request_schedule; m4.cpu.instructions.full_memory_barrier; end push_isr; procedure push_syscall (task_id : in ewok.tasks_shared.t_task_id) is req : constant t_syscall_request := (task_id, WAITING); ok : boolean; begin p_syscall_requests.write (syscall_queue, req, ok); if not ok then debug.panic ("ewok.softirq.push_syscall() failed. syscall_queue is " & p_syscall_requests.ring_state'image (p_syscall_requests.state (syscall_queue))); end if; ewok.tasks.set_state (ID_SOFTIRQ, TASK_MODE_MAINTHREAD, TASK_STATE_RUNNABLE); ewok.sched.request_schedule; m4.cpu.instructions.full_memory_barrier; end push_syscall; procedure syscall_handler (req : in t_syscall_request) is type t_syscall_parameters_access is access all t_syscall_parameters; function to_syscall_parameters_access is new ada.unchecked_conversion (system_address, t_syscall_parameters_access); svc : t_svc_type; params_a : t_syscall_parameters_access; begin -- -- Getting the svc number from the SVC instruction -- declare PC : constant system_address := TSK.tasks_list(req.caller_id).ctx.frame_a.all.PC; inst : m4.cpu.instructions.t_svc_instruction with import, address => to_address (PC - 2); begin if not inst.opcode'valid then raise program_error; end if; declare svc_type : t_svc_type with address => inst.svc_num'address; val : unsigned_8 with address => inst.svc_num'address; begin if not svc_type'valid then debug.log (debug.WARNING, "invalid SVC: " & unsigned_8'image (val)); ewok.tasks.set_state (req.caller_id, TASK_MODE_MAINTHREAD, TASK_STATE_FAULT); set_return_value (req.caller_id, TSK.tasks_list(req.caller_id).mode, SYS_E_DENIED); return; end if; svc := svc_type; end; end; -- -- Getting syscall parameters -- params_a := to_syscall_parameters_access (TSK.tasks_list(req.caller_id).ctx.frame_a.all.R0); if params_a = NULL then debug.log (debug.WARNING, "(task" & ewok.tasks_shared.t_task_id'image (req.caller_id) & ") syscall with no parameters"); return; end if; if not params_a.all.syscall_type'valid then debug.log (debug.WARNING, "(task" & ewok.tasks_shared.t_task_id'image (req.caller_id) & ") unknown syscall" & ewok.syscalls.t_syscall_type'image (params_a.all.syscall_type)); return; end if; -- -- Logging -- #if CONFIG_DBGLEVEL > 6 declare len : constant natural := types.c.len (TSK.tasks_list(req.caller_id).name.all); name : string (1 .. len); begin to_ada (name, TSK.tasks_list(req.caller_id).name.all); debug.log (debug.INFO, "[" & name & "] svc" & ewok.syscalls.t_svc_type'image (svc) & ", syscall" & ewok.syscalls.t_syscall_type'image (params_a.all.syscall_type)); end; #end if; -- -- Calling the handler -- if svc /= SVC_SYSCALL then debug.panic ("ewok.softirq.syscall_handler(): wrong SVC" & ewok.syscalls.t_svc_type'image (svc)); end if; case params_a.all.syscall_type is when SYS_YIELD => ewok.syscalls.yield.sys_yield (req.caller_id, TASK_MODE_MAINTHREAD); when SYS_INIT => ewok.syscalls.init.sys_init (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_IPC => ewok.syscalls.ipc.sys_ipc (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_CFG => ewok.syscalls.cfg.sys_cfg (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_GETTICK => ewok.syscalls.gettick.sys_gettick (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_RESET => ewok.syscalls.reset.sys_reset (req.caller_id, TASK_MODE_MAINTHREAD); when SYS_SLEEP => ewok.syscalls.sleep.sys_sleep (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_LOCK => ewok.syscalls.lock.sys_lock (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); end case; end syscall_handler; procedure isr_handler (req : in t_isr_request) is params : t_parameters; config_a : ewok.exported.interrupts.t_interrupt_config_access; begin -- For further MPU mapping of the device, we need to know which device -- triggered that interrupt. -- Note -- - EXTIs are not associated to any device because they can be -- associated to several GPIO pins -- - DMAs are not considered as devices because a single controller -- can be used by several drivers. DMA streams are registered in a -- specific table TSK.tasks_list(req.caller_id).isr_ctx.device_id := ewok.interrupts.get_device_from_interrupt (req.params.interrupt); -- Keep track of some hint about scheduling policy to apply after the end -- of the ISR execution -- Note - see above config_a := ewok.devices.get_interrupt_config_from_interrupt (req.params.interrupt); if config_a /= NULL then TSK.tasks_list(req.caller_id).isr_ctx.sched_policy := config_a.all.mode; else TSK.tasks_list(req.caller_id).isr_ctx.sched_policy := ISR_STANDARD; end if; -- Zeroing the ISR stack if the ISR previously executed belongs to -- another task if previous_isr_owner /= req.caller_id then declare stack : byte_array(1 .. ewok.layout.STACK_SIZE_TASK_ISR) with address => to_address (ewok.layout.STACK_BOTTOM_TASK_ISR); begin stack := (others => 0); end; previous_isr_owner := req.caller_id; end if; -- -- Note - isr_ctx.entry_point is a wrapper. The real ISR entry -- point is defined in params(0) -- -- User defined ISR handler params(0) := req.params.handler; -- IRQ params(1) := unsigned_32'val (soc.nvic.to_irq_number (req.params.interrupt)); -- Status and data returned by the 'posthook' treatement -- (cf. ewok.posthook.exec) params(2) := req.params.posthook_status; params(3) := req.params.posthook_data; create_stack (ewok.layout.STACK_TOP_TASK_ISR, TSK.tasks_list(req.caller_id).isr_ctx.entry_point, -- Wrapper params, TSK.tasks_list(req.caller_id).isr_ctx.frame_a); TSK.tasks_list(req.caller_id).mode := TASK_MODE_ISRTHREAD; ewok.tasks.set_state (req.caller_id, TASK_MODE_ISRTHREAD, TASK_STATE_RUNNABLE); end isr_handler; procedure main_task is isr_req : t_isr_request; sys_req : t_syscall_request; ok : boolean; begin loop -- -- User ISRs -- loop m4.cpu.disable_irq; p_isr_requests.read (isr_queue, isr_req, ok); m4.cpu.enable_irq; exit when not ok; if isr_req.state = WAITING then if TSK.tasks_list(isr_req.caller_id).state /= TASK_STATE_LOCKED then m4.cpu.disable_irq; isr_handler (isr_req); isr_req.state := DONE; m4.cpu.enable_irq; #if CONFIG_ISR_REACTIVITY m4.cpu.instructions.full_memory_barrier; ewok.sched.request_schedule; #end if; else m4.cpu.disable_irq; p_isr_requests.write (isr_queue, isr_req, ok); if not ok then debug.panic ("softirq.main_task() failed to add ISR request"); end if; m4.cpu.instructions.full_memory_barrier; ewok.sched.request_schedule; m4.cpu.enable_irq; end if; else raise program_error; end if; end loop; m4.cpu.instructions.full_memory_barrier; -- -- Syscalls -- loop m4.cpu.disable_irq; p_syscall_requests.read (syscall_queue, sys_req, ok); m4.cpu.enable_irq; exit when not ok; if sys_req.state = WAITING then syscall_handler (sys_req); sys_req.state := DONE; else debug.panic ("ewok.softirq.main_task() syscall request not in WAITING state"); end if; end loop; -- -- Set softirq task as IDLE if there is no more request to handle -- m4.cpu.disable_irq; if p_isr_requests.state (isr_queue) = p_isr_requests.EMPTY and p_syscall_requests.state (syscall_queue) = p_syscall_requests.EMPTY then ewok.tasks.set_state (ID_SOFTIRQ, TASK_MODE_MAINTHREAD, TASK_STATE_IDLE); m4.cpu.instructions.full_memory_barrier; ewok.sched.request_schedule; end if; m4.cpu.enable_irq; end loop; end main_task; end ewok.softirq;
stcarrez/helios
Ada
1,580
ads
----------------------------------------------------------------------- -- helios-commands-check -- Helios check commands -- Copyright (C) 2017, 2018, 2019 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- 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 Helios.Commands.Drivers; package Helios.Commands.Check is type Command_Type is new Helios.Commands.Drivers.Command_Type with null record; -- Execute a information command to report information about the agent and monitoring. overriding procedure Execute (Command : in out Command_Type; Name : in String; Args : in Argument_List'Class; Context : in out Context_Type); -- Write the help associated with the command. overriding procedure Help (Command : in out Command_Type; Name : in String; Context : in out Context_Type); end Helios.Commands.Check;
AdaCore/libadalang
Ada
80
ads
package Ghost_Library_Pkg.Child is A : Integer; end Ghost_Library_Pkg.Child;
JeremyGrosser/clock3
Ada
913
adb
package body Seven is procedure Set_Digit (This : in out Device; Pos : Position; Val : Digit) is begin case Pos is when 1 => This.Buffer (1) := Numbers (Val); when 2 => This.Buffer (3) := Numbers (Val); when 3 => This.Buffer (7) := Numbers (Val); when 4 => This.Buffer (9) := Numbers (Val); end case; end Set_Digit; procedure Set_Colon (This : in out Device; On : Boolean) is begin if On then This.Set (33); else This.Clear (33); end if; end Set_Colon; procedure Set_Point (This : in out Device; Num : Point_Number; On : Boolean) is begin if On then This.Set (Points (Num)); else This.Clear (Points (Num)); end if; end Set_Point; end Seven;
Fabien-Chouteau/motherlode
Ada
16,618
adb
-- Motherlode -- Copyright (c) 2020 Fabien Chouteau with GESTE; with GESTE.Maths_Types; use GESTE.Maths_Types; with HUD; with Sound; package body Player is P : aliased Player_Type; Going_Up : Boolean := False; Going_Down : Boolean := False; Going_Left : Boolean := False; Going_Right : Boolean := False; Facing_Left : Boolean := False with Unreferenced; Using_Drill : Boolean := False; type Drill_Anim_Rec is record In_Progress : Boolean := False; Steps : Natural := 0; -- Total number of steps for the animation Rem_Steps : Natural := 0; -- Remaining number of steps in the animation Target_CX : Natural := 0; -- X coord of the cell that is being drilled Target_CY : Natural := 0; -- Y coord of the cell that is being drilled Origin_PX : Natural := 0; -- X coord of the player when starting anim Origin_PY : Natural := 0; -- Y coord of the player when starting anim end record; -- Data for the drill animation Drill_Anim : Drill_Anim_Rec; type Collision_Points is array (Natural range <>) of GESTE.Pix_Point; -- Bounding Box points BB_Top : constant Collision_Points := ((-3, -4), (3, -4)); BB_Bottom : constant Collision_Points := ((-3, 5), (3, 5)); BB_Left : constant Collision_Points := ((-5, 5), (-5, -2)); BB_Right : constant Collision_Points := ((5, 5), (5, -2)); -- Drill points Drill_Bottom : constant Collision_Points := (0 => (0, 8)); Drill_Left : constant Collision_Points := (0 => (-8, 0)); Drill_Right : constant Collision_Points := (0 => (8, 0)); Grounded : Boolean := False; function Collides (Points : Collision_Points) return Boolean; -------------- -- Collides -- -------------- function Collides (Points : Collision_Points) return Boolean is X : constant Integer := Integer (P.Position.X); Y : constant Integer := Integer (P.Position.Y); begin for Pt of Points loop if World.Collides (X + Pt.X, Y + Pt.Y) then return True; end if; end loop; return False; end Collides; ----------- -- Spawn -- ----------- procedure Spawn is begin P.Set_Mass (Parameters.Empty_Mass); P.Set_Speed ((0.0, 0.0)); P.Money := 0; P.Fuel := Parameters.Start_Fuel; P.Equip_Level := (others => 1); Move ((Parameters.Spawn_X, Parameters.Spawn_Y)); end Spawn; ---------- -- Move -- ---------- procedure Move (Pt : GESTE.Pix_Point) is begin P.Set_Position (GESTE.Maths_Types.Point'(Value (Pt.X), Value (Pt.Y))); P.Set_Speed ((0.0, 0.0)); end Move; -------------- -- Position -- -------------- function Position return GESTE.Pix_Point is ((Integer (P.Position.X), Integer (P.Position.Y))); -------------- -- Quantity -- -------------- function Quantity (Kind : World.Valuable_Cell) return Natural is (P.Cargo (Kind)); ---------- -- Drop -- ---------- procedure Drop (Kind : World.Valuable_Cell) is Cnt : Natural renames P.Cargo (Kind); begin if Cnt > 0 then Cnt := Cnt - 1; P.Cargo_Sum := P.Cargo_Sum - 1; P.Set_Mass (P.Mass - Value (Parameters.Weight (Kind))); end if; end Drop; ----------- -- Level -- ----------- function Level (Kind : Parameters.Equipment) return Parameters.Equipment_Level is (P.Equip_Level (Kind)); ------------- -- Upgrade -- ------------- procedure Upgrade (Kind : Parameters.Equipment) is use Parameters; begin if P.Equip_Level (Kind) /= Equipment_Level'Last then declare Next_Lvl : constant Equipment_Level := P.Equip_Level (Kind) + 1; Cost : constant Natural := Parameters.Price (Kind, Next_Lvl); begin if Cost <= P.Money then P.Money := P.Money - Cost; P.Equip_Level (Kind) := Next_Lvl; P.Cash_In := P.Cash_In - Cost; P.Cash_In_TTL := 30 * 1; end if; end; end if; end Upgrade; ----------- -- Money -- ----------- function Money return Natural is (P.Money); ------------------ -- Put_In_Cargo -- ------------------ procedure Put_In_Cargo (This : in out Player_Type; Kind : World.Valuable_Cell) is use Parameters; begin if P.Cargo_Sum < Cargo_Capacity (This.Equip_Level (Cargo)) then P.Cargo (Kind) := P.Cargo (Kind) + 1; P.Cargo_Sum := P.Cargo_Sum + 1; P.Set_Mass (P.Mass + GESTE.Maths_Types.Value (Weight (Kind))); end if; end Put_In_Cargo; ----------------- -- Empty_Cargo -- ----------------- procedure Empty_Cargo (This : in out Player_Type) is begin if This.Cash_In_TTL /= 0 then -- Do not empty cargo when still showing previous cash operation return; end if; This.Cash_In := 0; for Kind in World.Valuable_Cell loop P.Cash_In := P.Cash_In + P.Cargo (Kind) * Parameters.Value (Kind); P.Cargo (Kind) := 0; end loop; if This.Cash_In = 0 then return; end if; P.Money := P.Money + P.Cash_In; -- How many frames the cash in text will be displayed P.Cash_In_TTL := 30 * 1; P.Cargo_Sum := 0; P.Set_Mass (Parameters.Empty_Mass); Sound.Play_Coin; end Empty_Cargo; ------------ -- Refuel -- ------------ procedure Refuel (This : in out Player_Type) is use Parameters; Tank_Capa : constant Float := Float (Tank_Capacity (This.Equip_Level (Tank))); Amount : constant Float := Float'Min (Tank_Capa - P.Fuel, Float (P.Money) / Parameters.Fuel_Price); Cost : constant Natural := Natural (Amount * Parameters.Fuel_Price); begin if This.Cash_In_TTL /= 0 or else Amount = 0.0 then -- Do not refuel when still showing previous cash operation return; end if; if Cost <= This.Money then P.Fuel := P.Fuel + Amount; P.Money := P.Money - Cost; P.Cash_In := -Cost; P.Cash_In_TTL := 30 * 1; end if; end Refuel; --------------- -- Try_Drill -- --------------- procedure Try_Drill is use World; use Parameters; PX : constant Integer := Integer (P.Position.X); PY : constant Integer := Integer (P.Position.Y); CX : Integer := PX / Cell_Size; CY : Integer := PY / Cell_Size; Drill : Boolean := False; begin if Using_Drill and then Grounded then if Going_Down and Collides (Drill_Bottom) then CY := CY + 1; Drill := True; elsif Going_Left and Collides (Drill_Left) then CX := CX - 1; Drill := True; elsif Going_Right and Collides (Drill_Right) then CX := CX + 1; Drill := True; end if; if Drill and then CX in 0 .. World.Ground_Width - 1 and then CY in 0 .. World.Ground_Depth - 1 then declare Kind : constant Cell_Kind := Ground (CX + CY * Ground_Width); begin if (Kind /= Gold or else P.Equip_Level (Parameters.Drill) > 1) and then (Kind /= Diamond or else P.Equip_Level (Parameters.Drill) > 2) and then (Kind /= Rock or else P.Equip_Level (Parameters.Drill) = 7) then Sound.Play_Drill; if Kind in World.Valuable_Cell then P.Put_In_Cargo (Kind); end if; Drill_Anim.Target_CX := CX; Drill_Anim.Target_CY := CY; Drill_Anim.Origin_PX := Position.X; Drill_Anim.Origin_PY := Position.Y; Drill_Anim.In_Progress := True; Drill_Anim.Steps := (case Kind is when Dirt => 15, when Coal => 20, when Iron => 30, when Gold => 40, when Diamond => 50, when Rock => 80, when others => raise Program_Error); -- Faster drilling with a better drill... Drill_Anim.Steps := Drill_Anim.Steps / Natural (P.Equip_Level (Parameters.Drill)); Drill_Anim.Rem_Steps := Drill_Anim.Steps; end if; end; end if; end if; end Try_Drill; ----------------------- -- Update_Drill_Anim -- ----------------------- procedure Update_Drill_Anim is use World; D : Drill_Anim_Rec renames Drill_Anim; Target_PX : constant Natural := D.Target_CX * Cell_Size + Cell_Size / 2; Target_PY : constant Natural := D.Target_CY * Cell_Size + Cell_Size / 2; Shaking : constant array (0 .. 9) of Integer := (1, 0, 0, 1, 0, 1, 1, 0, 1, 0); begin if D.Rem_Steps = 0 then D.In_Progress := False; Ground (D.Target_CX + D.Target_CY * Ground_Width) := Empty; Move ((Target_PX, Target_PY)); Using_Drill := False; -- Kill speed P.Set_Speed ((GESTE.Maths_Types.Value (0.0), GESTE.Maths_Types.Value (0.0))); else -- Consume Fuel P.Fuel := P.Fuel - Parameters.Fuel_Per_Step; declare Percent : constant Float := Float (D.Rem_Steps) / Float (D.Steps); DX : Integer := Integer (Percent * Float (Target_PX - D.Origin_PX)); DY : Integer := Integer (Percent * Float (Target_PY - D.Origin_PY)); begin -- Add a little bit of shaking DX := DX + Shaking (D.Rem_Steps mod Shaking'Length); DY := DY + Shaking ((D.Rem_Steps + 2) mod Shaking'Length); Move ((Target_PX - DX, Target_PY - DY)); D.Rem_Steps := D.Rem_Steps - 1; end; end if; end Update_Drill_Anim; ------------------- -- Update_Motion -- ------------------- procedure Update_Motion is Old : constant Point := P.Position; Elapsed : constant Value := Value (1.0 / 60.0); Collision_To_Fix : Boolean; begin if Going_Right then Facing_Left := False; elsif Going_Left then Facing_Left := True; end if; if P.Fuel <= 0.0 then P.Fuel := 0.0; Going_Up := False; Going_Down := False; Going_Left := False; Going_Right := False; end if; -- Lateral movements if Grounded then if Going_Right then P.Apply_Force ((100_000.0, 0.0)); elsif Going_Left then P.Apply_Force ((-100_000.0, 0.0)); else -- Friction on the floor P.Apply_Force ( (Value (Value (-2000.0) * P.Speed.X), 0.0)); end if; else if Going_Right then P.Apply_Force ((70_000.0, 0.0)); elsif Going_Left then P.Apply_Force ((-70_000.0, 0.0)); end if; end if; -- Gavity if not Grounded then P.Apply_Gravity (-Parameters.Gravity); end if; if Going_Up then -- Thrust P.Apply_Force ((0.0, -Value (Parameters.Engine_Thrust (P.Equip_Level (Parameters.Engine))))); end if; P.Step (Elapsed); Grounded := False; Collision_To_Fix := False; if P.Speed.Y < 0.0 then -- Going up if Collides (BB_Top) then Collision_To_Fix := True; -- Touching a roof, kill vertical speed P.Set_Speed ((P.Speed.X, Value (0.0))); -- Going back to previous Y coord P.Set_Position ((P.Position.X, Old.Y)); end if; elsif P.Speed.Y > 0.0 then -- Going down if Collides (BB_Bottom) then Collision_To_Fix := True; Grounded := True; -- Touching the ground, kill vertical speed P.Set_Speed ((P.Speed.X, Value (0.0))); -- Going back to previous Y coord P.Set_Position ((P.Position.X, Old.Y)); end if; end if; if P.Speed.X > 0.0 then -- Going right if Collides (BB_Right) then Collision_To_Fix := True; -- Touching a wall, kill horizontal speed P.Set_Speed ((Value (0.0), P.Speed.Y)); -- Going back to previos X coord P.Set_Position ((Old.X, P.Position.Y)); end if; elsif P.Speed.X < 0.0 then -- Going left if Collides (BB_Left) then Collision_To_Fix := True; -- Touching a wall, kill horizontal speed P.Set_Speed ((Value (0.0), P.Speed.Y)); -- Going back to previous X coord P.Set_Position ((Old.X, P.Position.Y)); end if; end if; -- Fix the collisions, one pixel at a time while Collision_To_Fix loop Collision_To_Fix := False; if Collides (BB_Top) then Collision_To_Fix := True; -- Try a new Y coord that do not collides P.Set_Position ((P.Position.X, P.Position.Y + 1.0)); elsif Collides (BB_Bottom) then Collision_To_Fix := True; -- Try a new Y coord that do not collides P.Set_Position ((P.Position.X, P.Position.Y - 1.0)); end if; if Collides (BB_Right) then Collision_To_Fix := True; -- Try to find X coord that do not collides P.Set_Position ((P.Position.X - 1.0, P.Position.Y)); elsif Collides (BB_Left) then Collision_To_Fix := True; -- Try to find X coord that do not collides P.Set_Position ((P.Position.X + 1.0, P.Position.Y)); end if; end loop; -- Consume Fuel if Going_Right or else Going_Left or else Going_Up then P.Fuel := P.Fuel - Parameters.Fuel_Per_Step; end if; Try_Drill; -- Market if Integer (P.Position.Y) in 16 * 2 .. 16 * 3 and then Integer (P.Position.X) in 16 * 15 .. 16 * 16 then P.Empty_Cargo; end if; -- Fuel pump if Integer (P.Position.Y) in 16 * 2 .. 16 * 3 and then Integer (P.Position.X) in 16 * 5 .. 16 * 6 then P.Refuel; end if; end Update_Motion; ------------ -- Update -- ------------ procedure Update is begin if Drill_Anim.In_Progress then Update_Drill_Anim; else Update_Motion; end if; Going_Up := False; Going_Down := False; Going_Left := False; Going_Right := False; Using_Drill := False; end Update; ---------- -- Draw -- ---------- procedure Draw_Hud (FB : in out HAL.UInt16_Array) is use Parameters; begin Hud.Draw (FB, P.Money, Natural (P.Fuel), Tank_Capacity (P.Equip_Level (Tank)), P.Cargo_Sum, Cargo_Capacity (P.Equip_Level (Cargo)), (-Integer (P.Position.Y) / World.Cell_Size) + 2, P.Cash_In); if P.Cash_In_TTL > 0 then P.Cash_In_TTL := P.Cash_In_TTL - 1; else P.Cash_In := 0; end if; end Draw_Hud; ------------- -- Move_Up -- ------------- procedure Move_Up is begin Going_Up := True; end Move_Up; --------------- -- Move_Down -- --------------- procedure Move_Down is begin Going_Down := True; end Move_Down; --------------- -- Move_Left -- --------------- procedure Move_Left is begin Going_Left := True; end Move_Left; ---------------- -- Move_Right -- ---------------- procedure Move_Right is begin Going_Right := True; end Move_Right; ---------------- -- Drill -- ---------------- procedure Drill is begin Using_Drill := True; end Drill; end Player;
reznikmm/matreshka
Ada
4,257
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Nodes; with XML.DOM.Elements.Internals; package body ODF.DOM.Elements.Style.Header_Style.Internals is ------------ -- Create -- ------------ function Create (Node : Matreshka.ODF_Elements.Style.Header_Style.Style_Header_Style_Access) return ODF.DOM.Elements.Style.Header_Style.ODF_Style_Header_Style is begin return (XML.DOM.Elements.Internals.Create (Matreshka.DOM_Nodes.Element_Access (Node)) with null record); end Create; ---------- -- Wrap -- ---------- function Wrap (Node : Matreshka.ODF_Elements.Style.Header_Style.Style_Header_Style_Access) return ODF.DOM.Elements.Style.Header_Style.ODF_Style_Header_Style is begin return (XML.DOM.Elements.Internals.Wrap (Matreshka.DOM_Nodes.Element_Access (Node)) with null record); end Wrap; end ODF.DOM.Elements.Style.Header_Style.Internals;
mfkiwl/ewok-kernel-security-OS
Ada
2,692
adb
-- -- Copyright 2018 The wookey project team <[email protected]> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- package body soc.syscfg with spark_mode => on is procedure get_exti_port (pin : in soc.gpio.t_gpio_pin_index; port : out soc.gpio.t_gpio_port_index) is begin case pin is when 0 .. 3 => port := SYSCFG.EXTICR1.exti(pin); when 4 .. 7 => port := SYSCFG.EXTICR2.exti(pin); when 8 .. 11 => port := SYSCFG.EXTICR3.exti(pin); when 12 .. 15 => port := SYSCFG.EXTICR4.exti(pin); end case; end get_exti_port; procedure set_exti_port (pin : in soc.gpio.t_gpio_pin_index; port : in soc.gpio.t_gpio_port_index) is begin case pin is when 0 .. 3 => -- SYSCFG.EXTICR1.exti(pin) := port; declare exticr_list : t_exticr_list (0 .. 3) := SYSCFG.EXTICR1.exti; begin exticr_list(pin) := port; SYSCFG.EXTICR1.exti := exticr_list; end; when 4 .. 7 => -- SYSCFG.EXTICR2.exti(pin) := port; declare exticr_list : t_exticr_list (4 .. 7) := SYSCFG.EXTICR2.exti; begin exticr_list(pin) := port; SYSCFG.EXTICR2.exti := exticr_list; end; when 8 .. 11 => -- SYSCFG.EXTICR3.exti(pin) := port; declare exticr_list : t_exticr_list (8 .. 11) := SYSCFG.EXTICR3.exti; begin exticr_list(pin) := port; SYSCFG.EXTICR3.exti := exticr_list; end; when 12 .. 15 => -- SYSCFG.EXTICR4.exti(pin) := port; declare exticr_list : t_exticr_list (12 .. 15) := SYSCFG.EXTICR4.exti; begin exticr_list(pin) := port; SYSCFG.EXTICR4.exti := exticr_list; end; end case; end set_exti_port; end soc.syscfg;
reznikmm/matreshka
Ada
4,557
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Db.String_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Db_String_Attribute_Node is begin return Self : Db_String_Attribute_Node do Matreshka.ODF_Db.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Db_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Db_String_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.String_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Db_URI, Matreshka.ODF_String_Constants.String_Attribute, Db_String_Attribute_Node'Tag); end Matreshka.ODF_Db.String_Attributes;
reznikmm/matreshka
Ada
5,295
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Generic_Collections; package AMF.UML.Templateable_Elements.Collections is pragma Preelaborate; package UML_Templateable_Element_Collections is new AMF.Generic_Collections (UML_Templateable_Element, UML_Templateable_Element_Access); type Set_Of_UML_Templateable_Element is new UML_Templateable_Element_Collections.Set with null record; Empty_Set_Of_UML_Templateable_Element : constant Set_Of_UML_Templateable_Element; type Ordered_Set_Of_UML_Templateable_Element is new UML_Templateable_Element_Collections.Ordered_Set with null record; Empty_Ordered_Set_Of_UML_Templateable_Element : constant Ordered_Set_Of_UML_Templateable_Element; type Bag_Of_UML_Templateable_Element is new UML_Templateable_Element_Collections.Bag with null record; Empty_Bag_Of_UML_Templateable_Element : constant Bag_Of_UML_Templateable_Element; type Sequence_Of_UML_Templateable_Element is new UML_Templateable_Element_Collections.Sequence with null record; Empty_Sequence_Of_UML_Templateable_Element : constant Sequence_Of_UML_Templateable_Element; private Empty_Set_Of_UML_Templateable_Element : constant Set_Of_UML_Templateable_Element := (UML_Templateable_Element_Collections.Set with null record); Empty_Ordered_Set_Of_UML_Templateable_Element : constant Ordered_Set_Of_UML_Templateable_Element := (UML_Templateable_Element_Collections.Ordered_Set with null record); Empty_Bag_Of_UML_Templateable_Element : constant Bag_Of_UML_Templateable_Element := (UML_Templateable_Element_Collections.Bag with null record); Empty_Sequence_Of_UML_Templateable_Element : constant Sequence_Of_UML_Templateable_Element := (UML_Templateable_Element_Collections.Sequence with null record); end AMF.UML.Templateable_Elements.Collections;
Fabien-Chouteau/Ada_Drivers_Library
Ada
1,759
ads
with SiFive.GPIO; use SiFive.GPIO; with SiFive.SPI; use SiFive.SPI; with SiFive.PWM; use SiFive.PWM; with System; use System; with SiFive.UART; use SiFive.UART; package SiFive.Device is -- GPIO0 -- GPIO0 : aliased GPIO_Controller (268828672); P00 : aliased GPIO_Point (GPIO0'Access, 0); P01 : aliased GPIO_Point (GPIO0'Access, 1); P02 : aliased GPIO_Point (GPIO0'Access, 2); P03 : aliased GPIO_Point (GPIO0'Access, 3); P04 : aliased GPIO_Point (GPIO0'Access, 4); P05 : aliased GPIO_Point (GPIO0'Access, 5); P06 : aliased GPIO_Point (GPIO0'Access, 6); P07 : aliased GPIO_Point (GPIO0'Access, 7); P08 : aliased GPIO_Point (GPIO0'Access, 8); P09 : aliased GPIO_Point (GPIO0'Access, 9); P010 : aliased GPIO_Point (GPIO0'Access, 10); P011 : aliased GPIO_Point (GPIO0'Access, 11); P012 : aliased GPIO_Point (GPIO0'Access, 12); P013 : aliased GPIO_Point (GPIO0'Access, 13); P014 : aliased GPIO_Point (GPIO0'Access, 14); P015 : aliased GPIO_Point (GPIO0'Access, 15); -- QSPI0 -- QSPI0 : aliased SPI_Controller (268697600); -- QSPI1 -- QSPI1 : aliased SPI_Controller (268701696); -- QSPI2 -- QSPI2 : aliased SPI_Controller (268763136); -- PWM0 -- PWM0_Internal : aliased SiFive.PWM.Internal_PWM with Import, Address => System'To_Address (268566528); PWM0 : aliased SiFive.PWM.PWM_Device (PWM0_Internal'Access); -- PWM1 -- PWM1_Internal : aliased SiFive.PWM.Internal_PWM with Import, Address => System'To_Address (268570624); PWM1 : aliased SiFive.PWM.PWM_Device (PWM1_Internal'Access); -- UART0 -- UART0 : aliased SiFive.UART.UART_Device (268500992); -- UART1 -- UART1 : aliased SiFive.UART.UART_Device (268505088); end SiFive.Device;
reznikmm/matreshka
Ada
18,895
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Elements; with AMF.Internals.Element_Collections; with AMF.Internals.Helpers; with AMF.Internals.Tables.OCL_Attributes; with AMF.OCL.Ocl_Expressions; with AMF.UML.Comments.Collections; with AMF.UML.Dependencies.Collections; with AMF.UML.Elements.Collections; with AMF.UML.Named_Elements; with AMF.UML.Namespaces.Collections; with AMF.UML.Packages.Collections; with AMF.UML.Parameters; with AMF.UML.String_Expressions; with AMF.UML.Types; with AMF.Visitors.OCL_Iterators; with AMF.Visitors.OCL_Visitors; with League.Strings.Internals; with Matreshka.Internals.Strings; package body AMF.Internals.OCL_Variables is ------------------------- -- Get_Init_Expression -- ------------------------- overriding function Get_Init_Expression (Self : not null access constant OCL_Variable_Proxy) return AMF.OCL.Ocl_Expressions.OCL_Ocl_Expression_Access is begin return AMF.OCL.Ocl_Expressions.OCL_Ocl_Expression_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Init_Expression (Self.Element))); end Get_Init_Expression; ------------------------- -- Set_Init_Expression -- ------------------------- overriding procedure Set_Init_Expression (Self : not null access OCL_Variable_Proxy; To : AMF.OCL.Ocl_Expressions.OCL_Ocl_Expression_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Init_Expression (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Init_Expression; ------------------------------- -- Get_Represented_Parameter -- ------------------------------- overriding function Get_Represented_Parameter (Self : not null access constant OCL_Variable_Proxy) return AMF.UML.Parameters.UML_Parameter_Access is begin return AMF.UML.Parameters.UML_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Represented_Parameter (Self.Element))); end Get_Represented_Parameter; ------------------------------- -- Set_Represented_Parameter -- ------------------------------- overriding procedure Set_Represented_Parameter (Self : not null access OCL_Variable_Proxy; To : AMF.UML.Parameters.UML_Parameter_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Represented_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Represented_Parameter; -------------- -- Get_Type -- -------------- overriding function Get_Type (Self : not null access constant OCL_Variable_Proxy) return AMF.UML.Types.UML_Type_Access is begin return AMF.UML.Types.UML_Type_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Type (Self.Element))); end Get_Type; -------------- -- Set_Type -- -------------- overriding procedure Set_Type (Self : not null access OCL_Variable_Proxy; To : AMF.UML.Types.UML_Type_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Type (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Type; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant OCL_Variable_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is begin return AMF.UML.Dependencies.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Client_Dependency (Self.Element))); end Get_Client_Dependency; -------------- -- Get_Name -- -------------- overriding function Get_Name (Self : not null access constant OCL_Variable_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.OCL_Attributes.Internal_Get_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Name; -------------- -- Set_Name -- -------------- overriding procedure Set_Name (Self : not null access OCL_Variable_Proxy; To : AMF.Optional_String) is begin if To.Is_Empty then AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name (Self.Element, null); else AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name (Self.Element, League.Strings.Internals.Internal (To.Value)); end if; end Set_Name; ------------------------- -- Get_Name_Expression -- ------------------------- overriding function Get_Name_Expression (Self : not null access constant OCL_Variable_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access is begin return AMF.UML.String_Expressions.UML_String_Expression_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Name_Expression (Self.Element))); end Get_Name_Expression; ------------------------- -- Set_Name_Expression -- ------------------------- overriding procedure Set_Name_Expression (Self : not null access OCL_Variable_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name_Expression (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Name_Expression; ------------------- -- Get_Namespace -- ------------------- overriding function Get_Namespace (Self : not null access constant OCL_Variable_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin return AMF.UML.Namespaces.UML_Namespace_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Namespace (Self.Element))); end Get_Namespace; ------------------------ -- Get_Qualified_Name -- ------------------------ overriding function Get_Qualified_Name (Self : not null access constant OCL_Variable_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.OCL_Attributes.Internal_Get_Qualified_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Qualified_Name; -------------------- -- Get_Visibility -- -------------------- overriding function Get_Visibility (Self : not null access constant OCL_Variable_Proxy) return AMF.UML.Optional_UML_Visibility_Kind is begin return AMF.Internals.Tables.OCL_Attributes.Internal_Get_Visibility (Self.Element); end Get_Visibility; -------------------- -- Set_Visibility -- -------------------- overriding procedure Set_Visibility (Self : not null access OCL_Variable_Proxy; To : AMF.UML.Optional_UML_Visibility_Kind) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Visibility (Self.Element, To); end Set_Visibility; ----------------------- -- Get_Owned_Comment -- ----------------------- overriding function Get_Owned_Comment (Self : not null access constant OCL_Variable_Proxy) return AMF.UML.Comments.Collections.Set_Of_UML_Comment is begin return AMF.UML.Comments.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Comment (Self.Element))); end Get_Owned_Comment; ----------------------- -- Get_Owned_Element -- ----------------------- overriding function Get_Owned_Element (Self : not null access constant OCL_Variable_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element is begin return AMF.UML.Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Element (Self.Element))); end Get_Owned_Element; --------------- -- Get_Owner -- --------------- overriding function Get_Owner (Self : not null access constant OCL_Variable_Proxy) return AMF.UML.Elements.UML_Element_Access is begin return AMF.UML.Elements.UML_Element_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owner (Self.Element))); end Get_Owner; -------------------- -- All_Namespaces -- -------------------- overriding function All_Namespaces (Self : not null access constant OCL_Variable_Proxy) return AMF.UML.Namespaces.Collections.Ordered_Set_Of_UML_Namespace is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Namespaces unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Variable_Proxy.All_Namespaces"; return All_Namespaces (Self); end All_Namespaces; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant OCL_Variable_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Variable_Proxy.All_Owning_Packages"; return All_Owning_Packages (Self); end All_Owning_Packages; ----------------------------- -- Is_Distinguishable_From -- ----------------------------- overriding function Is_Distinguishable_From (Self : not null access constant OCL_Variable_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Variable_Proxy.Is_Distinguishable_From"; return Is_Distinguishable_From (Self, N, Ns); end Is_Distinguishable_From; --------------- -- Namespace -- --------------- overriding function Namespace (Self : not null access constant OCL_Variable_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Variable_Proxy.Namespace"; return Namespace (Self); end Namespace; -------------------- -- Qualified_Name -- -------------------- overriding function Qualified_Name (Self : not null access constant OCL_Variable_Proxy) return League.Strings.Universal_String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Qualified_Name unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Variable_Proxy.Qualified_Name"; return Qualified_Name (Self); end Qualified_Name; --------------- -- Separator -- --------------- overriding function Separator (Self : not null access constant OCL_Variable_Proxy) return League.Strings.Universal_String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Separator unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Variable_Proxy.Separator"; return Separator (Self); end Separator; ------------------------ -- All_Owned_Elements -- ------------------------ overriding function All_Owned_Elements (Self : not null access constant OCL_Variable_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owned_Elements unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Variable_Proxy.All_Owned_Elements"; return All_Owned_Elements (Self); end All_Owned_Elements; ------------------- -- Must_Be_Owned -- ------------------- overriding function Must_Be_Owned (Self : not null access constant OCL_Variable_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Must_Be_Owned unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Variable_Proxy.Must_Be_Owned"; return Must_Be_Owned (Self); end Must_Be_Owned; ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant OCL_Variable_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.OCL_Visitors.OCL_Visitor'Class then AMF.Visitors.OCL_Visitors.OCL_Visitor'Class (Visitor).Enter_Variable (AMF.OCL.Variables.OCL_Variable_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant OCL_Variable_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.OCL_Visitors.OCL_Visitor'Class then AMF.Visitors.OCL_Visitors.OCL_Visitor'Class (Visitor).Leave_Variable (AMF.OCL.Variables.OCL_Variable_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant OCL_Variable_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Iterator in AMF.Visitors.OCL_Iterators.OCL_Iterator'Class then AMF.Visitors.OCL_Iterators.OCL_Iterator'Class (Iterator).Visit_Variable (Visitor, AMF.OCL.Variables.OCL_Variable_Access (Self), Control); end if; end Visit_Element; end AMF.Internals.OCL_Variables;
reznikmm/matreshka
Ada
15,406
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ package AMF.Internals.Tables.Standard_Profile_L2_Metamodel.Objects is procedure Initialize; private procedure Initialize_1 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_2 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_3 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_4 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_5 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_6 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_7 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_8 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_9 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_10 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_11 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_12 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_13 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_14 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_15 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_16 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_17 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_18 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_19 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_20 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_21 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_22 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_23 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_24 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_25 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_26 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_27 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_28 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_29 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_30 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_31 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_32 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_33 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_34 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_35 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_36 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_37 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_38 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_39 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_40 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_41 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_42 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_43 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_44 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_45 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_46 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_47 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_48 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_49 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_50 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_51 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_52 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_53 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_54 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_55 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_56 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_57 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_58 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_59 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_60 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_61 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_62 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_63 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_64 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_65 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_66 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_67 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_68 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_69 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_70 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_71 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_72 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_73 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_74 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_75 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_76 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_77 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_78 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_79 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_80 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_81 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_82 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_83 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_84 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_85 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_86 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_87 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_88 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_89 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_90 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_91 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_92 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_93 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_94 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_95 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_96 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_97 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_98 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_99 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_100 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_101 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_102 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_103 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_104 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_105 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_106 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_107 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_108 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_109 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_110 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_111 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_112 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_113 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_114 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_115 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_116 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_117 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_118 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_119 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_120 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_121 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_122 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_123 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_124 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_125 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_126 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_127 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_128 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_129 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_130 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_131 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_132 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_133 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_134 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_135 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_136 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_137 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_138 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_139 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_140 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_141 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_142 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_143 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_144 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_145 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_146 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_147 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_148 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_149 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_150 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_151 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_152 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_153 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_154 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_155 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_156 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_157 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_158 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_159 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_160 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_161 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_162 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_163 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_164 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_165 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_166 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_167 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_168 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_169 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_170 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_171 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_172 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_173 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_174 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_175 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_176 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_177 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_178 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_179 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_180 (Extent : AMF.Internals.AMF_Extent); end AMF.Internals.Tables.Standard_Profile_L2_Metamodel.Objects;
stcarrez/hyperion
Ada
2,320
ads
----------------------------------------------------------------------- -- hyperion-hosts-beans -- Beans for module hosts -- Copyright (C) 2017 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Util.Beans.Basic; with Util.Beans.Objects; with Util.Beans.Methods; with Hyperion.Hosts.Modules; with Hyperion.Hosts.Models; package Hyperion.Hosts.Beans is type Host_Bean is new Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with record Module : Hyperion.Hosts.Modules.Host_Module_Access := null; Count : Natural := 0; end record; type Host_Bean_Access is access all Host_Bean'Class; -- Get the value identified by the name. overriding function Get_Value (From : in Host_Bean; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. overriding procedure Set_Value (From : in out Host_Bean; Name : in String; Value : in Util.Beans.Objects.Object); -- This bean provides some methods that can be used in a Method_Expression overriding function Get_Method_Bindings (From : in Host_Bean) return Util.Beans.Methods.Method_Binding_Array_Access; -- Example of action method. procedure Action (Bean : in out Host_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); -- Create the Hosts_Bean bean instance. function Create_Host_Bean (Module : in Hyperion.Hosts.Modules.Host_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access; end Hyperion.Hosts.Beans;