content stringlengths 23 1.05M |
|---|
pragma Ada_2012;
with Interfaces; use Interfaces;
with Interfaces.C; use Interfaces.C;
with fastpbkdf2_h_generic;
package fastpbkdf2_h is new fastpbkdf2_h_generic
(Unsigned_8, Unsigned_32, size_t);
|
with DOM.Core;
private
package Project_Processor.Parsers.XML_Parsers.Basic_Parsers is
function Expect_ID (N : DOM.Core.Node;
Name : String := "label")
return EU_Projects.Dotted_Identifier;
function Expect_Number (N : DOM.Core.Node;
Name : String)
return Natural;
function Expect_Time (N : DOM.Core.Node;
Name : String)
return Symbolic_Instant;
function Expect_Duration (N : DOM.Core.Node;
Name : String)
return Symbolic_Duration;
procedure Get_End_And_Duration
(N : DOM.Core.Node;
Start_Time : in Symbolic_Instant;
End_Time : out Symbolic_Instant;
Duration : out Symbolic_Duration);
end Project_Processor.Parsers.XML_Parsers.Basic_Parsers;
|
-- SPDX-FileCopyrightText: 2021 Max Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Element_Vectors;
with Program.Elements.Discrete_Simple_Expression_Ranges;
with Program.Elements.Function_Calls;
with Program.Elements.Identifiers;
with Program.Elements.Infix_Operators;
with Program.Elements.Numeric_Literals;
with Program.Elements.Operator_Symbols;
with Program.Elements.Parameter_Associations;
with Program.Elements.Record_Component_Associations;
with Program.Elements.Record_Aggregates;
with Program.Elements.String_Literals;
with Program.Interpretations.Expressions;
with Program.Interpretations.Names;
with Program.Node_Symbols;
with Program.Resolvers.Name_In_Region;
with Program.Safe_Element_Visitors;
with Program.Symbols;
with Program.Type_Matchers;
package body Program.Complete_Contexts is
package Up_Visitors is
type Visitor
(Sets : not null Program.Interpretations.Context_Access)
is new
Program.Safe_Element_Visitors.Safe_Element_Visitor
with record
Result : Program.Interpretations.Interpretation_Set;
end record;
procedure Call_Up
(Self : in out Visitor'Class;
Prefix : not null Program.Elements.Element_Access;
Arg : Program.Element_Vectors.Iterators.Forward_Iterator'Class;
Arity : Positive);
-- Common procedure from Infix_Operator and Function_Call
overriding procedure Discrete_Simple_Expression_Range
(Self : in out Visitor;
Element : not null Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range_Access);
overriding procedure Function_Call
(Self : in out Visitor;
Element : not null Program.Elements.Function_Calls
.Function_Call_Access);
overriding procedure Identifier
(Self : in out Visitor;
Element : not null Program.Elements.Identifiers.Identifier_Access);
overriding procedure Infix_Operator
(Self : in out Visitor;
Element : not null Program.Elements.Infix_Operators
.Infix_Operator_Access);
overriding procedure Numeric_Literal
(Self : in out Visitor;
Element : not null Program.Elements.Numeric_Literals
.Numeric_Literal_Access);
overriding procedure Operator_Symbol
(Self : in out Visitor;
Element : not null Program.Elements.Operator_Symbols
.Operator_Symbol_Access);
overriding procedure Parameter_Association
(Self : in out Visitor;
Element : not null Program.Elements.Parameter_Associations
.Parameter_Association_Access);
overriding procedure Record_Aggregate
(Self : in out Visitor;
Element : not null Program.Elements.Record_Aggregates
.Record_Aggregate_Access);
overriding procedure String_Literal
(Self : in out Visitor;
Element : not null Program.Elements.String_Literals
.String_Literal_Access);
end Up_Visitors;
package body Up_Visitors is
procedure Call_Up
(Self : in out Visitor'Class;
Prefix : not null Program.Elements.Element_Access;
Arg : Program.Element_Vectors.Iterators.Forward_Iterator'Class;
Arity : Positive)
is
use type Program.Interpretations.Names.Cursor;
use all type Program.Visibility.View_Kind;
Name : Program.Interpretations.Interpretation_Set;
Args : Program.Interpretations.Interpretation_Set_Array (1 .. Arity);
Down : Program.Interpretations.Solution_Array (0 .. Arity);
begin
Self.Result := Self.Sets.Create_Interpretation_Set;
Name := Up (Prefix, Self.Sets);
for J in Arg loop
Args (J.Index) := Up (J.Element, Self.Sets);
end loop;
for N in Program.Interpretations.Names.Each (Name) loop
declare
View : constant Program.Visibility.View := +N;
procedure Callback (Down : Interpretations.Solution_Array);
procedure Callback (Down : Interpretations.Solution_Array) is
begin
Self.Result.Add_Expression
(Program.Visibility.Result (View), Down);
end Callback;
begin
if View.Kind = Function_View then
Down (0) :=
(Program.Interpretations.Defining_Name_Solution,
View);
Resolve_Parameters
(Arguments => Args,
Parameters => Program.Visibility.Parameters (View),
Callback => Callback'Access,
Down => Down);
end if;
end;
end loop;
end Call_Up;
overriding procedure Discrete_Simple_Expression_Range
(Self : in out Visitor;
Element : not null Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range_Access)
is
use type Program.Interpretations.Expressions.Cursor;
Left : constant Program.Interpretations.Interpretation_Set :=
Up (Element.Lower_Bound, Self.Sets);
Right : constant Program.Interpretations.Interpretation_Set :=
Up (Element.Upper_Bound, Self.Sets);
begin
Self.Result := Self.Sets.Create_Interpretation_Set;
for N in Program.Interpretations.Expressions.Each (Left) loop
for K in Program.Interpretations.Expressions.Each_Of_Type
(Right, +N)
loop
Self.Result.Add_Expression
(+N, -- FIXME: choose between +N, +K to avoid universal_int
(1 => -N, 2 => -K));
end loop;
end loop;
end Discrete_Simple_Expression_Range;
overriding procedure Function_Call
(Self : in out Visitor;
Element : not null Program.Elements.Function_Calls
.Function_Call_Access) is
begin
Self.Call_Up
(Prefix => Element.Prefix.To_Element,
Arg => Element.Parameters.Each_Element,
Arity => Element.Parameters.Length);
null;
end Function_Call;
overriding procedure Identifier
(Self : in out Visitor;
Element : not null Program.Elements.Identifiers.Identifier_Access)
is
Symbol : constant Program.Symbols.Symbol :=
Program.Node_Symbols.Get_Symbol (Element);
begin
Self.Result := Self.Sets.Create_Interpretation_Set;
Self.Result.Add_Symbol (Symbol);
end Identifier;
overriding procedure Infix_Operator
(Self : in out Visitor;
Element : not null Program.Elements.Infix_Operators
.Infix_Operator_Access)
is
Arity : constant Positive := 1 + Boolean'Pos (Element.Left.Assigned);
begin
if Arity = 1 then
Self.Call_Up
(Prefix => Element.Operator.To_Element,
Arg => Program.Element_Vectors.Single_Element
(Element.Right.To_Element),
Arity => Arity);
else
Self.Call_Up
(Prefix => Element.Operator.To_Element,
Arg => Program.Element_Vectors.Two_Elements
(Element.Left.To_Element,
Element.Right.To_Element),
Arity => Arity);
end if;
end Infix_Operator;
overriding procedure Numeric_Literal
(Self : in out Visitor;
Element : not null Program.Elements.Numeric_Literals
.Numeric_Literal_Access)
is
pragma Unreferenced (Element);
use type Program.Visibility.View_Cursor;
begin
Self.Result := Self.Sets.Create_Interpretation_Set;
for Std in Self.Sets.Env.Immediate_Visible
(Program.Symbols.Standard)
loop
for Str in Program.Visibility.Immediate_Visible
(+Std, Program.Symbols.Integer)
loop
Self.Result.Add_Expression (+Str);
end loop;
end loop;
end Numeric_Literal;
overriding procedure Operator_Symbol
(Self : in out Visitor;
Element : not null Program.Elements.Operator_Symbols
.Operator_Symbol_Access)
is
Symbol : constant Program.Symbols.Symbol :=
Program.Node_Symbols.Get_Symbol (Element);
begin
Self.Result := Self.Sets.Create_Interpretation_Set;
Self.Result.Add_Symbol (Symbol);
end Operator_Symbol;
overriding procedure Parameter_Association
(Self : in out Visitor;
Element : not null Program.Elements.Parameter_Associations
.Parameter_Association_Access)
is
begin
Self.Visit (Element.Actual_Parameter);
pragma Assert (not Element.Formal_Parameter.Assigned);
end Parameter_Association;
Only_Records : aliased Program.Type_Matchers.Record_Type_Matcher;
overriding procedure Record_Aggregate
(Self : in out Visitor;
Element : not null Program.Elements.Record_Aggregates
.Record_Aggregate_Access)
is
pragma Unreferenced (Element);
begin
Self.Result := Self.Sets.Create_Interpretation_Set;
Self.Result.Add_Expression_Category (Only_Records'Access);
end Record_Aggregate;
overriding procedure String_Literal
(Self : in out Visitor;
Element : not null Program.Elements.String_Literals
.String_Literal_Access)
is
pragma Unreferenced (Element);
use type Program.Visibility.View_Cursor;
begin
Self.Result := Self.Sets.Create_Interpretation_Set;
for Std in Self.Sets.Env.Immediate_Visible
(Program.Symbols.Standard)
loop
for Str in Program.Visibility.Immediate_Visible
(+Std, Program.Symbols.String)
loop
Self.Result.Add_Expression (+Str);
end loop;
end loop;
end String_Literal;
end Up_Visitors;
package Down_Visitors is
type Visitor
(Sets : not null Program.Interpretations.Context_Access;
Setter : not null Program.Cross_Reference_Updaters
.Cross_Reference_Updater_Access)
is new
Program.Safe_Element_Visitors.Safe_Element_Visitor
with record
Solution : Program.Interpretations.Solution;
end record;
overriding procedure Discrete_Simple_Expression_Range
(Self : in out Visitor;
Element : not null Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range_Access);
overriding procedure Function_Call
(Self : in out Visitor;
Element : not null Program.Elements.Function_Calls
.Function_Call_Access);
overriding procedure Identifier
(Self : in out Visitor;
Element : not null Program.Elements.Identifiers.Identifier_Access);
overriding procedure Infix_Operator
(Self : in out Visitor;
Element : not null Program.Elements.Infix_Operators
.Infix_Operator_Access);
overriding procedure Numeric_Literal
(Self : in out Visitor;
Element : not null Program.Elements.Numeric_Literals
.Numeric_Literal_Access);
overriding procedure Operator_Symbol
(Self : in out Visitor;
Element : not null Program.Elements.Operator_Symbols
.Operator_Symbol_Access);
overriding procedure Parameter_Association
(Self : in out Visitor;
Element : not null Program.Elements.Parameter_Associations
.Parameter_Association_Access);
overriding procedure Record_Aggregate
(Self : in out Visitor;
Element : not null Program.Elements.Record_Aggregates
.Record_Aggregate_Access);
overriding procedure String_Literal
(Self : in out Visitor;
Element : not null Program.Elements.String_Literals
.String_Literal_Access);
end Down_Visitors;
package body Down_Visitors is
procedure Down
(Self : in out Visitor'Class;
Element : not null access Program.Elements.Element'Class;
Solution : Program.Interpretations.Solution);
procedure Down
(Self : in out Visitor'Class;
Element : not null access Program.Elements.Element'Class;
Solution : Program.Interpretations.Solution) is
begin
Down (Element, Solution, Self.Setter, Self.Sets);
end Down;
overriding procedure Discrete_Simple_Expression_Range
(Self : in out Visitor;
Element : not null Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range_Access) is
begin
Self.Down (Element.Lower_Bound, Self.Solution.Tuple (1));
Self.Down (Element.Upper_Bound, Self.Solution.Tuple (2));
end Discrete_Simple_Expression_Range;
overriding procedure Function_Call
(Self : in out Visitor;
Element : not null Program.Elements.Function_Calls
.Function_Call_Access)
is
begin
Self.Down (Element.Prefix, Self.Solution.Tuple (0));
for J in Element.Parameters.Each_Element loop
Self.Down (J.Element, Self.Solution.Tuple (J.Index));
end loop;
end Function_Call;
----------------
-- Identifier --
----------------
overriding procedure Identifier
(Self : in out Visitor;
Element : not null Program.Elements.Identifiers.Identifier_Access) is
begin
case Self.Solution.Kind is
when Program.Interpretations.Defining_Name_Solution =>
Self.Setter.Set_Corresponding_Defining_Name
(Element.To_Element,
Program.Visibility.Name (Self.Solution.Name_View));
when others =>
raise Program_Error;
end case;
end Identifier;
overriding procedure Infix_Operator
(Self : in out Visitor;
Element : not null Program.Elements.Infix_Operators
.Infix_Operator_Access) is
begin
Self.Down (Element.Operator, Self.Solution.Tuple (0));
Self.Down (Element.Left, Self.Solution.Tuple (1));
Self.Down (Element.Right, Self.Solution.Tuple (2));
end Infix_Operator;
overriding procedure Numeric_Literal
(Self : in out Visitor;
Element : not null Program.Elements.Numeric_Literals
.Numeric_Literal_Access) is
begin
null;
end Numeric_Literal;
overriding procedure Operator_Symbol
(Self : in out Visitor;
Element : not null Program.Elements.Operator_Symbols
.Operator_Symbol_Access) is
begin
case Self.Solution.Kind is
when Program.Interpretations.Defining_Name_Solution =>
Self.Setter.Set_Corresponding_Defining_Name
(Element.To_Element,
Program.Visibility.Name (Self.Solution.Name_View));
when others =>
raise Program_Error;
end case;
end Operator_Symbol;
overriding procedure Parameter_Association
(Self : in out Visitor;
Element : not null Program.Elements.Parameter_Associations
.Parameter_Association_Access) is
begin
Self.Visit (Element.Actual_Parameter);
end Parameter_Association;
overriding procedure Record_Aggregate
(Self : in out Visitor;
Element : not null Program.Elements.Record_Aggregates
.Record_Aggregate_Access)
is
View : constant Program.Visibility.View := Self.Solution.Type_View;
begin
for J in Element.Components.Each_Element loop
declare
Compon : Program.Visibility.View;
Assoc : constant Program.Elements.Record_Component_Associations
.Record_Component_Association_Access :=
J.Element.To_Record_Component_Association;
Choices : constant Program.Element_Vectors
.Element_Vector_Access := Assoc.Choices;
begin
pragma Assert (Choices.Length > 0);
for K in Choices.Each_Element loop
Program.Resolvers.Name_In_Region.Resolve_Name
(Region => View,
Name => K.Element.To_Expression,
Setter => Self.Setter);
Compon := Self.Sets.Env.Get_Name_View (K.Element);
Resolve_To_Expected_Type
(Assoc.Component_Value.To_Element,
Self.Sets,
Self.Setter,
Expect => Program.Visibility.Subtype_Mark (Compon));
end loop;
end;
end loop;
end Record_Aggregate;
overriding procedure String_Literal
(Self : in out Visitor;
Element : not null Program.Elements.String_Literals
.String_Literal_Access) is
begin
null;
end String_Literal;
end Down_Visitors;
----------
-- Down --
----------
procedure Down
(Element : not null access Program.Elements.Element'Class;
Solution : Program.Interpretations.Solution;
Setter : not null Program.Cross_Reference_Updaters
.Cross_Reference_Updater_Access;
Sets : not null Program.Interpretations.Context_Access)
is
Down : Down_Visitors.Visitor := (Sets, Setter, False, Solution);
begin
Down.Visit (Element);
end Down;
------------------------
-- Resolve_Parameters --
------------------------
procedure Resolve_Parameters
(Arguments : Program.Interpretations.Interpretation_Set_Array;
Parameters : Program.Visibility.View_Array;
Callback : access procedure
(Down : Program.Interpretations.Solution_Array);
Down : in out Program.Interpretations.Solution_Array;
Index : Positive := 1)
is
use type Program.Interpretations.Expressions.Cursor;
begin
if Arguments'Length /= Parameters'Length then
return;
elsif Index > Down'Last then
Callback (Down);
return;
end if;
for X in Program.Interpretations.Expressions.Each_Of_Type
(Arguments (Index),
Program.Visibility.Type_Of (Parameters (Index)))
loop
Down (Index) := -X;
Resolve_Parameters
(Arguments, Parameters, Callback, Down, Index + 1);
end loop;
end Resolve_Parameters;
-------------------------
-- Resolve_To_Any_Type --
-------------------------
procedure Resolve_To_Any_Type
(Element : not null Program.Elements.Expressions.Expression_Access;
Sets : not null Program.Interpretations.Context_Access;
Setter : not null Program.Cross_Reference_Updaters
.Cross_Reference_Updater_Access;
Result : out Program.Visibility.View)
is
use type Program.Interpretations.Expressions.Cursor;
Set : constant Program.Interpretations.Interpretation_Set :=
Up (Element.To_Element, Sets);
Found : Program.Interpretations.Solution;
Count : Natural := 0;
begin
for N in Program.Interpretations.Expressions.Each (Set) loop
Count := Count + 1;
Found := -N;
Result := +N;
end loop;
if Count > 0 then
Down (Element.To_Element, Found, Setter, Sets);
end if;
end Resolve_To_Any_Type;
------------------------------
-- Resolve_To_Discrete_Type --
------------------------------
procedure Resolve_To_Discrete_Type
(Element : not null Program.Elements.Expressions.Expression_Access;
Sets : not null Program.Interpretations.Context_Access;
Setter : not null Program.Cross_Reference_Updaters
.Cross_Reference_Updater_Access;
Result : out Program.Visibility.View)
is
use type Program.Interpretations.Expressions.Cursor;
Set : constant Program.Interpretations.Interpretation_Set :=
Up (Element, Sets);
Found : Program.Interpretations.Solution;
Count : Natural := 0;
Matcher : Program.Type_Matchers.Discrete_Type_Matcher;
begin
for N in Program.Interpretations.Expressions.Each (Set) loop
if Matcher.Is_Matched (+N) then
Count := Count + 1;
Found := -N;
Result := +N;
end if;
end loop;
if Count > 0 then
Down (Element.To_Element, Found, Setter, Sets);
end if;
end Resolve_To_Discrete_Type;
------------------------------
-- Resolve_To_Expected_Type --
------------------------------
procedure Resolve_To_Expected_Type
(Element : not null Program.Elements.Element_Access;
Sets : not null Program.Interpretations.Context_Access;
Setter : not null Program.Cross_Reference_Updaters
.Cross_Reference_Updater_Access;
Expect : Program.Visibility.View)
is
use type Program.Interpretations.Expressions.Cursor;
Set : constant Program.Interpretations.Interpretation_Set :=
Up (Element, Sets);
Found : Program.Interpretations.Solution;
Count : Natural := 0;
begin
for N in Program.Interpretations.Expressions.Each_Of_Type
(Set, Expect)
loop
Count := Count + 1;
Found := -N;
end loop;
if Count > 0 then
Down (Element.To_Element, Found, Setter, Sets);
end if;
end Resolve_To_Expected_Type;
--------
-- Up --
--------
function Up
(Element : not null access Program.Elements.Element'Class;
Sets : not null Program.Interpretations.Context_Access)
return Program.Interpretations.Interpretation_Set
is
Up : Up_Visitors.Visitor (Sets);
begin
Up.Visit (Element);
return Up.Result;
end Up;
end Program.Complete_Contexts;
|
-----------------------------------------------------------------------
-- Test_Bean - A simple bean for unit tests
-- Copyright (C) 2009, 2010, 2011 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body Test_Bean is
use EL.Objects;
FIRST_NAME : constant String := "firstName";
LAST_NAME : constant String := "lastName";
AGE : constant String := "age";
WEIGHT : constant String := "weight";
function Create_Person (First_Name, Last_Name : String;
Age : Natural) return Person_Access is
begin
return new Person '(First_Name => To_Unbounded_String (First_Name),
Last_Name => To_Unbounded_String (Last_Name),
Age => Age,
Date => Ada.Calendar.Clock,
Weight => 12.0);
end Create_Person;
-- Get the value identified by the name.
function Get_Value (From : Person; Name : String) return EL.Objects.Object is
begin
if Name = FIRST_NAME then
return To_Object (From.First_Name);
elsif Name = LAST_NAME then
return To_Object (From.Last_Name);
elsif Name = AGE then
return To_Object (From.Age);
elsif Name = WEIGHT then
return To_Object (From.Weight);
-- elsif Name = DATE then
-- return To_Object (From.Date);
else
return EL.Objects.Null_Object;
end if;
end Get_Value;
-- Set the value identified by the name.
procedure Set_Value (From : in out Person;
Name : in String;
Value : in EL.Objects.Object) is
begin
if Name = FIRST_NAME then
From.First_Name := To_Unbounded_String (Value);
elsif Name = LAST_NAME then
From.Last_Name := To_Unbounded_String (Value);
elsif Name = AGE then
From.Age := Natural (To_Integer (Value));
elsif Name = WEIGHT then
From.Weight := To_Long_Long_Float (Value);
-- elsif Name = DATE then
-- From.Date := To_Time (Value);
else
raise EL.Objects.No_Value;
end if;
end Set_Value;
-- Function to format a string
function Format (Arg : EL.Objects.Object) return EL.Objects.Object is
S : constant String := To_String (Arg);
begin
return To_Object ("[" & S & "]");
end Format;
end Test_Bean;
|
with Interfaces;
with kv.avm.Executables;
with kv.avm.Instructions;
with kv.avm.Registers;
with kv.avm.Actors;
with kv.avm.Processors;
with kv.avm.Frames;
with kv.avm.Actor_References;
with kv.avm.Actor_References.Sets;
with kv.avm.Messages;
with kv.avm.Tuples;
with kv.avm.control;
with kv.avm.Memories;
package kv.avm.Instances is
use Interfaces;
use kv.avm.Messages;
type Instance_Type is new kv.avm.Executables.Executable_Interface with private;
type Instance_Access is access all Instance_Type;
function "+"(RHS : Instance_Access) return kv.avm.Executables.Executable_Access;
procedure Initialize
(Self : access Instance_Type;
Actor : in kv.avm.Actors.Actor_Access;
Memory : in kv.avm.Memories.Memory_Type;
Myself : in kv.avm.Actor_References.Actor_Reference_Type);
-- Routine used in unit tests
function Get_Frame(Self : Instance_Type) return kv.avm.Frames.Frame_Access;
overriding
procedure Process_Message
(Self : in out Instance_Type;
Message : in kv.avm.Messages.Message_Type);
overriding
procedure Process_Gosub
(Self : access Instance_Type;
Tailcall : in Boolean;
Supercall : in Boolean;
Reply_To : in kv.avm.Actor_References.Actor_Reference_Type;
Method : in kv.avm.Registers.String_Type;
Data : access constant kv.avm.Memories.Register_Set_Type;
Future : in Interfaces.Unsigned_32);
overriding
function Can_Accept_Message_Now(Self : Instance_Type; Message : kv.avm.Messages.Message_Type) return Boolean;
overriding
function Program_Counter
(Self : in Instance_Type) return Interfaces.Unsigned_32;
overriding
function Is_Running
(Self : in Instance_Type) return Boolean;
overriding
procedure Step
(Self : access Instance_Type;
Processor : access kv.avm.Processors.Processor_Type;
Status : out kv.avm.Control.Status_Type);
overriding
procedure Process_Internal_Response
(Self : in out Instance_Type;
Answer : in kv.avm.Tuples.Tuple_Type);
overriding
procedure Resolve_Future
(Self : in out Instance_Type;
Answer : in kv.avm.Tuples.Tuple_Type;
Future : in Interfaces.Unsigned_32);
function Alive(Self : Instance_Type) return Boolean;
overriding
procedure Halt_Actor
(Self : in out Instance_Type);
overriding
function Reachable(Self : Instance_Type) return kv.avm.Actor_References.Sets.Set;
overriding
function Image(Self : Instance_Type) return String;
overriding
function Debug_Info(Self : Instance_Type) return String;
type Instance_Factory is new kv.avm.Executables.Executable_Factory with null record;
overriding
procedure New_Executable
(Self : in out Instance_Factory;
Actor : in kv.avm.Actors.Actor_Access;
Machine : in kv.avm.Control.Control_Access;
Executable : out kv.avm.Executables.Executable_Access;
Reference : out kv.avm.Actor_References.Actor_Reference_Type);
private
type Instance_Type is new kv.avm.Executables.Executable_Interface with
record
Actor : kv.avm.Actors.Actor_Access;
Myself : kv.avm.Actor_References.Actor_Reference_Type;
Pc : Interfaces.Unsigned_32;
Memory : kv.avm.Memories.Memory_Type;
Attributes : kv.avm.Memories.Register_Array_Type;
Constants : kv.avm.Memories.Register_Array_Type;
Frame : kv.avm.Frames.Frame_Access;
Alive : Boolean;
end record;
end kv.avm.Instances;
|
package body String_Vectors is
function Is_In(List: Vec;
Word: String;
Start: Positive; Stop: Natural) return Boolean is
Middle: Positive;
begin
if Start > Stop then
return False;
else
Middle := (Start+Stop) / 2;
if List.Element(Middle) = Word then
return True;
elsif List.Element(Middle) < Word then
return List.Is_In(Word, Middle+1, Stop);
else
return List.Is_In(Word, Start, Middle-1);
end if;
end if;
end Is_In;
function Read(Filename: String) return Vec is
package IO renames Ada.Text_IO;
Persistent_List: IO.File_Type;
List: Vec;
begin
IO.Open(File => Persistent_List, Name => Filename, Mode => IO.In_File);
while not IO.End_Of_File(Persistent_List) loop
List.Append(New_Item => IO.Get_Line(Persistent_List));
end loop;
IO.Close(Persistent_List);
return List;
end Read;
end String_Vectors;
|
-- SPDX-FileCopyrightText: 2021 Max Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Ada.Iterator_Interfaces;
with League.Strings;
with WebIDL.Types;
package WebIDL.Arguments is
pragma Preelaborate;
type Argument is limited interface;
function Assigned (Self : access Argument'Class) return Boolean is
(Self /= null);
type Argument_Access is access all Argument'Class
with Storage_Size => 0;
not overriding function Name (Self : Argument)
return League.Strings.Universal_String is abstract;
not overriding function Is_Optional (Self : Argument)
return Boolean is abstract;
not overriding function Has_Ellipsis (Self : Argument)
return Boolean is abstract;
not overriding function Get_Type (Self : Argument)
return not null WebIDL.Types.Type_Access is abstract;
type Cursor is record
Index : Positive;
Argument : Argument_Access;
end record;
function Has_Element (Self : Cursor) return Boolean is
(Self.Argument.Assigned);
package Iterators is new Ada.Iterator_Interfaces (Cursor, Has_Element);
type Argument_Iterator_Access is access constant
Iterators.Forward_Iterator'Class
with Storage_Size => 0;
end WebIDL.Arguments;
|
with Ada.Text_IO;
with Dot;
procedure Demo_Dot is
package ATI renames Ada.Text_IO;
NL : constant String := (1 => ASCII.LF);
-- Support subprograms:
procedure Print (Graph : in Dot.Graphs.Access_Class;
Title : in String) is
begin
ATI.Put_Line ("// " & Title & ":");
ATI.Put_Line ("//");
Graph.Put (ATI.Standard_Output);
ATI.New_Line;
ATI.New_Line;
end;
function Create_Graph return Dot.Graphs.Access_Class is
begin
return Dot.Graphs.Create (Is_Digraph => True,
Is_Strict => False);
end;
-- Demo subprograms:
procedure Demo_Default_Graph is
Graph : Dot.Graphs.Access_Class := new Dot.Graphs.Class; -- Initialized
begin
Print (Graph, "Default Graph");
end;
procedure Demo_Graph is
Graph : Dot.Graphs.Access_Class := Create_Graph;
begin
Graph.Set_Is_Digraph (False);
Graph.Set_Is_Strict (False);
Print (Graph, "Graph");
end;
procedure Demo_Digraph is
Graph : Dot.Graphs.Access_Class := Create_Graph;
begin
Graph.Set_Is_Digraph (True);
Graph.Set_Is_Strict (False);
Print (Graph, "Digraph");
end;
procedure Demo_Strict_Graph is
Graph : Dot.Graphs.Access_Class := Create_Graph;
begin
Graph.Set_Is_Digraph (False);
Graph.Set_Is_Strict (True);
Print (Graph, "Strict Graph");
end;
procedure Demo_Strict_Digraph is
Graph : Dot.Graphs.Access_Class := Create_Graph;
begin
Graph.Set_Is_Digraph (True);
Graph.Set_Is_Strict (True);
Print (Graph, "Strict Digraph");
end;
procedure Demo_ID is
Graph : Dot.Graphs.Access_Class := Create_Graph;
begin
Graph.Set_ID ("Some_ID");
Print (Graph, "Graph with ID");
end;
procedure Demo_Reserved_ID is
Graph : Dot.Graphs.Access_Class := Create_Graph;
begin
Graph.Set_ID ("graph");
Print (Graph, "Graph with reserved word as ID");
end;
procedure Demo_Minimal_Node is
Graph : Dot.Graphs.Access_Class := Create_Graph;
Node_Stmt_1 : Dot.Node_Stmt.Class; -- Initialized
begin
Node_Stmt_1.Node_ID.ID := Dot.To_ID_Type ("minimal_node");
Graph.Append_Stmt (new Dot.Node_Stmt.Class'(Node_Stmt_1));
Print (Graph, "One minimal node");
end;
procedure Demo_Two_Nodes is
Graph : Dot.Graphs.Access_Class := Create_Graph;
Node_Stmt_1 : Dot.Node_Stmt.Class; -- Initialized
Node_Stmt_2 : Dot.Node_Stmt.Class; -- Initialized
begin
Node_Stmt_1.Node_ID.ID := Dot.To_ID_Type ("minimal_node_1");
Graph.Append_Stmt (new Dot.Node_Stmt.Class'(Node_Stmt_1));
Node_Stmt_2.Node_ID.ID := Dot.To_ID_Type ("minimal_node_2");
Graph.Append_Stmt (new Dot.Node_Stmt.Class'(Node_Stmt_2));
Print (Graph, "Two minimal nodes");
end;
procedure Demo_One_Attr_Two_Assigns is
Graph : Dot.Graphs.Access_Class := Create_Graph;
Node_Stmt_2 : Dot.Node_Stmt.Class; -- Initialized
Attr_1 : Dot.Attr.Class; -- Initialized
begin
Node_Stmt_2.Node_ID.ID := Dot.To_ID_Type ("node_with_attr");
Attr_1.A_List.Append ("Today", "Thursday");
Attr_1.A_List.Append ("Tomorrow", "Friday");
Node_Stmt_2.Attr_List.Append (Attr_1);
Graph.Append_Stmt (new Dot.Node_Stmt.Class'(Node_Stmt_2));
Print (Graph, "One node, one attr, two assigns");
end;
procedure Demo_Two_Attrs_One_Assign_Each is
Graph : Dot.Graphs.Access_Class := Create_Graph;
Node_Stmt_2 : Dot.Node_Stmt.Class; -- Initialized
Attr_1 : Dot.Attr.Class; -- Initialized
Attr_2 : Dot.Attr.Class; -- Initialized
begin
Node_Stmt_2.Node_ID.ID := Dot.To_ID_Type ("node_with_attrs");
Attr_1.A_List.Append ("Today", "Thursday");
Node_Stmt_2.Attr_List.Append (Attr_1);
Attr_2.A_List.Append ("Now", "Day");
Node_Stmt_2.Attr_List.Append (Attr_2);
Graph.Append_Stmt (new Dot.Node_Stmt.Class'(Node_Stmt_2));
Print (Graph, "One node, two attrs, one assign each");
end;
procedure Demo_Two_Attrs_No_Assigns is
Graph : Dot.Graphs.Access_Class := Create_Graph;
Node_Stmt_2 : Dot.Node_Stmt.Class; -- Initialized
Attr_1 : Dot.Attr.Class; -- Initialized
Attr_2 : Dot.Attr.Class; -- Initialized
begin
Node_Stmt_2.Node_ID.ID := Dot.To_ID_Type ("node_with_attrs");
Node_Stmt_2.Attr_List.Append (Attr_1);
Node_Stmt_2.Attr_List.Append (Attr_2);
Graph.Append_Stmt (new Dot.Node_Stmt.Class'(Node_Stmt_2));
Print (Graph, "One node, two attrs, no assigns");
end;
procedure Demo_Two_Nodes_Two_Attrs_Two_Assigns is
Graph : Dot.Graphs.Access_Class := Create_Graph;
Node_Stmt_1 : Dot.Node_Stmt.Class; -- Initialized
Node_Stmt_2 : Dot.Node_Stmt.Class; -- Initialized
Attr_1 : Dot.Attr.Class; -- Initialized
Attr_2 : Dot.Attr.Class; -- Initialized
Attr_3 : Dot.Attr.Class; -- Initialized
Attr_4 : Dot.Attr.Class; -- Initialized
begin
Node_Stmt_1.Node_ID.ID := Dot.To_ID_Type ("node_1");
Attr_1.A_List.Append ("Today", "Thursday");
Attr_1.A_List.Append ("Tomorrow", "Friday");
Node_Stmt_1.Attr_List.Append (Attr_1);
Attr_2.A_List.Append ("Now", "Day");
Attr_2.A_List.Append ("Later", "Night");
Node_Stmt_1.Attr_List.Append (Attr_2);
Graph.Append_Stmt (new Dot.Node_Stmt.Class'(Node_Stmt_1));
Node_Stmt_2.Node_ID.ID := Dot.To_ID_Type ("node_2");
Attr_3.A_List.Append ("Today", "Thursday");
Attr_3.A_List.Append ("Yesterday", "Wednesday");
Node_Stmt_2.Attr_List.Append (Attr_3);
Attr_4.A_List.Append ("Now", "Day");
Attr_4.A_List.Append ("Before", "Morning");
Node_Stmt_2.Attr_List.Append (Attr_4);
Graph.Append_Stmt (new Dot.Node_Stmt.Class'(Node_Stmt_2));
Print (Graph, "Two nodes, two attrs, two assigns");
end;
procedure Demo_Add_Assign_To_First_Attr is
Graph : Dot.Graphs.Access_Class := Create_Graph;
Node_Stmt_2 : Dot.Node_Stmt.Class; -- Initialized
begin
Node_Stmt_2.Node_ID.ID := Dot.To_ID_Type ("node_with_attr");
Node_Stmt_2.Attr_List.Add_Assign_To_First_Attr ("Today", "Thursday");
Node_Stmt_2.Attr_List.Add_Assign_To_First_Attr ("Tomorrow", "Friday");
Graph.Append_Stmt (new Dot.Node_Stmt.Class'(Node_Stmt_2));
Print (Graph, "One node, one attr, two assigns, using Add_Assign_To_First_Attr");
end;
procedure Demo_Default_Edge is
Graph : Dot.Graphs.Access_Class := Create_Graph;
Edge_Stmt : Dot.Edges.Stmts.Class; -- Initialized
begin
Graph.Append_Stmt (new Dot.Edges.Stmts.Class'(Edge_Stmt));
Print (Graph, "One default edge");
end;
procedure Demo_One_Edge is
Graph : Dot.Graphs.Access_Class := Create_Graph;
Edge_Stmt : Dot.Edges.Stmts.Class; -- Initialized
begin
Edge_Stmt.LHS.Node_Id.ID := Dot.To_ID_Type ("A");
Edge_Stmt.RHS.Node_Id.ID := Dot.To_ID_Type ("B");
Graph.Append_Stmt (new Dot.Edges.Stmts.Class'(Edge_Stmt));
Print (Graph, "One edge stmt");
end;
procedure Demo_Two_Edges is
Graph : Dot.Graphs.Access_Class := Create_Graph;
Edge_Stmts : array (1..2) of Dot.Edges.Stmts.Class; -- Initialized
begin
Edge_Stmts (1).LHS.Node_Id.ID := Dot.To_ID_Type ("A");
Edge_Stmts (1).RHS.Node_Id.ID := Dot.To_ID_Type ("B");
Graph.Append_Stmt (new Dot.Edges.Stmts.Class'(Edge_Stmts (1)));
Edge_Stmts (2).LHS.Node_Id.ID := Dot.To_ID_Type ("C");
Edge_Stmts (2).RHS.Node_Id.ID := Dot.To_ID_Type ("D");
Graph.Append_Stmt (new Dot.Edges.Stmts.Class'(Edge_Stmts (2)));
Print (Graph, "Two edge stmts");
end;
procedure Demo_HTML_Like_Label is
Graph : Dot.Graphs.Access_Class := Create_Graph;
Node_Stmt : Dot.Node_Stmt.Class; -- Initialized
-- Attr_Stmt : Dot.Attr_Stmt.Class; -- Initialized
HL_Label : Dot.HTML_Like_Labels.Class; -- Initialized
begin
Node_Stmt.Node_ID.ID := Dot.To_ID_Type ("node_1");
-- Optional - node shape defaults to none:
-- Attr_Stmt.Kind := Dot.Attr_Stmt.Node;
-- Attr_Stmt_Attr.A_List.Append ("shape", "none");
-- Attr_Stmt.Attr_List.Append (Attr_Stmt_Attr);
-- Graph.Append_Stmt (new Dot.Attr_Stmt.Class'(Attr_Stmt));
HL_Label.Add_Eq_Row ("Element_Kind", "AN_EXPRESSION");
HL_Label.Add_Eq_Row ("Expression_Kind", "AN_IDENTIFIER");
HL_Label.Add_Eq_Row ("Name_Image", "Text_IO");
Node_Stmt.Add_Label (HL_Label);
Graph.Append_Stmt (new Dot.Node_Stmt.Class'(Node_Stmt));
Print (Graph, "One node, with HTML-like label");
end;
procedure Demo_File_Output is
Graph : Dot.Graphs.Access_Class := Create_Graph;
Name : constant String := "demo_dot";
begin
Graph.Set_Is_Digraph (False);
Graph.Set_Is_Strict (False);
ATI.Put_Line ("// " & "Writing file to " & Name & ".dot");
ATI.Put_Line ("//");
Graph.Write_File
(Name => Name,
Overwrite => True);
ATI.Put_Line ("// " & "Done.");
ATI.New_Line;
end;
begin
Demo_Default_Graph;
Demo_Graph;
Demo_Digraph;
Demo_Strict_Graph;
Demo_Strict_Digraph;
Demo_ID;
Demo_Reserved_ID;
Demo_Minimal_Node;
Demo_Two_Nodes;
Demo_One_Attr_Two_Assigns;
Demo_Two_Attrs_One_Assign_Each;
Demo_Two_Attrs_No_Assigns;
Demo_Two_Nodes_Two_Attrs_Two_Assigns;
Demo_Add_Assign_To_First_Attr;
Demo_Default_Edge;
Demo_One_Edge;
Demo_Two_Edges;
Demo_HTML_Like_Label;
Demo_File_Output;
end Demo_Dot;
|
-----------------------------------------------------------------------
-- popen -- Print the GNAT version by using a pipe
-- Copyright (C) 2011, 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 Ada.Text_IO;
with Ada.Strings.Unbounded;
with Util.Processes;
with Util.Streams.Pipes;
with Util.Streams.Buffered;
procedure Popen is
Command : constant String := "gnatmake --version";
Pipe : aliased Util.Streams.Pipes.Pipe_Stream;
Buffer : Util.Streams.Buffered.Input_Buffer_Stream;
Content : Ada.Strings.Unbounded.Unbounded_String;
begin
Pipe.Open (Command, Util.Processes.READ);
Buffer.Initialize (Pipe'Unchecked_Access, 1024);
Buffer.Read (Content);
Pipe.Close;
if Pipe.Get_Exit_Status /= 0 then
Ada.Text_IO.Put_Line (Command & " exited with status "
& Integer'Image (Pipe.Get_Exit_Status));
return;
end if;
Ada.Text_IO.Put_Line ("Result: " & Ada.Strings.Unbounded.To_String (Content));
end Popen;
|
with System.Address_To_Constant_Access_Conversions;
with System.Address_To_Named_Access_Conversions;
with System.Storage_Elements;
package body Interfaces.C.Generic_Strings is
use type Pointers.Constant_Pointer;
use type Pointers.Pointer;
use type System.Storage_Elements.Storage_Offset;
package libc is
function malloc (size : size_t) return chars_ptr
with Import,
Convention => Intrinsic, External_Name => "__builtin_malloc";
procedure free (ptr : chars_ptr)
with Import,
Convention => Intrinsic, External_Name => "__builtin_free";
end libc;
package chars_ptr_Conv is
new System.Address_To_Named_Access_Conversions (Element, chars_ptr);
package const_chars_ptr_Conv is
new System.Address_To_Constant_Access_Conversions (
Element,
const_chars_ptr);
-- implementation
function To_Chars_Ptr (
Item : access Element_Array;
Nul_Check : Boolean := False)
return chars_ptr is
begin
if Item = null then
return null;
else
if Nul_Check then
-- raise Terminator_Error when Item contains no nul
if Element'Size = char'Size
and then Element_Array'Component_Size =
char_array'Component_Size
-- 'Scalar_Storage_Order is unrelated since searching 0
then
declare
Source : char_array (Item'Range);
for Source'Address use Item.all'Address;
Dummy : size_t;
begin
Dummy := Length (Source);
end;
elsif Element'Size = wchar_t'Size
and then Element_Array'Component_Size =
wchar_array'Component_Size
then
declare
Source : wchar_array (Item'Range);
for Source'Address use Item.all'Address;
Dummy : size_t;
begin
Dummy := Length (Source);
end;
else
declare
I : size_t := Item'First;
begin
if I > Item'Last then
raise Terminator_Error; -- Item'Length = 0
end if;
loop
exit when Item (I) = Element'Val (0);
if I >= Item'Last then
raise Terminator_Error;
end if;
I := I + 1;
end loop;
end;
end if;
end if;
return chars_ptr_Conv.To_Pointer (Item.all'Address);
end if;
end To_Chars_Ptr;
function To_Const_Chars_Ptr (Item : not null access constant Element_Array)
return not null const_chars_ptr is
begin
return const_chars_ptr_Conv.To_Pointer (Item.all'Address);
end To_Const_Chars_Ptr;
function New_Char_Array (Chars : Element_Array)
return not null chars_ptr is
begin
return New_Chars_Ptr (
const_chars_ptr_Conv.To_Pointer (Chars'Address),
Chars'Length); -- CXB3009, accept non-nul terminated
end New_Char_Array;
function New_String (
Str : String_Type;
Substitute : Element_Array :=
(0 => Element'Val (Character'Pos ('?'))))
return not null chars_ptr
is
C : aliased constant Element_Array :=
To_C (Str, Append_Nul => True, Substitute => Substitute);
begin
return New_Chars_Ptr (
const_chars_ptr_Conv.To_Pointer (C'Address),
C'Length - 1);
end New_String;
function New_Chars_Ptr (Length : size_t) return not null chars_ptr is
Size : constant System.Storage_Elements.Storage_Count :=
(System.Storage_Elements.Storage_Offset (Length) + 1) -- appending nul
* (Element_Array'Component_Size / Standard'Storage_Unit);
Result : constant chars_ptr := libc.malloc (C.size_t (Size));
begin
if Result = null then
raise Storage_Error;
end if;
Result.all := Element'Val (0);
return Result;
end New_Chars_Ptr;
function New_Chars_Ptr (
Item : not null access constant Element;
Length : size_t)
return not null chars_ptr
is
Result : constant chars_ptr := New_Chars_Ptr (Length);
begin
Pointers.Copy_Array (
Source => Item,
Target => Result,
Length => ptrdiff_t (Length));
chars_ptr'(Result + ptrdiff_t (Length)).all := Element'Val (0);
return Result;
end New_Chars_Ptr;
function New_Chars_Ptr (Item : not null access constant Element)
return not null chars_ptr is
begin
return New_Chars_Ptr (Item, Strlen (Item));
end New_Chars_Ptr;
function New_Strcat (Items : const_chars_ptr_array)
return not null chars_ptr
is
Lengths : array (Items'Range) of size_t;
Total_Length : size_t;
begin
-- get length
Total_Length := 1; -- appending nul
for I in Items'Range loop
Lengths (I) := Strlen (Items (I));
Total_Length := Total_Length + Lengths (I);
end loop;
declare
-- allocate
Result : constant chars_ptr := New_Chars_Ptr (Total_Length);
P : chars_ptr := Result;
begin
-- copy
for I in Items'Range loop
Pointers.Copy_Array (Items (I), P, ptrdiff_t (Lengths (I)));
P := P + ptrdiff_t (Lengths (I));
end loop;
P.all := Element'Val (0);
return Result;
end;
end New_Strcat;
function New_Strcat (Items : const_chars_ptr_With_Length_array)
return not null chars_ptr
is
Total_Length : size_t;
begin
-- get length
Total_Length := 1; -- appending nul
for I in Items'Range loop
Total_Length := Total_Length + Items (I).Length;
end loop;
declare
-- allocate
Result : constant chars_ptr := New_Chars_Ptr (Total_Length);
P : chars_ptr := Result;
begin
-- copy
for I in Items'Range loop
declare
E : const_chars_ptr_With_Length renames Items (I);
begin
Pointers.Copy_Array (E.ptr, P, ptrdiff_t (E.Length));
P := P + ptrdiff_t (E.Length);
end;
end loop;
P.all := Element'Val (0);
return Result;
end;
end New_Strcat;
procedure Free (Item : in out chars_ptr) is
begin
libc.free (Item);
Item := null;
end Free;
function Value (
Item : access constant Element)
return Element_Array
is
Length : constant size_t := Strlen (Item); -- checking Dereference_Error
begin
return Pointers.Value (
Item,
ptrdiff_t (Length + 1)); -- CXB3009, including nul
end Value;
function Value (
Item : access constant Element;
Length : size_t;
Append_Nul : Boolean := False)
return Element_Array
is
pragma Check (Pre,
Check =>
Standard."/=" (Item, null) -- operator for anonymous access
or else Length = 0
or else raise Dereference_Error); -- CXB3010
Actual_Length : size_t;
begin
if not Append_Nul and then Length = 0 then
raise Constraint_Error; -- CXB3010
end if;
if Standard."=" (Item, null) then -- operator for anonymous access
Actual_Length := 0;
else
Actual_Length := Strlen (Item, Limit => Length) + 1; -- including nul
end if;
if Append_Nul and then Length < Actual_Length then
if Length = 0 then
return (0 => Element'Val (0));
else
declare
Source : Element_Array (0 .. Actual_Length - 1);
for Source'Address use const_chars_ptr_Conv.To_Address (Item);
begin
return Source (0 .. Length - 1) & Element'Val (0);
end;
end if;
else
return Pointers.Value (
Item,
ptrdiff_t (size_t'Min (Actual_Length, Length)));
-- CXB3010, not appending nul
end if;
end Value;
function Value (
Item : access constant Element;
Substitute : String_Type :=
(1 => Character_Type'Val (Character'Pos ('?'))))
return String_Type
is
Actual_Length : constant size_t := Strlen (Item); -- checking
First : size_t;
Last : size_t;
begin
if Actual_Length = 0 then
First := 1;
Last := 0;
else
First := 0;
Last := Actual_Length - 1;
end if;
declare
Source : Element_Array (First .. Last);
for Source'Address use const_chars_ptr_Conv.To_Address (Item);
begin
return To_Ada (Source, Trim_Nul => False, Substitute => Substitute);
end;
end Value;
function Value (
Item : access constant Element;
Length : size_t;
Substitute : String_Type :=
(1 => Character_Type'Val (Character'Pos ('?'))))
return String_Type
is
pragma Check (Dynamic_Predicate,
Check =>
Standard."/=" (Item, null) -- operator for anonymous access
or else raise Dereference_Error); -- CXB3011
Actual_Length : constant size_t := Strlen (Item, Limit => Length);
First : size_t;
Last : size_t;
begin
if Actual_Length = 0 then
First := 1;
Last := 0;
else
First := 0;
Last := Actual_Length - 1;
end if;
declare
Source : Element_Array (First .. Last);
for Source'Address use const_chars_ptr_Conv.To_Address (Item);
begin
return To_Ada (Source, Trim_Nul => False, Substitute => Substitute);
end;
end Value;
function Strlen (
Item : access constant Element)
return size_t
is
pragma Check (Dynamic_Predicate,
Check =>
Standard."/=" (Item, null) -- operator for anonymous access
or else raise Dereference_Error); -- CXB3011
begin
if Element'Size = char'Size
and then Element_Array'Component_Size = char_array'Component_Size
-- 'Scalar_Storage_Order is unrelated since searching 0
then
declare
function strlen (s : not null access constant Element)
return size_t
with Import,
Convention => Intrinsic, External_Name => "__builtin_strlen";
begin
return strlen (Item);
end;
elsif Element'Size = wchar_t'Size
and then Element_Array'Component_Size = wchar_array'Component_Size
then
declare
function wcslen (s : not null access constant Element)
return size_t
with Import, Convention => C;
begin
return wcslen (Item);
end;
else
declare
S : not null const_chars_ptr := Item;
Length : size_t := 0;
begin
while S.all /= Element'Val (0) loop
Length := Length + 1;
S := S + ptrdiff_t'(1);
end loop;
return Length;
end;
end if;
end Strlen;
function Strlen (Item : not null access constant Element; Limit : size_t)
return size_t
is
Result : size_t;
begin
if Element'Size = char'Size
and then Element_Array'Component_Size = char_array'Component_Size
then
declare
function memchr (
s : not null access constant Element;
c : int;
n : size_t)
return const_chars_ptr
with Import,
Convention => Intrinsic, External_Name => "__builtin_memchr";
P : constant const_chars_ptr := memchr (Item, 0, Limit);
begin
if P = null then
Result := Limit;
else
Result := size_t (P - Item);
end if;
end;
elsif Element'Size = wchar_t'Size
and then Element_Array'Component_Size = wchar_array'Component_Size
then
declare
function wmemchr (
ws : not null access constant Element;
wc : int;
n : size_t)
return const_chars_ptr
with Import, Convention => C;
P : constant const_chars_ptr := wmemchr (Item, 0, Limit);
begin
if P = null then
Result := Limit;
else
Result := size_t (P - Item);
end if;
end;
else
declare
Source : Element_Array (0 .. Limit - 1);
for Source'Address use const_chars_ptr_Conv.To_Address (Item);
begin
Result := 0;
while Result < Limit
and then Source (Result) /= Element'Val (0)
loop
Result := Result + 1;
end loop;
end;
end if;
return Result;
end Strlen;
procedure Update (
Item : access Element;
Offset : size_t;
Chars : Element_Array;
Check : Boolean := True)
is
pragma Check (Dynamic_Predicate,
Check =>
Standard."/=" (Item, null) -- operator for anonymous access
or else raise Dereference_Error); -- CXB3011
Chars_Length : constant C.size_t := Chars'Length;
begin
if Check and then Offset + Chars_Length > Strlen (Item) then
raise Update_Error;
end if;
declare
Target : constant not null chars_ptr := Item;
begin
Pointers.Copy_Array (
Source => chars_ptr_Conv.To_Pointer (Chars'Address),
Target => Target + ptrdiff_t (Offset),
Length => ptrdiff_t (Chars_Length));
end;
end Update;
procedure Update (
Item : access Element;
Offset : size_t;
Str : String_Type;
Check : Boolean := True;
Substitute : Element_Array :=
(0 => Element'Val (Character'Pos ('?'))))
is
Chars : constant Element_Array :=
To_C (Str, Append_Nul => True, Substitute => Substitute);
First, Last : C.size_t;
begin
if Chars'First >= Chars'Last then -- Chars'Length <= 1
First := Chars'First + 1;
Last := Chars'First;
else
First := Chars'First;
Last := Chars'Last - 1;
end if;
Update (
Item, -- checking Dereference_Error
Offset,
Chars (First .. Last),
Check);
end Update;
end Interfaces.C.Generic_Strings;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- R E P I N F O --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1999-2001 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Alloc; use Alloc;
with Atree; use Atree;
with Casing; use Casing;
with Debug; use Debug;
with Einfo; use Einfo;
with Lib; use Lib;
with Namet; use Namet;
with Opt; use Opt;
with Output; use Output;
with Sinfo; use Sinfo;
with Sinput; use Sinput;
with Table; use Table;
with Uname; use Uname;
with Urealp; use Urealp;
package body Repinfo is
SSU : constant := 8;
-- Value for Storage_Unit, we do not want to get this from TTypes, since
-- this introduces problematic dependencies in ASIS, and in any case this
-- value is assumed to be 8 for the implementation of the DDA.
-- This is wrong for AAMP???
---------------------------------------
-- Representation of gcc Expressions --
---------------------------------------
-- This table is used only if Frontend_Layout_On_Target is False,
-- so that gigi lays out dynamic size/offset fields using encoded
-- gcc expressions.
-- A table internal to this unit is used to hold the values of
-- back annotated expressions. This table is written out by -gnatt
-- and read back in for ASIS processing.
-- Node values are stored as Uint values which are the negative of
-- the node index in this table. Constants appear as non-negative
-- Uint values.
type Exp_Node is record
Expr : TCode;
Op1 : Node_Ref_Or_Val;
Op2 : Node_Ref_Or_Val;
Op3 : Node_Ref_Or_Val;
end record;
package Rep_Table is new Table.Table (
Table_Component_Type => Exp_Node,
Table_Index_Type => Nat,
Table_Low_Bound => 1,
Table_Initial => Alloc.Rep_Table_Initial,
Table_Increment => Alloc.Rep_Table_Increment,
Table_Name => "BE_Rep_Table");
--------------------------------------------------------------
-- Representation of Front-End Dynamic Size/Offset Entities --
--------------------------------------------------------------
package Dynamic_SO_Entity_Table is new Table.Table (
Table_Component_Type => Entity_Id,
Table_Index_Type => Nat,
Table_Low_Bound => 1,
Table_Initial => Alloc.Rep_Table_Initial,
Table_Increment => Alloc.Rep_Table_Increment,
Table_Name => "FE_Rep_Table");
-----------------------
-- Local Subprograms --
-----------------------
Unit_Casing : Casing_Type;
-- Identifier casing for current unit
procedure Spaces (N : Natural);
-- Output given number of spaces
function Back_End_Layout return Boolean;
-- Test for layout mode, True = back end, False = front end. This
-- function is used rather than checking the configuration parameter
-- because we do not want Repinfo to depend on Targparm (for ASIS)
procedure List_Entities (Ent : Entity_Id);
-- This procedure lists the entities associated with the entity E,
-- starting with the First_Entity and using the Next_Entity link.
-- If a nested package is found, entities within the package are
-- recursively processed.
procedure List_Name (Ent : Entity_Id);
-- List name of entity Ent in appropriate case. The name is listed with
-- full qualification up to but not including the compilation unit name.
procedure List_Array_Info (Ent : Entity_Id);
-- List representation info for array type Ent
procedure List_Object_Info (Ent : Entity_Id);
-- List representation info for object Ent
procedure List_Record_Info (Ent : Entity_Id);
-- List representation info for record type Ent
procedure List_Type_Info (Ent : Entity_Id);
-- List type info for type Ent
function Rep_Not_Constant (Val : Node_Ref_Or_Val) return Boolean;
-- Returns True if Val represents a variable value, and False if it
-- represents a value that is fixed at compile time.
procedure Write_Val (Val : Node_Ref_Or_Val; Paren : Boolean := False);
-- Given a representation value, write it out. No_Uint values or values
-- dependent on discriminants are written as two question marks. If the
-- flag Paren is set, then the output is surrounded in parentheses if
-- it is other than a simple value.
---------------------
-- Back_End_Layout --
---------------------
function Back_End_Layout return Boolean is
begin
-- We have back end layout if the back end has made any entries in
-- the table of GCC expressions, otherwise we have front end layout.
return Rep_Table.Last > 0;
end Back_End_Layout;
------------------------
-- Create_Discrim_Ref --
------------------------
function Create_Discrim_Ref
(Discr : Entity_Id)
return Node_Ref
is
N : constant Uint := Discriminant_Number (Discr);
T : Nat;
begin
Rep_Table.Increment_Last;
T := Rep_Table.Last;
Rep_Table.Table (T).Expr := Discrim_Val;
Rep_Table.Table (T).Op1 := N;
Rep_Table.Table (T).Op2 := No_Uint;
Rep_Table.Table (T).Op3 := No_Uint;
return UI_From_Int (-T);
end Create_Discrim_Ref;
---------------------------
-- Create_Dynamic_SO_Ref --
---------------------------
function Create_Dynamic_SO_Ref
(E : Entity_Id)
return Dynamic_SO_Ref
is
T : Nat;
begin
Dynamic_SO_Entity_Table.Increment_Last;
T := Dynamic_SO_Entity_Table.Last;
Dynamic_SO_Entity_Table.Table (T) := E;
return UI_From_Int (-T);
end Create_Dynamic_SO_Ref;
-----------------
-- Create_Node --
-----------------
function Create_Node
(Expr : TCode;
Op1 : Node_Ref_Or_Val;
Op2 : Node_Ref_Or_Val := No_Uint;
Op3 : Node_Ref_Or_Val := No_Uint)
return Node_Ref
is
T : Nat;
begin
Rep_Table.Increment_Last;
T := Rep_Table.Last;
Rep_Table.Table (T).Expr := Expr;
Rep_Table.Table (T).Op1 := Op1;
Rep_Table.Table (T).Op2 := Op2;
Rep_Table.Table (T).Op3 := Op3;
return UI_From_Int (-T);
end Create_Node;
---------------------------
-- Get_Dynamic_SO_Entity --
---------------------------
function Get_Dynamic_SO_Entity
(U : Dynamic_SO_Ref)
return Entity_Id
is
begin
return Dynamic_SO_Entity_Table.Table (-UI_To_Int (U));
end Get_Dynamic_SO_Entity;
-----------------------
-- Is_Dynamic_SO_Ref --
-----------------------
function Is_Dynamic_SO_Ref (U : SO_Ref) return Boolean is
begin
return U < Uint_0;
end Is_Dynamic_SO_Ref;
----------------------
-- Is_Static_SO_Ref --
----------------------
function Is_Static_SO_Ref (U : SO_Ref) return Boolean is
begin
return U >= Uint_0;
end Is_Static_SO_Ref;
---------
-- lgx --
---------
procedure lgx (U : Node_Ref_Or_Val) is
begin
List_GCC_Expression (U);
Write_Eol;
end lgx;
----------------------
-- List_Array_Info --
----------------------
procedure List_Array_Info (Ent : Entity_Id) is
begin
List_Type_Info (Ent);
Write_Str ("for ");
List_Name (Ent);
Write_Str ("'Component_Size use ");
Write_Val (Component_Size (Ent));
Write_Line (";");
end List_Array_Info;
-------------------
-- List_Entities --
-------------------
procedure List_Entities (Ent : Entity_Id) is
E : Entity_Id;
begin
if Present (Ent) then
E := First_Entity (Ent);
while Present (E) loop
if Comes_From_Source (E) or else Debug_Flag_AA then
if Is_Record_Type (E) then
List_Record_Info (E);
elsif Is_Array_Type (E) then
List_Array_Info (E);
elsif List_Representation_Info >= 2 then
if Is_Type (E) then
List_Type_Info (E);
elsif Ekind (E) = E_Variable
or else
Ekind (E) = E_Constant
or else
Ekind (E) = E_Loop_Parameter
or else
Is_Formal (E)
then
List_Object_Info (E);
end if;
end if;
-- Recurse over nested package, but not if they are
-- package renamings (in particular renamings of the
-- enclosing package, as for some Java bindings and
-- for generic instances).
if (Ekind (E) = E_Package
and then No (Renamed_Object (E)))
or else
Ekind (E) = E_Protected_Type
or else
Ekind (E) = E_Task_Type
or else
Ekind (E) = E_Subprogram_Body
or else
Ekind (E) = E_Package_Body
or else
Ekind (E) = E_Task_Body
or else
Ekind (E) = E_Protected_Body
then
List_Entities (E);
end if;
end if;
E := Next_Entity (E);
end loop;
end if;
end List_Entities;
-------------------------
-- List_GCC_Expression --
-------------------------
procedure List_GCC_Expression (U : Node_Ref_Or_Val) is
procedure P (Val : Node_Ref_Or_Val);
-- Internal recursive procedure to print expression
procedure P (Val : Node_Ref_Or_Val) is
begin
if Val >= 0 then
UI_Write (Val, Decimal);
else
declare
Node : Exp_Node renames Rep_Table.Table (-UI_To_Int (Val));
procedure Binop (S : String);
-- Output text for binary operator with S being operator name
procedure Binop (S : String) is
begin
Write_Char ('(');
P (Node.Op1);
Write_Str (S);
P (Node.Op2);
Write_Char (')');
end Binop;
-- Start of processing for P
begin
case Node.Expr is
when Cond_Expr =>
Write_Str ("(if ");
P (Node.Op1);
Write_Str (" then ");
P (Node.Op2);
Write_Str (" else ");
P (Node.Op3);
Write_Str (" end)");
when Plus_Expr =>
Binop (" + ");
when Minus_Expr =>
Binop (" - ");
when Mult_Expr =>
Binop (" * ");
when Trunc_Div_Expr =>
Binop (" /t ");
when Ceil_Div_Expr =>
Binop (" /c ");
when Floor_Div_Expr =>
Binop (" /f ");
when Trunc_Mod_Expr =>
Binop (" modt ");
when Floor_Mod_Expr =>
Binop (" modf ");
when Ceil_Mod_Expr =>
Binop (" modc ");
when Exact_Div_Expr =>
Binop (" /e ");
when Negate_Expr =>
Write_Char ('-');
P (Node.Op1);
when Min_Expr =>
Binop (" min ");
when Max_Expr =>
Binop (" max ");
when Abs_Expr =>
Write_Str ("abs ");
P (Node.Op1);
when Truth_Andif_Expr =>
Binop (" and if ");
when Truth_Orif_Expr =>
Binop (" or if ");
when Truth_And_Expr =>
Binop (" and ");
when Truth_Or_Expr =>
Binop (" or ");
when Truth_Xor_Expr =>
Binop (" xor ");
when Truth_Not_Expr =>
Write_Str ("not ");
P (Node.Op1);
when Lt_Expr =>
Binop (" < ");
when Le_Expr =>
Binop (" <= ");
when Gt_Expr =>
Binop (" > ");
when Ge_Expr =>
Binop (" >= ");
when Eq_Expr =>
Binop (" == ");
when Ne_Expr =>
Binop (" != ");
when Discrim_Val =>
Write_Char ('#');
UI_Write (Node.Op1);
end case;
end;
end if;
end P;
-- Start of processing for List_GCC_Expression
begin
if U = No_Uint then
Write_Line ("??");
else
P (U);
end if;
end List_GCC_Expression;
---------------
-- List_Name --
---------------
procedure List_Name (Ent : Entity_Id) is
begin
if not Is_Compilation_Unit (Scope (Ent)) then
List_Name (Scope (Ent));
Write_Char ('.');
end if;
Get_Unqualified_Decoded_Name_String (Chars (Ent));
Set_Casing (Unit_Casing);
Write_Str (Name_Buffer (1 .. Name_Len));
end List_Name;
---------------------
-- List_Object_Info --
---------------------
procedure List_Object_Info (Ent : Entity_Id) is
begin
Write_Eol;
if Known_Esize (Ent) then
Write_Str ("for ");
List_Name (Ent);
Write_Str ("'Size use ");
Write_Val (Esize (Ent));
Write_Line (";");
end if;
if Known_Alignment (Ent) then
Write_Str ("for ");
List_Name (Ent);
Write_Str ("'Alignment use ");
Write_Val (Alignment (Ent));
Write_Line (";");
end if;
end List_Object_Info;
----------------------
-- List_Record_Info --
----------------------
procedure List_Record_Info (Ent : Entity_Id) is
Comp : Entity_Id;
Esiz : Uint;
Cfbit : Uint;
Sunit : Uint;
Max_Name_Length : Natural;
Max_Suni_Length : Natural;
begin
List_Type_Info (Ent);
Write_Str ("for ");
List_Name (Ent);
Write_Line (" use record");
-- First loop finds out max line length and max starting position
-- length, for the purpose of lining things up nicely.
Max_Name_Length := 0;
Max_Suni_Length := 0;
Comp := First_Entity (Ent);
while Present (Comp) loop
if Ekind (Comp) = E_Component
or else Ekind (Comp) = E_Discriminant
then
Get_Decoded_Name_String (Chars (Comp));
Max_Name_Length := Natural'Max (Max_Name_Length, Name_Len);
Cfbit := Component_Bit_Offset (Comp);
if Rep_Not_Constant (Cfbit) then
UI_Image_Length := 2;
else
-- Complete annotation in case not done
Set_Normalized_Position (Comp, Cfbit / SSU);
Set_Normalized_First_Bit (Comp, Cfbit mod SSU);
Esiz := Esize (Comp);
Sunit := Cfbit / SSU;
UI_Image (Sunit);
end if;
if Unknown_Normalized_First_Bit (Comp) then
Set_Normalized_First_Bit (Comp, Uint_0);
end if;
Max_Suni_Length :=
Natural'Max (Max_Suni_Length, UI_Image_Length);
end if;
Comp := Next_Entity (Comp);
end loop;
-- Second loop does actual output based on those values
Comp := First_Entity (Ent);
while Present (Comp) loop
if Ekind (Comp) = E_Component
or else Ekind (Comp) = E_Discriminant
then
declare
Esiz : constant Uint := Esize (Comp);
Bofs : constant Uint := Component_Bit_Offset (Comp);
Npos : constant Uint := Normalized_Position (Comp);
Fbit : constant Uint := Normalized_First_Bit (Comp);
Lbit : Uint;
begin
Write_Str (" ");
Get_Decoded_Name_String (Chars (Comp));
Set_Casing (Unit_Casing);
Write_Str (Name_Buffer (1 .. Name_Len));
for J in 1 .. Max_Name_Length - Name_Len loop
Write_Char (' ');
end loop;
Write_Str (" at ");
if Known_Static_Normalized_Position (Comp) then
UI_Image (Npos);
Spaces (Max_Suni_Length - UI_Image_Length);
Write_Str (UI_Image_Buffer (1 .. UI_Image_Length));
elsif Known_Component_Bit_Offset (Comp)
and then List_Representation_Info = 3
then
Spaces (Max_Suni_Length - 2);
Write_Val (Bofs, Paren => True);
Write_Str (" / 8");
elsif Known_Normalized_Position (Comp)
and then List_Representation_Info = 3
then
Spaces (Max_Suni_Length - 2);
Write_Val (Npos);
else
Write_Str ("??");
end if;
Write_Str (" range ");
UI_Write (Fbit);
Write_Str (" .. ");
if not Is_Dynamic_SO_Ref (Esize (Comp)) then
Lbit := Fbit + Esiz - 1;
if Lbit < 10 then
Write_Char (' ');
end if;
UI_Write (Lbit);
elsif List_Representation_Info < 3 then
Write_Str ("??");
else -- List_Representation >= 3
Write_Val (Esiz, Paren => True);
-- If in front end layout mode, then dynamic size is
-- stored in storage units, so renormalize for output
if not Back_End_Layout then
Write_Str (" * ");
Write_Int (SSU);
end if;
-- Add appropriate first bit offset
if Fbit = 0 then
Write_Str (" - 1");
elsif Fbit = 1 then
null;
else
Write_Str (" + ");
Write_Int (UI_To_Int (Fbit) - 1);
end if;
end if;
Write_Line (";");
end;
end if;
Comp := Next_Entity (Comp);
end loop;
Write_Line ("end record;");
end List_Record_Info;
-------------------
-- List_Rep_Info --
-------------------
procedure List_Rep_Info is
Col : Nat;
begin
for U in Main_Unit .. Last_Unit loop
if In_Extended_Main_Source_Unit (Cunit_Entity (U)) then
Unit_Casing := Identifier_Casing (Source_Index (U));
Write_Eol;
Write_Str ("Representation information for unit ");
Write_Unit_Name (Unit_Name (U));
Col := Column;
Write_Eol;
for J in 1 .. Col - 1 loop
Write_Char ('-');
end loop;
Write_Eol;
List_Entities (Cunit_Entity (U));
end if;
end loop;
end List_Rep_Info;
--------------------
-- List_Type_Info --
--------------------
procedure List_Type_Info (Ent : Entity_Id) is
begin
Write_Eol;
-- If Esize and RM_Size are the same and known, list as Size. This
-- is a common case, which we may as well list in simple form.
if Esize (Ent) = RM_Size (Ent) then
if Known_Esize (Ent) then
Write_Str ("for ");
List_Name (Ent);
Write_Str ("'Size use ");
Write_Val (Esize (Ent));
Write_Line (";");
end if;
-- For now, temporary case, to be removed when gigi properly back
-- annotates RM_Size, if RM_Size is not set, then list Esize as
-- Size. This avoids odd Object_Size output till we fix things???
elsif Unknown_RM_Size (Ent) then
if Known_Esize (Ent) then
Write_Str ("for ");
List_Name (Ent);
Write_Str ("'Size use ");
Write_Val (Esize (Ent));
Write_Line (";");
end if;
-- Otherwise list size values separately if they are set
else
if Known_Esize (Ent) then
Write_Str ("for ");
List_Name (Ent);
Write_Str ("'Object_Size use ");
Write_Val (Esize (Ent));
Write_Line (";");
end if;
-- Note on following check: The RM_Size of a discrete type can
-- legitimately be set to zero, so a special check is needed.
if Known_RM_Size (Ent) or else Is_Discrete_Type (Ent) then
Write_Str ("for ");
List_Name (Ent);
Write_Str ("'Value_Size use ");
Write_Val (RM_Size (Ent));
Write_Line (";");
end if;
end if;
if Known_Alignment (Ent) then
Write_Str ("for ");
List_Name (Ent);
Write_Str ("'Alignment use ");
Write_Val (Alignment (Ent));
Write_Line (";");
end if;
end List_Type_Info;
----------------------
-- Rep_Not_Constant --
----------------------
function Rep_Not_Constant (Val : Node_Ref_Or_Val) return Boolean is
begin
if Val = No_Uint or else Val < 0 then
return True;
else
return False;
end if;
end Rep_Not_Constant;
---------------
-- Rep_Value --
---------------
function Rep_Value
(Val : Node_Ref_Or_Val;
D : Discrim_List)
return Uint
is
function B (Val : Boolean) return Uint;
-- Returns Uint_0 for False, Uint_1 for True
function T (Val : Node_Ref_Or_Val) return Boolean;
-- Returns True for 0, False for any non-zero (i.e. True)
function V (Val : Node_Ref_Or_Val) return Uint;
-- Internal recursive routine to evaluate tree
-------
-- B --
-------
function B (Val : Boolean) return Uint is
begin
if Val then
return Uint_1;
else
return Uint_0;
end if;
end B;
-------
-- T --
-------
function T (Val : Node_Ref_Or_Val) return Boolean is
begin
if V (Val) = 0 then
return False;
else
return True;
end if;
end T;
-------
-- V --
-------
function V (Val : Node_Ref_Or_Val) return Uint is
L, R, Q : Uint;
begin
if Val >= 0 then
return Val;
else
declare
Node : Exp_Node renames Rep_Table.Table (-UI_To_Int (Val));
begin
case Node.Expr is
when Cond_Expr =>
if T (Node.Op1) then
return V (Node.Op2);
else
return V (Node.Op3);
end if;
when Plus_Expr =>
return V (Node.Op1) + V (Node.Op2);
when Minus_Expr =>
return V (Node.Op1) - V (Node.Op2);
when Mult_Expr =>
return V (Node.Op1) * V (Node.Op2);
when Trunc_Div_Expr =>
return V (Node.Op1) / V (Node.Op2);
when Ceil_Div_Expr =>
return
UR_Ceiling
(V (Node.Op1) / UR_From_Uint (V (Node.Op2)));
when Floor_Div_Expr =>
return
UR_Floor
(V (Node.Op1) / UR_From_Uint (V (Node.Op2)));
when Trunc_Mod_Expr =>
return V (Node.Op1) rem V (Node.Op2);
when Floor_Mod_Expr =>
return V (Node.Op1) mod V (Node.Op2);
when Ceil_Mod_Expr =>
L := V (Node.Op1);
R := V (Node.Op2);
Q := UR_Ceiling (L / UR_From_Uint (R));
return L - R * Q;
when Exact_Div_Expr =>
return V (Node.Op1) / V (Node.Op2);
when Negate_Expr =>
return -V (Node.Op1);
when Min_Expr =>
return UI_Min (V (Node.Op1), V (Node.Op2));
when Max_Expr =>
return UI_Max (V (Node.Op1), V (Node.Op2));
when Abs_Expr =>
return UI_Abs (V (Node.Op1));
when Truth_Andif_Expr =>
return B (T (Node.Op1) and then T (Node.Op2));
when Truth_Orif_Expr =>
return B (T (Node.Op1) or else T (Node.Op2));
when Truth_And_Expr =>
return B (T (Node.Op1) and T (Node.Op2));
when Truth_Or_Expr =>
return B (T (Node.Op1) or T (Node.Op2));
when Truth_Xor_Expr =>
return B (T (Node.Op1) xor T (Node.Op2));
when Truth_Not_Expr =>
return B (not T (Node.Op1));
when Lt_Expr =>
return B (V (Node.Op1) < V (Node.Op2));
when Le_Expr =>
return B (V (Node.Op1) <= V (Node.Op2));
when Gt_Expr =>
return B (V (Node.Op1) > V (Node.Op2));
when Ge_Expr =>
return B (V (Node.Op1) >= V (Node.Op2));
when Eq_Expr =>
return B (V (Node.Op1) = V (Node.Op2));
when Ne_Expr =>
return B (V (Node.Op1) /= V (Node.Op2));
when Discrim_Val =>
declare
Sub : constant Int := UI_To_Int (Node.Op1);
begin
pragma Assert (Sub in D'Range);
return D (Sub);
end;
end case;
end;
end if;
end V;
-- Start of processing for Rep_Value
begin
if Val = No_Uint then
return No_Uint;
else
return V (Val);
end if;
end Rep_Value;
------------
-- Spaces --
------------
procedure Spaces (N : Natural) is
begin
for J in 1 .. N loop
Write_Char (' ');
end loop;
end Spaces;
---------------
-- Tree_Read --
---------------
procedure Tree_Read is
begin
Rep_Table.Tree_Read;
end Tree_Read;
----------------
-- Tree_Write --
----------------
procedure Tree_Write is
begin
Rep_Table.Tree_Write;
end Tree_Write;
---------------
-- Write_Val --
---------------
procedure Write_Val (Val : Node_Ref_Or_Val; Paren : Boolean := False) is
begin
if Rep_Not_Constant (Val) then
if List_Representation_Info < 3 then
Write_Str ("??");
else
if Back_End_Layout then
Write_Char (' ');
List_GCC_Expression (Val);
Write_Char (' ');
else
Write_Name_Decoded (Chars (Get_Dynamic_SO_Entity (Val)));
end if;
end if;
else
UI_Write (Val);
end if;
end Write_Val;
end Repinfo;
|
package body GDNative.Exceptions is
-- Here I should probably allow the library user to specify handlers for exceptions
-- (crash report dialog?)
procedure Put_Warning (Message : in Wide_String) is null;
procedure Put_Error (Occurrence : in Ada.Exceptions.Exception_Occurrence) is null;
end; |
-- part of AdaYaml, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "copying.txt"
package body Yaml.Destination.C_String is
function As_Destination (Raw : System.Address;
Size : Interfaces.C.size_t;
Size_Written : access Interfaces.C.size_t)
return Pointer is
Ret : constant access Instance :=
new Instance'(Destination.Instance with
Raw => Raw, Size => Integer (Size),
Size_Written => Size_Written);
begin
Ret.Size_Written.all := 0;
return Pointer (Ret);
end As_Destination;
overriding procedure Write_Data (D : in out Instance; Buffer : String) is
use type Interfaces.C.size_t;
Dest : String (1 .. D.Size);
for Dest'Address use D.Raw;
New_Length : constant Integer := Integer (D.Size_Written.all) + Buffer'Length;
begin
if New_Length > D.Size then
raise Destination_Error with
"Output does not fit into destination string!";
end if;
Dest (Integer (D.Size_Written.all + 1) .. New_Length) := Buffer;
D.Size_Written.all :=
D.Size_Written.all + Interfaces.C.size_t (Buffer'Length);
end Write_Data;
end Yaml.Destination.C_String;
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <denkpadje@gmail.com>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
private package EGL.Loading is
pragma Preelaborate;
generic
Function_Name : String;
type Param1_Type (<>) is private;
type Param2_Type (<>) is private;
type Return_Type is private;
package Function_With_2_Params is
type Function_Reference is not null access function
(Param1 : Param1_Type;
Param2 : Param2_Type) return Return_Type
with Convention => StdCall;
function Init
(Param1 : Param1_Type;
Param2 : Param2_Type) return Return_Type
with Convention => StdCall;
Ref : Function_Reference := Init'Access;
end Function_With_2_Params;
generic
Function_Name : String;
type Param1_Type (<>) is private;
type Param2_Type (<>) is private;
type Param3_Type (<>) is private;
type Return_Type is private;
package Function_With_3_Params is
type Function_Reference is not null access function
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type) return Return_Type
with Convention => StdCall;
function Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type) return Return_Type
with Convention => StdCall;
Ref : Function_Reference := Init'Access;
end Function_With_3_Params;
generic
Function_Name : String;
type Param1_Type (<>) is private;
type Param2_Type (<>) is private;
type Param3_Type (<>) is private;
type Param4_Type (<>) is private;
type Return_Type is private;
package Function_With_4_Params is
type Function_Reference is not null access function
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type) return Return_Type
with Convention => StdCall;
function Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type) return Return_Type
with Convention => StdCall;
Ref : Function_Reference := Init'Access;
end Function_With_4_Params;
generic
Function_Name : String;
type Param1_Type (<>) is private;
type Element_Type is private;
type Array_Type is array (Natural range <>) of Element_Type;
type Size_Type (<>) is private;
type Return_Type is private;
package Array_Getter_With_3_Params is
type Function_Reference is not null access function
(Param1 : Param1_Type;
Values : in out Array_Type;
Size : in out Size_Type) return Return_Type
with Convention => StdCall;
function Init
(Param1 : Param1_Type;
Values : in out Array_Type;
Size : in out Size_Type) return Return_Type
with Convention => StdCall;
Ref : Function_Reference := Init'Access;
end Array_Getter_With_3_Params;
generic
Function_Name : String;
type Param1_Type (<>) is private;
type Param2_Type (<>) is private;
type Param3_Type (<>) is private;
type Return_Type is private;
package Getter_With_3_Params is
type Function_Reference is not null access function
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : out Param3_Type) return Return_Type
with Convention => StdCall;
function Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : out Param3_Type) return Return_Type
with Convention => StdCall;
Ref : Function_Reference := Init'Access;
end Getter_With_3_Params;
end EGL.Loading;
|
-----------------------------------------------------------------------
-- package body Extended_Real, extended precision floating point arithmetic
-- Copyright (C) 2008-2018 Jonathan S. Parker
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
---------------------------------------------------------------------------
-- Internally the extended numbers are stored in such a way that the
-- value of e_Real number X is
--
-- Max
-- X = Radix**Exp * SUM {Radix**(-I) * Digit(I)}.
-- I=0
--
-- Externally, the user sees e_Real (via the Exponent, and Fraction
-- attribute functions) as tho' it were normalized. In other words, the
-- value of X is
--
-- Max
-- X = Radix**Exp_n * SUM {Radix**(-I-1) * Digit(I)}
-- I=0
--
-- Exp_n is called the "normalized" exponent. If Exp_n is the normalized exponent
-- then, say, a binary number would be written:
--
-- 0.111011010001 * 2**(Exp_n).
--
-- In other words the first binary digit in the mantissa is of power 2**(-1).
-- It is important to know this because the function Real'Exponent(x) returns
-- the *normalized* exponent, and the function Real'Fraction(x) returns
-- x * 2**(-Exp_n) where Exp_n is the normalized exponent. So in the above case,
-- 'Fraction would return 0.111011010001.
-- Also, in normalized form, the first binary digit of the mantissa is always
-- non-zero.
package body Extended_Real is
Disable_Program_Error_Tests : constant Boolean := False;
-- A few assertions and the like.
----------------------------------------
-- Shift_Right_2x_No_of_Bits_in_Radix --
----------------------------------------
function Shift_Right_2x_No_of_Bits_in_Radix
(Digit : in Digit_Type)
return Digit_Type
is
begin
-- Works in general, but use only for flt types:
--return Digit_Type (Real'Floor (Real (Digit) * Inverse_Radix_Squared));
return Digit / 2**(2*No_of_Bits_in_Radix);
end Shift_Right_2x_No_of_Bits_in_Radix;
pragma Inline (Shift_Right_2x_No_of_Bits_in_Radix);
-------------------------------------
-- Shift_Right_No_of_Bits_in_Radix --
-------------------------------------
function Shift_Right_No_of_Bits_in_Radix
(Digit : in Digit_Type)
return Digit_Type
is
begin
-- Works in general, but use only for flt types:
--return Digit_Type (Real'Floor (Real (Digit) * Inverse_Radix));
return Digit / 2**No_of_Bits_in_Radix;
end Shift_Right_No_of_Bits_in_Radix;
pragma Inline (Shift_Right_No_of_Bits_in_Radix);
-----------------
-- Digit_Floor --
-----------------
-- Used by "/" and Make_Extended:
function Digit_Floor (X : Real) return Digit_Type is
begin
return Digit_Type (Real'Floor (X));
end Digit_Floor;
pragma Assert (Real'Machine_Mantissa > No_Of_Bits_In_Radix); -- ie 53 > 30
pragma Inline (Digit_Floor);
----------------------------------
-- Minimum_No_Of_Digits_Allowed --
----------------------------------
-- Return setting of the constant Min_No_Of_Digits.
--
function Minimum_No_Of_Digits_Allowed return e_Integer is
begin return Min_No_Of_Digits;
end Minimum_No_Of_Digits_Allowed;
----------------------------
-- Number_Of_Guard_Digits --
----------------------------
-- Return setting of the constant No_Of_Guard_Digits.
--
function Number_Of_Guard_Digits return e_Integer is
begin return No_Of_Guard_Digits;
end Number_Of_Guard_Digits;
-- SECTION IV.
--
-- Ada94 attributes. More information on the machine model is given
-- above in the introduction.
---------------------------
-- e_Real_Machine_Rounds --
---------------------------
function e_Real_Machine_Rounds return Boolean is
begin return False;
end e_Real_Machine_Rounds;
------------------------------
-- e_Real_Machine_Overflows --
------------------------------
function e_Real_Machine_Overflows return Boolean is
begin return False;
end e_Real_Machine_Overflows;
-------------------------
-- e_Real_Signed_Zeros --
-------------------------
function e_Real_Signed_Zeros return Boolean is
begin return False;
end e_Real_Signed_Zeros;
-------------------
-- e_Real_Denorm --
-------------------
function e_Real_Denorm return Boolean is
begin return False;
end e_Real_Denorm;
-------------------------
-- e_Real_Machine_Emax --
-------------------------
function e_Real_Machine_Emax return e_Integer is
begin return Max_Exponent;
end e_Real_Machine_Emax;
-------------------------
-- e_Real_Machine_Emin --
-------------------------
function e_Real_Machine_Emin return e_Integer is
begin return Min_Exponent;
end e_Real_Machine_Emin;
-----------------------------
-- e_Real_Machine_Mantissa --
-----------------------------
-- Number of digits in machine mantissa.
function e_Real_Machine_Mantissa
return e_Integer is
begin
return Mantissa'Length;
end e_Real_Machine_Mantissa;
--------------------------
-- e_Real_Machine_Radix --
--------------------------
function e_Real_Machine_Radix return Real is
begin return Real_Radix;
end e_Real_Machine_Radix;
----------------------------
-- e_Real_Machine_Epsilon --
----------------------------
function e_Real_Machine_Epsilon return e_Real is
begin
return e_Real_Model_Epsilon_1;
end e_Real_Machine_Epsilon;
--------------------------
-- e_Real_Model_Epsilon --
--------------------------
function e_Real_Model_Epsilon return e_Real is
begin
return e_Real_Model_Epsilon_2;
end e_Real_Model_Epsilon;
----------------------------
-- e_Real_Model_Epsilon_1 --
----------------------------
-- 1 unit in the larger of the 2 guard digits.
function e_Real_Model_Epsilon_1 return e_Real is
Result : e_Real; -- equals Zero
begin
Result.Is_Zero := False;
Result.Digit (0) := Digit_One; -- 1 here with Exp=0 => Eps=radix**(-1)
Result.Exp := -(e_Real_Machine_Mantissa-1);
return Result;
end e_Real_Model_Epsilon_1;
----------------------------
-- e_Real_Model_Epsilon_2 --
----------------------------
-- Guard_Digits = 2 always; assume neither of them is correct.
-- if there's 3 digits of Radix 2^30 then eps is 2^(-30).
-- if there's 4 digits of Radix 2^30 then eps is 2^(-60).
-- if there's 5 digits of Radix 2^30 then eps is 2^(-90) or ~ 10**(-30).
function e_Real_Model_Epsilon_2 return e_Real is
Result : e_Real; -- equals Zero
begin
Result.Is_Zero := False;
Result.Digit (0) := Digit_One; -- 1 here with Exp=0 => Eps=radix**(-1)
Result.Exp := -(e_Real_Machine_Mantissa-2);
return Result;
end e_Real_Model_Epsilon_2;
--------------
-- Exponent --
--------------
-- For every value x of a floating point type T, the normalized exponent
-- of x is defined as follows:
-- - the normalized exponent of zero is (by convention) zero;
-- - for nonzero x, the normalized exponent of x is the unique
--
-- k-1 k
-- integer k such that T'Machine_Radix <= |x| < T'Machine_Radix .
--
-- For example, if x = 0.1101011 * 2**1 then k = 1 since
-- 2**0 <= x < 2**1. If X = 0.100000 * 2**1 then 2**0 = x < 2**1.
--
-- BY CONVENTION, the normalized exponent of 0 is 0. (Internally it ain't.)
function Exponent (X : e_Real) return e_Integer is
Normalized_Exponent : constant e_Integer := X.Exp + 1;
begin
if X.Is_Zero then
return 0;
else
return Normalized_Exponent;
end if;
-- proper choice because internal form of e_Real is not
-- normalized; internally, Exp is smaller than the normalized exp
-- by 1, because the internal mantissa is larger by a factor
-- of Radix than the normalized mantissa.
end Exponent;
------------------
-- Leading_Part --
------------------
-- Let k be the normalized exponent of x. The function Leading_Part(x)
-- yields the value
--
-- k-r k-r
-- - |x/T'Machine_Radix |*T'Machine_Radix ,
-- when x is nonnegative and r is positive;
-- k-r k-r
-- - |x/T'Machine_Radix |*T'Machine_Radix ,
-- when x is negative and r is positive.
--
-- Constraint_Error is raised when r is zero or negative.
-- A zero result, which can only occur when x is zero, has
-- the sign of X.
-- Returns the leading digits of X in the range 0..Radix_Digits-1,
-- regardless of sign of X. Other digits are set to 0.0. The exponent
-- is unchanged. Only X = Zero returns Zero. Not sure about infinity.
-- Makes sense that Leading_Part of inf is inf.
-- Notice assume Digit_Index'Last = Ultimate digit. The results are
-- consistant with a dynamic Digit_Index'Last, just a little slower.
--
function Leading_Part
(X : e_Real;
Radix_Digits : e_Integer)
return e_Real
is
No_Of_Digits : constant e_Integer := Ultimate_Digit + 1;
Result : e_Real := X;
begin
-- By convention:
if Radix_Digits <= 0 then
raise Constraint_Error with "Must have Radix_Digits > 0.";
end if;
if X.Is_Zero then
return Zero;
end if;
if X.Is_Infinite then
return X;
end if;
if Radix_Digits >= No_Of_Digits then
return X;
end if;
-- So now Radix_Digits < No_Of_Digits which implies that
-- Radix_Digits <= Ultimate_Digit
for I in Digit_Index range Radix_Digits .. Ultimate_Digit loop
Result.Digit (I) := Digit_Zero;
end loop;
-- The above uses the fact that Digit_Index starts at 0.
return Result;
end Leading_Part;
--------------
-- Fraction --
--------------
-- -k
-- The function yields the value x*T'Machine_Radix , where
-- k is the normalized exponent of x. A zero result, which
-- can only occur when x is zero, has the sign of X.
-- Not sure about inf, so raise contraint error, because the
-- user may make assumptions about the size of the exponent returned
-- by Exponent.
--
function Fraction (X : e_Real) return e_Real is
X2 : e_Real := X;
begin
if X.Is_Zero then
return Zero;
end if;
if X.Is_Infinite then
raise Constraint_Error with "Cannot take Fraction of inf.";
end if;
X2.Exp := -1;
-- Proper choice because format of e_Real
-- is not normalized. The effect of the -1 is
-- to shift the internal format down to the normalized format.
return X2;
end Fraction;
-------------
-- Compose --
-------------
-- S'Compose (X, Exp) = Fraction (X) * Machine_Radix ** Exp
--
-- e-k
-- Let v be the value X*T'Machine_Radix , where k is the
-- normalized exponent of X. If v is a machine number of
-- the type T, or if |v|GT'Model_Small, the function yields
-- v; otherwise, it yields either one of the machine
-- numbers of the type T adjacent to v. Constraint_Error
-- is optionally raised if v is outside the base range of
-- S. A zero result has the sign of Fraction when S'Signed_
-- Zeros is True.
--
function Compose
(Fraction : e_Real;
Exponent : e_Integer)
return e_Real
is
X2 : e_Real := Fraction;
begin
if Fraction.Is_Zero then
return Zero;
end if;
if Fraction.Is_Infinite then
raise Constraint_Error with "Cannot compose inf.";
end if;
X2.Exp := Exponent - 1;
-- The minus 1 comes from the Fraction(X) operation.
if X2.Exp < Min_Exponent or else X2.Exp > Max_Exponent then
raise Constraint_Error with "Exponent out of range in Compose operation.";
end if;
return X2;
end Compose;
-------------
-- Scaling --
-------------
-- S'Scaling (X, Exp)
-- Exp
-- Let v be the value X*T'Machine_Radix . If v is a
-- machine number of the type T, or if |v|GT'Model_Small,
-- the function yields v; otherwise, it yields either one
-- of the machine numbers of the type T adjacent to v.
-- Constraint_Error is optionally raised if v is outside
-- the base range of S. A zero result has the sign of X
-- when S'Signed_Zeros is True.
--
function Scaling
(X : e_Real;
Adjustment : e_Integer)
return e_Real
is
X2 : e_Real := X;
begin
if X.Is_Zero then
return Zero;
end if;
if X.Is_Infinite then
raise Constraint_Error with "Cannot scale inf.";
end if;
X2.Exp := X.Exp + Adjustment;
if X2.Exp < Min_Exponent or else X2.Exp > Max_Exponent then
raise Constraint_Error with "Exp out of range in Scaling operation.";
end if;
return X2;
end Scaling;
----------------
-- Truncation --
----------------
-- Strip off fraction for both + and - numbers.
-- This sets all digits beyond the decimal point to 0.0.
-- The function yields the value [x] when X > 0.0. ([x] by defn
-- is floor: largest int less than or equal to x.) When x is zero,
-- the result has the sign of X; a zero result otherwise has a
-- positive sign. When X < 0.0, then it's [x]+1 unless [x] = x.
-- Notice assume Digit_Index'Last = Ultimate_Digit.
function Truncation
(X : e_Real)
return e_Real
is
Result : e_Real;
First_Zeroed_Out_Digit : Digit_Index;
No_Of_Digits : constant e_Integer := Ultimate_Digit + 1;
No_Of_Digits_To_Keep : constant e_Integer := X.Exp + 1;
-- Normalized Exponent of X. Remember, if X.Exp = 0,then X has one
-- non-zero digit that's >= 1.0. So (Exp + 1)=1 means keep 1 digit
begin
if X.Is_Zero then
return Zero;
end if;
if No_Of_Digits_To_Keep < 1 then
return Zero;
end if;
-- According to the internal format of X, X.Exp = 0 means X >= 1.0.
-- If X.Exp < 0 then X < 1.0.
if X.Is_Infinite then
return X;
--Print_Text ("Cannot truncate inf.");
--raise Constraint_Error;
end if;
if No_Of_Digits_To_Keep >= No_Of_Digits then
return X;
end if;
-- So now No_Of_Digits_To_keep < No_Of_Digits which implies that
-- No_Of_Digits_To_keep <= Ultimate_Digit
-- Remember, Digit_Index starts at 0, and is a subtype of e_Integer.
Result := X;
First_Zeroed_Out_Digit := Digit_Index'First + No_Of_Digits_To_keep;
for I in First_Zeroed_Out_Digit .. Ultimate_Digit loop
Result.Digit (I) := Digit_Zero;
end loop;
return Result;
end Truncation;
-------------
-- Ceiling --
-------------
-- Let [x] = floor(x).
-- Function yields the value [x]+1, unless [x] = x, in which case,
-- function returns x. When x is zero, the
-- result has the sign of x; a zero result otherwise has a
-- negative sign when S'Signed_Zeros is True.
function Ceiling (X : e_Real)
return e_Real
is
Result : e_Real;
Lowest_Order_Digit : e_Integer;
begin
if X.Is_Zero then
return Zero;
end if;
if X.Is_Infinite then
return X;
end if;
-- Step 1.
-- Special case, X.Exp < 0 so X < 1.0. Have to round 0.0 up to 1.0.
-- We know X /= 0.0. if X.Exp < 0, then know |X| < 1.0. If
-- X > 0.0, then result must be 1.0; if X < 0.0 then result
-- is 0.0. So can save some time:
if X.Exp < 0 then
if X.Is_Positive then
return One;
else
return Zero;
end if;
end if;
-- Step 2.
-- Now know that X.Exp >= 0. Have to do some work:
Result := Truncation (X);
if not X.Is_Positive then -- we're done by defn: Ceiling = Trunc.
return Result;
end if;
-- Now know that X is positive. Must add one if Trunc(x) /= x.
-- We also know that Result.Exp >= 0, by defn of Trunc.
Lowest_Order_Digit := Result.Exp;
if (Lowest_Order_Digit <= Ultimate_Digit) and then Result < X then
if Result.Digit (Lowest_Order_Digit) < Digit_Radix_Minus_1 then
Result.Digit (Lowest_Order_Digit)
:= Result.Digit (Lowest_Order_Digit) + Digit_One;
else
Result := Result - One;
end if;
end if;
return Result;
end Ceiling;
-----------
-- Floor --
-----------
-- Function yields the value [x]. ([x] by defn is floor: largest int
-- less than or equal to x.) This equals trunc(x) when x > 0.0,
-- and = trunc(x)-1, when X < 0.0, unless Trunc(x) = x. When x = 0.0,
-- result has the sign of x; a zero result otherwise has a
-- negative sign when S'Signed_Zeros is True.
function Floor (X : e_Real) return e_Real is
Result : e_Real;
Lowest_Order_Digit : e_Integer;
begin
if X.Is_Zero then
return Zero;
end if;
if X.Is_Infinite then
return X;
end if;
-- Step 1.
-- Special case, X.Exp < 0.
-- Know X /= 0.0. if X.Exp < 0, then know |X| < 1.0. If then
-- X > 0.0, then result must be 0.0; if X < 0.0 then result
-- is -1.0. So can save some time:
if X.Exp < 0 then
if X.Is_Positive then
return Zero;
else
return -One;
end if;
end if;
-- Step 2.
-- Now know that X.Exp >= 0. Have to do some work:
Result := Truncation (X);
if X.Is_Positive then -- we're done by defn: Floor = Trunc.
return Result;
end if;
-- Now know that X is negative. Must subtract one if Trunc(x) > x.
-- We also know that Result.Exp >= 0, by defn of Trunc, unless trunc
-- returned Zero. (But it didn't cause X.Exp started out >= 0).
Lowest_Order_Digit := Result.Exp;
if (Lowest_Order_Digit <= Ultimate_Digit) and then Result > X then
if Result.Digit (Lowest_Order_Digit) > Digit_Zero then
Result.Digit (Lowest_Order_Digit)
:= Result.Digit (Lowest_Order_Digit) - Digit_One;
else
Result := Result - One;
end if;
end if;
return Result;
end Floor;
-------------------------------------
-- Round_Away_Smallest_Guard_Digit --
-------------------------------------
-- Round away Digit_Index'Last
function Round_Away_Smallest_Guard_Digit (X : e_Real) return e_Real is
Result : e_Real := X;
Penultimate : constant Digit_Index := Digit_Index'Last-1;
begin
if X.Digit(Digit_Index'Last) <= Half_Radix then
Result.Digit (Digit_Index'Last) := Digit_Zero;
else
-- X is not Zero.
Result.Digit (Digit_Index'Last) := Digit_Zero;
if X.Digit(Penultimate) < Digit_Radix_Minus_1 then
Result.Digit(Penultimate) := Result.Digit(Penultimate) + Digit_One;
else
if Result.Is_Positive then
Result := Result + e_Real_Model_Epsilon_1; --1 unit in penultimate digit.
else
Result := Result - e_Real_Model_Epsilon_1;
end if;
end if;
end if;
return Result;
end Round_Away_Smallest_Guard_Digit;
-------------
-- Machine --
-------------
-- Rounds away smallest of the 2 guard digits of X.
function Machine (X : e_Real) return e_Real is
Y : e_Real;
begin
Y := Round_Away_Smallest_Guard_Digit (X);
return Y;
end Machine;
---------------
-- Copy_Sign --
---------------
-- S'Copy_Sign denotes a function with the following specification:
-- function S'Copy_Sign (Value, Sign : T) return T
-- If the value of Value is nonzero, the function yields a
-- result whose magnitude is that of Value and whose sign
-- is that of Sign; otherwise, it yields the value zero.
-- Constraint_Error is optionally raised if the result is
-- outside the base range of S. A zero result has the sign
-- of Sign when S'Signed_Zeros is True.
--
function Copy_Sign (Value, Sign : e_Real) return e_Real is
Result : e_Real := Value;
begin
if Value.Is_Zero then
return Zero;
end if;
-- following holds even if Value is inf:
Result.Is_Positive := Sign.Is_Positive;
return Result;
end Copy_Sign;
--------------
-- Adjacent --
--------------
-- If t=x, the function yields x; otherwise, it yields the
-- machine number of the type T adjacent to x in the
-- direction of t, if that machine number exists. If the
-- result would be outside the base range of S, Constraint_
-- Error is raised. When T'Signed_Zeros is True, a zero
-- result has the sign of X. When t is zero, its sign has
-- no bearing on the result.
--
--function Adjacent (X, Towards : e_Real) return e_Real is
--begin
--end Adjacent;
--------------
-- Rounding --
--------------
-- The function yields the integral value nearest to x,
-- rounding away from zero if x lies exactly halfway
-- between two integers. A zero result has the sign of X
-- when S'Signed_Zeros is True.
--
function Rounding (X : e_Real) return e_Real is
Result : e_Real;
Half : constant e_Real := +0.5;
Del : e_Real;
begin
if X.Is_Zero then
return Zero;
end if;
if X.Is_Infinite then
return X;
end if;
Result := Truncation (X);
Del := Abs (X - Result);
if not (Del < Half) then
if X.Is_Positive then
Result := Result + One; -- because Trunc chopped it toward zero
else
Result := Result - One;
end if;
end if;
return Result;
end Rounding;
-----------------------
-- Unbiased_Rounding --
-----------------------
-- The function yields the integral value nearest to x,
-- rounding toward the even integer if x lies exactly
-- halfway between two integers. A zero result has the
-- sign of X when S'Signed_Zeros is True.
--
function Unbiased_Rounding (X : e_Real) return e_Real is
Result : e_Real;
Half : constant e_Real := +0.5;
Del : e_Real;
Least_Significant_Digit : e_Integer;
begin
if X.Is_Zero then
return Zero;
end if;
if X.Is_Infinite then
return X;
end if;
Result := Truncation (X);
Del := Abs (X - Result);
--if Del < Half then -- result is unmodified
if Del > Half then
if X.Is_Positive then
Result := Result + One; -- because Trunc chopped it toward zero
else
Result := Result - One;
end if;
end if;
if Are_Equal (Del, Half) then
-- Must find out if Result (= Truncation (X) = int) is even or not.
-- If it's not even, then add (or subtract) One as above.
-- To find out, must examine lowest order bit of least significant
-- digit.
Least_Significant_Digit := Exponent (Result) - 1;
-- If Least_Significant_Digit = 0 then Exponent (Result) = +1 cause
-- it returns the normalized Exp.
if (Least_Significant_Digit REM 2 = 1) then -- it's odd
if X.Is_Positive then
Result := Result + One; -- because Trunc chopped it toward zero
else
Result := Result - One;
end if;
end if;
end if;
return Result;
end Unbiased_Rounding;
---------------
-- Remainder --
---------------
-- Code, algorithm and comments from Ken Dritz. (Ada 9X Language study note.)
-- Modified to use e_Real's, so errors my own.
-- It does seem to work well .. much more accurate than the simple alternatives
-- I tried for Sin, Cos arguments, (but that is all the testing I've done.)
-- For nonzero y, let v be the value x-n*y, where n is the
-- integer nearest to the exact value of x/y; if
-- |n-x/y|=1/2, then n is chosen to be even. If v is a
-- machine number of the type T, the function yields v;
-- otherwise, it yields zero. Constraint_Error is raised
-- if y is zero. A zero result always has a positive sign.
function Remainder
(X, Y : e_Real)
return e_Real
is
Residue, Temp, Reducer, Reducer_Head, Reducer_Tail, N : e_Real;
Abs_Y : constant e_Real := Abs (Y);
-- See comments above about the possibility of overflow here on
-- radix-complement machines.
Scaled_Up, Negated : Boolean;
CONST1 : constant e_Real
:= Scaling (One, e_Real_Machine_Emin + e_Real_Machine_Mantissa - 2);
CONST2 : constant e_Real
:= Scaling (One, e_Real_Machine_Emin + e_Real_Machine_Mantissa - 1);
begin
if Y.Is_Zero then
raise Constraint_Error with "Must have Y /= 0 in function Remainder.";
end if;
Residue := X;
Negated := False;
loop
-- This loop is executed at most once more than the difference between
-- the exponents of X and Y.
if Copy_Sign (One, Residue) < Zero then
-- The following two statements are to be executed when the sign of
-- Residue is negative, that is, when Residue is less than zero or is
-- a negative zero. Simply comparing Residue to zero is not good
-- enough when T'Signed_Zeros is True. An actual implementation might
-- instead examine the sign bit. In an implementation in which
-- T'Signed_Zeros is False, the condition above can be simplified to
-- Residue < 0.0.
Residue := -Residue;
Negated := not Negated;
end if;
-- At this point, Residue has a positive sign, and Negated records the
-- parity of sign flippings that Residue has undergone.
exit when Residue < Abs_Y;
-- At this point, Residue is greater than or equal to Abs_Y. Its
-- exponent is the same as, or greater than, that of Abs_Y.
Reducer := Compose (Abs_Y, Exponent(Residue));
-- Reducer now has the fraction of Abs_Y and the exponent of Residue.
-- Thus, it is a (possibly large) exact multiple of Abs_Y.
if Reducer > Residue then
-- Reducer is greater than Residue only when
-- T'Fraction(Abs_Y) is greater than T'Fraction(Residue).
-- Reduce its exponent by one.
Reducer := Scaling(Reducer, -1);
-- It can be proved that underflow cannot occur in the above scaling.
-- At this point, 1.0 < Residue/Reducer < e_Real(T'Machine_Radix).
N := Unbiased_Rounding (Residue / Reducer);
-- Thus, 1.0 <= N <= e_Real (Machine_Radix).
-- Now basically want to subtract N*Reducer from Residue exactly,
-- but the product may have one too many digits to be represented
-- exactly. That occurs when the exponent of N*Reducer exceeds that
-- of Reducer; in the present case, that can happen for N as small as
-- two.
-- The following almost works:
-- Reducer_Head := T'Leading_Part(Reducer, 1);
-- Reducer_Tail := Reducer - Reducer_Head;
-- Residue := (Residue - N*Reducer_Head) - N*Reducer_Tail;
-- It fails only when Reducer is so small that underflow occurs when
-- subtracting Reducer_Head from it. Note that this is only a problem
-- when T'Denorm is False; when T'Denorm is True, the above suffices.
if Reducer < CONST1 then
-- Reducer is near the underflow threshold, and of course Residue
-- is near Reducer. Scale both of them up by a sufficient amount
-- to prevent underflow when subtracting Reducer_Head from Reducer;
-- scale back down later.
Residue := Scaling(Residue, e_Real_Machine_Mantissa);
Reducer := Scaling(Reducer, e_Real_Machine_Mantissa);
Scaled_Up := True;
else
Scaled_Up := False;
end if;
Reducer_Head := Leading_Part (Reducer, 1);
Reducer_Tail := Reducer - Reducer_Head;
-- Because cancellation occurs in the above subtraction, the result is
-- exact.
-- Now the subtraction can be performed in two stages.
Residue := (Residue - N*Reducer_Head) - N*Reducer_Tail;
-- In the present case, although N*Reducer can have too many digits to
-- be representable, it cannot overflow.
if Scaled_Up then
-- Scale back down. Note that underflow can occur in rare
-- circumstances here (i.e., when T'Denorm is False and the
-- remainder is less than the underflow threshold, which requires
-- that Y be near the underflow threshold and X be near a multiple
-- of Y). The specification calls for zero to be returned, but
-- T'Scaling might not return a zero when it underflows. If it
-- does, and the zero is properly signed, the if-then-else below
-- can be replaced by the else part (or by the equivalent
-- multiplication or division, if it yields a properly signed
-- zero on underflow).
if Abs (Residue) < CONST2 then
Residue := Copy_Sign (Zero, Residue);
else
Residue := Scaling (Residue, -E_Real_Machine_Mantissa);
end if;
end if;
else
-- This case is for Reducer <= Residue.
-- At this point, 1.0 <= Residue/Reducer < e_Real(T'Machine_Radix).
N := Unbiased_Rounding (Residue / Reducer);
-- Thus, 1.0 <= N <= e_Real(T'Machine_Radix).
-- Here, the technique for subtracting N*Reducer exactly from Residue
-- is different. In the present case, N*Reducer may have one too many
-- digits to be represented exactly only when the rounding was upward,
-- hence (N-1.0)*Reducer must necessarily be representable. Also,
-- N*Reducer could even overflow, but (N-1.0)*Reducer cannot.
if N > One then
-- The optimization represented by the above test is probably
-- worthwhile.
Residue := Residue - (N - One) * Reducer;
end if;
Residue := Residue - Reducer;
-- The above subtraction can underflow when T'Denorm is False, in
-- which case the desired result is zero. It is assumed that when
-- subtraction underflows, it underflows to zero.
end if;
-- Residue may now be negative, but its absolute value is less than or
-- equal to half of Reducer.
end loop;
-- At this point, Residue has a positive sign and a magnitude less than that
-- of Abs_Y. If Residue is greater than half of Abs_Y, correct it by
-- subtracting Abs_Y one more time. We do this without computing half of
-- Abs_Y, which could underflow or be inexact.
Temp := Residue - Abs_Y;
-- The above can underflow. It is assumed here that underflow produces a
-- zero result. Note that Temp now has a negative sign (a zero produced on
-- underflow is presumably a negative zero when T'Signed_Zeros is True).
if Temp + Residue > Zero then
-- True only if Residue is greater than half of Abs_Y, or if the
-- computation of Temp underflowed to zero. Note that the condition
-- might, on some machines, be more efficiently evaluated as
-- -Temp < Residue, or even as abs Temp < Residue.
Residue := Temp;
end if;
-- The above step might even be slightly more efficiently evaluated as
-- follows (here Temp is the negation of the value computed above and
-- hence always has a positive sign):
-- Temp := Abs_Y - Residue;
-- if Temp < Residue then
-- Residue := -Temp;
-- end if;
-- This version, which is clearly equivalent but harder to motivate, is
-- used in the binary case at the end of this LSN.
-- The desired remainder is now Residue, with a possible sign flip
-- (i.e., if Negated is True at this point).
if Negated then
return -Residue;
else
return Residue;
end if;
end Remainder;
-- SECTION III.
--
-- Routines for conversion from Real to e_Real and back again.
No_Of_Usable_Bits_In_Real : constant := 52;
pragma Assert (Real'Machine_Mantissa >= No_Of_Usable_Bits_In_Real);
No_Of_e_Digits_Per_Real : constant
:= (No_Of_Usable_Bits_In_Real-1) / No_Of_Bits_In_Radix + 1;
-- Used only by: Make_Extended to convert a Real object into an e_Real.
-- Equals: Ceiling (No_Of_Usable_Bits_In_Digit / No_Of_Bits_In_Radix)
-------------------
-- Make_Extended --
-------------------
function Make_Extended
(X : Real)
return e_Real
is
Result : e_Real; -- Initialized to zero (important).
Abs_X : Real := Abs (X);
Exponent : e_Integer := 0;
begin
if not X'Valid then
raise Constraint_Error with "Failure in routine Make_Real: Input is inf or NaN.";
end if;
if X = 0.0 then
return Zero;
elsif X = -0.0 then
return Zero;
else
Result.Is_Zero := False;
end if;
-- Abs_X = Abs(X):
if Abs_X > X then
Result.Is_Positive := False;
else
Result.Is_Positive := True;
end if;
-- Get power of 2 exponent and 1st digit. This is not usually in an
-- inner loop, so do it the brute force way. If Abs(X) < 1.0
-- then keep multiplying by Radix until 1.0 <= X <= Radix-1.
-- Strip off the fraction to get the first digit.
if Abs_X < Real_One then -- mult. by Radix until >= 1.0:
for I in e_Integer loop
Abs_X := Abs_X * Real_Radix;
Exponent := Exponent - 1;
if Abs_X >= Real_One then
exit;
end if;
end loop;
-- Abs_X is now 1.0 <= Abs_X < Radix. When strip off the fractional
-- part with Real_Floor, then Abs_X will be in 1.0..Radix-1.
elsif Abs_X >= Real_Radix then -- divide by Radix until just right:
for I in e_Integer loop
Abs_X := Abs_X * Inverse_Radix;
Exponent := Exponent + 1;
if Abs_X < Real_Radix then
exit;
end if;
end loop;
-- Abs_X is now 1.0 <= Abs_X < Radix. When strip off the fractional
-- part with Real_Floor, then Abs_X will be in 1.0..Radix-1.
else -- Abs_X is in desired range:
Exponent := 0;
end if;
Result.Exp := Exponent;
-- Now we've got Result.Exp, Result.Is_Positive, Result.Is_Zero all set.
-- Is_Infinite is initialized to False. Next get the first digit:
Result.Digit(0) := Digit_Floor (Abs_X);
Abs_X := Abs_X - Real (Result.Digit(0));
-- Now just the Abs_X < 1.0 fraction remains in Abs_X.
-- Optimization: if Abs_X = 0.0 then return early. Result is
-- already initialized to zero...no need to get next digits.
if Abs_X = 0.0 then
return Result;
end if;
-- Get subsequent digits. These digits are in the range
-- 0.0 <= X <= Radix-1. (Run the loop longer by 1 for safety.)
for I in Digit_Index range Digit_Index'First+1..No_Of_e_Digits_Per_Real loop
Abs_X := Abs_X * Real_Radix;
Result.Digit(I) := Digit_Floor (Abs_X);
Abs_X := Abs_X - Real (Result.Digit(I));
end loop;
if Abs_X > Real_One then
raise Constraint_Error with "Error in Make_Extended. Probably bad input.";
end if;
return Result;
end Make_Extended;
---------
-- "+" --
---------
-- Only works in range of Real (15 digits usually).
-- So X = 2**62 raises Constraint_Error if Real'Digits = 15.
function "+" (X : Integer) return e_Real
is
X_Real : constant Real := Real (X);
begin
if Abs X_Real > 2.0**(Real'Machine_Mantissa-1) then
raise Constraint_Error with "Can't make extended. Argument too large.";
end if;
return Make_Extended (X_Real);
end "+";
------------------
-- Make_e_Digit --
------------------
function Make_e_Digit
(X : Real)
return e_Digit
is
Ext_Result : e_Real; -- Initialized to zero.
Result : e_Digit; -- Initialized to zero.
begin
Ext_Result := Make_Extended (X);
if Ext_Result.Digit(1) /= Digit_Zero or Ext_Result.Digit(2) /= Digit_Zero then
raise Constraint_Error with "Error in Make_e_Digit: arg not in range.";
end if;
if Ext_Result.Is_Zero then
return Result;
end if;
Result.Exp := Ext_Result.Exp;
Result.Is_Positive := Ext_Result.Is_Positive;
Result.Is_Zero := Ext_Result.Is_Zero;
Result.Digit := Ext_Result.Digit(0);
return Result;
end Make_e_Digit;
---------
-- "-" --
---------
-- Same as Make_Extended, but changes the sign.
function "-" (X : Real) return e_Real is
Z : e_Real := Make_Extended (X);
begin
Z.Is_Positive := not Z.Is_Positive;
if Z.Is_Zero then -- get sign right again
Z.Is_Positive := True;
end if;
return Z;
end;
---------------
-- Make_Real --
---------------
-- Most of the arithmetic here is between powers of the machine_radix.
-- Results should be exact out to the last place of Real. But
-- can't be guaranteed.
function Make_Real (X : e_Real)
return Real
is
Result : Real := Real_Zero;
Mantissa : Real := Real_Zero;
begin
if X.Is_Zero then
return Real_Zero;
end if;
if X.Is_Infinite then
raise Constraint_Error with "Failure in routine Make_Real: Number is infinite.";
end if;
-- Here is the general case. It produces a Mantissa that is a Factor
-- of Radix larger than the Normalized Fraction that appears in
-- Value_Of_Real = Normalized Fraction * Radix**Normalized_Exponent.
--
--Power_Of_Radix := 1.0;
--Result := Real (X.Digit(0));
--for I in Digit_Index range 1..No_Of_e_Digits_Per_Real-1 loop
--Power_Of_Radix := Power_Of_Radix * Inverse_Radix;
--Result := Result + Power_Of_Radix * Real (X.Digit(I));
--end loop;
--
-- The following is the usual case. This is the inner product form.
-- This sometimes gives the best results because it is more often
-- done in the machine's extended arithmetic, if that's available.
-- The following produces a Mantissa that is a Factor
-- of Radix larger than the Normalized_Fraction that appears in
-- Value_Of_Real = Normalized_Fraction * Radix**Normalized_Exponent.
-- Recall that X.Exp is less than the Normalized exponents by 1.
Mantissa := Real (X.Digit(0))
+ Real (X.Digit(1)) * Inverse_Radix
+ Real (X.Digit(2)) * Inverse_Radix_Squared
+ Real (X.Digit(3)) * Inverse_Radix_Squared * Inverse_Radix
+ Real (X.Digit(4)) * Inverse_Radix_Squared * Inverse_Radix_Squared;
-- Possible overflows are left to the external float package to raise.
-- underflows to Zero are done explicitly.
if Integer(X.Exp) * No_Of_Bits_In_Radix < Real'Machine_Emin then
Result := 0.0;
else
Result := Mantissa * Real_Radix**Integer(X.Exp);
end if;
-- Here is the Ada94 way:
--
--Real_Exponent_Shift := No_Of_Bits_In_Radix * Integer (X.Exp - 1.0);
--Result := Real_Scaling (Mantissa, Real_Exponent_Shift);
-- The scaling function multiplies
-- Mantissa by Real'Machine_Radix ** Real_Exponent_Shift.
-- At present leave it up to Real floating point to raise the
-- constraint errors if they exist.
if X.Is_Positive then
null;
else
Result := -Result;
end if;
return Result;
end Make_Real;
-- SECTION II.
--
-- Standard arithmetic operators.
---------
-- Abs --
---------
function "Abs" (X : e_Real) return e_Real is
X2 : e_Real := X;
begin
X2.Is_Positive := True;
return X2;
end "Abs";
---------
-- "-" --
---------
function "-" (X : e_Real) return e_Real is
X2 : e_Real := X;
begin
X2.Is_Positive := not X2.Is_Positive;
if X2.Is_Zero then
X2 := Zero;
end if;
return X2;
end "-";
-------------------
-- Abs_Is_Lesser --
-------------------
-- Is Abs(X) less than Abs(Y)?
-- This performs the comparison for all digits: 0..Digit_Index'Last.
-- The user is epected to call "Round" first if he wants the comparison
-- in the range 0..Last_Correct_Digit == 0..Digit_Index'Last-No_Of_Guard_Digits.
function Abs_Is_Lesser (X, Y : e_Real)
return Boolean
is
begin
-- Step 0. Handle the infinities. inf < inf raises c.e. but not here.
if X.Is_Infinite and not Y.Is_Infinite then
return False; -- |X| > |Y|
elsif not X.Is_Infinite and Y.Is_Infinite then
return True; -- |X| < |Y|
end if;
-- Step 0b. Handle the Zeros. Another case where the Exp does not tell
-- us the magnitude of the number.
if X.Is_Zero and not Y.Is_Zero then
return True; -- |X| < |Y|
elsif not X.Is_Zero and Y.Is_Zero then
return False; -- |X| > |Y|
elsif X.Is_Zero and Y.Is_Zero then
return False; -- |X| = |Y|
end if;
-- Step 1. Find the lesser number, Exponent-wise. Must have the
-- number normalized or the following is false. Also must have filtered
-- out the special cases in which Exp is unrelated to the size of
-- numbers: Zero and Infinity.
if X.Exp < Y.Exp then
return True;
elsif X.Exp > Y.Exp then
return False;
end if;
-- Step 2. If got this far, then the Exponents are equal. Find the
-- the first unequal digit. The following makes use of the fact that
-- the digits are essentially INTEGER values (all zeros beyond the
-- the decimal point.)
for I in Digit_Index'First .. Digit_Index'Last loop
if X.Digit(I) < Y.Digit(I) then
return True;
elsif X.Digit(I) > Y.Digit(I) then
return False;
end if; -- if got this far, then the digits are equal
-- so continue on to the next digit and try again.
end loop;
-- If got this far, then the numbers are equal.
return False;
end Abs_Is_Lesser;
--------------------
-- Abs_Is_Greater --
--------------------
-- Is Abs(X) greater than Abs(Y)?
function Abs_Is_Greater (X, Y : e_Real) return Boolean is
begin
-- Step 0. Handle the infinities.
if X.Is_Infinite and not Y.Is_Infinite then
return True; -- |X| > |Y|
elsif not X.Is_Infinite and Y.Is_Infinite then
return False; -- |Y| > |X|
end if;
-- Step 0b. Handle the Zeros. Another case where the Exp does not tell
-- us the magnitude of the number.
if X.Is_Zero and not Y.Is_Zero then
return False; -- |X| < |Y|
elsif not X.Is_Zero and Y.Is_Zero then
return True; -- |X| > |Y|
elsif X.Is_Zero and Y.Is_Zero then
return False; -- |X| = |Y|
end if;
-- Step 1b. Find the larger number, Exponent-wise. Must have the
-- number normalized or the following is false.
if X.Exp > Y.Exp then
return True;
elsif X.Exp < Y.Exp then
return False;
end if;
-- Step 2. If got this far, then the Exponents are equal. Find the
-- the first unequal digit. The following makes use of the fact that
-- the digits are essentially INTEGER valued (all zeros beyond the
-- the decimal point.)
for I in Digit_Index'First .. Digit_Index'Last loop
if X.Digit(I) > Y.Digit(I) then
return True;
elsif X.Digit(I) < Y.Digit(I) then
return False;
end if; -- if got this far, then the digits are equal
-- so continue on to the next digit and try again.
end loop;
-- If got this far, then the numbers are equal up to Digit_Index'Last.
return False;
end Abs_Is_Greater;
---------------
-- Are_Equal --
---------------
-- X equals Y? Checks all digits except the digits beyond Digit_Index'Last.
-- No rounding is performed.
-- Can use this routine recognize Positive_Infinity and Zero.
function Are_Equal (X, Y : e_Real)
return Boolean
is
begin
-- both zero, go home early:
if X.Is_Zero AND Y.Is_Zero then
return True;
end if;
-- one is zero and the other isn't go home early:
if X.Is_Zero XOR Y.Is_Zero then
return False;
end if;
-- Check signs. Return False if they have different signs.
-- We've already checked for Zero's.
if X.Is_Positive XOR Y.Is_Positive then
return False;
end if;
-- both infinite but have different signs, then
-- the above step already returned false.
-- Make inf = inf so one can use this functions to recognize inf.
-- Another reasonable option would be to make it false.
if X.Is_Infinite AND Y.Is_Infinite then
return True;
end if;
-- One is infinite, the other not:
if X.Is_Infinite XOR Y.Is_Infinite then
return False;
end if;
-- ANDing and XORing Is_Zero and Is_Infinite now know
-- that the neither of the numbers is Zero or Infinite.
-- Check equality, Exponent-wise. Must have both
-- numbers normalized or the following doesn't work. Remember that the
-- the only unnormalized nums are Zero, and the 2 infinities. If got
-- this far then neither X nor Y is one of those three.
if X.Exp /= Y.Exp then
return False;
end if;
-- got this far, then the Exponents are equal. Find the
-- the first unequal digit. Makes use of the fact that the digits are
-- essentially integer valued.
for I in Digit_Index loop
if X.Digit(I) /= Y.Digit(I) then
return False;
end if; -- if got this far, then the digits are equal
-- so continue onto the next digit and try again.
end loop;
--If got this far, then digits, exponent, and sign are equal.
return True;
end Are_Equal;
-------------------
-- Are_Not_Equal --
-------------------
function Are_Not_Equal (X, Y : e_Real) return Boolean is
begin
return NOT Are_Equal (X, Y);
end Are_Not_Equal;
---------
-- ">" --
---------
-- Is X > Y?
function ">" (X, Y : e_Real) return Boolean is
begin
-- Step 0. Check Zeros.
if X.Is_Zero AND Y.Is_Zero then
return False;
end if;
-- Step 0b. Need some optimizations for the common case in which one
-- attempts to determine Positivity by X > Zero or signs by Zero > Y.
-- The following lets infinities through for the non-zero part.
if (not X.Is_Zero) AND Y.Is_Zero then
if X.Is_Positive then
return True; -- X is pos. but not zero, then (X > Zero).
else
return False; -- X is neg. but not zero, then not (X > Zero).
end if;
end if;
if X.Is_Zero AND (not Y.Is_Zero) then
if Y.Is_Positive then
return False; -- Y is pos. but not zero, then not (Zero > Y).
else
return True; -- Y is neg. but not zero, then (Zero > Y).
end if;
end if;
-- Step 1. Now do things more systematically.
-- Check signs. Notice that these give us efficient way to
-- check sign of a number. If X is negative, this is fast because
-- Zero is classified as positive. So go home early if:
if X.Is_Positive and not Y.Is_Positive then
return True;
elsif not X.Is_Positive and Y.Is_Positive then
return False;
end if;
-- Step 1b. Now they are either both positive or both negative.
-- If they are both inf, then raise ce, since don't know:
if X.Is_Infinite AND Y.Is_Infinite then
raise Constraint_Error with "Constraint_Error in routine >. Arguments are inf.";
end if;
-- Step 2. Now they are either both positive or both negative.
-- If they are both neg. return true if Abs X < Abs Y.
if X.Is_Positive and Y.Is_Positive then
return Abs_Is_Greater (X, Y); -- Abs X > Abs Y
else
return Abs_Is_Lesser (X, Y); -- Abs X < Abs Y
end if;
end ">";
---------
-- "<" --
---------
function "<" (X, Y : e_Real) return Boolean is
begin
-- Step 0. Check Zeros.
if X.Is_Zero AND Y.Is_Zero then
return False;
end if;
-- Step 0b. Need some optimizations for the common case in which one
-- attempts to determine signs by X < Zero or positivity by Zero < Y.
-- The following lets infinities through for the non-zero part.
if (not X.Is_Zero) AND Y.Is_Zero then
if X.Is_Positive then
return False; -- X is pos. but not zero, then not (X < Zero).
else
return True; -- X is neg. but not zero, then (X < Zero).
end if;
end if;
if X.Is_Zero AND (not Y.Is_Zero) then
if Y.Is_Positive then
return True; -- Y is pos. but not zero, then (Zero < Y).
else
return False; -- Y is neg. but not zero, then not (Zero < Y).
end if;
end if;
-- Step 1. Now do things more sytematically.
-- Check signs. Notice that these give us efficient way to
-- check sign of a number. If X is negative, this is fast because
-- Zero is classified as positive. (If want to find if it's Pos., use
-- not (X < Zero). Since they aren't both 0 go home early if:
if X.Is_Positive and not Y.Is_Positive then
return False;
elsif not X.Is_Positive and Y.Is_Positive then
return True;
end if;
-- Step 1b. Now they are either both positive or both negative.
-- If they are both inf, then raise ce:
if X.Is_Infinite AND Y.Is_Infinite then
raise Constraint_Error with "Error in routine <. Arguments are inf.";
end if;
-- Step 2. Now they are either both positive or both negative.
-- If they are both neg. return true if Abs X > Abs Y.
if X.Is_Positive and Y.Is_Positive then
return Abs_Is_Lesser (X, Y); -- Abs X < Abs Y
else
return Abs_Is_Greater (X, Y); -- Abs X > Abs Y
end if;
end "<";
----------
-- ">=" --
----------
function ">="
(X, Y : e_Real)
return Boolean
is
begin
return (not (X < Y));
end ">=";
----------
-- "<=" --
----------
function "<="
(X, Y : e_Real)
return Boolean
is
begin
return (not (X > Y));
end "<=";
----------
-- Add --
----------
-- Add the numbers. The individual digits may overflow the 0..Radix-1 range
-- but not the range of the base floating point number used to represent the
-- digit. Carrying is done later.
function Add
(Larger : e_Real;
Smaller : e_Real;
Digit_Shift : Digit_Index)
return e_Real
is
Z : e_Real;
begin
if Digit_Shift > Digit_Index'First then
for I in Digit_Index'First .. Digit_Shift-1 loop
Z.Digit(I) := Larger.Digit(I);
end loop;
end if;
for I in Digit_Shift .. Digit_Index'Last loop
Z.Digit(I) := Larger.Digit(I) + Smaller.Digit(I - Digit_Shift);
end loop;
return Z;
end Add;
--pragma Inline (Add);
--------------
-- Subtract --
--------------
-- Subtract the smaller from the larger. If they have the same
-- exponent, (ie Digit_Shift = 0),
-- then use the quantity "First_Unequal_Digit" to optimize
-- the subtraction, by inserting zeros for all of the equal digits.
-- We already verified that Larger and Smaller are not equal.
procedure Subtract
(Larger : in e_Real;
Smaller : in e_Real;
Digit_Shift : in Digit_Index;
First_Unequal_Digit : in Digit_Index;
Result : out e_Real;
Extra_Guard_Digit : out Digit_Type)
is
I : Digits_Base;
begin
if Digit_Shift = 0 then -- We can make use of First_Unequal_Digit.
if First_Unequal_Digit > 0 then
for I in 0 .. First_Unequal_Digit-1 loop
Result.Digit(I) := Digit_Zero;
end loop;
end if;
for I in First_Unequal_Digit .. Digit_Index'Last loop
Result.Digit(I) := Larger.Digit(I) - Smaller.Digit(I);
end loop;
Extra_Guard_Digit := Digit_Zero; -- important initialization.
else
for I in 0 .. Digit_Shift-1 loop
Result.Digit(I) := Larger.Digit(I);
end loop;
for I in Digit_Shift .. Digit_Index'Last loop
Result.Digit(I) := Larger.Digit(I) - Smaller.Digit(I - Digit_Shift);
end loop;
I := Digit_Index'Last + 1;
Extra_Guard_Digit := -Smaller.Digit(I - Digit_Shift);
-- Here the Larger.Digit(I) = 0.0 because it ran out of digits.
end if;
end Subtract;
--pragma Inline (Subtract);
----------------------------
-- Borrow_For_Subtraction --
----------------------------
-- Do the Borrowing. This can have much overhead in "-" or "+", so some
-- optimizations are performed. If the digits have become less than zero
-- then must borrow from the next higher order digit: subtract 1 from that
-- digit, and add Radix to digit in question. Start
-- at the least significant digit, Digit_Index'Last, work up to point at which
-- the subtraction began: Digit_Shift. Digit_Shift is the first digit of
-- Z on which a subtraction was performed. After that, unless a borrow is
-- performed, the process may end. Borrowing should be extremely
-- rare, so don't do unless necessary.
-- The Extra_Guard_Digit is a virtual digit at index Digit_Index'Last+1. Very
-- important in improving precision in some cases: particularly subtracting
-- a small number from 1.0.
procedure Borrow_For_Subtraction
(Z : in out e_Real;
Extra_Guard_Digit : in Digit_Type;
Digit_Shift : in Digit_Index)
is
First_Nonzero_Digit : Digits_Base := Digit_Index'Last+1;
All_The_Digits_Are_Zero : Boolean := True;
Borrow : constant Digit_Type := -Digit_One;
Guard_Digit : Digit_Type := Extra_Guard_Digit;
I : Digits_Base;
begin
-- This is the general case in which many numbers were subtracted:
-- Here it is possible that Borrow > 1.0.
-- if Digit_Shift < Digit_Index'Last then
-- for I in reverse Digit_Shift+1..Digit_Index'Last loop
-- if Z.Digit(I) < 0.0 then
-- Borrow := Real_Floor (Z.Digit(I) * Inverse_Radix);
-- Z.Digit(I) := Z.Digit(I) - Borrow * Radix; -- Borrow is < 0.0.
-- Z.Digit(I-1) := Z.Digit(I-1) + Borrow;
-- end if;
-- end loop;
-- end if;
-- We are subtracting only 2 numbers, so borrow at most 1 digit.
-- Special case: the extra guard digit at Digit_Index'Last+1:
--Borrow := -Digit_One;
I := Digit_Index'Last+1;
if Guard_Digit < Digit_Zero then
Guard_Digit := Guard_Digit + Digit_Radix;
Z.Digit(I-1) := Z.Digit(I-1) + Borrow;
end if;
if Digit_Shift < Digit_Index'Last then
--Borrow := -Digit_One;
for I in reverse Digit_Shift+1 .. Digit_Index'Last loop
if Z.Digit(I) < Digit_Zero then
Z.Digit(I) := Z.Digit(I) + Digit_Radix;
Z.Digit(I-1) := Z.Digit(I-1) + Borrow;
end if;
end loop;
end if;
-- Step 1. Do everything between the 2nd digit and Digit_Shift.
-- If no borrowing is performed, then are done, since these are the
-- digits on which no subtractions were performed initially. (With the
-- exception of digit Digit_Shift: still must check that it
-- is not < 0.0.)
-- The general case:
-- Borrow_Loop:
-- for I in reverse Digit_Index'First+1 .. Digit_Shift loop
-- if Z.Digit(I) < 0.0 then
-- Borrow := Real_Floor (Z.Digit(I) * Inverse_Radix);
-- Z.Digit(I) := Z.Digit(I) - Borrow * Radix;
-- Z.Digit(I-1) := Z.Digit(I-1) + Borrow;
-- else
-- exit Borrow_Loop;
-- end if;
-- end loop Borrow_Loop;
-- We are subtracting only 2 numbers, so borrow at most 1 digit.
--Borrow := -Digit_One;
Borrow_Loop:
for I in reverse Digit_Index'First+1..Digit_Shift loop
if Z.Digit(I) < Digit_Zero then
Z.Digit(I) := Z.Digit(I) + Digit_Radix;
Z.Digit(I-1) := Z.Digit(I-1) + Borrow;
else
exit Borrow_Loop;
end if;
end loop Borrow_Loop;
-- Step 2. If Z.Digit(0) < 0.0 then the result is < 0.0, which means
-- a failure in the "+" or "-" routines below.
if not Disable_Program_Error_Tests then
if Z.Digit(0) < Digit_Zero then
raise Program_Error with "Some error in Borrow_For_Subtraction.";
end if;
end if;
-- Step 3. Normalize the result if the highest order Digit is zero.
-- Shift the exponent accordingly. Recall that Z should not be Zero;
-- checked for that possibility before subtracting.
-- So shift the entire mantissa left by the number of leading zeros,
-- and decrement the exponent by the same amount. If do any left-shifts,
-- then put at the end of the mantissa the extra guard digit dragged
-- along just for this event.
First_Nonzero_Digit := Digit_Index'Last + 1;
All_The_Digits_Are_Zero := True;
for I in Digit_Index loop
if Z.Digit(I) /= Digit_Zero then
First_Nonzero_Digit := I;
All_The_Digits_Are_Zero := False;
exit;
end if;
end loop;
if All_The_Digits_Are_Zero then
if Guard_Digit = Digit_Zero then
-- But we checked equality of X and Y.
-- Only time this happened it was a compiler bug.
-- but maybe not an err?
Z := Zero;
if not Disable_Program_Error_Tests then
raise Program_Error with "Might be a bug in Borrow_For_Subtraction.";
end if;
else
-- This is certainly possible:
Z.Digit(0) := Guard_Digit;
Z.Exp := Z.Exp - e_Integer (First_Nonzero_Digit);
end if;
end if;
if not All_The_Digits_Are_Zero then -- First_Nonzero_Digit < Max_Index+1
if First_Nonzero_Digit > 0 then -- shift the mantissa left by this amount
for I in 0 .. Digit_Index'Last-First_Nonzero_Digit loop
Z.Digit(I) := Z.Digit(I + First_Nonzero_Digit);
end loop;
-- Shift the mantissa left by this amount.
for I in Digit_Index'Last-First_Nonzero_Digit+1 .. Digit_Index'Last loop
Z.Digit(I) := Digit_Zero;
end loop;
-- Set the rest of the mantissa to 0.0.
Z.Digit(Digit_Index'Last-First_Nonzero_Digit+1) := Guard_Digit;
-- Even tho' set Digit to 0.0 above, set it right now.
Z.Exp := Z.Exp - e_Integer (First_Nonzero_Digit);
end if;
end if;
-- If First_Nonzero_Digit = 0, the usual case, then are done.
end Borrow_For_Subtraction;
--pragma Inline (Borrow_For_Subtraction);
------------------------
-- Carry_For_Addition --
------------------------
-- Do the carrying. This can have much overhead, so some
-- optimizations are performed. If the digits have become larger
-- than Radix-1 then must break the digit into 2 parts and add the larger
-- to a higher order digit. This carry distance is at most one digit,
-- rather than the 2 possible in the multiplication routine. Start
-- at the least significant digit, Digit_Index'Last, work up to point at which
-- the addition began: Digit_Shift. Digit_Shift is the first digit of
-- Z on which an addition was performed. After that, unless a carry is
-- performed, the process may be ended. Carrying should be extremely
-- rare, so don't do unless necessary.
procedure Carry_For_Addition
(Z : in out e_Real;
Digit_Shift : in Digit_Index)
is
Digit_Minus_1 : Digit_Type := Digit_Zero;
We_Are_Finished : Boolean := False;
Must_Normalize : Boolean := False;
Carry : constant Digit_Type := Digit_One;
begin
-- Step 1. Do the carrying among the digits that have been added to each
-- other (Digit_ID in Digit_Shift+1..Digit_Index'Last). Actually,
-- Digit_ID = Digit_Shift had an addition performed to it also..that's
-- dealt with in step 2.
--
-- This is the general case. Useful for an optimized Sum(many numbers).
-- if Digit_Shift < Digit_Index'Last then
-- for I in reverse Digit_Shift+1..Digit_Index'Last loop
-- if Z.Digit(I) > Radix_Minus_1 then
-- Carry := Real_Floor (Z.Digit(I) * Inverse_Radix);
-- Z.Digit(I) := Z.Digit(I) - Carry * Radix;
-- Z.Digit(I-1) := Z.Digit(I-1) + Carry;
-- end if;
-- end loop;
-- end if;
--
-- We're summing at most 2 numbers, so Carry is at most 1.0.
if Digit_Shift < Digit_Index'Last then
for I in reverse Digit_Shift+1 .. Digit_Index'Last loop
if Z.Digit(I) > Digit_Radix_Minus_1 then
--Carry := Digit_One;
Z.Digit(I) := Z.Digit(I) - Digit_Radix;
Z.Digit(I-1) := Z.Digit(I-1) + Carry;
end if;
end loop;
end if;
We_Are_Finished := False; -- We have at least Digit(Digit_Shift) to check.
-- Step 2. Do everything between the 2nd digit and Digit_Shift.
-- If no carry is performed, then we're done, since these are the
-- digits on which no additions were performed initially. (With the
-- exception of digit Digit_Shift: still must check that it
-- is not larger than Radix-1.)
--
-- Carry_Loop:
-- for I in reverse Digit_Index'First+1 .. Digit_Shift loop
-- if Z.Digit(I) > Radix_Minus_1 then
-- Carry := Real_Floor (Z.Digit(I) * Inverse_Radix);
-- Z.Digit(I) := Z.Digit(I) - Carry * Radix;
-- Z.Digit(I-1) := Z.Digit(I-1) + Carry;
-- else
-- We_Are_Finished := True;
-- exit Carry_Loop;
-- end if;
-- end loop Carry_Loop;
-- When summing at most 2 numbers:
Carry_Loop:
for I in reverse Digit_Index'First+1..Digit_Shift loop
if Z.Digit(I) > Digit_Radix_Minus_1 then
--Carry := Digit_One;
Z.Digit(I) := Z.Digit(I) - Digit_Radix;
Z.Digit(I-1) := Z.Digit(I-1) + Carry;
else
We_Are_Finished := True;
exit Carry_Loop;
end if;
end loop Carry_Loop;
-- Step 3. If left the carry_loop early, then go home now.
-- No need to normalize the result (i.e. make sure that the first
-- digit is not 0). No need to increment Z.Exp. This should be the usual
-- case. First however, a debugging test:
if We_Are_Finished then
if not Disable_Program_Error_Tests then
if Z.Digit(0) <= Digit_Zero then
raise Program_Error with "Some error in Carrying for + operator.";
end if;
end if;
return;
end if;
-- Step 4. Perform the final carry if Z.Digit(0) > Radix-1 (to a digit
-- that doesn't exist yet, called Digit_Minus_1.)
-- Must_Normalize := False;
-- if Z.Digit(0) > Radix_Minus_1 then
-- Carry := Real_Floor (Z.Digit(0) * Inverse_Radix);
-- Z.Digit(0) := Z.Digit(0) - Carry * Radix;
-- Digit_Minus_1 := Carry;
-- Must_Normalize := True;
-- end if;
Must_Normalize := False;
if Z.Digit(0) > Digit_Radix_Minus_1 then
--Carry := Digit_One;
Z.Digit(0) := Z.Digit(0) - Digit_Radix;
Digit_Minus_1 := Carry; -- Digit_Minus_1 is initially 0.0.
Must_Normalize := True;
end if;
-- Step 5. Normalize the result if Digit(0) was > Radix-1,
-- hence a carry occurred to a larger digit.
-- Is it possible that Digit(0) is 0 and Digit_minus_1 is also 0?
-- No. To get Digit(0) to zero, it would have to = Radix..then a
-- carry to Digit_Minus_1 would make it zero. But then Digit_Minus_1
-- would be non-zero.
if Must_Normalize then
Z.Exp := Z.Exp + 1;
for I in reverse Digit_Index'First+1 .. Digit_Index'Last loop
Z.Digit(I) := Z.Digit(I-1);
end loop;
Z.Digit(0) := Digit_Minus_1;
end if;
-- Test for failure in algorithm:
if not Disable_Program_Error_Tests then
if Z.Digit(0) <= Digit_Zero then
raise Program_Error with "Some error in Carrying for + operator.";
end if;
end if;
end Carry_For_Addition;
--pragma Inline (Carry_For_Addition);
---------
-- "+" --
---------
-- Just the identity operator, so you can type A := +1.23E+02
-- and the statement will be accepted whether or not A is e_Real.
function "+" (X : e_Real) return e_Real is
begin
return X;
end "+";
---------
-- "+" --
---------
-- Surprizingly complicated.
function "+"(X, Y : e_Real) return e_Real is
Z : e_Real;
Delta_Exp : e_Integer;
Digit_Shift : Digit_Index := 0;
First_Unequal_Digit : Digit_Index := 0;
Extra_Guard_Digit : Digit_Type := Digit_Zero; -- Important init. (for subtraction)
Final_Sign_Is_Positive : Boolean;
Mantissas_Are_Equal : Boolean;
type Max_Info is (X_Is_Max, Y_Is_Max);
Max_Num_ID : Max_Info := X_Is_Max;
type Add_Choice is (Add_Them, Subtract_Y_From_X, Subtract_X_From_Y);
Add_Code : Add_Choice;
begin
-- Step 0. If Either of the numbers is 0.0, then return the other.
if Y.Is_Zero then
return X;
elsif X.Is_Zero then
return Y;
end if;
-- Step 0b. If one is infinite, but not the other, return the infinity,
-- sign of the inf unchanged. If both are inf, say inf + inf = +inf.
-- And say inf - inf raises c.e., because don't know what it is.
if Y.Is_Infinite and not X.Is_Infinite then
return Y;
elsif not Y.Is_Infinite and X.Is_Infinite then
return X;
end if;
if Y.Is_Infinite and X.Is_Infinite then
if not X.Is_Positive and not Y.Is_Positive then
return Negative_Infinity;
elsif X.Is_Positive and Y.Is_Positive then
return Positive_Infinity;
else
raise Constraint_Error with "Subtraction of inf by inf is undefined.";
end if;
end if;
-- Step 1. Find the larger number, Exponent-wise, and return it if it is
-- so much larger than the other that there is no addition to be done.
-- If they are equal, exponent-wise, then say X is the larger.
if Y.Exp > X.Exp then
Max_Num_ID := Y_Is_Max;
else
Max_Num_ID := X_Is_Max;
end if;
Delta_Exp := Abs (X.Exp - Y.Exp);
if Delta_Exp > e_Integer(Digit_Index'Last) then -- ie, Delta_Exp >= No_Of_Digits
case Max_Num_ID is
when X_Is_Max =>
return X;
when Y_Is_Max =>
return Y;
end case;
end if;
-- Step 2. When the exponents are equal, and subtraction is going to be
-- done (ie, one of the numbers is negative, the other pos., X>0 XOR Y>0),
-- need more information about which number is smaller.
-- Now correctly find the larger (Abs-wise) even if the Exp's are equal.
-- Only do this in the subtraction case; if then the numbers turn
-- out to be equal, then return Zero. It is important to handle that
-- special case here.
First_Unequal_Digit := Digit_Index'First;
if (X.Is_Positive XOR Y.Is_Positive) and then X.Exp = Y.Exp then
-- Find the first non-equal word in the mantissas:
Mantissas_Are_Equal := True;
for I in Digit_Index'First .. Digit_Index'Last loop
if X.Digit(I) /= Y.Digit(I) then
Mantissas_Are_Equal := False;
First_Unequal_Digit := I;
exit;
end if;
end loop;
-- We're finished if the Exp's are equal, the Mantissas are equal
-- and we're subtracting one from the other:
if Mantissas_Are_Equal then
return Zero;
end if;
-- Find the larger of the Two (Absolute values of course):
if X.Digit(First_Unequal_Digit) > Y.Digit(First_Unequal_Digit) then
Max_Num_ID := X_Is_Max;
else
Max_Num_ID := Y_Is_Max;
end if;
end if;
-- Step 3. Do add or subtract? Depends on their signs.
if X.Is_Positive and Y.Is_Positive then
Add_Code := Add_Them;
Final_Sign_Is_Positive := True;
end if;
if (not X.Is_Positive) and (not Y.Is_Positive) then
Add_Code := Add_Them; -- add 2 neg nums as tho they were pos.
Final_Sign_Is_Positive := False;
end if;
if (not X.Is_Positive) and Y.Is_Positive then
case Max_Num_ID is
when X_Is_Max =>
Add_Code := Subtract_Y_From_X; -- I mean Abs(X) - Abs(Y)
Final_Sign_Is_Positive := False;
when Y_Is_Max =>
Add_Code := Subtract_X_From_Y;
Final_Sign_Is_Positive := True;
end case;
end if;
if X.Is_Positive and (not Y.Is_Positive) then
case Max_Num_ID is
when X_Is_Max =>
Add_Code := Subtract_Y_From_X; -- I mean Abs(X) - Abs(Y)
Final_Sign_Is_Positive := True;
when Y_Is_Max =>
Add_Code := Subtract_X_From_Y; -- I mean Abs(Y) - Abs(X)
Final_Sign_Is_Positive := False;
end case;
end if;
-- Step 4. We're now ready to do the adding (or subtracting).
-- The adding and subtracting are separated from the
-- carrying/borrowing/normalizing process, because i) the
-- adding can then be vectorized or otherwise optimized and
-- ii) in other versions many numbers will be summed (not just X and Y),
-- in which case it really pays off to do the normalizing
-- and carrying just once, after many additions, because the
-- overhead of carrying can be higher than summing.
Digit_Shift := Digit_Index (Delta_Exp);
case Add_Code is
when Add_Them =>
case Max_Num_ID is
when X_Is_Max =>
Z := Add (Larger => X, Smaller => Y, Digit_Shift => Digit_Shift);
when Y_Is_Max =>
Z := Add (Larger => Y, Smaller => X, Digit_Shift => Digit_Shift);
end case;
when Subtract_Y_From_X =>
Subtract (Larger => X, Smaller => Y, Digit_Shift => Digit_Shift,
First_Unequal_Digit => First_Unequal_Digit,
Result => Z, Extra_Guard_Digit => Extra_Guard_Digit);
when Subtract_X_From_Y =>
Subtract (Larger => Y, Smaller => X, Digit_Shift => Digit_Shift,
First_Unequal_Digit => First_Unequal_Digit,
Result => Z, Extra_Guard_Digit => Extra_Guard_Digit);
end case;
-- Step 5. Do everything except the carrying or borrowing.
-- We were careful about subtracting the smaller from the larger, so
-- the following steps can be done before or after the carrying, (provided
-- only 2 numbers are being summed).
if Final_Sign_Is_Positive then
Z.Is_Positive := True;
else
Z.Is_Positive := False;
end if;
-- Set Z.Exp but remember it still may be raised by 1 (if carrying occurs),
-- or lowered by 1 if borrowing occurs.
case Max_Num_ID is
when X_Is_Max =>
Z.Exp := X.Exp;
when Y_Is_Max =>
Z.Exp := Y.Exp;
end case;
-- The Z = 0 case has already been considered.
Z.Is_Zero := False;
-- Do the carrying or borrowing, as the case may be. These also
-- normalize the number, and produce an additional correction to the Exp.
case Add_Code is
when Add_Them =>
Carry_For_Addition (Z, Digit_Shift);
when Subtract_Y_From_X | Subtract_X_From_Y =>
Borrow_For_Subtraction (Z, Extra_Guard_Digit, Digit_Shift);
end case;
-- Step 6. Handle over and under flow. Here underflow goes to Zero,
-- overflow to Infinity. This analysis is all isolated to the end
-- of the arithmetic routines so that it is more easily modified to
-- raise exceptions if that is what is desired. In order to do it
-- here, must assume that the parmeters Min_Exponent and Max_Exponent
-- limit the dynamic range of the Exp to about 1/4 of that allowed
-- by the base type used to represent the exponent. This is
-- checked in the spec with an assertion. (The reason is, the above
-- code will go outside the accepted range of Exp with out being
-- checked till down here.) This limit is OK because the base type
-- allows excessively large exponents anyway.
if Z.Exp < Min_Exponent then
Z := Zero;
end if;
if Z.Exp > Max_Exponent then
if Z.Is_Positive then
Z := Positive_Infinity;
else
Z := Negative_Infinity;
end if;
end if;
return Z;
end "+";
---------
-- "-" --
---------
-- Subtract Y from X:
function "-"(X, Y : e_Real) return e_Real is
Y2 : e_Real := Y;
begin
Y2.Is_Positive := not Y.Is_Positive;
return X + Y2;
end "-";
------------------------------------
-- Do_Carrying_For_Multiplication --
------------------------------------
-- The digits have probably overflowed their allotted range of 0..Radix-1.
-- Break the digits into three parts:
-- digit = d2 * 2**(Radix*2) + d1 * 2**(Radix*1) + d0 * 2**(Radix*0)
-- where d_n is in the range 0..Radix-1.
-- Carry d2 to two digits to the left of Digit; carry d1 one digit to the
-- left of Digit. So Carry_Minus_1 = d1, Carry_Minus_2 = d2.
procedure Do_Carrying_For_Multiplication
(Z : in out e_Real;
Digit_Minus_1 : in out Digit_Type;
Digit_Minus_2 : in out Digit_Type)
is
Carry_Minus_1, Carry_Minus_2 : Digit_Type := Digit_Zero; -- Essential init.
The_Digit : Digit_Type;
I : Digit_Index;
begin
--*******************************************************************
-- The real valued digits are effectively integers in the range
-- 0..2**63-1. (Std. vers.) Break them into three words: 1st 30 bits (d0),
-- 2nd 30 bits (d1), and last 3 bits (d2). (If Radix is 2**29, then these
-- will be 29 bit, 29 bit, 5 bit word repectively.) The 3rd (5 bit) word
-- will be Carried 2 digits to the left (Carry_Minus_2). The second
-- 29 bit word will be carried 1 digit to the left. The remaining
-- lowest order 29 bit word will be the desired digit.
--
-- Overhead is large from carrying so don't calculate and
-- carry the 3rd (5 bit) word unless necessary. This carry's usually
-- not necessary for the lowest order digits, because usually
-- the bits in the words are random, so half the time the word is
-- > Radix/2, half smaller. Or, <X> = Radix / 2.
-- Assume <X*Y> = <X><Y> (assume independence). Then
-- < SUM(X*Y) > = SUM <(X*Y)> = SUM <X><Y> = SUM <X>**2. So after
-- 4 sums (I = 3), you break the Radix**2 barrier, on the average.
-- So the optimization matters when the total number of digits is
-- small. When there are many digits, then it doesn't help much
-- but the overhead from trying is small enough that might as well
-- optimize for the common case: relatively small number of total
-- digits.
--*******************************************************************
for I in reverse Digit_Index'First+2 .. Digit_Index'Last loop
The_Digit := Z.Digit(I);
if The_Digit >= Digit_Radix_Squared then
Carry_Minus_2 := Shift_Right_2x_No_of_Bits_in_Radix (The_Digit);
The_Digit := The_Digit - Carry_Minus_2 * Digit_Radix_Squared;
Z.Digit(I-2) := Z.Digit(I-2) + Carry_Minus_2;
end if;
Carry_Minus_1 := Shift_Right_No_of_Bits_in_Radix (The_Digit);
Z.Digit(I) := The_Digit - Carry_Minus_1 * Digit_Radix;
Z.Digit(I-1) := Z.Digit(I-1) + Carry_Minus_1;
end loop;
-- Special case I = Digit_Index'First + 1 = 1.
I := Digit_Index'First + 1;
The_Digit := Z.Digit(I);
if The_Digit >= Digit_Radix_Squared then
Carry_Minus_2 := Shift_Right_2x_No_of_Bits_in_Radix (The_Digit);
The_Digit := The_Digit - Carry_Minus_2 * Digit_Radix_Squared;
Digit_Minus_1 := Digit_Minus_1 + Carry_Minus_2;
end if;
Carry_Minus_1 := Shift_Right_No_of_Bits_in_Radix (The_Digit);
Z.Digit(I) := The_Digit - Carry_Minus_1 * Digit_Radix;
Z.Digit(I-1) := Z.Digit(I-1) + Carry_Minus_1;
-- Special case I = Digit_Index'First = 0
I := Digit_Index'First;
The_Digit := Z.Digit(I);
if The_Digit >= Digit_Radix_Squared then
Carry_Minus_2 := Shift_Right_2x_No_of_Bits_in_Radix (The_Digit);
The_Digit := The_Digit - Carry_Minus_2 * Digit_Radix_Squared;
Digit_Minus_2 := Digit_Minus_2 + Carry_Minus_2;
end if;
Carry_Minus_1 := Shift_Right_No_of_Bits_in_Radix (The_Digit);
Z.Digit(I) := The_Digit - Carry_Minus_1 * Digit_Radix;
Digit_Minus_1 := Digit_Minus_1 + Carry_Minus_1;
-- Special case I = Digit_Index'First - 1
if Digit_Minus_1 > Digit_Radix_minus_1 then
Carry_Minus_1 := Shift_Right_No_of_Bits_in_Radix (Digit_Minus_1);
Digit_Minus_1 := Digit_Minus_1 - Carry_Minus_1 * Digit_Radix;
Digit_Minus_2 := Digit_Minus_2 + Carry_Minus_1;
end if;
end Do_Carrying_For_Multiplication;
--pragma Inline (Do_Carrying_For_Multiplication);
---------------
-- Normalize --
---------------
-- Normalize the result if the highest order (negative Index) digits are
-- non-zero. (The usual case.)
-- Shift Mantissa and the exponent accordingly. (The canonical form
-- requires that the first digit is non-zero.)
procedure Normalize
(Z : in out e_Real;
Digit_Minus_1 : in Digit_Type;
Digit_Minus_2 : in Digit_Type)
is
First_Nonzero_Digit : Digit_Index := Digit_Index'First; -- Init. essential
First_Nonzero_Digit_Is_Minus_1 : Boolean := False; -- Init. essential
First_Nonzero_Digit_Is_Minus_2 : Boolean := False; -- Init. essential
All_Digits_Are_Zero : Boolean := False; -- Init. essential
begin
-- Step 0. Infinities and Zero.
if Z.Is_Infinite then
return;
end if;
Z.Is_Zero := False; -- Will be toggled if all digits 0.
-- Step 1. Find the first non-zero digit:
if Digit_Minus_2 > Digit_Zero then
First_Nonzero_Digit_Is_Minus_2 := True;
elsif Digit_Minus_1 > Digit_Zero then
First_Nonzero_Digit_Is_Minus_1 := True;
else
All_Digits_Are_Zero := True;
for I in Digit_Index loop
if Z.Digit(I) /= Digit_Zero then
First_Nonzero_Digit := I; -- So First_Nonzero_Digit <= Digit_Index'Last.
All_Digits_Are_Zero := False;
exit;
end if;
end loop;
end if;
if All_Digits_Are_Zero then
Z := Zero;
return;
end if;
-- Step 2. Shift the array to the right if the Minus_N digits are
-- non Zero. Shift the array to the left if necessary (shouldn't be).
if First_Nonzero_Digit_Is_Minus_2 then -- Shift right by 2:
for I in reverse Digit_Index'First+2 .. Digit_Index'Last loop
Z.Digit(I) := Z.Digit(I - 2);
end loop;
Z.Digit(1) := Digit_Minus_1;
Z.Digit(0) := Digit_Minus_2;
Z.Exp := Z.Exp + 2;
elsif First_Nonzero_Digit_Is_Minus_1 then -- Shift right by 1:
for I in reverse Digit_Index'First+1 .. Digit_Index'Last loop
Z.Digit(I) := Z.Digit(I - 1);
end loop;
Z.Digit(0) := Digit_Minus_1;
Z.Exp := Z.Exp + 1;
elsif First_Nonzero_Digit > Digit_Index'First then
-- Shift left by val of First_Non...:
for I in 0 .. Digit_Index'Last-First_Nonzero_Digit loop
Z.Digit(I) := Z.Digit(I + First_Nonzero_Digit);
end loop;
for I in Digit_Index'Last-First_Nonzero_Digit+1 .. Digit_Index'Last loop
Z.Digit(I) := Digit_Zero;
end loop;
Z.Exp := Z.Exp - e_Integer (First_Nonzero_Digit); --assumes Digit_Index'First=0
end if;
-- Test for failure in algorithm:
if not Disable_Program_Error_Tests then
if Z.Digit(0) > Digit_Radix_Minus_1 or Z.Digit(0) <= Digit_Zero then
raise Program_Error with "Some error in Normalization for * operator.";
end if;
end if;
end Normalize;
--pragma Inline (Normalize);
----------------------------
-- General_Multiplication --
----------------------------
function General_Multiplication
(X, Y : e_Real)
return e_Real
is
Z : e_Real;
Digit_Minus_1, Digit_Minus_2 : Digit_Type := Digit_Zero; -- Essential init
Sum : Digit_Type := Digit_Zero;
No_Of_Digits, No_Of_Segments, Remaining_Sums : Digits_Base;
Starting_Digit, Ending_k : Digit_Index;
Start_Sum, End_Sum : Digit_Index;
Allowed_Digits_Per_Carry : constant := Sums_per_Carry + 1;
-- If you sum 9 numbers you only do 8 sums.
begin
-- Step 0. Handle the Zeros. We'll say 0 * infinity is 0, since inf is
-- really just a large finite number.
if X.Is_Zero or Y.Is_Zero then
return Zero;
end if;
Z.Is_Zero := False; -- toggled below if underflow.
-- Step 1. If one or more is infinite..Notice inf * inf = inf here.
if Y.Is_Infinite or X.Is_Infinite then
if X.Is_Positive xor Y.Is_Positive then -- opposite signs.
return Negative_Infinity;
else
return Positive_Infinity;
end if;
end if;
-- Step 2. Handle the signs and exponents:
Z.Is_Positive := not (X.Is_Positive XOR Y.Is_Positive);
Z.Exp := X.Exp + Y.Exp; -- Will be further adjusted by Carry/Normalize.
No_Of_Digits := Digit_Index'Last + 1;
No_Of_Segments := No_Of_Digits / Allowed_Digits_Per_Carry;
Remaining_Sums := No_Of_Digits REM Allowed_Digits_Per_Carry;
-- Z has been initialized to Zero: essential if Remaining_Sums = 0
-- First do the stragglers, digits of index (k in 0..Remaining_Sums-1):
if Remaining_Sums > 0 then
for Digit_ID in Digit_Index loop
Ending_k := Digit_Index'Min (Digit_ID, Remaining_Sums-1);
Sum := Digit_Zero;
for k in Digit_Index'First .. Ending_k loop
Sum := Sum + X.Digit(k) * Y.Digit(Digit_ID - k);
end loop;
Z.Digit(Digit_ID) := Sum; -- init Z.
end loop;
Do_Carrying_For_Multiplication (Z, Digit_Minus_1, Digit_Minus_2);
end if;
-- Now do the segments of length (up to) (usually) 32:
if No_Of_Segments > 0 then
for Segment in 0 .. No_Of_Segments-1 loop
Start_Sum := (Segment+0) * Allowed_Digits_Per_Carry + Remaining_Sums;
End_Sum := (Segment+1) * Allowed_Digits_Per_Carry + Remaining_Sums - 1;
--End_Sum := Start_Sum + (Allowed_Digits_Per_Carry - 1);
Starting_Digit := Start_Sum;
for Digit_ID in Starting_Digit .. Digit_Index'Last loop
Ending_k := Digit_Index'Min (Digit_ID, End_Sum);
Sum := Digit_Zero;
for k in Start_Sum .. Ending_k loop
Sum := Sum + X.Digit(k) * Y.Digit(Digit_ID - k);
end loop;
Z.Digit(Digit_ID) := Z.Digit(Digit_ID) + Sum;
-- Z.Digit(Digit_ID) is close enough to 0 (ie, < Radix-1) that this
-- does not count as a sum in the Sums_Per_Carry rule.
-- That's why Allowed_Sums_Per_Carry = Sums_Per_Carry+1 here.
end loop;
Do_Carrying_For_Multiplication (Z, Digit_Minus_1, Digit_Minus_2);
end loop;
end if;
-- Must Normalize: shift digit array to make sure that the first digit
-- is non-zero: if Infinity or Zero gets this far, then problem occurs.
-- Should catch in normalize.
Normalize (Z, Digit_Minus_1, Digit_Minus_2);
-- Step 4. Handle over and under flow. Here underflow goes to Zero,
-- overflow to Infinity. In order to do it
-- here, must assume that the parmeters Min_Exponent and Max_Exponent
-- limit the dynamic range of the Exp to about 1/4 of that allowed
-- by the base type used to represent the exponent. This is
-- checked in the spec with an assertion. (The reason is, the above
-- code will go well outside the accepted range of Exp with out being
-- checked till down here.) This limit is OK because the base type
-- allows excessively large exponents anyway, up to 2**31-1.
if Z.Exp < Min_Exponent then
Z := Zero;
end if;
if Z.Exp > Max_Exponent then
if Z.Is_Positive then
Z := Positive_Infinity;
else
Z := Negative_Infinity;
end if;
end if;
return Z;
end General_Multiplication;
------------
-- Square --
------------
-- Suppose Z, and X are composed of n digits 0..n-1. Then X*X is
--
-- Xn-1 := X0*Xn-1 + X1*Xn-2 + .. + Xn-1*X0
-- ...
-- X2 := X0*X2 + X1*X1 + X2*X0
-- X1 := X0*X1 + X1*X0
-- X0 := X0*X0
--
-- Now follows the upper half of the table, which produces words beyond
-- the precision of the two number X and X that are being multiplied. These
-- don't calculate. (Just make N larger if more precision is needed).
--
procedure Square
(X : in out e_Real)
is
Digit_Minus_1, Digit_Minus_2 : Digit_Type := Digit_Zero; -- Essential init
Ultimate_No_of_Digits : constant := Ultimate_Digit + 1;
-- equals: Digit_Index'Last - Digit_Index'First + 1 = Mantissa'Length
-------------------------------------
-- Product_if_digits_fewer_than_17 --
-------------------------------------
procedure Product_if_digits_fewer_than_17
is
pragma Assert (Ultimate_No_of_Digits >= 5); --because no if-then for 1st 5.
pragma Assert (Ultimate_No_of_Digits < 17);
pragma Assert (No_Of_Bits_In_Radix <= 30);
-- (not a) or b is same as a implies b.
-- no need to carry until the end if following evaluate to true:
pragma Assert (not (No_Of_Bits_In_Radix = 30) or Ultimate_No_of_Digits <= 8);
pragma Assert (not (No_Of_Bits_In_Radix = 29) or Ultimate_No_of_Digits <= 32);
pragma Suppress (Index_Check);
A : Mantissa renames X.Digit;
S : constant Digit_Index := Digit_Index'First;
begin
-- Ultimate_No_of_Digits is named number, so optimizer should
-- eliminate unused blocks of code below...not that it matters.
-- need to do intermediate carrying if No_Of_Bits_In_Radix >= 30
-- and more than 8 digits.
-- ! Must be done in the following order !
if Ultimate_No_of_Digits >= 16 then
A (S+15) :=(A(S+0)*A(S+15) + A(S+1)*A(S+14) + A(S+2)*A(S+13) +
A(S+3)*A(S+12) + A(S+4)*A(S+11) + A(S+5)*A(S+10)
+ A(S+6)*A(S+9) + A(S+7)*A(S+8))*Digit_Two;
end if;
if Ultimate_No_of_Digits >= 15 then
A (S+14) :=(A(S+0)*A(S+14) + A(S+1)*A(S+13) + A(S+2)*A(S+12) +
A(S+3)*A(S+11) + A(S+4)*A(S+10) + A(S+5)*A(S+9)
+ A(S+6)*A(S+8))*Digit_Two
+ A(S+7)*A(S+7);
end if;
if Ultimate_No_of_Digits >= 14 then
A (S+13) :=(A(S+0)*A(S+13) + A(S+1)*A(S+12) + A(S+2)*A(S+11) +
A(S+3)*A(S+10) + A(S+4)*A(S+9) + A(S+5)*A(S+8)
+ A(S+6)*A(S+7))*Digit_Two;
end if;
if Ultimate_No_of_Digits >= 13 then
A (S+12) :=(A(S+0)*A(S+12) + A(S+1)*A(S+11) + A(S+2)*A(S+10) +
A(S+3)*A(S+9) + A(S+4)*A(S+8) + A(S+5)*A(S+7))*Digit_Two
+ A(S+6)*A(S+6);
end if;
if Ultimate_No_of_Digits >= 12 then
A (S+11) :=(A(S+0)*A(S+11) + A(S+1)*A(S+10) + A(S+2)*A(S+9) +
A(S+3)*A(S+8) + A(S+4)*A(S+7) + A(S+5)*A(S+6))*Digit_Two;
end if;
if Ultimate_No_of_Digits >= 11 then
A (S+10) := (A(S+0)*A(S+10) + A(S+1)*A(S+9) + A(S+2)*A(S+8)
+ A(S+3)*A(S+7) + A(S+4)*A(S+6)) * Digit_Two
+ A(S+5)*A(S+5);
end if;
if Ultimate_No_of_Digits >= 10 then
A (S+9) := (A(S+0)*A(S+9) + A(S+1)*A(S+8) + A(S+2)*A(S+7)
+ A(S+3)*A(S+6) + A(S+4)*A(S+5)) * Digit_Two;
end if;
if Ultimate_No_of_Digits >= 9 then
A (S+8) := (A(S+0)*A(S+8) + A(S+1)*A(S+7) + A(S+2)*A(S+6)
+ A(S+3)*A(S+5)) * Digit_Two
+ A(S+4)*A(S+4);
end if;
if Ultimate_No_of_Digits >= 8 then
A (S+7) := (A(S+0)*A(S+7) + A(S+1)*A(S+6) + A(S+2)*A(S+5)
+ A(S+3)*A(S+4)) * Digit_Two;
end if;
if Ultimate_No_of_Digits >= 7 then
A (S+6) := (A(S+0)*A(S+6) + A(S+1)*A(S+5) + A(S+2)*A(S+4)) * Digit_Two
+ A(S+3)*A(S+3);
end if;
if Ultimate_No_of_Digits >= 6 then
A (S+5) := (A(S+0)*A(S+5) + A(S+1)*A(S+4) + A(S+2)*A(S+3)) * Digit_Two;
end if;
A (S+4) := A(S+2)*A(S+2) +
(A(S+0)*A(S+4) + A(S+1)*A(S+3)) * Digit_Two;
A (S+3) :=(A(S+0)*A(S+3) + A(S+1)*A(S+2)) * Digit_Two;
A (S+2) := A(S+1)*A(S+1) +
A(S+0)*A(S+2) * Digit_Two;
A (S+1) := A(S+0)*A(S+1) * Digit_Two;
A (S+0) := A(S+0)*A(S+0);
end Product_if_digits_fewer_than_17;
begin
-- Step 0. Handle the Zeros. We'll say 0 * infinity is 0, since inf is
-- really just a large finite number.
if X.Is_Zero then
return;
end if;
-- Step 2. Do the multiplication. We can only sum 32 elements of the sum
-- before the carrys must be done (in one stnd setting).
-- We use the inner product version (inner loop is an
-- dot-product.) To get the outer product version (BLAS routine DAXPY),
-- interchange the order of the loops.
--
-- Here's the idea:
-- for Digit_ID in Digit_Index loop
-- Sum := 0.0;
-- for k in 0..Digit_ID loop
-- Sum := Sum + X(k) * Y(Digit_ID-k);
-- end loop;
-- Z(Digit_ID) := Sum;
-- end loop;
--
-- Break sum into segments of 32 each in index k. Perform a carry
-- after each sum of 32 elements.
if (Ultimate_No_of_Digits < 9 and then No_Of_Bits_In_Radix <= 30) or
(Ultimate_No_of_Digits < 17 and then No_Of_Bits_In_Radix <= 29) then
Product_if_digits_fewer_than_17;
X.Exp := X.Exp + X.Exp; -- Will be further adjusted by "Normalize.." routine.
Do_Carrying_For_Multiplication (X, Digit_Minus_1, Digit_Minus_2);
-- Must Normalize: shift digit array to make sure that the first digit
-- is non-zero: if Infinity or Zero gets this far, then problem occurs.
-- Should catch in normalize.
Normalize (X, Digit_Minus_1, Digit_Minus_2);
X.Is_Positive := True;
else
X := General_Multiplication (X, X);
return;
end if;
-- Step 4. Handle over and under flow. Here underflow goes to Zero,
-- overflow to Infinity. This is all isolated to the end
-- of the arithmetic routines so that it is easily modified to
-- raise exceptions if that's what is desired. In order to do it
-- here, must assume that the parmeters Min_Exponent and Max_Exponent
-- limit the dynamic range of the Exp to about 1/4 of that allowed
-- by the base type used to represent the exponent. This is
-- checked in the spec with an assertion. (The reason is, the above
-- code will go well outside the accepted range of Exp with out being
-- checked till down here.) This limit is OK because the base type
-- allows excessively large exponents anyway, up to 2**31-1.
if X.Exp < Min_Exponent then
X := Zero;
end if;
if X.Exp > Max_Exponent then
X := Positive_Infinity;
end if;
end Square;
-------------------
-- Multiply_Stnd --
-------------------
-- Suppose Z, X, and Y are composed of n digits 0..n-1. Then X*Y is
--
-- Z0 := X0*Y0
-- Z1 := X0*Y1 + X1*Y0
-- Z2 := X0*Y2 + X1*Y1 + X2*Y0
-- ...
-- Zn-1 := X0*Yn-1 + X1*Yn-2 + .. + Xn-1*Y0
--
-- Now follows the upper half of the table, which produces words beyond
-- the precision of the two number X and Y that are being multiplied. These
-- don't calculate. (Just make N larger if more precision is needed).
-- If n is minimal for efficiency reasons, then it would be more efficient
-- in some calculations to make use the following instead of increasing the
-- number of digits to get the required precision.
--
-- Zn := Xn-1*Y1 + ... + X1*Yn-1
-- ...
-- Z2n-2 := Xn-1*Yn-1
--
function Multiply_Stnd
(X, Y : e_Real)
return e_Real
is
Z : e_Real := X;
Digit_Minus_1, Digit_Minus_2 : Digit_Type := Digit_Zero; -- Essential init
Ultimate_No_of_Digits : constant := Ultimate_Digit + 1;
-- equals: Digit_Index'Last - Digit_Index'First + 1 = Mantissa'Length
-------------------------------------
-- Product_if_digits_fewer_than_17 --
-------------------------------------
procedure Product_if_digits_fewer_than_17
is
pragma Assert (Ultimate_No_of_Digits >= 5); --because no if-then's for 1st 5.
pragma Assert (Ultimate_No_of_Digits < 17);
pragma Assert (No_Of_Bits_In_Radix <= 30);
-- (not a) or b is same as a implies b.
-- no need to carry until the end if following evaluate to true:
pragma Assert (not (No_Of_Bits_In_Radix = 30) or Ultimate_No_of_Digits <= 8);
pragma Assert (not (No_Of_Bits_In_Radix = 29) or Ultimate_No_of_Digits <= 32);
pragma Suppress (Index_Check);
A : Mantissa renames Z.Digit;
B : Mantissa renames Y.Digit;
S : constant Digit_Index := Digit_Index'First;
begin
-- would need to do intermediate carrying if
-- No_Of_Bits_In_Radix >= 30 and Ultimate_No_of_Digits > 5.
-- Ultimate_No_of_Digits is named number, so optimizer should
-- eliminate unused blocks of code below...
if Ultimate_No_of_Digits >= 16 then
A(S+15) := A(S+0)*B(S+15) + A(S+1)*B(S+14) + A(S+2)*B(S+13)
+ A(S+3)*B(S+12) + A(S+4)*B(S+11) + A(S+5)*B(S+10)
+ A(S+6)*B(S+9) + A(S+7)*B(S+8) + A(S+8)*B(S+7)
+ A(S+9)*B(S+6) + A(S+10)*B(S+5) + A(S+11)*B(S+4)
+ A(S+12)*B(S+3) + A(S+13)*B(S+2) + A(S+14)*B(S+1)
+ A(S+15)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 15 then
A(S+14) := A(S+0)*B(S+14) + A(S+1)*B(S+13) + A(S+2)*B(S+12)
+ A(S+3)*B(S+11) + A(S+4)*B(S+10) + A(S+5)*B(S+9)
+ A(S+6)*B(S+8) + A(S+7)*B(S+7) + A(S+8)*B(S+6)
+ A(S+9)*B(S+5) + A(S+10)*B(S+4) + A(S+11)*B(S+3)
+ A(S+12)*B(S+2) + A(S+13)*B(S+1) + A(S+14)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 14 then
A(S+13) := A(S+0)*B(S+13) + A(S+1)*B(S+12) + A(S+2)*B(S+11)
+ A(S+3)*B(S+10) + A(S+4)*B(S+9) + A(S+5)*B(S+8)
+ A(S+6)*B(S+7) + A(S+7)*B(S+6) + A(S+8)*B(S+5)
+ A(S+9)*B(S+4) + A(S+10)*B(S+3) + A(S+11)*B(S+2)
+ A(S+12)*B(S+1) + A(S+13)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 13 then
A(S+12) := A(S+0)*B(S+12) + A(S+1)*B(S+11) + A(S+2)*B(S+10)
+ A(S+3)*B(S+9) + A(S+4)*B(S+8) + A(S+5)*B(S+7)
+ A(S+6)*B(S+6) + A(S+7)*B(S+5) + A(S+8)*B(S+4)
+ A(S+9)*B(S+3) + A(S+10)*B(S+2) + A(S+11)*B(S+1)
+ A(S+12)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 12 then
A(S+11) := A(S+0)*B(S+11) + A(S+1)*B(S+10) + A(S+2)*B(S+9)
+ A(S+3)*B(S+8) + A(S+4)*B(S+7) + A(S+5)*B(S+6)
+ A(S+6)*B(S+5) + A(S+7)*B(S+4) + A(S+8)*B(S+3)
+ A(S+9)*B(S+2) + A(S+10)*B(S+1) + A(S+11)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 11 then
A(S+10) := A(S+0)*B(S+10) + A(S+1)*B(S+9) + A(S+2)*B(S+8)
+ A(S+3)*B(S+7) + A(S+4)*B(S+6) + A(S+5)*B(S+5)
+ A(S+6)*B(S+4) + A(S+7)*B(S+3) + A(S+8)*B(S+2)
+ A(S+9)*B(S+1) + A(S+10)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 10 then
A(S+9) := A(S+0)*B(S+9) + A(S+1)*B(S+8) + A(S+2)*B(S+7)
+ A(S+3)*B(S+6) + A(S+4)*B(S+5) + A(S+5)*B(S+4)
+ A(S+6)*B(S+3) + A(S+7)*B(S+2) + A(S+8)*B(S+1)
+ A(S+9)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 9 then
A(S+8) := A(S+0)*B(S+8) + A(S+1)*B(S+7) + A(S+2)*B(S+6)
+ A(S+3)*B(S+5) + A(S+4)*B(S+4) + A(S+5)*B(S+3)
+ A(S+6)*B(S+2) + A(S+7)*B(S+1) + A(S+8)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 8 then
A(S+7) := A(S+0)*B(S+7) + A(S+1)*B(S+6) + A(S+2)*B(S+5)
+ A(S+3)*B(S+4) + A(S+4)*B(S+3) + A(S+5)*B(S+2)
+ A(S+6)*B(S+1) + A(S+7)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 7 then
A(S+6) := A(S+0)*B(S+6) + A(S+1)*B(S+5) + A(S+2)*B(S+4)
+ A(S+3)*B(S+3) + A(S+4)*B(S+2) + A(S+5)*B(S+1)
+ A(S+6)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 6 then
A(S+5) := A(S+0)*B(S+5) + A(S+1)*B(S+4) + A(S+2)*B(S+3)
+ A(S+3)*B(S+2) + A(S+4)*B(S+1) + A(S+5)*B(S+0);
end if;
A(S+4) := A(S+0)*B(S+4) + A(S+1)*B(S+3) + A(S+2)*B(S+2)
+ A(S+3)*B(S+1) + A(S+4)*B(S+0);
A(S+3) := A(S+0)*B(S+3) + A(S+1)*B(S+2) + A(S+2)*B(S+1)
+ A(S+3)*B(S+0);
A(S+2) := A(S+0)*B(S+2) + A(S+1)*B(S+1) + A(S+2)*B(S+0);
A(S+1) := A(S+0)*B(S+1) + A(S+1)*B(S+0);
A(S+0) := A(S+0)*B(S+0);
end Product_if_digits_fewer_than_17;
begin
-- Step 0. Handle the Zeros. We'll say 0 * infinity is 0, since inf is
-- really just a large finite number.
if X.Is_Zero or Y.Is_Zero then
return Zero;
end if;
Z.Is_Zero := False; -- toggled below if underflow.
-- Step 1. If one or more is infinite..Notice inf * inf = inf here.
if Y.Is_Infinite or X.Is_Infinite then
if X.Is_Positive xor Y.Is_Positive then -- opposite signs.
return Negative_Infinity;
else
return Positive_Infinity;
end if;
end if;
-- Step 2. Handle the signs and exponents:
Z.Is_Positive := not (X.Is_Positive XOR Y.Is_Positive);
Z.Exp := X.Exp + Y.Exp; -- Will be further adjusted by "Carry.." routine.
-- Step 3. Do the multiplication. Can only sum (say) 32 elements of
-- the sum before the carrys must be done.
-- We use the inner product version (inner loop is an
-- dot-product.) To get the outer product version (BLAS routine DAXPY),
-- interchange the order of the loops.
--
-- Here's the idea:
-- for Digit_ID in Digit_Index loop
-- Sum := 0.0;
-- for k in 0..Digit_ID loop
-- Sum := Sum + X(k) * Y(Digit_ID-k);
-- end loop;
-- Z(Digit_ID) := Sum;
-- end loop;
--
-- Break sum into segments of 32 each in index k. Perform a carry
-- after each sum of 32 elements.
if (Ultimate_No_of_Digits < 9 and then No_Of_Bits_In_Radix <= 30) or
(Ultimate_No_of_Digits < 17 and then No_Of_Bits_In_Radix <= 29) then
Product_if_digits_fewer_than_17; -- Z = Z * Y (Z has been initialized to X).
Do_Carrying_For_Multiplication (Z, Digit_Minus_1, Digit_Minus_2);
-- the procedure requires initialized (0) Digit_Minus_1, ...
else
Z := General_Multiplication (X, Y);
return Z;
end if;
-- Must Normalize: shift digit array to make sure that the first digit
-- is non-zero: if Infinity or Zero gets this far, then problem occurs.
-- Should catch in normalize.
Normalize (Z, Digit_Minus_1, Digit_Minus_2);
-- Step 4. Handle over and under flow. Here underflow goes to Zero,
-- overflow to Infinity. In order to do it
-- here, must assume that the parmeters Min_Exponent and Max_Exponent
-- limit the dynamic range of the Exp to about 1/4 of that allowed
-- by the base type used to represent the exponent. This is
-- checked in the spec with an assertion. (The reason is, the above
-- code will go well outside the accepted range of Exp with out being
-- checked till down here.) This limit is OK because the base type
-- allows excessively large exponents anyway, up to 2**31-1.
if Z.Exp < Min_Exponent then
Z := Zero;
end if;
if Z.Exp > Max_Exponent then
if Z.Is_Positive then
Z := Positive_Infinity;
else
Z := Negative_Infinity;
end if;
end if;
return Z;
end Multiply_Stnd;
pragma Inline (Multiply_Stnd);
----------
-- Mult --
----------
-- Suppose Z, X, and Y are composed of n digits 0..n-1. Then X*Y is
--
-- Z0 := X0*Y0
-- Z1 := X0*Y1 + X1*Y0
-- Z2 := X0*Y2 + X1*Y1 + X2*Y0
-- ...
-- Zn-1 := X0*Yn-1 + X1*Yn-2 + .. + Xn-1*Y0
--
-- Now follows the upper half of the table, which produces words beyond
-- the precision of the two number X and Y that are being multiplied. These
-- don't calculate. (Just make N larger if more precision is needed).
-- If n is minimal for efficiency reasons, then it would be more efficient
-- in some calculations to make use the following instead of increasing the
-- number of digits to get the required precision.
--
-- Zn := Xn-1*Y1 + ... + X1*Yn-1
-- ...
-- Z2n-2 := Xn-1*Yn-1
--
procedure Mult
(X : in out e_Real;
Y : in e_Real)
is
Digit_Minus_1, Digit_Minus_2 : Digit_Type := Digit_Zero; -- Essential init
Ultimate_No_of_Digits : constant := Ultimate_Digit + 1;
-- equals: Digit_Index'Last - Digit_Index'First + 1 = Mantissa'Length
-------------------------------------
-- Product_if_digits_fewer_than_17 --
-------------------------------------
procedure Product_if_digits_fewer_than_17
is
pragma Assert (Ultimate_No_of_Digits >= 5); --because no if-then's for 1st 5.
pragma Assert (Ultimate_No_of_Digits < 17);
pragma Assert (No_Of_Bits_In_Radix <= 30);
-- (not a) or b is same as a implies b.
-- no need to carry until the end if following evaluate to true:
pragma Assert (not (No_Of_Bits_In_Radix = 30) or Ultimate_No_of_Digits <= 8);
pragma Assert (not (No_Of_Bits_In_Radix = 29) or Ultimate_No_of_Digits <= 32);
pragma Suppress (Index_Check);
A : Mantissa renames X.Digit;
B : Mantissa renames Y.Digit;
S : constant Digit_Index := Digit_Index'First;
--Result : Mantissa;
begin
-- would need to do intermediate carrying if
-- No_Of_Bits_In_Radix >= 30 and Ultimate_No_of_Digits > 5.
-- Ultimate_No_of_Digits is named number, so optimizer should
-- eliminate unused blocks of code below...
-- ! Must be done in the following order !
if Ultimate_No_of_Digits >= 16 then
A (S+15) := A(S+0)*B(S+15) + A(S+1)*B(S+14) + A(S+2)*B(S+13)
+ A(S+3)*B(S+12) + A(S+4)*B(S+11) + A(S+5)*B(S+10)
+ A(S+6)*B(S+9) + A(S+7)*B(S+8) + A(S+8)*B(S+7)
+ A(S+9)*B(S+6) + A(S+10)*B(S+5) + A(S+11)*B(S+4)
+ A(S+12)*B(S+3) + A(S+13)*B(S+2) + A(S+14)*B(S+1)
+ A(S+15)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 15 then
A (S+14) := A(S+0)*B(S+14) + A(S+1)*B(S+13) + A(S+2)*B(S+12)
+ A(S+3)*B(S+11) + A(S+4)*B(S+10) + A(S+5)*B(S+9)
+ A(S+6)*B(S+8) + A(S+7)*B(S+7) + A(S+8)*B(S+6)
+ A(S+9)*B(S+5) + A(S+10)*B(S+4) + A(S+11)*B(S+3)
+ A(S+12)*B(S+2) + A(S+13)*B(S+1) + A(S+14)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 14 then
A (S+13) := A(S+0)*B(S+13) + A(S+1)*B(S+12) + A(S+2)*B(S+11)
+ A(S+3)*B(S+10) + A(S+4)*B(S+9) + A(S+5)*B(S+8)
+ A(S+6)*B(S+7) + A(S+7)*B(S+6) + A(S+8)*B(S+5)
+ A(S+9)*B(S+4) + A(S+10)*B(S+3) + A(S+11)*B(S+2)
+ A(S+12)*B(S+1) + A(S+13)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 13 then
A (S+12) := A(S+0)*B(S+12) + A(S+1)*B(S+11) + A(S+2)*B(S+10)
+ A(S+3)*B(S+9) + A(S+4)*B(S+8) + A(S+5)*B(S+7)
+ A(S+6)*B(S+6) + A(S+7)*B(S+5) + A(S+8)*B(S+4)
+ A(S+9)*B(S+3) + A(S+10)*B(S+2) + A(S+11)*B(S+1)
+ A(S+12)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 12 then
A (S+11) := A(S+0)*B(S+11) + A(S+1)*B(S+10) + A(S+2)*B(S+9)
+ A(S+3)*B(S+8) + A(S+4)*B(S+7) + A(S+5)*B(S+6)
+ A(S+6)*B(S+5) + A(S+7)*B(S+4) + A(S+8)*B(S+3)
+ A(S+9)*B(S+2) + A(S+10)*B(S+1) + A(S+11)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 11 then
A (S+10) := A(S+0)*B(S+10) + A(S+1)*B(S+9) + A(S+2)*B(S+8)
+ A(S+3)*B(S+7) + A(S+4)*B(S+6) + A(S+5)*B(S+5)
+ A(S+6)*B(S+4) + A(S+7)*B(S+3) + A(S+8)*B(S+2)
+ A(S+9)*B(S+1) + A(S+10)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 10 then
A (S+9) := A(S+0)*B(S+9) + A(S+1)*B(S+8) + A(S+2)*B(S+7)
+ A(S+3)*B(S+6) + A(S+4)*B(S+5) + A(S+5)*B(S+4)
+ A(S+6)*B(S+3) + A(S+7)*B(S+2) + A(S+8)*B(S+1)
+ A(S+9)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 9 then
A (S+8) := A(S+0)*B(S+8) + A(S+1)*B(S+7) + A(S+2)*B(S+6)
+ A(S+3)*B(S+5) + A(S+4)*B(S+4) + A(S+5)*B(S+3)
+ A(S+6)*B(S+2) + A(S+7)*B(S+1) + A(S+8)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 8 then
A (S+7) := A(S+0)*B(S+7) + A(S+1)*B(S+6) + A(S+2)*B(S+5)
+ A(S+3)*B(S+4) + A(S+4)*B(S+3) + A(S+5)*B(S+2)
+ A(S+6)*B(S+1) + A(S+7)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 7 then
A (S+6) := A(S+0)*B(S+6) + A(S+1)*B(S+5) + A(S+2)*B(S+4)
+ A(S+3)*B(S+3) + A(S+4)*B(S+2) + A(S+5)*B(S+1)
+ A(S+6)*B(S+0);
end if;
if Ultimate_No_of_Digits >= 6 then
A (S+5) := A(S+0)*B(S+5) + A(S+1)*B(S+4) + A(S+2)*B(S+3)
+ A(S+3)*B(S+2) + A(S+4)*B(S+1) + A(S+5)*B(S+0);
end if;
A (S+4) := A(S+0)*B(S+4) + A(S+1)*B(S+3) + A(S+2)*B(S+2)
+ A(S+3)*B(S+1) + A(S+4)*B(S+0);
A (S+3) := A(S+0)*B(S+3) + A(S+1)*B(S+2) + A(S+2)*B(S+1)
+ A(S+3)*B(S+0);
A (S+2) := A(S+0)*B(S+2) + A(S+1)*B(S+1) + A(S+2)*B(S+0);
A (S+1) := A(S+0)*B(S+1) + A(S+1)*B(S+0);
A (S+0) := A(S+0)*B(S+0);
end Product_if_digits_fewer_than_17;
begin
-- Step 0. Handle the Zeros. We'll say 0 * infinity is 0, since inf is
-- really just a large finite number.
if X.Is_Zero or Y.Is_Zero then
X := Zero;
return;
end if;
-- Step 1. If one or more is infinite..Notice inf * inf = inf here.
if Y.Is_Infinite or X.Is_Infinite then
if X.Is_Positive xor Y.Is_Positive then -- opposite signs.
X := Negative_Infinity;
else
X := Positive_Infinity;
end if;
return;
end if;
-- Step 3. Do the multiplication. We can only sum 32 elements of the sum
-- before the carrys must be done.
-- We use the inner product version (inner loop is an
-- dot-product.) To get the outer product version (BLAS routine DAXPY),
-- interchange the order of the loops.
--
-- Here's the idea:
-- for Digit_ID in Digit_Index loop
-- Sum := 0.0;
-- for k in 0..Digit_ID loop
-- Sum := Sum + X(k) * Y(Digit_ID-k);
-- end loop;
-- Z(Digit_ID) := Sum;
-- end loop;
--
-- Break sum into segments of 32 each in index k. Perform a carry
-- after each sum of 32 elements.
if (Ultimate_No_of_Digits < 9 and then No_Of_Bits_In_Radix <= 30) or
(Ultimate_No_of_Digits < 17 and then No_Of_Bits_In_Radix <= 29) then
-- Notice we only change X here, not above, in case the else is used.
X.Is_Positive := not (X.Is_Positive XOR Y.Is_Positive);
X.Exp := X.Exp + Y.Exp; -- Will be further adjusted by "Normalize.." routine.
Product_if_digits_fewer_than_17;
Do_Carrying_For_Multiplication (X, Digit_Minus_1, Digit_Minus_2);
else
X := General_Multiplication (X, Y);
return;
end if;
Normalize (X, Digit_Minus_1, Digit_Minus_2);
-- Step 4. Handle over and under flow. Here underflow goes to Zero,
-- overflow to Infinity. This analysis is all isolated to the end
-- of the arithmetic routines so that it is more easily modified to
-- raise exceptions if that's what is desired. In order to do it
-- here, must assume that the parmeters Min_Exponent and Max_Exponent
-- limit the dynamic range of the Exp to about 1/4 of that allowed
-- by the base type used to represent the exponent. This is
-- checked in the spec with an assertion. (The reason is, the above
-- code will go well outside the accepted range of Exp with out being
-- checked till down here.) This limit is OK because the base type
-- allows excessively large exponents anyway, up to 2**31-1.
if X.Exp < Min_Exponent then
X := Zero;
end if;
if X.Exp > Max_Exponent then
if X.Is_Positive then
X := Positive_Infinity;
else
X := Negative_Infinity;
end if;
end if;
end Mult;
-----------------------
-- Multiply_In_Place --
-----------------------
function Multiply_In_Place
(X, Y : e_Real)
return e_Real
is
Z : e_Real := X;
begin
Mult (Z, Y);
return Z;
end Multiply_In_Place;
function "*" (X : e_Real; Y : e_Real) return e_Real renames Multiply_In_Place;
--function "*" (X : e_Real; Y : e_Real) return e_Real renames Multiply_stnd;
-- These 2 about the same. Multiply_In_Place calls procedure Mult.
---------
-- "*" --
---------
-- Multiply the first and only digit of X by Y.
function "*"(X : e_Digit;
Y : e_Real) return e_Real is
Z : e_Real;
Digit_Minus_1 : Digit_Type := Digit_Zero; --Essential init
Digit_Minus_2 : constant Digit_Type := Digit_Zero; --Essential init
Carry_Minus_1 : Digit_Type := Digit_Zero; --Essential init
I : Digit_Index;
begin
-- Step 0. Sign etc.
-- Notice this assumes 0 * inf = 0.
if X.Is_Zero or Y.Is_Zero then
return Zero;
end if;
-- Step 1. Infinities. Digit can't be inf.
Z.Is_Positive := not (X.Is_Positive XOR Y.Is_Positive);
if Y.Is_Infinite then
if Z.Is_Positive then
return Positive_Infinity;
else
return Negative_Infinity;
end if;
end if;
Z.Is_Zero := False;
Z.Exp := X.Exp + Y.Exp;
for I in Digit_Index'First .. Digit_Index'Last loop
Z.Digit(I) := X.Digit * Y.Digit(I);
end loop;
-- Step 2. Do the carries. This is simpler than the more general version
-- because you carry at most one digit. (The Max is of Digit*Digit is
-- Radix**2 - 2*Radix + 1. This results in a carry of approx. Radix. Add
-- this the the next higher order digit to get a max of Radix**2 - Radix.
-- So still don't overflow the Range over which a single carry is
-- all that's needed: 0..Radix**2 - 1.)
-- Carry_Minus_2 is always zero, and Digit_Minus_2 is always 0.
for I in reverse Digit_Index'First+1 .. Digit_Index'Last loop
Carry_Minus_1 := Shift_Right_No_of_Bits_in_Radix (Z.Digit(I));
Z.Digit(I) := Z.Digit(I) - Carry_Minus_1 * Digit_Radix;
Z.Digit(I-1) := Z.Digit(I-1) + Carry_Minus_1;
end loop;
-- Special case I = Digit_Index'First = 0
I := 0;
Carry_Minus_1 := Shift_Right_No_of_Bits_in_Radix (Z.Digit(I));
Z.Digit(I) := Z.Digit(I) - Carry_Minus_1 * Digit_Radix;
Digit_Minus_1 := Carry_Minus_1;
-- Step 3. Must Normalize: shift digit array to make sure that the first
-- digit is non-zero.
Normalize (Z, Digit_Minus_1, Digit_Minus_2);
-- Step 4. Handle over and under flow. Here underflow goes to Zero,
-- overflow to Infinity.
if Z.Exp < Min_Exponent then
Z := Zero;
end if;
if Z.Exp > Max_Exponent then
if Z.Is_Positive then
Z := Positive_Infinity;
else
Z := Negative_Infinity;
end if;
end if;
return Z;
end "*";
-------------
-- Scaling --
-------------
-- S'Scaling (X, Exp)
-- Exp
-- Let v be the value X*T'Machine_Radix . If v is a
-- machine number of the type T, or if |v|GT'Model_Small,
-- the function yields v; otherwise, it yields either one
-- of the machine numbers of the type T adjacent to v.
-- Constraint_Error is optionally raised if v is outside
-- the base range of S. A zero result has the sign of X
-- when S'Signed_Zeros is True.
--
function Scaling (X : e_Digit;
Adjustment : e_Integer) return e_Digit is
X2 : e_Digit := X;
begin
if X.Is_Zero then
return X2;
end if;
X2.Exp := X.Exp + Adjustment;
if X2.Exp < Min_Exponent or else X2.Exp > Max_Exponent then
raise Constraint_Error with "Exp out of range in Scaling e_Digit operation.";
end if;
return X2;
end Scaling;
-------------------
-- Make_Extended --
-------------------
-- Turn Digit into Extended:
function Make_Extended (X : e_Digit) return e_Real is
Z : e_Real; -- initialized to Zero. Import.
begin
Z.Digit(0) := X.digit;
Z.Is_Positive := X.Is_Positive;
Z.Exp := X.Exp;
Z.Is_Zero := X.Is_Zero;
Z.Is_Infinite := False;
return Z;
end Make_Extended;
------------
-- Sum_Of --
------------
-- Optimized SUM routine for e_Digit + e_Real -> e_Real.
function Sum_Of (X : e_Digit; Y : e_Real) return e_Real is
Z : e_Real := Y;
Delta_Exp : e_Integer;
New_Digit_1 : Digit_Type := Digit_Zero;
New_Digit_2 : Digit_Type := Digit_Zero;
Need_To_Carry : Boolean := False;
type Max_Info is (X_Is_Max, Y_Is_Max);
Max_Num_ID : Max_Info := X_Is_Max;
begin
-- Step 0. If Either of the numbers is 0.0, then return the other.
if X.Is_Zero then
return Y;
elsif Y.Is_Zero then
return Make_Extended (X);
end if;
-- Step 0b. If X is infinite, it doesn't matter what do.
if Y.Is_Infinite then
return Y;
end if;
-- Step 0c. If one is positive and the other neg., then are lazy.
-- Do it the slow way.
if X.Is_Positive XOR Y.Is_Positive then
return (Y + Make_Extended (X));
end if;
-- Step 1. Now they either both Positive or both Neg. Sum them if it's
-- easy and return with the right sign. Start by finding the larger
-- number, Exponent-wise. *Notice Y.Exp = X.Exp is classified as Y_Is_Max.*
if X.Exp > Y.Exp then
Max_Num_ID := X_Is_Max;
else
Max_Num_ID := Y_Is_Max;
end if;
Delta_Exp := Abs (X.Exp - Y.Exp);
if Delta_Exp > e_Integer(Digit_Index'Last) then -- ie, Delta_Exp >= No_Of_Digits
case Max_Num_ID is
when Y_Is_Max =>
return Y;
when X_Is_Max =>
return Make_Extended (X);
end case;
end if;
-- Step 2. If the digit X has the smaller exponent, then try
-- an optimization. Otherwise just use the full scale "+".
-- We verified above that Delta_Exp is in range of index of X.Digit.
-- The optimization covers the most common case by far in the "/" routine
-- and most other uses of this function: Y > X, and same sign.
-- We allow at most one carry..if more are required, give up trying.
if Max_Num_ID = Y_Is_Max then
New_Digit_1 := X.digit + Y.Digit(Delta_Exp);
if New_Digit_1 > Digit_Radix_Minus_1 then
Need_To_Carry := True;
end if;
if Need_To_Carry and then (Delta_Exp = 0) then -- would have to normalize.
goto Abort_Optimization;
end if;
if Need_To_Carry then
New_Digit_1 := New_Digit_1 - Digit_Radix;
New_Digit_2 := Y.Digit(Delta_Exp-1) + Digit_One; -- Carry.
if New_Digit_2 > Digit_Radix_Minus_1 then -- give up trying.
goto Abort_Optimization;
end if;
end if;
-- If got this far, then are going through with it.
-- just change the 1 or 2 digits of X, call it Z, and return it:
-- Z := Y;
-- Z is initialized to Y:
Z.Digit(Delta_Exp) := New_Digit_1;
if Need_To_Carry then
Z.Digit(Delta_Exp-1) := New_Digit_2;
end if;
-- Recall that X and Y have same sign. This must be the
-- sign of Z. OK, the Z := Y establishes this.
return Z;
end if;
<<Abort_Optimization>>
-- Step 3. If got this far, the optimization failed. Do it the
-- slow way.
return (Y + Make_Extended (X));
end Sum_Of;
---------
-- "/" --
---------
-- Calculate Quotient = X / Y.
-- Schoolboy algorithm. Not fast. Get Quotient a digit at a time.
-- Estimate trial Next_Digit by dividing first few digits of X by first few
-- digits of Y. Make this ratio into the proper range for a digit.
-- Multiply this Next_Digit by Y to get Product. (This step is why do it
-- a digit at a time. The above multiplication by Y can be highly optimized
-- then.) Subtract Product from X to get Remainder. Increment Quotient
-- by Next_Digit. Repeat the above steps with X replaced by Remainder.
-- Continue until Remainder has an exponent so small that subsequent
-- Next_Digit's are too small to contribute to Quotient.
--
-- Few remarks: Next_Digit may not really be the next digit in Quotient.
-- It should usually be, but sometimes it's too small, and very rarely, it's
-- too large. Nevertheless, you increment Quotient by Next_Digit and
-- converge on the answer. Also, when Next_Digit is too large, Remainder
-- becomes negative, and one *subtracts* the next Next_Digit from quotient,
-- and *adds* the next Product to Remainder, and continues doing this as
-- long as Remainder is negative. In other words can converge on the
-- quotient from either above or below. So are calculating each
-- iteration another pseudo-digit, DigitJ, such that, for example.
--
-- Y * (Digit0 + Digit1 + Digit3 - Digit4 + Digit5 ...) = X,
--
-- Add up the digits to get the approximation of X / Y.
-- Some are negative (rare), some positive, but they add up to Quotient.
-- More precisely,
--
-- X - Y * (Digit0 + Digit1 + Digit3 - Digit4 + Digit5 ...) = Remainder,
--
-- where X.Exp - Remainder.Exp > Digit_Index'Last. Further
-- Digits contribute negligably to Quotient when this inequality holds.
-- For example, if there are 2 digits, then Digit_Index'Lasts = 1, so that if
-- X.Exp - Remainder.Exp > Digit_Index'Last = 1 then the difference in
-- exponents guarantees that subsequent iterations contribute to digits
-- beyond Digit_Index'Last in the Quotient.
function "/" (X, Y : e_Real)
return e_Real
is
Delta_Remainder : e_Real;
Remainder_Of_X : e_Real := X; -- init important.
Quotient : e_Real; -- Initialized to zero (important).
Next_Digit : e_Digit; -- Initialized to zero (important).
Next_Digit_Val : Digit_Type;
Real_Next_Digit_Val : Real;
Real_Y, Inverse_Real_Y, Real_Remainder_Of_X : Real;
Decrement_Digit_Exp : Boolean := False;
Count : e_Integer := 0;
Max_Allowed_Iterations : constant e_Integer := Digit_Index'Last * 2;
begin
-- Step 0. Handle Zeros and Infinities. Do signs at very end. Until
-- the very end pretend that Quotient is positive.
if Y.Is_Zero then
raise Constraint_Error with "Division by zero.";
end if;
if X.Is_Zero then
return Zero;
end if;
if X.Is_Infinite and Y.Is_Infinite then
raise Constraint_Error with "Division of inf by inf is undefined.";
end if;
if X.Is_Infinite then
if (X.Is_Positive xor Y.Is_Positive) then
return Negative_Infinity;
else
return Positive_Infinity;
end if;
end if;
if Y.Is_Infinite and (not X.Is_Infinite) then
return Zero;
end if;
-- Step 1. We initialized Remainder_Of_X to X. Below make it positive,
-- and assume all quantities are positive. Signs are set at end.
-- Inverse_Real_Y is in range [1.0/(Radix-Eps) .. 1.0].
-- Real_Remainder_Of_X is in range [1.0 .. (Radix-Eps)].
-- Next_Digit is Real_Floor (Real_Remainder_Of_X*Inverse_Real_Y) where
-- the product has been multiplied by Radix if it's less than 1.0.
-- Possible range of Next_Digit: Max is Floor (Radix-eps / 1.0), which
-- is Radix-1. Min is Floor (Radix * (1.0 / (Radix-eps))) = 1.0.
Real_Y := Real (Y.Digit(0))
+ Real (Y.Digit(1)) * Inverse_Radix
+ Real (Y.Digit(2)) * Inverse_Radix_Squared;
Inverse_Real_Y := Real_One / Real_Y;
-- Pretend all quantities are positive till end.
Quotient.Is_Positive := True;
Remainder_Of_X.Is_Positive := True; -- This may go negative.
-- Iterate until the remainder is small enough:
Iteration: for Iter in e_Integer range 1..Max_Allowed_Iterations loop
-- Initialized to X, so it's not zero. Must lead with a nonzero digit.
-- Important here to sum ALL three leading digits of Remainder_Of_X.
Real_Remainder_Of_X := Real (Remainder_Of_X.Digit(0))
+ Real (Remainder_Of_X.Digit(1))*Inverse_Radix
+ Real (Remainder_Of_X.Digit(2))*Inverse_Radix_Squared;
Real_Next_Digit_Val := Real_Remainder_Of_X * Inverse_Real_Y;
-- Need Next_Digit in proper range for Mult_For_Div fctn: 1..Radix-1:
Decrement_Digit_Exp := False;
if Real_Next_Digit_Val < Real_One then
Real_Next_Digit_Val := Real_Next_Digit_Val * Real_Radix;
Decrement_Digit_Exp := True;
end if;
Next_Digit_Val := Digit_Floor (Real_Next_Digit_Val);
if Next_Digit_Val > Digit_Radix_Minus_1 then
Next_Digit_Val := Digit_Radix_Minus_1;
end if;
--if Next_Digit_Val < Digit_One then -- Should never happen, but test it.
-- Next_Digit_Val := Digit_One;
--end if;
-- Step 2. We now have Next_Digit, which is approx. Remainder_Of_X / Y.
-- We are ready to make Next_Digit an e_Digit number.
-- (so "*" can be optimized.) It must be in
-- the range 1..Radix-1, so truncate first. It has the exponent of
-- the Remainder_Of_X.Exp - Y.Exp, but decremented by 1.0 if multiplied
-- Next_Digit by Radix above.
-- Below remember that Next_Digit was initialized to Zero above,
-- and all that is changed in this loop is the digit value, and the Exp.
-- Also want the product of Next_Digit and Y to be >0, regardless of Y.
-- The conversion from Real to e_Digit could be done by the
-- function Make_e_Digit, but lets optimize:
Next_Digit.Digit := Next_Digit_val;
Next_Digit.Exp := Remainder_Of_X.Exp - Y.Exp;
Next_Digit.Is_Zero := False;
Next_Digit.Is_Positive := True;
if Decrement_Digit_Exp then
Next_Digit.Exp := Next_Digit.Exp - 1;
end if;
-- Step 3. Make the trial product of the next digit with the divisor..
-- this will be subtracted from the remainder.
Delta_Remainder := Next_Digit * Y;
Delta_Remainder.Is_Positive := True;
-- Step 3. Calculate the new "Quotient" and the new "Remainder_Of_X".
-- Add Extended_Next_Digit to Quotient, if Old Remainder was > 0.
-- Subtract Extended_Next_Digit from Quotient if Old Remainder was < 0.
-- If the Old Remainder = 0 then are done; that was checked on
-- previous pass of loop by line below. It was checked initially by
-- by checking if X = 0. (Remainder was initialized to X, and then made
-- positive).
if Remainder_Of_X.Is_Positive then
-- Add Next_Digit to Quotient, and subtract Delta_Remainder from Remainder.
Delta_Remainder.Is_Positive := False;
Next_Digit.Is_Positive := True;
else
-- Subtract Next_Digit from Quotient, and add Delta_Remainder to Remainder.
Delta_Remainder.Is_Positive := True;
Next_Digit.Is_Positive := False;
end if;
Remainder_Of_X := Remainder_Of_X + Delta_Remainder;
Quotient := Sum_Of (Next_Digit, Quotient);
-- Step 4. Are finished?
-- Remainder_Of_X.Exp started at X.Exp. Have made it small enough?
-- Remember that the calls above may have returned Infinity. Or if they
-- returned Zero, then the Exponent is 0. (None of these should happen tho.)
if Remainder_Of_X.Is_Zero then exit Iteration; end if;
if Remainder_Of_X.Is_Infinite then exit Iteration; end if;
if (X.Exp-Remainder_Of_X.Exp) > Digit_Index'Last then exit Iteration; end if;
Count := Iter;
end loop Iteration;
-- Max_Allowed_Iterations is twice the number usually required. I've
-- never seen it happen, but just in case:
if Count = Max_Allowed_Iterations then -- Should raise error?
raise Program_Error with "Convergence problem in division routine.";
end if;
--Print_Text (Integer'Image(Count));
--Print_Text (" Iterations.");
--text_io.new_line;
-- Step 5. Set Sign of Quotient. Handle over and under flow.
-- Here underflow goes to Zero, overflow to Infinity.
-- We can do this here because allowed room to maneuver in range of Exp.
Quotient.Is_Positive := not (X.Is_Positive xor Y.Is_Positive);
if Quotient.Exp < Min_Exponent then
Quotient := Zero;
end if;
if Quotient.Exp > Max_Exponent then
if Quotient.Is_Positive then
Quotient := Positive_Infinity;
else
Quotient := Negative_Infinity;
end if;
end if;
return Quotient;
end "/";
---------
-- "*" --
---------
-- Multiply the first and only digit of X by the first and only digit
-- of Y. the reduction in Carrying is the big win here.
function "*"(X : e_Digit;
Y : e_Digit) return e_Real is
Z : e_Real; -- Init important.
Digit_Minus_1 : Digit_Type := Digit_Zero; -- Init important.
Digit_Minus_2 : constant Digit_Type := Digit_Zero; -- Init important.
Carry_Minus_1 : Digit_Type := Digit_Zero; -- Init important.
I : Digit_Index;
begin
-- Step 0. Zeros.
if X.Is_Zero or Y.Is_Zero then
return Zero;
end if;
Z.Is_Zero := False;
-- Step 1. Sign and Infinities. Digits can't be inf.
Z.Is_Positive := not (X.Is_Positive XOR Y.Is_Positive);
Z.Exp := X.Exp + Y.Exp;
Z.Digit(0) := X.Digit * Y.Digit;
-- Step 2. Do the carries. This is simpler than the more general version
-- because you carry at most one digit. (The Max is of Digit*Digit is
-- Radix**2 - 2*Radix + 1. This results in a carry of approx. Radix. Add
-- this the the next higher order digit to get a max of Radix**2 - Radix.
-- So still don't overflow the Range over which a single carry is
-- all that's needed: 0..Radix**2 - 1.)
-- Carry_Minus_2 is always zero, and Digit_Minus_2 is always 0.
I := 0;
Carry_Minus_1 := Shift_Right_No_of_Bits_in_Radix (Z.Digit(I));
Z.Digit(I) := Z.Digit(I) - Carry_Minus_1 * Digit_Radix;
Digit_Minus_1 := Carry_Minus_1;
-- Step 3. Must Normalize: shift digit array to make sure that the first
-- digit is non-zero.
Normalize (Z, Digit_Minus_1, Digit_Minus_2);
-- Step 4. Handle over and under flow. Here underflow goes to Zero,
-- overflow to Infinity.
if Z.Exp < Min_Exponent then
Z := Zero;
end if;
if Z.Exp > Max_Exponent then
if Z.Is_Positive then
Z := Positive_Infinity;
else
Z := Negative_Infinity;
end if;
end if;
return Z;
end "*";
---------
-- "/" --
---------
-- The only difference between this "/" and the general "/" is that
-- the (e_Digit * e_Real) operation has been replaced
-- with an (e_Digit * e_Digit) operation. This produces
-- big savings in time. This is used in elementary math function
-- routines, where the efficiency is important.
function "/" (X : e_Real; Y : e_Digit) return e_Real is
Delta_Remainder : e_Real;
Remainder_Of_X : e_Real := X; -- init important.
Quotient : e_Real; -- Initialized to zero (important).
Next_Digit : e_Digit; -- Initialized to zero (important).
Real_Next_Digit_Val : Real;
Next_Digit_Val : Digit_Type;
Real_Y, Inverse_Real_Y, Real_Remainder_Of_X : Real;
Decrement_Digit_Exp : Boolean := False;
Count : e_Integer := 0;
Max_Allowed_Iterations : constant e_Integer := Digit_Index'Last * 2;
begin
-- Step 0. Handle Zeros and Infinities. Do signs at very end. Until
-- the very end pretend that Quotient is positive.
if Y.Is_Zero then
raise Constraint_Error with "Division by zero.";
end if;
if X.Is_Zero then
return Zero;
end if;
if X.Is_Infinite then
if (X.Is_Positive xor Y.Is_Positive) then
return Negative_Infinity;
else
return Positive_Infinity;
end if;
end if;
-- Step 1. We initialized Remainder_Of_X to X. Below make it positive,
-- and assume all quantities are positive. Signs are set at end.
-- Possible range of Next_Digit: Max is Floor (Radix-eps / 1.0), which
-- is Radix-1. Min is Floor (Radix * (1.0 / (Radix-eps))) = 1.0.
-- Remember, X and Y are normalized and we've tested for 0's, so
-- both are in the range 1..Radix-1.
Real_Y := Real (Y.Digit); -- >= 1.0, since it's quantized.
Inverse_Real_Y := Real_One / Real_Y;
-- Pretend all quantities are positive till end.
Quotient.Is_Positive := True;
Remainder_Of_X.Is_Positive := True; -- This may go negative.
-- Iterate until the remainder is small enough.
Iteration: for Iter in e_Integer range 1..Max_Allowed_Iterations loop
Real_Remainder_Of_X :=
Real (Remainder_Of_X.Digit(0))
+ Real (Remainder_Of_X.Digit(1))*Inverse_Radix
+ Real (Remainder_Of_X.Digit(1))*Inverse_Radix_Squared;
Real_Next_Digit_Val := Real_Remainder_Of_X * Inverse_Real_Y;
-- Need Next_Digit in proper range for Mult_For_Div fctn: 1..Radix-1:
Decrement_Digit_Exp := False;
if Real_Next_Digit_Val < Real_One then
Real_Next_Digit_Val := Real_Next_Digit_Val * Real_Radix;
Decrement_Digit_Exp := True;
end if;
Next_Digit_Val := Digit_Floor (Real_Next_Digit_Val);
if Next_Digit_Val > Digit_Radix_Minus_1 then
Next_Digit_Val := Digit_Radix_Minus_1;
end if;
--if Next_Digit_Val < Digit_One then -- Should never happen. Perform tests w/o
-- Next_Digit_Val := Digit_One;
--end if;
-- Step 2. We now have Next_Digit, which is approx. Remainder_Of_X / Y.
-- We are ready to make Next_Digit an e_Digit number.
-- (so "*" can be optimized.) It must be in
-- the range 1..Radix-1, so truncate first. It has the exponent of
-- the Remainder_Of_X.Exp - Y.Exp, but decremented by 1.0 if multiplied
-- Next_Digit by Radix above.
-- Below remember that Next_Digit was initialized to Zero above,
-- and all that is changed in this loop is the digit value, and the Exp.
-- Also want the product of Next_Digit and Y to be >0, regardless of Y.
-- The conversion from Real to e_Digit could be done by the
-- function Make_e_Digit, but lets optimize:
Next_Digit.Digit := Next_Digit_Val;
Next_Digit.Exp := Remainder_Of_X.Exp - Y.Exp;
Next_Digit.Is_Zero := False; -- Is this always true?
Next_Digit.Is_Positive := True;
if Decrement_Digit_Exp then
Next_Digit.Exp := Next_Digit.Exp - 1;
end if;
-- Step 3. Make the trial product of the next digit with the divisor..
-- this will be subtracted from the remainder.
Delta_Remainder := Next_Digit * Y;
Delta_Remainder.Is_Positive := True;
-- Step 3. Calculate the new "Quotient" and the new "Remainder_Of_X".
-- Add Extended_Next_Digit to Quotient, if Old Remainder was > 0.
-- Subtract Extended_Next_Digit from Quotient if Old Remainder was < 0.
-- If the Old Remainder = 0 then are done; that was checked on
-- previous pass of loop by line below. It was checked initially by
-- by checking if X = 0. (Remainder was initialized to X, and then made
-- positive).
if Remainder_Of_X.Is_Positive then
-- Add Next_Digit to Quotient, and
-- subtract Delta_Remainder from Remainder.
Delta_Remainder.Is_Positive := False;
Next_Digit.Is_Positive := True;
else
-- Subtract Next_Digit from Quotient, and
-- add Delta_Remainder to Remainder.
Delta_Remainder.Is_Positive := True;
Next_Digit.Is_Positive := False;
end if;
Remainder_Of_X := Remainder_Of_X + Delta_Remainder;
Quotient := Sum_Of (Next_Digit, Quotient);
-- Step 4. Are finished?
-- Remainder_Of_X.Exp started at X.Exp. Have made it small enough?
-- Remember that the calls above may have returned Infinity. Or if they
-- returned Zero, then the Exponent is 0. (None of these should happen tho.)
if Remainder_Of_X.Is_Zero then exit Iteration; end if;
if Remainder_Of_X.Is_Infinite then exit Iteration; end if;
if (X.Exp-Remainder_Of_X.Exp) > Digit_Index'Last then exit Iteration; end if;
Count := Iter;
end loop Iteration;
-- Max_Allowed_Iterations is twice the number usually required. I've
-- never seen it happen, but just in case:
if Count = Max_Allowed_Iterations then -- Should raise error?
raise Program_Error with "Convergence problem in division routine.";
end if;
--Print_Text (Integer'Image(Count));
--Print_Text (" Iterations.");
--text_io.new_line;
-- Step 4. Set Sign of Quotient. Handle over and under flow.
-- Here underflow goes to Zero, overflow to Infinity.
Quotient.Is_Positive := not (X.Is_Positive xor Y.Is_Positive);
if Quotient.Exp < Min_Exponent then
Quotient := Zero;
end if;
if Quotient.Exp > Max_Exponent then
if Quotient.Is_Positive then
Quotient := Positive_Infinity;
else
Quotient := Negative_Infinity;
end if;
end if;
return Quotient;
end "/";
----------
-- "**" --
----------
-- Standard algorithm. Write N in binary form:
--
-- N = 2**m0 + 2**m1 + 2**m2 + ... + 2**mn,
--
-- where the m0, m1, m2...are the indices of the nonzero binary digits of N.
-- Then
--
-- X**N = X**(2**m0) * X**(2**m1) * X**(2**m2) * ... * X**(2**mn).
--
-- We have written X as product of Powers of X.
-- Powers of X are obtained by squaring X, squaring the square of X,
-- etc.
--
-- 0.0**0 is defined to be 1.0. Anything to the 0 is defined to be 1.
--
function "**"
(X : e_Real;
N : Integer)
return e_Real
is
Power_Of_X, Product : e_Real;
Last_Bit_ID : constant Integer := Integer'Size - 2;
subtype Bit_Index is Integer range 0..Last_Bit_ID;
type Bit_Array is array(Bit_Index) of Integer;
Bit : Bit_Array := (others => 0);
Exp : Integer := Abs (N);
Final_Bit : Bit_Index;
Exp_Is_Even : Boolean;
begin
-- The following seems to be what the lrm implies, even if X=0.0:
-- If the exponent N is zero then return 1. (If X is inf this makes
-- sense since inf is really just a large finite number.)
if N = 0 then
return One;
end if;
-- Next, if the argument X is zero, set the result to zero.
-- If the Exponent is negative then raise constraint error.
if X.Is_Zero then
if N > 0 then
return Zero;
else
raise Constraint_Error with "Error in ** operation, division by 0.0.";
end if;
end if;
-- If the argument X is inf, set the result to inf, or 0 if N < 0.
-- If X < 0 then sign depends on whether Exp is even or odd.
-- (IS THIS TRUE if N=0? Will assume NO.)
if X.Is_Infinite then
Exp_Is_Even := ((Exp rem 2) = 0);
if X.Is_Positive then
Product := Positive_Infinity;
else
if Exp_Is_Even then
Product := Positive_Infinity;
else
Product := Negative_Infinity;
end if;
end if;
if N < 0 then
return Zero;
else
return Product;
end if;
end if;
-- Should try to avoid possible run-time errors (if, for example,
-- N * X.Exp > Max_Exponent)? No: the following
-- algorithm uses extended precision "*", which will overflow to
-- inf and short-circuit the process efficiently.
--
-- Get binary form of the exponent Exp = Abs(N)
for I in Bit_Index loop
Bit(I) := Exp REM 2;
Exp := Exp / 2;
Final_Bit := I;
if Exp = 0 then
exit;
end if;
end loop;
-- Do the arithmetic.
Product := One; -- X**0
Power_Of_X := X; -- X**(2**0). Preserves sign of X if N is odd.
if Bit(Bit_Index'First) /= 0 then
--Product := Product * Power_Of_X;
Mult (Product, Power_Of_X);
end if;
for I in Bit_Index'First+1 .. Final_Bit loop
--Power_Of_X := Power_Of_X * Power_Of_X; -- X**(2**I)
Square (Power_Of_X); -- X**(2**I), good speed-up
if Bit(I) = 1 then
--Product := Product * Power_Of_X;
Mult (Product, Power_Of_X);
end if;
end loop;
-- Under flow to zero. THe "/" operator should correctly do this, but
-- it's important to other routines, so make sure it's done right here:
if Product.Is_Infinite and N < 0 then
return Zero;
end if;
if N < 0 then
Product := One / Product; -- notice we've already checked for X=0.
end if;
-- need to do the final over/under flow check? No. The "/" and
-- "*" did that for us above.
return Product;
end "**";
end Extended_Real;
|
generic
n: Integer;
package Data is
---Declaration of private types
type Vector is private;
type Matrix is private;
--Calculation function 1
function Func1 (A, B, C: in Vector; MA, ME : in Matrix) return Integer;
--Calculation function 2
function Func2 (MF, MG, MH, ML: in Matrix) return Integer;
--Calculation function 3
function Func3 (A, B, C: in Vector; MB, MM : in Matrix) return Integer;
--Filling matrix with ones
procedure Matrix_Filling_Ones(A: out Matrix);
--Filling vector with ones
procedure Vector_Filling_Ones (A: out vector);
--Determination private types
private
type Vector is array (1..n) of Integer;
type Matrix is array (1..n) of Vector;
end Data;
|
-- { dg-options "-gnatws" }
package body G_Tables is
function Create (L : Natural) return Table is
begin
return T : Table (1 .. L);
end Create;
end G_Tables;
|
with Ada.Containers.Doubly_Linked_Lists; use Ada.Containers;
with Ada.Text_IO; use Ada.Text_IO;
procedure Day09 is
package Natural_Lists is new Doubly_Linked_Lists (Element_Type => Natural);
procedure Move_Cursor
(List : in Natural_Lists.List;
Pos : in out Natural_Lists.Cursor;
Steps : in Integer)
is
function "=" (X, Y : Natural_Lists.Cursor) return Boolean
renames Natural_Lists."=";
Remaining_Steps : Integer := Steps;
begin
while Remaining_Steps /= 0 loop
if Remaining_Steps > 0 then
if Pos = List.Last then
Pos := List.First;
else
Pos := Natural_Lists.Next (Pos);
end if;
Remaining_Steps := Remaining_Steps - 1;
else
if Pos = List.First then
Pos := List.Last;
else
Pos := Natural_Lists.Previous (Pos);
end if;
Remaining_Steps := Remaining_Steps + 1;
end if;
end loop;
end Move_Cursor;
-- Input
Player_Count : constant Positive := 452;
Last_Marble_Points : constant Natural := 71250;
type Big_Natural is range 0 .. (2**63 - 1);
Max_Score : Big_Natural := 0;
Marble_Circle : Natural_Lists.List;
Scores : array (Positive range 1 .. Player_Count) of Big_Natural :=
(others => 0);
begin
Marble_Circle.Append (0);
declare
Current_Player : Positive := 1;
Current_Pos : Natural_Lists.Cursor := Marble_Circle.First;
begin
for Marble in 1 .. (Last_Marble_Points * 100) loop
if Marble mod 23 = 0 then
Scores (Current_Player) :=
Scores (Current_Player) + Big_Natural (Marble);
Move_Cursor (Marble_Circle, Current_Pos, -7);
Scores (Current_Player) :=
Scores (Current_Player) +
Big_Natural (Natural_Lists.Element (Current_Pos));
declare
To_Delete : Natural_Lists.Cursor := Current_Pos;
begin
Move_Cursor (Marble_Circle, Current_Pos, 1);
Marble_Circle.Delete (To_Delete);
end;
if Scores (Current_Player) > Max_Score then
Max_Score := Scores (Current_Player);
end if;
else
Move_Cursor (Marble_Circle, Current_Pos, 2);
Marble_Circle.Insert
(Before => Current_Pos,
New_Item => Marble,
Position => Current_Pos);
end if;
Current_Player := (Current_Player mod Player_Count) + 1;
if Marble = Last_Marble_Points then
Put_Line ("Part 1 =" & Big_Natural'Image (Max_Score));
end if;
end loop;
end;
Put_Line ("Part 2 =" & Big_Natural'Image (Max_Score));
end Day09;
|
-- Entrées/Sorties sur les entiers.
-- Remarque : on refait, de manière simplifiée, le Put et le Get de
-- Integer_Text_IO.
package Integer_IO is
-- Afficher un entier naturel sur la sortie standard.
procedure Afficher (N : in Integer) with
Pre => N >= 0;
-- Saisir un entier naturel au clavier. Sa valeur est mise dans N.
-- Il peut y avoir des caractères blancs (ignorés) devant l'entier.
-- N vaut -1 si les caractères de l'entrée ne correspondent pas à un entier.
procedure Saisir (N : out Integer) with
Post => N = -1 or else N >= 0;
end Integer_IO;
|
package body Matrix_Scalar is
function Func(Left: Matrix; Right: Num) return Matrix is
Result: Matrix;
begin
for R in Rows loop
for C in Cols loop
Result(R,C) := F(Left(R,C), Right);
end loop;
end loop;
return Result;
end Func;
function Image(M: Matrix) return String is
function Img(R: Rows) return String is
function I(C: Cols) return String is
S: String := Image(M(R,C));
L: Positive := S'First;
begin
while S(L) = ' ' loop
L := L + 1;
end loop;
if C=Cols'Last then
return S(L .. S'Last);
else
return S(L .. S'Last) & "," & I(Cols'Succ(C));
end if;
end I;
Column: String := I(Cols'First);
begin
if R=Rows'Last then
return "(" & Column & ")";
else
return "(" & Column & ")," & Img(Rows'Succ(R));
end if;
end Img;
begin
return("(" & Img(Rows'First) & ")");
end Image;
end Matrix_Scalar;
|
-----------------------------------------------------------------------
-- util-xunit - Unit tests on top of AUnit
-- Copyright (C) 2009, 2010, 2011 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with AUnit;
with AUnit.Simple_Test_Cases;
with AUnit.Test_Suites;
with AUnit.Test_Fixtures;
with Ada.Strings.Unbounded;
with GNAT.Source_Info;
-- The <b>Util.XUnit</b> package exposes a common package definition used by the Ada testutil
-- library. It is intended to hide the details of the AUnit implementation.
-- A quite identical package exist for Ahven implementation.
package Util.XUnit is
use Ada.Strings.Unbounded;
use AUnit.Test_Suites;
subtype Status is AUnit.Status;
Success : constant Status := AUnit.Success;
Failure : constant Status := AUnit.Failure;
subtype Message_String is AUnit.Message_String;
subtype Test_Suite is AUnit.Test_Suites.Test_Suite;
subtype Access_Test_Suite is AUnit.Test_Suites.Access_Test_Suite;
function Format (S : in String) return Message_String renames AUnit.Format;
type Test_Case is abstract new AUnit.Simple_Test_Cases.Test_Case with null record;
-- maybe_overriding
procedure Assert (T : in Test_Case;
Condition : in Boolean;
Message : in String := "Test failed";
Source : in String := GNAT.Source_Info.File;
Line : in Natural := GNAT.Source_Info.Line);
type Test is abstract new AUnit.Test_Fixtures.Test_Fixture with null record;
-- maybe_overriding
procedure Assert (T : in Test;
Condition : in Boolean;
Message : in String := "Test failed";
Source : in String := GNAT.Source_Info.File;
Line : in Natural := GNAT.Source_Info.Line);
-- The main testsuite program. This launches the tests, collects the
-- results, create performance logs and set the program exit status
-- according to the testsuite execution status.
generic
with function Suite return Access_Test_Suite;
procedure Harness (Output : in Ada.Strings.Unbounded.Unbounded_String;
XML : in Boolean;
Result : out Status);
end Util.XUnit;
|
-----------------------------------------------------------------------
-- components-core-views -- ASF View Components
-- Copyright (C) 2009, 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 Util.Beans.Objects;
with Util.Locales;
with ASF.Events.Faces;
with ASF.Lifecycles;
with ASF.Components.Html.Forms;
with ASF.Components.Core;
with ASF.Views.Nodes;
private with Ada.Containers.Vectors;
package ASF.Components.Core.Views is
-- Name of the facet that holds the metadata information
-- (we use the same name as JSF 2 specification).
METADATA_FACET_NAME : constant String := "javax_faces_metadata";
-- ------------------------------
-- View component
-- ------------------------------
type UIView is new Core.UIComponentBase with private;
type UIView_Access is access all UIView'Class;
-- Get the content type returned by the view.
function Get_Content_Type (UI : in UIView;
Context : in Faces_Context'Class) return String;
-- Set the content type returned by the view.
procedure Set_Content_Type (UI : in out UIView;
Value : in String);
-- Get the locale to be used when rendering messages in the view.
-- If a locale was set explicitly, return it.
-- If the view component defines a <b>locale</b> attribute, evaluate and return its value.
-- If the locale is empty, calculate the locale by using the request context and the view
-- handler.
function Get_Locale (UI : in UIView;
Context : in Faces_Context'Class) return Util.Locales.Locale;
-- Set the locale to be used when rendering messages in the view.
procedure Set_Locale (UI : in out UIView;
Locale : in Util.Locales.Locale);
-- Encode the begining of the view. Set the response content type.
overriding
procedure Encode_Begin (UI : in UIView;
Context : in out Faces_Context'Class);
-- Encode the end of the view.
overriding
procedure Encode_End (UI : in UIView;
Context : in out Faces_Context'Class);
-- Decode any new state of the specified component from the request contained
-- in the specified context and store that state on the component.
--
-- During decoding, events may be enqueued for later processing
-- (by event listeners that have registered an interest), by calling
-- the <b>Queue_Event</b> on the associated component.
overriding
procedure Process_Decodes (UI : in out UIView;
Context : in out Faces_Context'Class);
-- Perform the component tree processing required by the <b>Process Validations</b>
-- phase of the request processing lifecycle for all facets of this component,
-- all children of this component, and this component itself, as follows:
-- <ul>
-- <li>If this component <b>rendered</b> property is false, skip further processing.
-- <li>Call the <b>Process_Validators</b> of all facets and children.
-- <ul>
overriding
procedure Process_Validators (UI : in out UIView;
Context : in out Faces_Context'Class);
-- Perform the component tree processing required by the <b>Update Model Values</b>
-- phase of the request processing lifecycle for all facets of this component,
-- all children of this component, and this component itself, as follows.
-- <ul>
-- <li>If this component <b>rendered</b> property is false, skip further processing.
-- <li>Call the <b>Process_Updates/b> of all facets and children.
-- <ul>
overriding
procedure Process_Updates (UI : in out UIView;
Context : in out Faces_Context'Class);
-- Broadcast any events that have been queued for the <b>Invoke Application</b>
-- phase of the request processing lifecycle and to clear out any events
-- for later phases if the event processing for this phase caused
-- <b>renderResponse</b> or <b>responseComplete</b> to be called.
procedure Process_Application (UI : in out UIView;
Context : in out Faces_Context'Class);
-- Queue an event for broadcast at the end of the current request
-- processing lifecycle phase. The event object
-- will be freed after being dispatched.
procedure Queue_Event (UI : in out UIView;
Event : not null access ASF.Events.Faces.Faces_Event'Class);
-- Broadcast the events after the specified lifecycle phase.
-- Events that were queued will be freed.
procedure Broadcast (UI : in out UIView;
Phase : in ASF.Lifecycles.Phase_Type;
Context : in out Faces_Context'Class);
-- Clear the events that were queued.
procedure Clear_Events (UI : in out UIView);
-- Set the component tree that must be rendered before this view.
-- This is an internal method used by Steal_Root_Component exclusively.
procedure Set_Before_View (UI : in out UIView'Class;
Tree : in Base.UIComponent_Access);
-- Set the component tree that must be rendered after this view.
-- This is an internal method used by Steal_Root_Component exclusively.
procedure Set_After_View (UI : in out UIView'Class;
Tree : in Base.UIComponent_Access);
-- Finalize the object.
overriding
procedure Finalize (UI : in out UIView);
-- ------------------------------
-- View Parameter Component
-- ------------------------------
-- The <b>UIViewParameter</b> component represents a request parameter that must be mapped
-- to a backed bean object. This component does not participate in the rendering.
type UIViewParameter is new Html.Forms.UIInput with private;
type UIViewParameter_Access is access all UIViewParameter'Class;
-- Get the input parameter from the submitted context. This operation is called by
-- <tt>Process_Decodes</tt> to retrieve the request parameter associated with the component.
overriding
function Get_Parameter (UI : in UIViewParameter;
Context : in Faces_Context'Class) return String;
-- ------------------------------
-- View Action Component
-- ------------------------------
-- The <b>UIViewAction</b> component implements the view action tag defined by Jave Server
-- Faces 2.2. This action defined by that tag will be called
type UIViewAction is new Html.Forms.UICommand with private;
type UIViewAction_Access is access all UIViewAction'Class;
-- Decode the request and prepare for the execution for the view action.
overriding
procedure Process_Decodes (UI : in out UIViewAction;
Context : in out Faces_Context'Class);
-- ------------------------------
-- View Metadata Component
-- ------------------------------
-- The <b>UIViewMetaData</b> component defines the view meta data components.
-- These components defines how to handle some request parameters for a GET request
-- as well as some actions that must be made upon reception of a request.
--
-- From ASF lifecycle management, if the request is a GET, this component is used
-- as the root of the component tree. The APPLY_REQUESTS .. INVOKE_APPLICATION actions
-- are called on that component tree. It is also used for the RENDER_RESPONSE, and
-- we have to propagate the rendering on the real view root. Therefore, the Encode_XXX
-- operations are overriden to propagate on the real root.
type UIViewMetaData is new UIView with private;
type UIViewMetaData_Access is access all UIViewMetaData'Class;
-- Start encoding the UIComponent.
overriding
procedure Encode_Begin (UI : in UIViewMetaData;
Context : in out Faces_Context'Class);
-- Encode the children of this component.
overriding
procedure Encode_Children (UI : in UIViewMetaData;
Context : in out Faces_Context'Class);
-- Finish encoding the component.
overriding
procedure Encode_End (UI : in UIViewMetaData;
Context : in out Faces_Context'Class);
-- Queue an event for broadcast at the end of the current request
-- processing lifecycle phase. The event object
-- will be freed after being dispatched.
overriding
procedure Queue_Event (UI : in out UIViewMetaData;
Event : not null access ASF.Events.Faces.Faces_Event'Class);
-- Broadcast the events after the specified lifecycle phase.
-- Events that were queued will be freed.
overriding
procedure Broadcast (UI : in out UIViewMetaData;
Phase : in ASF.Lifecycles.Phase_Type;
Context : in out Faces_Context'Class);
-- Clear the events that were queued.
overriding
procedure Clear_Events (UI : in out UIViewMetaData);
-- Get the root component.
function Get_Root (UI : in UIViewMetaData) return Base.UIComponent_Access;
-- Set the metadata facet on the UIView component.
procedure Set_Metadata (UI : in out UIView;
Meta : in UIViewMetaData_Access;
Tag : access ASF.Views.Nodes.Tag_Node'Class);
private
use ASF.Lifecycles;
type Faces_Event_Access is access all ASF.Events.Faces.Faces_Event'Class;
package Event_Vectors is new Ada.Containers.Vectors (Index_Type => Natural,
Element_Type => Faces_Event_Access);
type Event_Queues is array (Phase_Type) of Event_Vectors.Vector;
type UIView is new Core.UIComponentBase with record
Content_Type : Util.Beans.Objects.Object;
Phase_Events : Event_Queues;
Meta : UIViewMetaData_Access := null;
Locale : Util.Locales.Locale := Util.Locales.NULL_LOCALE;
Left_Tree : Base.UIComponent_Access := null;
Right_Tree : Base.UIComponent_Access := null;
end record;
type UIViewParameter is new Html.Forms.UIInput with record
Name : Ada.Strings.Unbounded.Unbounded_String;
end record;
type UIViewAction is new Html.Forms.UICommand with null record;
type UIViewMetaData is new UIView with record
Root : UIView_Access := null;
end record;
end ASF.Components.Core.Views;
|
-- BinToAsc_Suite.Misc_Tests
-- Unit tests for BinToAsc
-- Copyright (c) 2015, James Humphry - see LICENSE file for details
with AUnit; use AUnit;
with AUnit.Test_Cases; use AUnit.Test_Cases;
package BinToAsc_Suite.Misc_Tests is
type Misc_Test is new Test_Cases.Test_Case with null record;
procedure Register_Tests (T: in out Misc_Test);
function Name (T : Misc_Test) return Test_String;
procedure Set_Up (T : in out Misc_Test);
procedure Check_Valid_Alphabet (T : in out Test_Cases.Test_Case'Class);
procedure Check_Make_Reverse_Alphabet (T : in out Test_Cases.Test_Case'Class);
end BinToAsc_Suite.Misc_Tests;
|
pragma License (Unrestricted);
package Ada.Assertions is
pragma Pure;
Assertion_Error : exception
with Export, Convention => Ada, External_Name => "assertion_error";
-- modified
-- Assert reports the source location if it's called without a message.
-- procedure Assert (Check : Boolean);
-- procedure Assert (Check : Boolean; Message : String);
procedure Assert (
Check : Boolean;
Message : String := Debug.Source_Location);
-- extended
procedure Raise_Assertion_Error (
Message : String := Debug.Source_Location);
pragma No_Return (Raise_Assertion_Error);
-- Note: Raise_Assertion_Error is called by pragma Assert.
end Ada.Assertions;
|
with Web.HTML.Scripts;
with Web.Window;
with Web.Strings;
package body Cube_Programs is
function "+" (Item : Wide_Wide_String) return Web.Strings.Web_String
renames Web.Strings.To_Web_String;
-- GS : constant League.Strings.Universal_String :=
-- League.Strings.To_Universal_String ("gSampler");
-- VP : constant League.Strings.Universal_String :=
-- League.Strings.To_Universal_String ("vp");
-- TC : constant League.Strings.Universal_String :=
-- League.Strings.To_Universal_String ("tc");
----------------
-- Initialize --
----------------
procedure Initialize (Self : in out Cube_Program'Class) is
begin
Self.Add_Shader_From_Source_Code
(OpenGL.Vertex,
Web.Window.Document.Get_Element_By_Id
(+"cube-vertex-shader").As_HTML_Script.Get_Text);
Self.Add_Shader_From_Source_Code
(OpenGL.Fragment,
Web.Window.Document.Get_Element_By_Id
(+"cube-fragment-shader").As_HTML_Script.Get_Text);
end Initialize;
----------
-- Link --
----------
overriding function Link (Self : in out Cube_Program) return Boolean is
begin
if not OpenGL.Programs.OpenGL_Program (Self).Link then
return False;
end if;
Self.PM := Self.Uniform_Location (+"uProjectionMatrix");
Self.MVM := Self.Uniform_Location (+"uModelViewMatrix");
Self.MMM := Self.Uniform_Location (+"uModelMoveMatrix");
Self.VP := Self.Attribute_Location (+"aVertexPosition");
Self.CP := Self.Attribute_Location (+"aVertexColor");
return True;
end Link;
---------------------------
-- Set_Model_Move_Matrix --
---------------------------
procedure Set_Model_Move_Matrix
(Self : in out Cube_Program'Class;
Matrix : OpenGL.GLfloat_Matrix_4x4) is
begin
Self.Set_Uniform_Value (Self.MMM, Matrix);
end Set_Model_Move_Matrix;
---------------------------
-- Set_Model_View_Matrix --
---------------------------
procedure Set_Model_View_Matrix
(Self : in out Cube_Program'Class;
Matrix : OpenGL.GLfloat_Matrix_4x4) is
begin
Self.Set_Uniform_Value (Self.MVM, Matrix);
end Set_Model_View_Matrix;
---------------------------
-- Set_Projection_Matrix --
---------------------------
procedure Set_Projection_Matrix
(Self : in out Cube_Program'Class;
Matrix : OpenGL.GLfloat_Matrix_4x4) is
begin
Self.Set_Uniform_Value (Self.PM, Matrix);
end Set_Projection_Matrix;
----------------------------
-- Set_Vertex_Data_Buffer --
----------------------------
procedure Set_Vertex_Data_Buffer
(Self : in out Cube_Program'Class;
Buffer : Vertex_Data_Buffers.OpenGL_Buffer'Class)
is
Dummy : Vertex_Data;
begin
Self.Enable_Attribute_Array (Self.VP);
Self.Enable_Attribute_Array (Self.CP);
Self.Set_Attribute_Buffer
(Location => Self.VP,
Data_Type => OpenGL.GL_FLOAT,
Tuple_Size => Dummy.Vertex_Position'Length,
Offset => Dummy.Vertex_Position'Position,
Stride => Vertex_Data_Buffers.Stride);
Self.Set_Attribute_Buffer
(Location => Self.CP,
Data_Type => OpenGL.GL_FLOAT,
Tuple_Size => Dummy.Vertex_Color'Length,
Offset => Dummy.Vertex_Color'Position,
Stride => Vertex_Data_Buffers.Stride);
end Set_Vertex_Data_Buffer;
end Cube_Programs;
|
-- Shoot'n'loot
-- Copyright (c) 2020 Fabien Chouteau
with Game_Assets; use Game_Assets;
with GESTE;
package Chests is
Max_Nbr_Of_Chests : constant := 3;
procedure Init (Objects : Object_Array)
with Pre => Objects'Length <= Max_Nbr_Of_Chests;
procedure Check_Chest_Found (Pt : GESTE.Pix_Point);
function All_Open return Boolean;
procedure Update;
end Chests;
|
-- { dg-do compile }
-- { dg-options "-O -fdump-tree-optimized" }
pragma Overflow_Mode (Minimized);
package body Loop_Optimization22 is
procedure Foo (X : Discrim_Type) is
H : array (1 .. Integer (X.Count) + 1) of Float;
begin
for I in 1 .. X.Count loop
H (Integer(I) + 1):= 0.0;
end loop;
end;
end Loop_Optimization22;
-- { dg-final { scan-tree-dump-not "Index_Check" "optimized" } }
|
-- Package body Julian_calendar
----------------------------------------------------------------------------
-- Copyright Miletus 2016
-- Permission is hereby granted, free of charge, to any person obtaining
-- a copy of this software and associated documentation files (the
-- "Software"), to deal in the Software without restriction, including
-- without limitation the rights to use, copy, modify, merge, publish,
-- distribute, sublicense, and/or sell copies of the Software, and to
-- permit persons to whom the Software is furnished to do so, subject to
-- the following conditions:
-- 1. The above copyright notice and this permission notice shall be included
-- in all copies or substantial portions of the Software.
-- 2. Changes with respect to any former version shall be documented.
--
-- The software is provided "as is", without warranty of any kind,
-- express of implied, including but not limited to the warranties of
-- merchantability, fitness for a particular purpose and noninfringement.
-- In no event shall the authors of copyright holders be liable for any
-- claim, damages or other liability, whether in an action of contract,
-- tort or otherwise, arising from, out of or in connection with the software
-- or the use or other dealings in the software.
-- Inquiries: www.calendriermilesien.org
------------------------------------------------------------------------------
with Cycle_Computations;
package body Julian_calendar is
package Julian_Day_cycle is
new Cycle_computations.Integer_cycle_computations
(Num => Julian_Day'Base);
use Julian_Day_cycle;
subtype computation_month is integer range 0..12;
function is_bissextile_year -- in the sense of Julian or Gregorian
(year : Historical_year_number; Calendar : Calendar_type := Unspecified)
return Boolean is
Is_Julian : Boolean := Calendar = Julian or else
(Calendar = Unspecified and then year < 1583);
begin
return year mod 4 = 0 and then
(Is_Julian or else (year mod 100 /= 0
or else year mod 400 = 0));
end is_bissextile_year;
function is_valid
(date : Roman_date; Calendar : Calendar_type := Unspecified)
return Boolean is -- whether the given date is an existing one
-- on elaboration, the basic range cheks on record fields have been done
begin
case date.month is
when 4|6|9|11 => return date.day <= 30;
when 2 => return date.day <= 28
or else (date.day = 29
and is_bissextile_year (date.year , Calendar));
when others => return True;
end case;
end is_valid;
function JD_to_Roman (jd : Julian_Day;
Calendar : Calendar_type := Unspecified)
-- Gregorian : Boolean := (jd > 299160))
return Roman_date is
Is_Gregorian : Boolean := Calendar = Gregorian or else
(Calendar = Unspecified and then jd > 299160);
-- by default, the return date shall be specified in gregorian
-- if it falls after 1582-10-04 (julian)
cc : Cycle_coordinates := (0, jd+1401);
-- Initiated for the julian calendar case;
-- Base of cycle if julian calendar is 1/3/-4716 julian calendar
Shifted_month : Integer;
Shifted_year : Historical_year_number := -4716;
begin
-- 1. Find the year and day-of-year in the shifted Roman calendar,
-- i.e. the calendar that begins on 1 March.
-- 1.1 If Gregorian, find quadrisaeculum, then century, then quadriannum;
-- else find directly quadriannum;
-- 1.2 Find shifted year and rank of day in shifted year;
-- 1.3 Find shifted month, find day rank in shifted month
-- 2. Set to unshifted calendar.
if Is_Gregorian then -- 1.1
cc := Decompose_cycle (jd+32044, 146097);
-- intialise current day for the computations to
-- day of a "gregorian epoch" such as 0 is 1/3/-4800 gregorian
Shifted_year := (cc.cycle - 12) * 400;
-- Initiated for the gregorian calendar
cc := Decompose_cycle_ceiled (cc.phase, 36524, 4);
-- cc.cycle is rank of century in quadriseculum,
-- cc.phase is rank of days within century.
-- rank of century is 0 to 3, phase can be 36524 if rank is 3.
Shifted_year := Shifted_year + (cc.cycle) * 100; -- base century
end if;
-- 1.2; cc and shifted_year already initiated.
cc := Decompose_cycle (cc.phase, 1461); -- quadriannum
Shifted_year := Shifted_year + cc.cycle * 4;
cc := Decompose_cycle_ceiled (cc.phase, 365, 4); -- year in quadriannum
Shifted_year := Shifted_year + cc.cycle;
-- here we get the (shifted) year and the rank of day, cc.phase.
-- 1.3 use a variant of Troesch method
cc := Decompose_cycle (5 * cc.Phase + 2 , 153);
Shifted_month := cc.Cycle;
-- here Shifted_day = cc.Phase / 5;
if Shifted_month < 10 -- 0..9 meaning March to December
then return (year => Shifted_year,
month => Shifted_month + 3,
day => cc.Phase/5 + 1);
else return (year => Shifted_year + 1,
month => Shifted_month - 9,
day => cc.Phase/5 + 1);
end if;
end JD_to_Roman;
function Roman_to_JD (Date : Roman_date;
Calendar : Calendar_type := Unspecified)
return Julian_Day is
Is_Gregorian : Boolean := Calendar = Gregorian or else
(Calendar = Unspecified and then
(Date.year > 1583 or else
(Date.year = 1582 and then
(Date.month > 10 or else
(Date.month = 10 and then Date.day > 4)))));
Jd : Julian_Day;
Days : Julian_Day_Duration;
Shifted_month : integer := Date.month;
Shifted_year : Integer := Date.year;
Centuries : Integer;
begin
if not is_valid (date , Calendar) then raise Time_Error; end if;
if Shifted_month in 1..2 then
Shifted_month := Shifted_month + 9; -- 10 or 11
Shifted_year := Shifted_year - 1;
else
Shifted_month := Shifted_month - 3; -- 0 to 9
end if;
Centuries := (Shifted_year + 4800)/100; -- Computed from -4800;
Days := (Shifted_year + 4716) / 4 -- for each leap year
+ (Shifted_month*306 + 5) / 10
-- osssia + Integer (Fractional_day_in_year (Shifted_month * 30.6))
+ date.day - 307;
If Is_Gregorian then
Days := Days - Centuries + Centuries/4 + 38;
end if;
Jd := (Shifted_year + 4713) * 365; -- 365 days per years
Jd := Jd + Days;
Return Jd;
end Roman_to_JD;
function Julian_to_Gregorian_Delay (Year : Historical_year_number)
return Integer is
A : Natural := Year + 4800 ; -- force positive.
begin
return -38 + A/100 - A/400; -- divisions use only with positive arguments
end Julian_to_Gregorian_Delay;
function Easter_days (Year : Natural;
Calendar : Calendar_type := Unspecified)
return Natural is
Is_Gregorian : Boolean := Calendar = Gregorian or else
(Calendar = Unspecified and then year > 1582);
-- Initialisation: decompose year in suitable parts,
-- Compute Gold number, compute Easter residue.
-- Rank of century
S : Natural := Year / 100;
-- Rank of quadrisaeculum
Q : Natural := S/4;
-- Rank of quadriannum in current century
B : Natural range 0..24 := (Year - S*100) / 4;
-- Rank of year in current quadriannum
N : Natural range 0..3 := (Year - S*100 - B*4);
-- Gold number minus one in Meton's cycle
G : Natural range 0..18 := Year mod 19;
-- Easter residue, number of days from 21 March until Easter full moon
R : Natural range 0..29 :=
(15 + 19*G -- Computation of Easter residue after Delambre...
+ Boolean'Pos (Is_Gregorian) * (S - Q - (8*S + 13)/25))
-- Gregorian: add Metemptose and Proemptose.
-- Proemptose is computed with the Zeller-Troesch formula.
mod 30; -- Take the remainder by 30 residue before correction.
begin
if Is_Gregorian then
R := R - (G + 11*R) / 319 ; -- correction on residue
end if;
if Is_Gregorian then
return 1 + R + (4 - Q + 2*S + 2*B - N - R) mod 7 ;
else
return 1 + R + (6 + S + 2*B - N - R) mod 7 ;
end if;
end Easter_days;
end Julian_calendar;
|
-- C74211B.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 IMPLICITLY DECLARED INEQUALITY WHICH ACCOMPANIES AN
-- EXPLICIT DECLARATION OF EQUALITY HIDES OTHER IMPLICITLY DECLARED
-- HOMOGRAPHS, AND THAT DERIVED INEQUALITY HIDES PREDEFINED INEQUALITY.
-- DSJ 4/29/83
-- JBG 9/23/83
WITH REPORT;
PROCEDURE C74211B IS
USE REPORT;
BEGIN
TEST( "C74211B", "CHECK THAT HIDING OF IMPLICITLY DECLARED " &
"OPERATORS AND DERIVED SUBPROGRAMS IS DONE " &
"CORRECTLY REGARDLESS OF ORDER OF DECL'S");
DECLARE
PACKAGE P1 IS
TYPE LT1 IS LIMITED PRIVATE;
FUNCTION "="(L, R : LT1) RETURN BOOLEAN;
FUNCTION LT1_VALUE_2 RETURN LT1;
FUNCTION LT1_VALUE_4 RETURN LT1;
TYPE LT2 IS LIMITED PRIVATE;
PRIVATE
TYPE LT1 IS RANGE 1 .. 10;
TYPE LT2 IS RANGE 1 .. 10;
END P1;
USE P1;
PACKAGE P2 IS
TYPE LT3 IS LIMITED PRIVATE;
TYPE LT4 IS NEW LT1;
PRIVATE
FUNCTION "=" (L, R : LT3) RETURN BOOLEAN;
TYPE LT3 IS NEW LT1;
END P2;
USE P2;
PACKAGE BODY P1 IS
A , B : CONSTANT LT1 := 4;
C , D : CONSTANT LT2 := 6;
FUNCTION "=" (L, R : LT1) RETURN BOOLEAN IS
BEGIN
RETURN INTEGER(L) /= INTEGER(R);
END "=";
FUNCTION LT1_VALUE_2 RETURN LT1 IS
BEGIN
RETURN 2;
END LT1_VALUE_2;
FUNCTION LT1_VALUE_4 RETURN LT1 IS
BEGIN
RETURN 4;
END LT1_VALUE_4;
BEGIN
IF A = B THEN
FAILED ("PREDEFINED EQUALITY NOT HIDDEN BY " &
"EXPLICIT DECLARATION - LT1");
END IF;
IF C /= D THEN
FAILED ("WRONG PREDEFINED OPERATION - T2");
END IF;
END P1;
PACKAGE BODY P2 IS
FUNCTION U RETURN LT3 IS
BEGIN
RETURN LT1_VALUE_2;
END U;
FUNCTION V RETURN LT3 IS
BEGIN
RETURN LT1_VALUE_4;
END V;
FUNCTION W RETURN LT4 IS
BEGIN
RETURN LT1_VALUE_2;
END W;
FUNCTION X RETURN LT4 IS
BEGIN
RETURN LT1_VALUE_4;
END X;
FUNCTION "=" (L, R : LT3) RETURN BOOLEAN IS
BEGIN
RETURN NOT (LT1(L) = LT1(R));
END "=";
BEGIN
IF NOT (U /= V) THEN
FAILED ("DERIVED SUBPROGRAM NOT HIDDEN BY " &
"IMPLICITLY DECLARED INEQUALITY " &
"FROM EXPLICITLY DECLARED EQUALITY");
END IF;
IF NOT (LT3(W) = U) THEN
FAILED ("DERIVED SUBPROGRAM NOT HIDDEN BY " &
"EXPLICIT DECLARATION - '=' ");
END IF;
IF W /= X THEN
FAILED ("PREDEFINED OPERATOR NOT HIDDEN BY " &
"DERIVED SUBPROGRAM - '/=' ");
END IF;
IF NOT ( X = W ) THEN
FAILED ("PREDEFINED OPERATOR NOT HIDDEN BY " &
"DERIVED SUBPROGRAM - '=' ");
END IF;
END P2;
BEGIN
NULL;
END;
RESULT;
END C74211B;
|
with STM32GD.Board;
procedure Main is
begin
STM32GD.Board.Init;
loop
null;
end loop;
end Main;
|
with ada.text_io, ada.Integer_text_IO, Ada.Text_IO.Text_Streams, Ada.Strings.Fixed, Interfaces.C;
use ada.text_io, ada.Integer_text_IO, Ada.Strings, Ada.Strings.Fixed, Interfaces.C;
procedure aaa_013option is
type stringptr is access all char_array;
procedure PString(s : stringptr) is
begin
String'Write (Text_Streams.Stream (Current_Output), To_Ada(s.all));
end;
type foo;
type foo_PTR is access foo;
type i is access Integer;
type j is Array (Integer range <>) of Integer;
type j_PTR is access j;
type k is access j_PTR;
type l is Array (Integer range <>) of i;
type l_PTR is access l;
type m is Array (Integer range <>) of foo_PTR;
type m_PTR is access m;
type n is Array (Integer range <>) of foo_PTR;
type n_PTR is access n;
type o is access n_PTR;
type foo is record
a : Integer;
b : i;
c : k;
d : l_PTR;
e : j_PTR;
f : foo_PTR;
g : m_PTR;
h : o;
end record;
function default0(a : in i; b : in foo_PTR; c : in l_PTR; d : in m_PTR; e : in k; f : in o) return Integer is
begin
return 0;
end;
procedure aa(b : in foo_PTR) is
begin
NULL;
end;
a : i;
begin
a := Null;
PString(new char_array'( To_C("___" & Character'Val(10))));
end;
|
with GNAT.Sockets.Server; use GNAT.Sockets.Server;
with Strings_Edit.Integers; use Strings_Edit.Integers;
pragma Warnings(Off);
with System.IO; -- for debugging
pragma Warnings(On);
package body MQTT_Clients is
-------------------------
-- On_Connect_Accepted --
-------------------------
procedure On_Connect_Accepted
(Pier : in out MQTT_Client;
Session_Present : Boolean)
is
begin
System.IO.Put_Line("MQTT connect accepted");
end On_Connect_Accepted;
-------------------------
-- On_Connect_Rejected --
-------------------------
procedure On_Connect_Rejected
(Pier : in out MQTT_Client;
Response : Connect_Response)
is
begin
System.IO.Put_Line("Connect rejected " & Image (Response));
end On_Connect_Rejected;
----------------------
-- On_Ping_Response --
----------------------
procedure On_Ping_Response (Pier : in out MQTT_Client) is
begin
System.IO.Put_Line("Ping response");
end On_Ping_Response;
----------------
-- On_Publish --
----------------
procedure On_Publish
(Pier : in out MQTT_Client;
Topic : String;
Message : Stream_Element_Array;
Packet : Packet_Identification;
Duplicate : Boolean;
Retain : Boolean)
is
begin
System.IO.Put_Line("Message " & Topic & " = " & Image(Message));
On_Publish (MQTT_Pier (Pier),
Topic,
Message,
Packet,
Duplicate,
Retain);
end On_Publish;
----------------------------------
-- On_Subscribe_Acknowledgement --
----------------------------------
procedure On_Subscribe_Acknowledgement
(Pier : in out MQTT_Client;
Packet : Packet_Identifier;
Codes : Return_Code_List)
is
begin
for Code of Codes loop
if Code.Success then
System.IO.Put_Line ("Subscribed " & Image (Integer (Packet))
& ":" & QoS_Level'Image (Code.QoS));
else
System.IO.Put_Line ("Subscribe " & Image (Integer (Packet))
& ": failed");
end if;
end loop;
end On_Subscribe_Acknowledgement;
begin
System.IO.Set_Output(System.IO.Standard_Error);
end MQTT_Clients;
|
-------------------------------------------------------------------------------
-- Fichier : display_shell.adb
-- Auteur : MOUDDENE Hamza & CAZES Noa
-- Objectif : Spécification du package Display_Shell
-- Crée : Dimanche Nov 25 2019
--------------------------------------------------------------------------------
with Arbre_Genealogique; use Arbre_Genealogique;
with Registre; use Registre;
package Display_Shell is
-- Nom : Init_Bar.
-- Sémantique : Afficher la barre d'initialisation.
procedure Init_Bar;
-- Nom : Display_Menu.
-- Sémantique : Afficher le menu principal.
procedure Display_Menu;
-- Nom : Display_TREE_IN_FOREST.
-- Sémantique : Afficher une erreur quand l'arbre existe déja dans la foret.
procedure Display_TREE_IN_FOREST;
-- Nom : Display_EXCEPTION.
-- Sémantique : Afficher un message quand une fonction ou procedure lève une exception.
-- Paramètres :
-- Message -- Le message qui sera afficher.
-- Restart -- 1 si on redémarre le programme, 0 si on redémarre l'option.
procedure Display_Exception (Message : in String; Restart : in Integer);
-- Nom : Display_Menu.
-- Sémantique : Afficher un message quand l'exéctuion d'une procédure ou fonction réussit.
-- Paramètres :
-- Message -- Le message qui sera afficher.
procedure Display_Success (Message : in String);
-- Nom : Display_Success_Minimal_Tree_Ceation.
-- Sémantique : Afficher un message quand la création de l'arbre minimal réussit.
procedure Display_Success_Minimal_Tree_Ceation;
-- Nom : Display_ARBRE_NON_VIDE_EXCEPTION.
-- Sémantique : Afficher un message quand creer arbre minimal lève l'exception ARBRE_NON_VIDE_EXCEPTION.
procedure Display_ARBRE_NON_VIDE_EXCEPTION;
-- Nom : Display_Success_Add_Parent.
-- Sémantique : Afficher un message quand ajouter parent réussit.
procedure Display_Success_Add_Parent;
-- Nom : Display_ARBRE_VIDE_EXCEPTION.
-- Sémantique : Afficher un message quand ajouter parent lève l'exception ARBRE_VIDE_EXCEPTION.
-- Paramètres :
-- Message -- Le message qui sera afficher.
-- Restart -- 1 si on redémarre le programme, 0 si on redémarre l'option.
procedure Display_ARBRE_VIDE_EXCEPTION (Message : in String; Restart : in Integer);
-- Nom : Display_DEUX_PARENTS_PRESENTS_EXCEPTION.
-- Sémantique : Afficher un message quand ajouter parent lève l'exception DEUX_PARENTS_PRESENTS_EXCEPTION.
procedure Display_DEUX_PARENTS_PRESENTS_EXCEPTION;
-- Nom : Display_ID_ABSENT_EXCEPTION.
-- Sémantique : Afficher un message quand une fonction ou procedure lève l'exception ID_ABSENT_EXCEPTION.
-- Paramètres :
-- Message -- Le message qui sera afficher.
-- Restart -- 1 si on redémarre le programme, 0 si on redémarre l'option.
procedure Display_ID_ABSENT_EXCEPTION (Message : in String; Restart : in Integer);
-- Nom : Display_Number_Ancestors.
-- Sémantique : Afficher le nombre d'ancetres d'un individu donné.
-- Paramètres :
-- Ab -- L'Ab qui contient l'ID qu'on va afficher le nombre des ses ancetres.
-- ID -- l'ID qu'on va afficher le nombre des ses ancetres.
procedure Display_Number_Ancestors (Ab : in T_ABG; ID : in Integer);
-- Nom : Display_Title_Set.
-- Semantique : Afficher un message descriptif de l'ensemble affiché sur le terminal.
-- Paramètres :
-- Generation -- La Génération des ancestres.
procedure Display_Title_Set (Message : in String; Generation : in Integer);
-- Nom : Display_Is_Homonym.
-- Semantique : Afficher Vrai si deux individus n et m ont un ou plusieurs
-- ancêtres homonymes, sinon faux.
-- Paramètres :
-- Is_Homonym -- L'existence des homonymes.
procedure Display_Is_Homonym (Is_Homonym : in Boolean);
-- Nom : Afficher_Donnee
-- Sémantique : Afficher la donnée associée à un identifiant dans le registre
-- Paramètres :
-- Registre -- L'état civil.
-- ID -- l'ID de l'individu qu'on cherche à afficher son registre.
procedure Afficher_Donnee(Registre : in T_Registre; ID : in Integer);
-- Nom : Display_ABSENT_TREE_EXCEPTION.
-- Sémantique : Afficher un message quand une fonction ou procedure lève l'exception ABSENT_TREE_EXCEPTION.
-- Paramètres :
-- Message -- Le message qui sera afficher.
procedure Display_ABSENT_TREE_EXCEPTION (Message : in String);
-- Nom : End_Bar.
-- Semantique : Afficher la barre de fin d'exécution.
procedure End_Bar;
end Display_Shell;
|
package Benchmark.Matrix.Cholesky is
type Cholesky_Type is new Matrix_Type with private;
function Create_Cholesky return Benchmark_Pointer;
overriding
procedure Run(benchmark : in Cholesky_Type);
private
type Cholesky_Type is new Matrix_Type with null record;
end Benchmark.Matrix.Cholesky;
|
-- The Beer-Ware License (revision 42)
--
-- Jacob Sparre Andersen <jacob@jacob-sparre.dk> wrote this. As long as you
-- retain this notice you can do whatever you want with this stuff. If we meet
-- some day, and you think this stuff is worth it, you can buy me a beer in
-- return.
--
-- Jacob Sparre Andersen
with Ada.Text_IO;
with Sound.Mono;
procedure Test_ALSA_Binding is
Microphone : Sound.Mono.Line_Type;
Resolution : Sound.Sample_Frequency := 44_100;
Buffer_Size : Duration := 0.5;
Period : Duration := 0.1;
Recording : Sound.Mono.Frame_Array (1 .. 44_100 * 10);
Filled_To : Natural;
begin
Sound.Mono.Open (Line => Microphone,
Mode => Sound.Input,
Resolution => Resolution,
Buffer_Size => Buffer_Size,
Period => Period);
Ada.Text_IO.Put_Line
(File => Ada.Text_IO.Standard_Error,
Item => "Resolution [samples/s]: " &
Sound.Sample_Frequency'Image (Resolution));
Ada.Text_IO.Put_Line
(File => Ada.Text_IO.Standard_Error,
Item => "Buffer size [s]: " & Duration'Image (Buffer_Size));
Ada.Text_IO.Put_Line
(File => Ada.Text_IO.Standard_Error,
Item => "Period [s]: " & Duration'Image (Period));
Sound.Mono.Read (Line => Microphone,
Item => Recording,
Last => Filled_To);
Sound.Mono.Close (Line => Microphone);
for Index in Recording'First .. Filled_To loop
Ada.Text_IO.Put_Line (Recording (Index)'Img);
end loop;
end Test_ALSA_Binding;
|
with Interfaces; use Interfaces;
with STM32GD;
with STM32_SVD; use STM32_SVD;
with STM32GD.Board;
with STM32GD.Power;
procedure Main is
package Board renames STM32GD.Board;
package Text_IO renames STM32GD.Board.Text_IO;
package Radio renames STM32GD.Board.Radio;
procedure Print_Registers is new Radio.Print_Registers (Put_Line => Text_IO.Put_Line);
Line : String (1 .. 8);
Len : Natural;
procedure RX_Test is
RX_Address : constant Radio.Address_Type := 0;
Packet: Radio.Packet_Type (1 .. 48);
Length : Byte;
begin
Text_IO.Put_Line ("Starting RX test");
Radio.Set_RX_Address (RX_Address);
Radio.RX_Mode;
loop
STM32GD.Board.LED.Toggle;
if Radio.Wait_For_RX then
Text_IO.Put_Line ("Packet received");
Print_Registers;
Radio.Clear_IRQ;
Radio.RX (Packet, Length);
for I in 1 .. Length loop
Text_IO.Put_Hex (Unsigned_32 (Packet (I)), 2);
end loop;
Text_IO.New_Line;
end if;
end loop;
end RX_Test;
procedure TX_Test is
Broadcast_Address : constant Radio.Address_Type := 0;
TX_Data : constant Radio.Packet_Type := (
16#01#, 16#02#, 16#03#, 16#04#, 16#05#, 16#06#, 16#07#, 16#08#, 16#09#
-- 16#00#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#55#
);
begin
Text_IO.Put_Line ("Starting TX test");
Radio.Set_TX_Address (Broadcast_Address);
Radio.TX_Mode;
loop
Text_IO.Put_Line ("Press <enter>");
Text_IO.Get_Line (Line, Len);
STM32GD.Board.LED.Toggle;
Radio.TX (TX_Data, 9);
Print_Registers;
end loop;
end TX_Test;
procedure Power_Down_Test is
begin
Radio.Power_Down;
Board.Disable_Peripherals;
STM32GD.Power.Enable_Stop;
loop STM32GD.Wait_For_Interrupt; end loop;
end Power_Down_Test;
begin
Board.Init;
Text_IO.Put_Line ("Starting RFM69 Test");
Radio.Init;
Text_IO.Put_Line ("r: RX test -- t: TX test -- others: Power down");
Text_IO.Get_Line (Line, Len);
case Line (Line'First) is
when 'r' => RX_Test;
when 't' => TX_Test;
when others => Power_Down_Test;
end case;
end Main;
|
-- { dg-do compile }
with Noreturn4_Pkg; use Noreturn4_Pkg;
package body Noreturn4 is
procedure P1 (Msg : String) is
begin
P1 (Msg, 0);
end;
procedure P1 (Msg : String; Val : Integer) is
begin
Fatal_Error (Value (It));
end;
procedure Fatal_Error (X : Integer) is
begin
raise PRogram_Error;
end;
end Noreturn4;
|
generic
type Scalar is digits <>;
with function A (N : in Natural) return Natural;
with function B (N : in Positive) return Natural;
function Continued_Fraction_Ada95 (Steps : in Natural) return Scalar;
|
with NRF52_DK.Time;
with NRF52_DK.IOs;
with NRF52_DK.Buttons; use NRF52_DK.Buttons;
package body SteeringControl is
procedure Servocontrol(ServoPin : NRF52_DK.IOs.Pin_Id; Value : NRF52_DK.IOs.Analog_Value) is --Servo --
begin
--Writing values to the servo motor.
NRF52_DK.IOs.Write(ServoPin,Value);
NRF52_DK.IOs.Set_Analog_Period_Us(20000);
NRF52_DK.Time.Delay_Ms (2);
end Servocontrol;
procedure Direction_Controller is --Turning left/right with buttons by changing servo degrees --
begin
Servocontrol(3,300);
loop
while NRF52_DK.Buttons.State(Button_1) = Pressed loop
Servocontrol(3,200); --0value at 0 degrees, 200value medium state, 400value max degrees 180
if NRF52_DK.Buttons.State(Button_1) = Released then
Servocontrol(3,300);
end if;
end loop;
while (NRF52_DK.Buttons.State(Button_2) = Pressed) loop
Servocontrol(3,400); --0value at 0 degrees, 200value medium state, 400value max degrees 180
if NRF52_DK.Buttons.State(Button_2) = Released then
Servocontrol(3,300);
end if;
end loop;
end loop;
end Direction_Controller;
procedure Motor_Controller is --Forward/Backward using buttons --
begin
loop
--CLOCKWISE
while (NRF52_DK.Buttons.State(Button_3) = Pressed) loop -- DRIVE FORWARD --
NRF52_DK.IOs.Set (27, True);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (27, false);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (21, True);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (21, False);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (23, True);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (23, False);
NRF52_DK.Time.Delay_Ms (5);
end loop;
while (NRF52_DK.Buttons.State(Button_4) = Pressed) loop -- DRIVE Backward --
--Anti CLOCKWISE
NRF52_DK.IOs.Set (23, True);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (23, False);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (21, True);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (21, False);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (27, True);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (27, False);
NRF52_DK.Time.Delay_Ms (5);
end loop;
end loop;
end Motor_Controller;
procedure Crash_Stop_Forward is
begin
--This function will run when the sensor in front is triggering an emergency.
--The idea was so every time we tried to drive forward while the sensor in front
--is active, then this would run and run a loop of backwards on motor in order
--to even it out, since we thought it sounded better than stopping the motor completely.
--BACKWARD LOOP
NRF52_DK.IOs.Set (23, True);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (23, False);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (21, True);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (21, False);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (27, True);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (27, False);
NRF52_DK.Time.Delay_Ms (5);
end Crash_Stop_Forward;
procedure Crash_Stop_Backward is
begin
--Same thing here as with the function above, but here we run a forward loop.
--FORWARD LOOP
NRF52_DK.IOs.Set (27, True);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (27, false);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (21, True);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (21, False);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (23, True);
NRF52_DK.Time.Delay_Ms (5);
NRF52_DK.IOs.Set (23, False);
NRF52_DK.Time.Delay_Ms (5);
end Crash_Stop_Backward;
end SteeringControl;
|
-- { dg-do compile }
with ICE_Types; use ICE_Types;
procedure ICE_Type is
type Local_Float_T is new Float_View_T;
LF : Local_Float_T;
begin
Initialize (Float_View_T (LF));
end;
|
with E3GA;
package body Geometric_Objects is
function Set_Line (L1, L2 : C3GA.Normalized_Point) return C3GA.Line is
begin
return C3GA.Unit_R (E3GA.Outer_Product (L1, L2));
end Set_Line;
end Geometric_Objects;
|
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
type Days_Of_Week_T is
(Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday);
type Hours_Worked is digits 6;
Total_Worked : Hours_Worked := 0.0;
Hours_Today : Hours_Worked;
Overtime : Hours_Worked;
begin
-- For each day in the Days_Of_Week_T loop
-- Print prompt indicating which day we're asking for
-- Loop "forever"
Hours_Today := Hours_Worked'value (Get_Line);
-- exit the main loop if hours worked < 0
if Hours_Today > 24.0 then
Put_Line ("I don't believe you");
else
-- exit the input loop if a reasonable number is reached
null;
end if;
-- if hours worked > 8 then
Overtime := Hours_Today - 8.0;
Hours_Today := Hours_Today + 1.5 * Overtime;
-- Calculate actual hours paid for based on day of the week
-- Monday - Friday, just add hours worked
-- Saturday - hours worked * 1.5
-- Sunday - hours worked * 2
Put_Line (Hours_Worked'image (Total_Worked));
end Main;
|
------------------------------------------------------------------------------
-- --
-- GESTE --
-- --
-- Copyright (C) 2018 Fabien Chouteau --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Interfaces; use Interfaces;
package body GESTE is
use Layer;
function Max (A, B : Coordinate) return Coordinate
is (Coordinate'Max (A, B))
with Inline_Always;
function Min (A, B : Coordinate) return Coordinate
is (Coordinate'Min (A, B))
with Inline_Always;
--------------
-- Position --
--------------
function Position (This : Layer_Type)
return Pix_Point
is (This.Pt);
----------
-- Move --
----------
procedure Move (This : in out Layer_Type;
Pt : Pix_Point)
is
begin
if This.Pt /= Pt then
This.Last_Pt := This.Pt;
This.Pt := Pt;
This.Dirty := True;
end if;
end Move;
-----------------------
-- Enable_Collisions --
-----------------------
procedure Enable_Collisions (This : in out Layer_Type;
Enable : Boolean := True)
is
begin
This.Collisions_Enabled := Enable;
end Enable_Collisions;
-----------
-- Width --
-----------
function Width (This : Layer_Type) return Natural
is (This.A_Width);
------------
-- Height --
------------
function Height (This : Layer_Type) return Natural
is (This.A_Height);
---------
-- Add --
---------
procedure Add (L : not null Layer.Ref;
Priority : Layer_Priority) is
Prev : Layer.Ref := null;
Cur : Layer.Ref := Layer_List;
begin
L.Prio := Priority;
while Cur /= null and then Cur.Prio > Priority loop
Prev := Cur;
Cur := Cur.Next;
end loop;
if Prev = null then
-- Head
if Layer_List /= null then
Layer_List.Prev := L;
end if;
L.Next := Layer_List;
L.Prev := null;
Layer_List := L;
else
if Cur = null then
-- Tail
Prev.Next := L;
L.Prev := Prev;
L.Next := null;
else
L.Prev := Prev;
Prev.Next := L;
L.Next := Cur;
Cur.Prev := L;
end if;
end if;
L.Dirty := True;
L.Last_Pt := L.Pt;
L.Update_Size;
end Add;
------------
-- Remove --
------------
procedure Remove (L : not null Layer.Ref) is
begin
if L.Next /= null then
L.Next.Prev := L.Prev;
end if;
if L.Prev /= null then
L.Prev.Next := L.Next;
else
if Layer_List = L then
Layer_List := L.Next;
else
raise Program_Error with "Layer not in the list";
end if;
end if;
L.Next := null;
L.Prev := null;
end Remove;
----------------
-- Remove_All --
----------------
procedure Remove_All is
L : Layer.Ref;
begin
while Layer_List /= null loop
L := Layer_List;
Layer_List := L.next;
L.Next := null;
L.Prev := null;
end loop;
end Remove_All;
-------------------
-- Render_Window --
-------------------
procedure Render_Window (Window : Pix_Rect;
Background : Output_Color;
Buffer : in out Output_Buffer;
Push_Pixels : Push_Pixels_Proc;
Set_Drawing_Area : Set_Drawing_Area_Proc)
is
C : Output_Color;
Index : Output_Buffer_Index := Buffer'First;
L : Layer.Ref;
PX : Integer;
PY : Integer;
begin
-- For each pixel that we want to render, we look for the color of that
-- pixel inside the first layer. If that color is not the Transparent
-- color, we push it to the screen, otherwise we look in the next layer.
--
-- Here is a one dimension example using characters for the output
-- 'color'. The | (pipe) symbol shows how the layers are traversed.
--
-- ||||||||||||||||||||||||||||||||||||||||||||||||||
-- Layer 1 : AAA|A|AAA|AA|AAA|AA||||AA|A|||||A||||||A|A|||||A|A
-- Layer 2 : BBBB | BBB BBBBBB|| BBBBB|BB|BBB||BBB||||| BB
-- Layer 3 : CCCCCCC | CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC||||CCC
-- Background: ##################################################
--
-- Output : AAABABAAA#AABAAABAABBCCAABABBBCBACBBBCCABAC#####ABA
Set_Drawing_Area (Window);
for Y in Window.TL.Y .. Window.BR.Y loop
for X in Window.TL.X .. Window.BR.X loop
C := Transparent;
L := Layer_List;
Layer_Loop : while L /= null loop
PX := X - L.Pt.X;
PY := Y - L.Pt.Y;
if PX in 0 .. L.A_Width - 1
and then
PY in 0 .. L.A_Height - 1
then
C := L.Pix (PX, PY);
if C /= Transparent then
exit Layer_Loop;
end if;
end if;
L := L.Next;
end loop Layer_Loop;
if C = Transparent then
C := Background;
end if;
Buffer (Index) := C;
if Index = Buffer'Last then
Push_Pixels (Buffer);
Index := Buffer'First;
else
Index := Index + 1;
end if;
end loop;
end loop;
-- Push the remaining pixels
if Index /= Buffer'First then
Push_Pixels (Buffer (Buffer'First .. Index - 1));
end if;
end Render_Window;
----------------
-- Render_All --
----------------
procedure Render_All (Screen_Rect : Pix_Rect;
Background : Output_Color;
Buffer : in out Output_Buffer;
Push_Pixels : Push_Pixels_Proc;
Set_Drawing_Area : Set_Drawing_Area_Proc)
is
L : Layer.Ref := Layer_List;
Min_X : constant Coordinate := Screen_Rect.TL.X;
Min_Y : constant Coordinate := Screen_Rect.TL.Y;
Max_X : constant Coordinate := Screen_Rect.BR.X;
Max_Y : constant Coordinate := Screen_Rect.BR.Y;
X0 : Coordinate := Max_X;
X1 : Coordinate := Min_X;
Y0 : Coordinate := Max_Y;
Y1 : Coordinate := Min_Y;
begin
-- Find the window that contains all the layers
while L /= null loop
X0 := Min (X0, L.Pt.X);
Y0 := Min (Y0, L.Pt.Y);
X1 := Max (X1, L.Pt.X + L.A_Width - 1);
Y1 := Max (Y1, L.Pt.Y + L.A_Height - 1);
L.Dirty := False;
L := L.Next;
end loop;
-- Apply screen limits
X0 := Max (Min_X, Min (Max_X, X0));
Y0 := Max (Min_Y, Min (Max_Y, Y0));
X1 := Max (Min_X, Min (Max_X, X1));
Y1 := Max (Min_Y, Min (Max_Y, Y1));
if X1 >= X0 and then Y1 >= Y0 then
Render_Window (((X0, Y0), (X1, Y1)),
Background,
Buffer,
Push_Pixels,
Set_Drawing_Area);
end if;
end Render_All;
------------------
-- Render_Dirty --
------------------
procedure Render_Dirty (Screen_Rect : Pix_Rect;
Background : Output_Color;
Buffer : in out Output_Buffer;
Push_Pixels : Push_Pixels_Proc;
Set_Drawing_Area : Set_Drawing_Area_Proc)
is
Min_X : Coordinate renames Screen_Rect.TL.X;
Min_Y : Coordinate renames Screen_Rect.TL.Y;
Max_X : Coordinate renames Screen_Rect.BR.X;
Max_Y : Coordinate renames Screen_Rect.BR.Y;
W, H : Lenght;
L : Layer.Ref := Layer_List;
X0, X1, Y0, Y1 : Integer;
begin
while L /= null loop
if L.Dirty then
-- Find the window that contains both the layer now and the layer
-- at its previous location.
W := L.A_Width;
H := L.A_Height;
X0 := Min (L.Last_Pt.X, L.Pt.X);
Y0 := Min (L.Last_Pt.Y, L.Pt.Y);
X1 := Max (L.Last_Pt.X + W, L.Pt.X + W - 1);
Y1 := Max (L.Last_Pt.Y + H, L.Pt.Y + H - 1);
-- Apply screen limits
X0 := Max (Min_X, Min (Max_X, X0));
Y0 := Max (Min_Y, Min (Max_Y, Y0));
X1 := Max (Min_X, Min (Max_X, X1));
Y1 := Max (Min_Y, Min (Max_Y, Y1));
-- Update that window if it is not empty
if X1 >= X0 and then Y1 >= Y0 then
Render_Window (((X0, Y0), (X1, Y1)),
Background,
Buffer,
Push_Pixels,
Set_Drawing_Area);
end if;
L.Last_Pt := L.Pt;
L.Dirty := False;
end if;
L := L.Next;
end loop;
end Render_Dirty;
--------------
-- Collides --
--------------
function Collides (Pt : Pix_Point) return Boolean is
L : Layer.Ref := Layer_List;
X : Integer;
Y : Integer;
begin
while L /= null loop
if L.Collisions_Enabled then
X := Pt.X - L.Pt.X;
Y := Pt.Y - L.Pt.Y;
if X in 0 .. L.A_Width - 1
and then
Y in 0 .. L.A_Height - 1
and then
L.Collides (X, Y)
then
return True;
end if;
end if;
L := L.Next;
end loop;
return False;
end Collides;
end GESTE;
|
-- reference:
-- http://www.unicode.org/reports/tr15/
with Ada.Characters.Conversions;
with Ada.Strings.Canonical_Composites;
with Ada.UCD;
package body Ada.Strings.Normalization is
use type UCD.UCS_4;
function Standard_Equal (Left, Right : Wide_Wide_String) return Boolean;
function Standard_Equal (Left, Right : Wide_Wide_String) return Boolean is
begin
return Left = Right;
end Standard_Equal;
function Standard_Less (Left, Right : Wide_Wide_String) return Boolean;
function Standard_Less (Left, Right : Wide_Wide_String) return Boolean is
begin
return Left < Right;
end Standard_Less;
-- NFD
procedure D_Buff (
Item : in out Wide_Wide_String;
Last : in out Natural;
Decomposed : out Boolean);
procedure D_Buff (
Item : in out Wide_Wide_String;
Last : in out Natural;
Decomposed : out Boolean) is
begin
Decomposed := False;
for I in reverse Item'First .. Last loop
declare
D : constant Natural := Canonical_Composites.D_Find (Item (I));
To : Canonical_Composites.Decomposed_Wide_Wide_String;
To_Length : Natural;
begin
if D > 0 then
To := Canonical_Composites.D_Map (D).To;
To_Length := Canonical_Composites.Decomposed_Length (To);
elsif Wide_Wide_Character'Pos (Item (I)) in
UCD.Hangul.SBase ..
UCD.Hangul.SBase + UCD.Hangul.SCount - 1
then
-- S to LV[T]
declare
SIndex : constant UCD.UCS_4 :=
Wide_Wide_Character'Pos (Item (I)) - UCD.Hangul.SBase;
L : constant UCD.UCS_4 :=
UCD.Hangul.LBase + SIndex / UCD.Hangul.NCount;
V : constant UCD.UCS_4 :=
UCD.Hangul.VBase
+ SIndex rem UCD.Hangul.NCount / UCD.Hangul.TCount;
T : constant UCD.UCS_4 :=
UCD.Hangul.TBase + SIndex rem UCD.Hangul.TCount;
begin
To (1) := Wide_Wide_Character'Val (L);
To (2) := Wide_Wide_Character'Val (V);
To_Length := 2;
if T /= UCD.Hangul.TBase then
To (3) := Wide_Wide_Character'Val (T);
To_Length := 3;
end if;
end;
else
goto Continue;
end if;
-- replacing
Decomposed := True;
Item (I + To_Length .. Last + To_Length - 1) :=
Item (I + 1 .. Last);
Item (I .. I + To_Length - 1) := To (1 .. To_Length);
Last := Last + To_Length - 1;
end;
<<Continue>>
null;
end loop;
end D_Buff;
-- NFC
procedure C_Buff (
Item : in out Wide_Wide_String;
Last : in out Natural;
Composed : out Boolean);
procedure C_Buff (
Item : in out Wide_Wide_String;
Last : in out Natural;
Composed : out Boolean) is
begin
Composed := False;
for I in reverse Item'First .. Last - 1 loop
Process_After_Index : loop
declare
From : constant
Canonical_Composites.Composing_Wide_Wide_String :=
(Item (I), Item (I + 1));
C : constant Natural := Canonical_Composites.C_Find (From);
To : Wide_Wide_Character;
begin
if C > 0 then
To := Canonical_Composites.C_Map (C).To;
elsif Wide_Wide_Character'Pos (From (1)) in
UCD.Hangul.LBase ..
UCD.Hangul.LBase + UCD.Hangul.LCount - 1
and then Wide_Wide_Character'Pos (From (2)) in
UCD.Hangul.VBase ..
UCD.Hangul.VBase + UCD.Hangul.VCount - 1
then
-- LV to S
declare
LIndex : constant UCD.UCS_4 :=
Wide_Wide_Character'Pos (From (1))
- UCD.Hangul.LBase;
VIndex : constant UCD.UCS_4 :=
Wide_Wide_Character'Pos (From (2))
- UCD.Hangul.VBase;
begin
To := Wide_Wide_Character'Val (
UCD.Hangul.SBase
+ (LIndex * UCD.Hangul.VCount + VIndex)
* UCD.Hangul.TCount);
end;
elsif Wide_Wide_Character'Pos (From (1)) in
UCD.Hangul.SBase ..
UCD.Hangul.SBase + UCD.Hangul.SCount - 1
and then Wide_Wide_Character'Pos (From (2)) in
UCD.Hangul.TBase ..
UCD.Hangul.TBase + UCD.Hangul.TCount - 1
then
-- ST to T
declare
ch : constant UCD.UCS_4 :=
Wide_Wide_Character'Pos (From (1));
TIndex : constant UCD.UCS_4 :=
Wide_Wide_Character'Pos (From (2)) - UCD.Hangul.TBase;
begin
To := Wide_Wide_Character'Val (ch + TIndex);
end;
else
exit Process_After_Index;
end if;
-- replacing
Composed := True;
Item (I) := To;
Last := Last - 1;
exit Process_After_Index when Last <= I;
Item (I + 1 .. Last) := Item (I + 2 .. Last + 1);
end;
end loop Process_After_Index;
end loop;
end C_Buff;
generic
type Character_Type is (<>);
type String_Type is array (Positive range <>) of Character_Type;
Max_Length : Positive;
with procedure Get (
Data : String_Type;
Last : out Natural;
Result : out Wide_Wide_Character;
Is_Illegal_Sequence : out Boolean);
with procedure Put (
Code : Wide_Wide_Character;
Result : out String_Type;
Last : out Natural);
with procedure Get_Combined (
State : in out Composites.State;
Item : String_Type;
Last : out Natural;
Is_Illegal_Sequence : out Boolean);
package Generic_Normalization is
procedure Decode (
Item : String_Type;
Buffer : out Wide_Wide_String;
Buffer_Last : out Natural);
procedure Encode (
Item : Wide_Wide_String;
Buffer : out String_Type;
Buffer_Last : out Natural);
procedure Decompose_No_Length_Check (
State : in out Composites.State;
Item : String_Type;
Last : out Natural;
Out_Item : out String_Type;
Out_Last : out Natural);
procedure Compose_No_Length_Check (
State : in out Composites.State;
Item : String_Type;
Last : out Natural;
Out_Item : out String_Type;
Out_Last : out Natural);
end Generic_Normalization;
package body Generic_Normalization is
procedure Decode (
Item : String_Type;
Buffer : out Wide_Wide_String;
Buffer_Last : out Natural)
is
Last : Natural := Item'First - 1;
Code : Wide_Wide_Character;
Is_Illegal_Sequence : Boolean; -- ignore
begin
Buffer_Last := Buffer'First - 1;
while Last < Item'Last loop
Get (
Item (Last + 1 .. Item'Last),
Last,
Code,
Is_Illegal_Sequence);
Buffer_Last := Buffer_Last + 1;
Buffer (Buffer_Last) := Code;
end loop;
end Decode;
procedure Encode (
Item : Wide_Wide_String;
Buffer : out String_Type;
Buffer_Last : out Natural) is
begin
Buffer_Last := Buffer'First - 1;
for I in Item'Range loop
Put (
Item (I),
Buffer (Buffer_Last + 1 .. Buffer'Last),
Buffer_Last);
end loop;
end Encode;
procedure Decompose_No_Length_Check (
State : in out Composites.State;
Item : String_Type;
Last : out Natural;
Out_Item : out String_Type;
Out_Last : out Natural)
is
Is_Illegal_Sequence : Boolean;
begin
-- get one combining character sequence
Get_Combined (State, Item, Last, Is_Illegal_Sequence);
if not Is_Illegal_Sequence then
-- normalization
declare
Decomposed : Boolean;
Buffer : Wide_Wide_String (
1 ..
Expanding * Max_Length * (Last - Item'First + 1));
Buffer_Last : Natural;
begin
-- decoding
Decode (
Item (Item'First .. Last),
Buffer,
Buffer_Last);
-- decomposing
D_Buff (Buffer, Buffer_Last, Decomposed);
-- encoding
if Decomposed then
Encode (Buffer (1 .. Buffer_Last), Out_Item, Out_Last);
return;
end if;
end;
end if;
Out_Last := Out_Item'First + (Last - Item'First);
Out_Item (Out_Item'First .. Out_Last) := Item (Item'First .. Last);
end Decompose_No_Length_Check;
procedure Compose_No_Length_Check (
State : in out Composites.State;
Item : String_Type;
Last : out Natural;
Out_Item : out String_Type;
Out_Last : out Natural)
is
Is_Illegal_Sequence : Boolean;
begin
-- get one combining character sequence
Get_Combined (State, Item, Last, Is_Illegal_Sequence);
if not Is_Illegal_Sequence then
-- normalization
declare
Decomposed : Boolean;
Composed : Boolean;
Buffer : Wide_Wide_String (
1 ..
Expanding * Max_Length * (Last - Item'First + 1));
Buffer_Last : Natural;
begin
-- decoding
Decode (
Item (Item'First .. Last),
Buffer,
Buffer_Last);
-- first, decomposing
D_Buff (Buffer, Buffer_Last, Decomposed);
-- next, composing
C_Buff (Buffer, Buffer_Last, Composed);
-- encoding
if Decomposed or else Composed then
Encode (Buffer (1 .. Buffer_Last), Out_Item, Out_Last);
return;
end if;
end;
end if;
Out_Last := Out_Item'First + (Last - Item'First);
Out_Item (Out_Item'First .. Out_Last) := Item (Item'First .. Last);
end Compose_No_Length_Check;
end Generic_Normalization;
generic
type Character_Type is (<>);
type String_Type is array (Positive range <>) of Character_Type;
with package N is
new Generic_Normalization (Character_Type, String_Type, others => <>);
with procedure Start (Item : String_Type; State : out Composites.State);
procedure Generic_Decompose (
Item : String_Type;
Last : out Natural;
Out_Item : out String_Type;
Out_Last : out Natural);
procedure Generic_Decompose (
Item : String_Type;
Last : out Natural;
Out_Item : out String_Type;
Out_Last : out Natural) is
begin
if Item'Length = 0 then
Last := Item'First - 1;
Out_Last := Out_Item'First - 1;
else
Canonical_Composites.Initialize_D;
declare
St : Composites.State;
begin
Start (Item, St);
N.Decompose_No_Length_Check (St, Item, Last, Out_Item, Out_Last);
end;
end if;
end Generic_Decompose;
generic
type Character_Type is (<>);
type String_Type is array (Positive range <>) of Character_Type;
with package N is
new Generic_Normalization (Character_Type, String_Type, others => <>);
procedure Generic_Decompose_With_State (
State : in out Composites.State;
Item : String_Type;
Last : out Natural;
Out_Item : out String_Type;
Out_Last : out Natural);
procedure Generic_Decompose_With_State (
State : in out Composites.State;
Item : String_Type;
Last : out Natural;
Out_Item : out String_Type;
Out_Last : out Natural) is
begin
if Item'Length = 0 then
-- finished
Last := Item'Last;
State.Next_Character := Wide_Wide_Character'Val (0);
State.Next_Combining_Class := 0;
State.Next_Is_Illegal_Sequence := False;
State.Next_Last := Last;
Out_Last := Out_Item'First - 1;
else
Canonical_Composites.Initialize_D;
N.Decompose_No_Length_Check (State, Item, Last, Out_Item, Out_Last);
end if;
end Generic_Decompose_With_State;
generic
type Character_Type is (<>);
type String_Type is array (Positive range <>) of Character_Type;
with package N is
new Generic_Normalization (Character_Type, String_Type, others => <>);
with procedure Start (Item : String_Type; State : out Composites.State);
procedure Generic_Decompose_All (
Item : String_Type;
Out_Item : out String_Type;
Out_Last : out Natural);
procedure Generic_Decompose_All (
Item : String_Type;
Out_Item : out String_Type;
Out_Last : out Natural) is
begin
Out_Last := Out_Item'First - 1;
if Item'Length > 0 then
Canonical_Composites.Initialize_D;
declare
St : Composites.State;
Last : Natural := Item'First - 1;
begin
Start (Item, St);
while Last < Item'Last loop
N.Decompose_No_Length_Check (
St,
Item (Last + 1 .. Item'Last),
Last,
Out_Item (Out_Last + 1 .. Out_Item'Last),
Out_Last);
end loop;
end;
end if;
end Generic_Decompose_All;
generic
type Character_Type is (<>);
type String_Type is array (Positive range <>) of Character_Type;
with package N is
new Generic_Normalization (Character_Type, String_Type, others => <>);
with procedure Decompose (
Item : String_Type;
Out_Item : out String_Type;
Out_Last : out Natural);
function Generic_Decompose_All_Func (Item : String_Type)
return String_Type;
function Generic_Decompose_All_Func (Item : String_Type)
return String_Type
is
Result : String_Type (1 .. Expanding * N.Max_Length * Item'Length);
Result_Last : Natural := Result'First - 1;
begin
Decompose (Item, Result, Result_Last);
return Result (Result'First .. Result_Last);
end Generic_Decompose_All_Func;
generic
type Character_Type is (<>);
type String_Type is array (Positive range <>) of Character_Type;
with package N is
new Generic_Normalization (Character_Type, String_Type, others => <>);
with procedure Start (Item : String_Type; State : out Composites.State);
procedure Generic_Compose (
Item : String_Type;
Last : out Natural;
Out_Item : out String_Type;
Out_Last : out Natural);
procedure Generic_Compose (
Item : String_Type;
Last : out Natural;
Out_Item : out String_Type;
Out_Last : out Natural) is
begin
if Item'Length = 0 then
Last := Item'First - 1;
Out_Last := Out_Item'First - 1;
else
Canonical_Composites.Initialize_C;
declare
St : Composites.State;
begin
Start (Item, St);
N.Compose_No_Length_Check (St, Item, Last, Out_Item, Out_Last);
end;
end if;
end Generic_Compose;
generic
type Character_Type is (<>);
type String_Type is array (Positive range <>) of Character_Type;
with package N is
new Generic_Normalization (Character_Type, String_Type, others => <>);
procedure Generic_Compose_With_State (
State : in out Composites.State;
Item : String_Type;
Last : out Natural;
Out_Item : out String_Type;
Out_Last : out Natural);
procedure Generic_Compose_With_State (
State : in out Composites.State;
Item : String_Type;
Last : out Natural;
Out_Item : out String_Type;
Out_Last : out Natural) is
begin
if Item'Length = 0 then
-- finished
Last := Item'Last;
State.Next_Character := Wide_Wide_Character'Val (0);
State.Next_Combining_Class := 0;
State.Next_Is_Illegal_Sequence := False;
State.Next_Last := Last;
Out_Last := Out_Item'First - 1;
else
Canonical_Composites.Initialize_C;
N.Compose_No_Length_Check (State, Item, Last, Out_Item, Out_Last);
end if;
end Generic_Compose_With_State;
generic
type Character_Type is (<>);
type String_Type is array (Positive range <>) of Character_Type;
with package N is
new Generic_Normalization (Character_Type, String_Type, others => <>);
with procedure Start (Item : String_Type; State : out Composites.State);
procedure Generic_Compose_All (
Item : String_Type;
Out_Item : out String_Type;
Out_Last : out Natural);
procedure Generic_Compose_All (
Item : String_Type;
Out_Item : out String_Type;
Out_Last : out Natural) is
begin
Out_Last := Out_Item'First - 1;
if Item'Length > 0 then
Canonical_Composites.Initialize_C;
declare
St : Composites.State;
Last : Natural := Item'First - 1;
begin
Start (Item, St);
while Last < Item'Last loop
N.Compose_No_Length_Check (
St,
Item (Last + 1 .. Item'Last),
Last,
Out_Item (Out_Last + 1 .. Out_Item'Last),
Out_Last);
end loop;
end;
end if;
end Generic_Compose_All;
generic
type Character_Type is (<>);
type String_Type is array (Positive range <>) of Character_Type;
with package N is
new Generic_Normalization (Character_Type, String_Type, others => <>);
with procedure Compose (
Item : String_Type;
Out_Item : out String_Type;
Out_Last : out Natural);
function Generic_Compose_All_Func (Item : String_Type) return String_Type;
function Generic_Compose_All_Func (Item : String_Type) return String_Type is
Result : String_Type (1 .. Expanding * N.Max_Length * Item'Length);
Result_Last : Natural := Result'First - 1;
begin
Compose (Item, Result, Result_Last);
return Result (Result'First .. Result_Last);
end Generic_Compose_All_Func;
generic
type Character_Type is (<>);
type String_Type is array (Positive range <>) of Character_Type;
with function Equal (
Left, Right : String_Type;
Equal_Combined : not null access function (
Left, Right : Wide_Wide_String)
return Boolean)
return Boolean;
function Generic_Equal (Left, Right : String_Type) return Boolean;
function Generic_Equal (Left, Right : String_Type) return Boolean is
begin
return Equal (Left, Right, Standard_Equal'Access);
end Generic_Equal;
generic
type Character_Type is (<>);
type String_Type is array (Positive range <>) of Character_Type;
with package N is
new Generic_Normalization (Character_Type, String_Type, others => <>);
with procedure Start (Item : String_Type; State : out Composites.State);
function Generic_Equal_With_Comparator (
Left, Right : String_Type;
Equal_Combined : not null access function (
Left, Right : Wide_Wide_String)
return Boolean)
return Boolean;
function Generic_Equal_With_Comparator (
Left, Right : String_Type;
Equal_Combined : not null access function (
Left, Right : Wide_Wide_String)
return Boolean)
return Boolean is
begin
if Left'Length = 0 then
return Right'Length = 0;
elsif Right'Length = 0 then
return False;
end if;
Canonical_Composites.Initialize_D;
declare
Left_State : Composites.State;
Left_Last : Natural := Left'First - 1;
Right_State : Composites.State;
Right_Last : Natural := Right'First - 1;
begin
Start (Left, Left_State);
Start (Right, Right_State);
loop
-- get one combining character sequence
declare
Left_First : constant Positive := Left_Last + 1;
Right_First : constant Positive := Right_Last + 1;
Left_Is_Illegal_Sequence : Boolean;
Right_Is_Illegal_Sequence : Boolean;
begin
N.Get_Combined (
Left_State,
Left (Left_First .. Left'Last),
Left_Last,
Left_Is_Illegal_Sequence);
N.Get_Combined (
Right_State,
Right (Right_First .. Right'Last),
Right_Last,
Right_Is_Illegal_Sequence);
if not Left_Is_Illegal_Sequence then
if not Right_Is_Illegal_Sequence then
-- left and right are legal
declare
Left_Buffer : Wide_Wide_String (
1 ..
Expanding
* N.Max_Length
* (Left_Last - Left_First + 1));
Left_Buffer_Last : Natural;
Left_Decomposed : Boolean; -- ignore
Right_Buffer : Wide_Wide_String (
1 ..
Expanding
* N.Max_Length
* (Right_Last - Right_First + 1));
Right_Buffer_Last : Natural;
Right_Decomposed : Boolean; -- ignore
begin
N.Decode (
Left (Left_First .. Left_Last),
Left_Buffer,
Left_Buffer_Last);
D_Buff (
Left_Buffer,
Left_Buffer_Last,
Left_Decomposed);
N.Decode (
Right (Right_First .. Right_Last),
Right_Buffer,
Right_Buffer_Last);
D_Buff (
Right_Buffer,
Right_Buffer_Last,
Right_Decomposed);
if not Equal_Combined (
Left_Buffer (1 .. Left_Buffer_Last),
Right_Buffer (1 .. Right_Buffer_Last))
then
return False;
end if;
end;
else
-- left is legal, right is illegal
return False;
end if;
else
if not Right_Is_Illegal_Sequence then
-- left is illegal, right is legal
return False;
else
-- left and right are illegal
if Left (Left_First .. Left_Last) /=
Right (Right_First .. Right_Last)
then
return False;
end if;
end if;
end if;
end;
-- detect ends
if Left_Last >= Left'Last then
return Right_Last >= Right'Last;
elsif Right_Last >= Right'Last then
return False;
end if;
end loop;
end;
end Generic_Equal_With_Comparator;
generic
type Character_Type is (<>);
type String_Type is array (Positive range <>) of Character_Type;
with function Less (
Left, Right : String_Type;
Less_Combined : not null access function (
Left, Right : Wide_Wide_String)
return Boolean)
return Boolean;
function Generic_Less (Left, Right : String_Type) return Boolean;
function Generic_Less (Left, Right : String_Type) return Boolean is
begin
return Less (Left, Right, Standard_Less'Access);
end Generic_Less;
generic
type Character_Type is (<>);
type String_Type is array (Positive range <>) of Character_Type;
with package N is
new Generic_Normalization (Character_Type, String_Type, others => <>);
with procedure Start (Item : String_Type; State : out Composites.State);
function Generic_Less_With_Comparator (
Left, Right : String_Type;
Less_Combined : not null access function (
Left, Right : Wide_Wide_String)
return Boolean)
return Boolean;
function Generic_Less_With_Comparator (
Left, Right : String_Type;
Less_Combined : not null access function (
Left, Right : Wide_Wide_String)
return Boolean)
return Boolean is
begin
if Left'Length = 0 then
return Right'Length > 0;
elsif Right'Length = 0 then
return False;
end if;
Canonical_Composites.Initialize_D;
declare
Left_State : Composites.State;
Left_Last : Natural := Left'First - 1;
Right_State : Composites.State;
Right_Last : Natural := Right'First - 1;
begin
Start (Left, Left_State);
Start (Right, Right_State);
loop
-- get one combining character sequence
declare
Left_First : constant Positive := Left_Last + 1;
Right_First : constant Positive := Right_Last + 1;
Left_Is_Illegal_Sequence : Boolean;
Right_Is_Illegal_Sequence : Boolean;
begin
N.Get_Combined (
Left_State,
Left (Left_First .. Left'Last),
Left_Last,
Left_Is_Illegal_Sequence);
N.Get_Combined (
Right_State,
Right (Right_First .. Right'Last),
Right_Last,
Right_Is_Illegal_Sequence);
if not Left_Is_Illegal_Sequence then
if not Right_Is_Illegal_Sequence then
-- left and right are legal
declare
Left_Buffer : Wide_Wide_String (
1 ..
Expanding
* N.Max_Length
* (Left_Last - Left_First + 1));
Left_Buffer_Last : Natural;
Left_Decomposed : Boolean; -- ignore
Right_Buffer : Wide_Wide_String (
1 ..
Expanding
* N.Max_Length
* (Right_Last - Right_First + 1));
Right_Buffer_Last : Natural;
Right_Decomposed : Boolean; -- ignore
begin
N.Decode (
Left (Left_First .. Left_Last),
Left_Buffer,
Left_Buffer_Last);
D_Buff (
Left_Buffer,
Left_Buffer_Last,
Left_Decomposed);
N.Decode (
Right (Right_First .. Right_Last),
Right_Buffer,
Right_Buffer_Last);
D_Buff (
Right_Buffer,
Right_Buffer_Last,
Right_Decomposed);
if Less_Combined (
Left_Buffer (1 .. Left_Buffer_Last),
Right_Buffer (1 .. Right_Buffer_Last))
then
return True;
elsif Less_Combined (
Right_Buffer (1 .. Right_Buffer_Last),
Left_Buffer (1 .. Left_Buffer_Last))
then
return False;
end if;
end;
else
-- left is legal, right is illegal
return True;
end if;
else
if not Right_Is_Illegal_Sequence then
-- left is illegal, right is legal
return False;
else
-- left and right are illegal
if Left (Left_First .. Left_Last) <
Right (Right_First .. Right_Last)
then
return True;
elsif Left (Left_First .. Left_Last) <
Right (Right_First .. Right_Last)
then
return False;
end if;
end if;
end if;
end;
-- detect ends
if Left_Last >= Left'Last then
return Right_Last < Right'Last;
elsif Right_Last >= Right'Last then
return False;
end if;
end loop;
end;
end Generic_Less_With_Comparator;
package Strings is
new Generic_Normalization (
Character,
String,
Characters.Conversions.Max_Length_In_String,
Characters.Conversions.Get,
Characters.Conversions.Put,
Composites.Get_Combined);
package Wide_Strings is
new Generic_Normalization (
Wide_Character,
Wide_String,
Characters.Conversions.Max_Length_In_Wide_String,
Characters.Conversions.Get,
Characters.Conversions.Put,
Composites.Get_Combined);
package Wide_Wide_Strings is
new Generic_Normalization (
Wide_Wide_Character,
Wide_Wide_String,
Characters.Conversions.Max_Length_In_Wide_Wide_String, -- 1
Characters.Conversions.Get,
Characters.Conversions.Put,
Composites.Get_Combined);
-- implementation
procedure Iterate (
Expanded : Boolean;
Process : not null access procedure (
Precomposed : Wide_Wide_Character;
Decomposed : Wide_Wide_String))
is
procedure Do_Iterate (
Map : Canonical_Composites.D_Map_Array;
Process : not null access procedure (
Precomposed : Wide_Wide_Character;
Decomposed : Wide_Wide_String));
procedure Do_Iterate (
Map : Canonical_Composites.D_Map_Array;
Process : not null access procedure (
Precomposed : Wide_Wide_Character;
Decomposed : Wide_Wide_String)) is
begin
for I in Map'Range loop
declare
E : Canonical_Composites.D_Map_Element renames Map (I);
Decomposed_Length : constant Natural :=
Canonical_Composites.Decomposed_Length (E.To);
begin
Process (E.From, E.To (1 .. Decomposed_Length));
end;
end loop;
end Do_Iterate;
begin
if Expanded then
Canonical_Composites.Initialize_D;
Do_Iterate (Canonical_Composites.D_Map.all, Process);
else
Canonical_Composites.Initialize_Unexpanded_D;
Do_Iterate (Canonical_Composites.Unexpanded_D_Map.all, Process);
end if;
end Iterate;
procedure Decompose (
Item : String;
Last : out Natural;
Out_Item : out String;
Out_Last : out Natural)
is
procedure Decompose_String is
new Generic_Decompose (Character, String, Strings, Composites.Start);
begin
Decompose_String (Item, Last, Out_Item, Out_Last);
end Decompose;
procedure Decompose (
State : in out Composites.State;
Item : String;
Last : out Natural;
Out_Item : out String;
Out_Last : out Natural)
is
procedure Decompose_String is
new Generic_Decompose_With_State (Character, String, Strings);
begin
Decompose_String (State, Item, Last, Out_Item, Out_Last);
end Decompose;
procedure Decompose (
Item : Wide_String;
Last : out Natural;
Out_Item : out Wide_String;
Out_Last : out Natural)
is
procedure Decompose_Wide_String is
new Generic_Decompose (
Wide_Character,
Wide_String,
Wide_Strings,
Composites.Start);
begin
Decompose_Wide_String (Item, Last, Out_Item, Out_Last);
end Decompose;
procedure Decompose (
State : in out Composites.State;
Item : Wide_String;
Last : out Natural;
Out_Item : out Wide_String;
Out_Last : out Natural)
is
procedure Decompose_Wide_String is
new Generic_Decompose_With_State (
Wide_Character,
Wide_String,
Wide_Strings);
begin
Decompose_Wide_String (State, Item, Last, Out_Item, Out_Last);
end Decompose;
procedure Decompose (
Item : Wide_Wide_String;
Last : out Natural;
Out_Item : out Wide_Wide_String;
Out_Last : out Natural)
is
procedure Decompose_Wide_Wide_String is
new Generic_Decompose (
Wide_Wide_Character,
Wide_Wide_String,
Wide_Wide_Strings,
Composites.Start);
begin
Decompose_Wide_Wide_String (Item, Last, Out_Item, Out_Last);
end Decompose;
procedure Decompose (
State : in out Composites.State;
Item : Wide_Wide_String;
Last : out Natural;
Out_Item : out Wide_Wide_String;
Out_Last : out Natural)
is
procedure Decompose_Wide_Wide_String is
new Generic_Decompose_With_State (
Wide_Wide_Character,
Wide_Wide_String,
Wide_Wide_Strings);
begin
Decompose_Wide_Wide_String (State, Item, Last, Out_Item, Out_Last);
end Decompose;
procedure Decompose (
Item : String;
Out_Item : out String;
Out_Last : out Natural)
is
procedure Decompose_String is
new Generic_Decompose_All (
Character,
String,
Strings,
Composites.Start);
pragma Inline_Always (Decompose_String);
begin
Decompose_String (Item, Out_Item, Out_Last);
end Decompose;
function Decompose (Item : String) return String is
function Decompose_String is
new Generic_Decompose_All_Func (
Character,
String,
Strings,
Decompose);
begin
return Decompose_String (Item);
end Decompose;
procedure Decompose (
Item : Wide_String;
Out_Item : out Wide_String;
Out_Last : out Natural)
is
procedure Decompose_Wide_String is
new Generic_Decompose_All (
Wide_Character,
Wide_String,
Wide_Strings,
Composites.Start);
pragma Inline_Always (Decompose_Wide_String);
begin
Decompose_Wide_String (Item, Out_Item, Out_Last);
end Decompose;
function Decompose (Item : Wide_String) return Wide_String is
function Decompose_Wide_String is
new Generic_Decompose_All_Func (
Wide_Character,
Wide_String,
Wide_Strings,
Decompose);
begin
return Decompose_Wide_String (Item);
end Decompose;
procedure Decompose (
Item : Wide_Wide_String;
Out_Item : out Wide_Wide_String;
Out_Last : out Natural)
is
procedure Decompose_Wide_Wide_String is
new Generic_Decompose_All (
Wide_Wide_Character,
Wide_Wide_String,
Wide_Wide_Strings,
Composites.Start);
pragma Inline_Always (Decompose_Wide_Wide_String);
begin
Decompose_Wide_Wide_String (Item, Out_Item, Out_Last);
end Decompose;
function Decompose (Item : Wide_Wide_String) return Wide_Wide_String is
function Decompose_Wide_Wide_String is
new Generic_Decompose_All_Func (
Wide_Wide_Character,
Wide_Wide_String,
Wide_Wide_Strings,
Decompose);
begin
return Decompose_Wide_Wide_String (Item);
end Decompose;
procedure Compose (
Item : String;
Last : out Natural;
Out_Item : out String;
Out_Last : out Natural)
is
procedure Compose_String is
new Generic_Compose (Character, String, Strings, Composites.Start);
begin
Compose_String (Item, Last, Out_Item, Out_Last);
end Compose;
procedure Compose (
State : in out Composites.State;
Item : String;
Last : out Natural;
Out_Item : out String;
Out_Last : out Natural)
is
procedure Compose_String is
new Generic_Compose_With_State (Character, String, Strings);
begin
Compose_String (State, Item, Last, Out_Item, Out_Last);
end Compose;
procedure Compose (
Item : Wide_String;
Last : out Natural;
Out_Item : out Wide_String;
Out_Last : out Natural)
is
procedure Compose_Wide_String is
new Generic_Compose (
Wide_Character,
Wide_String,
Wide_Strings,
Composites.Start);
begin
Compose_Wide_String (Item, Last, Out_Item, Out_Last);
end Compose;
procedure Compose (
State : in out Composites.State;
Item : Wide_String;
Last : out Natural;
Out_Item : out Wide_String;
Out_Last : out Natural)
is
procedure Compose_Wide_String is
new Generic_Compose_With_State (
Wide_Character,
Wide_String,
Wide_Strings);
begin
Compose_Wide_String (State, Item, Last, Out_Item, Out_Last);
end Compose;
procedure Compose (
Item : Wide_Wide_String;
Last : out Natural;
Out_Item : out Wide_Wide_String;
Out_Last : out Natural)
is
procedure Compose_Wide_Wide_String is
new Generic_Compose (
Wide_Wide_Character,
Wide_Wide_String,
Wide_Wide_Strings,
Composites.Start);
begin
Compose_Wide_Wide_String (Item, Last, Out_Item, Out_Last);
end Compose;
procedure Compose (
State : in out Composites.State;
Item : Wide_Wide_String;
Last : out Natural;
Out_Item : out Wide_Wide_String;
Out_Last : out Natural)
is
procedure Compose_Wide_Wide_String is
new Generic_Compose_With_State (
Wide_Wide_Character,
Wide_Wide_String,
Wide_Wide_Strings);
begin
Compose_Wide_Wide_String (State, Item, Last, Out_Item, Out_Last);
end Compose;
procedure Compose (
Item : String;
Out_Item : out String;
Out_Last : out Natural)
is
procedure Compose_String is
new Generic_Compose_All (
Character,
String,
Strings,
Composites.Start);
pragma Inline_Always (Compose_String);
begin
Compose_String (Item, Out_Item, Out_Last);
end Compose;
function Compose (Item : String) return String is
function Compose_String is
new Generic_Compose_All_Func (Character, String, Strings, Compose);
begin
return Compose_String (Item);
end Compose;
procedure Compose (
Item : Wide_String;
Out_Item : out Wide_String;
Out_Last : out Natural)
is
procedure Compose_Wide_String is
new Generic_Compose_All (
Wide_Character,
Wide_String,
Wide_Strings,
Composites.Start);
pragma Inline_Always (Compose_Wide_String);
begin
Compose_Wide_String (Item, Out_Item, Out_Last);
end Compose;
function Compose (Item : Wide_String) return Wide_String is
function Compose_Wide_String is
new Generic_Compose_All_Func (
Wide_Character,
Wide_String,
Wide_Strings,
Compose);
begin
return Compose_Wide_String (Item);
end Compose;
procedure Compose (
Item : Wide_Wide_String;
Out_Item : out Wide_Wide_String;
Out_Last : out Natural)
is
procedure Compose_Wide_Wide_String is
new Generic_Compose_All (
Wide_Wide_Character,
Wide_Wide_String,
Wide_Wide_Strings,
Composites.Start);
pragma Inline_Always (Compose_Wide_Wide_String);
begin
Compose_Wide_Wide_String (Item, Out_Item, Out_Last);
end Compose;
function Compose (Item : Wide_Wide_String) return Wide_Wide_String is
function Compose_Wide_Wide_String is
new Generic_Compose_All_Func (
Wide_Wide_Character,
Wide_Wide_String,
Wide_Wide_Strings,
Compose);
begin
return Compose_Wide_Wide_String (Item);
end Compose;
function Equal (Left, Right : String) return Boolean is
function Equal_String is new Generic_Equal (Character, String, Equal);
begin
return Equal_String (Left, Right);
end Equal;
function Equal (
Left, Right : String;
Equal_Combined : not null access function (
Left, Right : Wide_Wide_String)
return Boolean)
return Boolean
is
function Equal_String is
new Generic_Equal_With_Comparator (
Character,
String,
Strings,
Composites.Start);
pragma Inline_Always (Equal_String);
begin
return Equal_String (Left, Right, Equal_Combined);
end Equal;
function Equal (Left, Right : Wide_String) return Boolean is
function Equal_Wide_String is
new Generic_Equal (Wide_Character, Wide_String, Equal);
begin
return Equal_Wide_String (Left, Right);
end Equal;
function Equal (
Left, Right : Wide_String;
Equal_Combined : not null access function (
Left, Right : Wide_Wide_String)
return Boolean)
return Boolean
is
function Equal_Wide_String is
new Generic_Equal_With_Comparator (
Wide_Character,
Wide_String,
Wide_Strings,
Composites.Start);
pragma Inline_Always (Equal_Wide_String);
begin
return Equal_Wide_String (Left, Right, Equal_Combined);
end Equal;
function Equal (Left, Right : Wide_Wide_String) return Boolean is
function Equal_Wide_Wide_String is
new Generic_Equal (Wide_Wide_Character, Wide_Wide_String, Equal);
begin
return Equal_Wide_Wide_String (Left, Right);
end Equal;
function Equal (
Left, Right : Wide_Wide_String;
Equal_Combined : not null access function (
Left, Right : Wide_Wide_String)
return Boolean)
return Boolean
is
function Equal_Wide_Wide_String is
new Generic_Equal_With_Comparator (
Wide_Wide_Character,
Wide_Wide_String,
Wide_Wide_Strings,
Composites.Start);
pragma Inline_Always (Equal_Wide_Wide_String);
begin
return Equal_Wide_Wide_String (Left, Right, Equal_Combined);
end Equal;
function Less (Left, Right : String) return Boolean is
function Less_String is new Generic_Less (Character, String, Less);
begin
return Less_String (Left, Right);
end Less;
function Less (
Left, Right : String;
Less_Combined : not null access function (
Left, Right : Wide_Wide_String)
return Boolean)
return Boolean
is
function Less_String is
new Generic_Less_With_Comparator (
Character,
String,
Strings,
Composites.Start);
pragma Inline_Always (Less_String);
begin
return Less_String (Left, Right, Less_Combined);
end Less;
function Less (Left, Right : Wide_String) return Boolean is
function Less_Wide_String is
new Generic_Less (Wide_Character, Wide_String, Less);
begin
return Less_Wide_String (Left, Right);
end Less;
function Less (
Left, Right : Wide_String;
Less_Combined : not null access function (
Left, Right : Wide_Wide_String)
return Boolean)
return Boolean
is
function Less_Wide_String is
new Generic_Less_With_Comparator (
Wide_Character,
Wide_String,
Wide_Strings,
Composites.Start);
pragma Inline_Always (Less_Wide_String);
begin
return Less_Wide_String (Left, Right, Less_Combined);
end Less;
function Less (Left, Right : Wide_Wide_String) return Boolean is
function Less_Wide_Wide_String is
new Generic_Less (Wide_Wide_Character, Wide_Wide_String, Less);
begin
return Less_Wide_Wide_String (Left, Right);
end Less;
function Less (
Left, Right : Wide_Wide_String;
Less_Combined : not null access function (
Left, Right : Wide_Wide_String)
return Boolean)
return Boolean
is
function Less_Wide_Wide_String is
new Generic_Less_With_Comparator (
Wide_Wide_Character,
Wide_Wide_String,
Wide_Wide_Strings,
Composites.Start);
pragma Inline_Always (Less_Wide_Wide_String);
begin
return Less_Wide_Wide_String (Left, Right, Less_Combined);
end Less;
end Ada.Strings.Normalization;
|
package TLSF.Block with SPARK_Mode, Pure, Preelaborate is
end TLSF.Block;
|
package body System.Interrupt_Numbers is
function Is_Reserved (Interrupt : C.signed_int) return Boolean is
begin
return Interrupt not in First_Interrupt_Id .. Last_Interrupt_Id;
-- SIGKILL and SIGSTOP are not declared in mingw
end Is_Reserved;
end System.Interrupt_Numbers;
|
with Ada.Text_IO;
use Ada.Text_IO;
procedure Demo2 is
-- type Arr_Type is array(1..1000) of String;
procedure proceed(Arg1: in Arr_Type) is
begin
-- <program body>
Put_Line("second line");
end proceed;
begin
-- call to proceed
Put_Line("second line");
end Demo2;
|
-- This spec has been automatically generated from STM32F103.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.SCB is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CPUID_Revision_Field is STM32_SVD.UInt4;
subtype CPUID_PartNo_Field is STM32_SVD.UInt12;
subtype CPUID_Constant_Field is STM32_SVD.UInt4;
subtype CPUID_Variant_Field is STM32_SVD.UInt4;
subtype CPUID_Implementer_Field is STM32_SVD.Byte;
-- CPUID base register
type CPUID_Register is record
-- Read-only. Revision number
Revision : CPUID_Revision_Field;
-- Read-only. Part number of the processor
PartNo : CPUID_PartNo_Field;
-- Read-only. Reads as 0xF
Constant_k : CPUID_Constant_Field;
-- Read-only. Variant number
Variant : CPUID_Variant_Field;
-- Read-only. Implementer code
Implementer : CPUID_Implementer_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CPUID_Register use record
Revision at 0 range 0 .. 3;
PartNo at 0 range 4 .. 15;
Constant_k at 0 range 16 .. 19;
Variant at 0 range 20 .. 23;
Implementer at 0 range 24 .. 31;
end record;
subtype ICSR_VECTACTIVE_Field is STM32_SVD.UInt9;
subtype ICSR_VECTPENDING_Field is STM32_SVD.UInt7;
subtype ICSR_ISRPENDING_Field is STM32_SVD.Bit;
subtype ICSR_PENDSTCLR_Field is STM32_SVD.Bit;
subtype ICSR_PENDSTSET_Field is STM32_SVD.Bit;
subtype ICSR_PENDSVCLR_Field is STM32_SVD.Bit;
subtype ICSR_PENDSVSET_Field is STM32_SVD.Bit;
subtype ICSR_NMIPENDSET_Field is STM32_SVD.Bit;
-- Interrupt control and state register
type ICSR_Register is record
-- Active vector
VECTACTIVE : ICSR_VECTACTIVE_Field := 16#0#;
-- unspecified
Reserved_9_10 : STM32_SVD.UInt2 := 16#0#;
-- Pending vector
VECTPENDING : ICSR_VECTPENDING_Field := 16#0#;
-- unspecified
Reserved_19_21 : STM32_SVD.UInt3 := 16#0#;
-- Interrupt pending flag
ISRPENDING : ICSR_ISRPENDING_Field := 16#0#;
-- unspecified
Reserved_23_24 : STM32_SVD.UInt2 := 16#0#;
-- SysTick exception clear-pending bit
PENDSTCLR : ICSR_PENDSTCLR_Field := 16#0#;
-- SysTick exception set-pending bit
PENDSTSET : ICSR_PENDSTSET_Field := 16#0#;
-- PendSV clear-pending bit
PENDSVCLR : ICSR_PENDSVCLR_Field := 16#0#;
-- PendSV set-pending bit
PENDSVSET : ICSR_PENDSVSET_Field := 16#0#;
-- unspecified
Reserved_29_30 : STM32_SVD.UInt2 := 16#0#;
-- NMI set-pending bit.
NMIPENDSET : ICSR_NMIPENDSET_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ICSR_Register use record
VECTACTIVE at 0 range 0 .. 8;
Reserved_9_10 at 0 range 9 .. 10;
VECTPENDING at 0 range 12 .. 18;
Reserved_19_21 at 0 range 19 .. 21;
ISRPENDING at 0 range 22 .. 22;
Reserved_23_24 at 0 range 23 .. 24;
PENDSTCLR at 0 range 25 .. 25;
PENDSTSET at 0 range 26 .. 26;
PENDSVCLR at 0 range 27 .. 27;
PENDSVSET at 0 range 28 .. 28;
Reserved_29_30 at 0 range 29 .. 30;
NMIPENDSET at 0 range 31 .. 31;
end record;
subtype AIRCR_VECTRESET_Field is STM32_SVD.Bit;
subtype AIRCR_VECTCLRACTIVE_Field is STM32_SVD.Bit;
subtype AIRCR_SYSRESETREQ_Field is STM32_SVD.Bit;
subtype AIRCR_PRIGROUP_Field is STM32_SVD.UInt3;
subtype AIRCR_ENDIANESS_Field is STM32_SVD.Bit;
subtype AIRCR_VECTKEYSTAT_Field is STM32_SVD.UInt16;
-- Application interrupt and reset control register
type AIRCR_Register is record
-- VECTCLRACTIVE
VECTCLRACTIVE : AIRCR_VECTCLRACTIVE_Field := 16#0#;
-- SYSRESETREQ
SYSRESETREQ : AIRCR_SYSRESETREQ_Field := 16#0#;
-- unspecified
Reserved_3_7 : STM32_SVD.UInt5 := 16#0#;
-- unspecified
Reserved_11_14 : STM32_SVD.UInt4 := 16#0#;
-- ENDIANESS
ENDIANESS : AIRCR_ENDIANESS_Field := 16#0#;
-- Register key
VECTKEYSTAT : AIRCR_VECTKEYSTAT_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for AIRCR_Register use record
VECTCLRACTIVE at 0 range 1 .. 1;
SYSRESETREQ at 0 range 2 .. 2;
Reserved_3_7 at 0 range 3 .. 7;
Reserved_11_14 at 0 range 11 .. 14;
ENDIANESS at 0 range 15 .. 15;
VECTKEYSTAT at 0 range 16 .. 31;
end record;
subtype SCR_SLEEPONEXIT_Field is STM32_SVD.Bit;
subtype SCR_SLEEPDEEP_Field is STM32_SVD.Bit;
subtype SCR_SEVEONPEND_Field is STM32_SVD.Bit;
-- System control register
type SCR_Register is record
-- unspecified
Reserved_0_0 : STM32_SVD.Bit := 16#0#;
-- SLEEPONEXIT
SLEEPONEXIT : SCR_SLEEPONEXIT_Field := 16#0#;
-- SLEEPDEEP
SLEEPDEEP : SCR_SLEEPDEEP_Field := 16#0#;
-- unspecified
Reserved_3_3 : STM32_SVD.Bit := 16#0#;
-- Send Event on Pending bit
SEVEONPEND : SCR_SEVEONPEND_Field := 16#0#;
-- unspecified
Reserved_5_31 : STM32_SVD.UInt27 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SCR_Register use record
Reserved_0_0 at 0 range 0 .. 0;
SLEEPONEXIT at 0 range 1 .. 1;
SLEEPDEEP at 0 range 2 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
SEVEONPEND at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
subtype CCR_NONBASETHRDENA_Field is STM32_SVD.Bit;
subtype CCR_USERSETMPEND_Field is STM32_SVD.Bit;
subtype CCR_UNALIGN_TRP_Field is STM32_SVD.Bit;
subtype CCR_DIV_0_TRP_Field is STM32_SVD.Bit;
subtype CCR_BFHFNMIGN_Field is STM32_SVD.Bit;
subtype CCR_STKALIGN_Field is STM32_SVD.Bit;
-- Configuration and control register
type CCR_Register is record
-- unspecified
Reserved_2_2 : STM32_SVD.Bit := 16#0#;
-- UNALIGN_ TRP
UNALIGN_TRP : CCR_UNALIGN_TRP_Field := 16#0#;
-- unspecified
Reserved_5_7 : STM32_SVD.UInt3 := 16#0#;
-- STKALIGN
STKALIGN : CCR_STKALIGN_Field := 16#0#;
-- unspecified
Reserved_10_31 : STM32_SVD.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR_Register use record
Reserved_2_2 at 0 range 2 .. 2;
UNALIGN_TRP at 0 range 3 .. 3;
Reserved_5_7 at 0 range 5 .. 7;
STKALIGN at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
subtype SHPR1_PRI_4_Field is STM32_SVD.Byte;
subtype SHPR1_PRI_5_Field is STM32_SVD.Byte;
subtype SHPR1_PRI_6_Field is STM32_SVD.Byte;
-- System handler priority registers
type SHPR1_Register is record
-- Priority of system handler 4
PRI_4 : SHPR1_PRI_4_Field := 16#0#;
-- Priority of system handler 5
PRI_5 : SHPR1_PRI_5_Field := 16#0#;
-- Priority of system handler 6
PRI_6 : SHPR1_PRI_6_Field := 16#0#;
-- unspecified
Reserved_24_31 : STM32_SVD.Byte := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SHPR1_Register use record
PRI_4 at 0 range 0 .. 7;
PRI_5 at 0 range 8 .. 15;
PRI_6 at 0 range 16 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype SHPR2_PRI_11_Field is STM32_SVD.Byte;
-- System handler priority registers
type SHPR2_Register is record
-- unspecified
Reserved_0_23 : STM32_SVD.UInt24 := 16#0#;
-- Priority of system handler 11
PRI_11 : SHPR2_PRI_11_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SHPR2_Register use record
Reserved_0_23 at 0 range 0 .. 23;
PRI_11 at 0 range 24 .. 31;
end record;
subtype SHPR3_PRI_14_Field is STM32_SVD.Byte;
subtype SHPR3_PRI_15_Field is STM32_SVD.Byte;
-- System handler priority registers
type SHPR3_Register is record
-- unspecified
Reserved_0_15 : STM32_SVD.UInt16 := 16#0#;
-- Priority of system handler 14
PRI_14 : SHPR3_PRI_14_Field := 16#0#;
-- Priority of system handler 15
PRI_15 : SHPR3_PRI_15_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SHPR3_Register use record
Reserved_0_15 at 0 range 0 .. 15;
PRI_14 at 0 range 16 .. 23;
PRI_15 at 0 range 24 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- System control block
type SCB_Peripheral is record
-- CPUID base register
CPUID : aliased CPUID_Register;
-- Interrupt control and state register
ICSR : aliased ICSR_Register;
-- Vector table offset register
AIRCR : aliased AIRCR_Register;
-- System control register
SCR : aliased SCR_Register;
-- Configuration and control register
CCR : aliased CCR_Register;
-- System handler priority registers
SHPR1 : aliased SHPR1_Register;
-- System handler priority registers
SHPR2 : aliased SHPR2_Register;
-- System handler priority registers
SHPR3 : aliased SHPR3_Register;
end record
with Volatile;
for SCB_Peripheral use record
CPUID at 16#0# range 0 .. 31;
ICSR at 16#4# range 0 .. 31;
AIRCR at 16#C# range 0 .. 31;
SCR at 16#10# range 0 .. 31;
CCR at 16#14# range 0 .. 31;
SHPR1 at 16#18# range 0 .. 31;
SHPR2 at 16#1C# range 0 .. 31;
SHPR3 at 16#20# range 0 .. 31;
end record;
-- System control block
SCB_Periph : aliased SCB_Peripheral
with Import, Address => System'To_Address (16#E000ED00#);
end STM32_SVD.SCB;
|
(lp1
(ccopy_reg
_reconstructor
p2
(cpygments.token
_TokenType
p3
c__builtin__
tuple
p4
(S'Comment'
p5
S'Single'
p6
ttRp7
(dp8
S'subtypes'
p9
c__builtin__
set
p10
((ltRp11
sS'parent'
p12
g2
(g3
g4
(g5
ttRp13
(dp14
g12
g2
(g3
g4
(ttRp15
(dp16
g5
g13
sS'Name'
p17
g2
(g3
g4
(g17
ttRp18
(dp19
S'Function'
p20
g2
(g3
g4
(g17
g20
ttRp21
(dp22
g9
g10
((ltRp23
sg12
g18
sbsS'Exception'
p24
g2
(g3
g4
(g17
g24
ttRp25
(dp26
g9
g10
((ltRp27
sg12
g18
sbsS'Tag'
p28
g2
(g3
g4
(g17
g28
ttRp29
(dp30
g9
g10
((ltRp31
sg12
g18
sbsS'Constant'
p32
g2
(g3
g4
(g17
g32
ttRp33
(dp34
g9
g10
((ltRp35
sg12
g18
sbsg12
g15
sS'Pseudo'
p36
g2
(g3
g4
(g17
g36
ttRp37
(dp38
g9
g10
((ltRp39
sg12
g18
sbsS'Attribute'
p40
g2
(g3
g4
(g17
g40
ttRp41
(dp42
g9
g10
((ltRp43
sg12
g18
sbsS'Label'
p44
g2
(g3
g4
(g17
g44
ttRp45
(dp46
g9
g10
((ltRp47
sg12
g18
sbsS'Blubb'
p48
g2
(g3
g4
(g17
g48
ttRp49
(dp50
g9
g10
((ltRp51
sg12
g18
sbsS'Entity'
p52
g2
(g3
g4
(g17
g52
ttRp53
(dp54
g9
g10
((ltRp55
sg12
g18
sbsS'Builtin'
p56
g2
(g3
g4
(g17
g56
ttRp57
(dp58
g9
g10
((lp59
g2
(g3
g4
(g17
g56
g36
ttRp60
(dp61
g9
g10
((ltRp62
sg12
g57
sbatRp63
sg36
g60
sg12
g18
sbsS'Other'
p64
g2
(g3
g4
(g17
g64
ttRp65
(dp66
g9
g10
((ltRp67
sg12
g18
sbsS'Identifier'
p68
g2
(g3
g4
(g17
g68
ttRp69
(dp70
g9
g10
((ltRp71
sg12
g18
sbsS'Variable'
p72
g2
(g3
g4
(g17
g72
ttRp73
(dp74
g12
g18
sS'Global'
p75
g2
(g3
g4
(g17
g72
g75
ttRp76
(dp77
g9
g10
((ltRp78
sg12
g73
sbsS'Instance'
p79
g2
(g3
g4
(g17
g72
g79
ttRp80
(dp81
g9
g10
((ltRp82
sg12
g73
sbsS'Anonymous'
p83
g2
(g3
g4
(g17
g72
g83
ttRp84
(dp85
g9
g10
((ltRp86
sg12
g73
sbsg9
g10
((lp87
g84
ag80
ag76
ag2
(g3
g4
(g17
g72
S'Class'
p88
ttRp89
(dp90
g9
g10
((ltRp91
sg12
g73
sbatRp92
sg88
g89
sbsg9
g10
((lp93
g2
(g3
g4
(g17
S'Decorator'
p94
ttRp95
(dp96
g9
g10
((ltRp97
sg12
g18
sbag41
ag33
ag37
ag2
(g3
g4
(g17
S'Namespace'
p98
ttRp99
(dp100
g9
g10
((ltRp101
sg12
g18
sbag69
ag57
ag73
ag65
ag49
ag53
ag21
ag2
(g3
g4
(g17
S'Property'
p102
ttRp103
(dp104
g9
g10
((ltRp105
sg12
g18
sbag45
ag29
ag25
ag2
(g3
g4
(g17
g88
ttRp106
(dp107
g9
g10
((ltRp108
sg12
g18
sbatRp109
sg102
g103
sg88
g106
sg94
g95
sg98
g99
sbsS'Keyword'
p110
g2
(g3
g4
(g110
ttRp111
(dp112
g32
g2
(g3
g4
(g110
g32
ttRp113
(dp114
g9
g10
((ltRp115
sg12
g111
sbsg12
g15
sg98
g2
(g3
g4
(g110
g98
ttRp116
(dp117
g9
g10
((ltRp118
sg12
g111
sbsg36
g2
(g3
g4
(g110
g36
ttRp119
(dp120
g9
g10
((ltRp121
sg12
g111
sbsS'Reserved'
p122
g2
(g3
g4
(g110
g122
ttRp123
(dp124
g9
g10
((ltRp125
sg12
g111
sbsS'Declaration'
p126
g2
(g3
g4
(g110
g126
ttRp127
(dp128
g9
g10
((ltRp129
sg12
g111
sbsg72
g2
(g3
g4
(g110
g72
ttRp130
(dp131
g9
g10
((ltRp132
sg12
g111
sbsg9
g10
((lp133
g113
ag123
ag2
(g3
g4
(g110
S'Type'
p134
ttRp135
(dp136
g9
g10
((ltRp137
sg12
g111
sbag127
ag130
ag116
ag119
atRp138
sg134
g135
sbsS'Generic'
p139
g2
(g3
g4
(g139
ttRp140
(dp141
S'Prompt'
p142
g2
(g3
g4
(g139
g142
ttRp143
(dp144
g9
g10
((ltRp145
sg12
g140
sbsg12
g15
sS'Deleted'
p146
g2
(g3
g4
(g139
g146
ttRp147
(dp148
g9
g10
((ltRp149
sg12
g140
sbsS'Traceback'
p150
g2
(g3
g4
(g139
g150
ttRp151
(dp152
g9
g10
((ltRp153
sg12
g140
sbsS'Emph'
p154
g2
(g3
g4
(g139
g154
ttRp155
(dp156
g9
g10
((ltRp157
sg12
g140
sbsS'Output'
p158
g2
(g3
g4
(g139
g158
ttRp159
(dp160
g9
g10
((ltRp161
sg12
g140
sbsS'Subheading'
p162
g2
(g3
g4
(g139
g162
ttRp163
(dp164
g9
g10
((ltRp165
sg12
g140
sbsS'Error'
p166
g2
(g3
g4
(g139
g166
ttRp167
(dp168
g9
g10
((ltRp169
sg12
g140
sbsg9
g10
((lp170
g159
ag155
ag167
ag163
ag151
ag147
ag2
(g3
g4
(g139
S'Heading'
p171
ttRp172
(dp173
g9
g10
((ltRp174
sg12
g140
sbag2
(g3
g4
(g139
S'Inserted'
p175
ttRp176
(dp177
g9
g10
((ltRp178
sg12
g140
sbag2
(g3
g4
(g139
S'Strong'
p179
ttRp180
(dp181
g9
g10
((ltRp182
sg12
g140
sbag143
atRp183
sg179
g180
sg175
g176
sg171
g172
sbsS'Text'
p184
g2
(g3
g4
(g184
ttRp185
(dp186
g9
g10
((lp187
g2
(g3
g4
(g184
S'Symbol'
p188
ttRp189
(dp190
g9
g10
((ltRp191
sg12
g185
sbag2
(g3
g4
(g184
S'Whitespace'
p192
ttRp193
(dp194
g9
g10
((ltRp195
sg12
g185
sbatRp196
sg188
g189
sg192
g193
sg12
g15
sbsS'Punctuation'
p197
g2
(g3
g4
(g197
ttRp198
(dp199
g9
g10
((lp200
g2
(g3
g4
(g197
S'Indicator'
p201
ttRp202
(dp203
g9
g10
((ltRp204
sg12
g198
sbatRp205
sg201
g202
sg12
g15
sbsS'Token'
p206
g15
sS'Number'
p207
g2
(g3
g4
(S'Literal'
p208
g207
ttRp209
(dp210
S'Bin'
p211
g2
(g3
g4
(g208
g207
g211
ttRp212
(dp213
g9
g10
((ltRp214
sg12
g209
sbsS'Binary'
p215
g2
(g3
g4
(g208
g207
g215
ttRp216
(dp217
g9
g10
((ltRp218
sg12
g209
sbsg12
g2
(g3
g4
(g208
ttRp219
(dp220
S'String'
p221
g2
(g3
g4
(g208
g221
ttRp222
(dp223
S'Regex'
p224
g2
(g3
g4
(g208
g221
g224
ttRp225
(dp226
g9
g10
((ltRp227
sg12
g222
sbsS'Interpol'
p228
g2
(g3
g4
(g208
g221
g228
ttRp229
(dp230
g9
g10
((ltRp231
sg12
g222
sbsS'Regexp'
p232
g2
(g3
g4
(g208
g221
g232
ttRp233
(dp234
g9
g10
((ltRp235
sg12
g222
sbsg12
g219
sS'Heredoc'
p236
g2
(g3
g4
(g208
g221
g236
ttRp237
(dp238
g9
g10
((ltRp239
sg12
g222
sbsS'Double'
p240
g2
(g3
g4
(g208
g221
g240
ttRp241
(dp242
g9
g10
((ltRp243
sg12
g222
sbsg188
g2
(g3
g4
(g208
g221
g188
ttRp244
(dp245
g9
g10
((ltRp246
sg12
g222
sbsS'Escape'
p247
g2
(g3
g4
(g208
g221
g247
ttRp248
(dp249
g9
g10
((ltRp250
sg12
g222
sbsS'Character'
p251
g2
(g3
g4
(g208
g221
g251
ttRp252
(dp253
g9
g10
((ltRp254
sg12
g222
sbsS'Interp'
p255
g2
(g3
g4
(g208
g221
g255
ttRp256
(dp257
g9
g10
((ltRp258
sg12
g222
sbsS'Backtick'
p259
g2
(g3
g4
(g208
g221
g259
ttRp260
(dp261
g9
g10
((ltRp262
sg12
g222
sbsS'Char'
p263
g2
(g3
g4
(g208
g221
g263
ttRp264
(dp265
g9
g10
((ltRp266
sg12
g222
sbsg6
g2
(g3
g4
(g208
g221
g6
ttRp267
(dp268
g9
g10
((ltRp269
sg12
g222
sbsg64
g2
(g3
g4
(g208
g221
g64
ttRp270
(dp271
g9
g10
((ltRp272
sg12
g222
sbsS'Doc'
p273
g2
(g3
g4
(g208
g221
g273
ttRp274
(dp275
g9
g10
((ltRp276
sg12
g222
sbsg9
g10
((lp277
g270
ag2
(g3
g4
(g208
g221
S'Atom'
p278
ttRp279
(dp280
g9
g10
((ltRp281
sg12
g222
sbag241
ag264
ag256
ag274
ag237
ag260
ag229
ag244
ag233
ag225
ag267
ag252
ag248
atRp282
sg278
g279
sbsg12
g15
sg207
g209
sS'Scalar'
p283
g2
(g3
g4
(g208
g283
ttRp284
(dp285
g9
g10
((lp286
g2
(g3
g4
(g208
g283
S'Plain'
p287
ttRp288
(dp289
g9
g10
((ltRp290
sg12
g284
sbatRp291
sg12
g219
sg287
g288
sbsg64
g2
(g3
g4
(g208
g64
ttRp292
(dp293
g9
g10
((ltRp294
sg12
g219
sbsS'Date'
p295
g2
(g3
g4
(g208
g295
ttRp296
(dp297
g9
g10
((ltRp298
sg12
g219
sbsg9
g10
((lp299
g296
ag222
ag292
ag209
ag284
atRp300
sbsS'Decimal'
p301
g2
(g3
g4
(g208
g207
g301
ttRp302
(dp303
g9
g10
((ltRp304
sg12
g209
sbsS'Float'
p305
g2
(g3
g4
(g208
g207
g305
ttRp306
(dp307
g9
g10
((ltRp308
sg12
g209
sbsS'Hex'
p309
g2
(g3
g4
(g208
g207
g309
ttRp310
(dp311
g9
g10
((ltRp312
sg12
g209
sbsS'Integer'
p313
g2
(g3
g4
(g208
g207
g313
ttRp314
(dp315
g9
g10
((lp316
g2
(g3
g4
(g208
g207
g313
S'Long'
p317
ttRp318
(dp319
g9
g10
((ltRp320
sg12
g314
sbatRp321
sg317
g318
sg12
g209
sbsS'Octal'
p322
g2
(g3
g4
(g208
g207
g322
ttRp323
(dp324
g9
g10
((ltRp325
sg12
g209
sbsg9
g10
((lp326
g212
ag216
ag323
ag302
ag2
(g3
g4
(g208
g207
S'Oct'
p327
ttRp328
(dp329
g9
g10
((ltRp330
sg12
g209
sbag314
ag306
ag310
atRp331
sg327
g328
sbsg208
g219
sg64
g2
(g3
g4
(g64
ttRp332
(dp333
g9
g10
((ltRp334
sg12
g15
sbsg166
g2
(g3
g4
(g166
ttRp335
(dp336
g9
g10
((ltRp337
sg12
g15
sbsS'Operator'
p338
g2
(g3
g4
(g338
ttRp339
(dp340
g9
g10
((lp341
g2
(g3
g4
(g338
S'Word'
p342
ttRp343
(dp344
g9
g10
((ltRp345
sg12
g339
sbatRp346
sg342
g343
sg12
g15
sbsg9
g10
((lp347
g13
ag335
ag140
ag185
ag18
ag198
ag111
ag219
ag339
ag332
atRp348
sg221
g222
sbsS'Preproc'
p349
g2
(g3
g4
(g5
g349
ttRp350
(dp351
g9
g10
((ltRp352
sg12
g13
sbsg6
g7
sS'Multiline'
p353
g2
(g3
g4
(g5
g353
ttRp354
(dp355
g9
g10
((ltRp356
sg12
g13
sbsg9
g10
((lp357
g2
(g3
g4
(g5
S'Special'
p358
ttRp359
(dp360
g9
g10
((ltRp361
sg12
g13
sbag350
ag7
ag354
atRp362
sg358
g359
sbsbV-- Model IED Simulator\u000a
p363
tp364
a(g7
V-- COL Gene Ressler, 1 December 2007\u000a
p365
tp366
a(g116
Vwith
p367
tp368
a(g185
V
tp369
a(g99
VAda.Text_IO
p370
tp371
a(g198
V;
tp372
a(g185
V\u000a\u000a
p373
tp374
a(g116
Vwith
p375
tp376
a(g185
V
tp377
a(g99
VAda.Characters.Latin_1
p378
tp379
a(g198
V;
tp380
a(g185
V\u000a
tp381
a(g116
Vuse
p382
tp383
a(g185
V
p384
tp385
a(g99
VAda.Characters.Latin_1
p386
tp387
a(g198
V;
tp388
a(g185
V\u000a\u000a
p389
tp390
a(g116
Vwith
p391
tp392
a(g185
V
tp393
a(g99
VAda.Strings.Fixed
p394
tp395
a(g198
V;
tp396
a(g185
V\u000a
tp397
a(g116
Vuse
p398
tp399
a(g185
V
p400
tp401
a(g99
VAda.Strings.Fixed
p402
tp403
a(g198
V;
tp404
a(g185
V\u000a\u000a
p405
tp406
a(g116
Vwith
p407
tp408
a(g185
V
tp409
a(g99
VAda.Strings
p410
tp411
a(g198
V;
tp412
a(g185
V\u000a
tp413
a(g116
Vwith
p414
tp415
a(g185
V
tp416
a(g99
VAda.Strings.Bounded
p417
tp418
a(g198
V;
tp419
a(g185
V\u000a\u000a
p420
tp421
a(g116
Vwith
p422
tp423
a(g185
V
tp424
a(g99
VBinary_Search
p425
tp426
a(g198
V;
tp427
a(g185
V\u000a\u000a
p428
tp429
a(g116
Vwith
p430
tp431
a(g185
V
tp432
a(g99
VAda.Containers.Generic_Array_Sort
p433
tp434
a(g198
V;
tp435
a(g185
V\u000a\u000a
p436
tp437
a(g127
Vpackage
p438
tp439
a(g185
V
tp440
a(g127
Vbody
p441
tp442
a(g185
V
tp443
a(g106
VScanner
p444
tp445
a(g185
V
tp446
a(g123
Vis
p447
tp448
a(g185
V\u000a
tp449
a(g185
V
p450
tp451
a(g185
V\u000a
tp452
a(g185
V
p453
tp454
a(g33
VConstant_123
p455
tp456
a(g185
V
p457
tp458
a(g198
V:
tp459
a(g185
V
tp460
a(g123
Vconstant
p461
tp462
a(g185
V
tp463
a(g135
VCharacter
p464
tp465
a(g185
V
tp466
a(g198
V:=
p467
tp468
a(g185
V
tp469
a(g135
VCharacter
p470
tp471
a(g198
V'
tp472
a(g41
VVal
p473
tp474
a(g185
V
tp475
a(g198
V(
tp476
a(g310
V16#00#
p477
tp478
a(g198
V)
tp479
a(g198
V;
tp480
a(g185
V\u000a
tp481
a(g185
V
p482
tp483
a(g33
VMAX_KEYWORD_LENGTH_C
p484
tp485
a(g185
V
tp486
a(g198
V:
tp487
a(g185
V
tp488
a(g123
Vconstant
p489
tp490
a(g185
V
tp491
a(g135
VNatural
p492
tp493
a(g185
V
tp494
a(g198
V:=
p495
tp496
a(g185
V
tp497
a(g314
V24
p498
tp499
a(g198
V;
tp500
a(g185
V\u000a
tp501
a(g185
V
p502
tp503
a(g185
V\u000a
tp504
a(g185
V
p505
tp506
a(g33
VNew_Constant
p507
tp508
a(g185
V
tp509
a(g198
V:
tp510
a(g185
V
tp511
a(g123
Vconstant
p512
tp513
a(g185
V
tp514
a(g18
VNew_Type
p515
tp516
a(g185
V\u000a
tp517
a(g185
V
p518
tp519
a(g198
V:=
p520
tp521
a(g185
V
tp522
a(g314
V2
tp523
a(g198
V;
tp524
a(g185
V\u000a
tp525
a(g185
V
p526
tp527
a(g185
V\u000a
tp528
a(g185
V
p529
tp530
a(g33
VKEYWORDS_C
p531
tp532
a(g185
V
tp533
a(g198
V:
tp534
a(g185
V
tp535
a(g123
Vconstant
p536
tp537
a(g185
V
tp538
a(g18
VKeyword_Array_T
p539
tp540
a(g185
V
tp541
a(g198
V:=
p542
tp543
a(g185
V\u000a
tp544
a(g185
V
p545
tp546
a(g198
V(
tp547
a(g18
VTo_BS
p548
tp549
a(g198
V(
tp550
a(g222
V"description"
p551
tp552
a(g198
V)
tp553
a(g198
V,
tp554
a(g185
V\u000a
tp555
a(g185
V
p556
tp557
a(g18
VTo_BS
p558
tp559
a(g198
V(
tp560
a(g222
V"with"
p561
tp562
a(g198
V)
tp563
a(g198
V)
tp564
a(g198
V;
tp565
a(g185
V\u000a
tp566
a(g185
V
p567
tp568
a(g185
V\u000a
tp569
a(g185
V
p570
tp571
a(g127
Vprocedure
p572
tp573
a(g185
V
tp574
a(g21
VBlah
p575
tp576
a(g198
V;
tp577
a(g185
V\u000a
tp578
a(g185
V
p579
tp580
a(g185
V\u000a
tp581
a(g185
V
p582
tp583
a(g127
Vprocedure
p584
tp585
a(g185
V
tp586
a(g21
Vblah
p587
tp588
a(g185
V
tp589
a(g123
Vis
p590
tp591
a(g185
V\u000a
tp592
a(g185
V
p593
tp594
a(g123
Vbegin
p595
tp596
a(g185
V\u000a
tp597
a(g185
V
p598
tp599
a(g185
V\u000a
tp600
a(g185
V
p601
tp602
a(g45
VDeclaration
p603
tp604
a(g198
V:
tp605
a(g185
V\u000a
p606
tp607
a(g123
Vdeclare
p608
tp609
a(g185
V\u000a
tp610
a(g185
V
p611
tp612
a(g18
VJoe
p613
tp614
a(g185
V
tp615
a(g198
V:
tp616
a(g185
V
tp617
a(g18
VType_Type
p618
tp619
a(g185
V
tp620
a(g198
V:=
p621
tp622
a(g185
V
tp623
a(g18
VRandom
p624
tp625
a(g198
V;
tp626
a(g185
V\u000a
tp627
a(g185
V
p628
tp629
a(g123
Vbegin
p630
tp631
a(g185
V\u000a
tp632
a(g185
V
p633
tp634
a(g18
VDo_Something
p635
tp636
a(g198
V;
tp637
a(g185
V\u000a
tp638
a(g185
V
p639
tp640
a(g123
Vend
p641
tp642
a(g185
V
tp643
a(g21
VDeclaration
p644
tp645
a(g198
V;
tp646
a(g185
V\u000a
tp647
a(g185
V
p648
tp649
a(g45
VLoop_ID
p650
tp651
a(g198
V:
tp652
a(g185
V\u000a
p653
tp654
a(g123
Vloop
p655
tp656
a(g185
V\u000a
tp657
a(g185
V
p658
tp659
a(g18
VLoop_Do
p660
tp661
a(g198
V;
tp662
a(g185
V\u000a
tp663
a(g185
V
p664
tp665
a(g123
Vexit
p666
tp667
a(g185
V
tp668
a(g123
Vwhen
p669
tp670
a(g185
V
tp671
a(g314
V1
tp672
a(g339
V=
tp673
a(g314
V2
tp674
a(g198
V;
tp675
a(g185
V\u000a
tp676
a(g185
V
p677
tp678
a(g123
Vend
p679
tp680
a(g185
V
tp681
a(g123
Vloop
p682
tp683
a(g185
V
tp684
a(g123
VLoop
p685
tp686
a(g21
V_ID
p687
tp688
a(g198
V;
tp689
a(g185
V\u000a
tp690
a(g185
V
p691
tp692
a(g123
Vif
p693
tp694
a(g185
V
tp695
a(g113
VTrue
p696
tp697
a(g185
V
tp698
a(g343
Vor else
p699
tp700
a(g185
V
tp701
a(g113
VFalse
p702
tp703
a(g185
V
tp704
a(g123
Vthen
p705
tp706
a(g185
V\u000a
tp707
a(g185
V
p708
tp709
a(g18
VDo_This
p710
tp711
a(g198
V(
tp712
a(g198
V)
tp713
a(g198
V;
tp714
a(g185
V\u000a
tp715
a(g185
V
p716
tp717
a(g123
Velsif
p718
tp719
a(g185
V
tp720
a(g343
Vnot
p721
tp722
a(g185
V
tp723
a(g113
VFalse
p724
tp725
a(g185
V
tp726
a(g343
Vand then
p727
tp728
a(g185
V
tp729
a(g113
VTrue
p730
tp731
a(g185
V
tp732
a(g123
Vthen
p733
tp734
a(g185
V\u000a
tp735
a(g185
V
p736
tp737
a(g18
VDo_That
p738
tp739
a(g198
V;
tp740
a(g185
V\u000a
tp741
a(g185
V
p742
tp743
a(g123
Velse
p744
tp745
a(g185
V\u000a
tp746
a(g185
V
p747
tp748
a(g18
VPanic
p749
tp750
a(g198
V;
tp751
a(g185
V\u000a
tp752
a(g185
V
p753
tp754
a(g123
Vend
p755
tp756
a(g185
V
tp757
a(g123
Vif
p758
tp759
a(g198
V;
tp760
a(g185
V\u000a
tp761
a(g185
V
p762
tp763
a(g123
Vend
p764
tp765
a(g185
V
tp766
a(g21
Vblah
p767
tp768
a(g198
V;
tp769
a(g185
V\u000a
tp770
a(g185
V
p771
tp772
a(g185
V\u000a
tp773
a(g185
V
p774
tp775
a(g127
Vfunction
p776
tp777
a(g185
V
tp778
a(g21
V"*"
p779
tp780
a(g185
V
tp781
a(g198
V(
tp782
a(g73
VLeft
p783
tp784
a(g198
V,
tp785
a(g185
V
tp786
a(g73
VRight
p787
tp788
a(g185
V
tp789
a(g198
V:
p790
tp791
a(g123
Vin
p792
tp793
a(g185
V
tp794
a(g135
VInteger
p795
tp796
a(g198
V)
tp797
a(g185
V
tp798
a(g123
Vreturn
p799
tp800
a(g185
V
tp801
a(g135
VInteger
p802
tp803
a(g185
V
tp804
a(g123
Vis
p805
tp806
a(g185
V\u000a
tp807
a(g185
V
p808
tp809
a(g123
Vbegin
p810
tp811
a(g185
V\u000a
tp812
a(g185
V
p813
tp814
a(g45
V<<Goto_Label>>
p815
tp816
a(g185
V\u000a
tp817
a(g185
V
p818
tp819
a(g123
Vgoto
p820
tp821
a(g185
V
tp822
a(g18
VGoto_Label
p823
tp824
a(g198
V;
tp825
a(g185
V\u000a
tp826
a(g185
V
p827
tp828
a(g123
Vreturn
p829
tp830
a(g185
V
tp831
a(g18
VLeft
p832
tp833
a(g185
V
tp834
a(g339
V+
tp835
a(g185
V
tp836
a(g18
VRight
p837
tp838
a(g198
V;
tp839
a(g185
V\u000a
tp840
a(g185
V
p841
tp842
a(g123
Vend
p843
tp844
a(g185
V
tp845
a(g21
V"*"
p846
tp847
a(g198
V;
tp848
a(g185
V\u000a
tp849
a(g185
V
p850
tp851
a(g185
V\u000a
tp852
a(g185
V
p853
tp854
a(g127
Vfunction
p855
tp856
a(g185
V
tp857
a(g21
VFunction_Specification
p858
tp859
a(g185
V\u000a
tp860
a(g185
V
p861
tp862
a(g198
V(
tp863
a(g73
VParam_1
p864
tp865
a(g185
V
p866
tp867
a(g198
V:
p868
tp869
a(g123
Vin
p870
tp871
a(g185
V
tp872
a(g18
VBlah
p873
tp874
a(g198
V;
tp875
a(g185
V
tp876
a(g185
V\u000a
tp877
a(g185
V
p878
tp879
a(g73
VParam2
p880
tp881
a(g198
V,
tp882
a(g185
V
tp883
a(g73
Vparam3
p884
tp885
a(g185
V
tp886
a(g198
V:
p887
tp888
a(g123
Vin
p889
tp890
a(g185
V
tp891
a(g123
Vaccess
p892
tp893
a(g185
V
tp894
a(g18
VBlah_Type
p895
tp896
a(g185
V
tp897
a(g198
V:=
p898
tp899
a(g185
V
tp900
a(g314
V0
tp901
a(g198
V)
tp902
a(g185
V\u000a
tp903
a(g185
V
p904
tp905
a(g123
Vreturn
p906
tp907
a(g185
V
tp908
a(g18
VIt_Type
p909
tp910
a(g198
V;
tp911
a(g185
V\u000a
tp912
a(g185
V
p913
tp914
a(g185
V\u000a
tp915
a(g185
V
p916
tp917
a(g127
Vpackage
p918
tp919
a(g185
V
tp920
a(g106
VRename_Check
p921
tp922
a(g185
V
tp923
a(g123
Vrenames
p924
tp925
a(g185
V
tp926
a(g106
VAda.Text_IO
p927
tp928
a(g198
V;
tp929
a(g185
V\u000a\u000a
p930
tp931
a(g185
V
p932
tp933
a(g127
Vtype
p934
tp935
a(g185
V
tp936
a(g135
VNew_Float
p937
tp938
a(g185
V
tp939
a(g123
Vis
p940
tp941
a(g185
V
tp942
a(g123
Vdelta
p943
tp944
a(g185
V
tp945
a(g306
V0.001
p946
tp947
a(g185
V
tp948
a(g123
Vdigits
p949
tp950
a(g185
V
tp951
a(g314
V12
p952
tp953
a(g198
V;
tp954
a(g185
V\u000a
tp955
a(g185
V
p956
tp957
a(g185
V\u000a
tp958
a(g185
V
p959
tp960
a(g127
Vpackage
p961
tp962
a(g185
V
tp963
a(g106
VPackage_Inst
p964
tp965
a(g185
V
tp966
a(g123
Vis new
p967
tp968
a(g185
V
tp969
a(g106
VAda.Strings.Bounded.Generic_Bounded_Length
p970
tp971
a(g185
V\u000a
tp972
a(g185
V
p973
tp974
a(g198
V(
tp975
a(g73
VMax
p976
tp977
a(g185
V
tp978
a(g198
V=>
p979
tp980
a(g185
V
tp981
a(g185
VM
tp982
a(g185
VA
tp983
a(g185
VX
tp984
a(g185
V_
tp985
a(g185
VK
tp986
a(g185
VE
tp987
a(g185
VY
tp988
a(g185
VW
tp989
a(g185
VO
tp990
a(g185
VR
tp991
a(g185
VD
tp992
a(g185
V_
tp993
a(g185
VL
tp994
a(g185
VE
tp995
a(g185
VN
tp996
a(g185
VG
tp997
a(g185
VT
tp998
a(g185
VH
tp999
a(g185
V_
tp1000
a(g185
VC
tp1001
a(g198
V)
tp1002
a(g198
V;
tp1003
a(g185
V\u000a\u000a
p1004
tp1005
a(g185
V
p1006
tp1007
a(g127
Vtype
p1008
tp1009
a(g185
V
tp1010
a(g135
VArray_Decl12
p1011
tp1012
a(g185
V
tp1013
a(g123
Vis
p1014
tp1015
a(g185
V
tp1016
a(g123
Varray
p1017
tp1018
a(g185
V
tp1019
a(g198
V(
tp1020
a(g135
VPositive
p1021
tp1022
a(g185
V
tp1023
a(g123
Vrange
p1024
tp1025
a(g185
V
tp1026
a(g198
V<>
p1027
tp1028
a(g198
V)
tp1029
a(g185
V
tp1030
a(g123
Vof
p1031
tp1032
a(g185
V
tp1033
a(g18
VSB
p1034
tp1035
a(g198
V.
tp1036
a(g18
VBounded_String
p1037
tp1038
a(g198
V;
tp1039
a(g185
V\u000a
tp1040
a(g185
V
p1041
tp1042
a(g127
Vtype
p1043
tp1044
a(g185
V
tp1045
a(g135
VArray_Decl3
p1046
tp1047
a(g185
V
tp1048
a(g123
Vis
p1049
tp1050
a(g185
V
tp1051
a(g123
Varray
p1052
tp1053
a(g185
V
tp1054
a(g198
V(
tp1055
a(g135
VNew_Type
p1056
tp1057
a(g185
V
tp1058
a(g123
Vrange
p1059
tp1060
a(g185
V
tp1061
a(g18
VThing_1
p1062
tp1063
a(g185
V
tp1064
a(g198
V.
tp1065
a(g198
V.
tp1066
a(g185
V
tp1067
a(g18
VThing_2
p1068
tp1069
a(g198
V)
tp1070
a(g185
V
tp1071
a(g123
Vof
p1072
tp1073
a(g185
V
tp1074
a(g18
VSB
p1075
tp1076
a(g198
V.
tp1077
a(g18
VBounded_String
p1078
tp1079
a(g198
V;
tp1080
a(g185
V\u000a\u000a
p1081
tp1082
a(g185
V
p1083
tp1084
a(g127
Vtype
p1085
tp1086
a(g185
V
tp1087
a(g135
VBoring_Type
p1088
tp1089
a(g185
V
tp1090
a(g123
Vis
p1091
tp1092
a(g185
V\u000a
tp1093
a(g185
V
p1094
tp1095
a(g198
V(
tp1096
a(g73
VStart
p1097
tp1098
a(g198
V,
tp1099
a(g185
V\u000a
tp1100
a(g185
V
p1101
tp1102
a(g18
VEnd_Error
p1103
tp1104
a(g198
V)
tp1105
a(g198
V;
tp1106
a(g185
V\u000a\u000a
p1107
tp1108
a(g185
V
p1109
tp1110
a(g127
Vsubtype
p1111
tp1112
a(g185
V
tp1113
a(g135
VSub_Type_check
p1114
tp1115
a(g185
V
tp1116
a(g123
Vis
p1117
tp1118
a(g185
V
tp1119
a(g135
VCharacter
p1120
tp1121
a(g185
V
tp1122
a(g123
Vrange
p1123
tp1124
a(g185
V
tp1125
a(g198
V'
tp1126
a(g41
V0
tp1127
a(g198
V'
tp1128
a(g185
V
tp1129
a(g198
V.
tp1130
a(g198
V.
tp1131
a(g185
V
tp1132
a(g198
V'
tp1133
a(g41
V9
tp1134
a(g198
V'
tp1135
a(g198
V;
tp1136
a(g185
V\u000a
tp1137
a(g185
V
p1138
tp1139
a(g185
V\u000a
tp1140
a(g185
V
p1141
tp1142
a(g33
VInitialized_Array
p1143
tp1144
a(g185
V
tp1145
a(g198
V:
tp1146
a(g185
V
tp1147
a(g123
Vconstant
p1148
tp1149
a(g185
V
tp1150
a(g18
VTransistion_Array_T
p1151
tp1152
a(g185
V
tp1153
a(g198
V:=
p1154
tp1155
a(g185
V\u000a
tp1156
a(g185
V
p1157
tp1158
a(g198
V(
tp1159
a(g18
VStart
p1160
tp1161
a(g185
V
tp1162
a(g198
V=>
p1163
tp1164
a(g185
V\u000a
tp1165
a(g185
V
p1166
tp1167
a(g198
V(
tp1168
a(g18
VLetter_Lower
p1169
tp1170
a(g185
V
tp1171
a(g198
V|
tp1172
a(g185
V
tp1173
a(g18
VLetter_Upper
p1174
tp1175
a(g185
V
tp1176
a(g198
V=>
p1177
tp1178
a(g185
V
tp1179
a(g18
VSaw_Alpha
p1180
tp1181
a(g198
V,
tp1182
a(g185
V\u000a
tp1183
a(g185
V
p1184
tp1185
a(g252
V' '
p1186
tp1187
a(g185
V
tp1188
a(g198
V|
tp1189
a(g185
V
tp1190
a(g18
VHT
p1191
tp1192
a(g185
V
tp1193
a(g198
V|
tp1194
a(g185
V
tp1195
a(g18
VCR
p1196
tp1197
a(g185
V
tp1198
a(g198
V|
tp1199
a(g185
V
tp1200
a(g18
VLF
p1201
tp1202
a(g185
V
p1203
tp1204
a(g198
V=>
p1205
tp1206
a(g185
V
tp1207
a(g18
VStart
p1208
tp1209
a(g198
V,
tp1210
a(g185
V\u000a
tp1211
a(g185
V
p1212
tp1213
a(g123
Vothers
p1214
tp1215
a(g185
V
tp1216
a(g198
V=>
p1217
tp1218
a(g185
V
tp1219
a(g18
VBegin_Error
p1220
tp1221
a(g198
V)
tp1222
a(g198
V,
tp1223
a(g185
V\u000a\u000a
p1224
tp1225
a(g185
V
p1226
tp1227
a(g18
VEnd_Error
p1228
tp1229
a(g185
V
tp1230
a(g198
V=>
p1231
tp1232
a(g185
V
tp1233
a(g198
V(
tp1234
a(g123
Vothers
p1235
tp1236
a(g185
V
tp1237
a(g198
V=>
p1238
tp1239
a(g185
V
tp1240
a(g18
VStart
p1241
tp1242
a(g198
V)
tp1243
a(g185
V\u000a\u000a
p1244
tp1245
a(g185
V
p1246
tp1247
a(g198
V)
tp1248
a(g198
V;
tp1249
a(g185
V\u000a\u000a
p1250
tp1251
a(g185
V
p1252
tp1253
a(g127
Vtype
p1254
tp1255
a(g185
V
tp1256
a(g135
VRecorder
p1257
tp1258
a(g185
V
tp1259
a(g123
Vis
p1260
tp1261
a(g185
V
tp1262
a(g123
Vrecord
p1263
tp1264
a(g185
V\u000a
tp1265
a(g185
V
p1266
tp1267
a(g73
VAdvance
p1268
tp1269
a(g185
V
p1270
tp1271
a(g198
V:
p1272
tp1273
a(g18
VBoolean
p1274
tp1275
a(g198
V;
tp1276
a(g185
V\u000a
tp1277
a(g185
V
p1278
tp1279
a(g73
VReturn_Token
p1280
tp1281
a(g185
V
tp1282
a(g198
V:
p1283
tp1284
a(g18
VToken_T
p1285
tp1286
a(g198
V;
tp1287
a(g185
V\u000a
tp1288
a(g185
V
p1289
tp1290
a(g123
Vend
p1291
tp1292
a(g185
V
tp1293
a(g123
Vrecord
p1294
tp1295
a(g198
V;
tp1296
a(g185
V\u000a
tp1297
a(g185
V
p1298
tp1299
a(g185
V\u000a
tp1300
a(g185
V
p1301
tp1302
a(g123
Vfor
p1303
tp1304
a(g185
V
tp1305
a(g18
VRecorder
p1306
tp1307
a(g185
V
tp1308
a(g116
Vuse
p1309
tp1310
a(g185
V
tp1311
a(g99
V8
tp1312
a(g198
V;
tp1313
a(g185
V\u000a
tp1314
a(g185
V
p1315
tp1316
a(g185
V\u000a
tp1317
a(g185
V
p1318
tp1319
a(g127
Vtype
p1320
tp1321
a(g185
V
tp1322
a(g135
VNull_Record
p1323
tp1324
a(g185
V
tp1325
a(g123
Vis
p1326
tp1327
a(g185
V
tp1328
a(g113
Vnull
p1329
tp1330
a(g185
V
tp1331
a(g123
Vrecord
p1332
tp1333
a(g198
V;
tp1334
a(g185
V\u000a
tp1335
a(g185
V
p1336
tp1337
a(g185
V\u000a
tp1338
a(g185
V
p1339
tp1340
a(g127
Vtype
p1341
tp1342
a(g185
V
tp1343
a(g135
VDiscriminated_Record
p1344
tp1345
a(g185
V
tp1346
a(g198
V(
tp1347
a(g73
VSize
p1348
tp1349
a(g185
V
tp1350
a(g198
V:
p1351
tp1352
a(g135
VNatural
p1353
tp1354
a(g198
V)
tp1355
a(g185
V
tp1356
a(g123
Vis
p1357
tp1358
a(g185
V
tp1359
a(g185
V\u000a
tp1360
a(g185
V
p1361
tp1362
a(g123
Vrecord
p1363
tp1364
a(g185
V\u000a
tp1365
a(g185
V
p1366
tp1367
a(g73
VA
tp1368
a(g185
V
tp1369
a(g198
V:
p1370
tp1371
a(g135
VString
p1372
tp1373
a(g185
V
tp1374
a(g198
V(
tp1375
a(g314
V1
tp1376
a(g185
V
tp1377
a(g198
V.
tp1378
a(g198
V.
tp1379
a(g185
V
tp1380
a(g18
VSize
p1381
tp1382
a(g198
V)
tp1383
a(g198
V;
tp1384
a(g185
V\u000a
tp1385
a(g185
V
p1386
tp1387
a(g123
Vend
p1388
tp1389
a(g185
V
tp1390
a(g123
Vrecord
p1391
tp1392
a(g198
V;
tp1393
a(g185
V\u000a
tp1394
a(g185
V
p1395
tp1396
a(g185
V\u000a
tp1397
a(g185
V
p1398
tp1399
a(g123
Vpragma
p1400
tp1401
a(g185
V
tp1402
a(g350
VUnchecked_Union
p1403
tp1404
a(g185
V
tp1405
a(g198
V(
tp1406
a(g18
VUnion
p1407
tp1408
a(g198
V)
tp1409
a(g198
V;
tp1410
a(g185
V\u000a
tp1411
a(g185
V
p1412
tp1413
a(g123
Vpragma
p1414
tp1415
a(g185
V
tp1416
a(g350
VConvention
p1417
tp1418
a(g185
V
tp1419
a(g198
V(
tp1420
a(g73
VC
tp1421
a(g198
V,
tp1422
a(g185
V
tp1423
a(g18
VUnion
p1424
tp1425
a(g198
V)
tp1426
a(g198
V;
tp1427
a(g185
V\u000a
tp1428
a(g185
V
p1429
tp1430
a(g185
V\u000a
tp1431
a(g185
V
p1432
tp1433
a(g127
Vtype
p1434
tp1435
a(g185
V
tp1436
a(g135
VPerson
p1437
tp1438
a(g185
V
tp1439
a(g123
Vis
p1440
tp1441
a(g185
V
tp1442
a(g123
Vtagged
p1443
tp1444
a(g185
V
tp1445
a(g185
V\u000a
tp1446
a(g185
V
p1447
tp1448
a(g123
Vrecord
p1449
tp1450
a(g185
V\u000a
tp1451
a(g185
V
p1452
tp1453
a(g73
VName
p1454
tp1455
a(g185
V
p1456
tp1457
a(g198
V:
p1458
tp1459
a(g135
VString
p1460
tp1461
a(g185
V
tp1462
a(g198
V(
tp1463
a(g314
V1
tp1464
a(g185
V
tp1465
a(g198
V.
tp1466
a(g198
V.
tp1467
a(g185
V
tp1468
a(g314
V10
p1469
tp1470
a(g198
V)
tp1471
a(g198
V;
tp1472
a(g185
V\u000a
tp1473
a(g185
V
p1474
tp1475
a(g18
VGender
p1476
tp1477
a(g185
V
tp1478
a(g198
V:
tp1479
a(g185
V
tp1480
a(g18
VGender_Type
p1481
tp1482
a(g198
V;
tp1483
a(g185
V\u000a
tp1484
a(g185
V
p1485
tp1486
a(g123
Vend
p1487
tp1488
a(g185
V
tp1489
a(g123
Vrecord
p1490
tp1491
a(g198
V;
tp1492
a(g185
V\u000a
tp1493
a(g185
V
p1494
tp1495
a(g185
V\u000a
tp1496
a(g185
V
p1497
tp1498
a(g127
Vtype
p1499
tp1500
a(g185
V
tp1501
a(g135
VProgrammer
p1502
tp1503
a(g185
V
tp1504
a(g123
Vis
p1505
tp1506
a(g185
V
tp1507
a(g123
Vnew
p1508
tp1509
a(g185
V
tp1510
a(g18
VPerson
p1511
tp1512
a(g185
V
tp1513
a(g123
Vwith
p1514
tp1515
a(g185
V\u000a
tp1516
a(g185
V
p1517
tp1518
a(g123
Vrecord
p1519
tp1520
a(g185
V\u000a
tp1521
a(g185
V
p1522
tp1523
a(g73
VSkilled_In
p1524
tp1525
a(g185
V
tp1526
a(g198
V:
p1527
tp1528
a(g18
VLanguage_List
p1529
tp1530
a(g198
V;
tp1531
a(g185
V\u000a
tp1532
a(g185
V
p1533
tp1534
a(g73
VFavorite_Langauge
p1535
tp1536
a(g185
V
tp1537
a(g198
V:
p1538
tp1539
a(g18
VPython_Type
p1540
tp1541
a(g198
V;
tp1542
a(g185
V\u000a
tp1543
a(g185
V
p1544
tp1545
a(g123
Vend
p1546
tp1547
a(g185
V
tp1548
a(g123
Vrecord
p1549
tp1550
a(g198
V;
tp1551
a(g185
V\u000a
tp1552
a(g185
V
p1553
tp1554
a(g185
V\u000a
tp1555
a(g185
V
p1556
tp1557
a(g127
Vtype
p1558
tp1559
a(g185
V
tp1560
a(g135
VProgrammer
p1561
tp1562
a(g185
V
tp1563
a(g123
Vis
p1564
tp1565
a(g185
V
tp1566
a(g123
Vnew
p1567
tp1568
a(g185
V
tp1569
a(g18
VPerson
p1570
tp1571
a(g185
V
tp1572
a(g185
V\u000a
tp1573
a(g185
V
p1574
tp1575
a(g123
Vand
p1576
tp1577
a(g185
V
tp1578
a(g18
VPrintable
p1579
tp1580
a(g185
V
tp1581
a(g185
V\u000a
tp1582
a(g185
V
p1583
tp1584
a(g123
Vwith
p1585
tp1586
a(g185
V
tp1587
a(g185
V\u000a
tp1588
a(g185
V
p1589
tp1590
a(g123
Vrecord
p1591
tp1592
a(g185
V\u000a
tp1593
a(g185
V
p1594
tp1595
a(g73
VSkilled_In
p1596
tp1597
a(g185
V
tp1598
a(g198
V:
p1599
tp1600
a(g18
VLanguage_List
p1601
tp1602
a(g198
V;
tp1603
a(g185
V\u000a
tp1604
a(g185
V
p1605
tp1606
a(g73
VBlah
p1607
tp1608
a(g185
V
tp1609
a(g198
V:
p1610
tp1611
a(g123
Valiased
p1612
tp1613
a(g185
V
tp1614
a(g135
VInteger
p1615
tp1616
a(g198
V;
tp1617
a(g185
V\u000a
tp1618
a(g185
V
p1619
tp1620
a(g123
Vend
p1621
tp1622
a(g185
V
tp1623
a(g123
Vrecord
p1624
tp1625
a(g198
V;
tp1626
a(g185
V\u000a
tp1627
a(g185
V
p1628
tp1629
a(g185
V\u000a
tp1630
a(g185
V
p1631
tp1632
a(g7
V---------------------\u000a
p1633
tp1634
a(g185
V
p1635
tp1636
a(g7
V-- Scan_Next_Token --\u000a
p1637
tp1638
a(g185
V
p1639
tp1640
a(g7
V---------------------\u000a
p1641
tp1642
a(g185
V
p1643
tp1644
a(g185
V\u000a
tp1645
a(g185
V
p1646
tp1647
a(g127
Vtask
p1648
tp1649
a(g185
V
tp1650
a(g18
VCyclic_Buffer_Task_Type
p1651
tp1652
a(g185
V
tp1653
a(g123
Vis
p1654
tp1655
a(g185
V\u000a
tp1656
a(g185
V
p1657
tp1658
a(g127
Ventry
p1659
tp1660
a(g185
V
tp1661
a(g21
VInsert
p1662
tp1663
a(g185
V
tp1664
a(g198
V(
tp1665
a(g73
VAn_Item
p1666
tp1667
a(g185
V
tp1668
a(g198
V:
p1669
tp1670
a(g123
Vin
p1671
tp1672
a(g185
V
p1673
tp1674
a(g18
VItem
p1675
tp1676
a(g198
V)
tp1677
a(g198
V;
tp1678
a(g185
V\u000a
tp1679
a(g185
V
p1680
tp1681
a(g127
Ventry
p1682
tp1683
a(g185
V
tp1684
a(g21
VRemove
p1685
tp1686
a(g185
V
tp1687
a(g198
V(
tp1688
a(g73
VAn_Item
p1689
tp1690
a(g185
V
tp1691
a(g198
V:
p1692
tp1693
a(g123
Vout
p1694
tp1695
a(g185
V
tp1696
a(g18
VItem
p1697
tp1698
a(g198
V)
tp1699
a(g198
V;
tp1700
a(g185
V\u000a
tp1701
a(g185
V
p1702
tp1703
a(g123
Vend
p1704
tp1705
a(g185
V
tp1706
a(g21
VCyclic_Buffer_Task_Type
p1707
tp1708
a(g198
V;
tp1709
a(g185
V\u000a
tp1710
a(g185
V
p1711
tp1712
a(g185
V\u000a
tp1713
a(g185
V
p1714
tp1715
a(g127
Vtask
p1716
tp1717
a(g185
V
tp1718
a(g123
Vbody
p1719
tp1720
a(g185
V
tp1721
a(g18
VCyclic_Buffer_Task_Type
p1722
tp1723
a(g185
V
tp1724
a(g123
Vis
p1725
tp1726
a(g185
V\u000a
tp1727
a(g185
V
p1728
tp1729
a(g73
VQ_Size
p1730
tp1731
a(g185
V
tp1732
a(g198
V:
p1733
tp1734
a(g123
Vconstant
p1735
tp1736
a(g185
V
tp1737
a(g198
V:=
p1738
tp1739
a(g185
V
tp1740
a(g314
V100
p1741
tp1742
a(g198
V;
tp1743
a(g185
V\u000a
tp1744
a(g185
V
p1745
tp1746
a(g127
Vsubtype
p1747
tp1748
a(g185
V
tp1749
a(g135
VQ_Range
p1750
tp1751
a(g185
V
tp1752
a(g123
Vis
p1753
tp1754
a(g185
V
tp1755
a(g135
VPositive
p1756
tp1757
a(g185
V
tp1758
a(g123
Vrange
p1759
tp1760
a(g185
V
tp1761
a(g314
V1
tp1762
a(g185
V
tp1763
a(g198
V.
tp1764
a(g198
V.
tp1765
a(g185
V
tp1766
a(g18
VQ_Size
p1767
tp1768
a(g198
V;
tp1769
a(g185
V\u000a
tp1770
a(g185
V
p1771
tp1772
a(g73
VLength
p1773
tp1774
a(g185
V
tp1775
a(g198
V:
p1776
tp1777
a(g135
VNatural
p1778
tp1779
a(g185
V
tp1780
a(g123
Vrange
p1781
tp1782
a(g185
V
tp1783
a(g314
V0
tp1784
a(g185
V
tp1785
a(g198
V.
tp1786
a(g198
V.
tp1787
a(g185
V
tp1788
a(g18
VQ_Size
p1789
tp1790
a(g185
V
tp1791
a(g198
V:=
p1792
tp1793
a(g185
V
tp1794
a(g314
V0
tp1795
a(g198
V;
tp1796
a(g185
V\u000a
tp1797
a(g185
V
p1798
tp1799
a(g73
VHead
p1800
tp1801
a(g198
V,
tp1802
a(g185
V
tp1803
a(g73
VTail
p1804
tp1805
a(g185
V
tp1806
a(g198
V:
p1807
tp1808
a(g18
VQ_Range
p1809
tp1810
a(g185
V
tp1811
a(g198
V:=
p1812
tp1813
a(g185
V
tp1814
a(g314
V1
tp1815
a(g198
V;
tp1816
a(g185
V\u000a
tp1817
a(g185
V
p1818
tp1819
a(g73
VData
p1820
tp1821
a(g185
V
tp1822
a(g198
V:
p1823
tp1824
a(g123
Varray
p1825
tp1826
a(g185
V
tp1827
a(g198
V(
tp1828
a(g18
VQ_Range
p1829
tp1830
a(g198
V)
tp1831
a(g185
V
tp1832
a(g123
Vof
p1833
tp1834
a(g185
V
tp1835
a(g18
VItem
p1836
tp1837
a(g198
V;
tp1838
a(g185
V\u000a
tp1839
a(g185
V
p1840
tp1841
a(g123
Vbegin
p1842
tp1843
a(g185
V\u000a
tp1844
a(g185
V
p1845
tp1846
a(g123
Vloop
p1847
tp1848
a(g185
V\u000a
tp1849
a(g185
V
p1850
tp1851
a(g123
Vselect
p1852
tp1853
a(g185
V\u000a
tp1854
a(g185
V
p1855
tp1856
a(g123
Vwhen
p1857
tp1858
a(g185
V
tp1859
a(g18
VLength
p1860
tp1861
a(g185
V
tp1862
a(g339
V<
tp1863
a(g185
V
tp1864
a(g18
VQ_Size
p1865
tp1866
a(g185
V
tp1867
a(g198
V=>
p1868
tp1869
a(g185
V\u000a
tp1870
a(g185
V
p1871
tp1872
a(g123
Vaccept
p1873
tp1874
a(g185
V
tp1875
a(g18
VInsert
p1876
tp1877
a(g185
V
tp1878
a(g198
V(
tp1879
a(g73
VAn_Item
p1880
tp1881
a(g185
V
tp1882
a(g198
V:
p1883
tp1884
a(g123
Vin
p1885
tp1886
a(g185
V
p1887
tp1888
a(g18
VItem
p1889
tp1890
a(g198
V)
tp1891
a(g185
V
tp1892
a(g123
Vdo
p1893
tp1894
a(g185
V\u000a
tp1895
a(g185
V
p1896
tp1897
a(g18
VData
p1898
tp1899
a(g198
V(
tp1900
a(g18
VTail
p1901
tp1902
a(g198
V)
tp1903
a(g185
V
tp1904
a(g198
V:=
p1905
tp1906
a(g185
V
tp1907
a(g18
VAn_Item
p1908
tp1909
a(g198
V;
tp1910
a(g185
V\u000a
tp1911
a(g185
V
p1912
tp1913
a(g123
Vend
p1914
tp1915
a(g185
V
tp1916
a(g21
VInsert
p1917
tp1918
a(g198
V;
tp1919
a(g185
V\u000a
tp1920
a(g185
V
p1921
tp1922
a(g18
VTail
p1923
tp1924
a(g185
V
tp1925
a(g198
V:=
p1926
tp1927
a(g185
V
tp1928
a(g18
VTail
p1929
tp1930
a(g185
V
tp1931
a(g343
Vmod
p1932
tp1933
a(g185
V
tp1934
a(g18
VQ_Size
p1935
tp1936
a(g185
V
tp1937
a(g339
V+
tp1938
a(g185
V
tp1939
a(g314
V1
tp1940
a(g198
V;
tp1941
a(g185
V\u000a
tp1942
a(g185
V
p1943
tp1944
a(g18
VLength
p1945
tp1946
a(g185
V
tp1947
a(g198
V:=
p1948
tp1949
a(g185
V
tp1950
a(g18
VLength
p1951
tp1952
a(g185
V
tp1953
a(g339
V+
tp1954
a(g185
V
tp1955
a(g314
V1
tp1956
a(g198
V;
tp1957
a(g185
V\u000a
tp1958
a(g185
V
p1959
tp1960
a(g123
Vor
p1961
tp1962
a(g185
V\u000a
tp1963
a(g185
V
p1964
tp1965
a(g123
Vwhen
p1966
tp1967
a(g185
V
tp1968
a(g18
VLength
p1969
tp1970
a(g185
V
tp1971
a(g339
V>
tp1972
a(g185
V
tp1973
a(g314
V0
tp1974
a(g185
V
tp1975
a(g198
V=>
p1976
tp1977
a(g185
V\u000a
tp1978
a(g185
V
p1979
tp1980
a(g123
Vaccept
p1981
tp1982
a(g185
V
tp1983
a(g18
VRemove
p1984
tp1985
a(g185
V
tp1986
a(g198
V(
tp1987
a(g73
VAn_Item
p1988
tp1989
a(g185
V
tp1990
a(g198
V:
p1991
tp1992
a(g123
Vout
p1993
tp1994
a(g185
V
tp1995
a(g18
VItem
p1996
tp1997
a(g198
V)
tp1998
a(g185
V
tp1999
a(g123
Vdo
p2000
tp2001
a(g185
V\u000a
tp2002
a(g185
V
p2003
tp2004
a(g18
VAn_Item
p2005
tp2006
a(g185
V
tp2007
a(g198
V:=
p2008
tp2009
a(g185
V
tp2010
a(g18
VData
p2011
tp2012
a(g198
V(
tp2013
a(g18
VHead
p2014
tp2015
a(g198
V)
tp2016
a(g198
V;
tp2017
a(g185
V\u000a
tp2018
a(g185
V
p2019
tp2020
a(g123
Vend
p2021
tp2022
a(g185
V
tp2023
a(g21
VRemove
p2024
tp2025
a(g198
V;
tp2026
a(g185
V\u000a
tp2027
a(g185
V
p2028
tp2029
a(g18
VHead
p2030
tp2031
a(g185
V
tp2032
a(g198
V:=
p2033
tp2034
a(g185
V
tp2035
a(g18
VHead
p2036
tp2037
a(g185
V
tp2038
a(g343
Vmod
p2039
tp2040
a(g185
V
tp2041
a(g18
VQ_Size
p2042
tp2043
a(g185
V
tp2044
a(g339
V+
tp2045
a(g185
V
tp2046
a(g314
V1
tp2047
a(g198
V;
tp2048
a(g185
V\u000a
tp2049
a(g185
V
p2050
tp2051
a(g18
VLength
p2052
tp2053
a(g185
V
tp2054
a(g198
V:=
p2055
tp2056
a(g185
V
tp2057
a(g18
VLength
p2058
tp2059
a(g185
V
tp2060
a(g339
V-
tp2061
a(g185
V
tp2062
a(g314
V1
tp2063
a(g198
V;
tp2064
a(g185
V\u000a
tp2065
a(g185
V
p2066
tp2067
a(g123
Vend
p2068
tp2069
a(g185
V
tp2070
a(g123
Vselect
p2071
tp2072
a(g198
V;
tp2073
a(g185
V\u000a
tp2074
a(g185
V
p2075
tp2076
a(g123
Vend
p2077
tp2078
a(g185
V
tp2079
a(g123
Vloop
p2080
tp2081
a(g198
V;
tp2082
a(g185
V\u000a
tp2083
a(g185
V
p2084
tp2085
a(g123
Vend
p2086
tp2087
a(g185
V
tp2088
a(g21
VCyclic_Buffer_Task_Type
p2089
tp2090
a(g198
V;
tp2091
a(g185
V\u000a
tp2092
a(g185
V
p2093
tp2094
a(g185
V\u000a
tp2095
a(g185
V
p2096
tp2097
a(g185
V\u000a
tp2098
a(g185
V
p2099
tp2100
a(g185
V\u000a
tp2101
a(g185
V
p2102
tp2103
a(g127
Vprocedure
p2104
tp2105
a(g185
V
tp2106
a(g21
VScan_Next_Token
p2107
tp2108
a(g185
V\u000a
tp2109
a(g185
V
p2110
tp2111
a(g198
V(
tp2112
a(g73
VS
tp2113
a(g185
V
p2114
tp2115
a(g198
V:
p2116
tp2117
a(g123
Vin
p2118
tp2119
a(g185
V
p2120
tp2121
a(g135
VString
p2122
tp2123
a(g198
V;
tp2124
a(g185
V\u000a
tp2125
a(g185
V
p2126
tp2127
a(g73
VStart_Index
p2128
tp2129
a(g185
V
tp2130
a(g198
V:
p2131
tp2132
a(g185
V
p2133
tp2134
a(g123
Vout
p2135
tp2136
a(g185
V
tp2137
a(g135
VPositive
p2138
tp2139
a(g198
V;
tp2140
a(g185
V\u000a
tp2141
a(g185
V
p2142
tp2143
a(g73
VEnd_Index
p2144
tp2145
a(g185
V
p2146
tp2147
a(g198
V:
p2148
tp2149
a(g123
Vin
p2150
tp2151
a(g185
V
tp2152
a(g123
Vout
p2153
tp2154
a(g185
V
tp2155
a(g135
VNatural
p2156
tp2157
a(g198
V;
tp2158
a(g185
V
p2159
tp2160
a(g7
V-- Tricky comment\u000a
p2161
tp2162
a(g185
V
p2163
tp2164
a(g73
VLine_Number
p2165
tp2166
a(g185
V
tp2167
a(g198
V:
p2168
tp2169
a(g123
Vin
p2170
tp2171
a(g185
V
tp2172
a(g123
Vout
p2173
tp2174
a(g185
V
tp2175
a(g135
VPositive
p2176
tp2177
a(g198
V;
tp2178
a(g185
V\u000a
tp2179
a(g185
V
p2180
tp2181
a(g73
VToken
p2182
tp2183
a(g185
V
p2184
tp2185
a(g198
V:
p2186
tp2187
a(g185
V
p2188
tp2189
a(g123
Vout
p2190
tp2191
a(g185
V
tp2192
a(g18
VToken_T
p2193
tp2194
a(g198
V)
tp2195
a(g198
V;
tp2196
a(g185
V\u000a
tp2197
a(g185
V
p2198
tp2199
a(g185
V\u000a
tp2200
a(g185
V
p2201
tp2202
a(g127
Vprocedure
p2203
tp2204
a(g185
V
tp2205
a(g21
VScan_Next_Token
p2206
tp2207
a(g185
V\u000a
tp2208
a(g185
V
p2209
tp2210
a(g198
V(
tp2211
a(g73
VS
tp2212
a(g185
V
p2213
tp2214
a(g198
V:
p2215
tp2216
a(g123
Vin
p2217
tp2218
a(g185
V
p2219
tp2220
a(g135
VString
p2221
tp2222
a(g198
V;
tp2223
a(g185
V\u000a
tp2224
a(g185
V
p2225
tp2226
a(g73
VStart_Index
p2227
tp2228
a(g185
V
tp2229
a(g198
V:
p2230
tp2231
a(g185
V
p2232
tp2233
a(g123
Vout
p2234
tp2235
a(g185
V
tp2236
a(g135
VPositive
p2237
tp2238
a(g198
V;
tp2239
a(g185
V\u000a
tp2240
a(g185
V
p2241
tp2242
a(g73
VEnd_Index
p2243
tp2244
a(g185
V
p2245
tp2246
a(g198
V:
p2247
tp2248
a(g123
Vin
p2249
tp2250
a(g185
V
tp2251
a(g123
Vout
p2252
tp2253
a(g185
V
tp2254
a(g135
VNatural
p2255
tp2256
a(g198
V;
tp2257
a(g185
V
p2258
tp2259
a(g7
V-- Another comment\u000a
p2260
tp2261
a(g185
V
p2262
tp2263
a(g73
VLine_Number
p2264
tp2265
a(g185
V
tp2266
a(g198
V:
p2267
tp2268
a(g123
Vin
p2269
tp2270
a(g185
V
tp2271
a(g123
Vout
p2272
tp2273
a(g185
V
tp2274
a(g135
VPositive
p2275
tp2276
a(g198
V;
tp2277
a(g185
V\u000a
tp2278
a(g185
V
p2279
tp2280
a(g73
VToken
p2281
tp2282
a(g185
V
p2283
tp2284
a(g198
V:
p2285
tp2286
a(g185
V
p2287
tp2288
a(g123
Vout
p2289
tp2290
a(g185
V
tp2291
a(g18
VToken_T
p2292
tp2293
a(g198
V)
tp2294
a(g185
V\u000a
tp2295
a(g185
V
p2296
tp2297
a(g123
Vis
p2298
tp2299
a(g185
V\u000a
tp2300
a(g185
V
p2301
tp2302
a(g123
Vbegin
p2303
tp2304
a(g185
V\u000a
tp2305
a(g185
V
p2306
tp2307
a(g45
VScanner_Loop
p2308
tp2309
a(g198
V:
tp2310
a(g185
V\u000a
p2311
tp2312
a(g123
Vloop
p2313
tp2314
a(g185
V\u000a
tp2315
a(g185
V
p2316
tp2317
a(g123
Vif
p2318
tp2319
a(g185
V
tp2320
a(g18
VNew_State
p2321
tp2322
a(g185
V
tp2323
a(g339
V=
tp2324
a(g185
V
tp2325
a(g18
VEnd_Error
p2326
tp2327
a(g185
V
tp2328
a(g123
Vthen
p2329
tp2330
a(g185
V\u000a
tp2331
a(g185
V
p2332
tp2333
a(g123
Vexit
p2334
tp2335
a(g185
V
tp2336
a(g18
VScanner_Loop
p2337
tp2338
a(g198
V;
tp2339
a(g185
V\u000a
tp2340
a(g185
V
p2341
tp2342
a(g123
Vend
p2343
tp2344
a(g185
V
tp2345
a(g123
Vif
p2346
tp2347
a(g198
V;
tp2348
a(g185
V\u000a\u000a
p2349
tp2350
a(g185
V
p2351
tp2352
a(g123
Vif
p2353
tp2354
a(g185
V
tp2355
a(g18
VState
p2356
tp2357
a(g185
V
tp2358
a(g339
V=
tp2359
a(g185
V
tp2360
a(g18
VStart
p2361
tp2362
a(g185
V
tp2363
a(g343
Vand
p2364
tp2365
a(g185
V
tp2366
a(g18
VNew_State
p2367
tp2368
a(g185
V
tp2369
a(g339
V/
tp2370
a(g339
V=
tp2371
a(g185
V
tp2372
a(g18
VStart
p2373
tp2374
a(g185
V
tp2375
a(g123
Vthen
p2376
tp2377
a(g185
V\u000a
tp2378
a(g185
V
p2379
tp2380
a(g18
VStart_Index
p2381
tp2382
a(g185
V
tp2383
a(g198
V:=
p2384
tp2385
a(g185
V
tp2386
a(g18
VPeek_Index
p2387
tp2388
a(g198
V;
tp2389
a(g185
V\u000a
tp2390
a(g185
V
p2391
tp2392
a(g123
Vend
p2393
tp2394
a(g185
V
tp2395
a(g123
Vif
p2396
tp2397
a(g198
V;
tp2398
a(g185
V\u000a
tp2399
a(g185
V
p2400
tp2401
a(g123
Vend
p2402
tp2403
a(g185
V
tp2404
a(g123
Vloop
p2405
tp2406
a(g185
V
tp2407
a(g21
VScanner_Loop
p2408
tp2409
a(g198
V;
tp2410
a(g185
V\u000a
tp2411
a(g185
V
p2412
tp2413
a(g123
Vend
p2414
tp2415
a(g185
V
tp2416
a(g21
VScan_Next_Token
p2417
tp2418
a(g198
V;
tp2419
a(g185
V\u000a
tp2420
a(g185
V
p2421
tp2422
a(g185
V\u000a
tp2423
a(g185
V
p2424
tp2425
a(g127
Vprocedure
p2426
tp2427
a(g185
V
tp2428
a(g21
VAdvance
p2429
tp2430
a(g185
V
tp2431
a(g123
Vis
p2432
tp2433
a(g185
V\u000a
tp2434
a(g185
V
p2435
tp2436
a(g123
Vbegin
p2437
tp2438
a(g185
V\u000a
tp2439
a(g185
V
p2440
tp2441
a(g18
VPeek_Index
p2442
tp2443
a(g185
V
tp2444
a(g198
V:=
p2445
tp2446
a(g185
V
tp2447
a(g18
VPeek_Index
p2448
tp2449
a(g185
V
tp2450
a(g339
V+
tp2451
a(g185
V
tp2452
a(g314
V1
tp2453
a(g198
V;
tp2454
a(g185
V\u000a
tp2455
a(g185
V
p2456
tp2457
a(g123
Vend
p2458
tp2459
a(g185
V
tp2460
a(g21
VAdvance
p2461
tp2462
a(g198
V;
tp2463
a(g185
V\u000a
tp2464
a(g185
V
p2465
tp2466
a(g185
V\u000a\u000a
p2467
tp2468
a(g185
V
p2469
tp2470
a(g7
V-- Eliminate the leading space that Ada puts in front of positive\u000a
p2471
tp2472
a(g185
V
p2473
tp2474
a(g7
V-- integer images.\u000a
p2475
tp2476
a(g185
V
p2477
tp2478
a(g127
Vfunction
p2479
tp2480
a(g185
V
tp2481
a(g21
VImage
p2482
tp2483
a(g198
V(
tp2484
a(g73
VN
tp2485
a(g185
V
tp2486
a(g198
V:
p2487
tp2488
a(g123
Vin
p2489
tp2490
a(g185
V
tp2491
a(g135
VInteger
p2492
tp2493
a(g198
V)
tp2494
a(g185
V
tp2495
a(g123
Vreturn
p2496
tp2497
a(g185
V
tp2498
a(g135
VString
p2499
tp2500
a(g185
V
tp2501
a(g123
Vis
p2502
tp2503
a(g185
V\u000a
tp2504
a(g185
V
p2505
tp2506
a(g18
VS
tp2507
a(g185
V
tp2508
a(g198
V:
tp2509
a(g185
V
tp2510
a(g135
VString
p2511
tp2512
a(g185
V
tp2513
a(g198
V:=
p2514
tp2515
a(g185
V
tp2516
a(g135
VInteger
p2517
tp2518
a(g198
V'
tp2519
a(g41
VImage
p2520
tp2521
a(g198
V(
tp2522
a(g18
VN
tp2523
a(g198
V)
tp2524
a(g198
V;
tp2525
a(g185
V\u000a
tp2526
a(g185
V
p2527
tp2528
a(g123
Vbegin
p2529
tp2530
a(g185
V\u000a
tp2531
a(g185
V
p2532
tp2533
a(g123
Vif
p2534
tp2535
a(g185
V
tp2536
a(g18
VS
tp2537
a(g198
V(
tp2538
a(g314
V1
tp2539
a(g198
V)
tp2540
a(g185
V
tp2541
a(g339
V=
tp2542
a(g185
V
tp2543
a(g252
V' '
p2544
tp2545
a(g185
V
tp2546
a(g123
Vthen
p2547
tp2548
a(g185
V\u000a
tp2549
a(g185
V
p2550
tp2551
a(g123
Vreturn
p2552
tp2553
a(g185
V
tp2554
a(g18
VS
tp2555
a(g198
V(
tp2556
a(g314
V2
tp2557
a(g185
V
tp2558
a(g198
V.
tp2559
a(g198
V.
tp2560
a(g185
V
tp2561
a(g18
VS
tp2562
a(g198
V'
tp2563
a(g41
VLast
p2564
tp2565
a(g198
V)
tp2566
a(g198
V;
tp2567
a(g185
V\u000a
tp2568
a(g185
V
p2569
tp2570
a(g123
Vend
p2571
tp2572
a(g185
V
tp2573
a(g123
Vif
p2574
tp2575
a(g198
V;
tp2576
a(g185
V\u000a
tp2577
a(g185
V
p2578
tp2579
a(g123
Vreturn
p2580
tp2581
a(g185
V
tp2582
a(g18
VS
tp2583
a(g198
V;
tp2584
a(g185
V\u000a
tp2585
a(g185
V
p2586
tp2587
a(g123
Vend
p2588
tp2589
a(g185
V
tp2590
a(g21
VImage
p2591
tp2592
a(g198
V;
tp2593
a(g185
V\u000a\u000a
p2594
tp2595
a(g123
Vend
p2596
tp2597
a(g185
V
tp2598
a(g21
VScanner
p2599
tp2600
a(g198
V;
tp2601
a(g185
V\u000a
tp2602
a. |
-----------------------------------------------------------------------
-- wiki-streams-text_io -- Text_IO input output streams
-- Copyright (C) 2016 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;
with Wiki.Helpers;
package body Wiki.Streams.Text_IO is
-- ------------------------------
-- Open the file and prepare to read the input stream.
-- ------------------------------
procedure Open (Stream : in out File_Input_Stream;
Path : in String;
Form : in String := "") is
begin
Ada.Wide_Wide_Text_IO.Open (Stream.File, Ada.Wide_Wide_Text_IO.In_File, Path, Form);
end Open;
-- ------------------------------
-- Close the file.
-- ------------------------------
procedure Close (Stream : in out File_Input_Stream) is
begin
if Ada.Wide_Wide_Text_IO.Is_Open (Stream.File) then
Ada.Wide_Wide_Text_IO.Close (Stream.File);
end if;
end Close;
-- ------------------------------
-- Close the stream.
-- ------------------------------
overriding
procedure Finalize (Stream : in out File_Input_Stream) is
begin
Stream.Close;
end Finalize;
-- ------------------------------
-- Read one character from the input stream and return False to the <tt>Eof</tt> indicator.
-- When there is no character to read, return True in the <tt>Eof</tt> indicator.
-- ------------------------------
overriding
procedure Read (Input : in out File_Input_Stream;
Char : out Wiki.Strings.WChar;
Eof : out Boolean) is
Available : Boolean;
begin
Eof := False;
Ada.Wide_Wide_Text_IO.Get_Immediate (Input.File, Char, Available);
exception
when Ada.IO_Exceptions.End_Error =>
Char := Wiki.Helpers.LF;
Eof := True;
end Read;
-- ------------------------------
-- Open the file and prepare to write the output stream.
-- ------------------------------
procedure Open (Stream : in out File_Output_Stream;
Path : in String;
Form : in String := "") is
begin
if Ada.Wide_Wide_Text_IO.Is_Open (Stream.File) then
Ada.Wide_Wide_Text_IO.Close (Stream.File);
end if;
Ada.Wide_Wide_Text_IO.Open (Stream.File, Ada.Wide_Wide_Text_IO.Out_File, Path, Form);
Ada.Wide_Wide_Text_IO.Set_Line_Length (Ada.Wide_Wide_Text_IO.Count'Last);
Stream.Stdout := False;
end Open;
-- ------------------------------
-- Create the file and prepare to write the output stream.
-- ------------------------------
procedure Create (Stream : in out File_Output_Stream;
Path : in String;
Form : in String := "") is
begin
Ada.Wide_Wide_Text_IO.Create (Stream.File, Ada.Wide_Wide_Text_IO.Out_File, Path, Form);
Ada.Wide_Wide_Text_IO.Set_Line_Length (Ada.Wide_Wide_Text_IO.Count'Last);
Stream.Stdout := False;
end Create;
-- ------------------------------
-- Close the file.
-- ------------------------------
procedure Close (Stream : in out File_Output_Stream) is
begin
if Ada.Wide_Wide_Text_IO.Is_Open (Stream.File) then
Ada.Wide_Wide_Text_IO.Close (Stream.File);
end if;
end Close;
-- ------------------------------
-- Write the string to the output stream.
-- ------------------------------
overriding
procedure Write (Stream : in out File_Output_Stream;
Content : in Wiki.Strings.WString) is
begin
if not Stream.Stdout then
Ada.Wide_Wide_Text_IO.Put (Stream.File, Content);
else
Ada.Wide_Wide_Text_IO.Put (Content);
end if;
end Write;
-- ------------------------------
-- Write a single character to the output stream.
-- ------------------------------
overriding
procedure Write (Stream : in out File_Output_Stream;
Char : in Wiki.Strings.WChar) is
begin
if not Stream.Stdout then
Ada.Wide_Wide_Text_IO.Put (Stream.File, Char);
else
Ada.Wide_Wide_Text_IO.Put (Char);
end if;
end Write;
-- ------------------------------
-- Close the stream.
-- ------------------------------
overriding
procedure Finalize (Stream : in out File_Output_Stream) is
begin
Stream.Close;
end Finalize;
end Wiki.Streams.Text_IO;
|
-- SPDX-FileCopyrightText: 2022 Max Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Interfaces.C;
with System;
package body Bluetooth is
function Raw_Data (Value : Byte_Array) return Advertising_Data is
begin
return Result : Advertising_Data do
Result.Raw := (Value'Length, Value);
end return;
end Raw_Data;
package body Peripheral_Device is
type Byte_Index_Array is array (Characteristic_Index) of Byte_Index'Base;
function Get_Offset_Array return Byte_Index_Array;
function Get_Offset_Array return Byte_Index_Array is
Last : Byte_Index := 1;
begin
return Result : Byte_Index_Array do
for Index in Characteristic_Array'Range loop
Result (Index) := Last;
Last := Last + Characteristic_Array (Index).Max_Length;
end loop;
end return;
end Get_Offset_Array;
Initialized : Boolean := False;
Characteristic_Offset : constant Byte_Index_Array := Get_Offset_Array;
Total_Size : constant Byte_Index :=
Characteristic_Offset (Characteristic_Index'Last) +
Characteristic_Array (Characteristic_Index'Last).Max_Length - 1;
pragma Compile_Time_Error
(Total_Size > Buffer_Size, "Buffer_Size too small");
protected Protected_Buffer is
procedure Write
(Index : Characteristic_Index;
Data : Byte_Array);
procedure Read
(Index : Characteristic_Index;
Data : out Byte_Array;
Last : out Byte_Index);
private
Buffer : Byte_Array (1 .. Buffer_Size);
Bound : Byte_Index_Array := (Characteristic_Index'Range => 0);
end Protected_Buffer;
protected body Protected_Buffer is
procedure Write
(Index : Characteristic_Index;
Data : Byte_Array) is
begin
Bound (Index) := Characteristic_Offset (Index) + Data'Length - 1;
Buffer (Characteristic_Offset (Index) .. Bound (Index)) := Data;
end Write;
procedure Read
(Index : Characteristic_Index;
Data : out Byte_Array;
Last : out Byte_Index) is
begin
Last := Bound (Index) - Characteristic_Offset (Index) + Data'First;
Data (Data'First .. Last) :=
Buffer (Characteristic_Offset (Index) .. Bound (Index));
end Read;
end Protected_Buffer;
package Nimble is
procedure Run;
end Nimble;
package body Nimble is
procedure Set_Services;
procedure On_Sync_Callback
with Convention => C;
procedure Start_Advertising;
procedure GAP_Event (Code : Interfaces.C.int)
with Convention => C;
procedure Char_Callback
(Code : Interfaces.C.int;
Index : Interfaces.C.int;
Buffer : System.Address;
Size : in out Interfaces.C.int)
with Convention => C;
procedure GAP_Event (Code : Interfaces.C.int) is
begin
case Code is
when 0 =>
Start_Advertising;
when others =>
null;
end case;
end GAP_Event;
procedure Char_Callback
(Code : Interfaces.C.int;
Index : Interfaces.C.int;
Buffer : System.Address;
Size : in out Interfaces.C.int)
is
use type Interfaces.C.int;
procedure puts
(data : System.Address)
with Import, Convention => C, External_Name => "puts";
Last : Byte_Index;
Char : constant Characteristic_Index :=
Characteristic_Index'Val (Index);
Target : Byte_Array (1 .. 32)
with Address => Buffer;
begin
Protected_Buffer.Read (Char, Target, Last);
Size := Interfaces.C.int (Last);
end Char_Callback;
procedure Run is
procedure internal_bt_init (Callback : System.Address)
with Import,
Convention => C,
External_Name => "internal_bt_init";
procedure internal_bt_start
with Import,
Convention => C,
External_Name => "internal_bt_start";
begin
internal_bt_init (On_Sync_Callback'Address);
Set_Services;
internal_bt_start;
end Run;
procedure On_Sync_Callback is
procedure ble_app_set_addr
with Import,
Convention => C,
External_Name => "ble_app_set_addr";
begin
ble_app_set_addr;
Start_Advertising;
end On_Sync_Callback;
procedure Set_Services is
procedure add_chr_def
(p_index : Interfaces.C.int;
p_uid : Interfaces.C.int;
flags : Interfaces.C.unsigned;
callback : System.Address)
with Import, Convention => C, External_Name => "add_chr_def";
procedure add_svc_def (p_uid : Interfaces.C.int)
with Import, Convention => C, External_Name => "add_svc_def";
procedure complete_svc_def
with Import, Convention => C, External_Name => "complete_svc_def";
function To_Flags (Set : Characteristic_Property_Set)
return Interfaces.C.unsigned
is
use type Interfaces.C.unsigned;
Map : constant
array (Characteristic_Property) of Interfaces.C.unsigned :=
(Read => 1, Write => 2, Notify => 4, Indicate => 0);
Result : Interfaces.C.unsigned := 0;
begin
for J in Set'Range loop
if Set (J) then
Result := Result + Map (J);
end if;
end loop;
return Result;
end To_Flags;
begin
for Service of Service_Array loop
add_svc_def (Interfaces.C.int (Service.UID));
for Index in
Service.First_Characteristic .. Service.Last_Characteristic
loop
declare
Char : Characteristic_Information renames
Characteristic_Array (Index);
begin
add_chr_def
(Characteristic_Index'Pos (Index),
Interfaces.C.int (Char.UID),
To_Flags (Char.Property_Set),
Char_Callback'Address);
end;
end loop;
end loop;
complete_svc_def;
end Set_Services;
procedure Start_Advertising
is
procedure ble_app_advertise
(data : System.Address;
data_len : Interfaces.C.int;
callback : System.Address)
with Import,
Convention => C,
External_Name => "ble_app_advertise";
begin
ble_app_advertise
(Advertising.Raw.Data'Address,
Interfaces.C.int (Advertising.Raw.Length),
GAP_Event'Address);
end Start_Advertising;
end Nimble;
procedure Run is
begin
if not Initialized then
Initialized := True;
Nimble.Run;
end if;
end Run;
procedure Write
(Index : Characteristic_Index;
Data : Byte_Array)
is
procedure ble_notify_chr_change
(p_index : Interfaces.C.int;
data : System.Address;
data_len : Interfaces.C.int)
with Import,
Convention => C,
External_Name => "ble_notify_chr_change";
begin
Protected_Buffer.Write (Index, Data);
if Initialized
and Characteristic_Array (Index).Property_Set (Notify)
then
ble_notify_chr_change
(Characteristic_Index'Pos (Index),
Data'Address,
Data'Length);
end if;
end Write;
procedure Read
(Index : Characteristic_Index;
Data : out Byte_Array;
Last : out Byte_Index) is
begin
Protected_Buffer.Read (Index, Data, Last);
end Read;
end Peripheral_Device;
end Bluetooth; |
with Ada.Text_IO;
with Ada.Integer_Text_IO;
-- Copyright 2021 Melwyn Francis Carlo
procedure A067 is
use Ada.Text_IO;
use Ada.Integer_Text_IO;
FT : File_Type;
Last_Index : Natural;
File_Name : constant String :=
"problems/067/p067_triangle.txt";
Triangle_Num_Row : String (1 .. 300);
Triangle_Num : String (1 .. 2);
Triangle : array (Integer range 1 .. 100,
Integer range 1 .. 100) of Integer;
I : Integer := 1;
J, Digits_N : Integer;
begin
Open (FT, In_File, File_Name);
while not End_Of_File (FT) loop
Get_Line (FT, Triangle_Num_Row, Last_Index);
J := 1;
Digits_N := 1;
for Digits_I in 1 .. Last_Index + 1 loop
if Digits_N <= 2 then
Triangle_Num (Digits_N) := Triangle_Num_Row (Digits_I);
Digits_N := Digits_N + 1;
else
Triangle (I, J) := Integer'Value (Triangle_Num);
Digits_N := 1;
J := J + 1;
end if;
end loop;
if J <= 100 then
while J /= 100 loop
Triangle (I, J) := 0;
J := J + 1;
end loop;
end if;
I := I + 1;
end loop;
Close (FT);
for I in reverse 1 .. 99 loop
for J in 1 .. I loop
if Triangle (I + 1, J) >= Triangle (I + 1, J + 1) then
Triangle (I, J) := Triangle (I, J) + Triangle (I + 1, J);
else
Triangle (I, J) := Triangle (I, J) + Triangle (I + 1, J + 1);
end if;
end loop;
end loop;
Put (Triangle (1, 1), Width => 0);
end A067;
|
with
AdaM.Factory;
package body AdaM.compilation_Unit
is
-- Storage Pool
--
record_Version : constant := 1;
max_Units : constant := 5_000;
package Pool is new AdaM.Factory.Pools (".adam-store",
"compilation_Units",
max_Units,
record_Version,
compilation_Unit.item,
compilation_Unit.view);
-- Forge
--
procedure define (Self : in out Item; Name : in String;
of_Kind : in unit_Kind)
is
begin
Self.Name := +Name;
case of_Kind
is
when library_unit_Kind =>
Self.library_Item := (Kind => library_unit_Kind,
library_Item => null);
when subunit_Kind =>
Self.library_Item := (Kind => subunit_Kind,
Subunit => null);
end case;
end define;
procedure destruct (Self : in out Item)
is
begin
null;
end destruct;
function new_compilation_Unit (Name : in String := "") return compilation_Unit.view
is
new_Unit : constant compilation_Unit.view := Pool.new_Item;
begin
new_Unit.Name := +Name;
return new_Unit;
end new_compilation_Unit;
function new_library_Unit (Name : in String := "";
the_Item : in AdaM.library_Item.view) return compilation_Unit.view
is
new_View : constant compilation_Unit.view := Pool.new_Item;
begin
define (compilation_Unit.item (new_View.all), Name, library_unit_Kind);
new_View.library_Item.library_Item := the_Item;
return new_View;
end new_library_Unit;
function new_Subunit (Name : in String := "";
the_Unit : in Subunit.view) return compilation_Unit.view
is
new_View : constant compilation_Unit.view := Pool.new_Item;
begin
define (compilation_Unit.item (new_View.all), Name, subunit_Kind);
new_View.library_Item.Subunit := the_Unit;
return new_View;
end new_Subunit;
procedure free (Self : in out compilation_Unit.view)
is
begin
destruct (compilation_Unit.item (Self.all));
Pool.free (Self);
end free;
-- Attributes
--
overriding
function Id (Self : access Item) return AdaM.Id
is
begin
return Pool.to_Id (Self);
end Id;
function Kind (Self : in Item) return unit_Kind
is
begin
return Self.library_Item.Kind;
end Kind;
function library_Item (Self : in Item) return AdaM.library_Item.view
is
begin
return Self.library_Item.library_Item;
end library_Item;
function Name (Self : in Item) return String
is
begin
return +Self.Name;
end Name;
procedure Name_is (Self : in out Item; Now : in String)
is
begin
Self.Name := +Now;
end Name_is;
function Entity (Self : in Item) return AdaM.Entity.view
is
begin
return Self.Entity;
end Entity;
procedure Entity_is (Self : in out Item; Now : in AdaM.Entity.view)
is
begin
Self.Entity := Now;
end Entity_is;
-- Streams
--
procedure Item_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in Item)
is
begin
Text'write (Stream, Self.Name);
-- Source.Entities'Output (Stream, Self.Entities);
end Item_write;
procedure Item_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out Item)
is
Version : constant Positive := Pool.storage_record_Version;
begin
case Version
is
when 1 =>
Text'read (Stream, Self.Name);
-- Self.Entities := Source.Entities'Input (Stream);
when others =>
raise Program_Error with "Illegal version number during compilation unit restore.";
end case;
end Item_read;
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View)
renames Pool.View_write;
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View)
renames Pool.View_read;
end AdaM.compilation_Unit;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P R J . T R E E --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 2001 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Stringt; use Stringt;
package body Prj.Tree is
use Tree_Private_Part;
--------------------------------
-- Associative_Array_Index_Of --
--------------------------------
function Associative_Array_Index_Of
(Node : Project_Node_Id)
return String_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Attribute_Declaration));
return Project_Nodes.Table (Node).Value;
end Associative_Array_Index_Of;
----------------------
-- Case_Insensitive --
----------------------
function Case_Insensitive (Node : Project_Node_Id) return Boolean is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Attribute_Declaration));
return Project_Nodes.Table (Node).Case_Insensitive;
end Case_Insensitive;
--------------------------------
-- Case_Variable_Reference_Of --
--------------------------------
function Case_Variable_Reference_Of
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Case_Construction);
return Project_Nodes.Table (Node).Field1;
end Case_Variable_Reference_Of;
-----------------------
-- Current_Item_Node --
-----------------------
function Current_Item_Node
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Declarative_Item);
return Project_Nodes.Table (Node).Field1;
end Current_Item_Node;
------------------
-- Current_Term --
------------------
function Current_Term
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Term);
return Project_Nodes.Table (Node).Field1;
end Current_Term;
--------------------------
-- Default_Project_Node --
--------------------------
function Default_Project_Node
(Of_Kind : Project_Node_Kind;
And_Expr_Kind : Variable_Kind := Undefined)
return Project_Node_Id
is
begin
Project_Nodes.Increment_Last;
Project_Nodes.Table (Project_Nodes.Last) :=
(Kind => Of_Kind,
Location => No_Location,
Directory => No_Name,
Expr_Kind => And_Expr_Kind,
Variables => Empty_Node,
Packages => Empty_Node,
Pkg_Id => Empty_Package,
Name => No_Name,
Path_Name => No_Name,
Value => No_String,
Field1 => Empty_Node,
Field2 => Empty_Node,
Field3 => Empty_Node,
Case_Insensitive => False);
return Project_Nodes.Last;
end Default_Project_Node;
------------------
-- Directory_Of --
------------------
function Directory_Of (Node : Project_Node_Id) return Name_Id is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Project);
return Project_Nodes.Table (Node).Directory;
end Directory_Of;
------------------------
-- Expression_Kind_Of --
------------------------
function Expression_Kind_Of (Node : Project_Node_Id) return Variable_Kind is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Literal_String
or else
Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
or else
Project_Nodes.Table (Node).Kind = N_Variable_Declaration
or else
Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
or else
Project_Nodes.Table (Node).Kind = N_Expression
or else
Project_Nodes.Table (Node).Kind = N_Term
or else
Project_Nodes.Table (Node).Kind = N_Variable_Reference
or else
Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
return Project_Nodes.Table (Node).Expr_Kind;
end Expression_Kind_Of;
-------------------
-- Expression_Of --
-------------------
function Expression_Of
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
or else
Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
or else
Project_Nodes.Table (Node).Kind = N_Variable_Declaration));
return Project_Nodes.Table (Node).Field1;
end Expression_Of;
---------------------------
-- External_Reference_Of --
---------------------------
function External_Reference_Of
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_External_Value);
return Project_Nodes.Table (Node).Field1;
end External_Reference_Of;
-------------------------
-- External_Default_Of --
-------------------------
function External_Default_Of
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_External_Value);
return Project_Nodes.Table (Node).Field2;
end External_Default_Of;
------------------------
-- First_Case_Item_Of --
------------------------
function First_Case_Item_Of
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Case_Construction);
return Project_Nodes.Table (Node).Field2;
end First_Case_Item_Of;
---------------------
-- First_Choice_Of --
---------------------
function First_Choice_Of
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Case_Item);
return Project_Nodes.Table (Node).Field1;
end First_Choice_Of;
-------------------------------
-- First_Declarative_Item_Of --
-------------------------------
function First_Declarative_Item_Of
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Project_Declaration
or else
Project_Nodes.Table (Node).Kind = N_Case_Item
or else
Project_Nodes.Table (Node).Kind = N_Package_Declaration));
if Project_Nodes.Table (Node).Kind = N_Project_Declaration then
return Project_Nodes.Table (Node).Field1;
else
return Project_Nodes.Table (Node).Field2;
end if;
end First_Declarative_Item_Of;
------------------------------
-- First_Expression_In_List --
------------------------------
function First_Expression_In_List
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Literal_String_List);
return Project_Nodes.Table (Node).Field1;
end First_Expression_In_List;
--------------------------
-- First_Literal_String --
--------------------------
function First_Literal_String
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_String_Type_Declaration);
return Project_Nodes.Table (Node).Field1;
end First_Literal_String;
----------------------
-- First_Package_Of --
----------------------
function First_Package_Of
(Node : Project_Node_Id)
return Package_Declaration_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Project);
return Project_Nodes.Table (Node).Packages;
end First_Package_Of;
--------------------------
-- First_String_Type_Of --
--------------------------
function First_String_Type_Of
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Project);
return Project_Nodes.Table (Node).Field3;
end First_String_Type_Of;
----------------
-- First_Term --
----------------
function First_Term
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Expression);
return Project_Nodes.Table (Node).Field1;
end First_Term;
-----------------------
-- First_Variable_Of --
-----------------------
function First_Variable_Of
(Node : Project_Node_Id)
return Variable_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Project
or else
Project_Nodes.Table (Node).Kind = N_Package_Declaration));
return Project_Nodes.Table (Node).Variables;
end First_Variable_Of;
--------------------------
-- First_With_Clause_Of --
--------------------------
function First_With_Clause_Of
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Project);
return Project_Nodes.Table (Node).Field1;
end First_With_Clause_Of;
----------------
-- Initialize --
----------------
procedure Initialize is
begin
Project_Nodes.Set_Last (Empty_Node);
Projects_Htable.Reset;
end Initialize;
-------------
-- Kind_Of --
-------------
function Kind_Of (Node : Project_Node_Id) return Project_Node_Kind is
begin
pragma Assert (Node /= Empty_Node);
return Project_Nodes.Table (Node).Kind;
end Kind_Of;
-----------------
-- Location_Of --
-----------------
function Location_Of (Node : Project_Node_Id) return Source_Ptr is
begin
pragma Assert (Node /= Empty_Node);
return Project_Nodes.Table (Node).Location;
end Location_Of;
-------------------------
-- Modified_Project_Of --
-------------------------
function Modified_Project_Of
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Project_Declaration);
return Project_Nodes.Table (Node).Field2;
end Modified_Project_Of;
------------------------------
-- Modified_Project_Path_Of --
------------------------------
function Modified_Project_Path_Of
(Node : Project_Node_Id)
return String_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Project);
return Project_Nodes.Table (Node).Value;
end Modified_Project_Path_Of;
-------------
-- Name_Of --
-------------
function Name_Of (Node : Project_Node_Id) return Name_Id is
begin
pragma Assert (Node /= Empty_Node);
return Project_Nodes.Table (Node).Name;
end Name_Of;
--------------------
-- Next_Case_Item --
--------------------
function Next_Case_Item
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Case_Item);
return Project_Nodes.Table (Node).Field3;
end Next_Case_Item;
---------------------------
-- Next_Declarative_Item --
---------------------------
function Next_Declarative_Item
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Declarative_Item);
return Project_Nodes.Table (Node).Field2;
end Next_Declarative_Item;
-----------------------------
-- Next_Expression_In_List --
-----------------------------
function Next_Expression_In_List
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Expression);
return Project_Nodes.Table (Node).Field2;
end Next_Expression_In_List;
-------------------------
-- Next_Literal_String --
-------------------------
function Next_Literal_String
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Literal_String);
return Project_Nodes.Table (Node).Field1;
end Next_Literal_String;
-----------------------------
-- Next_Package_In_Project --
-----------------------------
function Next_Package_In_Project
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Package_Declaration);
return Project_Nodes.Table (Node).Field3;
end Next_Package_In_Project;
----------------------
-- Next_String_Type --
----------------------
function Next_String_Type
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_String_Type_Declaration);
return Project_Nodes.Table (Node).Field2;
end Next_String_Type;
---------------
-- Next_Term --
---------------
function Next_Term
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Term);
return Project_Nodes.Table (Node).Field2;
end Next_Term;
-------------------
-- Next_Variable --
-------------------
function Next_Variable
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
or else
Project_Nodes.Table (Node).Kind = N_Variable_Declaration));
return Project_Nodes.Table (Node).Field3;
end Next_Variable;
-------------------------
-- Next_With_Clause_Of --
-------------------------
function Next_With_Clause_Of
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_With_Clause);
return Project_Nodes.Table (Node).Field2;
end Next_With_Clause_Of;
-------------------
-- Package_Id_Of --
-------------------
function Package_Id_Of (Node : Project_Node_Id) return Package_Node_Id is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Package_Declaration);
return Project_Nodes.Table (Node).Pkg_Id;
end Package_Id_Of;
---------------------
-- Package_Node_Of --
---------------------
function Package_Node_Of
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Variable_Reference
or else
Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
return Project_Nodes.Table (Node).Field2;
end Package_Node_Of;
------------------
-- Path_Name_Of --
------------------
function Path_Name_Of (Node : Project_Node_Id) return Name_Id is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Project
or else
Project_Nodes.Table (Node).Kind = N_With_Clause));
return Project_Nodes.Table (Node).Path_Name;
end Path_Name_Of;
----------------------------
-- Project_Declaration_Of --
----------------------------
function Project_Declaration_Of
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Project);
return Project_Nodes.Table (Node).Field2;
end Project_Declaration_Of;
---------------------
-- Project_Node_Of --
---------------------
function Project_Node_Of
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_With_Clause
or else
Project_Nodes.Table (Node).Kind = N_Variable_Reference
or else
Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
return Project_Nodes.Table (Node).Field1;
end Project_Node_Of;
-----------------------------------
-- Project_Of_Renamed_Package_Of --
-----------------------------------
function Project_Of_Renamed_Package_Of
(Node : Project_Node_Id)
return Project_Node_Id
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Package_Declaration);
return Project_Nodes.Table (Node).Field1;
end Project_Of_Renamed_Package_Of;
------------------------------------
-- Set_Associative_Array_Index_Of --
------------------------------------
procedure Set_Associative_Array_Index_Of
(Node : Project_Node_Id;
To : String_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Attribute_Declaration);
Project_Nodes.Table (Node).Value := To;
end Set_Associative_Array_Index_Of;
--------------------------
-- Set_Case_Insensitive --
--------------------------
procedure Set_Case_Insensitive
(Node : Project_Node_Id;
To : Boolean)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Attribute_Declaration);
Project_Nodes.Table (Node).Case_Insensitive := To;
end Set_Case_Insensitive;
------------------------------------
-- Set_Case_Variable_Reference_Of --
------------------------------------
procedure Set_Case_Variable_Reference_Of
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Case_Construction);
Project_Nodes.Table (Node).Field1 := To;
end Set_Case_Variable_Reference_Of;
---------------------------
-- Set_Current_Item_Node --
---------------------------
procedure Set_Current_Item_Node
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Declarative_Item);
Project_Nodes.Table (Node).Field1 := To;
end Set_Current_Item_Node;
----------------------
-- Set_Current_Term --
----------------------
procedure Set_Current_Term
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Term);
Project_Nodes.Table (Node).Field1 := To;
end Set_Current_Term;
----------------------
-- Set_Directory_Of --
----------------------
procedure Set_Directory_Of
(Node : Project_Node_Id;
To : Name_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Project);
Project_Nodes.Table (Node).Directory := To;
end Set_Directory_Of;
----------------------------
-- Set_Expression_Kind_Of --
----------------------------
procedure Set_Expression_Kind_Of
(Node : Project_Node_Id;
To : Variable_Kind)
is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Literal_String
or else
Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
or else
Project_Nodes.Table (Node).Kind = N_Variable_Declaration
or else
Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
or else
Project_Nodes.Table (Node).Kind = N_Expression
or else
Project_Nodes.Table (Node).Kind = N_Term
or else
Project_Nodes.Table (Node).Kind = N_Variable_Reference
or else
Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
Project_Nodes.Table (Node).Expr_Kind := To;
end Set_Expression_Kind_Of;
-----------------------
-- Set_Expression_Of --
-----------------------
procedure Set_Expression_Of
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
or else
Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
or else
Project_Nodes.Table (Node).Kind = N_Variable_Declaration));
Project_Nodes.Table (Node).Field1 := To;
end Set_Expression_Of;
-------------------------------
-- Set_External_Reference_Of --
-------------------------------
procedure Set_External_Reference_Of
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_External_Value);
Project_Nodes.Table (Node).Field1 := To;
end Set_External_Reference_Of;
-----------------------------
-- Set_External_Default_Of --
-----------------------------
procedure Set_External_Default_Of
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_External_Value);
Project_Nodes.Table (Node).Field2 := To;
end Set_External_Default_Of;
----------------------------
-- Set_First_Case_Item_Of --
----------------------------
procedure Set_First_Case_Item_Of
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Case_Construction);
Project_Nodes.Table (Node).Field2 := To;
end Set_First_Case_Item_Of;
-------------------------
-- Set_First_Choice_Of --
-------------------------
procedure Set_First_Choice_Of
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Case_Item);
Project_Nodes.Table (Node).Field1 := To;
end Set_First_Choice_Of;
------------------------
-- Set_Next_Case_Item --
------------------------
procedure Set_Next_Case_Item
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Case_Item);
Project_Nodes.Table (Node).Field3 := To;
end Set_Next_Case_Item;
-----------------------------------
-- Set_First_Declarative_Item_Of --
-----------------------------------
procedure Set_First_Declarative_Item_Of
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Project_Declaration
or else
Project_Nodes.Table (Node).Kind = N_Case_Item
or else
Project_Nodes.Table (Node).Kind = N_Package_Declaration));
if Project_Nodes.Table (Node).Kind = N_Project_Declaration then
Project_Nodes.Table (Node).Field1 := To;
else
Project_Nodes.Table (Node).Field2 := To;
end if;
end Set_First_Declarative_Item_Of;
----------------------------------
-- Set_First_Expression_In_List --
----------------------------------
procedure Set_First_Expression_In_List
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Literal_String_List);
Project_Nodes.Table (Node).Field1 := To;
end Set_First_Expression_In_List;
------------------------------
-- Set_First_Literal_String --
------------------------------
procedure Set_First_Literal_String
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_String_Type_Declaration);
Project_Nodes.Table (Node).Field1 := To;
end Set_First_Literal_String;
--------------------------
-- Set_First_Package_Of --
--------------------------
procedure Set_First_Package_Of
(Node : Project_Node_Id;
To : Package_Declaration_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Project);
Project_Nodes.Table (Node).Packages := To;
end Set_First_Package_Of;
------------------------------
-- Set_First_String_Type_Of --
------------------------------
procedure Set_First_String_Type_Of
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Project);
Project_Nodes.Table (Node).Field3 := To;
end Set_First_String_Type_Of;
--------------------
-- Set_First_Term --
--------------------
procedure Set_First_Term
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Expression);
Project_Nodes.Table (Node).Field1 := To;
end Set_First_Term;
---------------------------
-- Set_First_Variable_Of --
---------------------------
procedure Set_First_Variable_Of
(Node : Project_Node_Id;
To : Variable_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Project
or else
Project_Nodes.Table (Node).Kind = N_Package_Declaration));
Project_Nodes.Table (Node).Variables := To;
end Set_First_Variable_Of;
------------------------------
-- Set_First_With_Clause_Of --
------------------------------
procedure Set_First_With_Clause_Of
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Project);
Project_Nodes.Table (Node).Field1 := To;
end Set_First_With_Clause_Of;
-----------------
-- Set_Kind_Of --
-----------------
procedure Set_Kind_Of
(Node : Project_Node_Id;
To : Project_Node_Kind)
is
begin
pragma Assert (Node /= Empty_Node);
Project_Nodes.Table (Node).Kind := To;
end Set_Kind_Of;
---------------------
-- Set_Location_Of --
---------------------
procedure Set_Location_Of
(Node : Project_Node_Id;
To : Source_Ptr)
is
begin
pragma Assert (Node /= Empty_Node);
Project_Nodes.Table (Node).Location := To;
end Set_Location_Of;
-----------------------------
-- Set_Modified_Project_Of --
-----------------------------
procedure Set_Modified_Project_Of
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Project_Declaration);
Project_Nodes.Table (Node).Field2 := To;
end Set_Modified_Project_Of;
----------------------------------
-- Set_Modified_Project_Path_Of --
----------------------------------
procedure Set_Modified_Project_Path_Of
(Node : Project_Node_Id;
To : String_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Project);
Project_Nodes.Table (Node).Value := To;
end Set_Modified_Project_Path_Of;
-----------------
-- Set_Name_Of --
-----------------
procedure Set_Name_Of
(Node : Project_Node_Id;
To : Name_Id)
is
begin
pragma Assert (Node /= Empty_Node);
Project_Nodes.Table (Node).Name := To;
end Set_Name_Of;
-------------------------------
-- Set_Next_Declarative_Item --
-------------------------------
procedure Set_Next_Declarative_Item
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Declarative_Item);
Project_Nodes.Table (Node).Field2 := To;
end Set_Next_Declarative_Item;
---------------------------------
-- Set_Next_Expression_In_List --
---------------------------------
procedure Set_Next_Expression_In_List
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Expression);
Project_Nodes.Table (Node).Field2 := To;
end Set_Next_Expression_In_List;
-----------------------------
-- Set_Next_Literal_String --
-----------------------------
procedure Set_Next_Literal_String
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Literal_String);
Project_Nodes.Table (Node).Field1 := To;
end Set_Next_Literal_String;
---------------------------------
-- Set_Next_Package_In_Project --
---------------------------------
procedure Set_Next_Package_In_Project
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Package_Declaration);
Project_Nodes.Table (Node).Field3 := To;
end Set_Next_Package_In_Project;
--------------------------
-- Set_Next_String_Type --
--------------------------
procedure Set_Next_String_Type
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_String_Type_Declaration);
Project_Nodes.Table (Node).Field2 := To;
end Set_Next_String_Type;
-------------------
-- Set_Next_Term --
-------------------
procedure Set_Next_Term
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Term);
Project_Nodes.Table (Node).Field2 := To;
end Set_Next_Term;
-----------------------
-- Set_Next_Variable --
-----------------------
procedure Set_Next_Variable
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
or else
Project_Nodes.Table (Node).Kind = N_Variable_Declaration));
Project_Nodes.Table (Node).Field3 := To;
end Set_Next_Variable;
-----------------------------
-- Set_Next_With_Clause_Of --
-----------------------------
procedure Set_Next_With_Clause_Of
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_With_Clause);
Project_Nodes.Table (Node).Field2 := To;
end Set_Next_With_Clause_Of;
-----------------------
-- Set_Package_Id_Of --
-----------------------
procedure Set_Package_Id_Of
(Node : Project_Node_Id;
To : Package_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Package_Declaration);
Project_Nodes.Table (Node).Pkg_Id := To;
end Set_Package_Id_Of;
-------------------------
-- Set_Package_Node_Of --
-------------------------
procedure Set_Package_Node_Of
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Variable_Reference
or else
Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
Project_Nodes.Table (Node).Field2 := To;
end Set_Package_Node_Of;
----------------------
-- Set_Path_Name_Of --
----------------------
procedure Set_Path_Name_Of
(Node : Project_Node_Id;
To : Name_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Project
or else
Project_Nodes.Table (Node).Kind = N_With_Clause));
Project_Nodes.Table (Node).Path_Name := To;
end Set_Path_Name_Of;
--------------------------------
-- Set_Project_Declaration_Of --
--------------------------------
procedure Set_Project_Declaration_Of
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Project);
Project_Nodes.Table (Node).Field2 := To;
end Set_Project_Declaration_Of;
-------------------------
-- Set_Project_Node_Of --
-------------------------
procedure Set_Project_Node_Of
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_With_Clause
or else
Project_Nodes.Table (Node).Kind = N_Variable_Reference
or else
Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
Project_Nodes.Table (Node).Field1 := To;
end Set_Project_Node_Of;
---------------------------------------
-- Set_Project_Of_Renamed_Package_Of --
---------------------------------------
procedure Set_Project_Of_Renamed_Package_Of
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
Project_Nodes.Table (Node).Kind = N_Package_Declaration);
Project_Nodes.Table (Node).Field1 := To;
end Set_Project_Of_Renamed_Package_Of;
------------------------
-- Set_String_Type_Of --
------------------------
procedure Set_String_Type_Of
(Node : Project_Node_Id;
To : Project_Node_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Variable_Reference
or else
Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration)
and then
Project_Nodes.Table (To).Kind = N_String_Type_Declaration);
if Project_Nodes.Table (Node).Kind = N_Variable_Reference then
Project_Nodes.Table (Node).Field3 := To;
else
Project_Nodes.Table (Node).Field2 := To;
end if;
end Set_String_Type_Of;
-------------------------
-- Set_String_Value_Of --
-------------------------
procedure Set_String_Value_Of
(Node : Project_Node_Id;
To : String_Id)
is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_With_Clause
or else
Project_Nodes.Table (Node).Kind = N_Literal_String));
Project_Nodes.Table (Node).Value := To;
end Set_String_Value_Of;
--------------------
-- String_Type_Of --
--------------------
function String_Type_Of (Node : Project_Node_Id)
return Project_Node_Id is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_Variable_Reference
or else
Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration));
if Project_Nodes.Table (Node).Kind = N_Variable_Reference then
return Project_Nodes.Table (Node).Field3;
else
return Project_Nodes.Table (Node).Field2;
end if;
end String_Type_Of;
---------------------
-- String_Value_Of --
---------------------
function String_Value_Of (Node : Project_Node_Id) return String_Id is
begin
pragma Assert
(Node /= Empty_Node
and then
(Project_Nodes.Table (Node).Kind = N_With_Clause
or else
Project_Nodes.Table (Node).Kind = N_Literal_String));
return Project_Nodes.Table (Node).Value;
end String_Value_Of;
--------------------
-- Value_Is_Valid --
--------------------
function Value_Is_Valid
(For_Typed_Variable : Project_Node_Id;
Value : String_Id)
return Boolean
is
begin
pragma Assert
(For_Typed_Variable /= Empty_Node
and then
(Project_Nodes.Table (For_Typed_Variable).Kind =
N_Typed_Variable_Declaration));
declare
Current_String : Project_Node_Id :=
First_Literal_String
(String_Type_Of (For_Typed_Variable));
begin
while Current_String /= Empty_Node
and then
not String_Equal (String_Value_Of (Current_String), Value)
loop
Current_String :=
Next_Literal_String (Current_String);
end loop;
return Current_String /= Empty_Node;
end;
end Value_Is_Valid;
end Prj.Tree;
|
with agar.core.event;
with agar.core.object;
with agar.core.tail_queue;
with agar.core;
with agar.gui.style;
with agar.gui.surface;
with agar.gui.widget;
with agar.gui.window;
with interfaces.c;
with sdl.keysym;
with sdl.video;
package agar.gui.view is
package c renames interfaces.c;
package window_tail_queue is new agar.core.tail_queue
(entry_type => agar.gui.window.window_access_t);
type winop_t is (
WINOP_NONE,
WINOP_MOVE,
WINOP_LRESIZE,
WINOP_RRESIZE,
WINOP_HRESIZE
);
for winop_t use (
WINOP_NONE => 0,
WINOP_MOVE => 1,
WINOP_LRESIZE => 2,
WINOP_RRESIZE => 3,
WINOP_HRESIZE => 4
);
for winop_t'size use c.unsigned'size;
pragma convention (c, winop_t);
type display_t is record
object : agar.core.object.object_t;
v : sdl.video.surface_access_t;
stmpl : agar.gui.surface.surface_access_t;
w : c.int;
h : c.int;
depth : c.int;
opengl : c.int;
rcur : c.int;
rnom : c.unsigned;
dirty : sdl.video.rect_access_t;
ndirty : c.unsigned;
maxdirty : c.unsigned;
windows : window_tail_queue.head_t;
detach : window_tail_queue.head_t;
win_to_focus : agar.gui.window.window_access_t;
win_selected : agar.gui.window.window_access_t;
win_modal : access agar.gui.window.window_access_t;
nmodal : c.unsigned;
winop : winop_t;
style : agar.gui.style.style_access_t;
end record;
type display_access_t is access all display_t;
pragma convention (c, display_t);
pragma convention (c, display_access_t);
function resize_display
(width : positive;
height : positive) return boolean;
pragma inline (resize_display);
function set_refresh_rate (rate : positive) return boolean;
pragma inline (set_refresh_rate);
procedure bind_global_key
(key : sdl.keysym.key_t;
modkey : sdl.keysym.modkey_t;
proc : access procedure);
pragma import (c, bind_global_key, "AG_BindGlobalKey");
procedure bind_global_key_event
(key : sdl.keysym.key_t;
modkey : sdl.keysym.modkey_t;
proc : access procedure (ev : agar.core.event.event_access_t));
pragma import (c, bind_global_key_event, "AG_BindGlobalKeyEv");
function unbind_global_key
(key : sdl.keysym.key_t;
modkey : sdl.keysym.modkey_t) return c.int;
pragma import (c, unbind_global_key, "AG_UnbindGlobalKey");
function unbind_global_key
(key : sdl.keysym.key_t;
modkey : sdl.keysym.modkey_t) return boolean;
pragma inline (unbind_global_key);
procedure clear_global_keys;
pragma import (c, clear_global_keys, "AG_ClearGlobalKeys");
function find_window (name : string) return agar.gui.window.window_access_t;
pragma inline (find_window);
function find_widget
(view : display_access_t;
name : string) return agar.gui.widget.widget_access_t;
pragma inline (find_widget);
end agar.gui.view;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P R J --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 2001 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- The following package declares the data types for GNAT project.
-- These data types may be used by GNAT Project-aware tools.
-- Children of these package implements various services on these data types.
-- See in particular Prj.Pars and Prj.Env.
with Casing; use Casing;
with GNAT.OS_Lib; use GNAT.OS_Lib;
with Scans; use Scans;
with Table;
with Types; use Types;
package Prj is
Default_Ada_Spec_Suffix : Name_Id;
-- The Name_Id for the standard GNAT suffix for Ada spec source file
-- name ".ads". Initialized by Prj.Initialize.
Default_Ada_Impl_Suffix : Name_Id;
-- The Name_Id for the standard GNAT suffix for Ada body source file
-- name ".adb". Initialized by Prj.Initialize.
type Put_Line_Access is access procedure (Line : String);
-- Use to customize error reporting in Prj.Proc and Prj.Nmsc.
type Verbosity is (Default, Medium, High);
-- Verbosity when parsing GNAT Project Files
-- Default is default (very quiet, if no errors).
-- Medium is more verbose.
-- High is extremely verbose.
type Lib_Kind is (Static, Dynamic, Relocatable);
function Empty_String return String_Id;
type String_List_Id is new Nat;
Nil_String : constant String_List_Id := 0;
type String_Element is record
Value : String_Id := No_String;
Location : Source_Ptr := No_Location;
Next : String_List_Id := Nil_String;
end record;
-- To hold values for string list variables and array elements
package String_Elements is new Table.Table
(Table_Component_Type => String_Element,
Table_Index_Type => String_List_Id,
Table_Low_Bound => 1,
Table_Initial => 200,
Table_Increment => 100,
Table_Name => "Prj.String_Elements");
-- The table for string elements in string lists
type Variable_Kind is (Undefined, List, Single);
-- Different kinds of variables
type Variable_Value (Kind : Variable_Kind := Undefined) is record
Location : Source_Ptr := No_Location;
Default : Boolean := False;
case Kind is
when Undefined =>
null;
when List =>
Values : String_List_Id := Nil_String;
when Single =>
Value : String_Id := No_String;
end case;
end record;
-- Values for variables and array elements.
-- Default is True if the current value is the default one for the variable
Nil_Variable_Value : constant Variable_Value :=
(Kind => Undefined,
Location => No_Location,
Default => False);
-- Value of a non existing variable or array element
type Variable_Id is new Nat;
No_Variable : constant Variable_Id := 0;
type Variable is record
Next : Variable_Id := No_Variable;
Name : Name_Id;
Value : Variable_Value;
end record;
-- To hold the list of variables in a project file and in packages
package Variable_Elements is new Table.Table
(Table_Component_Type => Variable,
Table_Index_Type => Variable_Id,
Table_Low_Bound => 1,
Table_Initial => 200,
Table_Increment => 100,
Table_Name => "Prj.Variable_Elements");
-- The table of variable in list of variables
type Array_Element_Id is new Nat;
No_Array_Element : constant Array_Element_Id := 0;
type Array_Element is record
Index : Name_Id;
Value : Variable_Value;
Next : Array_Element_Id := No_Array_Element;
end record;
-- Each Array_Element represents an array element and is linked (Next)
-- to the next array element, if any, in the array.
package Array_Elements is new Table.Table
(Table_Component_Type => Array_Element,
Table_Index_Type => Array_Element_Id,
Table_Low_Bound => 1,
Table_Initial => 200,
Table_Increment => 100,
Table_Name => "Prj.Array_Elements");
-- The table that contains all array elements
type Array_Id is new Nat;
No_Array : constant Array_Id := 0;
type Array_Data is record
Name : Name_Id := No_Name;
Value : Array_Element_Id := No_Array_Element;
Next : Array_Id := No_Array;
end record;
-- Each Array_Data value represents an array.
-- Value is the id of the first element.
-- Next is the id of the next array in the project file or package.
package Arrays is new Table.Table
(Table_Component_Type => Array_Data,
Table_Index_Type => Array_Id,
Table_Low_Bound => 1,
Table_Initial => 200,
Table_Increment => 100,
Table_Name => "Prj.Arrays");
-- The table that contains all arrays
type Package_Id is new Nat;
No_Package : constant Package_Id := 0;
type Declarations is record
Variables : Variable_Id := No_Variable;
Attributes : Variable_Id := No_Variable;
Arrays : Array_Id := No_Array;
Packages : Package_Id := No_Package;
end record;
No_Declarations : constant Declarations :=
(Variables => No_Variable,
Attributes => No_Variable,
Arrays => No_Array,
Packages => No_Package);
-- Declarations. Used in project structures and packages (what for???)
type Package_Element is record
Name : Name_Id := No_Name;
Decl : Declarations := No_Declarations;
Parent : Package_Id := No_Package;
Next : Package_Id := No_Package;
end record;
-- A package. Includes declarations that may include other packages.
package Packages is new Table.Table
(Table_Component_Type => Package_Element,
Table_Index_Type => Package_Id,
Table_Low_Bound => 1,
Table_Initial => 100,
Table_Increment => 100,
Table_Name => "Prj.Packages");
-- The table that contains all packages.
function Image (Casing : Casing_Type) return String;
-- Similar to 'Image (but avoid use of this attribute in compiler)
function Value (Image : String) return Casing_Type;
-- Similar to 'Value (but avoid use of this attribute in compiler)
-- Raises Constraint_Error if not a Casing_Type image.
type Naming_Data is record
Current_Language : Name_Id := No_Name;
-- The programming language being currently considered
Dot_Replacement : Name_Id := No_Name;
-- The string to replace '.' in the source file name (for Ada).
Dot_Repl_Loc : Source_Ptr := No_Location;
-- The position in the project file source where
-- Dot_Replacement is defined.
Casing : Casing_Type := All_Lower_Case;
-- The casing of the source file name (for Ada).
Specification_Suffix : Array_Element_Id := No_Array_Element;
-- The string to append to the unit name for the
-- source file name of a specification.
-- Indexed by the programming language.
Current_Spec_Suffix : Name_Id := No_Name;
-- The specification suffix of the current programming language
Spec_Suffix_Loc : Source_Ptr := No_Location;
-- The position in the project file source where
-- Current_Spec_Suffix is defined.
Implementation_Suffix : Array_Element_Id := No_Array_Element;
-- The string to append to the unit name for the
-- source file name of a body.
-- Indexed by the programming language.
Current_Impl_Suffix : Name_Id := No_Name;
-- The implementation suffix of the current programming language
Impl_Suffix_Loc : Source_Ptr := No_Location;
-- The position in the project file source where
-- Current_Impl_Suffix is defined.
Separate_Suffix : Name_Id := No_Name;
-- The string to append to the unit name for the
-- source file name of an Ada subunit.
Sep_Suffix_Loc : Source_Ptr := No_Location;
-- The position in the project file source where
-- Separate_Suffix is defined.
Specifications : Array_Element_Id := No_Array_Element;
-- An associative array mapping individual specifications
-- to source file names. Specific to Ada.
Bodies : Array_Element_Id := No_Array_Element;
-- An associative array mapping individual bodies
-- to source file names. Specific to Ada.
Specification_Exceptions : Array_Element_Id := No_Array_Element;
-- An associative array mapping individual specifications
-- to source file names. Indexed by the programming language name.
Implementation_Exceptions : Array_Element_Id := No_Array_Element;
-- An associative array mapping individual bodies
-- to source file names. Indexed by the programming language name.
end record;
-- A naming scheme.
function Standard_Naming_Data return Naming_Data;
pragma Inline (Standard_Naming_Data);
-- The standard GNAT naming scheme.
function Same_Naming_Scheme
(Left, Right : Naming_Data)
return Boolean;
-- Returns True if Left and Right are the same naming scheme
-- not considering Specifications and Bodies.
type Project_Id is new Nat;
No_Project : constant Project_Id := 0;
-- Id of a Project File
type Project_List is new Nat;
Empty_Project_List : constant Project_List := 0;
-- A list of project files.
type Project_Element is record
Project : Project_Id := No_Project;
Next : Project_List := Empty_Project_List;
end record;
-- Element in a list of project file.
-- Next is the id of the next project file in the list.
package Project_Lists is new Table.Table
(Table_Component_Type => Project_Element,
Table_Index_Type => Project_List,
Table_Low_Bound => 1,
Table_Initial => 100,
Table_Increment => 100,
Table_Name => "Prj.Project_Lists");
-- The table that contains the lists of project files.
type Project_Data is record
First_Referred_By : Project_Id := No_Project;
-- The project, if any, that was the first to be known
-- as importing or extending this project.
-- Set by Prj.Proc.Process.
Name : Name_Id := No_Name;
-- The name of the project.
-- Set by Prj.Proc.Process.
Path_Name : Name_Id := No_Name;
-- The path name of the project file.
-- Set by Prj.Proc.Process.
Location : Source_Ptr := No_Location;
-- The location in the project file source of the
-- reserved word project.
-- Set by Prj.Proc.Process.
Directory : Name_Id := No_Name;
-- The directory where the project file resides.
-- Set by Prj.Proc.Process.
Library : Boolean := False;
-- True if this is a library project.
-- Set by Prj.Nmsc.Check_Naming_Scheme.
Library_Dir : Name_Id := No_Name;
-- If a library project, directory where resides the library
-- Set by Prj.Nmsc.Check_Naming_Scheme.
Library_Name : Name_Id := No_Name;
-- If a library project, name of the library
-- Set by Prj.Nmsc.Check_Naming_Scheme.
Library_Kind : Lib_Kind := Static;
-- If a library project, kind of library
-- Set by Prj.Nmsc.Check_Naming_Scheme.
Lib_Internal_Name : Name_Id := No_Name;
-- If a library project, internal name store inside the library
-- Set by Prj.Nmsc.Check_Naming_Scheme.
Lib_Elaboration : Boolean := False;
-- If a library project, indicate if <lib>init and <lib>final
-- procedures need to be defined.
-- Set by Prj.Nmsc.Check_Naming_Scheme.
Sources_Present : Boolean := True;
-- A flag that indicates if there are sources in this project file.
-- There are no sources if 1) Source_Dirs is specified as an
-- empty list, 2) Source_Files is specified as an empty list, or
-- 3) the current language is not in the list of the specified
-- Languages.
Sources : String_List_Id := Nil_String;
-- The list of all the source file names.
-- Set by Prj.Nmsc.Check_Naming_Scheme.
Source_Dirs : String_List_Id := Nil_String;
-- The list of all the source directories.
-- Set by Prj.Nmsc.Check_Naming_Scheme.
Object_Directory : Name_Id := No_Name;
-- The object directory of this project file.
-- Set by Prj.Nmsc.Check_Naming_Scheme.
Exec_Directory : Name_Id := No_Name;
-- The exec directory of this project file.
-- Default is equal to Object_Directory.
-- Set by Prj.Nmsc.Check_Naming_Scheme.
Modifies : Project_Id := No_Project;
-- The reference of the project file, if any, that this
-- project file modifies.
-- Set by Prj.Proc.Process.
Modified_By : Project_Id := No_Project;
-- The reference of the project file, if any, that
-- modifies this project file.
-- Set by Prj.Proc.Process.
Naming : Naming_Data := Standard_Naming_Data;
-- The naming scheme of this project file.
-- Set by Prj.Nmsc.Check_Naming_Scheme.
Decl : Declarations := No_Declarations;
-- The declarations (variables, attributes and packages)
-- of this project file.
-- Set by Prj.Proc.Process.
Imported_Projects : Project_List := Empty_Project_List;
-- The list of all directly imported projects, if any.
-- Set by Prj.Proc.Process.
Include_Path : String_Access := null;
-- The cached value of ADA_INCLUDE_PATH for this project file.
-- Set by gnatmake (prj.Env.Set_Ada_Paths).
-- Do not use this field directly outside of the compiler, use
-- Prj.Env.Ada_Source_Path instead.
Objects_Path : String_Access := null;
-- The cached value of ADA_OBJECTS_PATH for this project file.
-- Set by gnatmake (prj.Env.Set_Ada_Paths).
-- Do not use this field directly outside of the compiler, use
-- Prj.Env.Ada_Source_Path instead.
Config_File_Name : Name_Id := No_Name;
-- The name of the configuration pragmas file, if any.
-- Set by gnatmage (Prj.Env.Create_Config_Pragmas_File).
Config_File_Temp : Boolean := False;
-- An indication that the configuration pragmas file is
-- a temporary file that must be deleted at the end.
-- Set by gnatmage (Prj.Env.Create_Config_Pragmas_File).
Config_Checked : Boolean := False;
-- A flag to avoid checking repetitively the configuration pragmas file.
-- Set by gnatmage (Prj.Env.Create_Config_Pragmas_File).
Language_Independent_Checked : Boolean := False;
-- A flag that indicates that the project file has been checked
-- for language independent features: Object_Directory,
-- Source_Directories, Library, non empty Naming Suffixs.
Checked : Boolean := False;
-- A flag to avoid checking repetitively the naming scheme of
-- this project file.
-- Set by Prj.Nmsc.Check_Naming_Scheme.
Seen : Boolean := False;
Flag1 : Boolean := False;
Flag2 : Boolean := False;
-- Various flags that are used in an ad hoc manner
-- That's really not a good enough comment ??? we need to know what
-- these flags are used for, and give them proper names. If Flag1
-- and Flag2 have multiple uses, then either we use multiple fields
-- or a renaming scheme.
end record;
-- Project File representation.
function Empty_Project return Project_Data;
-- Return the representation of an empty project.
package Projects is new Table.Table (
Table_Component_Type => Project_Data,
Table_Index_Type => Project_Id,
Table_Low_Bound => 1,
Table_Initial => 100,
Table_Increment => 100,
Table_Name => "Prj.Projects");
-- The set of all project files.
procedure Expect (The_Token : Token_Type; Token_Image : String);
-- Check that the current token is The_Token. If it is not, then
-- output an error message.
procedure Initialize;
-- This procedure must be called before using any services from the Prj
-- hierarchy. Namet.Initialize must be called before Prj.Initialize.
procedure Reset;
-- This procedure resets all the tables that are used when processing a
-- project file tree. Initialize must be called before the call to Reset.
generic
type State is limited private;
with procedure Action
(Project : Project_Id;
With_State : in out State);
procedure For_Every_Project_Imported
(By : Project_Id;
With_State : in out State);
-- Call Action for each project imported directly or indirectly by project
-- By. Action is called according to the order of importation: if A
-- imports B, directly or indirectly, Action will be called for A before
-- it is called for B. With_State may be used by Action to choose a
-- behavior or to report some global result.
private
procedure Scan;
-- Calls Scn.Scan and change any Operator_Symbol to String_Literal
end Prj;
|
-----------------------------------------------------------------------
-- csv_reader -- Read CSV file
-- Copyright (C) 2011, 2017 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Text_IO;
with Ada.Command_Line;
with Util.Serialize.IO.CSV;
with Util.Serialize.Mappers;
-- This example shows how to read a CSV file. Unlike <b>csv_city</b>, the CSV cells
-- are collected directly by overriding the <b>Set_Cell</b> parser procedure.
procedure CSV_Reader is
use Ada.Text_IO;
use Util.Serialize.IO.CSV;
Prev_Row : Row_Type;
type CSV_Parser is new Util.Serialize.IO.CSV.Parser with null record;
overriding
procedure Set_Cell (Parser : in out CSV_Parser;
Value : in String;
Row : in Util.Serialize.IO.CSV.Row_Type;
Column : in Util.Serialize.IO.CSV.Column_Type);
overriding
procedure Set_Cell (Parser : in out CSV_Parser;
Value : in String;
Row : in Util.Serialize.IO.CSV.Row_Type;
Column : in Util.Serialize.IO.CSV.Column_Type) is
pragma Unreferenced (Parser, Column);
begin
if Prev_Row /= Row then
Ada.Text_IO.New_Line;
Prev_Row := Row;
else
Put (" ");
end if;
Ada.Text_IO.Put (Value);
end Set_Cell;
Parser : CSV_Parser;
Count : constant Natural := Ada.Command_Line.Argument_Count;
begin
if Count = 0 then
Ada.Text_IO.Put_Line ("Usage: csv_reader file...");
return;
end if;
for I in 1 .. Count loop
declare
File : constant String := Ada.Command_Line.Argument (I);
Mapper : Util.Serialize.Mappers.Processing;
begin
Prev_Row := Row_Type'Last;
Parser.Parse (File, Mapper);
end;
end loop;
end CSV_Reader;
|
with Interfaces;
with Ada.Numerics.Float_Random;
with Ada.Assertions;
with Vector_Math;
with Materials;
with Lights;
with Geometry;
with Scene;
with Ada.Unchecked_Deallocation;
use Interfaces;
use Vector_Math;
use Materials;
use Lights;
use Ada.Assertions;
use Geometry;
package Ray_Tracer is
width : Positive := 1024;
height : Positive := 768;
Threads_Num : Positive := 14*2;
Anti_Aliasing_On : boolean := true;
Max_Trace_Depth : Positive := 8;
Background_Color : float3 := (0.0,0.0,0.0);
G_Epsilon : constant float := 1.0e-5; -- small value for geometry offsets
G_Epsilon_Div : constant float := 1.0e-20; -- small value for bsdf/pdf divisions
g_gamma : constant float := 2.0;
g_scn : Scene.Render_Scene;
type ScreenBufferData is array(integer range <>, integer range <>) of Unsigned_32;
type ScreenBufferDataRef is access ScreenBufferData;
screen_buffer : ScreenBufferDataRef := null;
type Render_Type is (RT_DEBUG, RT_WHITTED, PT_STUPID, PT_SHADOW, PT_MIS); -- render type
procedure Init_Render(a_rendType : Render_Type);
procedure Render_Pass;
procedure Resize_Viewport(size_x,size_y : integer);
function GetSPP return integer;
function Finished return Boolean;
private
--
--
type AccumBuff is array (Integer range <>, integer range <>) of float3;
type AccumBuffRef is access AccumBuff;
-- pragma Atomic_Components(AccumBuff); -- atomic access to component of "AccumBuff" cannot be guaranteed
type FloatBuff is array (Integer range <>, integer range <>) of float;
type FloatBuffRef is access FloatBuff;
type Color is record
Red : float range 0.0..1.0;
Green : float range 0.0..1.0;
Blue : float range 0.0..1.0;
end record;
function ColorToUnsigned_32(c: Color) return Unsigned_32;
function ToneMapping(v : float3) return Color;
pragma Inline (ColorToUnsigned_32);
pragma Inline (ToneMapping);
function EyeRayDirection (x, y : Natural) return float3;
function Compute_Shadow(hit_pos : float3; lpos : float3) return Shadow_Hit;
type RayDirPack is array (0 .. 3) of float3;
procedure Generate4RayDirections (x, y : in Natural; res : out RayDirPack);
type IntRef is access integer;
-- multithreaded rendering stuff
--
task type Path_Trace_Thread(threadId : integer; Acc_Buff : AccumBuffRef) is
entry Resume;
entry Finish(spp : IntRef);
end Path_Trace_Thread;
type Path_Trace_Thread_Ptr is access Path_Trace_Thread;
g_threads : array(0..Threads_Num-1) of Path_Trace_Thread_Ptr;
g_threadsCreated : boolean := false;
---- instantiate deallocation procedures
--
procedure delete is new Ada.Unchecked_Deallocation(Object => ScreenBufferData, Name => ScreenBufferDataRef);
--procedure delete is new Ada.Unchecked_Deallocation(Object => RandomGenerator, Name => RandRef);
procedure delete is new Ada.Unchecked_Deallocation(Object => integer, Name => IntRef);
procedure delete is new Ada.Unchecked_Deallocation(Object => AccumBuff, Name => AccumBuffRef);
procedure delete is new Ada.Unchecked_Deallocation(Object => Path_Trace_Thread, Name => Path_Trace_Thread_Ptr);
function Find_Closest_Hit(r: Ray) return Hit;
pragma Inline(Find_Closest_Hit);
g_accBuff : AccumBuffRef := null;
g_spp : IntRef := null;
g_rend_type : Render_Type := PT_MIS;
g_finish : Boolean := false;
end Ray_Tracer;
|
-----------------------------------------------------------------------
-- facebook - Use Facebook Graph API
-- 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 Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Methods;
with Util.Beans.Basic;
with Util.Beans.Basic.Lists;
with Security.OAuth.Clients;
package Facebook is
-- Get the access token from the user session.
function Get_Access_Token return String;
-- ------------------------------
-- Friend information
-- ------------------------------
-- The JSON data contains: { "name": "John", "id": "680918286" }
type Friend_Info is new Util.Beans.Basic.Readonly_Bean with record
Name : Util.Beans.Objects.Object;
Id : Util.Beans.Objects.Object;
end record;
type Friend_Info_Access is access all Friend_Info;
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
overriding
function Get_Value (From : in Friend_Info;
Name : in String) return Util.Beans.Objects.Object;
package Friend_List is new Util.Beans.Basic.Lists (Element_Type => Friend_Info);
type Friend_List_Bean is new Friend_List.List_Bean with record
Has_Access_Token : Boolean := False;
end record;
type Friend_List_Bean_Access is access all Friend_List_Bean'Class;
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
overriding
function Get_Value (From : in Friend_List_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Create a Friend_List bean instance.
function Create_Friends_Bean return Util.Beans.Basic.Readonly_Bean_Access;
-- ------------------------------
-- Feed information
-- ------------------------------
-- The JSON structure is a little bit more complex. We only map a subset of it.
type Feed_Info is new Util.Beans.Basic.Readonly_Bean with record
Id : Util.Beans.Objects.Object;
From : Util.Beans.Objects.Object;
Name : Util.Beans.Objects.Object;
Message : Util.Beans.Objects.Object;
Picture : Util.Beans.Objects.Object;
Link : Util.Beans.Objects.Object;
Description : Util.Beans.Objects.Object;
Icon : Util.Beans.Objects.Object;
end record;
type Feed_Info_Access is access all Feed_Info;
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
overriding
function Get_Value (From : in Feed_Info;
Name : in String) return Util.Beans.Objects.Object;
package Feed_List is new Util.Beans.Basic.Lists (Element_Type => Feed_Info);
-- Build and return a Facebook feed list.
function Create_Feed_List_Bean return Util.Beans.Basic.Readonly_Bean_Access;
-- ------------------------------
-- Facebook Auth
-- ------------------------------
-- Authenticate this application on OAuth Facebook. This is a global bean shared
-- by several concurrent requests. It gives access to the Facebook authenticate URI
-- that must be used and provides the authenticate method that must be invoked upon
-- successfully authentication by the user (ie, through the OAuth callback).
type Facebook_Auth is new Security.OAuth.Clients.Application
and Util.Beans.Basic.Readonly_Bean
and Util.Beans.Methods.Method_Bean with private;
-- Get the user information identified by the given name.
overriding
function Get_Value (From : in Facebook_Auth;
Name : in String) return Util.Beans.Objects.Object;
-- Authenticate result from Facebook.
procedure Authenticate (From : in out Facebook_Auth;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- This bean provides some methods that can be used in a Method_Expression
overriding
function Get_Method_Bindings (From : in Facebook_Auth)
return Util.Beans.Methods.Method_Binding_Array_Access;
private
type Facebook_Auth is new Security.OAuth.Clients.Application
and Util.Beans.Basic.Readonly_Bean
and Util.Beans.Methods.Method_Bean with null record;
end Facebook;
|
with Ada.Numerics.Elementary_Functions; use Ada.Numerics;
package body Units.Numerics with
SPARK_Mode => On
is
function Sqrt (X : Base_Unit_Type) return Base_Unit_Type is
begin
return Base_Unit_Type( Elementary_Functions.Sqrt (Float (X)) );
end Sqrt;
-- procedure Lemma_Log_Is_Monotonic (X, Y : Unit_Type) with
-- Ghost,
-- Pre => X > 0.0 and then Y > 0.0,
-- Contract_Cases => (X <= Y => Log (X) <= Log (Y),
-- Y < X => Log (Y) <= Log (X));
-- procedure Lemma_Log_Is_Monotonic (X, Y : Unit_Type)
-- is null with SPARK_Mode => Off;
function Exp (X : Base_Unit_Type) return Base_Unit_Type is
begin
return Base_Unit_Type (Elementary_Functions.Exp (Float (X)));
end Exp;
function Log (X : Base_Unit_Type) return Base_Unit_Type is
begin
return Base_Unit_Type (Elementary_Functions.Log (Float (X)));
end Log;
function "**" (Left : Base_Unit_Type; Right : Float) return Base_Unit_Type is
begin
-- Elementary_Functions does not offer Pow, and "**" is for Natural exponents only.
-- Thus: x=b**y => log_b(x)=y => log x/log b = y => log x = log b*y => x=exp(y*log b)
-- with b=left, y=right
declare
ll : constant Base_Unit_Type := Log (Left);
arg : constant Base_Unit_Type := Base_Unit_Type (Right) * ll; -- TODO: ovf check might fail
begin
pragma Assert (arg < Log (Base_Unit_Type'Last)); -- TODO: assertion fails
return Base_Unit_Type (Exp (arg));
end;
end "**";
function Sin (X : Angle_Type) return Base_Unit_Type is
begin
return Base_Unit_Type( Elementary_Functions.Sin( Float( X ) ) );
end Sin;
-- header comment for Cos
-- @req mine+2
function Cos (X : Angle_Type) return Base_Unit_Type is
begin
-- @req foobar/2 @req nothing
-- @req foobar/2
return Base_Unit_Type( Elementary_Functions.Cos( Float( X ) ) );
end Cos;
-- footer comment for cos
function Arctan
(Y : Base_Unit_Type'Base;
X : Base_Unit_Type'Base := 1.0;
Cycle : Angle_Type)
return Angle_Type is
begin
return Angle_Type (Elementary_Functions.Arctan (Y => Float (Y), X => Float (X), Cycle => Float (Cycle)));
end Arctan;
function Arctan
(Y : Base_Unit_Type;
X : Base_Unit_Type := 1.0)
return Angle_Type is
begin
return Angle_Type (Elementary_Functions.Arctan (Y => Float (Y), X => Float (X)));
end Arctan;
end Units.Numerics;
-- trailing package comment
|
pragma Restrictions (No_Elaboration_Code);
with System; use System;
with STM32_SVD.LPTIM; use STM32_SVD.LPTIM;
package STM32.LPTimers is
type LPTimer is limited private;
procedure Enable (This : in out LPTimer)
with Post => Enabled (This);
procedure Disable (This : in out LPTimer)
with Post => not Enabled (This);
function Enabled (This : LPTimer) return Boolean;
type LPTimer_Prescaler is
(Div_1,
Div_2,
Div_4,
Div_8,
Div_16,
Div_32,
Div_64,
Div_128)
with Size => 3;
procedure Configure_Prescaler
(This : in out LPTimer;
Prescaler : LPTimer_Prescaler)
with Pre => not Enabled (This),
Post => Current_Prescaler (This) = Prescaler;
-- Configure the division factor.
function Current_Prescaler (This : LPTimer) return LPTimer_Prescaler;
procedure Set_Compare_Value
(This : in out LPTimer;
Value : UInt16)
with
Post => Current_Compare_Value (This) = Value;
function Current_Compare_Value (This : LPTimer) return UInt16;
procedure Set_Autoreload_Value
(This : in out LPTimer;
Value : UInt16)
with
Post => Current_Autoreload (This) = Value;
function Current_Autoreload (This : LPTimer) return UInt16;
procedure Configure
(This : in out LPTimer;
Prescaler : LPTimer_Prescaler;
Period : UInt16)
with Pre => not Enabled (This),
Post => Current_Prescaler (This) = Prescaler and
Current_Autoreload (This) = Period;
procedure Compute_Prescaler_And_Period
(This : LPTimer;
Requested_Frequency : UInt32;
Prescaler : out LPTimer_Prescaler;
Period : out UInt32)
with Pre => Requested_Frequency > 0;
-- Computes the minimum prescaler and thus the maximum resolution for the
-- given timer, based on the system clocks and the requested frequency.
-- Computes the period required for the requested frequency.
Invalid_Request : exception;
-- Raised when the requested frequency is too high or too low for the given
-- timer and system clocks.
type LPTimer_Clock_Source is (Internal, External);
-- LPTIM is clocked by internal clock source (APB clock or any of the
-- embedded oscillators) or by an external clock source through the LPTIM
-- external Input1.
procedure Set_Counter_Clock_Source
(This : in out LPTimer;
Mode : LPTimer_Clock_Source)
with Pre => not Enabled (This);
-- Select which clock source is used to clock the counter.
procedure Set_Counter_Value
(This : in out LPTimer;
Value : UInt16)
with Post => Current_Counter (This) = Value;
function Current_Counter (This : LPTimer) return UInt16;
type LPTimer_Counter_Reset_Mode is (After_Read_Counter, Now);
procedure Set_Counter_Reset_Mode
(This : in out LPTimer;
Mode : LPTimer_Counter_Reset_Mode;
Enable : Boolean := True)
with Pre => (if Mode = Now then Enable);
type LPTimer_Preload_Mode is (After_APB_Bus_Write, End_Current_Period);
procedure Set_Preload_Mode
(This : in out LPTimer;
Mode : LPTimer_Preload_Mode)
with Pre => not Enabled (This);
-- Autoreload and the Compare registers are updated after each APB bus
-- write access or at the end of the current LPTIM period.
type LPTimer_Interrupt is
(Compare_Match,
Autorreload_Match,
External_Trigger_Valid_Edge,
Compare_Register_Update_Ok,
Autorreload_Register_Update_Ok,
Direction_Change_To_Up,
Direction_Change_To_Down);
procedure Enable_Interrupt
(This : in out LPTimer;
Source : LPTimer_Interrupt)
with Post => Interrupt_Enabled (This, Source);
type LPTimer_Interrupt_List is array (Positive range <>) of LPTimer_Interrupt;
procedure Enable_Interrupt
(This : in out LPTimer;
Sources : LPTimer_Interrupt_List)
with Post => (for all Source of Sources => Interrupt_Enabled (This, Source));
procedure Disable_Interrupt
(This : in out LPTimer;
Source : LPTimer_Interrupt)
with Post => not Interrupt_Enabled (This, Source);
procedure Clear_Pending_Interrupt
(This : in out LPTimer;
Source : LPTimer_Interrupt);
function Interrupt_Enabled
(This : LPTimer;
Source : LPTimer_Interrupt)
return Boolean;
type LPTimer_Status_Flag is new LPTimer_Interrupt;
function Status (This : LPTimer;
Flag : LPTimer_Status_Flag) return Boolean;
procedure Clear_Status (This : in out LPTimer; Flag : LPTimer_Status_Flag);
procedure Select_Clock_Source
(This : in out LPTimer;
Source : LPTimer_Clock_Source);
-- LPTIM is clocked by internal clock source (APB clock or any of the
-- embedded oscillators) or by an external clock source through the LPTIM
-- external Input1.
function Get_Clock_Source (This : LPTimer) return LPTimer_Clock_Source;
type LPTimer_External_Clock_Polarity is
(Rising_Edge,
Falling_Edge,
Both_Rising_Falling_Edges)
with Size => 2;
-- When the LPTIM is clocked by an external clock source, CKPOL bits is
-- used to configure the active edge or edges used by the counter.
type LPTimer_Digital_Filter is
(Any_Level_Change,
Stable_2_Clock_Periods,
Stable_4_Clock_Periods,
Stable_8_Clock_Periods)
with Size => 2;
-- Sets the number of consecutive equal samples that should be detected
-- when a level change occurs on an external clock signal before it is
-- considered as a valid level transition. An internal clock source must
-- be present to use this feature.
procedure Configure_External_Clock
(This : in out LPTimer;
Polarity : LPTimer_External_Clock_Polarity;
Filter : LPTimer_Digital_Filter);
type LPTimer_Input_Clock is
(Option_1,
Option_2,
Option_3,
Option_4)
with Size => 2;
-- Option LPTIM1 LPTIM1 LPTIM2 LPTIM2 LPTIM3
-- Input 1 Input 2 Input 1 Input 2 Input 1
-- 1 GPIO AF GPIO AF GPIO AF GPIO AF
-- 2 COMP1_OUT COMP2_OUT COMP1_OUT COMP2_OUT SAM_FS_A
-- 3 COMP2_OUT SAM_FS_B
-- 4 COMP1 OR COMP2
-- LPTimer input 1 or input 2 connected to GPIO alternate function or COMP
-- output. See RM0433 rev 7 Chapter 43.4.3 "LPTIM input and trigger mapping".
type LPTimer_Input is (Input_1, Input_2);
procedure Configure_Input_Clock
(This : in out LPTimer;
Input : LPTimer_Input;
Clock : LPTimer_Input_Clock)
with Pre => not Enabled (This) and
This'Address /= STM32_SVD.LPTIM4_Base and
This'Address /= STM32_SVD.LPTIM5_Base and
(if This'Address = STM32_SVD.LPTIM3_Base then Input /= Input_2);
-- LPTimer input 1 or input 2 connected to GPIO alternate function or COMP
-- output. See RM0433 rev 7 Chapter 43.4.3 "LPTIM input and trigger
-- mapping" and Chapter 43.4.1 "LPTIM block diagram".
type LPTimer_Trigger_Source is
(Option_1,
Option_2,
Option_3,
Option_4,
Option_5,
Option_6,
Option_7,
Option_8)
with Size => 3;
-- Option LPTIM1 LPTIM3 LPTIM2 LPTIM2 LPTIM3
-- 1 GPIO GPIO LPTIM2_OUT LPTIM2_OUT LPTIM2_OUT
-- 2 RTC_ALARMA RTC_ALARMB LPTIM3_OUT LPTIM3_OUT
-- 3 RTC_TAMP1_OUT RTC_TAMP1_OUT LPTIM4_OUT LPTIM4_OUT
-- 4 RTC_TAMP2_OUT RTC_TAMP2_OUT LPTIM5_OUT LPTIM5_OUT SAI4_FS_A
-- 5 RTC_TAMP3_OUT RTC_TAMP3_OUT SAI1_FS_A SAI2_FS_A SAI4_FS_B
-- 6 RTC_TAMP4_OUT RTC_TAMP4_OUT SAI1_FS_B SAI2_FS_B
-- 7 COMP1_OUT COMP1_OUT
-- 8 COMP2_OUT COMP2_OUT
-- See RM0433 rev 7 Chapter 43.4.3 "LPTIM input and trigger mapping".
procedure Select_Trigger_Source
(This : in out LPTimer;
Source : LPTimer_Trigger_Source);
procedure Select_Trigger_Filter
(This : in out LPTimer;
Filter : LPTimer_Digital_Filter);
procedure Set_Trigger_Timeout
(This : in out LPTimer;
Enable : Boolean)
with Pre => not Enabled (This);
-- A trigger event arriving when the timer is already started will be
-- ignored (timeout) or will reset and restart the counter.
procedure Configure_Trigger
(This : in out LPTimer;
Source : LPTimer_Trigger_Source;
Filter : LPTimer_Digital_Filter;
Timeout : Boolean);
type LPTimer_Pulse_Mode is (Repetitive, Single);
procedure Select_Pulse_Mode
(This : in out LPTimer;
Mode : LPTimer_Pulse_Mode)
with Pre => Enabled (This);
-- In case of software start (TRIGEN[1:0] = ‘00’), setting this bit starts
-- the LPTIM in Continuous or Single mode. If the software start is disabled
-- (TRIGEN[1:0] different than ‘00’), setting this bit starts the timer in
-- Continuous or Single mode as soon as an external trigger is detected.
-- If this bit is set when a single pulse mode counting is ongoing or in
-- continuous mode, then the LPTIM will not stop at the next match between
-- the LPTIM_ARR and LPTIM_CNT registers and the LPTIM counter keeps
-- counting in Continuous or single mode.
type LPTimer_Waveform_Shape is (PWM_One_Pulse, Set_Once);
procedure Set_Waveform_Shape
(This : in out LPTimer;
Shape : LPTimer_Waveform_Shape)
with Pre => not Enabled (This);
type LPTimer_Waveform_Polarity is (Direct, Inverse);
procedure Set_Waveform_Polarity
(This : in out LPTimer;
Polarity : LPTimer_Waveform_Polarity)
with Pre => not Enabled (This);
procedure Configure_Waveform_Shape
(This : in out LPTimer;
Shape : LPTimer_Waveform_Shape;
Polarity : LPTimer_Waveform_Polarity)
with Pre => not Enabled (This);
-- Two 16-bit registers, the LPTIM_ARR (autoreload register) and LPTIM_CMP
-- (compare register), are used to generate several different waveforms on
-- LPTIM output. The timer can generate the following waveforms:
-- • The PWM mode: the LPTIM output is set as soon as the counter value in
-- LPTIM_CNT exceeds the compare value in LPTIM_CMP. The LPTIM output is
-- reset as soon as a match occurs between the LPTIM_ARR and the LPTIM_CNT
-- registers.
-- • The One-pulse mode: the output waveform is similar to the one of the
-- PWM mode for the first pulse, then the output is permanently reset.
-- • The Set-once mode: the output waveform is similar to the One-pulse
-- mode except that the output is kept to the last signal level (depends
-- on the output configured polarity).
-- See section 43.4.10 RM0433 rev 7 for waveform generation.
procedure Set_Encoder_Mode
(This : in out LPTimer;
Enable : Boolean)
with Pre => not Enabled (This);
-- This mode allows handling signals from quadrature encoders used to detect
-- angular position of rotary elements. Encoder interface mode acts simply
-- as an external clock with direction selection. This means that the
-- counter just counts continuously between 0 and the auto-reload value
-- programmed into the LPTIM_ARR register (0 up to ARR or ARR down to 0
-- depending on the direction). Therefore LPTIM_ARR must be configured
-- before starting.
-- From the two external input signals, Input1 and Input2, a clock signal is
-- generated to clock the LPTIM counter. The phase between those two signals
-- determines the counting direction.Direction change is signalized by the
-- two Down and Up flags in the LPTIM_ISR register. Also, an interrupt can
-- be generated for both direction change events if enabled through the
-- DOWNIE bit.
-- See section 43.4.15 RM0433 rev 7 for encoder scenarios.
private
type LPTimer is new LPTIM1_Peripheral;
end STM32.LPTimers;
|
-- This spec has been automatically generated from nrf53.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package NRF53_SVD.TAD is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Start all trace debug clocks
type CLOCKSTART_Register is record
-- Start trace debug clocks
START : Boolean := False;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CLOCKSTART_Register use record
START at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- Stop all trace debug clocks
type CLOCKSTOP_Register is record
-- Stop trace debug clocks
STOP : Boolean := False;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CLOCKSTOP_Register use record
STOP at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- Enable debug domain and aquire selected GPIOs
type ENABLE_Register is record
-- Enable debug domain and aquire selected GPIOs
ENABLE : Boolean := False;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ENABLE_Register use record
ENABLE at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
subtype TRACECLK_PIN_Field is HAL.UInt5;
-- Pin configuration for traceclk
type TRACECLK_Register is record
-- Pin number
PIN : TRACECLK_PIN_Field := 16#0#;
-- unspecified
Reserved_5_30 : HAL.UInt26 := 16#0#;
-- connection
CONNECT : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TRACECLK_Register use record
PIN at 0 range 0 .. 4;
Reserved_5_30 at 0 range 5 .. 30;
CONNECT at 0 range 31 .. 31;
end record;
subtype TRACEDATA_PIN_Field is HAL.UInt5;
-- Pin configuration for tracedata0
type TRACEDATA_Register is record
-- Pin number
PIN : TRACEDATA_PIN_Field := 16#0#;
-- unspecified
Reserved_5_30 : HAL.UInt26 := 16#0#;
-- connection
CONNECT : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TRACEDATA_Register use record
PIN at 0 range 0 .. 4;
Reserved_5_30 at 0 range 5 .. 30;
CONNECT at 0 range 31 .. 31;
end record;
subtype TRACESPEED_TRACEPORTSPEED_Field is HAL.UInt2;
-- Clocking options for the trace port debug interface
type TRACESPEED_Register is record
-- speed of traceport
TRACEPORTSPEED : TRACESPEED_TRACEPORTSPEED_Field := 16#0#;
-- unspecified
Reserved_2_31 : HAL.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TRACESPEED_Register use record
TRACEPORTSPEED at 0 range 0 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Trace and debug
type TAD_Peripheral is record
-- Start all trace debug clocks
CLOCKSTART : aliased CLOCKSTART_Register;
-- Stop all trace debug clocks
CLOCKSTOP : aliased CLOCKSTOP_Register;
-- Enable debug domain and aquire selected GPIOs
ENABLE : aliased ENABLE_Register;
-- Pin configuration for traceclk
TRACECLK : aliased TRACECLK_Register;
-- Pin configuration for tracedata0
TRACEDATA0 : aliased TRACEDATA_Register;
-- Pin configuration for tracedata1
TRACEDATA1 : aliased TRACEDATA_Register;
-- Pin configuration for tracedata2
TRACEDATA2 : aliased TRACEDATA_Register;
-- Pin configuration for tracedata3
TRACEDATA3 : aliased TRACEDATA_Register;
-- Clocking options for the trace port debug interface
TRACESPEED : aliased TRACESPEED_Register;
end record
with Volatile;
for TAD_Peripheral use record
CLOCKSTART at 16#4# range 0 .. 31;
CLOCKSTOP at 16#8# range 0 .. 31;
ENABLE at 16#500# range 0 .. 31;
TRACECLK at 16#504# range 0 .. 31;
TRACEDATA0 at 16#508# range 0 .. 31;
TRACEDATA1 at 16#50C# range 0 .. 31;
TRACEDATA2 at 16#510# range 0 .. 31;
TRACEDATA3 at 16#514# range 0 .. 31;
TRACESPEED at 16#518# range 0 .. 31;
end record;
-- Trace and debug
TAD_Periph : aliased TAD_Peripheral
with Import, Address => System'To_Address (16#E0080000#);
end NRF53_SVD.TAD;
|
with Ada.Unchecked_Deallocation;
with PB_Support.IO;
with PB_Support.Internal;
package body Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3 is
package Any_IO is
new PB_Support.IO.Message_IO
(Google.Protobuf.Any.Any, Google.Protobuf.Any.Any_Vector,
Google.Protobuf.Any.Append);
package Bool_Value_IO is
new PB_Support.IO.Message_IO
(Google.Protobuf.Wrappers.Bool_Value,
Google.Protobuf.Wrappers.Bool_Value_Vector,
Google.Protobuf.Wrappers.Append);
package Bytes_Value_IO is
new PB_Support.IO.Message_IO
(Google.Protobuf.Wrappers.Bytes_Value,
Google.Protobuf.Wrappers.Bytes_Value_Vector,
Google.Protobuf.Wrappers.Append);
package Double_Value_IO is
new PB_Support.IO.Message_IO
(Google.Protobuf.Wrappers.Double_Value,
Google.Protobuf.Wrappers.Double_Value_Vector,
Google.Protobuf.Wrappers.Append);
package Duration_IO is
new PB_Support.IO.Message_IO
(Google.Protobuf.Duration.Duration,
Google.Protobuf.Duration.Duration_Vector,
Google.Protobuf.Duration.Append);
package Field_Mask_IO is
new PB_Support.IO.Message_IO
(Google.Protobuf.Field_Mask.Field_Mask,
Google.Protobuf.Field_Mask.Field_Mask_Vector,
Google.Protobuf.Field_Mask.Append);
package Float_Value_IO is
new PB_Support.IO.Message_IO
(Google.Protobuf.Wrappers.Float_Value,
Google.Protobuf.Wrappers.Float_Value_Vector,
Google.Protobuf.Wrappers.Append);
package Int_32Value_IO is
new PB_Support.IO.Message_IO
(Google.Protobuf.Wrappers.Int_32Value,
Google.Protobuf.Wrappers.Int_32Value_Vector,
Google.Protobuf.Wrappers.Append);
package Int_64Value_IO is
new PB_Support.IO.Message_IO
(Google.Protobuf.Wrappers.Int_64Value,
Google.Protobuf.Wrappers.Int_64Value_Vector,
Google.Protobuf.Wrappers.Append);
package List_Value_IO is
new PB_Support.IO.Message_IO
(Google.Protobuf.Struct.List_Value,
Google.Protobuf.Struct.List_Value_Vector,
Google.Protobuf.Struct.Append);
package String_Value_IO is
new PB_Support.IO.Message_IO
(Google.Protobuf.Wrappers.String_Value,
Google.Protobuf.Wrappers.String_Value_Vector,
Google.Protobuf.Wrappers.Append);
package Struct_IO is
new PB_Support.IO.Message_IO
(Google.Protobuf.Struct.Struct, Google.Protobuf.Struct.Struct_Vector,
Google.Protobuf.Struct.Append);
package Timestamp_IO is
new PB_Support.IO.Message_IO
(Google.Protobuf.Timestamp.Timestamp,
Google.Protobuf.Timestamp.Timestamp_Vector,
Google.Protobuf.Timestamp.Append);
package UInt_32Value_IO is
new PB_Support.IO.Message_IO
(Google.Protobuf.Wrappers.UInt_32Value,
Google.Protobuf.Wrappers.UInt_32Value_Vector,
Google.Protobuf.Wrappers.Append);
package UInt_64Value_IO is
new PB_Support.IO.Message_IO
(Google.Protobuf.Wrappers.UInt_64Value,
Google.Protobuf.Wrappers.UInt_64Value_Vector,
Google.Protobuf.Wrappers.Append);
package Value_IO is
new PB_Support.IO.Message_IO
(Google.Protobuf.Struct.Value, Google.Protobuf.Struct.Value_Vector,
Google.Protobuf.Struct.Append);
type Integer_Foreign_Enum is range 0 .. 2
with Size =>
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Foreign_Enum'Size;
package Foreign_Enum_IO is
new PB_Support.IO.Enum_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Foreign_Enum,
Integer_Foreign_Enum,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Foreign_Enum_Vectors);
package Foreign_Message_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Foreign_Message,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Foreign_Message_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Test_All_Types_Proto_3_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Test_All_Types_Proto_3,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Test_All_Types_Proto_3_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
type Integer_Aliased_Enum is range 0 .. 2
with Size =>
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Aliased_Enum'Size;
package Aliased_Enum_IO is
new PB_Support.IO.Enum_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Aliased_Enum,
Integer_Aliased_Enum,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Aliased_Enum_Vectors);
package Map_Bool_Bool_Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Bool_Bool_Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Bool_Bool_Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_Fixed_32Fixed_32Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Fixed_32Fixed_32Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Fixed_32Fixed_32Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_Fixed_64Fixed_64Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Fixed_64Fixed_64Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Fixed_64Fixed_64Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_Int_32Double_Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Int_32Double_Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Int_32Double_Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_Int_32Float_Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Int_32Float_Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Int_32Float_Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_Int_32Int_32Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Int_32Int_32Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Int_32Int_32Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_Int_64Int_64Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Int_64Int_64Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Int_64Int_64Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_Sfixed_32Sfixed_32Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Sfixed_32Sfixed_32Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Sfixed_32Sfixed_32Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_Sfixed_64Sfixed_64Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Sfixed_64Sfixed_64Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Sfixed_64Sfixed_64Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_Sint_32Sint_32Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Sint_32Sint_32Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Sint_32Sint_32Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_Sint_64Sint_64Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Sint_64Sint_64Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Sint_64Sint_64Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_String_Bytes_Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_Bytes_Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_Bytes_Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_String_Foreign_Enum_Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_Foreign_Enum_Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_Foreign_Enum_Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_String_Foreign_Message_Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_Foreign_Message_Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_Foreign_Message_Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_String_Nested_Enum_Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_Nested_Enum_Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_Nested_Enum_Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_String_Nested_Message_Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_Nested_Message_Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_Nested_Message_Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_String_String_Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_String_Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_String_Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_Uint_32Uint_32Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Uint_32Uint_32Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Uint_32Uint_32Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
package Map_Uint_64Uint_64Entry_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Uint_64Uint_64Entry,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Uint_64Uint_64Entry_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
type Integer_Nested_Enum is range - 1 .. 2
with Size =>
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Nested_Enum'Size;
package Nested_Enum_IO is
new PB_Support.IO.Enum_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Nested_Enum,
Integer_Nested_Enum,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Nested_Enum_Vectors);
package Nested_Message_IO is
new PB_Support.IO.Message_IO
(Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Nested_Message,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Nested_Message_Vector,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.Append);
function Length (Self : Test_All_Types_Proto_3_Vector) return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Test_All_Types_Proto_3_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Test_All_Types_Proto_3_Array, Test_All_Types_Proto_3_Array_Access);
procedure Append
(Self : in out Test_All_Types_Proto_3_Vector;
V : Test_All_Types_Proto_3) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Test_All_Types_Proto_3'Size);
begin
if Self.Length = 0 then
Self.Data := new Test_All_Types_Proto_3_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Test_All_Types_Proto_3_Array'
(Self.Data.all
& Test_All_Types_Proto_3_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust (Self : in out Test_All_Types_Proto_3_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Test_All_Types_Proto_3_Array'(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Test_All_Types_Proto_3_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Test_All_Types_Proto_3_Variable_Reference
(Self : aliased in out Test_All_Types_Proto_3_Vector;
Index : Positive)
return Test_All_Types_Proto_3_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Test_All_Types_Proto_3_Variable_Reference;
not overriding function Get_Test_All_Types_Proto_3_Constant_Reference
(Self : aliased Test_All_Types_Proto_3_Vector;
Index : Positive)
return Test_All_Types_Proto_3_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Test_All_Types_Proto_3_Constant_Reference;
procedure Read_Test_All_Types_Proto_3
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Test_All_Types_Proto_3) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Optional_Int_32);
when 2 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Optional_Int_64);
when 3 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Optional_Uint_32);
when 4 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Optional_Uint_64);
when 5 =>
PB_Support.IO.Read_Zigzag
(Stream, Key.Encoding, V.Optional_Sint_32);
when 6 =>
PB_Support.IO.Read_Zigzag
(Stream, Key.Encoding, V.Optional_Sint_64);
when 7 =>
PB_Support.IO.Read_Fixed
(Stream, Key.Encoding, V.Optional_Fixed_32);
when 8 =>
PB_Support.IO.Read_Fixed
(Stream, Key.Encoding, V.Optional_Fixed_64);
when 9 =>
PB_Support.IO.Read_Fixed
(Stream, Key.Encoding, V.Optional_Sfixed_32);
when 10 =>
PB_Support.IO.Read_Fixed
(Stream, Key.Encoding, V.Optional_Sfixed_64);
when 11 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Optional_Float);
when 12 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Optional_Double);
when 13 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Optional_Bool);
when 14 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Optional_String);
when 15 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Optional_Bytes);
when 18 =>
if not V.Optional_Nested_Message.Is_Set then
V.Optional_Nested_Message := (True, others => <>);
end if;
Nested_Message_IO.Read
(Stream, Key.Encoding, V.Optional_Nested_Message.Value);
when 19 =>
if not V.Optional_Foreign_Message.Is_Set then
V.Optional_Foreign_Message := (True, others => <>);
end if;
Foreign_Message_IO.Read
(Stream, Key.Encoding, V.Optional_Foreign_Message.Value);
when 21 =>
Nested_Enum_IO.Read
(Stream, Key.Encoding, V.Optional_Nested_Enum);
when 22 =>
Foreign_Enum_IO.Read
(Stream, Key.Encoding, V.Optional_Foreign_Enum);
when 23 =>
Aliased_Enum_IO.Read
(Stream, Key.Encoding, V.Optional_Aliased_Enum);
when 24 =>
PB_Support.IO.Read
(Stream, Key.Encoding, V.Optional_String_Piece);
when 25 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Optional_Cord);
when 27 =>
if V.Recursive_Message.Length = 0 then
V.Recursive_Message.Append ((others => <>));
end if;
Test_All_Types_Proto_3_IO.Read
(Stream, Key.Encoding, V.Recursive_Message (1));
when 31 =>
PB_Support.IO.Read_Varint_Vector
(Stream, Key.Encoding, V.Repeated_Int_32);
when 32 =>
PB_Support.IO.Read_Varint_Vector
(Stream, Key.Encoding, V.Repeated_Int_64);
when 33 =>
PB_Support.IO.Read_Varint_Vector
(Stream, Key.Encoding, V.Repeated_Uint_32);
when 34 =>
PB_Support.IO.Read_Varint_Vector
(Stream, Key.Encoding, V.Repeated_Uint_64);
when 35 =>
PB_Support.IO.Read_Zigzag_Vector
(Stream, Key.Encoding, V.Repeated_Sint_32);
when 36 =>
PB_Support.IO.Read_Zigzag_Vector
(Stream, Key.Encoding, V.Repeated_Sint_64);
when 37 =>
PB_Support.IO.Read_Fixed_Vector
(Stream, Key.Encoding, V.Repeated_Fixed_32);
when 38 =>
PB_Support.IO.Read_Fixed_Vector
(Stream, Key.Encoding, V.Repeated_Fixed_64);
when 39 =>
PB_Support.IO.Read_Fixed_Vector
(Stream, Key.Encoding, V.Repeated_Sfixed_32);
when 40 =>
PB_Support.IO.Read_Fixed_Vector
(Stream, Key.Encoding, V.Repeated_Sfixed_64);
when 41 =>
PB_Support.IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Float);
when 42 =>
PB_Support.IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Double);
when 43 =>
PB_Support.IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Bool);
when 44 =>
PB_Support.IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_String);
when 45 =>
PB_Support.IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Bytes);
when 48 =>
Nested_Message_IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Nested_Message);
when 49 =>
Foreign_Message_IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Foreign_Message);
when 51 =>
Nested_Enum_IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Nested_Enum);
when 52 =>
Foreign_Enum_IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Foreign_Enum);
when 54 =>
PB_Support.IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_String_Piece);
when 55 =>
PB_Support.IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Cord);
when 75 =>
PB_Support.IO.Read_Varint_Vector
(Stream, Key.Encoding, V.Packed_Int_32);
when 76 =>
PB_Support.IO.Read_Varint_Vector
(Stream, Key.Encoding, V.Packed_Int_64);
when 77 =>
PB_Support.IO.Read_Varint_Vector
(Stream, Key.Encoding, V.Packed_Uint_32);
when 78 =>
PB_Support.IO.Read_Varint_Vector
(Stream, Key.Encoding, V.Packed_Uint_64);
when 79 =>
PB_Support.IO.Read_Zigzag_Vector
(Stream, Key.Encoding, V.Packed_Sint_32);
when 80 =>
PB_Support.IO.Read_Zigzag_Vector
(Stream, Key.Encoding, V.Packed_Sint_64);
when 81 =>
PB_Support.IO.Read_Fixed_Vector
(Stream, Key.Encoding, V.Packed_Fixed_32);
when 82 =>
PB_Support.IO.Read_Fixed_Vector
(Stream, Key.Encoding, V.Packed_Fixed_64);
when 83 =>
PB_Support.IO.Read_Fixed_Vector
(Stream, Key.Encoding, V.Packed_Sfixed_32);
when 84 =>
PB_Support.IO.Read_Fixed_Vector
(Stream, Key.Encoding, V.Packed_Sfixed_64);
when 85 =>
PB_Support.IO.Read_Vector
(Stream, Key.Encoding, V.Packed_Float);
when 86 =>
PB_Support.IO.Read_Vector
(Stream, Key.Encoding, V.Packed_Double);
when 87 =>
PB_Support.IO.Read_Vector (Stream, Key.Encoding, V.Packed_Bool);
when 88 =>
Nested_Enum_IO.Read_Vector
(Stream, Key.Encoding, V.Packed_Nested_Enum);
when 89 =>
PB_Support.IO.Read_Varint_Vector
(Stream, Key.Encoding, V.Unpacked_Int_32);
when 90 =>
PB_Support.IO.Read_Varint_Vector
(Stream, Key.Encoding, V.Unpacked_Int_64);
when 91 =>
PB_Support.IO.Read_Varint_Vector
(Stream, Key.Encoding, V.Unpacked_Uint_32);
when 92 =>
PB_Support.IO.Read_Varint_Vector
(Stream, Key.Encoding, V.Unpacked_Uint_64);
when 93 =>
PB_Support.IO.Read_Zigzag_Vector
(Stream, Key.Encoding, V.Unpacked_Sint_32);
when 94 =>
PB_Support.IO.Read_Zigzag_Vector
(Stream, Key.Encoding, V.Unpacked_Sint_64);
when 95 =>
PB_Support.IO.Read_Fixed_Vector
(Stream, Key.Encoding, V.Unpacked_Fixed_32);
when 96 =>
PB_Support.IO.Read_Fixed_Vector
(Stream, Key.Encoding, V.Unpacked_Fixed_64);
when 97 =>
PB_Support.IO.Read_Fixed_Vector
(Stream, Key.Encoding, V.Unpacked_Sfixed_32);
when 98 =>
PB_Support.IO.Read_Fixed_Vector
(Stream, Key.Encoding, V.Unpacked_Sfixed_64);
when 99 =>
PB_Support.IO.Read_Vector
(Stream, Key.Encoding, V.Unpacked_Float);
when 100 =>
PB_Support.IO.Read_Vector
(Stream, Key.Encoding, V.Unpacked_Double);
when 101 =>
PB_Support.IO.Read_Vector
(Stream, Key.Encoding, V.Unpacked_Bool);
when 102 =>
Nested_Enum_IO.Read_Vector
(Stream, Key.Encoding, V.Unpacked_Nested_Enum);
when 56 =>
Map_Int_32Int_32Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_Int_32_Int_32);
when 57 =>
Map_Int_64Int_64Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_Int_64_Int_64);
when 58 =>
Map_Uint_32Uint_32Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_Uint_32_Uint_32);
when 59 =>
Map_Uint_64Uint_64Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_Uint_64_Uint_64);
when 60 =>
Map_Sint_32Sint_32Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_Sint_32_Sint_32);
when 61 =>
Map_Sint_64Sint_64Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_Sint_64_Sint_64);
when 62 =>
Map_Fixed_32Fixed_32Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_Fixed_32_Fixed_32);
when 63 =>
Map_Fixed_64Fixed_64Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_Fixed_64_Fixed_64);
when 64 =>
Map_Sfixed_32Sfixed_32Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_Sfixed_32_Sfixed_32);
when 65 =>
Map_Sfixed_64Sfixed_64Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_Sfixed_64_Sfixed_64);
when 66 =>
Map_Int_32Float_Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_Int_32_Float);
when 67 =>
Map_Int_32Double_Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_Int_32_Double);
when 68 =>
Map_Bool_Bool_Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_Bool_Bool);
when 69 =>
Map_String_String_Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_String_String);
when 70 =>
Map_String_Bytes_Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_String_Bytes);
when 71 =>
Map_String_Nested_Message_Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_String_Nested_Message);
when 72 =>
Map_String_Foreign_Message_Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_String_Foreign_Message);
when 73 =>
Map_String_Nested_Enum_Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_String_Nested_Enum);
when 74 =>
Map_String_Foreign_Enum_Entry_IO.Read_Vector
(Stream, Key.Encoding, V.Map_String_Foreign_Enum);
when 111 =>
if V.Variant.Oneof_Field /= Oneof_Uint_32_Kind then
V.Variant := (Oneof_Uint_32_Kind, others => <>);
end if;
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Variant.Oneof_Uint_32);
when 112 =>
if V.Variant.Oneof_Field /= Oneof_Nested_Message_Kind then
V.Variant := (Oneof_Nested_Message_Kind, others => <>);
end if;
Nested_Message_IO.Read
(Stream, Key.Encoding, V.Variant.Oneof_Nested_Message);
when 113 =>
if V.Variant.Oneof_Field /= Oneof_String_Kind then
V.Variant := (Oneof_String_Kind, others => <>);
end if;
PB_Support.IO.Read
(Stream, Key.Encoding, V.Variant.Oneof_String);
when 114 =>
if V.Variant.Oneof_Field /= Oneof_Bytes_Kind then
V.Variant := (Oneof_Bytes_Kind, others => <>);
end if;
PB_Support.IO.Read
(Stream, Key.Encoding, V.Variant.Oneof_Bytes);
when 115 =>
if V.Variant.Oneof_Field /= Oneof_Bool_Kind then
V.Variant := (Oneof_Bool_Kind, others => <>);
end if;
PB_Support.IO.Read (Stream, Key.Encoding, V.Variant.Oneof_Bool);
when 116 =>
if V.Variant.Oneof_Field /= Oneof_Uint_64_Kind then
V.Variant := (Oneof_Uint_64_Kind, others => <>);
end if;
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Variant.Oneof_Uint_64);
when 117 =>
if V.Variant.Oneof_Field /= Oneof_Float_Kind then
V.Variant := (Oneof_Float_Kind, others => <>);
end if;
PB_Support.IO.Read
(Stream, Key.Encoding, V.Variant.Oneof_Float);
when 118 =>
if V.Variant.Oneof_Field /= Oneof_Double_Kind then
V.Variant := (Oneof_Double_Kind, others => <>);
end if;
PB_Support.IO.Read
(Stream, Key.Encoding, V.Variant.Oneof_Double);
when 119 =>
if V.Variant.Oneof_Field /= Oneof_Enum_Kind then
V.Variant := (Oneof_Enum_Kind, others => <>);
end if;
Nested_Enum_IO.Read
(Stream, Key.Encoding, V.Variant.Oneof_Enum);
when 201 =>
if not V.Optional_Bool_Wrapper.Is_Set then
V.Optional_Bool_Wrapper := (True, others => <>);
end if;
Bool_Value_IO.Read
(Stream, Key.Encoding, V.Optional_Bool_Wrapper.Value);
when 202 =>
if not V.Optional_Int_32_Wrapper.Is_Set then
V.Optional_Int_32_Wrapper := (True, others => <>);
end if;
Int_32Value_IO.Read
(Stream, Key.Encoding, V.Optional_Int_32_Wrapper.Value);
when 203 =>
if not V.Optional_Int_64_Wrapper.Is_Set then
V.Optional_Int_64_Wrapper := (True, others => <>);
end if;
Int_64Value_IO.Read
(Stream, Key.Encoding, V.Optional_Int_64_Wrapper.Value);
when 204 =>
if not V.Optional_Uint_32_Wrapper.Is_Set then
V.Optional_Uint_32_Wrapper := (True, others => <>);
end if;
UInt_32Value_IO.Read
(Stream, Key.Encoding, V.Optional_Uint_32_Wrapper.Value);
when 205 =>
if not V.Optional_Uint_64_Wrapper.Is_Set then
V.Optional_Uint_64_Wrapper := (True, others => <>);
end if;
UInt_64Value_IO.Read
(Stream, Key.Encoding, V.Optional_Uint_64_Wrapper.Value);
when 206 =>
if not V.Optional_Float_Wrapper.Is_Set then
V.Optional_Float_Wrapper := (True, others => <>);
end if;
Float_Value_IO.Read
(Stream, Key.Encoding, V.Optional_Float_Wrapper.Value);
when 207 =>
if not V.Optional_Double_Wrapper.Is_Set then
V.Optional_Double_Wrapper := (True, others => <>);
end if;
Double_Value_IO.Read
(Stream, Key.Encoding, V.Optional_Double_Wrapper.Value);
when 208 =>
if not V.Optional_String_Wrapper.Is_Set then
V.Optional_String_Wrapper := (True, others => <>);
end if;
String_Value_IO.Read
(Stream, Key.Encoding, V.Optional_String_Wrapper.Value);
when 209 =>
if not V.Optional_Bytes_Wrapper.Is_Set then
V.Optional_Bytes_Wrapper := (True, others => <>);
end if;
Bytes_Value_IO.Read
(Stream, Key.Encoding, V.Optional_Bytes_Wrapper.Value);
when 211 =>
Bool_Value_IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Bool_Wrapper);
when 212 =>
Int_32Value_IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Int_32_Wrapper);
when 213 =>
Int_64Value_IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Int_64_Wrapper);
when 214 =>
UInt_32Value_IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Uint_32_Wrapper);
when 215 =>
UInt_64Value_IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Uint_64_Wrapper);
when 216 =>
Float_Value_IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Float_Wrapper);
when 217 =>
Double_Value_IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Double_Wrapper);
when 218 =>
String_Value_IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_String_Wrapper);
when 219 =>
Bytes_Value_IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Bytes_Wrapper);
when 301 =>
if not V.Optional_Duration.Is_Set then
V.Optional_Duration := (True, others => <>);
end if;
Duration_IO.Read
(Stream, Key.Encoding, V.Optional_Duration.Value);
when 302 =>
if not V.Optional_Timestamp.Is_Set then
V.Optional_Timestamp := (True, others => <>);
end if;
Timestamp_IO.Read
(Stream, Key.Encoding, V.Optional_Timestamp.Value);
when 303 =>
if not V.Optional_Field_Mask.Is_Set then
V.Optional_Field_Mask := (True, others => <>);
end if;
Field_Mask_IO.Read
(Stream, Key.Encoding, V.Optional_Field_Mask.Value);
when 304 =>
if not V.Optional_Struct.Is_Set then
V.Optional_Struct := (True, others => <>);
end if;
Struct_IO.Read (Stream, Key.Encoding, V.Optional_Struct.Value);
when 305 =>
if not V.Optional_Any.Is_Set then
V.Optional_Any := (True, others => <>);
end if;
Any_IO.Read (Stream, Key.Encoding, V.Optional_Any.Value);
when 306 =>
if not V.Optional_Value.Is_Set then
V.Optional_Value := (True, others => <>);
end if;
Value_IO.Read (Stream, Key.Encoding, V.Optional_Value.Value);
when 311 =>
Duration_IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Duration);
when 312 =>
Timestamp_IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Timestamp);
when 313 =>
Field_Mask_IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_Fieldmask);
when 324 =>
Struct_IO.Read_Vector (Stream, Key.Encoding, V.Repeated_Struct);
when 315 =>
Any_IO.Read_Vector (Stream, Key.Encoding, V.Repeated_Any);
when 316 =>
Value_IO.Read_Vector (Stream, Key.Encoding, V.Repeated_Value);
when 317 =>
List_Value_IO.Read_Vector
(Stream, Key.Encoding, V.Repeated_List_Value);
when 401 =>
PB_Support.IO.Read_Varint (Stream, Key.Encoding, V.Fieldname_1);
when 402 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Field_Name_2);
when 403 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Field_Name_3);
when 404 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Field_Name_4);
when 405 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Field_0name_5);
when 406 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Field_0_Name_6);
when 407 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Field_Name_7);
when 408 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Field_Name_8);
when 409 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Field_Name_9);
when 410 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Field_Name_10);
when 411 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.FIELD_NAME11);
when 412 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.FIELD_Name_12);
when 413 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Field_Name_13);
when 414 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Field_Name_14);
when 415 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Field_Name_15);
when 416 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Field_Name_16);
when 417 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Field_Name_17);
when 418 =>
PB_Support.IO.Read_Varint
(Stream, Key.Encoding, V.Field_Name_18);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Test_All_Types_Proto_3;
procedure Write_Test_All_Types_Proto_3
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Test_All_Types_Proto_3) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Test_All_Types_Proto_3 (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Varint_Option (1, V.Optional_Int_32, 0);
WS.Write_Varint_Option (2, V.Optional_Int_64, 0);
WS.Write_Varint_Option (3, V.Optional_Uint_32, 0);
WS.Write_Varint_Option (4, V.Optional_Uint_64, 0);
WS.Write_Zigzag_Option (5, V.Optional_Sint_32, 0);
WS.Write_Zigzag_Option (6, V.Optional_Sint_64, 0);
WS.Write_Fixed_Option (7, V.Optional_Fixed_32, 0);
WS.Write_Fixed_Option (8, V.Optional_Fixed_64, 0);
WS.Write_Fixed_Option (9, V.Optional_Sfixed_32, 0);
WS.Write_Fixed_Option (10, V.Optional_Sfixed_64, 0);
WS.Write_Option (11, V.Optional_Float, 0.0);
WS.Write_Option (12, V.Optional_Double, 0.0);
WS.Write_Option (13, V.Optional_Bool, False);
WS.Write_Option (14, V.Optional_String);
WS.Write_Option (15, V.Optional_Bytes);
if V.Optional_Nested_Message.Is_Set then
WS.Write_Key ((18, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Nested_Message'Write
(Stream, V.Optional_Nested_Message.Value);
end if;
if V.Optional_Foreign_Message.Is_Set then
WS.Write_Key ((19, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Foreign_Message'Write
(Stream, V.Optional_Foreign_Message.Value);
end if;
Nested_Enum_IO.Write_Option
(WS, 21, V.Optional_Nested_Enum,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.FOO);
Foreign_Enum_IO.Write_Option
(WS, 22, V.Optional_Foreign_Enum,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.FOREIGN_FOO);
Aliased_Enum_IO.Write_Option
(WS, 23, V.Optional_Aliased_Enum,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.ALIAS_FOO);
WS.Write_Option (24, V.Optional_String_Piece);
WS.Write_Option (25, V.Optional_Cord);
for J in 1 .. V.Recursive_Message.Length loop
WS.Write_Key ((27, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Test_All_Types_Proto_3'Write
(Stream, V.Recursive_Message (J));
end loop;
WS.Write_Varint_Packed (31, V.Repeated_Int_32);
WS.Write_Varint_Packed (32, V.Repeated_Int_64);
WS.Write_Varint_Packed (33, V.Repeated_Uint_32);
WS.Write_Varint_Packed (34, V.Repeated_Uint_64);
WS.Write_Zigzag_Packed (35, V.Repeated_Sint_32);
WS.Write_Zigzag_Packed (36, V.Repeated_Sint_64);
WS.Write_Fixed_Packed (37, V.Repeated_Fixed_32);
WS.Write_Fixed_Packed (38, V.Repeated_Fixed_64);
WS.Write_Fixed_Packed (39, V.Repeated_Sfixed_32);
WS.Write_Fixed_Packed (40, V.Repeated_Sfixed_64);
WS.Write_Packed (41, V.Repeated_Float);
WS.Write_Packed (42, V.Repeated_Double);
WS.Write_Packed (43, V.Repeated_Bool);
WS.Write (44, V.Repeated_String);
WS.Write (45, V.Repeated_Bytes);
for J in 1 .. V.Repeated_Nested_Message.Length loop
WS.Write_Key ((48, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Nested_Message'Write
(Stream, V.Repeated_Nested_Message (J));
end loop;
for J in 1 .. V.Repeated_Foreign_Message.Length loop
WS.Write_Key ((49, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Foreign_Message'Write
(Stream, V.Repeated_Foreign_Message (J));
end loop;
Nested_Enum_IO.Write_Packed (WS, 51, V.Repeated_Nested_Enum);
Foreign_Enum_IO.Write_Packed (WS, 52, V.Repeated_Foreign_Enum);
WS.Write (54, V.Repeated_String_Piece);
WS.Write (55, V.Repeated_Cord);
WS.Write_Varint_Packed (75, V.Packed_Int_32);
WS.Write_Varint_Packed (76, V.Packed_Int_64);
WS.Write_Varint_Packed (77, V.Packed_Uint_32);
WS.Write_Varint_Packed (78, V.Packed_Uint_64);
WS.Write_Zigzag_Packed (79, V.Packed_Sint_32);
WS.Write_Zigzag_Packed (80, V.Packed_Sint_64);
WS.Write_Fixed_Packed (81, V.Packed_Fixed_32);
WS.Write_Fixed_Packed (82, V.Packed_Fixed_64);
WS.Write_Fixed_Packed (83, V.Packed_Sfixed_32);
WS.Write_Fixed_Packed (84, V.Packed_Sfixed_64);
WS.Write_Packed (85, V.Packed_Float);
WS.Write_Packed (86, V.Packed_Double);
WS.Write_Packed (87, V.Packed_Bool);
Nested_Enum_IO.Write_Packed (WS, 88, V.Packed_Nested_Enum);
WS.Write_Varint (89, V.Unpacked_Int_32);
WS.Write_Varint (90, V.Unpacked_Int_64);
WS.Write_Varint (91, V.Unpacked_Uint_32);
WS.Write_Varint (92, V.Unpacked_Uint_64);
WS.Write_Zigzag (93, V.Unpacked_Sint_32);
WS.Write_Zigzag (94, V.Unpacked_Sint_64);
WS.Write_Fixed (95, V.Unpacked_Fixed_32);
WS.Write_Fixed (96, V.Unpacked_Fixed_64);
WS.Write_Fixed (97, V.Unpacked_Sfixed_32);
WS.Write_Fixed (98, V.Unpacked_Sfixed_64);
WS.Write (99, V.Unpacked_Float);
WS.Write (100, V.Unpacked_Double);
WS.Write (101, V.Unpacked_Bool);
Nested_Enum_IO.Write (WS, 102, V.Unpacked_Nested_Enum);
for J in 1 .. V.Map_Int_32_Int_32.Length loop
WS.Write_Key ((56, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Int_32Int_32Entry'Write
(Stream, V.Map_Int_32_Int_32 (J));
end loop;
for J in 1 .. V.Map_Int_64_Int_64.Length loop
WS.Write_Key ((57, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Int_64Int_64Entry'Write
(Stream, V.Map_Int_64_Int_64 (J));
end loop;
for J in 1 .. V.Map_Uint_32_Uint_32.Length loop
WS.Write_Key ((58, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Uint_32Uint_32Entry'Write
(Stream, V.Map_Uint_32_Uint_32 (J));
end loop;
for J in 1 .. V.Map_Uint_64_Uint_64.Length loop
WS.Write_Key ((59, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Uint_64Uint_64Entry'Write
(Stream, V.Map_Uint_64_Uint_64 (J));
end loop;
for J in 1 .. V.Map_Sint_32_Sint_32.Length loop
WS.Write_Key ((60, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Sint_32Sint_32Entry'Write
(Stream, V.Map_Sint_32_Sint_32 (J));
end loop;
for J in 1 .. V.Map_Sint_64_Sint_64.Length loop
WS.Write_Key ((61, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Sint_64Sint_64Entry'Write
(Stream, V.Map_Sint_64_Sint_64 (J));
end loop;
for J in 1 .. V.Map_Fixed_32_Fixed_32.Length loop
WS.Write_Key ((62, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Fixed_32Fixed_32Entry'Write
(Stream, V.Map_Fixed_32_Fixed_32 (J));
end loop;
for J in 1 .. V.Map_Fixed_64_Fixed_64.Length loop
WS.Write_Key ((63, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Fixed_64Fixed_64Entry'Write
(Stream, V.Map_Fixed_64_Fixed_64 (J));
end loop;
for J in 1 .. V.Map_Sfixed_32_Sfixed_32.Length loop
WS.Write_Key ((64, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Sfixed_32Sfixed_32Entry'Write
(Stream, V.Map_Sfixed_32_Sfixed_32 (J));
end loop;
for J in 1 .. V.Map_Sfixed_64_Sfixed_64.Length loop
WS.Write_Key ((65, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Sfixed_64Sfixed_64Entry'Write
(Stream, V.Map_Sfixed_64_Sfixed_64 (J));
end loop;
for J in 1 .. V.Map_Int_32_Float.Length loop
WS.Write_Key ((66, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Int_32Float_Entry'Write
(Stream, V.Map_Int_32_Float (J));
end loop;
for J in 1 .. V.Map_Int_32_Double.Length loop
WS.Write_Key ((67, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Int_32Double_Entry'Write
(Stream, V.Map_Int_32_Double (J));
end loop;
for J in 1 .. V.Map_Bool_Bool.Length loop
WS.Write_Key ((68, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_Bool_Bool_Entry'Write
(Stream, V.Map_Bool_Bool (J));
end loop;
for J in 1 .. V.Map_String_String.Length loop
WS.Write_Key ((69, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_String_Entry'Write
(Stream, V.Map_String_String (J));
end loop;
for J in 1 .. V.Map_String_Bytes.Length loop
WS.Write_Key ((70, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_Bytes_Entry'Write
(Stream, V.Map_String_Bytes (J));
end loop;
for J in 1 .. V.Map_String_Nested_Message.Length loop
WS.Write_Key ((71, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_Nested_Message_Entry'Write
(Stream, V.Map_String_Nested_Message (J));
end loop;
for J in 1 .. V.Map_String_Foreign_Message.Length loop
WS.Write_Key ((72, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_Foreign_Message_Entry'Write
(Stream, V.Map_String_Foreign_Message (J));
end loop;
for J in 1 .. V.Map_String_Nested_Enum.Length loop
WS.Write_Key ((73, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_Nested_Enum_Entry'Write
(Stream, V.Map_String_Nested_Enum (J));
end loop;
for J in 1 .. V.Map_String_Foreign_Enum.Length loop
WS.Write_Key ((74, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Map_String_Foreign_Enum_Entry'Write
(Stream, V.Map_String_Foreign_Enum (J));
end loop;
if V.Optional_Bool_Wrapper.Is_Set then
WS.Write_Key ((201, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.Bool_Value'Write
(Stream, V.Optional_Bool_Wrapper.Value);
end if;
if V.Optional_Int_32_Wrapper.Is_Set then
WS.Write_Key ((202, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.Int_32Value'Write
(Stream, V.Optional_Int_32_Wrapper.Value);
end if;
if V.Optional_Int_64_Wrapper.Is_Set then
WS.Write_Key ((203, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.Int_64Value'Write
(Stream, V.Optional_Int_64_Wrapper.Value);
end if;
if V.Optional_Uint_32_Wrapper.Is_Set then
WS.Write_Key ((204, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.UInt_32Value'Write
(Stream, V.Optional_Uint_32_Wrapper.Value);
end if;
if V.Optional_Uint_64_Wrapper.Is_Set then
WS.Write_Key ((205, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.UInt_64Value'Write
(Stream, V.Optional_Uint_64_Wrapper.Value);
end if;
if V.Optional_Float_Wrapper.Is_Set then
WS.Write_Key ((206, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.Float_Value'Write
(Stream, V.Optional_Float_Wrapper.Value);
end if;
if V.Optional_Double_Wrapper.Is_Set then
WS.Write_Key ((207, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.Double_Value'Write
(Stream, V.Optional_Double_Wrapper.Value);
end if;
if V.Optional_String_Wrapper.Is_Set then
WS.Write_Key ((208, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.String_Value'Write
(Stream, V.Optional_String_Wrapper.Value);
end if;
if V.Optional_Bytes_Wrapper.Is_Set then
WS.Write_Key ((209, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.Bytes_Value'Write
(Stream, V.Optional_Bytes_Wrapper.Value);
end if;
for J in 1 .. V.Repeated_Bool_Wrapper.Length loop
WS.Write_Key ((211, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.Bool_Value'Write
(Stream, V.Repeated_Bool_Wrapper (J));
end loop;
for J in 1 .. V.Repeated_Int_32_Wrapper.Length loop
WS.Write_Key ((212, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.Int_32Value'Write
(Stream, V.Repeated_Int_32_Wrapper (J));
end loop;
for J in 1 .. V.Repeated_Int_64_Wrapper.Length loop
WS.Write_Key ((213, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.Int_64Value'Write
(Stream, V.Repeated_Int_64_Wrapper (J));
end loop;
for J in 1 .. V.Repeated_Uint_32_Wrapper.Length loop
WS.Write_Key ((214, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.UInt_32Value'Write
(Stream, V.Repeated_Uint_32_Wrapper (J));
end loop;
for J in 1 .. V.Repeated_Uint_64_Wrapper.Length loop
WS.Write_Key ((215, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.UInt_64Value'Write
(Stream, V.Repeated_Uint_64_Wrapper (J));
end loop;
for J in 1 .. V.Repeated_Float_Wrapper.Length loop
WS.Write_Key ((216, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.Float_Value'Write
(Stream, V.Repeated_Float_Wrapper (J));
end loop;
for J in 1 .. V.Repeated_Double_Wrapper.Length loop
WS.Write_Key ((217, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.Double_Value'Write
(Stream, V.Repeated_Double_Wrapper (J));
end loop;
for J in 1 .. V.Repeated_String_Wrapper.Length loop
WS.Write_Key ((218, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.String_Value'Write
(Stream, V.Repeated_String_Wrapper (J));
end loop;
for J in 1 .. V.Repeated_Bytes_Wrapper.Length loop
WS.Write_Key ((219, PB_Support.Length_Delimited));
Google.Protobuf.Wrappers.Bytes_Value'Write
(Stream, V.Repeated_Bytes_Wrapper (J));
end loop;
if V.Optional_Duration.Is_Set then
WS.Write_Key ((301, PB_Support.Length_Delimited));
Google.Protobuf.Duration.Duration'Write
(Stream, V.Optional_Duration.Value);
end if;
if V.Optional_Timestamp.Is_Set then
WS.Write_Key ((302, PB_Support.Length_Delimited));
Google.Protobuf.Timestamp.Timestamp'Write
(Stream, V.Optional_Timestamp.Value);
end if;
if V.Optional_Field_Mask.Is_Set then
WS.Write_Key ((303, PB_Support.Length_Delimited));
Google.Protobuf.Field_Mask.Field_Mask'Write
(Stream, V.Optional_Field_Mask.Value);
end if;
if V.Optional_Struct.Is_Set then
WS.Write_Key ((304, PB_Support.Length_Delimited));
Google.Protobuf.Struct.Struct'Write
(Stream, V.Optional_Struct.Value);
end if;
if V.Optional_Any.Is_Set then
WS.Write_Key ((305, PB_Support.Length_Delimited));
Google.Protobuf.Any.Any'Write (Stream, V.Optional_Any.Value);
end if;
if V.Optional_Value.Is_Set then
WS.Write_Key ((306, PB_Support.Length_Delimited));
Google.Protobuf.Struct.Value'Write
(Stream, V.Optional_Value.Value);
end if;
for J in 1 .. V.Repeated_Duration.Length loop
WS.Write_Key ((311, PB_Support.Length_Delimited));
Google.Protobuf.Duration.Duration'Write
(Stream, V.Repeated_Duration (J));
end loop;
for J in 1 .. V.Repeated_Timestamp.Length loop
WS.Write_Key ((312, PB_Support.Length_Delimited));
Google.Protobuf.Timestamp.Timestamp'Write
(Stream, V.Repeated_Timestamp (J));
end loop;
for J in 1 .. V.Repeated_Fieldmask.Length loop
WS.Write_Key ((313, PB_Support.Length_Delimited));
Google.Protobuf.Field_Mask.Field_Mask'Write
(Stream, V.Repeated_Fieldmask (J));
end loop;
for J in 1 .. V.Repeated_Struct.Length loop
WS.Write_Key ((324, PB_Support.Length_Delimited));
Google.Protobuf.Struct.Struct'Write
(Stream, V.Repeated_Struct (J));
end loop;
for J in 1 .. V.Repeated_Any.Length loop
WS.Write_Key ((315, PB_Support.Length_Delimited));
Google.Protobuf.Any.Any'Write (Stream, V.Repeated_Any (J));
end loop;
for J in 1 .. V.Repeated_Value.Length loop
WS.Write_Key ((316, PB_Support.Length_Delimited));
Google.Protobuf.Struct.Value'Write (Stream, V.Repeated_Value (J));
end loop;
for J in 1 .. V.Repeated_List_Value.Length loop
WS.Write_Key ((317, PB_Support.Length_Delimited));
Google.Protobuf.Struct.List_Value'Write
(Stream, V.Repeated_List_Value (J));
end loop;
WS.Write_Varint_Option (401, V.Fieldname_1, 0);
WS.Write_Varint_Option (402, V.Field_Name_2, 0);
WS.Write_Varint_Option (403, V.Field_Name_3, 0);
WS.Write_Varint_Option (404, V.Field_Name_4, 0);
WS.Write_Varint_Option (405, V.Field_0name_5, 0);
WS.Write_Varint_Option (406, V.Field_0_Name_6, 0);
WS.Write_Varint_Option (407, V.Field_Name_7, 0);
WS.Write_Varint_Option (408, V.Field_Name_8, 0);
WS.Write_Varint_Option (409, V.Field_Name_9, 0);
WS.Write_Varint_Option (410, V.Field_Name_10, 0);
WS.Write_Varint_Option (411, V.FIELD_NAME11, 0);
WS.Write_Varint_Option (412, V.FIELD_Name_12, 0);
WS.Write_Varint_Option (413, V.Field_Name_13, 0);
WS.Write_Varint_Option (414, V.Field_Name_14, 0);
WS.Write_Varint_Option (415, V.Field_Name_15, 0);
WS.Write_Varint_Option (416, V.Field_Name_16, 0);
WS.Write_Varint_Option (417, V.Field_Name_17, 0);
WS.Write_Varint_Option (418, V.Field_Name_18, 0);
case V.Variant.Oneof_Field is
when Oneof_Uint_32_Kind =>
WS.Write_Varint (111, V.Variant.Oneof_Uint_32);
when Oneof_Nested_Message_Kind =>
WS.Write_Key ((112, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Nested_Message'Write
(Stream, V.Variant.Oneof_Nested_Message);
when Oneof_String_Kind =>
WS.Write (113, V.Variant.Oneof_String);
when Oneof_Bytes_Kind =>
WS.Write (114, V.Variant.Oneof_Bytes);
when Oneof_Bool_Kind =>
WS.Write (115, V.Variant.Oneof_Bool);
when Oneof_Uint_64_Kind =>
WS.Write_Varint (116, V.Variant.Oneof_Uint_64);
when Oneof_Float_Kind =>
WS.Write (117, V.Variant.Oneof_Float);
when Oneof_Double_Kind =>
WS.Write (118, V.Variant.Oneof_Double);
when Oneof_Enum_Kind =>
Nested_Enum_IO.Write (WS, 119, V.Variant.Oneof_Enum);
when Oneof_Field_Not_Set =>
null;
end case;
if WS.End_Message then
Write_Test_All_Types_Proto_3 (WS'Access, V);
end if;
end;
end Write_Test_All_Types_Proto_3;
function Length (Self : Nested_Message_Vector) return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Nested_Message_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Nested_Message_Array, Nested_Message_Array_Access);
procedure Append
(Self : in out Nested_Message_Vector;
V : Nested_Message) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Nested_Message'Size);
begin
if Self.Length = 0 then
Self.Data := new Nested_Message_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Nested_Message_Array'
(Self.Data.all & Nested_Message_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust (Self : in out Nested_Message_Vector) is
begin
if Self.Length > 0 then
Self.Data := new Nested_Message_Array'(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize (Self : in out Nested_Message_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Nested_Message_Variable_Reference
(Self : aliased in out Nested_Message_Vector;
Index : Positive)
return Nested_Message_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Nested_Message_Variable_Reference;
not overriding function Get_Nested_Message_Constant_Reference
(Self : aliased Nested_Message_Vector;
Index : Positive)
return Nested_Message_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Nested_Message_Constant_Reference;
procedure Read_Nested_Message
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Nested_Message) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read_Varint (Stream, Key.Encoding, V.A);
when 2 =>
if V.Corecursive.Length = 0 then
V.Corecursive.Append ((others => <>));
end if;
Test_All_Types_Proto_3_IO.Read
(Stream, Key.Encoding, V.Corecursive (1));
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Nested_Message;
procedure Write_Nested_Message
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Nested_Message) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Nested_Message (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Varint_Option (1, V.A, 0);
for J in 1 .. V.Corecursive.Length loop
WS.Write_Key ((2, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Test_All_Types_Proto_3'Write
(Stream, V.Corecursive (J));
end loop;
if WS.End_Message then
Write_Nested_Message (WS'Access, V);
end if;
end;
end Write_Nested_Message;
function Length (Self : Map_Int_32Int_32Entry_Vector) return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_Int_32Int_32Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_Int_32Int_32Entry_Array, Map_Int_32Int_32Entry_Array_Access);
procedure Append
(Self : in out Map_Int_32Int_32Entry_Vector;
V : Map_Int_32Int_32Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_Int_32Int_32Entry'Size);
begin
if Self.Length = 0 then
Self.Data := new Map_Int_32Int_32Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_Int_32Int_32Entry_Array'
(Self.Data.all
& Map_Int_32Int_32Entry_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust (Self : in out Map_Int_32Int_32Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_Int_32Int_32Entry_Array'(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_Int_32Int_32Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_Int_32Int_32Entry_Variable_Reference
(Self : aliased in out Map_Int_32Int_32Entry_Vector;
Index : Positive)
return Map_Int_32Int_32Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Int_32Int_32Entry_Variable_Reference;
not overriding function Get_Map_Int_32Int_32Entry_Constant_Reference
(Self : aliased Map_Int_32Int_32Entry_Vector;
Index : Positive)
return Map_Int_32Int_32Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Int_32Int_32Entry_Constant_Reference;
procedure Read_Map_Int_32Int_32Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_Int_32Int_32Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read_Varint (Stream, Key.Encoding, V.Key);
when 2 =>
PB_Support.IO.Read_Varint (Stream, Key.Encoding, V.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_Int_32Int_32Entry;
procedure Write_Map_Int_32Int_32Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_Int_32Int_32Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_Int_32Int_32Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Varint_Option (1, V.Key, 0);
WS.Write_Varint_Option (2, V.Value, 0);
if WS.End_Message then
Write_Map_Int_32Int_32Entry (WS'Access, V);
end if;
end;
end Write_Map_Int_32Int_32Entry;
function Length (Self : Map_Int_64Int_64Entry_Vector) return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_Int_64Int_64Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_Int_64Int_64Entry_Array, Map_Int_64Int_64Entry_Array_Access);
procedure Append
(Self : in out Map_Int_64Int_64Entry_Vector;
V : Map_Int_64Int_64Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_Int_64Int_64Entry'Size);
begin
if Self.Length = 0 then
Self.Data := new Map_Int_64Int_64Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_Int_64Int_64Entry_Array'
(Self.Data.all
& Map_Int_64Int_64Entry_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust (Self : in out Map_Int_64Int_64Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_Int_64Int_64Entry_Array'(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_Int_64Int_64Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_Int_64Int_64Entry_Variable_Reference
(Self : aliased in out Map_Int_64Int_64Entry_Vector;
Index : Positive)
return Map_Int_64Int_64Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Int_64Int_64Entry_Variable_Reference;
not overriding function Get_Map_Int_64Int_64Entry_Constant_Reference
(Self : aliased Map_Int_64Int_64Entry_Vector;
Index : Positive)
return Map_Int_64Int_64Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Int_64Int_64Entry_Constant_Reference;
procedure Read_Map_Int_64Int_64Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_Int_64Int_64Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read_Varint (Stream, Key.Encoding, V.Key);
when 2 =>
PB_Support.IO.Read_Varint (Stream, Key.Encoding, V.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_Int_64Int_64Entry;
procedure Write_Map_Int_64Int_64Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_Int_64Int_64Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_Int_64Int_64Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Varint_Option (1, V.Key, 0);
WS.Write_Varint_Option (2, V.Value, 0);
if WS.End_Message then
Write_Map_Int_64Int_64Entry (WS'Access, V);
end if;
end;
end Write_Map_Int_64Int_64Entry;
function Length (Self : Map_Uint_32Uint_32Entry_Vector) return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_Uint_32Uint_32Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_Uint_32Uint_32Entry_Array, Map_Uint_32Uint_32Entry_Array_Access);
procedure Append
(Self : in out Map_Uint_32Uint_32Entry_Vector;
V : Map_Uint_32Uint_32Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_Uint_32Uint_32Entry'Size);
begin
if Self.Length = 0 then
Self.Data := new Map_Uint_32Uint_32Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_Uint_32Uint_32Entry_Array'
(Self.Data.all
& Map_Uint_32Uint_32Entry_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust
(Self : in out Map_Uint_32Uint_32Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_Uint_32Uint_32Entry_Array'(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_Uint_32Uint_32Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_Uint_32Uint_32Entry_Variable_Reference
(Self : aliased in out Map_Uint_32Uint_32Entry_Vector;
Index : Positive)
return Map_Uint_32Uint_32Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Uint_32Uint_32Entry_Variable_Reference;
not overriding function Get_Map_Uint_32Uint_32Entry_Constant_Reference
(Self : aliased Map_Uint_32Uint_32Entry_Vector;
Index : Positive)
return Map_Uint_32Uint_32Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Uint_32Uint_32Entry_Constant_Reference;
procedure Read_Map_Uint_32Uint_32Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_Uint_32Uint_32Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read_Varint (Stream, Key.Encoding, V.Key);
when 2 =>
PB_Support.IO.Read_Varint (Stream, Key.Encoding, V.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_Uint_32Uint_32Entry;
procedure Write_Map_Uint_32Uint_32Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_Uint_32Uint_32Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_Uint_32Uint_32Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Varint_Option (1, V.Key, 0);
WS.Write_Varint_Option (2, V.Value, 0);
if WS.End_Message then
Write_Map_Uint_32Uint_32Entry (WS'Access, V);
end if;
end;
end Write_Map_Uint_32Uint_32Entry;
function Length (Self : Map_Uint_64Uint_64Entry_Vector) return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_Uint_64Uint_64Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_Uint_64Uint_64Entry_Array, Map_Uint_64Uint_64Entry_Array_Access);
procedure Append
(Self : in out Map_Uint_64Uint_64Entry_Vector;
V : Map_Uint_64Uint_64Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_Uint_64Uint_64Entry'Size);
begin
if Self.Length = 0 then
Self.Data := new Map_Uint_64Uint_64Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_Uint_64Uint_64Entry_Array'
(Self.Data.all
& Map_Uint_64Uint_64Entry_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust
(Self : in out Map_Uint_64Uint_64Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_Uint_64Uint_64Entry_Array'(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_Uint_64Uint_64Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_Uint_64Uint_64Entry_Variable_Reference
(Self : aliased in out Map_Uint_64Uint_64Entry_Vector;
Index : Positive)
return Map_Uint_64Uint_64Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Uint_64Uint_64Entry_Variable_Reference;
not overriding function Get_Map_Uint_64Uint_64Entry_Constant_Reference
(Self : aliased Map_Uint_64Uint_64Entry_Vector;
Index : Positive)
return Map_Uint_64Uint_64Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Uint_64Uint_64Entry_Constant_Reference;
procedure Read_Map_Uint_64Uint_64Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_Uint_64Uint_64Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read_Varint (Stream, Key.Encoding, V.Key);
when 2 =>
PB_Support.IO.Read_Varint (Stream, Key.Encoding, V.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_Uint_64Uint_64Entry;
procedure Write_Map_Uint_64Uint_64Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_Uint_64Uint_64Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_Uint_64Uint_64Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Varint_Option (1, V.Key, 0);
WS.Write_Varint_Option (2, V.Value, 0);
if WS.End_Message then
Write_Map_Uint_64Uint_64Entry (WS'Access, V);
end if;
end;
end Write_Map_Uint_64Uint_64Entry;
function Length (Self : Map_Sint_32Sint_32Entry_Vector) return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_Sint_32Sint_32Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_Sint_32Sint_32Entry_Array, Map_Sint_32Sint_32Entry_Array_Access);
procedure Append
(Self : in out Map_Sint_32Sint_32Entry_Vector;
V : Map_Sint_32Sint_32Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_Sint_32Sint_32Entry'Size);
begin
if Self.Length = 0 then
Self.Data := new Map_Sint_32Sint_32Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_Sint_32Sint_32Entry_Array'
(Self.Data.all
& Map_Sint_32Sint_32Entry_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust
(Self : in out Map_Sint_32Sint_32Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_Sint_32Sint_32Entry_Array'(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_Sint_32Sint_32Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_Sint_32Sint_32Entry_Variable_Reference
(Self : aliased in out Map_Sint_32Sint_32Entry_Vector;
Index : Positive)
return Map_Sint_32Sint_32Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Sint_32Sint_32Entry_Variable_Reference;
not overriding function Get_Map_Sint_32Sint_32Entry_Constant_Reference
(Self : aliased Map_Sint_32Sint_32Entry_Vector;
Index : Positive)
return Map_Sint_32Sint_32Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Sint_32Sint_32Entry_Constant_Reference;
procedure Read_Map_Sint_32Sint_32Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_Sint_32Sint_32Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read_Zigzag (Stream, Key.Encoding, V.Key);
when 2 =>
PB_Support.IO.Read_Zigzag (Stream, Key.Encoding, V.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_Sint_32Sint_32Entry;
procedure Write_Map_Sint_32Sint_32Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_Sint_32Sint_32Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_Sint_32Sint_32Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Zigzag_Option (1, V.Key, 0);
WS.Write_Zigzag_Option (2, V.Value, 0);
if WS.End_Message then
Write_Map_Sint_32Sint_32Entry (WS'Access, V);
end if;
end;
end Write_Map_Sint_32Sint_32Entry;
function Length (Self : Map_Sint_64Sint_64Entry_Vector) return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_Sint_64Sint_64Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_Sint_64Sint_64Entry_Array, Map_Sint_64Sint_64Entry_Array_Access);
procedure Append
(Self : in out Map_Sint_64Sint_64Entry_Vector;
V : Map_Sint_64Sint_64Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_Sint_64Sint_64Entry'Size);
begin
if Self.Length = 0 then
Self.Data := new Map_Sint_64Sint_64Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_Sint_64Sint_64Entry_Array'
(Self.Data.all
& Map_Sint_64Sint_64Entry_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust
(Self : in out Map_Sint_64Sint_64Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_Sint_64Sint_64Entry_Array'(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_Sint_64Sint_64Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_Sint_64Sint_64Entry_Variable_Reference
(Self : aliased in out Map_Sint_64Sint_64Entry_Vector;
Index : Positive)
return Map_Sint_64Sint_64Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Sint_64Sint_64Entry_Variable_Reference;
not overriding function Get_Map_Sint_64Sint_64Entry_Constant_Reference
(Self : aliased Map_Sint_64Sint_64Entry_Vector;
Index : Positive)
return Map_Sint_64Sint_64Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Sint_64Sint_64Entry_Constant_Reference;
procedure Read_Map_Sint_64Sint_64Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_Sint_64Sint_64Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read_Zigzag (Stream, Key.Encoding, V.Key);
when 2 =>
PB_Support.IO.Read_Zigzag (Stream, Key.Encoding, V.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_Sint_64Sint_64Entry;
procedure Write_Map_Sint_64Sint_64Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_Sint_64Sint_64Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_Sint_64Sint_64Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Zigzag_Option (1, V.Key, 0);
WS.Write_Zigzag_Option (2, V.Value, 0);
if WS.End_Message then
Write_Map_Sint_64Sint_64Entry (WS'Access, V);
end if;
end;
end Write_Map_Sint_64Sint_64Entry;
function Length (Self : Map_Fixed_32Fixed_32Entry_Vector) return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_Fixed_32Fixed_32Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_Fixed_32Fixed_32Entry_Array, Map_Fixed_32Fixed_32Entry_Array_Access);
procedure Append
(Self : in out Map_Fixed_32Fixed_32Entry_Vector;
V : Map_Fixed_32Fixed_32Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_Fixed_32Fixed_32Entry'Size);
begin
if Self.Length = 0 then
Self.Data := new Map_Fixed_32Fixed_32Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_Fixed_32Fixed_32Entry_Array'
(Self.Data.all
& Map_Fixed_32Fixed_32Entry_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust
(Self : in out Map_Fixed_32Fixed_32Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_Fixed_32Fixed_32Entry_Array'(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_Fixed_32Fixed_32Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_Fixed_32Fixed_32Entry_Variable_Reference
(Self : aliased in out Map_Fixed_32Fixed_32Entry_Vector;
Index : Positive)
return Map_Fixed_32Fixed_32Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Fixed_32Fixed_32Entry_Variable_Reference;
not overriding function Get_Map_Fixed_32Fixed_32Entry_Constant_Reference
(Self : aliased Map_Fixed_32Fixed_32Entry_Vector;
Index : Positive)
return Map_Fixed_32Fixed_32Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Fixed_32Fixed_32Entry_Constant_Reference;
procedure Read_Map_Fixed_32Fixed_32Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_Fixed_32Fixed_32Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read_Fixed (Stream, Key.Encoding, V.Key);
when 2 =>
PB_Support.IO.Read_Fixed (Stream, Key.Encoding, V.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_Fixed_32Fixed_32Entry;
procedure Write_Map_Fixed_32Fixed_32Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_Fixed_32Fixed_32Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_Fixed_32Fixed_32Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Fixed_Option (1, V.Key, 0);
WS.Write_Fixed_Option (2, V.Value, 0);
if WS.End_Message then
Write_Map_Fixed_32Fixed_32Entry (WS'Access, V);
end if;
end;
end Write_Map_Fixed_32Fixed_32Entry;
function Length (Self : Map_Fixed_64Fixed_64Entry_Vector) return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_Fixed_64Fixed_64Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_Fixed_64Fixed_64Entry_Array, Map_Fixed_64Fixed_64Entry_Array_Access);
procedure Append
(Self : in out Map_Fixed_64Fixed_64Entry_Vector;
V : Map_Fixed_64Fixed_64Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_Fixed_64Fixed_64Entry'Size);
begin
if Self.Length = 0 then
Self.Data := new Map_Fixed_64Fixed_64Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_Fixed_64Fixed_64Entry_Array'
(Self.Data.all
& Map_Fixed_64Fixed_64Entry_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust
(Self : in out Map_Fixed_64Fixed_64Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_Fixed_64Fixed_64Entry_Array'(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_Fixed_64Fixed_64Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_Fixed_64Fixed_64Entry_Variable_Reference
(Self : aliased in out Map_Fixed_64Fixed_64Entry_Vector;
Index : Positive)
return Map_Fixed_64Fixed_64Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Fixed_64Fixed_64Entry_Variable_Reference;
not overriding function Get_Map_Fixed_64Fixed_64Entry_Constant_Reference
(Self : aliased Map_Fixed_64Fixed_64Entry_Vector;
Index : Positive)
return Map_Fixed_64Fixed_64Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Fixed_64Fixed_64Entry_Constant_Reference;
procedure Read_Map_Fixed_64Fixed_64Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_Fixed_64Fixed_64Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read_Fixed (Stream, Key.Encoding, V.Key);
when 2 =>
PB_Support.IO.Read_Fixed (Stream, Key.Encoding, V.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_Fixed_64Fixed_64Entry;
procedure Write_Map_Fixed_64Fixed_64Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_Fixed_64Fixed_64Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_Fixed_64Fixed_64Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Fixed_Option (1, V.Key, 0);
WS.Write_Fixed_Option (2, V.Value, 0);
if WS.End_Message then
Write_Map_Fixed_64Fixed_64Entry (WS'Access, V);
end if;
end;
end Write_Map_Fixed_64Fixed_64Entry;
function Length
(Self : Map_Sfixed_32Sfixed_32Entry_Vector)
return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_Sfixed_32Sfixed_32Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_Sfixed_32Sfixed_32Entry_Array,
Map_Sfixed_32Sfixed_32Entry_Array_Access);
procedure Append
(Self : in out Map_Sfixed_32Sfixed_32Entry_Vector;
V : Map_Sfixed_32Sfixed_32Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_Sfixed_32Sfixed_32Entry'Size);
begin
if Self.Length = 0 then
Self.Data :=
new Map_Sfixed_32Sfixed_32Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_Sfixed_32Sfixed_32Entry_Array'
(Self.Data.all
& Map_Sfixed_32Sfixed_32Entry_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust
(Self : in out Map_Sfixed_32Sfixed_32Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_Sfixed_32Sfixed_32Entry_Array'
(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_Sfixed_32Sfixed_32Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_Sfixed_32Sfixed_32Entry_Variable_Reference
(Self : aliased in out Map_Sfixed_32Sfixed_32Entry_Vector;
Index : Positive)
return Map_Sfixed_32Sfixed_32Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Sfixed_32Sfixed_32Entry_Variable_Reference;
not overriding function Get_Map_Sfixed_32Sfixed_32Entry_Constant_Reference
(Self : aliased Map_Sfixed_32Sfixed_32Entry_Vector;
Index : Positive)
return Map_Sfixed_32Sfixed_32Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Sfixed_32Sfixed_32Entry_Constant_Reference;
procedure Read_Map_Sfixed_32Sfixed_32Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_Sfixed_32Sfixed_32Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read_Fixed (Stream, Key.Encoding, V.Key);
when 2 =>
PB_Support.IO.Read_Fixed (Stream, Key.Encoding, V.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_Sfixed_32Sfixed_32Entry;
procedure Write_Map_Sfixed_32Sfixed_32Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_Sfixed_32Sfixed_32Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_Sfixed_32Sfixed_32Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Fixed_Option (1, V.Key, 0);
WS.Write_Fixed_Option (2, V.Value, 0);
if WS.End_Message then
Write_Map_Sfixed_32Sfixed_32Entry (WS'Access, V);
end if;
end;
end Write_Map_Sfixed_32Sfixed_32Entry;
function Length
(Self : Map_Sfixed_64Sfixed_64Entry_Vector)
return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_Sfixed_64Sfixed_64Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_Sfixed_64Sfixed_64Entry_Array,
Map_Sfixed_64Sfixed_64Entry_Array_Access);
procedure Append
(Self : in out Map_Sfixed_64Sfixed_64Entry_Vector;
V : Map_Sfixed_64Sfixed_64Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_Sfixed_64Sfixed_64Entry'Size);
begin
if Self.Length = 0 then
Self.Data :=
new Map_Sfixed_64Sfixed_64Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_Sfixed_64Sfixed_64Entry_Array'
(Self.Data.all
& Map_Sfixed_64Sfixed_64Entry_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust
(Self : in out Map_Sfixed_64Sfixed_64Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_Sfixed_64Sfixed_64Entry_Array'
(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_Sfixed_64Sfixed_64Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_Sfixed_64Sfixed_64Entry_Variable_Reference
(Self : aliased in out Map_Sfixed_64Sfixed_64Entry_Vector;
Index : Positive)
return Map_Sfixed_64Sfixed_64Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Sfixed_64Sfixed_64Entry_Variable_Reference;
not overriding function Get_Map_Sfixed_64Sfixed_64Entry_Constant_Reference
(Self : aliased Map_Sfixed_64Sfixed_64Entry_Vector;
Index : Positive)
return Map_Sfixed_64Sfixed_64Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Sfixed_64Sfixed_64Entry_Constant_Reference;
procedure Read_Map_Sfixed_64Sfixed_64Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_Sfixed_64Sfixed_64Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read_Fixed (Stream, Key.Encoding, V.Key);
when 2 =>
PB_Support.IO.Read_Fixed (Stream, Key.Encoding, V.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_Sfixed_64Sfixed_64Entry;
procedure Write_Map_Sfixed_64Sfixed_64Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_Sfixed_64Sfixed_64Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_Sfixed_64Sfixed_64Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Fixed_Option (1, V.Key, 0);
WS.Write_Fixed_Option (2, V.Value, 0);
if WS.End_Message then
Write_Map_Sfixed_64Sfixed_64Entry (WS'Access, V);
end if;
end;
end Write_Map_Sfixed_64Sfixed_64Entry;
function Length (Self : Map_Int_32Float_Entry_Vector) return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_Int_32Float_Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_Int_32Float_Entry_Array, Map_Int_32Float_Entry_Array_Access);
procedure Append
(Self : in out Map_Int_32Float_Entry_Vector;
V : Map_Int_32Float_Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_Int_32Float_Entry'Size);
begin
if Self.Length = 0 then
Self.Data := new Map_Int_32Float_Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_Int_32Float_Entry_Array'
(Self.Data.all
& Map_Int_32Float_Entry_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust (Self : in out Map_Int_32Float_Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_Int_32Float_Entry_Array'(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_Int_32Float_Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_Int_32Float_Entry_Variable_Reference
(Self : aliased in out Map_Int_32Float_Entry_Vector;
Index : Positive)
return Map_Int_32Float_Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Int_32Float_Entry_Variable_Reference;
not overriding function Get_Map_Int_32Float_Entry_Constant_Reference
(Self : aliased Map_Int_32Float_Entry_Vector;
Index : Positive)
return Map_Int_32Float_Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Int_32Float_Entry_Constant_Reference;
procedure Read_Map_Int_32Float_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_Int_32Float_Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read_Varint (Stream, Key.Encoding, V.Key);
when 2 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_Int_32Float_Entry;
procedure Write_Map_Int_32Float_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_Int_32Float_Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_Int_32Float_Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Varint_Option (1, V.Key, 0);
WS.Write_Option (2, V.Value, 0.0);
if WS.End_Message then
Write_Map_Int_32Float_Entry (WS'Access, V);
end if;
end;
end Write_Map_Int_32Float_Entry;
function Length (Self : Map_Int_32Double_Entry_Vector) return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_Int_32Double_Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_Int_32Double_Entry_Array, Map_Int_32Double_Entry_Array_Access);
procedure Append
(Self : in out Map_Int_32Double_Entry_Vector;
V : Map_Int_32Double_Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_Int_32Double_Entry'Size);
begin
if Self.Length = 0 then
Self.Data := new Map_Int_32Double_Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_Int_32Double_Entry_Array'
(Self.Data.all
& Map_Int_32Double_Entry_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust (Self : in out Map_Int_32Double_Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_Int_32Double_Entry_Array'(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_Int_32Double_Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_Int_32Double_Entry_Variable_Reference
(Self : aliased in out Map_Int_32Double_Entry_Vector;
Index : Positive)
return Map_Int_32Double_Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Int_32Double_Entry_Variable_Reference;
not overriding function Get_Map_Int_32Double_Entry_Constant_Reference
(Self : aliased Map_Int_32Double_Entry_Vector;
Index : Positive)
return Map_Int_32Double_Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Int_32Double_Entry_Constant_Reference;
procedure Read_Map_Int_32Double_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_Int_32Double_Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read_Varint (Stream, Key.Encoding, V.Key);
when 2 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_Int_32Double_Entry;
procedure Write_Map_Int_32Double_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_Int_32Double_Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_Int_32Double_Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Varint_Option (1, V.Key, 0);
WS.Write_Option (2, V.Value, 0.0);
if WS.End_Message then
Write_Map_Int_32Double_Entry (WS'Access, V);
end if;
end;
end Write_Map_Int_32Double_Entry;
function Length (Self : Map_Bool_Bool_Entry_Vector) return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_Bool_Bool_Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_Bool_Bool_Entry_Array, Map_Bool_Bool_Entry_Array_Access);
procedure Append
(Self : in out Map_Bool_Bool_Entry_Vector;
V : Map_Bool_Bool_Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_Bool_Bool_Entry'Size);
begin
if Self.Length = 0 then
Self.Data := new Map_Bool_Bool_Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_Bool_Bool_Entry_Array'
(Self.Data.all
& Map_Bool_Bool_Entry_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust (Self : in out Map_Bool_Bool_Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_Bool_Bool_Entry_Array'(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize (Self : in out Map_Bool_Bool_Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_Bool_Bool_Entry_Variable_Reference
(Self : aliased in out Map_Bool_Bool_Entry_Vector;
Index : Positive)
return Map_Bool_Bool_Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Bool_Bool_Entry_Variable_Reference;
not overriding function Get_Map_Bool_Bool_Entry_Constant_Reference
(Self : aliased Map_Bool_Bool_Entry_Vector;
Index : Positive)
return Map_Bool_Bool_Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_Bool_Bool_Entry_Constant_Reference;
procedure Read_Map_Bool_Bool_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_Bool_Bool_Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Key);
when 2 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_Bool_Bool_Entry;
procedure Write_Map_Bool_Bool_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_Bool_Bool_Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_Bool_Bool_Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Option (1, V.Key, False);
WS.Write_Option (2, V.Value, False);
if WS.End_Message then
Write_Map_Bool_Bool_Entry (WS'Access, V);
end if;
end;
end Write_Map_Bool_Bool_Entry;
function Length (Self : Map_String_String_Entry_Vector) return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_String_String_Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_String_String_Entry_Array, Map_String_String_Entry_Array_Access);
procedure Append
(Self : in out Map_String_String_Entry_Vector;
V : Map_String_String_Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_String_String_Entry'Size);
begin
if Self.Length = 0 then
Self.Data := new Map_String_String_Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_String_String_Entry_Array'
(Self.Data.all
& Map_String_String_Entry_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust
(Self : in out Map_String_String_Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_String_String_Entry_Array'(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_String_String_Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_String_String_Entry_Variable_Reference
(Self : aliased in out Map_String_String_Entry_Vector;
Index : Positive)
return Map_String_String_Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_String_String_Entry_Variable_Reference;
not overriding function Get_Map_String_String_Entry_Constant_Reference
(Self : aliased Map_String_String_Entry_Vector;
Index : Positive)
return Map_String_String_Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_String_String_Entry_Constant_Reference;
procedure Read_Map_String_String_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_String_String_Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Key);
when 2 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_String_String_Entry;
procedure Write_Map_String_String_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_String_String_Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_String_String_Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Option (1, V.Key);
WS.Write_Option (2, V.Value);
if WS.End_Message then
Write_Map_String_String_Entry (WS'Access, V);
end if;
end;
end Write_Map_String_String_Entry;
function Length (Self : Map_String_Bytes_Entry_Vector) return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_String_Bytes_Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_String_Bytes_Entry_Array, Map_String_Bytes_Entry_Array_Access);
procedure Append
(Self : in out Map_String_Bytes_Entry_Vector;
V : Map_String_Bytes_Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_String_Bytes_Entry'Size);
begin
if Self.Length = 0 then
Self.Data := new Map_String_Bytes_Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_String_Bytes_Entry_Array'
(Self.Data.all
& Map_String_Bytes_Entry_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust (Self : in out Map_String_Bytes_Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_String_Bytes_Entry_Array'(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_String_Bytes_Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_String_Bytes_Entry_Variable_Reference
(Self : aliased in out Map_String_Bytes_Entry_Vector;
Index : Positive)
return Map_String_Bytes_Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_String_Bytes_Entry_Variable_Reference;
not overriding function Get_Map_String_Bytes_Entry_Constant_Reference
(Self : aliased Map_String_Bytes_Entry_Vector;
Index : Positive)
return Map_String_Bytes_Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_String_Bytes_Entry_Constant_Reference;
procedure Read_Map_String_Bytes_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_String_Bytes_Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Key);
when 2 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_String_Bytes_Entry;
procedure Write_Map_String_Bytes_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_String_Bytes_Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_String_Bytes_Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Option (1, V.Key);
WS.Write_Option (2, V.Value);
if WS.End_Message then
Write_Map_String_Bytes_Entry (WS'Access, V);
end if;
end;
end Write_Map_String_Bytes_Entry;
function Length
(Self : Map_String_Nested_Message_Entry_Vector)
return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_String_Nested_Message_Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_String_Nested_Message_Entry_Array,
Map_String_Nested_Message_Entry_Array_Access);
procedure Append
(Self : in out Map_String_Nested_Message_Entry_Vector;
V : Map_String_Nested_Message_Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_String_Nested_Message_Entry'Size);
begin
if Self.Length = 0 then
Self.Data :=
new Map_String_Nested_Message_Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_String_Nested_Message_Entry_Array'
(Self.Data.all
& Map_String_Nested_Message_Entry_Array'
(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust
(Self : in out Map_String_Nested_Message_Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_String_Nested_Message_Entry_Array'
(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_String_Nested_Message_Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_String_Nested_Message_Entry_Variable_Reference
(Self : aliased in out Map_String_Nested_Message_Entry_Vector;
Index : Positive)
return Map_String_Nested_Message_Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_String_Nested_Message_Entry_Variable_Reference;
not overriding function Get_Map_String_Nested_Message_Entry_Constant_Reference
(Self : aliased Map_String_Nested_Message_Entry_Vector;
Index : Positive)
return Map_String_Nested_Message_Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_String_Nested_Message_Entry_Constant_Reference;
procedure Read_Map_String_Nested_Message_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_String_Nested_Message_Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Key);
when 2 =>
if not V.Value.Is_Set then
V.Value := (True, others => <>);
end if;
Nested_Message_IO.Read (Stream, Key.Encoding, V.Value.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_String_Nested_Message_Entry;
procedure Write_Map_String_Nested_Message_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_String_Nested_Message_Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_String_Nested_Message_Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Option (1, V.Key);
if V.Value.Is_Set then
WS.Write_Key ((2, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Nested_Message'Write
(Stream, V.Value.Value);
end if;
if WS.End_Message then
Write_Map_String_Nested_Message_Entry (WS'Access, V);
end if;
end;
end Write_Map_String_Nested_Message_Entry;
function Length
(Self : Map_String_Foreign_Message_Entry_Vector)
return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_String_Foreign_Message_Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_String_Foreign_Message_Entry_Array,
Map_String_Foreign_Message_Entry_Array_Access);
procedure Append
(Self : in out Map_String_Foreign_Message_Entry_Vector;
V : Map_String_Foreign_Message_Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_String_Foreign_Message_Entry'Size);
begin
if Self.Length = 0 then
Self.Data :=
new Map_String_Foreign_Message_Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_String_Foreign_Message_Entry_Array'
(Self.Data.all
& Map_String_Foreign_Message_Entry_Array'
(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust
(Self : in out Map_String_Foreign_Message_Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_String_Foreign_Message_Entry_Array'
(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_String_Foreign_Message_Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_String_Foreign_Message_Entry_Variable_Reference
(Self : aliased in out Map_String_Foreign_Message_Entry_Vector;
Index : Positive)
return Map_String_Foreign_Message_Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_String_Foreign_Message_Entry_Variable_Reference;
not overriding function Get_Map_String_Foreign_Message_Entry_Constant_Reference
(Self : aliased Map_String_Foreign_Message_Entry_Vector;
Index : Positive)
return Map_String_Foreign_Message_Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_String_Foreign_Message_Entry_Constant_Reference;
procedure Read_Map_String_Foreign_Message_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_String_Foreign_Message_Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Key);
when 2 =>
if not V.Value.Is_Set then
V.Value := (True, others => <>);
end if;
Foreign_Message_IO.Read (Stream, Key.Encoding, V.Value.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_String_Foreign_Message_Entry;
procedure Write_Map_String_Foreign_Message_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_String_Foreign_Message_Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_String_Foreign_Message_Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Option (1, V.Key);
if V.Value.Is_Set then
WS.Write_Key ((2, PB_Support.Length_Delimited));
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3
.Foreign_Message'Write
(Stream, V.Value.Value);
end if;
if WS.End_Message then
Write_Map_String_Foreign_Message_Entry (WS'Access, V);
end if;
end;
end Write_Map_String_Foreign_Message_Entry;
function Length
(Self : Map_String_Nested_Enum_Entry_Vector)
return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_String_Nested_Enum_Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_String_Nested_Enum_Entry_Array,
Map_String_Nested_Enum_Entry_Array_Access);
procedure Append
(Self : in out Map_String_Nested_Enum_Entry_Vector;
V : Map_String_Nested_Enum_Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_String_Nested_Enum_Entry'Size);
begin
if Self.Length = 0 then
Self.Data :=
new Map_String_Nested_Enum_Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_String_Nested_Enum_Entry_Array'
(Self.Data.all
& Map_String_Nested_Enum_Entry_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust
(Self : in out Map_String_Nested_Enum_Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_String_Nested_Enum_Entry_Array'
(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_String_Nested_Enum_Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_String_Nested_Enum_Entry_Variable_Reference
(Self : aliased in out Map_String_Nested_Enum_Entry_Vector;
Index : Positive)
return Map_String_Nested_Enum_Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_String_Nested_Enum_Entry_Variable_Reference;
not overriding function Get_Map_String_Nested_Enum_Entry_Constant_Reference
(Self : aliased Map_String_Nested_Enum_Entry_Vector;
Index : Positive)
return Map_String_Nested_Enum_Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_String_Nested_Enum_Entry_Constant_Reference;
procedure Read_Map_String_Nested_Enum_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_String_Nested_Enum_Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Key);
when 2 =>
Nested_Enum_IO.Read (Stream, Key.Encoding, V.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_String_Nested_Enum_Entry;
procedure Write_Map_String_Nested_Enum_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_String_Nested_Enum_Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_String_Nested_Enum_Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Option (1, V.Key);
Nested_Enum_IO.Write_Option
(WS, 2, V.Value,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.FOO);
if WS.End_Message then
Write_Map_String_Nested_Enum_Entry (WS'Access, V);
end if;
end;
end Write_Map_String_Nested_Enum_Entry;
function Length
(Self : Map_String_Foreign_Enum_Entry_Vector)
return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Map_String_Foreign_Enum_Entry_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Map_String_Foreign_Enum_Entry_Array,
Map_String_Foreign_Enum_Entry_Array_Access);
procedure Append
(Self : in out Map_String_Foreign_Enum_Entry_Vector;
V : Map_String_Foreign_Enum_Entry) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Map_String_Foreign_Enum_Entry'Size);
begin
if Self.Length = 0 then
Self.Data :=
new Map_String_Foreign_Enum_Entry_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Map_String_Foreign_Enum_Entry_Array'
(Self.Data.all
& Map_String_Foreign_Enum_Entry_Array'
(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust
(Self : in out Map_String_Foreign_Enum_Entry_Vector) is
begin
if Self.Length > 0 then
Self.Data :=
new Map_String_Foreign_Enum_Entry_Array'
(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize
(Self : in out Map_String_Foreign_Enum_Entry_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Map_String_Foreign_Enum_Entry_Variable_Reference
(Self : aliased in out Map_String_Foreign_Enum_Entry_Vector;
Index : Positive)
return Map_String_Foreign_Enum_Entry_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_String_Foreign_Enum_Entry_Variable_Reference;
not overriding function Get_Map_String_Foreign_Enum_Entry_Constant_Reference
(Self : aliased Map_String_Foreign_Enum_Entry_Vector;
Index : Positive)
return Map_String_Foreign_Enum_Entry_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Map_String_Foreign_Enum_Entry_Constant_Reference;
procedure Read_Map_String_Foreign_Enum_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Map_String_Foreign_Enum_Entry) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read (Stream, Key.Encoding, V.Key);
when 2 =>
Foreign_Enum_IO.Read (Stream, Key.Encoding, V.Value);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Map_String_Foreign_Enum_Entry;
procedure Write_Map_String_Foreign_Enum_Entry
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Map_String_Foreign_Enum_Entry) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Map_String_Foreign_Enum_Entry (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Option (1, V.Key);
Foreign_Enum_IO.Write_Option
(WS, 2, V.Value,
Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3.FOREIGN_FOO);
if WS.End_Message then
Write_Map_String_Foreign_Enum_Entry (WS'Access, V);
end if;
end;
end Write_Map_String_Foreign_Enum_Entry;
function Length (Self : Foreign_Message_Vector) return Natural is
begin
return Self.Length;
end Length;
procedure Clear (Self : in out Foreign_Message_Vector) is
begin
Self.Length := 0;
end Clear;
procedure Free is new Ada.Unchecked_Deallocation
(Foreign_Message_Array, Foreign_Message_Array_Access);
procedure Append
(Self : in out Foreign_Message_Vector;
V : Foreign_Message) is
Init_Length : constant Positive :=
Positive'Max (1, 256 / Foreign_Message'Size);
begin
if Self.Length = 0 then
Self.Data := new Foreign_Message_Array (1 .. Init_Length);
elsif Self.Length = Self.Data'Last then
Self.Data :=
new Foreign_Message_Array'
(Self.Data.all & Foreign_Message_Array'(1 .. Self.Length => <>));
end if;
Self.Length := Self.Length + 1;
Self.Data (Self.Length) := V;
end Append;
overriding procedure Adjust (Self : in out Foreign_Message_Vector) is
begin
if Self.Length > 0 then
Self.Data := new Foreign_Message_Array'(Self.Data (1 .. Self.Length));
end if;
end Adjust;
overriding procedure Finalize (Self : in out Foreign_Message_Vector) is
begin
if Self.Data /= null then
Free (Self.Data);
end if;
end Finalize;
not overriding function Get_Foreign_Message_Variable_Reference
(Self : aliased in out Foreign_Message_Vector;
Index : Positive)
return Foreign_Message_Variable_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Foreign_Message_Variable_Reference;
not overriding function Get_Foreign_Message_Constant_Reference
(Self : aliased Foreign_Message_Vector;
Index : Positive)
return Foreign_Message_Constant_Reference is
begin
return (Element => Self.Data (Index)'Access);
end Get_Foreign_Message_Constant_Reference;
procedure Read_Foreign_Message
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Foreign_Message) is
Key : aliased PB_Support.IO.Key;
begin
while PB_Support.IO.Read_Key (Stream, Key'Access) loop
case Key.Field is
when 1 =>
PB_Support.IO.Read_Varint (Stream, Key.Encoding, V.C);
when others =>
PB_Support.IO.Unknown_Field (Stream, Key.Encoding);
end case;
end loop;
end Read_Foreign_Message;
procedure Write_Foreign_Message
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Foreign_Message) is
begin
if Stream.all not in PB_Support.Internal.Stream then
declare
WS : aliased PB_Support.Internal.Stream (Stream);
begin
Write_Foreign_Message (WS'Access, V);
return;
end;
end if;
declare
WS : PB_Support.Internal.Stream renames
PB_Support.Internal.Stream (Stream.all);
begin
WS.Start_Message;
WS.Write_Varint_Option (1, V.C, 0);
if WS.End_Message then
Write_Foreign_Message (WS'Access, V);
end if;
end;
end Write_Foreign_Message;
end Protobuf_Test_Messages.Proto_3.Test_Messages_Proto_3; |
package Floating_Point_Definition is
type Floating_Type_1 is digits 6;
type Floating_Type_2 is digits 6 range 0.0 .. 1.0;
end Floating_Point_Definition;
|
-------------------------------------------------------------------------------
-- package Disorderly, Linear Random Number Generator
-- Copyright (C) 1995-2018 Jonathan S. Parker
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-------------------------------------------------------------------------------
-- PACKAGE Disorderly
--
-- 1. Procedure Disorderly.Random.Get_Random
--
-- is a 61-bit non-linear pseudo random number generator optimized for
-- high statistical quality, and designed to be task-safe.
--
-- procedure Disorderly.Random.Get_Random meets several design goals:
--
-- 1. Uniform output in the range 0 .. 2**61-1.
-- (ie, 61 random bits per call.)
-- (2**61-1 is a Mersenne Prime; explanation below.)
-- 2. Period > 2^246. (Actually, period is about 1.813381 * 2^246.)
-- 3. Period is the product of 4 large (8-byte) prime numbers.
-- 4. Generator is non-linear.
-- 5. Generator is full-period, and 2 of the 3 component generators are
-- full-period. (The 3rd, the non-linear one, is optionally full-period.)
-- 6. Generator is pure (the package is stateless) for convenient use
-- in multi-tasking simulations.
-- 7. CPU time per call is constant (again for multi-tasking simulations).
-- 8. Size of state per generator is 4 x 64 bits.
--
-- Items 1-5 are general characteristics of good generators.
-- Items 6-8 are attributes that are desirable in a language with built-in
-- concurrency.
--
-- 2. procedure Disorderly.Basic_Rand.Get_Random
--
-- is a stripped down linear version of Disorderly.Random generator - for
-- cases in which speed of Random number generation is the most important
-- consideration. It's more than twice as fast as Disorderly.Random. I give
-- it the unappealing name to encourage use of the Disorderly.Random generator
-- instead.
--
-- 3. package Disorderly.Random.Deviates
--
-- is a package of random deviates: floating point random variables
-- satisfying the following distributions:
--
-- Uniform, Normal (Gaussian), Exponential, Lorentzian (Cauchy),
-- Poissonian, Binomial, Negative Binomial, Weibull, Rayleigh,
-- Student_t, Beta, Gamma, Chi_Squared, Log_Normal, Multivariate_Normal.
--
-- Rationale
--
-- I'd summarize the history of pseudo random number generation in
-- five disgraceful chapters:
--
-- 1. Failure of numerical analysts to provide algorithms that work.
-- 2. Failure of programmers to choose correct algorithms to implement.
-- 3. Failure of programmers to correctly implement the algorithms that do work.
-- 4. Failure of implementors to communicate limitations in the algorithms
-- to users.
-- 5. User preference for bad algorithms that don't work, on the grounds
-- that they are faster than good algorithms that do work.
--
-- By the early 1990's, most of the technical problems had been solved. It's now
-- straightforward to make high integrity random number generators with good
-- efficiency, but the less technical problems (2 - 5) remain unsolved.
package Disorderly is
pragma Pure (Disorderly);
end Disorderly;
|
with MSP430_SVD; use MSP430_SVD;
package MSPGD.SPI is
pragma Preelaborate;
type Clock_Source_Type is (UCLK, ACLK, SMCLK);
type SPI_Module_Type is (USCI_A, USCI_B);
type SPI_Mode is (Mode_0, Mode_1, Mode_2, Mode_3);
end MSPGD.SPI;
|
------------------------------------------------------------------------------
-- Copyright (c) 2011, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
with Ada.Strings.Fixed;
with Ada.Strings.Maps;
package body Natools.Getopt_Long is
package Fixed renames Ada.Strings.Fixed;
package Maps renames Ada.Strings.Maps;
---------------------------
-- Any_Name constructors --
---------------------------
function To_Name (Long_Name : String) return Any_Name is
begin
return Any_Name'(Style => Long,
Size => Long_Name'Length,
Long => Long_Name);
end To_Name;
function To_Name (Short_Name : Character) return Any_Name is
begin
return Any_Name'(Style => Short, Size => 1, Short => Short_Name);
end To_Name;
function Image (Name : Any_Name) return String is
begin
case Name.Style is
when Short => return '-' & Name.Short;
when Long => return "--" & Name.Long;
end case;
-- Alternate implementation:
-- case Name.Style is
-- when Short => return String'(1 => Name.Short);
-- when Long => return '"' & Name.Long & '"';
-- end case;
end Image;
----------------------
-- Default handlers --
----------------------
package body Handlers is
procedure Missing_Argument
(Handler : in out Callback;
Id : Option_Id;
Name : Any_Name)
is
pragma Unreferenced (Handler);
pragma Unreferenced (Id);
begin
raise Option_Error with
"Missing argument to option " & Image (Name);
end Missing_Argument;
procedure Unexpected_Argument
(Handler : in out Callback;
Id : Option_Id;
Name : Any_Name;
Argument : String)
is
pragma Unreferenced (Handler);
pragma Unreferenced (Id);
begin
raise Option_Error with
"Unexpected argument """ & Argument
& """ to option " & Image (Name);
end Unexpected_Argument;
procedure Unknown_Option
(Handler : in out Callback;
Name : Any_Name)
is
pragma Unreferenced (Handler);
begin
raise Option_Error with "Unknown option " & Image (Name);
end Unknown_Option;
end Handlers;
-------------------------------------
-- Simple configuration parameters --
-------------------------------------
function Posixly_Correct (Config : Configuration) return Boolean is
begin
return Config.Posixly_Correct;
end Posixly_Correct;
procedure Posixly_Correct
(Config : in out Configuration;
To : Boolean := True) is
begin
Config.Posixly_Correct := To;
end Posixly_Correct;
function Long_Only (Config : Configuration) return Boolean is
begin
return Config.Long_Only;
end Long_Only;
procedure Use_Long_Only
(Config : in out Configuration;
Value : Boolean := True) is
begin
Config.Long_Only := Value;
end Use_Long_Only;
----------------------------
-- Option list management --
----------------------------
procedure Add_Option
(Config : in out Configuration;
Long_Name : String;
Short_Name : Character;
Has_Arg : Argument_Requirement;
Id : Option_Id)
is
New_Option : constant Option
:= (Long_Name_Length => Long_Name'Length,
Id => Id,
Has_Arg => Has_Arg,
Long_Name => Long_Name,
Short_Name => Short_Name);
begin
if Long_Name = Null_Long_Name or Short_Name = Null_Short_Name then
raise Constraint_Error;
end if;
Config.By_Long_Name.Insert (Long_Name, New_Option);
Config.By_Short_Name.Insert (Short_Name, New_Option);
end Add_Option;
procedure Add_Option
(Config : in out Configuration;
Long_Name : String;
Has_Arg : Argument_Requirement;
Id : Option_Id)
is
New_Option : constant Option
:= (Long_Name_Length => Long_Name'Length,
Id => Id,
Has_Arg => Has_Arg,
Long_Name => Long_Name,
Short_Name => Null_Short_Name);
begin
if Long_Name = Null_Long_Name then
raise Constraint_Error;
end if;
Config.By_Long_Name.Insert (Long_Name, New_Option);
end Add_Option;
procedure Add_Option
(Config : in out Configuration;
Short_Name : Character;
Has_Arg : Argument_Requirement;
Id : Option_Id)
is
New_Option : constant Option
:= (Long_Name_Length => 0,
Id => Id,
Has_Arg => Has_Arg,
Long_Name => Null_Long_Name,
Short_Name => Short_Name);
begin
if Short_Name = Null_Short_Name then
raise Constraint_Error;
end if;
Config.By_Short_Name.Insert (Short_Name, New_Option);
end Add_Option;
procedure Del_Option
(Config : in out Configuration;
Id : Option_Id)
is
Short_Name_Cursor : Short_Option_Maps.Cursor
:= Config.By_Short_Name.First;
Long_Name_Cursor : Long_Option_Maps.Cursor
:= Config.By_Long_Name.First;
begin
while Short_Option_Maps.Has_Element (Short_Name_Cursor) loop
declare
Next : constant Short_Option_Maps.Cursor
:= Short_Option_Maps.Next (Short_Name_Cursor);
begin
if Short_Option_Maps.Element (Short_Name_Cursor).Id = Id then
Config.By_Short_Name.Delete (Short_Name_Cursor);
end if;
Short_Name_Cursor := Next;
end;
end loop;
while Long_Option_Maps.Has_Element (Long_Name_Cursor) loop
declare
Next : constant Long_Option_Maps.Cursor
:= Long_Option_Maps.Next (Long_Name_Cursor);
begin
if Long_Option_Maps.Element (Long_Name_Cursor).Id = Id then
Config.By_Long_Name.Delete (Long_Name_Cursor);
end if;
Long_Name_Cursor := Next;
end;
end loop;
end Del_Option;
procedure Del_Option
(Config : in out Configuration;
Long_Name : String) is
begin
Config.By_Long_Name.Delete (Long_Name);
end Del_Option;
procedure Del_Option
(Config : in out Configuration;
Short_Name : Character) is
begin
Config.By_Short_Name.Delete (Short_Name);
end Del_Option;
----------------------------
-- Formatting subprograms --
----------------------------
function Format_Long_Names
(Config : Configuration;
Id : Option_Id;
Separator : String := ", ";
Name_Prefix : String := "--")
return String
is
Long_Name_Count : constant Natural := Get_Long_Name_Count (Config, Id);
Result_Length : Natural;
Position : Positive;
begin
if Long_Name_Count = 0 then
return "";
end if;
Result_Length := Long_Name_Count * Name_Prefix'Length
+ (Long_Name_Count - 1) * Separator'Length;
for J in 1 .. Long_Name_Count loop
Result_Length := Result_Length + Get_Long_Name (Config, Id, J)'Length;
end loop;
return Result : String (1 .. Result_Length) do
Position := Result'First;
for J in 1 .. Long_Name_Count loop
if J > 1 then
Result (Position .. Position + Separator'Length - 1)
:= Separator;
Position := Position + Separator'Length;
end if;
Result (Position .. Position + Name_Prefix'Length - 1)
:= Name_Prefix;
Position := Position + Name_Prefix'Length;
declare
Name : constant String := Get_Long_Name (Config, Id, J);
begin
Result (Position .. Position + Name'Length - 1) := Name;
Position := Position + Name'Length;
end;
end loop;
end return;
end Format_Long_Names;
function Format_Names
(Config : Configuration;
Id : Option_Id;
Separator : String := ", ";
Long_Name_Prefix : String := "--";
Short_Name_Prefix : String := "-";
Short_First : Boolean := True)
return String
is
Long_Names : constant String
:= Format_Long_Names (Config, Id, Separator, Long_Name_Prefix);
Short_Names : constant String
:= Format_Short_Names (Config, Id, Separator, Short_Name_Prefix);
begin
if Long_Names = "" then
return Short_Names;
elsif Short_Names = "" then
return Long_Names;
elsif Short_First then
return Short_Names & Separator & Long_Names;
else
return Long_Names & Separator & Short_Names;
end if;
end Format_Names;
function Format_Short_Names
(Config : Configuration;
Id : Option_Id;
Separator : String := ", ";
Name_Prefix : String := "-")
return String
is
Short_Names : constant String := Get_Short_Names (Config, Id);
Space_Per_Name : constant Positive
:= Name_Prefix'Length + 1 + Separator'Length;
Result : String (1 .. Short_Names'Length * Space_Per_Name);
begin
if Short_Names = "" then
return "";
end if;
for J in Short_Names'Range loop
declare
First : constant Positive
:= Result'First + (J - Short_Names'First) * Space_Per_Name;
begin
Result (First .. First + Name_Prefix'Length - 1) := Name_Prefix;
Result (First + Name_Prefix'Length) := Short_Names (J);
Result (First + Name_Prefix'Length + 1 ..
First + Space_Per_Name - 1) := Separator;
end;
end loop;
return Result (Result'First .. Result'Last - Separator'Length);
end Format_Short_Names;
function Get_Long_Name
(Config : Configuration;
Id : Option_Id;
Index : Positive := 1)
return String
is
Seen : Natural := 0;
Cursor : Long_Option_Maps.Cursor := Config.By_Long_Name.First;
begin
while Long_Option_Maps.Has_Element (Cursor) loop
declare
Opt : constant Option := Long_Option_Maps.Element (Cursor);
begin
if Opt.Id = Id then
Seen := Seen + 1;
if Seen = Index then
return Opt.Long_Name;
end if;
end if;
end;
Long_Option_Maps.Next (Cursor);
end loop;
raise Constraint_Error;
end Get_Long_Name;
function Get_Long_Name_Count
(Config : Configuration;
Id : Option_Id)
return Natural
is
procedure Process (Key : String; Element : Option);
procedure Process (Cursor : Long_Option_Maps.Cursor);
Result : Natural := 0;
procedure Process (Key : String; Element : Option) is
pragma Unreferenced (Key);
begin
if Element.Id = Id then
Result := Result + 1;
end if;
end Process;
procedure Process (Cursor : Long_Option_Maps.Cursor) is
begin
Long_Option_Maps.Query_Element (Cursor, Process'Access);
end Process;
begin
Config.By_Long_Name.Iterate (Process'Access);
return Result;
end Get_Long_Name_Count;
function Get_Short_Name_Count
(Config : Configuration;
Id : Option_Id)
return Natural
is
procedure Process (Key : Character; Element : Option);
procedure Process (Cursor : Short_Option_Maps.Cursor);
Result : Natural := 0;
procedure Process (Key : Character; Element : Option) is
pragma Unreferenced (Key);
begin
if Element.Id = Id then
Result := Result + 1;
end if;
end Process;
procedure Process (Cursor : Short_Option_Maps.Cursor) is
begin
Short_Option_Maps.Query_Element (Cursor, Process'Access);
end Process;
begin
Config.By_Short_Name.Iterate (Process'Access);
return Result;
end Get_Short_Name_Count;
function Get_Short_Names
(Config : Configuration;
Id : Option_Id)
return String
is
procedure Process (Key : Character; Element : Option);
procedure Process (Cursor : Short_Option_Maps.Cursor);
Result : String (1 .. Config.Get_Short_Name_Count (Id));
J : Positive := Result'First;
procedure Process (Key : Character; Element : Option) is
begin
if Element.Id = Id then
Result (J) := Key;
J := J + 1;
end if;
end Process;
procedure Process (Cursor : Short_Option_Maps.Cursor) is
begin
Short_Option_Maps.Query_Element (Cursor, Process'Access);
end Process;
begin
Config.By_Short_Name.Iterate (Process'Access);
return Result;
end Get_Short_Names;
procedure Iterate
(Config : Configuration;
Process : not null access procedure (Id : Option_Id;
Long_Name : String;
Short_Name : Character;
Has_Arg : Argument_Requirement))
is
procedure Long_Process (Key : String; Opt : Option);
procedure Long_Query (C : Long_Option_Maps.Cursor);
procedure Short_Process (Key : Character; Opt : Option);
procedure Short_Query (C : Short_Option_Maps.Cursor);
procedure Long_Process (Key : String; Opt : Option) is
pragma Unreferenced (Key);
begin
if Opt.Short_Name = Null_Short_Name then
Process (Opt.Id, Opt.Long_Name, Opt.Short_Name, Opt.Has_Arg);
end if;
end Long_Process;
procedure Long_Query (C : Long_Option_Maps.Cursor) is
begin
Long_Option_Maps.Query_Element (C, Long_Process'Access);
end Long_Query;
procedure Short_Process (Key : Character; Opt : Option) is
pragma Unreferenced (Key);
begin
Process (Opt.Id, Opt.Long_Name, Opt.Short_Name, Opt.Has_Arg);
end Short_Process;
procedure Short_Query (C : Short_Option_Maps.Cursor) is
begin
Short_Option_Maps.Query_Element (C, Short_Process'Access);
end Short_Query;
begin
Config.By_Short_Name.Iterate (Short_Query'Access);
Config.By_Long_Name.Iterate (Long_Query'Access);
end Iterate;
-----------------------------
-- Command-line processing --
-----------------------------
procedure Process
(Config : Configuration;
Handler : in out Handlers.Callback'Class;
Argument_Count : not null access function return Natural
:= Ada.Command_Line.Argument_Count'Access;
Argument : not null access function (Number : Positive) return String
:= Ada.Command_Line.Argument'Access)
is
procedure Process_Long_Option (Arg : String);
Arg_Count : constant Natural := Argument_Count.all;
Arg_N : Positive := 1;
procedure Process_Long_Option (Arg : String) is
function Has_Prefix (C : Long_Option_Maps.Cursor; Prefix : String)
return Boolean;
Equal : constant Natural := Fixed.Index (Arg, Maps.To_Set ('='));
Cursor : Long_Option_Maps.Cursor;
Arg_Name_Last : Natural := Arg'Last;
function Has_Prefix (C : Long_Option_Maps.Cursor; Prefix : String)
return Boolean
is
Key : constant String := Long_Option_Maps.Key (C);
begin
return Key'Length >= Prefix'Length and then
Key (1 .. Prefix'Length) = Prefix;
end Has_Prefix;
begin
if Equal /= 0 then
Arg_Name_Last := Equal - 1;
end if;
declare
Arg_Name : String renames Arg (Arg'First .. Arg_Name_Last);
begin
-- Looking for an exact match
Cursor := Config.By_Long_Name.Find (Arg_Name);
if not Long_Option_Maps.Has_Element (Cursor) then
-- Looking for a unique partial match
Cursor := Config.By_Long_Name.Ceiling (Arg_Name);
if not Long_Option_Maps.Has_Element (Cursor) or else
not Has_Prefix (Cursor, Arg_Name) or else
Has_Prefix (Long_Option_Maps.Next (Cursor), Arg_Name)
then
Handler.Unknown_Option (To_Name (Arg_Name));
return;
end if;
end if;
-- At this point, Cursor points to the selected argument
declare
Opt : constant Option := Long_Option_Maps.Element (Cursor);
begin
case Opt.Has_Arg is
when No_Argument =>
if Equal = 0 then
Handler.Option (Opt.Id, "");
else
Handler.Unexpected_Argument
(Opt.Id,
To_Name (Opt.Long_Name),
Arg (Equal + 1 .. Arg'Last));
end if;
when Optional_Argument =>
if Equal = 0 then
Handler.Option (Opt.Id, "");
else
Handler.Option (Opt.Id, Arg (Equal + 1 .. Arg'Last));
end if;
when Required_Argument =>
if Equal = 0 then
if Arg_N = Arg_Count then
Handler.Missing_Argument
(Opt.Id, To_Name (Opt.Long_Name));
else
Handler.Option (Opt.Id, Argument (Arg_N + 1));
Arg_N := Arg_N + 1;
end if;
else
Handler.Option (Opt.Id, Arg (Equal + 1 .. Arg'Last));
end if;
end case;
end;
end;
end Process_Long_Option;
begin
while Arg_N <= Arg_Count loop
declare
Arg : constant String := Argument (Arg_N);
begin
if Arg'Length <= 1 or else Arg (Arg'First) /= '-' then
-- This is a non-flag argument, abort option processing if
-- posixly correct.
if Config.Posixly_Correct then
exit;
else
Handler.Argument (Arg);
Arg_N := Arg_N + 1;
end if;
elsif Arg (Arg'First + 1) = '-' then
-- "--" stops option processing.
if Arg'Length = 2 then
Arg_N := Arg_N + 1;
exit;
end if;
-- Argument starting with "--": long option.
Process_Long_Option (Arg (Arg'First + 2 .. Arg'Last));
Arg_N := Arg_N + 1;
elsif Config.Long_Only then
-- Force long option on a single dash prefix.
Process_Long_Option (Arg (Arg'First + 1 .. Arg'Last));
Arg_N := Arg_N + 1;
else
-- Process a list of short options, until one with required
-- argument is encountered (and the rest is its argument).
for Arg_I in Arg'First + 1 .. Arg'Last loop
declare
Cursor : constant Short_Option_Maps.Cursor
:= Config.By_Short_Name.Find (Arg (Arg_I));
begin
if Short_Option_Maps.Has_Element (Cursor) then
declare
Opt : constant Option
:= Short_Option_Maps.Element (Cursor);
begin
if Opt.Has_Arg = Required_Argument then
if Arg_I = Arg'Last then
if Arg_N = Arg_Count then
Handler.Missing_Argument
(Opt.Id, To_Name (Opt.Short_Name));
else
Handler.Option
(Opt.Id, Argument (Arg_N + 1));
Arg_N := Arg_N + 1;
exit;
end if;
else
Handler.Option
(Opt.Id, Arg (Arg_I + 1 .. Arg'Last));
exit;
end if;
else
Handler.Option (Opt.Id, "");
end if;
end;
else
Handler.Unknown_Option (To_Name (Arg (Arg_I)));
end if;
end;
end loop;
Arg_N := Arg_N + 1;
end if;
end;
end loop;
-- Only non-flag arguments remain
while Arg_N <= Arg_Count loop
Handler.Argument (Argument (Arg_N));
Arg_N := Arg_N + 1;
end loop;
end Process;
end Natools.Getopt_Long;
|
-- part of FreeTypeAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
with Interfaces.C.Strings;
with FT.Faces;
with FT.Errors;
private package FT.API is
pragma Preelaborate;
type Bool is new Boolean;
function FT_Reference_Library (Ptr : Library_Ptr) return Errors.Error_Code;
pragma Import (C, FT_Reference_Library, "FT_Reference_Library");
function FT_Done_Library (Library : Library_Ptr) return Errors.Error_Code;
pragma Import (C, FT_Done_Library, "FT_Done_Library");
function FT_Get_Kerning
(aFace : Face_Ptr; Left_Glyph : UInt; Right_Glyph : UInt;
Kern_Mode : UInt; aKerning : access Vector)
return Errors.Error_Code;
pragma Import (C, FT_Get_Kerning, "FT_Get_Kerning");
function FT_Init_FreeType (aLibrary : access FT.Library_Ptr)
return Errors.Error_Code;
pragma Import (C, FT_Init_FreeType, "FT_Init_FreeType");
function FT_Get_Char_Index (Face : Face_Ptr; Char_Code : ULong)
return Faces.Char_Index_Type;
pragma Import (C, FT_Get_Char_Index, "FT_Get_Char_Index");
function FT_Load_Glyph (Face : Face_Ptr; Glyph_Index : Faces.Char_Index_Type;
Flags : Faces.Load_Flag) return Errors.Error_Code;
pragma Import (C, FT_Load_Glyph, "FT_Load_Glyph");
function FT_Load_Char (aFace : Face_Ptr; Char_Code : ULong;
Load_Flags : Faces.Load_Flag)
return Errors.Error_Code;
pragma Import (C, FT_Load_Char, "FT_Load_Char");
function FT_New_Face (Library : Library_Ptr;
File_Path_Name : Interfaces.C.Strings.chars_ptr;
Face_Index : Faces.Face_Index_Type;
aFace : access Face_Ptr)
return Errors.Error_Code;
pragma Import (C, FT_New_Face, "FT_New_Face");
function FT_Reference_Face (Face : Face_Ptr)
return Errors.Error_Code;
pragma Import (C, FT_Reference_Face, "FT_Reference_Face");
function FT_Done_Face (aFace : Face_Ptr) return Errors.Error_Code;
pragma Import (C, FT_Done_Face, "FT_Done_Face");
function FT_Set_Pixel_Sizes (aFace : Face_Ptr;
Pixel_Width : UInt;
Pixel_Height : UInt)
return Errors.Error_Code;
pragma Import (C, FT_Set_Pixel_Sizes, "FT_Set_Pixel_Sizes");
private
for Bool use (False => 0, True => 1);
for Bool'Size use Interfaces.C.unsigned_char'Size;
end FT.API;
|
-- Select an enumeration value uniformly at random.
generic
type Enum_Type is (<>);
function Random_Enum(value : Natural) return Enum_Type;
|
------------------------------------------------------------------------------
-- --
-- Copyright (c) 2014-2015 Vitalij 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 Ada.Strings.Unbounded.Hash;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
package body L10n_Table is
---------------------
-- Get_L10n_String --
---------------------
function Get_L10n_String
(Pattern : Pattern_Matcher; Source_Line : String) return String
is
Bracket_Index : Natural;
Minus_Index : Natural;
First : Positive;
Last : Positive;
Found : Boolean;
Result : Match_Array (0 .. 0);
begin
Match (Pattern, Source_Line, Result);
Found := not (Result (0) = No_Match);
if Found then
First := Result (0).First;
Last := Result (0).Last;
Bracket_Index := Index (Source_Line (First .. Last), "(");
Minus_Index := Index (Source_Line (First .. Last), "-");
if Bracket_Index > 0 and (Bracket_Index - Minus_Index) in 2 .. 3 then
First := Bracket_Index + 1;
elsif Minus_Index > 0 then
First := Minus_Index + 1;
end if;
return Source_Line (First .. Last);
end if;
return "";
end Get_L10n_String;
function Get_L10n_String
(Pattern : Pattern_Matcher;
Source_Line : String) return Unbounded_String is
begin
return To_Unbounded_String (Get_L10n_String (Pattern, Source_Line));
end Get_L10n_String;
function Get_L10n_String
(Pattern : Pattern_Matcher;
Source_Line : Unbounded_String) return Unbounded_String is
begin
return To_Unbounded_String
(Get_L10n_String (Pattern, To_String (Source_Line)));
end Get_L10n_String;
function Get_L10n_String
(Pattern : String;
Source_Line : String) return String is
begin
return Get_L10n_String (Compile (Pattern), Source_Line);
end Get_L10n_String;
end L10n_Table;
|
WITH P_StepHandler;
USE P_StepHandler;
with P_StructuralTypes;
use P_StructuralTypes;
with Ada.Streams;
use Ada.Streams;
package P_StepHandler.InputHandler is
type InputHandler is new T_StepHandler with private;
type Ptr_InputHandler is access InputHandler;
--- CONSTRUCTOR ---
function Make (Self : in out InputHandler;
File_Name : in Unbounded_String) return InputHandler;
--- PROCEDURE ---
procedure Handle (Self : in out InputHandler);
--- GETTER ---
function Get_Input_Size (Self : in InputHandler) return Integer;
function Get_PaddingBitsNumber (Self : in InputHandler) return Integer;
procedure Set_Input_Length (Self : in out InputHandler;
Length : in Integer);
procedure Set_Input_Size (Self : in out InputHandler ; Size : in Integer);
PRIVATE
type InputHandler is new P_StepHandler.T_StepHandler with record
Key : T_Key;
Input_Length : Integer := 0;
Input_Size : Integer := 0;
Input_Name : Unbounded_String;
PaddingBitsNumber : Integer := 0;
end record;
end P_StepHandler.InputHandler;
|
package Giza.Bitmap_Fonts.FreeMonoBoldOblique18pt7b is
Font : constant Giza.Font.Ref_Const;
private
FreeMonoBoldOblique18pt7bBitmaps : aliased constant Font_Bitmap := (
16#0F#, 16#07#, 16#C7#, 16#E3#, 16#F1#, 16#F0#, 16#F8#, 16#7C#, 16#7C#,
16#3E#, 16#1F#, 16#0F#, 16#07#, 16#87#, 16#C3#, 16#C1#, 16#E0#, 16#60#,
16#00#, 16#38#, 16#3E#, 16#1F#, 16#0F#, 16#83#, 16#80#, 16#F8#, 16#FF#,
16#0E#, 16#F1#, 16#EF#, 16#1E#, 16#E1#, 16#CE#, 16#1C#, 16#C1#, 16#CC#,
16#18#, 16#C1#, 16#88#, 16#18#, 16#00#, 16#E3#, 16#80#, 16#79#, 16#E0#,
16#1C#, 16#70#, 16#07#, 16#1C#, 16#03#, 16#CF#, 16#00#, 16#F3#, 16#C0#,
16#38#, 16#E0#, 16#7F#, 16#FF#, 16#3F#, 16#FF#, 16#CF#, 16#FF#, 16#F3#,
16#FF#, 16#F8#, 16#3C#, 16#F0#, 16#0F#, 16#3C#, 16#03#, 16#8E#, 16#0F#,
16#FF#, 16#E3#, 16#FF#, 16#FC#, 16#FF#, 16#FF#, 16#3F#, 16#FF#, 16#83#,
16#CF#, 16#00#, 16#F3#, 16#C0#, 16#38#, 16#E0#, 16#1E#, 16#78#, 16#07#,
16#9E#, 16#01#, 16#C7#, 16#00#, 16#71#, 16#C0#, 16#00#, 16#00#, 16#38#,
16#00#, 16#0E#, 16#00#, 16#07#, 16#80#, 16#03#, 16#F0#, 16#03#, 16#FF#,
16#81#, 16#FF#, 16#F0#, 16#FF#, 16#F8#, 16#3C#, 16#1E#, 16#1E#, 16#07#,
16#87#, 16#80#, 16#01#, 16#F0#, 16#00#, 16#7F#, 16#C0#, 16#0F#, 16#FC#,
16#01#, 16#FF#, 16#80#, 16#07#, 16#F0#, 16#00#, 16#3C#, 16#70#, 16#0F#,
16#3C#, 16#03#, 16#CF#, 16#83#, 16#E3#, 16#FF#, 16#F8#, 16#FF#, 16#FC#,
16#3F#, 16#FE#, 16#0C#, 16#FE#, 16#00#, 16#1C#, 16#00#, 16#07#, 16#00#,
16#03#, 16#C0#, 16#00#, 16#F0#, 16#00#, 16#18#, 16#00#, 16#03#, 16#C0#,
16#0F#, 16#E0#, 16#1C#, 16#70#, 16#30#, 16#30#, 16#30#, 16#30#, 16#30#,
16#70#, 16#38#, 16#E0#, 16#1F#, 16#C3#, 16#0F#, 16#1F#, 16#01#, 16#FC#,
16#0F#, 16#E0#, 16#7F#, 16#00#, 16#F8#, 16#F0#, 16#83#, 16#F8#, 16#07#,
16#1C#, 16#0E#, 16#0C#, 16#0C#, 16#0C#, 16#0C#, 16#1C#, 16#0E#, 16#38#,
16#07#, 16#F0#, 16#03#, 16#C0#, 16#00#, 16#7A#, 16#01#, 16#FF#, 16#03#,
16#FF#, 16#07#, 16#FE#, 16#0F#, 16#9C#, 16#0F#, 16#00#, 16#0F#, 16#00#,
16#0F#, 16#00#, 16#07#, 16#80#, 16#1F#, 16#80#, 16#3F#, 16#C0#, 16#7F#,
16#CF#, 16#7B#, 16#FF#, 16#F1#, 16#FE#, 16#F1#, 16#FC#, 16#F0#, 16#F8#,
16#FF#, 16#FE#, 16#FF#, 16#FE#, 16#7F#, 16#FE#, 16#1F#, 16#BC#, 16#7B#,
16#DD#, 16#EE#, 16#73#, 16#98#, 16#C6#, 16#00#, 16#01#, 16#C0#, 16#F0#,
16#3C#, 16#1E#, 16#0F#, 16#03#, 16#C1#, 16#E0#, 16#70#, 16#3C#, 16#0F#,
16#07#, 16#81#, 16#E0#, 16#78#, 16#3C#, 16#0F#, 16#03#, 16#C0#, 16#F0#,
16#3C#, 16#0F#, 16#03#, 16#C0#, 16#F0#, 16#3E#, 16#07#, 16#81#, 16#E0#,
16#7C#, 16#1F#, 16#03#, 16#80#, 16#07#, 16#03#, 16#C0#, 16#F8#, 16#3E#,
16#07#, 16#81#, 16#F0#, 16#3C#, 16#0F#, 16#03#, 16#C0#, 16#F0#, 16#3C#,
16#0F#, 16#03#, 16#C0#, 16#F0#, 16#78#, 16#1E#, 16#07#, 16#81#, 16#C0#,
16#F0#, 16#3C#, 16#1E#, 16#07#, 16#83#, 16#C1#, 16#E0#, 16#78#, 16#3C#,
16#0E#, 16#00#, 16#00#, 16#C0#, 16#03#, 16#C0#, 16#07#, 16#00#, 16#0E#,
16#02#, 16#3C#, 16#0F#, 16#FF#, 16#FF#, 16#FF#, 16#BF#, 16#FE#, 16#1F#,
16#F0#, 16#1F#, 16#80#, 16#7F#, 16#81#, 16#EF#, 16#07#, 16#8F#, 16#0F#,
16#1E#, 16#08#, 16#10#, 16#00#, 16#00#, 16#70#, 16#00#, 16#3C#, 16#00#,
16#0F#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#E0#, 16#00#, 16#38#, 16#00#,
16#1E#, 16#03#, 16#FF#, 16#FE#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#,
16#FF#, 16#F8#, 16#0F#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#E0#, 16#00#,
16#38#, 16#00#, 16#0E#, 16#00#, 16#07#, 16#80#, 16#01#, 16#C0#, 16#00#,
16#70#, 16#00#, 16#0F#, 16#87#, 16#87#, 16#83#, 16#83#, 16#C1#, 16#C1#,
16#C0#, 16#C0#, 16#E0#, 16#60#, 16#00#, 16#FF#, 16#FF#, 16#BF#, 16#FF#,
16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FE#, 16#77#, 16#FF#, 16#F7#, 16#00#,
16#00#, 16#00#, 16#38#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#1C#, 16#00#,
16#01#, 16#E0#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#0F#,
16#00#, 16#00#, 16#F0#, 16#00#, 16#07#, 16#00#, 16#00#, 16#70#, 16#00#,
16#07#, 16#80#, 16#00#, 16#38#, 16#00#, 16#03#, 16#80#, 16#00#, 16#3C#,
16#00#, 16#03#, 16#C0#, 16#00#, 16#1C#, 16#00#, 16#01#, 16#E0#, 16#00#,
16#1E#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#F0#,
16#00#, 16#07#, 16#00#, 16#00#, 16#70#, 16#00#, 16#07#, 16#80#, 16#00#,
16#78#, 16#00#, 16#03#, 16#80#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#FC#, 16#01#, 16#FF#, 16#01#, 16#FF#, 16#C1#,
16#FF#, 16#E1#, 16#F1#, 16#F9#, 16#E0#, 16#7C#, 16#F0#, 16#1E#, 16#F0#,
16#0F#, 16#78#, 16#07#, 16#B8#, 16#03#, 16#9C#, 16#03#, 16#DE#, 16#01#,
16#CF#, 16#00#, 16#E7#, 16#00#, 16#73#, 16#C0#, 16#79#, 16#E0#, 16#3C#,
16#F0#, 16#1C#, 16#78#, 16#1E#, 16#3E#, 16#1E#, 16#0F#, 16#FF#, 16#07#,
16#FF#, 16#01#, 16#FF#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#7C#, 16#03#,
16#F0#, 16#0F#, 16#E0#, 16#7F#, 16#C0#, 16#F3#, 16#81#, 16#8F#, 16#00#,
16#1C#, 16#00#, 16#38#, 16#00#, 16#70#, 16#01#, 16#E0#, 16#03#, 16#80#,
16#07#, 16#00#, 16#0E#, 16#00#, 16#3C#, 16#00#, 16#70#, 16#00#, 16#E0#,
16#01#, 16#C0#, 16#03#, 16#81#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#,
16#EF#, 16#FF#, 16#C0#, 16#00#, 16#1F#, 16#00#, 16#07#, 16#FC#, 16#00#,
16#FF#, 16#E0#, 16#1F#, 16#FF#, 16#03#, 16#C1#, 16#F0#, 16#78#, 16#0F#,
16#07#, 16#80#, 16#F0#, 16#70#, 16#0F#, 16#00#, 16#01#, 16#E0#, 16#00#,
16#3E#, 16#00#, 16#07#, 16#C0#, 16#00#, 16#F8#, 16#00#, 16#3F#, 16#00#,
16#07#, 16#E0#, 16#01#, 16#FC#, 16#00#, 16#3F#, 16#80#, 16#07#, 16#E0#,
16#01#, 16#F8#, 16#00#, 16#3F#, 16#03#, 16#87#, 16#FF#, 16#F8#, 16#7F#,
16#FF#, 16#87#, 16#FF#, 16#F8#, 16#FF#, 16#FF#, 16#00#, 16#00#, 16#FE#,
16#00#, 16#FF#, 16#C0#, 16#7F#, 16#F8#, 16#3F#, 16#FF#, 16#0E#, 16#07#,
16#C0#, 16#00#, 16#F0#, 16#00#, 16#3C#, 16#00#, 16#1F#, 16#00#, 16#07#,
16#80#, 16#1F#, 16#C0#, 16#0F#, 16#E0#, 16#03#, 16#F0#, 16#00#, 16#FF#,
16#00#, 16#03#, 16#E0#, 16#00#, 16#78#, 16#00#, 16#1E#, 16#00#, 16#07#,
16#80#, 16#03#, 16#C0#, 16#03#, 16#F1#, 16#FF#, 16#F8#, 16#FF#, 16#FC#,
16#3F#, 16#FE#, 16#03#, 16#FE#, 16#00#, 16#00#, 16#1F#, 16#00#, 16#3F#,
16#00#, 16#3F#, 16#00#, 16#7E#, 16#00#, 16#FE#, 16#01#, 16#EE#, 16#03#,
16#DE#, 16#07#, 16#9C#, 16#0F#, 16#1C#, 16#1E#, 16#1C#, 16#3C#, 16#3C#,
16#78#, 16#38#, 16#FF#, 16#FE#, 16#FF#, 16#FE#, 16#FF#, 16#FE#, 16#FF#,
16#FC#, 16#00#, 16#70#, 16#03#, 16#FC#, 16#07#, 16#FC#, 16#07#, 16#FC#,
16#07#, 16#F8#, 16#07#, 16#FF#, 16#C1#, 16#FF#, 16#F0#, 16#7F#, 16#FC#,
16#3F#, 16#FE#, 16#0F#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#E0#, 16#00#,
16#3B#, 16#E0#, 16#1F#, 16#FE#, 16#07#, 16#FF#, 16#C1#, 16#FF#, 16#F8#,
16#78#, 16#3E#, 16#00#, 16#07#, 16#80#, 16#01#, 16#E0#, 16#00#, 16#78#,
16#00#, 16#1E#, 16#00#, 16#0F#, 16#18#, 16#0F#, 16#CF#, 16#FF#, 16#E3#,
16#FF#, 16#F0#, 16#7F#, 16#F8#, 16#07#, 16#F0#, 16#00#, 16#00#, 16#0F#,
16#C0#, 16#0F#, 16#FC#, 16#03#, 16#FF#, 16#81#, 16#FF#, 16#E0#, 16#7F#,
16#00#, 16#1F#, 16#80#, 16#07#, 16#C0#, 16#01#, 16#F0#, 16#00#, 16#3C#,
16#00#, 16#0F#, 16#9F#, 16#01#, 16#EF#, 16#F0#, 16#3F#, 16#FF#, 16#0F#,
16#FF#, 16#F1#, 16#FC#, 16#3E#, 16#3E#, 16#03#, 16#C7#, 16#80#, 16#78#,
16#F0#, 16#0F#, 16#1E#, 16#03#, 16#C3#, 16#E0#, 16#F8#, 16#7F#, 16#FE#,
16#07#, 16#FF#, 16#80#, 16#7F#, 16#E0#, 16#07#, 16#F0#, 16#00#, 16#7F#,
16#FF#, 16#7F#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#F0#, 16#0E#,
16#00#, 16#1E#, 16#00#, 16#1C#, 16#00#, 16#3C#, 16#00#, 16#78#, 16#00#,
16#70#, 16#00#, 16#F0#, 16#00#, 16#E0#, 16#01#, 16#E0#, 16#01#, 16#C0#,
16#03#, 16#C0#, 16#07#, 16#80#, 16#07#, 16#00#, 16#0F#, 16#00#, 16#0E#,
16#00#, 16#1E#, 16#00#, 16#1C#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#7E#,
16#00#, 16#3F#, 16#F0#, 16#0F#, 16#FF#, 16#03#, 16#FF#, 16#F0#, 16#F8#,
16#3E#, 16#3E#, 16#03#, 16#C7#, 16#80#, 16#78#, 16#F0#, 16#0F#, 16#1E#,
16#03#, 16#C3#, 16#E0#, 16#F0#, 16#3F#, 16#FC#, 16#03#, 16#FF#, 16#00#,
16#FF#, 16#E0#, 16#7F#, 16#FE#, 16#1F#, 16#83#, 16#E3#, 16#C0#, 16#3C#,
16#F0#, 16#07#, 16#9E#, 16#01#, 16#F3#, 16#E0#, 16#7C#, 16#7F#, 16#FF#,
16#87#, 16#FF#, 16#E0#, 16#7F#, 16#F0#, 16#03#, 16#F8#, 16#00#, 16#00#,
16#7E#, 16#00#, 16#7F#, 16#C0#, 16#3F#, 16#F8#, 16#1F#, 16#FE#, 16#0F#,
16#87#, 16#C3#, 16#C0#, 16#F1#, 16#E0#, 16#3C#, 16#78#, 16#0F#, 16#1E#,
16#03#, 16#C7#, 16#81#, 16#F1#, 16#F1#, 16#FC#, 16#7F#, 16#FE#, 16#0F#,
16#FF#, 16#81#, 16#FD#, 16#E0#, 16#3E#, 16#F0#, 16#00#, 16#7C#, 16#00#,
16#3E#, 16#00#, 16#1F#, 16#00#, 16#1F#, 16#81#, 16#FF#, 16#C0#, 16#FF#,
16#E0#, 16#3F#, 16#E0#, 16#07#, 16#E0#, 16#00#, 16#1C#, 16#7C#, 16#F9#,
16#F1#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#8F#, 16#9F#,
16#3E#, 16#38#, 16#01#, 16#C0#, 16#7C#, 16#0F#, 16#81#, 16#F0#, 16#3C#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#,
16#C0#, 16#F0#, 16#1E#, 16#07#, 16#80#, 16#E0#, 16#38#, 16#07#, 16#01#,
16#C0#, 16#30#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#70#, 16#00#, 16#FC#, 16#00#, 16#FE#, 16#00#, 16#FE#, 16#00#,
16#FE#, 16#01#, 16#FE#, 16#01#, 16#FC#, 16#00#, 16#FE#, 16#00#, 16#0F#,
16#E0#, 16#00#, 16#FE#, 16#00#, 16#1F#, 16#C0#, 16#01#, 16#FC#, 16#00#,
16#1F#, 16#C0#, 16#01#, 16#F0#, 16#00#, 16#38#, 16#3F#, 16#FF#, 16#EF#,
16#FF#, 16#FD#, 16#FF#, 16#FF#, 16#9F#, 16#FF#, 16#E0#, 16#00#, 16#00#,
16#00#, 16#00#, 16#1F#, 16#FF#, 16#F7#, 16#FF#, 16#FE#, 16#FF#, 16#FF#,
16#DF#, 16#FF#, 16#F0#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#FC#,
16#00#, 16#0F#, 16#E0#, 16#00#, 16#7F#, 16#00#, 16#07#, 16#F0#, 16#00#,
16#3F#, 16#80#, 16#01#, 16#FC#, 16#00#, 16#1F#, 16#C0#, 16#0F#, 16#E0#,
16#07#, 16#F0#, 16#07#, 16#F8#, 16#03#, 16#F8#, 16#01#, 16#FC#, 16#00#,
16#3E#, 16#00#, 16#07#, 16#00#, 16#00#, 16#07#, 16#E0#, 16#FF#, 16#C7#,
16#FF#, 16#BF#, 16#FF#, 16#F0#, 16#7F#, 16#80#, 16#FE#, 16#03#, 16#C0#,
16#0F#, 16#00#, 16#78#, 16#0F#, 16#E1#, 16#FE#, 16#0F#, 16#F0#, 16#7E#,
16#01#, 16#E0#, 16#07#, 16#00#, 16#00#, 16#00#, 16#70#, 16#03#, 16#E0#,
16#0F#, 16#80#, 16#3E#, 16#00#, 16#70#, 16#00#, 16#00#, 16#3E#, 16#00#,
16#3F#, 16#E0#, 16#1F#, 16#F8#, 16#0F#, 16#0F#, 16#07#, 16#01#, 16#C3#,
16#80#, 16#71#, 16#E0#, 16#1C#, 16#70#, 16#0E#, 16#18#, 16#0F#, 16#8E#,
16#1F#, 16#E3#, 16#8F#, 16#F0#, 16#E7#, 16#9C#, 16#33#, 16#C7#, 16#1C#,
16#E1#, 16#C7#, 16#38#, 16#71#, 16#CF#, 16#18#, 16#73#, 16#FE#, 16#38#,
16#7F#, 16#CE#, 16#0F#, 16#F3#, 16#80#, 16#00#, 16#E0#, 16#00#, 16#38#,
16#00#, 16#0F#, 16#00#, 16#01#, 16#E0#, 16#C0#, 16#7F#, 16#F0#, 16#0F#,
16#F8#, 16#01#, 16#F8#, 16#00#, 16#01#, 16#FF#, 16#80#, 16#07#, 16#FE#,
16#00#, 16#1F#, 16#F8#, 16#00#, 16#7F#, 16#E0#, 16#00#, 16#1F#, 16#C0#,
16#00#, 16#FF#, 16#00#, 16#07#, 16#BC#, 16#00#, 16#1C#, 16#F0#, 16#00#,
16#F3#, 16#E0#, 16#07#, 16#87#, 16#80#, 16#1E#, 16#1E#, 16#00#, 16#F0#,
16#78#, 16#07#, 16#FF#, 16#E0#, 16#1F#, 16#FF#, 16#C0#, 16#FF#, 16#FF#,
16#03#, 16#FF#, 16#FC#, 16#1E#, 16#00#, 16#F1#, 16#FE#, 16#1F#, 16#FF#,
16#F8#, 16#7F#, 16#FF#, 16#E1#, 16#FF#, 16#FF#, 16#07#, 16#F8#, 16#0F#,
16#FF#, 16#C0#, 16#7F#, 16#FF#, 16#87#, 16#FF#, 16#FC#, 16#1F#, 16#FF#,
16#F0#, 16#38#, 16#0F#, 16#81#, 16#C0#, 16#3C#, 16#1E#, 16#01#, 16#E0#,
16#F0#, 16#3E#, 16#07#, 16#FF#, 16#E0#, 16#3F#, 16#FE#, 16#03#, 16#FF#,
16#F8#, 16#1F#, 16#FF#, 16#E0#, 16#E0#, 16#1F#, 16#87#, 16#00#, 16#3C#,
16#38#, 16#01#, 16#E3#, 16#C0#, 16#0F#, 16#1E#, 16#00#, 16#F3#, 16#FF#,
16#FF#, 16#BF#, 16#FF#, 16#F9#, 16#FF#, 16#FF#, 16#8F#, 16#FF#, 16#F0#,
16#00#, 16#00#, 16#7F#, 16#30#, 16#0F#, 16#FF#, 16#C1#, 16#FF#, 16#FE#,
16#1F#, 16#FF#, 16#F1#, 16#F8#, 16#3F#, 16#1F#, 16#00#, 16#78#, 16#F0#,
16#03#, 16#CF#, 16#80#, 16#1C#, 16#78#, 16#00#, 16#03#, 16#C0#, 16#00#,
16#3C#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#78#,
16#00#, 16#03#, 16#C0#, 16#00#, 16#1F#, 16#00#, 16#38#, 16#7E#, 16#07#,
16#C3#, 16#FF#, 16#FC#, 16#0F#, 16#FF#, 16#C0#, 16#3F#, 16#FC#, 16#00#,
16#7F#, 16#80#, 16#00#, 16#0F#, 16#FF#, 16#80#, 16#7F#, 16#FE#, 16#07#,
16#FF#, 16#F8#, 16#1F#, 16#FF#, 16#E0#, 16#78#, 16#1F#, 16#03#, 16#80#,
16#7C#, 16#1C#, 16#01#, 16#E1#, 16#E0#, 16#0F#, 16#0F#, 16#00#, 16#78#,
16#70#, 16#03#, 16#C3#, 16#80#, 16#1E#, 16#1C#, 16#00#, 16#F1#, 16#E0#,
16#0F#, 16#0F#, 16#00#, 16#78#, 16#70#, 16#07#, 16#C3#, 16#80#, 16#7C#,
16#3C#, 16#07#, 16#C3#, 16#FF#, 16#FC#, 16#3F#, 16#FF#, 16#C1#, 16#FF#,
16#FC#, 16#0F#, 16#FF#, 16#80#, 16#00#, 16#07#, 16#FF#, 16#FC#, 16#3F#,
16#FF#, 16#F0#, 16#FF#, 16#FF#, 16#C3#, 16#FF#, 16#FF#, 16#03#, 16#C0#,
16#3C#, 16#0F#, 16#00#, 16#E0#, 16#3C#, 16#73#, 16#80#, 16#E3#, 16#CC#,
16#03#, 16#FF#, 16#00#, 16#1F#, 16#FC#, 16#00#, 16#7F#, 16#E0#, 16#01#,
16#FF#, 16#80#, 16#07#, 16#1E#, 16#00#, 16#3C#, 16#70#, 16#00#, 16#F0#,
16#07#, 16#03#, 16#C0#, 16#1C#, 16#0E#, 16#00#, 16#F1#, 16#FF#, 16#FF#,
16#C7#, 16#FF#, 16#FE#, 16#3F#, 16#FF#, 16#F8#, 16#7F#, 16#FF#, 16#E0#,
16#07#, 16#FF#, 16#FE#, 16#1F#, 16#FF#, 16#FC#, 16#3F#, 16#FF#, 16#F0#,
16#7F#, 16#FF#, 16#E0#, 16#3C#, 16#01#, 16#C0#, 16#70#, 16#07#, 16#80#,
16#E1#, 16#8E#, 16#03#, 16#C7#, 16#1C#, 16#07#, 16#FE#, 16#00#, 16#0F#,
16#FC#, 16#00#, 16#1F#, 16#F8#, 16#00#, 16#3F#, 16#F0#, 16#00#, 16#F1#,
16#C0#, 16#01#, 16#E3#, 16#80#, 16#03#, 16#80#, 16#00#, 16#07#, 16#00#,
16#00#, 16#1E#, 16#00#, 16#00#, 16#FF#, 16#E0#, 16#03#, 16#FF#, 16#C0#,
16#07#, 16#FF#, 16#80#, 16#0F#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#3F#,
16#18#, 16#0F#, 16#FF#, 16#C0#, 16#FF#, 16#FE#, 16#0F#, 16#FF#, 16#F0#,
16#FC#, 16#0F#, 16#0F#, 16#80#, 16#38#, 16#F8#, 16#01#, 16#87#, 16#80#,
16#00#, 16#78#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#1E#, 16#00#, 16#00#,
16#E0#, 16#7F#, 16#EF#, 16#07#, 16#FF#, 16#78#, 16#3F#, 16#FB#, 16#C0#,
16#FF#, 16#9E#, 16#00#, 16#38#, 16#FC#, 16#03#, 16#C3#, 16#FF#, 16#FE#,
16#1F#, 16#FF#, 16#E0#, 16#3F#, 16#FC#, 16#00#, 16#7F#, 16#80#, 16#00#,
16#03#, 16#F8#, 16#FE#, 16#0F#, 16#F3#, 16#FC#, 16#1F#, 16#E7#, 16#F8#,
16#3F#, 16#8F#, 16#E0#, 16#3C#, 16#07#, 16#80#, 16#70#, 16#0E#, 16#00#,
16#E0#, 16#1C#, 16#03#, 16#C0#, 16#78#, 16#07#, 16#80#, 16#F0#, 16#0F#,
16#FF#, 16#C0#, 16#1F#, 16#FF#, 16#80#, 16#3F#, 16#FF#, 16#00#, 16#FF#,
16#FE#, 16#01#, 16#E0#, 16#3C#, 16#03#, 16#80#, 16#70#, 16#07#, 16#00#,
16#E0#, 16#1E#, 16#03#, 16#C0#, 16#FF#, 16#1F#, 16#E1#, 16#FE#, 16#7F#,
16#C7#, 16#FC#, 16#FF#, 16#87#, 16#F1#, 16#FE#, 16#00#, 16#07#, 16#FF#,
16#E1#, 16#FF#, 16#FC#, 16#3F#, 16#FF#, 16#87#, 16#FF#, 16#E0#, 16#07#,
16#80#, 16#00#, 16#E0#, 16#00#, 16#1C#, 16#00#, 16#03#, 16#80#, 16#00#,
16#F0#, 16#00#, 16#1E#, 16#00#, 16#03#, 16#80#, 16#00#, 16#70#, 16#00#,
16#1E#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#78#, 16#00#, 16#0E#, 16#00#,
16#01#, 16#C0#, 16#0F#, 16#FF#, 16#C3#, 16#FF#, 16#F8#, 16#7F#, 16#FF#,
16#07#, 16#FF#, 16#E0#, 16#00#, 16#3F#, 16#FE#, 16#00#, 16#FF#, 16#FC#,
16#01#, 16#FF#, 16#F8#, 16#03#, 16#FF#, 16#E0#, 16#00#, 16#1C#, 16#00#,
16#00#, 16#38#, 16#00#, 16#00#, 16#70#, 16#00#, 16#01#, 16#E0#, 16#00#,
16#03#, 16#C0#, 16#00#, 16#07#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#80#,
16#1C#, 16#03#, 16#80#, 16#78#, 16#0F#, 16#00#, 16#E0#, 16#1E#, 16#01#,
16#C0#, 16#38#, 16#07#, 16#80#, 16#70#, 16#1F#, 16#01#, 16#FF#, 16#FC#,
16#03#, 16#FF#, 16#F0#, 16#03#, 16#FF#, 16#C0#, 16#00#, 16#FC#, 16#00#,
16#00#, 16#07#, 16#F8#, 16#FC#, 16#1F#, 16#FB#, 16#FC#, 16#3F#, 16#E7#,
16#F0#, 16#7F#, 16#CF#, 16#E0#, 16#3C#, 16#1E#, 16#00#, 16#70#, 16#F8#,
16#00#, 16#E3#, 16#E0#, 16#03#, 16#CF#, 16#00#, 16#07#, 16#FC#, 16#00#,
16#0F#, 16#F0#, 16#00#, 16#1F#, 16#F0#, 16#00#, 16#3F#, 16#F0#, 16#00#,
16#F9#, 16#F0#, 16#01#, 16#E1#, 16#E0#, 16#03#, 16#83#, 16#E0#, 16#07#,
16#03#, 16#C0#, 16#1E#, 16#07#, 16#80#, 16#FF#, 16#8F#, 16#E3#, 16#FF#,
16#0F#, 16#C7#, 16#FE#, 16#1F#, 16#8F#, 16#F8#, 16#3E#, 16#00#, 16#0F#,
16#FE#, 16#00#, 16#FF#, 16#F0#, 16#1F#, 16#FE#, 16#00#, 16#FF#, 16#E0#,
16#01#, 16#E0#, 16#00#, 16#1E#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#1C#,
16#00#, 16#03#, 16#C0#, 16#00#, 16#3C#, 16#00#, 16#03#, 16#80#, 16#00#,
16#38#, 16#00#, 16#07#, 16#80#, 16#60#, 16#78#, 16#0F#, 16#07#, 16#80#,
16#F0#, 16#70#, 16#0E#, 16#07#, 16#00#, 16#E7#, 16#FF#, 16#FE#, 16#FF#,
16#FF#, 16#EF#, 16#FF#, 16#FE#, 16#FF#, 16#FF#, 16#C0#, 16#0F#, 16#C0#,
16#1F#, 16#87#, 16#E0#, 16#0F#, 16#C7#, 16#F8#, 16#0F#, 16#E1#, 16#FC#,
16#0F#, 16#E0#, 16#7E#, 16#07#, 16#E0#, 16#3F#, 16#07#, 16#F0#, 16#1F#,
16#C7#, 16#F8#, 16#1F#, 16#E3#, 16#F8#, 16#0E#, 16#F3#, 16#DC#, 16#07#,
16#7B#, 16#CE#, 16#03#, 16#BF#, 16#EF#, 16#03#, 16#CF#, 16#E7#, 16#01#,
16#E7#, 16#E3#, 16#80#, 16#E3#, 16#F1#, 16#C0#, 16#70#, 16#F1#, 16#E0#,
16#38#, 16#70#, 16#F0#, 16#3C#, 16#00#, 16#70#, 16#3F#, 16#C1#, 16#FE#,
16#3F#, 16#E1#, 16#FF#, 16#1F#, 16#F0#, 16#FF#, 16#8F#, 16#F0#, 16#7F#,
16#80#, 16#0F#, 16#C1#, 16#FE#, 16#1F#, 16#C1#, 16#FF#, 16#1F#, 16#C3#,
16#FE#, 16#1F#, 16#E1#, 16#FE#, 16#07#, 16#E0#, 16#38#, 16#07#, 16#F0#,
16#78#, 16#07#, 16#F0#, 16#78#, 16#0F#, 16#F8#, 16#70#, 16#0F#, 16#F8#,
16#70#, 16#0E#, 16#78#, 16#F0#, 16#0E#, 16#7C#, 16#F0#, 16#1E#, 16#3C#,
16#F0#, 16#1E#, 16#3E#, 16#E0#, 16#1E#, 16#1E#, 16#E0#, 16#1C#, 16#1F#,
16#E0#, 16#1C#, 16#0F#, 16#E0#, 16#3C#, 16#0F#, 16#E0#, 16#7F#, 16#87#,
16#C0#, 16#FF#, 16#87#, 16#C0#, 16#FF#, 16#87#, 16#C0#, 16#FF#, 16#03#,
16#C0#, 16#00#, 16#7E#, 16#00#, 16#1F#, 16#F8#, 16#07#, 16#FF#, 16#C0#,
16#FF#, 16#FE#, 16#1F#, 16#87#, 16#E3#, 16#E0#, 16#1F#, 16#3C#, 16#01#,
16#F7#, 16#C0#, 16#0F#, 16#78#, 16#00#, 16#FF#, 16#00#, 16#0F#, 16#F0#,
16#00#, 16#FF#, 16#00#, 16#0F#, 16#F0#, 16#01#, 16#EF#, 16#00#, 16#3E#,
16#F8#, 16#03#, 16#CF#, 16#80#, 16#7C#, 16#7C#, 16#1F#, 16#87#, 16#FF#,
16#F0#, 16#3F#, 16#FE#, 16#01#, 16#FF#, 16#80#, 16#07#, 16#E0#, 16#00#,
16#0F#, 16#FF#, 16#80#, 16#7F#, 16#FF#, 16#07#, 16#FF#, 16#FC#, 16#1F#,
16#FF#, 16#F0#, 16#38#, 16#0F#, 16#81#, 16#C0#, 16#3C#, 16#1E#, 16#01#,
16#E0#, 16#F0#, 16#0F#, 16#07#, 16#00#, 16#F0#, 16#38#, 16#0F#, 16#83#,
16#FF#, 16#F8#, 16#1F#, 16#FF#, 16#80#, 16#FF#, 16#F8#, 16#07#, 16#FF#,
16#00#, 16#38#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#1E#, 16#00#, 16#03#,
16#FF#, 16#80#, 16#3F#, 16#FC#, 16#01#, 16#FF#, 16#E0#, 16#0F#, 16#FE#,
16#00#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#1F#, 16#F8#, 16#07#, 16#FF#,
16#C0#, 16#FF#, 16#FE#, 16#1F#, 16#87#, 16#E3#, 16#E0#, 16#1F#, 16#3C#,
16#01#, 16#F7#, 16#C0#, 16#0F#, 16#78#, 16#00#, 16#FF#, 16#00#, 16#0F#,
16#F0#, 16#00#, 16#FF#, 16#00#, 16#0F#, 16#F0#, 16#01#, 16#EF#, 16#00#,
16#3E#, 16#F8#, 16#03#, 16#CF#, 16#80#, 16#7C#, 16#7C#, 16#1F#, 16#87#,
16#FF#, 16#F0#, 16#3F#, 16#FE#, 16#01#, 16#FF#, 16#80#, 16#07#, 16#E0#,
16#01#, 16#FE#, 16#30#, 16#3F#, 16#FF#, 16#87#, 16#FF#, 16#F0#, 16#7F#,
16#FF#, 16#07#, 16#83#, 16#C0#, 16#07#, 16#FF#, 16#80#, 16#3F#, 16#FF#,
16#80#, 16#FF#, 16#FF#, 16#03#, 16#FF#, 16#FE#, 16#03#, 16#C0#, 16#F8#,
16#0E#, 16#01#, 16#E0#, 16#38#, 16#07#, 16#81#, 16#E0#, 16#3E#, 16#07#,
16#83#, 16#F0#, 16#1F#, 16#FF#, 16#80#, 16#7F#, 16#FC#, 16#01#, 16#FF#,
16#C0#, 16#0F#, 16#FF#, 16#80#, 16#3C#, 16#3E#, 16#00#, 16#E0#, 16#7C#,
16#03#, 16#80#, 16#F0#, 16#1E#, 16#03#, 16#E1#, 16#FF#, 16#07#, 16#FF#,
16#FC#, 16#1F#, 16#FF#, 16#F0#, 16#3F#, 16#FF#, 16#80#, 16#F8#, 16#00#,
16#7C#, 16#E0#, 16#7F#, 16#FC#, 16#1F#, 16#FF#, 16#87#, 16#FF#, 16#E0#,
16#F8#, 16#7C#, 16#3C#, 16#07#, 16#87#, 16#80#, 16#E0#, 16#F0#, 16#00#,
16#1F#, 16#00#, 16#03#, 16#FE#, 16#00#, 16#3F#, 16#F8#, 16#03#, 16#FF#,
16#80#, 16#07#, 16#F8#, 16#40#, 16#1F#, 16#3C#, 16#01#, 16#E7#, 16#80#,
16#3C#, 16#FC#, 16#1F#, 16#1F#, 16#FF#, 16#E3#, 16#FF#, 16#F8#, 16#7F#,
16#FE#, 16#00#, 16#7E#, 16#00#, 16#7F#, 16#FF#, 16#EF#, 16#FF#, 16#FD#,
16#FF#, 16#FF#, 16#BF#, 16#FF#, 16#FF#, 16#0E#, 16#1D#, 16#E1#, 16#C3#,
16#BC#, 16#78#, 16#77#, 16#0F#, 16#1E#, 16#E1#, 16#C1#, 16#80#, 16#38#,
16#00#, 16#0F#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#3C#, 16#00#, 16#07#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#3C#, 16#00#, 16#07#, 16#80#, 16#0F#,
16#FE#, 16#03#, 16#FF#, 16#E0#, 16#7F#, 16#FC#, 16#0F#, 16#FF#, 16#00#,
16#7F#, 16#8F#, 16#F3#, 16#FE#, 16#7F#, 16#DF#, 16#F7#, 16#FC#, 16#FF#,
16#1F#, 16#E3#, 16#C0#, 16#1C#, 16#1C#, 16#01#, 16#E0#, 16#E0#, 16#0E#,
16#07#, 16#00#, 16#70#, 16#78#, 16#03#, 16#83#, 16#80#, 16#3C#, 16#1C#,
16#01#, 16#E0#, 16#E0#, 16#0E#, 16#0F#, 16#00#, 16#70#, 16#78#, 16#03#,
16#83#, 16#C0#, 16#3C#, 16#1F#, 16#01#, 16#C0#, 16#FC#, 16#3E#, 16#03#,
16#FF#, 16#E0#, 16#1F#, 16#FE#, 16#00#, 16#7F#, 16#E0#, 16#00#, 16#FC#,
16#00#, 16#00#, 16#7F#, 16#81#, 16#FE#, 16#FF#, 16#87#, 16#FF#, 16#FF#,
16#0F#, 16#FB#, 16#FC#, 16#1F#, 16#E3#, 16#C0#, 16#0F#, 16#03#, 16#C0#,
16#1C#, 16#07#, 16#80#, 16#78#, 16#0F#, 16#01#, 16#E0#, 16#1E#, 16#03#,
16#80#, 16#3E#, 16#0F#, 16#00#, 16#3C#, 16#3C#, 16#00#, 16#78#, 16#70#,
16#00#, 16#F1#, 16#E0#, 16#01#, 16#F7#, 16#80#, 16#01#, 16#EE#, 16#00#,
16#03#, 16#FC#, 16#00#, 16#07#, 16#F0#, 16#00#, 16#0F#, 16#C0#, 16#00#,
16#0F#, 16#80#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#,
16#7F#, 16#87#, 16#FF#, 16#FF#, 16#1F#, 16#FF#, 16#F8#, 16#7F#, 16#FF#,
16#E1#, 16#FE#, 16#78#, 16#00#, 16#F1#, 16#E3#, 16#C3#, 16#87#, 16#8F#,
16#0E#, 16#1E#, 16#7E#, 16#78#, 16#79#, 16#F9#, 16#C1#, 16#EF#, 16#E7#,
16#07#, 16#3F#, 16#BC#, 16#1D#, 16#FE#, 16#E0#, 16#77#, 16#7F#, 16#81#,
16#FD#, 16#FE#, 16#07#, 16#E7#, 16#F0#, 16#3F#, 16#8F#, 16#C0#, 16#FC#,
16#3F#, 16#03#, 16#F0#, 16#F8#, 16#0F#, 16#83#, 16#E0#, 16#3E#, 16#0F#,
16#80#, 16#F0#, 16#3C#, 16#00#, 16#07#, 16#E0#, 16#7E#, 16#0F#, 16#F0#,
16#FF#, 16#0F#, 16#F0#, 16#FE#, 16#0F#, 16#E0#, 16#FE#, 16#03#, 16#C0#,
16#F8#, 16#03#, 16#E1#, 16#E0#, 16#01#, 16#F3#, 16#C0#, 16#00#, 16#F7#,
16#80#, 16#00#, 16#7F#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#3C#,
16#00#, 16#00#, 16#FE#, 16#00#, 16#01#, 16#FF#, 16#00#, 16#03#, 16#EF#,
16#00#, 16#07#, 16#CF#, 16#80#, 16#0F#, 16#87#, 16#C0#, 16#1F#, 16#03#,
16#C0#, 16#7F#, 16#07#, 16#F0#, 16#FF#, 16#8F#, 16#F0#, 16#FF#, 16#0F#,
16#F0#, 16#FF#, 16#0F#, 16#E0#, 16#7E#, 16#0F#, 16#EF#, 16#F0#, 16#FF#,
16#FF#, 16#0F#, 16#EF#, 16#E0#, 16#FE#, 16#3C#, 16#0F#, 16#03#, 16#E1#,
16#E0#, 16#1E#, 16#3C#, 16#01#, 16#F7#, 16#C0#, 16#0F#, 16#F8#, 16#00#,
16#7F#, 16#00#, 16#07#, 16#E0#, 16#00#, 16#3C#, 16#00#, 16#03#, 16#80#,
16#00#, 16#38#, 16#00#, 16#07#, 16#80#, 16#00#, 16#78#, 16#00#, 16#07#,
16#00#, 16#07#, 16#FF#, 16#00#, 16#FF#, 16#F8#, 16#0F#, 16#FF#, 16#00#,
16#FF#, 16#F0#, 16#00#, 16#07#, 16#FF#, 16#E0#, 16#FF#, 16#FC#, 16#3F#,
16#FF#, 16#87#, 16#FF#, 16#F0#, 16#F0#, 16#7C#, 16#1C#, 16#1F#, 16#03#,
16#87#, 16#C0#, 16#61#, 16#F0#, 16#00#, 16#7C#, 16#00#, 16#1F#, 16#00#,
16#07#, 16#C0#, 16#01#, 16#F0#, 16#00#, 16#7C#, 16#00#, 16#1F#, 16#07#,
16#07#, 16#80#, 16#E1#, 16#E0#, 16#3C#, 16#78#, 16#07#, 16#8F#, 16#FF#,
16#F3#, 16#FF#, 16#FC#, 16#7F#, 16#FF#, 16#8F#, 16#FF#, 16#F0#, 16#03#,
16#F8#, 16#1F#, 16#C1#, 16#FE#, 16#0F#, 16#E0#, 16#70#, 16#03#, 16#80#,
16#3C#, 16#01#, 16#C0#, 16#0E#, 16#00#, 16#70#, 16#07#, 16#80#, 16#3C#,
16#01#, 16#C0#, 16#0E#, 16#00#, 16#70#, 16#07#, 16#80#, 16#38#, 16#01#,
16#C0#, 16#0E#, 16#00#, 16#F0#, 16#07#, 16#80#, 16#38#, 16#01#, 16#C0#,
16#1F#, 16#E0#, 16#FF#, 16#07#, 16#F8#, 16#3F#, 16#80#, 16#E0#, 16#38#,
16#0F#, 16#03#, 16#C0#, 16#F0#, 16#3C#, 16#07#, 16#81#, 16#E0#, 16#78#,
16#1F#, 16#03#, 16#C0#, 16#F0#, 16#3C#, 16#0F#, 16#81#, 16#E0#, 16#78#,
16#1E#, 16#03#, 16#C0#, 16#F0#, 16#3C#, 16#0F#, 16#81#, 16#E0#, 16#78#,
16#1E#, 16#03#, 16#C0#, 16#F0#, 16#3C#, 16#06#, 16#07#, 16#F8#, 16#3F#,
16#C1#, 16#FC#, 16#0F#, 16#E0#, 16#0F#, 16#00#, 16#78#, 16#03#, 16#80#,
16#1C#, 16#00#, 16#E0#, 16#0F#, 16#00#, 16#70#, 16#03#, 16#80#, 16#1C#,
16#01#, 16#E0#, 16#0F#, 16#00#, 16#70#, 16#03#, 16#80#, 16#1C#, 16#01#,
16#E0#, 16#0E#, 16#00#, 16#70#, 16#03#, 16#80#, 16#1C#, 16#0F#, 16#C0#,
16#FE#, 16#07#, 16#F0#, 16#3F#, 16#80#, 16#00#, 16#40#, 16#01#, 16#80#,
16#07#, 16#80#, 16#1F#, 16#80#, 16#FF#, 16#03#, 16#FF#, 16#0F#, 16#9F#,
16#3E#, 16#1E#, 16#F8#, 16#3F#, 16#C0#, 16#3F#, 16#00#, 16#30#, 16#FF#,
16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#,
16#F0#, 16#C3#, 16#C7#, 16#0E#, 16#3C#, 16#30#, 16#00#, 16#FE#, 16#00#,
16#7F#, 16#F0#, 16#1F#, 16#FF#, 16#03#, 16#FF#, 16#E0#, 16#00#, 16#3C#,
16#07#, 16#FF#, 16#83#, 16#FF#, 16#F0#, 16#FF#, 16#FC#, 16#3F#, 16#FF#,
16#8F#, 16#80#, 16#F3#, 16#E0#, 16#1E#, 16#78#, 16#1F#, 16#8F#, 16#FF#,
16#FF#, 16#FF#, 16#FF#, 16#DF#, 16#FF#, 16#F8#, 16#FE#, 16#7E#, 16#07#,
16#E0#, 16#00#, 16#3F#, 16#80#, 16#00#, 16#FC#, 16#00#, 16#03#, 16#F0#,
16#00#, 16#01#, 16#C0#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#38#, 16#FC#,
16#00#, 16#EF#, 16#FC#, 16#03#, 16#FF#, 16#F8#, 16#1F#, 16#FF#, 16#E0#,
16#7E#, 16#0F#, 16#C1#, 16#E0#, 16#1F#, 16#07#, 16#00#, 16#3C#, 16#1C#,
16#00#, 16#F0#, 16#E0#, 16#03#, 16#C3#, 16#80#, 16#1E#, 16#0F#, 16#00#,
16#F8#, 16#3E#, 16#07#, 16#C7#, 16#FF#, 16#FF#, 16#3F#, 16#FF#, 16#F8#,
16#FF#, 16#FF#, 16#81#, 16#F1#, 16#F8#, 16#00#, 16#00#, 16#FE#, 16#60#,
16#FF#, 16#FC#, 16#3F#, 16#FF#, 16#8F#, 16#FF#, 16#F3#, 16#F0#, 16#3C#,
16#F8#, 16#03#, 16#9E#, 16#00#, 16#67#, 16#80#, 16#00#, 16#F0#, 16#00#,
16#1E#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#7E#, 16#01#, 16#C7#, 16#FF#,
16#F8#, 16#FF#, 16#FE#, 16#0F#, 16#FF#, 16#80#, 16#7F#, 16#80#, 16#00#,
16#01#, 16#F8#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#FC#, 16#00#, 16#07#,
16#E0#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#70#, 16#07#, 16#E3#, 16#80#,
16#FF#, 16#DC#, 16#0F#, 16#FF#, 16#E0#, 16#FF#, 16#FE#, 16#0F#, 16#C1#,
16#F0#, 16#F8#, 16#07#, 16#87#, 16#80#, 16#1C#, 16#78#, 16#00#, 16#E3#,
16#C0#, 16#0E#, 16#1E#, 16#00#, 16#70#, 16#F0#, 16#07#, 16#87#, 16#E0#,
16#FC#, 16#1F#, 16#FF#, 16#F8#, 16#FF#, 16#FF#, 16#C3#, 16#FF#, 16#FE#,
16#07#, 16#E3#, 16#E0#, 16#00#, 16#FC#, 16#01#, 16#FF#, 16#C0#, 16#FF#,
16#F8#, 16#7F#, 16#FE#, 16#3E#, 16#0F#, 16#CE#, 16#00#, 16#F7#, 16#00#,
16#3D#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#,
16#FF#, 16#E0#, 16#1E#, 16#FF#, 16#FF#, 16#9F#, 16#FF#, 16#E3#, 16#FF#,
16#F0#, 16#3F#, 16#F0#, 16#00#, 16#0F#, 16#F0#, 16#01#, 16#FF#, 16#C0#,
16#1F#, 16#FE#, 16#01#, 16#FF#, 16#E0#, 16#0F#, 16#00#, 16#00#, 16#F0#,
16#00#, 16#3F#, 16#FF#, 16#03#, 16#FF#, 16#F8#, 16#1F#, 16#FF#, 16#C0#,
16#FF#, 16#FC#, 16#00#, 16#F0#, 16#00#, 16#07#, 16#80#, 16#00#, 16#38#,
16#00#, 16#01#, 16#C0#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#F0#, 16#00#,
16#07#, 16#00#, 16#00#, 16#38#, 16#00#, 16#1F#, 16#FF#, 16#81#, 16#FF#,
16#FC#, 16#0F#, 16#FF#, 16#E0#, 16#7F#, 16#FE#, 16#00#, 16#01#, 16#F9#,
16#F8#, 16#3F#, 16#FF#, 16#C3#, 16#FF#, 16#FE#, 16#7F#, 16#FF#, 16#E3#,
16#E0#, 16#FC#, 16#3E#, 16#03#, 16#E1#, 16#E0#, 16#0E#, 16#1E#, 16#00#,
16#70#, 16#F0#, 16#03#, 16#87#, 16#80#, 16#3C#, 16#3E#, 16#03#, 16#E1#,
16#F8#, 16#7E#, 16#07#, 16#FF#, 16#F0#, 16#3F#, 16#FF#, 16#80#, 16#FF#,
16#FC#, 16#01#, 16#F9#, 16#E0#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#F0#,
16#00#, 16#0F#, 16#80#, 16#7F#, 16#F8#, 16#07#, 16#FF#, 16#80#, 16#3F#,
16#F8#, 16#00#, 16#FF#, 16#00#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#FC#,
16#00#, 16#0F#, 16#C0#, 16#00#, 16#FC#, 16#00#, 16#03#, 16#80#, 16#00#,
16#38#, 16#00#, 16#03#, 16#9F#, 16#00#, 16#7F#, 16#FC#, 16#07#, 16#FF#,
16#C0#, 16#7F#, 16#FE#, 16#07#, 16#C3#, 16#E0#, 16#70#, 16#1E#, 16#0F#,
16#01#, 16#C0#, 16#F0#, 16#1C#, 16#0E#, 16#03#, 16#C0#, 16#E0#, 16#3C#,
16#1E#, 16#03#, 16#81#, 16#E0#, 16#38#, 16#7F#, 16#0F#, 16#FF#, 16#F8#,
16#FF#, 16#FF#, 16#8F#, 16#F7#, 16#F0#, 16#FE#, 16#00#, 16#78#, 16#00#,
16#78#, 16#00#, 16#78#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#,
16#0F#, 16#F0#, 16#0F#, 16#F0#, 16#1F#, 16#F0#, 16#0F#, 16#F0#, 16#00#,
16#F0#, 16#00#, 16#E0#, 16#00#, 16#E0#, 16#01#, 16#E0#, 16#01#, 16#E0#,
16#01#, 16#E0#, 16#01#, 16#C0#, 16#01#, 16#C0#, 16#FF#, 16#FF#, 16#FF#,
16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FE#, 16#00#, 16#07#, 16#80#, 16#01#,
16#E0#, 16#00#, 16#F0#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#7F#, 16#FC#, 16#3F#, 16#FE#, 16#0F#, 16#FF#, 16#81#, 16#FF#,
16#E0#, 16#00#, 16#78#, 16#00#, 16#1C#, 16#00#, 16#07#, 16#00#, 16#01#,
16#C0#, 16#00#, 16#70#, 16#00#, 16#3C#, 16#00#, 16#0E#, 16#00#, 16#03#,
16#80#, 16#00#, 16#E0#, 16#00#, 16#78#, 16#00#, 16#1C#, 16#00#, 16#07#,
16#00#, 16#01#, 16#C0#, 16#00#, 16#F0#, 16#00#, 16#7C#, 16#1F#, 16#FE#,
16#0F#, 16#FF#, 16#03#, 16#FF#, 16#80#, 16#7F#, 16#80#, 16#00#, 16#07#,
16#E0#, 16#00#, 16#FE#, 16#00#, 16#0F#, 16#E0#, 16#00#, 16#7C#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#3C#, 16#00#, 16#03#, 16#CF#, 16#F0#, 16#38#,
16#FF#, 16#03#, 16#9F#, 16#F0#, 16#38#, 16#FE#, 16#07#, 16#BF#, 16#00#,
16#77#, 16#C0#, 16#07#, 16#F8#, 16#00#, 16#7F#, 16#00#, 16#07#, 16#F8#,
16#00#, 16#FF#, 16#C0#, 16#0F#, 16#7E#, 16#00#, 16#E3#, 16#F0#, 16#7E#,
16#1F#, 16#E7#, 16#E1#, 16#FE#, 16#FE#, 16#3F#, 16#E7#, 16#C1#, 16#FC#,
16#03#, 16#FC#, 16#07#, 16#FC#, 16#07#, 16#F8#, 16#07#, 16#F8#, 16#00#,
16#78#, 16#00#, 16#78#, 16#00#, 16#70#, 16#00#, 16#70#, 16#00#, 16#70#,
16#00#, 16#F0#, 16#00#, 16#E0#, 16#00#, 16#E0#, 16#00#, 16#E0#, 16#01#,
16#E0#, 16#01#, 16#E0#, 16#01#, 16#C0#, 16#01#, 16#C0#, 16#01#, 16#C0#,
16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FE#, 16#1F#,
16#7C#, 16#78#, 16#7F#, 16#FF#, 16#F8#, 16#FF#, 16#FF#, 16#F9#, 16#FF#,
16#FF#, 16#F0#, 16#F1#, 16#F1#, 16#E1#, 16#C3#, 16#83#, 16#C7#, 16#87#,
16#07#, 16#8F#, 16#0E#, 16#0E#, 16#1C#, 16#1C#, 16#1C#, 16#38#, 16#78#,
16#78#, 16#70#, 16#E0#, 16#F1#, 16#E1#, 16#C1#, 16#C7#, 16#E3#, 16#C3#,
16#FF#, 16#CF#, 16#C7#, 16#FF#, 16#9F#, 16#9F#, 16#FF#, 16#3E#, 16#3E#,
16#0F#, 16#8F#, 16#80#, 16#FD#, 16#FF#, 16#07#, 16#FF#, 16#F8#, 16#3F#,
16#FF#, 16#E0#, 16#7E#, 16#1F#, 16#07#, 16#C0#, 16#78#, 16#3C#, 16#03#,
16#81#, 16#E0#, 16#1C#, 16#0E#, 16#01#, 16#E0#, 16#70#, 16#0F#, 16#07#,
16#80#, 16#70#, 16#3C#, 16#03#, 16#87#, 16#F0#, 16#3F#, 16#7F#, 16#C3#,
16#FF#, 16#FE#, 16#1F#, 16#EF#, 16#E0#, 16#FE#, 16#01#, 16#FC#, 16#01#,
16#FF#, 16#80#, 16#FF#, 16#F8#, 16#7F#, 16#FE#, 16#3E#, 16#0F#, 16#DF#,
16#01#, 16#F7#, 16#80#, 16#3F#, 16#C0#, 16#0F#, 16#F0#, 16#03#, 16#FC#,
16#01#, 16#EF#, 16#80#, 16#FB#, 16#F0#, 16#7C#, 16#7F#, 16#FF#, 16#1F#,
16#FF#, 16#03#, 16#FF#, 16#80#, 16#3F#, 16#80#, 16#07#, 16#C7#, 16#E0#,
16#1F#, 16#BF#, 16#F0#, 16#3F#, 16#FF#, 16#F0#, 16#7F#, 16#FF#, 16#E0#,
16#3F#, 16#07#, 16#E0#, 16#78#, 16#03#, 16#C0#, 16#E0#, 16#07#, 16#81#,
16#C0#, 16#0F#, 16#07#, 16#00#, 16#1E#, 16#0F#, 16#00#, 16#78#, 16#1E#,
16#01#, 16#F0#, 16#3E#, 16#07#, 16#C0#, 16#7F#, 16#FF#, 16#81#, 16#FF#,
16#FE#, 16#03#, 16#DF#, 16#F0#, 16#07#, 16#1F#, 16#80#, 16#0E#, 16#00#,
16#00#, 16#3C#, 16#00#, 16#00#, 16#78#, 16#00#, 16#03#, 16#FE#, 16#00#,
16#0F#, 16#FE#, 16#00#, 16#1F#, 16#F8#, 16#00#, 16#3F#, 16#F0#, 16#00#,
16#00#, 16#01#, 16#F8#, 16#F8#, 16#1F#, 16#FF#, 16#F1#, 16#FF#, 16#FF#,
16#CF#, 16#FF#, 16#FE#, 16#3E#, 16#07#, 16#C1#, 16#F0#, 16#0F#, 16#07#,
16#80#, 16#1C#, 16#3C#, 16#00#, 16#70#, 16#F0#, 16#03#, 16#83#, 16#C0#,
16#0E#, 16#0F#, 16#80#, 16#78#, 16#3F#, 16#07#, 16#E0#, 16#7F#, 16#FF#,
16#01#, 16#FF#, 16#FC#, 16#03#, 16#FF#, 16#70#, 16#03#, 16#F1#, 16#C0#,
16#00#, 16#0F#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#E0#, 16#00#,
16#3F#, 16#E0#, 16#01#, 16#FF#, 16#C0#, 16#07#, 16#FF#, 16#00#, 16#1F#,
16#F8#, 16#00#, 16#0F#, 16#C3#, 16#C1#, 16#FC#, 16#FF#, 16#1F#, 16#FF#,
16#F1#, 16#FF#, 16#FE#, 16#03#, 16#FC#, 16#00#, 16#3F#, 16#00#, 16#03#,
16#C0#, 16#00#, 16#78#, 16#00#, 16#07#, 16#80#, 16#00#, 16#70#, 16#00#,
16#07#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#FF#, 16#FC#, 16#0F#, 16#FF#,
16#E0#, 16#FF#, 16#FC#, 16#0F#, 16#FF#, 16#C0#, 16#03#, 16#F3#, 16#0F#,
16#FF#, 16#3F#, 16#FF#, 16#3F#, 16#FF#, 16#7C#, 16#0E#, 16#78#, 16#00#,
16#7F#, 16#E0#, 16#3F#, 16#FC#, 16#1F#, 16#FF#, 16#00#, 16#3F#, 16#70#,
16#0F#, 16#F8#, 16#1F#, 16#FF#, 16#FE#, 16#FF#, 16#FC#, 16#FF#, 16#F8#,
16#0F#, 16#E0#, 16#06#, 16#00#, 16#0F#, 16#00#, 16#0F#, 16#00#, 16#0E#,
16#00#, 16#0E#, 16#00#, 16#7F#, 16#FE#, 16#FF#, 16#FE#, 16#FF#, 16#FE#,
16#FF#, 16#FC#, 16#1C#, 16#00#, 16#1C#, 16#00#, 16#3C#, 16#00#, 16#38#,
16#00#, 16#38#, 16#00#, 16#38#, 16#00#, 16#78#, 16#00#, 16#7C#, 16#0E#,
16#7F#, 16#FF#, 16#7F#, 16#FE#, 16#3F#, 16#FC#, 16#0F#, 16#E0#, 16#7C#,
16#0F#, 16#FF#, 16#07#, 16#FF#, 16#81#, 16#FF#, 16#E0#, 16#7E#, 16#78#,
16#03#, 16#9E#, 16#00#, 16#E7#, 16#80#, 16#79#, 16#E0#, 16#1C#, 16#78#,
16#07#, 16#1E#, 16#01#, 16#C7#, 16#80#, 16#F1#, 16#E0#, 16#FC#, 16#7F#,
16#FF#, 16#9F#, 16#FF#, 16#E3#, 16#FF#, 16#F8#, 16#3E#, 16#7C#, 16#7F#,
16#87#, 16#FF#, 16#FC#, 16#7F#, 16#FF#, 16#E3#, 16#FF#, 16#FF#, 16#1F#,
16#E1#, 16#E0#, 16#3C#, 16#0F#, 16#03#, 16#C0#, 16#78#, 16#3C#, 16#01#,
16#E1#, 16#C0#, 16#0F#, 16#1E#, 16#00#, 16#79#, 16#E0#, 16#03#, 16#CE#,
16#00#, 16#0F#, 16#F0#, 16#00#, 16#7F#, 16#00#, 16#03#, 16#F0#, 16#00#,
16#0F#, 16#00#, 16#00#, 16#78#, 16#00#, 16#7E#, 16#03#, 16#F7#, 16#F0#,
16#3F#, 16#FF#, 16#81#, 16#FD#, 16#F8#, 16#0F#, 16#E7#, 16#8E#, 16#1C#,
16#3C#, 16#F9#, 16#E1#, 16#E7#, 16#CE#, 16#0F#, 16#7E#, 16#F0#, 16#7B#,
16#F7#, 16#03#, 16#FF#, 16#F8#, 16#1F#, 16#DF#, 16#80#, 16#FC#, 16#FC#,
16#07#, 16#E7#, 16#C0#, 16#3E#, 16#3E#, 16#01#, 16#F1#, 16#E0#, 16#0F#,
16#07#, 16#00#, 16#0F#, 16#E3#, 16#F8#, 16#FF#, 16#1F#, 16#C7#, 16#F9#,
16#FE#, 16#1F#, 16#87#, 16#F0#, 16#7E#, 16#7C#, 16#01#, 16#FF#, 16#C0#,
16#07#, 16#FC#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#FC#, 16#00#, 16#1F#,
16#F0#, 16#01#, 16#F7#, 16#C0#, 16#1F#, 16#1F#, 16#03#, 16#F0#, 16#7C#,
16#7F#, 16#CF#, 16#FB#, 16#FE#, 16#7F#, 16#DF#, 16#E3#, 16#FC#, 16#07#,
16#F0#, 16#7F#, 16#0F#, 16#F0#, 16#FF#, 16#0F#, 16#F0#, 16#FF#, 16#07#,
16#E0#, 16#FE#, 16#03#, 16#C0#, 16#38#, 16#03#, 16#C0#, 16#78#, 16#03#,
16#C0#, 16#F0#, 16#01#, 16#E1#, 16#E0#, 16#01#, 16#E1#, 16#C0#, 16#01#,
16#E3#, 16#C0#, 16#00#, 16#F7#, 16#80#, 16#00#, 16#FF#, 16#00#, 16#00#,
16#FE#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#00#,
16#78#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#01#,
16#E0#, 16#00#, 16#7F#, 16#F0#, 16#00#, 16#FF#, 16#F8#, 16#00#, 16#FF#,
16#F0#, 16#00#, 16#7F#, 16#F0#, 16#00#, 16#1F#, 16#FF#, 16#C7#, 16#FF#,
16#F1#, 16#FF#, 16#F8#, 16#FF#, 16#FE#, 16#3C#, 16#1F#, 16#0E#, 16#1F#,
16#00#, 16#0F#, 16#80#, 16#07#, 16#C0#, 16#03#, 16#C0#, 16#03#, 16#E0#,
16#01#, 16#F0#, 16#00#, 16#F0#, 16#3C#, 16#FF#, 16#FF#, 16#3F#, 16#FF#,
16#CF#, 16#FF#, 16#E3#, 16#FF#, 16#F8#, 16#00#, 16#F0#, 16#1F#, 16#03#,
16#F0#, 16#7E#, 16#07#, 16#80#, 16#70#, 16#0F#, 16#00#, 16#F0#, 16#0E#,
16#00#, 16#E0#, 16#1E#, 16#01#, 16#C0#, 16#FC#, 16#0F#, 16#80#, 16#F8#,
16#0F#, 16#C0#, 16#3C#, 16#03#, 16#C0#, 16#38#, 16#03#, 16#80#, 16#78#,
16#07#, 16#80#, 16#78#, 16#07#, 16#E0#, 16#7E#, 16#03#, 16#E0#, 16#1C#,
16#00#, 16#02#, 16#07#, 16#07#, 16#07#, 16#06#, 16#0E#, 16#0E#, 16#0E#,
16#0E#, 16#1C#, 16#1C#, 16#1C#, 16#1C#, 16#1C#, 16#38#, 16#38#, 16#38#,
16#38#, 16#30#, 16#70#, 16#70#, 16#70#, 16#70#, 16#E0#, 16#E0#, 16#E0#,
16#E0#, 16#01#, 16#C0#, 16#1F#, 16#00#, 16#FC#, 16#07#, 16#E0#, 16#0F#,
16#00#, 16#78#, 16#03#, 16#C0#, 16#1C#, 16#00#, 16#E0#, 16#0F#, 16#00#,
16#78#, 16#03#, 16#C0#, 16#1F#, 16#80#, 16#7C#, 16#03#, 16#E0#, 16#3F#,
16#03#, 16#C0#, 16#1C#, 16#00#, 16#E0#, 16#0F#, 16#00#, 16#78#, 16#03#,
16#80#, 16#3C#, 16#0F#, 16#E0#, 16#7E#, 16#07#, 16#E0#, 16#1E#, 16#00#,
16#0F#, 16#00#, 16#1F#, 16#C0#, 16#1F#, 16#F0#, 16#FF#, 16#FC#, 16#FF#,
16#3F#, 16#FF#, 16#0F#, 16#F8#, 16#03#, 16#F8#, 16#00#, 16#F0#);
FreeMonoBoldOblique18pt7bGlyphs : aliased constant Glyph_Array := (
(0, 0, 0, 21, 0, 1), -- 0x20 ' '
(0, 9, 22, 21, 9, -21), -- 0x21 '!'
(25, 12, 10, 21, 9, -20), -- 0x22 '"'
(40, 18, 25, 21, 4, -22), -- 0x23 '#'
(97, 18, 28, 21, 4, -23), -- 0x24 '$'
(160, 16, 21, 21, 5, -20), -- 0x25 '%'
(202, 16, 20, 21, 4, -19), -- 0x26 '&'
(242, 5, 10, 21, 12, -20), -- 0x27 '''
(249, 10, 27, 21, 11, -21), -- 0x28 '('
(283, 10, 27, 21, 4, -21), -- 0x29 ')'
(317, 15, 15, 21, 6, -21), -- 0x2A '*'
(346, 18, 19, 21, 4, -18), -- 0x2B '+'
(389, 9, 10, 21, 4, -3), -- 0x2C ','
(401, 18, 4, 21, 4, -11), -- 0x2D '-'
(410, 5, 5, 21, 8, -4), -- 0x2E '.'
(414, 21, 28, 21, 2, -23), -- 0x2F '/'
(488, 17, 23, 21, 5, -22), -- 0x30 '0'
(537, 15, 22, 21, 3, -21), -- 0x31 '1'
(579, 20, 23, 21, 2, -22), -- 0x32 '2'
(637, 18, 23, 21, 3, -22), -- 0x33 '3'
(689, 16, 21, 21, 4, -20), -- 0x34 '4'
(731, 18, 22, 21, 4, -21), -- 0x35 '5'
(781, 19, 23, 21, 5, -22), -- 0x36 '6'
(836, 16, 22, 21, 6, -21), -- 0x37 '7'
(880, 19, 23, 21, 3, -22), -- 0x38 '8'
(935, 18, 23, 21, 4, -22), -- 0x39 '9'
(987, 7, 16, 21, 9, -15), -- 0x3A ':'
(1001, 11, 22, 21, 4, -15), -- 0x3B ';'
(1032, 18, 16, 21, 4, -17), -- 0x3C '<'
(1068, 19, 10, 21, 3, -14), -- 0x3D '='
(1092, 19, 16, 21, 3, -17), -- 0x3E '>'
(1130, 14, 21, 21, 8, -20), -- 0x3F '?'
(1167, 18, 27, 21, 3, -21), -- 0x40 '@'
(1228, 22, 21, 21, 0, -20), -- 0x41 'A'
(1286, 21, 21, 21, 1, -20), -- 0x42 'B'
(1342, 21, 21, 21, 2, -20), -- 0x43 'C'
(1398, 21, 21, 21, 1, -20), -- 0x44 'D'
(1454, 22, 21, 21, 0, -20), -- 0x45 'E'
(1512, 23, 21, 21, 0, -20), -- 0x46 'F'
(1573, 21, 21, 21, 2, -20), -- 0x47 'G'
(1629, 23, 21, 21, 0, -20), -- 0x48 'H'
(1690, 19, 21, 21, 2, -20), -- 0x49 'I'
(1740, 23, 21, 21, 0, -20), -- 0x4A 'J'
(1801, 23, 21, 21, 0, -20), -- 0x4B 'K'
(1862, 20, 21, 21, 1, -20), -- 0x4C 'L'
(1915, 25, 21, 21, 0, -20), -- 0x4D 'M'
(1981, 24, 21, 21, 1, -20), -- 0x4E 'N'
(2044, 20, 21, 21, 2, -20), -- 0x4F 'O'
(2097, 21, 21, 21, 1, -20), -- 0x50 'P'
(2153, 20, 26, 21, 2, -20), -- 0x51 'Q'
(2218, 22, 21, 21, 0, -20), -- 0x52 'R'
(2276, 19, 21, 21, 3, -20), -- 0x53 'S'
(2326, 19, 21, 21, 3, -20), -- 0x54 'T'
(2376, 21, 21, 21, 3, -20), -- 0x55 'U'
(2432, 23, 21, 21, 1, -20), -- 0x56 'V'
(2493, 22, 21, 21, 2, -20), -- 0x57 'W'
(2551, 24, 21, 21, 0, -20), -- 0x58 'X'
(2614, 20, 21, 21, 3, -20), -- 0x59 'Y'
(2667, 19, 21, 21, 2, -20), -- 0x5A 'Z'
(2717, 13, 27, 21, 8, -21), -- 0x5B '['
(2761, 10, 28, 21, 8, -23), -- 0x5C '\'
(2796, 13, 27, 21, 4, -21), -- 0x5D ']'
(2840, 15, 11, 21, 6, -21), -- 0x5E '^'
(2861, 21, 4, 21, -1, 4), -- 0x5F '_'
(2872, 6, 6, 21, 10, -22), -- 0x60 '`'
(2877, 19, 16, 21, 2, -15), -- 0x61 'a'
(2915, 22, 22, 21, 0, -21), -- 0x62 'b'
(2976, 19, 16, 21, 3, -15), -- 0x63 'c'
(3014, 21, 22, 21, 3, -21), -- 0x64 'd'
(3072, 18, 16, 21, 3, -15), -- 0x65 'e'
(3108, 21, 22, 21, 3, -21), -- 0x66 'f'
(3166, 21, 23, 21, 2, -15), -- 0x67 'g'
(3227, 20, 22, 21, 1, -21), -- 0x68 'h'
(3282, 16, 22, 21, 3, -21), -- 0x69 'i'
(3326, 18, 29, 21, 2, -21), -- 0x6A 'j'
(3392, 20, 22, 21, 1, -21), -- 0x6B 'k'
(3447, 16, 22, 21, 3, -21), -- 0x6C 'l'
(3491, 23, 16, 21, 0, -15), -- 0x6D 'm'
(3537, 21, 16, 21, 1, -15), -- 0x6E 'n'
(3579, 18, 16, 21, 3, -15), -- 0x6F 'o'
(3615, 23, 23, 21, -1, -15), -- 0x70 'p'
(3682, 22, 23, 21, 2, -15), -- 0x71 'q'
(3746, 20, 16, 21, 2, -15), -- 0x72 'r'
(3786, 16, 16, 21, 4, -15), -- 0x73 's'
(3818, 16, 21, 21, 4, -20), -- 0x74 't'
(3860, 18, 16, 21, 3, -15), -- 0x75 'u'
(3896, 21, 16, 21, 2, -15), -- 0x76 'v'
(3938, 21, 16, 21, 3, -15), -- 0x77 'w'
(3980, 21, 16, 21, 1, -15), -- 0x78 'x'
(4022, 24, 23, 21, -1, -15), -- 0x79 'y'
(4091, 18, 16, 21, 3, -15), -- 0x7A 'z'
(4127, 12, 27, 21, 8, -21), -- 0x7B '{'
(4168, 8, 27, 21, 8, -21), -- 0x7C '|'
(4195, 13, 27, 21, 4, -21), -- 0x7D '}'
(4239, 17, 8, 21, 4, -13)); -- 0x7E '~'
Font_D : aliased constant Bitmap_Font :=
(FreeMonoBoldOblique18pt7bBitmaps'Access,
FreeMonoBoldOblique18pt7bGlyphs'Access,
35);
Font : constant Giza.Font.Ref_Const := Font_D'Access;
end Giza.Bitmap_Fonts.FreeMonoBoldOblique18pt7b;
|
with Ada.Containers.Vectors;
with Rewriters; use Rewriters;
package Rewriters_Sequence is new Ada.Containers.Vectors
(Positive, Any_Constant_Rewriter);
|
-----------------------------------------------------------------------
-- awa-mail-module-tests -- Unit tests for Mail module
-- Copyright (C) 2012, 2017 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Test_Caller;
with AWA.Events;
package body AWA.Mail.Modules.Tests is
package Caller is new Util.Test_Caller (Test, "Mail.Modules");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test AWA.Mail.Module.Create_Message",
Test_Create_Message'Access);
Caller.Add_Test (Suite, "Test AWA.Mail.Module.Create_Message (CC:)",
Test_Cc_Message'Access);
Caller.Add_Test (Suite, "Test AWA.Mail.Module.Create_Message (BCC:)",
Test_Bcc_Message'Access);
end Add_Tests;
-- ------------------------------
-- Create an email message with the given template and verify its content.
-- ------------------------------
procedure Test_Mail_Message (T : in out Test;
Name : in String) is
use Util.Beans.Objects;
Mail : constant AWA.Mail.Modules.Mail_Module_Access := AWA.Mail.Modules.Get_Mail_Module;
Event : AWA.Events.Module_Event;
Props : Util.Beans.Objects.Maps.Map;
begin
T.Assert (Mail /= null, "There is no current mail module");
Props.Insert ("name", To_Object (String '("joe")));
Props.Insert ("email", To_Object (String '("joe.rogers@somewhere.org")));
Mail.Send_Mail (Template => Name,
Props => Props,
Content => Event);
end Test_Mail_Message;
-- ------------------------------
-- Create an email message and verify its content.
-- ------------------------------
procedure Test_Create_Message (T : in out Test) is
begin
T.Test_Mail_Message ("mail-info.html");
end Test_Create_Message;
-- ------------------------------
-- Create an email message with Cc: and verify its content.
-- ------------------------------
procedure Test_Cc_Message (T : in out Test) is
begin
T.Test_Mail_Message ("mail-cc.html");
end Test_Cc_Message;
-- ------------------------------
-- Create an email message with Bcc: and verify its content.
-- ------------------------------
procedure Test_Bcc_Message (T : in out Test) is
begin
T.Test_Mail_Message ("mail-bcc.html");
end Test_Bcc_Message;
end AWA.Mail.Modules.Tests;
|
with agar.gui.widget.box;
package agar.gui.widget.hbox is
use type agar.gui.widget.box.flags_t;
use type c.unsigned;
type hbox_t is record
box : aliased agar.gui.widget.box.box_t;
end record;
type hbox_access_t is access all hbox_t;
pragma convention (c, hbox_t);
pragma convention (c, hbox_access_t);
type flags_t is new c.unsigned;
HBOX_HOMOGENOUS : constant flags_t := flags_t (agar.gui.widget.box.BOX_HOMOGENOUS);
HBOX_HFILL : constant flags_t := flags_t (agar.gui.widget.box.BOX_HFILL);
HBOX_VFILL : constant flags_t := flags_t (agar.gui.widget.box.BOX_VFILL);
HBOX_EXPAND : constant flags_t := flags_t (agar.gui.widget.box.BOX_HFILL or agar.gui.widget.box.BOX_VFILL);
-- API
function allocate
(parent : widget_access_t;
flags : flags_t) return hbox_access_t;
pragma import (c, allocate, "agar_gui_widget_hbox_new");
procedure set_homogenous
(box : hbox_access_t;
homogenous : boolean := true);
pragma inline (set_homogenous);
procedure set_padding
(box : hbox_access_t;
padding : natural);
pragma inline (set_padding);
procedure set_spacing
(box : hbox_access_t;
spacing : natural);
pragma inline (set_spacing);
function widget (box : hbox_access_t) return widget_access_t;
pragma inline (widget);
end agar.gui.widget.hbox;
|
package body Opt25_Pkg2 is
function Default_Stack return Stack is
begin
return Default_Stack_Var;
end Default_Stack;
end Opt25_Pkg2;
|
with Ada.Text_IO;
with Ada.Strings.UTF_Encoding.Wide_Strings;
procedure Remove_Characters
is
use Ada.Text_IO;
use Ada.Strings.UTF_Encoding;
use Ada.Strings.UTF_Encoding.Wide_Strings;
S : String := "upraisers";
U : Wide_String := Decode (UTF_8_String'(S));
function To_String (X : Wide_String)return String
is
begin
return String (UTF_8_String'(Encode (X)));
end To_String;
begin
Put_Line
(To_String
("Full String: """ & U & """"));
Put_Line
(To_String
("Without_First: """ & U (U'First + 1 .. U'Last) & """"));
Put_Line
(To_String
("Without_Last: """ & U (U'First .. U'Last - 1) & """"));
Put_Line
(To_String
("Without_Both: """ & U (U'First + 1 .. U'Last - 1) & """"));
end Remove_Characters;
|
with Opt48_Pkg2; use Opt48_Pkg2;
package Opt48_Pkg1 is
function Get_Z return Rec;
end Opt48_Pkg1;
|
-----------------------------------------------------------------------
-- util-encoders-kdf-pbkdf2 -- Password-Based Key Derivation Function 2, RFC 8018.
-- 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 Interfaces;
procedure Util.Encoders.KDF.PBKDF2 (Password : in Secret_Key;
Salt : in Secret_Key;
Counter : in Positive;
Result : out Secret_Key) is
use Interfaces;
Total : constant Key_Length := Salt.Length + Length + 4;
Pos : constant Ada.Streams.Stream_Element_Offset := 1 + Salt.Secret'Last;
First : Ada.Streams.Stream_Element_Offset := 1;
I : Unsigned_32 := 1;
U : Secret_Key (Total);
Len : Ada.Streams.Stream_Element_Offset;
begin
-- RFC 8018, 5.2. PBKDF2
while First <= Result.Secret'Last loop
-- Compute: U_1 = PRF (P, S || INT (i))
U.Secret (Salt.Secret'Range) := Salt.Secret;
U.Secret (Pos) := Stream_Element (Shift_Left (I, 24) and 16#0ff#);
U.Secret (Pos + 1) := Stream_Element (Shift_Left (I, 16) and 16#0ff#);
U.Secret (Pos + 2) := Stream_Element (Shift_Left (I, 8) and 16#0ff#);
U.Secret (Pos + 3) := Stream_Element (I and 16#0ff#);
Len := Result.Secret'Last - First + 1;
if Len > Length then
Len := Length;
end if;
Hash (Key => Password.Secret,
Data => U.Secret (1 .. Pos + 3),
Into => U.Secret (1 .. Length));
-- Compute: F (P, S, c, i) = U_1 \xor U_2 \xor ... \xor U_c
-- With: U_c = PRF (P, U_{c-1}) .
Result.Secret (First .. First + Len - 1) := U.Secret (1 .. Len);
for C in 1 .. Counter - 1 loop
Hash (Key => Password.Secret,
Data => U.Secret (1 .. Length),
Into => U.Secret (1 .. Length));
for J in 1 .. Len loop
Result.Secret (First + J - 1) := Result.Secret (First + J - 1) xor U.Secret (J);
end loop;
end loop;
I := I + 1;
First := First + Length;
end loop;
end Util.Encoders.KDF.PBKDF2;
|
with ada.unchecked_Deallocation;
with Ada.Sequential_IO;
with Ada.Text_IO;
package body Neural.Forge
--
--
--
is
type Signals_view is access all Signals;
procedure free is new ada.unchecked_Deallocation (Signals, Signals_view);
-- Pattern
--
procedure Destroy (Self : in out Pattern)
is
begin
Free (Signals_view (Self.Inputs));
Free (Signals_view (Self.Outputs));
end Destroy;
function Creation (From : in Pattern) return Pattern
is
Self : constant Pattern := (Inputs => new Signals'(From.Inputs.all),
Outputs => new Signals'(From.Outputs.all));
begin
return Self;
end Creation;
-- Patterns
--
package Signal_IO is new Ada.Sequential_IO (Signal);
procedure Free is new Ada.Unchecked_Deallocation (Patterns, neural.Set.Patterns_view);
function Creation (From_File_Named : in String) return neural.Set.Patterns_view
is
use Signal_IO, ada.Text_IO;
the_File : ada.text_io.File_Type;
begin
open (the_File, in_File, From_File_Named & ".bounds");
declare
Num_Patterns : constant Natural := Integer'Value (get_Line (the_File));
Num_Inputs : constant Positive := Integer'Value (get_Line (the_File));
Num_Outputs : constant Positive := Integer'Value (get_Line (the_File));
Signals_File : signal_io.File_Type;
The_Creation : constant neural.Set.Patterns_view := new Patterns (1 .. Num_Patterns);
begin
open (Signals_File, In_File, From_File_Named & ".signals");
for Each_Pattern in The_Creation'Range
loop
The_Creation (Each_Pattern).Inputs := new Signals (1 .. Num_Inputs);
The_Creation (Each_Pattern).Outputs := new Signals (1 .. Num_Outputs);
for Each_Input in The_Creation (Each_Pattern).Inputs'Range
loop
Read (Signals_File, The_Creation (Each_Pattern).Inputs (Each_Input));
end loop;
for Each_Output in The_Creation (Each_Pattern).Outputs'Range
loop
Read (Signals_File, The_Creation (Each_Pattern).Outputs (Each_Output));
end loop;
end loop;
Close (Signals_File);
close (the_File);
return The_Creation;
end;
end Creation;
procedure Destroy (Self : in out Patterns)
is
begin
for Each in Self'Range loop
Destroy (Self (Each));
end loop;
end Destroy;
procedure Destroy (Self : in out neural.Set.Patterns_view)
is
use type Neural.Set.Patterns_view;
begin
if Self /= null then
Destroy (Self.all);
Free (Self);
end if;
end Destroy;
procedure Store (Self : in Patterns;
In_File_Named : in String)
is
use Signal_IO;
use Ada.Text_IO;
Bounds_File : Ada.Text_IO.File_Type;
Signals_File : Signal_IO.File_Type;
begin
create (Bounds_File, Out_File, In_File_Named & ".bounds");
put_Line (Bounds_File, Integer'Image (Self'Length));
put_Line (Bounds_File, Integer'Image (Self (1).Inputs'Length));
put_Line (Bounds_File, Integer'Image (Self (1).Outputs'Length));
close (Bounds_File);
Create (Signals_File, Out_File, In_File_Named & ".signals");
for Each_Pattern in Self'Range loop
for Each_Input in Self (Each_Pattern).Inputs'Range loop
Write (Signals_File, Self (Each_Pattern).Inputs (Each_Input));
end loop;
for Each_Output in Self (Each_Pattern).Outputs'Range loop
Write (Signals_File, Self (Each_Pattern).Outputs (Each_Output));
end loop;
end loop;
Close (Signals_File);
end Store;
end Neural.Forge;
|
-- Copyright (c) 2020-2021 Bartek thindil Jasicki <thindil@laeran.pl>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Tcl.Strings; use Tcl.Strings;
with Tk.Widget; use Tk.Widget;
-- ****h* Tk/Menu
-- FUNCTION
-- Provides code for manipulate Tk widget menu
-- SOURCE
package Tk.Menu is
-- ****
--## rule off REDUCEABLE_SCOPE
-- ****t* Menu/Menu.Tk_Menu
-- FUNCTION
-- The Tk identifier of the menu
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
subtype Tk_Menu is Tk_Widget;
-- ****
-- ****t* Menu/Menu.Menu_Types
-- FUNCTION
-- The types of menu
-- OPTIONS
-- NONE - If used in setting the menu type, then the menu type will be
-- set to default type
-- MEMUBAR - The menu will be set as the main application menu bar
-- TEAROFF - The menu will be show as separated window
-- NORMAL - The menu will be show as the standard menu
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
type Menu_Types is (NONE, MENUBAR, TEAROFF, NORMAL) with
Default_Value => NONE;
-- ****
-- ****d* Menu/Menu.Default_Menu_Type
-- FUNCTION
-- Default Tk menu type
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
Default_Menu_Type: constant Menu_Types := NORMAL;
-- ****
-- ****s* Menu/Menu.Menu_Options
-- FUNCTION
-- Data structure for all available options for the Tk menu
-- OPTIONS
-- Active_Background - Background color when menu is active (mouse is
-- over the menu)
-- Active_Border_Width - The width of border drawed around active menu
-- Active_Foreground - Foreground color when menu is active
-- Background - Normal background color of the menu
-- Border_Width - The width of the menu's border
-- Disabled_Foreground - Foreground color when the menu is disabled
-- Font - The Tk font which will be used to draw text on the menu
-- Foreground - Normal foreground color of the menu
-- Relief - 3-D effect desired for the menu
-- Post_Command - The Tcl command executed before the menu is posted
-- Tear_Off - If true, the menu can be torn off, otherwise this option
-- is disabled
-- Tear_Off_Command - The Tcl command executed when the menu will be torn off
-- Title - The title of the torn off menu
-- Menu_Type - The type of the menu. It can be set only during creation.
-- Later even if this option is changed, the menu behavior is
-- not.
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
type Menu_Options is new Widget_Options with record
Active_Background: Tcl_String := Null_Tcl_String;
Active_Border_Width: Pixel_Data := Empty_Pixel_Data;
Active_Foreground: Tcl_String := Null_Tcl_String;
Background: Tcl_String := Null_Tcl_String;
Border_Width: Pixel_Data := Empty_Pixel_Data;
Disabled_Foreground: Tcl_String := Null_Tcl_String;
Font: Tcl_String := Null_Tcl_String;
Foreground: Tcl_String := Null_Tcl_String;
Relief: Relief_Type := NONE;
Post_Command: Tcl_String := Null_Tcl_String;
Select_Color: Tcl_String := Null_Tcl_String;
Tear_Off: Extended_Boolean := NONE;
Tear_Off_Command: Tcl_String := Null_Tcl_String;
Title: Tcl_String := Null_Tcl_String;
Menu_Type: Menu_Types := NONE;
end record;
-- ****
-- ****t* Menu/Menu.Menu_Item_Types
-- FUNCTION
-- Available types of menu items (entries)
-- OPTIONS
-- CASCADE - The item is a submenu with own entries
-- CHECKBUTTON - The item is a checkbutton
-- COMMAND - The standard menu item
-- RADIOBUTTON - The item is a radiobutton
-- SEPARATOR - The item is a separator line, no command associated with it
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
type Menu_Item_Types is
(CASCADE, CHECKBUTTON, COMMAND, RADIOBUTTON, SEPARATOR) with
Default_Value => COMMAND;
-- ****
-- ****d* Menu/Menu.Default_Menu_Item
-- FUNCTION
-- Default type for Tk menu item
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
Default_Menu_Item: constant Menu_Item_Types := COMMAND;
-- ****
-- ****s* Menu/Menu.Menu_Item_Options
-- FUNCTION
-- Data structure for all available options for the Tk menu entries (items).
-- Available options depends on Item_Type of menu item.
-- OPTIONS
-- Item_Type - Type of item which options will be get or set. SEPARATOR
-- menu item don't have any options.
-- Active_Background - Background color when menu entry is active (mouse is
-- over the menu)
-- Active_Foreground - Foreground color when menu entry is active
-- Accelerator - Text which will be show on the right side of the menu entry.
-- The most often it is keyboard shortcut for the entry.
-- Background - Normal background color of the menu entry
-- Bitmap - Specifies bitmap to display instead of text on the menu entry
-- Column_Break - If True, the menu entry appears on at the top of new column in
-- menu. Otherwise it appears below the previous menu entry.
-- Command - The Tcl command to execute when the menu entry is invoked
-- Compound - Specifies if menu entry should display image and text and if
-- so, where image will be placed relative to text
-- Font - The Tk font which will be used for the menu entry
-- Foreground - Normal foreground color of the menu entry
-- Hide_Margin - If False, draw standard margin around the menu entry. Otherwise
-- margins are hidden
-- Image - Specifies Tk image to show on the menu entry
-- Label - Specifies text which will be displayed on the menu entry
-- State - The state of the menu entry. Disabled menu entries cannot be
-- invoked.
-- Underline - Index of the character in Label which will be underlined. Used
-- mostly to indicate keyboard shortcut for the menu entry.
-- Menu - The submenu of the menu entry. Available only for CASCADE
-- Item_Type.
-- Indicator_On - If True, show the menu entry indicator. Available only for
-- RADIOBUTTON and CHECKBUTTON Item_Type.
-- Select_Color - The color of indicator when the menu entry is selected. Available
-- only for RADIOBUTTON and CHECKBUTTON Item_Type.
-- Select_Image - The image displayed when the menu entry is selected. Available
-- only for RADIOBUTTON and CHECKBUTTON Item_Type.
-- Variable - The name of Tcl global variable which will be set when the menu
-- entry is selected. Available only for RADIOBUTTON and CHECKBUTTON
-- Item_Type
-- Off_Value - The value of the associated Variable when the menu entry is not
-- selected. Available only for CHECKBUTTON Item_Type.
-- On_Value - The value of the associated Variable when the menu entry is
-- selected. Available only for CHECKBUTTON Item_Type.
-- Value - The value of the associated Variable when the menu entry is
-- selected. Available only for RADIOBUTTON Item_Type.
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
type Menu_Item_Options(Item_Type: Menu_Item_Types := COMMAND) is record
case Item_Type is
when CASCADE | CHECKBUTTON | COMMAND | RADIOBUTTON =>
Active_Background: Tcl_String := Null_Tcl_String;
Active_Foreground: Tcl_String := Null_Tcl_String;
Accelerator: Tcl_String := Null_Tcl_String;
Background: Tcl_String := Null_Tcl_String;
Bitmap: Tcl_String := Null_Tcl_String;
Column_Break: Extended_Boolean := NONE;
Command: Tcl_String := Null_Tcl_String;
Compound: Place_Type := EMPTY;
Font: Tcl_String := Null_Tcl_String;
Foreground: Tcl_String := Null_Tcl_String;
Hide_Margin: Extended_Boolean := NONE;
Image: Tcl_String := Null_Tcl_String;
Label: Tcl_String := Null_Tcl_String;
State: State_Type := NONE;
Underline: Extended_Natural := -1;
case Item_Type is
when CASCADE =>
Menu: Tk_Menu := Null_Widget;
when CHECKBUTTON | RADIOBUTTON =>
Indicator_On: Extended_Boolean := NONE;
Select_Color: Tcl_String := Null_Tcl_String;
Select_Image: Tcl_String := Null_Tcl_String;
Variable: Tcl_String := Null_Tcl_String;
case Item_Type is
when CHECKBUTTON =>
Off_Value: Tcl_String := Null_Tcl_String;
On_Value: Tcl_String := Null_Tcl_String;
when RADIOBUTTON =>
Value: Tcl_String := Null_Tcl_String;
when others =>
null;
end case;
when others =>
null;
end case;
when SEPARATOR =>
null;
end case;
end record;
-- ****
-- ****d* Menu/Menu.Default_Menu_Item_Options
-- FUNCTION
-- Default values for options for Tk menu item
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
Default_Menu_Item_Options: constant Menu_Item_Options :=
Menu_Item_Options'(others => <>);
-- ****
-- ****t* Menu/Menu.Menu_Item_Indexes
-- FUNCTION
-- Available types of menu entries indexes
-- OPTIONS
-- ACTIVE - The currently active menu entry. If no active entry, then
-- the same as NONE
-- MENU_END - The last entry in the menu
-- LAST - The last entry in the menu (same as MENU_END)
-- NONE - The none entry. Used mostly in resetting active state
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
type Menu_Item_Indexes is (ACTIVE, MENU_END, LAST, NONE) with
Default_Value => NONE;
-- ****
-- ****d* Menu/Menu.Empty_Menu_Item_Index
-- FUNCTION
-- Empty index type for menu item
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
Empty_Menu_Item_Index: constant Menu_Item_Indexes := NONE;
-- ****
-- ****f* Menu/Menu.Create_(function)
-- FUNCTION
-- Create a new Tk menu widget with the selected pathname and options
-- PARAMETERS
-- Path_Name - Tk pathname for the newly created menu
-- Options - Options for the newly created menu
-- Interpreter - Tcl interpreter on which the menu will be created. Can
-- be empty. Default value is the default Tcl interpreter
-- RESULT
-- The Tk identifier of the newly created menu widget or Null_Widget if
-- the menu cannot be created
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Create the menu with pathname .mymenu with disabled tear off option
-- My_Menu: constant Tk_Menu := Create(".mymenu", Menu_Options'(Tear_Off => False, others => <>));
-- SEE ALSO
-- Menu.Create_(procedure)
-- COMMANDS
-- menu Path_Name Options
-- SOURCE
function Create
(Path_Name: Tk_Path_String; Options: Menu_Options;
Interpreter: Tcl_Interpreter := Get_Interpreter) return Tk_Menu with
Pre'Class => Path_Name'Length > 0 and Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Create_Menu1", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.Create_(procedure)
-- FUNCTION
-- Create a new Tk menu widget with the selected pathname and options
-- PARAMETERS
-- Menu_Widget - Tk_Menu identifier which will be returned
-- Path_Name - Tk pathname for the newly created menu
-- Options - Options for the newly created menu
-- Interpreter - Tcl interpreter on which the menu will be created. Can
-- be empty. Default value is the default Tcl interpreter
-- OUTPUT
-- The Menu_Widget parameter as Tk identifier of the newly created menu
-- widget or Null_Widget if the menu cannot be created
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Create the menu with pathname .mymenu with disabled tear off option
-- declare
-- My_Menu: Tk_Menu;
-- begin
-- Create(My_Menu, ".mymenu", Menu_Options'(Tear_Off => False, others => <>));
-- end;
-- SEE ALSO
-- Menu.Create_(function)
-- COMMANDS
-- menu Path_Name Options
-- SOURCE
procedure Create
(Menu_Widget: out Tk_Menu; Path_Name: Tk_Path_String;
Options: Menu_Options;
Interpreter: Tcl_Interpreter := Get_Interpreter) with
Pre'Class => Path_Name'Length > 0 and Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Create_Menu2", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.Activate
-- FUNCTION
-- Set the selected menu entry as active
-- PARAMETERS
-- Menu_Widget - Tk_Menu widget in which the menu entry will be set as active
-- Menu_Index - The index of the menu entry to activate
-- Is_Index - If True, Menu_Index is numerical index of the menu entry,
-- otherwise it is Y coordinate of the menu entry
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Set active the last element of the menu My_Menu
-- Activate(My_Menu, LAST);
-- COMMANDS
-- Menu_Widget activate Menu_Index
-- SOURCE
procedure Activate(Menu_Widget: Tk_Menu; Menu_Index: Tcl_String) with
Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0,
Test_Case => (Name => "Test_Activate_Menu", Mode => Nominal);
procedure Activate
(Menu_Widget: Tk_Menu; Menu_Index: Natural;
Is_Index: Boolean := True) with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Activate_Menu2", Mode => Nominal);
procedure Activate(Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes) with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Activate_Menu3", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.Add
-- FUNCTION
-- Add a new menu entry to the selected menu
-- PARAMETERS
-- Menu_Widget - Tk_Menu widget in which the new entry will be added
-- Options - The options for the newly added entry
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Add to menu My_Menu entry with label "Quit" and quit from the program on activate
-- Add(My_Menu, Menu_Item_Options'(Label => To_Tcl_String("Quit"), Command => To_Tcl_String("exit"),
-- others => <>));
-- COMMANDS
-- Menu_Widget add Item_Type Options
-- SEE ALSO
-- Menu.Insert
-- SOURCE
procedure Add(Menu_Widget: Tk_Menu; Options: Menu_Item_Options) with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Add_Menu", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.Get_Options
-- FUNCTION
-- Get all values of Tk options of the selected menu
-- PARAMETERS
-- Menu_Widget - Tk_Menu which options' values will be taken
-- RESULT
-- Menu_Options record with values of the selected menu options
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get all values of option of menu with pathname .mymenu
-- My_Menu_Options: constant Menu_Options := Get_Options(Get_Widget(".mymenu"));
-- SEE ALSO
-- Menu.Configure
-- COMMANDS
-- Menu_Widget configure
-- SOURCE
function Get_Options(Menu_Widget: Tk_Menu) return Menu_Options with
Pre'Class => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Get_Options_Menu", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.Configure
-- FUNCTION
-- Set the selected options for the selected menu
-- PARAMETERS
-- Menu_Widget - Tk_Menu which options will be set
-- Options - The record with new values for the menu options
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Disable tear off for menu with pathname .mymenu
-- Configure(Get_Widget(".mymenu"), (Tear_Off => False, others => <>));
-- SEE ALSO
-- Menu.Get_Options
-- COMMANDS
-- Menu_Widget configure Options
-- SOURCE
procedure Configure(Menu_Widget: Tk_Menu; Options: Menu_Options) with
Pre'Class => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Configure_Menu", Mode => Nominal);
-- ****
-- ****d* Menu/Menu.Default_Menu_Options
-- FUNCTION
-- Default Tk menu options values
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
Default_Menu_Options: constant Menu_Options := Menu_Options'(others => <>);
-- ****
-- ****f* Menu/Menu.Delete
-- FUNCTION
-- Delete the selected menu entries from the selected menu
-- PARAMETERS
-- Menu_Widget - Tk_Menu from which the menu entries will be deleted
-- Index1 - The index of the first menu entry to delete
-- Index2 - The index of the last menu entry to delete. If empty, delete
-- only the Index1 menu entry. Default value is empty
-- Is_Index1 - If true, Index1 is numerical index of the menu entry.
-- Otherwise it is Y coordinate of the menu entry.
-- Is_Index2 - If true, Index2 is numerical index of the menu entry.
-- Otherwise it is Y coordinate of the menu entry.
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Delete the last menu entry in My_Menu menu
-- Delete(My_Menu, To_Tcl_String("end"));
-- COMMANDS
-- Menu_Widget delete Index1 ?Index2?
-- SOURCE
procedure Delete
(Menu_Widget: Tk_Menu; Index1: Tcl_String;
Index2: Tcl_String := To_Tcl_String(Source => "")) with
Pre => Menu_Widget /= Null_Widget and Length(Source => Index1) > 0,
Test_Case => (Name => "Test_Delete_Menu", Mode => Nominal);
procedure Delete
(Menu_Widget: Tk_Menu; Index1: Natural; Index2: Extended_Natural := -1;
Is_Index1, Is_Index2: Boolean := True) with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Delete_Menu2", Mode => Nominal);
procedure Delete
(Menu_Widget: Tk_Menu; Index1: Menu_Item_Indexes;
Index2: Menu_Item_Indexes := NONE) with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Delete_Menu3", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.Entry_Get_Options
-- FUNCTION
-- Get all options of the selected menu entry in the selected menu
-- PARAMETERS
-- Menu_Widget - Tk_Menu from which the options for the selected menu entry
-- will be get
-- Menu_Index - The index of the menu entry which options will be get
-- Is_Index - If true, Menu_Index is numerical index of the menu entry.
-- Otherwise it is Y coordinate of the menu entry
-- RESULT
-- Menu_Item_Options record with options of the selected menu entry
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get the options of the third menu entry in My_Menu menu
-- Item_Options: constant Menu_Item_Options := Entry_Get_Options(My_Menu, 2));
-- COMMANDS
-- Menu_Widget entryconfigure Menu_Index
-- SEE ALSO
-- Menu.Entry_Configure
-- SOURCE
function Entry_Get_Options
(Menu_Widget: Tk_Menu; Menu_Index: Tcl_String)
return Menu_Item_Options with
Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0,
Test_Case => (Name => "Test_Entry_Get_Options_Menu", Mode => Nominal);
function Entry_Get_Options
(Menu_Widget: Tk_Menu; Menu_Index: Natural; Is_Index: Boolean := True)
return Menu_Item_Options with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Entry_Get_Options_Menu2", Mode => Nominal);
function Entry_Get_Options
(Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes)
return Menu_Item_Options with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Entry_Get_Options_Menu3", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.Entry_Configure
-- FUNCTION
-- Set options of the selected menu entry in the selected menu
-- PARAMETERS
-- Menu_Widget - Tk_Menu in which the menu entry options will be set
-- Menu_Index - The index of the menu entry which options will be set
-- Options - The new values of options for the selected menu entry
-- Is_Index - If true, Menu_Index is numerical index of the menu entry.
-- Otherwise it is Y coordinate of the menu entry
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Set the label for the first menu entry in My_Menu menu to "First element"
-- Entry_Configure(My_Menu, 0, Menu_Item_Options'(Label => To_Tcl_String("First element")));
-- COMMANDS
-- Menu_Widget entryconfigure Menu_Index Options
-- SEE ALSO
-- Menu.Entry_Get_Options
-- SOURCE
procedure Entry_Configure
(Menu_Widget: Tk_Menu; Menu_Index: Tcl_String;
Options: Menu_Item_Options) with
Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0,
Test_Case => (Name => "Test_Entry_Configure_Menu", Mode => Nominal);
procedure Entry_Configure
(Menu_Widget: Tk_Menu; Menu_Index: Natural; Options: Menu_Item_Options;
Is_Index: Boolean := True) with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Entry_Configure_Menu2", Mode => Nominal);
procedure Entry_Configure
(Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes;
Options: Menu_Item_Options) with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Entry_Configure_Menu3", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.Index
-- FUNCTION
-- Get the numerical index of the selected menu entry in the selected
-- menu
-- PARAMETERS
-- Menu_Widget - Tk_Menu in which the numerical index of menu entry will be
-- get
-- Menu_Index - The index of the menu entry which numerical index will be get
-- RESULT
-- Numerical index of the selected menu entry or -1 if menu entry was
-- specified as NONE or "none"
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get the numerical index of the last menu entry in My_Menu menu
-- Number: constant Extended_Natural := Index(My_Menu, MENU_END);
-- COMMANDS
-- Menu_Widget index Menu_Index
-- SOURCE
function Index
(Menu_Widget: Tk_Menu; Menu_Index: Tcl_String)
return Extended_Natural with
Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0,
Test_Case => (Name => "Test_Index_Menu", Mode => Nominal);
function Index
(Menu_Widget: Tk_Menu; Menu_Index: Natural) return Extended_Natural with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Index_Menu2", Mode => Nominal);
function Index
(Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes)
return Extended_Natural with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Index_Menu3", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.Insert
-- FUNCTION
-- Insert a new menu entry into selected position in the selected menu
-- PARAMETERS
-- Menu_Widget - Tk_Menu widget in which the new entry will be inserted
-- Menu_Index - The index on which the new menu entry will be inserted
-- Item_Type - The type of menu entry to insert
-- Options - The options for the newly inserted entry
-- Is_Index - If true, Menu_Index is numerical index of the menu entry.
-- Otherwise it is Y coordinate of the menu entry
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Insert into menu My_Menu entry with label "Quit" and quit from the program on activate on last position
-- Insert(My_Menu, MENU_END, COMMAND, Menu_Item_Options'(Label => To_Tcl_String("Quit"),
-- Command => To_Tcl_String("exit"),
-- others => <>));
-- COMMANDS
-- Menu_Widget insert Menu_Index Item_Type Options
-- SEE ALSO
-- Menu.Add
-- SOURCE
procedure Insert
(Menu_Widget: Tk_Menu; Menu_Index: Tcl_String; Item_Type: Menu_Item_Types;
Options: Menu_Item_Options) with
Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0,
Test_Case => (Name => "Test_Insert_Menu", Mode => Nominal);
procedure Insert
(Menu_Widget: Tk_Menu; Menu_Index: Natural; Item_Type: Menu_Item_Types;
Options: Menu_Item_Options; Is_Index: Boolean := True) with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Insert_Menu2", Mode => Nominal);
procedure Insert
(Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes;
Item_Type: Menu_Item_Types; Options: Menu_Item_Options) with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Insert_Menu3", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.Invoke_(procedure)
-- FUNCTION
-- Invoke the Tcl command related to the selected menu entry in the
-- selected menu
-- PARAMETERS
-- Menu_Widget - Tk_Menu in which the menu entry command will be invoked
-- Menu_Index - The index of the menu entry which command will be invoked
-- Is_Index - If true, Menu_Index is numerical index of the menu entry.
-- Otherwise it is Y coordinate of the menu entry
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Invoke the first menu entry in My_Menu menu
-- Invoke(My_Menu, 0);
-- COMMANDS
-- Menu_Widget invoke Menu_Index
-- SEE ALSO
-- Menu.Invoke_(function)
-- SOURCE
procedure Invoke(Menu_Widget: Tk_Menu; Menu_Index: Tcl_String) with
Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0,
Test_Case => (Name => "Test_Invoke_Menu1", Mode => Nominal);
procedure Invoke
(Menu_Widget: Tk_Menu; Menu_Index: Natural;
Is_Index: Boolean := True) with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Invoke_Menu3", Mode => Nominal);
procedure Invoke(Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes) with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Invoke_Menu4", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.Invoke_(function)
-- FUNCTION
-- Invoke the Tcl command related to the selected menu entry in the
-- selected menu
-- PARAMETERS
-- Menu_Widget - Tk_Menu in which the menu entry command will be invoked
-- Menu_Index - The index of the menu entry which command will be invoked
-- Is_Index - If true, Menu_Index is numerical index of the menu entry.
-- Otherwise it is Y coordinate of the menu entry
-- RESULT
-- String with value returned by the invoked Tcl command
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Invoke the second menu entry in My_Menu menu
-- Result: constant String := Invoke(My_Menu, 1);
-- COMMANDS
-- Menu_Widget invoke Menu_Index
-- SEE ALSO
-- Menu.Invoke_(procedure)
-- SOURCE
function Invoke
(Menu_Widget: Tk_Menu; Menu_Index: Tcl_String) return String with
Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0,
Test_Case => (Name => "Test_Invoke_Menu2", Mode => Nominal);
function Invoke
(Menu_Widget: Tk_Menu; Menu_Index: Natural; Is_Index: Boolean := True)
return String with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Invoke_Menu5", Mode => Nominal);
function Invoke
(Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes) return String with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Invoke_Menu6", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.Post_(procedure)
-- FUNCTION
-- Show the selected menu at the selected root-window coordinates
-- PARAMETERS
-- Menu_Widget - Tk_Menu to show
-- X - X coordinate of root-window where upper left corner of menu
-- will be
-- Y - Y coordinate of root-window where upper left corner of menu
-- will be
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Show the menu My_Menu at location (10, 24) of root-window
-- Post(My_Menu, 10, 24);
-- COMMANDS
-- Menu_Widget post X Y
-- SEE ALSO
-- Menu.Post_(function)
-- SOURCE
procedure Post(Menu_Widget: Tk_Menu; X, Y: Natural) with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Post_Menu1", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.Post_(function)
-- FUNCTION
-- Show the selected menu at the selected root-window coordinates and get
-- the value returned by Post_Command Tcl command of the menu
-- PARAMETERS
-- Menu_Widget - Tk_Menu to show
-- X - X coordinate of root-window where upper left corner of menu
-- will be
-- Y - Y coordinate of root-window where upper left corner of menu
-- will be
-- RESULT
-- The value returned by the Post_Command Tcl command of the menu. If no
-- Post_Command specified, return empty String.
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Show the menu My_Menu at location (20, 44) of root-window
-- Result : constant String := Post(My_Menu, 10, 24);
-- COMMANDS
-- Menu_Widget post X Y
-- SEE ALSO
-- Menu.Post_(procedure), Menu.Unpost
-- SOURCE
function Post(Menu_Widget: Tk_Menu; X, Y: Natural) return String with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Post_Menu2", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.Post_Cascade
-- FUNCTION
-- Post the submenu associated with the selected CASCADE menu entry and
-- unpost the previous submenu if visible
-- PARAMETERS
-- Menu_Widget - Tk_Menu in which the submenu will be show
-- Menu_Index - Index of menu entry which submenu will be show
-- Is_Index - If true, Menu_Index is numerical index of the menu entry.
-- Otherwise it is Y coordinate of the menu entry
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Show the submenu of the second item in My_Menu menu
-- Post_Cascade(My_Menu, 1);
-- COMMANDS
-- Menu_Widget postcascade Menu_Index
-- SOURCE
procedure Post_Cascade(Menu_Widget: Tk_Menu; Menu_Index: Tcl_String) with
Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0,
Test_Case => (Name => "Test_PostCascade_Menu", Mode => Nominal);
procedure Post_Cascade
(Menu_Widget: Tk_Menu; Menu_Index: Natural;
Is_Index: Boolean := True) with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_PostCascade_Menu2", Mode => Nominal);
procedure Post_Cascade
(Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes) with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_PostCascade_Menu3", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.Get_Item_Type
-- FUNCTION
-- Get the type of the selected menu entry in the selected menu
-- PARAMETERS
-- Menu_Widget - Tk_Menu in which the menu item type will be get
-- Menu_Index - The index of the menu entry which type will be get
-- Is_Index - If true, Menu_Index is numerical index of the menu entry.
-- Otherwise it is Y coordinate of the menu entry
-- RESULT
-- The type of the selected menu entry
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get the type of menu entry with label Quit in My_Menu menu
-- Item_Type: constant Menu_Item_Types := Get_Item_Type(My_Menu, To_Tcl_String("Quit"));
-- COMMANDS
-- Menu_Widget type Menu_Index
-- SOURCE
function Get_Item_Type
(Menu_Widget: Tk_Menu; Menu_Index: Tcl_String) return Menu_Item_Types with
Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0,
Test_Case => (Name => "Test_Get_Item_Type_Menu", Mode => Nominal);
function Get_Item_Type
(Menu_Widget: Tk_Menu; Menu_Index: Natural; Is_Index: Boolean := True)
return Menu_Item_Types with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Get_Item_Type_Menu2", Mode => Nominal);
function Get_Item_Type
(Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes)
return Menu_Item_Types with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Get_Item_Type_Menu3", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.Unpost
-- FUNCTION
-- Hide the selected menu
-- PARAMETERS
-- Menu_Widget - Tk_Menu to hide
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Hide menu My_Menu
-- Unpost(My_Menu);
-- COMMANDS
-- Menu_Widget unpost
-- SEE ALSO
-- Menu.Post
-- SOURCE
procedure Unpost(Menu_Widget: Tk_Menu) with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Unpost_Menu", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.X_Position
-- FUNCTION
-- Get the X pixel coordinate of top left corner of the selected menu
-- entry in the selected menu
-- PARAMETERS
-- Menu_Widget - Tk_Menu in which coordinate will be get
-- Menu_Index - The index of the menu entry which coordinate will be get
-- Is_Index - If true, Menu_Index is numerical index of the menu entry.
-- Otherwise it is Y coordinate of the menu entry
-- RESULT
-- X coordinate for the pixel of the top left corner of the selected
-- menu
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get the X coordinate for the first menu entry in My_Menu
-- X: constant Natural := X_Position(My_Menu, 0);
-- COMMANDS
-- Menu_Widget xposition Menu_Index
-- SEE ALSO
-- Menu.Y_Position
-- SOURCE
function X_Position
(Menu_Widget: Tk_Menu; Menu_Index: Tcl_String) return Natural with
Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0,
Test_Case => (Name => "Test_X_Position_Menu", Mode => Nominal);
function X_Position
(Menu_Widget: Tk_Menu; Menu_Index: Natural; Is_Index: Boolean := True)
return Natural with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_X_Position_Menu2", Mode => Nominal);
function X_Position
(Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes) return Natural with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_X_Position_Menu3", Mode => Nominal);
-- ****
-- ****f* Menu/Menu.Y_Position
-- FUNCTION
-- Get the Y pixel coordinate of top left corner of the selected menu
-- entry in the selected menu
-- PARAMETERS
-- Menu_Widget - Tk_Menu in which coordinate will be get
-- Menu_Index - The index of the menu entry which coordinate will be get
-- Is_Index - If true, Menu_Index is numerical index of the menu entry.
-- Otherwise it is Y coordinate of the menu entry
-- RESULT
-- Y coordinate for the pixel of the top left corner of the selected
-- menu
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get the Y coordinate for the first menu entry in My_Menu
-- Y: constant Natural := Y_Position(My_Menu, 0);
-- COMMANDS
-- Menu_Widget yposition Menu_Index
-- SEE ALSO
-- Menu.X_Position
-- SOURCE
function Y_Position
(Menu_Widget: Tk_Menu; Menu_Index: Tcl_String) return Natural with
Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0,
Test_Case => (Name => "Test_Y_Position_Menu", Mode => Nominal);
function Y_Position
(Menu_Widget: Tk_Menu; Menu_Index: Natural; Is_Index: Boolean := True)
return Natural with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Y_Position_Menu2", Mode => Nominal);
function Y_Position
(Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes) return Natural with
Pre => Menu_Widget /= Null_Widget,
Test_Case => (Name => "Test_Y_Position_Menu3", Mode => Nominal);
-- ****
--## rule on REDUCEABLE_SCOPE
end Tk.Menu;
|
--
-- Copyright (C) 2019, AdaCore
--
-- Copyright (c) 2010 - 2018, Nordic Semiconductor ASA
--
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- 2. Redistributions in binary form, except as embedded into a Nordic
-- Semiconductor ASA integrated circuit in a product or a software update
-- for such product, must reproduce the above copyright notice, this list
-- of conditions and the following disclaimer in the documentation and/or
-- other materials provided with the distribution.
--
-- 3. Neither the name of Nordic Semiconductor ASA nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- 4. This software, with or without modification, must only be used with a
-- Nordic Semiconductor ASA integrated circuit.
--
-- 5. Any software provided in binary form under this license must not be
-- reverse engineered, decompiled, modified and/or disassembled.
--
-- THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY
-- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-- WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR
-- ASA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--
-- This spec has been automatically generated from nrf52840.svd
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package Interfaces.NRF52.RTC is
pragma Preelaborate;
pragma No_Elaboration_Code_All;
---------------
-- Registers --
---------------
subtype TASKS_START_TASKS_START_Field is Interfaces.NRF52.Bit;
-- Start RTC COUNTER
type TASKS_START_Register is record
-- Write-only.
TASKS_START : TASKS_START_TASKS_START_Field := 16#0#;
-- unspecified
Reserved_1_31 : Interfaces.NRF52.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TASKS_START_Register use record
TASKS_START at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
subtype TASKS_STOP_TASKS_STOP_Field is Interfaces.NRF52.Bit;
-- Stop RTC COUNTER
type TASKS_STOP_Register is record
-- Write-only.
TASKS_STOP : TASKS_STOP_TASKS_STOP_Field := 16#0#;
-- unspecified
Reserved_1_31 : Interfaces.NRF52.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TASKS_STOP_Register use record
TASKS_STOP at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
subtype TASKS_CLEAR_TASKS_CLEAR_Field is Interfaces.NRF52.Bit;
-- Clear RTC COUNTER
type TASKS_CLEAR_Register is record
-- Write-only.
TASKS_CLEAR : TASKS_CLEAR_TASKS_CLEAR_Field := 16#0#;
-- unspecified
Reserved_1_31 : Interfaces.NRF52.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TASKS_CLEAR_Register use record
TASKS_CLEAR at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
subtype TASKS_TRIGOVRFLW_TASKS_TRIGOVRFLW_Field is Interfaces.NRF52.Bit;
-- Set COUNTER to 0xFFFFF0
type TASKS_TRIGOVRFLW_Register is record
-- Write-only.
TASKS_TRIGOVRFLW : TASKS_TRIGOVRFLW_TASKS_TRIGOVRFLW_Field := 16#0#;
-- unspecified
Reserved_1_31 : Interfaces.NRF52.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TASKS_TRIGOVRFLW_Register use record
TASKS_TRIGOVRFLW at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
subtype EVENTS_TICK_EVENTS_TICK_Field is Interfaces.NRF52.Bit;
-- Event on COUNTER increment
type EVENTS_TICK_Register is record
EVENTS_TICK : EVENTS_TICK_EVENTS_TICK_Field := 16#0#;
-- unspecified
Reserved_1_31 : Interfaces.NRF52.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EVENTS_TICK_Register use record
EVENTS_TICK at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
subtype EVENTS_OVRFLW_EVENTS_OVRFLW_Field is Interfaces.NRF52.Bit;
-- Event on COUNTER overflow
type EVENTS_OVRFLW_Register is record
EVENTS_OVRFLW : EVENTS_OVRFLW_EVENTS_OVRFLW_Field := 16#0#;
-- unspecified
Reserved_1_31 : Interfaces.NRF52.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EVENTS_OVRFLW_Register use record
EVENTS_OVRFLW at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
subtype EVENTS_COMPARE_EVENTS_COMPARE_Field is Interfaces.NRF52.Bit;
-- Description collection[n]: Compare event on CC[n] match
type EVENTS_COMPARE_Register is record
EVENTS_COMPARE : EVENTS_COMPARE_EVENTS_COMPARE_Field := 16#0#;
-- unspecified
Reserved_1_31 : Interfaces.NRF52.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EVENTS_COMPARE_Register use record
EVENTS_COMPARE at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- Description collection[n]: Compare event on CC[n] match
type EVENTS_COMPARE_Registers is array (0 .. 3) of EVENTS_COMPARE_Register;
-- Write '1' to enable interrupt for TICK event
type INTENSET_TICK_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_TICK_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to enable interrupt for TICK event
type INTENSET_TICK_Field_1 is
(-- Reset value for the field
Intenset_Tick_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_TICK_Field_1 use
(Intenset_Tick_Field_Reset => 0,
Set => 1);
-- Write '1' to enable interrupt for OVRFLW event
type INTENSET_OVRFLW_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_OVRFLW_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to enable interrupt for OVRFLW event
type INTENSET_OVRFLW_Field_1 is
(-- Reset value for the field
Intenset_Ovrflw_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_OVRFLW_Field_1 use
(Intenset_Ovrflw_Field_Reset => 0,
Set => 1);
-- Write '1' to enable interrupt for COMPARE[0] event
type INTENSET_COMPARE0_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_COMPARE0_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to enable interrupt for COMPARE[0] event
type INTENSET_COMPARE0_Field_1 is
(-- Reset value for the field
Intenset_Compare0_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_COMPARE0_Field_1 use
(Intenset_Compare0_Field_Reset => 0,
Set => 1);
-- INTENSET_COMPARE array
type INTENSET_COMPARE_Field_Array is array (0 .. 3)
of INTENSET_COMPARE0_Field_1
with Component_Size => 1, Size => 4;
-- Type definition for INTENSET_COMPARE
type INTENSET_COMPARE_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COMPARE as a value
Val : Interfaces.NRF52.UInt4;
when True =>
-- COMPARE as an array
Arr : INTENSET_COMPARE_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for INTENSET_COMPARE_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Enable interrupt
type INTENSET_Register is record
-- Write '1' to enable interrupt for TICK event
TICK : INTENSET_TICK_Field_1 := Intenset_Tick_Field_Reset;
-- Write '1' to enable interrupt for OVRFLW event
OVRFLW : INTENSET_OVRFLW_Field_1 := Intenset_Ovrflw_Field_Reset;
-- unspecified
Reserved_2_15 : Interfaces.NRF52.UInt14 := 16#0#;
-- Write '1' to enable interrupt for COMPARE[0] event
COMPARE : INTENSET_COMPARE_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_20_31 : Interfaces.NRF52.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for INTENSET_Register use record
TICK at 0 range 0 .. 0;
OVRFLW at 0 range 1 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
COMPARE at 0 range 16 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- Write '1' to disable interrupt for TICK event
type INTENCLR_TICK_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_TICK_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to disable interrupt for TICK event
type INTENCLR_TICK_Field_1 is
(-- Reset value for the field
Intenclr_Tick_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_TICK_Field_1 use
(Intenclr_Tick_Field_Reset => 0,
Clear => 1);
-- Write '1' to disable interrupt for OVRFLW event
type INTENCLR_OVRFLW_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_OVRFLW_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to disable interrupt for OVRFLW event
type INTENCLR_OVRFLW_Field_1 is
(-- Reset value for the field
Intenclr_Ovrflw_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_OVRFLW_Field_1 use
(Intenclr_Ovrflw_Field_Reset => 0,
Clear => 1);
-- Write '1' to disable interrupt for COMPARE[0] event
type INTENCLR_COMPARE0_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_COMPARE0_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to disable interrupt for COMPARE[0] event
type INTENCLR_COMPARE0_Field_1 is
(-- Reset value for the field
Intenclr_Compare0_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_COMPARE0_Field_1 use
(Intenclr_Compare0_Field_Reset => 0,
Clear => 1);
-- INTENCLR_COMPARE array
type INTENCLR_COMPARE_Field_Array is array (0 .. 3)
of INTENCLR_COMPARE0_Field_1
with Component_Size => 1, Size => 4;
-- Type definition for INTENCLR_COMPARE
type INTENCLR_COMPARE_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COMPARE as a value
Val : Interfaces.NRF52.UInt4;
when True =>
-- COMPARE as an array
Arr : INTENCLR_COMPARE_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for INTENCLR_COMPARE_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Disable interrupt
type INTENCLR_Register is record
-- Write '1' to disable interrupt for TICK event
TICK : INTENCLR_TICK_Field_1 := Intenclr_Tick_Field_Reset;
-- Write '1' to disable interrupt for OVRFLW event
OVRFLW : INTENCLR_OVRFLW_Field_1 := Intenclr_Ovrflw_Field_Reset;
-- unspecified
Reserved_2_15 : Interfaces.NRF52.UInt14 := 16#0#;
-- Write '1' to disable interrupt for COMPARE[0] event
COMPARE : INTENCLR_COMPARE_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_20_31 : Interfaces.NRF52.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for INTENCLR_Register use record
TICK at 0 range 0 .. 0;
OVRFLW at 0 range 1 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
COMPARE at 0 range 16 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- Enable or disable event routing for TICK event
type EVTEN_TICK_Field is
(-- Disable
Disabled,
-- Enable
Enabled)
with Size => 1;
for EVTEN_TICK_Field use
(Disabled => 0,
Enabled => 1);
-- Enable or disable event routing for OVRFLW event
type EVTEN_OVRFLW_Field is
(-- Disable
Disabled,
-- Enable
Enabled)
with Size => 1;
for EVTEN_OVRFLW_Field use
(Disabled => 0,
Enabled => 1);
-- Enable or disable event routing for COMPARE[0] event
type EVTEN_COMPARE0_Field is
(-- Disable
Disabled,
-- Enable
Enabled)
with Size => 1;
for EVTEN_COMPARE0_Field use
(Disabled => 0,
Enabled => 1);
-- EVTEN_COMPARE array
type EVTEN_COMPARE_Field_Array is array (0 .. 3) of EVTEN_COMPARE0_Field
with Component_Size => 1, Size => 4;
-- Type definition for EVTEN_COMPARE
type EVTEN_COMPARE_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COMPARE as a value
Val : Interfaces.NRF52.UInt4;
when True =>
-- COMPARE as an array
Arr : EVTEN_COMPARE_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for EVTEN_COMPARE_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Enable or disable event routing
type EVTEN_Register is record
-- Enable or disable event routing for TICK event
TICK : EVTEN_TICK_Field := Interfaces.NRF52.RTC.Disabled;
-- Enable or disable event routing for OVRFLW event
OVRFLW : EVTEN_OVRFLW_Field := Interfaces.NRF52.RTC.Disabled;
-- unspecified
Reserved_2_15 : Interfaces.NRF52.UInt14 := 16#0#;
-- Enable or disable event routing for COMPARE[0] event
COMPARE : EVTEN_COMPARE_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_20_31 : Interfaces.NRF52.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EVTEN_Register use record
TICK at 0 range 0 .. 0;
OVRFLW at 0 range 1 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
COMPARE at 0 range 16 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- Write '1' to enable event routing for TICK event
type EVTENSET_TICK_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for EVTENSET_TICK_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to enable event routing for TICK event
type EVTENSET_TICK_Field_1 is
(-- Reset value for the field
Evtenset_Tick_Field_Reset,
-- Enable
Set)
with Size => 1;
for EVTENSET_TICK_Field_1 use
(Evtenset_Tick_Field_Reset => 0,
Set => 1);
-- Write '1' to enable event routing for OVRFLW event
type EVTENSET_OVRFLW_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for EVTENSET_OVRFLW_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to enable event routing for OVRFLW event
type EVTENSET_OVRFLW_Field_1 is
(-- Reset value for the field
Evtenset_Ovrflw_Field_Reset,
-- Enable
Set)
with Size => 1;
for EVTENSET_OVRFLW_Field_1 use
(Evtenset_Ovrflw_Field_Reset => 0,
Set => 1);
-- Write '1' to enable event routing for COMPARE[0] event
type EVTENSET_COMPARE0_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for EVTENSET_COMPARE0_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to enable event routing for COMPARE[0] event
type EVTENSET_COMPARE0_Field_1 is
(-- Reset value for the field
Evtenset_Compare0_Field_Reset,
-- Enable
Set)
with Size => 1;
for EVTENSET_COMPARE0_Field_1 use
(Evtenset_Compare0_Field_Reset => 0,
Set => 1);
-- EVTENSET_COMPARE array
type EVTENSET_COMPARE_Field_Array is array (0 .. 3)
of EVTENSET_COMPARE0_Field_1
with Component_Size => 1, Size => 4;
-- Type definition for EVTENSET_COMPARE
type EVTENSET_COMPARE_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COMPARE as a value
Val : Interfaces.NRF52.UInt4;
when True =>
-- COMPARE as an array
Arr : EVTENSET_COMPARE_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for EVTENSET_COMPARE_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Enable event routing
type EVTENSET_Register is record
-- Write '1' to enable event routing for TICK event
TICK : EVTENSET_TICK_Field_1 := Evtenset_Tick_Field_Reset;
-- Write '1' to enable event routing for OVRFLW event
OVRFLW : EVTENSET_OVRFLW_Field_1 := Evtenset_Ovrflw_Field_Reset;
-- unspecified
Reserved_2_15 : Interfaces.NRF52.UInt14 := 16#0#;
-- Write '1' to enable event routing for COMPARE[0] event
COMPARE : EVTENSET_COMPARE_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_20_31 : Interfaces.NRF52.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EVTENSET_Register use record
TICK at 0 range 0 .. 0;
OVRFLW at 0 range 1 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
COMPARE at 0 range 16 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- Write '1' to disable event routing for TICK event
type EVTENCLR_TICK_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for EVTENCLR_TICK_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to disable event routing for TICK event
type EVTENCLR_TICK_Field_1 is
(-- Reset value for the field
Evtenclr_Tick_Field_Reset,
-- Disable
Clear)
with Size => 1;
for EVTENCLR_TICK_Field_1 use
(Evtenclr_Tick_Field_Reset => 0,
Clear => 1);
-- Write '1' to disable event routing for OVRFLW event
type EVTENCLR_OVRFLW_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for EVTENCLR_OVRFLW_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to disable event routing for OVRFLW event
type EVTENCLR_OVRFLW_Field_1 is
(-- Reset value for the field
Evtenclr_Ovrflw_Field_Reset,
-- Disable
Clear)
with Size => 1;
for EVTENCLR_OVRFLW_Field_1 use
(Evtenclr_Ovrflw_Field_Reset => 0,
Clear => 1);
-- Write '1' to disable event routing for COMPARE[0] event
type EVTENCLR_COMPARE0_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for EVTENCLR_COMPARE0_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to disable event routing for COMPARE[0] event
type EVTENCLR_COMPARE0_Field_1 is
(-- Reset value for the field
Evtenclr_Compare0_Field_Reset,
-- Disable
Clear)
with Size => 1;
for EVTENCLR_COMPARE0_Field_1 use
(Evtenclr_Compare0_Field_Reset => 0,
Clear => 1);
-- EVTENCLR_COMPARE array
type EVTENCLR_COMPARE_Field_Array is array (0 .. 3)
of EVTENCLR_COMPARE0_Field_1
with Component_Size => 1, Size => 4;
-- Type definition for EVTENCLR_COMPARE
type EVTENCLR_COMPARE_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COMPARE as a value
Val : Interfaces.NRF52.UInt4;
when True =>
-- COMPARE as an array
Arr : EVTENCLR_COMPARE_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for EVTENCLR_COMPARE_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Disable event routing
type EVTENCLR_Register is record
-- Write '1' to disable event routing for TICK event
TICK : EVTENCLR_TICK_Field_1 := Evtenclr_Tick_Field_Reset;
-- Write '1' to disable event routing for OVRFLW event
OVRFLW : EVTENCLR_OVRFLW_Field_1 := Evtenclr_Ovrflw_Field_Reset;
-- unspecified
Reserved_2_15 : Interfaces.NRF52.UInt14 := 16#0#;
-- Write '1' to disable event routing for COMPARE[0] event
COMPARE : EVTENCLR_COMPARE_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_20_31 : Interfaces.NRF52.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EVTENCLR_Register use record
TICK at 0 range 0 .. 0;
OVRFLW at 0 range 1 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
COMPARE at 0 range 16 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
subtype COUNTER_COUNTER_Field is Interfaces.NRF52.UInt24;
-- Current COUNTER value
type COUNTER_Register is record
-- Read-only. Counter value
COUNTER : COUNTER_COUNTER_Field;
-- unspecified
Reserved_24_31 : Interfaces.NRF52.Byte;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for COUNTER_Register use record
COUNTER at 0 range 0 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype PRESCALER_PRESCALER_Field is Interfaces.NRF52.UInt12;
-- 12 bit prescaler for COUNTER frequency (32768/(PRESCALER+1)).Must be
-- written when RTC is stopped
type PRESCALER_Register is record
-- Prescaler value
PRESCALER : PRESCALER_PRESCALER_Field := 16#0#;
-- unspecified
Reserved_12_31 : Interfaces.NRF52.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PRESCALER_Register use record
PRESCALER at 0 range 0 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
subtype CC_COMPARE_Field is Interfaces.NRF52.UInt24;
-- Description collection[n]: Compare register n
type CC_Register is record
-- Compare value
COMPARE : CC_COMPARE_Field := 16#0#;
-- unspecified
Reserved_24_31 : Interfaces.NRF52.Byte := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CC_Register use record
COMPARE at 0 range 0 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
-- Description collection[n]: Compare register n
type CC_Registers is array (0 .. 3) of CC_Register;
-----------------
-- Peripherals --
-----------------
-- Real time counter 0
type RTC_Peripheral is record
-- Start RTC COUNTER
TASKS_START : aliased TASKS_START_Register;
-- Stop RTC COUNTER
TASKS_STOP : aliased TASKS_STOP_Register;
-- Clear RTC COUNTER
TASKS_CLEAR : aliased TASKS_CLEAR_Register;
-- Set COUNTER to 0xFFFFF0
TASKS_TRIGOVRFLW : aliased TASKS_TRIGOVRFLW_Register;
-- Event on COUNTER increment
EVENTS_TICK : aliased EVENTS_TICK_Register;
-- Event on COUNTER overflow
EVENTS_OVRFLW : aliased EVENTS_OVRFLW_Register;
-- Description collection[n]: Compare event on CC[n] match
EVENTS_COMPARE : aliased EVENTS_COMPARE_Registers;
-- Enable interrupt
INTENSET : aliased INTENSET_Register;
-- Disable interrupt
INTENCLR : aliased INTENCLR_Register;
-- Enable or disable event routing
EVTEN : aliased EVTEN_Register;
-- Enable event routing
EVTENSET : aliased EVTENSET_Register;
-- Disable event routing
EVTENCLR : aliased EVTENCLR_Register;
-- Current COUNTER value
COUNTER : aliased COUNTER_Register;
-- 12 bit prescaler for COUNTER frequency (32768/(PRESCALER+1)).Must be
-- written when RTC is stopped
PRESCALER : aliased PRESCALER_Register;
-- Description collection[n]: Compare register n
CC : aliased CC_Registers;
end record
with Volatile;
for RTC_Peripheral use record
TASKS_START at 16#0# range 0 .. 31;
TASKS_STOP at 16#4# range 0 .. 31;
TASKS_CLEAR at 16#8# range 0 .. 31;
TASKS_TRIGOVRFLW at 16#C# range 0 .. 31;
EVENTS_TICK at 16#100# range 0 .. 31;
EVENTS_OVRFLW at 16#104# range 0 .. 31;
EVENTS_COMPARE at 16#140# range 0 .. 127;
INTENSET at 16#304# range 0 .. 31;
INTENCLR at 16#308# range 0 .. 31;
EVTEN at 16#340# range 0 .. 31;
EVTENSET at 16#344# range 0 .. 31;
EVTENCLR at 16#348# range 0 .. 31;
COUNTER at 16#504# range 0 .. 31;
PRESCALER at 16#508# range 0 .. 31;
CC at 16#540# range 0 .. 127;
end record;
-- Real time counter 0
RTC0_Periph : aliased RTC_Peripheral
with Import, Address => RTC0_Base;
-- Real time counter 1
RTC1_Periph : aliased RTC_Peripheral
with Import, Address => RTC1_Base;
-- Real time counter 2
RTC2_Periph : aliased RTC_Peripheral
with Import, Address => RTC2_Base;
end Interfaces.NRF52.RTC;
|
package Array13 is
Max : Natural := 1;
type Arr is array (Natural range 0..Max) of Natural;
type T is record
A : Arr := (others => 0);
end record;
procedure Foo;
end Array13;
|
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Streams.Stream_IO;
with Ada.Text_IO;
with Slim.Messages;
with Slim.Messages.grfe;
with Slim.Messages.grfg;
with Slim.Messages.grfs;
with Slim.Message_Decoders;
with Slim.Message_Visiters;
with League.Application;
with League.Stream_Element_Vectors;
with League.Strings;
procedure Slim.Read_File is
procedure Client_Message
(Client : access Ada.Streams.Root_Stream_Type'Class);
procedure Server_Message
(Server : access Ada.Streams.Root_Stream_Type'Class);
package Dump is
type Visiter is new Slim.Message_Visiters.Visiter with record
Count : Positive := 1;
end record;
not overriding procedure Dump_File
(Self : in out Visiter;
Tag : Slim.Messages.Message_Tag;
Data : Ada.Streams.Stream_Element_Array);
overriding procedure grfe
(Self : in out Visiter;
Message : not null access Slim.Messages.grfe.Grfe_Message);
overriding procedure grfg
(Self : in out Visiter;
Message : not null access Slim.Messages.grfg.Grfg_Message);
overriding procedure grfs
(Self : in out Visiter;
Message : not null access Slim.Messages.grfs.Grfs_Message);
end Dump;
package body Dump is
overriding procedure grfe
(Self : in out Visiter;
Message : not null access Slim.Messages.grfe.Grfe_Message) is
begin
Self.Dump_File ("grfe", Message.Data);
end grfe;
overriding procedure grfg
(Self : in out Visiter;
Message : not null access Slim.Messages.grfg.Grfg_Message) is
begin
Self.Dump_File ("grfg", Message.Data);
end grfg;
overriding procedure grfs
(Self : in out Visiter;
Message : not null access Slim.Messages.grfs.Grfs_Message) is
begin
Self.Dump_File ("grfs", Message.Data);
end grfs;
not overriding procedure Dump_File
(Self : in out Visiter;
Tag : Slim.Messages.Message_Tag;
Data : Ada.Streams.Stream_Element_Array)
is
-- convert -size 32x160 -depth 1 gray:F1.dat -flop -rotate -90 image.png
Output : Ada.Streams.Stream_IO.File_Type;
Image : String := Positive'Image (Self.Count);
begin
Image (1) := 'F';
Self.Count := Self.Count + 1;
Ada.Streams.Stream_IO.Create
(File => Output,
Name => "/tmp/" & Image & Tag & ".dat");
Ada.Streams.Stream_IO.Write (Output, Data);
Ada.Streams.Stream_IO.Close (Output);
end Dump_File;
end Dump;
Visiter : Dump.Visiter;
--------------------
-- Client_Message --
--------------------
procedure Client_Message
(Client : access Ada.Streams.Root_Stream_Type'Class)
is
use type Ada.Streams.Stream_Element_Offset;
Tag : Slim.Messages.Message_Tag;
Raw_Tag : Ada.Streams.Stream_Element_Array (1 .. 4)
with Address => Tag'Address;
Word : Ada.Streams.Stream_Element_Array (1 .. 4);
Length : Ada.Streams.Stream_Element_Offset := 0;
Last : Ada.Streams.Stream_Element_Offset;
Data : aliased League.Stream_Element_Vectors.Stream_Element_Vector;
begin
Client.Read (Raw_Tag, Last);
pragma Assert (Last = Raw_Tag'Length);
Ada.Text_IO.Put_Line (Tag);
Client.Read (Word, Last);
pragma Assert (Last = Word'Length);
for Byte of Word loop
Length := Length * 256 + Ada.Streams.Stream_Element_Offset (Byte);
end loop;
while Length > 0 loop
declare
Piece : constant Ada.Streams.Stream_Element_Offset :=
Ada.Streams.Stream_Element_Offset'Min (Length, 256);
Input : Ada.Streams.Stream_Element_Array (1 .. Piece);
begin
Client.Read (Input, Last);
pragma Assert (Last = Input'Length);
Data.Append (Input);
Length := Length - Last;
end;
end loop;
declare
Decoder : Slim.Message_Decoders.Decoder;
Message : Slim.Messages.Message_Access;
pragma Unreferenced (Message);
begin
Decoder.Decode (Tag, Data'Unchecked_Access, Message);
Data.Clear;
end;
end Client_Message;
--------------------
-- Server_Message --
--------------------
procedure Server_Message
(Server : access Ada.Streams.Root_Stream_Type'Class)
is
use type Ada.Streams.Stream_Element_Offset;
Tag : Slim.Messages.Message_Tag;
Raw_Tag : Ada.Streams.Stream_Element_Array (1 .. 4)
with Address => Tag'Address;
Word : Ada.Streams.Stream_Element_Array (1 .. 2);
Length : Ada.Streams.Stream_Element_Offset := 0;
Last : Ada.Streams.Stream_Element_Offset;
Data : aliased League.Stream_Element_Vectors.Stream_Element_Vector;
begin
Server.Read (Word, Last);
pragma Assert (Last = Word'Length);
Server.Read (Raw_Tag, Last);
pragma Assert (Last = Raw_Tag'Length);
Ada.Text_IO.Put_Line (Tag);
for Byte of Word loop
Length := Length * 256 + Ada.Streams.Stream_Element_Offset (Byte);
end loop;
Length := Length - 4;
while Length > 0 loop
declare
Piece : constant Ada.Streams.Stream_Element_Offset :=
Ada.Streams.Stream_Element_Offset'Min (Length, 256);
Input : Ada.Streams.Stream_Element_Array (1 .. Piece);
begin
Server.Read (Input, Last);
pragma Assert (Last = Input'Length);
Data.Append (Input);
Length := Length - Last;
end;
end loop;
declare
Decoder : Slim.Message_Decoders.Decoder;
Message : Slim.Messages.Message_Access;
begin
Decoder.Decode (Tag, Data'Unchecked_Access, Message);
Message.Visit (Visiter);
Data.Clear;
end;
end Server_Message;
File_Name : constant League.Strings.Universal_String :=
League.Application.Arguments.Element (1);
Is_Client : constant Boolean := File_Name.Starts_With ("cli");
Input : Ada.Streams.Stream_IO.File_Type;
Stream : Ada.Streams.Stream_IO.Stream_Access;
begin
Ada.Streams.Stream_IO.Open
(File => Input,
Mode => Ada.Streams.Stream_IO.In_File,
Name => File_Name.To_UTF_8_String);
Stream := Ada.Streams.Stream_IO.Stream (Input);
while not Ada.Streams.Stream_IO.End_Of_File (Input) loop
if Is_Client then
Client_Message (Stream);
else
Server_Message (Stream);
end if;
end loop;
end Slim.Read_File;
|
with System;
with Interfaces; use Interfaces;
with System.Storage_Elements; use System.Storage_Elements;
with System.Machine_Code; use System.Machine_Code;
with Ada.Unchecked_Conversion;
package body Startup is
WDTCTL : Unsigned_16 with Import, Address => System'To_Address (16#0120#);
procedure Ada_Init with Import => True, Convention => C, External_Name => "adainit";
procedure Ada_Main with Import => True, Convention => C, External_Name => "_ada_main";
procedure Default_Handler with Export => True, External_Name => "Default_Handler";
pragma Machine_Attribute (Entity => Default_Handler, Attribute_Name => "interrupt");
procedure Default_Handler is
begin
Asm ("bic.b #0xF8, 0(SP)", Volatile => True);
end Default_Handler;
procedure Reset_Handler is
Sdata : Storage_Element
with Import, Convention => Asm, External_Name => "__data_start";
Edata : Storage_Element
with Import, Convention => Asm, External_Name => "__data_end";
Sbss : Storage_Element
with Import, Convention => Asm, External_Name => "__bss_start";
Ebss : Storage_Element
with Import, Convention => Asm, External_Name => "__bss_end";
Data_Size : constant Storage_Offset := Edata'Address - Sdata'Address;
-- Index from 1 so as to avoid subtracting 1 from the size
Data_In_Flash : Storage_Array (1 .. Data_Size)
with Import, Convention => Asm, External_Name => "__data_load";
Data_In_Sram : Storage_Array (1 .. Data_Size)
with Import, Convention => Asm, External_Name => "__data_start";
Bss_Size : constant Storage_Offset := Ebss'Address - Sbss'Address;
Bss : Storage_Array (1 .. Bss_Size)
with Import, Convention => Ada, External_Name => "__bss_start";
begin
Asm ("mov #__stack_end, sp", Volatile => True);
WDTCTL := 16#5A80#;
-- Data_In_Sram := Data_In_Flash;
-- Bss := (others => 0);
Ada_Init;
Ada_Main;
end Reset_Handler;
Vectors : constant array (0 .. 15) of System.Address := (
Default_Handler'Address,
Default_Handler'Address,
Default_Handler'Address,
Default_Handler'Address,
Default_Handler'Address,
Default_Handler'Address,
Default_Handler'Address,
Default_Handler'Address,
Default_Handler'Address,
Default_Handler'Address,
Default_Handler'Address,
Default_Handler'Address,
Default_Handler'Address,
Default_Handler'Address,
Default_Handler'Address,
Reset_Handler'Address)
with Export => True;
pragma Linker_Section (Vectors, ".vectors");
end Startup;
|
-- Copyright (c) 2013, Nordic Semiconductor ASA
-- 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 Nordic Semiconductor ASA nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--
-- This spec has been automatically generated from nrf51.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package NRF51_SVD.POWER is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Enable interrupt on POFWARN event.
type INTENSET_POFWARN_Field is
(
-- Interrupt disabled.
Disabled,
-- Interrupt enabled.
Enabled)
with Size => 1;
for INTENSET_POFWARN_Field use
(Disabled => 0,
Enabled => 1);
-- Enable interrupt on POFWARN event.
type INTENSET_POFWARN_Field_1 is
(
-- Reset value for the field
Intenset_Pofwarn_Field_Reset,
-- Enable interrupt on write.
Set)
with Size => 1;
for INTENSET_POFWARN_Field_1 use
(Intenset_Pofwarn_Field_Reset => 0,
Set => 1);
-- Interrupt enable set register.
type INTENSET_Register is record
-- unspecified
Reserved_0_1 : HAL.UInt2 := 16#0#;
-- Enable interrupt on POFWARN event.
POFWARN : INTENSET_POFWARN_Field_1 :=
Intenset_Pofwarn_Field_Reset;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for INTENSET_Register use record
Reserved_0_1 at 0 range 0 .. 1;
POFWARN at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
-- Disable interrupt on POFWARN event.
type INTENCLR_POFWARN_Field is
(
-- Interrupt disabled.
Disabled,
-- Interrupt enabled.
Enabled)
with Size => 1;
for INTENCLR_POFWARN_Field use
(Disabled => 0,
Enabled => 1);
-- Disable interrupt on POFWARN event.
type INTENCLR_POFWARN_Field_1 is
(
-- Reset value for the field
Intenclr_Pofwarn_Field_Reset,
-- Disable interrupt on write.
Clear)
with Size => 1;
for INTENCLR_POFWARN_Field_1 use
(Intenclr_Pofwarn_Field_Reset => 0,
Clear => 1);
-- Interrupt enable clear register.
type INTENCLR_Register is record
-- unspecified
Reserved_0_1 : HAL.UInt2 := 16#0#;
-- Disable interrupt on POFWARN event.
POFWARN : INTENCLR_POFWARN_Field_1 :=
Intenclr_Pofwarn_Field_Reset;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for INTENCLR_Register use record
Reserved_0_1 at 0 range 0 .. 1;
POFWARN at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
-- Reset from pin-reset detected.
type RESETREAS_RESETPIN_Field is
(
-- Reset not detected.
Notdetected,
-- Reset detected.
Detected)
with Size => 1;
for RESETREAS_RESETPIN_Field use
(Notdetected => 0,
Detected => 1);
-- Reset from watchdog detected.
type RESETREAS_DOG_Field is
(
-- Reset not detected.
Notdetected,
-- Reset detected.
Detected)
with Size => 1;
for RESETREAS_DOG_Field use
(Notdetected => 0,
Detected => 1);
-- Reset from AIRCR.SYSRESETREQ detected.
type RESETREAS_SREQ_Field is
(
-- Reset not detected.
Notdetected,
-- Reset detected.
Detected)
with Size => 1;
for RESETREAS_SREQ_Field use
(Notdetected => 0,
Detected => 1);
-- Reset from CPU lock-up detected.
type RESETREAS_LOCKUP_Field is
(
-- Reset not detected.
Notdetected,
-- Reset detected.
Detected)
with Size => 1;
for RESETREAS_LOCKUP_Field use
(Notdetected => 0,
Detected => 1);
-- Reset from wake-up from OFF mode detected by the use of DETECT signal
-- from GPIO.
type RESETREAS_OFF_Field is
(
-- Reset not detected.
Notdetected,
-- Reset detected.
Detected)
with Size => 1;
for RESETREAS_OFF_Field use
(Notdetected => 0,
Detected => 1);
-- Reset from wake-up from OFF mode detected by the use of ANADETECT signal
-- from LPCOMP.
type RESETREAS_LPCOMP_Field is
(
-- Reset not detected.
Notdetected,
-- Reset detected.
Detected)
with Size => 1;
for RESETREAS_LPCOMP_Field use
(Notdetected => 0,
Detected => 1);
-- Reset from wake-up from OFF mode detected by entering into debug
-- interface mode.
type RESETREAS_DIF_Field is
(
-- Reset not detected.
Notdetected,
-- Reset detected.
Detected)
with Size => 1;
for RESETREAS_DIF_Field use
(Notdetected => 0,
Detected => 1);
-- Reset reason.
type RESETREAS_Register is record
-- Reset from pin-reset detected.
RESETPIN : RESETREAS_RESETPIN_Field :=
NRF51_SVD.POWER.Notdetected;
-- Reset from watchdog detected.
DOG : RESETREAS_DOG_Field := NRF51_SVD.POWER.Notdetected;
-- Reset from AIRCR.SYSRESETREQ detected.
SREQ : RESETREAS_SREQ_Field := NRF51_SVD.POWER.Notdetected;
-- Reset from CPU lock-up detected.
LOCKUP : RESETREAS_LOCKUP_Field := NRF51_SVD.POWER.Notdetected;
-- unspecified
Reserved_4_15 : HAL.UInt12 := 16#0#;
-- Reset from wake-up from OFF mode detected by the use of DETECT signal
-- from GPIO.
OFF : RESETREAS_OFF_Field := NRF51_SVD.POWER.Notdetected;
-- Reset from wake-up from OFF mode detected by the use of ANADETECT
-- signal from LPCOMP.
LPCOMP : RESETREAS_LPCOMP_Field := NRF51_SVD.POWER.Notdetected;
-- Reset from wake-up from OFF mode detected by entering into debug
-- interface mode.
DIF : RESETREAS_DIF_Field := NRF51_SVD.POWER.Notdetected;
-- unspecified
Reserved_19_31 : HAL.UInt13 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RESETREAS_Register use record
RESETPIN at 0 range 0 .. 0;
DOG at 0 range 1 .. 1;
SREQ at 0 range 2 .. 2;
LOCKUP at 0 range 3 .. 3;
Reserved_4_15 at 0 range 4 .. 15;
OFF at 0 range 16 .. 16;
LPCOMP at 0 range 17 .. 17;
DIF at 0 range 18 .. 18;
Reserved_19_31 at 0 range 19 .. 31;
end record;
-- RAM block 0 status.
type RAMSTATUS_RAMBLOCK0_Field is
(
-- RAM block 0 is off or powering up.
Off,
-- RAM block 0 is on.
On)
with Size => 1;
for RAMSTATUS_RAMBLOCK0_Field use
(Off => 0,
On => 1);
-- RAM block 1 status.
type RAMSTATUS_RAMBLOCK1_Field is
(
-- RAM block 1 is off or powering up.
Off,
-- RAM block 1 is on.
On)
with Size => 1;
for RAMSTATUS_RAMBLOCK1_Field use
(Off => 0,
On => 1);
-- RAM block 2 status.
type RAMSTATUS_RAMBLOCK2_Field is
(
-- RAM block 2 is off or powering up.
Off,
-- RAM block 2 is on.
On)
with Size => 1;
for RAMSTATUS_RAMBLOCK2_Field use
(Off => 0,
On => 1);
-- RAM block 3 status.
type RAMSTATUS_RAMBLOCK3_Field is
(
-- RAM block 3 is off or powering up.
Off,
-- RAM block 3 is on.
On)
with Size => 1;
for RAMSTATUS_RAMBLOCK3_Field use
(Off => 0,
On => 1);
-- Ram status register.
type RAMSTATUS_Register is record
-- Read-only. RAM block 0 status.
RAMBLOCK0 : RAMSTATUS_RAMBLOCK0_Field;
-- Read-only. RAM block 1 status.
RAMBLOCK1 : RAMSTATUS_RAMBLOCK1_Field;
-- Read-only. RAM block 2 status.
RAMBLOCK2 : RAMSTATUS_RAMBLOCK2_Field;
-- Read-only. RAM block 3 status.
RAMBLOCK3 : RAMSTATUS_RAMBLOCK3_Field;
-- unspecified
Reserved_4_31 : HAL.UInt28;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RAMSTATUS_Register use record
RAMBLOCK0 at 0 range 0 .. 0;
RAMBLOCK1 at 0 range 1 .. 1;
RAMBLOCK2 at 0 range 2 .. 2;
RAMBLOCK3 at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-- Enter system off mode.
type SYSTEMOFF_SYSTEMOFF_Field is
(
-- Reset value for the field
Systemoff_Systemoff_Field_Reset,
-- Enter system off mode.
Enter)
with Size => 1;
for SYSTEMOFF_SYSTEMOFF_Field use
(Systemoff_Systemoff_Field_Reset => 0,
Enter => 1);
-- System off register.
type SYSTEMOFF_Register is record
-- Write-only. Enter system off mode.
SYSTEMOFF : SYSTEMOFF_SYSTEMOFF_Field :=
Systemoff_Systemoff_Field_Reset;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SYSTEMOFF_Register use record
SYSTEMOFF at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- Power failure comparator enable.
type POFCON_POF_Field is
(
-- Disabled.
Disabled,
-- Enabled.
Enabled)
with Size => 1;
for POFCON_POF_Field use
(Disabled => 0,
Enabled => 1);
-- Set threshold level.
type POFCON_THRESHOLD_Field is
(
-- Set threshold to 2.1Volts.
V21,
-- Set threshold to 2.3Volts.
V23,
-- Set threshold to 2.5Volts.
V25,
-- Set threshold to 2.7Volts.
V27)
with Size => 2;
for POFCON_THRESHOLD_Field use
(V21 => 0,
V23 => 1,
V25 => 2,
V27 => 3);
-- Power failure configuration.
type POFCON_Register is record
-- Power failure comparator enable.
POF : POFCON_POF_Field := NRF51_SVD.POWER.Disabled;
-- Set threshold level.
THRESHOLD : POFCON_THRESHOLD_Field := NRF51_SVD.POWER.V21;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for POFCON_Register use record
POF at 0 range 0 .. 0;
THRESHOLD at 0 range 1 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype GPREGRET_GPREGRET_Field is HAL.UInt8;
-- General purpose retention register. This register is a retained
-- register.
type GPREGRET_Register is record
-- General purpose retention register.
GPREGRET : GPREGRET_GPREGRET_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 GPREGRET_Register use record
GPREGRET at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- RAM block 0 behaviour in ON mode.
type RAMON_ONRAM0_Field is
(
-- RAM block 0 OFF in ON mode.
Ram0Off,
-- RAM block 0 ON in ON mode.
Ram0On)
with Size => 1;
for RAMON_ONRAM0_Field use
(Ram0Off => 0,
Ram0On => 1);
-- RAM block 1 behaviour in ON mode.
type RAMON_ONRAM1_Field is
(
-- RAM block 1 OFF in ON mode.
Ram1Off,
-- RAM block 1 ON in ON mode.
Ram1On)
with Size => 1;
for RAMON_ONRAM1_Field use
(Ram1Off => 0,
Ram1On => 1);
-- RAM block 0 behaviour in OFF mode.
type RAMON_OFFRAM0_Field is
(
-- RAM block 0 OFF in OFF mode.
Ram0Off,
-- RAM block 0 ON in OFF mode.
Ram0On)
with Size => 1;
for RAMON_OFFRAM0_Field use
(Ram0Off => 0,
Ram0On => 1);
-- RAM block 1 behaviour in OFF mode.
type RAMON_OFFRAM1_Field is
(
-- RAM block 1 OFF in OFF mode.
Ram1Off,
-- RAM block 1 ON in OFF mode.
Ram1On)
with Size => 1;
for RAMON_OFFRAM1_Field use
(Ram1Off => 0,
Ram1On => 1);
-- Ram on/off.
type RAMON_Register is record
-- RAM block 0 behaviour in ON mode.
ONRAM0 : RAMON_ONRAM0_Field := NRF51_SVD.POWER.Ram0On;
-- RAM block 1 behaviour in ON mode.
ONRAM1 : RAMON_ONRAM1_Field := NRF51_SVD.POWER.Ram1On;
-- unspecified
Reserved_2_15 : HAL.UInt14 := 16#0#;
-- RAM block 0 behaviour in OFF mode.
OFFRAM0 : RAMON_OFFRAM0_Field := NRF51_SVD.POWER.Ram0Off;
-- RAM block 1 behaviour in OFF mode.
OFFRAM1 : RAMON_OFFRAM1_Field := NRF51_SVD.POWER.Ram1Off;
-- unspecified
Reserved_18_31 : HAL.UInt14 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RAMON_Register use record
ONRAM0 at 0 range 0 .. 0;
ONRAM1 at 0 range 1 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
OFFRAM0 at 0 range 16 .. 16;
OFFRAM1 at 0 range 17 .. 17;
Reserved_18_31 at 0 range 18 .. 31;
end record;
-- Enable or disable pin reset in debug interface mode.
type RESET_RESET_Field is
(
-- Pin reset in debug interface mode disabled.
Disabled,
-- Pin reset in debug interface mode enabled.
Enabled)
with Size => 1;
for RESET_RESET_Field use
(Disabled => 0,
Enabled => 1);
-- Pin reset functionality configuration register. This register is a
-- retained register.
type RESET_Register is record
-- Enable or disable pin reset in debug interface mode.
RESET : RESET_RESET_Field := NRF51_SVD.POWER.Disabled;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RESET_Register use record
RESET at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- RAM block 2 behaviour in ON mode.
type RAMONB_ONRAM2_Field is
(
-- RAM block 2 OFF in ON mode.
Ram2Off,
-- RAM block 2 ON in ON mode.
Ram2On)
with Size => 1;
for RAMONB_ONRAM2_Field use
(Ram2Off => 0,
Ram2On => 1);
-- RAM block 3 behaviour in ON mode.
type RAMONB_ONRAM3_Field is
(
-- RAM block 33 OFF in ON mode.
Ram3Off,
-- RAM block 3 ON in ON mode.
Ram3On)
with Size => 1;
for RAMONB_ONRAM3_Field use
(Ram3Off => 0,
Ram3On => 1);
-- RAM block 2 behaviour in OFF mode.
type RAMONB_OFFRAM2_Field is
(
-- RAM block 2 OFF in OFF mode.
Ram2Off,
-- RAM block 2 ON in OFF mode.
Ram2On)
with Size => 1;
for RAMONB_OFFRAM2_Field use
(Ram2Off => 0,
Ram2On => 1);
-- RAM block 3 behaviour in OFF mode.
type RAMONB_OFFRAM3_Field is
(
-- RAM block 3 OFF in OFF mode.
Ram3Off,
-- RAM block 3 ON in OFF mode.
Ram3On)
with Size => 1;
for RAMONB_OFFRAM3_Field use
(Ram3Off => 0,
Ram3On => 1);
-- Ram on/off.
type RAMONB_Register is record
-- RAM block 2 behaviour in ON mode.
ONRAM2 : RAMONB_ONRAM2_Field := NRF51_SVD.POWER.Ram2On;
-- RAM block 3 behaviour in ON mode.
ONRAM3 : RAMONB_ONRAM3_Field := NRF51_SVD.POWER.Ram3On;
-- unspecified
Reserved_2_15 : HAL.UInt14 := 16#0#;
-- RAM block 2 behaviour in OFF mode.
OFFRAM2 : RAMONB_OFFRAM2_Field := NRF51_SVD.POWER.Ram2Off;
-- RAM block 3 behaviour in OFF mode.
OFFRAM3 : RAMONB_OFFRAM3_Field := NRF51_SVD.POWER.Ram3Off;
-- unspecified
Reserved_18_31 : HAL.UInt14 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RAMONB_Register use record
ONRAM2 at 0 range 0 .. 0;
ONRAM3 at 0 range 1 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
OFFRAM2 at 0 range 16 .. 16;
OFFRAM3 at 0 range 17 .. 17;
Reserved_18_31 at 0 range 18 .. 31;
end record;
-- Enable DCDC converter.
type DCDCEN_DCDCEN_Field is
(
-- DCDC converter disabled.
Disabled,
-- DCDC converter enabled.
Enabled)
with Size => 1;
for DCDCEN_DCDCEN_Field use
(Disabled => 0,
Enabled => 1);
-- DCDC converter enable configuration register.
type DCDCEN_Register is record
-- Enable DCDC converter.
DCDCEN : DCDCEN_DCDCEN_Field := NRF51_SVD.POWER.Disabled;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DCDCEN_Register use record
DCDCEN at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- DCDC power-up force off.
type DCDCFORCE_FORCEOFF_Field is
(
-- No force.
Noforce,
-- Force.
Force)
with Size => 1;
for DCDCFORCE_FORCEOFF_Field use
(Noforce => 0,
Force => 1);
-- DCDC power-up force on.
type DCDCFORCE_FORCEON_Field is
(
-- No force.
Noforce,
-- Force.
Force)
with Size => 1;
for DCDCFORCE_FORCEON_Field use
(Noforce => 0,
Force => 1);
-- DCDC power-up force register.
type DCDCFORCE_Register is record
-- DCDC power-up force off.
FORCEOFF : DCDCFORCE_FORCEOFF_Field := NRF51_SVD.POWER.Noforce;
-- DCDC power-up force on.
FORCEON : DCDCFORCE_FORCEON_Field := NRF51_SVD.POWER.Noforce;
-- unspecified
Reserved_2_31 : HAL.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DCDCFORCE_Register use record
FORCEOFF at 0 range 0 .. 0;
FORCEON at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Power Control.
type POWER_Peripheral is record
-- Enable constant latency mode.
TASKS_CONSTLAT : aliased HAL.UInt32;
-- Enable low power mode (variable latency).
TASKS_LOWPWR : aliased HAL.UInt32;
-- Power failure warning.
EVENTS_POFWARN : aliased HAL.UInt32;
-- Interrupt enable set register.
INTENSET : aliased INTENSET_Register;
-- Interrupt enable clear register.
INTENCLR : aliased INTENCLR_Register;
-- Reset reason.
RESETREAS : aliased RESETREAS_Register;
-- Ram status register.
RAMSTATUS : aliased RAMSTATUS_Register;
-- System off register.
SYSTEMOFF : aliased SYSTEMOFF_Register;
-- Power failure configuration.
POFCON : aliased POFCON_Register;
-- General purpose retention register. This register is a retained
-- register.
GPREGRET : aliased GPREGRET_Register;
-- Ram on/off.
RAMON : aliased RAMON_Register;
-- Pin reset functionality configuration register. This register is a
-- retained register.
RESET : aliased RESET_Register;
-- Ram on/off.
RAMONB : aliased RAMONB_Register;
-- DCDC converter enable configuration register.
DCDCEN : aliased DCDCEN_Register;
-- DCDC power-up force register.
DCDCFORCE : aliased DCDCFORCE_Register;
end record
with Volatile;
for POWER_Peripheral use record
TASKS_CONSTLAT at 16#78# range 0 .. 31;
TASKS_LOWPWR at 16#7C# range 0 .. 31;
EVENTS_POFWARN at 16#108# range 0 .. 31;
INTENSET at 16#304# range 0 .. 31;
INTENCLR at 16#308# range 0 .. 31;
RESETREAS at 16#400# range 0 .. 31;
RAMSTATUS at 16#428# range 0 .. 31;
SYSTEMOFF at 16#500# range 0 .. 31;
POFCON at 16#510# range 0 .. 31;
GPREGRET at 16#51C# range 0 .. 31;
RAMON at 16#524# range 0 .. 31;
RESET at 16#544# range 0 .. 31;
RAMONB at 16#554# range 0 .. 31;
DCDCEN at 16#578# range 0 .. 31;
DCDCFORCE at 16#A08# range 0 .. 31;
end record;
-- Power Control.
POWER_Periph : aliased POWER_Peripheral
with Import, Address => System'To_Address (16#40000000#);
end NRF51_SVD.POWER;
|
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Element_Vectors;
with Program.Elements.Definitions;
with Program.Lexical_Elements;
package Program.Elements.Variants is
pragma Pure (Program.Elements.Variants);
type Variant is
limited interface and Program.Elements.Definitions.Definition;
type Variant_Access is access all Variant'Class with Storage_Size => 0;
not overriding function Choices
(Self : Variant)
return not null Program.Element_Vectors.Element_Vector_Access
is abstract;
not overriding function Components
(Self : Variant)
return not null Program.Element_Vectors.Element_Vector_Access
is abstract;
type Variant_Text is limited interface;
type Variant_Text_Access is access all Variant_Text'Class
with Storage_Size => 0;
not overriding function To_Variant_Text
(Self : aliased in out Variant)
return Variant_Text_Access is abstract;
not overriding function When_Token
(Self : Variant_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Arrow_Token
(Self : Variant_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
type Variant_Vector is
limited interface and Program.Element_Vectors.Element_Vector;
type Variant_Vector_Access is access all Variant_Vector'Class
with Storage_Size => 0;
overriding function Element
(Self : Variant_Vector;
Index : Positive)
return not null Program.Elements.Element_Access is abstract
with Post'Class => Element'Result.Is_Variant;
function To_Variant
(Self : Variant_Vector'Class;
Index : Positive)
return not null Variant_Access is (Self.Element (Index).To_Variant);
end Program.Elements.Variants;
|
package Giza.Bitmap_Fonts.FreeSerifBoldItalic18pt7b is
Font : constant Giza.Font.Ref_Const;
private
FreeSerifBoldItalic18pt7bBitmaps : aliased constant Font_Bitmap := (
16#01#, 16#C0#, 16#7C#, 16#0F#, 16#81#, 16#F0#, 16#3E#, 16#07#, 16#80#,
16#F0#, 16#3C#, 16#07#, 16#80#, 16#E0#, 16#1C#, 16#03#, 16#00#, 16#60#,
16#0C#, 16#03#, 16#00#, 16#60#, 16#08#, 16#00#, 16#00#, 16#00#, 16#00#,
16#07#, 16#81#, 16#F8#, 16#3F#, 16#07#, 16#E0#, 16#78#, 16#00#, 16#38#,
16#1D#, 16#E0#, 16#F7#, 16#83#, 16#DC#, 16#0E#, 16#70#, 16#39#, 16#C0#,
16#E6#, 16#03#, 16#18#, 16#0C#, 16#40#, 16#23#, 16#01#, 16#80#, 16#00#,
16#38#, 16#60#, 16#07#, 16#0E#, 16#00#, 16#70#, 16#C0#, 16#06#, 16#1C#,
16#00#, 16#E1#, 16#C0#, 16#0E#, 16#38#, 16#01#, 16#C3#, 16#81#, 16#FF#,
16#FF#, 16#1F#, 16#FF#, 16#E1#, 16#FF#, 16#FE#, 16#03#, 16#86#, 16#00#,
16#30#, 16#E0#, 16#07#, 16#0E#, 16#00#, 16#71#, 16#C0#, 16#0E#, 16#1C#,
16#0F#, 16#FF#, 16#F8#, 16#FF#, 16#FF#, 16#0F#, 16#FF#, 16#F0#, 16#1C#,
16#30#, 16#01#, 16#87#, 16#00#, 16#38#, 16#70#, 16#03#, 16#0E#, 16#00#,
16#70#, 16#E0#, 16#07#, 16#0C#, 16#00#, 16#E1#, 16#C0#, 16#00#, 16#00#,
16#08#, 16#00#, 16#0C#, 16#00#, 16#7E#, 16#00#, 16#FF#, 16#C0#, 16#F1#,
16#70#, 16#71#, 16#9C#, 16#70#, 16#C6#, 16#38#, 16#43#, 16#1C#, 16#61#,
16#0F#, 16#30#, 16#87#, 16#D0#, 16#03#, 16#F8#, 16#00#, 16#FE#, 16#00#,
16#3F#, 16#80#, 16#0F#, 16#E0#, 16#03#, 16#F8#, 16#01#, 16#FC#, 16#00#,
16#DF#, 16#10#, 16#47#, 16#88#, 16#63#, 16#CC#, 16#31#, 16#E6#, 16#10#,
16#F3#, 16#98#, 16#71#, 16#CC#, 16#78#, 16#7E#, 16#78#, 16#07#, 16#F8#,
16#03#, 16#F0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#C0#,
16#18#, 16#01#, 16#FE#, 16#0F#, 16#00#, 16#7C#, 16#FF#, 16#C0#, 16#1F#,
16#0F#, 16#98#, 16#07#, 16#C1#, 16#06#, 16#00#, 16#F8#, 16#21#, 16#80#,
16#3E#, 16#04#, 16#30#, 16#07#, 16#C1#, 16#8C#, 16#00#, 16#F0#, 16#21#,
16#80#, 16#1E#, 16#0C#, 16#60#, 16#03#, 16#C1#, 16#0C#, 16#00#, 16#78#,
16#C3#, 16#03#, 16#C7#, 16#F8#, 16#61#, 16#FC#, 16#7C#, 16#18#, 16#7C#,
16#C0#, 16#06#, 16#1F#, 16#08#, 16#00#, 16#C7#, 16#C1#, 16#00#, 16#30#,
16#F0#, 16#20#, 16#06#, 16#3E#, 16#04#, 16#01#, 16#87#, 16#C1#, 16#00#,
16#30#, 16#F0#, 16#20#, 16#0C#, 16#1E#, 16#0C#, 16#03#, 16#03#, 16#C1#,
16#00#, 16#60#, 16#3C#, 16#C0#, 16#18#, 16#07#, 16#F8#, 16#03#, 16#00#,
16#7C#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#1F#, 16#F0#, 16#00#,
16#1E#, 16#38#, 16#00#, 16#0E#, 16#0E#, 16#00#, 16#0F#, 16#07#, 16#00#,
16#07#, 16#83#, 16#80#, 16#03#, 16#C3#, 16#80#, 16#01#, 16#E3#, 16#80#,
16#00#, 16#F7#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#3E#, 16#00#,
16#00#, 16#7F#, 16#0F#, 16#F0#, 16#E7#, 16#81#, 16#E0#, 16#E3#, 16#E0#,
16#E0#, 16#E1#, 16#F0#, 16#60#, 16#E0#, 16#7C#, 16#60#, 16#F0#, 16#3E#,
16#20#, 16#78#, 16#1F#, 16#B0#, 16#3C#, 16#07#, 16#F0#, 16#1F#, 16#03#,
16#F0#, 16#0F#, 16#80#, 16#FC#, 16#03#, 16#F0#, 16#7F#, 16#8D#, 16#FF#,
16#EF#, 16#FC#, 16#7F#, 16#E3#, 16#FC#, 16#0F#, 16#C0#, 16#78#, 16#00#,
16#3B#, 16#DE#, 16#E7#, 16#39#, 16#8C#, 16#46#, 16#00#, 16#00#, 16#60#,
16#18#, 16#06#, 16#01#, 16#80#, 16#60#, 16#1C#, 16#07#, 16#01#, 16#E0#,
16#38#, 16#0F#, 16#01#, 16#C0#, 16#38#, 16#0F#, 16#01#, 16#E0#, 16#38#,
16#07#, 16#00#, 16#E0#, 16#1C#, 16#03#, 16#80#, 16#70#, 16#0E#, 16#00#,
16#C0#, 16#18#, 16#03#, 16#00#, 16#60#, 16#06#, 16#00#, 16#C0#, 16#08#,
16#00#, 16#80#, 16#10#, 16#00#, 16#06#, 16#00#, 16#40#, 16#04#, 16#00#,
16#80#, 16#18#, 16#01#, 16#00#, 16#30#, 16#06#, 16#00#, 16#C0#, 16#1C#,
16#03#, 16#80#, 16#70#, 16#0E#, 16#01#, 16#C0#, 16#38#, 16#07#, 16#01#,
16#E0#, 16#3C#, 16#07#, 16#00#, 16#E0#, 16#3C#, 16#07#, 16#00#, 16#E0#,
16#38#, 16#06#, 16#01#, 16#C0#, 16#70#, 16#18#, 16#06#, 16#01#, 16#80#,
16#00#, 16#07#, 16#00#, 16#38#, 16#01#, 16#C1#, 16#8E#, 16#3E#, 16#23#,
16#F9#, 16#3F#, 16#EB#, 16#E0#, 16#E0#, 16#FF#, 16#F7#, 16#93#, 16#F8#,
16#9F#, 16#8E#, 16#60#, 16#70#, 16#03#, 16#80#, 16#08#, 16#00#, 16#01#,
16#C0#, 16#00#, 16#E0#, 16#00#, 16#70#, 16#00#, 16#38#, 16#00#, 16#1C#,
16#00#, 16#0E#, 16#00#, 16#07#, 16#01#, 16#FF#, 16#FF#, 16#FF#, 16#FF#,
16#FF#, 16#FF#, 16#C0#, 16#70#, 16#00#, 16#38#, 16#00#, 16#1C#, 16#00#,
16#0E#, 16#00#, 16#07#, 16#00#, 16#03#, 16#80#, 16#01#, 16#C0#, 16#00#,
16#1C#, 16#7C#, 16#F9#, 16#F1#, 16#E1#, 16#C3#, 16#0C#, 16#30#, 16#C2#,
16#00#, 16#7F#, 16#BF#, 16#FF#, 16#FF#, 16#E0#, 16#7B#, 16#FF#, 16#FF#,
16#78#, 16#00#, 16#1C#, 16#00#, 16#60#, 16#03#, 16#80#, 16#0C#, 16#00#,
16#70#, 16#01#, 16#C0#, 16#0E#, 16#00#, 16#38#, 16#01#, 16#C0#, 16#07#,
16#00#, 16#18#, 16#00#, 16#E0#, 16#03#, 16#00#, 16#1C#, 16#00#, 16#60#,
16#03#, 16#80#, 16#0C#, 16#00#, 16#70#, 16#01#, 16#C0#, 16#0E#, 16#00#,
16#38#, 16#01#, 16#C0#, 16#07#, 16#00#, 16#18#, 16#00#, 16#E0#, 16#00#,
16#00#, 16#F0#, 16#07#, 16#30#, 16#1C#, 16#30#, 16#78#, 16#60#, 16#E0#,
16#E3#, 16#C1#, 16#CF#, 16#83#, 16#9E#, 16#0F#, 16#3C#, 16#1E#, 16#F8#,
16#3D#, 16#E0#, 16#7B#, 16#C1#, 16#FF#, 16#83#, 16#FF#, 16#07#, 16#BC#,
16#0F#, 16#78#, 16#3E#, 16#F0#, 16#7D#, 16#E0#, 16#F3#, 16#81#, 16#E7#,
16#07#, 16#8E#, 16#0F#, 16#0C#, 16#3C#, 16#18#, 16#70#, 16#19#, 16#C0#,
16#1E#, 16#00#, 16#00#, 16#06#, 16#01#, 16#F8#, 16#1F#, 16#F0#, 16#03#,
16#E0#, 16#07#, 16#80#, 16#0F#, 16#00#, 16#3E#, 16#00#, 16#7C#, 16#00#,
16#F0#, 16#01#, 16#E0#, 16#07#, 16#C0#, 16#0F#, 16#00#, 16#1E#, 16#00#,
16#7C#, 16#00#, 16#F0#, 16#01#, 16#E0#, 16#07#, 16#C0#, 16#0F#, 16#80#,
16#1E#, 16#00#, 16#3C#, 16#00#, 16#F8#, 16#01#, 16#F0#, 16#03#, 16#E0#,
16#0F#, 16#C0#, 16#FF#, 16#F0#, 16#00#, 16#F8#, 16#01#, 16#FC#, 16#03#,
16#FE#, 16#06#, 16#3F#, 16#08#, 16#1F#, 16#18#, 16#0F#, 16#00#, 16#0F#,
16#00#, 16#0F#, 16#00#, 16#0F#, 16#00#, 16#0E#, 16#00#, 16#1E#, 16#00#,
16#1C#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#70#, 16#00#, 16#C0#,
16#01#, 16#80#, 16#03#, 16#00#, 16#06#, 16#02#, 16#0C#, 16#06#, 16#08#,
16#0C#, 16#1F#, 16#FC#, 16#3F#, 16#FC#, 16#7F#, 16#F8#, 16#FF#, 16#F8#,
16#00#, 16#F0#, 16#07#, 16#F8#, 16#1F#, 16#F0#, 16#61#, 16#F0#, 16#81#,
16#E0#, 16#03#, 16#C0#, 16#07#, 16#80#, 16#0E#, 16#00#, 16#3C#, 16#00#,
16#E0#, 16#07#, 16#C0#, 16#3F#, 16#C0#, 16#1F#, 16#80#, 16#0F#, 16#80#,
16#1F#, 16#00#, 16#1E#, 16#00#, 16#3C#, 16#00#, 16#78#, 16#00#, 16#F0#,
16#01#, 16#C0#, 16#07#, 16#9C#, 16#0E#, 16#3C#, 16#38#, 16#7F#, 16#E0#,
16#7E#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#70#, 16#00#, 16#3C#,
16#00#, 16#1E#, 16#00#, 16#0F#, 16#80#, 16#07#, 16#E0#, 16#02#, 16#F8#,
16#01#, 16#3C#, 16#00#, 16#9F#, 16#00#, 16#47#, 16#C0#, 16#31#, 16#E0#,
16#18#, 16#78#, 16#0C#, 16#3E#, 16#06#, 16#0F#, 16#83#, 16#03#, 16#C1#,
16#80#, 16#F0#, 16#7F#, 16#FF#, 16#1F#, 16#FF#, 16#CF#, 16#FF#, 16#F0#,
16#03#, 16#E0#, 16#00#, 16#F8#, 16#00#, 16#3C#, 16#00#, 16#0F#, 16#00#,
16#07#, 16#C0#, 16#01#, 16#FF#, 16#00#, 16#FF#, 16#80#, 16#FF#, 16#C0#,
16#7F#, 16#E0#, 16#60#, 16#00#, 16#30#, 16#00#, 16#10#, 16#00#, 16#1F#,
16#00#, 16#0F#, 16#E0#, 16#0F#, 16#F8#, 16#07#, 16#FE#, 16#00#, 16#3F#,
16#00#, 16#07#, 16#C0#, 16#01#, 16#E0#, 16#00#, 16#F0#, 16#00#, 16#38#,
16#00#, 16#1C#, 16#00#, 16#0E#, 16#00#, 16#06#, 16#00#, 16#03#, 16#00#,
16#03#, 16#87#, 16#83#, 16#83#, 16#E3#, 16#81#, 16#FF#, 16#80#, 16#3F#,
16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#0F#, 16#80#, 16#1F#, 16#00#,
16#3E#, 16#00#, 16#3E#, 16#00#, 16#3E#, 16#00#, 16#3E#, 16#00#, 16#3E#,
16#00#, 16#1F#, 16#00#, 16#1F#, 16#F0#, 16#1F#, 16#FE#, 16#0F#, 16#CF#,
16#07#, 16#C3#, 16#C7#, 16#E1#, 16#E3#, 16#E0#, 16#F1#, 16#F0#, 16#78#,
16#F8#, 16#3C#, 16#78#, 16#3E#, 16#3C#, 16#1F#, 16#1E#, 16#0F#, 16#0F#,
16#0F#, 16#83#, 16#87#, 16#81#, 16#E7#, 16#80#, 16#7F#, 16#80#, 16#0F#,
16#80#, 16#00#, 16#1F#, 16#FF#, 16#3F#, 16#FE#, 16#3F#, 16#FE#, 16#7F#,
16#FC#, 16#60#, 16#1C#, 16#80#, 16#38#, 16#80#, 16#30#, 16#00#, 16#70#,
16#00#, 16#60#, 16#00#, 16#E0#, 16#01#, 16#C0#, 16#01#, 16#C0#, 16#03#,
16#80#, 16#03#, 16#00#, 16#07#, 16#00#, 16#0E#, 16#00#, 16#0E#, 16#00#,
16#1C#, 16#00#, 16#1C#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#70#,
16#00#, 16#E0#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#F8#, 16#00#, 16#FF#,
16#00#, 16#E1#, 16#C0#, 16#E0#, 16#F0#, 16#F0#, 16#38#, 16#78#, 16#1C#,
16#3C#, 16#0E#, 16#1F#, 16#07#, 16#0F#, 16#87#, 16#07#, 16#E7#, 16#01#,
16#FF#, 16#00#, 16#7E#, 16#00#, 16#1F#, 16#80#, 16#3F#, 16#E0#, 16#73#,
16#F0#, 16#70#, 16#FC#, 16#70#, 16#3E#, 16#70#, 16#0F#, 16#38#, 16#07#,
16#9C#, 16#03#, 16#CE#, 16#01#, 16#E7#, 16#00#, 16#E1#, 16#C0#, 16#E0#,
16#70#, 16#E0#, 16#0F#, 16#C0#, 16#00#, 16#00#, 16#F8#, 16#01#, 16#FF#,
16#01#, 16#F3#, 16#C1#, 16#F0#, 16#E1#, 16#F0#, 16#70#, 16#F0#, 16#3C#,
16#F8#, 16#1E#, 16#7C#, 16#0F#, 16#3C#, 16#0F#, 16#9E#, 16#07#, 16#CF#,
16#03#, 16#E7#, 16#83#, 16#F3#, 16#C1#, 16#F0#, 16#F1#, 16#F8#, 16#3F#,
16#F8#, 16#0F#, 16#FC#, 16#00#, 16#7C#, 16#00#, 16#7C#, 16#00#, 16#7E#,
16#00#, 16#3E#, 16#00#, 16#3C#, 16#00#, 16#7C#, 16#00#, 16#7C#, 16#00#,
16#F0#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#07#, 16#83#, 16#F0#, 16#FC#,
16#3F#, 16#07#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#78#, 16#3F#, 16#0F#, 16#C3#, 16#F0#, 16#78#, 16#00#,
16#03#, 16#C0#, 16#FC#, 16#1F#, 16#83#, 16#F0#, 16#3C#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#03#, 16#C0#,
16#7C#, 16#0F#, 16#80#, 16#F0#, 16#0E#, 16#01#, 16#80#, 16#30#, 16#0C#,
16#03#, 16#01#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#30#,
16#00#, 16#7C#, 16#00#, 16#7F#, 16#00#, 16#7F#, 16#00#, 16#FF#, 16#00#,
16#FF#, 16#00#, 16#FE#, 16#00#, 16#FE#, 16#00#, 16#3E#, 16#00#, 16#0F#,
16#C0#, 16#01#, 16#FC#, 16#00#, 16#1F#, 16#E0#, 16#01#, 16#FE#, 16#00#,
16#0F#, 16#E0#, 16#00#, 16#FF#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#F0#,
16#00#, 16#04#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FC#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#,
16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#F0#, 16#00#, 16#00#,
16#38#, 16#00#, 16#0F#, 16#80#, 16#03#, 16#F8#, 16#00#, 16#3F#, 16#80#,
16#03#, 16#FC#, 16#00#, 16#3F#, 16#C0#, 16#01#, 16#FC#, 16#00#, 16#1F#,
16#C0#, 16#01#, 16#F0#, 16#00#, 16#FC#, 16#00#, 16#FE#, 16#01#, 16#FE#,
16#01#, 16#FE#, 16#01#, 16#FC#, 16#03#, 16#FC#, 16#00#, 16#FC#, 16#00#,
16#38#, 16#00#, 16#08#, 16#00#, 16#00#, 16#07#, 16#C0#, 16#FF#, 16#0E#,
16#3C#, 16#70#, 16#F3#, 16#C7#, 16#8C#, 16#3C#, 16#01#, 16#E0#, 16#1F#,
16#00#, 16#F0#, 16#07#, 16#80#, 16#78#, 16#07#, 16#80#, 16#30#, 16#03#,
16#00#, 16#10#, 16#01#, 16#80#, 16#08#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#07#, 16#80#, 16#7E#, 16#03#, 16#F0#, 16#1F#, 16#80#, 16#78#,
16#00#, 16#00#, 16#3F#, 16#80#, 16#00#, 16#FF#, 16#F8#, 16#01#, 16#F0#,
16#1E#, 16#01#, 16#E0#, 16#03#, 16#81#, 16#C0#, 16#00#, 16#E1#, 16#C0#,
16#18#, 16#38#, 16#E0#, 16#3F#, 16#CC#, 16#E0#, 16#3C#, 16#E7#, 16#70#,
16#3C#, 16#71#, 16#F0#, 16#1C#, 16#30#, 16#F8#, 16#1E#, 16#38#, 16#7C#,
16#0E#, 16#1C#, 16#3E#, 16#0F#, 16#0E#, 16#1F#, 16#07#, 16#0E#, 16#0F#,
16#83#, 16#87#, 16#0D#, 16#C1#, 16#C7#, 16#86#, 16#70#, 16#E5#, 16#C6#,
16#38#, 16#7C#, 16#FE#, 16#1C#, 16#1C#, 16#3E#, 16#07#, 16#00#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#00#, 16#78#, 16#00#, 16#40#, 16#1F#, 16#00#,
16#E0#, 16#03#, 16#FF#, 16#E0#, 16#00#, 16#3F#, 16#80#, 16#00#, 16#00#,
16#00#, 16#80#, 16#00#, 16#03#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#,
16#1C#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#F8#, 16#00#, 16#03#,
16#F0#, 16#00#, 16#07#, 16#E0#, 16#00#, 16#17#, 16#C0#, 16#00#, 16#67#,
16#80#, 16#00#, 16#8F#, 16#00#, 16#03#, 16#1F#, 16#00#, 16#0C#, 16#3E#,
16#00#, 16#10#, 16#7C#, 16#00#, 16#60#, 16#F8#, 16#00#, 16#81#, 16#F0#,
16#03#, 16#FF#, 16#E0#, 16#0F#, 16#FF#, 16#E0#, 16#18#, 16#07#, 16#C0#,
16#60#, 16#0F#, 16#81#, 16#C0#, 16#1F#, 16#03#, 16#00#, 16#3E#, 16#0E#,
16#00#, 16#7C#, 16#3C#, 16#00#, 16#FC#, 16#FE#, 16#0F#, 16#FE#, 16#07#,
16#FF#, 16#E0#, 16#01#, 16#FF#, 16#FC#, 16#01#, 16#F8#, 16#7E#, 16#01#,
16#F8#, 16#3F#, 16#01#, 16#F0#, 16#3F#, 16#01#, 16#F0#, 16#3F#, 16#01#,
16#F0#, 16#3F#, 16#03#, 16#E0#, 16#3F#, 16#03#, 16#E0#, 16#7E#, 16#03#,
16#E0#, 16#FC#, 16#03#, 16#E3#, 16#F0#, 16#07#, 16#FF#, 16#80#, 16#07#,
16#C3#, 16#E0#, 16#07#, 16#C1#, 16#F8#, 16#0F#, 16#C0#, 16#F8#, 16#0F#,
16#80#, 16#FC#, 16#0F#, 16#80#, 16#FC#, 16#0F#, 16#80#, 16#FC#, 16#1F#,
16#80#, 16#FC#, 16#1F#, 16#01#, 16#FC#, 16#1F#, 16#01#, 16#F8#, 16#1F#,
16#03#, 16#F0#, 16#3F#, 16#0F#, 16#E0#, 16#7F#, 16#FF#, 16#C0#, 16#FF#,
16#FE#, 16#00#, 16#00#, 16#1F#, 16#82#, 16#01#, 16#FF#, 16#E8#, 16#07#,
16#E0#, 16#F0#, 16#3F#, 16#80#, 16#E0#, 16#FE#, 16#00#, 16#C1#, 16#F8#,
16#01#, 16#87#, 16#E0#, 16#02#, 16#1F#, 16#80#, 16#04#, 16#3F#, 16#00#,
16#00#, 16#FC#, 16#00#, 16#01#, 16#F8#, 16#00#, 16#07#, 16#F0#, 16#00#,
16#0F#, 16#E0#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#3F#, 16#00#, 16#00#,
16#7E#, 16#00#, 16#00#, 16#FC#, 16#00#, 16#01#, 16#F8#, 16#00#, 16#03#,
16#F0#, 16#00#, 16#03#, 16#E0#, 16#01#, 16#07#, 16#E0#, 16#06#, 16#07#,
16#E0#, 16#18#, 16#07#, 16#E0#, 16#E0#, 16#07#, 16#FF#, 16#00#, 16#01#,
16#F8#, 16#00#, 16#07#, 16#FF#, 16#E0#, 16#01#, 16#FF#, 16#FE#, 16#00#,
16#1F#, 16#87#, 16#E0#, 16#07#, 16#E0#, 16#7C#, 16#01#, 16#F0#, 16#1F#,
16#80#, 16#7C#, 16#03#, 16#E0#, 16#1F#, 16#00#, 16#F8#, 16#0F#, 16#80#,
16#3F#, 16#03#, 16#E0#, 16#0F#, 16#C0#, 16#F8#, 16#03#, 16#F0#, 16#3E#,
16#00#, 16#FC#, 16#1F#, 16#00#, 16#3F#, 16#07#, 16#C0#, 16#0F#, 16#C1#,
16#F0#, 16#07#, 16#F0#, 16#FC#, 16#01#, 16#F8#, 16#3E#, 16#00#, 16#7E#,
16#0F#, 16#80#, 16#3F#, 16#83#, 16#E0#, 16#0F#, 16#C1#, 16#F8#, 16#07#,
16#F0#, 16#7C#, 16#01#, 16#F8#, 16#1F#, 16#00#, 16#FC#, 16#07#, 16#C0#,
16#7E#, 16#03#, 16#F0#, 16#7E#, 16#01#, 16#FF#, 16#FF#, 16#00#, 16#FF#,
16#FE#, 16#00#, 16#00#, 16#07#, 16#FF#, 16#FE#, 16#03#, 16#FF#, 16#FC#,
16#07#, 16#E0#, 16#78#, 16#0F#, 16#C0#, 16#60#, 16#1F#, 16#00#, 16#40#,
16#3E#, 16#00#, 16#80#, 16#7C#, 16#01#, 16#00#, 16#F8#, 16#10#, 16#03#,
16#E0#, 16#60#, 16#07#, 16#C3#, 16#80#, 16#0F#, 16#FF#, 16#00#, 16#3F#,
16#FE#, 16#00#, 16#7C#, 16#38#, 16#00#, 16#F8#, 16#30#, 16#01#, 16#F0#,
16#60#, 16#07#, 16#C0#, 16#80#, 16#0F#, 16#81#, 16#00#, 16#1F#, 16#00#,
16#10#, 16#7E#, 16#00#, 16#60#, 16#F8#, 16#01#, 16#C1#, 16#F0#, 16#07#,
16#03#, 16#E0#, 16#1E#, 16#0F#, 16#C0#, 16#FC#, 16#3F#, 16#FF#, 16#F8#,
16#FF#, 16#FF#, 16#E0#, 16#07#, 16#FF#, 16#FE#, 16#03#, 16#FF#, 16#FC#,
16#07#, 16#E0#, 16#78#, 16#0F#, 16#C0#, 16#60#, 16#1F#, 16#00#, 16#40#,
16#3E#, 16#00#, 16#80#, 16#7C#, 16#01#, 16#01#, 16#F8#, 16#20#, 16#03#,
16#E0#, 16#C0#, 16#07#, 16#C3#, 16#80#, 16#0F#, 16#FE#, 16#00#, 16#3F#,
16#FC#, 16#00#, 16#7C#, 16#38#, 16#00#, 16#F8#, 16#30#, 16#03#, 16#F0#,
16#60#, 16#07#, 16#C0#, 16#80#, 16#0F#, 16#81#, 16#00#, 16#1F#, 16#00#,
16#00#, 16#7E#, 16#00#, 16#00#, 16#F8#, 16#00#, 16#01#, 16#F0#, 16#00#,
16#03#, 16#E0#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#3F#, 16#80#, 16#00#,
16#FF#, 16#C0#, 16#00#, 16#00#, 16#1F#, 16#C2#, 16#00#, 16#FF#, 16#F6#,
16#01#, 16#F8#, 16#3C#, 16#03#, 16#E0#, 16#1C#, 16#0F#, 16#C0#, 16#0C#,
16#0F#, 16#C0#, 16#08#, 16#1F#, 16#80#, 16#08#, 16#3F#, 16#00#, 16#00#,
16#3F#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#,
16#7E#, 16#00#, 16#00#, 16#FE#, 16#00#, 16#00#, 16#FC#, 16#03#, 16#FF#,
16#FC#, 16#00#, 16#FC#, 16#FC#, 16#00#, 16#F8#, 16#FC#, 16#00#, 16#F8#,
16#FC#, 16#00#, 16#F8#, 16#FC#, 16#00#, 16#F0#, 16#7C#, 16#01#, 16#F0#,
16#7E#, 16#01#, 16#F0#, 16#3E#, 16#01#, 16#E0#, 16#1F#, 16#83#, 16#E0#,
16#0F#, 16#FF#, 16#80#, 16#01#, 16#FC#, 16#00#, 16#07#, 16#FF#, 16#3F#,
16#F8#, 16#0F#, 16#E0#, 16#7F#, 16#00#, 16#7E#, 16#01#, 16#F8#, 16#03#,
16#F0#, 16#0F#, 16#80#, 16#1F#, 16#00#, 16#7C#, 16#00#, 16#F8#, 16#07#,
16#E0#, 16#07#, 16#C0#, 16#3E#, 16#00#, 16#7E#, 16#01#, 16#F0#, 16#03#,
16#E0#, 16#0F#, 16#80#, 16#1F#, 16#00#, 16#F8#, 16#00#, 16#F8#, 16#07#,
16#C0#, 16#0F#, 16#FF#, 16#FE#, 16#00#, 16#7F#, 16#FF#, 16#F0#, 16#03#,
16#E0#, 16#1F#, 16#00#, 16#3F#, 16#00#, 16#F8#, 16#01#, 16#F0#, 16#07#,
16#C0#, 16#0F#, 16#80#, 16#7C#, 16#00#, 16#7C#, 16#03#, 16#E0#, 16#07#,
16#E0#, 16#1F#, 16#00#, 16#3E#, 16#00#, 16#F8#, 16#01#, 16#F0#, 16#0F#,
16#C0#, 16#0F#, 16#80#, 16#7C#, 16#00#, 16#FC#, 16#03#, 16#E0#, 16#0F#,
16#E0#, 16#3F#, 16#80#, 16#FF#, 16#C7#, 16#FF#, 16#00#, 16#07#, 16#FE#,
16#03#, 16#F8#, 16#07#, 16#E0#, 16#0F#, 16#C0#, 16#1F#, 16#00#, 16#3E#,
16#00#, 16#7C#, 16#01#, 16#F0#, 16#03#, 16#E0#, 16#07#, 16#C0#, 16#0F#,
16#80#, 16#3E#, 16#00#, 16#7C#, 16#00#, 16#F8#, 16#03#, 16#F0#, 16#07#,
16#C0#, 16#0F#, 16#80#, 16#1F#, 16#00#, 16#7C#, 16#00#, 16#F8#, 16#01#,
16#F0#, 16#03#, 16#E0#, 16#0F#, 16#C0#, 16#3F#, 16#80#, 16#FF#, 16#C0#,
16#00#, 16#3F#, 16#F0#, 16#01#, 16#FE#, 16#00#, 16#0F#, 16#C0#, 16#00#,
16#F8#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#F8#, 16#00#, 16#1F#, 16#80#,
16#01#, 16#F0#, 16#00#, 16#1F#, 16#00#, 16#01#, 16#F0#, 16#00#, 16#3E#,
16#00#, 16#03#, 16#E0#, 16#00#, 16#3E#, 16#00#, 16#07#, 16#E0#, 16#00#,
16#7C#, 16#00#, 16#07#, 16#C0#, 16#00#, 16#7C#, 16#00#, 16#0F#, 16#C0#,
16#00#, 16#F8#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#F8#, 16#00#, 16#1F#,
16#00#, 16#61#, 16#F0#, 16#0F#, 16#3F#, 16#00#, 16#E7#, 16#E0#, 16#07#,
16#FC#, 16#00#, 16#3F#, 16#00#, 16#00#, 16#07#, 16#FF#, 16#3F#, 16#80#,
16#FE#, 16#07#, 16#80#, 16#7E#, 16#03#, 16#00#, 16#3F#, 16#03#, 16#00#,
16#1F#, 16#03#, 16#00#, 16#0F#, 16#83#, 16#00#, 16#07#, 16#C3#, 16#00#,
16#07#, 16#E3#, 16#00#, 16#03#, 16#E3#, 16#00#, 16#01#, 16#F3#, 16#00#,
16#00#, 16#FB#, 16#80#, 16#00#, 16#FB#, 16#C0#, 16#00#, 16#7F#, 16#E0#,
16#00#, 16#3E#, 16#F8#, 16#00#, 16#3F#, 16#7C#, 16#00#, 16#1F#, 16#1F#,
16#00#, 16#0F#, 16#8F#, 16#80#, 16#07#, 16#C7#, 16#E0#, 16#07#, 16#E1#,
16#F0#, 16#03#, 16#E0#, 16#FC#, 16#01#, 16#F0#, 16#3E#, 16#00#, 16#F8#,
16#1F#, 16#00#, 16#FC#, 16#07#, 16#C0#, 16#FE#, 16#07#, 16#F0#, 16#FF#,
16#CF#, 16#FC#, 16#00#, 16#07#, 16#FF#, 16#00#, 16#07#, 16#F0#, 16#00#,
16#1F#, 16#80#, 16#00#, 16#7E#, 16#00#, 16#01#, 16#F0#, 16#00#, 16#07#,
16#C0#, 16#00#, 16#1F#, 16#00#, 16#00#, 16#78#, 16#00#, 16#03#, 16#E0#,
16#00#, 16#0F#, 16#80#, 16#00#, 16#3E#, 16#00#, 16#01#, 16#F0#, 16#00#,
16#07#, 16#C0#, 16#00#, 16#1F#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#03#,
16#E0#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#3E#, 16#00#, 16#11#, 16#F0#,
16#00#, 16#C7#, 16#C0#, 16#06#, 16#1F#, 16#00#, 16#38#, 16#7C#, 16#01#,
16#E3#, 16#F0#, 16#3F#, 16#9F#, 16#FF#, 16#FC#, 16#FF#, 16#FF#, 16#F0#,
16#07#, 16#F8#, 16#00#, 16#3F#, 16#80#, 16#FC#, 16#00#, 16#3F#, 16#80#,
16#3E#, 16#00#, 16#3F#, 16#80#, 16#1F#, 16#00#, 16#1F#, 16#80#, 16#1F#,
16#80#, 16#1F#, 16#C0#, 16#0F#, 16#E0#, 16#1B#, 16#E0#, 16#07#, 16#F0#,
16#0D#, 16#F0#, 16#02#, 16#F8#, 16#0D#, 16#F0#, 16#03#, 16#7C#, 16#04#,
16#F8#, 16#01#, 16#BE#, 16#06#, 16#7C#, 16#00#, 16#DF#, 16#06#, 16#7C#,
16#00#, 16#CF#, 16#82#, 16#3E#, 16#00#, 16#67#, 16#C3#, 16#1F#, 16#00#,
16#33#, 16#E3#, 16#0F#, 16#80#, 16#10#, 16#F9#, 16#8F#, 16#80#, 16#18#,
16#7D#, 16#87#, 16#C0#, 16#0C#, 16#3F#, 16#83#, 16#E0#, 16#06#, 16#1F#,
16#C1#, 16#F0#, 16#06#, 16#0F#, 16#C1#, 16#F0#, 16#03#, 16#07#, 16#C0#,
16#F8#, 16#01#, 16#83#, 16#E0#, 16#7C#, 16#01#, 16#C0#, 16#E0#, 16#7E#,
16#00#, 16#E0#, 16#60#, 16#3F#, 16#00#, 16#F8#, 16#30#, 16#3F#, 16#80#,
16#FF#, 16#10#, 16#7F#, 16#F0#, 16#00#, 16#07#, 16#F0#, 16#0F#, 16#E0#,
16#3E#, 16#00#, 16#78#, 16#07#, 16#E0#, 16#06#, 16#00#, 16#7C#, 16#00#,
16#C0#, 16#0F#, 16#C0#, 16#10#, 16#03#, 16#F8#, 16#06#, 16#00#, 16#6F#,
16#80#, 16#C0#, 16#09#, 16#F0#, 16#10#, 16#03#, 16#3F#, 16#02#, 16#00#,
16#63#, 16#E0#, 16#C0#, 16#0C#, 16#7E#, 16#18#, 16#03#, 16#07#, 16#C2#,
16#00#, 16#60#, 16#FC#, 16#40#, 16#0C#, 16#0F#, 16#98#, 16#01#, 16#01#,
16#F3#, 16#00#, 16#60#, 16#3F#, 16#40#, 16#0C#, 16#03#, 16#F8#, 16#01#,
16#80#, 16#7F#, 16#00#, 16#60#, 16#07#, 16#C0#, 16#0C#, 16#00#, 16#F8#,
16#01#, 16#80#, 16#0F#, 16#00#, 16#70#, 16#01#, 16#E0#, 16#0E#, 16#00#,
16#18#, 16#03#, 16#E0#, 16#03#, 16#00#, 16#02#, 16#00#, 16#60#, 16#00#,
16#00#, 16#1F#, 16#C0#, 16#00#, 16#FF#, 16#C0#, 16#07#, 16#C3#, 16#E0#,
16#1F#, 16#03#, 16#C0#, 16#7C#, 16#03#, 16#C1#, 16#F0#, 16#07#, 16#87#,
16#E0#, 16#0F#, 16#8F#, 16#80#, 16#1F#, 16#3F#, 16#00#, 16#3E#, 16#7C#,
16#00#, 16#7D#, 16#F8#, 16#01#, 16#FB#, 16#E0#, 16#03#, 16#F7#, 16#C0#,
16#07#, 16#DF#, 16#80#, 16#1F#, 16#BF#, 16#00#, 16#3F#, 16#7C#, 16#00#,
16#7C#, 16#F8#, 16#01#, 16#F9#, 16#F0#, 16#03#, 16#E3#, 16#E0#, 16#0F#,
16#C7#, 16#C0#, 16#1F#, 16#07#, 16#80#, 16#7C#, 16#0F#, 16#81#, 16#F0#,
16#0F#, 16#87#, 16#C0#, 16#0F#, 16#FE#, 16#00#, 16#07#, 16#F0#, 16#00#,
16#07#, 16#FF#, 16#E0#, 16#03#, 16#FF#, 16#F0#, 16#07#, 16#E3#, 16#F0#,
16#0F#, 16#83#, 16#E0#, 16#1F#, 16#07#, 16#E0#, 16#3E#, 16#0F#, 16#C0#,
16#7C#, 16#1F#, 16#81#, 16#F0#, 16#3F#, 16#03#, 16#E0#, 16#FE#, 16#07#,
16#C1#, 16#F8#, 16#0F#, 16#87#, 16#F0#, 16#3E#, 16#1F#, 16#C0#, 16#7F#,
16#FE#, 16#00#, 16#FF#, 16#F0#, 16#03#, 16#E0#, 16#00#, 16#07#, 16#C0#,
16#00#, 16#0F#, 16#80#, 16#00#, 16#1F#, 16#00#, 16#00#, 16#7C#, 16#00#,
16#00#, 16#F8#, 16#00#, 16#01#, 16#F0#, 16#00#, 16#03#, 16#E0#, 16#00#,
16#0F#, 16#C0#, 16#00#, 16#3F#, 16#80#, 16#00#, 16#FF#, 16#C0#, 16#00#,
16#00#, 16#1F#, 16#C0#, 16#00#, 16#FF#, 16#C0#, 16#07#, 16#C3#, 16#E0#,
16#1F#, 16#03#, 16#C0#, 16#7C#, 16#03#, 16#C1#, 16#F0#, 16#07#, 16#87#,
16#E0#, 16#0F#, 16#8F#, 16#80#, 16#1F#, 16#3F#, 16#00#, 16#3E#, 16#7C#,
16#00#, 16#7D#, 16#F8#, 16#01#, 16#FB#, 16#F0#, 16#03#, 16#F7#, 16#C0#,
16#07#, 16#DF#, 16#80#, 16#0F#, 16#BF#, 16#00#, 16#3F#, 16#7C#, 16#00#,
16#7C#, 16#F8#, 16#01#, 16#F9#, 16#F0#, 16#03#, 16#E3#, 16#E0#, 16#07#,
16#C7#, 16#C0#, 16#1F#, 16#07#, 16#80#, 16#7C#, 16#0F#, 16#01#, 16#F0#,
16#0F#, 16#07#, 16#80#, 16#07#, 16#FE#, 16#00#, 16#03#, 16#80#, 16#00#,
16#0C#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#20#, 16#FF#, 16#C1#, 16#87#,
16#FF#, 16#FE#, 16#1E#, 16#FF#, 16#F8#, 16#00#, 16#1F#, 16#C0#, 16#00#,
16#07#, 16#FF#, 16#E0#, 16#01#, 16#FF#, 16#FC#, 16#01#, 16#F8#, 16#7E#,
16#01#, 16#F8#, 16#3F#, 16#01#, 16#F8#, 16#3F#, 16#01#, 16#F0#, 16#3F#,
16#01#, 16#F0#, 16#3F#, 16#03#, 16#F0#, 16#3F#, 16#03#, 16#E0#, 16#7E#,
16#03#, 16#E0#, 16#FE#, 16#03#, 16#E1#, 16#F8#, 16#07#, 16#FF#, 16#F0#,
16#07#, 16#FF#, 16#80#, 16#07#, 16#DF#, 16#C0#, 16#0F#, 16#CF#, 16#C0#,
16#0F#, 16#8F#, 16#C0#, 16#0F#, 16#8F#, 16#E0#, 16#0F#, 16#87#, 16#E0#,
16#1F#, 16#87#, 16#E0#, 16#1F#, 16#07#, 16#F0#, 16#1F#, 16#03#, 16#F0#,
16#1F#, 16#03#, 16#F0#, 16#3F#, 16#01#, 16#F8#, 16#7F#, 16#01#, 16#F8#,
16#FF#, 16#E1#, 16#FE#, 16#00#, 16#F8#, 16#40#, 16#FF#, 16#B0#, 16#38#,
16#3C#, 16#1C#, 16#07#, 16#0F#, 16#01#, 16#C3#, 16#C0#, 16#20#, 16#F0#,
16#08#, 16#3E#, 16#02#, 16#0F#, 16#C0#, 16#03#, 16#F8#, 16#00#, 16#7F#,
16#00#, 16#0F#, 16#E0#, 16#01#, 16#FC#, 16#00#, 16#3F#, 16#80#, 16#07#,
16#E0#, 16#00#, 16#FC#, 16#00#, 16#1F#, 16#00#, 16#03#, 16#C4#, 16#00#,
16#F1#, 16#00#, 16#3C#, 16#60#, 16#0F#, 16#38#, 16#07#, 16#8F#, 16#83#,
16#C2#, 16#3F#, 16#E0#, 16#83#, 16#F0#, 16#00#, 16#3F#, 16#FF#, 16#F9#,
16#FF#, 16#FF#, 16#CF#, 16#1F#, 16#1E#, 16#70#, 16#F8#, 16#77#, 16#07#,
16#83#, 16#30#, 16#7C#, 16#09#, 16#03#, 16#E0#, 16#40#, 16#1E#, 16#02#,
16#01#, 16#F0#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#7C#, 16#00#, 16#07#,
16#C0#, 16#00#, 16#3E#, 16#00#, 16#01#, 16#F0#, 16#00#, 16#0F#, 16#00#,
16#00#, 16#F8#, 16#00#, 16#07#, 16#C0#, 16#00#, 16#3E#, 16#00#, 16#03#,
16#E0#, 16#00#, 16#1F#, 16#00#, 16#00#, 16#F8#, 16#00#, 16#07#, 16#C0#,
16#00#, 16#7E#, 16#00#, 16#07#, 16#F0#, 16#00#, 16#FF#, 16#F0#, 16#00#,
16#7F#, 16#F0#, 16#FF#, 16#1F#, 16#C0#, 16#3E#, 16#1F#, 16#80#, 16#1C#,
16#1F#, 16#80#, 16#18#, 16#1F#, 16#00#, 16#18#, 16#1F#, 16#00#, 16#18#,
16#1F#, 16#00#, 16#30#, 16#3E#, 16#00#, 16#30#, 16#3E#, 16#00#, 16#30#,
16#3E#, 16#00#, 16#30#, 16#7E#, 16#00#, 16#60#, 16#7C#, 16#00#, 16#60#,
16#7C#, 16#00#, 16#60#, 16#7C#, 16#00#, 16#C0#, 16#7C#, 16#00#, 16#C0#,
16#F8#, 16#00#, 16#C0#, 16#F8#, 16#00#, 16#C0#, 16#F8#, 16#01#, 16#80#,
16#F8#, 16#01#, 16#80#, 16#F8#, 16#03#, 16#80#, 16#F8#, 16#03#, 16#00#,
16#7C#, 16#06#, 16#00#, 16#7E#, 16#1E#, 16#00#, 16#3F#, 16#F8#, 16#00#,
16#0F#, 16#E0#, 16#00#, 16#FF#, 16#E0#, 16#7F#, 16#3F#, 16#80#, 16#1C#,
16#1F#, 16#80#, 16#18#, 16#1F#, 16#80#, 16#18#, 16#1F#, 16#80#, 16#30#,
16#1F#, 16#80#, 16#30#, 16#0F#, 16#80#, 16#60#, 16#1F#, 16#80#, 16#40#,
16#0F#, 16#80#, 16#C0#, 16#0F#, 16#81#, 16#80#, 16#0F#, 16#81#, 16#00#,
16#0F#, 16#C3#, 16#00#, 16#0F#, 16#C6#, 16#00#, 16#0F#, 16#C4#, 16#00#,
16#07#, 16#CC#, 16#00#, 16#07#, 16#C8#, 16#00#, 16#07#, 16#D8#, 16#00#,
16#07#, 16#F0#, 16#00#, 16#07#, 16#E0#, 16#00#, 16#07#, 16#E0#, 16#00#,
16#03#, 16#C0#, 16#00#, 16#03#, 16#80#, 16#00#, 16#03#, 16#80#, 16#00#,
16#03#, 16#00#, 16#00#, 16#02#, 16#00#, 16#00#, 16#FF#, 16#CF#, 16#F8#,
16#7E#, 16#7F#, 16#07#, 16#E0#, 16#38#, 16#7C#, 16#07#, 16#80#, 16#60#,
16#F8#, 16#0F#, 16#00#, 16#81#, 16#F0#, 16#1E#, 16#03#, 16#03#, 16#E0#,
16#3E#, 16#04#, 16#07#, 16#E0#, 16#FC#, 16#18#, 16#0F#, 16#C1#, 16#F8#,
16#20#, 16#1F#, 16#87#, 16#F0#, 16#C0#, 16#1F#, 16#0B#, 16#E1#, 16#00#,
16#3E#, 16#37#, 16#C2#, 16#00#, 16#7C#, 16#4F#, 16#88#, 16#00#, 16#F9#,
16#9F#, 16#10#, 16#01#, 16#F2#, 16#1F#, 16#40#, 16#03#, 16#EC#, 16#3E#,
16#80#, 16#07#, 16#F0#, 16#7E#, 16#00#, 16#07#, 16#E0#, 16#FC#, 16#00#,
16#0F#, 16#81#, 16#F0#, 16#00#, 16#1F#, 16#03#, 16#E0#, 16#00#, 16#3C#,
16#07#, 16#80#, 16#00#, 16#78#, 16#07#, 16#00#, 16#00#, 16#E0#, 16#0C#,
16#00#, 16#00#, 16#C0#, 16#18#, 16#00#, 16#01#, 16#00#, 16#20#, 16#00#,
16#02#, 16#00#, 16#40#, 16#00#, 16#0F#, 16#FE#, 16#3F#, 16#81#, 16#FC#,
16#07#, 16#80#, 16#7C#, 16#03#, 16#00#, 16#3F#, 16#03#, 16#00#, 16#0F#,
16#83#, 16#80#, 16#07#, 16#C1#, 16#80#, 16#03#, 16#E1#, 16#80#, 16#00#,
16#F9#, 16#80#, 16#00#, 16#7D#, 16#80#, 16#00#, 16#3F#, 16#80#, 16#00#,
16#0F#, 16#80#, 16#00#, 16#07#, 16#C0#, 16#00#, 16#03#, 16#E0#, 16#00#,
16#01#, 16#F8#, 16#00#, 16#01#, 16#FC#, 16#00#, 16#00#, 16#BE#, 16#00#,
16#00#, 16#CF#, 16#80#, 16#00#, 16#C7#, 16#C0#, 16#00#, 16#C3#, 16#E0#,
16#00#, 16#C1#, 16#F0#, 16#00#, 16#C0#, 16#7C#, 16#00#, 16#E0#, 16#3E#,
16#00#, 16#E0#, 16#1F#, 16#00#, 16#F8#, 16#1F#, 16#E0#, 16#FF#, 16#1F#,
16#F8#, 16#00#, 16#FF#, 16#C3#, 16#F9#, 16#F8#, 16#07#, 16#87#, 16#C0#,
16#38#, 16#3E#, 16#01#, 16#81#, 16#F0#, 16#18#, 16#07#, 16#C0#, 16#80#,
16#3E#, 16#0C#, 16#01#, 16#F0#, 16#C0#, 16#07#, 16#C4#, 16#00#, 16#3E#,
16#60#, 16#01#, 16#F6#, 16#00#, 16#07#, 16#A0#, 16#00#, 16#3E#, 16#00#,
16#01#, 16#F0#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#FC#, 16#00#, 16#07#,
16#C0#, 16#00#, 16#3E#, 16#00#, 16#01#, 16#F0#, 16#00#, 16#1F#, 16#00#,
16#00#, 16#F8#, 16#00#, 16#07#, 16#C0#, 16#00#, 16#7E#, 16#00#, 16#07#,
16#F0#, 16#00#, 16#FF#, 16#F0#, 16#00#, 16#07#, 16#FF#, 16#F8#, 16#3F#,
16#FF#, 16#C3#, 16#E0#, 16#7E#, 16#1C#, 16#03#, 16#E0#, 16#C0#, 16#3E#,
16#0C#, 16#03#, 16#F0#, 16#40#, 16#3F#, 16#00#, 16#01#, 16#F0#, 16#00#,
16#1F#, 16#00#, 16#01#, 16#F8#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#F8#,
16#00#, 16#0F#, 16#C0#, 16#00#, 16#FC#, 16#00#, 16#07#, 16#C0#, 16#00#,
16#7C#, 16#00#, 16#07#, 16#E0#, 16#00#, 16#7E#, 16#00#, 16#83#, 16#E0#,
16#0C#, 16#3E#, 16#00#, 16#C3#, 16#F0#, 16#0E#, 16#1F#, 16#00#, 16#F1#,
16#F0#, 16#1F#, 16#9F#, 16#FF#, 16#F8#, 16#FF#, 16#FF#, 16#C0#, 16#01#,
16#FC#, 16#07#, 16#E0#, 16#3C#, 16#00#, 16#E0#, 16#03#, 16#80#, 16#0E#,
16#00#, 16#78#, 16#01#, 16#C0#, 16#07#, 16#00#, 16#1C#, 16#00#, 16#70#,
16#03#, 16#80#, 16#0E#, 16#00#, 16#38#, 16#00#, 16#E0#, 16#07#, 16#00#,
16#1C#, 16#00#, 16#70#, 16#01#, 16#C0#, 16#0F#, 16#00#, 16#38#, 16#00#,
16#E0#, 16#03#, 16#80#, 16#1E#, 16#00#, 16#70#, 16#01#, 16#C0#, 16#07#,
16#00#, 16#3C#, 16#00#, 16#FF#, 16#03#, 16#F8#, 16#00#, 16#E0#, 16#38#,
16#07#, 16#01#, 16#C0#, 16#70#, 16#0C#, 16#03#, 16#80#, 16#E0#, 16#38#,
16#07#, 16#01#, 16#C0#, 16#70#, 16#0C#, 16#03#, 16#80#, 16#E0#, 16#38#,
16#07#, 16#01#, 16#C0#, 16#70#, 16#0C#, 16#03#, 16#80#, 16#E0#, 16#38#,
16#07#, 16#01#, 16#C0#, 16#03#, 16#FC#, 16#0F#, 16#F0#, 16#03#, 16#80#,
16#0E#, 16#00#, 16#38#, 16#01#, 16#E0#, 16#07#, 16#00#, 16#1C#, 16#00#,
16#70#, 16#03#, 16#C0#, 16#0E#, 16#00#, 16#38#, 16#00#, 16#E0#, 16#07#,
16#80#, 16#1C#, 16#00#, 16#70#, 16#01#, 16#C0#, 16#0F#, 16#00#, 16#38#,
16#00#, 16#E0#, 16#03#, 16#80#, 16#0E#, 16#00#, 16#70#, 16#01#, 16#C0#,
16#07#, 16#00#, 16#1C#, 16#00#, 16#E0#, 16#03#, 16#80#, 16#FE#, 16#03#,
16#F8#, 16#00#, 16#03#, 16#C0#, 16#03#, 16#C0#, 16#07#, 16#E0#, 16#07#,
16#E0#, 16#0E#, 16#70#, 16#0E#, 16#70#, 16#1C#, 16#78#, 16#1C#, 16#38#,
16#3C#, 16#3C#, 16#38#, 16#1C#, 16#78#, 16#1E#, 16#70#, 16#0E#, 16#F0#,
16#0E#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FC#, 16#E1#,
16#E3#, 16#C1#, 16#C1#, 16#C0#, 16#C0#, 16#00#, 16#F7#, 16#80#, 16#FD#,
16#E0#, 16#7C#, 16#F0#, 16#3C#, 16#3C#, 16#1E#, 16#0F#, 16#0F#, 16#83#,
16#83#, 16#C1#, 16#E1#, 16#E0#, 16#78#, 16#78#, 16#1C#, 16#3E#, 16#0F#,
16#0F#, 16#03#, 16#C3#, 16#C1#, 16#F0#, 16#F0#, 16#FC#, 16#FE#, 16#6F#,
16#6F#, 16#F3#, 16#F1#, 16#F8#, 16#F8#, 16#3C#, 16#1C#, 16#00#, 16#01#,
16#E0#, 16#1F#, 16#C0#, 16#07#, 16#C0#, 16#07#, 16#C0#, 16#07#, 16#80#,
16#07#, 16#80#, 16#0F#, 16#80#, 16#0F#, 16#00#, 16#0F#, 16#00#, 16#0F#,
16#3C#, 16#1E#, 16#FE#, 16#1F#, 16#9F#, 16#1F#, 16#0F#, 16#1E#, 16#0F#,
16#3E#, 16#0F#, 16#3C#, 16#0F#, 16#3C#, 16#1F#, 16#78#, 16#1E#, 16#78#,
16#1E#, 16#78#, 16#3C#, 16#78#, 16#3C#, 16#F0#, 16#78#, 16#F0#, 16#F0#,
16#F1#, 16#E0#, 16#7F#, 16#C0#, 16#3F#, 16#00#, 16#01#, 16#F0#, 16#3F#,
16#C3#, 16#CE#, 16#3C#, 16#F3#, 16#C7#, 16#1E#, 16#01#, 16#E0#, 16#0F#,
16#00#, 16#F8#, 16#07#, 16#80#, 16#3C#, 16#01#, 16#E0#, 16#0F#, 16#03#,
16#78#, 16#31#, 16#E3#, 16#0F#, 16#F0#, 16#1E#, 16#00#, 16#00#, 16#1F#,
16#C0#, 16#00#, 16#F8#, 16#00#, 16#1F#, 16#00#, 16#03#, 16#E0#, 16#00#,
16#78#, 16#00#, 16#0F#, 16#00#, 16#03#, 16#E0#, 16#00#, 16#78#, 16#01#,
16#EF#, 16#00#, 16#7F#, 16#E0#, 16#3E#, 16#7C#, 16#07#, 16#8F#, 16#01#,
16#E1#, 16#E0#, 16#78#, 16#3C#, 16#0F#, 16#0F#, 16#83#, 16#C1#, 16#E0#,
16#78#, 16#3C#, 16#1E#, 16#0F#, 16#83#, 16#C1#, 16#F0#, 16#78#, 16#7C#,
16#0F#, 16#0F#, 16#91#, 16#E3#, 16#F6#, 16#3F#, 16#DF#, 16#83#, 16#F3#,
16#E0#, 16#3C#, 16#38#, 16#00#, 16#01#, 16#E0#, 16#3F#, 16#83#, 16#CE#,
16#3C#, 16#73#, 16#C3#, 16#9E#, 16#1D#, 16#E1#, 16#CF#, 16#1C#, 16#FB#,
16#C7#, 16#F8#, 16#3C#, 16#01#, 16#E0#, 16#0F#, 16#02#, 16#78#, 16#31#,
16#E3#, 16#0F#, 16#F0#, 16#1E#, 16#00#, 16#00#, 16#01#, 16#F0#, 16#00#,
16#1D#, 16#C0#, 16#01#, 16#CE#, 16#00#, 16#1C#, 16#70#, 16#01#, 16#E0#,
16#00#, 16#0F#, 16#00#, 16#00#, 16#78#, 16#00#, 16#07#, 16#80#, 16#00#,
16#3C#, 16#00#, 16#0F#, 16#FC#, 16#00#, 16#7F#, 16#E0#, 16#00#, 16#F0#,
16#00#, 16#07#, 16#80#, 16#00#, 16#3C#, 16#00#, 16#03#, 16#E0#, 16#00#,
16#1E#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#07#, 16#80#, 16#00#, 16#7C#,
16#00#, 16#03#, 16#C0#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#F0#, 16#00#,
16#07#, 16#80#, 16#00#, 16#78#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#1E#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#0F#, 16#00#, 16#0E#, 16#70#, 16#00#,
16#77#, 16#80#, 16#03#, 16#F8#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#00#,
16#FE#, 16#00#, 16#7F#, 16#FC#, 16#1F#, 16#1F#, 16#87#, 16#C3#, 16#C1#,
16#F0#, 16#78#, 16#3C#, 16#1F#, 16#07#, 16#83#, 16#E0#, 16#F0#, 16#F8#,
16#0E#, 16#3E#, 16#01#, 16#FF#, 16#80#, 16#3F#, 16#C0#, 16#0C#, 16#00#,
16#03#, 16#C0#, 16#00#, 16#7F#, 16#80#, 16#0F#, 16#FE#, 16#00#, 16#7F#,
16#F0#, 16#70#, 16#FF#, 16#1C#, 16#03#, 16#E3#, 16#80#, 16#3C#, 16#70#,
16#07#, 16#0F#, 16#03#, 16#E0#, 16#FF#, 16#F0#, 16#07#, 16#F0#, 16#00#,
16#1F#, 16#C0#, 16#03#, 16#E0#, 16#00#, 16#F0#, 16#00#, 16#F8#, 16#00#,
16#78#, 16#00#, 16#3C#, 16#00#, 16#1E#, 16#00#, 16#1E#, 16#00#, 16#0F#,
16#0E#, 16#07#, 16#9F#, 16#83#, 16#DF#, 16#C3#, 16#C9#, 16#E1#, 16#E8#,
16#F0#, 16#F8#, 16#F8#, 16#74#, 16#78#, 16#7C#, 16#3C#, 16#3E#, 16#3E#,
16#1E#, 16#1E#, 16#1F#, 16#0F#, 16#0F#, 16#0F#, 16#87#, 16#87#, 16#8B#,
16#C3#, 16#CB#, 16#E1#, 16#E9#, 16#E0#, 16#FC#, 16#F0#, 16#38#, 16#00#,
16#03#, 16#03#, 16#C1#, 16#E0#, 16#F0#, 16#30#, 16#00#, 16#00#, 16#00#,
16#07#, 16#3F#, 16#87#, 16#83#, 16#C1#, 16#E0#, 16#F0#, 16#F0#, 16#78#,
16#3C#, 16#1C#, 16#1E#, 16#0F#, 16#27#, 16#17#, 16#93#, 16#F1#, 16#F8#,
16#70#, 16#00#, 16#00#, 16#06#, 16#00#, 16#0F#, 16#00#, 16#0F#, 16#00#,
16#0F#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#06#, 16#00#, 16#FE#, 16#00#, 16#3E#, 16#00#, 16#3C#, 16#00#,
16#3C#, 16#00#, 16#3C#, 16#00#, 16#3C#, 16#00#, 16#78#, 16#00#, 16#78#,
16#00#, 16#78#, 16#00#, 16#70#, 16#00#, 16#F0#, 16#00#, 16#F0#, 16#00#,
16#F0#, 16#01#, 16#E0#, 16#01#, 16#E0#, 16#01#, 16#E0#, 16#01#, 16#E0#,
16#03#, 16#C0#, 16#E3#, 16#C0#, 16#E7#, 16#80#, 16#FF#, 16#00#, 16#7C#,
16#00#, 16#1F#, 16#C0#, 16#03#, 16#E0#, 16#00#, 16#F0#, 16#00#, 16#78#,
16#00#, 16#38#, 16#00#, 16#3C#, 16#00#, 16#1E#, 16#00#, 16#0F#, 16#00#,
16#0F#, 16#3F#, 16#87#, 16#87#, 16#83#, 16#C3#, 16#01#, 16#E3#, 16#01#,
16#E3#, 16#00#, 16#F3#, 16#00#, 16#7B#, 16#80#, 16#7B#, 16#C0#, 16#3F#,
16#E0#, 16#1E#, 16#F0#, 16#0F#, 16#78#, 16#0F#, 16#1E#, 16#07#, 16#8F#,
16#13#, 16#C7#, 16#93#, 16#E1#, 16#F9#, 16#E0#, 16#F8#, 16#F0#, 16#38#,
16#00#, 16#1F#, 16#C0#, 16#F8#, 16#1F#, 16#03#, 16#C0#, 16#78#, 16#1F#,
16#03#, 16#C0#, 16#78#, 16#0F#, 16#01#, 16#E0#, 16#78#, 16#0F#, 16#01#,
16#E0#, 16#38#, 16#0F#, 16#01#, 16#E0#, 16#3C#, 16#0F#, 16#01#, 16#E0#,
16#3C#, 16#8F#, 16#31#, 16#EC#, 16#3F#, 16#07#, 16#C0#, 16#70#, 16#00#,
16#01#, 16#87#, 16#07#, 16#0F#, 16#E7#, 16#E7#, 16#E0#, 16#F3#, 16#F9#,
16#F8#, 16#3D#, 16#9E#, 16#9E#, 16#0F#, 16#47#, 16#C7#, 16#83#, 16#A1#,
16#D1#, 16#E1#, 16#F8#, 16#F8#, 16#F0#, 16#7C#, 16#3C#, 16#3C#, 16#1F#,
16#0F#, 16#1F#, 16#07#, 16#87#, 16#C7#, 16#83#, 16#E1#, 16#E1#, 16#E0#,
16#F0#, 16#78#, 16#78#, 16#3C#, 16#1E#, 16#3C#, 16#1F#, 16#0F#, 16#0F#,
16#27#, 16#83#, 16#C3#, 16#D1#, 16#E0#, 16#F0#, 16#FC#, 16#F8#, 16#78#,
16#1C#, 16#00#, 16#01#, 16#8F#, 16#0F#, 16#E7#, 16#E0#, 16#F3#, 16#F8#,
16#3C#, 16#9E#, 16#0F#, 16#47#, 16#87#, 16#A3#, 16#C1#, 16#E8#, 16#F0#,
16#7C#, 16#3C#, 16#1E#, 16#1E#, 16#0F#, 16#87#, 16#83#, 16#E1#, 16#E0#,
16#F0#, 16#F8#, 16#3C#, 16#3C#, 16#1F#, 16#0F#, 16#27#, 16#83#, 16#D1#,
16#E0#, 16#FC#, 16#78#, 16#1C#, 16#00#, 16#01#, 16#F0#, 16#0E#, 16#30#,
16#38#, 16#70#, 16#F0#, 16#F3#, 16#C1#, 16#E7#, 16#83#, 16#DE#, 16#07#,
16#BC#, 16#1F#, 16#F8#, 16#3F#, 16#E0#, 16#7B#, 16#C0#, 16#F7#, 16#83#,
16#CF#, 16#07#, 16#9E#, 16#1E#, 16#1C#, 16#38#, 16#1C#, 16#E0#, 16#1F#,
16#00#, 16#00#, 16#E3#, 16#80#, 16#FD#, 16#F8#, 16#0F#, 16#FF#, 16#81#,
16#E8#, 16#F0#, 16#3E#, 16#1E#, 16#07#, 16#83#, 16#C0#, 16#F0#, 16#78#,
16#3E#, 16#1F#, 16#07#, 16#83#, 16#C0#, 16#F0#, 16#78#, 16#1E#, 16#1F#,
16#07#, 16#83#, 16#C0#, 16#F0#, 16#F8#, 16#1E#, 16#1E#, 16#03#, 16#C7#,
16#80#, 16#FF#, 16#E0#, 16#1E#, 16#F0#, 16#03#, 16#C0#, 16#00#, 16#F0#,
16#00#, 16#1E#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#F8#, 16#00#, 16#3F#,
16#C0#, 16#00#, 16#01#, 16#EF#, 16#07#, 16#FF#, 16#0F#, 16#1E#, 16#1E#,
16#1E#, 16#1E#, 16#1E#, 16#3C#, 16#1E#, 16#7C#, 16#3C#, 16#78#, 16#3C#,
16#78#, 16#3C#, 16#F0#, 16#7C#, 16#F0#, 16#78#, 16#F0#, 16#F8#, 16#F0#,
16#F8#, 16#F1#, 16#F0#, 16#FE#, 16#F0#, 16#7E#, 16#F0#, 16#39#, 16#E0#,
16#01#, 16#E0#, 16#01#, 16#E0#, 16#01#, 16#E0#, 16#03#, 16#C0#, 16#03#,
16#C0#, 16#1F#, 16#F8#, 16#03#, 16#9C#, 16#7F#, 16#7C#, 16#3D#, 16#F8#,
16#7A#, 16#E0#, 16#F8#, 16#03#, 16#E0#, 16#07#, 16#C0#, 16#0F#, 16#00#,
16#3E#, 16#00#, 16#7C#, 16#00#, 16#F0#, 16#01#, 16#E0#, 16#07#, 16#C0#,
16#0F#, 16#00#, 16#1E#, 16#00#, 16#7C#, 16#00#, 16#07#, 16#18#, 16#FF#,
16#C7#, 16#1C#, 16#70#, 16#63#, 16#81#, 16#1E#, 16#08#, 16#F8#, 16#07#,
16#E0#, 16#1F#, 16#00#, 16#7C#, 16#01#, 16#F0#, 16#07#, 16#84#, 16#3C#,
16#20#, 16#E1#, 16#87#, 16#1C#, 16#70#, 16#9E#, 16#00#, 16#00#, 16#80#,
16#60#, 16#30#, 16#1C#, 16#1F#, 16#1F#, 16#F7#, 16#FC#, 16#78#, 16#1E#,
16#07#, 16#83#, 16#C0#, 16#F0#, 16#3C#, 16#1F#, 16#07#, 16#81#, 16#E0#,
16#79#, 16#3C#, 16#4F#, 16#23#, 16#F0#, 16#FC#, 16#1C#, 16#00#, 16#0F#,
16#0F#, 16#3F#, 16#87#, 16#8F#, 16#83#, 16#C7#, 16#C1#, 16#E3#, 16#E1#,
16#E1#, 16#E0#, 16#F0#, 16#F0#, 16#78#, 16#F8#, 16#78#, 16#78#, 16#3C#,
16#3C#, 16#3E#, 16#1E#, 16#1F#, 16#1E#, 16#1F#, 16#0F#, 16#17#, 16#97#,
16#9B#, 16#CB#, 16#F9#, 16#F9#, 16#F8#, 16#F8#, 16#78#, 16#38#, 16#00#,
16#18#, 16#37#, 16#C3#, 16#DE#, 16#1E#, 16#78#, 16#73#, 16#C1#, 16#9E#,
16#08#, 16#F0#, 16#C7#, 16#84#, 16#3C#, 16#41#, 16#E4#, 16#0F#, 16#40#,
16#7C#, 16#03#, 16#C0#, 16#1C#, 16#00#, 16#C0#, 16#04#, 16#00#, 16#38#,
16#10#, 16#DF#, 16#06#, 16#3D#, 16#E0#, 16#C7#, 16#BC#, 16#38#, 16#73#,
16#C7#, 16#86#, 16#79#, 16#F0#, 16#8F#, 16#3E#, 16#11#, 16#EB#, 16#C4#,
16#3F#, 16#79#, 16#07#, 16#CF#, 16#60#, 16#F9#, 16#E8#, 16#1E#, 16#3E#,
16#03#, 16#87#, 16#80#, 16#70#, 16#F0#, 16#0C#, 16#0C#, 16#01#, 16#01#,
16#00#, 16#03#, 16#83#, 16#87#, 16#F1#, 16#F0#, 16#3C#, 16#F8#, 16#0F#,
16#60#, 16#03#, 16#D0#, 16#00#, 16#F8#, 16#00#, 16#1E#, 16#00#, 16#07#,
16#80#, 16#01#, 16#E0#, 16#00#, 16#78#, 16#00#, 16#1F#, 16#00#, 16#0F#,
16#C0#, 16#02#, 16#F1#, 16#39#, 16#3C#, 16#CF#, 16#CF#, 16#E3#, 16#E1#,
16#F0#, 16#70#, 16#38#, 16#00#, 16#01#, 16#83#, 16#07#, 16#E3#, 16#C1#,
16#F1#, 16#E0#, 16#78#, 16#F0#, 16#3E#, 16#18#, 16#1F#, 16#08#, 16#07#,
16#84#, 16#03#, 16#C6#, 16#01#, 16#E2#, 16#00#, 16#FB#, 16#00#, 16#3D#,
16#00#, 16#1F#, 16#80#, 16#0F#, 16#80#, 16#07#, 16#C0#, 16#03#, 16#C0#,
16#01#, 16#E0#, 16#00#, 16#E0#, 16#00#, 16#60#, 16#00#, 16#60#, 16#0E#,
16#60#, 16#0F#, 16#E0#, 16#07#, 16#E0#, 16#01#, 16#C0#, 16#00#, 16#1F#,
16#FC#, 16#3F#, 16#F8#, 16#7F#, 16#E1#, 16#81#, 16#82#, 16#06#, 16#00#,
16#08#, 16#00#, 16#20#, 16#00#, 16#C0#, 16#03#, 16#00#, 16#0C#, 16#00#,
16#10#, 16#00#, 16#40#, 16#01#, 16#80#, 16#07#, 16#C0#, 16#1F#, 16#86#,
16#3F#, 16#8E#, 16#CF#, 16#9C#, 16#07#, 16#30#, 16#03#, 16#C0#, 16#00#,
16#1E#, 16#00#, 16#F8#, 16#03#, 16#C0#, 16#0F#, 16#00#, 16#1E#, 16#00#,
16#38#, 16#00#, 16#F0#, 16#01#, 16#E0#, 16#03#, 16#C0#, 16#07#, 16#00#,
16#1E#, 16#00#, 16#3C#, 16#00#, 16#78#, 16#01#, 16#E0#, 16#03#, 16#C0#,
16#1F#, 16#00#, 16#7E#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#E0#,
16#01#, 16#C0#, 16#07#, 16#80#, 16#0F#, 16#00#, 16#1E#, 16#00#, 16#38#,
16#00#, 16#F0#, 16#01#, 16#E0#, 16#03#, 16#C0#, 16#07#, 16#00#, 16#0E#,
16#00#, 16#0C#, 16#00#, 16#0F#, 16#00#, 16#FF#, 16#FF#, 16#FF#, 16#FF#,
16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#E0#, 16#00#, 16#F0#, 16#00#,
16#70#, 16#00#, 16#70#, 16#00#, 16#E0#, 16#01#, 16#C0#, 16#03#, 16#80#,
16#07#, 16#00#, 16#1E#, 16#00#, 16#3C#, 16#00#, 16#78#, 16#00#, 16#E0#,
16#03#, 16#C0#, 16#07#, 16#80#, 16#0F#, 16#00#, 16#1C#, 16#00#, 16#18#,
16#00#, 16#10#, 16#00#, 16#F0#, 16#03#, 16#F0#, 16#0F#, 16#00#, 16#1E#,
16#00#, 16#38#, 16#00#, 16#F0#, 16#01#, 16#E0#, 16#03#, 16#C0#, 16#07#,
16#00#, 16#1E#, 16#00#, 16#3C#, 16#00#, 16#70#, 16#01#, 16#E0#, 16#0F#,
16#80#, 16#7C#, 16#00#, 16#3E#, 16#00#, 16#7F#, 16#C6#, 16#FF#, 16#FF#,
16#61#, 16#FE#, 16#00#, 16#7C#);
FreeSerifBoldItalic18pt7bGlyphs : aliased constant Glyph_Array := (
(0, 0, 0, 9, 0, 1), -- 0x20 ' '
(0, 11, 25, 14, 2, -23), -- 0x21 '!'
(35, 14, 10, 19, 4, -23), -- 0x22 '"'
(53, 20, 25, 17, -1, -24), -- 0x23 '#'
(116, 17, 29, 18, 0, -25), -- 0x24 '$'
(178, 27, 25, 29, 1, -23), -- 0x25 '%'
(263, 25, 25, 27, 0, -23), -- 0x26 '&'
(342, 5, 10, 10, 4, -23), -- 0x27 '''
(349, 11, 30, 12, 1, -23), -- 0x28 '('
(391, 11, 30, 12, -2, -23), -- 0x29 ')'
(433, 13, 15, 18, 2, -23), -- 0x2A '*'
(458, 17, 17, 20, 1, -16), -- 0x2B '+'
(495, 7, 11, 9, -2, -4), -- 0x2C ','
(505, 9, 4, 12, 0, -9), -- 0x2D '-'
(510, 6, 5, 9, 0, -3), -- 0x2E '.'
(514, 14, 25, 12, 0, -23), -- 0x2F '/'
(558, 15, 25, 18, 1, -23), -- 0x30 '0'
(605, 15, 25, 17, 0, -23), -- 0x31 '1'
(652, 16, 25, 18, 0, -23), -- 0x32 '2'
(702, 15, 25, 17, 1, -23), -- 0x33 '3'
(749, 18, 24, 17, 0, -23), -- 0x34 '4'
(803, 17, 25, 18, 0, -23), -- 0x35 '5'
(857, 17, 25, 18, 1, -23), -- 0x36 '6'
(911, 16, 24, 17, 3, -23), -- 0x37 '7'
(959, 17, 25, 18, 0, -23), -- 0x38 '8'
(1013, 17, 25, 18, 0, -23), -- 0x39 '9'
(1067, 10, 17, 9, 0, -15), -- 0x3A ':'
(1089, 11, 22, 9, -1, -15), -- 0x3B ';'
(1120, 18, 19, 20, 1, -18), -- 0x3C '<'
(1163, 18, 10, 20, 2, -13), -- 0x3D '='
(1186, 18, 19, 20, 2, -18), -- 0x3E '>'
(1229, 13, 25, 17, 3, -23), -- 0x3F '?'
(1270, 25, 25, 29, 2, -23), -- 0x40 '@'
(1349, 23, 25, 24, 0, -23), -- 0x41 'A'
(1421, 24, 25, 22, 0, -23), -- 0x42 'B'
(1496, 23, 25, 22, 1, -23), -- 0x43 'C'
(1568, 26, 25, 25, 0, -23), -- 0x44 'D'
(1650, 23, 25, 22, 0, -23), -- 0x45 'E'
(1722, 23, 25, 21, 0, -23), -- 0x46 'F'
(1794, 24, 25, 25, 2, -23), -- 0x47 'G'
(1869, 29, 25, 26, 0, -23), -- 0x48 'H'
(1960, 15, 25, 13, 0, -23), -- 0x49 'I'
(2007, 20, 27, 17, 0, -23), -- 0x4A 'J'
(2075, 25, 25, 23, 0, -23), -- 0x4B 'K'
(2154, 22, 25, 21, 0, -23), -- 0x4C 'L'
(2223, 33, 25, 31, 0, -23), -- 0x4D 'M'
(2327, 27, 25, 25, 0, -23), -- 0x4E 'N'
(2412, 23, 25, 24, 1, -23), -- 0x4F 'O'
(2484, 23, 25, 21, 0, -23), -- 0x50 'P'
(2556, 23, 31, 24, 1, -23), -- 0x51 'Q'
(2646, 24, 25, 23, 0, -23), -- 0x52 'R'
(2721, 18, 25, 18, 0, -23), -- 0x53 'S'
(2778, 21, 25, 21, 3, -23), -- 0x54 'T'
(2844, 24, 25, 25, 4, -23), -- 0x55 'U'
(2919, 24, 25, 25, 4, -23), -- 0x56 'V'
(2994, 31, 25, 32, 4, -23), -- 0x57 'W'
(3091, 25, 25, 24, 0, -23), -- 0x58 'X'
(3170, 21, 25, 22, 4, -23), -- 0x59 'Y'
(3236, 21, 25, 20, 0, -23), -- 0x5A 'Z'
(3302, 14, 30, 12, -1, -23), -- 0x5B '['
(3355, 10, 25, 14, 4, -23), -- 0x5C '\'
(3387, 14, 30, 12, -2, -23), -- 0x5D ']'
(3440, 16, 13, 20, 2, -23), -- 0x5E '^'
(3466, 18, 3, 17, 0, 3), -- 0x5F '_'
(3473, 7, 6, 12, 3, -23), -- 0x60 '`'
(3479, 18, 17, 18, 0, -15), -- 0x61 'a'
(3518, 16, 26, 17, 1, -24), -- 0x62 'b'
(3570, 13, 17, 15, 1, -15), -- 0x63 'c'
(3598, 19, 25, 18, 1, -23), -- 0x64 'd'
(3658, 13, 17, 15, 1, -15), -- 0x65 'e'
(3686, 21, 32, 17, -3, -24), -- 0x66 'f'
(3770, 19, 23, 17, -1, -15), -- 0x67 'g'
(3825, 17, 25, 19, 1, -23), -- 0x68 'h'
(3879, 9, 25, 10, 1, -23), -- 0x69 'i'
(3908, 16, 31, 12, -3, -23), -- 0x6A 'j'
(3970, 17, 25, 18, 1, -23), -- 0x6B 'k'
(4024, 11, 25, 10, 1, -23), -- 0x6C 'l'
(4059, 26, 17, 27, 0, -15), -- 0x6D 'm'
(4115, 18, 17, 18, 0, -15), -- 0x6E 'n'
(4154, 15, 17, 17, 1, -15), -- 0x6F 'o'
(4186, 19, 23, 17, -2, -15), -- 0x70 'p'
(4241, 16, 23, 17, 1, -15), -- 0x71 'q'
(4287, 15, 16, 14, 0, -15), -- 0x72 'r'
(4317, 13, 17, 12, 0, -15), -- 0x73 's'
(4345, 10, 22, 10, 1, -20), -- 0x74 't'
(4373, 17, 17, 19, 1, -15), -- 0x75 'u'
(4410, 13, 16, 15, 2, -15), -- 0x76 'v'
(4436, 19, 16, 23, 3, -15), -- 0x77 'w'
(4474, 18, 17, 17, -1, -15), -- 0x78 'x'
(4513, 17, 23, 15, -2, -15), -- 0x79 'y'
(4562, 15, 19, 14, 0, -15), -- 0x7A 'z'
(4598, 15, 32, 12, 0, -24), -- 0x7B '{'
(4658, 3, 25, 9, 4, -23), -- 0x7C '|'
(4668, 15, 32, 12, -5, -24), -- 0x7D '}'
(4728, 16, 5, 20, 2, -11)); -- 0x7E '~'
Font_D : aliased constant Bitmap_Font :=
(FreeSerifBoldItalic18pt7bBitmaps'Access,
FreeSerifBoldItalic18pt7bGlyphs'Access,
42);
Font : constant Giza.Font.Ref_Const := Font_D'Access;
end Giza.Bitmap_Fonts.FreeSerifBoldItalic18pt7b;
|
------------------------------------------------------------------------------
-- Copyright (C) 2020 by Heisenbug Ltd. (gh+spat@heisenbug.eu)
--
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.
------------------------------------------------------------------------------
pragma License (Unrestricted);
------------------------------------------------------------------------------
--
-- SPARK Proof Analysis Tool
--
-- S.P.A.T. - Names of recognized fields in JSON data.
--
------------------------------------------------------------------------------
package SPAT.Field_Names is
Assumptions : constant UTF8_String := "assumptions";
Check_Tree : constant UTF8_String := "check_tree";
Column : constant UTF8_String := "col";
Entity : constant UTF8_String := "entity";
File : constant UTF8_String := "file";
Flow : constant UTF8_String := "flow";
Flow_Analysis : constant UTF8_String := "flow analysis";
Line : constant UTF8_String := "line";
Max_Steps : constant UTF8_String := "max_steps";
Name : constant UTF8_String := "name";
Proof : constant UTF8_String := "proof";
Proof_Attempts : constant UTF8_String := "proof_attempts";
Result : constant UTF8_String := "result";
Rule : constant UTF8_String := "rule";
Severity : constant UTF8_String := "severity";
Sloc : constant UTF8_String := "sloc";
Spark : constant UTF8_String := "spark";
Stats : constant UTF8_String := "stats";
Steps : constant UTF8_String := "steps";
Suppressed : constant UTF8_String := "suppressed";
Time : constant UTF8_String := "time";
Timings : constant UTF8_String := "timings";
Transformations : constant UTF8_String := "transformations";
Trivial_True : constant UTF8_String := "trivial_true";
-- GNAT_CE_2019
Translation_Of_Compilation_Unit : constant UTF8_String :=
"translation of compilation unit";
-- GNAT_CE_2020
GNAT_Why3_Prefixed : constant UTF8_String := "gnatwhy3.";
-- Not really a single field name, but a collection of sub-fields containing
-- timing information.
Session_Map : constant UTF8_String := "session_map";
end SPAT.Field_Names;
|
package Other_Class is
type Object is new My_Class.Object with null record;
overriding procedure Primitive(Self: Object);
end Other_Class;
package body Other_Class is
procedure Primitive(Self: Object) is
begin
Put_Line("Hello Universe!");
end Primitive;
end Other_Class;
|
pragma Ada_2012;
with Line_Arrays;
with Node_List_Parsers;
with EU_Projects.Times.Time_Expressions; use EU_Projects.Times.Time_Expressions;
with EU_Projects.Nodes.Action_Nodes.WPs;
with EU_Projects.Nodes.Partners;
with EU_Projects.Nodes.Action_Nodes.Tasks;
with EU_Projects.Efforts;
with EU_Projects.Nodes.Timed_Nodes;
with EU_Projects.Nodes.Timed_Nodes.Milestones;
with EU_Projects.Nodes.Timed_Nodes.Deliverables;
with EU_Projects.Event_Names;
with Project_Processor.Parsers.Parser_Tables;
with Ada.Text_IO; use Ada.Text_IO;
with EU_Projects.Node_Tables;
with EU_Projects.Nodes.Timed_Nodes.Project_Infos;
with Tokenize.Token_Vectors;
with Ada.Exceptions;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
-- with Eu_Projects.Event_Names;
package body Project_Processor.Parsers.Simple_Format is
use EU_Projects;
use EU_Projects.Nodes.Timed_Nodes;
type Node_Class is (Metadata, Wp, Partner, Milestone, Deliverable, Tsk, Role);
subtype Top_Level_Node is Node_Class range Metadata .. Milestone;
package Node_Parser is
new Node_List_Parsers (Node_Class, EU_Projects.Bounded_Identifiers);
use Node_Parser;
package Node_Images is
-- This micro-package records the "name" (class and actual name) of
-- the node currently being parsed. This is necessary to produce
-- error messages that are fairly meaningful
procedure Set_Current_Node (X : Node_Type);
function Current_Node_Name return String;
private
type Node_Image is
record
Class : Node_Class;
Name : Unbounded_String;
end record;
Current_Node : Node_Image;
function Current_Node_Name return String
is (Node_Class'Image (Current_Node.Class)
& " """
& To_String (Current_Node.Name)
& """");
end Node_Images;
package body Node_Images is
procedure Set_Current_Node (X : Node_Type)
is
begin
Current_Node :=
(Class => X.Class,
Name => To_Unbounded_String
(if X.Contains (To_ID ("name")) then
X.Value ("name")
else
"<Unknown>"));
end Set_Current_Node;
end Node_Images;
function Deliverable_Type_Check is
new Generic_Enumerative (Deliverables.Deliverable_Type);
function Dissemination_Level_Check is
new Generic_Enumerative (Deliverables.Dissemination_Level);
Basic_Checker : constant Attribute_Checker :=
Mandatory ("label") +
Mandatory ("name") +
Mandatory ("short");
Project_Checker : constant Attribute_Checker :=
Basic_Checker + Default ("end", Event_Names.Default_Time);
Event_Checker : constant Attribute_Checker :=
Basic_Checker + Default ("when", "default");
Activity_Checker : constant Attribute_Checker :=
Basic_Checker
+ Mandatory ("begin")
+ Alternative ("end|duration")
+ Default ("objective", "")
+ Default ("dependencies", "");
WP_Checker : constant Attribute_Checker := Activity_Checker + Mandatory ("leader");
Task_Checker : constant Attribute_Checker := WP_Checker
+ Mandatory ("effort")
+ Default ("intensity", "100%");
Milestone_Checker : constant Attribute_Checker := Event_Checker
+ Default ("verification", "");
-- + Default ("deliverables", "");
Deliverable_Checker : constant Attribute_Checker := Event_Checker
+ Default ("tasks", "")
+ Default ("milestones", "")
+ Deliverable_Type_Check ("type")
+ Dissemination_Level_Check ("dissemination");
Partner_Checker : constant Attribute_Checker := Basic_Checker
+ Mandatory ("country");
Role_Checker : constant Attribute_Checker := Mandatory ("name")
+ Default ("monthly-cost", "0")
+ Default ("description", "");
function Get_Times (Node : Node_Type) return Nodes.Action_Nodes.Action_Time
is
use Nodes.Action_Nodes;
End_Given : constant Boolean := Node.Contains (+"end");
Duration_Given : constant Boolean := Node.Contains (+"duration");
begin
if End_Given and Duration_Given then
-- This should never happen
raise Program_Error with "end and duration together";
elsif (not End_Given) and (not Duration_Given) then
-- This neither
raise Program_Error with "neither end nor duration";
elsif End_Given and (not Duration_Given) then
-- Put_Line (Node ("begin") & "|" & Node ("end"));
return Create (Start_On => Instant_Raw (Node ("begin")),
End_On => Instant_Raw (Node ("end")));
else
return Create (Start_On => Instant_Raw (Node.Value ("begin")),
Duration => Duration_Raw (Node.Value ("duration")));
end if;
end Get_Times;
------------
-- Create --
------------
function Create
(Params : not null access Plugins.Parameter_Maps.Map)
return Parser_Type
is
pragma Unreferenced (Params);
Result : Parser_Type;
begin
return Result;
end Create;
procedure Parse_Deliverable (WP : EU_Projects.Nodes.Action_Nodes.WPs.Project_WP_Access;
Node_Seq : in out Node_Parser.Node_Scanner;
Node_Dir : in out Node_Tables.Node_Table)
with Pre => Class_Is (Node_Seq, Deliverable);
-----------------------
-- Parse_Deliverable --
-----------------------
-----------------------
-- Parse_Deliverable --
-----------------------
procedure Parse_Deliverable (WP : EU_Projects.Nodes.Action_Nodes.WPs.Project_WP_Access;
Node_Seq : in out Node_Parser.Node_Scanner;
Node_Dir : in out Node_Tables.Node_Table)
is
use EU_Projects.Nodes.Timed_Nodes.Deliverables;
Deliv_Node : Node_Type := Peek (Node_Seq);
This_Deliv : Deliverable_Access;
begin
Node_Images.Set_Current_Node (Deliv_Node);
Next (Node_Seq);
Check (Deliverable_Checker, Deliv_Node);
declare
use Tokenize;
Label : constant Deliverable_Label :=
Deliverable_Label'(To_ID (Deliv_Node ("label")));
Delivered_By : constant EU_Projects.Nodes.Node_Label_Lists.Vector :=
Nodes.Parse_Label_List (Deliv_Node ("tasks"));
Due_Times : Token_Vectors.Vector :=
Token_Vectors.To_Vector (Split (Deliv_Node ("when"), ';'));
begin
if Node_Dir.Contains (EU_Projects.Nodes.Node_Label (Label)) then
raise Parsing_Error
with "Duplicated label '" & Image (Label) & "' in deliverable";
end if;
This_Deliv :=
Create (Label => Label,
Name => Deliv_Node ("name"),
Short_Name => Deliv_Node ("short"),
Description => Deliv_Node.Description,
Delivered_By => Delivered_By,
Linked_Milestones => Nodes.Parse_Label_List (Deliv_Node ("milestones")),
Due_On => Due_Times.First_Element,
Node_Dir => Node_Dir,
Parent_WP => EU_Projects.Nodes.Node_Access (WP),
Deliv_Type => Deliverable_Type'Value (Deliv_Node ("type")),
Dissemination => Dissemination_Level'Value (Deliv_Node ("dissemination")));
for Idx in Due_Times.First_Index + 1 .. Due_Times.Last_Index loop
Clone (Item => This_Deliv.all,
Due_On => Due_Times (Idx),
Node_Dir => Node_Dir);
end loop;
WP.Add_Deliverable (This_Deliv);
end;
end Parse_Deliverable;
procedure Parse_Task (Parent : Nodes.Action_Nodes.WPs.Project_WP_Access;
Nodes : in out Node_Parser.Node_Scanner;
Node_Dir : in out Node_Tables.Node_Table)
with Pre => Class_Is (Nodes, Tsk);
procedure Parse_Task (Parent : Nodes.Action_Nodes.WPs.Project_WP_Access;
Nodes : in out Node_Parser.Node_Scanner;
Node_Dir : in out Node_Tables.Node_Table)
is
use EU_Projects.Nodes.Action_Nodes.Tasks;
use EU_Projects.Nodes.Partners;
Task_Node : Node_Type := Peek (Nodes);
This_Task : Project_Task_Access;
begin
Node_Images.Set_Current_Node (Task_Node);
Check (Task_Checker, Task_Node);
Next (Nodes);
This_Task := Create
(Label => Task_Label (EU_Projects.To_ID (Task_Node.Value ("label"))),
Name => Task_Node.Value ("name"),
Short_Name => Task_Node.Value ("short"),
Leader => Partner_Label (EU_Projects.To_ID (Task_Node.Value ("leader"))),
Description => Line_Arrays.Join (Task_Node.Description),
Active_When => Get_Times (Task_Node),
Parent_WP => EU_Projects.Nodes.Node_Access (Parent),
Intensity => Value (Task_Node.Value ("intensity")),
Depends_On => EU_Projects.Nodes.Parse_Label_List (Task_Node.Value ("dependencies")),
Node_Dir => Node_Dir);
declare
use EU_Projects.Efforts.Effort_Maps;
begin
for Pos in EU_Projects.Efforts.Parse (Task_Node ("effort")).Iterate loop
This_Task.Add_Effort (Partner => Key (Pos),
PM => Element (Pos));
end loop;
exception
when EU_Projects.Efforts.Bad_Effort_List =>
Put_Line (Standard_Error, "Bad effort list for task '" & Task_Node.Value ("name") & "'");
raise;
end;
Parent.Add_Task (This_Task);
end Parse_Task;
procedure Parse_WP (Nodes : in out Node_Parser.Node_Scanner;
Project : out EU_Projects.Projects.Project_Descriptor)
with Pre => Peek_Class (Nodes) = Wp;
procedure Parse_WP (Nodes : in out Node_Parser.Node_Scanner;
Project : out EU_Projects.Projects.Project_Descriptor)
is
use EU_Projects.Nodes.Action_Nodes.WPs;
use EU_Projects.Nodes.Partners;
WP_Node : Node_Type := Peek (Nodes);
use EU_Projects.Nodes;
This_Wp : Project_WP_Access;
begin
Node_Images.Set_Current_Node (WP_Node);
Check (WP_Checker, Wp_Node);
if Project.Find (To_ID (WP_Node ("leader"))) = null then
raise Bad_Input with "Leader '" & WP_Node ("leader") & "' Unknown";
end if;
This_Wp := Create
(Label => WP_Label (EU_Projects.To_ID (WP_Node.Value ("label"))),
Name => WP_Node.Value ("name"),
Short_Name => WP_Node.Value ("short"),
Leader => Partner_Label (EU_Projects.To_ID (WP_Node.Value ("leader"))),
Objectives => WP_Node.Value ("objective"),
Description => Line_Arrays.Join (WP_Node.Description),
Active_When => Get_Times (WP_Node),
Depends_On => EU_Projects.Nodes.Parse_Label_List (Wp_Node.Value ("dependencies")),
Node_Dir => Project.Node_Directory);
Next (Nodes);
while Class_Is (Nodes, Tsk) loop
Parse_Task (This_Wp, Nodes, Project.Node_Directory);
end loop;
while Class_Is (Nodes, Deliverable) loop
Parse_Deliverable (This_Wp, Nodes, Project.Node_Directory);
end loop;
Project.Add_WP (This_Wp);
end Parse_WP;
procedure Parse_Role (Nodes : in out Node_Parser.Node_Scanner;
Partner : EU_Projects.Nodes.Partners.Partner_Access)
with Pre => Class_Is (Nodes, Role);
procedure Parse_Role (Nodes : in out Node_Parser.Node_Scanner;
Partner : EU_Projects.Nodes.Partners.Partner_Access)
is
use EU_Projects.Nodes.Partners;
Role_Node : Node_Type := Peek (Nodes);
begin
Node_Images.Set_Current_Node (Role_Node);
Next (Nodes);
Check (Role_Checker, Role_Node);
Partner.Add_Role (Role => Role_Name'(To_Id (Role_Node ("name"))),
Description => Role_Node ("description"),
Monthly_Cost => Currency'Value (Role_Node ("monthly-cost")));
end Parse_Role;
procedure Parse_Partner (Nodes : in out Node_Parser.Node_Scanner;
Project : out EU_Projects.Projects.Project_Descriptor)
with Pre => Class_Is (Nodes, Partner);
procedure Parse_Partner (Nodes : in out Node_Parser.Node_Scanner;
Project : out EU_Projects.Projects.Project_Descriptor)
is
use EU_Projects.Nodes.Partners;
Partner_Node : Node_Type := Peek (Nodes);
This_Partner : Partner_Access;
begin
Node_Images.Set_Current_Node (Partner_Node);
Next (Nodes);
Check (Partner_Checker, Partner_Node);
This_Partner := Create (ID => To_ID (Partner_Node ("label")),
Name => Partner_Node ("name"),
Short_Name => Partner_Node ("short"),
Country => Partner_Node ("country"),
Node_Dir => Project.Node_Directory);
while Class_Is (Nodes, Role) loop
Parse_Role (Nodes, This_Partner);
end loop;
Project.Add_Partner (This_Partner);
end Parse_Partner;
procedure Parse_Metadata (Nodes : in out Node_Parser.Node_Scanner;
Project : out EU_Projects.Projects.Project_Descriptor)
with Pre => Class_Is (Nodes, Metadata);
procedure Parse_Metadata (Nodes : in out Node_Parser.Node_Scanner;
Project : out EU_Projects.Projects.Project_Descriptor)
is
use EU_Projects.Nodes.Timed_Nodes.Project_Infos;
This_Node : Node_Type := Peek (Nodes);
This_Metadata : Info_Access;
begin
Node_Images.Set_Current_Node (This_Node);
Next (Nodes);
Check (Project_Checker, This_Node);
This_Metadata := Project_Infos.Create (Label => EU_Projects.Nodes.To_ID (This_Node ("label")),
Name => This_Node ("name"),
Short_Name => This_Node ("short"),
Stop_At => This_Node ("end"),
Node_Dir => Project.Node_Directory);
Project.Bless (This_Metadata);
end Parse_Metadata;
procedure Parse_Milestone (Nodes : in out Node_Parser.Node_Scanner;
Project : out EU_Projects.Projects.Project_Descriptor)
with Pre => Class_Is (Nodes, Milestone);
---------------------
-- Parse_Milestone --
---------------------
procedure Parse_Milestone (Nodes : in out Node_Parser.Node_Scanner;
Project : out EU_Projects.Projects.Project_Descriptor)
is
use EU_Projects.Nodes.Timed_Nodes.Milestones;
Milestone_Node : Node_Type := Peek (Nodes);
This_Milestone : Milestone_Access;
begin
Node_Images.Set_Current_Node (Milestone_Node);
Next (Nodes);
Check (Milestone_Checker, Milestone_Node);
This_Milestone :=
Create (Label => Milestone_Label'(To_ID (Milestone_Node ("label"))),
Name => Milestone_Node ("name"),
Short_Name => Milestone_Node ("short"),
Description => Milestone_Node.Description,
Due_On => Milestone_Node ("when"),
Node_Dir => Project.Node_Directory,
Verification => Milestone_Node ("verification"));
Project.Add_Milestone (This_Milestone);
end Parse_Milestone;
---------------------
-- Parse_Top_Level --
---------------------
procedure Parse_Top_Level (Nodes : in out Node_Parser.Node_Scanner;
Project : out EU_Projects.Projects.Project_Descriptor)
is
begin
if not (Node_Parser.Peek_Class (Nodes) in Top_Level_Node) then
raise Parsing_Error with "top level node expected";
end if;
case Top_Level_Node (Peek_Class (Nodes)) is
when Metadata =>
Parse_Metadata (Nodes, Project);
when Wp =>
Parse_Wp (Nodes, Project);
when Partner =>
Parse_Partner (Nodes, Project);
when Milestone =>
Parse_Milestone (Nodes, Project);
--
-- when Deliverable =>
-- Parse_Deliverable (Nodes, Project);
end case;
end Parse_Top_Level;
-----------
-- Parse --
-----------
overriding procedure Parse
(Parser : in out Parser_Type;
Project : out EU_Projects.Projects.Project_Descriptor;
Input : String)
is
pragma Unreferenced (Parser);
Names : Name_Maps.Map;
begin
Names.Insert (Key => +"task",
New_Item => Tsk);
declare
Nodes : Node_Scanner :=
To_Scanner (Parse (Input => Line_Arrays.Split (Input),
Names => Names));
begin
while not End_Of_List (Nodes) loop
Parse_Top_Level (Nodes, Project);
end loop;
end;
exception
when Error : Node_Parser.Missing_Alternative =>
raise Parsing_Error
with "Missing alternative in project spec: "
& Ada.Exceptions.Exception_Message (Error)
& " at node "
& Node_Images.Current_Node_Name;
when Error : Node_Parser.Missing_Mandatory =>
raise Parsing_Error
with "Missing mandatory field in project spec: "
& Ada.Exceptions.Exception_Message (Error)
& " at node "
& Node_Images.Current_Node_Name;
end Parse;
begin
Parser_Tables.Register (ID => "simple",
Tag => Parser_Type'Tag);
Register_Extension (Parser => "simple",
File_Extension => "simple");
end Project_Processor.Parsers.Simple_Format;
|
-- Copyright (c) 2010-2011 Xiph.Org Foundation, Skype Limited
--
-- Most of the documentation has been copied from opus.h and opus_defines.h
-- and is licensed under the license of those files; the Simplified BSD License.
--
-- Copyright (c) 2014 onox <denkpadje@gmail.com>
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
with Interfaces.C.Extensions;
package Opus.Decoders is
type Decoder_Data is private;
-- A single codec state may only be accessed from a single thread at
-- a time and any required locking must be performed by the caller.
-- Separate streams must be decoded with separate decoder states and
-- can be decoded in parallel unless the Opus library was compiled
-- with NONTHREADSAFE_PSEUDOSTACK defined.
type Q8_dB is new Interfaces.C.int range -32768 .. 32767;
function Create
(Frequency : in Sampling_Rate;
Channels : in Channel_Type) return Decoder_Data;
-- Create and return an Opus decoder
procedure Destroy (Decoder : in Decoder_Data);
function Decode
(Decoder : in Decoder_Data;
Data : in Byte_Array;
Max_Samples_Per_Channel : in Positive;
Decode_FEC : in Boolean) return PCM_Buffer;
-- If Data = null or Decode_FEC is true then Frame_Size must be a
-- multiple of 2.5 ms.
procedure Reset_State (Decoder : in Decoder_Data);
-- Resets the codec state to be equivalent to a freshly initialized
-- state. This should be called when switching streams in order to
-- prevent the back to back decoding from giving different results
-- from one at a time decoding.
function Get_Bandwidth (Decoder : in Decoder_Data) return Bandwidth;
-- Gets the decoder's last bandpass.
--
-- Raises No_Packets_Decoded if no packets have been decoded yet.
function Get_Channels (Decoder : in Decoder_Data) return Channel_Type;
-- Return the number of channels that the decoder expects. The returned
-- value is a mandatory argument to the Create function.
procedure Set_Gain
(Decoder : in Decoder_Data;
Factor : in Q8_dB);
-- Set decoder gain adjustment, which is the amount to scale the PCM
-- signal by in Q8 dB units.
--
-- Scales the decoded output by a factor specified in Q8 dB units.
-- The default is zero indicating no adjustment. This setting survives
-- decoder reset.
--
-- gain = pow(10, factor / (20.0 * 256))
function Get_Gain (Decoder : in Decoder_Data) return Q8_dB;
-- Gets the decoder's configured gain adjustment, which is the amount
-- to scale the PCM signal by in Q8 dB units.
function Get_Pitch (Decoder : in Decoder_Data) return Integer;
-- Gets the pitch period at 48 kHz of the last decoded frame, or
-- 0 if not available.
--
-- This can be used for any post-processing algorithm requiring the
-- use of pitch, e.g. time stretching/shortening. If the last frame
-- was not voiced, or if the pitch was not coded in the frame, then
-- zero is returned.
function Get_Final_Range (Decoder : in Decoder_Data) return Integer;
-- Gets the final state of the codec's entropy coder.
--
-- This is used for testing purposesr. The encoder and decoder state
-- should be identical after coding a payload (assuming no data
-- corruption or software bugs)
function Get_Sample_Rate (Decoder : in Decoder_Data) return Sampling_Rate;
-- Return the sampling rate the decoder was initialized with
function Get_Last_Packet_Duration (Decoder : in Decoder_Data) return Natural;
-- Return the duration (number of samples at current sampling rate)
-- of the last packet successfully decoded or concealed.
No_Packets_Decoded : exception;
private
subtype Opus_Decoder is Interfaces.C.Extensions.opaque_structure_def_ptr;
type Decoder_Data is record
Decoder : Opus_Decoder;
Channels : Channel_Type;
end record;
end Opus.Decoders;
|
-- Copyright (c) 2017 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with LSP.Messages;
package LSP.Message_Handlers is
pragma Preelaborate;
type Request_Handler is limited interface;
type Request_Handler_Access is access all Request_Handler'Class;
not overriding procedure Initialize_Request
(Self : access Request_Handler;
Value : LSP.Messages.InitializeParams;
Response : in out LSP.Messages.Initialize_Response) is null;
not overriding procedure Shutdown_Request
(Self : access Request_Handler;
Response : in out LSP.Messages.ResponseMessage) is null;
not overriding procedure Text_Document_Code_Action_Request
(Self : access Request_Handler;
Value : LSP.Messages.CodeActionParams;
Response : in out LSP.Messages.CodeAction_Response) is null;
not overriding procedure Text_Document_Completion_Request
(Self : access Request_Handler;
Value : LSP.Messages.TextDocumentPositionParams;
Response : in out LSP.Messages.Completion_Response) is null;
not overriding procedure Text_Document_Definition_Request
(Self : access Request_Handler;
Value : LSP.Messages.TextDocumentPositionParams;
Response : in out LSP.Messages.Location_Response) is null;
not overriding procedure Text_Document_Hover_Request
(Self : access Request_Handler;
Value : LSP.Messages.TextDocumentPositionParams;
Response : in out LSP.Messages.Hover_Response) is null;
not overriding procedure Text_Document_Highlight_Request
(Self : access Request_Handler;
Value : LSP.Messages.TextDocumentPositionParams;
Response : in out LSP.Messages.Highlight_Response) is null;
not overriding procedure Text_Document_References_Request
(Self : access Request_Handler;
Value : LSP.Messages.ReferenceParams;
Response : in out LSP.Messages.Location_Response) is null;
not overriding procedure Text_Document_Signature_Help_Request
(Self : access Request_Handler;
Value : LSP.Messages.TextDocumentPositionParams;
Response : in out LSP.Messages.SignatureHelp_Response) is null;
not overriding procedure Text_Document_Symbol_Request
(Self : access Request_Handler;
Value : LSP.Messages.DocumentSymbolParams;
Response : in out LSP.Messages.Symbol_Response) is null;
not overriding procedure Workspace_Execute_Command_Request
(Self : access Request_Handler;
Value : LSP.Messages.ExecuteCommandParams;
Response : in out LSP.Messages.ExecuteCommand_Response) is null;
not overriding procedure Workspace_Symbol_Request
(Self : access Request_Handler;
Value : LSP.Messages.WorkspaceSymbolParams;
Response : in out LSP.Messages.Symbol_Response) is null;
type Notification_Handler is limited interface;
type Notification_Handler_Access is access all Notification_Handler'Class;
not overriding procedure Workspace_Did_Change_Configuration
(Self : access Notification_Handler;
Value : LSP.Messages.DidChangeConfigurationParams) is null;
not overriding procedure Text_Document_Did_Open
(Self : access Notification_Handler;
Value : LSP.Messages.DidOpenTextDocumentParams) is null;
not overriding procedure Text_Document_Did_Change
(Self : access Notification_Handler;
Value : LSP.Messages.DidChangeTextDocumentParams) is null;
not overriding procedure Text_Document_Did_Save
(Self : access Notification_Handler;
Value : LSP.Messages.DidSaveTextDocumentParams) is null;
not overriding procedure Text_Document_Did_Close
(Self : access Notification_Handler;
Value : LSP.Messages.DidCloseTextDocumentParams) is null;
not overriding procedure Exit_Notification
(Self : access Notification_Handler) is null;
end LSP.Message_Handlers;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015, Vadim Godunko <vgodunko@gmail.com> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Wide_Wide_Text_IO;
with Asis.Declarations;
with Asis.Definitions;
with Asis.Elements;
with Asis.Expressions;
with Asis.Statements;
with Properties.Tools;
with Properties.Expressions.Identifiers;
package body Properties.Statements.Procedure_Call_Statement is
function Intrinsic
(Engine : access Engines.Contexts.Context;
Element : Asis.Expression;
Name : Engines.Text_Property) return League.Strings.Universal_String;
----------
-- Code --
----------
function Code
(Engine : access Engines.Contexts.Context;
Element : Asis.Statement;
Name : Engines.Text_Property) return League.Strings.Universal_String
is
use type Engines.Convention_Kind;
function Get_Parameters
(Prefix : Asis.Expression;
Is_Dispatching : Boolean;
Is_JavaScript : Boolean)
return Asis.Parameter_Specification_List
is
begin
if not Is_Dispatching and not Is_JavaScript then
return Properties.Tools.Parameter_Profile (Prefix);
elsif Asis.Statements.Is_Dispatching_Call (Element) then
declare
Decl : constant Asis.Declaration :=
Properties.Tools.Corresponding_Declaration (Prefix);
begin
case Asis.Elements.Declaration_Kind (Decl) is
when
Asis.A_Procedure_Declaration |
Asis.A_Function_Declaration |
Asis.A_Procedure_Body_Declaration |
Asis.A_Function_Body_Declaration |
Asis.A_Null_Procedure_Declaration |
Asis.A_Procedure_Renaming_Declaration |
Asis.A_Function_Renaming_Declaration |
Asis.An_Entry_Declaration |
Asis.An_Entry_Body_Declaration |
Asis.A_Procedure_Body_Stub |
Asis.A_Function_Body_Stub |
Asis.A_Generic_Function_Declaration |
Asis.A_Generic_Procedure_Declaration |
Asis.A_Formal_Function_Declaration |
Asis.A_Formal_Procedure_Declaration |
Asis.An_Expression_Function_Declaration =>
return Asis.Declarations.Parameter_Profile (Decl);
when others =>
return Asis.Nil_Element_List;
end case;
end;
else
return Asis.Nil_Element_List;
end if;
end Get_Parameters;
Text : League.Strings.Universal_String;
Prefix : constant Asis.Expression :=
Asis.Statements.Called_Name (Element);
Conv : constant Engines.Convention_Kind :=
Engine.Call_Convention.Get_Property
(Prefix,
Engines.Call_Convention);
Is_Dispatching : constant Boolean := Engine.Boolean.Get_Property
(Prefix, Engines.Is_Dispatching);
Is_Prefixed : constant Boolean :=
Conv in Engines.JavaScript_Property_Setter |
Engines.JavaScript_Method;
Params : constant Asis.Parameter_Specification_List :=
Get_Parameters (Prefix, Is_Dispatching, Is_Prefixed);
Has_Output : constant Boolean :=
Engine.Boolean.Get_Property
(List => Params,
Name => Engines.Has_Simple_Output,
Empty => False,
Sum => Properties.Tools."or"'Access);
List : constant Asis.Association_List :=
Asis.Statements.Call_Statement_Parameters
(Element, Normalized => False);
Arg : League.Strings.Universal_String;
begin
if Has_Output then
Text.Append ("var _r=");
end if;
if Conv = Engines.Intrinsic then
Arg := Intrinsic (Engine, Element, Name);
Text.Append (Arg);
elsif not Is_Dispatching and not Is_Prefixed then
Arg := Engine.Text.Get_Property (Prefix, Name);
Text.Append (Arg);
Text.Append ("(");
for J in 1 .. List'Last loop
Arg := Engine.Text.Get_Property
(Asis.Expressions.Actual_Parameter (List (J)), Name);
Text.Append (Arg);
if J /= List'Last then
Text.Append (", ");
end if;
end loop;
Text.Append (")");
elsif Conv = Engines.JavaScript_Property_Setter then
Arg := Engine.Text.Get_Property
(Asis.Expressions.Actual_Parameter (List (1)), Name);
Text.Append (Arg);
Text.Append (".");
Text.Append
(Engine.Text.Get_Property (Prefix, Engines.Method_Name));
Text.Append (" = ");
Arg := Engine.Text.Get_Property
(Asis.Expressions.Actual_Parameter (List (2)), Name);
Text.Append (Arg);
elsif Asis.Statements.Is_Dispatching_Call (Element) or
Conv = Engines.JavaScript_Method
then
declare
Expr : Asis.Expression;
Decl : Asis.Declaration;
Comp : Asis.Definition;
begin
Arg := Engine.Text.Get_Property
(Asis.Expressions.Actual_Parameter (List (1)), Name);
Text.Append (Arg);
Text.Append (".");
Text.Append
(Engine.Text.Get_Property (Prefix, Engines.Method_Name));
Text.Append ("(");
for J in 2 .. List'Last loop
Expr := Asis.Expressions.Actual_Parameter (List (J));
Arg := Engine.Text.Get_Property (Expr, Name);
Text.Append (Arg);
Decl := Asis.Expressions.Corresponding_Expression_Type (Expr);
if Tools.Is_Array (Expr)
and then Tools.Is_Array_Buffer (Decl)
then
Comp := Asis.Definitions.Array_Component_Definition
(Tools.Type_Declaration_View (Decl));
Comp := Asis.Definitions.Component_Definition_View (Comp);
Arg := Engine.Text.Get_Property
(Comp, Engines.Typed_Array_Item_Type);
if not Arg.Is_Empty then
Text.Append (".");
Text.Append (Arg);
end if;
end if;
if J /= List'Last then
Text.Append (", ");
end if;
end loop;
Text.Append (")");
end;
else
declare
Proc : Asis.Declaration :=
Asis.Statements.Corresponding_Called_Entity (Element);
begin
while Asis.Elements.Is_Part_Of_Inherited (Proc) loop
Proc :=
Asis.Declarations.Corresponding_Subprogram_Derivation (Proc);
end loop;
Arg := Properties.Expressions.Identifiers.Name_Prefix
(Engine => Engine,
Name => Element,
Decl => Proc);
Text.Append (Arg);
Text.Append
(Engine.Text.Get_Property
(Asis.Declarations.Names (Proc) (1), Name));
Text.Append (".call(");
Text.Append
(Engine.Text.Get_Property
(Asis.Expressions.Actual_Parameter (List (1)), Name));
for J in 2 .. List'Last loop
Arg := Engine.Text.Get_Property
(Asis.Expressions.Actual_Parameter (List (J)), Name);
Text.Append (", ");
Text.Append (Arg);
end loop;
Text.Append (")");
end;
end if;
for J in Params'Range loop
if Engine.Boolean.Get_Property
(Params (J), Engines.Has_Simple_Output)
then
Text.Append (";");
Arg := Engine.Text.Get_Property
(Asis.Expressions.Actual_Parameter (List (J)), Name);
Text.Append (Arg);
Text.Append ("=_r.");
Arg := Engine.Text.Get_Property
(Asis.Declarations.Names (Params (J)) (1), Name);
Text.Append (Arg);
end if;
end loop;
Text.Append (";");
return Text;
end Code;
---------------
-- Intrinsic --
---------------
function Intrinsic
(Engine : access Engines.Contexts.Context;
Element : Asis.Expression;
Name : Engines.Text_Property) return League.Strings.Universal_String
is
pragma Unreferenced (Name);
Func : constant League.Strings.Universal_String :=
Engine.Text.Get_Property
(Asis.Statements.Called_Name (Element),
Engines.Intrinsic_Name);
List : constant Asis.Association_List :=
Asis.Statements.Call_Statement_Parameters
(Element, Normalized => False);
pragma Unreferenced (List);
begin
Ada.Wide_Wide_Text_IO.Put ("Unimplemented Intrinsic: ");
Ada.Wide_Wide_Text_IO.Put (Func.To_Wide_Wide_String);
raise Program_Error;
return League.Strings.Empty_Universal_String;
end Intrinsic;
end Properties.Statements.Procedure_Call_Statement;
|
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Command_Line; use Ada.Command_Line;
procedure HelloAda is
begin
if Argument_Count > 0 then
Put_Line("Hello, " & Argument(1) & "!");
else
Put_Line("Hello World!");
end if;
end HelloAda;
|
with Opt23_Pkg; use Opt23_Pkg;
package Opt23 is
procedure Proc (Driver : Rec);
end Opt23;
|
-- -*- Mode: Ada -*-
-- Filename : ether-response.ads
-- Description : Interface for the response objects.
-- Author : Luke A. Guest
-- Created On : Sun Jul 4 19:22:48 2010
-- with Ada.Strings.Unbounded;
with GNAT.Sockets;
with AWS.Messages;
package Ether.Responses is
procedure Send
(Output : in GNAT.Sockets.Stream_Access;
Status : in AWS.Messages.Status_Code;
Mime_Type : in String;
Content : in String; -- TODO: This should be a Unicode string.
Char_Set : in String := "UTF-8");
end Ether.Responses;
|
------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2016-2017, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Interfaces.ARM_V7AR;
with System.Machine_Code; use System.Machine_Code;
with Trap_Handler;
with Interfaces; use Interfaces;
with Ada.Text_IO; use Ada.Text_IO;
with Commands; use Commands;
with Dumps; use Dumps;
package body Armv7a is
function Get_VBAR return Unsigned_32
is
Res : Unsigned_32;
begin
Asm ("mrc p15, #0, %0, c12, c0, #0",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_VBAR;
function Get_CPSR return Unsigned_32
is
Res : Unsigned_32;
begin
Asm ("mrs %0,cpsr",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_CPSR;
function Get_SPSR return Unsigned_32
is
Res : Unsigned_32;
begin
Asm ("mrs %0,spsr",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_SPSR;
pragma Unreferenced (Get_SPSR);
function Get_SCR return Unsigned_32
is
Res : Unsigned_32;
begin
Asm ("mrc p15,#0,%0,c1,c1,#0",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_SCR;
function Get_CPUECTLR return Unsigned_32
is
Lo, Hi : Unsigned_32;
begin
Asm ("mrrc p15, 1, %0, %1, c15",
Outputs => (Unsigned_32'Asm_Output ("=r", Lo),
Unsigned_32'Asm_Output ("=r", Hi)),
Volatile => True);
return Lo;
end Get_CPUECTLR;
function Get_MIDR return Unsigned_32
is
Res : Unsigned_32;
begin
Asm ("mrc p15, #0, %0, c0, c0, #0",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_MIDR;
function Get_HSCTLR return Unsigned_32
is
Res : Unsigned_32;
begin
Asm ("mrc p15, #4, %0, c1, c0, #0",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_HSCTLR;
function Get_HCPTR return Unsigned_32
is
Res : Unsigned_32;
begin
Asm ("mrc p15, #4, %0, c1, c1, #2",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_HCPTR;
function Get_HMAIR0 return Unsigned_32
is
Res : Unsigned_32;
begin
Asm ("mrc p15, #4, %0, c10, c2, #0",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_HMAIR0;
function Get_HMAIR1 return Unsigned_32
is
Res : Unsigned_32;
begin
Asm ("mrc p15, #4, %0, c10, c2, #1",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_HMAIR1;
function Get_HTCR return Unsigned_32
is
Res : Unsigned_32;
begin
Asm ("mrc p15, #4, %0, c2, c0, #2",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_HTCR;
function Get_HTTBR return Unsigned_64
is
Lo, Hi : Unsigned_32;
begin
Asm ("mrrc p15, 4, %0, %1, c2",
Outputs => (Unsigned_32'Asm_Output ("=r", Lo),
Unsigned_32'Asm_Output ("=r", Hi)),
Volatile => True);
return Shift_Left (Unsigned_64 (Hi), 32) or Unsigned_64 (Lo);
end Get_HTTBR;
procedure Proc_Cr is
CPSR : constant Unsigned_32 := Get_CPSR;
MIDR : constant Unsigned_32 := Get_MIDR;
begin
Put ("VBAR: " & Image8 (Get_VBAR));
Put (", CPSR: " & Image8 (CPSR));
Put (' ');
case CPSR and 16#1f# is
when 2#10000# => Put ("usr");
when 2#10001# => Put ("fiq");
when 2#10010# => Put ("irq");
when 2#10011# => Put ("svc");
when 2#10110# => Put ("mon");
when 2#10111# => Put ("abt");
when 2#11010# => Put ("hyp");
when 2#11011# => Put ("und");
when 2#11111# => Put ("sys");
when others => Put ("???");
end case;
New_Line;
Put ("MIDR: " & Image8 (Get_MIDR));
New_Line;
-- Only for A53
if (MIDR and 16#ff_0_f_fff_0#) = 16#41_0_f_d03_0# then
Put ("CPUECTLR: ");
Put (Image8 (Get_CPUECTLR));
New_Line;
end if;
if (CPSR and 16#1f#) = 2#11010# then
-- For hypervisor
Put ("HSCTLR: ");
Put (Hex4 (Get_HSCTLR));
Put (", HCPTR: ");
Put (Hex4 (Get_HCPTR));
New_Line;
Put ("HMAIR0: ");
Put (Hex4 (Get_HMAIR0));
Put (", HMAIR1: ");
Put (Hex4 (Get_HMAIR1));
Put (", HTCR: ");
Put (Hex4 (Get_HTCR));
Put (", HTTBR: ");
Put (Hex8 (Get_HTTBR));
New_Line;
end if;
if (CPSR and 16#1f#) = 2#10110# then
-- Only for monitor.
Put ("SCR: ");
Put (Image8 (Get_SCR));
New_Line;
end if;
end Proc_Cr;
procedure Proc_Cpsid is
begin
Asm ("cpsid if", Volatile => True);
end Proc_Cpsid;
procedure Proc_Cpsie is
begin
Asm ("cpsie if", Volatile => True);
end Proc_Cpsie;
procedure Proc_Svc is
begin
Asm ("svc #0", Volatile => True);
end Proc_Svc;
procedure Proc_Smc is
begin
Asm ("mov r10, #0x27; mov r11, #0x15; smc #0", Volatile => True);
end Proc_Smc;
procedure Disp_Cache_Size (L : Natural)
is
use Interfaces.ARM_V7AR;
Ccsidr : Unsigned_32;
Lines, Assoc, Sets : Natural;
begin
CP15.Set_CSSELR (Unsigned_32 (L));
Barriers.ISB;
Ccsidr := CP15.Get_CCSIDR;
Lines := 2**(2 + Natural (Ccsidr and 3));
Assoc := Natural (Shift_Right (Ccsidr, 3) and 16#3ff#) + 1;
Sets := Natural (Shift_Right (Ccsidr, 13) and 16#7fff#) + 1;
Put ("Line: ");
Put (Lines);
Put ("B, assoc: ");
Put (Assoc);
Put (", sets: ");
Put (Sets);
Put (" (size: ");
Put (Lines * Assoc * Sets / 1024);
Put ("KB)");
end Disp_Cache_Size;
procedure Proc_Cache
is
use Interfaces.ARM_V7AR;
Sctlr : constant Unsigned_32 := CP15.Get_SCTLR;
Clidr : constant Unsigned_32 := CP15.Get_CLIDR;
begin
Put ("SCTLR: ");
Put (Image8 (Sctlr));
Put (", CLIDR: ");
Put (Image8 (Clidr));
New_Line;
-- Disp cache levels
for I in 0 .. 6 loop
declare
L : constant Unsigned_32 :=
Shift_Right (Clidr, I * 3) and 7;
begin
if L /= 0 then
Put (" L");
Put (I + 1);
Put (": ");
case L is
when 1 =>
Put (" I-cache: ");
Disp_Cache_Size (I * 2 + 1);
when 2 =>
Put (" D-cache");
Disp_Cache_Size (I * 2);
when 3 =>
Put (" I-cache: ");
Disp_Cache_Size (I * 2 + 1);
New_Line;
Put (" D-cache: ");
Disp_Cache_Size (I * 2);
when 4 =>
Put ("I+D-cache: ");
Disp_Cache_Size (I * 2);
when others =>
Put ("??");
Put (Natural (L));
end case;
New_Line;
end if;
end;
end loop;
Put ("LoUU: ");
Put (Natural (Shift_Right (Clidr, 27) and 7));
New_Line;
Put ("LoC : ");
Put (Natural (Shift_Right (Clidr, 27) and 7));
New_Line;
end Proc_Cache;
Commands : aliased Command_List :=
(6,
(1 => (new String'("cache - disp cache"),
Proc_Cache'Access),
2 => (new String'("cr - Display some config registers"),
Proc_Cr'Access),
3 => (new String'("cpsid - Disable interrupts"),
Proc_Cpsid'Access),
4 => (new String'("cpsie - Enable interrupts"),
Proc_Cpsie'Access),
5 => (new String'("svc - Supervisor call"),
Proc_Svc'Access),
6 => (new String'("smc - Monitor call"),
Proc_Smc'Access)),
null);
begin
Register_Commands (Commands'Access);
if False then
Trap_Handler.Install_Monitor_Handlers;
Put_Line ("Handlers installed");
end if;
end Armv7a;
|
with Ada.Text_IO; use Ada.Text_IO;
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings; use Interfaces.C.Strings;
procedure Test_C_Interface is
function strdup (s1 : Char_Array) return Chars_Ptr;
pragma Import (C, strdup, "_strdup");
S1 : constant String := "Hello World!";
S2 : Chars_Ptr;
begin
S2 := strdup (To_C (S1));
Put_Line (Value (S2));
Free (S2);
end Test_C_Interface;
|
with Interfaces; use Interfaces;
with Ada.Unchecked_Conversion;
package body Opt61_Pkg is
pragma Suppress (Overflow_Check);
pragma Suppress (Range_Check);
subtype Uns64 is Unsigned_64;
function To_Int is new Ada.Unchecked_Conversion (Uns64, Int64);
subtype Uns32 is Unsigned_32;
-----------------------
-- Local Subprograms --
-----------------------
function "+" (A : Uns64; B : Uns32) return Uns64 is (A + Uns64 (B));
-- Length doubling additions
function "*" (A, B : Uns32) return Uns64 is (Uns64 (A) * Uns64 (B));
-- Length doubling multiplication
function "&" (Hi, Lo : Uns32) return Uns64 is
(Shift_Left (Uns64 (Hi), 32) or Uns64 (Lo));
-- Concatenate hi, lo values to form 64-bit result
function "abs" (X : Int64) return Uns64 is
(if X = Int64'First then 2**63 else Uns64 (Int64'(abs X)));
-- Convert absolute value of X to unsigned. Note that we can't just use
-- the expression of the Else, because it overflows for X = Int64'First.
function Lo (A : Uns64) return Uns32 is (Uns32 (A and 16#FFFF_FFFF#));
-- Low order half of 64-bit value
function Hi (A : Uns64) return Uns32 is (Uns32 (Shift_Right (A, 32)));
-- High order half of 64-bit value
-------------------
-- Double_Divide --
-------------------
procedure Double_Divide
(X, Y, Z : Int64;
Q, R : out Int64;
Round : Boolean)
is
Xu : constant Uns64 := abs X;
Yu : constant Uns64 := abs Y;
Yhi : constant Uns32 := Hi (Yu);
Ylo : constant Uns32 := Lo (Yu);
Zu : constant Uns64 := abs Z;
Zhi : constant Uns32 := Hi (Zu);
Zlo : constant Uns32 := Lo (Zu);
T1, T2 : Uns64;
Du, Qu, Ru : Uns64;
Den_Pos : Boolean;
begin
if Yu = 0 or else Zu = 0 then
raise Constraint_Error;
end if;
-- Compute Y * Z. Note that if the result overflows 64 bits unsigned,
-- then the rounded result is clearly zero (since the dividend is at
-- most 2**63 - 1, the extra bit of precision is nice here).
if Yhi /= 0 then
if Zhi /= 0 then
Q := 0;
R := X;
return;
else
T2 := Yhi * Zlo;
end if;
else
T2 := (if Zhi /= 0 then Ylo * Zhi else 0);
end if;
T1 := Ylo * Zlo;
T2 := T2 + Hi (T1);
if Hi (T2) /= 0 then
Q := 0;
R := X;
return;
end if;
Du := Lo (T2) & Lo (T1);
-- Set final signs (RM 4.5.5(27-30))
Den_Pos := (Y < 0) = (Z < 0);
-- Check overflow case of largest negative number divided by 1
if X = Int64'First and then Du = 1 and then not Den_Pos then
raise Constraint_Error;
end if;
-- Perform the actual division
Qu := Xu / Du;
Ru := Xu rem Du;
-- Deal with rounding case
if Round and then Ru > (Du - Uns64'(1)) / Uns64'(2) then
Qu := Qu + Uns64'(1);
end if;
-- Case of dividend (X) sign positive
if X >= 0 then
R := To_Int (Ru);
Q := (if Den_Pos then To_Int (Qu) else -To_Int (Qu));
-- Case of dividend (X) sign negative
else
R := -To_Int (Ru);
Q := (if Den_Pos then -To_Int (Qu) else To_Int (Qu));
end if;
end Double_Divide;
end Opt61_Pkg;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.