content
stringlengths
23
1.05M
------------------------------------------------------------------------------ -- G E L A X A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ with Ada.Characters.Handling; with Ada.Unchecked_Deallocation; with Asis.Elements; with Asis.Definitions; with Asis.Expressions; with Asis.Declarations; with XASIS.Static.Iter; with XASIS.Static.Signed; with XASIS.Static.Discrete; with XASIS.Static.Unsigned; with XASIS.Static.Float; with XASIS.Static.Fixed; with XASIS.Utils; pragma Elaborate (XASIS.Static.Iter); package body XASIS.Static is type Calculator is null record; function Literal (Object : access Calculator; Element : in Asis.Expression) return Value; function Operator (Object : access Calculator; Tipe : in Classes.Type_Info; Kind : in Asis.Operator_Kinds; Args : in Asis.Association_List) return Value; function Attribute (Object : access Calculator; Tipe : in Classes.Type_Info; Kind : in Asis.Attribute_Kinds; Element : in Asis.Expression) return Value; function Attribute_Call (Object : access Calculator; Tipe : in Classes.Type_Info; Kind : in Asis.Attribute_Kinds; Args : in Asis.Association_List) return Value; function Check_Range (Object : access Calculator; Expr : in Asis.Expression; Bounds : in Static_Range; Invert : in Boolean) return Value; function Undefined (Object : access Calculator; Element : in Asis.Expression) return Value; function Range_Of_Array (Object : access Calculator; Decl : in Asis.Declaration; Attr : in Asis.Expression) return Static_Range; function Range_Of_Type (Object : access Calculator; Type_Def : in Asis.Definition) return Static_Range; function String_Constant_Range (Object : access Calculator; Decl : in Asis.Declaration) return Static_Range; package S is new XASIS.Static.Iter (Value, Static_Range, Calculator, Literal => Literal, Operator => Operator, Attribute => Attribute, Attribute_Call => Attribute_Call, Check_Range => Check_Range, Undefined => Undefined, Range_Of_Array => Range_Of_Array, Range_Of_Type => Range_Of_Type, String_Constant_Range => String_Constant_Range); function Get_Type_Class (Info : Classes.Type_Info) return Type_Class'Class; function "+" (Item : Asis.ASIS_Integer) return XASIS.Integers.Value; function Check_Range (Object : access Calculator; Val : in Value; Bounds : in Static_Range; Invert : in Boolean) return Value; --------- -- "+" -- --------- function "+" (Item : Value) return Asis.ASIS_Integer is begin if Item.Kind = Static_Discrete then return Asis.ASIS_Integer'Value (XASIS.Integers.Image (Item.Pos)); else Raise_Error (Unexpected_Type); return 0; end if; end "+"; --------- -- "+" -- --------- function "+" (Item : Asis.ASIS_Integer) return XASIS.Integers.Value is begin return XASIS.Integers.Literal (Asis.ASIS_Integer'Image (Item)); end "+"; ------------ -- Adjust -- ------------ procedure Adjust (Object : in out Integer_Array_Node) is begin if Object.Data /= null then Object.Data := new Integer_Array'(Object.Data.all); end if; end Adjust; ------------------------------------- -- Attribute_Designator_Expression -- ------------------------------------- function Attribute_Designator_Expression (Attr : Asis.Expression) return Value is Args : constant Asis.Expression_List := Asis.Expressions.Attribute_Designator_Expressions (Attr); begin if Args'Length > 0 then return Evaluate (Args (1)); else return Static_One; end if; end Attribute_Designator_Expression; ---------------- -- Check_Zero -- ---------------- procedure Check_Zero (Item : Value) is begin if Item = Static_Zero or Item = (Static_Float, Fractions.Zero) then Raise_Error (Division_By_Zero); end if; end Check_Zero; ----------------- -- Debug_Image -- ----------------- function Debug_Image (Item : Value) return Wide_String is use Ada.Characters.Handling; begin case Item.Kind is when Static_Discrete => return "Static_Discrete:" & To_Wide_String (XASIS.Integers.Image (Item.Pos)); when Static_Undefined => return "Static_Undefined"; when others => return ""; end case; end Debug_Image; -------------- -- Evaluate -- -------------- function Evaluate (Element : Asis.Expression) return Value is Object : aliased Calculator; begin return S.Evaluate (Object'Access, Element); end Evaluate; -------------- -- Finalize -- -------------- procedure Finalize (Object : in out Integer_Array_Node) is procedure Free is new Ada.Unchecked_Deallocation (Integer_Array, Integer_Array_Access); begin if Object.Data /= null then Free (Object.Data); end if; end Finalize; -------------- -- Fraction -- -------------- function Fraction (Item : Value) return XASIS.Fractions.Fraction is begin return Item.Fraction; end Fraction; ----------- -- Image -- ----------- function Image (Item : Value) return Wide_String is use Ada.Characters.Handling; begin if Item.Kind /= Static_Discrete then Raise_Error (Unexpected_Type); end if; return To_Wide_String (XASIS.Integers.Image (Item.Pos)); end Image; -------------- -- In_Range -- -------------- function In_Range (Item : Value; Element : Asis.Definition) return Boolean is Object : aliased Calculator; Rng : constant Static_Range := S.Get_Discrete_Range (Object'Access, Element); begin return Check_Range (Object'Access, Item, Rng, False) = Static_True; end In_Range; ------------- -- Integer -- ------------- function Integer (Item : Value) return XASIS.Integers.Value is begin return Item.Pos; end Integer; ---------------------------- -- Static_Range_Attribute -- ---------------------------- function Static_Range_Attribute (Attr : Asis.Expression) return Static_Range is Object : aliased Calculator; begin return S.Static_Range_Attribute (Object'Access, Attr); end Static_Range_Attribute; -------------------- -- Get_Type_Class -- -------------------- function Get_Type_Class (Info : Classes.Type_Info) return Type_Class'Class is begin if Classes.Is_Discrete (Info) then if Classes.Is_Integer (Info) then if Classes.Is_Modular_Integer (Info) then return Unsigned.Type_Class'(Info => Info); else return Signed.Type_Class'(Info => Info); end if; else return Discrete.Type_Class'(Info => Info); end if; elsif Classes.Is_Float_Point (Info) then return Float.Type_Class'(Info => Info); elsif Classes.Is_Fixed_Point (Info) then return Fixed.Type_Class'(Info => Info); else Raise_Error (Not_Implemented); return Get_Type_Class (Info); end if; end Get_Type_Class; --------------- -- Undefined -- --------------- function Undefined return Value is begin return (Kind => Static_Undefined); end Undefined; --------------------------------------------- -- Static.Iter procedures inplimentation -- --------------------------------------------- ------------- -- Literal -- ------------- function Literal (Object : access Calculator; Element : in Asis.Expression) return Value is use Asis; use Asis.Elements; use Asis.Expressions; Kind : constant Asis.Expression_Kinds := Expression_Kind (Element); begin case Kind is when An_Integer_Literal => declare Text : constant String := Ada.Characters.Handling.To_String (Value_Image (Element)); begin return Discrete.I (XASIS.Integers.Literal (Text)); end; when A_Real_Literal => declare Text : constant String := Ada.Characters.Handling.To_String (Value_Image (Element)); begin return Float.V (XASIS.Fractions.Value(Text)); end; when An_Enumeration_Literal | A_Character_Literal | An_Identifier => declare Decl : constant Asis.Declaration := XASIS.Utils.Selected_Name_Declaration (Element, False); Name : constant Asis.Defining_Name := Asis.Declarations.Names (Decl) (1); Pos : constant Wide_String := Asis.Declarations.Position_Number_Image (Name); Text : constant String := Ada.Characters.Handling.To_String (Pos); begin if Is_Part_Of_Implicit (Decl) then -- impl defined character declare Img : constant Wide_String := Name_Image (Element); Pos : constant Asis.ASIS_Natural := Wide_Character'Pos (Img (2)); begin return Discrete.I (+Pos); end; else return Discrete.I (XASIS.Integers.Literal (Text)); end if; end; when A_String_Literal => declare use Ada.Finalization; function Dequote (Text : Wide_String) return Wide_String is Result : Wide_String (Text'Range); Last : Natural := Result'First - 1; Skip : Boolean := False; begin for J in Text'First + 2 .. Text'Last - 2 loop if Skip then Skip := False; else Last := Last + 1; Result (Last) := Text (J); Skip := Text (J) = '"'; end if; end loop; return Result (Result'First .. Last); end Dequote; Image : constant Wide_String := Dequote (Value_Image (Element)); Text : Integer_Array (1 .. Image'Length); begin for J in Image'Range loop Text (Asis.ASIS_Positive (J)) := +Wide_Character'Pos (Image (J)); end loop; return (Kind => Static_String, Lower => XASIS.Integers.One, -- TODO Upper => + (Text'Last), String => (Controlled with new Integer_Array'(Text))); end; when others => Raise_Error (Internal_Error); return Undefined; end case; end Literal; -------------- -- Operator -- -------------- function Operator (Object : access Calculator; Tipe : in Classes.Type_Info; Kind : in Asis.Operator_Kinds; Args : in Asis.Association_List) return Value is Switch : Type_Class'Class := Get_Type_Class (Tipe); begin return Evaluate (Switch, Kind, Args); end Operator; --------------- -- Attribute -- --------------- function Attribute (Object : access Calculator; Tipe : in Classes.Type_Info; Kind : in Asis.Attribute_Kinds; Element : in Asis.Expression) return Value is Switch : Type_Class'Class := Get_Type_Class (Tipe); begin return Evaluate (Switch, Kind, Element); end Attribute; -------------------- -- Attribute_Call -- -------------------- function Attribute_Call (Object : access Calculator; Tipe : in Classes.Type_Info; Kind : in Asis.Attribute_Kinds; Args : in Asis.Association_List) return Value is Switch : Type_Class'Class := Get_Type_Class (Tipe); begin return Evaluate (Switch, Kind, Args); end Attribute_Call; ----------------- -- Check_Range -- ----------------- function Check_Range (Object : access Calculator; Expr : in Asis.Expression; Bounds : in Static_Range; Invert : in Boolean) return Value is Val : constant Value := S.Evaluate (Object, Expr); begin return Check_Range (Object, Val, Bounds, Invert); end Check_Range; ----------------- -- Check_Range -- ----------------- function Check_Range (Object : access Calculator; Val : in Value; Bounds : in Static_Range; Invert : in Boolean) return Value is use XASIS.Integers; begin if Discrete.Is_Discrete (Val) and then Discrete.Is_Discrete (Bounds (Lower)) then if Val.Pos < Bounds (Lower).Pos then if Invert then return Static_True; else return Static_False; end if; elsif Discrete.Is_Discrete (Bounds (Upper)) then if Val.Pos <= Bounds (Upper).Pos xor Invert then return Static_True; else return Static_False; end if; end if; end if; return Undefined; end Check_Range; ---------------- -- Last_Error -- ---------------- procedure Last_Error (Reason : out Error_Reason) is begin Reason := Last_Error_Reason; end Last_Error; --------------- -- Undefined -- --------------- function Undefined (Object : access Calculator; Element : in Asis.Expression) return Value is begin return Undefined; end Undefined; ----------------- -- Raise_Error -- ----------------- procedure Raise_Error (Reason : Error_Reason) is begin Last_Error_Reason := Reason; raise Evaluation_Error; end Raise_Error; -------------------- -- Range_Of_Array -- -------------------- function Range_Of_Array (Object : access Calculator; Decl : in Asis.Declaration; Attr : in Asis.Expression) return Static_Range is Val : constant Value := Attribute_Designator_Expression (Attr); Index : Asis.ASIS_Positive; begin if Discrete.Is_Discrete (Val) then Index := +Val; else return (Undefined, Undefined); end if; return S.Constrained_Array_Range (Object, Decl, Index); end Range_Of_Array; ------------------- -- Range_Of_Type -- ------------------- function Range_Of_Type (Object : access Calculator; Type_Def : in Asis.Definition) return Static_Range is use Asis; use Asis.Definitions; begin case Asis.Elements.Type_Kind (Type_Def) is when An_Enumeration_Type_Definition => declare List : constant Asis.Declaration_List := Enumeration_Literal_Declarations (Type_Def); Last : constant XASIS.Integers.Value := +(List'Length - 1); begin return (Static_Zero, Discrete.I (Last)); end; when A_Signed_Integer_Type_Definition => return (Undefined, Undefined); when A_Modular_Type_Definition => declare use XASIS.Integers; Module : constant Asis.Expression := Mod_Static_Expression (Type_Def); Val : constant Value := S.Evaluate (Object, Module); begin if Discrete.Is_Discrete (Val) then return (Static_Zero, Discrete.I (Val.Pos - One)); else return (Undefined, Undefined); end if; end; when A_Floating_Point_Definition | An_Ordinary_Fixed_Point_Definition | A_Decimal_Fixed_Point_Definition => return (Undefined, Undefined); when others => Raise_Error (Internal_Error); return (Undefined, Undefined); end case; end Range_Of_Type; --------------------------- -- String_Constant_Range -- --------------------------- function String_Constant_Range (Object : access Calculator; Decl : in Asis.Declaration) return Static_Range is use XASIS.Static.Discrete; Val : constant Value := S.Evaluate_Static_Constant (Object, Decl); begin if Val.Kind = Static_Undefined then return (Undefined, Undefined); elsif Val.Kind = Static_String then return (I (Val.Lower), I (Val.Upper)); else Raise_Error (Unexpected_Type); return (Undefined, Undefined); end if; end String_Constant_Range; -------------- -- To_Fixed -- -------------- function To_Fixed (Item : Value; Tipe : Classes.Type_Info) return XASIS.Integers.Value is begin return Fixed.V (Item, Tipe).Fixed; end To_Fixed; end XASIS.Static; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, Maxim Reznik -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of the Maxim Reznik, IE nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------
with Interfaces.C.Strings; with Tkmrpc.Types; with Tkmrpc.Results; package Tkmrpc.Clients.Cfg is procedure Init (Result : out Results.Result_Type; Address : Interfaces.C.Strings.chars_ptr); pragma Export (C, Init, "cfg_init"); pragma Export_Valued_Procedure (Init); -- Initialize CFG client with given address. procedure Tkm_Version (Result : out Results.Result_Type; Version : out Types.Version_Type); pragma Export (C, Tkm_Version, "cfg_tkm_version"); pragma Export_Valued_Procedure (Tkm_Version); -- Returns the version of TKM. procedure Tkm_Limits (Result : out Results.Result_Type; Max_Active_Requests : out Types.Active_Requests_Type; Authag_Contexts : out Types.Authag_Id_Type; Cag_Contexts : out Types.Cag_Id_Type; Li_Contexts : out Types.Li_Id_Type; Ri_Contexts : out Types.Ri_Id_Type; Iag_Contexts : out Types.Iag_Id_Type; Eag_Contexts : out Types.Eag_Id_Type; Dhag_Contexts : out Types.Dhag_Id_Type; Sp_Contexts : out Types.Sp_Id_Type; Authp_Contexts : out Types.Authp_Id_Type; Dhp_Contexts : out Types.Dhp_Id_Type; Autha_Contexts : out Types.Autha_Id_Type; Ca_Contexts : out Types.Ca_Id_Type; Lc_Contexts : out Types.Lc_Id_Type; Ia_Contexts : out Types.Ia_Id_Type; Ea_Contexts : out Types.Ea_Id_Type; Dha_Contexts : out Types.Dha_Id_Type); pragma Export (C, Tkm_Limits, "cfg_tkm_limits"); pragma Export_Valued_Procedure (Tkm_Limits); -- Returns limits of fixed length of TKM. procedure Tkm_Reset (Result : out Results.Result_Type); pragma Export (C, Tkm_Reset, "cfg_tkm_reset"); pragma Export_Valued_Procedure (Tkm_Reset); -- Reset the TKM - CFG interface to a known initial state. end Tkmrpc.Clients.Cfg;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2015, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ pragma Restrictions (No_Elaboration_Code); -- GNAT: enforce generation of preinitialized data section instead of -- generation of elaboration code. package Matreshka.Internals.Unicode.Ucd.Core_001B is pragma Preelaborate; Group_001B : aliased constant Core_Second_Stage := (16#00# .. 16#03# => -- 1B00 .. 1B03 (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#04# => -- 1B04 (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#34# => -- 1B34 (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Diacritic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#35# => -- 1B35 (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#36# .. 16#3A# => -- 1B36 .. 1B3A (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#3B# => -- 1B3B (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#3C# => -- 1B3C (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#3D# .. 16#41# => -- 1B3D .. 1B41 (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#42# => -- 1B42 (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#43# => -- 1B43 (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#44# => -- 1B44 (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Diacritic | Grapheme_Base | Grapheme_Link | ID_Continue | XID_Continue => True, others => False)), 16#4C# .. 16#4F# => -- 1B4C .. 1B4F (Unassigned, Neutral, Other, Other, Other, Unknown, (others => False)), 16#50# .. 16#59# => -- 1B50 .. 1B59 (Decimal_Number, Neutral, Other, Numeric, Numeric, Numeric, (Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#5A# .. 16#5B# => -- 1B5A .. 1B5B (Other_Punctuation, Neutral, Other, Other, S_Term, Break_After, (STerm | Terminal_Punctuation | Grapheme_Base => True, others => False)), 16#5C# => -- 1B5C (Other_Punctuation, Neutral, Other, Other, Other, Alphabetic, (Grapheme_Base => True, others => False)), 16#5D# => -- 1B5D (Other_Punctuation, Neutral, Other, Other, Other, Break_After, (Terminal_Punctuation | Grapheme_Base => True, others => False)), 16#5E# .. 16#5F# => -- 1B5E .. 1B5F (Other_Punctuation, Neutral, Other, Other, S_Term, Break_After, (STerm | Terminal_Punctuation | Grapheme_Base => True, others => False)), 16#60# => -- 1B60 (Other_Punctuation, Neutral, Other, Other, Other, Break_After, (Grapheme_Base => True, others => False)), 16#61# .. 16#6A# => -- 1B61 .. 1B6A (Other_Symbol, Neutral, Other, Other, Other, Alphabetic, (Grapheme_Base => True, others => False)), 16#6B# .. 16#73# => -- 1B6B .. 1B73 (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Diacritic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#74# .. 16#7C# => -- 1B74 .. 1B7C (Other_Symbol, Neutral, Other, Other, Other, Alphabetic, (Grapheme_Base => True, others => False)), 16#7D# .. 16#7F# => -- 1B7D .. 1B7F (Unassigned, Neutral, Other, Other, Other, Unknown, (others => False)), 16#80# .. 16#81# => -- 1B80 .. 1B81 (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#82# => -- 1B82 (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#A1# => -- 1BA1 (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#A2# .. 16#A5# => -- 1BA2 .. 1BA5 (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#A6# .. 16#A7# => -- 1BA6 .. 1BA7 (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#A8# .. 16#A9# => -- 1BA8 .. 1BA9 (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#AA# => -- 1BAA (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Diacritic | Grapheme_Base | Grapheme_Link | ID_Continue | XID_Continue => True, others => False)), 16#AB# => -- 1BAB (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Diacritic | Case_Ignorable | Grapheme_Extend | Grapheme_Link | ID_Continue | XID_Continue => True, others => False)), 16#AC# .. 16#AD# => -- 1BAC .. 1BAD (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#B0# .. 16#B9# => -- 1BB0 .. 1BB9 (Decimal_Number, Neutral, Other, Numeric, Numeric, Numeric, (Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#E6# => -- 1BE6 (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#E7# => -- 1BE7 (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#E8# .. 16#E9# => -- 1BE8 .. 1BE9 (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#EA# .. 16#EC# => -- 1BEA .. 1BEC (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#ED# => -- 1BED (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#EE# => -- 1BEE (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#EF# .. 16#F1# => -- 1BEF .. 1BF1 (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#F2# .. 16#F3# => -- 1BF2 .. 1BF3 (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Grapheme_Base | Grapheme_Link | ID_Continue | XID_Continue => True, others => False)), 16#F4# .. 16#FB# => -- 1BF4 .. 1BFB (Unassigned, Neutral, Other, Other, Other, Unknown, (others => False)), 16#FC# .. 16#FF# => -- 1BFC .. 1BFF (Other_Punctuation, Neutral, Other, Other, Other, Alphabetic, (Grapheme_Base => True, others => False)), others => (Other_Letter, Neutral, Other, A_Letter, O_Letter, Alphabetic, (Alphabetic | Grapheme_Base | ID_Continue | ID_Start | XID_Continue | XID_Start => True, others => False))); end Matreshka.Internals.Unicode.Ucd.Core_001B;
----------------------------------------------------------------------- -- Util.Streams.Files -- File Stream utilities -- Copyright (C) 2010, 2011, 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.IO_Exceptions; package body Util.Streams.Texts is procedure Initialize (Stream : in out Print_Stream; To : in Output_Stream_Access) is begin Stream.Initialize (Output => To, Input => null, Size => 4096); end Initialize; -- ------------------------------ -- Write an integer on the stream. -- ------------------------------ procedure Write (Stream : in out Print_Stream; Item : in Integer) is S : constant String := Integer'Image (Item); begin if Item > 0 then Stream.Write (S (S'First + 1 .. S'Last)); else Stream.Write (S); end if; end Write; -- ------------------------------ -- Write an integer on the stream. -- ------------------------------ procedure Write (Stream : in out Print_Stream; Item : in Long_Long_Integer) is S : constant String := Long_Long_Integer'Image (Item); begin if Item > 0 then Stream.Write (S (S'First + 1 .. S'Last)); else Stream.Write (S); end if; end Write; -- ------------------------------ -- Write a string on the stream. -- ------------------------------ procedure Write (Stream : in out Print_Stream; Item : in Ada.Strings.Unbounded.Unbounded_String) is begin Stream.Write (Ada.Strings.Unbounded.To_String (Item)); end Write; -- ------------------------------ -- Write a date on the stream. -- ------------------------------ procedure Write (Stream : in out Print_Stream; Item : in Ada.Calendar.Time; Format : in GNAT.Calendar.Time_IO.Picture_String := GNAT.Calendar.Time_IO.ISO_Date) is begin Stream.Write (GNAT.Calendar.Time_IO.Image (Item, Format)); end Write; -- ------------------------------ -- Get the output stream content as a string. -- ------------------------------ function To_String (Stream : in Buffered.Buffered_Stream) return String is use Ada.Streams; Size : constant Natural := Stream.Get_Size; Buffer : constant Streams.Buffered.Buffer_Access := Stream.Get_Buffer; Result : String (1 .. Size); begin for I in Result'Range loop Result (I) := Character'Val (Buffer (Stream_Element_Offset (I))); end loop; return Result; end To_String; -- ------------------------------ -- Initialize the reader to read the input from the input stream given in <b>From</b>. -- ------------------------------ procedure Initialize (Stream : in out Reader_Stream; From : in Input_Stream_Access) is begin Stream.Initialize (Output => null, Input => From, Size => 4096); end Initialize; -- ------------------------------ -- Read an input line from the input stream. The line is terminated by ASCII.LF. -- When <b>Strip</b> is set, the line terminators (ASCII.CR, ASCII.LF) are removed. -- ------------------------------ procedure Read_Line (Stream : in out Reader_Stream; Into : out Ada.Strings.Unbounded.Unbounded_String; Strip : in Boolean := False) is C : Character; begin while not Stream.Is_Eof loop Stream.Read (C); if C = ASCII.LF then if not Strip then Ada.Strings.Unbounded.Append (Into, C); end if; return; elsif C /= ASCII.CR or not Strip then Ada.Strings.Unbounded.Append (Into, C); end if; end loop; exception when Ada.IO_Exceptions.Data_Error => return; end Read_Line; end Util.Streams.Texts;
-- Copyright 2017-2021 Bartek thindil Jasicki -- -- This file is part of Steam Sky. -- -- Steam Sky is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- Steam Sky is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Steam Sky. If not, see <http://www.gnu.org/licenses/>. with Ada.Containers.Vectors; use Ada.Containers; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Crew; use Crew; with Game; use Game; -- ****h* Statistics/Statistics -- FUNCTION -- Provides code for manipulate the game statistic -- SOURCE package Statistics is -- **** -- ****s* Statistics/Statistics.Statistics_Data -- FUNCTION -- Data for finished goals, destroyed ships and killed mobs -- PARAMETERS -- Index - Index of goal or ship name or name of fraction of killed mobs -- Amount - Amount of finished goals or ships or mobs of that type -- SOURCE type Statistics_Data is record Index: Unbounded_String; Amount: Positive := 1; end record; -- **** -- ****t* Statistics/Statistics.Statistics_Container -- FUNCTION -- Used to store game statistics data -- SOURCE package Statistics_Container is new Vectors(Positive, Statistics_Data); -- **** -- ****s* Statistics/Statistics.GameStats_Data -- FUNCTION -- Data for game statistics -- PARAMETERS -- DestroyedShips - Data for all destroyed ships by player -- BasesVisited - Amount of visited bases -- MapVisited - Amount of visited map fields -- DistanceTraveled - Amount of map fields travelled -- CraftingOrders - Data for finished crafting orders -- AcceptedMissions - Amount of accepted missions -- FinishedMissions - Data for all finished missions -- FinishedGoals - Data for all finished goals -- KilledMobs - Data for all mobs killed by player -- Points - Amount of gained points -- SOURCE type GameStats_Data is record DestroyedShips: Statistics_Container.Vector; BasesVisited: Bases_Range; MapVisited: Positive := 1; DistanceTraveled: Natural := 0; CraftingOrders: Statistics_Container.Vector; AcceptedMissions: Natural := 0; FinishedMissions: Statistics_Container.Vector; FinishedGoals: Statistics_Container.Vector; KilledMobs: Statistics_Container.Vector; Points: Natural := 0; end record; -- **** -- ****v* Statistics/Statistics.GameStats -- FUNCTION -- Game statistics -- SOURCE GameStats: GameStats_Data; -- **** -- ****f* Statistics/Statistics.UpdateDestroyedShips -- FUNCTION -- Add new destroyed ship to list -- PARAMETERS -- ShipName - Name of the ship to add to destroyed list -- SOURCE procedure UpdateDestroyedShips(ShipName: Unbounded_String) with Pre => ShipName /= Null_Unbounded_String, Test_Case => (Name => "Test_UpdateDestroyedShips", Mode => Nominal); -- **** -- ****f* Statistics/Statistics.ClearGameStats -- FUNCTION -- Clear game statistics -- SOURCE procedure ClearGameStats with Post => GameStats.Points = 0, Test_Case => (Name => "Test_ClearGameStats", Mode => Nominal); -- **** -- ****f* Statistics/Statistics.UpdateFinishedGoals -- FUNCTION -- Add new finished goal to list -- PARAMETERS -- Index - Index of goal to update -- SOURCE procedure UpdateFinishedGoals(Index: Unbounded_String) with Pre => Index /= Null_Unbounded_String, Test_Case => (Name => "Test_UpdateFinishedGoals", Mode => Nominal); -- **** -- ****f* Statistics/Statistics.UpdateFinishedMissions -- FUNCTION -- Add new finished mission to list -- PARAMETERS -- MType - Type of mission to update -- SOURCE procedure UpdateFinishedMissions(MType: Unbounded_String) with Pre => MType /= Null_Unbounded_String, Test_Case => (Name => "Test_UpdateFinishedMissions", Mode => Nominal); -- **** -- ****f* Statistics/Statistics.UpdateCraftingOrders -- FUNCTION -- Add new finished crafting order to list -- PARAMETERS -- Index - Index of crafting order to update -- SOURCE procedure UpdateCraftingOrders(Index: Unbounded_String) with Pre => Index /= Null_Unbounded_String, Test_Case => (Name => "Test_UpdateCraftingOrders", Mode => Nominal); -- **** -- ****f* Statistics/Statistics.UpdateKilledMobs -- FUNCTION -- Add new killed mob to list -- PARAMETERS -- Mob - Killed mobile data -- FactionName - Faction name to which killed mobile belongs -- SOURCE procedure UpdateKilledMobs (Mob: Member_Data; FractionName: Unbounded_String) with Pre => FractionName /= Null_Unbounded_String, Test_Case => (Name => "Test_UpdateKilledMobs", Mode => Nominal); -- **** -- ****f* Statistics/Statistics.GetGamePoints -- FUNCTION -- Get amount of gained points multiplied by difficulty bonus -- RESULT -- Amount of gained points by player in this game -- SOURCE function GetGamePoints return Natural with Test_Case => (Name => "Test_GetGamePoints", Mode => Robustness); -- **** end Statistics;
with Datos, Posicion; use Datos; function Interseccion (L1, L2 : in Lista ) return Lista is -- pre: -- post: se ha insertado el nuevo valor en L de manera ordenada LI : Lista; Num : Integer; begin crear_lista_vacia(LI); while L1 /= null loop while L2 /= null loop if Num = L2.all.info then LI : new Nodo; end Interseccion;
----------------------------------------------------------------------- -- views.nodes.jsf -- JSF Core Tag Library -- Copyright (C) 2010, 2011, 2012, 2013, 2014 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Beans.Objects; with ASF.Converters; with ASF.Converters.Dates; with ASF.Validators.Texts; with ASF.Validators.Numbers; with ASF.Components.Holders; with ASF.Components.Core.Views; package body ASF.Views.Nodes.Jsf is -- Get the date conversion global format. function Get_Format (Node : in Convert_Date_Time_Tag_Node; Context : in Contexts.Facelets.Facelet_Context'Class) return ASF.Converters.Dates.Format_Type; -- Get a dateStyle or a timeStyle attribute value. function Get_Date_Style (Node : in Convert_Date_Time_Tag_Node; Name : in String; Attr : in Tag_Attribute_Access; Context : in Contexts.Facelets.Facelet_Context'Class) return ASF.Converters.Dates.Style_Type; -- ------------------------------ -- Converter Tag -- ------------------------------ -- ------------------------------ -- Create the Converter Tag -- ------------------------------ function Create_Converter_Tag_Node (Binding : in Binding_Access; Line : in Views.Line_Info; Parent : in Views.Nodes.Tag_Node_Access; Attributes : in Views.Nodes.Tag_Attribute_Array_Access) return Views.Nodes.Tag_Node_Access is use ASF.Views.Nodes; Node : constant Converter_Tag_Node_Access := new Converter_Tag_Node; Conv : constant Tag_Attribute_Access := Find_Attribute (Attributes, "converterId"); begin Initialize (Node.all'Access, Binding, Line, Parent, Attributes); if Conv = null then Node.Error ("Missing 'converterId' attribute"); else Node.Converter := EL.Objects.To_Object (Conv.Value); end if; return Node.all'Access; end Create_Converter_Tag_Node; -- ------------------------------ -- Build the component tree from the tag node and attach it as -- the last child of the given parent. Calls recursively the -- method to create children. Get the specified converter and -- add it to the parent component. This operation does not create any -- new UIComponent. -- ------------------------------ overriding procedure Build_Components (Node : access Converter_Tag_Node; Parent : in UIComponent_Access; Context : in out Contexts.Facelets.Facelet_Context'Class) is use ASF.Components.Holders; use type ASF.Converters.Converter_Access; Cvt : constant Converters.Converter_Access := Context.Get_Converter (Node.Converter); begin if not (Parent.all in Value_Holder'Class) then Node.Error ("Parent component is not an instance of Value_Holder"); return; end if; if Cvt = null then Node.Error ("Converter was not found"); return; end if; declare VH : constant access Value_Holder'Class := Value_Holder'Class (Parent.all)'Access; begin VH.Set_Converter (Converter => Cvt); end; end Build_Components; -- ------------------------------ -- Convert Date Time Tag -- ------------------------------ -- ------------------------------ -- Create the Converter Tag -- ------------------------------ function Create_Convert_Date_Time_Tag_Node (Binding : in Binding_Access; Line : in Views.Line_Info; Parent : in Views.Nodes.Tag_Node_Access; Attributes : in Nodes.Tag_Attribute_Array_Access) return Views.Nodes.Tag_Node_Access is use ASF.Views.Nodes; Node : constant Convert_Date_Time_Tag_Node_Access := new Convert_Date_Time_Tag_Node; begin Initialize (Node.all'Access, Binding, Line, Parent, Attributes); Node.Date_Style := Find_Attribute (Attributes, "dateStyle"); Node.Time_Style := Find_Attribute (Attributes, "timeStyle"); Node.Locale := Find_Attribute (Attributes, "locale"); Node.Pattern := Find_Attribute (Attributes, "pattern"); Node.Format := Find_Attribute (Attributes, "type"); return Node.all'Access; end Create_Convert_Date_Time_Tag_Node; -- Get a dateStyle or a timeStyle attribute value. function Get_Date_Style (Node : in Convert_Date_Time_Tag_Node; Name : in String; Attr : in Tag_Attribute_Access; Context : in Contexts.Facelets.Facelet_Context'Class) return ASF.Converters.Dates.Style_Type is Style : constant String := Get_Value (Attr, Context, ""); begin if Style = "default" or Style = "" then return ASF.Converters.Dates.DEFAULT; elsif Style = "short" then return ASF.Converters.Dates.SHORT; elsif Style = "medium" then return ASF.Converters.Dates.MEDIUM; elsif Style = "long" then return ASF.Converters.Dates.LONG; elsif Style = "full" then return ASF.Converters.Dates.FULL; else Node.Error ("Invalid attribute {0}: {1}", Name, Style); return ASF.Converters.Dates.DEFAULT; end if; end Get_Date_Style; -- Get the date conversion global format. function Get_Format (Node : in Convert_Date_Time_Tag_Node; Context : in Contexts.Facelets.Facelet_Context'Class) return ASF.Converters.Dates.Format_Type is Format : constant String := Get_Value (Node.Format, Context, ""); begin if Format = "both" then return ASF.Converters.Dates.BOTH; elsif Format = "time" then return ASF.Converters.Dates.TIME; elsif Format = "date" then return ASF.Converters.Dates.DATE; else Node.Error ("Invalid attribute type: {0}", Format); return ASF.Converters.Dates.BOTH; end if; end Get_Format; -- ------------------------------ -- Build the component tree from the tag node and attach it as -- the last child of the given parent. Calls recursively the -- method to create children. Get the specified converter and -- add it to the parent component. This operation does not create any -- new UIComponent. -- ------------------------------ overriding procedure Build_Components (Node : access Convert_Date_Time_Tag_Node; Parent : in UIComponent_Access; Context : in out Contexts.Facelets.Facelet_Context'Class) is use ASF.Components.Holders; use ASF.Converters; C : ASF.Converters.Dates.Date_Converter_Access; Locale : constant String := Get_Value (Node.Locale, Context, ""); begin if not (Parent.all in Value_Holder'Class) then Node.Error ("Parent component is not an instance of Value_Holder"); return; end if; if Node.Pattern /= null then C := Dates.Create_Date_Converter (Date => Converters.Dates.DEFAULT, Time => Converters.Dates.DEFAULT, Format => Converters.Dates.CONVERTER_PATTERN, Locale => Locale, Pattern => Get_Value (Node.Pattern, Context, "")); elsif Node.Format /= null then C := Dates.Create_Date_Converter (Date => Get_Date_Style (Node.all, "dateStyle", Node.Date_Style, Context), Time => Get_Date_Style (Node.all, "timeStyle", Node.Time_Style, Context), Format => Get_Format (Node.all, Context), Locale => Locale, Pattern => ""); elsif Node.Date_Style /= null then C := Dates.Create_Date_Converter (Date => Get_Date_Style (Node.all, "dateStyle", Node.Date_Style, Context), Time => Converters.Dates.DEFAULT, Format => Converters.Dates.DATE, Locale => Locale, Pattern => ""); elsif Node.Time_Style /= null then C := Dates.Create_Date_Converter (Date => Converters.Dates.DEFAULT, Time => Get_Date_Style (Node.all, "timeStyle", Node.Time_Style, Context), Format => ASF.Converters.Dates.TIME, Locale => Locale, Pattern => ""); else C := Dates.Create_Date_Converter (Date => Converters.Dates.DEFAULT, Time => Converters.Dates.DEFAULT, Format => ASF.Converters.Dates.BOTH, Locale => Locale, Pattern => ""); end if; declare VH : constant access Value_Holder'Class := Value_Holder'Class (Parent.all)'Access; begin VH.Set_Converter (Converter => C.all'Access); end; end Build_Components; -- ------------------------------ -- Validator Tag -- ------------------------------ -- ------------------------------ -- Create the Validator Tag -- ------------------------------ function Create_Validator_Tag_Node (Binding : in Binding_Access; Line : in Views.Line_Info; Parent : in Views.Nodes.Tag_Node_Access; Attributes : in Views.Nodes.Tag_Attribute_Array_Access) return Views.Nodes.Tag_Node_Access is use ASF.Views.Nodes; Node : constant Validator_Tag_Node_Access := new Validator_Tag_Node; Vid : constant Tag_Attribute_Access := Find_Attribute (Attributes, "validatorId"); begin Initialize (Node.all'Access, Binding, Line, Parent, Attributes); if Vid = null then Node.Error ("Missing 'validatorId' attribute"); else Node.Validator := EL.Objects.To_Object (Vid.Value); end if; return Node.all'Access; end Create_Validator_Tag_Node; -- ------------------------------ -- Get the specified validator and add it to the parent component. -- This operation does not create any new UIComponent. -- ------------------------------ overriding procedure Build_Components (Node : access Validator_Tag_Node; Parent : in UIComponent_Access; Context : in out Contexts.Facelets.Facelet_Context'Class) is use ASF.Components.Holders; use type ASF.Validators.Validator_Access; V : Validators.Validator_Access; Shared : Boolean; begin if not (Parent.all in Editable_Value_Holder'Class) then Node.Error ("Parent component is not an instance of Editable_Value_Holder"); return; end if; Validator_Tag_Node'Class (Node.all).Get_Validator (Context, V, Shared); if V = null then Node.Error ("Validator was not found"); return; end if; declare VH : constant access Editable_Value_Holder'Class := Editable_Value_Holder'Class (Parent.all)'Access; begin VH.Add_Validator (Validator => V, Shared => Shared); end; end Build_Components; -- ------------------------------ -- Get the validator instance that corresponds to the validator tag. -- Returns in <b>Validator</b> the instance if it exists and indicate -- in <b>Shared</b> whether it must be freed or not when the component is deleted. -- ------------------------------ procedure Get_Validator (Node : in Validator_Tag_Node; Context : in out Contexts.Facelets.Facelet_Context'Class; Validator : out Validators.Validator_Access; Shared : out Boolean) is begin Validator := Context.Get_Validator (Node.Validator); Shared := True; end Get_Validator; -- ------------------------------ -- Range Validator Tag -- ------------------------------ -- Create the Range_Validator Tag function Create_Range_Validator_Tag_Node (Binding : in Binding_Access; Line : in Views.Line_Info; Parent : in Views.Nodes.Tag_Node_Access; Attributes : in Nodes.Tag_Attribute_Array_Access) return Views.Nodes.Tag_Node_Access is use ASF.Views.Nodes; Node : constant Range_Validator_Tag_Node_Access := new Range_Validator_Tag_Node; begin Initialize (Node.all'Access, Binding, Line, Parent, Attributes); Node.Minimum := Find_Attribute (Attributes, "minimum"); Node.Maximum := Find_Attribute (Attributes, "maximum"); if Node.Minimum = null and Node.Maximum = null then Node.Error ("Missing 'minimum' or 'maximum' attribute"); end if; return Node.all'Access; end Create_Range_Validator_Tag_Node; -- Get the validator instance that corresponds to the range validator. -- Returns in <b>Validator</b> the validator instance if it exists and indicate -- in <b>Shared</b> whether it must be freed or not when the component is deleted. overriding procedure Get_Validator (Node : in Range_Validator_Tag_Node; Context : in out Contexts.Facelets.Facelet_Context'Class; Validator : out Validators.Validator_Access; Shared : out Boolean) is use type ASF.Validators.Validator_Access; Min : Long_Long_Integer := Long_Long_Integer'First; Max : Long_Long_Integer := Long_Long_Integer'Last; begin -- Get the minimum and maximum attributes. begin if Node.Minimum /= null then Min := EL.Objects.To_Long_Long_Integer (Get_Value (Node.Minimum.all, Context)); end if; if Node.Maximum /= null then Max := EL.Objects.To_Long_Long_Integer (Get_Value (Node.Maximum.all, Context)); end if; exception when Constraint_Error => Node.Error ("Invalid minimum or maximum value"); end; Shared := False; if Max < Min then Node.Error ("Minimum ({0}) should be less than maximum ({1})", Long_Long_Integer'Image (Min), Long_Long_Integer'Image (Max)); return; end if; Validator := Validators.Numbers.Create_Range_Validator (Minimum => Min, Maximum => Max); end Get_Validator; -- ------------------------------ -- Length Validator Tag -- ------------------------------ -- ------------------------------ -- Create the Length_Validator Tag. Verifies that the XML node defines -- the <b>minimum</b> or the <b>maximum</b> or both attributes. -- ------------------------------ function Create_Length_Validator_Tag_Node (Binding : in Binding_Access; Line : in Views.Line_Info; Parent : in Views.Nodes.Tag_Node_Access; Attributes : in Nodes.Tag_Attribute_Array_Access) return Views.Nodes.Tag_Node_Access is use ASF.Views.Nodes; Node : constant Length_Validator_Tag_Node_Access := new Length_Validator_Tag_Node; begin Initialize (Node.all'Access, Binding, Line, Parent, Attributes); Node.Minimum := Find_Attribute (Attributes, "minimum"); Node.Maximum := Find_Attribute (Attributes, "maximum"); if Node.Minimum = null and Node.Maximum = null then Node.Error ("Missing 'minimum' or 'maximum' attribute"); end if; return Node.all'Access; end Create_Length_Validator_Tag_Node; -- ------------------------------ -- Get the validator instance that corresponds to the validator tag. -- Returns in <b>Validator</b> the instance if it exists and indicate -- in <b>Shared</b> whether it must be freed or not when the component is deleted. -- ------------------------------ overriding procedure Get_Validator (Node : in Length_Validator_Tag_Node; Context : in out Contexts.Facelets.Facelet_Context'Class; Validator : out Validators.Validator_Access; Shared : out Boolean) is use type ASF.Validators.Validator_Access; Min : Natural := 0; Max : Natural := Natural'Last; begin -- Get the minimum and maximum attributes. begin if Node.Minimum /= null then Min := Natural (EL.Objects.To_Integer (Get_Value (Node.Minimum.all, Context))); end if; if Node.Maximum /= null then Max := Natural (EL.Objects.To_Integer (Get_Value (Node.Maximum.all, Context))); end if; exception when Constraint_Error => Node.Error ("Invalid minimum or maximum value"); end; Shared := False; if Max < Min then Node.Error ("Minimum ({0}) should be less than maximum ({1})", Natural'Image (Min), Natural'Image (Max)); return; end if; Validator := Validators.Texts.Create_Length_Validator (Minimum => Min, Maximum => Max); end Get_Validator; -- ------------------------------ -- Attribute Tag -- ------------------------------ -- ------------------------------ -- Create the Attribute Tag -- ------------------------------ function Create_Attribute_Tag_Node (Binding : in Binding_Access; Line : in Views.Line_Info; Parent : in Views.Nodes.Tag_Node_Access; Attributes : in Views.Nodes.Tag_Attribute_Array_Access) return Views.Nodes.Tag_Node_Access is use ASF.Views.Nodes; Attr : constant Tag_Attribute_Access := Find_Attribute (Attributes, "name"); Node : Attribute_Tag_Node_Access; begin Node := new Attribute_Tag_Node; Initialize (Node.all'Access, Binding, Line, Parent, Attributes); Node.Attr_Name := Attr; Node.Value := Find_Attribute (Attributes, "value"); if Node.Attr_Name = null then Node.Error ("Missing 'name' attribute"); else Node.Attr.Name := Attr.Value; end if; if Node.Value = null then Node.Error ("Missing 'value' attribute"); end if; return Node.all'Access; end Create_Attribute_Tag_Node; -- ------------------------------ -- Build the component tree from the tag node and attach it as -- the last child of the given parent. Calls recursively the -- method to create children. -- Adds the attribute to the component node. -- This operation does not create any new UIComponent. -- ------------------------------ overriding procedure Build_Components (Node : access Attribute_Tag_Node; Parent : in UIComponent_Access; Context : in out Contexts.Facelets.Facelet_Context'Class) is use EL.Expressions; begin if Node.Attr_Name /= null and Node.Value /= null then if Node.Value.Binding /= null then declare Expr : constant EL.Expressions.Expression := ASF.Views.Nodes.Reduce_Expression (Node.Value.all, Context); begin Parent.Set_Attribute (Def => Node.Attr'Access, Value => Expr); end; else Parent.Set_Attribute (Def => Node.Attr'Access, Value => Get_Value (Node.Value.all, Context)); end if; end if; end Build_Components; -- ------------------------------ -- Facet Tag -- ------------------------------ -- ------------------------------ -- Create the Facet Tag -- ------------------------------ function Create_Facet_Tag_Node (Binding : in Binding_Access; Line : in Views.Line_Info; Parent : in Views.Nodes.Tag_Node_Access; Attributes : in Views.Nodes.Tag_Attribute_Array_Access) return Views.Nodes.Tag_Node_Access is use ASF.Views.Nodes; Node : constant Facet_Tag_Node_Access := new Facet_Tag_Node; begin Initialize (Node.all'Access, Binding, Line, Parent, Attributes); Node.Facet_Name := Find_Attribute (Attributes, "name"); if Node.Facet_Name = null then Node.Error ("Missing 'name' attribute"); end if; return Node.all'Access; end Create_Facet_Tag_Node; -- ------------------------------ -- Build the component tree from the tag node and attach it as -- the facet component of the given parent. Calls recursively the -- method to create children. -- ------------------------------ overriding procedure Build_Components (Node : access Facet_Tag_Node; Parent : in UIComponent_Access; Context : in out Contexts.Facelets.Facelet_Context'Class) is Facet : constant UIComponent_Access := new UIComponent; Name : constant Util.Beans.Objects.Object := Get_Value (Node.Facet_Name.all, Context); begin Node.Build_Children (Facet, Context); Parent.Add_Facet (Util.Beans.Objects.To_String (Name), Facet.all'Access, Node); end Build_Components; -- ------------------------------ -- Metadata Tag -- ------------------------------ -- ------------------------------ -- Create the Metadata Tag -- ------------------------------ function Create_Metadata_Tag_Node (Binding : in Binding_Access; Line : in Views.Line_Info; Parent : in Views.Nodes.Tag_Node_Access; Attributes : in Views.Nodes.Tag_Attribute_Array_Access) return Views.Nodes.Tag_Node_Access is use ASF.Views.Nodes; Node : constant Metadata_Tag_Node_Access := new Metadata_Tag_Node; begin Initialize (Node.all'Access, Binding, Line, Parent, Attributes); return Node.all'Access; end Create_Metadata_Tag_Node; -- ------------------------------ -- Build the component tree from the tag node and attach it as a metadata information -- facet for the UIView parent component. -- ------------------------------ overriding procedure Build_Components (Node : access Metadata_Tag_Node; Parent : in UIComponent_Access; Context : in out Contexts.Facelets.Facelet_Context'Class) is use ASF.Components.Core.Views; begin if not (Parent.all in UIView'Class) then Node.Error ("Parent component of <f:metadata> must be a <f:view>"); return; end if; declare UI : constant UIViewMetaData_Access := new UIViewMetaData; begin UIView'Class (Parent.all).Set_Metadata (UI, Node); Build_Attributes (UI.all, Node.all, Context); UI.Initialize (UI.Get_Context.all); Node.Build_Children (UI.all'Access, Context); end; end Build_Components; end ASF.Views.Nodes.Jsf;
-- unique_c_resources.adb -- A convenience package to wrap a C type that requires initialization and -- finalization. -- Copyright (c) 2016, James Humphry -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -- PERFORMANCE OF THIS SOFTWARE. package body Unique_C_Resources is -------------- -- Unique_T -- -------------- function Make_Unique_T (X : in T) return Unique_T is (Unique_T'(Ada.Finalization.Limited_Controlled with Element => X)); function Element (U : Unique_T) return T is (U.Element); overriding procedure Initialize (Object : in out Unique_T) is begin Object.Element := Initialize; end Initialize; overriding procedure Finalize (Object : in out Unique_T) is begin Finalize(Object.Element); end Finalize; end Unique_C_Resources;
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- G N A T . E X P E C T . T T Y -- -- -- -- S p e c -- -- -- -- Copyright (C) 2000-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with GNAT.OS_Lib; use GNAT.OS_Lib; with System; use System; package body GNAT.Expect.TTY is On_Windows : constant Boolean := Directory_Separator = '\'; -- True when on Windows ----------- -- Close -- ----------- overriding procedure Close (Descriptor : in out TTY_Process_Descriptor; Status : out Integer) is procedure Terminate_Process (Process : System.Address); pragma Import (C, Terminate_Process, "__gnat_terminate_process"); function Waitpid (Process : System.Address) return Integer; pragma Import (C, Waitpid, "__gnat_tty_waitpid"); -- Wait for a specific process id, and return its exit code procedure Free_Process (Process : System.Address); pragma Import (C, Free_Process, "__gnat_free_process"); procedure Close_TTY (Process : System.Address); pragma Import (C, Close_TTY, "__gnat_close_tty"); begin -- If we haven't already closed the process if Descriptor.Process = System.Null_Address then Status := -1; else -- Send a Ctrl-C to the process first. This way, if the launched -- process is a "sh" or "cmd", the child processes will get -- terminated as well. Otherwise, terminating the main process -- brutally will leave the children running. -- Note: special characters are sent to the terminal to generate the -- signal, so this needs to be done while the file descriptors are -- still open (it used to be after the closes and that was wrong). Interrupt (Descriptor); delay (0.05); if Descriptor.Input_Fd /= Invalid_FD then Close (Descriptor.Input_Fd); end if; if Descriptor.Error_Fd /= Descriptor.Output_Fd and then Descriptor.Error_Fd /= Invalid_FD then Close (Descriptor.Error_Fd); end if; if Descriptor.Output_Fd /= Invalid_FD then Close (Descriptor.Output_Fd); end if; Terminate_Process (Descriptor.Process); Status := Waitpid (Descriptor.Process); if not On_Windows then Close_TTY (Descriptor.Process); end if; Free_Process (Descriptor.Process'Address); Descriptor.Process := System.Null_Address; GNAT.OS_Lib.Free (Descriptor.Buffer); Descriptor.Buffer_Size := 0; end if; end Close; overriding procedure Close (Descriptor : in out TTY_Process_Descriptor) is Status : Integer; begin Close (Descriptor, Status); end Close; ----------------------------- -- Close_Pseudo_Descriptor -- ----------------------------- procedure Close_Pseudo_Descriptor (Descriptor : in out TTY_Process_Descriptor) is begin Descriptor.Buffer_Size := 0; GNAT.OS_Lib.Free (Descriptor.Buffer); end Close_Pseudo_Descriptor; --------------- -- Interrupt -- --------------- overriding procedure Interrupt (Descriptor : in out TTY_Process_Descriptor) is procedure Internal (Process : System.Address); pragma Import (C, Internal, "__gnat_interrupt_process"); begin if Descriptor.Process /= System.Null_Address then Internal (Descriptor.Process); end if; end Interrupt; procedure Interrupt (Pid : Integer) is procedure Internal (Pid : Integer); pragma Import (C, Internal, "__gnat_interrupt_pid"); begin Internal (Pid); end Interrupt; ----------------------- -- Terminate_Process -- ----------------------- procedure Terminate_Process (Pid : Integer) is procedure Internal (Pid : Integer); pragma Import (C, Internal, "__gnat_terminate_pid"); begin Internal (Pid); end Terminate_Process; ----------------------- -- Pseudo_Descriptor -- ----------------------- procedure Pseudo_Descriptor (Descriptor : out TTY_Process_Descriptor'Class; TTY : GNAT.TTY.TTY_Handle; Buffer_Size : Natural := 4096) is begin Descriptor.Input_Fd := GNAT.TTY.TTY_Descriptor (TTY); Descriptor.Output_Fd := Descriptor.Input_Fd; -- Create the buffer Descriptor.Buffer_Size := Buffer_Size; if Buffer_Size /= 0 then Descriptor.Buffer := new String (1 .. Positive (Buffer_Size)); end if; end Pseudo_Descriptor; ---------- -- Send -- ---------- overriding procedure Send (Descriptor : in out TTY_Process_Descriptor; Str : String; Add_LF : Boolean := True; Empty_Buffer : Boolean := False) is Header : String (1 .. 5); Length : Natural; Ret : Natural; procedure Internal (Process : System.Address; S : in out String; Length : Natural; Ret : out Natural); pragma Import (C, Internal, "__gnat_send_header"); begin Length := Str'Length; if Add_LF then Length := Length + 1; end if; Internal (Descriptor.Process, Header, Length, Ret); if Ret = 1 then -- Need to use the header GNAT.Expect.Send (Process_Descriptor (Descriptor), Header & Str, Add_LF, Empty_Buffer); else GNAT.Expect.Send (Process_Descriptor (Descriptor), Str, Add_LF, Empty_Buffer); end if; end Send; -------------- -- Set_Size -- -------------- procedure Set_Size (Descriptor : in out TTY_Process_Descriptor'Class; Rows : Natural; Columns : Natural) is procedure Internal (Process : System.Address; R, C : Integer); pragma Import (C, Internal, "__gnat_setup_winsize"); begin if Descriptor.Process /= System.Null_Address then Internal (Descriptor.Process, Rows, Columns); end if; end Set_Size; --------------------------- -- Set_Up_Communications -- --------------------------- overriding procedure Set_Up_Communications (Pid : in out TTY_Process_Descriptor; Err_To_Out : Boolean; Pipe1 : access Pipe_Type; Pipe2 : access Pipe_Type; Pipe3 : access Pipe_Type) is pragma Unreferenced (Err_To_Out, Pipe1, Pipe2, Pipe3); function Internal (Process : System.Address) return Integer; pragma Import (C, Internal, "__gnat_setup_communication"); begin if Internal (Pid.Process'Address) /= 0 then raise Invalid_Process with "cannot setup communication."; end if; end Set_Up_Communications; --------------------------------- -- Set_Up_Child_Communications -- --------------------------------- overriding procedure Set_Up_Child_Communications (Pid : in out TTY_Process_Descriptor; Pipe1 : in out Pipe_Type; Pipe2 : in out Pipe_Type; Pipe3 : in out Pipe_Type; Cmd : String; Args : System.Address) is pragma Unreferenced (Pipe1, Pipe2, Pipe3, Cmd); function Internal (Process : System.Address; Argv : System.Address; Use_Pipes : Integer) return Process_Id; pragma Import (C, Internal, "__gnat_setup_child_communication"); begin Pid.Pid := Internal (Pid.Process, Args, Boolean'Pos (Pid.Use_Pipes)); end Set_Up_Child_Communications; ---------------------------------- -- Set_Up_Parent_Communications -- ---------------------------------- overriding procedure Set_Up_Parent_Communications (Pid : in out TTY_Process_Descriptor; Pipe1 : in out Pipe_Type; Pipe2 : in out Pipe_Type; Pipe3 : in out Pipe_Type) is pragma Unreferenced (Pipe1, Pipe2, Pipe3); procedure Internal (Process : System.Address; Inputfp : out File_Descriptor; Outputfp : out File_Descriptor; Errorfp : out File_Descriptor; Pid : out Process_Id); pragma Import (C, Internal, "__gnat_setup_parent_communication"); begin Internal (Pid.Process, Pid.Input_Fd, Pid.Output_Fd, Pid.Error_Fd, Pid.Pid); end Set_Up_Parent_Communications; ------------------- -- Set_Use_Pipes -- ------------------- procedure Set_Use_Pipes (Descriptor : in out TTY_Process_Descriptor; Use_Pipes : Boolean) is begin Descriptor.Use_Pipes := Use_Pipes; end Set_Use_Pipes; end GNAT.Expect.TTY;
-- part of OpenGLAda, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" with Ada.Directories; with Ada.Direct_IO; with Ada.Unchecked_Deallocation; with Interfaces.C.Strings; with GL.API; with GL.Types; package body GL.Files is use GL.Types; procedure Load_Shader_Source_From_File (Object : Objects.Shaders.Shader; File_Name : String) is procedure Free is new Ada.Unchecked_Deallocation (C.char_array, C.Strings.char_array_access); File_Size : constant Int := Int (Ada.Directories.Size (File_Name)); -- File string *without* null termination subtype File_String is C.char_array (1 .. C.size_t (File_Size)); package File_String_IO is new Ada.Direct_IO (File_String); File : File_String_IO.File_Type; Raw_Contents : C.Strings.char_array_access := new C.char_array (1 .. C.size_t (File_Size + 1)); begin File_String_IO.Open (File, Mode => File_String_IO.In_File, Name => File_Name); File_String_IO.Read (File, Item => Raw_Contents.all (1 .. C.size_t (File_Size))); File_String_IO.Close (File); Raw_Contents.all (C.size_t (File_Size + 1)) := C.nul; API.Shader_Source (Object.Raw_Id, 1, (1 => Raw_Contents (1)'Unchecked_Access), (1 => File_Size)); Free (Raw_Contents); Raise_Exception_On_OpenGL_Error; end Load_Shader_Source_From_File; end GL.Files;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Wide_Wide_Text_IO; with Matreshka.Internals.Unicode.Ucd; package body Matreshka.CLDR.AllKeys_Reader is function Parse_Code_Points (Image : Wide_Wide_String; Index : in out Positive) return Matreshka.CLDR.Collation_Data.Code_Point_Array_Access; function Parse_Collation_Elements (Image : Wide_Wide_String; Index : in out Positive) return Matreshka.CLDR.Collation_Data.Collation_Element_Array_Access; procedure Parse_Code_Point (Buffer : Wide_Wide_String; Index : in out Positive; Last : Natural; Value : out Matreshka.Internals.Unicode.Code_Point; Success : out Boolean); -- Parses single collation element. procedure Parse_Collation_Element (Buffer : Wide_Wide_String; Index : in out Positive; Last : Natural; Value : out Matreshka.CLDR.Collation_Data.Collation_Element; Success : out Boolean); -- Parses single collation element. procedure Parse_Collation_Weight (Buffer : Wide_Wide_String; Index : in out Positive; Last : Natural; Value : out Matreshka.Internals.Unicode.Ucd.Collation_Weight; Success : out Boolean); -- Parses hexadecimal collation weight value. procedure Skip_Spaces (Buffer : Wide_Wide_String; Index : in out Positive; Last : Natural); -- Skip spaces and comments. ----------------------- -- Load_AllKeys_File -- ----------------------- function Load_AllKeys_File (File_Name : League.Strings.Universal_String) return Matreshka.CLDR.Collation_Data.Collation_Information_Access is use type Matreshka.CLDR.Collation_Data.Collation_Record_Access; Result : Matreshka.CLDR.Collation_Data.Collation_Information_Access; File : Ada.Wide_Wide_Text_IO.File_Type; Buffer : Wide_Wide_String (1 .. 1024); Last : Natural; Current_Record : Matreshka.CLDR.Collation_Data.Collation_Record_Access; Aux_Record : Matreshka.CLDR.Collation_Data.Collation_Record_Access; Index : Positive; begin Result := new Matreshka.CLDR.Collation_Data.Collation_Information; Ada.Wide_Wide_Text_IO.Open (File, Ada.Wide_Wide_Text_IO.In_File, File_Name.To_UTF_8_String, "wcem=8"); while not Ada.Wide_Wide_Text_IO.End_Of_File (File) loop Index := Buffer'First; Ada.Wide_Wide_Text_IO.Get_Line (File, Buffer, Last); Skip_Spaces (Buffer, Index, Last); if Index > Last then -- Skip empty or comment line. null; elsif Buffer (Index) = '@' then -- Ignore @version line. null; else Current_Record := new Matreshka.CLDR.Collation_Data.Collation_Record; Current_Record.Contractors := Parse_Code_Points (Buffer (Index .. Last), Index); Index := Index + 1; Current_Record.Collations := Parse_Collation_Elements (Buffer (Index .. Last), Index); -- Link collation is sorting order. if Result.Lower_Record = null then Result.Lower_Record := Current_Record; Result.Greater_Record := Current_Record; else Current_Record.Less_Or_Equal := Result.Greater_Record; Result.Greater_Record.Greater_Or_Equal := Current_Record; Result.Greater_Record := Current_Record; end if; -- Link collation into the list of code point's collation. Aux_Record := Result.Collations (Current_Record.Contractors (1)); if Aux_Record = null then Result.Collations (Current_Record.Contractors (1)) := Current_Record; else while Aux_Record.Next /= null loop Aux_Record := Aux_Record.Next; end loop; Aux_Record.Next := Current_Record; end if; end if; end loop; Ada.Wide_Wide_Text_IO.Close (File); return Result; end Load_AllKeys_File; ---------------------- -- Parse_Code_Point -- ---------------------- procedure Parse_Code_Point (Buffer : Wide_Wide_String; Index : in out Positive; Last : Natural; Value : out Matreshka.Internals.Unicode.Code_Point; Success : out Boolean) is use type Matreshka.Internals.Unicode.Code_Point; begin Success := False; Value := 0; Skip_Spaces (Buffer, Index, Last); while Index <= Last loop case Buffer (Index) is when '0' .. '9' => Success := True; Value := Value * 16 + Wide_Wide_Character'Pos (Buffer (Index)) - Wide_Wide_Character'Pos ('0'); when 'A' .. 'F' => Success := True; Value := Value * 16 + Wide_Wide_Character'Pos (Buffer (Index)) - Wide_Wide_Character'Pos ('A') + 10; when 'a' .. 'f' => Success := True; Value := Value * 16 + Wide_Wide_Character'Pos (Buffer (Index)) - Wide_Wide_Character'Pos ('a') + 10; when others => exit; end case; Index := Index + 1; end loop; end Parse_Code_Point; ----------------------- -- Parse_Code_Points -- ----------------------- function Parse_Code_Points (Image : Wide_Wide_String; Index : in out Positive) return Matreshka.CLDR.Collation_Data.Code_Point_Array_Access is Result : Matreshka.CLDR.Collation_Data.Code_Point_Array (1 .. 3); Used : Natural := 0; Success : Boolean; begin loop Skip_Spaces (Image, Index, Image'Last); exit when Index > Image'Last; exit when Image (Index) = ';'; Parse_Code_Point (Image, Index, Image'Last, Result (Used + 1), Success); if not Success then raise Program_Error; end if; Used := Used + 1; end loop; return new Matreshka.CLDR.Collation_Data.Code_Point_Array' (Result (1 .. Used)); end Parse_Code_Points; ----------------------------- -- Parse_Collation_Element -- ----------------------------- procedure Parse_Collation_Element (Buffer : Wide_Wide_String; Index : in out Positive; Last : Natural; Value : out Matreshka.CLDR.Collation_Data.Collation_Element; Success : out Boolean) is begin Value := (False, 0, 0, 0, 0); Success := False; if Index > Last or else Buffer (Index) /= '[' then return; end if; Index := Index + 1; case Buffer (Index) is when '*' => Value.Is_Variable := True; when '.' => Value.Is_Variable := False; when others => return; end case; Index := Index + 1; Parse_Collation_Weight (Buffer, Index, Last, Value.Primary, Success); if not Success then return; end if; if Buffer (Index) /= '.' then Success := False; return; end if; Index := Index + 1; Parse_Collation_Weight (Buffer, Index, Last, Value.Secondary, Success); if not Success then return; end if; if Buffer (Index) /= '.' then Success := False; return; end if; Index := Index + 1; Parse_Collation_Weight (Buffer, Index, Last, Value.Trinary, Success); if not Success then return; end if; if Buffer (Index) /= '.' then Success := False; return; end if; Index := Index + 1; Parse_Code_Point (Buffer, Index, Last, Value.Code, Success); if not Success then return; end if; if Buffer (Index) /= ']' then Success := False; return; end if; Index := Index + 1; end Parse_Collation_Element; ------------------------------ -- Parse_Collation_Elements -- ------------------------------ function Parse_Collation_Elements (Image : Wide_Wide_String; Index : in out Positive) return Matreshka.CLDR.Collation_Data.Collation_Element_Array_Access is Result : Matreshka.CLDR.Collation_Data.Collation_Element_Array (1 .. 18); Used : Natural := 0; Success : Boolean; begin loop Skip_Spaces (Image, Index, Image'Last); exit when Index > Image'Last; Parse_Collation_Element (Image, Index, Image'Last, Result (Used + 1), Success); if not Success then raise Program_Error; end if; Used := Used + 1; end loop; return new Matreshka.CLDR.Collation_Data.Collation_Element_Array' (Result (1 .. Used)); end Parse_Collation_Elements; ---------------------------- -- Parse_Collation_Weight -- ---------------------------- procedure Parse_Collation_Weight (Buffer : Wide_Wide_String; Index : in out Positive; Last : Natural; Value : out Matreshka.Internals.Unicode.Ucd.Collation_Weight; Success : out Boolean) is use type Matreshka.Internals.Unicode.Ucd.Collation_Weight; begin Value := 0; Success := False; while Index <= Last loop case Buffer (Index) is when '0' .. '9' => Success := True; Value := Value * 16 + Wide_Wide_Character'Pos (Buffer (Index)) - Wide_Wide_Character'Pos ('0'); when 'A' .. 'F' => Success := True; Value := Value * 16 + Wide_Wide_Character'Pos (Buffer (Index)) - Wide_Wide_Character'Pos ('A') + 10; when 'a' .. 'f' => Success := True; Value := Value * 16 + Wide_Wide_Character'Pos (Buffer (Index)) - Wide_Wide_Character'Pos ('a') + 10; when others => exit; end case; Index := Index + 1; end loop; end Parse_Collation_Weight; ----------------- -- Skip_Spaces -- ----------------- procedure Skip_Spaces (Buffer : Wide_Wide_String; Index : in out Positive; Last : Natural) is begin while Index <= Last loop case Buffer (Index) is when ' ' => Index := Index + 1; when '#' | '%' => Index := Last + 1; return; when others => return; end case; end loop; end Skip_Spaces; end Matreshka.CLDR.AllKeys_Reader;
/* Author - Ashish Tyagi */ with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure Hello is Div_By_3 : Boolean := false; Div_By_5 : Boolean := false; begin For_Loop : for I in Integer range 1 .. 100 loop Div_By_3 := I mod 3 = 0; Div_By_5 := I mod 5 = 0; if Div_By_3 and Div_By_5 then Put_Line("FizzBuzz"); elsif Div_By_3 then Put_Line("Fizz"); elsif Div_By_5 then Put_Line("Buzz"); else Put( I ); New_Line(1); end if; end loop For_Loop; end Hello;
with Courbes; use Courbes; with Iterateur_Mots; use Iterateur_Mots; package Parser_Svg is use Liste_Courbes; Courbe_Abs : exception; Courbe_Illisible : exception; --parse un fichier svg et retourne une liste de points (voir documentation) -- lève Courbe_Abs si pas de courbe trouvée -- lève Courbe_Illisible si erreur de syntaxe procedure Charger_SVG(Nom_Fichier : String; L : out Liste); private Marqueur_Ligne : constant String := "d="""; Separateur : constant Character := ' '; Separateur_Coord : constant Character := ','; type Op_Code is ('m', 'l', 'h', 'v', 'c', 'q', 'M', 'L', 'H', 'V', 'C', 'Q'); subtype Op_Code_Relative is Op_Code range 'm' .. 'q'; subtype Op_Code_Absolute is Op_Code range 'M' .. 'Q'; -- Lit un opcode procedure Lire_OpCode ( Iterateur : in out Iterateur_Mot; Op : out Op_Code); -- Execute l'opcode procedure Gerer_OpCode ( Iterateur : in out Iterateur_Mot; Op : Op_Code; L : in out Liste); -- Valide le mot suivant comme opcode function Mot_Suivant_Est_Op_Code_Ou_Vide (Iterateur : Iterateur_Mot) return Boolean; -- Interprete le texte en tant qu'opcode -- True si success function Interpreter_Op_Code (Contenu : String; Op : in out Op_Code) return Boolean; end;
with Ada.Text_IO, Ada.Numerics.Generic_Elementary_Functions; procedure Benford is subtype Nonzero_Digit is Natural range 1 .. 9; function First_Digit(S: String) return Nonzero_Digit is (if S(S'First) in '1' .. '9' then Nonzero_Digit'Value(S(S'First .. S'First)) else First_Digit(S(S'First+1 .. S'Last))); package N_IO is new Ada.Text_IO.Integer_IO(Natural); procedure Print(D: Nonzero_Digit; Counted, Sum: Natural) is package Math is new Ada.Numerics.Generic_Elementary_Functions(Float); package F_IO is new Ada.Text_IO.Float_IO(Float); Actual: constant Float := Float(Counted) / Float(Sum); Expected: constant Float := Math.Log(1.0 + 1.0 / Float(D), Base => 10.0); Deviation: constant Float := abs(Expected-Actual); begin N_IO.Put(D, 5); N_IO.Put(Counted, 14); F_IO.Put(Float(Sum)*Expected, Fore => 16, Aft => 1, Exp => 0); F_IO.Put(100.0*Actual, Fore => 9, Aft => 2, Exp => 0); F_IO.Put(100.0*Expected, Fore => 11, Aft => 2, Exp => 0); F_IO.Put(100.0*Deviation, Fore => 13, Aft => 2, Exp => 0); end Print; Cnt: array(Nonzero_Digit) of Natural := (1 .. 9 => 0); D: Nonzero_Digit; Sum: Natural := 0; Counter: Positive; begin while not Ada.Text_IO.End_Of_File loop -- each line in the input file holds Counter, followed by Fib(Counter) N_IO.Get(Counter); -- Counter and skip it, we just don't need it D := First_Digit(Ada.Text_IO.Get_Line); -- read the rest of the line and extract the first digit Cnt(D) := Cnt(D)+1; Sum := Sum + 1; end loop; Ada.Text_IO.Put_Line(" Digit Found[total] Expected[total] Found[%]" & " Expected[%] Difference[%]"); for I in Nonzero_Digit loop Print(I, Cnt(I), Sum); Ada.Text_IO.New_Line; end loop; end Benford;
-- This file is generated by SWIG. Please do *not* modify by hand. -- with Interfaces.C; with Swig; with Interfaces.C; package osmesa_c is -- GLenum -- subtype GLenum is Interfaces.C.unsigned; type GLenum_array is array (Interfaces.C.size_t range <>) of aliased osmesa_c.GLenum; -- GLint -- subtype GLint is Interfaces.C.int; type GLint_array is array (Interfaces.C.size_t range <>) of aliased osmesa_c.GLint; -- GLsizei -- subtype GLsizei is Interfaces.C.int; type GLsizei_array is array (Interfaces.C.size_t range <>) of aliased osmesa_c.GLsizei; -- GLboolean -- subtype GLboolean is Interfaces.C.unsigned_char; type GLboolean_array is array (Interfaces.C.size_t range <>) of aliased osmesa_c.GLboolean; -- OSMesaContext -- subtype OSMesaContext is Swig.opaque_structure; type OSMesaContext_array is array (Interfaces.C.size_t range <>) of aliased osmesa_c.OSMesaContext; -- OSMESAproc -- type OSMESAproc is access procedure; pragma Convention (C, OSMESAproc); -- OSMESAprocs -- type OSMESAprocs is array (Interfaces.C.size_t range <>) of aliased osmesa_c.OSMESAproc; OSMESA_MAJOR_VERSION : constant := 11; OSMESA_MINOR_VERSION : constant := 2; OSMESA_PATCH_VERSION : constant := 0; OSMESA_BGRA : constant := 16#1#; OSMESA_ARGB : constant := 16#2#; OSMESA_BGR : constant := 16#4#; OSMESA_RGB_565 : constant := 16#5#; OSMESA_ROW_LENGTH : constant := 16#10#; OSMESA_Y_UP : constant := 16#11#; OSMESA_WIDTH : constant := 16#20#; OSMESA_HEIGHT : constant := 16#21#; OSMESA_FORMAT : constant := 16#22#; OSMESA_TYPE : constant := 16#23#; OSMESA_MAX_WIDTH : constant := 16#24#; OSMESA_MAX_HEIGHT : constant := 16#25#; OSMESA_DEPTH_BITS : constant := 16#30#; OSMESA_STENCIL_BITS : constant := 16#31#; OSMESA_ACCUM_BITS : constant := 16#32#; OSMESA_PROFILE : constant := 16#33#; OSMESA_CORE_PROFILE : constant := 16#34#; OSMESA_COMPAT_PROFILE : constant := 16#35#; OSMESA_CONTEXT_MAJOR_VERSION : constant := 16#36#; OSMESA_CONTEXT_MINOR_VERSION : constant := 16#37#; end osmesa_c;
with impact.d2.World, impact.d2.Broadphase, ada.unchecked_Deallocation; package body impact.d2.Solid is use type int32, uint16; procedure SetType (Self : in out b2Body; Kind : in b2BodyType) is ce : access contact.b2ContactEdge; begin if Self.m_type = Kind then return; end if; Self.m_type := Kind; Self.ResetMassData; if Self.m_type = b2_staticBody then Self.m_linearVelocity := (0.0, 0.0); Self.m_angularVelocity := 0.0; end if; Self.SetAwake (True); Self.m_force := (0.0, 0.0); Self.m_torque := 0.0; -- Since the body type changed, we need to flag contacts for filtering. -- ce := Self.m_contactList; while ce /= null loop ce.contact.FlagForFiltering; ce := ce.next; end loop; end SetType; function GetType (Self : in b2Body) return b2BodyType is begin return Self.m_type; end GetType; function GetContactList (Self : in b2Body) return access contact.b2ContactEdge is begin return Self.m_contactList; end GetContactList; function GetTransform (Self : in b2Body) return b2Transform is begin return Self.m_xf; end GetTransform; function GetWorldPoint (Self : in b2Body; localPoint : in b2Vec2) return b2Vec2 is begin return b2Mul (Self.m_xf, localPoint); end GetWorldPoint; function GetWorldVector (Self : in b2Body; localVector : in b2Vec2) return b2Vec2 is begin return b2Mul (Self.m_xf.R, localVector); end GetWorldVector; function GetMass (Self : in b2Body) return float32 is begin return self.m_mass; end GetMass; procedure ResetMassData (Self : in out b2Body) is center, oldCenter : b2Vec2; massData : aliased shape.b2MassData; f : access Fixture.b2Fixture; begin -- Compute mass data from shapes. Each shape has its own density. Self.m_mass := 0.0; Self.m_invMass := 0.0; Self.m_I := 0.0; Self.m_invI := 0.0; Self.m_sweep.localCenter := (0.0, 0.0); -- Static and kinematic bodies have zero mass. if Self.m_type = b2_staticBody or else Self.m_type = b2_kinematicBody then Self.m_sweep.c0 := Self.m_xf.position; Self.m_sweep.c := Self.m_xf.position; return; end if; pragma Assert (Self.m_type = b2_dynamicBody); -- Accumulate mass over all fixtures. center := b2Vec2_zero; f := Self.m_fixtureList; while f /= null loop if f.getDensity /= 0.0 then f.GetMassData (massData'Access); Self.m_mass := Self.m_mass + massData.mass; center := center + massData.mass * massData.center; Self.m_I := Self.m_I + massData.I; end if; f := f.getNext; end loop; -- Compute center of mass. if Self.m_mass > 0.0 then Self.m_invMass := 1.0 / Self.m_mass; center := center * Self.m_invMass; else -- Force all dynamic bodies to have a positive mass. Self.m_mass := 1.0; Self.m_invMass := 1.0; end if; if Self.m_I > 0.0 and then (Self.m_flags and e_fixedRotationFlag) = 0 then -- Center the inertia about the center of mass. Self.m_I := Self.m_I - Self.m_mass * b2Dot (center, center); pragma Assert (Self.m_I > 0.0); Self.m_invI := 1.0 / Self.m_I; else Self.m_I := 0.0; Self.m_invI := 0.0; end if; -- Move center of mass. oldCenter := Self.m_sweep.c; Self.m_sweep.localCenter := center; Self.m_sweep.c0 := b2Mul (Self.m_xf, Self.m_sweep.localCenter); Self.m_sweep.c := Self.m_sweep.c0; -- Update center of mass velocity. Self.m_linearVelocity := Self.m_linearVelocity + b2Cross (Self.m_angularVelocity, Self.m_sweep.c - oldCenter); end ResetMassData; function GetLinearVelocity (Self : in b2Body) return b2Vec2 is begin return self.m_linearVelocity; end GetLinearVelocity; function GetAngularVelocity (Self : in b2Body) return float32 is begin return self.m_angularVelocity; end GetAngularVelocity; procedure SetSleepingAllowed (Self : in out b2Body; flag : in Boolean) is begin if flag then Self.m_flags := Self.m_flags or e_autoSleepFlag; else Self.m_flags := Self.m_flags and not e_autoSleepFlag; Self.SetAwake (True); end if; end SetSleepingAllowed; function IsSleepingAllowed (Self : in b2Body) return Boolean is begin return (Self.m_flags and e_autoSleepFlag) = e_autoSleepFlag; end IsSleepingAllowed; procedure SetAwake (Self : in out b2Body; flag : in Boolean) is begin if flag then if (Self.m_flags and e_awakeFlag) = 0 then Self.m_flags := Self.m_flags or e_awakeFlag; Self.m_sleepTime := 0.0; end if; else Self.m_flags := Self.m_flags and not e_awakeFlag; Self.m_sleepTime := 0.0; Self.m_linearVelocity := (0.0, 0.0); --.SetZero(); Self.m_angularVelocity := 0.0; Self.m_force := (0.0, 0.0); --.SetZero(); Self.m_torque := 0.0; end if; end SetAwake; function IsAwake (Self : in b2Body) return Boolean is begin return (Self.m_flags and e_awakeFlag) = e_awakeFlag; end IsAwake; function GetPosition (Self : in b2Body) return b2Vec2 is begin return Self.m_xf.position; end GetPosition; function GetAngle (Self : in b2Body) return float32 is begin return Self.m_sweep.a; end GetAngle; function GetWorldCenter (Self : in b2Body) return b2Vec2 is begin return Self.m_sweep.c; end GetWorldCenter; function GetLocalCenter (Self : in b2Body) return b2Vec2 is begin return Self.m_sweep.localCenter; end GetLocalCenter; procedure SetLinearVelocity (Self : in out b2Body; v : in b2Vec2) is begin if Self.m_type = b2_staticBody then return; end if; if b2Dot (v, v) > 0.0 then Self.SetAwake (True); end if; Self.m_linearVelocity := v; end SetLinearVelocity; procedure SetAngularVelocity (Self : in out b2Body; omega : in float32) is begin if Self.m_type = b2_staticBody then return; end if; if omega * omega > 0.0 then Self.SetAwake (True); end if; Self.m_angularVelocity := omega; end SetAngularVelocity; procedure ApplyForce (Self : in out b2Body; force : in b2Vec2; point : in b2Vec2) is begin if Self.m_type /= b2_dynamicBody then return; end if; if not Self.IsAwake then Self.SetAwake (True); end if; Self.m_force := Self.m_force + force; Self.m_torque := Self.m_torque + b2Cross (point - Self.m_sweep.c, force); end ApplyForce; procedure ApplyTorque (Self : in out b2Body; torque : in float32) is begin if Self.m_type /= b2_dynamicBody then return; end if; if not Self.IsAwake then Self.SetAwake (True); end if; Self.m_torque := Self.m_torque + torque; end ApplyTorque; procedure ApplyLinearImpulse (Self : in out b2Body; impulse : in b2Vec2; point : in b2Vec2) is begin if Self.m_type /= b2_dynamicBody then return; end if; if not Self.IsAwake then Self.SetAwake (True); end if; Self.m_linearVelocity := Self.m_linearVelocity + Self.m_invMass * impulse; Self.m_angularVelocity := Self.m_angularVelocity + Self.m_invI * b2Cross (point - Self.m_sweep.c, impulse); end ApplyLinearImpulse; procedure ApplyAngularImpulse (Self : in out b2Body; impulse : in float32) is begin if Self.m_type /= b2_dynamicBody then return; end if; if not Self.IsAwake then Self.SetAwake (True); end if; Self.m_angularVelocity := Self.m_angularVelocity + Self.m_invI * impulse; end ApplyAngularImpulse; function GetInertia (Self : in b2Body) return float32 is begin return Self.m_I + Self.m_mass * b2Dot (Self.m_sweep.localCenter, Self.m_sweep.localCenter); end GetInertia; procedure GetMassData (Self : in b2Body; data : access shape.b2MassData) is begin data.mass := Self.m_mass; data.I := Self.m_I + Self.m_mass * b2Dot (Self.m_sweep.localCenter, Self.m_sweep.localCenter); data.center := Self.m_sweep.localCenter; end GetMassData; function GetLocalPoint (Self : in b2Body; worldPoint : in b2Vec2) return b2Vec2 is begin return b2MulT (Self.m_xf, worldPoint); end GetLocalPoint; function GetLocalVector (Self : in b2Body; worldVector : in b2Vec2) return b2Vec2 is begin return b2MulT (Self.m_xf.R, worldVector); end GetLocalVector; function GetLinearVelocityFromWorldPoint (Self : in b2Body; worldPoint : in b2Vec2) return b2Vec2 is begin return Self.m_linearVelocity + b2Cross (Self.m_angularVelocity, worldPoint - Self.m_sweep.c); end GetLinearVelocityFromWorldPoint; function GetLinearVelocityFromLocalPoint (Self : in b2Body; localPoint : in b2Vec2) return b2Vec2 is begin return Self.GetLinearVelocityFromWorldPoint (Self.GetWorldPoint (localPoint)); end GetLinearVelocityFromLocalPoint; function GetLinearDamping (Self : in b2Body) return float32 is begin return Self.m_linearDamping; end GetLinearDamping; procedure SetLinearDamping (Self : in out b2Body; linearDamping : in float32) is begin Self.m_linearDamping := linearDamping; end SetLinearDamping; function GetAngularDamping (Self : in b2Body) return float32 is begin return Self.m_angularDamping; end GetAngularDamping; procedure SetAngularDamping (Self : in out b2Body; angularDamping : in float32) is begin Self.m_angularDamping := angularDamping; end SetAngularDamping; procedure SetBullet (Self : in out b2Body; flag : in Boolean) is begin if flag then Self.m_flags := Self.m_flags or e_bulletFlag; else Self.m_flags := Self.m_flags and not e_bulletFlag; end if; end SetBullet; function IsBullet (Self : in b2Body) return Boolean is begin return (Self.m_flags and e_bulletFlag) = e_bulletFlag; end IsBullet; function IsActive (Self : in b2Body) return Boolean is begin return (Self.m_flags and e_activeFlag) = e_activeFlag; end IsActive; procedure SetFixedRotation (Self : in out b2Body; flag : in Boolean) is begin if flag then Self.m_flags := Self.m_flags or e_fixedRotationFlag; else Self.m_flags := Self.m_flags and not e_fixedRotationFlag; end if; Self.ResetMassData; end SetFixedRotation; function IsFixedRotation (Self : in b2Body) return Boolean is begin return (Self.m_flags and e_fixedRotationFlag) = e_fixedRotationFlag; end IsFixedRotation; function GetFixtureList (Self : in b2Body) return access Fixture.b2Fixture is begin return Self.m_fixtureList; end GetFixtureList; function GetJointList (Self : in b2Body) return access joint.b2JointEdge is begin return Self.m_jointList; end GetJointList; function GetNext (Self : in b2Body) return access b2Body'Class is begin return Self.m_next; end GetNext; function GetUserData (Self : in b2Body) return access Any'Class is begin return Self.m_userData; end GetUserData; procedure SetUserData (Self : in out b2Body; data : access Any'Class) is begin Self.m_userData := data; end SetUserData; function GetWorld (Self : in b2Body) return access constant world.b2World'Class is begin return Self.m_world; end GetWorld; procedure Advance (Self : in out b2Body; t : in float32) is begin -- Advance to the new safe time. Advance (Self.m_sweep, t); Self.m_sweep.c := Self.m_sweep.c0; Self.m_sweep.a := Self.m_sweep.a0; Self.SynchronizeTransform; end Advance; package body Forge is function to_b2Body (bd : in b2BodyDef; world : access impact.d2.world.b2World'Class) return b2Body is Self : b2Body; begin pragma Assert (IsValid (bd.position)); pragma Assert (IsValid (bd.linearVelocity)); pragma Assert (b2IsValid (bd.angle)); pragma Assert (b2IsValid (bd.angularVelocity)); pragma Assert (b2IsValid (bd.inertiaScale) and then bd.inertiaScale >= 0.0); pragma Assert (b2IsValid (bd.angularDamping) and then bd.angularDamping >= 0.0); pragma Assert (b2IsValid (bd.linearDamping) and then bd.linearDamping >= 0.0); Self.m_flags := 0; if bd.bullet then Self.m_flags := Self.m_flags or e_bulletFlag; end if; if bd.fixedRotation then Self.m_flags := Self.m_flags or e_fixedRotationFlag; end if; if bd.allowSleep then Self.m_flags := Self.m_flags or e_autoSleepFlag; end if; if bd.awake then Self.m_flags := Self.m_flags or e_awakeFlag; end if; if bd.active then Self.m_flags := Self.m_flags or e_activeFlag; end if; Self.m_world := world; Self.m_xf.position := bd.position; Set (Self.m_xf.R, bd.angle); Self.m_sweep.localCenter := (0.0, 0.0); Self.m_sweep.a0 := bd.angle; Self.m_sweep.a := bd.angle; Self.m_sweep.c0 := b2Mul (Self.m_xf, Self.m_sweep.localCenter); Self.m_sweep.c := Self.m_sweep.c0; Self.m_jointList := null; Self.m_contactList := null; Self.m_prev := null; Self.m_next := null; Self.m_linearVelocity := bd.linearVelocity; Self.m_angularVelocity := bd.angularVelocity; Self.m_linearDamping := bd.linearDamping; Self.m_angularDamping := bd.angularDamping; Self.m_force := (0.0, 0.0); Self.m_torque := 0.0; Self.m_sleepTime := 0.0; Self.m_type := bd.kind; if Self.m_type = b2_dynamicBody then Self.m_mass := 1.0; Self.m_invMass := 1.0; else Self.m_mass := 0.0; Self.m_invMass := 0.0; end if; Self.m_I := 0.0; Self.m_invI := 0.0; Self.m_userData := bd.userData; Self.m_fixtureList := null; Self.m_fixtureCount := 0; return Self; end to_b2Body; end Forge; function CreateFixture (Self : access b2Body; def : in fixture.b2FixtureDef) return Fixture.view is use type uint32; fixture : impact.d2.Fixture.view; begin pragma Assert (not Self.m_world.IsLocked); if Self.m_world.IsLocked then return null; end if; -- b2BlockAllocator* allocator = &m_world.m_blockAllocator; -- void* memory = allocator.Allocate(sizeof(b2Fixture)); fixture := new impact.d2.Fixture.b2Fixture; fixture.Create (Self, def); if (Self.m_flags and e_activeFlag) /= 0 then -- b2BroadPhase* broadPhase = &m_world.m_contactManager.m_broadPhase; fixture.CreateProxy (Self.m_world.m_contactManager.all.m_broadPhase'Access, Self.m_xf); end if; fixture.m_next_is (Self.m_fixtureList); Self.m_fixtureList := fixture; Self.m_fixtureCount := Self.m_fixtureCount + 1; fixture.m_body_is (Self.all'Unchecked_Access); -- Adjust mass properties if needed. if fixture.getDensity > 0.0 then Self.ResetMassData; end if; -- Let the world know we have a new fixture. This will cause new contacts -- to be created at the beginning of the next time step. Self.m_world.m_flags.all := Self.m_world.m_flags.all or World.e_newFixture; return fixture; end CreateFixture; function CreateFixture (Self : access b2Body; shape : in impact.d2.Shape.View; density : in float32 ) return Fixture.view is def : aliased fixture.b2FixtureDef; begin def.shape := shape; def.density := density; return Self.CreateFixture (def); end CreateFixture; procedure DestroyFixture (Self : access b2Body; fixture : in out impact.d2.Fixture.view) is procedure free is new ada.Unchecked_Deallocation (impact.d2.Fixture.b2Fixture'Class, impact.d2.Fixture.view); begin pragma Assert (not Self.m_world.IsLocked); if Self.m_world.IsLocked then return; end if; pragma Assert (fixture.getBody = Self); -- Remove the fixture from this body's singly linked list. pragma Assert (Self.m_fixtureCount > 0); declare use type impact.d2.Fixture.view; node : impact.d2.Fixture.View := Self.m_fixtureList; -- b2Fixture** node = &Self.m_fixtureList; found : Boolean := False; begin while node /= null loop if node = fixture then node := fixture.getNext.all'Access; found := True; exit; end if; node := node.getNext.all'Access; end loop; -- You tried to remove a shape that is not attached to this body. pragma Assert (found); end; -- Destroy any contacts associated with the fixture. declare use type impact.d2.Fixture.view; edge : access contact.b2ContactEdge := Self.m_contactList; c : Contact.view; begin while edge /= null loop c := edge.contact.all'Access; edge := edge.next; if fixture = c.GetFixtureA or else fixture = c.GetFixtureB then -- This destroys the contact and removes it from -- this body's contact list. Self.m_world.m_contactManager.Destroy (c); end if; end loop; end; -- b2BlockAllocator* allocator = &m_world.m_blockAllocator; if (Self.m_flags and e_activeFlag) /= 0 then pragma Assert (fixture.m_proxyId /= BroadPhase.e_nullProxy); -- b2BroadPhase* broadPhase = &Self.m_world.m_contactManager.m_broadPhase; fixture.DestroyProxy (Self.m_world.m_contactManager.m_broadPhase'Access); else null; -- pragma assert (fixture.m_proxyId = BroadPhase.e_nullProxy); end if; fixture.Destroy; --(allocator); fixture.m_body_is (null); fixture.m_next_is (null); fixture.destruct; -- allocator.Free(fixture, sizeof(b2Fixture)); free (fixture); Self.m_fixtureCount := Self.m_fixtureCount - 1; -- Reset the mass data. Self.ResetMassData; end DestroyFixture; procedure SetMassData (Self : in out b2Body; data : in shape.b2MassData) is oldCenter : b2Vec2; begin pragma Assert (Self.m_world.IsLocked = False); if Self.m_world.IsLocked then return; end if; if Self.m_type /= b2_dynamicBody then return; end if; Self.m_invMass := 0.0; Self.m_I := 0.0; Self.m_invI := 0.0; Self.m_mass := data.mass; if Self.m_mass <= 0.0 then Self.m_mass := 1.0; end if; Self.m_invMass := 1.0 / Self.m_mass; if data.I > 0.0 and then (Self.m_flags and Solid.e_fixedRotationFlag) = 0 then Self.m_I := Data.I - Self.m_mass * b2Dot (Data.center, Data.center); pragma Assert (Self.m_I > 0.0); Self.m_invI := 1.0 / Self.m_I; end if; -- Move center of mass. oldCenter := Self.m_sweep.c; Self.m_sweep.localCenter := Data.center; Self.m_sweep.c0 := b2Mul (Self.m_xf, Self.m_sweep.localCenter); Self.m_sweep.c := Self.m_sweep.c0; -- Update center of mass velocity. Self.m_linearVelocity := Self.m_linearVelocity + b2Cross (Self.m_angularVelocity, Self.m_sweep.c - oldCenter); end SetMassData; procedure SetTransform (Self : in out b2Body; position : in b2Vec2; angle : in float32) is use type Fixture.view; broadPhase : access impact.d2.Broadphase.b2BroadPhase; f : Fixture.view; begin pragma Assert (not Self.m_world.IsLocked); if Self.m_world.IsLocked then return; end if; Set (Self.m_xf.R, angle); Self.m_xf.position := position; Self.m_sweep.c0 := b2Mul (Self.m_xf, Self.m_sweep.localCenter); Self.m_sweep.c := Self.m_sweep.c0; Self.m_sweep.a0 := angle; Self.m_sweep.a := Self.m_sweep.a0; broadPhase := Self.m_world.m_contactManager.m_broadPhase'Access; f := Self.m_fixtureList; while f /= null loop f.Synchronize (broadPhase, Self.m_xf, Self.m_xf); f := Fixture.view (f.getNext); end loop; Self.m_world.m_contactManager.FindNewContacts; end SetTransform; procedure SynchronizeFixtures (Self : in out b2Body) is use type Fixture.view; broadPhase : access impact.d2.Broadphase.b2BroadPhase; f : Fixture.view; xf1 : b2Transform; begin Set (xf1.R, Self.m_sweep.a0); xf1.position := Self.m_sweep.c0 - b2Mul (xf1.R, Self.m_sweep.localCenter); broadPhase := Self.m_world.m_contactManager.m_broadPhase'Access; f := Self.m_fixtureList; while f /= null loop f.Synchronize (broadPhase, xf1, Self.m_xf); f := Fixture.view (f.getNext); end loop; end SynchronizeFixtures; procedure SetActive (Self : in out b2Body; flag : in Boolean) is use type Fixture.view; broadPhase : access impact.d2.Broadphase.b2BroadPhase; f : Fixture.view; ce, ce0 : access contact.b2ContactEdge; begin if flag = Self.IsActive then return; end if; if flag then Self.m_flags := Self.m_flags or e_activeFlag; -- Create all proxies. broadPhase := Self.m_world.m_contactManager.m_broadPhase'Access; f := Self.m_fixtureList; while f /= null loop f.CreateProxy (broadPhase, Self.m_xf); f := Fixture.view (f.getNext); end loop; -- Contacts are created the next time step. else Self.m_flags := Self.m_flags and not e_activeFlag; -- Destroy all proxies. broadPhase := Self.m_world.m_contactManager.m_broadPhase'Access; f := Self.m_fixtureList; while f /= null loop f.DestroyProxy (broadPhase); f := Fixture.view (f.getNext); end loop; -- Destroy the attached contacts. ce := Self.m_contactList; while ce /= null loop ce0 := ce; ce := ce.next; Self.m_world.m_contactManager.Destroy (Contact.view (ce0.contact)); end loop; Self.m_contactList := null; end if; end SetActive; procedure SynchronizeTransform (Self : in out b2Body) is begin Set (Self.m_xf.R, Self.m_sweep.a); Self.m_xf.position := Self.m_sweep.c - b2Mul (Self.m_xf.R, Self.m_sweep.localCenter); end SynchronizeTransform; --- 'protected' subprograms used by C 'friends'. -- function m_angularVelocity (Self : access b2Body'Class) return access float32 is begin return Self.m_angularVelocity'Unchecked_Access; end m_angularVelocity; function m_linearVelocity (Self : access b2Body'Class) return access b2Vec2 is begin return Self.m_linearVelocity'Unchecked_Access; end m_linearVelocity; function m_force (Self : access b2Body'Class) return access b2Vec2 is begin return Self.m_force'Access; end m_force; function m_torque (Self : access b2Body'Class) return access float32 is begin return Self.m_torque'Access; end m_torque; procedure m_flags_are (Self : in out b2Body'Class; Now : in uint16) is begin Self.m_flags := Now; end m_flags_are; function m_flags (Self : in b2Body'Class) return uint16 is begin return Self.m_flags; end m_flags; function m_sleepTime (Self : access b2Body'Class) return access float32 is begin return Self.m_sleepTime'Access; end m_sleepTime; function m_linearDamping (Self : access b2Body'Class) return access float32 is begin return Self.m_linearDamping'Access; end m_linearDamping; function m_angularDamping (Self : access b2Body'Class) return access float32 is begin return Self.m_angularDamping'Access; end m_angularDamping; function m_invMass (Self : access b2Body'Class) return access float32 is begin return Self.m_invMass'Unchecked_Access; end m_invMass; function m_invI (Self : access b2Body'Class) return access float32 is begin return Self.m_invI'Unchecked_Access; end m_invI; function m_sweep (Self : access b2Body'Class) return access b2Sweep is begin return Self.m_sweep'Unchecked_Access; end m_sweep; procedure m_contactList_is (Self : in out b2Body'Class; Now : access contact.b2ContactEdge) is begin Self.m_contactList := Now; end m_contactList_is; function m_contactList (Self : access b2Body'Class) return access contact.b2ContactEdge is begin return Self.m_contactList; end m_contactList; function m_islandIndex (Self : in b2Body'Class) return int32 is begin return Self.m_islandIndex; end m_islandIndex; procedure m_islandIndex_is (Self : in out b2Body'Class; Now : in int32) is begin Self.m_islandIndex := Now; end m_islandIndex_is; procedure m_world_is (Self : in out b2Body'Class; Now : access world.b2World'Class) is begin Self.m_world := Now; end m_world_is; procedure m_next_is (Self : in out b2Body'Class; Now : access b2Body'Class) is begin Self.m_next := Now; end m_next_is; procedure m_prev_is (Self : in out b2Body'Class; Now : access b2Body'Class) is begin Self.m_prev := Now; end m_prev_is; function m_prev (Self : access b2Body'Class) return access b2Body'Class is begin return Self.m_prev; end m_prev; procedure m_jointList_is (Self : in out b2Body'Class; Now : access joint.b2JointEdge) is begin Self.m_jointList := Now; end m_jointList_is; procedure m_fixtureList_is (Self : in out b2Body'Class; Now : in Fixture.view) is begin Self.m_fixtureList := Now; end m_fixtureList_is; procedure m_fixtureCount_is (Self : in out b2Body'Class; Now : in int32) is begin Self.m_fixtureCount := Now; end m_fixtureCount_is; function ShouldCollide (Self : in b2Body; other : access constant b2Body'Class) return Boolean is use type impact.d2.Joint.Solid_view; jn : access joint.b2JointEdge; begin -- At least one body should be dynamic. if Self.m_type /= b2_dynamicBody and then other.m_type /= b2_dynamicBody then return False; end if; -- Does a joint prevent collision? jn := Self.m_jointList; while jn /= null loop if impact.d2.Joint.Solid_view (jn.other) = other then if not jn.joint.m_collideConnected then return False; end if; end if; jn := jn.next; end loop; return True; end ShouldCollide; end impact.d2.Solid;
-- { dg-do compile } procedure Pack5 is type Kind is (v1, v2, v3); type Error (k : Kind := Kind'First) is record case k is when v1 => null; when v2 => null; when Others => B : Boolean; end case; end record; pragma Pack (Error); for Error'Size use 16; No_Error: constant Error := (k => v2); type R (B : Boolean) is record E : Error; end record; pragma Pack(R); type Ptr is access R; C : Ptr := new R (True); begin C.E := No_Error; end;
with Ada.Text_IO; use Ada.Text_IO; procedure main is begin Put_Line("Hello world"); end main;
package Private1 is type T is private; private type T is new Boolean; end Private1;
with Ada.Integer_Text_IO; procedure Day_04 is subtype Cand is Integer range 284639 .. 748759; function Is_Valid(C: Cand) return Boolean is Image: String(1..8) := (others => ' '); subtype Image_Middle is String(1..4); function Has_Double(S: Image_Middle) return Boolean is (S(1) /= S(2) and S(2) = S(3) and S(3) /= S(4)); Non_Descending, Any_Has_Double: Boolean; begin Ada.Integer_Text_IO.Put(To => Image(2..7), Item => C); Any_Has_Double := (for some I in 1 .. 5 => Has_Double(Image(I .. I + 3))); Non_Descending := (for all I in 2 .. 6 => Image(I) <= Image(I + 1)); return Non_Descending and Any_Has_Double; end Is_Valid; Count: Natural := 0; begin for C in Cand'Range loop if Is_Valid(C) then Count := Count + 1; end if; end loop; Ada.Integer_Text_IO.Put(Count); end Day_04;
-- { dg-do run } procedure Pack19 is subtype Always_False is Boolean range False .. False; type Rec1 is record B1 : Boolean; B2 : Boolean; B3 : Boolean; B4 : Boolean; B5 : Boolean; B6 : Boolean; B7 : Always_False; B8 : Boolean; end record; pragma Pack (Rec1); subtype Always_True is Boolean range True .. True; type Rec2 is record B1 : Boolean; B2 : Boolean; B3 : Boolean; B4 : Boolean; B5 : Boolean; B6 : Boolean; B7 : Always_True; B8 : Boolean; end record; pragma Pack (Rec2); R1 : Rec1 := (True, True, True, True, True, True, False, False); R2 : Rec2 := (False, False, False, False, False, False, True, True); begin R1.B8 := True; if R1.B7 /= False then raise Program_Error; end if; R1.B7 := False; if R1.B7 /= False then raise Program_Error; end if; R2.B8 := False; if R2.B7 /= True then raise Program_Error; end if; R2.B7 := True; if R2.B7 /= True then raise Program_Error; end if; end;
-- { dg-do compile } pragma Restrictions(No_Elaboration_Code); with System; package Elab1 is type Ptrs_Type is array (Integer range 1 .. 2) of System.Address; type Vars_Array is array (Integer range 1 .. 2) of Integer; Vars : Vars_Array; Val1 : constant Integer := 1; Val2 : constant Integer := 2; Ptrs : constant Ptrs_Type := (1 => Vars (Val1)'Address, 2 => Vars (Val2)'Address); end Elab1;
------------------------------------------------------------------------------ -- -- -- JSON Parser/Constructor -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2021, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * Richard Wai (ANNEXI-STRAYLINE) -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Ada.Real_Time; with Ada.Exceptions; with Ada.IO_Exceptions; with Ada.Strings.Fixed; with Ada.Strings.Wide_Wide_Fixed; with Ada.Strings.Wide_Wide_Maps; with Ada.Strings.UTF_Encoding.Wide_Wide_Strings; with Ada.Characters.Conversions; with Ada.Unchecked_Deallocate_Subpool; with Unicode.UTF8_Stream_Decoder; with JSON.Standards; package body JSON.Unbounded_Codecs is function To_Wide_Wide_String (Item: in String) return Wide_Wide_String renames Ada.Characters.Conversions.To_Wide_Wide_String; -- -- Tools -- ----------------- -- Append_Node -- ----------------- -- Allocates and initializes a new node that is appended to Parent as a -- child, and returns the reference. -- -- This process properly initializes the Index, as well as updating the -- Member/Element counter of the Parent. -- -- The container is default initialized (JSON_Null), and the callee is -- reponsible for mutating the Container, and properly initializing it. function Append_Node (Parent: not null Node) return not null Node is New_Node: Node; -- := new (Parent.Codec_Subpool) JSON_Value; begin New_Node := new (Parent.Codec_Subpool) JSON_Value; -- TODO: Move this to the allocator.. Emacs ada mode doesn't like subpool -- allocations.. New_Node.Root := (if Parent.Parent = null then Parent else Parent.Root); New_Node.Parent := Parent; New_Node.Codec_Subpool := Parent.Codec_Subpool; case JSON_Structure_Kind (Parent.Container.Kind) is when JSON_Object => if Parent.Container.First_Member = null then pragma Assert (Parent.Container.Last_Member = null); Parent.Container.First_Member := New_Node; Parent.Container.Last_Member := New_Node; New_Node.Index := 0; else pragma Assert (Parent.Container.Last_Member.Next = null); Parent.Container.Last_Member.Next := New_Node; New_Node.Prev := Parent.Container.Last_Member; New_Node.Index := Parent.Container.Last_Member.Index + 1; Parent.Container.Last_Member := New_Node; end if; Slab_Strings.Setup (Target => New_Node.Name, Subpool => New_Node.Codec_Subpool); New_Node.Index := Parent.Container.Member_Count; Parent.Container.Member_Count := Parent.Container.Member_Count + 1; when JSON_Array => if Parent.Container.First_Element = null then pragma Assert (Parent.Container.Last_Element = null); Parent.Container.First_Element := New_Node; Parent.Container.Last_Element := New_Node; New_Node.Index := 0; else pragma Assert (Parent.Container.Last_Element.Next = null); Parent.Container.Last_Element.Next := New_Node; New_Node.Prev := Parent.Container.Last_Element; New_Node.Index := Parent.Container.Last_Element.Index + 1; Parent.Container.Last_Element := New_Node; end if; New_Node.Index := Parent.Container.Element_Count; Parent.Container.Element_Count := Parent.Container.Element_Count + 1; end case; return New_Node; end Append_Node; --------------- -- Seek_Node -- --------------- -- Seek Node obtains the Node value of a an actual JSON_Value within a Codec. -- This is primarily used by Codec.Delve and Codec.Constant_Delve to -- generate the JSON_Mutable_Structure, which contains a reference, without -- resorting to Unchecked_Access. -- -- Seek_Node also ensures Value belongs to Codec, and raises Program_Error -- if it does not. function Seek_Node (Codec: Unbounded_JSON_Codec; Value: JSON_Value'Class) return not null Node with Inline is begin if Value.Root /= Codec.Root_Node then raise Program_Error with "Value is not a member of Codec"; elsif Value.Parent = null then return Codec.Root_Node; elsif Value.Prev /= null then return Value.Prev.Next; elsif Value.Next /= null then return Value.Next.Prev; else -- This should not possibly fail case JSON_Structure_Kind (Value.Parent.Container.Kind) is when JSON_Object => pragma Assert (Value.Parent.Container.Member_Count = 1); return Value.Parent.Container.First_Member; when JSON_Array => pragma Assert (Value.Parent.Container.Element_Count = 1); return Value.Parent.Container.First_Element; end case; end if; end Seek_Node; -- -- Internal Subsystem Implementations -- package body Slab_Strings is separate; package body Node_Hash_Maps is separate; -- -- JSON_Value -- ---------- -- Kind -- ---------- function Kind (Value: JSON_Value) return JSON_Value_Kind is (Value.Container.Kind); ----------------- -- Parent_Kind -- ----------------- function Parent_Kind (Value: JSON_Value) return JSON_Structure_Kind is begin if Value.Parent = null then -- This indicates the root object raise Constraint_Error with "The Codec Root object has no parent."; else return Value.Parent.Container.Kind; end if; end; ---------- -- Name -- ---------- function Name (Value: JSON_Value) return JSON_String_Value is begin -- Explicit check for the precondition, since this could be a common -- mistake if Value.Container.Kind /= JSON_Object then raise Constraint_Error with "Value is not named. Only members of " & "JSON objects are named."; end if; return Slab_Strings.To_JSON_String (Value.Name); end; --------------- -- UTF8_Name -- --------------- function UTF8_Name (Value: JSON_Value) return UTF_8_String is use Ada.Strings.UTF_Encoding.Wide_Wide_Strings; Wide_Wide_Name: constant JSON_String_Value := Slab_Strings.To_JSON_String (Value.Name); begin return Encode (Wide_Wide_Name); end; ----------- -- Index -- ----------- function Index (Value: JSON_Value) return Natural is (Value.Index); ----------- -- Value -- (Get) ----------- function Value (Value: JSON_Value) return Boolean is (Value.Container.Boolean_Value); function Value (Value: JSON_Value) return JSON_Integer_Value is (Value.Container.Integer_Value); function Value (Value: JSON_Value) return JSON_Float_Value is (Value.Container.Float_Value); function Value (Value: JSON_Value) return JSON_String_Value is (Slab_Strings.To_JSON_String (Value.Container.String_Value)); function UTF8_Value (Value: JSON_Value) return UTF_8_String is (Ada.Strings.UTF_Encoding.Wide_Wide_Strings.Encode (Value.Value)); ----------- -- Value -- (Set) ----------- procedure Value (Target: in out JSON_Value; Value : in Boolean; Mutate: in Boolean := False) is begin if Target.Container.Kind = JSON_Boolean then Target.Container.Boolean_Value := Value; elsif Mutate or else Target.Container.Kind = JSON_Null then -- Full mutation Target.Container := Value_Container'(Kind => JSON_Boolean, Boolean_Value => Value); else raise Constraint_Error with "Intended value (JSON_INTEGER) does not fit the Kind of the target " & '(' & JSON_Value_Kind'Image (Target.Container.Kind) & ")."; end if; end; ---------------------------------------------------------------------- procedure Value (Target: in out JSON_Value; Value : in JSON_Integer_Value; Mutate: in Boolean := False) is begin if Target.Container.Kind = JSON_Integer then Target.Container.Integer_Value := Value; elsif Mutate or else Target.Container.Kind = JSON_Null then -- Full mutation Target.Container := Value_Container'(Kind => JSON_Integer, Integer_Value => Value); else raise Constraint_Error with "Intended value (JSON_INTEGER) does not fit the Kind of the target " & '(' & JSON_Value_Kind'Image (Target.Container.Kind) & ")."; end if; end; ---------------------------------------------------------------------- procedure Value (Target: in out JSON_Value; Value : in JSON_Float_Value; Mutate: in Boolean := False) is begin if Target.Container.Kind = JSON_Float then Target.Container.Float_Value := Value; elsif Mutate or else Target.Kind = JSON_Null then -- Full mutation Target.Container := Value_Container'(Kind => JSON_Float, Float_Value => Value); else raise Constraint_Error with "Intended value (JSON_FLOAT) does not fit the Kind of the target " & '(' & JSON_Value_Kind'Image (Target.Container.Kind) & ")."; end if; end; ---------------------------------------------------------------------- procedure Value (Target: in out JSON_Value; Value : in JSON_String_Value; Mutate: in Boolean := False) is procedure Set_Value with Inline is use Slab_Strings; begin Clear (Target.Container.String_Value); Append (Target.Container.String_Value, Value); end; begin if Target.Container.Kind = JSON_String then Set_Value; elsif Mutate or else Target.Container.Kind = JSON_Null then -- Full mutation Target.Container := Value_Container'(Kind => JSON_String, others => <>); Slab_Strings.Setup (Target => Target.Container.String_Value, Subpool => Target.Codec_Subpool); Set_Value; else raise Constraint_Error with "Intended value (JSON_STRIJNG) does not fit the Kind of the target " & '(' & JSON_Value_Kind'Image (Target.Container.Kind) & ")."; end if; end; ------------- -- Nullify -- ------------- procedure Nullify (Target: in out JSON_Value) is begin Target.Container := Value_Container'(Kind => JSON_Null); end; -- -- JSON_Structure / JSON_Mutable_Structure -- ---------- -- Kind -- ---------- function Kind (Structure: JSON_Structure) return JSON_Structure_Kind is (Structure.Structure_Root.Container.Kind); ------------ -- Length -- ------------ function Length (Structure: JSON_Structure) return Natural is Struct_Actual: JSON_Value renames Structure.Structure_Root.all; begin case JSON_Structure_Kind (Struct_Actual.Container.Kind) is when JSON_Object => return Struct_Actual.Container.Member_Count; when JSON_Array => return Struct_Actual.Container.Element_Count; end case; end; -------------------- -- Array Indexing -- -------------------- function Reference (Structure: in out JSON_Mutable_Structure; Index : in JSON_Array_Index) return JSON_Value_Reference is use Node_Hash_Maps; Struct_Actual: JSON_Value renames Structure.Structure_Root.all; begin if Structure.Codec_Constant.Write_Only then raise Constraint_Error with "Cannot index. Codec is write-only."; elsif Index >= Struct_Actual.Container.Element_Count then raise Constraint_Error with "Index is out of range of JSON_Array"; end if; return JSON_Value_Reference' (Ref => Lookup_By_Index (Index_Map => Struct_Actual.Container.Index_Map, Index => Index)); -- Note that any Index that is within the Element count shuld not -- possibly result in a missed lookup. If it does happen, a null -- check will fail when we try to return the reference end; ---------------------------------------------------------------------- function Constant_Reference (Structure: JSON_Structure; Index : JSON_Array_Index) return JSON_Value_Constant_Reference is use Node_Hash_Maps; Struct_Actual: JSON_Value renames Structure.Structure_Root.all; begin if Structure.Codec_Constant.Write_Only then raise Constraint_Error with "Cannot index. Codec is write-only."; elsif Index >= Struct_Actual.Container.Element_Count then raise Constraint_Error with "Index is out of range of JSON_Array"; end if; return JSON_Value_Constant_Reference' (Ref => Lookup_By_Index (Index_Map => Struct_Actual.Container.Index_Map, Index => Index)); end; ---------------------------- -- Object (Name) Indexing -- ---------------------------- function Has_Member (Structure: JSON_Structure; Name: JSON_String_Value) return Boolean is use Node_Hash_Maps; Struct_Actual: JSON_Value renames Structure.Structure_Root.all; begin if Structure.Codec_Constant.Write_Only then raise Constraint_Error with "Cannot index. Codec is write-only."; else return Lookup_By_Name (Name_Map => Struct_Actual.Container.Name_Map, Name => Name) /= null; end if; end; ---------------------------------------------------------------------- function Reference (Structure: in out JSON_Mutable_Structure; Name : in JSON_String_Value) return JSON_Value_Reference is use Node_Hash_Maps; Struct_Actual: JSON_Value renames Structure.Structure_Root.all; Hit: Node; begin if Structure.Codec_Constant.Write_Only then raise Constraint_Error with "Cannot index. Codec is write-only."; end if; Hit := Lookup_By_Name (Name_Map => Struct_Actual.Container.Name_Map, Name => Name); if Hit = null then raise Constraint_Error with "Object does not contain named member."; else return JSON_Value_Reference'(Ref => Hit); end if; end; ---------------------------------------------------------------------- function Constant_Reference (Structure: JSON_Structure; Name : JSON_String_Value) return JSON_Value_Constant_Reference is use Node_Hash_Maps; Struct_Actual: JSON_Value renames Structure.Structure_Root.all; Hit: Node; begin if Structure.Codec_Constant.Write_Only then raise Constraint_Error with "Cannot index. Codec is write-only."; end if; Hit := Lookup_By_Name (Name_Map => Struct_Actual.Container.Name_Map, Name => Name); if Hit = null then raise Constraint_Error with "Object does not contain named member."; else return JSON_Value_Constant_Reference'(Ref => Hit); end if; end; --------------------- -- Cursor Indexing -- --------------------- function Has_Value (Position: JSON_Structure_Cursor) return Boolean is (Position.Target /= null); ---------------------------------------------------------------------- function Reference (Structure: in out JSON_Mutable_Structure; Position : in JSON_Structure_Cursor) return JSON_Value_Reference is begin if Position.Target = null then raise Constraint_Error with "Cursor does not designate a value."; elsif Position.Target.Parent /= Structure.Structure_Root then raise Constraint_Error with "Cursor is not from this structure."; else return JSON_Value_Reference'(Ref => Position.Target); end if; end; ---------------------------------------------------------------------- function Constant_Reference (Structure: JSON_Structure; Position : JSON_Structure_Cursor) return JSON_Value_Constant_Reference is begin if Position.Target = null then raise Constraint_Error with "Cursor does not designate a value."; elsif Position.Target.Parent /= Structure.Structure_Root then raise Constraint_Error with "Cursor is not from this structure."; else return JSON_Value_Constant_Reference'(Ref => Position.Target); end if; end; --------------- -- Iteration -- --------------- type Structure_Iterator is limited new JSON_Structure_Iterators.Reversible_Iterator with record Structure_Root: not null Node; end record; overriding function First (Object: Structure_Iterator) return JSON_Structure_Cursor; overriding function Next (Object: Structure_Iterator; Position: JSON_Structure_Cursor) return JSON_Structure_Cursor; overriding function Last (Object: Structure_Iterator) return JSON_Structure_Cursor; overriding function Previous (Object : Structure_Iterator; Position: JSON_Structure_Cursor) return JSON_Structure_Cursor; ---------------------------------------------------------------------- function Iterate (Structure: JSON_Structure) return JSON_Structure_Iterators.Reversible_Iterator'Class is (Structure_Iterator'(Structure_Root => Structure.Structure_Root)); ---------------------------------------------------------------------- function First (Object: Structure_Iterator) return JSON_Structure_Cursor is Struct_Actual: JSON_Value renames Object.Structure_Root.all; begin case JSON_Structure_Kind (Struct_Actual.Container.Kind) is when JSON_Object => return (Target => Struct_Actual.Container.First_Member); when JSON_Array => return (Target => Struct_Actual.Container.First_Element); end case; end; ---------------------------------------------------------------------- function Last (Object: Structure_Iterator) return JSON_Structure_Cursor is Struct_Actual: JSON_Value renames Object.Structure_Root.all; begin case JSON_Structure_Kind (Struct_Actual.Container.Kind) is when JSON_Object => return (Target => Struct_Actual.Container.Last_Member); when JSON_Array => return (Target => Struct_Actual.Container.Last_Element); end case; end; ---------------------------------------------------------------------- function Next (Object: Structure_Iterator; Position: JSON_Structure_Cursor) return JSON_Structure_Cursor is begin if Object.Structure_Root /= Position.Target.Parent then raise Constraint_Error with "Cursor does not belong to iterated structure."; end if; return (Target => Position.Target.Next); end Next; ---------------------------------------------------------------------- function Previous (Object : Structure_Iterator; Position: JSON_Structure_Cursor) return JSON_Structure_Cursor is begin if Object.Structure_Root /= Position.Target.Parent then raise Constraint_Error with "Cursor does not belong to iterated structure."; end if; return (Target => Position.Target.Prev); end; ------------------------ -- Structure Building -- ------------------------ function Append_Null_Member (Structure: in out JSON_Mutable_Structure; Name : in JSON_String_Value) return JSON_Value_Reference is Struct_Actual: JSON_Value renames Structure.Structure_Root.all; New_Node: Node; begin if Name'Length = 0 then raise Constraint_Error with "Names must not be empty"; elsif Struct_Actual.Container.Kind /= JSON_Object then raise Constraint_Error with "Structure is not an object."; end if; New_Node := Append_Node (Structure.Structure_Root); Slab_Strings.Append (New_Node.Name, Name); if not Structure.Codec_Constant.Write_Only then Node_Hash_Maps.Register (Path_Map => Structure.Codec_Mutable.Path_Map, Registrant => New_Node); end if; return JSON_Value_Reference'(Ref => New_Node); end Append_Null_Member; ---------------------------------------------------------------------- function Append_Null_Element (Structure: in out JSON_Mutable_Structure) return JSON_Value_Reference is Struct_Actual: JSON_Value renames Structure.Structure_Root.all; New_Node: Node; begin if Struct_Actual.Container.Kind /= JSON_Array then raise Constraint_Error with "Structure is not an array."; end if; New_Node := Append_Node (Structure.Structure_Root); if not Structure.Codec_Constant.Write_Only then Node_Hash_Maps.Register (Path_Map => Structure.Codec_Mutable.Path_Map, Registrant => New_Node); end if; return JSON_Value_Reference'(Ref => New_Node); end Append_Null_Element; ---------------------------------------------------------------------- function Append_Structural_Member (Structure: in out JSON_Mutable_Structure; Name : in JSON_String_Value; Kind : in JSON_Structure_Kind) return JSON_Value_Reference is begin return New_Struct: JSON_Value_Reference := Structure.Append_Null_Member (Name) do case Kind is when JSON_Object => New_Struct.Container := (Kind => JSON_Object, others => <>); Node_Hash_Maps.Setup (Map => New_Struct.Container.Name_Map, Subpool => New_Struct.Codec_Subpool); when JSON_Array => New_Struct.Container := (Kind => JSON_Array, others => <>); Node_Hash_Maps.Setup (Map => New_Struct.Container.Index_Map, Subpool => New_Struct.Codec_Subpool); end case; end return; end; ---------------------------------------------------------------------- function Append_Structural_Element (Structure: in out JSON_Mutable_Structure; Kind : in JSON_Structure_Kind) return JSON_Value_Reference is begin return New_Struct: JSON_Value_Reference := Structure.Append_Null_Element do case Kind is when JSON_Object => New_Struct.Container := (Kind => JSON_Object, others => <>); Node_Hash_Maps.Setup (Map => New_Struct.Container.Name_Map, Subpool => New_Struct.Codec_Subpool); when JSON_Array => New_Struct.Container := (Kind => JSON_Array, others => <>); Node_Hash_Maps.Setup (Map => New_Struct.Container.Index_Map, Subpool => New_Struct.Codec_Subpool); end case; end return; end; -- -- Unbounded_JSON_Codec -- ----------------- -- Path_Exists -- ----------------- function Path_Exists (Codec: Unbounded_JSON_Codec; Path : in JSON_String_Value) return Boolean is use Node_Hash_Maps; begin if Codec.Write_Only then raise Constraint_Error with "Cannot index. Codec is write-only."; end if; return Lookup_By_Path (Path_Map => Codec.Path_Map, Path => Path) /= null; end; ------------ -- Lookup -- ------------ function Lookup (Codec: aliased in out Unbounded_JSON_Codec; Path : in JSON_String_Value) return JSON_Value_Reference is use Node_Hash_Maps; begin if Codec.Write_Only then raise Constraint_Error with "Cannot index. Codec is write-only."; end if; return JSON_Value_Reference' (Ref => Lookup_By_Path (Path_Map => Codec.Path_Map, Path => Path)); end; ---------------------------------------------------------------------- function Constant_Lookup (Codec: aliased Unbounded_JSON_Codec; Path : JSON_String_Value) return JSON_Value_Constant_Reference is use Node_Hash_Maps; begin if Codec.Write_Only then raise Constraint_Error with "Cannot index. Codec is write-only."; end if; return JSON_Value_Constant_Reference' (Ref => Lookup_By_Path (Path_Map => Codec.Path_Map, Path => Path)); end; ---------- -- Root -- ---------- function Root (Codec: aliased in out Unbounded_JSON_Codec) return JSON_Mutable_Structure'Class is (JSON_Mutable_Structure'(Structure_Root => Codec.Root_Node, Codec_Constant => Codec'Access, Codec_Mutable => Codec'Access)); ---------------------------------------------------------------------- function Constant_Root (Codec: aliased Unbounded_JSON_Codec) return JSON_Structure'Class is (JSON_Structure'(Structure_Root => Codec.Root_Node, Codec_Constant => Codec'Access)); ----------- -- Delve -- ----------- function Delve (Codec : aliased in out Unbounded_JSON_Codec; Structure: aliased in out JSON_Value'Class) return JSON_Mutable_Structure'Class is begin return JSON_Mutable_Structure' (Structure_Root => Seek_Node (Codec => Codec, Value => Structure), Codec_Constant => Codec'Access, Codec_Mutable => Codec'Access); end; ---------------------------------------------------------------------- function Constant_Delve (Codec : aliased Unbounded_JSON_Codec; Structure: aliased JSON_Value'Class) return JSON_Structure'Class is begin return JSON_Structure' (Structure_Root => Seek_Node (Codec => Codec, Value => Structure), Codec_Constant => Codec'Access); end Constant_Delve; ----------- -- Valid -- ----------- function Valid (Codec: Unbounded_JSON_Codec) return Boolean is use Parsers; begin return Last_Indication (Codec.Parser) /= Invalid; end; ------------------------------- -- Invalid_Because_End_Error -- ------------------------------- function Invalid_Because_End_Error (Codec: Unbounded_JSON_Codec) return Boolean is (Codec.End_Error); ------------------- -- Error_Message -- ------------------- procedure Set_Parser_Error (Codec: in out Unbounded_JSON_Codec) is use Ada.Strings, Ada.Strings.Fixed; Pos: constant Parsers.Text_Position := Parsers.Last_Position (Codec.Parser); Parser_Error_String: constant String := "Invalid JSON: " & (if Pos.Overflow then "(Position Overflow):" else Trim (Positive'Image (Pos.Line), Left) & ':' & Trim (Natural'Image (Pos.Column), Left) & ':') & ' ' & Parsers.Invalid_Reason (Codec.Parser); begin Slab_Strings.Clear (Codec.Error); Slab_Strings.Append (Target => Codec.Error, Source => To_Wide_Wide_String (Parser_Error_String)); end Set_Parser_Error; ---------------------------------------------------------------------- function Error_Message (Codec: Unbounded_JSON_Codec) return String is use Ada.Strings.UTF_Encoding.Wide_Wide_Strings; begin if Codec.Valid then raise Constraint_Error with "Error_Message can only be invoked if " & "the Codec is inValid."; end if; return Encode (Slab_Strings.To_JSON_String (Codec.Error)); end Error_Message; --------------- -- Serialize -- --------------- -- Single Node Encoding ---------------------------------------------- function Encode_Node (Target: not null Node) return Wide_Wide_String is -- Outputs the encoded value of Target, but does not include any -- trailing or leading structural characters (such as separators). -- Only a name (and name separator) is added when appropriate. -- -- However, if Target is an Object or Array, '{' or '[' is output, -- respectively use JSON.Standards; function Trim (Source: in Wide_Wide_String; Side : in Ada.Strings.Trim_End := Ada.Strings.Left) return Wide_Wide_String renames Ada.Strings.Wide_Wide_Fixed.Trim; Is_Named: constant Boolean := Target.Parent /= null and then Target.Parent.Container.Kind = JSON_Object; function Format_String (SS: Slab_Strings.Slab_String) return JSON_String_Value is use JSON.Standards; use Ada.Strings.Wide_Wide_Fixed; package WWM renames Ada.Strings.Wide_Wide_Maps; -- This role of this function is to prepare a slab string for actual -- JSON output. This means adding the quotation marks on each end, -- as well as scanning for anything that needs to be escaped, and -- converting those into the correct escape sequence. Original_Length: constant Natural := Slab_Strings.Length (SS); Original: JSON_String_Value (1 .. Original_Length); Original_Last: Natural := Original'First - 1; Original_Mark: Natural; Copy_Length: Natural; Need_Escaping: Natural; Formatted_Length: Natural; Formatted_Last: Natural; begin Slab_Strings.To_JSON_String (Source => SS, Target => Original); Need_Escaping := Count (Source => Original, Set => Escape_Serialize_Set); if Need_Escaping = 0 then -- Shortcut! return Quotation_Mark & Original & Quotation_Mark; end if; -- We have escaping, so we need to do more work Formatted_Length := Original_Length + Need_Escaping + 2; -- Each escaped character needs an extra \ added, and the 2 is for -- the two quotation marks that enclose the entire string return Formatted: JSON_String_Value (1 .. Formatted_Length) do Formatted(Formatted'First) := Quotation_Mark; Formatted(Formatted'Last) := Quotation_Mark; Formatted_Last := Formatted'First; while Original_Last < Original'Last loop Original_Mark := Index (Source => Original, Set => Escape_Serialize_Set, From => Original_Last + 1); exit when Original_Mark = 0; -- Copy everything up-to index to Formatted (if there is -- anything to copy) Copy_Length := Original_Mark - 1 - Original_Last; if Copy_Length > 0 then Formatted (Formatted_Last + 1 .. Formatted_Last + Copy_Length) := Original (Original_Last + 1 .. Original_Last + Copy_Length); Formatted_Last := Formatted_Last + Copy_Length; Original_Last := Original_Last + Copy_Length; end if; -- Now we add in the '\' Formatted(Formatted_Last + 1) := Escape_Symbol; Formatted_Last := Formatted_Last + 1; -- Now we convert the original character to the proper encoded -- form with a map pragma Assert (Original_Mark = Original_Last + 1); Formatted (Formatted_Last + 1) := WWM.Value (Map => Escape_Code_Reverse_Map, Element => Original (Original_Mark)); Formatted_Last := Formatted_Last + 1; Original_Last := Original_Mark; end loop; -- Finish-up with a final copy if needed if Original_Last < Original'Last then -- If our math is right, this should always work-out correctly Formatted (Formatted_Last + 1 .. Formatted'Last - 1) := Original (Original_Last + 1 .. Original'Last); end if; end return; end Format_String; function Leader return Wide_Wide_String is (if Is_Named then Format_String (Target.Name) & Name_Separator else ""); begin case Target.Container.Kind is when JSON_Object => return Leader & Begin_Object; when JSON_Array => return Leader & Begin_Array; when JSON_String => return Leader & Format_String (Target.Container.String_Value); when JSON_Integer => return Leader & Trim (JSON_Integer_Value'Wide_Wide_Image (Target.Container.Integer_Value)); when JSON_Float => return Leader & Trim (JSON_Float_Value'Wide_Wide_Image (Target.Container.Float_Value)); when JSON_Boolean => return Leader & (if Target.Container.Boolean_Value then Literal_True else Literal_False); when JSON_Null => return Leader & Literal_Null; end case; end Encode_Node; -- Generic Serializer ------------------------------------------------ generic with procedure Output_Segment (Output: UTF_8_String); procedure Generic_Serializer (Codec: Unbounded_JSON_Codec); procedure Generic_Serializer (Codec: Unbounded_JSON_Codec) is use JSON.Standards; function UTF_8 (Item : Wide_Wide_String; Output_BOM: Boolean := False) return UTF_8_String renames Ada.Strings.UTF_Encoding.Wide_Wide_Strings.Encode; procedure Recursive_Descend (Down_From: not null Node); -- Down_From shall be a JSON_Object or JSON_Array. procedure Recursive_Descend (Down_From: not null Node) is Finger: Node; begin case JSON_Structure_Kind (Down_From.Container.Kind) is when JSON_Object => Finger := Down_From.Container.First_Member; when JSON_Array => Finger := Down_From.Container.First_Element; end case; while Finger /= null loop Output_Segment (UTF_8 (Encode_Node (Finger))); if Finger.Kind in JSON_Structure_Kind then Recursive_Descend (Finger); end if; Finger := Finger.Next; if Finger /= null then Output_Segment (UTF_8 (Wide_Wide_String'(1 => Value_Separator))); end if; end loop; case JSON_Structure_Kind (Down_From.Container.Kind) is when JSON_Object => Output_Segment (UTF_8 (Wide_Wide_String'(1 => End_Object))); when JSON_Array => Output_Segment (UTF_8 (Wide_Wide_String'(1 => End_Array))); end case; end Recursive_Descend; begin -- We "hand craft" the root node opening. The closing will be handled by -- Recursive_Descend. case JSON_Structure_Kind (Codec.Root_Node.Container.Kind) is when JSON_Object => Output_Segment (UTF_8 (Wide_Wide_String'(1 => Begin_Object))); when JSON_Array => Output_Segment (UTF_8 (Wide_Wide_String'(1 => Begin_Array))); end case; Recursive_Descend (Down_From => Codec.Root_Node); end Generic_Serializer; -- Serialized_Length ------------------------------------------------- function Serialized_Length (Codec: in Unbounded_JSON_Codec) return Natural is Total_Length: Natural := 0; procedure Meter_Output (Output: UTF_8_String) is begin Total_Length := Total_Length + Output'Length; end; procedure Dry_Run is new Generic_Serializer (Meter_Output); begin Dry_Run (Codec); pragma Assert (Total_Length >= 2); return Total_Length; end Serialized_Length; ---------------------------------------------------------------------- procedure Serialize (Codec : in Unbounded_JSON_Codec; Output: out UTF_8_String) is Last: Natural := Output'First - 1; procedure Append_Segment (Segment: UTF_8_String) is First: constant Natural := Last + 1; begin Last := First + Segment'Length - 1; Output (First .. Last) := Segment; end; procedure Serialize_Actual is new Generic_Serializer (Append_Segment); begin Serialize_Actual (Codec); if Last < Output'Last then Output (Last + 1 .. Output'Last) := (others => ' '); end if; end; ---------------------------------------------------------------------- function Serialize (Codec: in Unbounded_JSON_Codec) return UTF_8_String is begin return Output_Buffer: UTF_8_String (1 .. Codec.Serialized_Length) do Codec.Serialize (Output_Buffer); end return; end; ---------------------------------------------------------------------- procedure Serialize (Output_Stream: not null access Ada.Streams.Root_Stream_Type'Class; Codec : in Unbounded_JSON_Codec) is procedure Stream_Segment (Output: UTF_8_String) is begin UTF_8_String'Write (Output_Stream, Output); end; procedure Serialize_Actual is new Generic_Serializer (Stream_Segment); begin Serialize_Actual (Codec); end Serialize; ----------------- -- Parser_Push -- ----------------- -- This is the core subprogram for driving the parser finite state machine, -- used by all deserialization operations. procedure Parser_Push (Codec : in out Unbounded_JSON_Codec'Class; Next_Character: in Wide_Wide_Character; Indication : in out Parsers.Operator_Indication) with Inline, Pre => Parsers."=" (Indication, Parsers.Ready), Post => Indication in Parsers.Ready | Parsers.Done | Parsers.Invalid is -- Parser_Push is the meat of a single character loop, where simply the -- loop should terminate when Indication is Invalid or Done. -- -- The purpose of Exec_Push is to improve performance by reducing -- stack frame movements and procedure calls compared to just calling -- "FSM_Push" for each character. -- -- Indication should be initialized to the Parser_FSM's Last_Indication -- before the first call of Exec_Push use Parsers; Parser: Parser_FSM renames Codec.Parser; Current_Structure: Node renames Codec.Current_Structure; Output_Recipient: Node := null; procedure Initialization_Pass is -- Invoked on entry until Current_Structure is not null. This -- subprogram waits for a Push indication and then allocates and -- configures the codec's root begin Feed (Machine => Parser, Input => Next_Character, Indication => Indication); case Indication is when Ready | Invalid => return; when Push => Codec.Root_Node := new (Codec.Codec_Subpool) JSON_Value; Codec.Root_Node.Index := 0; Codec.Root_Node.Codec_Subpool := Codec.Codec_Subpool; Codec.Root_Node.Root := Codec.Root_Node; -- Used for IDing the owning Codec only case Current_Structure_Kind (Parser) is when JSON_Object => Codec.Root_Node.Container := (Kind => JSON_Object, others => <>); Node_Hash_Maps.Setup (Map => Codec.Root_Node.Container.Name_Map, Subpool => Codec.Codec_Subpool); when JSON_Array => Codec.Root_Node.Container := (Kind => JSON_Array, others => <>); Node_Hash_Maps.Setup (Map => Codec.Root_Node.Container.Index_Map, Subpool => Codec.Codec_Subpool); end case; Acknowledge_Push (Machine => Parser, Indication => Indication); Current_Structure := Codec.Root_Node; when others => raise Program_Error with "Unexpected indication from the " & "paser state machine."; end case; end Initialization_Pass; procedure Do_Pop is -- We often need to do pops after we acknowledge an output, so -- this avoids needlessly wrapping the entire post-Feed case statement -- in a giant loop. begin Current_Structure := Current_Structure.Parent; -- Note this will never be null if the Parser operates correctly. Acknowledge_Pop (Machine => Parser, Popped_To => Current_Structure.Container.Kind, Indication => Indication); end; begin if Current_Structure = null then Initialization_Pass; return; end if; Feed (Machine => Parser, Input => Next_Character, Indication => Indication); case Indication is when Ready | Done | Invalid => return; when Output_Member | Output_Element => Output_Recipient := Append_Node (Current_Structure); if Indication = Output_Member then Output_Name (Machine => Parser, Target => Output_Recipient.Name); end if; case Output_Kind (Parser) is when JSON_Object | JSON_Array => raise Program_Error with "Parser FSM violated Output_Kind postcondition"; when JSON_String => Output_Recipient.Container := (Kind => JSON_String, others => <>); Output_Value (Machine => Parser, Target => Output_Recipient.Container.String_Value); when JSON_Integer => Output_Recipient.Container := (Kind => JSON_Integer, others => <>); Output_Recipient.Container.Integer_Value := Output_Value (Parser); when JSON_Float => Output_Recipient.Container := (Kind => JSON_Float, others => <>); Output_Recipient.Container.Float_Value := Output_Value (Parser); when JSON_Boolean => Output_Recipient.Container := (Kind => JSON_Boolean, others => <>); Output_Recipient.Container.Boolean_Value := Output_Value (Parser); when JSON_Null => null; end case; Acknowledge_Output (Machine => Parser, Indication => Indication); if not Codec.Write_Only then Node_Hash_Maps.Register (Path_Map => Codec.Path_Map, Registrant => Output_Recipient); end if; if Indication = Pop then Do_Pop; end if; when Push => Current_Structure := Append_Node (Current_Structure); if Current_Structure.Parent.Container.Kind = JSON_Object then Output_Name (Machine => Parser, Target => Current_Structure.Name); end if; case Current_Structure_Kind (Parser) is when JSON_Object => Current_Structure.Container := (Kind => JSON_Object, others => <>); Node_Hash_Maps.Setup (Map => Current_Structure.Container.Name_Map, Subpool => Current_Structure.Codec_Subpool); when JSON_Array => Current_Structure.Container := (Kind => JSON_Array, others => <>); Node_Hash_Maps.Setup (Map => Current_Structure.Container.Index_Map, Subpool => Current_Structure.Codec_Subpool); end case; if not Codec.Write_Only then Node_Hash_Maps.Register (Path_Map => Codec.Path_Map, Registrant => Current_Structure); end if; Acknowledge_Push (Machine => Parser, Indication => Indication); when Pop => Do_Pop; end case; end Parser_Push; ----------------- -- Deserialize -- ----------------- function Deserialize (Input: UTF_8_String) return Unbounded_JSON_Codec is use Parsers; WW_Characters: constant Wide_Wide_String := Ada.Strings.UTF_Encoding.Wide_Wide_Strings.Decode (Input); Indication: Operator_Indication; begin return Codec: Unbounded_JSON_Codec do Indication := Last_Indication (Codec.Parser); for Next_Character of WW_Characters loop Parser_Push (Codec, Next_Character, Indication); exit when Indication /= Ready; end loop; pragma Assert (Indication in Done | Invalid | Ready); if Indication = Invalid then Set_Parser_Error (Codec); elsif Indication = Ready then Codec.End_Error := True; Slab_Strings.Clear (Codec.Error); Slab_Strings.Append (Codec.Error, "Serialized JSON text ended unexpectedly"); Parsers.Emergency_Stop (Codec.Parser); end if; exception when e: others => Slab_Strings.Clear (Codec.Error); Slab_Strings.Append (Codec.Error, "Deserialization failed with an exception: " & To_Wide_Wide_String (Ada.Exceptions.Exception_Information (e))); Parsers.Emergency_Stop (Codec.Parser); end return; end; ---------------------------------------------------------------------- generic Slow_Loris_Protection: in Boolean := False; procedure Generic_Stream_Deserialize (Codec : in out Unbounded_JSON_Codec; Source: not null access Ada.Streams.Root_Stream_Type'Class; Decode_Time_Budget: in Duration := 0.0); procedure Generic_Stream_Deserialize (Codec : in out Unbounded_JSON_Codec; Source: not null access Ada.Streams.Root_Stream_Type'Class; Decode_Time_Budget: in Duration := 0.0) is use Parsers; use type Ada.Real_Time.Time; package UTF8 renames Unicode.UTF8_Stream_Decoder; Deadline: Ada.Real_Time.Time; Indication: Operator_Indication := Last_Indication (Codec.Parser); begin if Slow_Loris_Protection then Deadline := Ada.Real_Time.Clock + Ada.Real_Time.To_Time_Span (Decode_Time_Budget); end if; while Indication = Ready loop Parser_Push (Codec => Codec, Next_Character => UTF8.Decode_Next (Source), Indication => Indication); if Slow_Loris_Protection then if Ada.Real_Time.Clock > Deadline then Codec.End_Error := False; Slab_Strings.Clear (Codec.Error); Slab_Strings.Append (Codec.Error, "Deserialization did not complete before the deadline."); Parsers.Emergency_Stop (Codec.Parser); return; end if; end if; end loop; pragma Assert (Indication in Done | Invalid); if Indication = Invalid then Set_Parser_Error (Codec); end if; exception when Ada.IO_Exceptions.End_Error => Codec.End_Error := True; Slab_Strings.Clear (Codec.Error); Slab_Strings.Append (Codec.Error, "Serialized JSON stream ended unexpectedly"); Parsers.Emergency_Stop (Codec.Parser); when e: others => Slab_Strings.Clear (Codec.Error); Slab_Strings.Append (Codec.Error, "Deserialization failed with an exception: " & To_Wide_Wide_String (Ada.Exceptions.Exception_Information (e))); Parsers.Emergency_Stop (Codec.Parser); end Generic_Stream_Deserialize; ---------------------------------------------------------------------- procedure Normal_Stream_Deserialize is new Generic_Stream_Deserialize; procedure Protected_Stream_Deserialize is new Generic_Stream_Deserialize (Slow_Loris_Protection => True); ---------------------------------------------------------------------- function Deserialize (Source: not null access Ada.Streams.Root_Stream_Type'Class) return Unbounded_JSON_Codec is begin return Codec: Unbounded_JSON_Codec do Normal_Stream_Deserialize (Codec, Source); end return; end; ---------------------------------------------------------------------- function Deserialize (Source: not null access Ada.Streams.Root_Stream_Type'Class; Limits: Codec_Limits) return Unbounded_JSON_Codec is begin return Codec: Unbounded_JSON_Codec do Parsers.Configure_Limits (Machine => Codec.Parser, Limits => Limits); Normal_Stream_Deserialize (Codec, Source); end return; end; ---------------------------------------------------------------------- function Time_Bounded_Deserialize (Source: not null access Ada.Streams.Root_Stream_Type'Class; Budget: in Duration) return Unbounded_JSON_Codec is begin return Codec: Unbounded_JSON_Codec do Protected_Stream_Deserialize (Codec, Source, Decode_Time_Budget => Budget); end return; end; ---------------------------------------------------------------------- function Time_Bounded_Deserialize (Source: not null access Ada.Streams.Root_Stream_Type'Class; Limits: Codec_Limits; Budget: in Duration) return Unbounded_JSON_Codec is begin return Codec: Unbounded_JSON_Codec do Parsers.Configure_Limits (Machine => Codec.Parser, Limits => Limits); Protected_Stream_Deserialize (Codec, Source, Decode_Time_Budget => Budget); end return; end; ---------------------------------------------------------------------- --------------------- -- Disallowed_Read -- --------------------- procedure Disallowed_Read (Stream: not null access Ada.Streams.Root_Stream_Type'Class; Item : out Unbounded_JSON_Codec) is begin raise Program_Error with "'Read is not allowed for Unbounded_JSON_Codec."; end; ------------------ -- Initializers -- ------------------ procedure Initialize (Codec: in out Unbounded_JSON_Codec) is begin Codec.Codec_Subpool := Slab_Pool.Create_Subpool; Slab_Strings.Setup (Target => Codec.Path_Buffer, Subpool => Codec.Codec_Subpool); Slab_Strings.Setup (Target => Codec.Error, Subpool => Codec.Codec_Subpool); Node_Hash_Maps.Setup (Map => Codec.Path_Map, Subpool => Codec.Codec_Subpool); Parsers.Setup_Buffers (Machine => Codec.Parser, Config => Codec.Codec_Subpool); end Initialize; ---------------------------------------------------------------------- function Construction_Codec (Format : JSON_Structure_Kind := JSON_Object; Write_Only: Boolean := True) return Unbounded_JSON_Codec is begin return Codec: Unbounded_JSON_Codec do Codec.Write_Only := Write_Only; -- Hand-craft the root node Codec.Root_Node := new (Codec.Codec_Subpool) JSON_Value; Codec.Root_Node.Root := Codec.Root_Node; Codec.Root_Node.Index := 0; Codec.Root_Node.Codec_Subpool := Codec.Codec_Subpool; case Format is when JSON_Object => Codec.Root_Node.Container := (Kind => JSON_Object, others => <>); Node_Hash_Maps.Setup (Map => Codec.Root_Node.Container.Name_Map, Subpool => Codec.Codec_Subpool); when JSON_Array => Codec.Root_Node.Container := (Kind => JSON_Array, others => <>); Node_Hash_Maps.Setup (Map => Codec.Root_Node.Container.Index_Map, Subpool => Codec.Codec_Subpool); end case; Codec.Current_Structure := Codec.Root_Node; -- Note that this is technically not "necessary" as it is impossible -- for a resular Unbounded_JSON_Codec to invoke the parser after being -- initialized (as is done from here), but if it was possible, and -- this was not set, bad things would happen. So why not? end return; end Construction_Codec; -------------- -- Finalize -- -------------- procedure Finalize (Codec: in out Unbounded_JSON_Codec) is -- use Ada.Text_IO; -- use Node_Hash_Maps; -- Perf: constant Performance_Counters := Performance (Codec.Path_Map); begin -- Put_Line ("Path hash table stats:"); -- Put_Line ("----------------------"); -- Put_Line ("Primary Registrations"); -- for Level in Match_Level loop -- Put (" Level" & Match_Level'Image(Level) & " ="); -- Put_Line (Natural'Image (Perf.Primary_Registrations(Level))); -- end loop; -- New_Line; -- Put_Line ("Overflow Registrations"); -- for Level in Match_Level loop -- Put (" Level" & Match_Level'Image(Level) & " ="); -- Put_Line (Natural'Image (Perf.Overflow_Registrations(Level))); -- end loop; -- New_Line; -- Put_Line ("Total Tables =" & Natural'Image (Perf.Total_Tables)); -- Put_Line ("Saturation HW =" & Natural'Image (Perf.Saturation_High_Water)); -- Put_Line ("Full Collisions =" & Natural'Image (Perf.Full_Collisions)); Ada.Unchecked_Deallocate_Subpool (Codec.Codec_Subpool); -- Everthing in one go! end Finalize; -- -- Unbounded_FSM_JSON_Codec -- ----------------------- -- Input_Limited_FSM -- ----------------------- function Input_Limited_FSM (Limits: Codec_Limits) return Unbounded_FSM_JSON_Codec is begin return Codec: Unbounded_FSM_JSON_Codec do Parsers.Configure_Limits (Machine => Codec.Parser, Limits => Limits); end return; end; ---------------------- -- Root_Initialized -- ---------------------- function Root_Initialized (Codec: Unbounded_FSM_JSON_Codec) return Boolean is (Codec.Root_Node /= null); -------------- -- FSM_Push -- -------------- procedure FSM_Push (Codec : in out Unbounded_FSM_JSON_Codec; Next_Character: in Wide_Wide_Character; Halt : out Boolean) is use Parsers; Indication: Operator_Indication := Last_Indication (Codec.Parser); begin Parser_Push (Codec, Next_Character, Indication); Halt := Indication /= Ready; pragma Assert (if Halt then Indication in Done | Invalid); end; ---------------------------------------------------------------------- procedure FSM_Push (Codec : in out Unbounded_FSM_JSON_Codec; Next_Characters: in Wide_Wide_String; Halt : out Boolean) is use Parsers; Indication: Operator_Indication := Last_Indication (Codec.Parser); begin for Next_Character of Next_Characters loop exit when Indication /= Ready; Parser_Push (Codec, Next_Character, Indication); end loop; Halt := Indication /= Ready; pragma Assert (if Halt then Indication in Done | Invalid); end; end JSON.Unbounded_Codecs;
PROCEDURE loop_parameter_specification IS J : Integer; BEGIN for J in 0 .. 2 loop NULL; end loop; END loop_parameter_specification;
/*- * Copyright (c) 1980 The Regents of the University of California. * All rights reserved. * * %sccs.include.proprietary.c% * * @(#)instrs.adb 5.1 (Berkeley) 04/04/91 */ OP("adda",0x8e,2,ACCR+TYPL,ACCM+TYPL,0,0,0,0), OP("addb2",0x08,2,ACCR+TYPB,ACCM+TYPB,0,0,0,0), OP("addb3",0x18,3,ACCR+TYPB,ACCR+TYPB,ACCW+TYPB,0,0,0), OP("addd",0xc7,1,ACCR+TYPD,0,0,0,0,0), OP("addf",0xc6,1,ACCR+TYPF,0,0,0,0,0), OP("addl2",0x0c,2,ACCR+TYPL,ACCM+TYPL,0,0,0,0), OP("addl3",0x1c,3,ACCR+TYPL,ACCR+TYPL,ACCW+TYPL,0,0,0), OP("addw2",0x0a,2,ACCR+TYPW,ACCM+TYPW,0,0,0,0), OP("addw3",0x1a,3,ACCR+TYPW,ACCR+TYPW,ACCW+TYPW,0,0,0), OP("adwc",0x8d,2,ACCR+TYPL,ACCM+TYPL,0,0,0,0), OP("andb2",0xa8,2,ACCR+TYPB,ACCM+TYPB,0,0,0,0), OP("andb3",0xb8,3,ACCR+TYPB,ACCR+TYPB,ACCW+TYPB,0,0,0), OP("andl2",0xac,2,ACCR+TYPL,ACCM+TYPL,0,0,0,0), OP("andl3",0xbc,3,ACCR+TYPL,ACCR+TYPL,ACCW+TYPL,0,0,0), OP("andw2",0xaa,2,ACCR+TYPW,ACCM+TYPW,0,0,0,0), OP("andw3",0xba,3,ACCR+TYPW,ACCR+TYPW,ACCW+TYPW,0,0,0), OP("aobleq",0x3f,3,ACCR+TYPL,ACCM+TYPL,ACCB+TYPW,0,0,0), OP("aoblss",0x2f,3,ACCR+TYPL,ACCM+TYPL,ACCB+TYPW,0,0,0), OP("atanf",0x25,0,0,0,0,0,0,0), OP("bbc",0x1e,3,ACCR+TYPL,ACCR+TYPL,ACCB+TYPW,0,0,0), OP("bbs",0x0e,3,ACCR+TYPL,ACCR+TYPL,ACCB+TYPW,0,0,0), OP("bbssi",0x5f,3,ACCR+TYPL,ACCM+TYPL,ACCB+TYPW,0,0,0), OP("bcc",0xf1,1,ACCB+TYPB,0,0,0,0,0), OP("bcs",0xe1,1,ACCB+TYPB,0,0,0,0,0), OP("beql",0x31,1,ACCB+TYPB,0,0,0,0,0), OP("beqlu",0x31,1,ACCB+TYPB,0,0,0,0,0), OP("bgeq",0x81,1,ACCB+TYPB,0,0,0,0,0), OP("bgequ",0xe1,1,ACCB+TYPB,0,0,0,0,0), OP("bgtr",0x41,1,ACCB+TYPB,0,0,0,0,0), OP("bgtru",0xa1,1,ACCB+TYPB,0,0,0,0,0), OP("bicpsw",0x9b,1,ACCR+TYPW,0,0,0,0,0), OP("bispsw",0x8b,1,ACCR+TYPW,0,0,0,0,0), OP("bitb",0x39,2,ACCR+TYPB,ACCR+TYPB,0,0,0,0), OP("bitl",0x3d,2,ACCR+TYPL,ACCR+TYPL,0,0,0,0), OP("bitw",0x3b,2,ACCR+TYPW,ACCR+TYPW,0,0,0,0), OP("bleq",0x51,1,ACCB+TYPB,0,0,0,0,0), OP("blequ",0xb1,1,ACCB+TYPB,0,0,0,0,0), OP("blss",0x91,1,ACCB+TYPB,0,0,0,0,0), OP("blssu",0xf1,1,ACCB+TYPB,0,0,0,0,0), OP("bneq",0x21,1,ACCB+TYPB,0,0,0,0,0), OP("bnequ",0x21,1,ACCB+TYPB,0,0,0,0,0), OP("bpt",0x30,0,0,0,0,0,0,0), OP("brb",0x11,1,ACCB+TYPB,0,0,0,0,0), OP("brw",0x13,1,ACCB+TYPW,0,0,0,0,0), OP("btcs",0xce,1,ACCR+TYPB,0,0,0,0,0), OP("bvc",0xc1,1,ACCB+TYPB,0,0,0,0,0), OP("bvs",0xd1,1,ACCB+TYPB,0,0,0,0,0), OP("callf",0xfe,2,ACCR+TYPB,ACCA+TYPB,0,0,0,0), OP("calls",0xbf,2,ACCR+TYPB,ACCA+TYPB,0,0,0,0), OP("casel",0xfc,3,ACCR+TYPL,ACCR+TYPL,ACCR+TYPL,0,0,0), OP("clrb",0x49,1,ACCW+TYPB,0,0,0,0,0), OP("clrl",0x4d,1,ACCW+TYPL,0,0,0,0,0), OP("clrw",0x4b,1,ACCW+TYPW,0,0,0,0,0), OP("cmpb",0x19,2,ACCR+TYPB,ACCR+TYPB,0,0,0,0), OP("cmpd",0x37,1,ACCR+TYPD,0,0,0,0,0), OP("cmpd2",0x47,2,ACCR+TYPD,ACCR+TYPD,0,0,0,0), OP("cmpf",0x36,1,ACCR+TYPF,0,0,0,0,0), OP("cmpf2",0x46,2,ACCR+TYPF,ACCR+TYPF,0,0,0,0), OP("cmpl",0x1d,2,ACCR+TYPL,ACCR+TYPL,0,0,0,0), OP("cmps2",0x92,0,0,0,0,0,0,0), OP("cmps3",0xd2,0,0,0,0,0,0,0), OP("cmpw",0x1b,2,ACCR+TYPW,ACCR+TYPW,0,0,0,0), OP("cosf",0x15,0,0,0,0,0,0,0), OP("cvdf",0xa6,0,0,0,0,0,0,0), OP("cvdl",0x87,1,ACCW+TYPL,0,0,0,0,0), OP("cvfl",0x86,1,ACCW+TYPL,0,0,0,0,0), OP("cvld",0x77,1,ACCR+TYPL,0,0,0,0,0), OP("cvlf",0x76,1,ACCR+TYPL,0,0,0,0,0), OP("cvtbl",0x89,2,ACCR+TYPB,ACCW+TYPL,0,0,0,0), OP("cvtbw",0x99,2,ACCR+TYPB,ACCW+TYPW,0,0,0,0), OP("cvtlb",0x6f,2,ACCR+TYPL,ACCW+TYPB,0,0,0,0), OP("cvtlw",0x7f,2,ACCR+TYPL,ACCW+TYPW,0,0,0,0), OP("cvtwb",0x33,2,ACCR+TYPW,ACCW+TYPB,0,0,0,0), OP("cvtwl",0x23,2,ACCR+TYPW,ACCW+TYPL,0,0,0,0), OP("decb",0x79,1,ACCM+TYPB,0,0,0,0,0), OP("decl",0x7d,1,ACCM+TYPL,0,0,0,0,0), OP("decw",0x7b,1,ACCM+TYPW,0,0,0,0,0), OP("divd",0xf7,1,ACCR+TYPD,0,0,0,0,0), OP("divf",0xf6,1,ACCR+TYPF,0,0,0,0,0), OP("divl2",0x6c,2,ACCR+TYPL,ACCM+TYPL,0,0,0,0), OP("divl3",0x7c,3,ACCR+TYPL,ACCR+TYPL,ACCW+TYPL,0,0,0), OP("ediv",0x3e,4,ACCR+TYPL,ACCR+TYPQ,ACCW+TYPL,ACCW+TYPL,0,0), OP("emul",0x2e,4,ACCR+TYPL,ACCR+TYPL,ACCR+TYPL,ACCW+TYPQ,0,0), OP("expf",0x55,0,0,0,0,0,0,0), OP("ffc",0xbe,2,ACCR+TYPL,ACCW+TYPL,0,0,0,0), OP("ffs",0xae,2,ACCR+TYPL,ACCW+TYPL,0,0,0,0), OP("halt",0x00,0,0,0,0,0,0,0), OP("incb",0x69,1,ACCM+TYPB,0,0,0,0,0), OP("incl",0x6d,1,ACCM+TYPL,0,0,0,0,0), OP("incw",0x6b,1,ACCM+TYPW,0,0,0,0,0), OP("insque",0xe0,2,ACCA+TYPL,ACCA+TYPL,0,0,0,0), OP("jmp",0x71,1,ACCA+TYPB,0,0,0,0,0), OP("kcall",0xcf,1,ACCR+TYPW,0,0,0,0,0), OP("ldd",0x07,1,ACCR+TYPD,0,0,0,0,0), OP("ldf",0x06,1,ACCR+TYPF,0,0,0,0,0), OP("ldfd",0x97,1,ACCR+TYPF,0,0,0,0,0), OP("ldpctx",0x60,0,0,0,0,0,0,0), OP("lnd",0x17,1,ACCR+TYPD,0,0,0,0,0), OP("lnf",0x16,1,ACCR+TYPF,0,0,0,0,0), OP("loadr",0xab,2,ACCR+TYPW,ACCA+TYPL,0,0,0,0), OP("logf",0x35,0,0,0,0,0,0,0), OP("mcomb",0x29,2,ACCR+TYPB,ACCW+TYPB,0,0,0,0), OP("mcoml",0x2d,2,ACCR+TYPL,ACCW+TYPL,0,0,0,0), OP("mcomw",0x2b,2,ACCR+TYPW,ACCW+TYPW,0,0,0,0), OP("mfpr",0xbd,2,ACCR+TYPL,ACCW+TYPL,0,0,0,0), OP("mnegb",0xe8,2,ACCR+TYPB,ACCW+TYPB,0,0,0,0), OP("mnegl",0xec,2,ACCR+TYPL,ACCW+TYPL,0,0,0,0), OP("mnegw",0xea,2,ACCR+TYPW,ACCW+TYPW,0,0,0,0), OP("movab",0xe9,2,ACCA+TYPB,ACCW+TYPL,0,0,0,0), OP("moval",0xed,2,ACCA+TYPL,ACCW+TYPL,0,0,0,0), OP("movaw",0xeb,2,ACCA+TYPW,ACCW+TYPL,0,0,0,0), OP("movb",0x09,2,ACCR+TYPB,ACCW+TYPB,0,0,0,0), OP("movblk",0xf8,0,0,0,0,0,0,0), OP("movl",0x0d,2,ACCR+TYPL,ACCW+TYPL,0,0,0,0), OP("movob",0xc9,2,ACCR+TYPB,ACCW+TYPB,0,0,0,0), OP("movow",0xcb,2,ACCR+TYPW,ACCW+TYPW,0,0,0,0), OP("movpsl",0xcd,1,ACCW+TYPL,0,0,0,0,0), OP("movs2",0x82,0,0,0,0,0,0,0), OP("movs3",0xc2,0,0,0,0,0,0,0), OP("movw",0x0b,2,ACCR+TYPW,ACCW+TYPW,0,0,0,0), OP("movzbl",0xa9,2,ACCR+TYPB,ACCW+TYPL,0,0,0,0), OP("movzbw",0xb9,2,ACCR+TYPB,ACCW+TYPW,0,0,0,0), OP("movzwl",0xc3,2,ACCR+TYPW,ACCW+TYPL,0,0,0,0), OP("mtpr",0xad,2,ACCR+TYPL,ACCR+TYPL,0,0,0,0), OP("muld",0xe7,1,ACCR+TYPD,0,0,0,0,0), OP("mulf",0xe6,1,ACCR+TYPF,0,0,0,0,0), OP("mull2",0x4c,2,ACCR+TYPL,ACCM+TYPL,0,0,0,0), OP("mull3",0x5c,3,ACCR+TYPL,ACCR+TYPL,ACCW+TYPL,0,0,0), OP("negd",0xb7,0,0,0,0,0,0,0), OP("negf",0xb6,0,0,0,0,0,0,0), OP("nop",0x10,0,0,0,0,0,0,0), OP("orb2",0x88,2,ACCR+TYPB,ACCM+TYPB,0,0,0,0), OP("orb3",0x98,3,ACCR+TYPB,ACCR+TYPB,ACCW+TYPB,0,0,0), OP("orl2",0x8c,2,ACCR+TYPL,ACCM+TYPL,0,0,0,0), OP("orl3",0x9c,3,ACCR+TYPL,ACCR+TYPL,ACCW+TYPL,0,0,0), OP("orw2",0x8a,2,ACCR+TYPW,ACCM+TYPW,0,0,0,0), OP("orw3",0x9a,3,ACCR+TYPW,ACCR+TYPW,ACCW+TYPW,0,0,0), OP("prober",0xc0,3,ACCR+TYPB,ACCA+TYPB,ACCR+TYPL,0,0,0), OP("probew",0xd0,3,ACCR+TYPB,ACCA+TYPB,ACCR+TYPL,0,0,0), OP("pushab",0xf9,1,ACCA+TYPB,0,0,0,0,0), OP("pushal",0xfd,1,ACCA+TYPL,0,0,0,0,0), OP("pushaw",0xfb,1,ACCA+TYPW,0,0,0,0,0), OP("pushb",0xd9,1,ACCR+TYPB,0,0,0,0,0), OP("pushd",0x67,0,0,0,0,0,0,0), OP("pushl",0xdd,1,ACCR+TYPL,0,0,0,0,0), OP("pushw",0xdb,1,ACCR+TYPW,0,0,0,0,0), OP("rei",0x20,0,0,0,0,0,0,0), OP("remque",0xf0,1,ACCA+TYPL,0,0,0,0,0), OP("ret",0x40,0,0,0,0,0,0,0), OP("sbwc",0x9d,2,ACCR+TYPL,ACCM+TYPL,0,0,0,0), OP("shal",0x4e,3,ACCR+TYPB,ACCR+TYPL,ACCW+TYPL,0,0,0), OP("shar",0x5e,3,ACCR+TYPB,ACCR+TYPL,ACCW+TYPL,0,0,0), OP("shll",0x48,3,ACCR+TYPB,ACCR+TYPL,ACCW+TYPL,0,0,0), OP("shlq",0x4a,3,ACCR+TYPB,ACCR+TYPQ,ACCW+TYPQ,0,0,0), OP("shrl",0x58,3,ACCR+TYPB,ACCR+TYPL,ACCW+TYPL,0,0,0), OP("shrq",0x5a,3,ACCR+TYPB,ACCR+TYPQ,ACCW+TYPQ,0,0,0), OP("sinf",0x05,0,0,0,0,0,0,0), OP("sqrtf",0x45,0,0,0,0,0,0,0), OP("std",0x27,1,ACCW+TYPD,0,0,0,0,0), OP("stf",0x26,1,ACCW+TYPF,0,0,0,0,0), OP("storer",0xbb,2,ACCR+TYPW,ACCA+TYPL,0,0,0,0), OP("suba",0x9e,2,ACCR+TYPL,ACCM+TYPL,0,0,0,0), OP("subb2",0x28,2,ACCR+TYPB,ACCM+TYPB,0,0,0,0), OP("subb3",0x38,3,ACCR+TYPB,ACCR+TYPB,ACCW+TYPB,0,0,0), OP("subd",0xd7,1,ACCR+TYPD,0,0,0,0,0), OP("subf",0xd6,1,ACCR+TYPF,0,0,0,0,0), OP("subl2",0x2c,2,ACCR+TYPL,ACCM+TYPL,0,0,0,0), OP("subl3",0x3c,3,ACCR+TYPL,ACCR+TYPL,ACCW+TYPL,0,0,0), OP("subw2",0x2a,2,ACCR+TYPW,ACCM+TYPW,0,0,0,0), OP("subw3",0x3a,3,ACCR+TYPW,ACCR+TYPW,ACCW+TYPW,0,0,0), OP("svpctx",0x70,0,0,0,0,0,0,0), OP("tstb",0x59,1,ACCR+TYPB,0,0,0,0,0), OP("tstd",0x57,0,0,0,0,0,0,0), OP("tstf",0x56,0,0,0,0,0,0,0), OP("tstl",0x5d,1,ACCR+TYPL,0,0,0,0,0), OP("tstw",0x5b,1,ACCR+TYPW,0,0,0,0,0), OP("xorb2",0xc8,2,ACCR+TYPB,ACCM+TYPB,0,0,0,0), OP("xorb3",0xd8,3,ACCR+TYPB,ACCR+TYPB,ACCW+TYPB,0,0,0), OP("xorl2",0xcc,2,ACCR+TYPL,ACCM+TYPL,0,0,0,0), OP("xorl3",0xdc,3,ACCR+TYPL,ACCR+TYPL,ACCW+TYPL,0,0,0), OP("xorw2",0xca,2,ACCR+TYPW,ACCM+TYPW,0,0,0,0), OP("xorw3",0xda,3,ACCR+TYPW,ACCR+TYPW,ACCW+TYPW,0,0,0),
M:part4a F:G$putchar$0$0({2}DF,SV:S),Z,0,0,0,0,0 F:G$getchar$0$0({2}DF,SC:S),Z,0,0,0,0,0 F:G$main$0$0({2}DF,SV:S),Z,0,0,0,0,0 F:G$SYSCLK_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0 F:G$PORT_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0 F:G$UART0_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0 F:G$ADC_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0 F:G$DAC_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0 F:G$INTERRUPT_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0 F:G$TIMER_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0 F:G$MAC_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0 S:G$start_conversion$0$0({1}SC:S),E,0,0 S:G$dig_val$0$0({2}SI:U),E,0,0 S:Lpart4a.main$adcValH$1$29({5}DA5d,SC:U),E,0,0 S:Lpart4a.main$adcValL$1$29({5}DA5d,SC:U),E,0,0 S:Lpart4a.main$result$1$29({2}SI:U),R,0,0,[r6,r7] S:Lpart4a.main$results$1$29({4}DA2d,SI:U),E,0,0 S:Lpart4a.main$analogval$1$29({2}SI:U),R,0,0,[] S:Lpart4a.main$analoghi$1$29({1}SC:U),R,0,0,[r4] S:Lpart4a.main$analoglow$1$29({1}SC:U),R,0,0,[r5] S:Lpart4a.main$VREF$1$29({4}SF:S),R,0,0,[] S:G$P0$0$0({1}SC:U),I,0,0 S:G$SP$0$0({1}SC:U),I,0,0 S:G$DPL$0$0({1}SC:U),I,0,0 S:G$DPH$0$0({1}SC:U),I,0,0 S:G$SFRPAGE$0$0({1}SC:U),I,0,0 S:G$SFRNEXT$0$0({1}SC:U),I,0,0 S:G$SFRLAST$0$0({1}SC:U),I,0,0 S:G$PCON$0$0({1}SC:U),I,0,0 S:G$P1$0$0({1}SC:U),I,0,0 S:G$P2$0$0({1}SC:U),I,0,0 S:G$IE$0$0({1}SC:U),I,0,0 S:G$P3$0$0({1}SC:U),I,0,0 S:G$PSBANK$0$0({1}SC:U),I,0,0 S:G$IP$0$0({1}SC:U),I,0,0 S:G$PSW$0$0({1}SC:U),I,0,0 S:G$ACC$0$0({1}SC:U),I,0,0 S:G$EIE1$0$0({1}SC:U),I,0,0 S:G$EIE2$0$0({1}SC:U),I,0,0 S:G$B$0$0({1}SC:U),I,0,0 S:G$EIP1$0$0({1}SC:U),I,0,0 S:G$EIP2$0$0({1}SC:U),I,0,0 S:G$WDTCN$0$0({1}SC:U),I,0,0 S:G$TCON$0$0({1}SC:U),I,0,0 S:G$TMOD$0$0({1}SC:U),I,0,0 S:G$TL0$0$0({1}SC:U),I,0,0 S:G$TL1$0$0({1}SC:U),I,0,0 S:G$TH0$0$0({1}SC:U),I,0,0 S:G$TH1$0$0({1}SC:U),I,0,0 S:G$CKCON$0$0({1}SC:U),I,0,0 S:G$PSCTL$0$0({1}SC:U),I,0,0 S:G$SSTA0$0$0({1}SC:U),I,0,0 S:G$SCON0$0$0({1}SC:U),I,0,0 S:G$SCON$0$0({1}SC:U),I,0,0 S:G$SBUF0$0$0({1}SC:U),I,0,0 S:G$SBUF$0$0({1}SC:U),I,0,0 S:G$SPI0CFG$0$0({1}SC:U),I,0,0 S:G$SPI0DAT$0$0({1}SC:U),I,0,0 S:G$SPI0CKR$0$0({1}SC:U),I,0,0 S:G$EMI0TC$0$0({1}SC:U),I,0,0 S:G$EMI0CN$0$0({1}SC:U),I,0,0 S:G$_XPAGE$0$0({1}SC:U),I,0,0 S:G$EMI0CF$0$0({1}SC:U),I,0,0 S:G$SADDR0$0$0({1}SC:U),I,0,0 S:G$FLSCL$0$0({1}SC:U),I,0,0 S:G$SADEN0$0$0({1}SC:U),I,0,0 S:G$AMX0CF$0$0({1}SC:U),I,0,0 S:G$AMX0SL$0$0({1}SC:U),I,0,0 S:G$ADC0CF$0$0({1}SC:U),I,0,0 S:G$ADC0L$0$0({1}SC:U),I,0,0 S:G$ADC0H$0$0({1}SC:U),I,0,0 S:G$SMB0CN$0$0({1}SC:U),I,0,0 S:G$SMB0STA$0$0({1}SC:U),I,0,0 S:G$SMB0DAT$0$0({1}SC:U),I,0,0 S:G$SMB0ADR$0$0({1}SC:U),I,0,0 S:G$ADC0GTL$0$0({1}SC:U),I,0,0 S:G$ADC0GTH$0$0({1}SC:U),I,0,0 S:G$ADC0LTL$0$0({1}SC:U),I,0,0 S:G$ADC0LTH$0$0({1}SC:U),I,0,0 S:G$TMR2CN$0$0({1}SC:U),I,0,0 S:G$TMR2CF$0$0({1}SC:U),I,0,0 S:G$RCAP2L$0$0({1}SC:U),I,0,0 S:G$RCAP2H$0$0({1}SC:U),I,0,0 S:G$TMR2L$0$0({1}SC:U),I,0,0 S:G$TL2$0$0({1}SC:U),I,0,0 S:G$TMR2H$0$0({1}SC:U),I,0,0 S:G$TH2$0$0({1}SC:U),I,0,0 S:G$SMB0CR$0$0({1}SC:U),I,0,0 S:G$REF0CN$0$0({1}SC:U),I,0,0 S:G$DAC0L$0$0({1}SC:U),I,0,0 S:G$DAC0H$0$0({1}SC:U),I,0,0 S:G$DAC0CN$0$0({1}SC:U),I,0,0 S:G$PCA0CN$0$0({1}SC:U),I,0,0 S:G$PCA0MD$0$0({1}SC:U),I,0,0 S:G$PCA0CPM0$0$0({1}SC:U),I,0,0 S:G$PCA0CPM1$0$0({1}SC:U),I,0,0 S:G$PCA0CPM2$0$0({1}SC:U),I,0,0 S:G$PCA0CPM3$0$0({1}SC:U),I,0,0 S:G$PCA0CPM4$0$0({1}SC:U),I,0,0 S:G$PCA0CPM5$0$0({1}SC:U),I,0,0 S:G$PCA0CPL5$0$0({1}SC:U),I,0,0 S:G$PCA0CPH5$0$0({1}SC:U),I,0,0 S:G$ADC0CN$0$0({1}SC:U),I,0,0 S:G$PCA0CPL2$0$0({1}SC:U),I,0,0 S:G$PCA0CPH2$0$0({1}SC:U),I,0,0 S:G$PCA0CPL3$0$0({1}SC:U),I,0,0 S:G$PCA0CPH3$0$0({1}SC:U),I,0,0 S:G$PCA0CPL4$0$0({1}SC:U),I,0,0 S:G$PCA0CPH4$0$0({1}SC:U),I,0,0 S:G$RSTSRC$0$0({1}SC:U),I,0,0 S:G$SPI0CN$0$0({1}SC:U),I,0,0 S:G$PCA0L$0$0({1}SC:U),I,0,0 S:G$PCA0H$0$0({1}SC:U),I,0,0 S:G$PCA0CPL0$0$0({1}SC:U),I,0,0 S:G$PCA0CPH0$0$0({1}SC:U),I,0,0 S:G$PCA0CPL1$0$0({1}SC:U),I,0,0 S:G$PCA0CPH1$0$0({1}SC:U),I,0,0 S:G$CPT0CN$0$0({1}SC:U),I,0,0 S:G$CPT0MD$0$0({1}SC:U),I,0,0 S:G$SCON1$0$0({1}SC:U),I,0,0 S:G$SBUF1$0$0({1}SC:U),I,0,0 S:G$TMR3CN$0$0({1}SC:U),I,0,0 S:G$TMR3CF$0$0({1}SC:U),I,0,0 S:G$RCAP3L$0$0({1}SC:U),I,0,0 S:G$RCAP3H$0$0({1}SC:U),I,0,0 S:G$TMR3L$0$0({1}SC:U),I,0,0 S:G$TMR3H$0$0({1}SC:U),I,0,0 S:G$DAC1L$0$0({1}SC:U),I,0,0 S:G$DAC1H$0$0({1}SC:U),I,0,0 S:G$DAC1CN$0$0({1}SC:U),I,0,0 S:G$CPT1CN$0$0({1}SC:U),I,0,0 S:G$CPT1MD$0$0({1}SC:U),I,0,0 S:G$AMX2CF$0$0({1}SC:U),I,0,0 S:G$AMX2SL$0$0({1}SC:U),I,0,0 S:G$ADC2CF$0$0({1}SC:U),I,0,0 S:G$ADC2$0$0({1}SC:U),I,0,0 S:G$ADC2GT$0$0({1}SC:U),I,0,0 S:G$ADC2LT$0$0({1}SC:U),I,0,0 S:G$TMR4CN$0$0({1}SC:U),I,0,0 S:G$TMR4CF$0$0({1}SC:U),I,0,0 S:G$RCAP4L$0$0({1}SC:U),I,0,0 S:G$RCAP4H$0$0({1}SC:U),I,0,0 S:G$TMR4L$0$0({1}SC:U),I,0,0 S:G$TMR4H$0$0({1}SC:U),I,0,0 S:G$ADC2CN$0$0({1}SC:U),I,0,0 S:G$MAC0BL$0$0({1}SC:U),I,0,0 S:G$MAC0BH$0$0({1}SC:U),I,0,0 S:G$MAC0ACC0$0$0({1}SC:U),I,0,0 S:G$MAC0ACC1$0$0({1}SC:U),I,0,0 S:G$MAC0ACC2$0$0({1}SC:U),I,0,0 S:G$MAC0ACC3$0$0({1}SC:U),I,0,0 S:G$MAC0OVR$0$0({1}SC:U),I,0,0 S:G$MAC0STA$0$0({1}SC:U),I,0,0 S:G$MAC0AL$0$0({1}SC:U),I,0,0 S:G$MAC0AH$0$0({1}SC:U),I,0,0 S:G$MAC0CF$0$0({1}SC:U),I,0,0 S:G$MAC0RNDL$0$0({1}SC:U),I,0,0 S:G$MAC0RNDH$0$0({1}SC:U),I,0,0 S:G$FLSTAT$0$0({1}SC:U),I,0,0 S:G$PLL0CN$0$0({1}SC:U),I,0,0 S:G$OSCICN$0$0({1}SC:U),I,0,0 S:G$OSCICL$0$0({1}SC:U),I,0,0 S:G$OSCXCN$0$0({1}SC:U),I,0,0 S:G$PLL0DIV$0$0({1}SC:U),I,0,0 S:G$PLL0MUL$0$0({1}SC:U),I,0,0 S:G$PLL0FLT$0$0({1}SC:U),I,0,0 S:G$SFRPGCN$0$0({1}SC:U),I,0,0 S:G$CLKSEL$0$0({1}SC:U),I,0,0 S:G$CCH0MA$0$0({1}SC:U),I,0,0 S:G$P4MDOUT$0$0({1}SC:U),I,0,0 S:G$P5MDOUT$0$0({1}SC:U),I,0,0 S:G$P6MDOUT$0$0({1}SC:U),I,0,0 S:G$P7MDOUT$0$0({1}SC:U),I,0,0 S:G$CCH0CN$0$0({1}SC:U),I,0,0 S:G$CCH0TN$0$0({1}SC:U),I,0,0 S:G$CCH0LC$0$0({1}SC:U),I,0,0 S:G$P0MDOUT$0$0({1}SC:U),I,0,0 S:G$P1MDOUT$0$0({1}SC:U),I,0,0 S:G$P2MDOUT$0$0({1}SC:U),I,0,0 S:G$P3MDOUT$0$0({1}SC:U),I,0,0 S:G$P1MDIN$0$0({1}SC:U),I,0,0 S:G$FLACL$0$0({1}SC:U),I,0,0 S:G$P4$0$0({1}SC:U),I,0,0 S:G$P5$0$0({1}SC:U),I,0,0 S:G$XBR0$0$0({1}SC:U),I,0,0 S:G$XBR1$0$0({1}SC:U),I,0,0 S:G$XBR2$0$0({1}SC:U),I,0,0 S:G$P6$0$0({1}SC:U),I,0,0 S:G$P7$0$0({1}SC:U),I,0,0 S:G$TMR0$0$0({2}SI:U),I,0,0 S:G$TMR1$0$0({2}SI:U),I,0,0 S:G$TMR2$0$0({2}SI:U),I,0,0 S:G$RCAP2$0$0({2}SI:U),I,0,0 S:G$ADC0$0$0({2}SI:U),I,0,0 S:G$ADC0GT$0$0({2}SI:U),I,0,0 S:G$ADC0LT$0$0({2}SI:U),I,0,0 S:G$DAC0$0$0({2}SI:U),I,0,0 S:G$PCA0$0$0({2}SI:U),I,0,0 S:G$PCA0CP0$0$0({2}SI:U),I,0,0 S:G$PCA0CP1$0$0({2}SI:U),I,0,0 S:G$PCA0CP2$0$0({2}SI:U),I,0,0 S:G$PCA0CP3$0$0({2}SI:U),I,0,0 S:G$PCA0CP4$0$0({2}SI:U),I,0,0 S:G$PCA0CP5$0$0({2}SI:U),I,0,0 S:G$TMR3$0$0({2}SI:U),I,0,0 S:G$RCAP3$0$0({2}SI:U),I,0,0 S:G$DAC1$0$0({2}SI:U),I,0,0 S:G$TMR4$0$0({2}SI:U),I,0,0 S:G$RCAP4$0$0({2}SI:U),I,0,0 S:G$MAC0A$0$0({2}SI:U),I,0,0 S:G$MAC0ACC$0$0({4}SL:U),I,0,0 S:G$MAC0RND$0$0({2}SI:U),I,0,0 S:G$P0_0$0$0({1}SX:U),J,0,0 S:G$P0_1$0$0({1}SX:U),J,0,0 S:G$P0_2$0$0({1}SX:U),J,0,0 S:G$P0_3$0$0({1}SX:U),J,0,0 S:G$P0_4$0$0({1}SX:U),J,0,0 S:G$P0_5$0$0({1}SX:U),J,0,0 S:G$P0_6$0$0({1}SX:U),J,0,0 S:G$P0_7$0$0({1}SX:U),J,0,0 S:G$IT0$0$0({1}SX:U),J,0,0 S:G$IE0$0$0({1}SX:U),J,0,0 S:G$IT1$0$0({1}SX:U),J,0,0 S:G$IE1$0$0({1}SX:U),J,0,0 S:G$TR0$0$0({1}SX:U),J,0,0 S:G$TF0$0$0({1}SX:U),J,0,0 S:G$TR1$0$0({1}SX:U),J,0,0 S:G$TF1$0$0({1}SX:U),J,0,0 S:G$CP0HYN0$0$0({1}SX:U),J,0,0 S:G$CP0HYN1$0$0({1}SX:U),J,0,0 S:G$CP0HYP0$0$0({1}SX:U),J,0,0 S:G$CP0HYP1$0$0({1}SX:U),J,0,0 S:G$CP0FIF$0$0({1}SX:U),J,0,0 S:G$CP0RIF$0$0({1}SX:U),J,0,0 S:G$CP0OUT$0$0({1}SX:U),J,0,0 S:G$CP0EN$0$0({1}SX:U),J,0,0 S:G$CP1HYN0$0$0({1}SX:U),J,0,0 S:G$CP1HYN1$0$0({1}SX:U),J,0,0 S:G$CP1HYP0$0$0({1}SX:U),J,0,0 S:G$CP1HYP1$0$0({1}SX:U),J,0,0 S:G$CP1FIF$0$0({1}SX:U),J,0,0 S:G$CP1RIF$0$0({1}SX:U),J,0,0 S:G$CP1OUT$0$0({1}SX:U),J,0,0 S:G$CP1EN$0$0({1}SX:U),J,0,0 S:G$FLHBUSY$0$0({1}SX:U),J,0,0 S:G$P1_0$0$0({1}SX:U),J,0,0 S:G$P1_1$0$0({1}SX:U),J,0,0 S:G$P1_2$0$0({1}SX:U),J,0,0 S:G$P1_3$0$0({1}SX:U),J,0,0 S:G$P1_4$0$0({1}SX:U),J,0,0 S:G$P1_5$0$0({1}SX:U),J,0,0 S:G$P1_6$0$0({1}SX:U),J,0,0 S:G$P1_7$0$0({1}SX:U),J,0,0 S:G$RI0$0$0({1}SX:U),J,0,0 S:G$RI$0$0({1}SX:U),J,0,0 S:G$TI0$0$0({1}SX:U),J,0,0 S:G$TI$0$0({1}SX:U),J,0,0 S:G$RB80$0$0({1}SX:U),J,0,0 S:G$TB80$0$0({1}SX:U),J,0,0 S:G$REN0$0$0({1}SX:U),J,0,0 S:G$REN$0$0({1}SX:U),J,0,0 S:G$SM20$0$0({1}SX:U),J,0,0 S:G$SM10$0$0({1}SX:U),J,0,0 S:G$SM00$0$0({1}SX:U),J,0,0 S:G$RI1$0$0({1}SX:U),J,0,0 S:G$TI1$0$0({1}SX:U),J,0,0 S:G$RB81$0$0({1}SX:U),J,0,0 S:G$TB81$0$0({1}SX:U),J,0,0 S:G$REN1$0$0({1}SX:U),J,0,0 S:G$MCE1$0$0({1}SX:U),J,0,0 S:G$S1MODE$0$0({1}SX:U),J,0,0 S:G$P2_0$0$0({1}SX:U),J,0,0 S:G$P2_1$0$0({1}SX:U),J,0,0 S:G$P2_2$0$0({1}SX:U),J,0,0 S:G$P2_3$0$0({1}SX:U),J,0,0 S:G$P2_4$0$0({1}SX:U),J,0,0 S:G$P2_5$0$0({1}SX:U),J,0,0 S:G$P2_6$0$0({1}SX:U),J,0,0 S:G$P2_7$0$0({1}SX:U),J,0,0 S:G$EX0$0$0({1}SX:U),J,0,0 S:G$ET0$0$0({1}SX:U),J,0,0 S:G$EX1$0$0({1}SX:U),J,0,0 S:G$ET1$0$0({1}SX:U),J,0,0 S:G$ES0$0$0({1}SX:U),J,0,0 S:G$ES$0$0({1}SX:U),J,0,0 S:G$ET2$0$0({1}SX:U),J,0,0 S:G$EA$0$0({1}SX:U),J,0,0 S:G$P3_0$0$0({1}SX:U),J,0,0 S:G$P3_1$0$0({1}SX:U),J,0,0 S:G$P3_2$0$0({1}SX:U),J,0,0 S:G$P3_3$0$0({1}SX:U),J,0,0 S:G$P3_4$0$0({1}SX:U),J,0,0 S:G$P3_5$0$0({1}SX:U),J,0,0 S:G$P3_6$0$0({1}SX:U),J,0,0 S:G$P3_7$0$0({1}SX:U),J,0,0 S:G$PX0$0$0({1}SX:U),J,0,0 S:G$PT0$0$0({1}SX:U),J,0,0 S:G$PX1$0$0({1}SX:U),J,0,0 S:G$PT1$0$0({1}SX:U),J,0,0 S:G$PS0$0$0({1}SX:U),J,0,0 S:G$PS$0$0({1}SX:U),J,0,0 S:G$PT2$0$0({1}SX:U),J,0,0 S:G$SMBTOE$0$0({1}SX:U),J,0,0 S:G$SMBFTE$0$0({1}SX:U),J,0,0 S:G$AA$0$0({1}SX:U),J,0,0 S:G$SI$0$0({1}SX:U),J,0,0 S:G$STO$0$0({1}SX:U),J,0,0 S:G$STA$0$0({1}SX:U),J,0,0 S:G$ENSMB$0$0({1}SX:U),J,0,0 S:G$BUSY$0$0({1}SX:U),J,0,0 S:G$MAC0N$0$0({1}SX:U),J,0,0 S:G$MAC0SO$0$0({1}SX:U),J,0,0 S:G$MAC0Z$0$0({1}SX:U),J,0,0 S:G$MAC0HO$0$0({1}SX:U),J,0,0 S:G$CPRL2$0$0({1}SX:U),J,0,0 S:G$CT2$0$0({1}SX:U),J,0,0 S:G$TR2$0$0({1}SX:U),J,0,0 S:G$EXEN2$0$0({1}SX:U),J,0,0 S:G$EXF2$0$0({1}SX:U),J,0,0 S:G$TF2$0$0({1}SX:U),J,0,0 S:G$CPRL3$0$0({1}SX:U),J,0,0 S:G$CT3$0$0({1}SX:U),J,0,0 S:G$TR3$0$0({1}SX:U),J,0,0 S:G$EXEN3$0$0({1}SX:U),J,0,0 S:G$EXF3$0$0({1}SX:U),J,0,0 S:G$TF3$0$0({1}SX:U),J,0,0 S:G$CPRL4$0$0({1}SX:U),J,0,0 S:G$CT4$0$0({1}SX:U),J,0,0 S:G$TR4$0$0({1}SX:U),J,0,0 S:G$EXEN4$0$0({1}SX:U),J,0,0 S:G$EXF4$0$0({1}SX:U),J,0,0 S:G$TF4$0$0({1}SX:U),J,0,0 S:G$P4_0$0$0({1}SX:U),J,0,0 S:G$P4_1$0$0({1}SX:U),J,0,0 S:G$P4_2$0$0({1}SX:U),J,0,0 S:G$P4_3$0$0({1}SX:U),J,0,0 S:G$P4_4$0$0({1}SX:U),J,0,0 S:G$P4_5$0$0({1}SX:U),J,0,0 S:G$P4_6$0$0({1}SX:U),J,0,0 S:G$P4_7$0$0({1}SX:U),J,0,0 S:G$P$0$0({1}SX:U),J,0,0 S:G$F1$0$0({1}SX:U),J,0,0 S:G$OV$0$0({1}SX:U),J,0,0 S:G$RS0$0$0({1}SX:U),J,0,0 S:G$RS1$0$0({1}SX:U),J,0,0 S:G$F0$0$0({1}SX:U),J,0,0 S:G$AC$0$0({1}SX:U),J,0,0 S:G$CY$0$0({1}SX:U),J,0,0 S:G$CCF0$0$0({1}SX:U),J,0,0 S:G$CCF1$0$0({1}SX:U),J,0,0 S:G$CCF2$0$0({1}SX:U),J,0,0 S:G$CCF3$0$0({1}SX:U),J,0,0 S:G$CCF4$0$0({1}SX:U),J,0,0 S:G$CCF5$0$0({1}SX:U),J,0,0 S:G$CR$0$0({1}SX:U),J,0,0 S:G$CF$0$0({1}SX:U),J,0,0 S:G$P5_0$0$0({1}SX:U),J,0,0 S:G$P5_1$0$0({1}SX:U),J,0,0 S:G$P5_2$0$0({1}SX:U),J,0,0 S:G$P5_3$0$0({1}SX:U),J,0,0 S:G$P5_4$0$0({1}SX:U),J,0,0 S:G$P5_5$0$0({1}SX:U),J,0,0 S:G$P5_6$0$0({1}SX:U),J,0,0 S:G$P5_7$0$0({1}SX:U),J,0,0 S:G$AD0LJST$0$0({1}SX:U),J,0,0 S:G$AD0WINT$0$0({1}SX:U),J,0,0 S:G$AD0CM0$0$0({1}SX:U),J,0,0 S:G$AD0CM1$0$0({1}SX:U),J,0,0 S:G$AD0BUSY$0$0({1}SX:U),J,0,0 S:G$AD0INT$0$0({1}SX:U),J,0,0 S:G$AD0TM$0$0({1}SX:U),J,0,0 S:G$AD0EN$0$0({1}SX:U),J,0,0 S:G$AD2WINT$0$0({1}SX:U),J,0,0 S:G$AD2CM0$0$0({1}SX:U),J,0,0 S:G$AD2CM1$0$0({1}SX:U),J,0,0 S:G$AD2CM2$0$0({1}SX:U),J,0,0 S:G$AD2BUSY$0$0({1}SX:U),J,0,0 S:G$AD2INT$0$0({1}SX:U),J,0,0 S:G$AD2TM$0$0({1}SX:U),J,0,0 S:G$AD2EN$0$0({1}SX:U),J,0,0 S:G$P6_0$0$0({1}SX:U),J,0,0 S:G$P6_1$0$0({1}SX:U),J,0,0 S:G$P6_2$0$0({1}SX:U),J,0,0 S:G$P6_3$0$0({1}SX:U),J,0,0 S:G$P6_4$0$0({1}SX:U),J,0,0 S:G$P6_5$0$0({1}SX:U),J,0,0 S:G$P6_6$0$0({1}SX:U),J,0,0 S:G$P6_7$0$0({1}SX:U),J,0,0 S:G$SPIEN$0$0({1}SX:U),J,0,0 S:G$TXBMT$0$0({1}SX:U),J,0,0 S:G$NSSMD0$0$0({1}SX:U),J,0,0 S:G$NSSMD1$0$0({1}SX:U),J,0,0 S:G$RXOVRN$0$0({1}SX:U),J,0,0 S:G$MODF$0$0({1}SX:U),J,0,0 S:G$WCOL$0$0({1}SX:U),J,0,0 S:G$SPIF$0$0({1}SX:U),J,0,0 S:G$P7_0$0$0({1}SX:U),J,0,0 S:G$P7_1$0$0({1}SX:U),J,0,0 S:G$P7_2$0$0({1}SX:U),J,0,0 S:G$P7_3$0$0({1}SX:U),J,0,0 S:G$P7_4$0$0({1}SX:U),J,0,0 S:G$P7_5$0$0({1}SX:U),J,0,0 S:G$P7_6$0$0({1}SX:U),J,0,0 S:G$P7_7$0$0({1}SX:U),J,0,0 S:G$_print_format$0$0({2}DF,SI:S),C,0,0 S:G$printf_small$0$0({2}DF,SV:S),C,0,0 S:G$printf$0$0({2}DF,SI:S),C,0,0 S:G$vprintf$0$0({2}DF,SI:S),C,0,0 S:G$sprintf$0$0({2}DF,SI:S),C,0,0 S:G$vsprintf$0$0({2}DF,SI:S),C,0,0 S:G$puts$0$0({2}DF,SI:S),C,0,0 S:G$gets$0$0({2}DF,DG,SC:S),C,0,0 S:G$printf_fast$0$0({2}DF,SV:S),C,0,0 S:G$printf_fast_f$0$0({2}DF,SV:S),C,0,0 S:G$printf_tiny$0$0({2}DF,SV:S),C,0,0
with Node; use Node; package Sender is task type SenderTask(firstNode: pNodeObj; k: Natural; h: Natural); type pSenderTask is access SenderTask; end Sender;
-- Copyright 2012-2021 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with System; package Pck is type Color is (Black, Red, Green, Blue, White); type Strength is (None, Low, Medium, High); type Short is new Natural range 0 .. 2 ** 8 - 1; type Full_Table is array (Color) of Boolean; pragma Pack (Full_Table); subtype Primary_Color is Color range Red .. Blue; type Primary_Table is array (Primary_Color) of Boolean; pragma Pack (Primary_Table); type Cold_Color is new Color range Green .. Blue; type Cold_Table is array (Cold_Color) of Boolean; pragma Pack (Cold_Table); type Small_Table is array (Color range <>) of Boolean; pragma Pack (Small_Table); function New_Small_Table (Low: Color; High: Color) return Small_Table; type Multi_Table is array (Color range <>, Strength range <>) of Boolean; pragma Pack (Multi_Table); function New_Multi_Table (Low, High: Color; LS, HS: Strength) return Multi_Table; type Multi_Multi_Table is array (Positive range <>, Positive range <>, Positive range <>) of Boolean; pragma Pack (Multi_Multi_Table); function New_Multi_Multi_Table (L1, H1, L2, H2, L3, H3: Positive) return Multi_Multi_Table; type Multi_Dimension is array (Boolean, Color) of Short; pragma Pack (Multi_Dimension); type Multi_Dimension_Access is access all Multi_Dimension; type My_Enum is (Blue, Red, Green); type My_Array_Type is array (My_Enum) of Integer; type Confused_Array_Type is array (Color) of My_Array_Type; procedure Do_Nothing (A : System.Address); end Pck;
with sys_h; private with mouse_types_h, console_types_h; package Libtcod.Input is use type sys_h.TCOD_event_t; type Mouse is private; type Key is private; -- A kind of event subtype Event_Type is sys_h.TCOD_event_t; Event_None : constant Event_Type := sys_h.TCOD_EVENT_NONE; Event_Key_Press : constant Event_Type := sys_h.TCOD_EVENT_KEY_PRESS; Event_Key_Release : constant Event_Type := sys_h.TCOD_EVENT_KEY_RELEASE; Event_Key : constant Event_Type := sys_h.TCOD_EVENT_KEY; Event_Mouse_Move : constant Event_Type := sys_h.TCOD_EVENT_MOUSE_MOVE; Event_Mouse_Press : constant Event_Type := sys_h.TCOD_EVENT_MOUSE_PRESS; Event_Mouse_Release : constant Event_Type := sys_h.TCOD_EVENT_MOUSE_RELEASE; Event_Mouse : constant Event_Type := sys_h.TCOD_EVENT_MOUSE; Event_Finger_Move : constant Event_Type := sys_h.TCOD_EVENT_FINGER_MOVE; Event_Finger_Press : constant Event_Type := sys_h.TCOD_EVENT_FINGER_PRESS; Event_Finger_Release : constant Event_Type := sys_h.TCOD_EVENT_FINGER_RELEASE; Event_Finger : constant Event_Type := sys_h.TCOD_EVENT_FINGER; Event_Any : constant Event_Type := sys_h.TCOD_EVENT_ANY; -- A kind of keypress type Key_Type is (Key_None, Key_Escape, Key_Backspace, Key_Tab, Key_Enter, -- Modifiers Key_Shift, Key_Control, Key_Alt, Key_Pause, Key_Capslock, Key_Pageup, Key_Pagedown, Key_End, Key_Home, -- Arrows Key_Up, Key_Left, Key_Right, Key_Down, Key_Printscreen, Key_Insert, Key_Delete, Key_Lwin, Key_Rwin, Key_Apps, -- Digits Key_0, Key_1, Key_2, Key_3, Key_4, Key_5, Key_6, Key_7, Key_8, Key_9, -- Keypad Digits Key_Kp0, Key_Kp1, Key_Kp2, Key_Kp3, Key_Kp4, Key_Kp5, Key_Kp6, Key_Kp7, Key_Kp8, Key_Kp9, -- Keypad Operators Key_Kpadd, Key_Kpsub, Key_Kpdiv, Key_Kpmul, Key_Kpdec, Key_Kpenter, -- Function keys Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10, Key_F11, Key_F12, Key_Numlock, Key_Scrolllock, Key_Space, Key_Char, -- (note: use Key_Text, then get_char to get characters that respect -- holding shift) Key_Text) with Convention => C; subtype Arrow_Key_Type is Key_Type range Key_Up .. Key_Down; subtype Function_Key_Type is Key_Type range Key_F1 .. Key_F12; subtype Whitespace_Key_Type is Key_Type with Static_Predicate => Whitespace_Key_Type in Key_Tab | Key_Enter | Key_Space; function get_key_type(k : Key) return Key_Type with Inline; -- Note: get_char assumes that the current Key's Key_Type is Key_Text function get_char(k : Key) return Character with Inline; function alt(k : Key) return Boolean with Inline; function ctrl(k : Key) return Boolean with Inline; function meta(k : Key) return Boolean with Inline; function shift(k : Key) return Boolean with Inline; function check_for_event(kind : Event_Type; k : aliased out Key) return Event_Type with Inline; function check_for_event(kind : Event_Type; m : aliased out Mouse; k : aliased out Key) return Event_Type with Inline; private type Mouse is new mouse_types_h.TCOD_mouse_t; type Key is new console_types_h.TCOD_key_t; end Libtcod.Input;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- G N A T . M B B S _ D I S C R E T E _ R A N D O M -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2019, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- The implementation used in this package was contributed by Robert -- Eachus. It is based on the work of L. Blum, M. Blum, and M. Shub, SIAM -- Journal of Computing, Vol 15. No 2, May 1986. The particular choices for P -- and Q chosen here guarantee a period of 562,085,314,430,582 (about 2**49), -- and the generated sequence has excellent randomness properties. For further -- details, see the paper "Fast Generation of Trustworthy Random Numbers", by -- Robert Eachus, which describes both the algorithm and the efficient -- implementation approach used here. -- Formerly, this package was Ada.Numerics.Discrete_Random. It is retained -- here in part to allow users to reconstruct number sequences generated -- by previous versions. with Interfaces; generic type Result_Subtype is (<>); package GNAT.MBBS_Discrete_Random is -- The algorithm used here is reliable from a required statistical point of -- view only up to 48 bits. We try to behave reasonably in the case of -- larger types, but we can't guarantee the required properties. So -- generate a warning for these (slightly) dubious cases. pragma Compile_Time_Warning (Result_Subtype'Size > 48, "statistical properties not guaranteed for size > 48"); -- Basic facilities type Generator is limited private; function Random (Gen : Generator) return Result_Subtype; procedure Reset (Gen : Generator); procedure Reset (Gen : Generator; Initiator : Integer); -- Advanced facilities type State is private; procedure Save (Gen : Generator; To_State : out State); procedure Reset (Gen : Generator; From_State : State); Max_Image_Width : constant := 80; function Image (Of_State : State) return String; function Value (Coded_State : String) return State; private subtype Int is Interfaces.Integer_32; subtype Rst is Result_Subtype; -- We prefer to use 14 digits for Flt, but some targets are more limited type Flt is digits Positive'Min (14, Long_Long_Float'Digits); RstF : constant Flt := Flt (Rst'Pos (Rst'First)); RstL : constant Flt := Flt (Rst'Pos (Rst'Last)); Offs : constant Flt := RstF - 0.5; K1 : constant := 94_833_359; K1F : constant := 94_833_359.0; K2 : constant := 47_416_679; K2F : constant := 47_416_679.0; Scal : constant Flt := (RstL - RstF + 1.0) / (K1F * K2F); type State is record X1 : Int := Int (2999 ** 2); X2 : Int := Int (1439 ** 2); P : Int := K1; Q : Int := K2; FP : Flt := K1F; Scl : Flt := Scal; end record; type Writable_Access (Self : access Generator) is limited null record; -- Auxiliary type to make Generator a self-referential type type Generator is limited record Writable : Writable_Access (Generator'Access); -- This self reference allows functions to modify Generator arguments Gen_State : State; end record; end GNAT.MBBS_Discrete_Random;
with ada.Strings.Unbounded, utils, montecarlo, ada.Integer_Text_IO, opstrat; use ada.Strings.Unbounded, utils, montecarlo, ada.Integer_Text_IO, opstrat; package botIO is type T_prefix is (settings, update_game, update_hand, action); type T_params is Array(0..7) of Unbounded_String; type T_command is record prefix : T_prefix; pars : T_params; size : Integer; end record; --Decoupe une chaine envoyee par le launcher au niveau des espaces et des guillements, et renvoie une commande function splitLine(line : String; line_length : Integer) return T_command; --Permet d'interpreter des commandes de type settings, update_game et update_hand procedure readSettings(command : T_command; game : in out T_game); procedure readUpdateGame(command : T_command; game : in out T_game); procedure readUpdateHand(command : T_command; game : in out T_game; logic : in out T_logic); --Affiche la valeur et la couleur d'une carte dans la console (sert a debugger) procedure printCard(card : in T_card); --Permet de lire une carte selon le formalisme du launcher function parseCard(str : in String) return T_card; end botIO;
-- { dg-do compile } -- { dg-options "-gnatws" } procedure Pack6 is type R is record I : Integer; a, b, c, d, e : Character; end record; type Ar1 is array (1..4) of R; type Ar2 is array (1..4) of R; pragma Pack (Ar2); type R2 is record A : Ar2; end record; for R2 use record A at 0 range 0 .. 72*4-1; end record; X : Ar1; Y : Ar2; begin Y (1) := X (1); end;
with AUnit.Simple_Test_Cases; use AUnit.Simple_Test_Cases; with Test_Find_And_Replacer; use Test_Find_And_Replacer; with Test_Indentation; use Test_Indentation; with Test_Match_Patterns; use Test_Match_Patterns; with Test_Match_Patterns_Eagerness; use Test_Match_Patterns_Eagerness; with Test_Match_Patterns_Placeholders; use Test_Match_Patterns_Placeholders; with Test_Navigation; use Test_Navigation; with Test_Placeholders; use Test_Placeholders; with Test_Replacer; use Test_Replacer; with Test_Nested; use Test_Nested; with Test_String_Utils; use Test_String_Utils; with Test_Text_Rewrites; use Test_Text_Rewrites; package body Rejuvenation_Lib_Suite is function Suite return Access_Test_Suite is Ret : constant Access_Test_Suite := new Test_Suite; Find_And_Replacer : constant Test_Case_Access := new Find_And_Replacer_Test_Case; Indentation : constant Test_Case_Access := new Indentation_Test_Case; Match_Patterns : constant Test_Case_Access := new Match_Patterns_Test_Case; Match_Patterns_Eagerness : constant Test_Case_Access := new Match_Patterns_Eagerness_Test_Case; Match_Patterns_Placeholders : constant Test_Case_Access := new Match_Patterns_Placeholders_Test_Case; Navigation : constant Test_Case_Access := new Navigation_Test_Case; Placeholders : constant Test_Case_Access := new Placeholders_Test_Case; Replacer : constant Test_Case_Access := new Replacer_Test_Case; Nested : constant Test_Case_Access := new Nested_Test_Case; String_Utils : constant Test_Case_Access := new String_Utils_Test_Case; Rewrites : constant Test_Case_Access := new Text_Rewrite_Test_Case; begin Ret.Add_Test (Find_And_Replacer); Ret.Add_Test (Indentation); Ret.Add_Test (Match_Patterns); Ret.Add_Test (Match_Patterns_Eagerness); Ret.Add_Test (Match_Patterns_Placeholders); Ret.Add_Test (Navigation); Ret.Add_Test (Placeholders); Ret.Add_Test (Replacer); Ret.Add_Test (Nested); Ret.Add_Test (String_Utils); Ret.Add_Test (Rewrites); return Ret; end Suite; end Rejuvenation_Lib_Suite;
package reg is type Word is mod 2**32; RCC_CR : Word; pragma Volatile (RCC_CR); pragma Import (C, RCC_CR, "RCC_CR"); RCC_AHB1ENR : Word; pragma Volatile (RCC_AHB1ENR); pragma Import (C, RCC_AHB1ENR, "RCC_AHB1ENR"); RCC_AHB2ENR : Word; pragma Volatile (RCC_AHB2ENR); pragma Import (C, RCC_AHB2ENR, "RCC_AHB2ENR"); GPIOA_MODER : Word; pragma Volatile (GPIOA_MODER); pragma Import (C, GPIOA_MODER, "GPIOA_MODER"); GPIOA_PUPDR : Word; pragma Volatile (GPIOA_PUPDR); pragma Import (C, GPIOA_PUPDR, "GPIOA_PUPDR"); GPIOA_IDR : Word; pragma Volatile (GPIOA_IDR); pragma Import (C, GPIOA_IDR, "GPIOA_IDR"); GPIOA_BSRR : Word; pragma Volatile (GPIOA_BSRR); pragma Import (C, GPIOA_BSRR, "GPIOA_BSRR"); GPIOD_MODER : Word; pragma Volatile (GPIOD_MODER); pragma Import (C, GPIOD_MODER, "GPIOD_MODER"); GPIOD_PUPDR : Word; pragma Volatile (GPIOD_PUPDR); pragma Import (C, GPIOD_PUPDR, "GPIOD_PUPDR"); GPIOD_IDR : Word; pragma Volatile (GPIOD_IDR); pragma Import (C, GPIOD_IDR, "GPIOD_IDR"); GPIOD_BSRR : Word; pragma Volatile (GPIOD_BSRR); pragma Import (C, GPIOD_BSRR, "GPIOD_BSRR"); GPIOE_MODER : Word; pragma Volatile (GPIOE_MODER); pragma Import (C, GPIOE_MODER, "GPIOE_MODER"); GPIOE_PUPDR : Word; pragma Volatile (GPIOE_PUPDR); pragma Import (C, GPIOE_PUPDR, "GPIOE_PUPDR"); GPIOE_IDR : Word; pragma Volatile (GPIOE_IDR); pragma Import (C, GPIOE_IDR, "GPIOE_IDR"); GPIOE_BSRR : Word; pragma Volatile (GPIOE_BSRR); pragma Import (C, GPIOE_BSRR, "GPIOE_BSRR"); GPIOF_MODER : Word; pragma Volatile (GPIOF_MODER); pragma Import (C, GPIOF_MODER, "GPIOF_MODER"); GPIOF_PUPDR : Word; pragma Volatile (GPIOF_PUPDR); pragma Import (C, GPIOF_PUPDR, "GPIOF_PUPDR"); GPIOF_IDR : Word; pragma Volatile (GPIOF_IDR); pragma Import (C, GPIOF_IDR, "GPIOF_IDR"); GPIOF_BSRR : Word; pragma Volatile (GPIOF_BSRR); pragma Import (C, GPIOF_BSRR, "GPIOF_BSRR"); RNG_CR : Word; pragma Volatile (RNG_CR); pragma Import (C, RNG_CR, "RNG_CR"); RNG_SR : Word; pragma Volatile (RNG_SR); pragma Import (C, RNG_SR, "RNG_SR"); RNG_DR : Word; pragma Volatile (RNG_DR); pragma Import (C, RNG_DR, "RNG_DR"); end reg;
-- -- Copyright 2021 (C) Jeremy Grosser <jeremy@synack.me> -- -- SPDX-License-Identifier: BSD-3-Clause -- package body DS3231 is use HAL.Real_Time_Clock; use HAL; procedure Read_All (This : DS3231_Device; Val : out All_Registers) is use HAL.I2C; Data : constant I2C_Data (1 .. 1) := (1 => 16#00#); Status : I2C_Status; begin -- Set the read address to zero This.I2C_Port.Master_Transmit (This.I2C_Address, Data, Status); if Status /= Ok then raise DS3231_Error with "Failed to set register address"; end if; This.I2C_Port.Master_Receive (This.I2C_Address, Val, Status); if Status /= Ok then raise DS3231_Error with "Failed to read register values"; end if; end Read_All; function To_Integer (BCD : HAL.UInt8) return Integer is N : constant Integer := Integer (BCD and 16#F#) + (Integer (Shift_Right (BCD, 4)) * 10); begin return N; end To_Integer; function To_BCD (N : Integer) return HAL.UInt8 is (Shift_Left (UInt8 (N / 10), 4) or UInt8 (N mod 10)); overriding procedure Set (This : in out DS3231_Device; Time : RTC_Time; Date : RTC_Date) is use HAL.I2C; Val : All_Registers := (others => 0); Data : I2C_Data (1 .. 2) := (0, 0); Status : I2C_Status; begin Val (0) := To_BCD (Integer (Time.Sec)); Val (1) := To_BCD (Integer (Time.Min)); Val (2) := To_BCD (Integer (Time.Hour)); Val (3) := UInt8 (RTC_Day_Of_Week'Pos (Date.Day_Of_Week)); Val (4) := To_BCD (Integer (Date.Day)); Val (5) := To_BCD (RTC_Month'Pos (Date.Month)); Val (6) := To_BCD (Integer (Date.Year)); -- Alarm registers exist here, but we don't use them. -- Overwrite the control register with default values Val (16#0E#) := 2#00011100#; for I in Val'Range loop Data := (UInt8 (I), Val (I)); This.I2C_Port.Master_Transmit (This.I2C_Address, Data, Status); if Status /= Ok then raise DS3231_Error with "Failed to set register values"; end if; end loop; end Set; overriding procedure Get (This : in out DS3231_Device; Time : out RTC_Time; Date : out RTC_Date) is Val : All_Registers; N : Integer; begin -- If there's anything wrong with the I2C interface or RTC, there's a -- good chance we'll throw Constraint_Error here. Read_All (This, Val); Time.Sec := RTC_Second (To_Integer (Val (16#00#))); Time.Min := RTC_Minute (To_Integer (Val (16#01#))); Time.Hour := RTC_Hour (To_Integer (Val (16#02#))); Date.Day := RTC_Day (To_Integer (Val (16#04#))); -- Sometimes the RTC returns Day and Month as 0 right after power on. -- These conditionals paper over that rather than throwing an exception -- on the first read. N := Integer (Val (16#03#)); if N not in 1 .. 7 then Date.Day_Of_Week := RTC_Day_Of_Week'First; else Date.Day_Of_Week := RTC_Day_Of_Week'Val (N); end if; N := Integer (Val (16#05#) and 16#7F#); if N not in 1 .. 31 then Date.Month := RTC_Month'First; else Date.Month := RTC_Month'Val (N); end if; Date.Year := RTC_Year (To_Integer (Val (16#06#))); end Get; overriding function Get_Time (This : DS3231_Device) return RTC_Time is Val : All_Registers; Time : RTC_Time; begin Read_All (This, Val); Time.Sec := RTC_Second (To_Integer (Val (16#00#))); Time.Min := RTC_Minute (To_Integer (Val (16#01#))); Time.Hour := RTC_Hour (To_Integer (Val (16#02#))); return Time; end Get_Time; overriding function Get_Date (This : DS3231_Device) return RTC_Date is Val : All_Registers; Date : RTC_Date; begin Read_All (This, Val); Date.Day := RTC_Day (To_Integer (Val (16#04#))); Date.Day_Of_Week := RTC_Day_Of_Week'Val (Integer (Val (16#03#))); Date.Month := RTC_Month'Val (To_Integer (Val (16#05#) and 16#7F#)); Date.Year := RTC_Year (To_Integer (Val (16#06#))); return Date; end Get_Date; end DS3231;
-- SPDX-FileCopyrightText: 2021 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package body Network.Polls is use type Interfaces.C.int; use type Interfaces.Unsigned_32; EPOLL_CLOEXEC : constant := 8#02000000#; pragma Warnings (Off); EPOLLIN : constant := 16#001#; EPOLLPRI : constant := 16#002#; EPOLLOUT : constant := 16#004#; EPOLLRDNORM : constant := 16#040#; EPOLLRDBAND : constant := 16#080#; EPOLLWRNORM : constant := 16#100#; EPOLLWRBAND : constant := 16#200#; EPOLLMSG : constant := 16#400#; EPOLLERR : constant := 16#008#; EPOLLHUP : constant := 16#010#; EPOLLRDHUP : constant := 16#2000#; -- EPOLLEXCLUSIVE = 1u << 28, EPOLLEXCLUSIVE : constant := 16#1000_0000#; -- EPOLLWAKEUP = 1u << 29, EPOLLWAKEUP : constant := 16#2000_0000#; -- EPOLLONESHOT = 1u << 30, EPOLLONESHOT : constant := 16#4000_0000#; -- EPOLLET = 1u << 31 EPOLLET : constant := 16#8000_0000#; EPOLL_CTL_ADD : constant := 1; EPOLL_CTL_DEL : constant := 2; EPOLL_CTL_MOD : constant := 3; pragma Warnings (On); function epoll_create1 (Flag : Interfaces.C.int) return Interfaces.C.int with Import, Convention => C, External_Name => "epoll_create1"; type epoll_event is record events : Interfaces.Unsigned_32; data : Listener_Access; end record with Convention => C, Pack; function epoll_ctl (epfd : Interfaces.C.int; op : Interfaces.C.int; fd : Interfaces.C.int; event : epoll_event) return Interfaces.C.int with Import, Convention => C, External_Name => "epoll_ctl"; type epoll_event_array is array (Positive range <>) of epoll_event; function epoll_wait (epfd : Interfaces.C.int; events : out epoll_event_array; maxevents : Interfaces.C.int := 1; timeout : Interfaces.C.int) return Interfaces.C.int with Import, Convention => C, External_Name => "epoll_wait"; Map : constant array (Event) of Interfaces.Unsigned_32 := (Input => EPOLLIN, Output => EPOLLOUT, Error => EPOLLERR, Close => EPOLLHUP); function To_Int (Set : Event_Set) return Interfaces.Unsigned_32; ------------------ -- Change_Watch -- ------------------ procedure Change_Watch (Self : in out Poll'Class; Events : Event_Set; Value : FD; Listener : Listener_Access) is Op : constant Interfaces.C.int := (if Events = (Event_Set'Range => False) then EPOLL_CTL_DEL else EPOLL_CTL_MOD); Data : constant epoll_event := (To_Int (Events), Listener); Result : constant Interfaces.C.int := epoll_ctl (Self.Internal, Op, Value, Data); begin pragma Assert (Result = 0); if Op = EPOLL_CTL_DEL then Self.Count := Self.Count - 1; end if; end Change_Watch; -------------- -- Finalize -- -------------- overriding procedure Finalize (Self : in out Poll) is procedure close (Value : FD) with Import, Convention => C, External_Name => "close"; begin if Self.Is_Initialized then close (Self.Internal); Self.Internal := 0; end if; end Finalize; ---------------- -- Initialize -- ---------------- procedure Initialize (Self : out Poll'Class) is begin Self.Count := 0; Self.Internal := epoll_create1 (EPOLL_CLOEXEC); end Initialize; -------------------- -- Is_Initialized -- -------------------- function Is_Initialized (Self : Poll'Class) return Boolean is begin return Self.Internal /= 0; end Is_Initialized; ------------ -- To_Int -- ------------ function To_Int (Set : Event_Set) return Interfaces.Unsigned_32 is All_Events : Interfaces.Unsigned_32 := 0; begin for J in Set'Range loop if Set (J) then All_Events := All_Events + Map (J); end if; end loop; return All_Events; end To_Int; ---------- -- Wait -- ---------- procedure Wait (Self : in out Poll'Class; Timeout : Duration) is function To_Set (X : Interfaces.Unsigned_32) return Event_Set; ------------ -- To_Set -- ------------ function To_Set (X : Interfaces.Unsigned_32) return Event_Set is Result : Event_Set; begin for J in Result'Range loop Result (J) := (X and Map (J)) /= 0; end loop; return Result; end To_Set; Data : epoll_event_array (1 .. Self.Count); begin if Self.Count = 0 then delay Timeout; return; end if; declare Result : constant Interfaces.C.int := epoll_wait (epfd => Self.Internal, events => Data, maxevents => Data'Length, timeout => Interfaces.C.int (1000 * Timeout)); begin pragma Assert (Result >= 0); for X of Data (1 .. Natural (Result)) loop X.data.On_Event (To_Set (X.events)); end loop; end; end Wait; ----------- -- Watch -- ----------- procedure Watch (Self : in out Poll'Class; Value : FD; Events : Event_Set; Listener : Listener_Access) is Data : constant epoll_event := (To_Int (Events), Listener); Result : constant Interfaces.C.int := epoll_ctl (Self.Internal, EPOLL_CTL_ADD, Value, Data); begin pragma Assert (Result = 0); Self.Count := Self.Count + 1; end Watch; end Network.Polls;
------------------------------------------------------------------------------- -- 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.Assertions; use AUnit.Assertions; with Keccak.Types; package body Sponge_Tests is procedure Set_Up(T : in out Test) is begin Sponge.Init(T.Ctx, Capacity); end Set_Up; -- Test that streaming works when absorbing data. -- -- This test takes a 512 byte message and breaks it up into equal-sized -- chunks (sometimes the last chunk is smaller) and absorbs it into the -- sponge using multiple calls to Absorb. The test checks that for each -- possible chunk size (1 .. 511 byte chunks) the Sponge always produces -- exactly the same output. procedure Test_Absorb_Streaming(T : in out Test) is use type Keccak.Types.Byte_Array; Input_Data : Keccak.Types.Byte_Array(0 .. 512); Baseline_Output : Keccak.Types.Byte_Array(0 .. 512); Output_Data : Keccak.Types.Byte_Array(0 .. 512); Num_Chunks : Natural; begin -- Setup the input data for I in Input_Data'Range loop Input_Data(I) := Keccak.Types.Byte(I mod 256); end loop; -- Get the baseline output by passing in the entire input in 1 call to Absorb Sponge.Absorb(T.Ctx, Input_Data, Input_Data'Length * 8); Sponge.Squeeze(T.Ctx, Baseline_Output); -- Break up the Input_Data into chunks of varying sizes, and check -- that the squeezed output is the same as the Baseline_Output. for Chunk_Size in Positive range 1 .. Input_Data'Length - 1 loop Sponge.Init(T.Ctx, Capacity); Num_Chunks := Input_Data'Length / Chunk_Size; for N in Natural range 0 .. Num_Chunks - 1 loop Sponge.Absorb(T.Ctx, Input_Data(N*Chunk_Size .. (N*Chunk_Size + Chunk_Size) - 1), Chunk_Size * 8); end loop; -- Last chunk, if necessary if Input_Data'Length mod Chunk_Size /= 0 then Sponge.Absorb(T.Ctx, Input_Data(Chunk_Size * (Input_Data'Length / Chunk_Size) .. Input_Data'Last), (Input_Data'Length mod Chunk_Size) * 8); end if; -- Get the output and compare it against the baseline Sponge.Squeeze(T.Ctx, Output_Data); Assert(Output_Data = Baseline_Output, "Streaming test failed for" & Positive'Image(Chunk_Size) & " byte chunks"); end loop; end Test_Absorb_Streaming; -- Test that streaming works when squeezing data. -- -- This test verifies that the sponge always outputs the same data sequence, -- regardless of how much data is output for each call to Squeeze. -- -- The test iterates through chunk sizes from 1 .. 511 bytes. For each chunk -- size the test squeezes 512 bytes of data. For example, for 2 byte chunks -- the test calls Squeeze 256 times to generate 512 bytes of output, and this -- output should be exactly the same as the 512 bytes generated from reading -- 1 bytes per call to Squeeze. procedure Test_Squeeze_Streaming(T : in out Test) is use type Keccak.Types.Byte_Array; Input_Data : Keccak.Types.Byte_Array(0 .. 512); Baseline_Output : Keccak.Types.Byte_Array(0 .. 512); Output_Data : Keccak.Types.Byte_Array(0 .. 512); Num_Chunks : Natural; begin -- Setup the input data for I in Input_Data'Range loop Input_Data(I) := Keccak.Types.Byte(I mod 256); end loop; -- Get the baseline output by passing in the entire input in 1 call to Absorb Sponge.Absorb(T.Ctx, Input_Data, Input_Data'Length * 8); Sponge.Squeeze(T.Ctx, Baseline_Output); -- Break up the Output_Data into chunks of varying sizes, and check -- that the squeezed output is the same as the Baseline_Output. for Chunk_Size in Positive range 1 .. Input_Data'Length - 1 loop Sponge.Init(T.Ctx, Capacity); Sponge.Absorb(T.Ctx, Input_Data, Input_Data'Length * 8); Num_Chunks := Input_Data'Length / Chunk_Size; for N in Natural range 0 .. Num_Chunks - 1 loop Sponge.Squeeze(T.Ctx, Output_Data(N*Chunk_Size .. (N*Chunk_Size + Chunk_Size) - 1)); end loop; -- Last chunk, if necessary if Input_Data'Length mod Chunk_Size /= 0 then Sponge.Squeeze(T.Ctx, Output_Data(Chunk_Size * (Output_Data'Length / Chunk_Size) .. Output_Data'Last)); end if; -- Compare it against the baseline Assert(Output_Data = Baseline_Output, "Streaming test failed for" & Positive'Image(Chunk_Size) & " byte chunks"); end loop; end Test_Squeeze_Streaming; -- Test that Absorb_With_Suffix is equivalent to Absorb -- when the Suffix_Size is 0. procedure Test_Absorb_No_Suffix(T : in out Test) is use type Keccak.Types.Byte_Array; Input_Data : Keccak.Types.Byte_Array(0 .. 512); Baseline_Output : Keccak.Types.Byte_Array(0 .. 512); Output_Data : Keccak.Types.Byte_Array(0 .. 512); begin -- Setup the input data for I in Input_Data'Range loop Input_Data(I) := Keccak.Types.Byte(I mod 256); end loop; -- Test all possible bit-lengths in the range 1 .. 512 for I in Positive range 1 .. Input_Data'Length loop -- Generate the baseline output with Absorb Sponge.Init(T.Ctx, Capacity); Sponge.Absorb(T.Ctx, Input_Data, I); Sponge.Squeeze(T.Ctx, Baseline_Output); -- Do the same with Append_With_Suffix, but squeeze to Output_Data Sponge.Init(T.Ctx, Capacity); Sponge.Absorb_With_Suffix(T.Ctx, Input_Data, I, 0, -- Suffix 0); -- Suffix_Size Sponge.Squeeze(T.Ctx, Output_Data); pragma Assert(Output_Data = Baseline_Output, "Failed with input data of" & Positive'Image(I) & " bits"); end loop; end Test_Absorb_No_Suffix; -- Test that Absorb_With_Suffix is equivalent to Absorb where the -- suffix bits are included in the message passed to Absorb. -- For example, an 8-bit message (2#0000_0000#) with 4 suffix bits (2#1111#) -- should produce identical output when called with the following pseudo-code: -- Absorb_With_Suffix(Message => 2#0000_0000#, -- Suffix => 2#1111#); -- or -- Absorb(Message => 2#0000_0000_1111#); procedure Test_Suffix_Bits(T : in out Test) is use type Keccak.Types.Byte_Array; Suffix : constant Keccak.Types.Byte := 16#FF#; Message_Without_Suffix : Keccak.Types.Byte_Array(1 .. 1) := (1 => 16#00#); Message_With_Suffix : Keccak.Types.Byte_Array(1 .. 2) := (1 => 16#00#, 2 => Suffix); Digest_1 : Keccak.Types.Byte_Array(1 .. 32); Digest_2 : Keccak.Types.Byte_Array(1 .. 32); begin -- Test all suffix bit lengths (range 0 .. 8) for I in Natural range 0 .. 8 loop Sponge.Init(T.Ctx, Capacity); Sponge.Absorb_With_Suffix(Ctx => T.Ctx, Message => Message_Without_Suffix, Bit_Length => 8, Suffix => Suffix, Suffix_Len => I); Sponge.Squeeze(T.Ctx, Digest_1); Sponge.Init(T.Ctx, Capacity); Sponge.Absorb(Ctx => T.Ctx, Data => Message_With_Suffix, Bit_Length => 8 + I); Sponge.Squeeze(T.Ctx, Digest_2); Assert(Digest_1 = Digest_2, "Computed digests do not match with suffix length: " & Natural'Image(I)); end loop; end Test_Suffix_Bits; -- Test that Absorbing 0 bits does not affect the output. procedure Test_Null_Absorb(T : in out Test) is use type Keccak.Types.Byte_Array; Expected_Digest : Keccak.Types.Byte_Array(1 .. 32); Actual_Digest : Keccak.Types.Byte_Array(1 .. 32); Empty_Array : Keccak.Types.Byte_Array(1 .. 0) := (others => 0); begin Sponge.Init(T.Ctx, Capacity); Sponge.Squeeze(T.Ctx, Expected_Digest); Sponge.Init(T.Ctx, Capacity); Sponge.Absorb(T.Ctx, Empty_Array, 0); Sponge.Squeeze(T.Ctx, Actual_Digest); Assert(Actual_Digest = Expected_Digest, "Absorb had an unexpected effect on the output"); Sponge.Init(T.Ctx, Capacity); Sponge.Absorb_With_Suffix(Ctx => T.Ctx, Message => Empty_Array, Bit_Length => 0, Suffix => 0, Suffix_Len => 0); Sponge.Squeeze(T.Ctx, Actual_Digest); Assert(Actual_Digest = Expected_Digest, "Absorb_With_Suffix had an unexpected effect on the output"); end Test_Null_Absorb; -- Test that Absorb_With_Suffix correctly absorbs the suffix bits when -- the message is empty. -- -- The behaviour should be identical to calling Absorb where the message -- contains the suffix bits. procedure Test_Absorb_Suffix_Only(T : in out Test) is use type Keccak.Types.Byte_Array; Suffix : constant Keccak.Types.Byte := 16#FF#; Message : constant Keccak.Types.Byte_Array(1 .. 1) := (1 => Suffix); Empty_Message : constant Keccak.Types.Byte_Array(1 .. 0) := (others => 0); Expected_Digest : Keccak.Types.Byte_Array(1 .. 32); Actual_Digest : Keccak.Types.Byte_Array(1 .. 32); begin Sponge.Init(T.Ctx, Capacity); Sponge.Absorb(T.Ctx, Message, 4); Sponge.Squeeze(T.Ctx, Expected_Digest); Sponge.Init(T.Ctx, Capacity); Sponge.Absorb_With_Suffix(Ctx => T.Ctx, Message => Empty_Message, Bit_Length => 0, Suffix => Suffix, Suffix_Len => 4); Sponge.Squeeze(T.Ctx, Actual_Digest); Assert(Expected_Digest = Actual_Digest, "Suffix bits were not absorbed correctly"); end Test_Absorb_Suffix_Only; -- Test that suffix bits are correctly packed into non-multiple-of-8 message -- sizes. procedure Test_Suffix_Packing(T : in out Test) is use type Keccak.Types.Byte_Array; Message_With_Suffix_1 : Keccak.Types.Byte_Array(1 .. 2) := (1 => 2#0000_0000#, 2 => 2#1111_0000#); Message_Without_Suffix_1 : Keccak.Types.Byte_Array(1 .. 2) := (1 => 2#0000_0000#, 2 => 2#0000#); Message_With_Suffix_2 : Keccak.Types.Byte_Array(1 .. 3) := (1 => 2#0000_0000#, 2 => 2#1100_0000#, 3 => 2#11#); Message_Without_Suffix_2 : Keccak.Types.Byte_Array(1 .. 2) := (1 => 2#0000_0000#, 2 => 2#0000_00#); Suffix : Keccak.Types.Byte := 2#1111#; Expected_Digest : Keccak.Types.Byte_Array(1 .. 32); Actual_Digest : Keccak.Types.Byte_Array(1 .. 32); begin -- Case 1, where the suffix bits fit into the last byte of the message. Sponge.Init(T.Ctx, Capacity); Sponge.Absorb(T.Ctx, Message_With_Suffix_1, 16); Sponge.Squeeze(T.Ctx, Expected_Digest); Sponge.Init(T.Ctx, Capacity); Sponge.Absorb_With_Suffix(Ctx => T.Ctx, Message => Message_Without_Suffix_1, Bit_Length => 12, Suffix => Suffix, Suffix_Len => 4); Sponge.Squeeze(T.Ctx, Actual_Digest); Assert(Actual_Digest = Expected_Digest, "Wrong output for message: 0000_0000_0000_1111"); -- Case 2, where the suffix bits are spilled across two bytes Sponge.Init(T.Ctx, Capacity); Sponge.Absorb(T.Ctx, Message_With_Suffix_2, 18); Sponge.Squeeze(T.Ctx, Expected_Digest); Sponge.Init(T.Ctx, Capacity); Sponge.Absorb_With_Suffix(Ctx => T.Ctx, Message => Message_Without_Suffix_2, Bit_Length => 14, Suffix => Suffix, Suffix_Len => 4); Sponge.Squeeze(T.Ctx, Actual_Digest); Assert(Actual_Digest = Expected_Digest, "Wrong output for message: 0000_0000_0000_0011_11"); end Test_Suffix_Packing; end Sponge_Tests;
with Text_IO; use Text_IO; -- Programme minimal qui affiche juste un message. procedure Premier_Programme is begin Put_Line ("Bravo ! Vous avez réussi à exécuter le programme."); end Premier_Programme;
with Ada.Text_IO; use Ada.Text_IO; with SDL_Ada_Sizes; use SDL_Ada_Sizes; with SDL.Types; with SDL.Cdrom; with SDL.Events; with Interfaces.C; procedure Verify_Ada_Sizes is package C renames Interfaces.C; package AI is new Ada.Text_IO.Integer_IO (Integer); package CI is new Ada.Text_IO.Integer_IO (C.int); use type C.int; No_Failure : Boolean := True; -- ============================================= procedure Comparison ( name : String; A_Size : Integer; C_Size : C.int) is A_Size_Bytes : integer := A_Size / C.CHAR_BIT; begin Put ("Testing "); Put_Line(name); if Integer (C_Size) /= A_Size_Bytes then Put ("Incompatibility in byte sizes of type : "); Put (name); Put ("; Ada size = "); AI.Put (A_Size_Bytes, 4); Put ("; C size = "); CI.Put (C_Size, 4); New_line; No_Failure := No_Failure and False; end if; No_Failure := No_Failure and True; end; -- ============================================= begin Put_Line ("************* STARTING TYPES COMPARISON ******************"); Comparison ("Uint8", SDL.Types.Uint8'size, Uint8_Size); Comparison ("CDtrack", SDL.Cdrom.CDtrack'size, SDL_CDtrack_Size); comparison ("CD", SDL.Cdrom.CD'size, SDL_CD_Size); comparison ("JoyAxisEvent", SDL.Events.JoyAxisEvent'Size, SDL_JoyAxisEvent_Size); comparison ("JoyBallEvent", SDL.Events.JoyBallEvent'Size, SDL_JoyBallEvent_Size); comparison ("JoyHatEvent", SDL.Events.JoyHatEvent'Size, SDL_JoyHatEvent_Size); comparison ("JoyButtonEvent", SDL.Events.JoyButtonEvent'Size, SDL_JoyButtonEvent_Size); comparison ("Event", SDL.Events.Event'Size, SDL_Event_Size); if No_Failure then Put_Line ("The tested sizes are all correct"); else Put_Line ("Some sizes are not correct"); end if; Put_Line ("************** END OF TYPES COMPARISON ******************"); end Verify_Ada_Sizes;
-- SPDX-FileCopyrightText: 2021 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Ada.Finalization; with Interfaces.C; package Network.Polls is pragma Preelaborate; type Listener is limited interface; type Listener_Access is access all Listener'Class with Storage_Size => 0; type Event is (Input, Output, Error, Close); type Event_Set is array (Event) of Boolean with Pack; subtype FD is Interfaces.C.int; not overriding procedure On_Event (Self : in out Listener; Events : Event_Set) is null; type Poll is tagged limited private; type Poll_Access is access all Poll'Class with Storage_Size => 0; function Is_Initialized (Self : Poll'Class) return Boolean; procedure Initialize (Self : out Poll'Class) with Pre => not Self.Is_Initialized, Post => Self.Is_Initialized; procedure Watch (Self : in out Poll'Class; Value : FD; Events : Event_Set; Listener : Listener_Access) with Pre => Self.Is_Initialized; procedure Change_Watch (Self : in out Poll'Class; Events : Event_Set; Value : FD; Listener : Listener_Access) with Pre => Self.Is_Initialized; procedure Wait (Self : in out Poll'Class; Timeout : Duration) with Pre => Self.Is_Initialized; private type Poll is new Ada.Finalization.Limited_Controlled with record Count : Natural := 0; Internal : FD := 0; end record; overriding procedure Finalize (Self : in out Poll); end Network.Polls;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P R J . A T T R -- -- -- -- S p e c -- -- -- -- Copyright (C) 2001-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. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package defines packages and attributes in GNAT project files. -- There are predefined packages and attributes. -- It is also possible to define new packages with their attributes with Table; with GNAT.Strings; package Prj.Attr is function Package_Name_List return GNAT.Strings.String_List; -- Returns the list of valid package names, including those added by -- procedures Register_New_Package below. The String_Access components of -- the returned String_List should never be freed. procedure Initialize; -- Initialize the predefined project level attributes and the predefined -- packages and their attribute. This procedure should be called by -- Prj.Initialize. type Attribute_Kind is ( Unknown, -- The attribute does not exist Single, -- Single variable attribute (not an associative array) Associative_Array, -- Associative array attribute with a case sensitive index Optional_Index_Associative_Array, -- Associative array attribute with a case sensitive index and an -- optional source index. Case_Insensitive_Associative_Array, -- Associative array attribute with a case insensitive index Optional_Index_Case_Insensitive_Associative_Array -- Associative array attribute with a case insensitive index and an -- optional source index. ); -- Characteristics of an attribute. Optional_Index indicates that there -- may be an optional index in the index of the associative array, as in -- for Switches ("files.ada" at 2) use ... subtype Defined_Attribute_Kind is Attribute_Kind range Single .. Optional_Index_Case_Insensitive_Associative_Array; -- Subset of Attribute_Kinds that may be used for the attributes that is -- used when defining a new package. subtype All_Case_Insensitive_Associative_Array is Attribute_Kind range Case_Insensitive_Associative_Array .. Optional_Index_Case_Insensitive_Associative_Array; -- Subtype including both cases of Case_Insensitive_Associative_Array Max_Attribute_Name_Length : constant := 64; -- The maximum length of attribute names subtype Attribute_Name_Length is Positive range 1 .. Max_Attribute_Name_Length; type Attribute_Data (Name_Length : Attribute_Name_Length := 1) is record Name : String (1 .. Name_Length); -- The name of the attribute Attr_Kind : Defined_Attribute_Kind; -- The type of the attribute Index_Is_File_Name : Boolean; -- For associative arrays, indicate if the index is a file name, so -- that the attribute kind may be modified depending on the case -- sensitivity of file names. This is only taken into account when -- Attr_Kind is Associative_Array or Optional_Index_Associative_Array. Opt_Index : Boolean; -- True if there may be an optional index in the value of the index, -- as in: -- "file.ada" at 2 -- ("main.adb", "file.ada" at 1) Var_Kind : Defined_Variable_Kind; -- The attribute value kind: single or list Default : Attribute_Default_Value := Empty_Value; -- The value of the attribute when referenced if the attribute has not -- yet been declared. end record; -- Name and characteristics of an attribute in a package registered -- explicitly with Register_New_Package (see below). type Attribute_Data_Array is array (Positive range <>) of Attribute_Data; -- A list of attribute name/characteristics to be used as parameter of -- procedure Register_New_Package below. -- In the subprograms below, when it is specified that the subprogram -- "fails", procedure Prj.Com.Fail is called. Unless it is specified -- otherwise, if Prj.Com.Fail returns, exception Prj.Prj_Error is raised. procedure Register_New_Package (Name : String; Attributes : Attribute_Data_Array); -- Add a new package with its attributes. This procedure can only be -- called after Initialize, but before any other call to a service of -- the Project Manager. Fail if the name of the package is empty or not -- unique, or if the names of the attributes are not different. ---------------- -- Attributes -- ---------------- type Attribute_Node_Id is private; -- The type to refers to an attribute, self-initialized Empty_Attribute : constant Attribute_Node_Id; -- Indicates no attribute. Default value of Attribute_Node_Id objects Attribute_First : constant Attribute_Node_Id; -- First attribute node id of project level attributes function Attribute_Node_Id_Of (Name : Name_Id; Starting_At : Attribute_Node_Id) return Attribute_Node_Id; -- Returns the node id of an attribute at the project level or in -- a package. Starting_At indicates the first known attribute node where -- to start the search. Returns Empty_Attribute if the attribute cannot -- be found. function Attribute_Kind_Of (Attribute : Attribute_Node_Id) return Attribute_Kind; -- Returns the attribute kind of a known attribute. Returns Unknown if -- Attribute is Empty_Attribute. -- -- To use this function, the following code should be used: -- -- Pkg : constant Package_Node_Id := -- Prj.Attr.Package_Node_Id_Of (Name => <package name>); -- Att : constant Attribute_Node_Id := -- Prj.Attr.Attribute_Node_Id_Of -- (Name => <attribute name>, -- Starting_At => First_Attribute_Of (Pkg)); -- Kind : constant Attribute_Kind := Attribute_Kind_Of (Att); -- -- However, do not use this function once you have an already parsed -- project tree. Instead, given a Project_Node_Id corresponding to the -- attribute declaration ("for Attr (index) use ..."), use for example: -- -- if Case_Insensitive (Attr, Tree) then ... procedure Set_Attribute_Kind_Of (Attribute : Attribute_Node_Id; To : Attribute_Kind); -- Set the attribute kind of a known attribute. Does nothing if -- Attribute is Empty_Attribute. function Attribute_Name_Of (Attribute : Attribute_Node_Id) return Name_Id; -- Returns the name of a known attribute. Returns No_Name if Attribute is -- Empty_Attribute. function Variable_Kind_Of (Attribute : Attribute_Node_Id) return Variable_Kind; -- Returns the variable kind of a known attribute. Returns Undefined if -- Attribute is Empty_Attribute. procedure Set_Variable_Kind_Of (Attribute : Attribute_Node_Id; To : Variable_Kind); -- Set the variable kind of a known attribute. Does nothing if Attribute is -- Empty_Attribute. function Attribute_Default_Of (Attribute : Attribute_Node_Id) return Attribute_Default_Value; -- Returns the default of the attribute, Read_Only_Value for read only -- attributes, Empty_Value when default not specified, or specified value. function Optional_Index_Of (Attribute : Attribute_Node_Id) return Boolean; -- Returns True if Attribute is a known attribute and may have an -- optional index. Returns False otherwise. function Is_Read_Only (Attribute : Attribute_Node_Id) return Boolean; function Next_Attribute (After : Attribute_Node_Id) return Attribute_Node_Id; -- Returns the attribute that follow After in the list of project level -- attributes or the list of attributes in a package. -- Returns Empty_Attribute if After is either Empty_Attribute or is the -- last of the list. function Others_Allowed_For (Attribute : Attribute_Node_Id) return Boolean; -- True iff the index for an associative array attributes may be others -------------- -- Packages -- -------------- type Package_Node_Id is private; -- Type to refer to a package, self initialized Empty_Package : constant Package_Node_Id; -- Default value of Package_Node_Id objects Unknown_Package : constant Package_Node_Id; -- Value of an unknown package that has been found but is unknown procedure Register_New_Package (Name : String; Id : out Package_Node_Id); -- Add a new package. Fails if Name (the package name) is empty or is -- already the name of a package, and set Id to Empty_Package, -- if Prj.Com.Fail returns. Initially, the new package has no attributes. -- Id may be used to add attributes using procedure Register_New_Attribute -- below. procedure Register_New_Attribute (Name : String; In_Package : Package_Node_Id; Attr_Kind : Defined_Attribute_Kind; Var_Kind : Defined_Variable_Kind; Index_Is_File_Name : Boolean := False; Opt_Index : Boolean := False; Default : Attribute_Default_Value := Empty_Value); -- Add a new attribute to registered package In_Package. Fails if Name -- (the attribute name) is empty, if In_Package is Empty_Package or if -- the attribute name has a duplicate name. See definition of type -- Attribute_Data above for the meaning of parameters Attr_Kind, Var_Kind, -- Index_Is_File_Name, Opt_Index, and Default. function Package_Node_Id_Of (Name : Name_Id) return Package_Node_Id; -- Returns the package node id of the package with name Name. Returns -- Empty_Package if there is no package with this name. function First_Attribute_Of (Pkg : Package_Node_Id) return Attribute_Node_Id; -- Returns the first attribute in the list of attributes of package Pkg. -- Returns Empty_Attribute if Pkg is Empty_Package or Unknown_Package. private ---------------- -- Attributes -- ---------------- Attributes_Initial : constant := 50; Attributes_Increment : constant := 100; Attribute_Node_Low_Bound : constant := 0; Attribute_Node_High_Bound : constant := 099_999_999; type Attr_Node_Id is range Attribute_Node_Low_Bound .. Attribute_Node_High_Bound; -- Index type for table Attrs in the body type Attribute_Node_Id is record Value : Attr_Node_Id := Attribute_Node_Low_Bound; end record; -- Full declaration of self-initialized private type Empty_Attr : constant Attr_Node_Id := Attribute_Node_Low_Bound; Empty_Attribute : constant Attribute_Node_Id := (Value => Empty_Attr); First_Attribute : constant Attr_Node_Id := Attribute_Node_Low_Bound + 1; First_Attribute_Node_Id : constant Attribute_Node_Id := (Value => First_Attribute); Attribute_First : constant Attribute_Node_Id := First_Attribute_Node_Id; -------------- -- Packages -- -------------- Packages_Initial : constant := 10; Packages_Increment : constant := 100; Package_Node_Low_Bound : constant := 0; Package_Node_High_Bound : constant := 099_999_999; type Pkg_Node_Id is range Package_Node_Low_Bound .. Package_Node_High_Bound; -- Index type for table Package_Attributes in the body type Package_Node_Id is record Value : Pkg_Node_Id := Package_Node_Low_Bound; end record; -- Full declaration of self-initialized private type Empty_Pkg : constant Pkg_Node_Id := Package_Node_Low_Bound; Empty_Package : constant Package_Node_Id := (Value => Empty_Pkg); Unknown_Pkg : constant Pkg_Node_Id := Package_Node_High_Bound; Unknown_Package : constant Package_Node_Id := (Value => Unknown_Pkg); First_Package : constant Pkg_Node_Id := Package_Node_Low_Bound + 1; First_Package_Node_Id : constant Package_Node_Id := (Value => First_Package); Package_First : constant Package_Node_Id := First_Package_Node_Id; ---------------- -- Attributes -- ---------------- type Attribute_Record is record Name : Name_Id; Var_Kind : Variable_Kind; Optional_Index : Boolean; Attr_Kind : Attribute_Kind; Read_Only : Boolean; Others_Allowed : Boolean; Default : Attribute_Default_Value; Next : Attr_Node_Id; end record; -- Data for an attribute package Attrs is new Table.Table (Table_Component_Type => Attribute_Record, Table_Index_Type => Attr_Node_Id, Table_Low_Bound => First_Attribute, Table_Initial => Attributes_Initial, Table_Increment => Attributes_Increment, Table_Name => "Prj.Attr.Attrs"); -- The table of the attributes -------------- -- Packages -- -------------- type Package_Record is record Name : Name_Id; Known : Boolean := True; First_Attribute : Attr_Node_Id; end record; -- Data for a package package Package_Attributes is new Table.Table (Table_Component_Type => Package_Record, Table_Index_Type => Pkg_Node_Id, Table_Low_Bound => First_Package, Table_Initial => Packages_Initial, Table_Increment => Packages_Increment, Table_Name => "Prj.Attr.Packages"); -- The table of the packages end Prj.Attr;
with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; With Ada.Text_IO.Unbounded_IO; with Ada.Calendar; use Ada.Calendar; with Ada.Text_IO; use Ada.Text_IO; with Ada.Calendar; use Ada.Calendar; with Ada.Calendar.Formatting; use Ada.Calendar.Formatting; with Texaco; use Texaco; with Display_Warning; package Message.Post is package SU renames Ada.Strings.Unbounded; procedure Quote (Msgid : Unbounded_String); function Pad (InStr : String;PadWdth : Integer) return String; function Generate_UID return Unbounded_String; procedure Post_Message (ReplyID : in Unbounded_String := To_Unbounded_String(""); ReplySubject : in Unbounded_String := To_Unbounded_String("")); end Message.Post;
----------------------------------------------------------------------- -- keystore-passwords-files -- File based password provider -- Copyright (C) 2019 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Text_IO; with Ada.IO_Exceptions; with Ada.Strings.Unbounded; package body Keystore.Passwords.Input is type Provider is limited new Keystore.Passwords.Provider with record Confirm : Boolean := False; end record; -- Get the password through the Getter operation. overriding procedure Get_Password (From : in Provider; Getter : not null access procedure (Password : in Secret_Key)); -- ------------------------------ -- Create a password provider that asks interactively for the password. -- ------------------------------ function Create (Confirm : in Boolean) return Provider_Access is begin return new Provider '(Confirm => Confirm); end Create; -- ------------------------------ -- Get the password through the Getter operation. -- ------------------------------ overriding procedure Get_Password (From : in Provider; Getter : not null access procedure (Password : in Secret_Key)) is pragma Unreferenced (From); Content : Ada.Strings.Unbounded.Unbounded_String; C : Character; begin Ada.Text_IO.Put_Line ("Enter password:"); begin loop Ada.Text_IO.Get_Immediate (C); exit when C < ' '; Ada.Strings.Unbounded.Append (Content, C); end loop; exception when Ada.IO_Exceptions.End_Error => null; end; if Ada.Strings.Unbounded.Length (Content) = 0 then raise Keystore.Bad_Password with "Empty password given"; end if; Getter (Keystore.Create (Ada.Strings.Unbounded.To_String (Content))); end Get_Password; end Keystore.Passwords.Input;
pragma License (Unrestricted); -- generalized unit of Ada.Strings.Hash with Ada.Containers; generic type Character_Type is (<>); type String_Type is array (Positive range <>) of Character_Type; with procedure Get ( Item : String_Type; Last : out Natural; Value : out Wide_Wide_Character; Is_Illegal_Sequence : out Boolean); function Ada.Strings.Generic_Hash (Key : String_Type) return Containers.Hash_Type; pragma Pure (Ada.Strings.Generic_Hash);
with Ada.Text_IO; use Ada.Text_IO; with Gamma; procedure Test_Gamma is begin for I in 1..10 loop Put_Line (Long_Float'Image (Gamma (Long_Float (I) / 3.0))); end loop; end Test_Gamma;
with Ada.Characters.Handling; with DOM.Core.Elements; with LMCP_Messages; with LMCP_Message_Conversions; with AFRL.CMASI.AirVehicleConfiguration; use AFRL.CMASI.AirVehicleConfiguration; with AFRL.CMASI.AirVehicleState; use AFRL.CMASI.AirVehicleState; with AFRL.CMASI.AutomationRequest; use AFRL.CMASI.AutomationRequest; with AFRL.Impact.ImpactAutomationRequest; use AFRL.Impact.ImpactAutomationRequest; with AFRL.Vehicles.GroundVehicleConfiguration; use AFRL.Vehicles.GroundVehicleConfiguration; with AFRL.Vehicles.GroundVehicleState; use AFRL.Vehicles.GroundVehicleState; with AFRL.Vehicles.SurfaceVehicleConfiguration; use AFRL.Vehicles.SurfaceVehicleConfiguration; with AFRL.Vehicles.SurfaceVehicleState; use AFRL.Vehicles.SurfaceVehicleState; with UxAS.Messages.Route.RoutePlanResponse; use UxAS.Messages.Route.RoutePlanResponse; with UxAS.Messages.Route.RouteRequest; use UxAS.Messages.Route.RouteRequest; with AFRL.CMASI.EntityConfiguration; use AFRL.CMASI.EntityConfiguration; with AFRL.CMASI.EntityState; use AFRL.CMASI.EntityState; with AVTAS.LMCP.Types; with UxAS.Messages.lmcptask.TaskPlanOptions; use UxAS.Messages.lmcptask.TaskPlanOptions; with UxAS.Messages.lmcptask.UniqueAutomationRequest; use UxAS.Messages.lmcptask.UniqueAutomationRequest; with Ada.Containers; use Ada.Containers; package body UxAS.Comms.LMCP_Net_Client.Service.Route_Aggregation is procedure Handle_AirVehicleConfig_Msg (This : in out Route_Aggregator_Service; Msg : EntityConfiguration_Any); procedure Handle_AirVehicleState_Msg (This : in out Route_Aggregator_Service; Msg : EntityState_Any); procedure Handle_GroundVehicleConfig_Msg (This : in out Route_Aggregator_Service; Msg : EntityConfiguration_Any); procedure Handle_GroundVehicleState_Msg (This : in out Route_Aggregator_Service; Msg : EntityState_Any); procedure Handle_ImpactAutomationRequest_Msg (This : in out Route_Aggregator_Service; Msg : ImpactAutomationRequest_Any); procedure Handle_RoutePlanResponse_Msg (This : in out Route_Aggregator_Service; Msg : RoutePlanResponse_Any); procedure Handle_RouteRequest_Msg (This : in out Route_Aggregator_Service; Msg : RouteRequest_Any); procedure Handle_SurfaceVehicleConfig_Msg (This : in out Route_Aggregator_Service; Msg : EntityConfiguration_Any); procedure Handle_SurfaceVehicleState_Msg (This : in out Route_Aggregator_Service; Msg : EntityState_Any); procedure Handle_TaskPlanOptions_Msg (This : in out Route_Aggregator_Service; Msg : TaskPlanOptions_Any); procedure Handle_UniqueAutomationRequest_Msg (This : in out Route_Aggregator_Service; Msg : UniqueAutomationRequest_Any); --------------- -- Configure -- --------------- overriding procedure Configure (This : in out Route_Aggregator_Service; XML_Node : DOM.Core.Element; Result : out Boolean) is Unused : Boolean; begin declare Attr_Value : constant String := DOM.Core.Elements.Get_Attribute (XML_Node, Name => "FastPlan"); use Ada.Characters.Handling; begin if Attr_Value = "" then This.Config.m_fastPlan := False; -- FastPlan is an optional parameter elsif To_Lower (Attr_Value) = "true" then This.Config.m_fastPlan := True; elsif To_Lower (Attr_Value) = "false" then This.Config.m_fastPlan := False; else -- malformed boolean value Result := False; return; end if; end; -- track states and configurations for assignment cost matrix calculation -- [EntityStates] are used to calculate costs from current position to first task -- [EntityConfigurations] are used for nominal speed values (all costs are in terms of time to arrive) -- addSubscriptionAddress(afrl::CMASI::EntityConfiguration::Subscription); This.Add_Subscription_Address (AFRL.CMASI.EntityConfiguration.Subscription, Unused); for Descendant of EntityConfiguration_Descendants loop This.Add_Subscription_Address (Descendant, Unused); end loop; -- addSubscriptionAddress(afrl::CMASI::EntityState::Subscription); This.Add_Subscription_Address (AFRL.CMASI.EntityState.Subscription, Unused); for Descendant of AFRL.CMASI.EntityState.EntityState_Descendants loop This.Add_Subscription_Address (Descendant, Unused); end loop; -- track requests to kickoff matrix calculation -- addSubscriptionAddress(UxAS::messages::task::UniqueAutomationRequest::Subscription); This.Add_Subscription_Address (UxAS.Messages.lmcptask.UniqueAutomationRequest.Subscription, Unused); -- subscribe to task plan options to build matrix -- addSubscriptionAddress(UxAS::messages::task::TaskPlanOptions::Subscription); This.Add_Subscription_Address (UxAS.Messages.lmcptask.TaskPlanOptions.Subscription, Unused); -- handle batch route requests -- addSubscriptionAddress(UxAS::messages::route::RouteRequest::Subscription); This.Add_Subscription_Address (UxAS.Messages.Route.RouteRequest.Subscription, Unused); -- listen for responses to requests from route planner(s) -- addSubscriptionAddress(UxAS::messages::route::RoutePlanResponse::Subscription); This.Add_Subscription_Address (UxAS.Messages.Route.RoutePlanResponse.Subscription, Unused); -- // Subscribe to group messages (whisper from local route planner) -- //TODO REVIEW DESIGN "RouteAggregator" "RoutePlanner" flip message addressing effecting session behavior -- return true; // may not have the proper fast plan value, but proceed anyway Result := True; end Configure; ------------ -- Create -- ------------ function Create return Any_Service is Result : Any_Service; begin Result := new Route_Aggregator_Service; Result.Construct_Service (Service_Type => Type_Name, Work_Directory_Name => Directory_Name); return Result; end Create; --------------------------------- -- Handle_AirVehicleConfig_Msg -- --------------------------------- procedure Handle_AirVehicleConfig_Msg (This : in out Route_Aggregator_Service; Msg : EntityConfiguration_Any) is Id : constant Common.Int64 := Common.Int64 (Msg.getID); begin -- { -- int64_t id = std::static_pointer_cast<afrl::CMASI::EntityConfiguration>(receivedLMCPMessage->m_object)->getID(); -- m_entityConfigurations[id] = std::static_pointer_cast<afrl::CMASI::EntityConfiguration>(receivedLMCPMessage->m_object); -- m_airVehicles.insert(id); -- } if not Contains (This.Config.m_airVehicles, Id) then This.Config.m_airVehicles := Add (This.Config.m_airVehicles, Id); end if; if not Contains (This.Config.m_entityStates, Int64_Sequences.First, Last (This.Config.m_entityStates), Id) then This.Config.m_entityStates := Add (This.Config.m_entityStates, Id); end if; end Handle_AirVehicleConfig_Msg; -------------------------------- -- Handle_AirVehicleState_Msg -- -------------------------------- procedure Handle_AirVehicleState_Msg (This : in out Route_Aggregator_Service; Msg : EntityState_Any) is use LMCP_Message_Conversions; Entity_State : constant LMCP_Messages.EntityState := As_EntityState_Message (Msg); Id : constant Common.Int64 := Entity_State.Id; begin -- { -- int64_t id = std::static_pointer_cast<afrl::CMASI::EntityState>(receivedLMCPMessage->m_object)->getID(); -- m_entityStates[id] = std::static_pointer_cast<afrl::CMASI::EntityState>(receivedLMCPMessage->m_object); -- m_airVehicles.insert(id); -- } if not Contains (This.Config.m_airVehicles, Id) then This.Config.m_airVehicles := Add (This.Config.m_airVehicles, Id); end if; if not Contains (This.Config.m_entityStates, Int64_Sequences.First, Last (This.Config.m_entityStates), Id) then This.Config.m_entityStates := Add (This.Config.m_entityStates, Id); end if; if ES_Maps.Has_Key (This.Config.m_entityStatesInfo, Id) then This.Config.m_entityStatesInfo := ES_Maps.Set (This.Config.m_entityStatesInfo, Id, Entity_State); else This.Config.m_entityStatesInfo := ES_Maps.Add (This.Config.m_entityStatesInfo, Id, Entity_State); end if; end Handle_AirVehicleState_Msg; ------------------------------------ -- Handle_GroundVehicleConfig_Msg -- ------------------------------------ procedure Handle_GroundVehicleConfig_Msg (This : in out Route_Aggregator_Service; Msg : EntityConfiguration_Any) is Id : constant Common.Int64 := Common.Int64 (Msg.getID); begin -- { -- int64_t id = std::static_pointer_cast<afrl::CMASI::EntityConfiguration>(receivedLMCPMessage->m_object)->getID(); -- m_entityConfigurations[id] = std::static_pointer_cast<afrl::CMASI::EntityConfiguration>(receivedLMCPMessage->m_object); -- m_groundVehicles.insert(id); -- } if not Contains (This.Config.m_groundVehicles, Id) then This.Config.m_groundVehicles := Add (This.Config.m_groundVehicles, Id); end if; if not Contains (This.Config.m_entityStates, Int64_Sequences.First, Last (This.Config.m_entityStates), Id) then This.Config.m_entityStates := Add (This.Config.m_entityStates, Id); end if; end Handle_GroundVehicleConfig_Msg; ----------------------------------- -- Handle_GroundVehicleState_Msg -- ----------------------------------- procedure Handle_GroundVehicleState_Msg (This : in out Route_Aggregator_Service; Msg : EntityState_Any) is use LMCP_Message_Conversions; Entity_State : constant LMCP_Messages.EntityState := As_EntityState_Message (Msg); Id : constant Common.Int64 := Entity_State.Id; begin -- { -- int64_t id = std::static_pointer_cast<afrl::CMASI::EntityState>(receivedLMCPMessage->m_object)->getID(); -- m_entityStates[id] = std::static_pointer_cast<afrl::CMASI::EntityState>(receivedLMCPMessage->m_object); -- m_groundVehicles.insert(id); -- } if not Contains (This.Config.m_groundVehicles, Id) then This.Config.m_groundVehicles := Add (This.Config.m_groundVehicles, Id); end if; if not Contains (This.Config.m_entityStates, Int64_Sequences.First, Last (This.Config.m_entityStates), Id) then This.Config.m_entityStates := Add (This.Config.m_entityStates, Id); end if; if ES_Maps.Has_Key (This.Config.m_entityStatesInfo, Id) then This.Config.m_entityStatesInfo := ES_Maps.Set (This.Config.m_entityStatesInfo, Id, Entity_State); else This.Config.m_entityStatesInfo := ES_Maps.Add (This.Config.m_entityStatesInfo, Id, Entity_State); end if; end Handle_GroundVehicleState_Msg; ---------------------------------------- -- Handle_ImpactAutomationRequest_Msg -- ---------------------------------------- procedure Handle_ImpactAutomationRequest_Msg (This : in out Route_Aggregator_Service; Msg : ImpactAutomationRequest_Any) is -- auto areq = std::shared_ptr<UxAS::messages::task::UniqueAutomationRequest>(); AReq : constant UniqueAutomationRequest_Any := new UxAS.Messages.lmcptask.UniqueAutomationRequest.UniqueAutomationRequest; begin -- auto sreq = std::static_pointer_cast<afrl::impact::ImpactAutomationRequest>(receivedLMCPMessage->m_object); -- Msg corresponds to sreq in this Ada version -- areq->setOriginalRequest(sreq->getTrialRequest()->clone()); AReq.setOriginalRequest (new AutomationRequest'(Msg.getTrialRequest.all)); -- m_uniqueAutomationRequests[m_autoRequestId++] = areq; -- areq->setRequestID(m_autoRequestId); AReq.setRequestID (AVTAS.LMCP.Types.Int64 (This.State.m_autoRequestId + 1)); -- //ResetTaskOptions(areq); // clear m_taskOptions and wait for refresh from tasks -- CheckAllTaskOptionsReceived(); Route_Aggregator.Handle_Unique_Automation_Request (This.Config, This.Mailbox, This.State, LMCP_Message_Conversions.As_UniqueAutomationRequest_Message (AReq)); end Handle_ImpactAutomationRequest_Msg; ---------------------------------- -- Handle_RoutePlanResponse_Msg -- ---------------------------------- procedure Handle_RoutePlanResponse_Msg (This : in out Route_Aggregator_Service; Msg : RoutePlanResponse_Any) is use LMCP_Message_Conversions; begin Route_Aggregator.Handle_Route_Plan_Response (This.Mailbox, This.State, As_RoutePlanResponse_Message (Msg)); end Handle_RoutePlanResponse_Msg; ----------------------------- -- Handle_RouteRequest_Msg -- ----------------------------- procedure Handle_RouteRequest_Msg (This : in out Route_Aggregator_Service; Msg : RouteRequest_Any) is use LMCP_Message_Conversions; begin Route_Aggregator.Handle_Route_Request (This.Config, This.Mailbox, This.State, As_RouteRequest_Message (Msg)); end Handle_RouteRequest_Msg; ------------------------------------- -- Handle_SurfaceVehicleConfig_Msg -- ------------------------------------- procedure Handle_SurfaceVehicleConfig_Msg (This : in out Route_Aggregator_Service; Msg : EntityConfiguration_Any) is Id : constant Common.Int64 := Common.Int64 (Msg.getID); begin -- { -- int64_t id = std::static_pointer_cast<afrl::CMASI::EntityConfiguration>(receivedLMCPMessage->m_object)->getID(); -- m_entityConfigurations[id] = std::static_pointer_cast<afrl::CMASI::EntityConfiguration>(receivedLMCPMessage->m_object); -- m_surfaceVehicles.insert(id); -- } if not Contains (This.Config.m_surfaceVehicles, Id) then This.Config.m_surfaceVehicles := Add (This.Config.m_surfaceVehicles, Id); end if; if not Contains (This.Config.m_entityStates, Int64_Sequences.First, Last (This.Config.m_entityStates), Id) then This.Config.m_entityStates := Add (This.Config.m_entityStates, Id); end if; end Handle_SurfaceVehicleConfig_Msg; ------------------------------------ -- Handle_SurfaceVehicleState_Msg -- ------------------------------------ procedure Handle_SurfaceVehicleState_Msg (This : in out Route_Aggregator_Service; Msg : EntityState_Any) is use LMCP_Message_Conversions; Entity_State : constant LMCP_Messages.EntityState := As_EntityState_Message (Msg); Id : constant Common.Int64 := Entity_State.Id; begin -- { -- int64_t id = std::static_pointer_cast<afrl::CMASI::EntityState>(receivedLMCPMessage->m_object)->getID(); -- m_entityStates[id] = std::static_pointer_cast<afrl::CMASI::EntityState>(receivedLMCPMessage->m_object); -- m_surfaceVehicles.insert(id); -- } if not Contains (This.Config.m_surfaceVehicles, Id) then This.Config.m_surfaceVehicles := Add (This.Config.m_surfaceVehicles, Id); end if; if not Contains (This.Config.m_entityStates, Int64_Sequences.First, Last (This.Config.m_entityStates), Id) then This.Config.m_entityStates := Add (This.Config.m_entityStates, Id); end if; if ES_Maps.Has_Key (This.Config.m_entityStatesInfo, Id) then This.Config.m_entityStatesInfo := ES_Maps.Set (This.Config.m_entityStatesInfo, Id, Entity_State); else This.Config.m_entityStatesInfo := ES_Maps.Add (This.Config.m_entityStatesInfo, Id, Entity_State); end if; end Handle_SurfaceVehicleState_Msg; -------------------------------- -- Handle_TaskPlanOptions_Msg -- -------------------------------- procedure Handle_TaskPlanOptions_Msg (This : in out Route_Aggregator_Service; Msg : TaskPlanOptions_Any) is begin Route_Aggregator.Handle_Task_Plan_Options (This.Mailbox, This.Config, This.State, LMCP_Message_Conversions.As_TaskPlanOption_Message (Msg)); end Handle_TaskPlanOptions_Msg; ---------------------------------------- -- Handle_UniqueAutomationRequest_Msg -- ---------------------------------------- procedure Handle_UniqueAutomationRequest_Msg (This : in out Route_Aggregator_Service; Msg : UniqueAutomationRequest_Any) is begin -- { -- auto areq = std::static_pointer_cast<UxAS::messages::task::UniqueAutomationRequest>(receivedLMCPMessage->m_object); -- m_uniqueAutomationRequests[m_autoRequestId++] = areq; -- //ResetTaskOptions(areq); // clear m_taskOptions and wait for refresh from tasks -- CheckAllTaskOptionsReceived(); -- } Route_Aggregator.Handle_Unique_Automation_Request (This.Config, This.Mailbox, This.State, LMCP_Message_Conversions.As_UniqueAutomationRequest_Message (Msg)); end Handle_UniqueAutomationRequest_Msg; ---------------- -- Initialize -- ---------------- overriding procedure Initialize (This : in out Route_Aggregator_Service; Result : out Boolean) is begin Result := True; -- per the C++ version Route_Aggregator_Communication.Initialize (This.Mailbox, Source_Group => Value (This.Message_Source_Group), Unique_Id => Common.Int64 (UxAS.Comms.LMCP_Net_Client.Unique_Entity_Send_Message_Id), Entity_Id => Common.UInt32 (This.Entity_Id), Service_Id => Common.UInt32 (This.Network_Id)); end Initialize; ----------------------------------- -- Process_Received_LMCP_Message -- ----------------------------------- overriding procedure Process_Received_LMCP_Message (This : in out Route_Aggregator_Service; Received_Message : not null Any_LMCP_Message; Should_Terminate : out Boolean) is begin -- if (UxAS::messages::route::isRoutePlanResponse(receivedLMCPMessage->m_object.get())) if Received_Message.Payload.all in RoutePlanResponse'Class then This.Handle_RoutePlanResponse_Msg (RoutePlanResponse_Any (Received_Message.Payload)); -- else if (UxAS::messages::route::isRouteRequest(receivedLMCPMessage->m_object.get())) elsif Received_Message.Payload.all in RouteRequest'Class then This.Handle_RouteRequest_Msg (RouteRequest_Any (Received_Message.Payload)); -- else if (std::dynamic_pointer_cast<afrl::CMASI::AirVehicleState>(receivedLMCPMessage->m_object)) elsif Received_Message.Payload.all in AirVehicleState'Class then This.Handle_AirVehicleState_Msg (EntityState_Any (Received_Message.Payload)); -- else if (afrl::vehicles::isGroundVehicleState(receivedLMCPMessage->m_object.get())) elsif Received_Message.Payload.all in GroundVehicleState'Class then This.Handle_GroundVehicleState_Msg (EntityState_Any (Received_Message.Payload)); -- else if (afrl::vehicles::isSurfaceVehicleState(receivedLMCPMessage->m_object.get())) elsif Received_Message.Payload.all in SurfaceVehicleState'Class then This.Handle_SurfaceVehicleState_Msg (EntityState_Any (Received_Message.Payload)); -- else if (std::dynamic_pointer_cast<afrl::CMASI::AirVehicleConfiguration>(receivedLMCPMessage->m_object)) elsif Received_Message.Payload.all in AirVehicleConfiguration'Class then This.Handle_AirVehicleConfig_Msg (EntityConfiguration_Any (Received_Message.Payload)); -- else if (afrl::vehicles::isGroundVehicleConfiguration(receivedLMCPMessage->m_object.get())) elsif Received_Message.Payload.all in GroundVehicleConfiguration'Class then This.Handle_GroundVehicleConfig_Msg (EntityConfiguration_Any (Received_Message.Payload)); -- else if (afrl::vehicles::isSurfaceVehicleConfiguration(receivedLMCPMessage->m_object.get())) elsif Received_Message.Payload.all in SurfaceVehicleConfiguration'Class then This.Handle_SurfaceVehicleConfig_Msg (EntityConfiguration_Any (Received_Message.Payload)); -- else if (UxAS::messages::task::isUniqueAutomationRequest(receivedLMCPMessage->m_object.get())) elsif Received_Message.Payload.all in UxAS.Messages.lmcptask.UniqueAutomationRequest.UniqueAutomationRequest'Class then This.Handle_UniqueAutomationRequest_Msg (UniqueAutomationRequest_Any (Received_Message.Payload)); -- else if (afrl::impact::isImpactAutomationRequest(receivedLMCPMessage->m_object.get())) elsif Received_Message.Payload.all in ImpactAutomationRequest'Class then This.Handle_ImpactAutomationRequest_Msg (ImpactAutomationRequest_Any (Received_Message.Payload)); -- else if (UxAS::messages::task::isTaskPlanOptions(receivedLMCPMessage->m_object.get())) elsif Received_Message.Payload.all in TaskPlanOptions'Class then This.Handle_TaskPlanOptions_Msg (TaskPlanOptions_Any (Received_Message.Payload)); end if; Should_Terminate := False; end Process_Received_LMCP_Message; --------------------------------- -- Registry_Service_Type_Names -- --------------------------------- function Registry_Service_Type_Names return Service_Type_Names_List is (Service_Type_Names_List'(1 => Instance (Service_Type_Name_Max_Length, Content => Type_Name))); ----------------------------- -- Package Executable Part -- ----------------------------- -- This is the executable part for the package, invoked automatically and only once. begin -- All concrete service subclasses must call this procedure in their -- own package like this, with their own params. Register_Service_Creation_Function_Pointers (Registry_Service_Type_Names, Create'Access); end UxAS.Comms.LMCP_Net_Client.Service.Route_Aggregation;
with Ada.Text_IO; use Ada.Text_IO; package body algorithmic is function Do_Naive_Calculation(NIC : Naive_Interface'Class; input : Integer) return Integer is begin Put("<naive>"); return input + NIC.Get_Data**3; -- yes, this is blatantly trivial example, with "optimization" just storing -- that cubed integer at initialization. -- But it illustrates the point end; function Do_Optimized_Calculation(OIC : Optimized_Interface'Class; input : Integer) return Integer is begin Put("<optim>"); return input + OIC.Get_Extra_Data; end; function do_some_calc_messy(UIC : Unrelated_Interface'Class; input : Integer; IFC : Naive_Interface'Class) return Integer is begin if IFC in Optimized_Interface'Class then return Optimized_Interface(IFC).Do_Optimized_Calculation(input); else return IFC.Do_Naive_Calculation(input); end if; end; function do_some_calc_oop (UIC : Unrelated_Interface'Class; input : Integer; IFC : Naive_Interface'Class) return Integer is begin return IFC.Do_Complex_Calculation(input); end; end algorithmic;
----------------------------------------------------------------------- -- swagger-tests -- Unit tests for REST clients -- Copyright (C) 2018, 2020, 2021 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Log.Loggers; with Util.Test_Caller; with Swagger.Clients; with Ada.Text_IO; with TestAPI.Models; package body Swagger.Tests is Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Swagger.Tests"); package Caller is new Util.Test_Caller (Test, "Swagger.Tests"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test unauthorized access", Test_Unauthorized'Access); Caller.Add_Test (Suite, "Test authorized access", Test_Authorized'Access); end Add_Tests; overriding procedure Set_Up (T : in out Test) is begin T.Server := To_UString (Util.Tests.Get_Parameter ("testapi.url")); end Set_Up; procedure Configure (T : in out Test; Client : in out TestAPI.Clients.Client_Type) is begin Client.Set_Server (To_String (T.Server)); Client.Set_Server (Util.Tests.Get_Parameter ("testapi.url")); end Configure; procedure Authenticate (T : in out Test; Cred : in out Swagger.Credentials.OAuth.OAuth2_Credential_Type) is Username : constant String := Util.Tests.Get_Parameter ("testapi.username"); Password : constant String := Util.Tests.Get_Parameter ("testapi.password"); Client_Id : constant String := Util.Tests.Get_Parameter ("testapi.client_id"); Client_Sec : constant String := Util.Tests.Get_Parameter ("testapi.client_secret"); begin Cred.Set_Application_Identifier (Client_Id); Cred.Set_Application_Secret (Client_Sec); Cred.Set_Provider_URI (To_String (T.Server) & "/oauth/token"); Cred.Request_Token (Username, Password, "read-ticket,write-ticket"); end Authenticate; -- ------------------------------ -- Test unauthorized operations. -- ------------------------------ procedure Test_Unauthorized (T : in out Test) is Client : TestAPI.Clients.Client_Type; Empty : Nullable_UString; begin T.Configure (Client); Client.Do_Create_Ticket (To_UString ("test"), Empty, Empty, Empty); T.Fail ("No authorization error exception was raised"); exception when Swagger.Clients.Authorization_Error => null; end Test_Unauthorized; -- ------------------------------ -- Test authorized operations. -- ------------------------------ procedure Test_Authorized (T : in out Test) is Client : TestAPI.Clients.Client_Type; Empty : Nullable_UString; Cred : aliased Swagger.Credentials.OAuth.OAuth2_Credential_Type; List : TestAPI.Models.Ticket_Type_Vectors.Vector; Count : Natural; T2 : TestAPI.Models.Ticket_Type; begin T.Configure (Client); T.Authenticate (Cred); Client.Set_Credentials (Cred'Unchecked_Access); Client.Do_Create_Ticket (To_UString ("test"), Empty, Empty, Empty); Util.Tests.Assert_Equals (T, 201, Client.Get_Status, "Invalid response status"); Ada.Text_IO.Put_Line (Client.Get_Header ("Location")); Client.Do_List_Tickets (Empty, Empty, List); Util.Tests.Assert_Equals (T, 200, Client.Get_Status, "Invalid response status"); Client.Do_Head_Ticket; Util.Tests.Assert_Equals (T, 200, Client.Get_Status, "Invalid response status"); for Ticket of List loop Log.Info ("Ticket {0} - {1}", To_String (Ticket.Title), To_String (Ticket.Status)); Client.Do_Patch_Ticket (Tid => Ticket.Id, Owner => Ticket.Owner, Status => (Is_Null => False, Value => To_UString ("assigned")), Title => (Is_Null => True, Value => <>), Description => (Is_Null => False, Value => To_UString ("patch")), Result => Ticket); Util.Tests.Assert_Equals (T, 200, Client.Get_Status, "Invalid response status"); Client.Do_Update_Ticket (Tid => Ticket.Id, Owner => Ticket.Owner, Status => (Is_Null => False, Value => To_UString ("closed")), Title => (Is_Null => True, Value => <>), Description => (Is_Null => False, Value => To_UString ("ok")), Result => Ticket); Util.Tests.Assert_Equals (T, 200, Client.Get_Status, "Invalid response status"); Util.Tests.Assert_Equals (T, "closed", To_String (Ticket.Status), "Invalid status after Update_Ticket"); Util.Tests.Assert_Equals (T, "ok", To_String (Ticket.Description), "Invalid description after Update_Ticket"); Client.Do_Get_Ticket (Tid => Ticket.Id, Result => T2); Util.Tests.Assert_Equals (T, 200, Client.Get_Status, "Invalid response status"); Client.Do_Options_Ticket (Tid => Ticket.Id, Result => T2); Util.Tests.Assert_Equals (T, 200, Client.Get_Status, "Invalid response status"); end loop; Count := Natural (List.Length); Log.Info ("Number of tickets{0}", Natural'Image (Count)); Client.Do_List_Tickets (Empty, Empty, List); Util.Tests.Assert_Equals (T, 200, Client.Get_Status, "Invalid response status"); Count := Natural (List.Length); Log.Info ("Number of tickets{0}", Natural'Image (Count)); -- Delete each ticket, doing a DELETE operation. for Ticket of List loop Client.Do_Delete_Ticket (Tid => Ticket.Id); Util.Tests.Assert_Equals (T, 204, Client.Get_Status, "Invalid response status"); end loop; Client.Do_List_Tickets (Empty, Empty, List); Util.Tests.Assert_Equals (T, 200, Client.Get_Status, "Invalid response status"); Count := Natural (List.Length); Util.Tests.Assert_Equals (T, 0, Count, "The ticket list was not cleared"); end Test_Authorized; end Swagger.Tests;
------------------------------------------------------------------------------ -- -- -- GNAT EXAMPLE -- -- -- -- Copyright (C) 2013-2016, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ pragma Ada_2012; pragma Warnings (Off); with System.Machine_Reset; pragma Warnings (On); with Console; use Console; with Term; use Term; with Dumps; use Dumps; package body Commands is First_Cmd : Command_List_Acc; Last_Cmd : Command_List_Acc; -- Simply linked list of commands. procedure Register_Commands (Cmd : Command_List_Acc) is begin if Last_Cmd = null then First_Cmd := Cmd; else Last_Cmd.Next := Cmd; end if; Last_Cmd := Cmd; end Register_Commands; function Command_Name_Eq (Cmd : Command_Type) return Boolean is Word_Len : constant Natural := End_Pos - Pos + 1; begin for I in 1 .. Cmd.Name'Length loop if Cmd.Name (I) = ' ' and then I = Word_Len + 1 then return True; end if; if Cmd.Name (I) /= Line (Pos + I - 1) then return False; end if; end loop; return Word_Len = Cmd.Name'Length; end Command_Name_Eq; procedure Handle_Command is Cmd : Command_List_Acc; begin Next_Word; if Pos > Line_Len then return; end if; Cmd := First_Cmd; while Cmd /= null loop for I in Cmd.Commands'Range loop if Command_Name_Eq (Cmd.Commands (I)) then Cmd.Commands (I).Proc.all; return; end if; end loop; Cmd := Cmd.Next; end loop; Put ("unknown command: "); Put_Line (Line (Pos .. End_Pos)); Put_Line ("Try help"); end Handle_Command; procedure Proc_Help is Cmds : Command_List_Acc; begin Put_Line ("List of commands:"); Cmds := First_Cmd; while Cmds /= null loop for I in Cmds.Commands'Range loop Put_Line (Cmds.Commands (I).Name.all); end loop; Cmds := Cmds.Next; end loop; end Proc_Help; procedure Proc_Reset is begin Put ("Reset"); Put (ASCII.SUB); -- ^Z Put_Line ("........"); System.Machine_Reset.Stop; end Proc_Reset; procedure Parse_Unsigned32 (Res : out Unsigned_32; Ok : out Boolean) is H : Hex_Digit_Type; C : Character; begin Res := 0; Ok := False; if Pos > Line_Len then Put_Line ("missing argument"); return; end if; if End_Pos > Pos + 1 and then Line (Pos) = '0' and then Line (Pos + 1) = 'x' then -- Parse as hex. for I in Pos + 2 .. End_Pos loop H := Read_Hex_Digit (I); if H = Bad_Hex then Put_Line ("Bad character in hex number"); return; else Res := Res * 16 + Unsigned_32 (H); end if; end loop; else -- Parse as dec. for I in Pos .. End_Pos loop Res := Res * 10; C := Line (I); if C in '0' .. '9' then Res := Res + Character'Pos (C) - Character'Pos ('0'); else Put_Line ("Bad character in decimal number"); return; end if; end loop; end if; Ok := True; end Parse_Unsigned32; procedure Proc_Conv is V : Unsigned_32; Ok : Boolean; begin loop Next_Word; exit when Pos > Line_Len; Parse_Unsigned32 (V, Ok); exit when not Ok; Put_Line (Image8 (V)); end loop; end Proc_Conv; procedure Parse_Dump_Args (Addr : out Unsigned_32; Len : out Unsigned_32; Ok : out Boolean) is begin Next_Word; Parse_Unsigned32 (Addr, Ok); if not Ok then return; end if; Next_Word; if Pos > Line_Len then Len := 32; else Parse_Unsigned32 (Len, Ok); if not Ok then return; end if; end if; end Parse_Dump_Args; -- Hexa + char byte dump procedure Proc_Dump is Addr : Unsigned_32; Len : Unsigned_32; Eaddr : Unsigned_32; Ok : Boolean; begin Parse_Dump_Args (Addr, Len, Ok); if not Ok then return; end if; Eaddr := Addr + Len - 1; loop Put (Image8 (Addr)); Put (": "); for I in Unsigned_32 range 0 .. 15 loop if Addr > Eaddr then Put (" "); else declare B : Unsigned_8; for B'Address use System'To_Address (Addr); pragma Import (Ada, B); begin Put (Image2 (Unsigned_32 (B))); end; end if; if I = 7 then Put ('-'); else Put (' '); end if; Addr := Addr + 1; end loop; Addr := Addr - 16; Put (' '); for I in Unsigned_32 range 0 .. 15 loop if Addr > Eaddr then Put (' '); else declare C : Character; for C'Address use System'To_Address (Addr); pragma Import (Ada, C); begin if C not in ' ' .. '~' then Put ('.'); else Put (C); end if; end; end if; Addr := Addr + 1; end loop; New_Line; exit when Addr - 1 >= Eaddr; -- Handle wrap around 0 end loop; end Proc_Dump; -- Word dump procedure Proc_Dump32 is Addr : Unsigned_32; Len : Unsigned_32; Eaddr : Unsigned_32; Ok : Boolean; begin Parse_Dump_Args (Addr, Len, Ok); if not Ok then return; end if; -- Align address Addr := Addr and not 3; Eaddr := Addr + Len - 1; loop Put (Image8 (Addr)); Put (": "); for I in Unsigned_32 range 0 .. 3 loop if Addr > Eaddr then Put (" "); else declare W : Unsigned_32; for W'Address use System'To_Address (Addr); pragma Import (Ada, W); begin Put (Image8 (W)); end; end if; Put (' '); Addr := Addr + 4; end loop; New_Line; exit when Addr - 1 >= Eaddr; -- Handle wrap around 0 end loop; end Proc_Dump32; procedure Proc_Dump_Srec is use System; Chksum : Unsigned_8; procedure Dump_Byte (B : Unsigned_8) is begin Chksum := Chksum + B; Put (Image2 (Unsigned_32 (B))); end Dump_Byte; Addr : Unsigned_32; L : Unsigned_32; Ll : Unsigned_32; Ok : Boolean; begin Next_Word; Parse_Unsigned32 (Addr, Ok); if not Ok then return; end if; Next_Word; if Pos > Line_Len then L := 32; else Parse_Unsigned32 (L, Ok); if not Ok then return; end if; end if; while L > 0 loop Ll := Unsigned_32'Min (L, 32); Put ("S3"); Chksum := 0; -- Len Dump_Byte (Unsigned_8 (Ll + 5)); -- Address Dump_Byte (Unsigned_8 (Shift_Right (Addr, 24) and 16#ff#)); Dump_Byte (Unsigned_8 (Shift_Right (Addr, 16) and 16#ff#)); Dump_Byte (Unsigned_8 (Shift_Right (Addr, 8) and 16#ff#)); Dump_Byte (Unsigned_8 (Shift_Right (Addr, 0) and 16#ff#)); -- Data for I in 1 .. Ll loop declare B : Unsigned_8 with Address => System'To_Address (Addr), Import; begin Dump_Byte (B); Addr := Addr + 1; end; end loop; -- Chksum Dump_Byte (not Chksum); New_Line; L := L - Ll; end loop; null; end Proc_Dump_Srec; procedure Proc_Write is Addr : Unsigned_32; Val : Unsigned_32; Ok : Boolean; begin Next_Word; Parse_Unsigned32 (Addr, Ok); if not Ok then return; end if; Next_Word; Parse_Unsigned32 (Val, Ok); if not Ok then return; end if; declare W : Unsigned_32; for W'Address use System'To_Address (Addr); pragma Import (Ada, W); pragma Volatile (W); begin W := Val; end; end Proc_Write; Commands : aliased Command_List := (7, ((new String'("help - Print this help"), Proc_Help'Access), (new String'("reset - Reboot the board"), Proc_Reset'Access), (new String'("conv NUM - Print NUM in hexa"), Proc_Conv'Access), (new String'("dump ADDR [LEN] - Hexa byte dump"), Proc_Dump'Access), (new String'("dump32 ADDR [LEN] - Hexa word dump"), Proc_Dump32'Access), (new String'("dump_srec ADDR [LEN] - SREC dump"), Proc_Dump_Srec'Access), (new String'("w ADDR VAL - Write a word to memory"), Proc_Write'Access)), null); begin Register_Commands (Commands'Access); end Commands;
-- { dg-do run } with Disp2_Pkg; use Disp2_Pkg; procedure Disp2 is Obj : Object_Ptr := new Object; begin if Obj.Get_Ptr /= Obj.Impl_Of then raise Program_Error; end if; end;
-- SPDX-FileCopyrightText: 2021 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with WebIDL.Factories; with WebIDL.Tokens; with League.String_Vectors; package WebIDL.Parsers is pragma Preelaborate; type Abstract_Lexer is limited interface; not overriding procedure Next_Token (Self : in out Abstract_Lexer; Value : out WebIDL.Tokens.Token) is abstract; type Parser is tagged limited private; procedure Parse (Self : in out Parser'Class; Lexer : in out Abstract_Lexer'Class; Factory : in out WebIDL.Factories.Factory'Class; Errors : out League.String_Vectors.Universal_String_Vector); private type Parser is tagged limited null record; end WebIDL.Parsers;
with System.Native_Time; with C.sys.time; with C.sys.types; package body System.Native_Calendar is -- use type C.signed_int; -- use type C.signed_long; -- tm_gmtoff -- use type C.sys.types.time_t; Diff : constant := 5680281600.0; -- seconds from 1970-01-01 (0 of POSIX time) -- to 2150-01-01 (0 of Ada time) function To_Time (T : C.sys.types.time_t) return Duration; function To_Time (T : C.sys.types.time_t) return Duration is begin return System.Native_Time.To_Duration (T) - Diff; end To_Time; procedure Fixup ( T : in out C.sys.types.time_t; Current : Second_Number'Base; Expected : Second_Number); procedure Fixup ( T : in out C.sys.types.time_t; Current : Second_Number'Base; Expected : Second_Number) is use type C.sys.types.time_t; begin if (Current + 59) rem 60 = Expected then -- or else (Current = 60 and Expected = 59) T := T - 1; else pragma Assert ( (Current + 1) rem 60 = Expected or else (Current = 60 and then Expected = 0)); T := T + 1; end if; end Fixup; function Is_Leap_Second (T : Duration) return Boolean; function Is_Leap_Second (T : Duration) return Boolean is Aliased_T : aliased C.sys.types.time_t := To_Native_Time (T).tv_sec; tm : aliased C.time.struct_tm; tm_r : access C.time.struct_tm; begin tm_r := C.time.gmtime_r (Aliased_T'Access, tm'Access); return tm_r /= null and then Second_Number'Base (tm_r.tm_sec) = 60; end Is_Leap_Second; -- implementation function To_Native_Time (T : Duration) return Native_Time is begin return System.Native_Time.To_timespec (T + Diff); end To_Native_Time; function To_Time (T : Native_Time) return Duration is begin return System.Native_Time.To_Duration (T) - Diff; end To_Time; function Clock return Native_Time is use type C.signed_int; Result : aliased C.sys.time.struct_timeval; R : C.signed_int; begin R := C.sys.time.gettimeofday (Result'Access, null); if R < 0 then raise Program_Error; -- ??? end if; return System.Native_Time.To_timespec (Result); end Clock; procedure Split ( Date : Time; Year : out Year_Number; Month : out Month_Number; Day : out Day_Number; Seconds : out Day_Duration; Leap_Second : out Boolean; Time_Zone : Time_Offset; Error : out Boolean) is use type C.sys.types.time_t; timespec : aliased C.time.struct_timespec := To_Native_Time (Date); Buffer : aliased C.time.struct_tm := (others => <>); -- uninitialized tm : access C.time.struct_tm; begin tm := C.time.gmtime_r (timespec.tv_sec'Access, Buffer'Access); Error := tm = null; if not Error then declare Second : constant Second_Number'Base := Second_Number'Base (tm.tm_sec); begin -- Leap_Second is always calculated as GMT Leap_Second := Second >= 60; -- other units are calculated by Time_Zone if Time_Zone /= 0 then timespec.tv_sec := timespec.tv_sec + C.sys.types.time_t (Time_Zone) * 60; tm := C.time.gmtime_r (timespec.tv_sec'Access, Buffer'Access); Error := tm = null; if not Error and then not Leap_Second and then Second_Number'Base (tm.tm_sec) /= Second then -- Time_Zone is passed over some leap time Fixup (timespec.tv_sec, Current => Second_Number'Base (tm.tm_sec), Expected => Second); tm := C.time.gmtime_r (timespec.tv_sec'Access, Buffer'Access); Error := tm = null; pragma Assert ( Error or else Second_Number'Base (tm.tm_sec) = Second); end if; end if; end; if not Error then Year := Integer (tm.tm_year) + 1900; Month := Integer (tm.tm_mon) + 1; Day := Day_Number (tm.tm_mday); -- truncate to day tm.tm_hour := 0; tm.tm_min := 0; tm.tm_sec := 0; declare Truncated_Time : C.sys.types.time_t; begin Truncated_Time := C.time.timegm (tm); Error := Truncated_Time = -1; if not Error then timespec.tv_sec := timespec.tv_sec - Truncated_Time; if Leap_Second and then Time_Zone <= 0 then timespec.tv_sec := timespec.tv_sec - 1; end if; Seconds := System.Native_Time.To_Duration (timespec); end if; end; end if; end if; end Split; procedure Split ( Date : Time; Year : out Year_Number; Month : out Month_Number; Day : out Day_Number; Hour : out Hour_Number; Minute : out Minute_Number; Second : out Second_Number; Sub_Second : out Second_Duration; Leap_Second : out Boolean; Day_of_Week : out Day_Name; Time_Zone : Time_Offset; Error : out Boolean) is use type C.sys.types.time_t; timespec : aliased C.time.struct_timespec := To_Native_Time (Date); Buffer : aliased C.time.struct_tm := (others => <>); -- uninitialized tm : access C.time.struct_tm; begin tm := C.time.gmtime_r (timespec.tv_sec'Access, Buffer'Access); Error := tm = null; if not Error then -- Second, Sub_Second and Leap_Second are always calculated as GMT if Second_Number'Base (tm.tm_sec) >= 60 then Second := 59; Leap_Second := True; else Second := Second_Number (tm.tm_sec); Leap_Second := False; end if; Sub_Second := Duration'Fixed_Value ( System.Native_Time.Nanosecond_Number (timespec.tv_nsec)); -- other units are calculated by Time_Zone if Time_Zone /= 0 then if Leap_Second and then Time_Zone < 0 then timespec.tv_sec := timespec.tv_sec - 1; end if; timespec.tv_sec := timespec.tv_sec + C.sys.types.time_t (Time_Zone) * 60; tm := C.time.gmtime_r (timespec.tv_sec'Access, Buffer'Access); Error := tm = null; if not Error and then not Leap_Second and then Second_Number'Base (tm.tm_sec) /= Second then -- Time_Zone is passed over some leap time Fixup (timespec.tv_sec, Current => Second_Number'Base (tm.tm_sec), Expected => Second); tm := C.time.gmtime_r (timespec.tv_sec'Access, Buffer'Access); Error := tm = null; pragma Assert ( Error or else Second_Number'Base (tm.tm_sec) = Second); end if; end if; if not Error then Year := Integer (tm.tm_year) + 1900; Month := Integer (tm.tm_mon) + 1; Day := Day_Number (tm.tm_mday); Hour := Hour_Number (tm.tm_hour); Minute := Minute_Number (tm.tm_min); Day_of_Week := (Integer (tm.tm_wday) + 6) rem 7; -- Day_Name starts from Monday end if; end if; end Split; procedure Time_Of ( Year : Year_Number; Month : Month_Number; Day : Day_Number; Seconds : Day_Duration; Leap_Second : Boolean; Time_Zone : Time_Offset; Result : out Time; Error : out Boolean) is use type C.sys.types.time_t; sec : C.sys.types.time_t; Sub_Second : Second_Duration; tm : aliased C.time.struct_tm := ( tm_sec => 0, tm_min => 0, tm_hour => 0, tm_mday => C.signed_int (Day), tm_mon => C.signed_int (Month_Number'Base (Month) - 1), tm_year => C.signed_int (Year_Number'Base (Year) - 1900), tm_wday => 0, tm_yday => 0, tm_isdst => 0, tm_gmtoff => 0, tm_zone => null); time : aliased C.sys.types.time_t; begin time := C.time.timegm (tm'Access); Error := time = -1; if not Error then declare Seconds_timespec : constant C.time.struct_timespec := System.Native_Time.To_timespec (Seconds); begin sec := Seconds_timespec.tv_sec; Sub_Second := Duration'Fixed_Value (Seconds_timespec.tv_nsec); end; time := time + sec; if Time_Zone /= 0 then time := time - C.sys.types.time_t (Time_Zone * 60); if not Leap_Second then declare Second : constant Second_Number := Second_Number'Base (sec) rem 60; tm_r : access C.time.struct_tm; begin tm_r := C.time.gmtime_r (time'Access, tm'Access); -- reuse tm Error := tm_r = null; if not Error and then Second_Number'Base (tm_r.tm_sec) /= Second then -- Time_Zone is passed over some leap time Fixup (time, Current => Second_Number'Base (tm_r.tm_sec), Expected => Second); end if; end; end if; end if; end if; -- UNIX time starts until 1970, Year_Number stats unitl 1901... if Error then -- to pass negative UNIX time (?) if Year = 1901 and then Month = 1 and then Day = 1 then Result := -7857734400.0; -- first day in Time Error := False; end if; else Result := To_Time (time); end if; if not Error then Result := Result + Sub_Second; if Leap_Second then if Time_Zone <= 0 then Result := Result + 1.0; end if; -- checking Error := not Is_Leap_Second (Result); end if; end if; end Time_Of; procedure Time_Of ( Year : Year_Number; Month : Month_Number; Day : Day_Number; Hour : Hour_Number; Minute : Minute_Number; Second : Second_Number; Sub_Second : Second_Duration; Leap_Second : Boolean; Time_Zone : Time_Offset; Result : out Time; Error : out Boolean) is use type C.sys.types.time_t; tm : aliased C.time.struct_tm := ( tm_sec => C.signed_int (Second), tm_min => C.signed_int (Minute), tm_hour => C.signed_int (Hour), tm_mday => C.signed_int (Day), tm_mon => C.signed_int (Month_Number'Base (Month) - 1), tm_year => C.signed_int (Year_Number'Base (Year) - 1900), tm_wday => 0, tm_yday => 0, tm_isdst => 0, tm_gmtoff => 0, tm_zone => null); time : aliased C.sys.types.time_t; begin time := C.time.timegm (tm'Access); Error := time = -1; if not Error and then Time_Zone /= 0 then time := time - C.sys.types.time_t (Time_Zone * 60); if not Leap_Second then declare tm_r : access C.time.struct_tm; begin tm_r := C.time.gmtime_r (time'Access, tm'Access); -- reuse tm Error := tm_r = null; if not Error and then Second_Number'Base (tm_r.tm_sec) /= Second then -- Time_Zone is passed over some leap time Fixup (time, Current => Second_Number'Base (tm_r.tm_sec), Expected => Second); end if; end; end if; end if; -- UNIX time starts until 1970, Year_Number stats unitl 1901... if Error then -- to pass negative UNIX time (?) if Year = 1901 and then Month = 1 and then Day = 1 then Result := -7857734400.0 -- first day in Time + Duration (((Hour * 60 + Minute) * 60) + Second); Error := False; end if; else Result := To_Time (time); end if; if not Error then Result := Result + Sub_Second; if Leap_Second then if Time_Zone <= 0 then Result := Result + 1.0; end if; -- checking Error := not Is_Leap_Second (Result); end if; end if; end Time_Of; procedure UTC_Time_Offset ( Date : Time; Time_Zone : out Time_Offset; Error : out Boolean) is use type C.signed_long; -- tm_gmtoff -- FreeBSD does not have timezone variable GMT_Time : aliased constant Native_Time := To_Native_Time (Duration (Date)); Local_TM_Buf : aliased C.time.struct_tm; Local_TM : access C.time.struct_tm; begin Local_TM := C.time.localtime_r ( GMT_Time.tv_sec'Access, Local_TM_Buf'Access); Error := Local_TM = null; if not Error then Time_Zone := Time_Offset (Local_TM.tm_gmtoff / 60); end if; end UTC_Time_Offset; procedure Simple_Delay_Until (T : Native_Time) is Timeout_T : constant Duration := System.Native_Time.To_Duration (T); Current_T : constant Duration := System.Native_Time.To_Duration (Clock); D : Duration; begin if Timeout_T > Current_T then D := Timeout_T - Current_T; else D := 0.0; -- always calling Delay_For for abort checking end if; System.Native_Time.Delay_For (D); end Simple_Delay_Until; procedure Delay_Until (T : Native_Time) is begin Delay_Until_Hook.all (T); end Delay_Until; end System.Native_Calendar;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- V A L I D S W -- -- -- -- B o d y -- -- -- -- Copyright (C) 2001-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. 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; package body Validsw is ---------------------------------- -- Reset_Validity_Check_Options -- ---------------------------------- procedure Reset_Validity_Check_Options is begin Validity_Check_Components := False; Validity_Check_Copies := False; Validity_Check_Default := True; Validity_Check_Floating_Point := False; Validity_Check_In_Out_Params := False; Validity_Check_In_Params := False; Validity_Check_Operands := False; Validity_Check_Returns := False; Validity_Check_Subscripts := False; Validity_Check_Tests := False; end Reset_Validity_Check_Options; --------------------------------- -- Save_Validity_Check_Options -- --------------------------------- procedure Save_Validity_Check_Options (Options : out Validity_Check_Options) is P : Natural := 0; procedure Add (C : Character; S : Boolean); -- Add given character C to string if switch S is true procedure Add (C : Character; S : Boolean) is begin if S then P := P + 1; Options (P) := C; end if; end Add; -- Start of processing for Save_Validity_Check_Options begin for K in Options'Range loop Options (K) := ' '; end loop; Add ('n', not Validity_Check_Default); Add ('c', Validity_Check_Copies); Add ('e', Validity_Check_Components); Add ('f', Validity_Check_Floating_Point); Add ('i', Validity_Check_In_Params); Add ('m', Validity_Check_In_Out_Params); Add ('o', Validity_Check_Operands); Add ('r', Validity_Check_Returns); Add ('s', Validity_Check_Subscripts); Add ('t', Validity_Check_Tests); end Save_Validity_Check_Options; ---------------------------------------- -- Set_Default_Validity_Check_Options -- ---------------------------------------- procedure Set_Default_Validity_Check_Options is begin Reset_Validity_Check_Options; Set_Validity_Check_Options ("d"); end Set_Default_Validity_Check_Options; -------------------------------- -- Set_Validity_Check_Options -- -------------------------------- -- Version used when no error checking is required procedure Set_Validity_Check_Options (Options : String) is OK : Boolean; EC : Natural; pragma Warnings (Off, OK); pragma Warnings (Off, EC); begin Set_Validity_Check_Options (Options, OK, EC); end Set_Validity_Check_Options; -- Normal version with error checking procedure Set_Validity_Check_Options (Options : String; OK : out Boolean; Err_Col : out Natural) is J : Natural; C : Character; begin J := Options'First; while J <= Options'Last loop C := Options (J); J := J + 1; -- Turn on validity checking (gets turned off by Vn) Validity_Checks_On := True; case C is when 'c' => Validity_Check_Copies := True; when 'd' => Validity_Check_Default := True; when 'e' => Validity_Check_Components := True; when 'f' => Validity_Check_Floating_Point := True; when 'i' => Validity_Check_In_Params := True; when 'm' => Validity_Check_In_Out_Params := True; when 'o' => Validity_Check_Operands := True; when 'p' => Validity_Check_Parameters := True; when 'r' => Validity_Check_Returns := True; when 's' => Validity_Check_Subscripts := True; when 't' => Validity_Check_Tests := True; when 'C' => Validity_Check_Copies := False; when 'D' => Validity_Check_Default := False; when 'E' => Validity_Check_Components := False; when 'F' => Validity_Check_Floating_Point := False; when 'I' => Validity_Check_In_Params := False; when 'M' => Validity_Check_In_Out_Params := False; when 'O' => Validity_Check_Operands := False; when 'P' => Validity_Check_Parameters := False; when 'R' => Validity_Check_Returns := False; when 'S' => Validity_Check_Subscripts := False; when 'T' => Validity_Check_Tests := False; when 'a' => Validity_Check_Components := True; Validity_Check_Copies := True; Validity_Check_Default := True; Validity_Check_Floating_Point := True; Validity_Check_In_Out_Params := True; Validity_Check_In_Params := True; Validity_Check_Operands := True; Validity_Check_Parameters := True; Validity_Check_Returns := True; Validity_Check_Subscripts := True; Validity_Check_Tests := True; when 'n' => Validity_Check_Components := False; Validity_Check_Copies := False; Validity_Check_Default := False; Validity_Check_Floating_Point := False; Validity_Check_In_Out_Params := False; Validity_Check_In_Params := False; Validity_Check_Operands := False; Validity_Check_Parameters := False; Validity_Check_Returns := False; Validity_Check_Subscripts := False; Validity_Check_Tests := False; Validity_Checks_On := False; when ' ' => null; when others => if Ignore_Unrecognized_VWY_Switches then Write_Line ("unrecognized switch -gnatV" & C & " ignored"); else OK := False; Err_Col := J - 1; return; end if; end case; end loop; OK := True; Err_Col := Options'Last + 1; end Set_Validity_Check_Options; end Validsw;
-- This spec has been automatically generated from STM32L4x2.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.USB is pragma Preelaborate; --------------- -- Registers -- --------------- subtype EP0R_EA_Field is HAL.UInt4; subtype EP0R_STAT_TX_Field is HAL.UInt2; subtype EP0R_EP_TYPE_Field is HAL.UInt2; subtype EP0R_STAT_RX_Field is HAL.UInt2; -- endpoint 0 register type EP0R_Register is record -- Endpoint address EA : EP0R_EA_Field := 16#0#; -- Status bits, for transmission transfers STAT_TX : EP0R_STAT_TX_Field := 16#0#; -- Data Toggle, for transmission transfers DTOG_TX : Boolean := False; -- Correct Transfer for transmission CTR_TX : Boolean := False; -- Endpoint kind EP_KIND : Boolean := False; -- Endpoint type EP_TYPE : EP0R_EP_TYPE_Field := 16#0#; -- Setup transaction completed SETUP : Boolean := False; -- Status bits, for reception transfers STAT_RX : EP0R_STAT_RX_Field := 16#0#; -- Data Toggle, for reception transfers DTOG_RX : Boolean := False; -- Correct transfer for reception CTR_RX : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EP0R_Register use record EA at 0 range 0 .. 3; STAT_TX at 0 range 4 .. 5; DTOG_TX at 0 range 6 .. 6; CTR_TX at 0 range 7 .. 7; EP_KIND at 0 range 8 .. 8; EP_TYPE at 0 range 9 .. 10; SETUP at 0 range 11 .. 11; STAT_RX at 0 range 12 .. 13; DTOG_RX at 0 range 14 .. 14; CTR_RX at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype EP1R_EA_Field is HAL.UInt4; subtype EP1R_STAT_TX_Field is HAL.UInt2; subtype EP1R_EP_TYPE_Field is HAL.UInt2; subtype EP1R_STAT_RX_Field is HAL.UInt2; -- endpoint 1 register type EP1R_Register is record -- Endpoint address EA : EP1R_EA_Field := 16#0#; -- Status bits, for transmission transfers STAT_TX : EP1R_STAT_TX_Field := 16#0#; -- Data Toggle, for transmission transfers DTOG_TX : Boolean := False; -- Correct Transfer for transmission CTR_TX : Boolean := False; -- Endpoint kind EP_KIND : Boolean := False; -- Endpoint type EP_TYPE : EP1R_EP_TYPE_Field := 16#0#; -- Setup transaction completed SETUP : Boolean := False; -- Status bits, for reception transfers STAT_RX : EP1R_STAT_RX_Field := 16#0#; -- Data Toggle, for reception transfers DTOG_RX : Boolean := False; -- Correct transfer for reception CTR_RX : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EP1R_Register use record EA at 0 range 0 .. 3; STAT_TX at 0 range 4 .. 5; DTOG_TX at 0 range 6 .. 6; CTR_TX at 0 range 7 .. 7; EP_KIND at 0 range 8 .. 8; EP_TYPE at 0 range 9 .. 10; SETUP at 0 range 11 .. 11; STAT_RX at 0 range 12 .. 13; DTOG_RX at 0 range 14 .. 14; CTR_RX at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype EP2R_EA_Field is HAL.UInt4; subtype EP2R_STAT_TX_Field is HAL.UInt2; subtype EP2R_EP_TYPE_Field is HAL.UInt2; subtype EP2R_STAT_RX_Field is HAL.UInt2; -- endpoint 2 register type EP2R_Register is record -- Endpoint address EA : EP2R_EA_Field := 16#0#; -- Status bits, for transmission transfers STAT_TX : EP2R_STAT_TX_Field := 16#0#; -- Data Toggle, for transmission transfers DTOG_TX : Boolean := False; -- Correct Transfer for transmission CTR_TX : Boolean := False; -- Endpoint kind EP_KIND : Boolean := False; -- Endpoint type EP_TYPE : EP2R_EP_TYPE_Field := 16#0#; -- Setup transaction completed SETUP : Boolean := False; -- Status bits, for reception transfers STAT_RX : EP2R_STAT_RX_Field := 16#0#; -- Data Toggle, for reception transfers DTOG_RX : Boolean := False; -- Correct transfer for reception CTR_RX : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EP2R_Register use record EA at 0 range 0 .. 3; STAT_TX at 0 range 4 .. 5; DTOG_TX at 0 range 6 .. 6; CTR_TX at 0 range 7 .. 7; EP_KIND at 0 range 8 .. 8; EP_TYPE at 0 range 9 .. 10; SETUP at 0 range 11 .. 11; STAT_RX at 0 range 12 .. 13; DTOG_RX at 0 range 14 .. 14; CTR_RX at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype EP3R_EA_Field is HAL.UInt4; subtype EP3R_STAT_TX_Field is HAL.UInt2; subtype EP3R_EP_TYPE_Field is HAL.UInt2; subtype EP3R_STAT_RX_Field is HAL.UInt2; -- endpoint 3 register type EP3R_Register is record -- Endpoint address EA : EP3R_EA_Field := 16#0#; -- Status bits, for transmission transfers STAT_TX : EP3R_STAT_TX_Field := 16#0#; -- Data Toggle, for transmission transfers DTOG_TX : Boolean := False; -- Correct Transfer for transmission CTR_TX : Boolean := False; -- Endpoint kind EP_KIND : Boolean := False; -- Endpoint type EP_TYPE : EP3R_EP_TYPE_Field := 16#0#; -- Setup transaction completed SETUP : Boolean := False; -- Status bits, for reception transfers STAT_RX : EP3R_STAT_RX_Field := 16#0#; -- Data Toggle, for reception transfers DTOG_RX : Boolean := False; -- Correct transfer for reception CTR_RX : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EP3R_Register use record EA at 0 range 0 .. 3; STAT_TX at 0 range 4 .. 5; DTOG_TX at 0 range 6 .. 6; CTR_TX at 0 range 7 .. 7; EP_KIND at 0 range 8 .. 8; EP_TYPE at 0 range 9 .. 10; SETUP at 0 range 11 .. 11; STAT_RX at 0 range 12 .. 13; DTOG_RX at 0 range 14 .. 14; CTR_RX at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype EP4R_EA_Field is HAL.UInt4; subtype EP4R_STAT_TX_Field is HAL.UInt2; subtype EP4R_EP_TYPE_Field is HAL.UInt2; subtype EP4R_STAT_RX_Field is HAL.UInt2; -- endpoint 4 register type EP4R_Register is record -- Endpoint address EA : EP4R_EA_Field := 16#0#; -- Status bits, for transmission transfers STAT_TX : EP4R_STAT_TX_Field := 16#0#; -- Data Toggle, for transmission transfers DTOG_TX : Boolean := False; -- Correct Transfer for transmission CTR_TX : Boolean := False; -- Endpoint kind EP_KIND : Boolean := False; -- Endpoint type EP_TYPE : EP4R_EP_TYPE_Field := 16#0#; -- Setup transaction completed SETUP : Boolean := False; -- Status bits, for reception transfers STAT_RX : EP4R_STAT_RX_Field := 16#0#; -- Data Toggle, for reception transfers DTOG_RX : Boolean := False; -- Correct transfer for reception CTR_RX : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EP4R_Register use record EA at 0 range 0 .. 3; STAT_TX at 0 range 4 .. 5; DTOG_TX at 0 range 6 .. 6; CTR_TX at 0 range 7 .. 7; EP_KIND at 0 range 8 .. 8; EP_TYPE at 0 range 9 .. 10; SETUP at 0 range 11 .. 11; STAT_RX at 0 range 12 .. 13; DTOG_RX at 0 range 14 .. 14; CTR_RX at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype EP5R_EA_Field is HAL.UInt4; subtype EP5R_STAT_TX_Field is HAL.UInt2; subtype EP5R_EP_TYPE_Field is HAL.UInt2; subtype EP5R_STAT_RX_Field is HAL.UInt2; -- endpoint 5 register type EP5R_Register is record -- Endpoint address EA : EP5R_EA_Field := 16#0#; -- Status bits, for transmission transfers STAT_TX : EP5R_STAT_TX_Field := 16#0#; -- Data Toggle, for transmission transfers DTOG_TX : Boolean := False; -- Correct Transfer for transmission CTR_TX : Boolean := False; -- Endpoint kind EP_KIND : Boolean := False; -- Endpoint type EP_TYPE : EP5R_EP_TYPE_Field := 16#0#; -- Setup transaction completed SETUP : Boolean := False; -- Status bits, for reception transfers STAT_RX : EP5R_STAT_RX_Field := 16#0#; -- Data Toggle, for reception transfers DTOG_RX : Boolean := False; -- Correct transfer for reception CTR_RX : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EP5R_Register use record EA at 0 range 0 .. 3; STAT_TX at 0 range 4 .. 5; DTOG_TX at 0 range 6 .. 6; CTR_TX at 0 range 7 .. 7; EP_KIND at 0 range 8 .. 8; EP_TYPE at 0 range 9 .. 10; SETUP at 0 range 11 .. 11; STAT_RX at 0 range 12 .. 13; DTOG_RX at 0 range 14 .. 14; CTR_RX at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype EP6R_EA_Field is HAL.UInt4; subtype EP6R_STAT_TX_Field is HAL.UInt2; subtype EP6R_EP_TYPE_Field is HAL.UInt2; subtype EP6R_STAT_RX_Field is HAL.UInt2; -- endpoint 6 register type EP6R_Register is record -- Endpoint address EA : EP6R_EA_Field := 16#0#; -- Status bits, for transmission transfers STAT_TX : EP6R_STAT_TX_Field := 16#0#; -- Data Toggle, for transmission transfers DTOG_TX : Boolean := False; -- Correct Transfer for transmission CTR_TX : Boolean := False; -- Endpoint kind EP_KIND : Boolean := False; -- Endpoint type EP_TYPE : EP6R_EP_TYPE_Field := 16#0#; -- Setup transaction completed SETUP : Boolean := False; -- Status bits, for reception transfers STAT_RX : EP6R_STAT_RX_Field := 16#0#; -- Data Toggle, for reception transfers DTOG_RX : Boolean := False; -- Correct transfer for reception CTR_RX : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EP6R_Register use record EA at 0 range 0 .. 3; STAT_TX at 0 range 4 .. 5; DTOG_TX at 0 range 6 .. 6; CTR_TX at 0 range 7 .. 7; EP_KIND at 0 range 8 .. 8; EP_TYPE at 0 range 9 .. 10; SETUP at 0 range 11 .. 11; STAT_RX at 0 range 12 .. 13; DTOG_RX at 0 range 14 .. 14; CTR_RX at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype EP7R_EA_Field is HAL.UInt4; subtype EP7R_STAT_TX_Field is HAL.UInt2; subtype EP7R_EP_TYPE_Field is HAL.UInt2; subtype EP7R_STAT_RX_Field is HAL.UInt2; -- endpoint 7 register type EP7R_Register is record -- Endpoint address EA : EP7R_EA_Field := 16#0#; -- Status bits, for transmission transfers STAT_TX : EP7R_STAT_TX_Field := 16#0#; -- Data Toggle, for transmission transfers DTOG_TX : Boolean := False; -- Correct Transfer for transmission CTR_TX : Boolean := False; -- Endpoint kind EP_KIND : Boolean := False; -- Endpoint type EP_TYPE : EP7R_EP_TYPE_Field := 16#0#; -- Setup transaction completed SETUP : Boolean := False; -- Status bits, for reception transfers STAT_RX : EP7R_STAT_RX_Field := 16#0#; -- Data Toggle, for reception transfers DTOG_RX : Boolean := False; -- Correct transfer for reception CTR_RX : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EP7R_Register use record EA at 0 range 0 .. 3; STAT_TX at 0 range 4 .. 5; DTOG_TX at 0 range 6 .. 6; CTR_TX at 0 range 7 .. 7; EP_KIND at 0 range 8 .. 8; EP_TYPE at 0 range 9 .. 10; SETUP at 0 range 11 .. 11; STAT_RX at 0 range 12 .. 13; DTOG_RX at 0 range 14 .. 14; CTR_RX at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- control register type CNTR_Register is record -- Force USB Reset FRES : Boolean := True; -- Power down PDWN : Boolean := True; -- Low-power mode LPMODE : Boolean := False; -- Force suspend FSUSP : Boolean := False; -- Resume request RESUME : Boolean := False; -- LPM L1 Resume request L1RESUME : Boolean := False; -- unspecified Reserved_6_6 : HAL.Bit := 16#0#; -- LPM L1 state request interrupt mask L1REQM : Boolean := False; -- Expected start of frame interrupt mask ESOFM : Boolean := False; -- Start of frame interrupt mask SOFM : Boolean := False; -- USB reset interrupt mask RESETM : Boolean := False; -- Suspend mode interrupt mask SUSPM : Boolean := False; -- Wakeup interrupt mask WKUPM : Boolean := False; -- Error interrupt mask ERRM : Boolean := False; -- Packet memory area over / underrun interrupt mask PMAOVRM : Boolean := False; -- Correct transfer interrupt mask CTRM : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CNTR_Register use record FRES at 0 range 0 .. 0; PDWN at 0 range 1 .. 1; LPMODE at 0 range 2 .. 2; FSUSP at 0 range 3 .. 3; RESUME at 0 range 4 .. 4; L1RESUME at 0 range 5 .. 5; Reserved_6_6 at 0 range 6 .. 6; L1REQM at 0 range 7 .. 7; ESOFM at 0 range 8 .. 8; SOFM at 0 range 9 .. 9; RESETM at 0 range 10 .. 10; SUSPM at 0 range 11 .. 11; WKUPM at 0 range 12 .. 12; ERRM at 0 range 13 .. 13; PMAOVRM at 0 range 14 .. 14; CTRM at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype ISTR_EP_ID_Field is HAL.UInt4; -- interrupt status register type ISTR_Register is record -- Read-only. Endpoint Identifier EP_ID : ISTR_EP_ID_Field := 16#0#; -- Read-only. Direction of transaction DIR : Boolean := False; -- unspecified Reserved_5_6 : HAL.UInt2 := 16#0#; -- LPM L1 state request L1REQ : Boolean := False; -- Expected start frame ESOF : Boolean := False; -- start of frame SOF : Boolean := False; -- reset request RESET : Boolean := False; -- Suspend mode request SUSP : Boolean := False; -- Wakeup WKUP : Boolean := False; -- Error ERR : Boolean := False; -- Packet memory area over / underrun PMAOVR : Boolean := False; -- Read-only. Correct transfer CTR : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ISTR_Register use record EP_ID at 0 range 0 .. 3; DIR at 0 range 4 .. 4; Reserved_5_6 at 0 range 5 .. 6; L1REQ at 0 range 7 .. 7; ESOF at 0 range 8 .. 8; SOF at 0 range 9 .. 9; RESET at 0 range 10 .. 10; SUSP at 0 range 11 .. 11; WKUP at 0 range 12 .. 12; ERR at 0 range 13 .. 13; PMAOVR at 0 range 14 .. 14; CTR at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype FNR_FN_Field is HAL.UInt11; subtype FNR_LSOF_Field is HAL.UInt2; -- frame number register type FNR_Register is record -- Read-only. Frame number FN : FNR_FN_Field; -- Read-only. Lost SOF LSOF : FNR_LSOF_Field; -- Read-only. Locked LCK : Boolean; -- Read-only. Receive data - line status RXDM : Boolean; -- Read-only. Receive data + line status RXDP : Boolean; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FNR_Register use record FN at 0 range 0 .. 10; LSOF at 0 range 11 .. 12; LCK at 0 range 13 .. 13; RXDM at 0 range 14 .. 14; RXDP at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DADDR_ADD_Field is HAL.UInt7; -- device address type DADDR_Register is record -- Device address ADD : DADDR_ADD_Field := 16#0#; -- Enable function EF : Boolean := False; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DADDR_Register use record ADD at 0 range 0 .. 6; EF at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype BTABLE_BTABLE_Field is HAL.UInt13; -- Buffer table address type BTABLE_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- Buffer table BTABLE : BTABLE_BTABLE_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BTABLE_Register use record Reserved_0_2 at 0 range 0 .. 2; BTABLE at 0 range 3 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype LPMCSR_BESL_Field is HAL.UInt4; -- LPM control and status register type LPMCSR_Register is record -- LPM support enable LPMEN : Boolean := False; -- LPM Token acknowledge enable LPMACK : Boolean := False; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- Read-only. bRemoteWake value REMWAKE : Boolean := False; -- Read-only. BESL value BESL : LPMCSR_BESL_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for LPMCSR_Register use record LPMEN at 0 range 0 .. 0; LPMACK at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; REMWAKE at 0 range 3 .. 3; BESL at 0 range 4 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- Battery charging detector type BCDR_Register is record -- Battery charging detector BCDEN : Boolean := False; -- Data contact detection DCDEN : Boolean := False; -- Primary detection PDEN : Boolean := False; -- Secondary detection SDEN : Boolean := False; -- Read-only. Data contact detection DCDET : Boolean := False; -- Read-only. Primary detection PDET : Boolean := False; -- Read-only. Secondary detection SDET : Boolean := False; -- Read-only. DM pull-up detection status PS2DET : Boolean := False; -- unspecified Reserved_8_14 : HAL.UInt7 := 16#0#; -- DP pull-up control DPPU : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BCDR_Register use record BCDEN at 0 range 0 .. 0; DCDEN at 0 range 1 .. 1; PDEN at 0 range 2 .. 2; SDEN at 0 range 3 .. 3; DCDET at 0 range 4 .. 4; PDET at 0 range 5 .. 5; SDET at 0 range 6 .. 6; PS2DET at 0 range 7 .. 7; Reserved_8_14 at 0 range 8 .. 14; DPPU at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Universal serial bus full-speed device interface type USB_Peripheral is record -- endpoint 0 register EP0R : aliased EP0R_Register; -- endpoint 1 register EP1R : aliased EP1R_Register; -- endpoint 2 register EP2R : aliased EP2R_Register; -- endpoint 3 register EP3R : aliased EP3R_Register; -- endpoint 4 register EP4R : aliased EP4R_Register; -- endpoint 5 register EP5R : aliased EP5R_Register; -- endpoint 6 register EP6R : aliased EP6R_Register; -- endpoint 7 register EP7R : aliased EP7R_Register; -- control register CNTR : aliased CNTR_Register; -- interrupt status register ISTR : aliased ISTR_Register; -- frame number register FNR : aliased FNR_Register; -- device address DADDR : aliased DADDR_Register; -- Buffer table address BTABLE : aliased BTABLE_Register; -- LPM control and status register LPMCSR : aliased LPMCSR_Register; -- Battery charging detector BCDR : aliased BCDR_Register; end record with Volatile; for USB_Peripheral use record EP0R at 16#0# range 0 .. 31; EP1R at 16#4# range 0 .. 31; EP2R at 16#8# range 0 .. 31; EP3R at 16#C# range 0 .. 31; EP4R at 16#10# range 0 .. 31; EP5R at 16#14# range 0 .. 31; EP6R at 16#18# range 0 .. 31; EP7R at 16#1C# range 0 .. 31; CNTR at 16#40# range 0 .. 31; ISTR at 16#44# range 0 .. 31; FNR at 16#48# range 0 .. 31; DADDR at 16#4C# range 0 .. 31; BTABLE at 16#50# range 0 .. 31; LPMCSR at 16#54# range 0 .. 31; BCDR at 16#58# range 0 .. 31; end record; -- Universal serial bus full-speed device interface USB_FS_Periph : aliased USB_Peripheral with Import, Address => System'To_Address (16#40006800#); -- Universal serial bus full-speed device interface USB_SRAM_Periph : aliased USB_Peripheral with Import, Address => System'To_Address (16#40006C00#); end STM32_SVD.USB;
-- Generated by Snowball 2.2.0 - https://snowballstem.org/ package Stemmer.Arabic with SPARK_Mode is type Context_Type is new Stemmer.Context_Type with private; procedure Stem (Z : in out Context_Type; Result : out Boolean); private type Context_Type is new Stemmer.Context_Type with record B_Is_defined : Boolean; B_Is_verb : Boolean; B_Is_noun : Boolean; end record; end Stemmer.Arabic;
pragma Style_Checks (Off); -- This spec has been automatically generated from STM32H743x.svd pragma Restrictions (No_Elaboration_Code); with HAL; with System; package STM32_SVD.RCC is pragma Preelaborate; --------------- -- Registers -- --------------- subtype CR_HSIDIV_Field is HAL.UInt2; -- clock control register type CR_Register is record -- Internal high-speed clock enable HSION : Boolean := True; -- High Speed Internal clock enable in Stop mode HSIKERON : Boolean := True; -- HSI clock ready flag HSIRDY : Boolean := False; -- HSI clock divider HSIDIV : CR_HSIDIV_Field := 16#0#; -- HSI divider flag HSIDIVF : Boolean := False; -- unspecified Reserved_6_6 : HAL.Bit := 16#0#; -- CSI clock enable CSION : Boolean := True; -- CSI clock ready flag CSIRDY : Boolean := False; -- CSI clock enable in Stop mode CSIKERON : Boolean := False; -- unspecified Reserved_10_11 : HAL.UInt2 := 16#0#; -- RC48 clock enable HSI48ON : Boolean := False; -- RC48 clock ready flag HSI48RDY : Boolean := False; -- D1 domain clocks ready flag D1CKRDY : Boolean := False; -- D2 domain clocks ready flag D2CKRDY : Boolean := False; -- HSE clock enable HSEON : Boolean := False; -- HSE clock ready flag HSERDY : Boolean := False; -- HSE clock bypass HSEBYP : Boolean := False; -- HSE Clock Security System enable HSECSSON : Boolean := False; -- unspecified Reserved_20_23 : HAL.UInt4 := 16#0#; -- PLL1 enable PLL1ON : Boolean := False; -- PLL1 clock ready flag PLL1RDY : Boolean := False; -- PLL2 enable PLL2ON : Boolean := False; -- PLL2 clock ready flag PLL2RDY : Boolean := False; -- PLL3 enable PLL3ON : Boolean := False; -- PLL3 clock ready flag PLL3RDY : Boolean := False; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CR_Register use record HSION at 0 range 0 .. 0; HSIKERON at 0 range 1 .. 1; HSIRDY at 0 range 2 .. 2; HSIDIV at 0 range 3 .. 4; HSIDIVF at 0 range 5 .. 5; Reserved_6_6 at 0 range 6 .. 6; CSION at 0 range 7 .. 7; CSIRDY at 0 range 8 .. 8; CSIKERON at 0 range 9 .. 9; Reserved_10_11 at 0 range 10 .. 11; HSI48ON at 0 range 12 .. 12; HSI48RDY at 0 range 13 .. 13; D1CKRDY at 0 range 14 .. 14; D2CKRDY at 0 range 15 .. 15; HSEON at 0 range 16 .. 16; HSERDY at 0 range 17 .. 17; HSEBYP at 0 range 18 .. 18; HSECSSON at 0 range 19 .. 19; Reserved_20_23 at 0 range 20 .. 23; PLL1ON at 0 range 24 .. 24; PLL1RDY at 0 range 25 .. 25; PLL2ON at 0 range 26 .. 26; PLL2RDY at 0 range 27 .. 27; PLL3ON at 0 range 28 .. 28; PLL3RDY at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; subtype ICSCR_HSICAL_Field is HAL.UInt12; subtype ICSCR_HSITRIM_Field is HAL.UInt6; subtype ICSCR_CSICAL_Field is HAL.UInt8; subtype ICSCR_CSITRIM_Field is HAL.UInt5; -- RCC Internal Clock Source Calibration Register type ICSCR_Register is record -- Read-only. HSI clock calibration HSICAL : ICSCR_HSICAL_Field := 16#0#; -- HSI clock trimming HSITRIM : ICSCR_HSITRIM_Field := 16#0#; -- Read-only. CSI clock calibration CSICAL : ICSCR_CSICAL_Field := 16#0#; -- CSI clock trimming CSITRIM : ICSCR_CSITRIM_Field := 16#10#; -- unspecified Reserved_31_31 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ICSCR_Register use record HSICAL at 0 range 0 .. 11; HSITRIM at 0 range 12 .. 17; CSICAL at 0 range 18 .. 25; CSITRIM at 0 range 26 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; subtype CRRCR_RC48CAL_Field is HAL.UInt10; -- RCC Clock Recovery RC Register type CRRCR_Register is record -- Read-only. Internal RC 48 MHz clock calibration RC48CAL : CRRCR_RC48CAL_Field; -- unspecified Reserved_10_31 : HAL.UInt22; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CRRCR_Register use record RC48CAL at 0 range 0 .. 9; Reserved_10_31 at 0 range 10 .. 31; end record; subtype CFGR_SW_Field is HAL.UInt3; subtype CFGR_SWS_Field is HAL.UInt3; subtype CFGR_RTCPRE_Field is HAL.UInt6; subtype CFGR_MCO1PRE_Field is HAL.UInt4; subtype CFGR_MCO1SEL_Field is HAL.UInt3; subtype CFGR_MCO2PRE_Field is HAL.UInt4; subtype CFGR_MCO2SEL_Field is HAL.UInt3; -- RCC Clock Configuration Register type CFGR_Register is record -- System clock switch SW : CFGR_SW_Field := 16#0#; -- System clock switch status SWS : CFGR_SWS_Field := 16#0#; -- System clock selection after a wake up from system Stop STOPWUCK : Boolean := False; -- Kernel clock selection after a wake up from system Stop STOPKERWUCK : Boolean := False; -- HSE division factor for RTC clock RTCPRE : CFGR_RTCPRE_Field := 16#0#; -- High Resolution Timer clock prescaler selection HRTIMSEL : Boolean := False; -- Timers clocks prescaler selection TIMPRE : Boolean := False; -- unspecified Reserved_16_17 : HAL.UInt2 := 16#0#; -- MCO1 prescaler MCO1PRE : CFGR_MCO1PRE_Field := 16#0#; -- Micro-controller clock output 1 MCO1SEL : CFGR_MCO1SEL_Field := 16#0#; -- MCO2 prescaler MCO2PRE : CFGR_MCO2PRE_Field := 16#0#; -- Micro-controller clock output 2 MCO2SEL : CFGR_MCO2SEL_Field := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CFGR_Register use record SW at 0 range 0 .. 2; SWS at 0 range 3 .. 5; STOPWUCK at 0 range 6 .. 6; STOPKERWUCK at 0 range 7 .. 7; RTCPRE at 0 range 8 .. 13; HRTIMSEL at 0 range 14 .. 14; TIMPRE at 0 range 15 .. 15; Reserved_16_17 at 0 range 16 .. 17; MCO1PRE at 0 range 18 .. 21; MCO1SEL at 0 range 22 .. 24; MCO2PRE at 0 range 25 .. 28; MCO2SEL at 0 range 29 .. 31; end record; subtype D1CFGR_HPRE_Field is HAL.UInt4; subtype D1CFGR_D1PPRE_Field is HAL.UInt3; subtype D1CFGR_D1CPRE_Field is HAL.UInt4; -- RCC Domain 1 Clock Configuration Register type D1CFGR_Register is record -- D1 domain AHB prescaler HPRE : D1CFGR_HPRE_Field := 16#0#; -- D1 domain APB3 prescaler D1PPRE : D1CFGR_D1PPRE_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- D1 domain Core prescaler D1CPRE : D1CFGR_D1CPRE_Field := 16#0#; -- unspecified Reserved_12_31 : HAL.UInt20 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for D1CFGR_Register use record HPRE at 0 range 0 .. 3; D1PPRE at 0 range 4 .. 6; Reserved_7_7 at 0 range 7 .. 7; D1CPRE at 0 range 8 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; subtype D2CFGR_D2PPRE1_Field is HAL.UInt3; subtype D2CFGR_D2PPRE2_Field is HAL.UInt3; -- RCC Domain 2 Clock Configuration Register type D2CFGR_Register is record -- unspecified Reserved_0_3 : HAL.UInt4 := 16#0#; -- D2 domain APB1 prescaler D2PPRE1 : D2CFGR_D2PPRE1_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- D2 domain APB2 prescaler D2PPRE2 : D2CFGR_D2PPRE2_Field := 16#0#; -- unspecified Reserved_11_31 : HAL.UInt21 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for D2CFGR_Register use record Reserved_0_3 at 0 range 0 .. 3; D2PPRE1 at 0 range 4 .. 6; Reserved_7_7 at 0 range 7 .. 7; D2PPRE2 at 0 range 8 .. 10; Reserved_11_31 at 0 range 11 .. 31; end record; subtype D3CFGR_D3PPRE_Field is HAL.UInt3; -- RCC Domain 3 Clock Configuration Register type D3CFGR_Register is record -- unspecified Reserved_0_3 : HAL.UInt4 := 16#0#; -- D3 domain APB4 prescaler D3PPRE : D3CFGR_D3PPRE_Field := 16#0#; -- unspecified Reserved_7_31 : HAL.UInt25 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for D3CFGR_Register use record Reserved_0_3 at 0 range 0 .. 3; D3PPRE at 0 range 4 .. 6; Reserved_7_31 at 0 range 7 .. 31; end record; subtype PLLCKSELR_PLLSRC_Field is HAL.UInt2; subtype PLLCKSELR_DIVM1_Field is HAL.UInt6; subtype PLLCKSELR_DIVM2_Field is HAL.UInt6; subtype PLLCKSELR_DIVM3_Field is HAL.UInt6; -- RCC PLLs Clock Source Selection Register type PLLCKSELR_Register is record -- DIVMx and PLLs clock source selection PLLSRC : PLLCKSELR_PLLSRC_Field := 16#0#; -- unspecified Reserved_2_3 : HAL.UInt2 := 16#0#; -- Prescaler for PLL1 DIVM1 : PLLCKSELR_DIVM1_Field := 16#20#; -- unspecified Reserved_10_11 : HAL.UInt2 := 16#0#; -- Prescaler for PLL2 DIVM2 : PLLCKSELR_DIVM2_Field := 16#20#; -- unspecified Reserved_18_19 : HAL.UInt2 := 16#0#; -- Prescaler for PLL3 DIVM3 : PLLCKSELR_DIVM3_Field := 16#20#; -- unspecified Reserved_26_31 : HAL.UInt6 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for PLLCKSELR_Register use record PLLSRC at 0 range 0 .. 1; Reserved_2_3 at 0 range 2 .. 3; DIVM1 at 0 range 4 .. 9; Reserved_10_11 at 0 range 10 .. 11; DIVM2 at 0 range 12 .. 17; Reserved_18_19 at 0 range 18 .. 19; DIVM3 at 0 range 20 .. 25; Reserved_26_31 at 0 range 26 .. 31; end record; subtype PLLCFGR_PLL1RGE_Field is HAL.UInt2; subtype PLLCFGR_PLL2RGE_Field is HAL.UInt2; subtype PLLCFGR_PLL3RGE_Field is HAL.UInt2; -- RCC PLLs Configuration Register type PLLCFGR_Register is record -- PLL1 fractional latch enable PLL1FRACEN : Boolean := False; -- PLL1 VCO selection PLL1VCOSEL : Boolean := False; -- PLL1 input frequency range PLL1RGE : PLLCFGR_PLL1RGE_Field := 16#0#; -- PLL2 fractional latch enable PLL2FRACEN : Boolean := False; -- PLL2 VCO selection PLL2VCOSEL : Boolean := False; -- PLL2 input frequency range PLL2RGE : PLLCFGR_PLL2RGE_Field := 16#0#; -- PLL3 fractional latch enable PLL3FRACEN : Boolean := False; -- PLL3 VCO selection PLL3VCOSEL : Boolean := False; -- PLL3 input frequency range PLL3RGE : PLLCFGR_PLL3RGE_Field := 16#0#; -- unspecified Reserved_12_15 : HAL.UInt4 := 16#0#; -- PLL1 DIVP divider output enable DIVP1EN : Boolean := True; -- PLL1 DIVQ divider output enable DIVQ1EN : Boolean := True; -- PLL1 DIVR divider output enable DIVR1EN : Boolean := True; -- PLL2 DIVP divider output enable DIVP2EN : Boolean := True; -- PLL2 DIVQ divider output enable DIVQ2EN : Boolean := True; -- PLL2 DIVR divider output enable DIVR2EN : Boolean := True; -- PLL3 DIVP divider output enable DIVP3EN : Boolean := True; -- PLL3 DIVQ divider output enable DIVQ3EN : Boolean := True; -- PLL3 DIVR divider output enable DIVR3EN : Boolean := True; -- unspecified Reserved_25_31 : HAL.UInt7 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for PLLCFGR_Register use record PLL1FRACEN at 0 range 0 .. 0; PLL1VCOSEL at 0 range 1 .. 1; PLL1RGE at 0 range 2 .. 3; PLL2FRACEN at 0 range 4 .. 4; PLL2VCOSEL at 0 range 5 .. 5; PLL2RGE at 0 range 6 .. 7; PLL3FRACEN at 0 range 8 .. 8; PLL3VCOSEL at 0 range 9 .. 9; PLL3RGE at 0 range 10 .. 11; Reserved_12_15 at 0 range 12 .. 15; DIVP1EN at 0 range 16 .. 16; DIVQ1EN at 0 range 17 .. 17; DIVR1EN at 0 range 18 .. 18; DIVP2EN at 0 range 19 .. 19; DIVQ2EN at 0 range 20 .. 20; DIVR2EN at 0 range 21 .. 21; DIVP3EN at 0 range 22 .. 22; DIVQ3EN at 0 range 23 .. 23; DIVR3EN at 0 range 24 .. 24; Reserved_25_31 at 0 range 25 .. 31; end record; subtype PLL1DIVR_DIVN1_Field is HAL.UInt9; subtype PLL1DIVR_DIVP1_Field is HAL.UInt7; subtype PLL1DIVR_DIVQ1_Field is HAL.UInt7; subtype PLL1DIVR_DIVR1_Field is HAL.UInt7; -- RCC PLL1 Dividers Configuration Register type PLL1DIVR_Register is record -- Multiplication factor for PLL1 VCO DIVN1 : PLL1DIVR_DIVN1_Field := 16#80#; -- PLL1 DIVP division factor DIVP1 : PLL1DIVR_DIVP1_Field := 16#1#; -- PLL1 DIVQ division factor DIVQ1 : PLL1DIVR_DIVQ1_Field := 16#1#; -- unspecified Reserved_23_23 : HAL.Bit := 16#0#; -- PLL1 DIVR division factor DIVR1 : PLL1DIVR_DIVR1_Field := 16#1#; -- unspecified Reserved_31_31 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for PLL1DIVR_Register use record DIVN1 at 0 range 0 .. 8; DIVP1 at 0 range 9 .. 15; DIVQ1 at 0 range 16 .. 22; Reserved_23_23 at 0 range 23 .. 23; DIVR1 at 0 range 24 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; subtype PLL1FRACR_FRACN1_Field is HAL.UInt13; -- RCC PLL1 Fractional Divider Register type PLL1FRACR_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- Fractional part of the multiplication factor for PLL1 VCO FRACN1 : PLL1FRACR_FRACN1_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for PLL1FRACR_Register use record Reserved_0_2 at 0 range 0 .. 2; FRACN1 at 0 range 3 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype PLL2DIVR_DIVN2_Field is HAL.UInt9; subtype PLL2DIVR_DIVP2_Field is HAL.UInt7; subtype PLL2DIVR_DIVQ2_Field is HAL.UInt7; subtype PLL2DIVR_DIVR2_Field is HAL.UInt7; -- RCC PLL2 Dividers Configuration Register type PLL2DIVR_Register is record -- Multiplication factor for PLL2 VCO DIVN2 : PLL2DIVR_DIVN2_Field := 16#80#; -- PLL2 DIVP division factor DIVP2 : PLL2DIVR_DIVP2_Field := 16#1#; -- PLL2 DIVQ division factor DIVQ2 : PLL2DIVR_DIVQ2_Field := 16#1#; -- unspecified Reserved_23_23 : HAL.Bit := 16#0#; -- PLL2 DIVR division factor DIVR2 : PLL2DIVR_DIVR2_Field := 16#1#; -- unspecified Reserved_31_31 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for PLL2DIVR_Register use record DIVN2 at 0 range 0 .. 8; DIVP2 at 0 range 9 .. 15; DIVQ2 at 0 range 16 .. 22; Reserved_23_23 at 0 range 23 .. 23; DIVR2 at 0 range 24 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; subtype PLL2FRACR_FRACN2_Field is HAL.UInt13; -- RCC PLL2 Fractional Divider Register type PLL2FRACR_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- Fractional part of the multiplication factor for PLL VCO FRACN2 : PLL2FRACR_FRACN2_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for PLL2FRACR_Register use record Reserved_0_2 at 0 range 0 .. 2; FRACN2 at 0 range 3 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype PLL3DIVR_DIVN3_Field is HAL.UInt9; subtype PLL3DIVR_DIVP3_Field is HAL.UInt7; subtype PLL3DIVR_DIVQ3_Field is HAL.UInt7; subtype PLL3DIVR_DIVR3_Field is HAL.UInt7; -- RCC PLL3 Dividers Configuration Register type PLL3DIVR_Register is record -- Multiplication factor for PLL3 VCO DIVN3 : PLL3DIVR_DIVN3_Field := 16#80#; -- PLL3 DIVP division factor DIVP3 : PLL3DIVR_DIVP3_Field := 16#1#; -- PLL3 DIVQ division factor DIVQ3 : PLL3DIVR_DIVQ3_Field := 16#1#; -- unspecified Reserved_23_23 : HAL.Bit := 16#0#; -- PLL3 DIVR division factor DIVR3 : PLL3DIVR_DIVR3_Field := 16#1#; -- unspecified Reserved_31_31 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for PLL3DIVR_Register use record DIVN3 at 0 range 0 .. 8; DIVP3 at 0 range 9 .. 15; DIVQ3 at 0 range 16 .. 22; Reserved_23_23 at 0 range 23 .. 23; DIVR3 at 0 range 24 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; subtype PLL3FRACR_FRACN3_Field is HAL.UInt13; -- RCC PLL3 Fractional Divider Register type PLL3FRACR_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- Fractional part of the multiplication factor for PLL3 VCO FRACN3 : PLL3FRACR_FRACN3_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for PLL3FRACR_Register use record Reserved_0_2 at 0 range 0 .. 2; FRACN3 at 0 range 3 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype D1CCIPR_FMCSEL_Field is HAL.UInt2; subtype D1CCIPR_QSPISEL_Field is HAL.UInt2; subtype D1CCIPR_CKPERSEL_Field is HAL.UInt2; -- RCC Domain 1 Kernel Clock Configuration Register type D1CCIPR_Register is record -- FMC kernel clock source selection FMCSEL : D1CCIPR_FMCSEL_Field := 16#0#; -- unspecified Reserved_2_3 : HAL.UInt2 := 16#0#; -- QUADSPI kernel clock source selection QSPISEL : D1CCIPR_QSPISEL_Field := 16#0#; -- unspecified Reserved_6_15 : HAL.UInt10 := 16#0#; -- SDMMC kernel clock source selection SDMMCSEL : Boolean := False; -- unspecified Reserved_17_27 : HAL.UInt11 := 16#0#; -- per_ck clock source selection CKPERSEL : D1CCIPR_CKPERSEL_Field := 16#0#; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for D1CCIPR_Register use record FMCSEL at 0 range 0 .. 1; Reserved_2_3 at 0 range 2 .. 3; QSPISEL at 0 range 4 .. 5; Reserved_6_15 at 0 range 6 .. 15; SDMMCSEL at 0 range 16 .. 16; Reserved_17_27 at 0 range 17 .. 27; CKPERSEL at 0 range 28 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; subtype D2CCIP1R_SAI1SEL_Field is HAL.UInt3; subtype D2CCIP1R_SAI23SEL_Field is HAL.UInt3; subtype D2CCIP1R_SPI123SEL_Field is HAL.UInt3; subtype D2CCIP1R_SPI45SEL_Field is HAL.UInt3; subtype D2CCIP1R_SPDIFSEL_Field is HAL.UInt2; subtype D2CCIP1R_FDCANSEL_Field is HAL.UInt2; -- RCC Domain 2 Kernel Clock Configuration Register type D2CCIP1R_Register is record -- SAI1 and DFSDM1 kernel Aclk clock source selection SAI1SEL : D2CCIP1R_SAI1SEL_Field := 16#0#; -- unspecified Reserved_3_5 : HAL.UInt3 := 16#0#; -- SAI2 and SAI3 kernel clock source selection SAI23SEL : D2CCIP1R_SAI23SEL_Field := 16#0#; -- unspecified Reserved_9_11 : HAL.UInt3 := 16#0#; -- SPI/I2S1,2 and 3 kernel clock source selection SPI123SEL : D2CCIP1R_SPI123SEL_Field := 16#0#; -- unspecified Reserved_15_15 : HAL.Bit := 16#0#; -- SPI4 and 5 kernel clock source selection SPI45SEL : D2CCIP1R_SPI45SEL_Field := 16#0#; -- unspecified Reserved_19_19 : HAL.Bit := 16#0#; -- SPDIFRX kernel clock source selection SPDIFSEL : D2CCIP1R_SPDIFSEL_Field := 16#0#; -- unspecified Reserved_22_23 : HAL.UInt2 := 16#0#; -- DFSDM1 kernel Clk clock source selection DFSDM1SEL : Boolean := False; -- unspecified Reserved_25_27 : HAL.UInt3 := 16#0#; -- FDCAN kernel clock source selection FDCANSEL : D2CCIP1R_FDCANSEL_Field := 16#0#; -- unspecified Reserved_30_30 : HAL.Bit := 16#0#; -- SWPMI kernel clock source selection SWPSEL : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for D2CCIP1R_Register use record SAI1SEL at 0 range 0 .. 2; Reserved_3_5 at 0 range 3 .. 5; SAI23SEL at 0 range 6 .. 8; Reserved_9_11 at 0 range 9 .. 11; SPI123SEL at 0 range 12 .. 14; Reserved_15_15 at 0 range 15 .. 15; SPI45SEL at 0 range 16 .. 18; Reserved_19_19 at 0 range 19 .. 19; SPDIFSEL at 0 range 20 .. 21; Reserved_22_23 at 0 range 22 .. 23; DFSDM1SEL at 0 range 24 .. 24; Reserved_25_27 at 0 range 25 .. 27; FDCANSEL at 0 range 28 .. 29; Reserved_30_30 at 0 range 30 .. 30; SWPSEL at 0 range 31 .. 31; end record; subtype D2CCIP2R_USART234578SEL_Field is HAL.UInt3; subtype D2CCIP2R_USART16SEL_Field is HAL.UInt3; subtype D2CCIP2R_RNGSEL_Field is HAL.UInt2; subtype D2CCIP2R_I2C123SEL_Field is HAL.UInt2; subtype D2CCIP2R_USBSEL_Field is HAL.UInt2; subtype D2CCIP2R_CECSEL_Field is HAL.UInt2; subtype D2CCIP2R_LPTIM1SEL_Field is HAL.UInt3; -- RCC Domain 2 Kernel Clock Configuration Register type D2CCIP2R_Register is record -- USART2/3, UART4,5, 7/8 (APB1) kernel clock source selection USART234578SEL : D2CCIP2R_USART234578SEL_Field := 16#0#; -- USART1 and 6 kernel clock source selection USART16SEL : D2CCIP2R_USART16SEL_Field := 16#0#; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- RNG kernel clock source selection RNGSEL : D2CCIP2R_RNGSEL_Field := 16#0#; -- unspecified Reserved_10_11 : HAL.UInt2 := 16#0#; -- I2C1,2,3 kernel clock source selection I2C123SEL : D2CCIP2R_I2C123SEL_Field := 16#0#; -- unspecified Reserved_14_19 : HAL.UInt6 := 16#0#; -- USBOTG 1 and 2 kernel clock source selection USBSEL : D2CCIP2R_USBSEL_Field := 16#0#; -- HDMI-CEC kernel clock source selection CECSEL : D2CCIP2R_CECSEL_Field := 16#0#; -- unspecified Reserved_24_27 : HAL.UInt4 := 16#0#; -- LPTIM1 kernel clock source selection LPTIM1SEL : D2CCIP2R_LPTIM1SEL_Field := 16#0#; -- unspecified Reserved_31_31 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for D2CCIP2R_Register use record USART234578SEL at 0 range 0 .. 2; USART16SEL at 0 range 3 .. 5; Reserved_6_7 at 0 range 6 .. 7; RNGSEL at 0 range 8 .. 9; Reserved_10_11 at 0 range 10 .. 11; I2C123SEL at 0 range 12 .. 13; Reserved_14_19 at 0 range 14 .. 19; USBSEL at 0 range 20 .. 21; CECSEL at 0 range 22 .. 23; Reserved_24_27 at 0 range 24 .. 27; LPTIM1SEL at 0 range 28 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; subtype D3CCIPR_LPUART1SEL_Field is HAL.UInt3; subtype D3CCIPR_I2C4SEL_Field is HAL.UInt2; subtype D3CCIPR_LPTIM2SEL_Field is HAL.UInt3; subtype D3CCIPR_LPTIM345SEL_Field is HAL.UInt3; subtype D3CCIPR_ADCSEL_Field is HAL.UInt2; subtype D3CCIPR_SAI4ASEL_Field is HAL.UInt3; subtype D3CCIPR_SAI4BSEL_Field is HAL.UInt3; subtype D3CCIPR_SPI6SEL_Field is HAL.UInt3; -- RCC Domain 3 Kernel Clock Configuration Register type D3CCIPR_Register is record -- LPUART1 kernel clock source selection LPUART1SEL : D3CCIPR_LPUART1SEL_Field := 16#0#; -- unspecified Reserved_3_7 : HAL.UInt5 := 16#0#; -- I2C4 kernel clock source selection I2C4SEL : D3CCIPR_I2C4SEL_Field := 16#0#; -- LPTIM2 kernel clock source selection LPTIM2SEL : D3CCIPR_LPTIM2SEL_Field := 16#0#; -- LPTIM3,4,5 kernel clock source selection LPTIM345SEL : D3CCIPR_LPTIM345SEL_Field := 16#0#; -- SAR ADC kernel clock source selection ADCSEL : D3CCIPR_ADCSEL_Field := 16#0#; -- unspecified Reserved_18_20 : HAL.UInt3 := 16#0#; -- Sub-Block A of SAI4 kernel clock source selection SAI4ASEL : D3CCIPR_SAI4ASEL_Field := 16#0#; -- Sub-Block B of SAI4 kernel clock source selection SAI4BSEL : D3CCIPR_SAI4BSEL_Field := 16#0#; -- unspecified Reserved_27_27 : HAL.Bit := 16#0#; -- SPI6 kernel clock source selection SPI6SEL : D3CCIPR_SPI6SEL_Field := 16#0#; -- unspecified Reserved_31_31 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for D3CCIPR_Register use record LPUART1SEL at 0 range 0 .. 2; Reserved_3_7 at 0 range 3 .. 7; I2C4SEL at 0 range 8 .. 9; LPTIM2SEL at 0 range 10 .. 12; LPTIM345SEL at 0 range 13 .. 15; ADCSEL at 0 range 16 .. 17; Reserved_18_20 at 0 range 18 .. 20; SAI4ASEL at 0 range 21 .. 23; SAI4BSEL at 0 range 24 .. 26; Reserved_27_27 at 0 range 27 .. 27; SPI6SEL at 0 range 28 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; -- RCC Clock Source Interrupt Enable Register type CIER_Register is record -- LSI ready Interrupt Enable LSIRDYIE : Boolean := False; -- LSE ready Interrupt Enable LSERDYIE : Boolean := False; -- HSI ready Interrupt Enable HSIRDYIE : Boolean := False; -- HSE ready Interrupt Enable HSERDYIE : Boolean := False; -- CSI ready Interrupt Enable CSIRDYIE : Boolean := False; -- RC48 ready Interrupt Enable RC48RDYIE : Boolean := False; -- PLL1 ready Interrupt Enable PLL1RDYIE : Boolean := False; -- PLL2 ready Interrupt Enable PLL2RDYIE : Boolean := False; -- PLL3 ready Interrupt Enable PLL3RDYIE : Boolean := False; -- LSE clock security system Interrupt Enable LSECSSIE : Boolean := False; -- unspecified Reserved_10_31 : HAL.UInt22 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CIER_Register use record LSIRDYIE at 0 range 0 .. 0; LSERDYIE at 0 range 1 .. 1; HSIRDYIE at 0 range 2 .. 2; HSERDYIE at 0 range 3 .. 3; CSIRDYIE at 0 range 4 .. 4; RC48RDYIE at 0 range 5 .. 5; PLL1RDYIE at 0 range 6 .. 6; PLL2RDYIE at 0 range 7 .. 7; PLL3RDYIE at 0 range 8 .. 8; LSECSSIE at 0 range 9 .. 9; Reserved_10_31 at 0 range 10 .. 31; end record; -- RCC Clock Source Interrupt Flag Register type CIFR_Register is record -- LSI ready Interrupt Flag LSIRDYF : Boolean := False; -- LSE ready Interrupt Flag LSERDYF : Boolean := False; -- HSI ready Interrupt Flag HSIRDYF : Boolean := False; -- HSE ready Interrupt Flag HSERDYF : Boolean := False; -- CSI ready Interrupt Flag CSIRDY : Boolean := False; -- RC48 ready Interrupt Flag RC48RDYF : Boolean := False; -- PLL1 ready Interrupt Flag PLL1RDYF : Boolean := False; -- PLL2 ready Interrupt Flag PLL2RDYF : Boolean := False; -- PLL3 ready Interrupt Flag PLL3RDYF : Boolean := False; -- LSE clock security system Interrupt Flag LSECSSF : Boolean := False; -- HSE clock security system Interrupt Flag HSECSSF : Boolean := False; -- unspecified Reserved_11_31 : HAL.UInt21 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CIFR_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; CSIRDY at 0 range 4 .. 4; RC48RDYF at 0 range 5 .. 5; PLL1RDYF at 0 range 6 .. 6; PLL2RDYF at 0 range 7 .. 7; PLL3RDYF at 0 range 8 .. 8; LSECSSF at 0 range 9 .. 9; HSECSSF at 0 range 10 .. 10; Reserved_11_31 at 0 range 11 .. 31; end record; -- RCC Clock Source Interrupt Clear Register type CICR_Register is record -- LSI ready Interrupt Clear LSIRDYC : Boolean := False; -- LSE ready Interrupt Clear LSERDYC : Boolean := False; -- HSI ready Interrupt Clear HSIRDYC : Boolean := False; -- HSE ready Interrupt Clear HSERDYC : Boolean := False; -- CSI ready Interrupt Clear HSE_ready_Interrupt_Clear : Boolean := False; -- RC48 ready Interrupt Clear RC48RDYC : Boolean := False; -- PLL1 ready Interrupt Clear PLL1RDYC : Boolean := False; -- PLL2 ready Interrupt Clear PLL2RDYC : Boolean := False; -- PLL3 ready Interrupt Clear PLL3RDYC : Boolean := False; -- LSE clock security system Interrupt Clear LSECSSC : Boolean := False; -- HSE clock security system Interrupt Clear HSECSSC : Boolean := False; -- unspecified Reserved_11_31 : HAL.UInt21 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CICR_Register use record LSIRDYC at 0 range 0 .. 0; LSERDYC at 0 range 1 .. 1; HSIRDYC at 0 range 2 .. 2; HSERDYC at 0 range 3 .. 3; HSE_ready_Interrupt_Clear at 0 range 4 .. 4; RC48RDYC at 0 range 5 .. 5; PLL1RDYC at 0 range 6 .. 6; PLL2RDYC at 0 range 7 .. 7; PLL3RDYC at 0 range 8 .. 8; LSECSSC at 0 range 9 .. 9; HSECSSC at 0 range 10 .. 10; Reserved_11_31 at 0 range 11 .. 31; end record; subtype BDCR_LSEDRV_Field is HAL.UInt2; subtype BDCR_RTCSEL_Field is HAL.UInt2; -- RCC Backup Domain Control Register type BDCR_Register is record -- LSE oscillator enabled LSEON : Boolean := False; -- LSE oscillator ready LSERDY : Boolean := False; -- LSE oscillator bypass LSEBYP : Boolean := False; -- LSE oscillator driving capability LSEDRV : BDCR_LSEDRV_Field := 16#0#; -- LSE clock security system enable LSECSSON : Boolean := False; -- LSE clock security system failure detection LSECSSD : Boolean := False; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- RTC clock source selection RTCSEL : BDCR_RTCSEL_Field := 16#0#; -- unspecified Reserved_10_14 : HAL.UInt5 := 16#0#; -- RTC clock enable RTCEN : Boolean := False; -- BDRST domain software reset BDRST : Boolean := False; -- unspecified Reserved_17_31 : HAL.UInt15 := 16#0#; end record with Volatile_Full_Access, Object_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; LSEDRV at 0 range 3 .. 4; LSECSSON at 0 range 5 .. 5; LSECSSD at 0 range 6 .. 6; Reserved_7_7 at 0 range 7 .. 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; -- RCC Clock Control and Status Register type CSR_Register is record -- LSI oscillator enable LSION : Boolean := False; -- LSI oscillator ready LSIRDY : Boolean := False; -- unspecified Reserved_2_31 : HAL.UInt30 := 16#0#; end record with Volatile_Full_Access, Object_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_31 at 0 range 2 .. 31; end record; -- RCC AHB3 Reset Register type AHB3RSTR_Register is record -- MDMA block reset MDMARST : Boolean := False; -- unspecified Reserved_1_3 : HAL.UInt3 := 16#0#; -- DMA2D block reset DMA2DRST : Boolean := False; -- JPGDEC block reset JPGDECRST : Boolean := False; -- unspecified Reserved_6_11 : HAL.UInt6 := 16#0#; -- FMC block reset FMCRST : Boolean := False; -- unspecified Reserved_13_13 : HAL.Bit := 16#0#; -- QUADSPI and QUADSPI delay block reset QSPIRST : Boolean := False; -- unspecified Reserved_15_15 : HAL.Bit := 16#0#; -- SDMMC1 and SDMMC1 delay block reset SDMMC1RST : Boolean := False; -- unspecified Reserved_17_30 : HAL.UInt14 := 16#0#; -- CPU reset CPURST : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB3RSTR_Register use record MDMARST at 0 range 0 .. 0; Reserved_1_3 at 0 range 1 .. 3; DMA2DRST at 0 range 4 .. 4; JPGDECRST at 0 range 5 .. 5; Reserved_6_11 at 0 range 6 .. 11; FMCRST at 0 range 12 .. 12; Reserved_13_13 at 0 range 13 .. 13; QSPIRST at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; SDMMC1RST at 0 range 16 .. 16; Reserved_17_30 at 0 range 17 .. 30; CPURST at 0 range 31 .. 31; end record; -- RCC AHB1 Peripheral Reset Register type AHB1RSTR_Register is record -- DMA1 block reset DMA1RST : Boolean := False; -- DMA2 block reset DMA2RST : Boolean := False; -- unspecified Reserved_2_4 : HAL.UInt3 := 16#0#; -- ADC1&2 block reset ADC12RST : Boolean := False; -- unspecified Reserved_6_14 : HAL.UInt9 := 16#0#; -- ETH1MAC block reset ETH1MACRST : Boolean := False; -- unspecified Reserved_16_24 : HAL.UInt9 := 16#0#; -- USB1OTG block reset USB1OTGRST : Boolean := False; -- unspecified Reserved_26_26 : HAL.Bit := 16#0#; -- USB2OTG block reset USB2OTGRST : Boolean := False; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB1RSTR_Register use record DMA1RST at 0 range 0 .. 0; DMA2RST at 0 range 1 .. 1; Reserved_2_4 at 0 range 2 .. 4; ADC12RST at 0 range 5 .. 5; Reserved_6_14 at 0 range 6 .. 14; ETH1MACRST at 0 range 15 .. 15; Reserved_16_24 at 0 range 16 .. 24; USB1OTGRST at 0 range 25 .. 25; Reserved_26_26 at 0 range 26 .. 26; USB2OTGRST at 0 range 27 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; -- RCC AHB2 Peripheral Reset Register type AHB2RSTR_Register is record -- CAMITF block reset CAMITFRST : Boolean := False; -- unspecified Reserved_1_3 : HAL.UInt3 := 16#0#; -- Cryptography block reset CRYPTRST : Boolean := False; -- Hash block reset HASHRST : Boolean := False; -- Random Number Generator block reset RNGRST : Boolean := False; -- unspecified Reserved_7_8 : HAL.UInt2 := 16#0#; -- SDMMC2 and SDMMC2 Delay block reset SDMMC2RST : Boolean := False; -- unspecified Reserved_10_31 : HAL.UInt22 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB2RSTR_Register use record CAMITFRST at 0 range 0 .. 0; Reserved_1_3 at 0 range 1 .. 3; CRYPTRST at 0 range 4 .. 4; HASHRST at 0 range 5 .. 5; RNGRST at 0 range 6 .. 6; Reserved_7_8 at 0 range 7 .. 8; SDMMC2RST at 0 range 9 .. 9; Reserved_10_31 at 0 range 10 .. 31; end record; -- RCC AHB4 Peripheral Reset Register type AHB4RSTR_Register is record -- GPIO block reset GPIOARST : Boolean := False; -- GPIO block reset GPIOBRST : Boolean := False; -- GPIO block reset GPIOCRST : Boolean := False; -- GPIO block reset GPIODRST : Boolean := False; -- GPIO block reset GPIOERST : Boolean := False; -- GPIO block reset GPIOFRST : Boolean := False; -- GPIO block reset GPIOGRST : Boolean := False; -- GPIO block reset GPIOHRST : Boolean := False; -- GPIO block reset GPIOIRST : Boolean := False; -- GPIO block reset GPIOJRST : Boolean := False; -- GPIO block reset GPIOKRST : Boolean := False; -- unspecified Reserved_11_18 : HAL.UInt8 := 16#0#; -- CRC block reset CRCRST : Boolean := False; -- unspecified Reserved_20_20 : HAL.Bit := 16#0#; -- BDMA block reset BDMARST : Boolean := False; -- unspecified Reserved_22_23 : HAL.UInt2 := 16#0#; -- ADC3 block reset ADC3RST : Boolean := False; -- HSEM block reset HSEMRST : Boolean := False; -- unspecified Reserved_26_31 : HAL.UInt6 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB4RSTR_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_18 at 0 range 11 .. 18; CRCRST at 0 range 19 .. 19; Reserved_20_20 at 0 range 20 .. 20; BDMARST at 0 range 21 .. 21; Reserved_22_23 at 0 range 22 .. 23; ADC3RST at 0 range 24 .. 24; HSEMRST at 0 range 25 .. 25; Reserved_26_31 at 0 range 26 .. 31; end record; -- RCC APB3 Peripheral Reset Register type APB3RSTR_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- LTDC block reset LTDCRST : Boolean := False; -- unspecified Reserved_4_31 : HAL.UInt28 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB3RSTR_Register use record Reserved_0_2 at 0 range 0 .. 2; LTDCRST at 0 range 3 .. 3; Reserved_4_31 at 0 range 4 .. 31; end record; -- RCC APB1 Peripheral Reset Register type APB1LRSTR_Register is record -- TIM block reset TIM2RST : Boolean := False; -- TIM block reset TIM3RST : Boolean := False; -- TIM block reset TIM4RST : Boolean := False; -- TIM block reset TIM5RST : Boolean := False; -- TIM block reset TIM6RST : Boolean := False; -- TIM block reset TIM7RST : Boolean := False; -- TIM block reset TIM12RST : Boolean := False; -- TIM block reset TIM13RST : Boolean := False; -- TIM block reset TIM14RST : Boolean := False; -- TIM block reset LPTIM1RST : Boolean := False; -- unspecified Reserved_10_13 : HAL.UInt4 := 16#0#; -- SPI2 block reset SPI2RST : Boolean := False; -- SPI3 block reset SPI3RST : Boolean := False; -- SPDIFRX block reset SPDIFRXRST : Boolean := False; -- USART2 block reset USART2RST : Boolean := False; -- USART3 block reset USART3RST : Boolean := False; -- UART4 block reset UART4RST : Boolean := False; -- UART5 block reset UART5RST : Boolean := False; -- I2C1 block reset I2C1RST : Boolean := False; -- I2C2 block reset I2C2RST : Boolean := False; -- I2C3 block reset I2C3RST : Boolean := False; -- unspecified Reserved_24_26 : HAL.UInt3 := 16#0#; -- HDMI-CEC block reset CECRST : Boolean := False; -- unspecified Reserved_28_28 : HAL.Bit := 16#0#; -- DAC1 and 2 Blocks Reset DAC12RST : Boolean := False; -- UART7 block reset UART7RST : Boolean := False; -- UART8 block reset UART8RST : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB1LRSTR_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; LPTIM1RST at 0 range 9 .. 9; Reserved_10_13 at 0 range 10 .. 13; SPI2RST at 0 range 14 .. 14; SPI3RST at 0 range 15 .. 15; SPDIFRXRST at 0 range 16 .. 16; USART2RST at 0 range 17 .. 17; USART3RST 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_26 at 0 range 24 .. 26; CECRST at 0 range 27 .. 27; Reserved_28_28 at 0 range 28 .. 28; DAC12RST at 0 range 29 .. 29; UART7RST at 0 range 30 .. 30; UART8RST at 0 range 31 .. 31; end record; -- RCC APB1 Peripheral Reset Register type APB1HRSTR_Register is record -- unspecified Reserved_0_0 : HAL.Bit := 16#0#; -- Clock Recovery System reset CRSRST : Boolean := False; -- SWPMI block reset SWPRST : Boolean := False; -- unspecified Reserved_3_3 : HAL.Bit := 16#0#; -- OPAMP block reset OPAMPRST : Boolean := False; -- MDIOS block reset MDIOSRST : Boolean := False; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- FDCAN block reset FDCANRST : Boolean := False; -- unspecified Reserved_9_31 : HAL.UInt23 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB1HRSTR_Register use record Reserved_0_0 at 0 range 0 .. 0; CRSRST at 0 range 1 .. 1; SWPRST at 0 range 2 .. 2; Reserved_3_3 at 0 range 3 .. 3; OPAMPRST at 0 range 4 .. 4; MDIOSRST at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; FDCANRST at 0 range 8 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; -- RCC APB2 Peripheral Reset Register type APB2RSTR_Register is record -- TIM1 block reset TIM1RST : Boolean := False; -- TIM8 block reset TIM8RST : Boolean := False; -- unspecified Reserved_2_3 : HAL.UInt2 := 16#0#; -- USART1 block reset USART1RST : Boolean := False; -- USART6 block reset USART6RST : Boolean := False; -- unspecified Reserved_6_11 : HAL.UInt6 := 16#0#; -- SPI1 block reset SPI1RST : Boolean := False; -- SPI4 block reset SPI4RST : Boolean := False; -- unspecified Reserved_14_15 : HAL.UInt2 := 16#0#; -- TIM15 block reset TIM15RST : Boolean := False; -- TIM16 block reset TIM16RST : Boolean := False; -- TIM17 block reset TIM17RST : Boolean := False; -- unspecified Reserved_19_19 : HAL.Bit := 16#0#; -- SPI5 block reset SPI5RST : Boolean := False; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- SAI1 block reset SAI1RST : Boolean := False; -- SAI2 block reset SAI2RST : Boolean := False; -- SAI3 block reset SAI3RST : Boolean := False; -- unspecified Reserved_25_27 : HAL.UInt3 := 16#0#; -- DFSDM1 block reset DFSDM1RST : Boolean := False; -- HRTIM block reset HRTIMRST : Boolean := False; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_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_11 at 0 range 6 .. 11; SPI1RST at 0 range 12 .. 12; SPI4RST at 0 range 13 .. 13; Reserved_14_15 at 0 range 14 .. 15; TIM15RST at 0 range 16 .. 16; TIM16RST at 0 range 17 .. 17; TIM17RST at 0 range 18 .. 18; Reserved_19_19 at 0 range 19 .. 19; SPI5RST at 0 range 20 .. 20; Reserved_21_21 at 0 range 21 .. 21; SAI1RST at 0 range 22 .. 22; SAI2RST at 0 range 23 .. 23; SAI3RST at 0 range 24 .. 24; Reserved_25_27 at 0 range 25 .. 27; DFSDM1RST at 0 range 28 .. 28; HRTIMRST at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; -- RCC APB4 Peripheral Reset Register type APB4RSTR_Register is record -- unspecified Reserved_0_0 : HAL.Bit := 16#0#; -- SYSCFG block reset SYSCFGRST : Boolean := False; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- LPUART1 block reset LPUART1RST : Boolean := False; -- unspecified Reserved_4_4 : HAL.Bit := 16#0#; -- SPI6 block reset SPI6RST : Boolean := False; -- unspecified Reserved_6_6 : HAL.Bit := 16#0#; -- I2C4 block reset I2C4RST : Boolean := False; -- unspecified Reserved_8_8 : HAL.Bit := 16#0#; -- LPTIM2 block reset LPTIM2RST : Boolean := False; -- LPTIM3 block reset LPTIM3RST : Boolean := False; -- LPTIM4 block reset LPTIM4RST : Boolean := False; -- LPTIM5 block reset LPTIM5RST : Boolean := False; -- unspecified Reserved_13_13 : HAL.Bit := 16#0#; -- COMP12 Blocks Reset COMP12RST : Boolean := False; -- VREF block reset VREFRST : Boolean := False; -- unspecified Reserved_16_20 : HAL.UInt5 := 16#0#; -- SAI4 block reset SAI4RST : Boolean := False; -- unspecified Reserved_22_31 : HAL.UInt10 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB4RSTR_Register use record Reserved_0_0 at 0 range 0 .. 0; SYSCFGRST at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; LPUART1RST at 0 range 3 .. 3; Reserved_4_4 at 0 range 4 .. 4; SPI6RST at 0 range 5 .. 5; Reserved_6_6 at 0 range 6 .. 6; I2C4RST at 0 range 7 .. 7; Reserved_8_8 at 0 range 8 .. 8; LPTIM2RST at 0 range 9 .. 9; LPTIM3RST at 0 range 10 .. 10; LPTIM4RST at 0 range 11 .. 11; LPTIM5RST at 0 range 12 .. 12; Reserved_13_13 at 0 range 13 .. 13; COMP12RST at 0 range 14 .. 14; VREFRST at 0 range 15 .. 15; Reserved_16_20 at 0 range 16 .. 20; SAI4RST at 0 range 21 .. 21; Reserved_22_31 at 0 range 22 .. 31; end record; -- RCC Global Control Register type GCR_Register is record -- WWDG1 reset scope control WW1RSC : Boolean := False; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for GCR_Register use record WW1RSC at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- RCC D3 Autonomous mode Register type D3AMR_Register is record -- BDMA and DMAMUX Autonomous mode enable BDMAAMEN : Boolean := False; -- unspecified Reserved_1_2 : HAL.UInt2 := 16#0#; -- LPUART1 Autonomous mode enable LPUART1AMEN : Boolean := False; -- unspecified Reserved_4_4 : HAL.Bit := 16#0#; -- SPI6 Autonomous mode enable SPI6AMEN : Boolean := False; -- unspecified Reserved_6_6 : HAL.Bit := 16#0#; -- I2C4 Autonomous mode enable I2C4AMEN : Boolean := False; -- unspecified Reserved_8_8 : HAL.Bit := 16#0#; -- LPTIM2 Autonomous mode enable LPTIM2AMEN : Boolean := False; -- LPTIM3 Autonomous mode enable LPTIM3AMEN : Boolean := False; -- LPTIM4 Autonomous mode enable LPTIM4AMEN : Boolean := False; -- LPTIM5 Autonomous mode enable LPTIM5AMEN : Boolean := False; -- unspecified Reserved_13_13 : HAL.Bit := 16#0#; -- COMP12 Autonomous mode enable COMP12AMEN : Boolean := False; -- VREF Autonomous mode enable VREFAMEN : Boolean := False; -- RTC Autonomous mode enable RTCAMEN : Boolean := False; -- unspecified Reserved_17_18 : HAL.UInt2 := 16#0#; -- CRC Autonomous mode enable CRCAMEN : Boolean := False; -- unspecified Reserved_20_20 : HAL.Bit := 16#0#; -- SAI4 Autonomous mode enable SAI4AMEN : Boolean := False; -- unspecified Reserved_22_23 : HAL.UInt2 := 16#0#; -- ADC3 Autonomous mode enable ADC3AMEN : Boolean := False; -- unspecified Reserved_25_27 : HAL.UInt3 := 16#0#; -- Backup RAM Autonomous mode enable BKPRAMAMEN : Boolean := False; -- SRAM4 Autonomous mode enable SRAM4AMEN : Boolean := False; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for D3AMR_Register use record BDMAAMEN at 0 range 0 .. 0; Reserved_1_2 at 0 range 1 .. 2; LPUART1AMEN at 0 range 3 .. 3; Reserved_4_4 at 0 range 4 .. 4; SPI6AMEN at 0 range 5 .. 5; Reserved_6_6 at 0 range 6 .. 6; I2C4AMEN at 0 range 7 .. 7; Reserved_8_8 at 0 range 8 .. 8; LPTIM2AMEN at 0 range 9 .. 9; LPTIM3AMEN at 0 range 10 .. 10; LPTIM4AMEN at 0 range 11 .. 11; LPTIM5AMEN at 0 range 12 .. 12; Reserved_13_13 at 0 range 13 .. 13; COMP12AMEN at 0 range 14 .. 14; VREFAMEN at 0 range 15 .. 15; RTCAMEN at 0 range 16 .. 16; Reserved_17_18 at 0 range 17 .. 18; CRCAMEN at 0 range 19 .. 19; Reserved_20_20 at 0 range 20 .. 20; SAI4AMEN at 0 range 21 .. 21; Reserved_22_23 at 0 range 22 .. 23; ADC3AMEN at 0 range 24 .. 24; Reserved_25_27 at 0 range 25 .. 27; BKPRAMAMEN at 0 range 28 .. 28; SRAM4AMEN at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; -- RCC Reset Status Register type RSR_Register is record -- unspecified Reserved_0_15 : HAL.UInt16 := 16#0#; -- Remove reset flag RMVF : Boolean := False; -- CPU reset flag CPURSTF : Boolean := False; -- unspecified Reserved_18_18 : HAL.Bit := 16#0#; -- D1 domain power switch reset flag D1RSTF : Boolean := False; -- D2 domain power switch reset flag D2RSTF : Boolean := False; -- BOR reset flag BORRSTF : Boolean := False; -- Pin reset flag (NRST) PINRSTF : Boolean := False; -- POR/PDR reset flag PORRSTF : Boolean := False; -- System reset from CPU reset flag SFTRSTF : Boolean := False; -- unspecified Reserved_25_25 : HAL.Bit := 16#0#; -- Independent Watchdog reset flag IWDG1RSTF : Boolean := False; -- unspecified Reserved_27_27 : HAL.Bit := 16#0#; -- Window Watchdog reset flag WWDG1RSTF : Boolean := False; -- unspecified Reserved_29_29 : HAL.Bit := 16#0#; -- Reset due to illegal D1 DStandby or CPU CStop flag LPWRRSTF : Boolean := False; -- unspecified Reserved_31_31 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for RSR_Register use record Reserved_0_15 at 0 range 0 .. 15; RMVF at 0 range 16 .. 16; CPURSTF at 0 range 17 .. 17; Reserved_18_18 at 0 range 18 .. 18; D1RSTF at 0 range 19 .. 19; D2RSTF at 0 range 20 .. 20; BORRSTF at 0 range 21 .. 21; PINRSTF at 0 range 22 .. 22; PORRSTF at 0 range 23 .. 23; SFTRSTF at 0 range 24 .. 24; Reserved_25_25 at 0 range 25 .. 25; IWDG1RSTF at 0 range 26 .. 26; Reserved_27_27 at 0 range 27 .. 27; WWDG1RSTF at 0 range 28 .. 28; Reserved_29_29 at 0 range 29 .. 29; LPWRRSTF at 0 range 30 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; -- RCC AHB3 Clock Register type AHB3ENR_Register is record -- MDMA Peripheral Clock Enable MDMAEN : Boolean := False; -- unspecified Reserved_1_3 : HAL.UInt3 := 16#0#; -- DMA2D Peripheral Clock Enable DMA2DEN : Boolean := False; -- JPGDEC Peripheral Clock Enable JPGDECEN : Boolean := False; -- unspecified Reserved_6_11 : HAL.UInt6 := 16#0#; -- FMC Peripheral Clocks Enable FMCEN : Boolean := False; -- unspecified Reserved_13_13 : HAL.Bit := 16#0#; -- QUADSPI and QUADSPI Delay Clock Enable QSPIEN : Boolean := False; -- unspecified Reserved_15_15 : HAL.Bit := 16#0#; -- SDMMC1 and SDMMC1 Delay Clock Enable SDMMC1EN : Boolean := False; -- unspecified Reserved_17_31 : HAL.UInt15 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB3ENR_Register use record MDMAEN at 0 range 0 .. 0; Reserved_1_3 at 0 range 1 .. 3; DMA2DEN at 0 range 4 .. 4; JPGDECEN at 0 range 5 .. 5; Reserved_6_11 at 0 range 6 .. 11; FMCEN at 0 range 12 .. 12; Reserved_13_13 at 0 range 13 .. 13; QSPIEN at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; SDMMC1EN at 0 range 16 .. 16; Reserved_17_31 at 0 range 17 .. 31; end record; -- RCC AHB1 Clock Register type AHB1ENR_Register is record -- DMA1 Clock Enable DMA1EN : Boolean := False; -- DMA2 Clock Enable DMA2EN : Boolean := False; -- unspecified Reserved_2_4 : HAL.UInt3 := 16#0#; -- ADC1/2 Peripheral Clocks Enable ADC12EN : Boolean := False; -- unspecified Reserved_6_14 : HAL.UInt9 := 16#0#; -- Ethernet MAC bus interface Clock Enable ETH1MACEN : Boolean := False; -- Ethernet Transmission Clock Enable ETH1TXEN : Boolean := False; -- Ethernet Reception Clock Enable ETH1RXEN : Boolean := False; -- Enable USB_PHY2 clocks USB2OTGHSULPIEN : Boolean := False; -- unspecified Reserved_19_24 : HAL.UInt6 := 16#0#; -- USB1OTG Peripheral Clocks Enable USB1OTGEN : Boolean := False; -- USB_PHY1 Clocks Enable USB1ULPIEN : Boolean := False; -- USB2OTG Peripheral Clocks Enable USB2OTGEN : Boolean := False; -- USB_PHY2 Clocks Enable USB2ULPIEN : Boolean := False; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB1ENR_Register use record DMA1EN at 0 range 0 .. 0; DMA2EN at 0 range 1 .. 1; Reserved_2_4 at 0 range 2 .. 4; ADC12EN at 0 range 5 .. 5; Reserved_6_14 at 0 range 6 .. 14; ETH1MACEN at 0 range 15 .. 15; ETH1TXEN at 0 range 16 .. 16; ETH1RXEN at 0 range 17 .. 17; USB2OTGHSULPIEN at 0 range 18 .. 18; Reserved_19_24 at 0 range 19 .. 24; USB1OTGEN at 0 range 25 .. 25; USB1ULPIEN at 0 range 26 .. 26; USB2OTGEN at 0 range 27 .. 27; USB2ULPIEN at 0 range 28 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; -- RCC AHB2 Clock Register type AHB2ENR_Register is record -- CAMITF peripheral clock enable CAMITFEN : Boolean := False; -- unspecified Reserved_1_3 : HAL.UInt3 := 16#0#; -- CRYPT peripheral clock enable CRYPTEN : Boolean := False; -- HASH peripheral clock enable HASHEN : Boolean := False; -- RNG peripheral clocks enable RNGEN : Boolean := False; -- unspecified Reserved_7_8 : HAL.UInt2 := 16#0#; -- SDMMC2 and SDMMC2 delay clock enable SDMMC2EN : Boolean := False; -- unspecified Reserved_10_28 : HAL.UInt19 := 16#0#; -- SRAM1 block enable SRAM1EN : Boolean := False; -- SRAM2 block enable SRAM2EN : Boolean := False; -- SRAM3 block enable SRAM3EN : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB2ENR_Register use record CAMITFEN at 0 range 0 .. 0; Reserved_1_3 at 0 range 1 .. 3; CRYPTEN at 0 range 4 .. 4; HASHEN at 0 range 5 .. 5; RNGEN at 0 range 6 .. 6; Reserved_7_8 at 0 range 7 .. 8; SDMMC2EN at 0 range 9 .. 9; Reserved_10_28 at 0 range 10 .. 28; SRAM1EN at 0 range 29 .. 29; SRAM2EN at 0 range 30 .. 30; SRAM3EN at 0 range 31 .. 31; end record; -- RCC AHB4 Clock Register type AHB4ENR_Register is record -- 0GPIO peripheral clock enable GPIOAEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOBEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOCEN : Boolean := False; -- 0GPIO peripheral clock enable GPIODEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOEEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOFEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOGEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOHEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOIEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOJEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOKEN : Boolean := False; -- unspecified Reserved_11_18 : HAL.UInt8 := 16#0#; -- CRC peripheral clock enable CRCEN : Boolean := False; -- unspecified Reserved_20_20 : HAL.Bit := 16#0#; -- BDMA and DMAMUX2 Clock Enable BDMAEN : Boolean := False; -- unspecified Reserved_22_23 : HAL.UInt2 := 16#0#; -- ADC3 Peripheral Clocks Enable ADC3EN : Boolean := False; -- HSEM peripheral clock enable HSEMEN : Boolean := False; -- unspecified Reserved_26_27 : HAL.UInt2 := 16#0#; -- Backup RAM Clock Enable BKPRAMEN : Boolean := False; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB4ENR_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_18 at 0 range 11 .. 18; CRCEN at 0 range 19 .. 19; Reserved_20_20 at 0 range 20 .. 20; BDMAEN at 0 range 21 .. 21; Reserved_22_23 at 0 range 22 .. 23; ADC3EN at 0 range 24 .. 24; HSEMEN at 0 range 25 .. 25; Reserved_26_27 at 0 range 26 .. 27; BKPRAMEN at 0 range 28 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; -- RCC APB3 Clock Register type APB3ENR_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- LTDC peripheral clock enable LTDCEN : Boolean := False; -- unspecified Reserved_4_5 : HAL.UInt2 := 16#0#; -- WWDG1 Clock Enable WWDG1EN : Boolean := False; -- unspecified Reserved_7_31 : HAL.UInt25 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB3ENR_Register use record Reserved_0_2 at 0 range 0 .. 2; LTDCEN at 0 range 3 .. 3; Reserved_4_5 at 0 range 4 .. 5; WWDG1EN at 0 range 6 .. 6; Reserved_7_31 at 0 range 7 .. 31; end record; -- RCC APB1 Clock Register type APB1LENR_Register is record -- TIM peripheral clock enable TIM2EN : Boolean := False; -- TIM peripheral clock enable TIM3EN : Boolean := False; -- TIM peripheral clock enable TIM4EN : Boolean := False; -- TIM peripheral clock enable TIM5EN : Boolean := False; -- TIM peripheral clock enable TIM6EN : Boolean := False; -- TIM peripheral clock enable TIM7EN : Boolean := False; -- TIM peripheral clock enable TIM12EN : Boolean := False; -- TIM peripheral clock enable TIM13EN : Boolean := False; -- TIM peripheral clock enable TIM14EN : Boolean := False; -- LPTIM1 Peripheral Clocks Enable LPTIM1EN : Boolean := False; -- unspecified Reserved_10_13 : HAL.UInt4 := 16#0#; -- SPI2 Peripheral Clocks Enable SPI2EN : Boolean := False; -- SPI3 Peripheral Clocks Enable SPI3EN : Boolean := False; -- SPDIFRX Peripheral Clocks Enable SPDIFRXEN : Boolean := False; -- USART2 Peripheral Clocks Enable USART2EN : Boolean := False; -- USART3 Peripheral Clocks Enable USART3EN : Boolean := False; -- UART4 Peripheral Clocks Enable UART4EN : Boolean := False; -- UART5 Peripheral Clocks Enable UART5EN : Boolean := False; -- I2C1 Peripheral Clocks Enable I2C1EN : Boolean := False; -- I2C2 Peripheral Clocks Enable I2C2EN : Boolean := False; -- I2C3 Peripheral Clocks Enable I2C3EN : Boolean := False; -- unspecified Reserved_24_26 : HAL.UInt3 := 16#0#; -- HDMI-CEC peripheral clock enable CECEN : Boolean := False; -- unspecified Reserved_28_28 : HAL.Bit := 16#0#; -- DAC1&2 peripheral clock enable DAC12EN : Boolean := False; -- UART7 Peripheral Clocks Enable UART7EN : Boolean := False; -- UART8 Peripheral Clocks Enable UART8EN : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB1LENR_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; LPTIM1EN at 0 range 9 .. 9; Reserved_10_13 at 0 range 10 .. 13; SPI2EN at 0 range 14 .. 14; SPI3EN at 0 range 15 .. 15; SPDIFRXEN 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_26 at 0 range 24 .. 26; CECEN at 0 range 27 .. 27; Reserved_28_28 at 0 range 28 .. 28; DAC12EN at 0 range 29 .. 29; UART7EN at 0 range 30 .. 30; UART8EN at 0 range 31 .. 31; end record; -- RCC APB1 Clock Register type APB1HENR_Register is record -- unspecified Reserved_0_0 : HAL.Bit := 16#0#; -- Clock Recovery System peripheral clock enable CRSEN : Boolean := False; -- SWPMI Peripheral Clocks Enable SWPEN : Boolean := False; -- unspecified Reserved_3_3 : HAL.Bit := 16#0#; -- OPAMP peripheral clock enable OPAMPEN : Boolean := False; -- MDIOS peripheral clock enable MDIOSEN : Boolean := False; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- FDCAN Peripheral Clocks Enable FDCANEN : Boolean := False; -- unspecified Reserved_9_31 : HAL.UInt23 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB1HENR_Register use record Reserved_0_0 at 0 range 0 .. 0; CRSEN at 0 range 1 .. 1; SWPEN at 0 range 2 .. 2; Reserved_3_3 at 0 range 3 .. 3; OPAMPEN at 0 range 4 .. 4; MDIOSEN at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; FDCANEN at 0 range 8 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; -- RCC APB2 Clock Register type APB2ENR_Register is record -- TIM1 peripheral clock enable TIM1EN : Boolean := False; -- TIM8 peripheral clock enable TIM8EN : Boolean := False; -- unspecified Reserved_2_3 : HAL.UInt2 := 16#0#; -- USART1 Peripheral Clocks Enable USART1EN : Boolean := False; -- USART6 Peripheral Clocks Enable USART6EN : Boolean := False; -- unspecified Reserved_6_11 : HAL.UInt6 := 16#0#; -- SPI1 Peripheral Clocks Enable SPI1EN : Boolean := False; -- SPI4 Peripheral Clocks Enable SPI4EN : Boolean := False; -- unspecified Reserved_14_15 : HAL.UInt2 := 16#0#; -- TIM15 peripheral clock enable TIM15EN : Boolean := False; -- TIM16 peripheral clock enable TIM16EN : Boolean := False; -- TIM17 peripheral clock enable TIM17EN : Boolean := False; -- unspecified Reserved_19_19 : HAL.Bit := 16#0#; -- SPI5 Peripheral Clocks Enable SPI5EN : Boolean := False; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- SAI1 Peripheral Clocks Enable SAI1EN : Boolean := False; -- SAI2 Peripheral Clocks Enable SAI2EN : Boolean := False; -- SAI3 Peripheral Clocks Enable SAI3EN : Boolean := False; -- unspecified Reserved_25_27 : HAL.UInt3 := 16#0#; -- DFSDM1 Peripheral Clocks Enable DFSDM1EN : Boolean := False; -- HRTIM peripheral clock enable HRTIMEN : Boolean := False; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_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_11 at 0 range 6 .. 11; SPI1EN at 0 range 12 .. 12; SPI4EN at 0 range 13 .. 13; Reserved_14_15 at 0 range 14 .. 15; TIM15EN at 0 range 16 .. 16; TIM16EN at 0 range 17 .. 17; TIM17EN at 0 range 18 .. 18; Reserved_19_19 at 0 range 19 .. 19; SPI5EN at 0 range 20 .. 20; Reserved_21_21 at 0 range 21 .. 21; SAI1EN at 0 range 22 .. 22; SAI2EN at 0 range 23 .. 23; SAI3EN at 0 range 24 .. 24; Reserved_25_27 at 0 range 25 .. 27; DFSDM1EN at 0 range 28 .. 28; HRTIMEN at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; -- RCC APB4 Clock Register type APB4ENR_Register is record -- unspecified Reserved_0_0 : HAL.Bit := 16#0#; -- SYSCFG peripheral clock enable SYSCFGEN : Boolean := False; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- LPUART1 Peripheral Clocks Enable LPUART1EN : Boolean := False; -- unspecified Reserved_4_4 : HAL.Bit := 16#0#; -- SPI6 Peripheral Clocks Enable SPI6EN : Boolean := False; -- unspecified Reserved_6_6 : HAL.Bit := 16#0#; -- I2C4 Peripheral Clocks Enable I2C4EN : Boolean := False; -- unspecified Reserved_8_8 : HAL.Bit := 16#0#; -- LPTIM2 Peripheral Clocks Enable LPTIM2EN : Boolean := False; -- LPTIM3 Peripheral Clocks Enable LPTIM3EN : Boolean := False; -- LPTIM4 Peripheral Clocks Enable LPTIM4EN : Boolean := False; -- LPTIM5 Peripheral Clocks Enable LPTIM5EN : Boolean := False; -- unspecified Reserved_13_13 : HAL.Bit := 16#0#; -- COMP1/2 peripheral clock enable COMP12EN : Boolean := False; -- VREF peripheral clock enable VREFEN : Boolean := False; -- RTC APB Clock Enable RTCAPBEN : Boolean := False; -- unspecified Reserved_17_20 : HAL.UInt4 := 16#0#; -- SAI4 Peripheral Clocks Enable SAI4EN : Boolean := False; -- unspecified Reserved_22_31 : HAL.UInt10 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB4ENR_Register use record Reserved_0_0 at 0 range 0 .. 0; SYSCFGEN at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; LPUART1EN at 0 range 3 .. 3; Reserved_4_4 at 0 range 4 .. 4; SPI6EN at 0 range 5 .. 5; Reserved_6_6 at 0 range 6 .. 6; I2C4EN at 0 range 7 .. 7; Reserved_8_8 at 0 range 8 .. 8; LPTIM2EN at 0 range 9 .. 9; LPTIM3EN at 0 range 10 .. 10; LPTIM4EN at 0 range 11 .. 11; LPTIM5EN at 0 range 12 .. 12; Reserved_13_13 at 0 range 13 .. 13; COMP12EN at 0 range 14 .. 14; VREFEN at 0 range 15 .. 15; RTCAPBEN at 0 range 16 .. 16; Reserved_17_20 at 0 range 17 .. 20; SAI4EN at 0 range 21 .. 21; Reserved_22_31 at 0 range 22 .. 31; end record; -- RCC AHB3 Sleep Clock Register type AHB3LPENR_Register is record -- MDMA Clock Enable During CSleep Mode MDMALPEN : Boolean := False; -- unspecified Reserved_1_3 : HAL.UInt3 := 16#0#; -- DMA2D Clock Enable During CSleep Mode DMA2DLPEN : Boolean := False; -- JPGDEC Clock Enable During CSleep Mode JPGDECLPEN : Boolean := False; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- FLITF Clock Enable During CSleep Mode FLASHLPEN : Boolean := False; -- unspecified Reserved_9_11 : HAL.UInt3 := 16#0#; -- FMC Peripheral Clocks Enable During CSleep Mode FMCLPEN : Boolean := False; -- unspecified Reserved_13_13 : HAL.Bit := 16#0#; -- QUADSPI and QUADSPI Delay Clock Enable During CSleep Mode QSPILPEN : Boolean := False; -- unspecified Reserved_15_15 : HAL.Bit := 16#0#; -- SDMMC1 and SDMMC1 Delay Clock Enable During CSleep Mode SDMMC1LPEN : Boolean := False; -- unspecified Reserved_17_27 : HAL.UInt11 := 16#0#; -- D1DTCM1 Block Clock Enable During CSleep mode D1DTCM1LPEN : Boolean := False; -- D1 DTCM2 Block Clock Enable During CSleep mode DTCM2LPEN : Boolean := False; -- D1ITCM Block Clock Enable During CSleep mode ITCMLPEN : Boolean := False; -- AXISRAM Block Clock Enable During CSleep mode AXISRAMLPEN : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB3LPENR_Register use record MDMALPEN at 0 range 0 .. 0; Reserved_1_3 at 0 range 1 .. 3; DMA2DLPEN at 0 range 4 .. 4; JPGDECLPEN at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; FLASHLPEN at 0 range 8 .. 8; Reserved_9_11 at 0 range 9 .. 11; FMCLPEN at 0 range 12 .. 12; Reserved_13_13 at 0 range 13 .. 13; QSPILPEN at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; SDMMC1LPEN at 0 range 16 .. 16; Reserved_17_27 at 0 range 17 .. 27; D1DTCM1LPEN at 0 range 28 .. 28; DTCM2LPEN at 0 range 29 .. 29; ITCMLPEN at 0 range 30 .. 30; AXISRAMLPEN at 0 range 31 .. 31; end record; -- RCC AHB1 Sleep Clock Register type AHB1LPENR_Register is record -- DMA1 Clock Enable During CSleep Mode DMA1LPEN : Boolean := False; -- DMA2 Clock Enable During CSleep Mode DMA2LPEN : Boolean := False; -- unspecified Reserved_2_4 : HAL.UInt3 := 16#0#; -- ADC1/2 Peripheral Clocks Enable During CSleep Mode ADC12LPEN : Boolean := False; -- unspecified Reserved_6_14 : HAL.UInt9 := 16#0#; -- Ethernet MAC bus interface Clock Enable During CSleep Mode ETH1MACLPEN : Boolean := False; -- Ethernet Transmission Clock Enable During CSleep Mode ETH1TXLPEN : Boolean := False; -- Ethernet Reception Clock Enable During CSleep Mode ETH1RXLPEN : Boolean := False; -- unspecified Reserved_18_24 : HAL.UInt7 := 16#0#; -- USB1OTG peripheral clock enable during CSleep mode USB1OTGHSLPEN : Boolean := False; -- USB_PHY1 clock enable during CSleep mode USB1OTGHSULPILPEN : Boolean := False; -- USB2OTG peripheral clock enable during CSleep mode USB2OTGHSLPEN : Boolean := False; -- USB_PHY2 clocks enable during CSleep mode USB2OTGHSULPILPEN : Boolean := False; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB1LPENR_Register use record DMA1LPEN at 0 range 0 .. 0; DMA2LPEN at 0 range 1 .. 1; Reserved_2_4 at 0 range 2 .. 4; ADC12LPEN at 0 range 5 .. 5; Reserved_6_14 at 0 range 6 .. 14; ETH1MACLPEN at 0 range 15 .. 15; ETH1TXLPEN at 0 range 16 .. 16; ETH1RXLPEN at 0 range 17 .. 17; Reserved_18_24 at 0 range 18 .. 24; USB1OTGHSLPEN at 0 range 25 .. 25; USB1OTGHSULPILPEN at 0 range 26 .. 26; USB2OTGHSLPEN at 0 range 27 .. 27; USB2OTGHSULPILPEN at 0 range 28 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; -- RCC AHB2 Sleep Clock Register type AHB2LPENR_Register is record -- CAMITF peripheral clock enable during CSleep mode CAMITFLPEN : Boolean := False; -- unspecified Reserved_1_3 : HAL.UInt3 := 16#0#; -- CRYPT peripheral clock enable during CSleep mode CRYPTLPEN : Boolean := False; -- HASH peripheral clock enable during CSleep mode HASHLPEN : Boolean := False; -- RNG peripheral clock enable during CSleep mode RNGLPEN : Boolean := False; -- unspecified Reserved_7_8 : HAL.UInt2 := 16#0#; -- SDMMC2 and SDMMC2 Delay Clock Enable During CSleep Mode SDMMC2LPEN : Boolean := False; -- unspecified Reserved_10_28 : HAL.UInt19 := 16#0#; -- SRAM1 Clock Enable During CSleep Mode SRAM1LPEN : Boolean := False; -- SRAM2 Clock Enable During CSleep Mode SRAM2LPEN : Boolean := False; -- SRAM3 Clock Enable During CSleep Mode SRAM3LPEN : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB2LPENR_Register use record CAMITFLPEN at 0 range 0 .. 0; Reserved_1_3 at 0 range 1 .. 3; CRYPTLPEN at 0 range 4 .. 4; HASHLPEN at 0 range 5 .. 5; RNGLPEN at 0 range 6 .. 6; Reserved_7_8 at 0 range 7 .. 8; SDMMC2LPEN at 0 range 9 .. 9; Reserved_10_28 at 0 range 10 .. 28; SRAM1LPEN at 0 range 29 .. 29; SRAM2LPEN at 0 range 30 .. 30; SRAM3LPEN at 0 range 31 .. 31; end record; -- RCC AHB4 Sleep Clock Register type AHB4LPENR_Register is record -- GPIO peripheral clock enable during CSleep mode GPIOALPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOBLPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOCLPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIODLPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOELPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOFLPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOGLPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOHLPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOILPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOJLPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOKLPEN : Boolean := False; -- unspecified Reserved_11_18 : HAL.UInt8 := 16#0#; -- CRC peripheral clock enable during CSleep mode CRCLPEN : Boolean := False; -- unspecified Reserved_20_20 : HAL.Bit := 16#0#; -- BDMA Clock Enable During CSleep Mode BDMALPEN : Boolean := False; -- unspecified Reserved_22_23 : HAL.UInt2 := 16#0#; -- ADC3 Peripheral Clocks Enable During CSleep Mode ADC3LPEN : Boolean := False; -- unspecified Reserved_25_27 : HAL.UInt3 := 16#0#; -- Backup RAM Clock Enable During CSleep Mode BKPRAMLPEN : Boolean := False; -- SRAM4 Clock Enable During CSleep Mode SRAM4LPEN : Boolean := False; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB4LPENR_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_18 at 0 range 11 .. 18; CRCLPEN at 0 range 19 .. 19; Reserved_20_20 at 0 range 20 .. 20; BDMALPEN at 0 range 21 .. 21; Reserved_22_23 at 0 range 22 .. 23; ADC3LPEN at 0 range 24 .. 24; Reserved_25_27 at 0 range 25 .. 27; BKPRAMLPEN at 0 range 28 .. 28; SRAM4LPEN at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; -- RCC APB3 Sleep Clock Register type APB3LPENR_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- LTDC peripheral clock enable during CSleep mode LTDCLPEN : Boolean := False; -- unspecified Reserved_4_5 : HAL.UInt2 := 16#0#; -- WWDG1 Clock Enable During CSleep Mode WWDG1LPEN : Boolean := False; -- unspecified Reserved_7_31 : HAL.UInt25 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB3LPENR_Register use record Reserved_0_2 at 0 range 0 .. 2; LTDCLPEN at 0 range 3 .. 3; Reserved_4_5 at 0 range 4 .. 5; WWDG1LPEN at 0 range 6 .. 6; Reserved_7_31 at 0 range 7 .. 31; end record; -- RCC APB1 Low Sleep Clock Register type APB1LLPENR_Register is record -- TIM2 peripheral clock enable during CSleep mode TIM2LPEN : Boolean := False; -- TIM3 peripheral clock enable during CSleep mode TIM3LPEN : Boolean := False; -- TIM4 peripheral clock enable during CSleep mode TIM4LPEN : Boolean := False; -- TIM5 peripheral clock enable during CSleep mode TIM5LPEN : Boolean := False; -- TIM6 peripheral clock enable during CSleep mode TIM6LPEN : Boolean := False; -- TIM7 peripheral clock enable during CSleep mode TIM7LPEN : Boolean := False; -- TIM12 peripheral clock enable during CSleep mode TIM12LPEN : Boolean := False; -- TIM13 peripheral clock enable during CSleep mode TIM13LPEN : Boolean := False; -- TIM14 peripheral clock enable during CSleep mode TIM14LPEN : Boolean := False; -- LPTIM1 Peripheral Clocks Enable During CSleep Mode LPTIM1LPEN : Boolean := False; -- unspecified Reserved_10_13 : HAL.UInt4 := 16#0#; -- SPI2 Peripheral Clocks Enable During CSleep Mode SPI2LPEN : Boolean := False; -- SPI3 Peripheral Clocks Enable During CSleep Mode SPI3LPEN : Boolean := False; -- SPDIFRX Peripheral Clocks Enable During CSleep Mode SPDIFRXLPEN : Boolean := False; -- USART2 Peripheral Clocks Enable During CSleep Mode USART2LPEN : Boolean := False; -- USART3 Peripheral Clocks Enable During CSleep Mode USART3LPEN : Boolean := False; -- UART4 Peripheral Clocks Enable During CSleep Mode UART4LPEN : Boolean := False; -- UART5 Peripheral Clocks Enable During CSleep Mode UART5LPEN : Boolean := False; -- I2C1 Peripheral Clocks Enable During CSleep Mode I2C1LPEN : Boolean := False; -- I2C2 Peripheral Clocks Enable During CSleep Mode I2C2LPEN : Boolean := False; -- I2C3 Peripheral Clocks Enable During CSleep Mode I2C3LPEN : Boolean := False; -- unspecified Reserved_24_26 : HAL.UInt3 := 16#0#; -- HDMI-CEC Peripheral Clocks Enable During CSleep Mode HDMICECLPEN : Boolean := False; -- unspecified Reserved_28_28 : HAL.Bit := 16#0#; -- DAC1/2 peripheral clock enable during CSleep mode DAC12LPEN : Boolean := False; -- UART7 Peripheral Clocks Enable During CSleep Mode UART7LPEN : Boolean := False; -- UART8 Peripheral Clocks Enable During CSleep Mode UART8LPEN : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB1LLPENR_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; LPTIM1LPEN at 0 range 9 .. 9; Reserved_10_13 at 0 range 10 .. 13; SPI2LPEN at 0 range 14 .. 14; SPI3LPEN at 0 range 15 .. 15; SPDIFRXLPEN 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_26 at 0 range 24 .. 26; HDMICECLPEN at 0 range 27 .. 27; Reserved_28_28 at 0 range 28 .. 28; DAC12LPEN at 0 range 29 .. 29; UART7LPEN at 0 range 30 .. 30; UART8LPEN at 0 range 31 .. 31; end record; -- RCC APB1 High Sleep Clock Register type APB1HLPENR_Register is record -- unspecified Reserved_0_0 : HAL.Bit := 16#0#; -- Clock Recovery System peripheral clock enable during CSleep mode CRSLPEN : Boolean := False; -- SWPMI Peripheral Clocks Enable During CSleep Mode SWPLPEN : Boolean := False; -- unspecified Reserved_3_3 : HAL.Bit := 16#0#; -- OPAMP peripheral clock enable during CSleep mode OPAMPLPEN : Boolean := False; -- MDIOS peripheral clock enable during CSleep mode MDIOSLPEN : Boolean := False; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- FDCAN Peripheral Clocks Enable During CSleep Mode FDCANLPEN : Boolean := False; -- unspecified Reserved_9_31 : HAL.UInt23 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB1HLPENR_Register use record Reserved_0_0 at 0 range 0 .. 0; CRSLPEN at 0 range 1 .. 1; SWPLPEN at 0 range 2 .. 2; Reserved_3_3 at 0 range 3 .. 3; OPAMPLPEN at 0 range 4 .. 4; MDIOSLPEN at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; FDCANLPEN at 0 range 8 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; -- RCC APB2 Sleep Clock Register type APB2LPENR_Register is record -- TIM1 peripheral clock enable during CSleep mode TIM1LPEN : Boolean := False; -- TIM8 peripheral clock enable during CSleep mode TIM8LPEN : Boolean := False; -- unspecified Reserved_2_3 : HAL.UInt2 := 16#0#; -- USART1 Peripheral Clocks Enable During CSleep Mode USART1LPEN : Boolean := False; -- USART6 Peripheral Clocks Enable During CSleep Mode USART6LPEN : Boolean := False; -- unspecified Reserved_6_11 : HAL.UInt6 := 16#0#; -- SPI1 Peripheral Clocks Enable During CSleep Mode SPI1LPEN : Boolean := False; -- SPI4 Peripheral Clocks Enable During CSleep Mode SPI4LPEN : Boolean := False; -- unspecified Reserved_14_15 : HAL.UInt2 := 16#0#; -- TIM15 peripheral clock enable during CSleep mode TIM15LPEN : Boolean := False; -- TIM16 peripheral clock enable during CSleep mode TIM16LPEN : Boolean := False; -- TIM17 peripheral clock enable during CSleep mode TIM17LPEN : Boolean := False; -- unspecified Reserved_19_19 : HAL.Bit := 16#0#; -- SPI5 Peripheral Clocks Enable During CSleep Mode SPI5LPEN : Boolean := False; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- SAI1 Peripheral Clocks Enable During CSleep Mode SAI1LPEN : Boolean := False; -- SAI2 Peripheral Clocks Enable During CSleep Mode SAI2LPEN : Boolean := False; -- SAI3 Peripheral Clocks Enable During CSleep Mode SAI3LPEN : Boolean := False; -- unspecified Reserved_25_27 : HAL.UInt3 := 16#0#; -- DFSDM1 Peripheral Clocks Enable During CSleep Mode DFSDM1LPEN : Boolean := False; -- HRTIM peripheral clock enable during CSleep mode HRTIMLPEN : Boolean := False; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_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_11 at 0 range 6 .. 11; SPI1LPEN at 0 range 12 .. 12; SPI4LPEN at 0 range 13 .. 13; Reserved_14_15 at 0 range 14 .. 15; TIM15LPEN at 0 range 16 .. 16; TIM16LPEN at 0 range 17 .. 17; TIM17LPEN at 0 range 18 .. 18; Reserved_19_19 at 0 range 19 .. 19; SPI5LPEN at 0 range 20 .. 20; Reserved_21_21 at 0 range 21 .. 21; SAI1LPEN at 0 range 22 .. 22; SAI2LPEN at 0 range 23 .. 23; SAI3LPEN at 0 range 24 .. 24; Reserved_25_27 at 0 range 25 .. 27; DFSDM1LPEN at 0 range 28 .. 28; HRTIMLPEN at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; -- RCC APB4 Sleep Clock Register type APB4LPENR_Register is record -- unspecified Reserved_0_0 : HAL.Bit := 16#0#; -- SYSCFG peripheral clock enable during CSleep mode SYSCFGLPEN : Boolean := False; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- LPUART1 Peripheral Clocks Enable During CSleep Mode LPUART1LPEN : Boolean := False; -- unspecified Reserved_4_4 : HAL.Bit := 16#0#; -- SPI6 Peripheral Clocks Enable During CSleep Mode SPI6LPEN : Boolean := False; -- unspecified Reserved_6_6 : HAL.Bit := 16#0#; -- I2C4 Peripheral Clocks Enable During CSleep Mode I2C4LPEN : Boolean := False; -- unspecified Reserved_8_8 : HAL.Bit := 16#0#; -- LPTIM2 Peripheral Clocks Enable During CSleep Mode LPTIM2LPEN : Boolean := False; -- LPTIM3 Peripheral Clocks Enable During CSleep Mode LPTIM3LPEN : Boolean := False; -- LPTIM4 Peripheral Clocks Enable During CSleep Mode LPTIM4LPEN : Boolean := False; -- LPTIM5 Peripheral Clocks Enable During CSleep Mode LPTIM5LPEN : Boolean := False; -- unspecified Reserved_13_13 : HAL.Bit := 16#0#; -- COMP1/2 peripheral clock enable during CSleep mode COMP12LPEN : Boolean := False; -- VREF peripheral clock enable during CSleep mode VREFLPEN : Boolean := False; -- RTC APB Clock Enable During CSleep Mode RTCAPBLPEN : Boolean := False; -- unspecified Reserved_17_20 : HAL.UInt4 := 16#0#; -- SAI4 Peripheral Clocks Enable During CSleep Mode SAI4LPEN : Boolean := False; -- unspecified Reserved_22_31 : HAL.UInt10 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB4LPENR_Register use record Reserved_0_0 at 0 range 0 .. 0; SYSCFGLPEN at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; LPUART1LPEN at 0 range 3 .. 3; Reserved_4_4 at 0 range 4 .. 4; SPI6LPEN at 0 range 5 .. 5; Reserved_6_6 at 0 range 6 .. 6; I2C4LPEN at 0 range 7 .. 7; Reserved_8_8 at 0 range 8 .. 8; LPTIM2LPEN at 0 range 9 .. 9; LPTIM3LPEN at 0 range 10 .. 10; LPTIM4LPEN at 0 range 11 .. 11; LPTIM5LPEN at 0 range 12 .. 12; Reserved_13_13 at 0 range 13 .. 13; COMP12LPEN at 0 range 14 .. 14; VREFLPEN at 0 range 15 .. 15; RTCAPBLPEN at 0 range 16 .. 16; Reserved_17_20 at 0 range 17 .. 20; SAI4LPEN at 0 range 21 .. 21; Reserved_22_31 at 0 range 22 .. 31; end record; -- RCC Reset Status Register type C1_RSR_Register is record -- unspecified Reserved_0_15 : HAL.UInt16 := 16#0#; -- Remove reset flag RMVF : Boolean := False; -- CPU reset flag CPURSTF : Boolean := False; -- unspecified Reserved_18_18 : HAL.Bit := 16#0#; -- D1 domain power switch reset flag D1RSTF : Boolean := False; -- D2 domain power switch reset flag D2RSTF : Boolean := False; -- BOR reset flag BORRSTF : Boolean := False; -- Pin reset flag (NRST) PINRSTF : Boolean := False; -- POR/PDR reset flag PORRSTF : Boolean := False; -- System reset from CPU reset flag SFTRSTF : Boolean := False; -- unspecified Reserved_25_25 : HAL.Bit := 16#0#; -- Independent Watchdog reset flag IWDG1RSTF : Boolean := False; -- unspecified Reserved_27_27 : HAL.Bit := 16#0#; -- Window Watchdog reset flag WWDG1RSTF : Boolean := False; -- unspecified Reserved_29_29 : HAL.Bit := 16#0#; -- Reset due to illegal D1 DStandby or CPU CStop flag LPWRRSTF : Boolean := False; -- unspecified Reserved_31_31 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_RSR_Register use record Reserved_0_15 at 0 range 0 .. 15; RMVF at 0 range 16 .. 16; CPURSTF at 0 range 17 .. 17; Reserved_18_18 at 0 range 18 .. 18; D1RSTF at 0 range 19 .. 19; D2RSTF at 0 range 20 .. 20; BORRSTF at 0 range 21 .. 21; PINRSTF at 0 range 22 .. 22; PORRSTF at 0 range 23 .. 23; SFTRSTF at 0 range 24 .. 24; Reserved_25_25 at 0 range 25 .. 25; IWDG1RSTF at 0 range 26 .. 26; Reserved_27_27 at 0 range 27 .. 27; WWDG1RSTF at 0 range 28 .. 28; Reserved_29_29 at 0 range 29 .. 29; LPWRRSTF at 0 range 30 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; -- RCC AHB3 Clock Register type C1_AHB3ENR_Register is record -- MDMA Peripheral Clock Enable MDMAEN : Boolean := False; -- unspecified Reserved_1_3 : HAL.UInt3 := 16#0#; -- DMA2D Peripheral Clock Enable DMA2DEN : Boolean := False; -- JPGDEC Peripheral Clock Enable JPGDECEN : Boolean := False; -- unspecified Reserved_6_11 : HAL.UInt6 := 16#0#; -- FMC Peripheral Clocks Enable FMCEN : Boolean := False; -- unspecified Reserved_13_13 : HAL.Bit := 16#0#; -- QUADSPI and QUADSPI Delay Clock Enable QSPIEN : Boolean := False; -- unspecified Reserved_15_15 : HAL.Bit := 16#0#; -- SDMMC1 and SDMMC1 Delay Clock Enable SDMMC1EN : Boolean := False; -- unspecified Reserved_17_31 : HAL.UInt15 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_AHB3ENR_Register use record MDMAEN at 0 range 0 .. 0; Reserved_1_3 at 0 range 1 .. 3; DMA2DEN at 0 range 4 .. 4; JPGDECEN at 0 range 5 .. 5; Reserved_6_11 at 0 range 6 .. 11; FMCEN at 0 range 12 .. 12; Reserved_13_13 at 0 range 13 .. 13; QSPIEN at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; SDMMC1EN at 0 range 16 .. 16; Reserved_17_31 at 0 range 17 .. 31; end record; -- RCC AHB1 Clock Register type C1_AHB1ENR_Register is record -- DMA1 Clock Enable DMA1EN : Boolean := False; -- DMA2 Clock Enable DMA2EN : Boolean := False; -- unspecified Reserved_2_4 : HAL.UInt3 := 16#0#; -- ADC1/2 Peripheral Clocks Enable ADC12EN : Boolean := False; -- unspecified Reserved_6_14 : HAL.UInt9 := 16#0#; -- Ethernet MAC bus interface Clock Enable ETH1MACEN : Boolean := False; -- Ethernet Transmission Clock Enable ETH1TXEN : Boolean := False; -- Ethernet Reception Clock Enable ETH1RXEN : Boolean := False; -- unspecified Reserved_18_24 : HAL.UInt7 := 16#0#; -- USB1OTG Peripheral Clocks Enable USB1OTGEN : Boolean := False; -- USB_PHY1 Clocks Enable USB1ULPIEN : Boolean := False; -- USB2OTG Peripheral Clocks Enable USB2OTGEN : Boolean := False; -- USB_PHY2 Clocks Enable USB2ULPIEN : Boolean := False; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_AHB1ENR_Register use record DMA1EN at 0 range 0 .. 0; DMA2EN at 0 range 1 .. 1; Reserved_2_4 at 0 range 2 .. 4; ADC12EN at 0 range 5 .. 5; Reserved_6_14 at 0 range 6 .. 14; ETH1MACEN at 0 range 15 .. 15; ETH1TXEN at 0 range 16 .. 16; ETH1RXEN at 0 range 17 .. 17; Reserved_18_24 at 0 range 18 .. 24; USB1OTGEN at 0 range 25 .. 25; USB1ULPIEN at 0 range 26 .. 26; USB2OTGEN at 0 range 27 .. 27; USB2ULPIEN at 0 range 28 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; -- RCC AHB2 Clock Register type C1_AHB2ENR_Register is record -- CAMITF peripheral clock enable CAMITFEN : Boolean := False; -- unspecified Reserved_1_3 : HAL.UInt3 := 16#0#; -- CRYPT peripheral clock enable CRYPTEN : Boolean := False; -- HASH peripheral clock enable HASHEN : Boolean := False; -- RNG peripheral clocks enable RNGEN : Boolean := False; -- unspecified Reserved_7_8 : HAL.UInt2 := 16#0#; -- SDMMC2 and SDMMC2 delay clock enable SDMMC2EN : Boolean := False; -- unspecified Reserved_10_28 : HAL.UInt19 := 16#0#; -- SRAM1 block enable SRAM1EN : Boolean := False; -- SRAM2 block enable SRAM2EN : Boolean := False; -- SRAM3 block enable SRAM3EN : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_AHB2ENR_Register use record CAMITFEN at 0 range 0 .. 0; Reserved_1_3 at 0 range 1 .. 3; CRYPTEN at 0 range 4 .. 4; HASHEN at 0 range 5 .. 5; RNGEN at 0 range 6 .. 6; Reserved_7_8 at 0 range 7 .. 8; SDMMC2EN at 0 range 9 .. 9; Reserved_10_28 at 0 range 10 .. 28; SRAM1EN at 0 range 29 .. 29; SRAM2EN at 0 range 30 .. 30; SRAM3EN at 0 range 31 .. 31; end record; -- RCC AHB4 Clock Register type C1_AHB4ENR_Register is record -- 0GPIO peripheral clock enable GPIOAEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOBEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOCEN : Boolean := False; -- 0GPIO peripheral clock enable GPIODEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOEEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOFEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOGEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOHEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOIEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOJEN : Boolean := False; -- 0GPIO peripheral clock enable GPIOKEN : Boolean := False; -- unspecified Reserved_11_18 : HAL.UInt8 := 16#0#; -- CRC peripheral clock enable CRCEN : Boolean := False; -- unspecified Reserved_20_20 : HAL.Bit := 16#0#; -- BDMA and DMAMUX2 Clock Enable BDMAEN : Boolean := False; -- unspecified Reserved_22_23 : HAL.UInt2 := 16#0#; -- ADC3 Peripheral Clocks Enable ADC3EN : Boolean := False; -- HSEM peripheral clock enable HSEMEN : Boolean := False; -- unspecified Reserved_26_27 : HAL.UInt2 := 16#0#; -- Backup RAM Clock Enable BKPRAMEN : Boolean := False; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_AHB4ENR_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_18 at 0 range 11 .. 18; CRCEN at 0 range 19 .. 19; Reserved_20_20 at 0 range 20 .. 20; BDMAEN at 0 range 21 .. 21; Reserved_22_23 at 0 range 22 .. 23; ADC3EN at 0 range 24 .. 24; HSEMEN at 0 range 25 .. 25; Reserved_26_27 at 0 range 26 .. 27; BKPRAMEN at 0 range 28 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; -- RCC APB3 Clock Register type C1_APB3ENR_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- LTDC peripheral clock enable LTDCEN : Boolean := False; -- unspecified Reserved_4_5 : HAL.UInt2 := 16#0#; -- WWDG1 Clock Enable WWDG1EN : Boolean := False; -- unspecified Reserved_7_31 : HAL.UInt25 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_APB3ENR_Register use record Reserved_0_2 at 0 range 0 .. 2; LTDCEN at 0 range 3 .. 3; Reserved_4_5 at 0 range 4 .. 5; WWDG1EN at 0 range 6 .. 6; Reserved_7_31 at 0 range 7 .. 31; end record; -- RCC APB1 Clock Register type C1_APB1LENR_Register is record -- TIM peripheral clock enable TIM2EN : Boolean := False; -- TIM peripheral clock enable TIM3EN : Boolean := False; -- TIM peripheral clock enable TIM4EN : Boolean := False; -- TIM peripheral clock enable TIM5EN : Boolean := False; -- TIM peripheral clock enable TIM6EN : Boolean := False; -- TIM peripheral clock enable TIM7EN : Boolean := False; -- TIM peripheral clock enable TIM12EN : Boolean := False; -- TIM peripheral clock enable TIM13EN : Boolean := False; -- TIM peripheral clock enable TIM14EN : Boolean := False; -- LPTIM1 Peripheral Clocks Enable LPTIM1EN : Boolean := False; -- unspecified Reserved_10_13 : HAL.UInt4 := 16#0#; -- SPI2 Peripheral Clocks Enable SPI2EN : Boolean := False; -- SPI3 Peripheral Clocks Enable SPI3EN : Boolean := False; -- SPDIFRX Peripheral Clocks Enable SPDIFRXEN : Boolean := False; -- USART2 Peripheral Clocks Enable USART2EN : Boolean := False; -- USART3 Peripheral Clocks Enable USART3EN : Boolean := False; -- UART4 Peripheral Clocks Enable UART4EN : Boolean := False; -- UART5 Peripheral Clocks Enable UART5EN : Boolean := False; -- I2C1 Peripheral Clocks Enable I2C1EN : Boolean := False; -- I2C2 Peripheral Clocks Enable I2C2EN : Boolean := False; -- I2C3 Peripheral Clocks Enable I2C3EN : Boolean := False; -- unspecified Reserved_24_26 : HAL.UInt3 := 16#0#; -- HDMI-CEC peripheral clock enable HDMICECEN : Boolean := False; -- unspecified Reserved_28_28 : HAL.Bit := 16#0#; -- DAC1&2 peripheral clock enable DAC12EN : Boolean := False; -- UART7 Peripheral Clocks Enable UART7EN : Boolean := False; -- UART8 Peripheral Clocks Enable UART8EN : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_APB1LENR_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; LPTIM1EN at 0 range 9 .. 9; Reserved_10_13 at 0 range 10 .. 13; SPI2EN at 0 range 14 .. 14; SPI3EN at 0 range 15 .. 15; SPDIFRXEN 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_26 at 0 range 24 .. 26; HDMICECEN at 0 range 27 .. 27; Reserved_28_28 at 0 range 28 .. 28; DAC12EN at 0 range 29 .. 29; UART7EN at 0 range 30 .. 30; UART8EN at 0 range 31 .. 31; end record; -- RCC APB1 Clock Register type C1_APB1HENR_Register is record -- unspecified Reserved_0_0 : HAL.Bit := 16#0#; -- Clock Recovery System peripheral clock enable CRSEN : Boolean := False; -- SWPMI Peripheral Clocks Enable SWPEN : Boolean := False; -- unspecified Reserved_3_3 : HAL.Bit := 16#0#; -- OPAMP peripheral clock enable OPAMPEN : Boolean := False; -- MDIOS peripheral clock enable MDIOSEN : Boolean := False; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- FDCAN Peripheral Clocks Enable FDCANEN : Boolean := False; -- unspecified Reserved_9_31 : HAL.UInt23 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_APB1HENR_Register use record Reserved_0_0 at 0 range 0 .. 0; CRSEN at 0 range 1 .. 1; SWPEN at 0 range 2 .. 2; Reserved_3_3 at 0 range 3 .. 3; OPAMPEN at 0 range 4 .. 4; MDIOSEN at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; FDCANEN at 0 range 8 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; -- RCC APB2 Clock Register type C1_APB2ENR_Register is record -- TIM1 peripheral clock enable TIM1EN : Boolean := False; -- TIM8 peripheral clock enable TIM8EN : Boolean := False; -- unspecified Reserved_2_3 : HAL.UInt2 := 16#0#; -- USART1 Peripheral Clocks Enable USART1EN : Boolean := False; -- USART6 Peripheral Clocks Enable USART6EN : Boolean := False; -- unspecified Reserved_6_11 : HAL.UInt6 := 16#0#; -- SPI1 Peripheral Clocks Enable SPI1EN : Boolean := False; -- SPI4 Peripheral Clocks Enable SPI4EN : Boolean := False; -- unspecified Reserved_14_15 : HAL.UInt2 := 16#0#; -- TIM15 peripheral clock enable TIM15EN : Boolean := False; -- TIM16 peripheral clock enable TIM16EN : Boolean := False; -- TIM17 peripheral clock enable TIM17EN : Boolean := False; -- unspecified Reserved_19_19 : HAL.Bit := 16#0#; -- SPI5 Peripheral Clocks Enable SPI5EN : Boolean := False; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- SAI1 Peripheral Clocks Enable SAI1EN : Boolean := False; -- SAI2 Peripheral Clocks Enable SAI2EN : Boolean := False; -- SAI3 Peripheral Clocks Enable SAI3EN : Boolean := False; -- unspecified Reserved_25_27 : HAL.UInt3 := 16#0#; -- DFSDM1 Peripheral Clocks Enable DFSDM1EN : Boolean := False; -- HRTIM peripheral clock enable HRTIMEN : Boolean := False; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_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_11 at 0 range 6 .. 11; SPI1EN at 0 range 12 .. 12; SPI4EN at 0 range 13 .. 13; Reserved_14_15 at 0 range 14 .. 15; TIM15EN at 0 range 16 .. 16; TIM16EN at 0 range 17 .. 17; TIM17EN at 0 range 18 .. 18; Reserved_19_19 at 0 range 19 .. 19; SPI5EN at 0 range 20 .. 20; Reserved_21_21 at 0 range 21 .. 21; SAI1EN at 0 range 22 .. 22; SAI2EN at 0 range 23 .. 23; SAI3EN at 0 range 24 .. 24; Reserved_25_27 at 0 range 25 .. 27; DFSDM1EN at 0 range 28 .. 28; HRTIMEN at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; -- RCC APB4 Clock Register type C1_APB4ENR_Register is record -- unspecified Reserved_0_0 : HAL.Bit := 16#0#; -- SYSCFG peripheral clock enable SYSCFGEN : Boolean := False; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- LPUART1 Peripheral Clocks Enable LPUART1EN : Boolean := False; -- unspecified Reserved_4_4 : HAL.Bit := 16#0#; -- SPI6 Peripheral Clocks Enable SPI6EN : Boolean := False; -- unspecified Reserved_6_6 : HAL.Bit := 16#0#; -- I2C4 Peripheral Clocks Enable I2C4EN : Boolean := False; -- unspecified Reserved_8_8 : HAL.Bit := 16#0#; -- LPTIM2 Peripheral Clocks Enable LPTIM2EN : Boolean := False; -- LPTIM3 Peripheral Clocks Enable LPTIM3EN : Boolean := False; -- LPTIM4 Peripheral Clocks Enable LPTIM4EN : Boolean := False; -- LPTIM5 Peripheral Clocks Enable LPTIM5EN : Boolean := False; -- unspecified Reserved_13_13 : HAL.Bit := 16#0#; -- COMP1/2 peripheral clock enable COMP12EN : Boolean := False; -- VREF peripheral clock enable VREFEN : Boolean := False; -- RTC APB Clock Enable RTCAPBEN : Boolean := False; -- unspecified Reserved_17_20 : HAL.UInt4 := 16#0#; -- SAI4 Peripheral Clocks Enable SAI4EN : Boolean := False; -- unspecified Reserved_22_31 : HAL.UInt10 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_APB4ENR_Register use record Reserved_0_0 at 0 range 0 .. 0; SYSCFGEN at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; LPUART1EN at 0 range 3 .. 3; Reserved_4_4 at 0 range 4 .. 4; SPI6EN at 0 range 5 .. 5; Reserved_6_6 at 0 range 6 .. 6; I2C4EN at 0 range 7 .. 7; Reserved_8_8 at 0 range 8 .. 8; LPTIM2EN at 0 range 9 .. 9; LPTIM3EN at 0 range 10 .. 10; LPTIM4EN at 0 range 11 .. 11; LPTIM5EN at 0 range 12 .. 12; Reserved_13_13 at 0 range 13 .. 13; COMP12EN at 0 range 14 .. 14; VREFEN at 0 range 15 .. 15; RTCAPBEN at 0 range 16 .. 16; Reserved_17_20 at 0 range 17 .. 20; SAI4EN at 0 range 21 .. 21; Reserved_22_31 at 0 range 22 .. 31; end record; -- RCC AHB3 Sleep Clock Register type C1_AHB3LPENR_Register is record -- MDMA Clock Enable During CSleep Mode MDMALPEN : Boolean := False; -- unspecified Reserved_1_3 : HAL.UInt3 := 16#0#; -- DMA2D Clock Enable During CSleep Mode DMA2DLPEN : Boolean := False; -- JPGDEC Clock Enable During CSleep Mode JPGDECLPEN : Boolean := False; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- FLITF Clock Enable During CSleep Mode FLITFLPEN : Boolean := False; -- unspecified Reserved_9_11 : HAL.UInt3 := 16#0#; -- FMC Peripheral Clocks Enable During CSleep Mode FMCLPEN : Boolean := False; -- unspecified Reserved_13_13 : HAL.Bit := 16#0#; -- QUADSPI and QUADSPI Delay Clock Enable During CSleep Mode QSPILPEN : Boolean := False; -- unspecified Reserved_15_15 : HAL.Bit := 16#0#; -- SDMMC1 and SDMMC1 Delay Clock Enable During CSleep Mode SDMMC1LPEN : Boolean := False; -- unspecified Reserved_17_27 : HAL.UInt11 := 16#0#; -- D1DTCM1 Block Clock Enable During CSleep mode D1DTCM1LPEN : Boolean := False; -- D1 DTCM2 Block Clock Enable During CSleep mode DTCM2LPEN : Boolean := False; -- D1ITCM Block Clock Enable During CSleep mode ITCMLPEN : Boolean := False; -- AXISRAM Block Clock Enable During CSleep mode AXISRAMLPEN : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_AHB3LPENR_Register use record MDMALPEN at 0 range 0 .. 0; Reserved_1_3 at 0 range 1 .. 3; DMA2DLPEN at 0 range 4 .. 4; JPGDECLPEN at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; FLITFLPEN at 0 range 8 .. 8; Reserved_9_11 at 0 range 9 .. 11; FMCLPEN at 0 range 12 .. 12; Reserved_13_13 at 0 range 13 .. 13; QSPILPEN at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; SDMMC1LPEN at 0 range 16 .. 16; Reserved_17_27 at 0 range 17 .. 27; D1DTCM1LPEN at 0 range 28 .. 28; DTCM2LPEN at 0 range 29 .. 29; ITCMLPEN at 0 range 30 .. 30; AXISRAMLPEN at 0 range 31 .. 31; end record; -- RCC AHB1 Sleep Clock Register type C1_AHB1LPENR_Register is record -- DMA1 Clock Enable During CSleep Mode DMA1LPEN : Boolean := False; -- DMA2 Clock Enable During CSleep Mode DMA2LPEN : Boolean := False; -- unspecified Reserved_2_4 : HAL.UInt3 := 16#0#; -- ADC1/2 Peripheral Clocks Enable During CSleep Mode ADC12LPEN : Boolean := False; -- unspecified Reserved_6_14 : HAL.UInt9 := 16#0#; -- Ethernet MAC bus interface Clock Enable During CSleep Mode ETH1MACLPEN : Boolean := False; -- Ethernet Transmission Clock Enable During CSleep Mode ETH1TXLPEN : Boolean := False; -- Ethernet Reception Clock Enable During CSleep Mode ETH1RXLPEN : Boolean := False; -- unspecified Reserved_18_24 : HAL.UInt7 := 16#0#; -- USB1OTG peripheral clock enable during CSleep mode USB1OTGLPEN : Boolean := False; -- USB_PHY1 clock enable during CSleep mode USB1ULPILPEN : Boolean := False; -- USB2OTG peripheral clock enable during CSleep mode USB2OTGLPEN : Boolean := False; -- USB_PHY2 clocks enable during CSleep mode USB2ULPILPEN : Boolean := False; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_AHB1LPENR_Register use record DMA1LPEN at 0 range 0 .. 0; DMA2LPEN at 0 range 1 .. 1; Reserved_2_4 at 0 range 2 .. 4; ADC12LPEN at 0 range 5 .. 5; Reserved_6_14 at 0 range 6 .. 14; ETH1MACLPEN at 0 range 15 .. 15; ETH1TXLPEN at 0 range 16 .. 16; ETH1RXLPEN at 0 range 17 .. 17; Reserved_18_24 at 0 range 18 .. 24; USB1OTGLPEN at 0 range 25 .. 25; USB1ULPILPEN at 0 range 26 .. 26; USB2OTGLPEN at 0 range 27 .. 27; USB2ULPILPEN at 0 range 28 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; -- RCC AHB2 Sleep Clock Register type C1_AHB2LPENR_Register is record -- CAMITF peripheral clock enable during CSleep mode CAMITFLPEN : Boolean := False; -- unspecified Reserved_1_3 : HAL.UInt3 := 16#0#; -- CRYPT peripheral clock enable during CSleep mode CRYPTLPEN : Boolean := False; -- HASH peripheral clock enable during CSleep mode HASHLPEN : Boolean := False; -- RNG peripheral clock enable during CSleep mode RNGLPEN : Boolean := False; -- unspecified Reserved_7_8 : HAL.UInt2 := 16#0#; -- SDMMC2 and SDMMC2 Delay Clock Enable During CSleep Mode SDMMC2LPEN : Boolean := False; -- unspecified Reserved_10_28 : HAL.UInt19 := 16#0#; -- SRAM1 Clock Enable During CSleep Mode SRAM1LPEN : Boolean := False; -- SRAM2 Clock Enable During CSleep Mode SRAM2LPEN : Boolean := False; -- SRAM3 Clock Enable During CSleep Mode SRAM3LPEN : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_AHB2LPENR_Register use record CAMITFLPEN at 0 range 0 .. 0; Reserved_1_3 at 0 range 1 .. 3; CRYPTLPEN at 0 range 4 .. 4; HASHLPEN at 0 range 5 .. 5; RNGLPEN at 0 range 6 .. 6; Reserved_7_8 at 0 range 7 .. 8; SDMMC2LPEN at 0 range 9 .. 9; Reserved_10_28 at 0 range 10 .. 28; SRAM1LPEN at 0 range 29 .. 29; SRAM2LPEN at 0 range 30 .. 30; SRAM3LPEN at 0 range 31 .. 31; end record; -- RCC AHB4 Sleep Clock Register type C1_AHB4LPENR_Register is record -- GPIO peripheral clock enable during CSleep mode GPIOALPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOBLPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOCLPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIODLPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOELPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOFLPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOGLPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOHLPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOILPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOJLPEN : Boolean := False; -- GPIO peripheral clock enable during CSleep mode GPIOKLPEN : Boolean := False; -- unspecified Reserved_11_18 : HAL.UInt8 := 16#0#; -- CRC peripheral clock enable during CSleep mode CRCLPEN : Boolean := False; -- unspecified Reserved_20_20 : HAL.Bit := 16#0#; -- BDMA Clock Enable During CSleep Mode BDMALPEN : Boolean := False; -- unspecified Reserved_22_23 : HAL.UInt2 := 16#0#; -- ADC3 Peripheral Clocks Enable During CSleep Mode ADC3LPEN : Boolean := False; -- unspecified Reserved_25_27 : HAL.UInt3 := 16#0#; -- Backup RAM Clock Enable During CSleep Mode BKPRAMLPEN : Boolean := False; -- SRAM4 Clock Enable During CSleep Mode SRAM4LPEN : Boolean := False; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_AHB4LPENR_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_18 at 0 range 11 .. 18; CRCLPEN at 0 range 19 .. 19; Reserved_20_20 at 0 range 20 .. 20; BDMALPEN at 0 range 21 .. 21; Reserved_22_23 at 0 range 22 .. 23; ADC3LPEN at 0 range 24 .. 24; Reserved_25_27 at 0 range 25 .. 27; BKPRAMLPEN at 0 range 28 .. 28; SRAM4LPEN at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; -- RCC APB3 Sleep Clock Register type C1_APB3LPENR_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- LTDC peripheral clock enable during CSleep mode LTDCLPEN : Boolean := False; -- unspecified Reserved_4_5 : HAL.UInt2 := 16#0#; -- WWDG1 Clock Enable During CSleep Mode WWDG1LPEN : Boolean := False; -- unspecified Reserved_7_31 : HAL.UInt25 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_APB3LPENR_Register use record Reserved_0_2 at 0 range 0 .. 2; LTDCLPEN at 0 range 3 .. 3; Reserved_4_5 at 0 range 4 .. 5; WWDG1LPEN at 0 range 6 .. 6; Reserved_7_31 at 0 range 7 .. 31; end record; -- RCC APB1 Low Sleep Clock Register type C1_APB1LLPENR_Register is record -- TIM2 peripheral clock enable during CSleep mode TIM2LPEN : Boolean := False; -- TIM3 peripheral clock enable during CSleep mode TIM3LPEN : Boolean := False; -- TIM4 peripheral clock enable during CSleep mode TIM4LPEN : Boolean := False; -- TIM5 peripheral clock enable during CSleep mode TIM5LPEN : Boolean := False; -- TIM6 peripheral clock enable during CSleep mode TIM6LPEN : Boolean := False; -- TIM7 peripheral clock enable during CSleep mode TIM7LPEN : Boolean := False; -- TIM12 peripheral clock enable during CSleep mode TIM12LPEN : Boolean := False; -- TIM13 peripheral clock enable during CSleep mode TIM13LPEN : Boolean := False; -- TIM14 peripheral clock enable during CSleep mode TIM14LPEN : Boolean := False; -- LPTIM1 Peripheral Clocks Enable During CSleep Mode LPTIM1LPEN : Boolean := False; -- unspecified Reserved_10_13 : HAL.UInt4 := 16#0#; -- SPI2 Peripheral Clocks Enable During CSleep Mode SPI2LPEN : Boolean := False; -- SPI3 Peripheral Clocks Enable During CSleep Mode SPI3LPEN : Boolean := False; -- SPDIFRX Peripheral Clocks Enable During CSleep Mode SPDIFRXLPEN : Boolean := False; -- USART2 Peripheral Clocks Enable During CSleep Mode USART2LPEN : Boolean := False; -- USART3 Peripheral Clocks Enable During CSleep Mode USART3LPEN : Boolean := False; -- UART4 Peripheral Clocks Enable During CSleep Mode UART4LPEN : Boolean := False; -- UART5 Peripheral Clocks Enable During CSleep Mode UART5LPEN : Boolean := False; -- I2C1 Peripheral Clocks Enable During CSleep Mode I2C1LPEN : Boolean := False; -- I2C2 Peripheral Clocks Enable During CSleep Mode I2C2LPEN : Boolean := False; -- I2C3 Peripheral Clocks Enable During CSleep Mode I2C3LPEN : Boolean := False; -- unspecified Reserved_24_26 : HAL.UInt3 := 16#0#; -- HDMI-CEC Peripheral Clocks Enable During CSleep Mode HDMICECLPEN : Boolean := False; -- unspecified Reserved_28_28 : HAL.Bit := 16#0#; -- DAC1/2 peripheral clock enable during CSleep mode DAC12LPEN : Boolean := False; -- UART7 Peripheral Clocks Enable During CSleep Mode UART7LPEN : Boolean := False; -- UART8 Peripheral Clocks Enable During CSleep Mode UART8LPEN : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_APB1LLPENR_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; LPTIM1LPEN at 0 range 9 .. 9; Reserved_10_13 at 0 range 10 .. 13; SPI2LPEN at 0 range 14 .. 14; SPI3LPEN at 0 range 15 .. 15; SPDIFRXLPEN 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_26 at 0 range 24 .. 26; HDMICECLPEN at 0 range 27 .. 27; Reserved_28_28 at 0 range 28 .. 28; DAC12LPEN at 0 range 29 .. 29; UART7LPEN at 0 range 30 .. 30; UART8LPEN at 0 range 31 .. 31; end record; -- RCC APB1 High Sleep Clock Register type C1_APB1HLPENR_Register is record -- unspecified Reserved_0_0 : HAL.Bit := 16#0#; -- Clock Recovery System peripheral clock enable during CSleep mode CRSLPEN : Boolean := False; -- SWPMI Peripheral Clocks Enable During CSleep Mode SWPLPEN : Boolean := False; -- unspecified Reserved_3_3 : HAL.Bit := 16#0#; -- OPAMP peripheral clock enable during CSleep mode OPAMPLPEN : Boolean := False; -- MDIOS peripheral clock enable during CSleep mode MDIOSLPEN : Boolean := False; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- FDCAN Peripheral Clocks Enable During CSleep Mode FDCANLPEN : Boolean := False; -- unspecified Reserved_9_31 : HAL.UInt23 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_APB1HLPENR_Register use record Reserved_0_0 at 0 range 0 .. 0; CRSLPEN at 0 range 1 .. 1; SWPLPEN at 0 range 2 .. 2; Reserved_3_3 at 0 range 3 .. 3; OPAMPLPEN at 0 range 4 .. 4; MDIOSLPEN at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; FDCANLPEN at 0 range 8 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; -- RCC APB2 Sleep Clock Register type C1_APB2LPENR_Register is record -- TIM1 peripheral clock enable during CSleep mode TIM1LPEN : Boolean := False; -- TIM8 peripheral clock enable during CSleep mode TIM8LPEN : Boolean := False; -- unspecified Reserved_2_3 : HAL.UInt2 := 16#0#; -- USART1 Peripheral Clocks Enable During CSleep Mode USART1LPEN : Boolean := False; -- USART6 Peripheral Clocks Enable During CSleep Mode USART6LPEN : Boolean := False; -- unspecified Reserved_6_11 : HAL.UInt6 := 16#0#; -- SPI1 Peripheral Clocks Enable During CSleep Mode SPI1LPEN : Boolean := False; -- SPI4 Peripheral Clocks Enable During CSleep Mode SPI4LPEN : Boolean := False; -- unspecified Reserved_14_15 : HAL.UInt2 := 16#0#; -- TIM15 peripheral clock enable during CSleep mode TIM15LPEN : Boolean := False; -- TIM16 peripheral clock enable during CSleep mode TIM16LPEN : Boolean := False; -- TIM17 peripheral clock enable during CSleep mode TIM17LPEN : Boolean := False; -- unspecified Reserved_19_19 : HAL.Bit := 16#0#; -- SPI5 Peripheral Clocks Enable During CSleep Mode SPI5LPEN : Boolean := False; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- SAI1 Peripheral Clocks Enable During CSleep Mode SAI1LPEN : Boolean := False; -- SAI2 Peripheral Clocks Enable During CSleep Mode SAI2LPEN : Boolean := False; -- SAI3 Peripheral Clocks Enable During CSleep Mode SAI3LPEN : Boolean := False; -- unspecified Reserved_25_27 : HAL.UInt3 := 16#0#; -- DFSDM1 Peripheral Clocks Enable During CSleep Mode DFSDM1LPEN : Boolean := False; -- HRTIM peripheral clock enable during CSleep mode HRTIMLPEN : Boolean := False; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_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_11 at 0 range 6 .. 11; SPI1LPEN at 0 range 12 .. 12; SPI4LPEN at 0 range 13 .. 13; Reserved_14_15 at 0 range 14 .. 15; TIM15LPEN at 0 range 16 .. 16; TIM16LPEN at 0 range 17 .. 17; TIM17LPEN at 0 range 18 .. 18; Reserved_19_19 at 0 range 19 .. 19; SPI5LPEN at 0 range 20 .. 20; Reserved_21_21 at 0 range 21 .. 21; SAI1LPEN at 0 range 22 .. 22; SAI2LPEN at 0 range 23 .. 23; SAI3LPEN at 0 range 24 .. 24; Reserved_25_27 at 0 range 25 .. 27; DFSDM1LPEN at 0 range 28 .. 28; HRTIMLPEN at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; -- RCC APB4 Sleep Clock Register type C1_APB4LPENR_Register is record -- unspecified Reserved_0_0 : HAL.Bit := 16#0#; -- SYSCFG peripheral clock enable during CSleep mode SYSCFGLPEN : Boolean := False; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- LPUART1 Peripheral Clocks Enable During CSleep Mode LPUART1LPEN : Boolean := False; -- unspecified Reserved_4_4 : HAL.Bit := 16#0#; -- SPI6 Peripheral Clocks Enable During CSleep Mode SPI6LPEN : Boolean := False; -- unspecified Reserved_6_6 : HAL.Bit := 16#0#; -- I2C4 Peripheral Clocks Enable During CSleep Mode I2C4LPEN : Boolean := False; -- unspecified Reserved_8_8 : HAL.Bit := 16#0#; -- LPTIM2 Peripheral Clocks Enable During CSleep Mode LPTIM2LPEN : Boolean := False; -- LPTIM3 Peripheral Clocks Enable During CSleep Mode LPTIM3LPEN : Boolean := False; -- LPTIM4 Peripheral Clocks Enable During CSleep Mode LPTIM4LPEN : Boolean := False; -- LPTIM5 Peripheral Clocks Enable During CSleep Mode LPTIM5LPEN : Boolean := False; -- unspecified Reserved_13_13 : HAL.Bit := 16#0#; -- COMP1/2 peripheral clock enable during CSleep mode COMP12LPEN : Boolean := False; -- VREF peripheral clock enable during CSleep mode VREFLPEN : Boolean := False; -- RTC APB Clock Enable During CSleep Mode RTCAPBLPEN : Boolean := False; -- unspecified Reserved_17_20 : HAL.UInt4 := 16#0#; -- SAI4 Peripheral Clocks Enable During CSleep Mode SAI4LPEN : Boolean := False; -- unspecified Reserved_22_31 : HAL.UInt10 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for C1_APB4LPENR_Register use record Reserved_0_0 at 0 range 0 .. 0; SYSCFGLPEN at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; LPUART1LPEN at 0 range 3 .. 3; Reserved_4_4 at 0 range 4 .. 4; SPI6LPEN at 0 range 5 .. 5; Reserved_6_6 at 0 range 6 .. 6; I2C4LPEN at 0 range 7 .. 7; Reserved_8_8 at 0 range 8 .. 8; LPTIM2LPEN at 0 range 9 .. 9; LPTIM3LPEN at 0 range 10 .. 10; LPTIM4LPEN at 0 range 11 .. 11; LPTIM5LPEN at 0 range 12 .. 12; Reserved_13_13 at 0 range 13 .. 13; COMP12LPEN at 0 range 14 .. 14; VREFLPEN at 0 range 15 .. 15; RTCAPBLPEN at 0 range 16 .. 16; Reserved_17_20 at 0 range 17 .. 20; SAI4LPEN at 0 range 21 .. 21; Reserved_22_31 at 0 range 22 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Reset and clock control type RCC_Peripheral is record -- clock control register CR : aliased CR_Register; -- RCC Internal Clock Source Calibration Register ICSCR : aliased ICSCR_Register; -- RCC Clock Recovery RC Register CRRCR : aliased CRRCR_Register; -- RCC Clock Configuration Register CFGR : aliased CFGR_Register; -- RCC Domain 1 Clock Configuration Register D1CFGR : aliased D1CFGR_Register; -- RCC Domain 2 Clock Configuration Register D2CFGR : aliased D2CFGR_Register; -- RCC Domain 3 Clock Configuration Register D3CFGR : aliased D3CFGR_Register; -- RCC PLLs Clock Source Selection Register PLLCKSELR : aliased PLLCKSELR_Register; -- RCC PLLs Configuration Register PLLCFGR : aliased PLLCFGR_Register; -- RCC PLL1 Dividers Configuration Register PLL1DIVR : aliased PLL1DIVR_Register; -- RCC PLL1 Fractional Divider Register PLL1FRACR : aliased PLL1FRACR_Register; -- RCC PLL2 Dividers Configuration Register PLL2DIVR : aliased PLL2DIVR_Register; -- RCC PLL2 Fractional Divider Register PLL2FRACR : aliased PLL2FRACR_Register; -- RCC PLL3 Dividers Configuration Register PLL3DIVR : aliased PLL3DIVR_Register; -- RCC PLL3 Fractional Divider Register PLL3FRACR : aliased PLL3FRACR_Register; -- RCC Domain 1 Kernel Clock Configuration Register D1CCIPR : aliased D1CCIPR_Register; -- RCC Domain 2 Kernel Clock Configuration Register D2CCIP1R : aliased D2CCIP1R_Register; -- RCC Domain 2 Kernel Clock Configuration Register D2CCIP2R : aliased D2CCIP2R_Register; -- RCC Domain 3 Kernel Clock Configuration Register D3CCIPR : aliased D3CCIPR_Register; -- RCC Clock Source Interrupt Enable Register CIER : aliased CIER_Register; -- RCC Clock Source Interrupt Flag Register CIFR : aliased CIFR_Register; -- RCC Clock Source Interrupt Clear Register CICR : aliased CICR_Register; -- RCC Backup Domain Control Register BDCR : aliased BDCR_Register; -- RCC Clock Control and Status Register CSR : aliased CSR_Register; -- RCC AHB3 Reset Register AHB3RSTR : aliased AHB3RSTR_Register; -- RCC AHB1 Peripheral Reset Register AHB1RSTR : aliased AHB1RSTR_Register; -- RCC AHB2 Peripheral Reset Register AHB2RSTR : aliased AHB2RSTR_Register; -- RCC AHB4 Peripheral Reset Register AHB4RSTR : aliased AHB4RSTR_Register; -- RCC APB3 Peripheral Reset Register APB3RSTR : aliased APB3RSTR_Register; -- RCC APB1 Peripheral Reset Register APB1LRSTR : aliased APB1LRSTR_Register; -- RCC APB1 Peripheral Reset Register APB1HRSTR : aliased APB1HRSTR_Register; -- RCC APB2 Peripheral Reset Register APB2RSTR : aliased APB2RSTR_Register; -- RCC APB4 Peripheral Reset Register APB4RSTR : aliased APB4RSTR_Register; -- RCC Global Control Register GCR : aliased GCR_Register; -- RCC D3 Autonomous mode Register D3AMR : aliased D3AMR_Register; -- RCC Reset Status Register RSR : aliased RSR_Register; -- RCC AHB3 Clock Register AHB3ENR : aliased AHB3ENR_Register; -- RCC AHB1 Clock Register AHB1ENR : aliased AHB1ENR_Register; -- RCC AHB2 Clock Register AHB2ENR : aliased AHB2ENR_Register; -- RCC AHB4 Clock Register AHB4ENR : aliased AHB4ENR_Register; -- RCC APB3 Clock Register APB3ENR : aliased APB3ENR_Register; -- RCC APB1 Clock Register APB1LENR : aliased APB1LENR_Register; -- RCC APB1 Clock Register APB1HENR : aliased APB1HENR_Register; -- RCC APB2 Clock Register APB2ENR : aliased APB2ENR_Register; -- RCC APB4 Clock Register APB4ENR : aliased APB4ENR_Register; -- RCC AHB3 Sleep Clock Register AHB3LPENR : aliased AHB3LPENR_Register; -- RCC AHB1 Sleep Clock Register AHB1LPENR : aliased AHB1LPENR_Register; -- RCC AHB2 Sleep Clock Register AHB2LPENR : aliased AHB2LPENR_Register; -- RCC AHB4 Sleep Clock Register AHB4LPENR : aliased AHB4LPENR_Register; -- RCC APB3 Sleep Clock Register APB3LPENR : aliased APB3LPENR_Register; -- RCC APB1 Low Sleep Clock Register APB1LLPENR : aliased APB1LLPENR_Register; -- RCC APB1 High Sleep Clock Register APB1HLPENR : aliased APB1HLPENR_Register; -- RCC APB2 Sleep Clock Register APB2LPENR : aliased APB2LPENR_Register; -- RCC APB4 Sleep Clock Register APB4LPENR : aliased APB4LPENR_Register; -- RCC Reset Status Register C1_RSR : aliased C1_RSR_Register; -- RCC AHB3 Clock Register C1_AHB3ENR : aliased C1_AHB3ENR_Register; -- RCC AHB1 Clock Register C1_AHB1ENR : aliased C1_AHB1ENR_Register; -- RCC AHB2 Clock Register C1_AHB2ENR : aliased C1_AHB2ENR_Register; -- RCC AHB4 Clock Register C1_AHB4ENR : aliased C1_AHB4ENR_Register; -- RCC APB3 Clock Register C1_APB3ENR : aliased C1_APB3ENR_Register; -- RCC APB1 Clock Register C1_APB1LENR : aliased C1_APB1LENR_Register; -- RCC APB1 Clock Register C1_APB1HENR : aliased C1_APB1HENR_Register; -- RCC APB2 Clock Register C1_APB2ENR : aliased C1_APB2ENR_Register; -- RCC APB4 Clock Register C1_APB4ENR : aliased C1_APB4ENR_Register; -- RCC AHB3 Sleep Clock Register C1_AHB3LPENR : aliased C1_AHB3LPENR_Register; -- RCC AHB1 Sleep Clock Register C1_AHB1LPENR : aliased C1_AHB1LPENR_Register; -- RCC AHB2 Sleep Clock Register C1_AHB2LPENR : aliased C1_AHB2LPENR_Register; -- RCC AHB4 Sleep Clock Register C1_AHB4LPENR : aliased C1_AHB4LPENR_Register; -- RCC APB3 Sleep Clock Register C1_APB3LPENR : aliased C1_APB3LPENR_Register; -- RCC APB1 Low Sleep Clock Register C1_APB1LLPENR : aliased C1_APB1LLPENR_Register; -- RCC APB1 High Sleep Clock Register C1_APB1HLPENR : aliased C1_APB1HLPENR_Register; -- RCC APB2 Sleep Clock Register C1_APB2LPENR : aliased C1_APB2LPENR_Register; -- RCC APB4 Sleep Clock Register C1_APB4LPENR : aliased C1_APB4LPENR_Register; end record with Volatile; for RCC_Peripheral use record CR at 16#0# range 0 .. 31; ICSCR at 16#4# range 0 .. 31; CRRCR at 16#8# range 0 .. 31; CFGR at 16#10# range 0 .. 31; D1CFGR at 16#18# range 0 .. 31; D2CFGR at 16#1C# range 0 .. 31; D3CFGR at 16#20# range 0 .. 31; PLLCKSELR at 16#28# range 0 .. 31; PLLCFGR at 16#2C# range 0 .. 31; PLL1DIVR at 16#30# range 0 .. 31; PLL1FRACR at 16#34# range 0 .. 31; PLL2DIVR at 16#38# range 0 .. 31; PLL2FRACR at 16#3C# range 0 .. 31; PLL3DIVR at 16#40# range 0 .. 31; PLL3FRACR at 16#44# range 0 .. 31; D1CCIPR at 16#4C# range 0 .. 31; D2CCIP1R at 16#50# range 0 .. 31; D2CCIP2R at 16#54# range 0 .. 31; D3CCIPR at 16#58# range 0 .. 31; CIER at 16#60# range 0 .. 31; CIFR at 16#64# range 0 .. 31; CICR at 16#68# range 0 .. 31; BDCR at 16#70# range 0 .. 31; CSR at 16#74# range 0 .. 31; AHB3RSTR at 16#7C# range 0 .. 31; AHB1RSTR at 16#80# range 0 .. 31; AHB2RSTR at 16#84# range 0 .. 31; AHB4RSTR at 16#88# range 0 .. 31; APB3RSTR at 16#8C# range 0 .. 31; APB1LRSTR at 16#90# range 0 .. 31; APB1HRSTR at 16#94# range 0 .. 31; APB2RSTR at 16#98# range 0 .. 31; APB4RSTR at 16#9C# range 0 .. 31; GCR at 16#A0# range 0 .. 31; D3AMR at 16#A8# range 0 .. 31; RSR at 16#D0# range 0 .. 31; AHB3ENR at 16#D4# range 0 .. 31; AHB1ENR at 16#D8# range 0 .. 31; AHB2ENR at 16#DC# range 0 .. 31; AHB4ENR at 16#E0# range 0 .. 31; APB3ENR at 16#E4# range 0 .. 31; APB1LENR at 16#E8# range 0 .. 31; APB1HENR at 16#EC# range 0 .. 31; APB2ENR at 16#F0# range 0 .. 31; APB4ENR at 16#F4# range 0 .. 31; AHB3LPENR at 16#FC# range 0 .. 31; AHB1LPENR at 16#100# range 0 .. 31; AHB2LPENR at 16#104# range 0 .. 31; AHB4LPENR at 16#108# range 0 .. 31; APB3LPENR at 16#10C# range 0 .. 31; APB1LLPENR at 16#110# range 0 .. 31; APB1HLPENR at 16#114# range 0 .. 31; APB2LPENR at 16#118# range 0 .. 31; APB4LPENR at 16#11C# range 0 .. 31; C1_RSR at 16#130# range 0 .. 31; C1_AHB3ENR at 16#134# range 0 .. 31; C1_AHB1ENR at 16#138# range 0 .. 31; C1_AHB2ENR at 16#13C# range 0 .. 31; C1_AHB4ENR at 16#140# range 0 .. 31; C1_APB3ENR at 16#144# range 0 .. 31; C1_APB1LENR at 16#148# range 0 .. 31; C1_APB1HENR at 16#14C# range 0 .. 31; C1_APB2ENR at 16#150# range 0 .. 31; C1_APB4ENR at 16#154# range 0 .. 31; C1_AHB3LPENR at 16#15C# range 0 .. 31; C1_AHB1LPENR at 16#160# range 0 .. 31; C1_AHB2LPENR at 16#164# range 0 .. 31; C1_AHB4LPENR at 16#168# range 0 .. 31; C1_APB3LPENR at 16#16C# range 0 .. 31; C1_APB1LLPENR at 16#170# range 0 .. 31; C1_APB1HLPENR at 16#174# range 0 .. 31; C1_APB2LPENR at 16#178# range 0 .. 31; C1_APB4LPENR at 16#17C# range 0 .. 31; end record; -- Reset and clock control RCC_Periph : aliased RCC_Peripheral with Import, Address => RCC_Base; end STM32_SVD.RCC;
----------------------------------------------------------------------------- -- -- -- GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS -- -- -- -- I n t e r f a c e s . C . S Y S T E M _ C o n s t a n t s -- -- -- -- S p e c -- -- -- -- $Revision: 2 $ -- -- -- -- Copyright (c) 1991,1992,1993,1994, FSU, All Rights Reserved -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU Library General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. GNARL is distributed in the hope that it will be use- -- -- ful, but but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Gen- -- -- eral Library Public License for more details. You should have received -- -- a copy of the GNU Library General Public License along with GNARL; see -- -- file COPYING.LIB. If not, write to the Free Software Foundation, 675 -- -- Mass Ave, Cambridge, MA 02139, USA. -- -- -- ----------------------------------------------------------------------------- package Interfaces.C.System_Constants is pthread_t_size : constant Integer := 1; pthread_attr_t_size : constant Integer := 13; pthread_mutexattr_t_size : constant Integer := 3; pthread_mutex_t_size : constant Integer := 8; pthread_condattr_t_size : constant Integer := 1; pthread_cond_t_size : constant Integer := 5; pthread_key_t_size : constant Integer := 1; jmp_buf_size : constant Integer := 12; sigjmp_buf_size : constant Integer := 19; sigset_t_size : constant Integer := 4; SIG_BLOCK : constant := 1; SIG_UNBLOCK : constant := 2; SIG_SETMASK : constant := 3; SA_NOCLDSTOP : constant := 131072; SA_SIGINFO : constant := 8; SIG_ERR : constant := -1; SIG_DFL : constant := 0; SIG_IGN : constant := 1; SIGNULL : constant := 0; SIGHUP : constant := 1; SIGINT : constant := 2; SIGQUIT : constant := 3; SIGILL : constant := 4; SIGABRT : constant := 6; SIGFPE : constant := 8; SIGKILL : constant := 9; SIGSEGV : constant := 11; SIGPIPE : constant := 13; SIGALRM : constant := 14; SIGTERM : constant := 15; SIGSTOP : constant := 23; SIGTSTP : constant := 24; SIGCONT : constant := 25; SIGCHLD : constant := 18; SIGTTIN : constant := 26; SIGTTOU : constant := 27; SIGUSR1 : constant := 16; SIGUSR2 : constant := 17; NSIG : constant := 44; -- OS specific signals represented as an array type Sig_Array is array (positive range <>) of integer; OS_Specific_Sync_Sigs : Sig_Array := (NSIG, 5, 7, 10); OS_Specific_Async_Sigs : Sig_Array := (NSIG, 12, 21, 22, 30, 31, 28, 29, 20); -- End of OS specific signals representation EPERM : constant := 1; ENOENT : constant := 2; ESRCH : constant := 3; EINTR : constant := 4; EIO : constant := 5; ENXIO : constant := 6; E2BIG : constant := 7; ENOEXEC : constant := 8; EBADF : constant := 9; ECHILD : constant := 10; EAGAIN : constant := 11; ENOMEM : constant := 12; EACCES : constant := 13; EFAULT : constant := 14; ENOTBLK : constant := 15; EBUSY : constant := 16; EEXIST : constant := 17; EXDEV : constant := 18; ENODEV : constant := 19; ENOTDIR : constant := 20; EISDIR : constant := 21; EINVAL : constant := 22; ENFILE : constant := 23; EMFILE : constant := 24; ENOTTY : constant := 25; ETXTBSY : constant := 26; EFBIG : constant := 27; ENOSPC : constant := 28; ESPIPE : constant := 29; EROFS : constant := 30; EMLINK : constant := 31; EPIPE : constant := 32; ENAMETOOLONG : constant := 78; ENOTEMPTY : constant := 93; EDEADLK : constant := 45; ENOLCK : constant := 46; ENOSYS : constant := 89; ENOTSUP : constant := 48; NO_PRIO_INHERIT : constant := 0; PRIO_INHERIT : constant := 1; PRIO_PROTECT : constant := 2; Add_Prio : constant Integer := 2; end Interfaces.C.System_Constants;
-- Copyright (c) 2020 Raspberry Pi (Trading) Ltd. -- -- SPDX-License-Identifier: BSD-3-Clause -- This spec has been automatically generated from rp2040.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; -- DW_apb_ssi has the following features:\n -- * APB interface – Allows for easy integration into a DesignWare -- Synthesizable Components for AMBA 2 implementation.\n -- * APB3 and APB4 protocol support.\n -- * Scalable APB data bus width – Supports APB data bus widths of -- 8, 16, and 32 bits.\n -- * Serial-master or serial-slave operation – Enables serial -- communication with serial-master or serial-slave peripheral devices.\n -- * Programmable Dual/Quad/Octal SPI support in Master Mode.\n -- * Dual Data Rate (DDR) and Read Data Strobe (RDS) Support - Enables -- the DW_apb_ssi master to perform operations with the device in DDR and RDS -- modes when working in Dual/Quad/Octal mode of operation.\n -- * Data Mask Support - Enables the DW_apb_ssi to selectively update -- the bytes in the device. This feature is applicable only in enhanced SPI -- modes.\n -- * eXecute-In-Place (XIP) support - Enables the DW_apb_ssi master to -- behave as a memory mapped I/O and fetches the data from the device based on -- the APB read request. This feature is applicable only in enhanced SPI -- modes.\n -- * DMA Controller Interface – Enables the DW_apb_ssi to interface -- to a DMA controller over the bus using a handshaking interface for transfer -- requests.\n -- * Independent masking of interrupts – Master collision, transmit -- FIFO overflow, transmit FIFO empty, receive FIFO full, receive FIFO -- underflow, and receive FIFO overflow interrupts can all be masked -- independently.\n -- * Multi-master contention detection – Informs the processor of -- multiple serial-master accesses on the serial bus.\n -- * Bypass of meta-stability flip-flops for synchronous clocks – -- When the APB clock (pclk) and the DW_apb_ssi serial clock (ssi_clk) are -- synchronous, meta-stable flip-flops are not used when transferring control -- signals across these clock domains.\n -- * Programmable delay on the sample time of the received serial data -- bit (rxd); enables programmable control of routing delays resulting in -- higher serial data-bit rates.\n -- * Programmable features:\n -- - Serial interface operation – Choice of Motorola SPI, Texas -- Instruments Synchronous Serial Protocol or National Semiconductor -- Microwire.\n -- - Clock bit-rate – Dynamic control of the serial bit rate of the -- data transfer; used in only serial-master mode of operation.\n -- - Data Item size (4 to 32 bits) – Item size of each data transfer -- under the control of the programmer.\n -- * Configured features:\n -- - FIFO depth – 16 words deep. The FIFO width is fixed at 32 -- bits.\n -- - 1 slave select output.\n -- - Hardware slave-select – Dedicated hardware slave-select line.\n -- - Combined interrupt line - one combined interrupt line from the -- DW_apb_ssi to the interrupt controller.\n -- - Interrupt polarity – active high interrupt lines.\n -- - Serial clock polarity – low serial-clock polarity directly -- after reset.\n -- - Serial clock phase – capture on first edge of serial-clock -- directly after reset. package RP_SVD.XIP_SSI is pragma Preelaborate; --------------- -- Registers -- --------------- subtype CTRLR0_DFS_Field is HAL.UInt4; subtype CTRLR0_FRF_Field is HAL.UInt2; -- Transfer mode type CTRLR0_TMOD_Field is (-- Both transmit and receive Tx_And_Rx, -- Transmit only (not for FRF == 0, standard SPI mode) Tx_Only, -- Receive only (not for FRF == 0, standard SPI mode) Rx_Only, -- EEPROM read mode (TX then RX; RX starts after control data TX'd) Eeprom_Read) with Size => 2; for CTRLR0_TMOD_Field use (Tx_And_Rx => 0, Tx_Only => 1, Rx_Only => 2, Eeprom_Read => 3); subtype CTRLR0_CFS_Field is HAL.UInt4; subtype CTRLR0_DFS_32_Field is HAL.UInt5; -- SPI frame format type CTRLR0_SPI_FRF_Field is (-- Standard 1-bit SPI frame format; 1 bit per SCK, full-duplex Std, -- Dual-SPI frame format; two bits per SCK, half-duplex Dual, -- Quad-SPI frame format; four bits per SCK, half-duplex Quad) with Size => 2; for CTRLR0_SPI_FRF_Field use (Std => 0, Dual => 1, Quad => 2); -- Control register 0 type CTRLR0_Register is record -- Data frame size DFS : CTRLR0_DFS_Field := 16#0#; -- Frame format FRF : CTRLR0_FRF_Field := 16#0#; -- Serial clock phase SCPH : Boolean := False; -- Serial clock polarity SCPOL : Boolean := False; -- Transfer mode TMOD : CTRLR0_TMOD_Field := RP_SVD.XIP_SSI.Tx_And_Rx; -- Slave output enable SLV_OE : Boolean := False; -- Shift register loop (test mode) SRL : Boolean := False; -- Control frame size\n Value of n -> n+1 clocks per frame. CFS : CTRLR0_CFS_Field := 16#0#; -- Data frame size in 32b transfer mode\n Value of n -> n+1 clocks per -- frame. DFS_32 : CTRLR0_DFS_32_Field := 16#0#; -- SPI frame format SPI_FRF : CTRLR0_SPI_FRF_Field := RP_SVD.XIP_SSI.Std; -- unspecified Reserved_23_23 : HAL.Bit := 16#0#; -- Slave select toggle enable SSTE : Boolean := False; -- unspecified Reserved_25_31 : HAL.UInt7 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CTRLR0_Register use record DFS at 0 range 0 .. 3; FRF at 0 range 4 .. 5; SCPH at 0 range 6 .. 6; SCPOL at 0 range 7 .. 7; TMOD at 0 range 8 .. 9; SLV_OE at 0 range 10 .. 10; SRL at 0 range 11 .. 11; CFS at 0 range 12 .. 15; DFS_32 at 0 range 16 .. 20; SPI_FRF at 0 range 21 .. 22; Reserved_23_23 at 0 range 23 .. 23; SSTE at 0 range 24 .. 24; Reserved_25_31 at 0 range 25 .. 31; end record; subtype CTRLR1_NDF_Field is HAL.UInt16; -- Master Control register 1 type CTRLR1_Register is record -- Number of data frames NDF : CTRLR1_NDF_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CTRLR1_Register use record NDF at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- SSI Enable type SSIENR_Register is record -- SSI enable SSI_EN : Boolean := False; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for SSIENR_Register use record SSI_EN at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- Microwire Control type MWCR_Register is record -- Microwire transfer mode MWMOD : Boolean := False; -- Microwire control MDD : Boolean := False; -- Microwire handshaking MHS : Boolean := False; -- unspecified Reserved_3_31 : HAL.UInt29 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MWCR_Register use record MWMOD at 0 range 0 .. 0; MDD at 0 range 1 .. 1; MHS at 0 range 2 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; -- Slave enable type SER_Register is record -- For each bit:\n 0 -> slave not selected\n 1 -> slave selected SER : Boolean := False; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for SER_Register use record SER at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; subtype BAUDR_SCKDV_Field is HAL.UInt16; -- Baud rate type BAUDR_Register is record -- SSI clock divider SCKDV : BAUDR_SCKDV_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for BAUDR_Register use record SCKDV at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype TXFTLR_TFT_Field is HAL.UInt8; -- TX FIFO threshold level type TXFTLR_Register is record -- Transmit FIFO threshold TFT : TXFTLR_TFT_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for TXFTLR_Register use record TFT at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype RXFTLR_RFT_Field is HAL.UInt8; -- RX FIFO threshold level type RXFTLR_Register is record -- Receive FIFO threshold RFT : RXFTLR_RFT_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for RXFTLR_Register use record RFT at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype TXFLR_TFTFL_Field is HAL.UInt8; -- TX FIFO level type TXFLR_Register is record -- Read-only. Transmit FIFO level TFTFL : TXFLR_TFTFL_Field; -- unspecified Reserved_8_31 : HAL.UInt24; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for TXFLR_Register use record TFTFL at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype RXFLR_RXTFL_Field is HAL.UInt8; -- RX FIFO level type RXFLR_Register is record -- Read-only. Receive FIFO level RXTFL : RXFLR_RXTFL_Field; -- unspecified Reserved_8_31 : HAL.UInt24; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for RXFLR_Register use record RXTFL at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- Status register type SR_Register is record -- Read-only. SSI busy flag BUSY : Boolean; -- Read-only. Transmit FIFO not full TFNF : Boolean; -- Read-only. Transmit FIFO empty TFE : Boolean; -- Read-only. Receive FIFO not empty RFNE : Boolean; -- Read-only. Receive FIFO full RFF : Boolean; -- Read-only. Transmission error TXE : Boolean; -- Read-only. Data collision error DCOL : Boolean; -- unspecified Reserved_7_31 : HAL.UInt25; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for SR_Register use record BUSY at 0 range 0 .. 0; TFNF at 0 range 1 .. 1; TFE at 0 range 2 .. 2; RFNE at 0 range 3 .. 3; RFF at 0 range 4 .. 4; TXE at 0 range 5 .. 5; DCOL at 0 range 6 .. 6; Reserved_7_31 at 0 range 7 .. 31; end record; -- Interrupt mask type IMR_Register is record -- Transmit FIFO empty interrupt mask TXEIM : Boolean := False; -- Transmit FIFO overflow interrupt mask TXOIM : Boolean := False; -- Receive FIFO underflow interrupt mask RXUIM : Boolean := False; -- Receive FIFO overflow interrupt mask RXOIM : Boolean := False; -- Receive FIFO full interrupt mask RXFIM : Boolean := False; -- Multi-master contention interrupt mask MSTIM : Boolean := False; -- unspecified Reserved_6_31 : HAL.UInt26 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for IMR_Register use record TXEIM at 0 range 0 .. 0; TXOIM at 0 range 1 .. 1; RXUIM at 0 range 2 .. 2; RXOIM at 0 range 3 .. 3; RXFIM at 0 range 4 .. 4; MSTIM at 0 range 5 .. 5; Reserved_6_31 at 0 range 6 .. 31; end record; -- Interrupt status type ISR_Register is record -- Read-only. Transmit FIFO empty interrupt status TXEIS : Boolean; -- Read-only. Transmit FIFO overflow interrupt status TXOIS : Boolean; -- Read-only. Receive FIFO underflow interrupt status RXUIS : Boolean; -- Read-only. Receive FIFO overflow interrupt status RXOIS : Boolean; -- Read-only. Receive FIFO full interrupt status RXFIS : Boolean; -- Read-only. Multi-master contention interrupt status MSTIS : Boolean; -- unspecified Reserved_6_31 : HAL.UInt26; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ISR_Register use record TXEIS at 0 range 0 .. 0; TXOIS at 0 range 1 .. 1; RXUIS at 0 range 2 .. 2; RXOIS at 0 range 3 .. 3; RXFIS at 0 range 4 .. 4; MSTIS at 0 range 5 .. 5; Reserved_6_31 at 0 range 6 .. 31; end record; -- Raw interrupt status type RISR_Register is record -- Read-only. Transmit FIFO empty raw interrupt status TXEIR : Boolean; -- Read-only. Transmit FIFO overflow raw interrupt status TXOIR : Boolean; -- Read-only. Receive FIFO underflow raw interrupt status RXUIR : Boolean; -- Read-only. Receive FIFO overflow raw interrupt status RXOIR : Boolean; -- Read-only. Receive FIFO full raw interrupt status RXFIR : Boolean; -- Read-only. Multi-master contention raw interrupt status MSTIR : Boolean; -- unspecified Reserved_6_31 : HAL.UInt26; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for RISR_Register use record TXEIR at 0 range 0 .. 0; TXOIR at 0 range 1 .. 1; RXUIR at 0 range 2 .. 2; RXOIR at 0 range 3 .. 3; RXFIR at 0 range 4 .. 4; MSTIR at 0 range 5 .. 5; Reserved_6_31 at 0 range 6 .. 31; end record; -- TX FIFO overflow interrupt clear type TXOICR_Register is record -- Read-only. Clear-on-read transmit FIFO overflow interrupt TXOICR : Boolean; -- unspecified Reserved_1_31 : HAL.UInt31; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for TXOICR_Register use record TXOICR at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- RX FIFO overflow interrupt clear type RXOICR_Register is record -- Read-only. Clear-on-read receive FIFO overflow interrupt RXOICR : Boolean; -- unspecified Reserved_1_31 : HAL.UInt31; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for RXOICR_Register use record RXOICR at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- RX FIFO underflow interrupt clear type RXUICR_Register is record -- Read-only. Clear-on-read receive FIFO underflow interrupt RXUICR : Boolean; -- unspecified Reserved_1_31 : HAL.UInt31; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for RXUICR_Register use record RXUICR at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- Multi-master interrupt clear type MSTICR_Register is record -- Read-only. Clear-on-read multi-master contention interrupt MSTICR : Boolean; -- unspecified Reserved_1_31 : HAL.UInt31; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MSTICR_Register use record MSTICR at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- Interrupt clear type ICR_Register is record -- Read-only. Clear-on-read all active interrupts ICR : Boolean; -- unspecified Reserved_1_31 : HAL.UInt31; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ICR_Register use record ICR at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- DMA control type DMACR_Register is record -- Receive DMA enable RDMAE : Boolean := False; -- Transmit DMA enable TDMAE : Boolean := False; -- unspecified Reserved_2_31 : HAL.UInt30 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DMACR_Register use record RDMAE at 0 range 0 .. 0; TDMAE at 0 range 1 .. 1; Reserved_2_31 at 0 range 2 .. 31; end record; subtype DMATDLR_DMATDL_Field is HAL.UInt8; -- DMA TX data level type DMATDLR_Register is record -- Transmit data watermark level DMATDL : DMATDLR_DMATDL_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DMATDLR_Register use record DMATDL at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype DMARDLR_DMARDL_Field is HAL.UInt8; -- DMA RX data level type DMARDLR_Register is record -- Receive data watermark level (DMARDLR+1) DMARDL : DMARDLR_DMARDL_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DMARDLR_Register use record DMARDL at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype RX_SAMPLE_DLY_RSD_Field is HAL.UInt8; -- RX sample delay type RX_SAMPLE_DLY_Register is record -- RXD sample delay (in SCLK cycles) RSD : RX_SAMPLE_DLY_RSD_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for RX_SAMPLE_DLY_Register use record RSD at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- Address and instruction transfer format type SPI_CTRLR0_TRANS_TYPE_Field is (-- Command and address both in standard SPI frame format Val_1C1A, -- Command in standard SPI format, address in format specified by FRF Val_1C2A, -- Command and address both in format specified by FRF (e.g. Dual-SPI) Val_2C2A) with Size => 2; for SPI_CTRLR0_TRANS_TYPE_Field use (Val_1C1A => 0, Val_1C2A => 1, Val_2C2A => 2); subtype SPI_CTRLR0_ADDR_L_Field is HAL.UInt4; -- Instruction length (0/4/8/16b) type SPI_CTRLR0_INST_L_Field is (-- No instruction None, -- 4-bit instruction Val_4B, -- 8-bit instruction Val_8B, -- 16-bit instruction Val_16B) with Size => 2; for SPI_CTRLR0_INST_L_Field use (None => 0, Val_4B => 1, Val_8B => 2, Val_16B => 3); subtype SPI_CTRLR0_WAIT_CYCLES_Field is HAL.UInt5; subtype SPI_CTRLR0_XIP_CMD_Field is HAL.UInt8; -- SPI control type SPI_CTRLR0_Register is record -- Address and instruction transfer format TRANS_TYPE : SPI_CTRLR0_TRANS_TYPE_Field := RP_SVD.XIP_SSI.Val_1C1A; -- Address length (0b-60b in 4b increments) ADDR_L : SPI_CTRLR0_ADDR_L_Field := 16#0#; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- Instruction length (0/4/8/16b) INST_L : SPI_CTRLR0_INST_L_Field := RP_SVD.XIP_SSI.None; -- unspecified Reserved_10_10 : HAL.Bit := 16#0#; -- Wait cycles between control frame transmit and data reception (in -- SCLK cycles) WAIT_CYCLES : SPI_CTRLR0_WAIT_CYCLES_Field := 16#0#; -- SPI DDR transfer enable SPI_DDR_EN : Boolean := False; -- Instruction DDR transfer enable INST_DDR_EN : Boolean := False; -- Read data strobe enable SPI_RXDS_EN : Boolean := False; -- unspecified Reserved_19_23 : HAL.UInt5 := 16#0#; -- SPI Command to send in XIP mode (INST_L = 8-bit) or to append to -- Address (INST_L = 0-bit) XIP_CMD : SPI_CTRLR0_XIP_CMD_Field := 16#3#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for SPI_CTRLR0_Register use record TRANS_TYPE at 0 range 0 .. 1; ADDR_L at 0 range 2 .. 5; Reserved_6_7 at 0 range 6 .. 7; INST_L at 0 range 8 .. 9; Reserved_10_10 at 0 range 10 .. 10; WAIT_CYCLES at 0 range 11 .. 15; SPI_DDR_EN at 0 range 16 .. 16; INST_DDR_EN at 0 range 17 .. 17; SPI_RXDS_EN at 0 range 18 .. 18; Reserved_19_23 at 0 range 19 .. 23; XIP_CMD at 0 range 24 .. 31; end record; subtype TXD_DRIVE_EDGE_TDE_Field is HAL.UInt8; -- TX drive edge type TXD_DRIVE_EDGE_Register is record -- TXD drive edge TDE : TXD_DRIVE_EDGE_TDE_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for TXD_DRIVE_EDGE_Register use record TDE at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- DW_apb_ssi has the following features:\n * APB interface – Allows for -- easy integration into a DesignWare Synthesizable Components for AMBA 2 -- implementation.\n * APB3 and APB4 protocol support.\n * Scalable APB -- data bus width – Supports APB data bus widths of 8, 16, and 32 bits.\n -- * Serial-master or serial-slave operation – Enables serial -- communication with serial-master or serial-slave peripheral devices.\n * -- Programmable Dual/Quad/Octal SPI support in Master Mode.\n * Dual Data -- Rate (DDR) and Read Data Strobe (RDS) Support - Enables the DW_apb_ssi -- master to perform operations with the device in DDR and RDS modes when -- working in Dual/Quad/Octal mode of operation.\n * Data Mask Support - -- Enables the DW_apb_ssi to selectively update the bytes in the device. -- This feature is applicable only in enhanced SPI modes.\n * -- eXecute-In-Place (XIP) support - Enables the DW_apb_ssi master to behave -- as a memory mapped I/O and fetches the data from the device based on the -- APB read request. This feature is applicable only in enhanced SPI -- modes.\n * DMA Controller Interface – Enables the DW_apb_ssi to -- interface to a DMA controller over the bus using a handshaking interface -- for transfer requests.\n * Independent masking of interrupts – Master -- collision, transmit FIFO overflow, transmit FIFO empty, receive FIFO -- full, receive FIFO underflow, and receive FIFO overflow interrupts can -- all be masked independently.\n * Multi-master contention detection – -- Informs the processor of multiple serial-master accesses on the serial -- bus.\n * Bypass of meta-stability flip-flops for synchronous clocks – -- When the APB clock (pclk) and the DW_apb_ssi serial clock (ssi_clk) are -- synchronous, meta-stable flip-flops are not used when transferring -- control signals across these clock domains.\n * Programmable delay on -- the sample time of the received serial data bit (rxd); enables -- programmable control of routing delays resulting in higher serial -- data-bit rates.\n * Programmable features:\n - Serial interface -- operation – Choice of Motorola SPI, Texas Instruments Synchronous -- Serial Protocol or National Semiconductor Microwire.\n - Clock bit-rate -- – Dynamic control of the serial bit rate of the data transfer; used in -- only serial-master mode of operation.\n - Data Item size (4 to 32 bits) -- – Item size of each data transfer under the control of the -- programmer.\n * Configured features:\n - FIFO depth – 16 words deep. -- The FIFO width is fixed at 32 bits.\n - 1 slave select output.\n - -- Hardware slave-select – Dedicated hardware slave-select line.\n - -- Combined interrupt line - one combined interrupt line from the -- DW_apb_ssi to the interrupt controller.\n - Interrupt polarity – -- active high interrupt lines.\n - Serial clock polarity – low -- serial-clock polarity directly after reset.\n - Serial clock phase – -- capture on first edge of serial-clock directly after reset. type XIP_SSI_Peripheral is record -- Control register 0 CTRLR0 : aliased CTRLR0_Register; -- Master Control register 1 CTRLR1 : aliased CTRLR1_Register; -- SSI Enable SSIENR : aliased SSIENR_Register; -- Microwire Control MWCR : aliased MWCR_Register; -- Slave enable SER : aliased SER_Register; -- Baud rate BAUDR : aliased BAUDR_Register; -- TX FIFO threshold level TXFTLR : aliased TXFTLR_Register; -- RX FIFO threshold level RXFTLR : aliased RXFTLR_Register; -- TX FIFO level TXFLR : aliased TXFLR_Register; -- RX FIFO level RXFLR : aliased RXFLR_Register; -- Status register SR : aliased SR_Register; -- Interrupt mask IMR : aliased IMR_Register; -- Interrupt status ISR : aliased ISR_Register; -- Raw interrupt status RISR : aliased RISR_Register; -- TX FIFO overflow interrupt clear TXOICR : aliased TXOICR_Register; -- RX FIFO overflow interrupt clear RXOICR : aliased RXOICR_Register; -- RX FIFO underflow interrupt clear RXUICR : aliased RXUICR_Register; -- Multi-master interrupt clear MSTICR : aliased MSTICR_Register; -- Interrupt clear ICR : aliased ICR_Register; -- DMA control DMACR : aliased DMACR_Register; -- DMA TX data level DMATDLR : aliased DMATDLR_Register; -- DMA RX data level DMARDLR : aliased DMARDLR_Register; -- Identification register IDR : aliased HAL.UInt32; -- Version ID SSI_VERSION_ID : aliased HAL.UInt32; -- Data Register 0 (of 36) DR0 : aliased HAL.UInt32; -- RX sample delay RX_SAMPLE_DLY : aliased RX_SAMPLE_DLY_Register; -- SPI control SPI_CTRLR0 : aliased SPI_CTRLR0_Register; -- TX drive edge TXD_DRIVE_EDGE : aliased TXD_DRIVE_EDGE_Register; end record with Volatile; for XIP_SSI_Peripheral use record CTRLR0 at 16#0# range 0 .. 31; CTRLR1 at 16#4# range 0 .. 31; SSIENR at 16#8# range 0 .. 31; MWCR at 16#C# range 0 .. 31; SER at 16#10# range 0 .. 31; BAUDR at 16#14# range 0 .. 31; TXFTLR at 16#18# range 0 .. 31; RXFTLR at 16#1C# range 0 .. 31; TXFLR at 16#20# range 0 .. 31; RXFLR at 16#24# range 0 .. 31; SR at 16#28# range 0 .. 31; IMR at 16#2C# range 0 .. 31; ISR at 16#30# range 0 .. 31; RISR at 16#34# range 0 .. 31; TXOICR at 16#38# range 0 .. 31; RXOICR at 16#3C# range 0 .. 31; RXUICR at 16#40# range 0 .. 31; MSTICR at 16#44# range 0 .. 31; ICR at 16#48# range 0 .. 31; DMACR at 16#4C# range 0 .. 31; DMATDLR at 16#50# range 0 .. 31; DMARDLR at 16#54# range 0 .. 31; IDR at 16#58# range 0 .. 31; SSI_VERSION_ID at 16#5C# range 0 .. 31; DR0 at 16#60# range 0 .. 31; RX_SAMPLE_DLY at 16#F0# range 0 .. 31; SPI_CTRLR0 at 16#F4# range 0 .. 31; TXD_DRIVE_EDGE at 16#F8# range 0 .. 31; end record; -- DW_apb_ssi has the following features:\n * APB interface – Allows for -- easy integration into a DesignWare Synthesizable Components for AMBA 2 -- implementation.\n * APB3 and APB4 protocol support.\n * Scalable APB -- data bus width – Supports APB data bus widths of 8, 16, and 32 bits.\n -- * Serial-master or serial-slave operation – Enables serial -- communication with serial-master or serial-slave peripheral devices.\n * -- Programmable Dual/Quad/Octal SPI support in Master Mode.\n * Dual Data -- Rate (DDR) and Read Data Strobe (RDS) Support - Enables the DW_apb_ssi -- master to perform operations with the device in DDR and RDS modes when -- working in Dual/Quad/Octal mode of operation.\n * Data Mask Support - -- Enables the DW_apb_ssi to selectively update the bytes in the device. -- This feature is applicable only in enhanced SPI modes.\n * -- eXecute-In-Place (XIP) support - Enables the DW_apb_ssi master to behave -- as a memory mapped I/O and fetches the data from the device based on the -- APB read request. This feature is applicable only in enhanced SPI -- modes.\n * DMA Controller Interface – Enables the DW_apb_ssi to -- interface to a DMA controller over the bus using a handshaking interface -- for transfer requests.\n * Independent masking of interrupts – Master -- collision, transmit FIFO overflow, transmit FIFO empty, receive FIFO -- full, receive FIFO underflow, and receive FIFO overflow interrupts can -- all be masked independently.\n * Multi-master contention detection – -- Informs the processor of multiple serial-master accesses on the serial -- bus.\n * Bypass of meta-stability flip-flops for synchronous clocks – -- When the APB clock (pclk) and the DW_apb_ssi serial clock (ssi_clk) are -- synchronous, meta-stable flip-flops are not used when transferring -- control signals across these clock domains.\n * Programmable delay on -- the sample time of the received serial data bit (rxd); enables -- programmable control of routing delays resulting in higher serial -- data-bit rates.\n * Programmable features:\n - Serial interface -- operation – Choice of Motorola SPI, Texas Instruments Synchronous -- Serial Protocol or National Semiconductor Microwire.\n - Clock bit-rate -- – Dynamic control of the serial bit rate of the data transfer; used in -- only serial-master mode of operation.\n - Data Item size (4 to 32 bits) -- – Item size of each data transfer under the control of the -- programmer.\n * Configured features:\n - FIFO depth – 16 words deep. -- The FIFO width is fixed at 32 bits.\n - 1 slave select output.\n - -- Hardware slave-select – Dedicated hardware slave-select line.\n - -- Combined interrupt line - one combined interrupt line from the -- DW_apb_ssi to the interrupt controller.\n - Interrupt polarity – -- active high interrupt lines.\n - Serial clock polarity – low -- serial-clock polarity directly after reset.\n - Serial clock phase – -- capture on first edge of serial-clock directly after reset. XIP_SSI_Periph : aliased XIP_SSI_Peripheral with Import, Address => XIP_SSI_Base; end RP_SVD.XIP_SSI;
-- NORX_Check_Padding -- Ensure that headers and trailers of different lengths are accepted -- and messages of different lengths correctly decrypted (to check padding) -- Copyright (c) 2016-2018, James Humphry - see LICENSE file for details with Ada.Text_IO; use Ada.Text_IO; with System.Storage_Elements; with Interfaces; use Interfaces; procedure Test_Input_Lengths is use NORX_Package; package Storage_Offset_Text_IO is new Ada.Text_IO.Integer_IO(Num => Storage_Offset); use Storage_Offset_Text_IO; function Generate (G : in out Unsigned_64) return Storage_Element is -- xorshift64 generator from: An experimental exploration of Marsaglia's -- xorshift generators, scrambled Sebastiano Vigna - arXiv 1402.6246v2 M32 : constant := 2685821657736338717; begin G := G xor Shift_Right(G, 12); G := G xor Shift_Left(G, 25); G := G xor Shift_Right(G, 17); return Storage_Element((G * M32) mod Storage_Element'Modulus); end Generate; K : Key_Type; N : Nonce_Type; A, M, Z, C, M2 : Storage_Array(0..Max_Size-1); T : Tag_Type; Valid : Boolean; G : Unsigned_64 := 314_159_265; begin -- Setting up example input data for I in K'Range loop K(I) := Generate(G); end loop; for I in N'Range loop N(I) := Generate(G); end loop; for I in A'Range loop A(I) := Generate(G); M(I) := Generate(G); Z(I) := Generate(G); end loop; -- Testing different header lengths Put("Testing header lengths from 0 .. "); Put(Max_Size, Width=>0); New_Line; for I in Storage_Offset range 0..Max_Size loop AEADEnc(K => K, N => N, A => A(0..I-1), M => M(0..Other_Size-1), Z => Z(0..Other_Size-1), C => C(0..Other_Size-1), T => T); AEADDec(K => K, N => N, A => A(0..I-1), C => C(0..Other_Size-1), Z => Z(0..Other_Size-1), T => T, M => M2(0..Other_Size-1), Valid => Valid); if not Valid then Put("Error: Failed to authenticate decryption with header size:"); Put(I, Width=>0); New_Line; elsif (for some J in Storage_Offset range 0..Other_Size-1 => M(J) /= M2(J)) then Put("Error: Decryption authenticated but message was corrupted " & "for header size:"); Put(I, Width=>0); New_Line; end if; end loop; -- Testing different message lengths Put("Testing message lengths from 0 .. "); Put(Max_Size, Width=>0); New_Line; for I in Storage_Offset range 0..Max_Size loop AEADEnc(K => K, N => N, A => A(0..Other_Size-1), M => M(0..I-1), Z => Z(0..Other_Size-1), C => C(0..I-1), T => T); AEADDec(K => K, N => N, A => A(0..Other_Size-1), C => C(0..I-1), Z => Z(0..Other_Size-1), T => T, M => M2(0..I-1), Valid => Valid); if not Valid then Put("Error: Failed to authenticate decryption with message size:"); Put(I, Width=>0); New_Line; elsif (for some J in Storage_Offset range 0..I-1 => M(J) /= M2(J)) then Put("Error: Decryption authenticated but message was corrupted " & "for message size:"); Put(I, Width=>0); New_Line; end if; end loop; -- Testing different trailer lengths Put("Testing trailer lengths from 0 .. "); Put(Max_Size, Width=>0); New_Line; for I in Storage_Offset range 0..Max_Size loop AEADEnc(K => K, N => N, A => A(0..Other_Size-1), M => M(0..Other_Size-1), Z => Z(0..I-1), C => C(0..Other_Size-1), T => T); AEADDec(K => K, N => N, A => A(0..Other_Size-1), C => C(0..Other_Size-1), Z => Z(0..I-1), T => T, M => M2(0..Other_Size-1), Valid => Valid); if not Valid then Put("Error: Failed to authenticate decryption with trailer size:"); Put(I, Width=>0); New_Line; elsif (for some J in Storage_Offset range 0..Other_Size-1 => M(J) /= M2(J)) then Put("Error: Decryption authenticated but message was corrupted " & "for trailer size:"); Put(I, Width=>0); New_Line; end if; end loop; New_Line; end Test_Input_Lengths;
-- ----------------------------------------------------------------------------- -- Copyright (C) 2003-2019 Stichting Mapcode Foundation (http://www.mapcode.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- ----------------------------------------------------------------------------- with Mapcode_Utils.As_U; use Mapcode_Utils; package Countries is -- The public part of the definition of a territory type Territory_Def is record -- The number, most efficient way to denote the territory Num : String (1 .. 3); -- The ISO 3166 Alpha code Code : As_U.Asu_Us; -- The full name Name : As_U.Asu_Us; end record; -- All the territories supported by Madpcodes Territories_Def : constant array (Positive range <>) of Territory_Def := ( ("000", As_U.Tus ("VAT"), As_U.Tus ("Vatican (Holy See) (_ City State)")), ("001", As_U.Tus ("MCO"), As_U.Tus ("Monaco (Principality of _)")), ("002", As_U.Tus ("GIB"), As_U.Tus ("Gibraltar")), ("003", As_U.Tus ("TKL"), As_U.Tus ("Tokelau")), ("004", As_U.Tus ("CCK"), As_U.Tus ("Cocos Islands (Keeling Islands)")), ("005", As_U.Tus ("BLM"), As_U.Tus ("Saint-Barthelemy (Collectivity of _)")), ("006", As_U.Tus ("NRU"), As_U.Tus ("Nauru (Republic of _)")), ("007", As_U.Tus ("TUV"), As_U.Tus ("Tuvalu")), ("008", As_U.Tus ("MAC"), As_U.Tus ("Macau (Aomen)")), ("009", As_U.Tus ("SXM"), As_U.Tus ("Sint Maarten")), ("010", As_U.Tus ("MAF"), As_U.Tus ("Saint Martin (Collectivity of _)")), ("011", As_U.Tus ("NFK"), As_U.Tus ("Norfolk and Philip Island" & " (Philip Island) (Norfolk Island)")), ("012", As_U.Tus ("PCN"), As_U.Tus ("Pitcairn Islands" & " (Pitcairn, Henderson, Ducie and Oeno Islands)")), ("013", As_U.Tus ("BVT"), As_U.Tus ("Bouvet Island")), ("014", As_U.Tus ("BMU"), As_U.Tus ("Bermuda (Somers Isles)")), ("015", As_U.Tus ("IOT"), As_U.Tus ("British Indian Ocean Territory")), ("016", As_U.Tus ("SMR"), As_U.Tus ("San Marino (Republic of _)")), ("017", As_U.Tus ("GGY"), As_U.Tus ("Guernsey (Bailiwick of _)")), ("018", As_U.Tus ("AIA"), As_U.Tus ("Anguilla")), ("019", As_U.Tus ("MSR"), As_U.Tus ("Montserrat")), ("020", As_U.Tus ("JEY"), As_U.Tus ("Jersey (Bailiwick of _)")), ("021", As_U.Tus ("CXR"), As_U.Tus ("Christmas Island")), ("022", As_U.Tus ("WLF"), As_U.Tus ("Wallis and Futuna" & " (Futuna) (Wallis) (Collectivity of the _ Islands)")), ("023", As_U.Tus ("VGB"), As_U.Tus ("British Virgin Islands (Virgin Islands, British)")), ("024", As_U.Tus ("LIE"), As_U.Tus ("Liechtenstein (Principality of _)")), ("025", As_U.Tus ("ABW"), As_U.Tus ("Aruba")), ("026", As_U.Tus ("MHL"), As_U.Tus ("Marshall Islands (Republic of the _)")), ("027", As_U.Tus ("ASM"), As_U.Tus ("American Samoa (Samoa, American)")), ("028", As_U.Tus ("COK"), As_U.Tus ("Cook Islands")), ("029", As_U.Tus ("SPM"), As_U.Tus ("Saint Pierre and Miquelon" & " (Miquelon) (Saint Pierre) (Collectivity of _)")), ("030", As_U.Tus ("NIU"), As_U.Tus ("Niue")), ("031", As_U.Tus ("KNA"), As_U.Tus ("Saint Kitts and Nevis" & " (Nevis) (Saint Kitts) (Federation of _)")), ("032", As_U.Tus ("CYM"), As_U.Tus ("Cayman islands")), ("033", As_U.Tus ("BES"), As_U.Tus ("Bonaire, St Eustasuis and Saba" & " (Bonaire) (Saba) (St Eustasius)")), ("034", As_U.Tus ("MDV"), As_U.Tus ("Maldives (Republic of _)")), ("035", As_U.Tus ("SHN"), As_U.Tus ("Saint Helena, Ascension and Tristan da Cunha" & " (Saint Helena) (Ascension) (Tristan da Cunha)")), ("036", As_U.Tus ("MLT"), As_U.Tus ("Malta (Republic of _)")), ("037", As_U.Tus ("GRD"), As_U.Tus ("Grenada")), ("038", As_U.Tus ("VIR"), As_U.Tus ("Virgin Islands of the United States" & " (US Virgin Islands) (American Virgin Islands)")), ("039", As_U.Tus ("MYT"), As_U.Tus ("Mayotte (Maore)")), ("040", As_U.Tus ("SJM"), As_U.Tus ("Svalbard and Jan Mayen" & " (Svalbard) (Jan Mayen) (Spitsbergen)")), ("041", As_U.Tus ("VCT"), As_U.Tus ("Saint Vincent and the Grenadines" & " (Saint Vincent) (Grenadines)")), ("042", As_U.Tus ("HMD"), As_U.Tus ("Heard Island and McDonald Islands" & " (Heard Island) (McDonald Islands)")), ("043", As_U.Tus ("BRB"), As_U.Tus ("Barbados")), ("044", As_U.Tus ("ATG"), As_U.Tus ("Antigua and Barbuda (Antigua) (Barbuda)")), ("045", As_U.Tus ("CUW"), As_U.Tus ("Curacao")), ("046", As_U.Tus ("SYC"), As_U.Tus ("Seychelles (Republic of _)")), ("047", As_U.Tus ("PLW"), As_U.Tus ("Palau (Republic of _)")), ("048", As_U.Tus ("MNP"), As_U.Tus ("Northern Mariana Islands (Commonwealth of the _)")), ("049", As_U.Tus ("AND"), As_U.Tus ("Andorra" & " (Principality of _)" & " (Principality of the Valleys of _)")), ("050", As_U.Tus ("GUM"), As_U.Tus ("Guam")), ("051", As_U.Tus ("IMN"), As_U.Tus ("Isle of Mann (Mann)")), ("052", As_U.Tus ("LCA"), As_U.Tus ("Saint Lucia")), ("053", As_U.Tus ("FSM"), As_U.Tus ("Micronesia (Federated States of Micronesia)")), ("054", As_U.Tus ("SGP"), As_U.Tus ("Singapore (Republic of _)")), ("055", As_U.Tus ("TON"), As_U.Tus ("Tonga (Kingdom of _)")), ("056", As_U.Tus ("DMA"), As_U.Tus ("Dominica (Commonwealth of _)")), ("057", As_U.Tus ("BHR"), As_U.Tus ("Bahrain (Kingdom of _)")), ("058", As_U.Tus ("KIR"), As_U.Tus ("Kiribati (Republic of _)")), ("059", As_U.Tus ("TCA"), As_U.Tus ("Turks and Caicos Islands" & " (Turks Islands) (Caicos Islands)")), ("060", As_U.Tus ("STP"), As_U.Tus ("Sao Tome and Principe" & " (Sao Tome) (Principe) (Democratic Republic of _)")), ("061", As_U.Tus ("HKG"), As_U.Tus ("Hong Kong (Xianggang)")), ("062", As_U.Tus ("MTQ"), As_U.Tus ("Martinique")), ("063", As_U.Tus ("FRO"), As_U.Tus ("Faroe Islands")), ("064", As_U.Tus ("GLP"), As_U.Tus ("Guadeloupe")), ("065", As_U.Tus ("COM"), As_U.Tus ("Comoros (Union of the _)")), ("066", As_U.Tus ("MUS"), As_U.Tus ("Mauritius (Republic of _)")), ("067", As_U.Tus ("REU"), As_U.Tus ("Reunion")), ("068", As_U.Tus ("LUX"), As_U.Tus ("Luxembourg (Grand Duchy of _)")), ("069", As_U.Tus ("WSM"), As_U.Tus ("Samoa (Independent State of _)")), ("070", As_U.Tus ("SGS"), As_U.Tus ("South Georgia and the South Sandwich Islands" & " (South Georgia) (South Sandwich Islands)")), ("071", As_U.Tus ("PYF"), As_U.Tus ("French Polynesia (Collectivity of _)")), ("072", As_U.Tus ("CPV"), As_U.Tus ("Cape Verde (Cabo Verde) (Republic of Cabo Verde)")), ("073", As_U.Tus ("TTO"), As_U.Tus ("Trinidad and Tobago" & " (Republic of _) (Trinidad) (Tobago)")), ("074", As_U.Tus ("BRN"), As_U.Tus ("Brunei (Nation of _, the Abode of Peace)")), ("075", As_U.Tus ("ATF"), As_U.Tus ("French Southern and Antarctic Lands")), ("076", As_U.Tus ("PRI"), As_U.Tus ("Puerto Rico (Commonwealth of _)")), ("077", As_U.Tus ("CYP"), As_U.Tus ("Cyprus (Republic of _)")), ("078", As_U.Tus ("LBN"), As_U.Tus ("Lebanon (Lebanese Republic)")), ("079", As_U.Tus ("JAM"), As_U.Tus ("Jamaica")), ("080", As_U.Tus ("GMB"), As_U.Tus ("Gambia (The Gambia) (Republic of the _)")), ("081", As_U.Tus ("QAT"), As_U.Tus ("Qatar (State of _)")), ("082", As_U.Tus ("FLK"), As_U.Tus ("Falkland Islands (The Falklands)")), ("083", As_U.Tus ("VUT"), As_U.Tus ("Vanuatu (Republic of _)")), ("084", As_U.Tus ("MNE"), As_U.Tus ("Montenegro")), ("085", As_U.Tus ("BHS"), As_U.Tus ("Bahamas (Commonwealth of the _)")), ("086", As_U.Tus ("TLS"), As_U.Tus ("Timor-Leste (Democratic Republic of _) (East Timor)")), ("087", As_U.Tus ("SWZ"), As_U.Tus ("Swaziland (Kingdom of _)")), ("088", As_U.Tus ("KWT"), As_U.Tus ("Kuwait (State of _)")), ("089", As_U.Tus ("FJI"), As_U.Tus ("Fiji (Republic of _)")), ("090", As_U.Tus ("NCL"), As_U.Tus ("New Caledonia")), ("091", As_U.Tus ("SVN"), As_U.Tus ("Slovenia (Republic of _)")), ("092", As_U.Tus ("ISR"), As_U.Tus ("Israel (State of _)")), ("093", As_U.Tus ("PSE"), As_U.Tus ("Palestinian territories (State of Palestine)")), ("094", As_U.Tus ("SLV"), As_U.Tus ("El Salvador (Republic of _)")), ("095", As_U.Tus ("BLZ"), As_U.Tus ("Belize")), ("096", As_U.Tus ("DJI"), As_U.Tus ("Djibouti (Republic of _)")), ("097", As_U.Tus ("MKD"), As_U.Tus ("Macedonia" & " (Republic of _) (FYROM)" & " (Former Yugoslav Republic of Macedonia)")), ("098", As_U.Tus ("RWA"), As_U.Tus ("Rwanda (Republic of _)")), ("099", As_U.Tus ("HTI"), As_U.Tus ("Haiti (Republic of _)")), ("100", As_U.Tus ("BDI"), As_U.Tus ("Burundi (Republic of _)")), ("101", As_U.Tus ("GNQ"), As_U.Tus ("Equatorial Guinea (Republic of _)")), ("102", As_U.Tus ("ALB"), As_U.Tus ("Albania (Republic of _)")), ("103", As_U.Tus ("SLB"), As_U.Tus ("Solomon Islands")), ("104", As_U.Tus ("ARM"), As_U.Tus ("Armenia (Republic of _)")), ("105", As_U.Tus ("LSO"), As_U.Tus ("Lesotho (Kingdom of _)")), ("106", As_U.Tus ("BEL"), As_U.Tus ("Belgium (Kingdom of _)")), ("107", As_U.Tus ("MDA"), As_U.Tus ("Moldova (Republic of _)")), ("108", As_U.Tus ("GNB"), As_U.Tus ("Guinea-Bissau (Republic of _)")), ("109", As_U.Tus ("TWN"), As_U.Tus ("Taiwan (Republic of China)")), ("110", As_U.Tus ("BTN"), As_U.Tus ("Bhutan (Kingdom of _)")), ("111", As_U.Tus ("CHE"), As_U.Tus ("Switzerland (Swiss Confederation)")), ("112", As_U.Tus ("NLD"), As_U.Tus ("Netherlands (The Netherlands) (Kingdom of the _)")), ("113", As_U.Tus ("DNK"), As_U.Tus ("Denmark (Kingdom of _)")), ("114", As_U.Tus ("EST"), As_U.Tus ("Estonia (Republic of _)")), ("115", As_U.Tus ("DOM"), As_U.Tus ("Dominican Republic")), ("116", As_U.Tus ("SVK"), As_U.Tus ("Slovakia (Slovak Republic)")), ("117", As_U.Tus ("CRI"), As_U.Tus ("Costa Rica (Republic of _)")), ("118", As_U.Tus ("BIH"), As_U.Tus ("Bosnia and Herzegovina")), ("119", As_U.Tus ("HRV"), As_U.Tus ("Croatia (Republic of _)")), ("120", As_U.Tus ("TGO"), As_U.Tus ("Togo (Togolese Republic)")), ("121", As_U.Tus ("LVA"), As_U.Tus ("Latvia (Republic of _)")), ("122", As_U.Tus ("LTU"), As_U.Tus ("Lithuania (Republic of _)")), ("123", As_U.Tus ("LKA"), As_U.Tus ("Sri Lanka (Democratic Socialist Republic of _)")), ("124", As_U.Tus ("GEO"), As_U.Tus ("Georgia")), ("125", As_U.Tus ("IRL"), As_U.Tus ("Ireland (Republic of _)")), ("126", As_U.Tus ("SLE"), As_U.Tus ("Sierra Leone (Republic of _)")), ("127", As_U.Tus ("PAN"), As_U.Tus ("Panama (Republic of _)")), ("128", As_U.Tus ("CZE"), As_U.Tus ("Czech Republic")), ("129", As_U.Tus ("GUF"), As_U.Tus ("French Guiana (Guiana)")), ("130", As_U.Tus ("ARE"), As_U.Tus ("United Arab Emirates (Emirates)")), ("131", As_U.Tus ("AUT"), As_U.Tus ("Austria (Republic of _)")), ("132", As_U.Tus ("AZE"), As_U.Tus ("Azerbaijan (Republic of _)")), ("133", As_U.Tus ("SRB"), As_U.Tus ("Serbia (Republic of _)")), ("134", As_U.Tus ("JOR"), As_U.Tus ("Jordan (Hashemite Kingdom of _) (Kingdom of _)")), ("135", As_U.Tus ("PRT"), As_U.Tus ("Portugal (Portuguese Republic)")), ("136", As_U.Tus ("HUN"), As_U.Tus ("Hungary (Republic of _)")), ("137", As_U.Tus ("KOR"), As_U.Tus ("South Korea (Republic of Korea) (Korea, South)")), ("138", As_U.Tus ("ISL"), As_U.Tus ("Iceland")), ("139", As_U.Tus ("GTM"), As_U.Tus ("Guatemala (Republic of _)")), ("140", As_U.Tus ("CUB"), As_U.Tus ("Cuba (Republic of _)")), ("141", As_U.Tus ("BGR"), As_U.Tus ("Bulgaria (Republic of _)")), ("142", As_U.Tus ("LBR"), As_U.Tus ("Liberia (Republic of _)")), ("143", As_U.Tus ("HND"), As_U.Tus ("Honduras (Republic of _)")), ("144", As_U.Tus ("BEN"), As_U.Tus ("Benin (Republic of _)")), ("145", As_U.Tus ("ERI"), As_U.Tus ("Eritrea (State of _)")), ("146", As_U.Tus ("MWI"), As_U.Tus ("Malawi (Republic of _)")), ("147", As_U.Tus ("PRK"), As_U.Tus ("North Korea" & " (Democratic People's Republic of Korea)" & " (Korea, North)")), ("148", As_U.Tus ("NIC"), As_U.Tus ("Nicaragua (Republic of _)")), ("149", As_U.Tus ("GRC"), As_U.Tus ("Greece (Hellenic Republic) (Hellas)")), ("150", As_U.Tus ("TJK"), As_U.Tus ("Tajikistan (Republic of _)")), ("151", As_U.Tus ("BGD"), As_U.Tus ("Bangladesh (People's Republic of _)")), ("152", As_U.Tus ("NPL"), As_U.Tus ("Nepal (Federal Democratic Republic of _)")), ("153", As_U.Tus ("TUN"), As_U.Tus ("Tunisia (Tunisian Republic) (Republic of _)")), ("154", As_U.Tus ("SUR"), As_U.Tus ("Suriname (Republic of _)")), ("155", As_U.Tus ("URY"), As_U.Tus ("Uruguay (Eastern Republic of _)")), ("156", As_U.Tus ("KHM"), As_U.Tus ("Cambodia (Kingdom of _)")), ("157", As_U.Tus ("SYR"), As_U.Tus ("Syria (Syrian Arab Republic)")), ("158", As_U.Tus ("SEN"), As_U.Tus ("Senegal (Republic of _)")), ("159", As_U.Tus ("KGZ"), As_U.Tus ("Kyrgyzstan (Kyrgyz Republic)")), ("160", As_U.Tus ("BLR"), As_U.Tus ("Belarus (Republic of _)")), ("161", As_U.Tus ("GUY"), As_U.Tus ("Guyana (Co-operative Republic of _)")), ("162", As_U.Tus ("LAO"), As_U.Tus ("Laos (Lao People's Democratic Republic)")), ("163", As_U.Tus ("ROU"), As_U.Tus ("Romania")), ("164", As_U.Tus ("GHA"), As_U.Tus ("Ghana (Republic of _)")), ("165", As_U.Tus ("UGA"), As_U.Tus ("Uganda (Republic of _)")), ("166", As_U.Tus ("GBR"), As_U.Tus ("United Kingdom" & " (Scotland) (Great Britain) (England)" & " (Northern Ireland) (Ireland, Northern) (Britain)" & " (United Kingdom of Great Britain and Northern" & " Ireland)")), ("167", As_U.Tus ("GIN"), As_U.Tus ("Guinea (Republic of _) (Guinea-Conakry)")), ("168", As_U.Tus ("ECU"), As_U.Tus ("Ecuador (Republic of _)")), ("169", As_U.Tus ("ESH"), As_U.Tus ("Western Sahara (Sahrawi Arab Democratic Republic)")), ("170", As_U.Tus ("GAB"), As_U.Tus ("Gabon (Gabonese Republic)")), ("171", As_U.Tus ("NZL"), As_U.Tus ("New Zealand")), ("172", As_U.Tus ("BFA"), As_U.Tus ("Burkina Faso")), ("173", As_U.Tus ("PHL"), As_U.Tus ("Philippines (Republic of the _)")), ("174", As_U.Tus ("ITA"), As_U.Tus ("Italy (Italian Republic)")), ("175", As_U.Tus ("OMN"), As_U.Tus ("Oman (Sultanate of _)")), ("176", As_U.Tus ("POL"), As_U.Tus ("Poland (Republic of _)")), ("177", As_U.Tus ("CIV"), As_U.Tus ("Ivory Coast" & " (Cote d'Ivoire) (Republic of Cote d'Ivoire)")), ("178", As_U.Tus ("NOR"), As_U.Tus ("Norway (Kingdom of _)")), ("179", As_U.Tus ("MYS"), As_U.Tus ("Malaysia")), ("180", As_U.Tus ("VNM"), As_U.Tus ("Vietnam (Socialist Republic of _)")), ("181", As_U.Tus ("FIN"), As_U.Tus ("Finland (Republic of _)")), ("182", As_U.Tus ("COG"), As_U.Tus ("Congo-Brazzaville" & " (West Congo) (Republic of the Congo)")), ("183", As_U.Tus ("DEU"), As_U.Tus ("Germany (Federal Republic of _)")), ("184", As_U.Tus ("JPN"), As_U.Tus ("Japan")), ("185", As_U.Tus ("ZWE"), As_U.Tus ("Zimbabwe (Republic of _)")), ("186", As_U.Tus ("PRY"), As_U.Tus ("Paraguay (Republic of _)")), ("187", As_U.Tus ("IRQ"), As_U.Tus ("Iraq (Republic of _)")), ("188", As_U.Tus ("MAR"), As_U.Tus ("Morocco (Kingdom of _)")), ("189", As_U.Tus ("UZB"), As_U.Tus ("Uzbekistan (Republic of _)")), ("190", As_U.Tus ("SWE"), As_U.Tus ("Sweden (Kingdom of _)")), ("191", As_U.Tus ("PNG"), As_U.Tus ("Papua New Guinea (Independent State of _)")), ("192", As_U.Tus ("CMR"), As_U.Tus ("Cameroon (Republic of _)")), ("193", As_U.Tus ("TKM"), As_U.Tus ("Turkmenistan")), ("194", As_U.Tus ("ESP"), As_U.Tus ("Spain (Kingdom of _)")), ("195", As_U.Tus ("THA"), As_U.Tus ("Thailand (Kingdom of _)")), ("196", As_U.Tus ("YEM"), As_U.Tus ("Yemen (Republic of _)")), ("197", As_U.Tus ("FRA"), As_U.Tus ("France (French Republic)")), ("198", As_U.Tus ("ALA"), As_U.Tus ("Aaland Islands")), ("199", As_U.Tus ("KEN"), As_U.Tus ("Kenya (Republic of _)")), ("200", As_U.Tus ("BWA"), As_U.Tus ("Botswana (Republic of _)")), ("201", As_U.Tus ("MDG"), As_U.Tus ("Madagascar (Republic of _)")), ("202", As_U.Tus ("UKR"), As_U.Tus ("Ukraine")), ("203", As_U.Tus ("SSD"), As_U.Tus ("South Sudan (Republic of _)")), ("204", As_U.Tus ("CAF"), As_U.Tus ("Central African Republic")), ("205", As_U.Tus ("SOM"), As_U.Tus ("Somalia (Federal Republic of _)")), ("206", As_U.Tus ("AFG"), As_U.Tus ("Afghanistan (Islamic Republic of _)")), ("207", As_U.Tus ("MMR"), As_U.Tus ("Myanmar (Republic of the Union of _) (Burma)")), ("208", As_U.Tus ("ZMB"), As_U.Tus ("Zambia (Republic of _)")), ("209", As_U.Tus ("CHL"), As_U.Tus ("Chile (Republic of _)")), ("210", As_U.Tus ("TUR"), As_U.Tus ("Turkey (Republic of _)")), ("211", As_U.Tus ("PAK"), As_U.Tus ("Pakistan (Islamic Republic of _)")), ("212", As_U.Tus ("MOZ"), As_U.Tus ("Mozambique (Republic of _)")), ("213", As_U.Tus ("NAM"), As_U.Tus ("Namibia (Republic of _)")), ("214", As_U.Tus ("VEN"), As_U.Tus ("Venezuela (Bolivarian Republic of _)")), ("215", As_U.Tus ("NGA"), As_U.Tus ("Nigeria (Federal Republic of _)")), ("216", As_U.Tus ("TZA"), As_U.Tus ("Tanzania (United Republic of _)")), ("217", As_U.Tus ("EGY"), As_U.Tus ("Egypt (Arab Republic of _)")), ("218", As_U.Tus ("MRT"), As_U.Tus ("Mauritania (Islamic Republic of _)")), ("219", As_U.Tus ("BOL"), As_U.Tus ("Bolivia (Plurinational State of _)")), ("220", As_U.Tus ("ETH"), As_U.Tus ("Ethiopia (Federal Democratic Republic of _)")), ("221", As_U.Tus ("COL"), As_U.Tus ("Colombia (Republic of _)")), ("222", As_U.Tus ("ZAF"), As_U.Tus ("South Africa (Republic of _)")), ("223", As_U.Tus ("MLI"), As_U.Tus ("Mali (Republic of _)")), ("224", As_U.Tus ("AGO"), As_U.Tus ("Angola (Republic of _)")), ("225", As_U.Tus ("NER"), As_U.Tus ("Niger (Republic of _)")), ("226", As_U.Tus ("TCD"), As_U.Tus ("Chad (Republic of _)")), ("227", As_U.Tus ("PER"), As_U.Tus ("Peru (Republic of _)")), ("228", As_U.Tus ("MNG"), As_U.Tus ("Mongolia")), ("229", As_U.Tus ("IRN"), As_U.Tus ("Iran (Persia) (Islamic Republic of _)")), ("230", As_U.Tus ("LBY"), As_U.Tus ("Libya")), ("231", As_U.Tus ("SDN"), As_U.Tus ("Sudan (Republic of the _)")), ("232", As_U.Tus ("IDN"), As_U.Tus ("Indonesia (Republic of _)")), ("233", As_U.Tus ("MX-DIF"), As_U.Tus ("Federal District")), ("234", As_U.Tus ("MX-TLA"), As_U.Tus ("Tlaxcala")), ("235", As_U.Tus ("MX-MOR"), As_U.Tus ("Morelos")), ("236", As_U.Tus ("MX-AGU"), As_U.Tus ("Aguascalientes")), ("237", As_U.Tus ("MX-CL"), As_U.Tus ("Colima")), ("238", As_U.Tus ("MX-QUE"), As_U.Tus ("Queretaro")), ("239", As_U.Tus ("MX-HID"), As_U.Tus ("Hidalgo")), ("240", As_U.Tus ("MX-MX"), As_U.Tus ("Mexico State")), ("241", As_U.Tus ("MX-TAB"), As_U.Tus ("Tabasco")), ("242", As_U.Tus ("MX-NAY"), As_U.Tus ("Nayarit")), ("243", As_U.Tus ("MX-GUA"), As_U.Tus ("Guanajuato")), ("244", As_U.Tus ("MX-PUE"), As_U.Tus ("Puebla")), ("245", As_U.Tus ("MX-YUC"), As_U.Tus ("Yucatan")), ("246", As_U.Tus ("MX-ROO"), As_U.Tus ("Quintana Roo")), ("247", As_U.Tus ("MX-SIN"), As_U.Tus ("Sinaloa")), ("248", As_U.Tus ("MX-CAM"), As_U.Tus ("Campeche")), ("249", As_U.Tus ("MX-MIC"), As_U.Tus ("Michoacan")), ("250", As_U.Tus ("MX-SLP"), As_U.Tus ("San Luis Potosi")), ("251", As_U.Tus ("MX-GRO"), As_U.Tus ("Guerrero")), ("252", As_U.Tus ("MX-NLE"), As_U.Tus ("Nuevo Leon (New Leon)")), ("253", As_U.Tus ("MX-BCN"), As_U.Tus ("Baja California")), ("254", As_U.Tus ("MX-VER"), As_U.Tus ("Veracruz")), ("255", As_U.Tus ("MX-CHP"), As_U.Tus ("Chiapas")), ("256", As_U.Tus ("MX-BCS"), As_U.Tus ("Baja California Sur")), ("257", As_U.Tus ("MX-ZAC"), As_U.Tus ("Zacatecas")), ("258", As_U.Tus ("MX-JAL"), As_U.Tus ("Jalisco")), ("259", As_U.Tus ("MX-TAM"), As_U.Tus ("Tamaulipas")), ("260", As_U.Tus ("MX-OAX"), As_U.Tus ("Oaxaca")), ("261", As_U.Tus ("MX-DUR"), As_U.Tus ("Durango")), ("262", As_U.Tus ("MX-COA"), As_U.Tus ("Coahuila")), ("263", As_U.Tus ("MX-SON"), As_U.Tus ("Sonora")), ("264", As_U.Tus ("MX-CHH"), As_U.Tus ("Chihuahua")), ("265", As_U.Tus ("GRL"), As_U.Tus ("Greenland")), ("266", As_U.Tus ("SAU"), As_U.Tus ("Saudi Arabia (Kingdom of _)")), ("267", As_U.Tus ("COD"), As_U.Tus ("Congo-Kinshasa" & " (Democratic Republic of the Congo) (East Congo)")), ("268", As_U.Tus ("DZA"), As_U.Tus ("Algeria (People's Democratic Republic of _)")), ("269", As_U.Tus ("KAZ"), As_U.Tus ("Kazakhstan (Republic of _)")), ("270", As_U.Tus ("ARG"), As_U.Tus ("Argentina (Argentine Republic)")), ("271", As_U.Tus ("IN-DD"), As_U.Tus ("Daman and Diu")), ("272", As_U.Tus ("IN-DN"), As_U.Tus ("Dadra and Nagar Haveli (Dadra) (Nagar Haveli)")), ("273", As_U.Tus ("IN-CH"), As_U.Tus ("Chandigarh")), ("274", As_U.Tus ("IN-AN"), As_U.Tus ("Andaman and Nicobar (Andaman) (Nicobar)")), ("275", As_U.Tus ("IN-LD"), As_U.Tus ("Lakshadweep")), ("276", As_U.Tus ("IN-DL"), As_U.Tus ("Delhi (National Capital Territory of _)")), ("277", As_U.Tus ("IN-ML"), As_U.Tus ("Meghalaya")), ("278", As_U.Tus ("IN-NL"), As_U.Tus ("Nagaland")), ("279", As_U.Tus ("IN-MN"), As_U.Tus ("Manipur")), ("280", As_U.Tus ("IN-TR"), As_U.Tus ("Tripura")), ("281", As_U.Tus ("IN-MZ"), As_U.Tus ("Mizoram")), ("282", As_U.Tus ("IN-SK"), As_U.Tus ("Sikkim")), ("283", As_U.Tus ("IN-PB"), As_U.Tus ("Punjab")), ("284", As_U.Tus ("IN-HR"), As_U.Tus ("Haryana")), ("285", As_U.Tus ("IN-AR"), As_U.Tus ("Arunachal Pradesh")), ("286", As_U.Tus ("IN-AS"), As_U.Tus ("Assam")), ("287", As_U.Tus ("IN-BR"), As_U.Tus ("Bihar")), ("288", As_U.Tus ("IN-UT"), As_U.Tus ("Uttarakhand")), ("289", As_U.Tus ("IN-GA"), As_U.Tus ("Goa")), ("290", As_U.Tus ("IN-KL"), As_U.Tus ("Kerala")), ("291", As_U.Tus ("IN-TN"), As_U.Tus ("Tamil Nadu")), ("292", As_U.Tus ("IN-HP"), As_U.Tus ("Himachal Pradesh")), ("293", As_U.Tus ("IN-JK"), As_U.Tus ("Jammu and Kashmir (Jammu) (Kashmir)")), ("294", As_U.Tus ("IN-CT"), As_U.Tus ("Chhattisgarh")), ("295", As_U.Tus ("IN-JH"), As_U.Tus ("Jharkhand")), ("296", As_U.Tus ("IN-KA"), As_U.Tus ("Karnataka")), ("297", As_U.Tus ("IN-RJ"), As_U.Tus ("Rajasthan")), ("298", As_U.Tus ("IN-OR"), As_U.Tus ("Odisha (Orissa)")), ("299", As_U.Tus ("IN-GJ"), As_U.Tus ("Gujarat")), ("300", As_U.Tus ("IN-WB"), As_U.Tus ("West Bengal")), ("301", As_U.Tus ("IN-MP"), As_U.Tus ("Madhya Pradesh")), ("302", As_U.Tus ("IN-TG"), As_U.Tus ("Telangana")), ("303", As_U.Tus ("IN-AP"), As_U.Tus ("Andhra Pradesh")), ("304", As_U.Tus ("IN-MH"), As_U.Tus ("Maharashtra")), ("305", As_U.Tus ("IN-UP"), As_U.Tus ("Uttar Pradesh")), ("306", As_U.Tus ("IN-PY"), As_U.Tus ("Puducherry")), ("307", As_U.Tus ("AU-NSW"), As_U.Tus ("New South Wales")), ("308", As_U.Tus ("AU-ACT"), As_U.Tus ("Australian Capital Territory")), ("309", As_U.Tus ("AU-JBT"), As_U.Tus ("Jervis Bay Territory")), ("310", As_U.Tus ("AU-NT"), As_U.Tus ("Northern Territory")), ("311", As_U.Tus ("AU-SA"), As_U.Tus ("South Australia")), ("312", As_U.Tus ("AU-TAS"), As_U.Tus ("Tasmania")), ("313", As_U.Tus ("AU-VIC"), As_U.Tus ("Victoria")), ("314", As_U.Tus ("AU-WA"), As_U.Tus ("Western Australia")), ("315", As_U.Tus ("AU-QLD"), As_U.Tus ("Queensland")), ("316", As_U.Tus ("BR-DF"), As_U.Tus ("Distrito Federal")), ("317", As_U.Tus ("BR-SE"), As_U.Tus ("Sergipe")), ("318", As_U.Tus ("BR-AL"), As_U.Tus ("Alagoas")), ("319", As_U.Tus ("BR-RJ"), As_U.Tus ("Rio de Janeiro")), ("320", As_U.Tus ("BR-ES"), As_U.Tus ("Espirito Santo")), ("321", As_U.Tus ("BR-RN"), As_U.Tus ("Rio Grande do Norte")), ("322", As_U.Tus ("BR-PB"), As_U.Tus ("Paraiba")), ("323", As_U.Tus ("BR-SC"), As_U.Tus ("Santa Catarina")), ("324", As_U.Tus ("BR-PE"), As_U.Tus ("Pernambuco")), ("325", As_U.Tus ("BR-AP"), As_U.Tus ("Amapa")), ("326", As_U.Tus ("BR-CE"), As_U.Tus ("Ceara")), ("327", As_U.Tus ("BR-AC"), As_U.Tus ("Acre")), ("328", As_U.Tus ("BR-PR"), As_U.Tus ("Parana")), ("329", As_U.Tus ("BR-RR"), As_U.Tus ("Roraima")), ("330", As_U.Tus ("BR-RO"), As_U.Tus ("Rondonia")), ("331", As_U.Tus ("BR-SP"), As_U.Tus ("Sao Paulo")), ("332", As_U.Tus ("BR-PI"), As_U.Tus ("Piaui")), ("333", As_U.Tus ("BR-TO"), As_U.Tus ("Tocantins")), ("334", As_U.Tus ("BR-RS"), As_U.Tus ("Rio Grande do Sul")), ("335", As_U.Tus ("BR-MA"), As_U.Tus ("Maranhao")), ("336", As_U.Tus ("BR-GO"), As_U.Tus ("Goias")), ("337", As_U.Tus ("BR-MS"), As_U.Tus ("Mato Grosso do Sul")), ("338", As_U.Tus ("BR-BA"), As_U.Tus ("Bahia")), ("339", As_U.Tus ("BR-MG"), As_U.Tus ("Minas Gerais")), ("340", As_U.Tus ("BR-MT"), As_U.Tus ("Mato Grosso")), ("341", As_U.Tus ("BR-PA"), As_U.Tus ("Para")), ("342", As_U.Tus ("BR-AM"), As_U.Tus ("Amazonas")), ("343", As_U.Tus ("US-DC"), As_U.Tus ("District of Columbia (Washington, D.C.)")), ("344", As_U.Tus ("US-RI"), As_U.Tus ("Rhode Island")), ("345", As_U.Tus ("US-DE"), As_U.Tus ("Delaware")), ("346", As_U.Tus ("US-CT"), As_U.Tus ("Connecticut")), ("347", As_U.Tus ("US-NJ"), As_U.Tus ("New Jersey")), ("348", As_U.Tus ("US-NH"), As_U.Tus ("New Hampshire")), ("349", As_U.Tus ("US-VT"), As_U.Tus ("Vermont")), ("350", As_U.Tus ("US-MA"), As_U.Tus ("Massachusetts (Commonwealth of _)")), ("351", As_U.Tus ("US-HI"), As_U.Tus ("Hawaii")), ("352", As_U.Tus ("US-MD"), As_U.Tus ("Maryland")), ("353", As_U.Tus ("US-WV"), As_U.Tus ("West Virginia")), ("354", As_U.Tus ("US-SC"), As_U.Tus ("South Carolina")), ("355", As_U.Tus ("US-ME"), As_U.Tus ("Maine")), ("356", As_U.Tus ("US-IN"), As_U.Tus ("Indiana")), ("357", As_U.Tus ("US-KY"), As_U.Tus ("Kentucky (Commonwealth of _)")), ("358", As_U.Tus ("US-TN"), As_U.Tus ("Tennessee")), ("359", As_U.Tus ("US-VA"), As_U.Tus ("Virginia (Commonwealth of _)")), ("360", As_U.Tus ("US-OH"), As_U.Tus ("Ohio")), ("361", As_U.Tus ("US-PA"), As_U.Tus ("Pennsylvania (Commonwealth of _)")), ("362", As_U.Tus ("US-MS"), As_U.Tus ("Mississippi")), ("363", As_U.Tus ("US-LA"), As_U.Tus ("Louisiana")), ("364", As_U.Tus ("US-AL"), As_U.Tus ("Alabama")), ("365", As_U.Tus ("US-AR"), As_U.Tus ("Arkansas")), ("366", As_U.Tus ("US-NC"), As_U.Tus ("North Carolina")), ("367", As_U.Tus ("US-NY"), As_U.Tus ("New York")), ("368", As_U.Tus ("US-IA"), As_U.Tus ("Iowa")), ("369", As_U.Tus ("US-IL"), As_U.Tus ("Illinois")), ("370", As_U.Tus ("US-GA"), As_U.Tus ("Georgia")), ("371", As_U.Tus ("US-WI"), As_U.Tus ("Wisconsin")), ("372", As_U.Tus ("US-FL"), As_U.Tus ("Florida")), ("373", As_U.Tus ("US-MO"), As_U.Tus ("Missouri")), ("374", As_U.Tus ("US-OK"), As_U.Tus ("Oklahoma")), ("375", As_U.Tus ("US-ND"), As_U.Tus ("North Dakota")), ("376", As_U.Tus ("US-WA"), As_U.Tus ("Washington")), ("377", As_U.Tus ("US-SD"), As_U.Tus ("South Dakota")), ("378", As_U.Tus ("US-NE"), As_U.Tus ("Nebraska")), ("379", As_U.Tus ("US-KS"), As_U.Tus ("Kansas")), ("380", As_U.Tus ("US-ID"), As_U.Tus ("Idaho")), ("381", As_U.Tus ("US-UT"), As_U.Tus ("Utah")), ("382", As_U.Tus ("US-MN"), As_U.Tus ("Minnesota")), ("383", As_U.Tus ("US-MI"), As_U.Tus ("Michigan")), ("384", As_U.Tus ("US-WY"), As_U.Tus ("Wyoming")), ("385", As_U.Tus ("US-OR"), As_U.Tus ("Oregon")), ("386", As_U.Tus ("US-CO"), As_U.Tus ("Colorado")), ("387", As_U.Tus ("US-NV"), As_U.Tus ("Nevada")), ("388", As_U.Tus ("US-AZ"), As_U.Tus ("Arizona")), ("389", As_U.Tus ("US-NM"), As_U.Tus ("New Mexico")), ("390", As_U.Tus ("US-MT"), As_U.Tus ("Montana")), ("391", As_U.Tus ("US-CA"), As_U.Tus ("California")), ("392", As_U.Tus ("US-TX"), As_U.Tus ("Texas")), ("393", As_U.Tus ("US-AK"), As_U.Tus ("Alaska")), ("394", As_U.Tus ("CA-BC"), As_U.Tus ("British Columbia")), ("395", As_U.Tus ("CA-AB"), As_U.Tus ("Alberta")), ("396", As_U.Tus ("CA-ON"), As_U.Tus ("Ontario")), ("397", As_U.Tus ("CA-QC"), As_U.Tus ("Quebec")), ("398", As_U.Tus ("CA-SK"), As_U.Tus ("Saskatchewan")), ("399", As_U.Tus ("CA-MB"), As_U.Tus ("Manitoba")), ("400", As_U.Tus ("CA-NL"), As_U.Tus ("Newfoundland and Labrador (Newfoundland) (Labrador)")), ("401", As_U.Tus ("CA-NB"), As_U.Tus ("New Brunswick")), ("402", As_U.Tus ("CA-NS"), As_U.Tus ("Nova Scotia")), ("403", As_U.Tus ("CA-PE"), As_U.Tus ("Prince Edward Island")), ("404", As_U.Tus ("CA-YT"), As_U.Tus ("Yukon")), ("405", As_U.Tus ("CA-NT"), As_U.Tus ("Northwest Territories")), ("406", As_U.Tus ("CA-NU"), As_U.Tus ("Nunavut")), ("407", As_U.Tus ("IND"), As_U.Tus ("India (Republic of _)")), ("408", As_U.Tus ("AUS"), As_U.Tus ("Australia (Commonwealth of _)")), ("409", As_U.Tus ("BRA"), As_U.Tus ("Brazil (Federative Republic of _)")), ("410", As_U.Tus ("USA"), As_U.Tus ("USA (United States of America) (America)")), ("411", As_U.Tus ("MEX"), As_U.Tus ("Mexico (United Mexican States)")), ("412", As_U.Tus ("RU-MOW"), As_U.Tus ("Moscow")), ("413", As_U.Tus ("RU-SPE"), As_U.Tus ("Saint Petersburg")), ("414", As_U.Tus ("RU-KGD"), As_U.Tus ("Kaliningrad Oblast")), ("415", As_U.Tus ("RU-IN"), As_U.Tus ("Ingushetia")), ("416", As_U.Tus ("RU-AD"), As_U.Tus ("Adygea Republic")), ("417", As_U.Tus ("RU-SE"), As_U.Tus ("North Ossetia-Alania Republic")), ("418", As_U.Tus ("RU-KB"), As_U.Tus ("Kabardino-Balkar Republic")), ("419", As_U.Tus ("RU-KC"), As_U.Tus ("Karachay-Cherkess Republic")), ("420", As_U.Tus ("RU-CE"), As_U.Tus ("Chechen Republic (Chechnya) (Ichkeria)")), ("421", As_U.Tus ("RU-CU"), As_U.Tus ("Chuvash Republic")), ("422", As_U.Tus ("RU-IVA"), As_U.Tus ("Ivanovo Oblast")), ("423", As_U.Tus ("RU-LIP"), As_U.Tus ("Lipetsk Oblast")), ("424", As_U.Tus ("RU-ORL"), As_U.Tus ("Oryol Oblast")), ("425", As_U.Tus ("RU-TUL"), As_U.Tus ("Tula Oblast")), ("426", As_U.Tus ("RU-BE"), As_U.Tus ("Belgorod Oblast")), ("427", As_U.Tus ("RU-VLA"), As_U.Tus ("Vladimir Oblast")), ("428", As_U.Tus ("RU-KRS"), As_U.Tus ("Kursk Oblast")), ("429", As_U.Tus ("RU-KLU"), As_U.Tus ("Kaluga Oblast")), ("430", As_U.Tus ("RU-TT"), As_U.Tus ("Tambov Oblast")), ("431", As_U.Tus ("RU-BRY"), As_U.Tus ("Bryansk Oblast")), ("432", As_U.Tus ("RU-YAR"), As_U.Tus ("Yaroslavl Oblast")), ("433", As_U.Tus ("RU-RYA"), As_U.Tus ("Ryazan Oblast")), ("434", As_U.Tus ("RU-AST"), As_U.Tus ("Astrakhan Oblast")), ("435", As_U.Tus ("RU-MOS"), As_U.Tus ("Moscow Oblast")), ("436", As_U.Tus ("RU-SMO"), As_U.Tus ("Smolensk Oblast")), ("437", As_U.Tus ("RU-DA"), As_U.Tus ("Dagestan Republic")), ("438", As_U.Tus ("RU-VOR"), As_U.Tus ("Voronezh Oblast")), ("439", As_U.Tus ("RU-NGR"), As_U.Tus ("Novgorod Oblast")), ("440", As_U.Tus ("RU-PSK"), As_U.Tus ("Pskov Oblast")), ("441", As_U.Tus ("RU-KOS"), As_U.Tus ("Kostroma Oblast")), ("442", As_U.Tus ("RU-STA"), As_U.Tus ("Stavropol Krai")), ("443", As_U.Tus ("RU-KDA"), As_U.Tus ("Krasnodar Krai")), ("444", As_U.Tus ("RU-KL"), As_U.Tus ("Kalmykia Republic")), ("445", As_U.Tus ("RU-TVE"), As_U.Tus ("Tver Oblast")), ("446", As_U.Tus ("RU-LEN"), As_U.Tus ("Leningrad Oblast")), ("447", As_U.Tus ("RU-ROS"), As_U.Tus ("Rostov Oblast")), ("448", As_U.Tus ("RU-VGG"), As_U.Tus ("Volgograd Oblast")), ("449", As_U.Tus ("RU-VLG"), As_U.Tus ("Vologda Oblast")), ("450", As_U.Tus ("RU-MUR"), As_U.Tus ("Murmansk Oblast")), ("451", As_U.Tus ("RU-KR"), As_U.Tus ("Karelia Republic")), ("452", As_U.Tus ("RU-NEN"), As_U.Tus ("Nenets Autonomous Okrug")), ("453", As_U.Tus ("RU-KO"), As_U.Tus ("Komi Republic")), ("454", As_U.Tus ("RU-ARK"), As_U.Tus ("Arkhangelsk Oblast")), ("455", As_U.Tus ("RU-MO"), As_U.Tus ("Mordovia Republic")), ("456", As_U.Tus ("RU-NIZ"), As_U.Tus ("Nizhny Novgorod Oblast")), ("457", As_U.Tus ("RU-PNZ"), As_U.Tus ("Penza Oblast")), ("458", As_U.Tus ("RU-KI"), As_U.Tus ("Kirov Oblast")), ("459", As_U.Tus ("RU-ME"), As_U.Tus ("Mari El Republic")), ("460", As_U.Tus ("RU-ORE"), As_U.Tus ("Orenburg Oblast")), ("461", As_U.Tus ("RU-ULY"), As_U.Tus ("Ulyanovsk Oblast")), ("462", As_U.Tus ("RU-PM"), As_U.Tus ("Perm Krai")), ("463", As_U.Tus ("RU-BA"), As_U.Tus ("Bashkortostan Republic")), ("464", As_U.Tus ("RU-UD"), As_U.Tus ("Udmurt Republic")), ("465", As_U.Tus ("RU-TA"), As_U.Tus ("Tatarstan Republic")), ("466", As_U.Tus ("RU-SAM"), As_U.Tus ("Samara Oblast")), ("467", As_U.Tus ("RU-SAR"), As_U.Tus ("Saratov Oblast")), ("468", As_U.Tus ("RU-YAN"), As_U.Tus ("Yamalo-Nenets")), ("469", As_U.Tus ("RU-KM"), As_U.Tus ("Khanty-Mansi")), ("470", As_U.Tus ("RU-SVE"), As_U.Tus ("Sverdlovsk Oblast")), ("471", As_U.Tus ("RU-TYU"), As_U.Tus ("Tyumen Oblast")), ("472", As_U.Tus ("RU-KGN"), As_U.Tus ("Kurgan Oblast")), ("473", As_U.Tus ("RU-CH"), As_U.Tus ("Chelyabinsk Oblast")), ("474", As_U.Tus ("RU-BU"), As_U.Tus ("Buryatia Republic")), ("475", As_U.Tus ("RU-ZAB"), As_U.Tus ("Zabaykalsky Krai")), ("476", As_U.Tus ("RU-IRK"), As_U.Tus ("Irkutsk Oblast")), ("477", As_U.Tus ("RU-NVS"), As_U.Tus ("Novosibirsk Oblast")), ("478", As_U.Tus ("RU-TOM"), As_U.Tus ("Tomsk Oblast")), ("479", As_U.Tus ("RU-OMS"), As_U.Tus ("Omsk Oblast")), ("480", As_U.Tus ("RU-KK"), As_U.Tus ("Khakassia Republic")), ("481", As_U.Tus ("RU-KEM"), As_U.Tus ("Kemerovo Oblast")), ("482", As_U.Tus ("RU-AL"), As_U.Tus ("Altai Republic")), ("483", As_U.Tus ("RU-ALT"), As_U.Tus ("Altai Krai")), ("484", As_U.Tus ("RU-TY"), As_U.Tus ("Tuva Republic")), ("485", As_U.Tus ("RU-KYA"), As_U.Tus ("Krasnoyarsk Krai")), ("486", As_U.Tus ("RU-MAG"), As_U.Tus ("Magadan Oblast")), ("487", As_U.Tus ("RU-CHU"), As_U.Tus ("Chukotka Okrug")), ("488", As_U.Tus ("RU-KAM"), As_U.Tus ("Kamchatka Krai")), ("489", As_U.Tus ("RU-SAK"), As_U.Tus ("Sakhalin Oblast")), ("490", As_U.Tus ("RU-PO"), As_U.Tus ("Primorsky Krai")), ("491", As_U.Tus ("RU-YEV"), As_U.Tus ("Jewish Autonomous Oblast")), ("492", As_U.Tus ("RU-KHA"), As_U.Tus ("Khabarovsk Krai")), ("493", As_U.Tus ("RU-AMU"), As_U.Tus ("Amur Oblast")), ("494", As_U.Tus ("RU-SA"), As_U.Tus ("Sakha Republic (Yakutia Republic)")), ("495", As_U.Tus ("CAN"), As_U.Tus ("Canada")), ("496", As_U.Tus ("RUS"), As_U.Tus ("Russia (Russian Federation)")), ("497", As_U.Tus ("CN-SH"), As_U.Tus ("Shanghai Municipality")), ("498", As_U.Tus ("CN-TJ"), As_U.Tus ("Tianjin Municipality")), ("499", As_U.Tus ("CN-BJ"), As_U.Tus ("Beijing Municipality")), ("500", As_U.Tus ("CN-HI"), As_U.Tus ("Hainan Province")), ("501", As_U.Tus ("CN-NX"), As_U.Tus ("Ningxia Hui Autonomous Region")), ("502", As_U.Tus ("CN-CQ"), As_U.Tus ("Chongqing Municipality")), ("503", As_U.Tus ("CN-ZJ"), As_U.Tus ("Zhejiang Province")), ("504", As_U.Tus ("CN-JS"), As_U.Tus ("Jiangsu Province")), ("505", As_U.Tus ("CN-FJ"), As_U.Tus ("Fujian Province")), ("506", As_U.Tus ("CN-AH"), As_U.Tus ("Anhui Province")), ("507", As_U.Tus ("CN-LN"), As_U.Tus ("Liaoning Province")), ("508", As_U.Tus ("CN-SD"), As_U.Tus ("Shandong Province")), ("509", As_U.Tus ("CN-SX"), As_U.Tus ("Shanxi Province")), ("510", As_U.Tus ("CN-JX"), As_U.Tus ("Jiangxi Province")), ("511", As_U.Tus ("CN-HA"), As_U.Tus ("Henan Province")), ("512", As_U.Tus ("CN-GZ"), As_U.Tus ("Guizhou Province")), ("513", As_U.Tus ("CN-GD"), As_U.Tus ("Guangdong Province")), ("514", As_U.Tus ("CN-HB"), As_U.Tus ("Hubei Province")), ("515", As_U.Tus ("CN-JL"), As_U.Tus ("Jilin Province")), ("516", As_U.Tus ("CN-HE"), As_U.Tus ("Hebei Province (Yanzhao Province)")), ("517", As_U.Tus ("CN-SN"), As_U.Tus ("Shaanxi Province")), ("518", As_U.Tus ("CN-NM"), As_U.Tus ("Nei Mongol Autonomous Region (Inner Mongolia)")), ("519", As_U.Tus ("CN-HL"), As_U.Tus ("Heilongjiang Province")), ("520", As_U.Tus ("CN-HN"), As_U.Tus ("Hunan Province")), ("521", As_U.Tus ("CN-GX"), As_U.Tus ("Guangxi Zhuang Autonomous Region")), ("522", As_U.Tus ("CN-SC"), As_U.Tus ("Sichuan Province")), ("523", As_U.Tus ("CN-YN"), As_U.Tus ("Yunnan Province")), ("524", As_U.Tus ("CN-XZ"), As_U.Tus ("Xizang Autonomous Region (Tibet)")), ("525", As_U.Tus ("CN-GS"), As_U.Tus ("Gansu Province")), ("526", As_U.Tus ("CN-QH"), As_U.Tus ("Qinghai Province (Tsinghai Province)")), ("527", As_U.Tus ("CN-XJ"), As_U.Tus ("Xinjiang Uyghur Autonomous Region")), ("528", As_U.Tus ("CHN"), As_U.Tus ("China (People's Republic of _)")), ("529", As_U.Tus ("UMI"), As_U.Tus ("United States Minor Outlying Islands")), ("530", As_U.Tus ("CPT"), As_U.Tus ("Clipperton Island")), ("531", As_U.Tus ("ATA"), As_U.Tus ("Antarctica")), ("532", As_U.Tus ("AAA"), As_U.Tus ("International (Worldwide) (Earth)")) ); end Countries;
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- ADA.CONTAINERS.FUNCTIONAL_VECTORS -- -- -- -- B o d y -- -- -- -- Copyright (C) 2016-2021, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- ------------------------------------------------------------------------------ pragma Ada_2012; package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is use Containers; --------- -- "<" -- --------- function "<" (Left : Sequence; Right : Sequence) return Boolean is (Length (Left.Content) < Length (Right.Content) and then (for all I in Index_Type'First .. Last (Left) => Get (Left.Content, I) = Get (Right.Content, I))); ---------- -- "<=" -- ---------- function "<=" (Left : Sequence; Right : Sequence) return Boolean is (Length (Left.Content) <= Length (Right.Content) and then (for all I in Index_Type'First .. Last (Left) => Get (Left.Content, I) = Get (Right.Content, I))); --------- -- "=" -- --------- function "=" (Left : Sequence; Right : Sequence) return Boolean is (Left.Content = Right.Content); --------- -- Add -- --------- function Add (Container : Sequence; New_Item : Element_Type) return Sequence is (Content => Add (Container.Content, Index_Type'Val (Index_Type'Pos (Index_Type'First) + Length (Container.Content)), New_Item)); function Add (Container : Sequence; Position : Index_Type; New_Item : Element_Type) return Sequence is (Content => Add (Container.Content, Position, New_Item)); -------------------- -- Constant_Range -- -------------------- function Constant_Range (Container : Sequence; Fst : Index_Type; Lst : Extended_Index; Item : Element_Type) return Boolean is begin for I in Fst .. Lst loop if Get (Container.Content, I) /= Item then return False; end if; end loop; return True; end Constant_Range; -------------- -- Contains -- -------------- function Contains (Container : Sequence; Fst : Index_Type; Lst : Extended_Index; Item : Element_Type) return Boolean is begin for I in Fst .. Lst loop if Get (Container.Content, I) = Item then return True; end if; end loop; return False; end Contains; ------------------ -- Equal_Except -- ------------------ function Equal_Except (Left : Sequence; Right : Sequence; Position : Index_Type) return Boolean is begin if Length (Left.Content) /= Length (Right.Content) then return False; end if; for I in Index_Type'First .. Last (Left) loop if I /= Position and then Get (Left.Content, I) /= Get (Right.Content, I) then return False; end if; end loop; return True; end Equal_Except; function Equal_Except (Left : Sequence; Right : Sequence; X : Index_Type; Y : Index_Type) return Boolean is begin if Length (Left.Content) /= Length (Right.Content) then return False; end if; for I in Index_Type'First .. Last (Left) loop if I /= X and then I /= Y and then Get (Left.Content, I) /= Get (Right.Content, I) then return False; end if; end loop; return True; end Equal_Except; --------- -- Get -- --------- function Get (Container : Sequence; Position : Extended_Index) return Element_Type is (Get (Container.Content, Position)); ---------- -- Last -- ---------- function Last (Container : Sequence) return Extended_Index is (Index_Type'Val ((Index_Type'Pos (Index_Type'First) - 1) + Length (Container))); ------------ -- Length -- ------------ function Length (Container : Sequence) return Count_Type is (Length (Container.Content)); ----------------- -- Range_Equal -- ----------------- function Range_Equal (Left : Sequence; Right : Sequence; Fst : Index_Type; Lst : Extended_Index) return Boolean is begin for I in Fst .. Lst loop if Get (Left, I) /= Get (Right, I) then return False; end if; end loop; return True; end Range_Equal; ------------------- -- Range_Shifted -- ------------------- function Range_Shifted (Left : Sequence; Right : Sequence; Fst : Index_Type; Lst : Extended_Index; Offset : Count_Type'Base) return Boolean is begin for I in Fst .. Lst loop if Get (Left, I) /= Get (Right, Index_Type'Val (Index_Type'Pos (I) + Offset)) then return False; end if; end loop; return True; end Range_Shifted; ------------ -- Remove -- ------------ function Remove (Container : Sequence; Position : Index_Type) return Sequence is (Content => Remove (Container.Content, Position)); --------- -- Set -- --------- function Set (Container : Sequence; Position : Index_Type; New_Item : Element_Type) return Sequence is (Content => Set (Container.Content, Position, New_Item)); end Ada.Containers.Functional_Vectors;
-- SPDX-FileCopyrightText: 2019-2021 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Defining_Identifiers; with Program.Elements.Defining_Names; with Program.Elements.Defining_Operator_Symbols; with Program.Elements.Function_Declarations; with Program.Elements.Identifiers; with Program.Elements.Parameter_Specifications; with Program.Symbols; package body Program.Predefined_Operators is package E renames Program.Elements; procedure Create_Operator (Self : in out Program.Visibility.Context'Class; Symbol : Program.Symbols.Symbol; Type_View : Program.Visibility.View; Setter : not null Program.Cross_Reference_Updaters.Cross_Reference_Updater_Access; Factory : Program.Implicit_Element_Factories.Element_Factory; Vectors : Program.Element_Vector_Factories.Element_Vector_Factory; Decl : out E.Function_Declarations.Function_Declaration_Access); --------------------- -- Create_Operator -- --------------------- procedure Create_Operator (Self : in out Program.Visibility.Context'Class; Symbol : Program.Symbols.Symbol; Type_View : Program.Visibility.View; Setter : not null Program.Cross_Reference_Updaters.Cross_Reference_Updater_Access; Factory : Program.Implicit_Element_Factories.Element_Factory; Vectors : Program.Element_Vector_Factories.Element_Vector_Factory; Decl : out E.Function_Declarations.Function_Declaration_Access) is procedure New_Parameter (Spec : out E.Parameter_Specifications.Parameter_Specification_Access); ------------------- -- New_Parameter -- ------------------- procedure New_Parameter (Spec : out E.Parameter_Specifications.Parameter_Specification_Access) is Type_Name : constant E.Defining_Names.Defining_Name_Access := Program.Visibility.Name (Type_View); Vector : E.Defining_Identifiers.Defining_Identifier_Vector_Access; Tipe_Id : constant E.Identifiers.Identifier_Access := Factory.Create_Identifier (Is_Part_Of_Implicit => True); Id : constant E.Defining_Identifiers.Defining_Identifier_Access := Factory.Create_Defining_Identifier (Is_Part_Of_Implicit => True); begin Setter.Set_Corresponding_Defining_Name (E.Element_Access (Tipe_Id), Type_Name); Vector := Vectors.Create_Defining_Identifier_Vector (Program.Element_Vectors.Single_Element (E.Element_Access (Id))); Spec := Factory.Create_Parameter_Specification (Names => Vector, Parameter_Subtype => E.Element_Access (Tipe_Id), Default_Expression => null, Is_Part_Of_Implicit => True); Self.Create_Parameter (Symbol => Program.Symbols.Left, Name => Id.all'Access, Mode => Program.Visibility.In_Mode, Has_Default => False); Self.Leave_Declarative_Region; Self.Set_Object_Type (Type_View); end New_Parameter; Type_Name : constant E.Defining_Names.Defining_Name_Access := Program.Visibility.Name (Type_View); Tipe : constant E.Identifiers.Identifier_Access := Factory.Create_Identifier (Is_Part_Of_Implicit => True); Name : constant E.Defining_Operator_Symbols .Defining_Operator_Symbol_Access := Factory.Create_Defining_Operator_Symbol (Is_Part_Of_Implicit => True); Left : E.Parameter_Specifications.Parameter_Specification_Access; Right : E.Parameter_Specifications.Parameter_Specification_Access; List : E.Parameter_Specifications.Parameter_Specification_Vector_Access; begin Self.Create_Function (Symbol, Name.all'Access); New_Parameter (Left); New_Parameter (Right); Self.Set_Result_Type (Type_View); Self.Leave_Declarative_Region; List := Vectors.Create_Parameter_Specification_Vector (Program.Element_Vectors.Two_Elements (E.Element_Access (Left), E.Element_Access (Right))); Setter.Set_Corresponding_Defining_Name (E.Element_Access (Tipe), Type_Name); Decl := Factory.Create_Function_Declaration (Name => Name.all'Access, Parameters => List, Result_Subtype => E.Element_Access (Tipe), Result_Expression => null, Aspects => null, Is_Part_Of_Implicit => True); end Create_Operator; -------------------------------- -- Create_Operators_For_Array -- -------------------------------- procedure Create_Operators_For_Array (Self : in out Program.Visibility.Context'Class; Type_View : Program.Visibility.View; Setter : not null Program.Cross_Reference_Updaters.Cross_Reference_Updater_Access; Factory : Program.Implicit_Element_Factories.Element_Factory; Vectors : Program.Element_Vector_Factories.Element_Vector_Factory; Result : out Program.Element_Vectors.Element_Vector_Access) is Indexes : constant Program.Visibility.View_Array := Program.Visibility.Indexes (Type_View); Ampersand : E.Function_Declarations.Function_Declaration_Access; begin if Indexes'Length /= 1 then -- FIXME: Check nonlimited return; end if; Create_Operator (Self, Symbol => Program.Symbols.Ampersand_Symbol, Type_View => Type_View, Setter => Setter, Factory => Factory, Vectors => Vectors, Decl => Ampersand); Result := Vectors.Create_Element_Vector (Program.Element_Vectors.Single_Element (E.Element_Access (Ampersand))); end Create_Operators_For_Array; ---------------------------------- -- Create_Operators_For_Integer -- ---------------------------------- procedure Create_Operators_For_Integer (Self : in out Program.Visibility.Context'Class; Type_View : Program.Visibility.View; Setter : not null Program.Cross_Reference_Updaters.Cross_Reference_Updater_Access; Factory : Program.Implicit_Element_Factories.Element_Factory; Vectors : Program.Element_Vector_Factories.Element_Vector_Factory; Result : out Program.Element_Vectors.Element_Vector_Access) is Hyphen : E.Function_Declarations.Function_Declaration_Access; begin Create_Operator (Self, Symbol => Program.Symbols.Hyphen_Symbol, Type_View => Type_View, Setter => Setter, Factory => Factory, Vectors => Vectors, Decl => Hyphen); Result := Vectors.Create_Element_Vector (Program.Element_Vectors.Single_Element (E.Element_Access (Hyphen))); end Create_Operators_For_Integer; end Program.Predefined_Operators;
with Interfaces.C.Strings; with Sensors.LibSensors.Sensors_Sensors_H; private package Sensors.Conversions is function Convert_Up (Source : Sensors.LibSensors.Sensors_Sensors_H.Sensors_Bus_Id) return Bus_Id; function Convert_Up (Source : Sensors.LibSensors.Sensors_Sensors_H.Sensors_Chip_Name) return Chip_Name; function Convert_Up (Source : Sensors.LibSensors.Sensors_Sensors_H.Sensors_Feature_Type)return Feature_Type; function Convert_Up (Source : Sensors.LibSensors.Sensors_Sensors_H.Sensors_Feature)return Feature; function Convert_Up (Source : Interfaces.C.Short) return Natural; function Convert_Up (Source : Interfaces.C.Int) return Natural; function Convert_Up (Source : Interfaces.C.Strings.Chars_Ptr)return Ada.Strings.Unbounded.Unbounded_String; function Convert_Down (Source : Bus_Id) return Sensors.LibSensors.Sensors_Sensors_H.Sensors_Bus_Id; function Convert_Down (Source : Chip_Name) return Sensors.LibSensors.Sensors_Sensors_H.Sensors_Chip_Name; function Convert_Down (Source : Feature_Type)return Sensors.LibSensors.Sensors_Sensors_H.Sensors_Feature_Type; function Convert_Down (Source : Feature)return Sensors.LibSensors.Sensors_Sensors_H.Sensors_Feature; function Convert_Down (Source : Natural) return Interfaces.C.Short; function Convert_Down (Source : Natural) return Interfaces.C.Int; function Convert_Down (Source : Ada.Strings.Unbounded.Unbounded_String)return Interfaces.C.Strings.Chars_Ptr; end Sensors.Conversions;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Strings; limited with Matreshka.DOM_Documents; limited with Matreshka.DOM_Elements; with XML.DOM.Documents; with XML.DOM.Nodes; with XML.DOM.Visitors; package Matreshka.DOM_Nodes is pragma Preelaborate; type Node is tagged; type Node_Access is access all Node'Class; type Document_Access is access all Matreshka.DOM_Documents.Document_Node'Class; type Element_Access is access all Matreshka.DOM_Elements.Abstract_Element_Node'Class; type Node is abstract limited new XML.DOM.Nodes.DOM_Node with record Document : Document_Access; Parent : Node_Access; First : Node_Access; Last : Node_Access; Previous : Node_Access; Next : Node_Access; -- Previous and next nodes in the doubly linked list of nodes. Each -- node, except document node, is member of one of three lists: -- - parent's list of children nodes; -- - element's list of attribute nodes; -- - document's list of detached nodes. end record; not overriding procedure Enter_Node (Self : not null access Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is abstract; -- Dispatch call to corresponding subprogram of visitor interface. not overriding procedure Leave_Node (Self : not null access Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is abstract; -- Dispatch call to corresponding subprogram of visitor interface. not overriding procedure Visit_Node (Self : not null access Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is abstract; -- Dispatch call to corresponding subprogram of iterator interface. procedure Check_Wrong_Document (Self : not null access Node'Class; Node : not null access XML.DOM.Nodes.DOM_Node'Class); -- Checks whether both nodes belongs to the same document and raise -- Wrong_Document_Error otherwise. procedure Raise_Index_Size_Error (Self : not null access Node'Class) with Inline => True, No_Return => True; procedure Raise_DOMString_Size_Error (Self : not null access Node'Class) with Inline => True, No_Return => True; procedure Raise_Hierarchy_Request_Error (Self : not null access Node'Class) with Inline => True, No_Return => True; procedure Raise_Wrong_Document_Error (Self : not null access Node'Class) with Inline => True, No_Return => True; procedure Raise_Invalid_Character_Error (Self : not null access Node'Class) with Inline => True, No_Return => True; procedure Raise_No_Data_Allowed_Error (Self : not null access Node'Class) with Inline => True, No_Return => True; procedure Raise_No_Modification_Allowed_Error (Self : not null access Node'Class) with Inline => True, No_Return => True; procedure Raise_Not_Found_Error (Self : not null access Node'Class) with Inline => True, No_Return => True; procedure Raise_Not_Supported_Error (Self : not null access Node'Class) with Inline => True, No_Return => True; procedure Raise_Inuse_Attribute_Error (Self : not null access Node'Class) with Inline => True, No_Return => True; procedure Raise_Invalid_State_Error (Self : not null access Node'Class) with Inline => True, No_Return => True; procedure Raise_Syntax_Error (Self : not null access Node'Class) with Inline => True, No_Return => True; procedure Raise_Invalid_Modification_Error (Self : not null access Node'Class) with Inline => True, No_Return => True; procedure Raise_Namespace_Error (Self : not null access Node'Class) with Inline => True, No_Return => True; procedure Raise_Invalid_Access_Error (Self : not null access Node'Class) with Inline => True, No_Return => True; procedure Raise_Validation_Error (Self : not null access Node'Class) with Inline => True, No_Return => True; procedure Raise_Type_Mismatch_Error (Self : not null access Node'Class) with Inline => True, No_Return => True; overriding function Append_Child (Self : not null access Node; New_Child : not null XML.DOM.Nodes.DOM_Node_Access) return not null XML.DOM.Nodes.DOM_Node_Access; -- Generic implementation of appending child node. Specialized nodes must -- override it to add required checks. overriding function Get_First_Child (Self : not null access constant Node) return XML.DOM.Nodes.DOM_Node_Access; overriding function Get_Last_Child (Self : not null access constant Node) return XML.DOM.Nodes.DOM_Node_Access; overriding function Get_Local_Name (Self : not null access constant Node) return League.Strings.Universal_String; overriding function Get_Namespace_URI (Self : not null access constant Node) return League.Strings.Universal_String; overriding function Get_Next_Sibling (Self : not null access constant Node) return XML.DOM.Nodes.DOM_Node_Access; overriding function Get_Node_Value (Self : not null access constant Node) return League.Strings.Universal_String; overriding function Get_Owner_Document (Self : not null access constant Node) return XML.DOM.Documents.DOM_Document_Access; overriding function Get_Parent_Node (Self : not null access constant Node) return XML.DOM.Nodes.DOM_Node_Access; overriding function Get_Previous_Sibling (Self : not null access constant Node) return XML.DOM.Nodes.DOM_Node_Access; overriding function Remove_Child (Self : not null access Node; Old_Child : not null XML.DOM.Nodes.DOM_Node_Access) return not null XML.DOM.Nodes.DOM_Node_Access; overriding procedure Set_Node_Value (Self : not null access Node; New_Value : League.Strings.Universal_String); package Constructors is procedure Initialize (Self : not null access Node'Class; Document : not null Document_Access); end Constructors; end Matreshka.DOM_Nodes;
with Interfaces; with GL.Types; with Blade; with Blade_Types; with E3GA; with GA_Maths; with Metric; with Multivectors; with Multivector_Type; package GA_Utilities is use GA_Maths.Float_Array_Package; function Multivector_Size (MV : Multivectors.Multivector) return Integer; procedure Print_Bitmap (Name : String; Bitmap : Interfaces.Unsigned_32); procedure Print_Blade (Name : String; B : Blade.Basis_Blade); procedure Print_Blade_List (Name : String; BL : Blade.Blade_List); procedure Print_Blade_String (Name : String; B : Blade.Basis_Blade; MV_Names : Blade_Types.Basis_Vector_Names); procedure Print_Blade_String_Array (Name : String; BB_Array : Blade.Basis_Blade_Array; MV_Names : Blade_Types.Basis_Vector_Names); procedure Print_E3_Vector (Name : String; aVector : E3GA.E3_Vector); procedure Print_E3_Vector_Array (Name : String; anArray : GL.Types.Singles.Vector3_Array); procedure Print_Float_3D (Name : String; aVector : GA_Maths.Float_3D); procedure Print_Float_Array (Name : String; anArray : GA_Maths.Float_Vector); procedure Print_Integer_Array (Name : String; anArray : GA_Maths.Integer_Array); procedure Print_Matrix (Name : String; aMatrix : GA_Maths.GA_Matrix3); procedure Print_Matrix (Name : String; aMatrix : Real_Matrix); procedure Print_Matrix (Name : String; aMatrix : Real_Matrix; Start, Last : GA_Maths.Array_I2); procedure Print_Metric (Name : String; aMetric : Metric.Metric_Record); procedure Print_Multivector (Name : String; MV : Multivectors.Multivector); procedure Print_Multivector_Info (Name : String; Info : Multivector_Type.MV_Type_Record); procedure Print_Multivector_List (Name : String; MV_List : Multivectors.Multivector_List); procedure Print_Multivector_List_String (Name : String; MV_List : Multivectors.Multivector_List; MV_Names : Blade_Types.Basis_Vector_Names); procedure Print_Multivector_String (Name : String; MV : Multivectors.Multivector; MV_Names : Blade_Types.Basis_Vector_Names); procedure Print_Vertex (Name : String; Vertex : Multivectors.M_Vector); end GA_Utilities;
with DICTIONARY_PACKAGE; use DICTIONARY_PACKAGE; package TRICKS_PACKAGE is procedure SYNCOPE(W : STRING; PA : in out PARSE_ARRAY; PA_LAST : in out INTEGER); procedure TRY_TRICKS(W : STRING; PA : in out PARSE_ARRAY; PA_LAST : in out INTEGER; LINE_NUMBER : INTEGER; WORD_NUMBER : INTEGER); procedure TRY_SLURY(W : STRING; PA : in out PARSE_ARRAY; PA_LAST : in out INTEGER; LINE_NUMBER : INTEGER; WORD_NUMBER : INTEGER); procedure ROMAN_NUMERALS(INPUT_WORD : STRING; PA : in out PARSE_ARRAY; PA_LAST : in out INTEGER); end TRICKS_PACKAGE;
package ordinary_type_declaration_range_constraint is type Ordinary_Type is range 1..10; end ordinary_type_declaration_range_constraint;
package body agar.gui.widget.checkbox is package cbinds is function allocate (parent : widget_access_t; flags : flags_t; label : cs.chars_ptr) return checkbox_access_t; pragma import (c, allocate, "AG_CheckboxNewS"); function allocate_function (parent : widget_access_t; flags : flags_t; label : cs.chars_ptr; func : agar.core.event.callback_t; fmt : agar.core.types.void_ptr_t) return checkbox_access_t; pragma import (c, allocate_function, "AG_CheckboxNewFn"); function allocate_integer (parent : widget_access_t; flags : flags_t; label : cs.chars_ptr; ptr : access c.int) return checkbox_access_t; pragma import (c, allocate_integer, "AG_CheckboxNewInt"); function allocate_flags (parent : widget_access_t; flags : flags_t; label : cs.chars_ptr; ptr : access c.unsigned; mask : c.unsigned) return checkbox_access_t; pragma import (c, allocate_flags, "AG_CheckboxNewFlag"); function allocate_flags32 (parent : widget_access_t; flags : flags_t; label : cs.chars_ptr; ptr : access agar.core.types.uint32_t; mask : agar.core.types.uint32_t) return checkbox_access_t; pragma import (c, allocate_flags32, "AG_CheckboxNewFlag32"); end cbinds; -- function allocate (parent : widget_access_t; flags : flags_t; label : string) return checkbox_access_t is ca_label : aliased c.char_array := c.to_c (label); begin return cbinds.allocate (parent => parent, flags => flags, label => cs.to_chars_ptr (ca_label'unchecked_access)); end allocate; function allocate_function (parent : widget_access_t; flags : flags_t; label : string; func : agar.core.event.callback_t) return checkbox_access_t is ca_label : aliased c.char_array := c.to_c (label); begin return cbinds.allocate_function (parent => parent, flags => flags, label => cs.to_chars_ptr (ca_label'unchecked_access), func => func, fmt => agar.core.types.null_ptr); end allocate_function; function allocate_integer (parent : widget_access_t; flags : flags_t; label : string; ptr : access c.int) return checkbox_access_t is ca_label : aliased c.char_array := c.to_c (label); begin return cbinds.allocate_integer (parent => parent, flags => flags, label => cs.to_chars_ptr (ca_label'unchecked_access), ptr => ptr); end allocate_integer; function allocate_flags (parent : widget_access_t; flags : flags_t; label : string; ptr : access c.unsigned; mask : c.unsigned) return checkbox_access_t is ca_label : aliased c.char_array := c.to_c (label); begin return cbinds.allocate_flags (parent => parent, flags => flags, label => cs.to_chars_ptr (ca_label'unchecked_access), ptr => ptr, mask => mask); end allocate_flags; function allocate_flags32 (parent : widget_access_t; flags : flags_t; label : string; ptr : access agar.core.types.uint32_t; mask : agar.core.types.uint32_t) return checkbox_access_t is ca_label : aliased c.char_array := c.to_c (label); begin return cbinds.allocate_flags32 (parent => parent, flags => flags, label => cs.to_chars_ptr (ca_label'unchecked_access), ptr => ptr, mask => mask); end allocate_flags32; function widget (checkbox : checkbox_access_t) return widget_access_t is begin return checkbox.widget'access; end widget; end agar.gui.widget.checkbox;
with Timer_Callback; use Timer_Callback; with Giza.Window; use Giza; with Screen_Interface; use Screen_Interface; with Giza.GUI; use Giza.GUI; -- with Hershey_Fonts.Rowmand; with Giza.Bitmap_Fonts.FreeMono8pt7b; with Test_Main_Window; use Test_Main_Window; procedure Giza_Test_Gtk is Main_W : constant Main_Window_Ref := new Main_Window; Enable_Backend : constant Boolean := True; begin if Enable_Backend then Screen_Interface.Initialize; else Timer_Callback.My_Backend.Disable; end if; My_Context.Set_Font (Giza.Bitmap_Fonts.FreeMono8pt7b.Font); Giza.GUI.Set_Context (Timer_Callback.My_Context'Access); Giza.GUI.Set_Backend (Timer_Callback.My_Backend'Access); Push (Window.Ref (Main_W)); Event_Loop; end Giza_Test_Gtk;
-- Standard Ada library specification -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual --------------------------------------------------------------------------- with Ada.Iterator_Interfaces; generic type Element_Type (<>) is private; with function "=" (Left, Right : Element_Type) return Boolean is <>; package Ada.Containers.Indefinite_Multiway_Trees is pragma Preelaborate(Indefinite_Multiway_Trees); pragma Remote_Types(Indefinite_Multiway_Trees); type Tree is tagged private with Constant_Indexing => Constant_Reference, Variable_Indexing => Reference, Default_Iterator => Iterate, Iterator_Element => Element_Type; pragma Preelaborable_Initialization(Tree); type Cursor is private; pragma Preelaborable_Initialization(Cursor); Empty_Tree : constant Tree; No_Element : constant Cursor; function Has_Element (Position : Cursor) return Boolean; package Tree_Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor, Has_Element); function Equal_Subtree (Left_Position : Cursor; Right_Position: Cursor) return Boolean; function "=" (Left, Right : Tree) return Boolean; function Is_Empty (Container : Tree) return Boolean; function Node_Count (Container : Tree) return Count_Type; function Subtree_Node_Count (Position : Cursor) return Count_Type; function Depth (Position : Cursor) return Count_Type; function Is_Root (Position : Cursor) return Boolean; function Is_Leaf (Position : Cursor) return Boolean; function Root (Container : Tree) return Cursor; procedure Clear (Container : in out Tree); function Element (Position : Cursor) return Element_Type; procedure Replace_Element (Container : in out Tree; Position : in Cursor; New_Item : in Element_Type); procedure Query_Element (Position : in Cursor; Process : not null access procedure (Element : in Element_Type)); procedure Update_Element (Container : in out Tree; Position : in Cursor; Process : not null access procedure (Element : in out Element_Type)); type Constant_Reference_Type (Element : not null access constant Element_Type) is private with Implicit_Dereference => Element; type Reference_Type (Element : not null access Element_Type) is private with Implicit_Dereference => Element; function Constant_Reference (Container : aliased in Tree; Position : in Cursor) return Constant_Reference_Type; function Reference (Container : aliased in out Tree; Position : in Cursor) return Reference_Type; procedure Assign (Target : in out Tree; Source : in Tree); function Copy (Source : Tree) return Tree; procedure Move (Target : in out Tree; Source : in out Tree); procedure Delete_Leaf (Container : in out Tree; Position : in out Cursor); procedure Delete_Subtree (Container : in out Tree; Position : in out Cursor); procedure Swap (Container : in out Tree; I, J : in Cursor); function Find (Container : Tree; Item : Element_Type) return Cursor; function Find_In_Subtree (Position : Cursor; Item : Element_Type) return Cursor; function Ancestor_Find (Position : Cursor; Item : Element_Type) return Cursor; function Contains (Container : Tree; Item : Element_Type) return Boolean; procedure Iterate (Container : in Tree; Process : not null access procedure (Position : in Cursor)); procedure Iterate_Subtree (Position : in Cursor; Process : not null access procedure (Position : in Cursor)); function Iterate (Container : in Tree) return Tree_Iterator_Interfaces.Forward_Iterator'Class; function Iterate_Subtree (Position : in Cursor) return Tree_Iterator_Interfaces.Forward_Iterator'Class; function Child_Count (Parent : Cursor) return Count_Type; function Child_Depth (Parent, Child : Cursor) return Count_Type; procedure Insert_Child (Container : in out Tree; Parent : in Cursor; Before : in Cursor; New_Item : in Element_Type; Count : in Count_Type := 1); procedure Insert_Child (Container : in out Tree; Parent : in Cursor; Before : in Cursor; New_Item : in Element_Type; Position : out Cursor; Count : in Count_Type := 1); procedure Prepend_Child (Container : in out Tree; Parent : in Cursor; New_Item : in Element_Type; Count : in Count_Type := 1); procedure Append_Child (Container : in out Tree; Parent : in Cursor; New_Item : in Element_Type; Count : in Count_Type := 1); procedure Delete_Children (Container : in out Tree; Parent : in Cursor); procedure Copy_Subtree (Target : in out Tree; Parent : in Cursor; Before : in Cursor; Source : in Cursor); procedure Splice_Subtree (Target : in out Tree; Parent : in Cursor; Before : in Cursor; Source : in out Tree; Position : in out Cursor); procedure Splice_Subtree (Container: in out Tree; Parent : in Cursor; Before : in Cursor; Position : in Cursor); procedure Splice_Children (Target : in out Tree; Target_Parent : in Cursor; Before : in Cursor; Source : in out Tree; Source_Parent : in Cursor); procedure Splice_Children (Container : in out Tree; Target_Parent : in Cursor; Before : in Cursor; Source_Parent : in Cursor); function Parent (Position : Cursor) return Cursor; function First_Child (Parent : Cursor) return Cursor; function First_Child_Element (Parent : Cursor) return Element_Type; function Last_Child (Parent : Cursor) return Cursor; function Last_Child_Element (Parent : Cursor) return Element_Type; function Next_Sibling (Position : Cursor) return Cursor; function Previous_Sibling (Position : Cursor) return Cursor; procedure Next_Sibling (Position : in out Cursor); procedure Previous_Sibling (Position : in out Cursor); procedure Iterate_Children (Parent : in Cursor; Process : not null access procedure (Position : in Cursor)); procedure Reverse_Iterate_Children (Parent : in Cursor; Process : not null access procedure (Position : in Cursor)); function Iterate_Children (Container : in Tree; Parent : in Cursor) return Tree_Iterator_Interfaces.Reversible_Iterator'Class; private -- not specified by the language end Ada.Containers.Indefinite_Multiway_Trees;
----------------------------------------------------------------------- -- views.nodes.jsf -- JSF Core Tag Library -- Copyright (C) 2010, 2011, 2012, 2013, 2014 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ASF.Views.Nodes; with ASF.Contexts.Facelets; with ASF.Validators; -- The <b>ASF.Views.Nodes.Jsf</b> package implements various JSF Core Tag -- components which alter the component tree but don't need to create -- new UI components in the usual way. The following components are supported: -- -- <f:attribute name='...' value='...'/> -- <f:converter converterId='...'/> -- <f:validateXXX .../> -- <f:facet name='...'>...</f:facet> -- -- The <b>f:attribute</b>, <b>f:converter</b> and <b>f:validateXXX</b> tags don't create any -- component. The <b>f:facet</b> creates components that are inserted as a facet component -- in the component tree. package ASF.Views.Nodes.Jsf is -- ------------------------------ -- Converter Tag -- ------------------------------ -- The <b>Converter_Tag_Node</b> is created in the facelet tree when -- the <f:converter> element is found. When building the component tree, -- we have to find the <b>Converter</b> object and attach it to the -- parent component. The parent component must implement the <b>Value_Holder</b> -- interface. type Converter_Tag_Node is new Views.Nodes.Tag_Node with private; type Converter_Tag_Node_Access is access all Converter_Tag_Node'Class; -- Create the Converter Tag function Create_Converter_Tag_Node (Binding : in Binding_Access; Line : in Views.Line_Info; Parent : in Views.Nodes.Tag_Node_Access; Attributes : in Views.Nodes.Tag_Attribute_Array_Access) return Views.Nodes.Tag_Node_Access; -- Build the component tree from the tag node and attach it as -- the last child of the given parent. Calls recursively the -- method to create children. Get the specified converter and -- add it to the parent component. This operation does not create any -- new UIComponent. overriding procedure Build_Components (Node : access Converter_Tag_Node; Parent : in UIComponent_Access; Context : in out Contexts.Facelets.Facelet_Context'Class); -- ------------------------------ -- Convert Date Time Tag -- ------------------------------ -- The <b>Convert_Date_Time_Tag_Node</b> is created in the facelet tree when -- the <f:converterDateTime> element is found. When building the component tree, -- we have to find the <b>Converter</b> object and attach it to the -- parent component. The parent component must implement the <b>Value_Holder</b> -- interface. type Convert_Date_Time_Tag_Node is new Views.Nodes.Tag_Node with private; type Convert_Date_Time_Tag_Node_Access is access all Convert_Date_Time_Tag_Node'Class; -- Create the Converter Tag function Create_Convert_Date_Time_Tag_Node (Binding : in Binding_Access; Line : in Views.Line_Info; Parent : in Views.Nodes.Tag_Node_Access; Attributes : in Nodes.Tag_Attribute_Array_Access) return Views.Nodes.Tag_Node_Access; -- Build the component tree from the tag node and attach it as -- the last child of the given parent. Calls recursively the -- method to create children. Get the specified converter and -- add it to the parent component. This operation does not create any -- new UIComponent. overriding procedure Build_Components (Node : access Convert_Date_Time_Tag_Node; Parent : in UIComponent_Access; Context : in out Contexts.Facelets.Facelet_Context'Class); -- ------------------------------ -- Validator Tag -- ------------------------------ -- The <b>Validator_Tag_Node</b> is created in the facelet tree when -- the <f:validateXXX> element is found. When building the component tree, -- we have to find the <b>Validator</b> object and attach it to the -- parent component. The parent component must implement the <b>Editable_Value_Holder</b> -- interface. type Validator_Tag_Node is new Views.Nodes.Tag_Node with private; type Validator_Tag_Node_Access is access all Validator_Tag_Node'Class; -- Create the Validator Tag function Create_Validator_Tag_Node (Binding : in Binding_Access; Line : in Views.Line_Info; Parent : in Views.Nodes.Tag_Node_Access; Attributes : in Views.Nodes.Tag_Attribute_Array_Access) return Views.Nodes.Tag_Node_Access; -- Get the validator instance that corresponds to the validator tag. -- Returns in <b>Validator</b> the instance if it exists and indicate -- in <b>Shared</b> whether it must be freed or not when the component is deleted. procedure Get_Validator (Node : in Validator_Tag_Node; Context : in out Contexts.Facelets.Facelet_Context'Class; Validator : out Validators.Validator_Access; Shared : out Boolean); -- Get the specified validator and add it to the parent component. -- This operation does not create any new UIComponent. overriding procedure Build_Components (Node : access Validator_Tag_Node; Parent : in UIComponent_Access; Context : in out Contexts.Facelets.Facelet_Context'Class); -- ------------------------------ -- Range Validator Tag -- ------------------------------ -- The <b>Range_Validator_Tag_Node</b> is created in the facelet tree when -- the <f:validateLongRange> element is found. -- The parent component must implement the <b>Editable_Value_Holder</b> -- interface. type Range_Validator_Tag_Node is new Validator_Tag_Node with private; type Range_Validator_Tag_Node_Access is access all Range_Validator_Tag_Node'Class; -- Create the Range_Validator Tag function Create_Range_Validator_Tag_Node (Binding : in Binding_Access; Line : in Views.Line_Info; Parent : in Views.Nodes.Tag_Node_Access; Attributes : in Nodes.Tag_Attribute_Array_Access) return Views.Nodes.Tag_Node_Access; -- Get the validator instance that corresponds to the range validator. -- Returns in <b>Validator</b> the validator instance if it exists and indicate -- in <b>Shared</b> whether it must be freed or not when the component is deleted. overriding procedure Get_Validator (Node : in Range_Validator_Tag_Node; Context : in out Contexts.Facelets.Facelet_Context'Class; Validator : out Validators.Validator_Access; Shared : out Boolean); -- ------------------------------ -- Length Validator Tag -- ------------------------------ -- The <b>Length_Validator_Tag_Node</b> is created in the facelet tree when -- the <f:validateLength> element is found. When building the component tree, -- we have to find the <b>Validator</b> object and attach it to the -- parent component. The parent component must implement the <b>Editable_Value_Holder</b> -- interface. type Length_Validator_Tag_Node is new Validator_Tag_Node with private; type Length_Validator_Tag_Node_Access is access all Length_Validator_Tag_Node'Class; -- Create the Length_Validator Tag. Verifies that the XML node defines -- the <b>minimum</b> or the <b>maximum</b> or both attributes. function Create_Length_Validator_Tag_Node (Binding : in Binding_Access; Line : in Views.Line_Info; Parent : in Views.Nodes.Tag_Node_Access; Attributes : in Nodes.Tag_Attribute_Array_Access) return Views.Nodes.Tag_Node_Access; -- Get the validator instance that corresponds to the validator tag. -- Returns in <b>Validator</b> the instance if it exists and indicate -- in <b>Shared</b> whether it must be freed or not when the component is deleted. overriding procedure Get_Validator (Node : in Length_Validator_Tag_Node; Context : in out Contexts.Facelets.Facelet_Context'Class; Validator : out Validators.Validator_Access; Shared : out Boolean); -- ------------------------------ -- Attribute Tag -- ------------------------------ -- The <b>Attribute_Tag_Node</b> is created in the facelet tree when -- the <f:attribute> element is found. When building the component tree, -- an attribute is added to the parent component. type Attribute_Tag_Node is new Views.Nodes.Tag_Node with private; type Attribute_Tag_Node_Access is access all Attribute_Tag_Node'Class; -- Create the Attribute Tag function Create_Attribute_Tag_Node (Binding : in Binding_Access; Line : in Views.Line_Info; Parent : in Views.Nodes.Tag_Node_Access; Attributes : in Views.Nodes.Tag_Attribute_Array_Access) return Views.Nodes.Tag_Node_Access; -- Build the component tree from the tag node and attach it as -- the last child of the given parent. Calls recursively the -- method to create children. -- Adds the attribute to the component node. -- This operation does not create any new UIComponent. overriding procedure Build_Components (Node : access Attribute_Tag_Node; Parent : in UIComponent_Access; Context : in out Contexts.Facelets.Facelet_Context'Class); -- ------------------------------ -- Facet Tag -- ------------------------------ -- The <b>Facet_Tag_Node</b> is created in the facelet tree when -- the <f:facet> element is found. After building the component tree, -- we have to add the component as a facet element of the parent component. -- type Facet_Tag_Node is new Views.Nodes.Tag_Node with private; type Facet_Tag_Node_Access is access all Facet_Tag_Node'Class; -- Create the Facet Tag function Create_Facet_Tag_Node (Binding : in Binding_Access; Line : in Views.Line_Info; Parent : in Views.Nodes.Tag_Node_Access; Attributes : in Views.Nodes.Tag_Attribute_Array_Access) return Views.Nodes.Tag_Node_Access; -- Build the component tree from the tag node and attach it as -- the facet component of the given parent. Calls recursively the -- method to create children. overriding procedure Build_Components (Node : access Facet_Tag_Node; Parent : in UIComponent_Access; Context : in out Contexts.Facelets.Facelet_Context'Class); -- ------------------------------ -- Metadata Tag -- ------------------------------ -- The <b>Metadata_Tag_Node</b> is created in the facelet tree when -- the <f:metadata> element is found. This special component is inserted as a special -- facet component on the UIView parent component. type Metadata_Tag_Node is new Views.Nodes.Tag_Node with private; type Metadata_Tag_Node_Access is access all Metadata_Tag_Node'Class; -- Create the Metadata Tag function Create_Metadata_Tag_Node (Binding : in Binding_Access; Line : in Views.Line_Info; Parent : in Views.Nodes.Tag_Node_Access; Attributes : in Views.Nodes.Tag_Attribute_Array_Access) return Views.Nodes.Tag_Node_Access; -- Build the component tree from the tag node and attach it as a metadata information -- facet for the UIView parent component. overriding procedure Build_Components (Node : access Metadata_Tag_Node; Parent : in UIComponent_Access; Context : in out Contexts.Facelets.Facelet_Context'Class); -- The elaboration check is disabled on the Create_XXX operation because they -- are referenced by the Components.Core.Factory to define a static UI binding. -- This reference triggers the implicit Elaborate_All for the Nodes.JSF package. -- At the end, we obtain a circular dependency that cannot be resolved. -- It is safe to suppress the elaboration check because these Create_XXX operation -- are not invoked before the application is initialized and a view is rendered. pragma Suppress (Elaboration_Check, On => Create_Attribute_Tag_Node); pragma Suppress (Elaboration_Check, On => Create_Converter_Tag_Node); pragma Suppress (Elaboration_Check, On => Create_Convert_Date_Time_Tag_Node); pragma Suppress (Elaboration_Check, On => Create_Facet_Tag_Node); pragma Suppress (Elaboration_Check, On => Create_Metadata_Tag_Node); pragma Suppress (Elaboration_Check, On => Create_Length_Validator_Tag_Node); pragma Suppress (Elaboration_Check, On => Create_Range_Validator_Tag_Node); pragma Suppress (Elaboration_Check, On => Create_Validator_Tag_Node); private type Converter_Tag_Node is new Views.Nodes.Tag_Node with record Converter : EL.Objects.Object; end record; type Convert_Date_Time_Tag_Node is new Views.Nodes.Tag_Node with record Date_Style : Tag_Attribute_Access; Time_Style : Tag_Attribute_Access; Locale : Tag_Attribute_Access; Pattern : Tag_Attribute_Access; Format : Tag_Attribute_Access; end record; type Validator_Tag_Node is new Views.Nodes.Tag_Node with record Validator : EL.Objects.Object; end record; type Length_Validator_Tag_Node is new Validator_Tag_Node with record Minimum : Tag_Attribute_Access; Maximum : Tag_Attribute_Access; end record; type Range_Validator_Tag_Node is new Validator_Tag_Node with record Minimum : Tag_Attribute_Access; Maximum : Tag_Attribute_Access; end record; type Attribute_Tag_Node is new Views.Nodes.Tag_Node with record Attr : aliased Tag_Attribute; Attr_Name : Tag_Attribute_Access; Value : Tag_Attribute_Access; end record; type Facet_Tag_Node is new Views.Nodes.Tag_Node with record Facet_Name : Tag_Attribute_Access; end record; type Metadata_Tag_Node is new Views.Nodes.Tag_Node with null record; end ASF.Views.Nodes.Jsf;
pragma Style_Checks (Off); -- This spec has been automatically generated from ATSAMD51G19A.svd pragma Restrictions (No_Elaboration_Code); with HAL; with System; package SAM_SVD.ITM is pragma Preelaborate; --------------- -- Registers -- --------------- -- ITM Stimulus Port Registers -- ITM Stimulus Port Registers type ITM_PORT_WORD_MODE_Registers is array (0 .. 31) of HAL.UInt32; subtype ITM_PORT_BYTE_MODE_PORT_Field is HAL.UInt8; -- ITM Stimulus Port Registers type ITM_PORT_BYTE_MODE_Register is record -- Write-only. PORT : ITM_PORT_BYTE_MODE_PORT_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ITM_PORT_BYTE_MODE_Register use record PORT at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- ITM Stimulus Port Registers type ITM_PORT_BYTE_MODE_Registers is array (0 .. 31) of ITM_PORT_BYTE_MODE_Register; subtype ITM_PORT_HWORD_MODE_PORT_Field is HAL.UInt16; -- ITM Stimulus Port Registers type ITM_PORT_HWORD_MODE_Register is record -- Write-only. PORT : ITM_PORT_HWORD_MODE_PORT_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ITM_PORT_HWORD_MODE_Register use record PORT at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- ITM Stimulus Port Registers type ITM_PORT_HWORD_MODE_Registers is array (0 .. 31) of ITM_PORT_HWORD_MODE_Register; subtype ITM_TPR_PRIVMASK_Field is HAL.UInt4; -- ITM Trace Privilege Register type ITM_TPR_Register is record PRIVMASK : ITM_TPR_PRIVMASK_Field := 16#0#; -- unspecified Reserved_4_31 : HAL.UInt28 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ITM_TPR_Register use record PRIVMASK at 0 range 0 .. 3; Reserved_4_31 at 0 range 4 .. 31; end record; subtype ITM_TCR_TSPrescale_Field is HAL.UInt2; subtype ITM_TCR_GTSFREQ_Field is HAL.UInt2; subtype ITM_TCR_TraceBusID_Field is HAL.UInt7; -- ITM Trace Control Register type ITM_TCR_Register is record ITMENA : Boolean := False; TSENA : Boolean := False; SYNCENA : Boolean := False; DWTENA : Boolean := False; SWOENA : Boolean := False; STALLENA : Boolean := False; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; TSPrescale : ITM_TCR_TSPrescale_Field := 16#0#; GTSFREQ : ITM_TCR_GTSFREQ_Field := 16#0#; -- unspecified Reserved_12_15 : HAL.UInt4 := 16#0#; TraceBusID : ITM_TCR_TraceBusID_Field := 16#0#; BUSY : Boolean := False; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ITM_TCR_Register use record ITMENA at 0 range 0 .. 0; TSENA at 0 range 1 .. 1; SYNCENA at 0 range 2 .. 2; DWTENA at 0 range 3 .. 3; SWOENA at 0 range 4 .. 4; STALLENA at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; TSPrescale at 0 range 8 .. 9; GTSFREQ at 0 range 10 .. 11; Reserved_12_15 at 0 range 12 .. 15; TraceBusID at 0 range 16 .. 22; BUSY at 0 range 23 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; -- ITM Integration Write Register type ITM_IWR_Register is record -- Write-only. ATVALIDM : Boolean := False; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ITM_IWR_Register use record ATVALIDM at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- ITM Integration Read Register type ITM_IRR_Register is record -- Read-only. ATREADYM : Boolean; -- unspecified Reserved_1_31 : HAL.UInt31; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ITM_IRR_Register use record ATREADYM at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; ----------------- -- Peripherals -- ----------------- type ITM_Disc is (WORD_MODE, BYTE_MODE, HWORD_MODE); -- Instrumentation Trace Macrocell type ITM_Peripheral (Discriminent : ITM_Disc := WORD_MODE) is record -- ITM Trace Enable Register TER : aliased HAL.UInt32; -- ITM Trace Privilege Register TPR : aliased ITM_TPR_Register; -- ITM Trace Control Register TCR : aliased ITM_TCR_Register; -- ITM Integration Write Register IWR : aliased ITM_IWR_Register; -- ITM Integration Read Register IRR : aliased ITM_IRR_Register; case Discriminent is when WORD_MODE => -- ITM Stimulus Port Registers PORT_WORD_MODE : aliased ITM_PORT_WORD_MODE_Registers; when BYTE_MODE => -- ITM Stimulus Port Registers PORT_BYTE_MODE : aliased ITM_PORT_BYTE_MODE_Registers; when HWORD_MODE => -- ITM Stimulus Port Registers PORT_HWORD_MODE : aliased ITM_PORT_HWORD_MODE_Registers; end case; end record with Unchecked_Union, Volatile; for ITM_Peripheral use record TER at 16#E00# range 0 .. 31; TPR at 16#E40# range 0 .. 31; TCR at 16#E80# range 0 .. 31; IWR at 16#EF8# range 0 .. 31; IRR at 16#EFC# range 0 .. 31; PORT_WORD_MODE at 16#0# range 0 .. 1023; PORT_BYTE_MODE at 16#0# range 0 .. 1023; PORT_HWORD_MODE at 16#0# range 0 .. 1023; end record; -- Instrumentation Trace Macrocell ITM_Periph : aliased ITM_Peripheral with Import, Address => ITM_Base; end SAM_SVD.ITM;
package body Generic_Perm is procedure Set_To_First(P: out Permutation; Is_Last: out Boolean) is begin for I in P'Range loop P (I) := I; end loop; Is_Last := P'Length = 1; -- if P has a single element, the fist permutation is the last one end Set_To_First; procedure Go_To_Next(P: in out Permutation; Is_Last: out Boolean) is procedure Swap (A, B : in out Integer) is C : Integer := A; begin A := B; B := C; end Swap; I, J, K : Element; begin -- find longest tail decreasing sequence -- after the loop, this sequence is I+1 .. n, -- and the ith element will be exchanged later -- with some element of the tail Is_Last := True; I := N - 1; loop if P (I) < P (I+1) then Is_Last := False; exit; end if; -- next instruction will raise an exception if I = 1, so -- exit now (this is the last permutation) exit when I = 1; I := I - 1; end loop; -- if all the elements of the permutation are in -- decreasing order, this is the last one if Is_Last then return; end if; -- sort the tail, i.e. reverse it, since it is in decreasing order J := I + 1; K := N; while J < K loop Swap (P (J), P (K)); J := J + 1; K := K - 1; end loop; -- find lowest element in the tail greater than the ith element J := N; while P (J) > P (I) loop J := J - 1; end loop; J := J + 1; -- exchange them -- this will give the next permutation in lexicographic order, -- since every element from ith to the last is minimum Swap (P (I), P (J)); end Go_To_Next; end Generic_Perm;
-- Abstract : -- -- External process parser for gpr mode -- -- Copyright (C) 2017 - 2019 Free Software Foundation, Inc. -- -- This program 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 program is distributed in the -- hope that it will be useful, but WITHOUT ANY WARRANTY; without even -- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -- PURPOSE. See the GNU General Public License for more details. You -- should have received a copy of the GNU General Public License -- distributed with this program; see file COPYING. If not, write to -- the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, -- MA 02110-1335, USA. pragma License (GPL); with Gen_Emacs_Wisi_LR_Parse; with Gpr_Process_Actions; with Gpr_Process_Main; with Wisi.Gpr; procedure Gpr_Mode_Wisi_Parse is new Gen_Emacs_Wisi_LR_Parse (Parse_Data_Type => Wisi.Gpr.Parse_Data_Type, Language_Protocol_Version => Wisi.Gpr.Language_Protocol_Version, Name => "gpr_mode_wisi_parse", Descriptor => Gpr_Process_Actions.Descriptor, Partial_Parse_Active => Gpr_Process_Actions.Partial_Parse_Active, Language_Fixes => null, Language_Matching_Begin_Tokens => null, Language_String_ID_Set => null, Create_Parser => Gpr_Process_Main.Create_Parser);
pragma Warnings (Off); pragma Ada_95; pragma Restrictions (No_Exception_Propagation); with System; with System.Parameters; with System.Secondary_Stack; package ada_main is GNAT_Version : constant String := "GNAT Version: Community 2020 (20200818-93)" & ASCII.NUL; pragma Export (C, GNAT_Version, "__gnat_version"); Ada_Main_Program_Name : constant String := "_ada_main" & ASCII.NUL; pragma Export (C, Ada_Main_Program_Name, "__gnat_ada_main_program_name"); procedure adainit; pragma Export (C, adainit, "adainit"); procedure main; pragma Export (C, main, "main"); -- BEGIN ELABORATION ORDER -- ada%s -- interfaces%s -- system%s -- ada.exceptions%s -- ada.exceptions%b -- system.machine_code%s -- system.parameters%s -- system.storage_elements%s -- system.storage_elements%b -- system.secondary_stack%s -- system.secondary_stack%b -- ada.tags%s -- ada.tags%b -- system.unsigned_types%s -- system.assertions%s -- system.assertions%b -- cortex_m%s -- cortex_m_svd%s -- hal%s -- cortex_m_svd.debug%s -- nrf_svd%s -- nrf_svd.aar%s -- nrf_svd.ccm%s -- nrf_svd.clock%s -- nrf_svd.ecb%s -- nrf_svd.ficr%s -- nrf_svd.gpio%s -- nrf_svd.gpiote%s -- nrf_svd.power%s -- nrf_svd.ppi%s -- nrf_svd.qdec%s -- nrf_svd.radio%s -- nrf_svd.rng%s -- nrf_svd.rtc%s -- nrf_svd.saadc%s -- nrf_svd.spi%s -- nrf_svd.temp%s -- nrf_svd.timer%s -- nrf_svd.twi%s -- nrf_svd.uart%s -- nrf_svd.wdt%s -- hal.gpio%s -- hal.i2c%s -- hal.spi%s -- hal.time%s -- hal.uart%s -- memory_barriers%s -- memory_barriers%b -- cortex_m.nvic%s -- cortex_m.nvic%b -- nrf%s -- nrf.events%s -- nrf.events%b -- nrf.gpio%s -- nrf.gpio%b -- nrf.interrupts%s -- nrf.interrupts%b -- nrf.rtc%s -- nrf.rtc%b -- nrf.spi_master%s -- nrf.spi_master%b -- nrf.tasks%s -- nrf.tasks%b -- nrf.clock%s -- nrf.clock%b -- nrf.timers%s -- nrf.timers%b -- nrf.twi%s -- nrf.twi%b -- nrf.uart%s -- nrf.uart%b -- nrf.device%s -- nrf.device%b -- nrf52_dk%s -- nrf52_dk.leds%s -- nrf52_dk.leds%b -- nrf52_dk.time%s -- nrf52_dk.time%b -- nrf52_dk.buttons%s -- nrf52_dk.buttons%b -- main%b -- END ELABORATION ORDER end ada_main;
----------------------------------------------------------------------- -- properties.hash -- Hash-based property implementation -- Copyright (C) 2001, 2002, 2003, 2006, 2008, 2009, 2010 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Unchecked_Deallocation; package body Util.Properties.Hash is use PropertyMap; type Manager_Object_Access is access all Manager; procedure Free is new Ada.Unchecked_Deallocation (Manager, Manager_Object_Access); -- ----------------------- -- Returns TRUE if the property exists. -- ----------------------- function Exists (Self : in Manager; Name : in Value) return Boolean is Pos : constant PropertyMap.Cursor := PropertyMap.Find (Self.Content, Name); begin return PropertyMap.Has_Element (Pos); end Exists; -- ----------------------- -- Returns the property value. Raises an exception if not found. -- ----------------------- function Get (Self : in Manager; Name : in Value) return Value is Pos : constant PropertyMap.Cursor := PropertyMap.Find (Self.Content, Name); begin if PropertyMap.Has_Element (Pos) then return PropertyMap.Element (Pos); else raise NO_PROPERTY with "No property: '" & To_String (Name) & "'"; end if; end Get; procedure Insert (Self : in out Manager; Name : in Value; Item : in Value) is Pos : PropertyMap.Cursor; Inserted : Boolean; begin PropertyMap.Insert (Self.Content, Name, Item, Pos, Inserted); end Insert; -- ----------------------- -- Set the value of the property. The property is created if it -- does not exists. -- ----------------------- procedure Set (Self : in out Manager; Name : in Value; Item : in Value) is Pos : PropertyMap.Cursor; Inserted : Boolean; begin PropertyMap.Insert (Self.Content, Name, Item, Pos, Inserted); if not Inserted then PropertyMap.Replace_Element (Self.Content, Pos, Item); end if; end Set; -- ----------------------- -- Remove the property given its name. -- ----------------------- procedure Remove (Self : in out Manager; Name : in Value) is Pos : PropertyMap.Cursor := PropertyMap.Find (Self.Content, Name); begin if PropertyMap.Has_Element (Pos) then PropertyMap.Delete (Self.Content, Pos); else raise NO_PROPERTY with "No property: '" & To_String (Name) & "'"; end if; end Remove; -- ----------------------- -- Iterate over the properties and execute the given procedure passing the -- property name and its value. -- ----------------------- procedure Iterate (Self : in Manager; Process : access procedure (Name, Item : Value)) is procedure Do_Process (Name, Item : in Value); procedure Do_Process (Name, Item : in Value) is begin Process.all (Name, Item); end Do_Process; Iter : PropertyMap.Cursor := Self.Content.First; begin while PropertyMap.Has_Element (Iter) loop PropertyMap.Query_Element (Iter, Do_Process'Access); PropertyMap.Next (Iter); end loop; end Iterate; -- ----------------------- -- Deep copy of properties stored in 'From' to 'To'. -- ----------------------- function Create_Copy (Self : in Manager) return Interface_P.Manager_Access is Copy : constant Manager_Access := new Manager; Iter : PropertyMap.Cursor := PropertyMap.First (Self.Content); New_Item : PropertyMap.Cursor; Inserted : Boolean; begin while PropertyMap.Has_Element (Iter) loop PropertyMap.Insert (Copy.Content, PropertyMap.Key (Iter), PropertyMap.Element (Iter), New_Item, Inserted); Iter := PropertyMap.Next (Iter); end loop; return Copy.all'Access; end Create_Copy; procedure Delete (Self : in Manager; Obj : in out Interface_P.Manager_Access) is pragma Unreferenced (Self); Item : Manager_Object_Access := Manager (Obj.all)'Access; begin Free (Item); end Delete; function Equivalent_Keys (Left : Value; Right : Value) return Boolean is begin return Left = Right; end Equivalent_Keys; function Get_Names (Self : in Manager; Prefix : in String) return Name_Array is It : PropertyMap.Cursor := Self.Content.First; Result : Name_Array (1 .. Integer (Self.Content.Length)); Pos : Natural := 1; begin while PropertyMap.Has_Element (It) loop declare Key : constant Value := PropertyMap.Key (It); begin if Prefix'Length = 0 or else Index (Key, Prefix) = 1 then Result (Pos) := Key; Pos := Pos + 1; end if; end; It := PropertyMap.Next (It); end loop; return Result (Result'First .. Pos - 1); end Get_Names; end Util.Properties.Hash;
with DOM.Core; with Assignment_Tree_Branch_Bound; use Assignment_Tree_Branch_Bound; with Assignment_Tree_Branch_Bound_Communication; use Assignment_Tree_Branch_Bound_Communication; package UxAS.Comms.LMCP_Net_Client.Service.Assignment_Tree_Branch_Bounding is type Assignment_Tree_Branch_Bound_Service is new Service_Base with private; Type_Name : constant String := "AssignmentTreeBranchBoundService"; Directory_Name : constant String := ""; -- static const std::vector<std::string> -- s_registryServiceTypeNames() function Registry_Service_Type_Names return Service_Type_Names_List; -- static ServiceBase* -- create() function Create return Any_Service; private type Assignment_Tree_Branch_Bound_Service is new Service_Base with record -- the following types are defined in SPARK code Config : Assignment_Tree_Branch_Bound_Configuration_Data; Mailbox : Assignment_Tree_Branch_Bound_Mailbox; State : Assignment_Tree_Branch_Bound_State; end record; overriding procedure Configure (This : in out Assignment_Tree_Branch_Bound_Service; XML_Node : DOM.Core.Element; Result : out Boolean); overriding procedure Initialize (This : in out Assignment_Tree_Branch_Bound_Service; Result : out Boolean); overriding procedure Process_Received_LMCP_Message (This : in out Assignment_Tree_Branch_Bound_Service; Received_Message : not null Any_LMCP_Message; Should_Terminate : out Boolean); end UxAS.Comms.LMCP_Net_Client.Service.Assignment_Tree_Branch_Bounding;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . T A S K I N G . T A S K _ A T T R I B U T E S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2014-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides support for the body of Ada.Task_Attributes with Ada.Unchecked_Conversion; package System.Tasking.Task_Attributes is type Deallocator is access procedure (Ptr : Atomic_Address); pragma Favor_Top_Level (Deallocator); type Attribute_Record is record Free : Deallocator; end record; -- The real type is declared in Ada.Task_Attributes body: Real_Attribute. -- As long as the first field is the deallocator we are good. type Attribute_Access is access all Attribute_Record; pragma No_Strict_Aliasing (Attribute_Access); function To_Attribute is new Ada.Unchecked_Conversion (Atomic_Address, Attribute_Access); function Next_Index (Require_Finalization : Boolean) return Integer; -- Return the next attribute index available. Require_Finalization is True -- if the attribute requires finalization and in particular its deallocator -- (Free field in Attribute_Record) should be called. Raise Storage_Error -- if no index is available. function Require_Finalization (Index : Integer) return Boolean; -- Return True if a given attribute index requires call to Free. This call -- is not protected against concurrent access, should only be called during -- finalization of the corresponding instantiation of Ada.Task_Attributes, -- or during finalization of a task. procedure Finalize (Index : Integer); -- Finalize given Index, possibly allowing future reuse private pragma Inline (Finalize); pragma Inline (Require_Finalization); end System.Tasking.Task_Attributes;
-- part of ParserTools, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" private with Ada.Streams.Stream_IO; private with Ada.Directories; package Lexer.Source.File is -- this provides streams which are backed by files on the file system. type Instance is new Source.Instance with private; type Instance_Access is access all Instance; overriding procedure Read_Data (S : in out Instance; Buffer : out String; Length : out Natural); overriding procedure Finalize (Object : in out Instance); function As_Source (File_Path : String) return Pointer; private type Instance is new Source.Instance with record File : Ada.Streams.Stream_IO.File_Type; Stream : Ada.Streams.Stream_IO.Stream_Access; Input_At, Input_Length : Ada.Directories.File_Size; end record; end Lexer.Source.File;
-- C25001B.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT ALL CHARACTER LITERALS CAN BE WRITTEN. -- CASE B: THE LOWER CASE LETTERS AND THE OTHER -- SPECIAL CHARACTERS. -- TBN 8/1/86 WITH REPORT; USE REPORT; PROCEDURE C25001B IS BEGIN TEST ("C25001B", "CHECK THAT EACH CHARACTER IN THE LOWER CASE " & "LETTERS AND THE OTHER SPECIAL CHARACTERS CAN " & "BE WRITTEN"); IF CHARACTER'POS('a') /= 97 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'a'"); END IF; IF CHARACTER'POS('b') /= 98 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'b'"); END IF; IF CHARACTER'POS('c') /= 99 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'c'"); END IF; IF CHARACTER'POS('d') /= 100 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'd'"); END IF; IF CHARACTER'POS('e') /= 101 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'e'"); END IF; IF CHARACTER'POS('f') /= 102 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'f'"); END IF; IF CHARACTER'POS('g') /= 103 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'g'"); END IF; IF CHARACTER'POS('h') /= 104 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'h'"); END IF; IF CHARACTER'POS('i') /= 105 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'i'"); END IF; IF CHARACTER'POS('j') /= 106 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'j'"); END IF; IF CHARACTER'POS('k') /= 107 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'k'"); END IF; IF CHARACTER'POS('l') /= 108 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'l'"); END IF; IF CHARACTER'POS('m') /= 109 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'm'"); END IF; IF CHARACTER'POS('n') /= 110 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'n'"); END IF; IF CHARACTER'POS('o') /= 111 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'o'"); END IF; IF CHARACTER'POS('p') /= 112 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'p'"); END IF; IF CHARACTER'POS('q') /= 113 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'q'"); END IF; IF CHARACTER'POS('r') /= 114 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'r'"); END IF; IF CHARACTER'POS('s') /= 115 THEN FAILED ("INCORRECT POSITION NUMBER FOR 's'"); END IF; IF CHARACTER'POS('t') /= 116 THEN FAILED ("INCORRECT POSITION NUMBER FOR 't'"); END IF; IF CHARACTER'POS('u') /= 117 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'u'"); END IF; IF CHARACTER'POS('v') /= 118 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'v'"); END IF; IF CHARACTER'POS('w') /= 119 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'w'"); END IF; IF CHARACTER'POS('x') /= 120 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'x'"); END IF; IF CHARACTER'POS('y') /= 121 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'y'"); END IF; IF CHARACTER'POS('z') /= 122 THEN FAILED ("INCORRECT POSITION NUMBER FOR 'z'"); END IF; IF CHARACTER'POS('!') /= 33 THEN FAILED ("INCORRECT POSITION NUMBER FOR '!'"); END IF; IF CHARACTER'POS('$') /= 36 THEN FAILED ("INCORRECT POSITION NUMBER FOR '$'"); END IF; IF CHARACTER'POS('%') /= 37 THEN FAILED ("INCORRECT POSITION NUMBER FOR '%'"); END IF; IF CHARACTER'POS('?') /= 63 THEN FAILED ("INCORRECT POSITION NUMBER FOR '?'"); END IF; IF CHARACTER'POS('@') /= 64 THEN FAILED ("INCORRECT POSITION NUMBER FOR '@'"); END IF; IF CHARACTER'POS('[') /= 91 THEN FAILED ("INCORRECT POSITION NUMBER FOR '['"); END IF; IF CHARACTER'POS('\') /= 92 THEN FAILED ("INCORRECT POSITION NUMBER FOR '\'"); END IF; IF CHARACTER'POS(']') /= 93 THEN FAILED ("INCORRECT POSITION NUMBER FOR ']'"); END IF; IF CHARACTER'POS('^') /= 94 THEN FAILED ("INCORRECT POSITION NUMBER FOR '^'"); END IF; IF CHARACTER'POS('`') /= 96 THEN FAILED ("INCORRECT POSITION NUMBER FOR '`'"); END IF; IF CHARACTER'POS('{') /= 123 THEN FAILED ("INCORRECT POSITION NUMBER FOR '{'"); END IF; IF CHARACTER'POS('}') /= 125 THEN FAILED ("INCORRECT POSITION NUMBER FOR '}'"); END IF; IF CHARACTER'POS('~') /= 126 THEN FAILED ("INCORRECT POSITION NUMBER FOR '~'"); END IF; RESULT; END C25001B;
-- Afficher l'entier N sur la sortie standard. -- Cette procédure s'appuie sur Ada.Integer_Text_IO.Put mais permet d'avoir -- une procédure avec un seul paramètre. procedure Afficher_Un_Entier (N: in Integer);
with Ada.Float_Text_IO; use Ada.Float_Text_IO; procedure Horners_Rule is type Coef is array(Positive range <>) of Float; function Horner(Coeffs: Coef; Val: Float) return Float is Res : Float := 0.0; begin for P in reverse Coeffs'Range loop Res := Res*Val + Coeffs(P); end loop; return Res; end Horner; begin Put(Horner(Coeffs => (-19.0, 7.0, -4.0, 6.0), Val => 3.0), Aft=>1, Exp=>0); end Horners_Rule;
-- { dg-do compile } with Ada.Numerics.Complex_types; use Ada.Numerics.Complex_types; with Complex1_Pkg; use Complex1_Pkg; procedure Complex1 is Z : Complex; begin Coord (Z.Re, Z.Im); end;
-- Copyright 2017-2021 Bartek thindil Jasicki -- -- This file is part of Steam Sky. -- -- Steam Sky is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- Steam Sky is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Steam Sky. If not, see <http://www.gnu.org/licenses/>. with Events; use Events; with Game; use Game; with Missions; use Missions; -- ****h* Maps/Maps -- FUNCTION -- Provide code for manipulate the game map -- SOURCE package Maps is -- **** -- ****s* Maps/Maps.SkyCell -- FUNCTION -- Data structure for cells in game map -- PARAMETERS -- BaseIndex - If sky base is in cell > 0 -- Visited - True if player was in this cell -- EventIndex - If event is in cell > 0 -- MissionIndex - If accepted mission is in cell > 0 -- SOURCE type SkyCell is record BaseIndex: Extended_Base_Range := 0; Visited: Boolean; EventIndex: Events_Container.Extended_Index := 0; MissionIndex: Mission_Container.Extended_Index := 0; end record; -- **** -- ****v* Maps/Maps.SkyMap -- FUNCTION -- Game map -- SOURCE SkyMap: array(Map_X_Range, Map_Y_Range) of SkyCell; -- **** -- ****f* Maps/Maps.CountDistance -- FUNCTION -- Count distance (in map fields) between player ship and the destination -- point -- PARAMETERS -- DestinationX - X coordinate of the destination point -- DestinationY - Y coordinate of the destination point -- RESULT -- Distance between player ship and destination point -- SOURCE function CountDistance (DestinationX: Map_X_Range; DestinationY: Map_Y_Range) return Natural with Test_Case => (Name => "Test_CountDistance", Mode => Robustness); -- **** -- ****f* Maps/Maps.NormalizeCoord -- FUNCTION -- Normalize map coordinates -- PARAMETERS -- Coord - Coordinate to normalize -- IsXAxis - If true, coordinate is in X axis -- RESULT -- Parameter Coord -- SOURCE procedure NormalizeCoord (Coord: in out Integer; IsXAxis: Boolean := True) with Post => (if IsXAxis then Coord in Map_X_Range'Range else Coord in Map_Y_Range), Test_Case => (Name => "Test_NormalizeCoord", Mode => Nominal); -- **** end Maps;
----------------------------------------------------------------------- -- are-installer-merges -- Web file merge -- Copyright (C) 2020, 2021 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with EL.Variables.Default; with EL.Contexts.Default; with Util.Strings.Maps; with Util.Beans.Objects.Maps; -- == Install mode: webmerge == -- The `webmerge` distribution rule is intended to merge Javascript or CSS files -- which are used by XHTML presentation files. It requires some help from the -- developer to describe what files must be merged. The XHTML file must contain -- well defined XML comments which are used to identify the merging areas. -- The CSS file merge start section begins with: -- -- <!-- ARE-MERGE-START link=#{contextPath}/css/target-merge-1.css --> -- -- and the Javascript merge start begings with: -- -- <!-- ARE-MERGE-START script=#{contextPath}/js/target-merge-1.js --> -- -- The merge section is terminated by the following XML comment: -- -- <!-- ARE-MERGE-END --> -- -- Everything withing these XML comments is then replaced either by a `link` -- HTML tag or by a `script` HTML tag and a file described either by the -- `link=` or `script=` markers is generated to include every `link` or `script` -- that was defined within the XML comment markers. For example, with the following -- XHTML extract: -- -- <!-- ARE-MERGE-START link=#{contextPath}/css/merged.css --> -- <link media="screen" type="text/css" rel="stylesheet" -- href="#{contextPath}/css/awa.css"/> -- <link media="screen" type="text/css" rel="stylesheet" -- href="#{jquery.uiCssPath}"/> -- <link media="screen" type="text/css" rel="stylesheet" -- href="#{jquery.chosenCssPath}"/> -- <!-- ARE-MERGE-END --> -- -- The generated file `css/merged.css` will include `awa.css`, `jquery-ui-1.12.1.css`, -- `chosen.css` and the XHTML will be replaced to include `css/merge.css` only -- by using the following XHTML: -- -- <link media='screen' type='text/css' rel='stylesheet' -- href='#{contextPath}/css/merged.css'/> -- -- To use the `webmerge`, the `package.xml` description file should contain -- the following command: -- -- <install mode='webmerge' dir='web' source-timestamp='true'> -- <property name="contextPath"></property> -- <property name="jquery.path">/js/jquery-3.4.1.js</property> -- <property name="jquery.uiCssPath">/css/redmond/jquery-ui-1.12.1.css</property> -- <property name="jquery.chosenCssPath">/css/jquery-chosen-1.8.7/chosen.css</property> -- <property name="jquery.uiPath">/js/jquery-ui-1.12.1</property> -- <fileset dir="web"> -- <include name="WEB-INF/layouts/*.xhtml"/> -- </fileset> -- </install> -- -- The merging areas are identified by the default tags `ARE-MERGE-START` and `ARE-MERGE-END`. -- These tags can be changed by specifying the expected value in the `merge-start` and `merge-end` -- attributes in the `install` XML element. For example, with -- -- <install mode='webmerge' dir='web' source-timestamp='true' -- merge-start='RESOURCE-MERGE-START' -- merge-end='RESOURCE-MERGE-END'> -- -- </install> -- -- the markers becomes: -- -- <!-- RESOURCE-MERGE-START link=#{contextPath}/css/target-merge-1.css --> -- <!-- RESOURCE-MERGE-END --> -- private package Are.Installer.Merges is DEFAULT_MERGE_START : constant String := "ARE-MERGE-START"; DEFAULT_MERGE_END : constant String := "ARE-MERGE-END"; -- Create a distribution rule to copy a set of files or directories. function Create_Rule (Node : in DOM.Core.Node) return Distrib_Rule_Access; -- ------------------------------ -- Distribution artifact -- ------------------------------ type Merge_Rule is new Distrib_Rule with private; type Merge_Rule_Access is access all Merge_Rule; -- Get a name to qualify the installation rule (used for logs). overriding function Get_Install_Name (Rule : in Merge_Rule) return String; overriding procedure Install (Rule : in Merge_Rule; Path : in String; Files : in File_Vector; Context : in out Context_Type'Class); private type Merge_Rule is new Distrib_Rule with record Params : Util.Beans.Objects.Maps.Map_Bean; Context : EL.Contexts.Default.Default_Context; Variables : aliased EL.Variables.Default.Default_Variable_Mapper; Replace : Util.Strings.Maps.Map; Start_Mark : UString; End_Mark : UString; end record; end Are.Installer.Merges;
-- Copyright (c) 2006-2020 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package JWS.Integers is Digit_Size : constant := 32; type Digit is mod 2 ** Digit_Size; type Number is array (Positive range <>) of Digit with Dynamic_Predicate => Number'First = 1; -- Size is number of Digits in the Number function BER_Length (Raw : Ada.Streams.Stream_Element_Array) return Positive; -- Return length of Number for given BER encoding procedure BER_Decode (Raw : Ada.Streams.Stream_Element_Array; Value : out Number); -- Decode BER integer into Value procedure BER_Encode (Value : Number; Raw : out Ada.Streams.Stream_Element_Array); -- Encode number into BER integer procedure Add (A : in out Number; B : Number) with Pre => A'Length = B'Length; -- Result is A + B procedure Add (A, B : Number; Result : out Number; C : Digit) with Pre => A'Length = B'Length and Result'Length = A'Length + 1; -- Result is A + B * C -- Result'Address can be A'Address or B'Address procedure Subtract (A : in out Number; B : Number; C : Digit := 1; Ok : out Boolean) with Pre => A'Length = B'Length + 1; -- Result is A - B * C, Ok is A >= B * C procedure Multiply (A, B : Number; Result : out Number) with Pre => Result'Length = A'Length + B'Length; -- Result is A * B procedure Fast_Devide (A : Number; B : Digit; Result : out Number; Rest : out Digit) with Pre => Result'Length = A'Length and B /= 0; -- Result is A /B, while Rest is A mod B procedure Remainder (A, B : Number; Result : out Number) with Pre => B /= (B'Range => 0) and Result'Length = B'Length; -- Result is A mod B procedure Power (Value : Number; Exponent : Number; Module : Number; Result : out Number) with Pre => Result'Length = Module'Length; -- Result is (Value ** Exponent) mod Module end JWS.Integers;
select accept first_entry; -- do something or accept second_entry; -- do something or terminate; end select;
pragma Extensions_Allowed (On); with Ada.Numerics.Big_Numbers.Big_Integers; use Ada.Numerics.Big_Numbers.Big_Integers; pragma Extensions_Allowed (Off); with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Strings.Fixed; use Ada.Strings.Fixed; package Rejuvenation.String_Utils with SPARK_Mode => On is function Starts_With (A_String, Beginning : String) return Boolean is (A_String'Length >= Beginning'Length and then Head (A_String, Beginning'Length) = Beginning); -- Does the given string start with the given beginning? function Starts_with_Case_Insensitive (A_String, Beginning : String) return Boolean is (Starts_With (To_Lower (A_String), To_Lower (Beginning))); -- Does the given string start with the given beginning, -- independent of the case? function Ends_With (A_String, Ending : String) return Boolean is (A_String'Length >= Ending'Length and then Tail (A_String, Ending'Length) = Ending); -- Does the given string end with the given ending? -- GNATCOLL.Strings also provides an Ends_With that needs -- an XString [yet another string class ;-( ] function Ends_with_Case_Insensitive (A_String, Ending : String) return Boolean is (Ends_With (To_Lower (A_String), To_Lower (Ending))); -- Does the given string end with the given ending (independent of the case)? function Replace_Prefix (String_With_Prefix : String; Prefix, New_Prefix : String) return String with Pre => -- Length constraints (added to help Prover) String_With_Prefix'Length >= Prefix'Length and then -- Empty string cannot be [Postive'Last + 1 .. Positive'Last] -- due to overflow hence String_With_Prefix'First <= Positive'Last - Prefix'Length and then New_Prefix'First <= Positive'Last - New_Prefix'Length and then -- Overflow protection, since the length of a string is limited by -- the range of Natural [0 .. Natural'Last] -- Furthermore, New_Prefix'First >= 1, so not whole range is -- necessarily available -- [type String is array (Positive range <>) of Character -- + with exceptions for empty string] To_Big_Integer (String_With_Prefix'Length) - To_Big_Integer (Prefix'Length) <= To_Big_Integer (Positive'Last) - To_Big_Integer (New_Prefix'Last) and then -- Value constraints String_With_Prefix (String_With_Prefix'First .. String_With_Prefix'First + (Prefix'Length - 1)) = Prefix, Post => -- Value Constraints Replace_Prefix'Result (Replace_Prefix'Result'First .. Replace_Prefix'Result'First + (New_Prefix'Length - 1)) = New_Prefix and then Replace_Prefix'Result (Replace_Prefix'Result'First + New_Prefix'Length .. Replace_Prefix'Result'Last) = String_With_Prefix (String_With_Prefix'First + Prefix'Length .. String_With_Prefix'Last), Test_Case => ("Example", Nominal), Test_Case => ("New Prefix Same Size", Nominal), Test_Case => ("New Prefix Longer", Nominal), Test_Case => ("New Prefix Shorter", Nominal), Test_Case => ("Slices", Nominal), Test_Case => ("Empty Prefix", Nominal), Test_Case => ("Empty New Prefix", Nominal), Test_Case => ("Empty Remainder", Nominal), Test_Case => ("Empty Prefix and New Prefix", Nominal), Test_Case => ("Empty Prefix and Remainder", Nominal), Test_Case => ("Empty New Prefix and Remainder", Nominal), Test_Case => ("All Empty", Nominal), Test_Case => ("String not start with Prefix, " & "Strlen larger than Prefix length", Robustness), Test_Case => ("String not start with Prefix, " & "Strlen equal to Prefix length", Robustness), Test_Case => ("String not start with Prefix, " & "Strlen smaller than Prefix length", Robustness); -- Replace 'Prefix' with 'New_Prefix' in 'String_With_Prefix'. -- @param String_With_Prefix String that starts with Prefix -- @param Prefix Prefix present in String_With_Prefix to be replaced -- by New_Prefix -- @param New_Prefix New Prefix to replace Prefix in String_With_Prefix -- @return Given that String_With_Prefix = Prefix & Remainder return is -- equal to New_Prefix & Remainder function Replace_All (Source, Pattern, Replacement : String) return String; -- Replace all occurrences of Pattern in Source by the given Replacement -- Note: Search order is left to right, matched parts are replace as a whole -- Example Replace_All ("InInInInIn, "InIn", "Out") = "OutOutIn" end Rejuvenation.String_Utils;
------------------------------------------------------------------------------ -- -- -- Copyright (c) 2014-2021 Vitalii Bondarenko <vibondare@gmail.com> -- -- -- ------------------------------------------------------------------------------ -- -- -- The MIT License (MIT) -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, sublicense, and/or sell copies of the Software, and to -- -- permit persons to whom the Software is furnished to do so, subject to -- -- the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -- -- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -- -- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -- -- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- ------------------------------------------------------------------------------ with System; use System; with Interfaces.C.Strings; use Interfaces.C.Strings; with Ada.Unchecked_Conversion; with Glib.Values; with Gtk.Arguments; use Gtk.Arguments; with Gtkada.Bindings; use Gtkada.Bindings; package body Notify.Notification is function Callback_To_Address is new Ada.Unchecked_Conversion (Notify_Action_Callback_Void, System.Address); function Callback_To_Address is new Ada.Unchecked_Conversion (G_Destroy_Notify_Address, System.Address); ---------------------------------- -- Notify_Notification_Get_Type -- ---------------------------------- function Notify_Notification_Get_Type return Glib.GType is function Internal return GType; pragma Import (C, Internal, "notify_notification_get_type"); begin return Internal; end Notify_Notification_Get_Type; ----------- -- G_New -- ----------- procedure G_New (Notification : out Notify_Notification; Summary : UTF8_String; Body_Text : UTF8_String := ""; Icon_Name : UTF8_String := "") is begin Notification := new Notify_Notification_Record; Initialize (Notification, Summary, Body_Text, Icon_Name); end G_New; ---------------- -- Initialize -- ---------------- procedure Initialize (Notification : not null access Notify_Notification_Record'Class; Summary : UTF8_String; Body_Text : UTF8_String; Icon_Name : UTF8_String) is function Internal (Summary : chars_ptr; Body_Text : chars_ptr; Icon_Name : chars_ptr) return System.Address; pragma Import (C, Internal, "notify_notification_new"); begin Notification.Set_Object (Internal (New_String (Summary), New_String (Body_Text), New_String (Icon_Name))); end Initialize; ------------ -- Update -- ------------ function Update (Notification : not null access Notify_Notification_Record; Summary : UTF8_String; Body_Text : UTF8_String := ""; Icon_Name : UTF8_String := "") return Boolean is function Internal (Notification : System.Address; Summary : chars_ptr; Body_Text : chars_ptr; Icon_Name : chars_ptr) return Gboolean; pragma Import (C, Internal, "notify_notification_update"); begin return 0 /= Internal (Notification.Get_Object, New_String (Summary), New_String (Body_Text), New_String (Icon_Name)); end Update; ---------- -- Show -- ---------- function Show (Notification : not null access Notify_Notification_Record; Error : access GError := null) return Boolean is function Internal (Notification : System.Address; Error : access GError) return Gboolean; pragma Import (C, Internal, "notify_notification_show"); begin return 0 /= Internal (Notification.Get_Object, Error); end Show; ----------------- -- Set_Timeout -- ----------------- procedure Set_Timeout (Notification : not null access Notify_Notification_Record; Timeout : Integer) is procedure Internal (Notification : System.Address; Timeout : Integer); pragma Import (C, Internal, "notify_notification_set_timeout"); begin Internal (Notification.Get_Object, Timeout); end Set_Timeout; ------------------ -- Set_Category -- ------------------ procedure Set_Category (Notification : not null access Notify_Notification_Record; Category : String) is procedure Internal (Notification : System.Address; Category : chars_ptr); pragma Import (C, Internal, "notify_notification_set_category"); begin Internal (Notification.Get_Object, New_String (Category)); end Set_Category; ----------------- -- Set_Urgency -- ----------------- procedure Set_Urgency (Notification : not null access Notify_Notification_Record; Urgency : Notify_Urgency) is procedure Internal (Notification : System.Address; Urgency : Notify_Urgency); pragma Import (C, Internal, "notify_notification_set_urgency"); begin Internal (Notification.Get_Object, Urgency); end Set_Urgency; --------------------------- -- Set_Image_From_Pixbuf -- --------------------------- procedure Set_Image_From_Pixbuf (Notification : not null access Notify_Notification_Record; Pixbuf : Gdk_Pixbuf) is procedure Internal (Notification : System.Address; Pixbuf : System.Address); pragma Import (C, Internal, "notify_notification_set_image_from_pixbuf"); begin Internal (Notification.Get_Object, Pixbuf.Get_Object); end Set_Image_From_Pixbuf; -------------- -- Set_Hint -- -------------- procedure Set_Hint (Notification : not null access Notify_Notification_Record; Key : String; Value : GVariant) is procedure Internal (Notification : System.Address; Key : chars_ptr; Value : System.Address); pragma Import (C, Internal, "notify_notification_set_hint"); begin Internal (Notification.Get_Object, New_String (Key), Value.Get_Object); end Set_Hint; ------------------ -- Set_App_Name -- ------------------ procedure Set_App_Name (Notification : not null access Notify_Notification_Record; App_Name : String) is procedure Internal (Notification : System.Address; App_Name : chars_ptr); pragma Import (C, Internal, "notify_notification_set_app_name"); begin Internal (Notification.Get_Object, New_String (App_Name)); end Set_App_Name; ----------------- -- Clear_Hints -- ----------------- procedure Clear_Hints (Notification : not null access Notify_Notification_Record) is procedure Internal (Notification : System.Address); pragma Import (C, Internal, "notify_notification_clear_hints"); begin Internal (Notification.Get_Object); end Clear_Hints; ---------------- -- Add_Action -- ---------------- function To_Notify_Action_Callback_Void is new Ada.Unchecked_Conversion (System.Address, Notify_Action_Callback_Void); function To_Address is new Ada.Unchecked_Conversion (Notify_Action_Callback_Void, System.Address); procedure C_Action_Cb (Notification : System.Address; Action : chars_ptr; User_Data : System.Address); pragma Convention (C, C_Action_Cb); procedure C_Action_Cb (Notification : System.Address; Action : chars_ptr; User_Data : System.Address) is Proc : constant Notify_Action_Callback_Void := To_Notify_Action_Callback_Void (User_Data); Stub_Notification : Notify_Notification_Record; begin Proc (Notify_Notification (Get_User_Data (Notification, Stub_Notification)), Value (Action)); end C_Action_Cb; procedure C_Notify_Notification_Add_Action (Notification : System.Address; Action : chars_ptr; Label : chars_ptr; Callback : System.Address; User_Data : System.Address; Free_Func : System.Address); pragma Import (C, C_Notify_Notification_Add_Action, "notify_notification_add_action"); procedure Add_Action (Notification : not null access Notify_Notification_Record; Action : UTF8_String; Label : UTF8_String; Callback : Notify_Action_Callback_Void) is begin C_Notify_Notification_Add_Action (Notification.Get_Object, New_String (Action), New_String (Label), C_Action_Cb'Address, To_Address (Callback), System.Null_Address); end Add_Action; ------------------- -- Clear_Actions -- ------------------- procedure Clear_Actions (Notification : not null access Notify_Notification_Record) is procedure Internal (Notification : System.Address); pragma Import (C, Internal, "notify_notification_clear_actions"); begin Internal (Notification.Get_Object); end Clear_Actions; ----------- -- Close -- ----------- function Close (Notification : not null access Notify_Notification_Record; Error : access GError := null) return Boolean is function Internal (Notification : System.Address; Error : access GError) return Gboolean; pragma Import (C, Internal, "notify_notification_close"); begin return 0 /= Internal (Notification.Get_Object, Error); end Close; ----------------------- -- Get_Closed_Reason -- ----------------------- function Get_Closed_Reason (Notification : not null access Notify_Notification_Record) return Integer is function Internal (Notification : System.Address) return Integer; pragma Import (C, Internal, "notify_notification_get_closed_reason"); begin return Internal (Notification.Get_Object); end Get_Closed_Reason; ---------------------------------- -- package Add_Action_User_Data -- ---------------------------------- package body Add_Action_User_Data is package Users is new Glib.Object.User_Data_Closure (User_Data_Type, Destroy); function To_Notify_Action_Callback_Void is new Ada.Unchecked_Conversion (System.Address, Notify_Action_Callback_Void); function To_Address is new Ada.Unchecked_Conversion (Notify_Action_Callback_Void, System.Address); procedure C_Action_Cb (Notification : System.Address; Action : chars_ptr; User_Data : System.Address); pragma Convention (C, C_Action_Cb); procedure C_Action_Cb (Notification : System.Address; Action : chars_ptr; User_Data : System.Address) is D : constant Users.Internal_Data_Access := Users.Convert (User_Data); Stub_Notification : Notify_Notification_Record; begin To_Notify_Action_Callback_Void (D.Func) (Notify_Notification (Get_User_Data (Notification, Stub_Notification)), Value (Action), D.Data.all); end C_Action_Cb; procedure Add_Action (Notification : not null access Notify_Notification_Record'Class; Action : UTF8_String; Label : UTF8_String; Callback : Notify_Action_Callback_Void; User_Data : User_Data_Type) is begin C_Notify_Notification_Add_Action (Notification.Get_Object, New_String (Action), New_String (Label), C_Action_Cb'Address, Users.Build (To_Address (Callback), User_Data), Users.Free_Data'Address); end Add_Action; end Add_Action_User_Data; ---------------------- -- Signal handling -- ---------------------- function Cb_To_Address is new Ada.Unchecked_Conversion (Cb_Notify_Notification_Void, System.Address); function Address_To_Cb is new Ada.Unchecked_Conversion (System.Address, Cb_Notify_Notification_Void); function Cb_To_Address is new Ada.Unchecked_Conversion (Cb_GObject_Void, System.Address); function Address_To_Cb is new Ada.Unchecked_Conversion (System.Address, Cb_GObject_Void); procedure Marsh_GObject_Void (Closure : GClosure; Return_Value : Glib.Values.GValue; N_Params : Glib.Guint; Params : Glib.Values.C_GValues; Invocation_Hint : System.Address; User_Data : System.Address); pragma Convention (C, Marsh_GObject_Void); procedure Marsh_Notify_Notification_Void (Closure : GClosure; Return_Value : Glib.Values.GValue; N_Params : Glib.Guint; Params : Glib.Values.C_GValues; Invocation_Hint : System.Address; User_Data : System.Address); pragma Convention (C, Marsh_Notify_Notification_Void); ------------------------ -- Marsh_GObject_Void -- ------------------------ procedure Marsh_GObject_Void (Closure : GClosure; Return_Value : Glib.Values.GValue; N_Params : Glib.Guint; Params : Glib.Values.C_GValues; Invocation_Hint : System.Address; User_Data : System.Address) is pragma Unreferenced (Return_Value, N_Params, Params, Invocation_Hint, User_Data); H : constant Cb_GObject_Void := Address_To_Cb (Get_Callback (Closure)); Obj : constant Glib.Object.GObject := Glib.Object.Convert (Get_Data (Closure)); begin H (Obj); exception when E : others => Process_Exception (E); end Marsh_GObject_Void; ------------------------------------ -- Marsh_Notify_Notification_Void -- ------------------------------------ procedure Marsh_Notify_Notification_Void (Closure : GClosure; Return_Value : Glib.Values.GValue; N_Params : Glib.Guint; Params : Glib.Values.C_GValues; Invocation_Hint : System.Address; User_Data : System.Address) is pragma Unreferenced (Return_Value, N_Params, Invocation_Hint, User_Data); H : constant Cb_Notify_Notification_Void := Address_To_Cb (Get_Callback (Closure)); Obj : constant Notify_Notification := Notify_Notification (Unchecked_To_Object (Params, 0)); begin H (Obj); exception when E : others => Process_Exception (E); end Marsh_Notify_Notification_Void; --------------- -- On_Closed -- --------------- procedure On_Closed (Self : not null access Notify_Notification_Record; Call : Cb_Notify_Notification_Void; After : Boolean := False) is begin Unchecked_Do_Signal_Connect (Object => Self, C_Name => Signal_Closed & ASCII.NUL, Marshaller => Marsh_Notify_Notification_Void'Access, Handler => Cb_To_Address (Call), Destroy => System.Null_Address, After => After, Slot_Object => null); end On_Closed; procedure On_Closed (Self : not null access Notify_Notification_Record; Call : Cb_GObject_Void; Slot : not null access Glib.Object.GObject_Record'Class; After : Boolean := False) is begin Unchecked_Do_Signal_Connect (Object => Self, C_Name => Signal_Closed & ASCII.NUL, Marshaller => Marsh_Notify_Notification_Void'Access, Handler => Cb_To_Address (Call), Destroy => System.Null_Address, After => After, Slot_Object => Slot); end On_Closed; end Notify.Notification;
generic type Input_Stream (<>) is limited private; -- Stream of bytes with procedure Get (Stream : in out Input_Stream; EOF : out Boolean; Byte : out Character) is <>; -- Try to read a byte from Stream. If the end of Stream was reached before -- we could read such a byte, just set EOF to True. Otherwise, set it to -- False and put the read character to Byte. Tab_Stop : Positive := 8; -- Maximal number of columns that tab characters (0x09) skip function TOML.Generic_Parse (Stream : in out Input_Stream) return TOML.Read_Result with Preelaborate; -- Read a TOML document from Stream and return the corresponding value
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with bits_types_struct_FILE_h; package bits_types_FILE_h is -- The opaque type of streams. This is the definition used elsewhere. subtype FILE is bits_types_struct_FILE_h.u_IO_FILE; -- /usr/include/bits/types/FILE.h:7 end bits_types_FILE_h;
------------------------------------------------------------------------------- -- LSE -- L-System Editor -- Author: Heziode -- -- License: -- MIT License -- -- Copyright (c) 2018 Quentin Dauprat (Heziode) <Heziode@protonmail.com> -- -- Permission is hereby granted, free of charge, to any person obtaining a -- copy of this software and associated documentation files (the "Software"), -- to deal in the Software without restriction, including without limitation -- the rights to use, copy, modify, merge, publish, distribute, sublicense, -- and/or sell copies of the Software, and to permit persons to whom the -- Software is furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------- with Ada.Characters.Latin_1; with Ada.Strings; with Ada.Strings.Fixed; with GNAT.Regpat; with LSE.Model.L_System.Error.Invalid_Rule; with LSE.Model.L_System.Error.Missing_Angle; with LSE.Model.L_System.Error.Missing_Axiom; with LSE.Model.L_System.Error.Missing_Restore; with LSE.Model.L_System.Error.Missing_Rule; with LSE.Model.L_System.Error.Missing_Save; with LSE.Model.L_System.Error.Not_A_Angle; with LSE.Model.L_System.Error.Unexpected_Character; with LSE.Model.L_System.Factory; package body LSE.Model.L_System.Concrete_Builder is package L renames Ada.Characters.Latin_1; package Pat renames GNAT.Regpat; procedure Initialize (This : out Instance) is Axiom : LSE.Model.Grammar.Symbol_Utils.P_List.List; Rules : LSE.Model.L_System.Growth_Rule_Utils.P_List.List; Error : Error_Vector.Vector; begin This := Instance '(Axiom, 0.0, Rules, Error); end Initialize; function Make (This : out Instance; Item : String) return Boolean is use Ada.Strings; use Ada.Strings.Fixed; -------------------------------- -- Constants, types, packages -- -------------------------------- Make_Error : exception; --------------- -- Variables -- --------------- V : String_Vector.Vector; Current_First : Positive; First, Last : Positive := 1; Found : Boolean; Error : Boolean := False; Line : Positive := 1; Input : Unbounded_String := To_Unbounded_String (Trim (Item, Both)); begin This.Initialize; -- If Item is empty, no L-System found if Item = "" then This.Error.Append (Missing_Angle.Initialize); raise Missing_Angle.Error; end if; -- Check syntax Parse (To_String (Input), L.LF & "", V); for Str of V loop Current_First := Str'First; First := 1; Last := 1; loop Search_For_Pattern (Regexp_Global, Str (Current_First .. Str'Last), First, Last, Found); exit when not Found; Error := True; This.Error. Append (Unexpected_Character.Initialize ( Line => Line, Column => First, Value => To_Unbounded_String (Str (First .. Last)))); Current_First := Last + 1; end loop; Line := Line + 1; end loop; if Error then raise Unexpected_Character.Error; end if; -- Check Save/Restore declare Counter : Integer := 0; Line_S, Column_S : Positive := 1; begin Line := 1; Check_Save_Restore : for Str of V loop Current_First := Str'First; First := 1; Last := 1; for C of Str loop if C = '[' then if Counter = 0 then Line_S := Line; Column_S := Current_First; end if; Counter := Counter + 1; elsif C = ']' then Counter := Counter - 1; if Counter < 0 then exit Check_Save_Restore; end if; end if; Current_First := Current_First + 1; end loop; Line := Line + 1; end loop Check_Save_Restore; if Counter < 0 then This.Error.Append (Missing_Restore.Initialize (Line, Current_First)); raise Missing_Restore.Error; elsif Counter > 0 then This.Error.Append (Missing_Save.Initialize (Line_S, Column_S)); raise Missing_Save.Error; end if; end; -- Clean String (removing CR,LF and useless space) V.Clear; Parse (To_String (Input), L.LF & "", V); Concat (Input, " ", V); V.Clear; Parse (To_String (Input), L.CR & "", V); Concat (Input, " ", V); Trim (Input, Both); Current_First := 1; loop if Element (Input, Current_First) = ' ' then if Current_First + 1 <= Length (Input) and then Element (Input, Current_First + 1) = ' ' then Delete (Input, Current_First, Current_First + 1); end if; end if; exit when Current_First = Length (Input); Current_First := Current_First + 1; end loop; V.Clear; -- Make angle if not Make_Angle (This, Input, First, Last) then raise Make_Error; end if; -- Make axiom if not Make_Axiom (This, Input, First, Last) then raise Make_Error; end if; -- Make rules if not Make_Rule (This, Input, First, Last) then raise Make_Error; end if; return True; exception when Missing_Angle.Error | Unexpected_Character.Error | Missing_Save.Error | Missing_Restore.Error | Make_Error => return False; end Make; function Get_Product (This : Instance; Turtle : LSE.Model.IO.Turtle_Utils.Holder) return L_System.Instance is LS : L_System.Instance; begin Initialize (LS, This.Axiom, This.Angle, This.Rules, Turtle); return LS; end Get_Product; procedure Get_Product (This : Instance; LS : out L_System.Instance; Turtle : LSE.Model.IO.Turtle_Utils.Holder) is begin Initialize (LS, This.Axiom, This.Angle, This.Rules, Turtle); end Get_Product; function Get_Error (This : Instance) return String is Str : Unbounded_String; begin for Error of This.Error loop Str := Str & Error.Get_Error & L.LF; end loop; return To_String (Str); end Get_Error; procedure Parse (Item : String; Separator : String; Vec : in out String_Vector.Vector) is use Ada.Strings.Fixed; i : constant Integer := Index (Item, Separator); begin if Item'Length > 0 then if i < Item'First then Vec.Append (Item); else Vec.Append (Item (Item'First .. i - 1)); Parse (To_String ( To_Unbounded_String (Item (i + 1 .. Item'Last))), L.LF & "", Vec); end if; end if; end Parse; procedure Concat (Item : out Unbounded_String; Separator : String; Vec : in out String_Vector.Vector) is Result : Unbounded_String := To_Unbounded_String (""); begin for Str of Vec loop Result := Result & Separator & To_Unbounded_String (Str); end loop; Item := Result; end Concat; procedure Search_For_Pattern (Expression, Search_In : String; First, Last : out Positive; Found : out Boolean) is Compiled_Expression : constant Pat.Pattern_Matcher := Pat.Compile (Expression); Result : Pat.Match_Array (0 .. 1); begin Pat.Match (Compiled_Expression, Search_In, Result); Found := not Pat."="(Result (1), Pat.No_Match); if Found then First := Result (1).First; Last := Result (1).Last; end if; end Search_For_Pattern; function Get_Next_Token (Item : out Unbounded_String; Last_Index : out Positive; First, Last : Positive) return Boolean is use Ada.Strings; begin Delete (Item, First, Last); Trim (Item, Left); if Item = "" then return False; end if; Last_Index := Length (Item); return True; end Get_Next_Token; function Make_Angle (This : out Instance; Input : Unbounded_String; First, Last : in out Positive) return Boolean is Last_Index : Positive; Found : Boolean; begin Last_Index := To_String (Input)'Last; Search_For_Pattern (Regexp_Angle, To_String (Input) (1 .. Last_Index), First, Last, Found); if not Found then This.Error.Append (Missing_Angle.Initialize); raise Missing_Angle.Error; return False; end if; if not Is_Angle (To_String (Input) (First .. Last)) then This.Error.Append (Not_A_Angle.Initialize); raise Not_A_Angle.Error; end if; This.Angle := Factory.Make_Angle (To_String (Input) (First .. Last)); return True; exception when Missing_Angle.Error | Not_A_Angle.Error => return False; end Make_Angle; function Make_Axiom (This : out Instance; Input : out Unbounded_String; First, Last : in out Positive) return Boolean is Last_Index : Positive; Found : Boolean; begin if not Get_Next_Token (Input, Last_Index, First, Last) then This.Error.Append (Missing_Axiom.Initialize); raise Missing_Axiom.Error; end if; Search_For_Pattern (Regexp_Axiom, To_String (Input) (1 .. Last_Index), First, Last, Found); if not Found then This.Error.Append (Missing_Axiom.Initialize); raise Missing_Axiom.Error; end if; This.Axiom := Factory.Make_Axiom (To_String (Input) (1 + First - 1 .. 1 + Last - 1)); return True; exception when Missing_Axiom.Error => return False; end Make_Axiom; function Make_Rule (This : out Instance; Input : out Unbounded_String; First, Last : in out Positive) return Boolean is use Ada.Strings; use Ada.Strings.Fixed; Last_Index : Positive; Found : Boolean := False; begin loop -- If it is the end of Input if not Get_Next_Token (Input, Last_Index, First, Last) then exit; end if; Search_For_Pattern (Regexp_Rule, To_String ( Input) (1 .. Last_Index), First, Last, Found); exit when not Found; declare Result : String (1 + First - 1 .. 1 + Last - 1); begin Result := To_String (Input) (1 + First - 1 .. 1 + Last - 1); This.Rules.Append (Factory.Make_Rule (Result (Result'First), Trim (Result (Result'First + 1 .. Result'Last), Both))); end; end loop; if not Found then if LSE.Model.L_System.Growth_Rule_Utils.P_List.Length (This.Rules) = 0 then This.Error.Append (Missing_Rule.Initialize); raise Missing_Rule.Error; else declare Result_Error : constant String := To_String (Input); First_I : constant Positive := Result_Error'First; Last_I : constant Positive := (if First_I + Invalid_Rule.Max_String_Length <= Result_Error'Last then First_I + Invalid_Rule.Max_String_Length else Result_Error'Last); begin This.Error.Append (Invalid_Rule.Initialize ( Result_Error (First_I .. Last_I))); end; raise Invalid_Rule.Error; end if; end if; return True; exception when Missing_Rule.Error | Invalid_Rule.Error => return False; end Make_Rule; end LSE.Model.L_System.Concrete_Builder;
----------------------------------------------------------------------- -- awa-wikis-beans -- Beans for module wikis -- Copyright (C) 2015, 2016, 2017, 2018, 2019, 2020 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Beans.Objects.Time; with Util.Strings; with ADO.Utils; with ADO.Queries; with ADO.Sessions; with ADO.Datasets; with ADO.Sessions.Entities; with ADO.Parameters; with ADO.Statements; with ASF.Applications.Messages.Factory; with AWA.Services; with AWA.Services.Contexts; with AWA.Tags.Modules; with AWA.Tags.Models; with AWA.Helpers.Selectors; with AWA.Images.Modules; with Wiki.Documents; with Wiki.Parsers; with Wiki.Filters.Html; with Wiki.Filters.Autolink; with Wiki.Filters.Collectors; with Wiki.Helpers; package body AWA.Wikis.Beans is package ASC renames AWA.Services.Contexts; procedure Make_Image_Link (Renderer : in out Wiki_Links_Bean; Link : in Wiki.Strings.WString; Info : in AWA.Wikis.Models.Wiki_Image_Info; URI : out Unbounded_Wide_Wide_String; Width : in out Natural; Height : in out Natural) is Sep : Natural; begin Sep := Wiki.Strings.Index (Link, "/"); URI := Renderer.Image_Prefix; Append (URI, Wiki.Strings.To_WString (Util.Strings.Image (Integer (Info.Id)))); Append (URI, "/"); if Width = 0 and Height = 0 then Append (URI, "default/"); elsif Width = Natural'Last or Height = Natural'Last then Append (URI, "original/"); else if Width /= 0 then Append (URI, Wiki.Strings.To_WString (Util.Strings.Image (Width))); end if; Append (URI, "x"); if Height /= 0 then Append (URI, Wiki.Strings.To_WString (Util.Strings.Image (Height))); end if; Append (URI, "/"); end if; if Sep = 0 then Append (URI, Link); else Append (URI, Link (Sep + 1 .. Link'Last)); end if; if not Info.Width.Is_Null and not Info.Height.Is_Null then AWA.Images.Modules.Scale (Width => Info.Width.Value, Height => Info.Height.Value, To_Width => Width, To_Height => Height); end if; end Make_Image_Link; procedure Find_Image_Link (Renderer : in out Wiki_Links_Bean; Link : in Wiki.Strings.WString; URI : out Unbounded_Wide_Wide_String; Width : in out Natural; Height : in out Natural) is Ctx : constant ASC.Service_Context_Access := ASC.Current; Session : ADO.Sessions.Session := ASC.Get_Session (Ctx); List : AWA.Wikis.Models.Wiki_Image_Info_Vector; Sep : Natural; Query : ADO.Queries.Context; Info : AWA.Wikis.Models.Wiki_Image_Info; begin Sep := Wiki.Strings.Index (Link, "/"); Query.Bind_Param ("wiki_id", Renderer.Wiki_Space_Id); if Sep = 0 then Query.Bind_Param ("folder_name", String '("Images")); Sep := Link'First - 1; else Query.Bind_Param ("folder_name", Wiki.Strings.To_String (Link (Link'First .. Sep - 1))); end if; Query.Bind_Param ("file_name", Wiki.Strings.To_String (Link (Sep + 1 .. Link'Last))); Query.Set_Query (AWA.Wikis.Models.Query_Wiki_Image); AWA.Wikis.Models.List (List, Session, Query); if not List.Is_Empty then Info := List.First_Element; else Info.Id := ADO.NO_IDENTIFIER; Info.Width.Is_Null := True; Info.Height.Is_Null := True; end if; Renderer.Images.Include (Link, Info); Renderer.Make_Image_Link (Link, Info, URI, Width, Height); end Find_Image_Link; -- ------------------------------ -- Get the image link that must be rendered from the wiki image link. -- ------------------------------ overriding procedure Make_Image_Link (Renderer : in out Wiki_Links_Bean; Link : in Wiki.Strings.WString; URI : out Unbounded_Wide_Wide_String; Width : in out Natural; Height : in out Natural) is Pos : Image_Info_Maps.Cursor; begin if Wiki.Helpers.Is_Url (Link) then URI := To_Unbounded_Wide_Wide_String (Link); else Pos := Renderer.Images.Find (Link); if Image_Info_Maps.Has_Element (Pos) then Renderer.Make_Image_Link (Link, Image_Info_Maps.Element (Pos), URI, Width, Height); else Renderer.Find_Image_Link (Link, URI, Width, Height); end if; end if; end Make_Image_Link; -- ------------------------------ -- Get the value identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Links_Bean; Name : in String) return Util.Beans.Objects.Object is begin if Name = "count" then return Util.Beans.Objects.To_Object (Integer (From.Images.Length)); else return Util.Beans.Objects.Null_Object; end if; end Get_Value; -- ------------------------------ -- Get the number of elements in the list. -- ------------------------------ overriding function Get_Count (From : Wiki_Links_Bean) return Natural is begin return Natural (From.Images.Length); end Get_Count; -- ------------------------------ -- Set the current row index. Valid row indexes start at 1. -- ------------------------------ overriding procedure Set_Row_Index (From : in out Wiki_Links_Bean; Index : in Natural) is begin if Index = 1 then From.Pos := From.Images.First; else Image_Info_Maps.Next (From.Pos); end if; From.Info := Image_Info_Maps.Element (From.Pos); From.Info_Bean := From.Info'Unchecked_Access; end Set_Row_Index; -- ------------------------------ -- Get the element at the current row index. -- ------------------------------ overriding function Get_Row (From : in Wiki_Links_Bean) return Util.Beans.Objects.Object is begin return Util.Beans.Objects.To_Object (Value => From.Info_Bean, Storage => Util.Beans.Objects.STATIC); end Get_Row; -- ------------------------------ -- Get the page link that must be rendered from the wiki page link. -- ------------------------------ overriding procedure Make_Page_Link (Renderer : in out Wiki_Links_Bean; Link : in Wiki.Strings.WString; URI : out Unbounded_Wide_Wide_String; Exists : out Boolean) is begin if Wiki.Helpers.Is_Url (Link) then URI := To_Unbounded_Wide_Wide_String (Link); else URI := Renderer.Page_Prefix; Append (URI, Link); end if; Exists := True; end Make_Page_Link; -- ------------------------------ -- Get the value identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Template_Bean; Name : in String) return Util.Beans.Objects.Object is begin if Name = "count" then return Util.Beans.Objects.To_Object (Natural (From.Templates.Length)); else return Util.Beans.Objects.Null_Object; end if; end Get_Value; -- ------------------------------ -- Get the number of elements in the list. -- ------------------------------ overriding function Get_Count (From : in Wiki_Template_Bean) return Natural is begin return Natural (From.Templates.Length); end Get_Count; -- ------------------------------ -- Set the current row index. Valid row indexes start at 1. -- ------------------------------ overriding procedure Set_Row_Index (From : in out Wiki_Template_Bean; Index : in Natural) is begin if Index = 1 then From.Pos := From.Templates.First; else Template_Maps.Next (From.Pos); end if; From.Info.Is_Public := False; From.Info.Id := ADO.NO_IDENTIFIER; From.Info.Name := Ada.Strings.Unbounded.To_Unbounded_String (Template_Maps.Key (From.Pos)); From.Info_Bean := From.Info'Unchecked_Access; end Set_Row_Index; -- ------------------------------ -- Get the element at the current row index. -- ------------------------------ overriding function Get_Row (From : in Wiki_Template_Bean) return Util.Beans.Objects.Object is begin return Util.Beans.Objects.To_Object (Value => From.Info_Bean, Storage => Util.Beans.Objects.STATIC); end Get_Row; -- ------------------------------ -- Get the template content for the plugin evaluation. -- ------------------------------ overriding procedure Get_Template (Plugin : in out Wiki_Template_Bean; Params : in out Wiki.Attributes.Attribute_List; Template : out Wiki.Strings.UString) is use Wiki.Strings; package ASC renames AWA.Services.Contexts; First : constant Wiki.Attributes.Cursor := Wiki.Attributes.First (Params); Name : constant String := "Template:" & Wiki.Attributes.Get_Value (First); Pos : constant Template_Maps.Cursor := Plugin.Templates.Find (Name); Query : ADO.Queries.Context; begin if Template_Maps.Has_Element (Pos) then Template := Template_Maps.Element (Pos); else Query.Bind_Param ("wiki_id", Plugin.Wiki_Space_Id); Query.Bind_Param ("name", Name); Query.Set_Query (AWA.Wikis.Models.Query_Wiki_Page_Content); declare Ctx : constant ASC.Service_Context_Access := ASC.Current; Session : constant ADO.Sessions.Session := ASC.Get_Session (Ctx); Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query); Result : Ada.Strings.Unbounded.Unbounded_String; begin Stmt.Execute; if Stmt.Has_Elements then Result := Stmt.Get_Unbounded_String (0); Template := Wiki.Strings.To_UString (To_WString (Ada.Strings.Unbounded.To_String (Result))); end if; Plugin.Templates.Include (Name, Template); end; end if; end Get_Template; -- ------------------------------ -- Find a plugin knowing its name. -- ------------------------------ overriding function Find (Factory : in Wiki_Template_Bean; Name : in String) return Wiki.Plugins.Wiki_Plugin_Access is begin if Name = "if" or Name = "else" or Name = "elsif" or Name = "end" then return Factory.Condition'Unrestricted_Access; elsif Name = "set" then return Factory.Variable'Unrestricted_Access; elsif Name = "list" then return Factory.List_Variable'Unrestricted_Access; else return Factory'Unrestricted_Access; end if; end Find; -- ------------------------------ -- Get the value identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_View_Bean; Name : in String) return Util.Beans.Objects.Object is use type ADO.Identifier; begin if Name = "is_visible" then if From.Is_Public.Is_Null or else From.Acl_Id /= ADO.NO_IDENTIFIER then return Util.Beans.Objects.To_Object (False); else return Util.Beans.Objects.To_Object (From.Is_Public.Value); end if; elsif Name = "wiki_id" then return ADO.Utils.To_Object (From.Wiki_Space.Get_Id); elsif Name = "tags" then return Util.Beans.Objects.To_Object (From.Tags_Bean, Util.Beans.Objects.STATIC); elsif Name = "links" then return Util.Beans.Objects.To_Object (From.Links_Bean, Util.Beans.Objects.STATIC); elsif Name = "plugins" then return Util.Beans.Objects.To_Object (From.Plugins_Bean, Util.Beans.Objects.STATIC); elsif Name = "counter" then return Util.Beans.Objects.To_Object (From.Counter_Bean, Util.Beans.Objects.STATIC); else return AWA.Wikis.Models.Wiki_View_Info (From).Get_Value (Name); end if; end Get_Value; -- ------------------------------ -- Set the wiki identifier. -- ------------------------------ procedure Set_Wiki_Id (Into : in out Wiki_View_Bean; Id : in ADO.Identifier) is S : constant Wide_Wide_String := ADO.Identifier'Wide_Wide_Image (Id); begin Into.Wiki_Space.Set_Id (Id); Into.Plugins.Wiki_Space_Id := Id; Into.Links.Wiki_Space_Id := Id; Into.Links.Page_Prefix := Into.Module.Get_Page_Prefix; Into.Links.Image_Prefix := Into.Module.Get_Image_Prefix; Append (Into.Links.Page_Prefix, S (S'First + 1 .. S'Last)); Append (Into.Links.Page_Prefix, "/"); Append (Into.Links.Image_Prefix, S (S'First + 1 .. S'Last)); Append (Into.Links.Image_Prefix, "/"); end Set_Wiki_Id; -- ------------------------------ -- Set the value identified by the name. -- ------------------------------ overriding procedure Set_Value (From : in out Wiki_View_Bean; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "wiki_id" then From.Set_Wiki_Id (ADO.Utils.To_Identifier (Value)); else AWA.Wikis.Models.Wiki_View_Info (From).Set_Value (Name, Value); end if; exception when Constraint_Error => From.Set_Wiki_Id (ADO.NO_IDENTIFIER); end Set_Value; -- ------------------------------ -- Get the wiki syntax for the page. -- ------------------------------ function Get_Syntax (From : in Wiki_View_Bean) return Wiki.Wiki_Syntax is begin case (if From.Format.Is_Null then From.Side_Format else From.Format.Value) is when Models.FORMAT_CREOLE => return Wiki.SYNTAX_CREOLE; when Models.FORMAT_MARKDOWN => return Wiki.SYNTAX_MARKDOWN; when Models.FORMAT_HTML => return Wiki.SYNTAX_HTML; when Models.FORMAT_DOTCLEAR => return Wiki.SYNTAX_DOTCLEAR; when Models.FORMAT_MEDIAWIKI => return Wiki.SYNTAX_MEDIA_WIKI; when Models.FORMAT_PHPBB => return Wiki.SYNTAX_PHPBB; end case; end Get_Syntax; -- ------------------------------ -- Load the information about the wiki page to display it. -- ------------------------------ overriding procedure Load (Bean : in out Wiki_View_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is pragma Unreferenced (Outcome); use type ADO.Identifier; package ASC renames AWA.Services.Contexts; Ctx : constant ASC.Service_Context_Access := ASC.Current; Session : ADO.Sessions.Session := ASC.Get_Session (Ctx); Query : ADO.Queries.Context; Name : constant Ada.Strings.Unbounded.Unbounded_String := Bean.Name.Value; begin if Bean.Wiki_Space.Is_Null then Outcome := Ada.Strings.Unbounded.To_Unbounded_String ("not-found"); return; end if; Query.Bind_Param ("wiki_id", Bean.Wiki_Space.Get_Id); if Bean.Id /= ADO.NO_IDENTIFIER then Query.Bind_Param ("id", Bean.Id); Query.Set_Query (AWA.Wikis.Models.Query_Wiki_Page_Id); else Query.Bind_Param ("name", Name); Query.Set_Query (AWA.Wikis.Models.Query_Wiki_Page); end if; Query.Bind_Param ("user_id", Ctx.Get_User_Identifier); ADO.Sessions.Entities.Bind_Param (Params => Query, Name => "entity_type", Table => AWA.Wikis.Models.WIKI_SPACE_TABLE, Session => Session); Bean.Load (Session, Query); if Bean.Id <= 0 or Bean.Is_Public.Is_Null then Bean.Name.Is_Null := False; Bean.Name.Value := Name; Bean.Title.Is_Null := False; Bean.Title.Value := Name; Outcome := Ada.Strings.Unbounded.To_Unbounded_String ("not-created"); elsif not Bean.Is_Public.Value and Bean.Acl_Id <= 0 then Outcome := Ada.Strings.Unbounded.To_Unbounded_String ("not-visible"); else -- Setup the wiki page read counter bean. ADO.Objects.Set_Value (Bean.Counter.Object, Bean.Id); Bean.Counter.Value := Bean.Read_Count.Value; -- Load the wiki page tags. Bean.Tags.Load_Tags (Session, Bean.Id); Outcome := Ada.Strings.Unbounded.To_Unbounded_String ("loaded"); if Ctx.Get_User_Identifier /= ADO.NO_IDENTIFIER then Bean.Plugins.Condition.Append ("user", ""); Bean.Plugins.Condition.Append ("authentified", ""); else Bean.Plugins.Condition.Append ("anonymous", ""); end if; if Bean.Is_Public.Value then Bean.Plugins.Condition.Append ("public", ""); else Bean.Plugins.Condition.Append ("private", ""); end if; end if; end Load; -- ------------------------------ -- Create the Wiki_View_Bean bean instance. -- ------------------------------ function Create_Wiki_View_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access is Object : constant Wiki_View_Bean_Access := new Wiki_View_Bean; begin Object.Module := Module; Object.Tags_Bean := Object.Tags'Access; Object.Tags.Set_Entity_Type (AWA.Wikis.Models.WIKI_PAGE_TABLE); Object.Tags.Set_Permission ("wiki-page-update"); Object.Counter_Bean := Object.Counter'Access; Object.Counter.Counter := AWA.Wikis.Modules.Read_Counter.Index; Object.Links_Bean := Object.Links'Access; Object.Plugins_Bean := Object.Plugins'Access; Object.Id := ADO.NO_IDENTIFIER; Object.Wiki_Space := Get_Wiki_Space_Bean ("adminWikiSpace"); -- Object.Wiki_Space_Id := ADO.NO_IDENTIFIER; return Object.all'Access; end Create_Wiki_View_Bean; function Create_From_Format is new AWA.Helpers.Selectors.Create_From_Enum (AWA.Wikis.Models.Format_Type, "wiki_format_"); -- ------------------------------ -- Get a select item list which contains a list of wiki formats. -- ------------------------------ function Create_Format_List_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access is pragma Unreferenced (Module); use AWA.Helpers; begin return Selectors.Create_Selector_Bean (Bundle => "wikis", Context => null, Create => Create_From_Format'Access).all'Access; end Create_Format_List_Bean; -- ------------------------------ -- Get the value identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Space_Bean; Name : in String) return Util.Beans.Objects.Object is begin if From.Is_Null then return Util.Beans.Objects.Null_Object; else return AWA.Wikis.Models.Wiki_Space_Bean (From).Get_Value (Name); end if; end Get_Value; -- ------------------------------ -- Set the value identified by the name. -- ------------------------------ overriding procedure Set_Value (From : in out Wiki_Space_Bean; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name /= "id" then AWA.Wikis.Models.Wiki_Space_Bean (From).Set_Value (Name, Value); elsif Name = "id" and not Util.Beans.Objects.Is_Empty (Value) then From.Module.Load_Wiki_Space (From, ADO.Utils.To_Identifier (Value)); end if; end Set_Value; -- ------------------------------ -- Create or save the wiki space. -- ------------------------------ overriding procedure Save (Bean : in out Wiki_Space_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is pragma Unreferenced (Outcome); begin if Bean.Is_Inserted then Bean.Module.Save_Wiki_Space (Bean); else Bean.Module.Create_Wiki_Space (Bean); end if; end Save; -- ------------------------------ -- Load the wiki space information. -- ------------------------------ overriding procedure Load (Bean : in out Wiki_Space_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is begin Bean.Module.Load_Wiki_Space (Bean, Bean.Get_Id); Outcome := Ada.Strings.Unbounded.To_Unbounded_String ("loaded"); end Load; -- Delete the wiki space. procedure Delete (Bean : in out Wiki_Space_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is begin null; end Delete; -- ------------------------------ -- Create the Wiki_Space_Bean bean instance. -- ------------------------------ function Create_Wiki_Space_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access is Object : constant Wiki_Space_Bean_Access := new Wiki_Space_Bean; begin Object.Module := Module; return Object.all'Access; end Create_Wiki_Space_Bean; -- ------------------------------ -- Get the value identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Page_Bean; Name : in String) return Util.Beans.Objects.Object is begin if Name = "wiki_id" then if From.Wiki_Space.Is_Null then return Util.Beans.Objects.Null_Object; else return ADO.Utils.To_Object (From.Wiki_Space.Get_Id); end if; elsif Name = "text" then if From.Has_Content then return Util.Beans.Objects.To_Object (From.New_Content); elsif From.Content.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (String '(From.Content.Get_Content)); end if; elsif Name = "date" then if From.Content.Is_Null then return Util.Beans.Objects.Null_Object; else return From.Content.Get_Value ("create_date"); end if; elsif Name = "format" then if not From.Content.Is_Null then return From.Content.Get_Value ("format"); elsif not From.Wiki_Space.Is_Null then return From.Wiki_Space.Get_Value ("format"); else return Util.Beans.Objects.Null_Object; end if; elsif Name = "comment" then if From.Content.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (String '(From.Content.Get_Save_Comment)); end if; elsif Name = "tags" then return Util.Beans.Objects.To_Object (From.Tags_Bean, Util.Beans.Objects.STATIC); elsif Name = "is_public" then if not From.Is_Null then return AWA.Wikis.Models.Wiki_Page_Bean (From).Get_Value (Name); elsif not From.Wiki_Space.Is_Null then return From.Wiki_Space.Get_Value (Name); else return Util.Beans.Objects.Null_Object; end if; elsif From.Is_Null then return Util.Beans.Objects.Null_Object; else return AWA.Wikis.Models.Wiki_Page_Bean (From).Get_Value (Name); end if; end Get_Value; -- ------------------------------ -- Set the value identified by the name. -- ------------------------------ overriding procedure Set_Value (From : in out Wiki_Page_Bean; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "id" then if not Util.Beans.Objects.Is_Empty (Value) then declare Id : constant ADO.Identifier := ADO.Utils.To_Identifier (Value); begin From.Module.Load_Page (From, From.Content, From.Tags, Id); end; end if; elsif Name = "wiki_id" then From.Wiki_Space.Set_Id (ADO.Utils.To_Identifier (Value)); elsif Name = "text" then From.Has_Content := True; From.New_Content := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "format" then From.Format := AWA.Wikis.Models.Format_Type_Objects.To_Value (Value); elsif Name = "comment" then From.New_Comment := Util.Beans.Objects.To_Unbounded_String (Value); From.Content.Set_Save_Comment (Util.Beans.Objects.To_String (Value)); else AWA.Wikis.Models.Wiki_Page_Bean (From).Set_Value (Name, Value); end if; exception when others => null; end Set_Value; -- ------------------------------ -- Returns True if the wiki page has a new text content and requires -- a new version to be created. -- ------------------------------ function Has_New_Content (Bean : in Wiki_Page_Bean) return Boolean is use type Ada.Strings.Unbounded.Unbounded_String; use type AWA.Wikis.Models.Format_Type; begin if not Bean.Is_Inserted then return True; elsif not Bean.Has_Content then return False; elsif Bean.Content.Get_Format /= Bean.Format then return True; else declare Current : constant Ada.Strings.Unbounded.Unbounded_String := Bean.Content.Get_Content; begin return Current /= Bean.New_Content; end; end if; end Has_New_Content; -- ------------------------------ -- Create or save the wiki page. -- ------------------------------ overriding procedure Save (Bean : in out Wiki_Page_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is use ASF.Applications; Result : ADO.Identifier; begin if not Bean.Is_Inserted then Bean.Content.Set_Content (Bean.New_Content); Bean.Content.Set_Save_Comment (Bean.New_Comment); Bean.Content.Set_Format (Bean.Format); Bean.Module.Create_Wiki_Page (Bean.Wiki_Space.all, Bean, Bean.Content); elsif not Bean.Has_New_Content then Bean.Module.Save (Bean); else Bean.Content := AWA.Wikis.Models.Null_Wiki_Content; Bean.Content.Set_Content (Bean.New_Content); Bean.Content.Set_Save_Comment (Bean.New_Comment); Bean.Content.Set_Format (Bean.Format); Bean.Module.Create_Wiki_Content (Bean, Bean.Content); end if; Result := Bean.Get_Id; Bean.Tags.Update_Tags (Result); Outcome := Ada.Strings.Unbounded.To_Unbounded_String ("success"); exception when AWA.Wikis.Modules.Name_Used => Messages.Factory.Add_Field_Message ("name", "wikis.wiki_page_name_used"); Outcome := Ada.Strings.Unbounded.To_Unbounded_String ("failure"); end Save; -- ------------------------------ -- Load the wiki page. -- ------------------------------ overriding procedure Load (Bean : in out Wiki_Page_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is begin Bean.Module.Load_Page (Bean, Bean.Content, Bean.Tags, Bean.Wiki_Space.Get_Id, Bean.Get_Name); Outcome := Ada.Strings.Unbounded.To_Unbounded_String ("loaded"); exception when ADO.Objects.NOT_FOUND => Outcome := Ada.Strings.Unbounded.To_Unbounded_String ("not-found"); end Load; -- ------------------------------ -- Setup the wiki page for the creation. -- ------------------------------ overriding procedure Setup (Bean : in out Wiki_Page_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is begin Bean.Module.Load_Wiki_Space (Bean.Wiki_Space.all, Bean.Wiki_Space.Get_Id); Outcome := Ada.Strings.Unbounded.To_Unbounded_String ("loaded"); exception when ADO.Objects.NOT_FOUND => Outcome := Ada.Strings.Unbounded.To_Unbounded_String ("not-found"); end Setup; -- ------------------------------ -- Delete the wiki page. -- ------------------------------ overriding procedure Delete (Bean : in out Wiki_Page_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is pragma Unreferenced (Outcome); begin Bean.Module.Delete (Bean); end Delete; -- ------------------------------ -- Create the Wiki_Page_Bean bean instance. -- ------------------------------ function Create_Wiki_Page_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access is Object : constant Wiki_Page_Bean_Access := new Wiki_Page_Bean; begin Object.Module := Module; Object.Tags_Bean := Object.Tags'Access; Object.Tags.Set_Entity_Type (AWA.Wikis.Models.WIKI_PAGE_TABLE); Object.Tags.Set_Permission ("wiki-page-update"); Object.Wiki_Space := Get_Wiki_Space_Bean ("adminWikiSpace"); return Object.all'Access; end Create_Wiki_Page_Bean; -- ------------------------------ -- Get the value identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_List_Bean; Name : in String) return Util.Beans.Objects.Object is Pos : Natural; begin if Name = "tags" then Pos := From.Pages.Get_Row_Index; if Pos = 0 then return Util.Beans.Objects.Null_Object; end if; declare Item : constant Models.Wiki_Page_Info := From.Pages.List.Element (Pos); begin return From.Tags.Get_Tags (Item.Id); end; elsif Name = "pages" then return Util.Beans.Objects.To_Object (Value => From.Pages_Bean, Storage => Util.Beans.Objects.STATIC); elsif Name = "tag" then return Util.Beans.Objects.To_Object (From.Tag); elsif Name = "page" then return Util.Beans.Objects.To_Object (From.Page); elsif Name = "sort" then return Util.Beans.Objects.To_Object (From.Sort); elsif Name = "count" then return Util.Beans.Objects.To_Object (From.Count); elsif Name = "page_count" then return Util.Beans.Objects.To_Object ((From.Count + From.Page_Size - 1) / From.Page_Size); elsif Name = "wiki_id" then return ADO.Utils.To_Object (From.Wiki_Id); elsif Name = "update_date" then if From.Pages.Get_Count = 0 then return Util.Beans.Objects.Null_Object; else declare Item : constant Models.Wiki_Page_Info := From.Pages.List.Element (1); begin return Util.Beans.Objects.Time.To_Object (Item.Create_Date); end; end if; else return From.Pages.Get_Value (Name); end if; end Get_Value; -- ------------------------------ -- Set the value identified by the name. -- ------------------------------ overriding procedure Set_Value (From : in out Wiki_List_Bean; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "tag" then From.Tag := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "page" and not Util.Beans.Objects.Is_Empty (Value) then From.Page := 1; From.Page := Util.Beans.Objects.To_Integer (Value); elsif Name = "wiki_id" and not Util.Beans.Objects.Is_Empty (Value) then From.Wiki_Id := ADO.NO_IDENTIFIER; From.Wiki_Id := ADO.Utils.To_Identifier (Value); elsif Name = "sort" and not Util.Beans.Objects.Is_Empty (Value) then From.Sort := Util.Beans.Objects.To_Unbounded_String (Value); end if; exception when Constraint_Error => null; end Set_Value; overriding procedure Load (From : in out Wiki_List_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is pragma Unreferenced (Outcome); begin From.Load_List; end Load; -- ------------------------------ -- Load the list of pages. If a tag was set, filter the list of pages with the tag. -- ------------------------------ procedure Load_List (Into : in out Wiki_List_Bean) is use AWA.Wikis.Models; use AWA.Services; use type Ada.Strings.Unbounded.Unbounded_String; use type ADO.Identifier; Ctx : constant Contexts.Service_Context_Access := AWA.Services.Contexts.Current; User : constant ADO.Identifier := Ctx.Get_User_Identifier; Session : ADO.Sessions.Session := ASC.Get_Session (Ctx); Query : ADO.Queries.Context; Count_Query : ADO.Queries.Context; Tag_Id : ADO.Identifier; First : constant Natural := (Into.Page - 1) * Into.Page_Size; Tag : constant String := Ada.Strings.Unbounded.To_String (Into.Tag); begin if Into.Wiki_Id = ADO.NO_IDENTIFIER then return; end if; Into.Wiki_Space.Set_Id (Into.Wiki_Id); if Tag'Length > 0 then AWA.Tags.Modules.Find_Tag_Id (Session, Tag, Tag_Id); if Tag_Id = ADO.NO_IDENTIFIER then return; end if; Query.Set_Query (AWA.Wikis.Models.Query_Wiki_Page_Tag_List); Query.Bind_Param (Name => "tag", Value => Tag_Id); Count_Query.Set_Count_Query (AWA.Wikis.Models.Query_Wiki_Page_Tag_List); Count_Query.Bind_Param (Name => "tag", Value => Tag_Id); ADO.Sessions.Entities.Bind_Param (Params => Query, Name => "page_table", Table => AWA.Wikis.Models.WIKI_PAGE_TABLE, Session => Session); ADO.Sessions.Entities.Bind_Param (Params => Count_Query, Name => "page_table", Table => AWA.Wikis.Models.WIKI_PAGE_TABLE, Session => Session); else Query.Set_Query (AWA.Wikis.Models.Query_Wiki_Page_List); Count_Query.Set_Count_Query (AWA.Wikis.Models.Query_Wiki_Page_List); end if; if Into.Sort = "name" then Query.Bind_Param (Name => "order1", Value => ADO.Parameters.Token '("page.name")); elsif Into.Sort = "recent" then Query.Bind_Param (Name => "order1", Value => ADO.Parameters.Token '("content.create_date DESC")); elsif Into.Sort = "popular" then Query.Bind_Param (Name => "order1", Value => ADO.Parameters.Token '("page.read_count DESC")); else return; end if; Query.Bind_Param (Name => "first", Value => First); Query.Bind_Param (Name => "count", Value => Into.Page_Size); Query.Bind_Param (Name => "wiki_id", Value => Into.Wiki_Id); Query.Bind_Param (Name => "user_id", Value => User); Count_Query.Bind_Param (Name => "wiki_id", Value => Into.Wiki_Id); Count_Query.Bind_Param (Name => "user_id", Value => User); ADO.Sessions.Entities.Bind_Param (Params => Query, Name => "table", Table => AWA.Wikis.Models.WIKI_SPACE_TABLE, Session => Session); ADO.Sessions.Entities.Bind_Param (Params => Count_Query, Name => "table", Table => AWA.Wikis.Models.WIKI_SPACE_TABLE, Session => Session); AWA.Wikis.Models.List (Into.Pages, Session, Query); Into.Count := ADO.Datasets.Get_Count (Session, Count_Query); declare List : ADO.Utils.Identifier_Vector; Iter : Wiki_Page_Info_Vectors.Cursor := Into.Pages.List.First; begin while Wiki_Page_Info_Vectors.Has_Element (Iter) loop List.Append (Wiki_Page_Info_Vectors.Element (Iter).Id); Wiki_Page_Info_Vectors.Next (Iter); end loop; Into.Tags.Load_Tags (Session, AWA.Wikis.Models.WIKI_PAGE_TABLE.Table.all, List); end; end Load_List; -- ------------------------------ -- Create the Wiki_List_Bean bean instance. -- ------------------------------ function Create_Wiki_List_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access is Object : constant Wiki_List_Bean_Access := new Wiki_List_Bean; begin Object.Module := Module; Object.Pages_Bean := Object.Pages'Access; Object.Page_Size := 20; Object.Page := 1; Object.Count := 0; Object.Wiki_Id := ADO.NO_IDENTIFIER; Object.Wiki_Space := Get_Wiki_Space_Bean ("adminWikiSpace"); return Object.all'Access; end Create_Wiki_List_Bean; -- ------------------------------ -- Get the value identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Version_List_Bean; Name : in String) return Util.Beans.Objects.Object is begin if Name = "versions" then return Util.Beans.Objects.To_Object (Value => From.Versions_Bean, Storage => Util.Beans.Objects.STATIC); elsif Name = "page_count" then return Util.Beans.Objects.To_Object ((From.Count + From.Page_Size - 1) / From.Page_Size); else return AWA.Wikis.Models.Wiki_Version_List_Bean (From).Get_Value (Name); end if; end Get_Value; -- ------------------------------ -- Set the value identified by the name. -- ------------------------------ overriding procedure Set_Value (From : in out Wiki_Version_List_Bean; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "page" and not Util.Beans.Objects.Is_Empty (Value) then From.Page := Util.Beans.Objects.To_Integer (Value); elsif Name = "wiki_id" and not Util.Beans.Objects.Is_Empty (Value) then From.Wiki_Id := ADO.NO_IDENTIFIER; From.Wiki_Id := ADO.Utils.To_Identifier (Value); elsif Name = "page_id" and not Util.Beans.Objects.Is_Empty (Value) then From.Page_Id := ADO.NO_IDENTIFIER; From.Page_Id := ADO.Utils.To_Identifier (Value); end if; exception when Constraint_Error => null; end Set_Value; overriding procedure Load (Into : in out Wiki_Version_List_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is use AWA.Wikis.Models; use AWA.Services; use type Ada.Strings.Unbounded.Unbounded_String; Ctx : constant Contexts.Service_Context_Access := AWA.Services.Contexts.Current; User : constant ADO.Identifier := Ctx.Get_User_Identifier; Session : ADO.Sessions.Session := ASC.Get_Session (Ctx); Query : ADO.Queries.Context; Count_Query : ADO.Queries.Context; First : constant Natural := (Into.Page - 1) * Into.Page_Size; Page : constant Wiki_View_Bean_Access := Get_Wiki_View_Bean ("wikiView"); begin -- Load the wiki page first. Page.Id := Into.Page_Id; Page.Set_Wiki_Id (Into.Wiki_Id); Page.Load (Outcome); if Outcome /= "loaded" then return; end if; Page.Wiki_Space.Set_Id (Into.Wiki_Id); -- Get the list of versions associated with the wiki page. Query.Set_Query (AWA.Wikis.Models.Query_Wiki_Version_List); Count_Query.Set_Count_Query (AWA.Wikis.Models.Query_Wiki_Version_List); Query.Bind_Param (Name => "first", Value => First); Query.Bind_Param (Name => "count", Value => Into.Page_Size); Query.Bind_Param (Name => "wiki_id", Value => Into.Wiki_Id); Query.Bind_Param (Name => "page_id", Value => Into.Page_Id); Query.Bind_Param (Name => "user_id", Value => User); Count_Query.Bind_Param (Name => "wiki_id", Value => Into.Wiki_Id); Count_Query.Bind_Param (Name => "page_id", Value => Into.Page_Id); Count_Query.Bind_Param (Name => "user_id", Value => User); ADO.Sessions.Entities.Bind_Param (Params => Query, Name => "table", Table => AWA.Wikis.Models.WIKI_SPACE_TABLE, Session => Session); ADO.Sessions.Entities.Bind_Param (Params => Count_Query, Name => "table", Table => AWA.Wikis.Models.WIKI_SPACE_TABLE, Session => Session); AWA.Wikis.Models.List (Into.Versions, Session, Query); Into.Count := ADO.Datasets.Get_Count (Session, Count_Query); end Load; -- ------------------------------ -- Create the Post_List_Bean bean instance. -- ------------------------------ function Create_Wiki_Version_List_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access is Object : constant Wiki_Version_List_Bean_Access := new Wiki_Version_List_Bean; begin Object.Module := Module; Object.Versions_Bean := Object.Versions'Access; Object.Page_Size := 20; Object.Page := 1; Object.Count := 0; Object.Wiki_Id := ADO.NO_IDENTIFIER; Object.Page_Id := ADO.NO_IDENTIFIER; return Object.all'Access; end Create_Wiki_Version_List_Bean; -- ------------------------------ -- Get the value identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Page_Info_Bean; Name : in String) return Util.Beans.Objects.Object is begin if Name = "words" then return Util.Beans.Objects.To_Object (Value => From.Words_Bean, Storage => Util.Beans.Objects.STATIC); elsif Name = "pages" then return Util.Beans.Objects.To_Object (Value => From.Links_Bean, Storage => Util.Beans.Objects.STATIC); elsif Name = "links" then return Util.Beans.Objects.To_Object (Value => From.Ext_Links_Bean, Storage => Util.Beans.Objects.STATIC); elsif Name = "images" then return Util.Beans.Objects.To_Object (Value => From.Page.Links_Bean, Storage => Util.Beans.Objects.STATIC); elsif Name = "templates" then return Util.Beans.Objects.To_Object (Value => From.Page.Plugins_Bean, Storage => Util.Beans.Objects.STATIC); elsif Name = "imageThumbnail" then declare URI : Ada.Strings.Wide_Wide_Unbounded.Unbounded_Wide_Wide_String; W : Natural := 64; H : Natural := 64; begin if Image_Info_Maps.Has_Element (From.Page.Links.Pos) then From.Page.Links.Make_Image_Link (Link => Image_Info_Maps.Key (From.Page.Links.Pos), Info => Image_Info_Maps.Element (From.Page.Links.Pos), URI => URI, Width => W, Height => H); end if; return Util.Beans.Objects.To_Object (URI); end; elsif Name = "imageTitle" then if Image_Info_Maps.Has_Element (From.Page.Links.Pos) then return Util.Beans.Objects.To_Object (Image_Info_Maps.Key (From.Page.Links.Pos)); else return Util.Beans.Objects.Null_Object; end if; else return AWA.Wikis.Models.Wiki_Page_Info_Bean (From).Get_Value (Name); end if; end Get_Value; -- ------------------------------ -- Set the value identified by the name. -- ------------------------------ overriding procedure Set_Value (From : in out Wiki_Page_Info_Bean; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "wiki_id" and not Util.Beans.Objects.Is_Empty (Value) then From.Wiki_Id := ADO.Utils.To_Identifier (Value); From.Page.Set_Wiki_Id (From.Wiki_Id); elsif Name = "page_id" and not Util.Beans.Objects.Is_Empty (Value) then From.Page_Id := ADO.Utils.To_Identifier (Value); From.Page.Id := From.Page_Id; end if; exception when Constraint_Error => From.Wiki_Id := ADO.NO_IDENTIFIER; From.Page_Id := ADO.NO_IDENTIFIER; end Set_Value; overriding procedure Load (Into : in out Wiki_Page_Info_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is use type Ada.Strings.Unbounded.Unbounded_String; begin -- Load the wiki page first. Into.Page.Load (Outcome); if Outcome /= "loaded" then return; end if; declare use Ada.Strings.Unbounded; Doc : Wiki.Documents.Document; Autolink : aliased Wiki.Filters.Autolink.Autolink_Filter; Images : aliased Wiki.Filters.Collectors.Image_Collector_Type; Links : aliased Wiki.Filters.Collectors.Link_Collector_Type; Words : aliased Wiki.Filters.Collectors.Word_Collector_Type; Filter : aliased Wiki.Filters.Html.Html_Filter_Type; Engine : Wiki.Parsers.Parser; procedure Collect_Word (Pos : in Wiki.Filters.Collectors.Cursor); procedure Collect_Link (Pos : in Wiki.Filters.Collectors.Cursor); procedure Collect_Image (Pos : in Wiki.Filters.Collectors.Cursor); procedure Collect_Word (Pos : in Wiki.Filters.Collectors.Cursor) is Word : constant Wiki.Strings.WString := Wiki.Filters.Collectors.WString_Maps.Key (Pos); Info : AWA.Tags.Models.Tag_Info; begin Info.Count := Wiki.Filters.Collectors.WString_Maps.Element (Pos); Info.Tag := To_Unbounded_String (Wiki.Strings.To_String (Word)); Into.Words.List.Append (Info); end Collect_Word; procedure Collect_Link (Pos : in Wiki.Filters.Collectors.Cursor) is Link : constant Wiki.Strings.WString := Wiki.Filters.Collectors.WString_Maps.Key (Pos); Info : AWA.Tags.Models.Tag_Info; begin Info.Count := Wiki.Filters.Collectors.WString_Maps.Element (Pos); Info.Tag := To_Unbounded_String (Wiki.Strings.To_String (Link)); if Wiki.Helpers.Is_Url (Link) then Into.Ext_Links.List.Append (Info); else Into.Links.List.Append (Info); end if; end Collect_Link; procedure Collect_Image (Pos : in Wiki.Filters.Collectors.Cursor) is Image : constant Wiki.Strings.WString := Wiki.Filters.Collectors.WString_Maps.Key (Pos); URI : Wiki.Strings.UString; W, H : Natural := 0; begin Into.Page.Links.Make_Image_Link (Link => Image, URI => URI, Width => W, Height => H); end Collect_Image; Content : constant String := To_String (Into.Page.Content.Value); begin Engine.Add_Filter (Words'Unchecked_Access); Engine.Add_Filter (Links'Unchecked_Access); Engine.Add_Filter (Images'Unchecked_Access); Engine.Add_Filter (Autolink'Unchecked_Access); Engine.Add_Filter (Filter'Unchecked_Access); Engine.Set_Syntax (Into.Page.Get_Syntax); Engine.Set_Plugin_Factory (Into.Page.Plugins'Access); Engine.Parse (Content, Doc); Words.Iterate (Collect_Word'Access); Links.Iterate (Collect_Link'Access); Images.Iterate (Collect_Image'Access); end; end Load; -- ------------------------------ -- Create the Wiki_Page_Info_Bean bean instance. -- ------------------------------ function Create_Wiki_Page_Info_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access is Object : constant Wiki_Page_Info_Bean_Access := new Wiki_Page_Info_Bean; begin Object.Module := Module; Object.Words_Bean := Object.Words'Access; Object.Links_Bean := Object.Links'Access; Object.Ext_Links_Bean := Object.Ext_Links'Access; Object.Page := Get_Wiki_View_Bean ("wikiView"); return Object.all'Access; end Create_Wiki_Page_Info_Bean; -- ------------------------------ -- Get the value identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Image_Info_Bean; Name : in String) return Util.Beans.Objects.Object is begin if Name = "wiki_id" then return ADO.Utils.To_Object (From.Wiki_Id); elsif Name = "page_id" then return ADO.Utils.To_Object (From.Page.Id); elsif Name = "folder_name" then return Util.Beans.Objects.To_Object (From.Folder_Name); elsif Name = "name" then return Util.Beans.Objects.To_Object (From.Name); elsif Name = "list" then return Util.Beans.Objects.To_Object (Value => From.List_Bean, Storage => Util.Beans.Objects.STATIC); elsif Name = "imageUrl" then declare Pos : constant Natural := From.List_Bean.Get_Row_Index; Info : AWA.Wikis.Models.Wiki_Image_Info; URI : Ada.Strings.Wide_Wide_Unbounded.Unbounded_Wide_Wide_String; W : Natural := 0; H : Natural := 0; Name : constant String := Ada.Strings.Unbounded.To_String (From.Name); WName : constant Wiki.Strings.WString := Wiki.Strings.To_WString (Name); begin if Pos < From.List_Bean.Get_Count then Info := From.List_Bean.List.Element (Pos); if not Info.Width.Is_Null and not Info.Height.Is_Null then W := Info.Width.Value; H := Info.Height.Value; end if; end if; Info.Id := From.Id; Info.Width := From.Width; Info.Height := From.Height; From.Page.Links.Make_Image_Link (Link => WName, Info => Info, URI => URI, Width => W, Height => H); return Util.Beans.Objects.To_Object (URI); end; else return Models.Wiki_Image_Bean (From).Get_Value (Name); end if; end Get_Value; -- ------------------------------ -- Set the value identified by the name. -- ------------------------------ overriding procedure Set_Value (From : in out Wiki_Image_Info_Bean; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "wiki_id" and not Util.Beans.Objects.Is_Empty (Value) then From.Wiki_Id := ADO.NO_IDENTIFIER; From.Wiki_Id := ADO.Utils.To_Identifier (Value); From.Page.Set_Wiki_Id (From.Wiki_Id); elsif Name = "folder_name" then From.Folder_Name := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "name" then From.Name := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "page_id" and not Util.Beans.Objects.Is_Empty (Value) then From.Page_Id := ADO.NO_IDENTIFIER; From.Page_Id := ADO.Utils.To_Identifier (Value); From.Page.Id := From.Page_Id; else Models.Wiki_Image_Bean (From).Set_Value (Name, Value); end if; exception when Constraint_Error => null; end Set_Value; -- ------------------------------ -- Load the information about the image. -- ------------------------------ overriding procedure Load (Into : in out Wiki_Image_Info_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is use type ADO.Identifier; use type Ada.Containers.Count_Type; use type Ada.Strings.Unbounded.Unbounded_String; Ctx : constant ASC.Service_Context_Access := ASC.Current; Session : ADO.Sessions.Session := ASC.Get_Session (Ctx); Query : ADO.Queries.Context; begin -- Load the wiki page first. Into.Page.Load (Outcome); if Outcome /= "loaded" then return; end if; -- Get the list of versions associated with the wiki page. Query.Set_Query (AWA.Wikis.Models.Query_Wiki_Image); Query.Bind_Param (Name => "file_name", Value => Into.Name); Query.Bind_Param (Name => "folder_name", Value => Into.Folder_Name); Query.Bind_Param (Name => "wiki_id", Value => Into.Wiki_Id); AWA.Wikis.Models.List (Into.List, Session, Query); if Into.List.List.Length > 0 then declare Img : constant AWA.Wikis.Models.Wiki_Image_Info := Into.List.List.First_Element; begin if Img.Id > 0 then Into.Id := Img.Id; Into.Mime_Type := Img.Mime_Type; Into.Storage := Img.Storage; Into.File_Size := Img.File_Size; Into.Create_Date := Img.Create_Date; Into.Width := Img.Width; Into.Height := Img.Height; end if; Into.Folder_Id := Img.Folder_Id; end; end if; end Load; -- ------------------------------ -- Create the Wiki_Image_Info_BEan bean instance. -- ------------------------------ function Create_Wiki_Image_Info_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access is Object : constant Wiki_Image_Info_Bean_Access := new Wiki_Image_Info_Bean; begin Object.Module := Module; Object.List_Bean := Object.List'Access; Object.Page := Get_Wiki_View_Bean ("wikiView"); Object.Id := ADO.NO_IDENTIFIER; Object.Folder_Id := ADO.NO_IDENTIFIER; Object.Width := (Is_Null => True, Value => 0); Object.Height := (Is_Null => True, Value => 0); return Object.all'Access; end Create_Wiki_Image_Info_Bean; -- ------------------------------ -- Load the list of wikis. -- ------------------------------ procedure Load_Wikis (List : in Wiki_Admin_Bean) is use AWA.Wikis.Models; use AWA.Services; Ctx : constant Contexts.Service_Context_Access := AWA.Services.Contexts.Current; User : constant ADO.Identifier := Ctx.Get_User_Identifier; Session : ADO.Sessions.Session := ASC.Get_Session (Ctx); Query : ADO.Queries.Context; begin Query.Set_Query (AWA.Wikis.Models.Query_Wiki_List); Query.Bind_Param ("user_id", User); ADO.Sessions.Entities.Bind_Param (Params => Query, Name => "table", Table => AWA.Wikis.Models.WIKI_SPACE_TABLE, Session => Session); AWA.Wikis.Models.List (List.Wiki_List_Bean.all, Session, Query); List.Flags (INIT_WIKI_LIST) := True; end Load_Wikis; -- ------------------------------ -- Get the wiki space identifier. -- ------------------------------ function Get_Wiki_Id (List : in Wiki_Admin_Bean) return ADO.Identifier is use type ADO.Identifier; begin if List.Wiki_Id = ADO.NO_IDENTIFIER then if not List.Flags (INIT_WIKI_LIST) then Load_Wikis (List); end if; if not List.Wiki_List.List.Is_Empty then return List.Wiki_List.List.Element (1).Id; end if; end if; return List.Wiki_Id; end Get_Wiki_Id; overriding function Get_Value (List : in Wiki_Admin_Bean; Name : in String) return Util.Beans.Objects.Object is begin if Name = "wikis" then if not List.Init_Flags (INIT_WIKI_LIST) then Load_Wikis (List); end if; return Util.Beans.Objects.To_Object (Value => List.Wiki_List_Bean, Storage => Util.Beans.Objects.STATIC); elsif Name = "id" then declare use type ADO.Identifier; Id : constant ADO.Identifier := List.Get_Wiki_Id; begin if Id = ADO.NO_IDENTIFIER then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (Long_Long_Integer (Id)); end if; end; else return Util.Beans.Objects.Null_Object; end if; end Get_Value; -- ------------------------------ -- Set the value identified by the name. -- ------------------------------ overriding procedure Set_Value (From : in out Wiki_Admin_Bean; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "id" and not Util.Beans.Objects.Is_Empty (Value) then From.Wiki_Id := ADO.NO_IDENTIFIER; From.Wiki_Id := ADO.Utils.To_Identifier (Value); end if; exception when Constraint_Error => null; end Set_Value; -- ------------------------------ -- Create the Wiki_Admin_Bean bean instance. -- ------------------------------ function Create_Wiki_Admin_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access is Object : constant Wiki_Admin_Bean_Access := new Wiki_Admin_Bean; begin Object.Module := Module; Object.Flags := Object.Init_Flags'Access; Object.Wiki_List_Bean := Object.Wiki_List'Access; return Object.all'Access; end Create_Wiki_Admin_Bean; end AWA.Wikis.Beans;
pragma Style_Checks (Off); -- This spec has been automatically generated from STM32H743x.svd pragma Restrictions (No_Elaboration_Code); with HAL; with System; package STM32_SVD.MDIOS is pragma Preelaborate; --------------- -- Registers -- --------------- subtype CR_PORT_ADDRESS_Field is HAL.UInt5; -- MDIOS configuration register type CR_Register is record -- Peripheral enable EN : Boolean := False; -- Register write interrupt enable WRIE : Boolean := False; -- Register Read Interrupt Enable RDIE : Boolean := False; -- Error interrupt enable EIE : Boolean := False; -- unspecified Reserved_4_6 : HAL.UInt3 := 16#0#; -- Disable Preamble Check DPC : Boolean := False; -- Slaves's address PORT_ADDRESS : CR_PORT_ADDRESS_Field := 16#0#; -- unspecified Reserved_13_31 : HAL.UInt19 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CR_Register use record EN at 0 range 0 .. 0; WRIE at 0 range 1 .. 1; RDIE at 0 range 2 .. 2; EIE at 0 range 3 .. 3; Reserved_4_6 at 0 range 4 .. 6; DPC at 0 range 7 .. 7; PORT_ADDRESS at 0 range 8 .. 12; Reserved_13_31 at 0 range 13 .. 31; end record; -- MDIOS status register type SR_Register is record -- Read-only. Preamble error flag PERF : Boolean; -- Read-only. Start error flag SERF : Boolean; -- Read-only. Turnaround error flag TERF : Boolean; -- unspecified Reserved_3_31 : HAL.UInt29; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for SR_Register use record PERF at 0 range 0 .. 0; SERF at 0 range 1 .. 1; TERF at 0 range 2 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; -- MDIOS clear flag register type CLRFR_Register is record -- Clear the preamble error flag CPERF : Boolean := False; -- Clear the start error flag CSERF : Boolean := False; -- Clear the turnaround error flag CTERF : Boolean := False; -- unspecified Reserved_3_31 : HAL.UInt29 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CLRFR_Register use record CPERF at 0 range 0 .. 0; CSERF at 0 range 1 .. 1; CTERF at 0 range 2 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; subtype DINR0_DIN0_Field is HAL.UInt16; -- MDIOS input data register 0 type DINR0_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN0 : DINR0_DIN0_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR0_Register use record DIN0 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR1_DIN1_Field is HAL.UInt16; -- MDIOS input data register 1 type DINR1_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN1 : DINR1_DIN1_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR1_Register use record DIN1 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR2_DIN2_Field is HAL.UInt16; -- MDIOS input data register 2 type DINR2_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN2 : DINR2_DIN2_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR2_Register use record DIN2 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR3_DIN3_Field is HAL.UInt16; -- MDIOS input data register 3 type DINR3_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN3 : DINR3_DIN3_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR3_Register use record DIN3 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR4_DIN4_Field is HAL.UInt16; -- MDIOS input data register 4 type DINR4_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN4 : DINR4_DIN4_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR4_Register use record DIN4 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR5_DIN5_Field is HAL.UInt16; -- MDIOS input data register 5 type DINR5_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN5 : DINR5_DIN5_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR5_Register use record DIN5 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR6_DIN6_Field is HAL.UInt16; -- MDIOS input data register 6 type DINR6_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN6 : DINR6_DIN6_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR6_Register use record DIN6 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR7_DIN7_Field is HAL.UInt16; -- MDIOS input data register 7 type DINR7_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN7 : DINR7_DIN7_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR7_Register use record DIN7 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR8_DIN8_Field is HAL.UInt16; -- MDIOS input data register 8 type DINR8_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN8 : DINR8_DIN8_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR8_Register use record DIN8 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR9_DIN9_Field is HAL.UInt16; -- MDIOS input data register 9 type DINR9_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN9 : DINR9_DIN9_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR9_Register use record DIN9 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR10_DIN10_Field is HAL.UInt16; -- MDIOS input data register 10 type DINR10_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN10 : DINR10_DIN10_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR10_Register use record DIN10 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR11_DIN11_Field is HAL.UInt16; -- MDIOS input data register 11 type DINR11_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN11 : DINR11_DIN11_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR11_Register use record DIN11 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR12_DIN12_Field is HAL.UInt16; -- MDIOS input data register 12 type DINR12_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN12 : DINR12_DIN12_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR12_Register use record DIN12 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR13_DIN13_Field is HAL.UInt16; -- MDIOS input data register 13 type DINR13_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN13 : DINR13_DIN13_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR13_Register use record DIN13 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR14_DIN14_Field is HAL.UInt16; -- MDIOS input data register 14 type DINR14_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN14 : DINR14_DIN14_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR14_Register use record DIN14 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR15_DIN15_Field is HAL.UInt16; -- MDIOS input data register 15 type DINR15_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN15 : DINR15_DIN15_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR15_Register use record DIN15 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR16_DIN16_Field is HAL.UInt16; -- MDIOS input data register 16 type DINR16_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN16 : DINR16_DIN16_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR16_Register use record DIN16 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR17_DIN17_Field is HAL.UInt16; -- MDIOS input data register 17 type DINR17_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN17 : DINR17_DIN17_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR17_Register use record DIN17 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR18_DIN18_Field is HAL.UInt16; -- MDIOS input data register 18 type DINR18_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN18 : DINR18_DIN18_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR18_Register use record DIN18 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR19_DIN19_Field is HAL.UInt16; -- MDIOS input data register 19 type DINR19_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN19 : DINR19_DIN19_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR19_Register use record DIN19 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR20_DIN20_Field is HAL.UInt16; -- MDIOS input data register 20 type DINR20_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN20 : DINR20_DIN20_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR20_Register use record DIN20 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR21_DIN21_Field is HAL.UInt16; -- MDIOS input data register 21 type DINR21_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN21 : DINR21_DIN21_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR21_Register use record DIN21 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR22_DIN22_Field is HAL.UInt16; -- MDIOS input data register 22 type DINR22_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN22 : DINR22_DIN22_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR22_Register use record DIN22 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR23_DIN23_Field is HAL.UInt16; -- MDIOS input data register 23 type DINR23_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN23 : DINR23_DIN23_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR23_Register use record DIN23 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR24_DIN24_Field is HAL.UInt16; -- MDIOS input data register 24 type DINR24_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN24 : DINR24_DIN24_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR24_Register use record DIN24 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR25_DIN25_Field is HAL.UInt16; -- MDIOS input data register 25 type DINR25_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN25 : DINR25_DIN25_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR25_Register use record DIN25 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR26_DIN26_Field is HAL.UInt16; -- MDIOS input data register 26 type DINR26_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN26 : DINR26_DIN26_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR26_Register use record DIN26 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR27_DIN27_Field is HAL.UInt16; -- MDIOS input data register 27 type DINR27_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN27 : DINR27_DIN27_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR27_Register use record DIN27 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR28_DIN28_Field is HAL.UInt16; -- MDIOS input data register 28 type DINR28_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN28 : DINR28_DIN28_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR28_Register use record DIN28 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR29_DIN29_Field is HAL.UInt16; -- MDIOS input data register 29 type DINR29_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN29 : DINR29_DIN29_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR29_Register use record DIN29 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR30_DIN30_Field is HAL.UInt16; -- MDIOS input data register 30 type DINR30_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN30 : DINR30_DIN30_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR30_Register use record DIN30 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DINR31_DIN31_Field is HAL.UInt16; -- MDIOS input data register 31 type DINR31_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN31 : DINR31_DIN31_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DINR31_Register use record DIN31 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR0_DOUT0_Field is HAL.UInt16; -- MDIOS output data register 0 type DOUTR0_Register is record -- Output data sent to MDIO Master during read frames DOUT0 : DOUTR0_DOUT0_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR0_Register use record DOUT0 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR1_DOUT1_Field is HAL.UInt16; -- MDIOS output data register 1 type DOUTR1_Register is record -- Output data sent to MDIO Master during read frames DOUT1 : DOUTR1_DOUT1_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR1_Register use record DOUT1 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR2_DOUT2_Field is HAL.UInt16; -- MDIOS output data register 2 type DOUTR2_Register is record -- Output data sent to MDIO Master during read frames DOUT2 : DOUTR2_DOUT2_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR2_Register use record DOUT2 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR3_DOUT3_Field is HAL.UInt16; -- MDIOS output data register 3 type DOUTR3_Register is record -- Output data sent to MDIO Master during read frames DOUT3 : DOUTR3_DOUT3_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR3_Register use record DOUT3 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR4_DOUT4_Field is HAL.UInt16; -- MDIOS output data register 4 type DOUTR4_Register is record -- Output data sent to MDIO Master during read frames DOUT4 : DOUTR4_DOUT4_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR4_Register use record DOUT4 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR5_DOUT5_Field is HAL.UInt16; -- MDIOS output data register 5 type DOUTR5_Register is record -- Output data sent to MDIO Master during read frames DOUT5 : DOUTR5_DOUT5_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR5_Register use record DOUT5 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR6_DOUT6_Field is HAL.UInt16; -- MDIOS output data register 6 type DOUTR6_Register is record -- Output data sent to MDIO Master during read frames DOUT6 : DOUTR6_DOUT6_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR6_Register use record DOUT6 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR7_DOUT7_Field is HAL.UInt16; -- MDIOS output data register 7 type DOUTR7_Register is record -- Output data sent to MDIO Master during read frames DOUT7 : DOUTR7_DOUT7_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR7_Register use record DOUT7 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR8_DOUT8_Field is HAL.UInt16; -- MDIOS output data register 8 type DOUTR8_Register is record -- Output data sent to MDIO Master during read frames DOUT8 : DOUTR8_DOUT8_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR8_Register use record DOUT8 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR9_DOUT9_Field is HAL.UInt16; -- MDIOS output data register 9 type DOUTR9_Register is record -- Output data sent to MDIO Master during read frames DOUT9 : DOUTR9_DOUT9_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR9_Register use record DOUT9 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR10_DOUT10_Field is HAL.UInt16; -- MDIOS output data register 10 type DOUTR10_Register is record -- Output data sent to MDIO Master during read frames DOUT10 : DOUTR10_DOUT10_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR10_Register use record DOUT10 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR11_DOUT11_Field is HAL.UInt16; -- MDIOS output data register 11 type DOUTR11_Register is record -- Output data sent to MDIO Master during read frames DOUT11 : DOUTR11_DOUT11_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR11_Register use record DOUT11 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR12_DOUT12_Field is HAL.UInt16; -- MDIOS output data register 12 type DOUTR12_Register is record -- Output data sent to MDIO Master during read frames DOUT12 : DOUTR12_DOUT12_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR12_Register use record DOUT12 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR13_DOUT13_Field is HAL.UInt16; -- MDIOS output data register 13 type DOUTR13_Register is record -- Output data sent to MDIO Master during read frames DOUT13 : DOUTR13_DOUT13_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR13_Register use record DOUT13 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR14_DOUT14_Field is HAL.UInt16; -- MDIOS output data register 14 type DOUTR14_Register is record -- Output data sent to MDIO Master during read frames DOUT14 : DOUTR14_DOUT14_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR14_Register use record DOUT14 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR15_DOUT15_Field is HAL.UInt16; -- MDIOS output data register 15 type DOUTR15_Register is record -- Output data sent to MDIO Master during read frames DOUT15 : DOUTR15_DOUT15_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR15_Register use record DOUT15 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR16_DOUT16_Field is HAL.UInt16; -- MDIOS output data register 16 type DOUTR16_Register is record -- Output data sent to MDIO Master during read frames DOUT16 : DOUTR16_DOUT16_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR16_Register use record DOUT16 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR17_DOUT17_Field is HAL.UInt16; -- MDIOS output data register 17 type DOUTR17_Register is record -- Output data sent to MDIO Master during read frames DOUT17 : DOUTR17_DOUT17_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR17_Register use record DOUT17 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR18_DOUT18_Field is HAL.UInt16; -- MDIOS output data register 18 type DOUTR18_Register is record -- Output data sent to MDIO Master during read frames DOUT18 : DOUTR18_DOUT18_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR18_Register use record DOUT18 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR19_DOUT19_Field is HAL.UInt16; -- MDIOS output data register 19 type DOUTR19_Register is record -- Output data sent to MDIO Master during read frames DOUT19 : DOUTR19_DOUT19_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR19_Register use record DOUT19 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR20_DOUT20_Field is HAL.UInt16; -- MDIOS output data register 20 type DOUTR20_Register is record -- Output data sent to MDIO Master during read frames DOUT20 : DOUTR20_DOUT20_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR20_Register use record DOUT20 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR21_DOUT21_Field is HAL.UInt16; -- MDIOS output data register 21 type DOUTR21_Register is record -- Output data sent to MDIO Master during read frames DOUT21 : DOUTR21_DOUT21_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR21_Register use record DOUT21 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR22_DOUT22_Field is HAL.UInt16; -- MDIOS output data register 22 type DOUTR22_Register is record -- Output data sent to MDIO Master during read frames DOUT22 : DOUTR22_DOUT22_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR22_Register use record DOUT22 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR23_DOUT23_Field is HAL.UInt16; -- MDIOS output data register 23 type DOUTR23_Register is record -- Output data sent to MDIO Master during read frames DOUT23 : DOUTR23_DOUT23_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR23_Register use record DOUT23 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR24_DOUT24_Field is HAL.UInt16; -- MDIOS output data register 24 type DOUTR24_Register is record -- Output data sent to MDIO Master during read frames DOUT24 : DOUTR24_DOUT24_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR24_Register use record DOUT24 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR25_DOUT25_Field is HAL.UInt16; -- MDIOS output data register 25 type DOUTR25_Register is record -- Output data sent to MDIO Master during read frames DOUT25 : DOUTR25_DOUT25_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR25_Register use record DOUT25 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR26_DOUT26_Field is HAL.UInt16; -- MDIOS output data register 26 type DOUTR26_Register is record -- Output data sent to MDIO Master during read frames DOUT26 : DOUTR26_DOUT26_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR26_Register use record DOUT26 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR27_DOUT27_Field is HAL.UInt16; -- MDIOS output data register 27 type DOUTR27_Register is record -- Output data sent to MDIO Master during read frames DOUT27 : DOUTR27_DOUT27_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR27_Register use record DOUT27 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR28_DOUT28_Field is HAL.UInt16; -- MDIOS output data register 28 type DOUTR28_Register is record -- Output data sent to MDIO Master during read frames DOUT28 : DOUTR28_DOUT28_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR28_Register use record DOUT28 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR29_DOUT29_Field is HAL.UInt16; -- MDIOS output data register 29 type DOUTR29_Register is record -- Output data sent to MDIO Master during read frames DOUT29 : DOUTR29_DOUT29_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR29_Register use record DOUT29 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR30_DOUT30_Field is HAL.UInt16; -- MDIOS output data register 30 type DOUTR30_Register is record -- Output data sent to MDIO Master during read frames DOUT30 : DOUTR30_DOUT30_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR30_Register use record DOUT30 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DOUTR31_DOUT31_Field is HAL.UInt16; -- MDIOS output data register 31 type DOUTR31_Register is record -- Output data sent to MDIO Master during read frames DOUT31 : DOUTR31_DOUT31_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DOUTR31_Register use record DOUT31 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Management data input/output slave type MDIOS_Peripheral is record -- MDIOS configuration register CR : aliased CR_Register; -- MDIOS write flag register WRFR : aliased HAL.UInt32; -- MDIOS clear write flag register CWRFR : aliased HAL.UInt32; -- MDIOS read flag register RDFR : aliased HAL.UInt32; -- MDIOS clear read flag register CRDFR : aliased HAL.UInt32; -- MDIOS status register SR : aliased SR_Register; -- MDIOS clear flag register CLRFR : aliased CLRFR_Register; -- MDIOS input data register 0 DINR0 : aliased DINR0_Register; -- MDIOS input data register 1 DINR1 : aliased DINR1_Register; -- MDIOS input data register 2 DINR2 : aliased DINR2_Register; -- MDIOS input data register 3 DINR3 : aliased DINR3_Register; -- MDIOS input data register 4 DINR4 : aliased DINR4_Register; -- MDIOS input data register 5 DINR5 : aliased DINR5_Register; -- MDIOS input data register 6 DINR6 : aliased DINR6_Register; -- MDIOS input data register 7 DINR7 : aliased DINR7_Register; -- MDIOS input data register 8 DINR8 : aliased DINR8_Register; -- MDIOS input data register 9 DINR9 : aliased DINR9_Register; -- MDIOS input data register 10 DINR10 : aliased DINR10_Register; -- MDIOS input data register 11 DINR11 : aliased DINR11_Register; -- MDIOS input data register 12 DINR12 : aliased DINR12_Register; -- MDIOS input data register 13 DINR13 : aliased DINR13_Register; -- MDIOS input data register 14 DINR14 : aliased DINR14_Register; -- MDIOS input data register 15 DINR15 : aliased DINR15_Register; -- MDIOS input data register 16 DINR16 : aliased DINR16_Register; -- MDIOS input data register 17 DINR17 : aliased DINR17_Register; -- MDIOS input data register 18 DINR18 : aliased DINR18_Register; -- MDIOS input data register 19 DINR19 : aliased DINR19_Register; -- MDIOS input data register 20 DINR20 : aliased DINR20_Register; -- MDIOS input data register 21 DINR21 : aliased DINR21_Register; -- MDIOS input data register 22 DINR22 : aliased DINR22_Register; -- MDIOS input data register 23 DINR23 : aliased DINR23_Register; -- MDIOS input data register 24 DINR24 : aliased DINR24_Register; -- MDIOS input data register 25 DINR25 : aliased DINR25_Register; -- MDIOS input data register 26 DINR26 : aliased DINR26_Register; -- MDIOS input data register 27 DINR27 : aliased DINR27_Register; -- MDIOS input data register 28 DINR28 : aliased DINR28_Register; -- MDIOS input data register 29 DINR29 : aliased DINR29_Register; -- MDIOS input data register 30 DINR30 : aliased DINR30_Register; -- MDIOS input data register 31 DINR31 : aliased DINR31_Register; -- MDIOS output data register 0 DOUTR0 : aliased DOUTR0_Register; -- MDIOS output data register 1 DOUTR1 : aliased DOUTR1_Register; -- MDIOS output data register 2 DOUTR2 : aliased DOUTR2_Register; -- MDIOS output data register 3 DOUTR3 : aliased DOUTR3_Register; -- MDIOS output data register 4 DOUTR4 : aliased DOUTR4_Register; -- MDIOS output data register 5 DOUTR5 : aliased DOUTR5_Register; -- MDIOS output data register 6 DOUTR6 : aliased DOUTR6_Register; -- MDIOS output data register 7 DOUTR7 : aliased DOUTR7_Register; -- MDIOS output data register 8 DOUTR8 : aliased DOUTR8_Register; -- MDIOS output data register 9 DOUTR9 : aliased DOUTR9_Register; -- MDIOS output data register 10 DOUTR10 : aliased DOUTR10_Register; -- MDIOS output data register 11 DOUTR11 : aliased DOUTR11_Register; -- MDIOS output data register 12 DOUTR12 : aliased DOUTR12_Register; -- MDIOS output data register 13 DOUTR13 : aliased DOUTR13_Register; -- MDIOS output data register 14 DOUTR14 : aliased DOUTR14_Register; -- MDIOS output data register 15 DOUTR15 : aliased DOUTR15_Register; -- MDIOS output data register 16 DOUTR16 : aliased DOUTR16_Register; -- MDIOS output data register 17 DOUTR17 : aliased DOUTR17_Register; -- MDIOS output data register 18 DOUTR18 : aliased DOUTR18_Register; -- MDIOS output data register 19 DOUTR19 : aliased DOUTR19_Register; -- MDIOS output data register 20 DOUTR20 : aliased DOUTR20_Register; -- MDIOS output data register 21 DOUTR21 : aliased DOUTR21_Register; -- MDIOS output data register 22 DOUTR22 : aliased DOUTR22_Register; -- MDIOS output data register 23 DOUTR23 : aliased DOUTR23_Register; -- MDIOS output data register 24 DOUTR24 : aliased DOUTR24_Register; -- MDIOS output data register 25 DOUTR25 : aliased DOUTR25_Register; -- MDIOS output data register 26 DOUTR26 : aliased DOUTR26_Register; -- MDIOS output data register 27 DOUTR27 : aliased DOUTR27_Register; -- MDIOS output data register 28 DOUTR28 : aliased DOUTR28_Register; -- MDIOS output data register 29 DOUTR29 : aliased DOUTR29_Register; -- MDIOS output data register 30 DOUTR30 : aliased DOUTR30_Register; -- MDIOS output data register 31 DOUTR31 : aliased DOUTR31_Register; end record with Volatile; for MDIOS_Peripheral use record CR at 16#0# range 0 .. 31; WRFR at 16#4# range 0 .. 31; CWRFR at 16#8# range 0 .. 31; RDFR at 16#C# range 0 .. 31; CRDFR at 16#10# range 0 .. 31; SR at 16#14# range 0 .. 31; CLRFR at 16#18# range 0 .. 31; DINR0 at 16#1C# range 0 .. 31; DINR1 at 16#20# range 0 .. 31; DINR2 at 16#24# range 0 .. 31; DINR3 at 16#28# range 0 .. 31; DINR4 at 16#2C# range 0 .. 31; DINR5 at 16#30# range 0 .. 31; DINR6 at 16#34# range 0 .. 31; DINR7 at 16#38# range 0 .. 31; DINR8 at 16#3C# range 0 .. 31; DINR9 at 16#40# range 0 .. 31; DINR10 at 16#44# range 0 .. 31; DINR11 at 16#48# range 0 .. 31; DINR12 at 16#4C# range 0 .. 31; DINR13 at 16#50# range 0 .. 31; DINR14 at 16#54# range 0 .. 31; DINR15 at 16#58# range 0 .. 31; DINR16 at 16#5C# range 0 .. 31; DINR17 at 16#60# range 0 .. 31; DINR18 at 16#64# range 0 .. 31; DINR19 at 16#68# range 0 .. 31; DINR20 at 16#6C# range 0 .. 31; DINR21 at 16#70# range 0 .. 31; DINR22 at 16#74# range 0 .. 31; DINR23 at 16#78# range 0 .. 31; DINR24 at 16#7C# range 0 .. 31; DINR25 at 16#80# range 0 .. 31; DINR26 at 16#84# range 0 .. 31; DINR27 at 16#88# range 0 .. 31; DINR28 at 16#8C# range 0 .. 31; DINR29 at 16#90# range 0 .. 31; DINR30 at 16#94# range 0 .. 31; DINR31 at 16#98# range 0 .. 31; DOUTR0 at 16#9C# range 0 .. 31; DOUTR1 at 16#A0# range 0 .. 31; DOUTR2 at 16#A4# range 0 .. 31; DOUTR3 at 16#A8# range 0 .. 31; DOUTR4 at 16#AC# range 0 .. 31; DOUTR5 at 16#B0# range 0 .. 31; DOUTR6 at 16#B4# range 0 .. 31; DOUTR7 at 16#B8# range 0 .. 31; DOUTR8 at 16#BC# range 0 .. 31; DOUTR9 at 16#C0# range 0 .. 31; DOUTR10 at 16#C4# range 0 .. 31; DOUTR11 at 16#C8# range 0 .. 31; DOUTR12 at 16#CC# range 0 .. 31; DOUTR13 at 16#D0# range 0 .. 31; DOUTR14 at 16#D4# range 0 .. 31; DOUTR15 at 16#D8# range 0 .. 31; DOUTR16 at 16#DC# range 0 .. 31; DOUTR17 at 16#E0# range 0 .. 31; DOUTR18 at 16#E4# range 0 .. 31; DOUTR19 at 16#E8# range 0 .. 31; DOUTR20 at 16#EC# range 0 .. 31; DOUTR21 at 16#F0# range 0 .. 31; DOUTR22 at 16#F4# range 0 .. 31; DOUTR23 at 16#F8# range 0 .. 31; DOUTR24 at 16#FC# range 0 .. 31; DOUTR25 at 16#100# range 0 .. 31; DOUTR26 at 16#104# range 0 .. 31; DOUTR27 at 16#108# range 0 .. 31; DOUTR28 at 16#10C# range 0 .. 31; DOUTR29 at 16#110# range 0 .. 31; DOUTR30 at 16#114# range 0 .. 31; DOUTR31 at 16#118# range 0 .. 31; end record; -- Management data input/output slave MDIOS_Periph : aliased MDIOS_Peripheral with Import, Address => MDIOS_Base; end STM32_SVD.MDIOS;
package body My_Package is procedure Some_Procedure(Item : out My_Type) is begin Item := 2 * Item; end Some_Procedure; function Set(Value : Integer) return My_Type is Temp : My_Type; begin Temp.Variable := Value; return Temp; end Set; end My_Package;
----------------------------------------------------------------------- -- gen-artifacts-distribs-libs -- Unix shared library extraction and distribution -- Copyright (C) 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with EL.Expressions; with Util.Strings.Vectors; -- The <b>Gen.Artifacts.Distribs.Libs</b> package provides a specific -- distribution rule which gather the shared libraries used by executables -- and put them in a target distribution directory. -- -- <install mode='libs' dir='lib'> -- <library>libgnat</library> -- <library>libmysql*</library> -- <fileset dir="bin"> -- <include name="*-server"/> -- </fileset> -- </install> -- -- Libraries to copy in the distribution are specified in the <b>library</b> -- rule description. The library name must match the pattern defined. -- -- The command works by executing the Unix application <b>ldd</b> on the -- executable. It parses the <b>ldd</b> output and collects the libraries -- that the program is using. It then copies the selected libraries -- in the target directory. private package Gen.Artifacts.Distribs.Libs is -- Create a distribution rule to extract the shared libraries used by an executable -- and copy a selected subset in the target directory. function Create_Rule (Node : in DOM.Core.Node) return Distrib_Rule_Access; -- ------------------------------ -- Distribution artifact -- ------------------------------ type Libs_Rule is new Distrib_Rule with private; type Libs_Rule_Access is access all Libs_Rule'Class; -- Check if the library whose absolute path is defined in <b>Source</b> must be -- copied in the target directory and copy that library if needed. procedure Copy (Rule : in Libs_Rule; Dir : in String; Source : in String); -- Get a name to qualify the installation rule (used for logs). overriding function Get_Install_Name (Rule : in Libs_Rule) return String; -- Get the target path associate with the given source file for the distribution rule. overriding function Get_Target_Path (Rule : in Libs_Rule; Base : in String; File : in File_Record) return String; overriding procedure Install (Rule : in Libs_Rule; Path : in String; Files : in File_Vector; Context : in out Generator'Class); private type Libs_Rule is new Distrib_Rule with record Command : EL.Expressions.Expression; Libraries : Util.Strings.Vectors.Vector; end record; end Gen.Artifacts.Distribs.Libs;
pragma Ada_2012; with Protypo.Api.Engine_Values.Parameter_Lists; use Protypo.Api.Engine_Values.Parameter_Lists; package body User_Records is --------------- -- Split_Bit -- --------------- function Split_Bit (Params : Protypo.Api.Engine_Values.Engine_Value_Vectors.Vector) return Protypo.Api.Engine_Values.Engine_Value_Vectors.Vector is use Protypo.Api.Engine_Values; Parameters : Parameter_List := Create (Params); X : constant Integer := Get_Integer (Shift (Parameters)); Y : constant Integer := Get_Integer (Shift (Parameters), 2); Result : Engine_Value_Vectors.Vector; begin Result (1) := Create (X / Y); Result (2) := Create (X mod Y); return Result; end Split_Bit; end User_Records;
-- ----------------------------------------------------------------------------- -- smk, the smart make (http://lionel.draghi.free.fr/smk/) -- © 2018, 2019 Lionel Draghi <lionel.draghi@free.fr> -- SPDX-License-Identifier: APSL-2.0 -- ----------------------------------------------------------------------------- -- 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 File_Utilities; with Smk.IO; with Smk.Settings; use Smk.Settings; separate (Smk.Runs) -- ----------------------------------------------------------------------------- function Must_Be_Run (Command : in Command_Lines; Previous_Run : in out Runfiles.Run_Lists.Map) return Boolean is -- -------------------------------------------------------------------------- procedure Put_Explanation (Text : in String) is begin if Settings.Explain then IO.Put_Line ("run """ & (+Command) & """ " & Text); end if; end Put_Explanation; use Runfiles; use Run_Lists; C : Run_Lists.Cursor; Updated_List : Condition_Lists.List; -- -------------------------------------------------------------------------- function Assert (C : Condition) return Boolean is Role : constant String := Role_Image (Files.Role (C.File)) & " "; Because : constant String := "because " & Role & (if Is_Dir (C.File) then "dir " else "file ") & Shorten (C.Name); Status : File_Status renames Files.Status (C.File); File_Exists : constant Boolean := Status /= Missing; Is_The_Target : constant Boolean := Has_Target (C.Name, Settings.Target_Name); -- Is_The_Target is True if C.Name is the target explicitly given -- on command line. begin if File_Exists and C.Trigger = File_Update and Status = Updated then -- -------------------------------------------------------------------- Put_Explanation (Because & " has been updated (" & IO.Image (Time_Tag (C.File)) & ")"); return False; elsif not File_Exists and C.Trigger = File_Absence and (Is_Target (C.File) and (Settings.Build_Missing_Targets or Is_The_Target)) -- if target and : -- - -mt option used, or -- - this target is explicitly given on command line then -- ----------------------------------------------------------------- Put_Explanation (Because & " is missing"); return False; elsif File_Exists and C.Trigger = File_Presence then -- -------------------------------------------------------------------- Put_Explanation (Because & " is present"); return False; else -- -------------------------------------------------------------------- -- assertions are OK return True; end if; end Assert; begin -- -------------------------------------------------------------------------- if Always_Make then -- don't even ask, run it! Put_Explanation ("because -a option is set"); return True; end if; C := Previous_Run.Find (Command); if C = No_Element then -- never run command Put_Explanation ("because it was not run before"); return True; end if; Update_Files_Status (Previous_Run (C).Assertions, Updated_List); if Debug_Mode then Put_Updated (Updated_List); end if; -- for P of Element (C).Assertions loop if not Assert (P) then return True; end if; end loop; return False; end Must_Be_Run;
-- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../License.txt package Definitions is pragma Pure; synth_version_major : constant String := "2"; synth_version_minor : constant String := "04"; copyright_years : constant String := "2015-2018"; host_localbase : constant String := "/usr/local"; host_make : constant String := "/usr/bin/make"; host_pkg8 : constant String := host_localbase & "/sbin/pkg"; host_bmake : constant String := host_localbase & "/bin/bmake"; host_make_program : constant String := host_make; chroot_make : constant String := "/usr/bin/make"; chroot_bmake : constant String := "/usr/pkg/bin/bmake -m /usr/pkg/share/mk"; chroot_make_program : constant String := chroot_make; jobs_per_cpu : constant := 2; type cpu_range is range 1 .. 32; type scanners is range cpu_range'First .. cpu_range'Last; type builders is range cpu_range'First .. cpu_range'Last * jobs_per_cpu; type package_system is (ports_collection, pkgsrc); software_framework : constant package_system := ports_collection; -- Notes for tailoring Synth. Use sed to: -- 1. Modify host_localbase to value of LOCALBASE -- 2. Change software_framework to "pkgsrc" for pkgsrc version -- 3. Change host_make_program to "host_bmake" for Non-NetBSD pkgsrc platforms -- 4. Change chroot_make_program to "chroot_bmake" for pkgsrc version -- 5. On replicant.ads, change "/usr/local" to "/usr/pkg" on pkgsrc end Definitions;
with Ada.Calendar.Time_Zones; with Ada.Environment_Variables; with Ada.Strings.Fixed; package body Web is Month_T : constant String := "JanFebMarAprMayJunJulAugSepOctNovDec"; Day_T : constant String := "MonTueWedThuFriSatSun"; function Environment_Variables_Value (Name : String) return String is begin if Ada.Environment_Variables.Exists (Name) then return Ada.Environment_Variables.Value (Name); else return ""; end if; end Environment_Variables_Value; procedure Header_Cookie_Internal ( Stream : not null access Ada.Streams.Root_Stream_Type'Class; Cookie : in Web.Cookie; Expires : access constant Ada.Calendar.Time) is begin if not Cookie.Is_Empty then declare Position : String_Maps.Cursor := String_Maps.First (Cookie); begin while String_Maps.Has_Element (Position) loop String'Write ( Stream, "set-cookie: " & String_Maps.Key (Position) & "=" & Encode_URI (String_Maps.Element (Position)) & ";"); if Expires /= null then String'Write (Stream, " expires=" & Image (Expires.all) & ";"); end if; String'Write (Stream, Line_Break); Position := String_Maps.Next (Position); end loop; end; end if; end Header_Cookie_Internal; -- implementation of string map function Element ( Map : String_Maps.Map; Key : String; Default : String := "") return String is Position : constant String_Maps.Cursor := String_Maps.Find (Map, Key); begin if not String_Maps.Has_Element (Position) then return Default; else return String_Maps.Element (Position); end if; end Element; function Element ( Map : String_Maps.Map; Key : String; Default : Ada.Streams.Stream_Element_Array := (-1 .. 0 => <>)) return Ada.Streams.Stream_Element_Array is Position : constant String_Maps.Cursor := String_Maps.Find (Map, Key); begin if not String_Maps.Has_Element (Position) then return Default; else declare Result_String : String_Maps.Constant_Reference_Type renames String_Maps.Constant_Reference (Map, Position); Result_SEA : Ada.Streams.Stream_Element_Array (0 .. Result_String.Element.all'Length - 1); for Result_SEA'Address use Result_String.Element.all'Address; begin return Result_SEA; end; end if; end Element; procedure Include ( Map : in out String_Maps.Map; Key : in String; Item : in Ada.Streams.Stream_Element_Array) is Item_String : String (1 .. Item'Length); for Item_String'Address use Item'Address; begin String_Maps.Include (Map, Key, Item_String); end Include; -- implementation of time function Image (Time : Ada.Calendar.Time) return Time_Name is Year : Ada.Calendar.Year_Number; Month : Ada.Calendar.Month_Number; Day : Ada.Calendar.Day_Number; Hou : Ada.Calendar.Formatting.Hour_Number; Min : Ada.Calendar.Formatting.Minute_Number; Sec : Ada.Calendar.Formatting.Second_Number; Sub_Seconds : Ada.Calendar.Day_Duration; begin Ada.Calendar.Formatting.Split ( Time, Year, Month, Day, Hou, Min, Sec, Sub_Seconds); return Day_Image ( Ada.Calendar.Formatting.Day_Of_Week (Time)) & ", " & Z2_Image (Day) & " " & Month_Image (Month) & " " & Year_Image (Year) & " " & Z2_Image (Hou) & ":" & Z2_Image (Min) & ":" & Z2_Image (Sec) & " GMT"; end Image; function Value (Image : String) return Ada.Calendar.Time is begin if Image'Length /= Time_Name'Length and then Image'Length /= Time_Name'Length + 2 -- +XXXX form then raise Constraint_Error; else declare F : constant Positive := Image'First; Dummy_Day_Of_Week : Ada.Calendar.Formatting.Day_Name; Year : Ada.Calendar.Year_Number; Month : Ada.Calendar.Month_Number; Day : Ada.Calendar.Day_Number; Hou : Ada.Calendar.Formatting.Hour_Number; Min : Ada.Calendar.Formatting.Minute_Number; Sec : Ada.Calendar.Formatting.Second_Number; Offset : Ada.Calendar.Time_Zones.Time_Offset; begin Dummy_Day_Of_Week := Day_Value (Image (F .. F + 2)); if Image (F + 3 .. F + 4) /= ", " then raise Constraint_Error; end if; Day := Natural'Value (Image (F + 5 .. F + 6)); if Image (F + 7) /= ' ' then raise Constraint_Error; end if; Month := Month_Value (Image (F + 8 .. F + 10)); if Image (F + 11) /= ' ' then raise Constraint_Error; end if; Year := Natural'Value (Image (F + 12 .. F + 15)); if Image (F + 16) /= ' ' then raise Constraint_Error; end if; Hou := Natural'Value (Image (F + 17 .. F + 18)); if Image (F + 19) /= ':' then raise Constraint_Error; end if; Min := Natural'Value (Image (F + 20 .. F + 21)); if Image (F + 22) /= ':' then raise Constraint_Error; end if; Sec := Natural'Value (Image (F + 23 .. F + 24)); if Image'Length = Time_Name'Length + 2 then pragma Assert (F + 30 = Image'Last); if Image (F + 25) /= ' ' or else Image (F + 26) /= '+' then raise Constraint_Error; end if; Offset := Ada.Calendar.Time_Zones.Time_Offset ( Natural'Value (Image (F + 27 .. F + 28)) * 60 + Natural'Value (Image (F + 29 .. F + 30))); else pragma Assert (Image'Length = Time_Name'Length); pragma Assert (F + 28 = Image'Last); if Image (F + 25 .. F + 28) /= " GMT" then raise Constraint_Error; end if; Offset := 0; end if; return Ada.Calendar.Formatting.Time_Of ( Year, Month, Day, Hou, Min, Sec, Time_Zone => Offset); end; end if; end Value; function Year_Image (Year : Natural) return Year_Name is S : constant String := Natural'Image (Year); begin pragma Assert (S (S'First) = ' '); return Result : Year_Name := (others => '0') do Result (Year_Name'Last + 1 - (S'Last - S'First) .. Year_Name'Last) := S (S'First + 1 .. S'Last); end return; end Year_Image; function Month_Image (Month : Ada.Calendar.Month_Number) return Month_Name is begin return Month_T (Month * 3 - 2 .. Month * 3); end Month_Image; function Month_Value (S : String) return Ada.Calendar.Month_Number is begin for Month in Ada.Calendar.Month_Number loop if S = Month_T (Month * 3 - 2 .. Month * 3) then return Month; end if; end loop; raise Constraint_Error; end Month_Value; function Day_Image (Day : Ada.Calendar.Formatting.Day_Name) return Day_Name is I : constant Natural := Ada.Calendar.Formatting.Day_Name'Pos (Day); begin return Day_T (I * 3 + 1 .. I * 3 + 3); end Day_Image; function Day_Value (S : String) return Ada.Calendar.Formatting.Day_Name is begin for Day in Ada.Calendar.Formatting.Day_Name loop declare I : constant Natural := Ada.Calendar.Formatting.Day_Name'Pos (Day); begin if S = Day_T (I * 3 + 1 .. I * 3 + 3) then return Day; end if; end; end loop; raise Constraint_Error; end Day_Value; function Z2_Image (Value : Natural) return String_2 is S : String := Natural'Image (Value); begin if S'Length > 2 then return S (S'Last - 1 .. S'Last); else pragma Assert (S'Length = 2); S (S'First) := '0'; return S; end if; end Z2_Image; -- implementation of host function Host return String is begin if Ada.Environment_Variables.Exists (HTTP_Host_Variable) then return Environment_Variables_Value (HTTP_Host_Variable); else return Environment_Variables_Value (Server_Name_Variable); end if; end Host; function Compose (Protocol : Web.Protocol; Host, Path : String) return String is Path_First : Positive := Path'First; begin if Path_First <= Path'Last and then Path (Path_First) = '/' and then Host'First <= Host'Last and then Host (Host'Last) = '/' then Path_First := Path_First + 1; end if; return String (Protocol) & Host & Path (Path_First .. Path'Last); end Compose; -- implementation of input function Request_URI return String is Request_URI_Value : constant String := Environment_Variables_Value (Request_URI_Variable); Query_String_Value : constant String := Environment_Variables_Value (Query_String_Variable); begin if Query_String_Value'Length = 0 or else Ada.Strings.Fixed.Index (Request_URI_Value, "?") > 0 then return Request_URI_Value; else return Request_URI_Value & "?" & Query_String_Value; end if; end Request_URI; function Request_Path return String is Request_URI_Value : constant String := Environment_Variables_Value (Request_URI_Variable); Query_Index : constant Integer := Ada.Strings.Fixed.Index (Request_URI_Value, "?"); begin if Query_Index > 0 then return Request_URI_Value (Request_URI_Value'First .. Query_Index - 1); else return Request_URI_Value; end if; end Request_Path; function Remote_Addr return String is begin return Environment_Variables_Value (Remote_Addr_Variable); end Remote_Addr; function Remote_Host return String is begin return Environment_Variables_Value (Remote_Host_Variable); end Remote_Host; function User_Agent return String is begin return Environment_Variables_Value (HTTP_User_Agent_Variable); end User_Agent; function Post return Boolean is begin return Equal_Case_Insensitive ( Environment_Variables_Value (Request_Method_Variable), L => "post"); end Post; function Get_Post_Length return Natural is begin return Natural'Value ( Ada.Environment_Variables.Value (Content_Length_Variable)); exception when Constraint_Error => return 0; end Get_Post_Length; function Get_Post_Encoded_Kind return Post_Encoded_Kind is Content_Type_Value : constant String := Ada.Environment_Variables.Value (Content_Type_Variable); begin if Prefixed_Case_Insensitive ( Content_Type_Value, L_Prefix => String (Content_URL_Encoded)) then return URL_Encoded; elsif Prefixed_Case_Insensitive ( Content_Type_Value, L_Prefix => String (Content_Multipart_Form_Data)) then return Multipart_Form_Data; else return Miscellany; end if; end Get_Post_Encoded_Kind; function Encode_URI (S : String) return String is Integer_To_Hex : constant array (0 .. 15) of Character := "0123456789abcdef"; Result : String (1 .. S'Length * 3); Length : Natural := 0; begin for I in S'Range loop declare C : constant Character := S (I); begin if (C >= 'A' and then C <= 'Z') or else (C >= 'a' and then C <= 'z') or else (C >= '0' and then C <= '9') then Length := Length + 1; Result (Length) := C; elsif C = ' ' then Length := Length + 1; Result (Length) := '+'; else Length := Length + 1; Result (Length) := '%'; Length := Length + 1; Result (Length) := Integer_To_Hex (Character'Pos (C) / 16); Length := Length + 1; Result (Length) := Integer_To_Hex (Character'Pos (C) rem 16); end if; end; end loop; return Result (1 .. Length); end Encode_URI; function Decode_URI (S : String) return String is Hex_To_Integer : constant array (Character) of Natural := ( '0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9, 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, 'E' => 14, 'F' => 15, 'a' => 10, 'b' => 11, 'c' => 12, 'd' => 13, 'e' => 14, 'f' => 15, others => 0); Result : String (1 .. S'Length); I : Positive; Length : Natural := 0; begin I := S'First; while I <= S'Last loop declare C : constant Character := S (I); begin if C = '+' then Length := Length + 1; Result (Length) := ' '; I := I + 1; elsif C /= '%' then Length := Length + 1; Result (Length) := C; I := I + 1; else I := I + 1; declare L, H : Natural := 0; begin if I <= S'Last then H := Hex_To_Integer (S (I)); I := I + 1; if I <= S'Last then L := Hex_To_Integer (S (I)); I := I + 1; end if; end if; Length := Length + 1; Result (Length) := Character'Val (L + H * 16); end; end if; end; end loop; return Result (1 .. Length); end Decode_URI; function Decode_Query_String (S : String) return Query_Strings is Result : Query_Strings; procedure Process (S : String) is Sep_Pos : constant Natural := Ada.Strings.Fixed.Index (S, "="); begin if Sep_Pos >= S'First then String_Maps.Include ( Result, S (S'First .. Sep_Pos - 1), Decode_URI (S (Sep_Pos + 1 .. S'Last))); else String_Maps.Include (Result, S, ""); end if; end Process; Pos : Natural := S'First; Next : Natural; begin Parsing : loop Next := Ada.Strings.Fixed.Index (S (Pos .. S'Last), "&"); if Next = 0 then Next := S'Last + 1; end if; if Pos < Next then Process (S (Pos .. Next - 1)); end if; Pos := Next + 1; if Pos > S'Last then exit Parsing; end if; end loop Parsing; return Result; end Decode_Query_String; function Get_Query_Strings return Query_Strings is URI : constant String := Request_URI; Arg_Pos : constant Natural := Ada.Strings.Fixed.Index (URI, "?"); begin if Arg_Pos = 0 then return String_Maps.Empty_Map; else return Decode_Query_String (URI (Arg_Pos + 1 .. URI'Last)); end if; end Get_Query_Strings; function Decode_Multipart_Form_Data (S : String) return Query_Strings is function New_Line (Position : aliased in out Positive) return Natural is begin if S (Position) = Character'Val (13) then if Position < S'Last and then S (Position + 1) = Character'Val (10) then Position := Position + 2; return 2; else Position := Position + 1; return 1; end if; elsif S (Position) = Character'Val (10) then Position := Position + 1; return 1; else return 0; end if; end New_Line; function Get_String (Position : aliased in out Positive) return String is First, Last : Positive; begin if S (Position) = '"' then Position := Position + 1; First := Position; while S (Position) /= '"' loop Position := Position + 1; end loop; Last := Position - 1; Position := Position + 1; return S (First .. Last); end if; return ""; end Get_String; procedure Skip_Spaces (Position : aliased in out Positive) is begin while S (Position) = ' ' loop Position := Position + 1; end loop; end Skip_Spaces; procedure Process_Item ( Position : aliased in out Positive; Last : Natural; Result : in out Query_Strings) is Content_Disposition : constant String := "content-disposition:"; Form_Data : constant String := "form-data;"; Name : constant String := "name="; File_Name : constant String := "filename="; Content_Type : constant String := "content-type:"; begin if Position + Content_Disposition'Length - 1 <= S'Last and then Equal_Case_Insensitive ( S (Position .. Position + Content_Disposition'Length - 1), L => Content_Disposition) then Position := Position + Content_Disposition'Length; Skip_Spaces (Position); if S (Position .. Position + Form_Data'Length - 1) = Form_Data then Position := Position + Form_Data'Length; Skip_Spaces (Position); if S (Position .. Position + Name'Length - 1) = Name then Position := Position + Name'Length; declare Item_Name : constant String := Get_String (Position); begin if New_Line (Position) > 0 then while New_Line (Position) > 0 loop null; end loop; String_Maps.Include (Result, Item_Name, S (Position .. Last)); elsif S (Position) = ';' then Position := Position + 1; Skip_Spaces (Position); if Equal_Case_Insensitive ( S (Position .. Position + File_Name'Length - 1), L => File_Name) then Position := Position + File_Name'Length; declare Item_File_Name : constant String := Get_String (Position); Content_Type_First, Content_Type_Last : Positive; begin if New_Line (Position) > 0 then if Equal_Case_Insensitive ( S (Position .. Position + Content_Type'Length - 1), L => Content_Type) then Position := Position + Content_Type'Length; Skip_Spaces (Position); Content_Type_First := Position; while S (Position) > Character'Val (32) loop Position := Position + 1; end loop; Content_Type_Last := Position - 1; while New_Line (Position) > 0 loop null; end loop; String_Maps.Include (Result, Item_Name, S (Position .. Last)); String_Maps.Include (Result, Item_Name & ":filename", Item_File_Name); String_Maps.Include ( Result, Item_Name & ":content-type", S (Content_Type_First .. Content_Type_Last)); end if; end if; end; end if; end if; end; end if; end if; end if; end Process_Item; Result : Query_Strings; Position : aliased Positive; begin if S (S'First) = '-' then Get_First_Line : for I in S'Range loop Position := I; if New_Line (Position) > 0 then declare Boundary : constant String := S (S'First .. I - 1); begin Separating : loop declare Next : constant Natural := Ada.Strings.Fixed.Index (S (Position .. S'Last), Boundary); Last : Natural; begin if Next = 0 then Last := S'Last; else Last := Next - 1; end if; if S (Last) = Character'Val (10) then Last := Last - 1; end if; if S (Last) = Character'Val (13) then Last := Last - 1; end if; Process_Item (Position, Last, Result); exit Separating when Next = 0; Position := Next + Boundary'Length; if New_Line (Position) = 0 then exit Separating; end if; end; end loop Separating; end; exit Get_First_Line; end if; end loop Get_First_Line; end if; return Result; end Decode_Multipart_Form_Data; function Get (Stream : not null access Ada.Streams.Root_Stream_Type'Class) return Query_Strings is begin if Post then declare Input : String (1 .. Get_Post_Length); begin String'Read (Stream, Input); case Get_Post_Encoded_Kind is when URL_Encoded => return Decode_Query_String (Input); when Multipart_Form_Data => return Decode_Multipart_Form_Data (Input); when Miscellany => return String_Maps.Empty_Map; end case; end; else return String_Maps.Empty_Map; end if; end Get; function Get_Cookie return Cookie is S : constant String := Environment_Variables_Value (HTTP_Cookie_Variable); Result : Cookie; procedure Process (S : in String) is Sep_Pos : constant Natural := Ada.Strings.Fixed.Index (S, "="); First : Natural := S'First; begin while S (First) = ' ' loop First := First + 1; if First > S'Last then return; end if; end loop; if Sep_Pos > First then String_Maps.Include ( Result, S (First .. Sep_Pos - 1), Decode_URI (S (Sep_Pos + 1 .. S'Last))); else String_Maps.Include (Result, S (First .. S'Last), ""); end if; end Process; Pos : Natural := S'First; Next : Natural; begin Parsing : loop Next := Ada.Strings.Fixed.Index (S (Pos .. S'Last), ";"); if Next = 0 then Next := S'Last + 1; end if; if Pos < Next then Process (S (Pos .. Next - 1)); end if; Pos := Next + 1; if Pos > S'Last then exit Parsing; end if; end loop Parsing; return Result; end Get_Cookie; function Equal_Case_Insensitive (S, L : String) return Boolean is S_Length : constant Natural := S'Length; L_Length : constant Natural := L'Length; begin if S_Length /= L_Length then return False; else for I in 0 .. S_Length - 1 loop declare S_Item : Character := S (S'First + I); begin if S_Item in 'A' .. 'Z' then S_Item := Character'Val ( Character'Pos (S_Item) + (Character'Pos ('a') - Character'Pos ('A'))); end if; pragma Assert (L (L'First + I) not in 'A' .. 'Z'); if S_Item /= L (L'First + I) then return False; end if; end; end loop; return True; end if; end Equal_Case_Insensitive; function Prefixed_Case_Insensitive (S, L_Prefix : String) return Boolean is begin return S'Length >= L_Prefix'Length and then Equal_Case_Insensitive ( S (S'First .. S'First + L_Prefix'Length - 1), L_Prefix); end Prefixed_Case_Insensitive; -- implementation of output procedure Header_303 ( Stream : not null access Ada.Streams.Root_Stream_Type'Class; Location : in String) is begin String'Write (Stream, "status: 303 See Other" & Line_Break & "location: "); String'Write (Stream, Location); String'Write (Stream, Line_Break); end Header_303; procedure Header_503 ( Stream : not null access Ada.Streams.Root_Stream_Type'Class) is begin String'Write (Stream, "status: 503 Service Unavailable" & Line_Break); end Header_503; procedure Header_Content_Type ( Stream : not null access Ada.Streams.Root_Stream_Type'Class; Content : in Mime_Type) is begin String'Write (Stream, "content-type: "); String'Write (Stream, String (Content)); String'Write (Stream, Line_Break); end Header_Content_Type; procedure Header_Cookie ( Stream : not null access Ada.Streams.Root_Stream_Type'Class; Cookie : in Web.Cookie; Expires : in Ada.Calendar.Time) is Aliased_Expires : aliased Ada.Calendar.Time := Expires; begin Header_Cookie_Internal (Stream, Cookie, Aliased_Expires'Access); end Header_Cookie; procedure Header_Cookie ( Stream : not null access Ada.Streams.Root_Stream_Type'Class; Cookie : in Web.Cookie) is begin Header_Cookie_Internal (Stream, Cookie, null); end Header_Cookie; procedure Header_X_Robots_Tag ( Stream : not null access Ada.Streams.Root_Stream_Type'Class; Options : in Robots_Options) is procedure Write ( Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : in String; Continuing : in out Boolean) is begin if not Continuing then String'Write (Stream, ", "); Continuing := True; end if; String'Write (Stream, Item); end Write; begin String'Write (Stream, "X-Robots-Tag: "); declare Continuing : Boolean := False; begin if Options.No_Index then Write (Stream, "noindex", Continuing); end if; if Options.No_Follow then Write (Stream, "nofollow", Continuing); end if; if Options.No_Archive then Write (Stream, "noarchive", Continuing); end if; if Options.No_Snippet then Write (Stream, "nosnippet", Continuing); end if; if Options.No_Translate then Write (Stream, "notranslate", Continuing); end if; if Options.No_Image_Index then Write (Stream, "noimageindex", Continuing); end if; if not Continuing then String'Write (Stream, "all"); end if; end; String'Write (Stream, Line_Break); end Header_X_Robots_Tag; procedure Header_Break ( Stream : not null access Ada.Streams.Root_Stream_Type'Class) is begin String'Write (Stream, Line_Break); end Header_Break; procedure Generic_Write (Item : in String) is begin String'Write (Stream, Item); end Generic_Write; end Web;