content stringlengths 23 1.05M |
|---|
-----------------------------------------------------------------------
-- util-strings-transforms -- Various Text Transformation Utilities
-- Copyright (C) 2015, 2018 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body Util.Strings.Transforms is
-- ------------------------------
-- Escape the content into the result stream using the JavaScript
-- escape rules.
-- ------------------------------
function Escape_Javascript (Content : String) return String is
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
TR.Escape_Java_Script (Content, Result);
return Ada.Strings.Unbounded.To_String (Result);
end Escape_Javascript;
-- ------------------------------
-- Escape the content into the result stream using the Java
-- escape rules.
-- ------------------------------
function Escape_Java (Content : String) return String is
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
TR.Escape_Java (Content, Result);
return Ada.Strings.Unbounded.To_String (Result);
end Escape_Java;
-- ------------------------------
-- Escape the content into the result stream using the XML
-- escape rules:
-- '<' -> '<'
-- '>' -> '>'
-- ''' -> '''
-- '&' -> '&'
-- -> '&#nnn;' if Character'Pos >= 128
-- ------------------------------
function Escape_Xml (Content : String) return String is
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
TR.Escape_Xml (Content, Result);
return Ada.Strings.Unbounded.To_String (Result);
end Escape_Xml;
end Util.Strings.Transforms;
|
-- Abstract :
--
-- See spec
--
-- Copyright (C) 2017 - 2019 Free Software Foundation, Inc.
--
-- This library is free software; you can redistribute it and/or modify it
-- under terms of the GNU General Public License as published by the Free
-- Software Foundation; either version 3, or (at your option) any later
-- version. This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-- As a special exception under Section 7 of GPL version 3, you are granted
-- additional permissions described in the GCC Runtime Library Exception,
-- version 3.1, as published by the Free Software Foundation.
pragma License (Modified_GPL);
with Ada.Strings.Fixed;
with Gpr_Process_Actions;
package body Wisi.Gpr is
overriding
procedure Initialize
(Data : in out Parse_Data_Type;
Lexer : in WisiToken.Lexer.Handle;
Descriptor : access constant WisiToken.Descriptor;
Base_Terminals : in WisiToken.Base_Token_Array_Access;
Post_Parse_Action : in Post_Parse_Action_Type;
Begin_Line : in WisiToken.Line_Number_Type;
End_Line : in WisiToken.Line_Number_Type;
Begin_Indent : in Integer;
Params : in String)
is
use Ada.Strings.Fixed;
use all type Gpr_Process_Actions.Token_Enum_ID;
First : Integer := Params'First;
Last : Integer := Index (Params, " ");
begin
Wisi.Initialize
(Wisi.Parse_Data_Type (Data), Lexer, Descriptor, Base_Terminals, Post_Parse_Action, Begin_Line, End_Line,
Begin_Indent, "");
Data.First_Comment_ID := +COMMENT_ID;
Data.Last_Comment_ID := WisiToken.Invalid_Token_ID;
Data.Left_Paren_ID := WisiToken.Invalid_Token_ID;
Data.Right_Paren_ID := WisiToken.Invalid_Token_ID;
if Params /= "" then
-- must match [1] wisi-parse-format-language-options
Gpr_Indent := Integer'Value (Params (First .. Last - 1));
First := Last + 1;
Last := Index (Params, " ", First);
Gpr_Indent_Broken := Integer'Value (Params (First .. Last - 1));
First := Last + 1;
Gpr_Indent_When := Integer'Value (Params (First .. Params'Last));
end if;
end Initialize;
end Wisi.Gpr;
|
package calc with SPARK_Mode is
function calc (f1, f2: Float) return Float with
Pre => f1 in -1000.0 .. 1000.0 and f2 in -1000.0 .. 1000.0;
end calc;
|
-- Copyright 2019 Simon Symeonidis (psyomn)
--
-- 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; use Ada.Strings;
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Common_Utils; use Common_Utils;
package body CLI is
procedure Process_Command_Line_Arguments (Conf : in out Listener) is
Total : constant Natural := Argument_Count;
Count : Positive := 1;
Skip : Boolean := False;
begin
if Total = 0 then
return;
end if;
Argument_Parse_Loop : loop
declare
Current_Argument : constant String := Argument (Count);
First_Two : constant String := Current_Argument (1 .. 2);
Hyphenated : constant Boolean := Current_Argument (1) = '-';
begin
if Count + 1 > Argument_Count and Hyphenated then
raise CLI_Argument_Exception with "you need to provide a value";
else
Skip := True;
end if;
if First_Two = "-r" then Apply_Root_Dir_Flag (Conf, Count);
elsif First_Two = "-p" then Apply_Port_Flag (Conf, Count);
elsif First_Two = "-h" then Apply_Host_Flag (Conf, Count);
else raise CLI_Argument_Exception with "non existant flag";
end if;
end;
Count := Count + 1 + (if Skip then 1 else 0);
Skip := False;
exit Argument_Parse_Loop when Count > Total;
end loop Argument_Parse_Loop;
end Process_Command_Line_Arguments;
procedure Apply_Root_Dir_Flag (Conf : in out Listener; Index : Positive) is
New_Path : constant String := Trim (
Source => Argument (Index + 1),
Side => Both
);
begin
Empty_String (Conf.WS_Root_Path);
Conf.WS_Root_Path (1 .. New_Path'Last) := New_Path (1 .. New_Path'Last);
end Apply_Root_Dir_Flag;
procedure Apply_Port_Flag (Conf : in out Listener; Index : Positive) is
Arg : constant String := Argument (Index + 1);
New_Port : constant Natural := Positive'Value (Arg);
begin
Conf.Port_Number := New_Port;
end Apply_Port_Flag;
procedure Apply_Host_Flag (Conf : in out Listener; Index : Positive) is
New_Host : constant String := Trim (
Source => Argument (Index + 1),
Side => Both
);
begin
Empty_String (Conf.Host_Name);
Overwrite (
Source => Conf.Host_Name,
Position => 1,
New_Item => New_Host
);
end Apply_Host_Flag;
end CLI;
|
-- 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 System;
-- nRF51 reference description for radio MCU with ARM 32-bit Cortex-M0
-- Microcontroller at 16MHz CPU clock
package NRF_SVD is
pragma Preelaborate;
--------------------
-- Base addresses --
--------------------
POWER_Base : constant System.Address := System'To_Address (16#40000000#);
CLOCK_Base : constant System.Address := System'To_Address (16#40000000#);
MPU_Base : constant System.Address := System'To_Address (16#40000000#);
AMLI_Base : constant System.Address := System'To_Address (16#40000000#);
RADIO_Base : constant System.Address := System'To_Address (16#40001000#);
UART0_Base : constant System.Address := System'To_Address (16#40002000#);
SPI0_Base : constant System.Address := System'To_Address (16#40003000#);
TWI0_Base : constant System.Address := System'To_Address (16#40003000#);
SPI1_Base : constant System.Address := System'To_Address (16#40004000#);
TWI1_Base : constant System.Address := System'To_Address (16#40004000#);
SPIS1_Base : constant System.Address := System'To_Address (16#40004000#);
SPIM1_Base : constant System.Address := System'To_Address (16#40004000#);
GPIOTE_Base : constant System.Address := System'To_Address (16#40006000#);
ADC_Base : constant System.Address := System'To_Address (16#40007000#);
TIMER0_Base : constant System.Address := System'To_Address (16#40008000#);
TIMER1_Base : constant System.Address := System'To_Address (16#40009000#);
TIMER2_Base : constant System.Address := System'To_Address (16#4000A000#);
RTC0_Base : constant System.Address := System'To_Address (16#4000B000#);
TEMP_Base : constant System.Address := System'To_Address (16#4000C000#);
RNG_Base : constant System.Address := System'To_Address (16#4000D000#);
ECB_Base : constant System.Address := System'To_Address (16#4000E000#);
AAR_Base : constant System.Address := System'To_Address (16#4000F000#);
CCM_Base : constant System.Address := System'To_Address (16#4000F000#);
WDT_Base : constant System.Address := System'To_Address (16#40010000#);
RTC1_Base : constant System.Address := System'To_Address (16#40011000#);
QDEC_Base : constant System.Address := System'To_Address (16#40012000#);
LPCOMP_Base : constant System.Address := System'To_Address (16#40013000#);
SWI_Base : constant System.Address := System'To_Address (16#40014000#);
NVMC_Base : constant System.Address := System'To_Address (16#4001E000#);
PPI_Base : constant System.Address := System'To_Address (16#4001F000#);
FICR_Base : constant System.Address := System'To_Address (16#10000000#);
UICR_Base : constant System.Address := System'To_Address (16#10001000#);
GPIO_Base : constant System.Address := System'To_Address (16#50000000#);
end NRF_SVD;
|
-----------------------------------------------------------------------
-- awa-setup -- Setup and installation
-- Copyright (C) 2016, 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.IO_Exceptions;
with Ada.Directories;
with Util.Files;
with Util.Processes;
with Util.Log.Loggers;
with Util.Streams.Pipes;
with Util.Streams.Buffered;
with Util.Strings;
with ASF.Events.Faces.Actions;
with ASF.Applications.Main.Configs;
with ASF.Applications.Messages.Factory;
with AWA.Applications;
with AWA.Applications.Configs;
with AWA.Components.Factory;
package body AWA.Setup.Applications is
use ASF.Applications;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("AWA.Setup.Applications");
package Save_Binding is
new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Application,
Method => Save,
Name => "save");
package Start_Binding is
new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Application,
Method => Start,
Name => "start");
package Finish_Binding is
new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Application,
Method => Finish,
Name => "finish");
package Configure_Binding is
new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Application,
Method => Configure_Database,
Name => "configure_database");
-- The application base URL.
package P_Base_URL is
new ASF.Applications.Main.Configs.Parameter ("app_url_base",
"http://localhost:8080/#{contextPath}");
Binding_Array : aliased constant Util.Beans.Methods.Method_Binding_Array
:= (Save_Binding.Proxy'Access,
Start_Binding.Proxy'Access,
Finish_Binding.Proxy'Access,
Configure_Binding.Proxy'Access);
protected body State is
-- ------------------------------
-- Wait until the configuration is finished.
-- ------------------------------
entry Wait_Configuring when Value /= CONFIGURING is
begin
null;
end Wait_Configuring;
-- ------------------------------
-- Wait until the server application is initialized and ready.
-- ------------------------------
entry Wait_Ready when Value = READY is
begin
null;
end Wait_Ready;
-- ------------------------------
-- Set the configuration state.
-- ------------------------------
procedure Set (V : in Configure_State) is
begin
Value := V;
end Set;
end State;
overriding
procedure Do_Get (Server : in Redirect_Servlet;
Request : in out ASF.Requests.Request'Class;
Response : in out ASF.Responses.Response'Class) is
pragma Unreferenced (Server);
Context_Path : constant String := Request.Get_Context_Path;
begin
Response.Send_Redirect (Context_Path & "/setup/install.html");
end Do_Get;
-- ------------------------------
-- Get the value identified by the name.
-- ------------------------------
function Get_Value (From : in Application;
Name : in String) return Util.Beans.Objects.Object is
begin
if Name = "database_name" then
return Util.Beans.Objects.To_Object (From.Database.Get_Database);
elsif Name = "database_server" then
return From.Db_Host;
elsif Name = "database_port" then
return From.Db_Port;
elsif Name = "database_user" then
return Util.Beans.Objects.To_Object (From.Database.Get_Property ("user"));
elsif Name = "database_password" then
return Util.Beans.Objects.To_Object (From.Database.Get_Property ("password"));
elsif Name = "database_driver" then
return From.Driver;
elsif Name = "database_root_user" then
return From.Root_User;
elsif Name = "database_root_password" then
return From.Root_Passwd;
elsif Name = "result" then
return From.Result;
end if;
if From.Changed.Exists (Name) then
return Util.Beans.Objects.To_Object (String '(From.Changed.Get (Name)));
end if;
declare
Param : constant String := From.Config.Get (Name);
begin
return Util.Beans.Objects.To_Object (Param);
end;
exception
when others =>
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Set the value identified by the name.
-- ------------------------------
procedure Set_Value (From : in out Application;
Name : in String;
Value : in Util.Beans.Objects.Object) is
begin
if Name = "database_name" then
From.Database.Set_Database (Util.Beans.Objects.To_String (Value));
elsif Name = "database_server" then
From.Db_Host := Value;
elsif Name = "database_port" then
From.Db_Port := Value;
elsif Name = "database_user" then
From.Database.Set_Property ("user", Util.Beans.Objects.To_String (Value));
elsif Name = "database_password" then
From.Database.Set_Property ("password", Util.Beans.Objects.To_String (Value));
elsif Name = "database_driver" then
From.Driver := Value;
elsif Name = "database_root_user" then
From.Root_User := Value;
elsif Name = "database_root_password" then
From.Root_Passwd := Value;
elsif Name = "callback_url" then
From.Changed.Set (Name, Util.Beans.Objects.To_String (Value));
From.Changed.Set ("facebook.callback_url",
Util.Beans.Objects.To_String (Value) & "#{contextPath}/auth/verify");
From.Changed.Set ("google-plus.callback_url",
Util.Beans.Objects.To_String (Value) & "#{contextPath}/auth/verify");
else
From.Changed.Set (Name, Util.Beans.Objects.To_String (Value));
end if;
end Set_Value;
-- ------------------------------
-- Get the database connection string to be used by the application.
-- ------------------------------
function Get_Database_URL (From : in Application) return String is
use Ada.Strings.Unbounded;
Result : Ada.Strings.Unbounded.Unbounded_String;
Driver : constant String := Util.Beans.Objects.To_String (From.Driver);
User : constant String := From.Database.Get_Property ("user");
begin
if Driver = "" then
Append (Result, "mysql");
else
Append (Result, Driver);
end if;
Append (Result, "://");
if Driver /= "sqlite" then
Append (Result, From.Database.Get_Server);
if From.Database.Get_Port /= 0 then
Append (Result, ":");
Append (Result, Util.Strings.Image (From.Database.Get_Port));
end if;
end if;
Append (Result, "/");
Append (Result, From.Database.Get_Database);
if User /= "" then
Append (Result, "?user=");
Append (Result, User);
if From.Database.Get_Property ("password") /= "" then
Append (Result, "&password=");
Append (Result, From.Database.Get_Property ("password"));
end if;
end if;
if Driver = "sqlite" then
if User /= "" then
Append (Result, "&");
else
Append (Result, "?");
end if;
Append (Result, "synchronous=OFF&encoding=UTF-8");
end if;
return To_String (Result);
end Get_Database_URL;
-- ------------------------------
-- Get the command to configure the database.
-- ------------------------------
function Get_Configure_Command (From : in Application) return String is
Database : constant String := From.Get_Database_URL;
Command : constant String := "dynamo create-database db '" & Database & "'";
Root : constant String := Util.Beans.Objects.To_String (From.Root_User);
Passwd : constant String := Util.Beans.Objects.To_String (From.Root_Passwd);
begin
if Root = "" then
return Command;
elsif Passwd = "" then
return Command & " " & Root;
else
return Command & " " & Root & " " & Passwd;
end if;
end Get_Configure_Command;
-- ------------------------------
-- Validate the database configuration parameters.
-- ------------------------------
procedure Validate (From : in out Application) is
Driver : constant String := Util.Beans.Objects.To_String (From.Driver);
Server : constant String := Util.Beans.Objects.To_String (From.Db_Host);
begin
From.Has_Error := False;
if Driver = "sqlite" then
return;
end if;
begin
From.Database.Set_Port (Util.Beans.Objects.To_Integer (From.Db_Port));
exception
when others =>
From.Has_Error := True;
Messages.Factory.Add_Field_Message ("db-port", "setup.setup_database_port_error",
Messages.ERROR);
end;
if Server'Length = 0 then
From.Has_Error := True;
Messages.Factory.Add_Field_Message ("db-server", "setup.setup_database_host_error",
Messages.ERROR);
end if;
From.Database.Set_Server (Server);
end Validate;
-- ------------------------------
-- Configure the database.
-- ------------------------------
procedure Configure_Database (From : in out Application;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is
begin
From.Validate;
if not From.Has_Error then
declare
Pipe : aliased Util.Streams.Pipes.Pipe_Stream;
Buffer : Util.Streams.Buffered.Buffered_Stream;
Content : Ada.Strings.Unbounded.Unbounded_String;
Command : constant String := From.Get_Configure_Command;
begin
Log.Info ("Configure database with {0}", Command);
Pipe.Open (Command, Util.Processes.READ);
Buffer.Initialize (null, Pipe'Unchecked_Access, 64 * 1024);
Buffer.Read (Content);
Pipe.Close;
From.Result := Util.Beans.Objects.To_Object (Content);
From.Has_Error := Pipe.Get_Exit_Status /= 0;
if From.Has_Error then
Log.Error ("Command {0} exited with status {1}", Command,
Util.Strings.Image (Pipe.Get_Exit_Status));
Messages.Factory.Add_Message ("setup.setup_database_error", Messages.ERROR);
if Pipe.Get_Exit_Status = 127 then
Messages.Factory.Add_Message ("setup.setup_dynamo_missing_error",
Messages.ERROR);
end if;
end if;
end;
end if;
if From.Has_Error then
Ada.Strings.Unbounded.Set_Unbounded_String (Outcome, "failure");
end if;
end Configure_Database;
-- ------------------------------
-- Save the configuration.
-- ------------------------------
procedure Save (From : in out Application;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is
pragma Unreferenced (Outcome);
procedure Save_Property (Name : in Ada.Strings.Unbounded.Unbounded_String;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Read_Property (Line : in String);
Path : constant String := Ada.Strings.Unbounded.To_String (From.Path);
New_File : constant String := Path & ".tmp";
Output : Ada.Text_IO.File_Type;
Changed : ASF.Applications.Config := From.Changed;
procedure Read_Property (Line : in String) is
Pos : constant Natural := Util.Strings.Index (Line, '=');
begin
if Pos = 0 or else not Changed.Exists (Line (Line'First .. Pos - 1)) then
Ada.Text_IO.Put_Line (Output, Line);
return;
end if;
Ada.Text_IO.Put (Output, Line (Line'First .. Pos));
Ada.Text_IO.Put_Line (Output, Changed.Get (Line (Line'First .. Pos - 1)));
Changed.Remove (Line (Line'First .. Pos - 1));
end Read_Property;
procedure Save_Property (Name : in Ada.Strings.Unbounded.Unbounded_String;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
begin
Ada.Text_IO.Put (Output, Ada.Strings.Unbounded.To_String (Name));
Ada.Text_IO.Put (Output, "=");
Ada.Text_IO.Put_Line (Output, Ada.Strings.Unbounded.To_String (Value));
end Save_Property;
begin
Log.Info ("Saving configuration file {0}", Path);
Changed.Set ("database", From.Get_Database_URL);
Ada.Text_IO.Create (File => Output, Name => New_File);
Util.Files.Read_File (Path, Read_Property'Access);
Changed.Iterate (Save_Property'Access);
Ada.Text_IO.Close (Output);
Ada.Directories.Delete_File (Path);
Ada.Directories.Rename (Old_Name => New_File,
New_Name => Path);
end Save;
-- ------------------------------
-- Finish the setup to start the application.
-- ------------------------------
procedure Start (From : in out Application;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is
pragma Unreferenced (Outcome);
begin
Log.Info ("Waiting for application to be started");
From.Status.Wait_Ready;
end Start;
-- ------------------------------
-- Finish the setup and exit the setup.
-- ------------------------------
procedure Finish (From : in out Application;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is
begin
Log.Info ("Finish configuration");
From.Save (Outcome);
From.Status.Set (STARTING);
end Finish;
-- ------------------------------
-- This bean provides some methods that can be used in a Method_Expression
-- ------------------------------
overriding
function Get_Method_Bindings (From : in Application)
return Util.Beans.Methods.Method_Binding_Array_Access is
pragma Unreferenced (From);
begin
return Binding_Array'Access;
end Get_Method_Bindings;
-- ------------------------------
-- Enter in the application setup
-- ------------------------------
procedure Setup (App : in out Application;
Config : in String;
Server : in out ASF.Server.Container'Class) is
Path : constant String := AWA.Applications.Configs.Get_Config_Path (Config);
Dir : constant String := Ada.Directories.Containing_Directory (Path);
Done : constant String := Ada.Directories.Compose (Dir, ".initialized");
begin
Log.Info ("Entering configuration for {0}", Path);
App.Path := Ada.Strings.Unbounded.To_Unbounded_String (Path);
begin
App.Config.Load_Properties (Path);
Util.Log.Loggers.Initialize (Path);
exception
when Ada.IO_Exceptions.Name_Error =>
Log.Error ("Cannot read application configuration file: {0}", Path);
end;
-- If the Done file marker exists, the installation was done and we don't want
-- to enter in it again.
if Ada.Directories.Exists (Done) then
Log.Info ("Application {0} is already initialized.", Config);
Log.Info ("Remove {0} if you want to enter in the installation again.", Done);
return;
end if;
App.Initialize (App.Config, App.Factory);
App.Set_Error_Page (ASF.Responses.SC_NOT_FOUND, "/setup/install.html");
App.Set_Global ("contextPath", App.Config.Get ("contextPath"));
App.Set_Global ("setup",
Util.Beans.Objects.To_Object (App'Unchecked_Access,
Util.Beans.Objects.STATIC));
App.Add_Servlet (Name => "redirect",
Server => App.Redirect'Unchecked_Access);
App.Add_Servlet (Name => "faces",
Server => App.Faces'Unchecked_Access);
App.Add_Servlet (Name => "files",
Server => App.Files'Unchecked_Access);
App.Add_Mapping (Pattern => "*.html",
Name => "redirect");
App.Add_Mapping (Pattern => "/setup/*.html",
Name => "faces");
App.Add_Mapping (Pattern => "*.css",
Name => "files");
App.Add_Mapping (Pattern => "*.js",
Name => "files");
App.Add_Mapping (Pattern => "*.png",
Name => "files");
App.Add_Components (AWA.Components.Factory.Definition);
declare
Paths : constant String := App.Get_Config (AWA.Applications.P_Module_Dir.P);
Path : constant String := Util.Files.Find_File_Path ("setup.xml", Paths);
begin
ASF.Applications.Main.Configs.Read_Configuration (App, Path);
exception
when Ada.IO_Exceptions.Name_Error =>
Log.Error ("Setup configuration file '{0}' does not exist", Path);
end;
declare
URL : constant String := App.Config.Get ("google-plus.callback_url", "");
Pos : constant Natural := Util.Strings.Index (URL, '#');
begin
if Pos > 0 then
App.Changed.Set ("callback_url", URL (URL'First .. Pos - 1));
else
App.Changed.Set ("callback_url", "http://mydomain.com/oauth");
end if;
end;
App.Database.Set_Connection (App.Get_Config (AWA.Applications.P_Database.P));
App.Driver := Util.Beans.Objects.To_Object (App.Database.Get_Driver);
if App.Database.Get_Driver = "mysql" then
App.Db_Host := Util.Beans.Objects.To_Object (App.Database.Get_Server);
App.Db_Port := Util.Beans.Objects.To_Object (App.Database.Get_Port);
else
App.Db_Host := Util.Beans.Objects.To_Object (String '("localhost"));
App.Db_Port := Util.Beans.Objects.To_Object (Integer (3306));
end if;
Server.Register_Application (App.Get_Config (AWA.Applications.P_Context_Path.P),
App'Unchecked_Access);
Log.Info ("Connect your browser to {0}/index.html", App.Get_Config (P_Base_URL.P));
App.Status.Wait_Configuring;
Log.Info ("Application setup is now finished");
Log.Info ("Creating the installation marker file {0}", Done);
Util.Files.Write_File (Done, "installed");
end Setup;
-- ------------------------------
-- Configure the application by using the setup application, allowing the administrator to
-- setup the application database, define the application admin parameters. After the
-- configuration is done, register the application in the server container and start it.
-- ------------------------------
procedure Configure (Server : in out ASF.Server.Container'Class;
App : in Application_Access;
Config : in String;
URI : in String) is
Path : constant String := AWA.Applications.Configs.Get_Config_Path (Config);
S : aliased Application;
C : ASF.Applications.Config;
begin
-- Do the application setup.
S.Setup (Config, Server);
-- Load the application configuration file that was configured during the setup process.
begin
C.Load_Properties (Path);
exception
when Ada.IO_Exceptions.Name_Error =>
Log.Error ("Cannot read application configuration file {0}", Path);
end;
-- Initialize the application and register it.
Log.Info ("Initializing application {0}", URI);
Initialize (App, C);
Server.Register_Application (URI, App.all'Access);
S.Status.Set (READY);
delay 2.0;
-- Now we can remove the setup application.
Server.Remove_Application (S'Unchecked_Access);
end Configure;
end AWA.Setup.Applications;
|
with Ada.Assertions; use Ada.Assertions;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package body Rejuvenation.Nested is
function Remove_Nested_Flags
(Source : String; On_Flag : String; Off_Flag : String;
Depth : Natural := 0) return String
is
function Next_Flag_Location
(From : Positive; Flag : String) return Positive;
function Next_Flag_Location
(From : Positive; Flag : String) return Positive
is
I : constant Natural := Index (Source, Flag, From);
begin
return (if I = 0 then Source'Last + 1 else I);
end Next_Flag_Location;
function Next_On_Flag_Location (From : Positive) return Positive is
(Next_Flag_Location (From, On_Flag));
function Next_Off_Flag_Location (From : Positive) return Positive is
(Next_Flag_Location (From, Off_Flag));
Current_Location : Natural := Source'First;
Current_Depth : Natural := Depth;
On_Location : Positive := Next_On_Flag_Location (Current_Location);
Off_Location : Positive := Next_Off_Flag_Location (Current_Location);
Final : Unbounded_String := Null_Unbounded_String;
begin
loop
if On_Location > Source'Last and then Off_Location > Source'Last then
Assert
(Check => Current_Depth = 0,
Message =>
"Unexpectedly at Current_Depth " & Current_Depth'Image);
Append (Final, Source (Current_Location .. Source'Last));
return To_String (Final);
elsif On_Location < Off_Location then
declare
Next_Location : constant Positive :=
On_Location + On_Flag'Length;
Last : constant Positive :=
(if Current_Depth = 0 then Next_Location - 1
else On_Location - 1);
begin
Current_Depth := Current_Depth + 1;
Append (Final, Source (Current_Location .. Last));
Current_Location := Next_Location;
Assert
(Check => Current_Location <= Off_Location,
Message => "Invariant violated");
On_Location := Next_On_Flag_Location (Current_Location);
end;
else
Assert
(Check => Off_Location < On_Location,
Message => "On and Off token can't occur at same location");
declare
Next_Location : constant Positive :=
Off_Location + Off_Flag'Length;
Last : constant Positive :=
(if Current_Depth = 1 then Next_Location - 1
else Off_Location - 1);
begin
Assert
(Check => Current_Depth > 0,
Message =>
"Current_Depth is zero at offset " & Off_Location'Image);
Current_Depth := Current_Depth - 1;
Append (Final, Source (Current_Location .. Last));
Current_Location := Next_Location;
Assert
(Check => Current_Location <= On_Location,
Message => "Invariant violated");
Off_Location := Next_Off_Flag_Location (Current_Location);
end;
end if;
end loop;
end Remove_Nested_Flags;
end Rejuvenation.Nested;
|
with Gdk.Event;
with Gdk.Types.Keysyms;
with Gtkada.Dialogs;
with Gtkada.File_Selection;
with Gtk.Dialog;
with Gtk.File_Chooser;
with Gtk.File_Chooser_Dialog; use Gtk.File_Chooser_Dialog;
with Gtk.List_Store;
with Gtk.Message_Dialog;
with Gtk.Main;
with Gtk.Status_Bar;
with Gtk.Text_Iter;
with Gtk.Tree_Model;
with Gtk.Widget; use Gtk.Widget;
with Pango.Font;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_IO; use Ada.Text_IO;
with Interfaces; use Interfaces;
with assembler;
with gui;
with util;
with vm; use vm;
-- Callback procedures, called from the Gtk GUI.
package body callbacks is
-------------------------
-- Some GUI state vars --
-------------------------
-- this is so we can pop up an "are you sure?" dialog on quit/new/open
unsavedChanges : Boolean := False;
-- current filename we are saving under.
curFileName : Unbounded_String;
-- Output from our assemble procedure. We'll pass this to the VM at boot time.
machinecode : MachineCodeVector.Vector;
-- gives us a chance to catch the signal to delete the main window. If we want
-- to quit, return False.
function tryQuit (Object : access Gtkada_Builder_Record'Class) return Boolean is
pragma Unreferenced (Object);
begin
if unsavedChanges then
return not areYouSure;
end if;
return False;
end tryQuit;
procedure quit (Object : access Gtkada_Builder_Record'Class) is
begin
Gtk.Main.Main_Quit;
end quit;
----------------------------------------------------------------------------
-- assembleCB - callback for GUI "assemble" button.
-- Assemble the source code into an object file that can be loaded into the
-- VM's memory.
----------------------------------------------------------------------------
procedure assembleCB (Object : access Gtkada_Builder_Record'Class) is
pragma Unreferenced (Object);
start : Gtk.Text_Iter.Gtk_Text_Iter;
finish : Gtk.Text_Iter.Gtk_Text_Iter;
assembly : Unbounded_String;
result : Boolean;
errMsg : Unbounded_String;
instructions : assembler.InstructionVector.Vector;
ignore : Gtkada.Dialogs.Message_Dialog_Buttons;
ignore2 : Gtk.Status_Bar.Message_Id;
begin
Ada.Text_IO.Put_Line("Assemble");
ignore2 := Gtk.Status_Bar.Push(gui.statusBar, 1, "Assembling...");
gui.textbuf.Get_Bounds(start, finish);
assembly := To_Unbounded_String(gui.textbuf.Get_Text(
Start => start,
The_End => finish,
Include_Hidden_Chars => True));
-- Assemble the file into a vector of instruction records
result := assembler.parse(source => To_String(assembly),
instructions => instructions,
msg => errMsg);
if not result then
ignore := Gtkada.Dialogs.Message_Dialog(
Msg => To_String(errMsg),
Dialog_Type => Gtkada.Dialogs.Information,
Buttons => Gtkada.Dialogs.Button_OK,
Title => "Parse Error",
Parent => null);
--gui.statusBar.removeAll;
return;
end if;
--gui.statusBar.Push("Code gen...", Context => 0);
-- convert the instruction vector into a vector of machine code insts.
result := assembler.codeGen(instructions => instructions,
objectFile => machinecode,
msg => errMsg);
if not result then
ignore := Gtkada.Dialogs.Message_Dialog(
Msg => To_String(errMsg),
Dialog_Type => Gtkada.Dialogs.Information,
Buttons => Gtkada.Dialogs.Button_OK,
Title => "Code Generation Error",
Parent => null);
--gui.statusBar.Remove_All;
return;
end if;
--gui.statusBar.Push("Loading object file...", Context => 0);
-- Load the opcodes into the machinecode list store.
loadObjectFile : declare
use Gtk.List_Store;
use Gtk.Tree_Model;
machinecodeListIter : Gtk_Tree_Iter;
addr : Unsigned_64 := 0;
inst : Unsigned_64 := 0;
begin
--machinecodeList := Gtk_List_Store(Gtkada.Builder.Get_Object(gui.builder, "machinecodeList"));
gui.machinecodeList.Clear;
Ada.Text_IO.Put_Line(" adding " & Integer(machinecode.Length)'Image & " instructions to liststore");
for i in 0 .. Integer(machinecode.Length)-1 loop
Ada.Text_IO.Put_Line(" adding element " & i'Image);
inst := machinecode.Element(Integer(i));
addr := Unsigned_64(Integer(i));
gui.machinecodeList.Append(Iter => machinecodeListIter);
gui.machinecodeList.Set(Iter => machinecodeListIter,
Column => 0,
Value => util.toHexString(addr));
gui.machinecodeList.Set(Iter => machinecodeListIter,
Column => 1,
Value => util.toHexString(inst));
end loop;
end loadObjectFile;
ignore2 := Gtk.Status_Bar.Push(gui.statusBar, 1, "Assembly Success!");
-- Go ahead and boot the VM
ignore := Gtkada.Dialogs.Message_Dialog(
Msg => "Assembly Finished, click OK to boot the VM.",
Dialog_Type => Gtkada.Dialogs.Information,
Buttons => Gtkada.Dialogs.Button_OK,
Title => "Success",
Parent => null);
vm.boot(machinecode);
gui.updateGUI_VM;
end assembleCB;
----------------------------------------------------------------------------
-- stepCB
-- callback for the "step" button - instruct the VM to single-step an
-- instruction.
----------------------------------------------------------------------------
procedure stepCB (Object : access Gtkada_Builder_Record'Class) is
pragma Unreferenced (Object);
errMsg : Unbounded_String;
healthy : Boolean;
ignore : Gtkada.Dialogs.Message_Dialog_Buttons;
begin
Ada.Text_IO.Put_Line("Step");
healthy := vm.step(errMsg);
if not healthy then
ignore := Gtkada.Dialogs.Message_Dialog(
Msg => To_String(errMsg),
Dialog_Type => Gtkada.Dialogs.Information,
Buttons => Gtkada.Dialogs.Button_OK,
Title => "Exception",
Parent => null);
return;
else
gui.updateGUI_VM;
end if;
end stepCB;
-----------
-- runCB --
-----------
procedure runCB (Object : access Gtkada_Builder_Record'Class) is
pragma Unreferenced (Object);
begin
Ada.Text_IO.Put_Line("Run");
end runCB;
------------
-- stopCB --
------------
procedure stopCB (Object : access Gtkada_Builder_Record'Class) is
pragma Unreferenced (Object);
begin
Ada.Text_IO.Put_Line("Stop");
end stopCB;
-----------
-- newCB --
-----------
procedure newCB (Object : access Gtkada_Builder_Record'Class) is
start : Gtk.Text_Iter.Gtk_Text_Iter;
finish : Gtk.Text_Iter.Gtk_Text_Iter;
begin
if unsavedChanges then
if not areYouSure then
return;
end if;
end if;
gui.textbuf.Get_Bounds(start, finish);
gui.textbuf.Delete(Start => start, The_End => finish);
unsavedChanges := False;
curFileName := To_Unbounded_String("");
gui.setTitle("YOTROC Assembler / Emulator: " & To_String(curFileName));
end newCB;
------------
-- openCB --
------------
procedure openCB (Object : access Gtkada_Builder_Record'Class) is
pragma Unreferenced(Object);
openPath : Unbounded_String;
begin
if unsavedChanges then
if not areYouSure then
return;
end if;
end if;
openPath := To_Unbounded_String(Gtkada.File_Selection.File_Selection_Dialog
(Title => "Open",
Must_Exist => True));
if openPath /= "" then
declare
file : Ada.Text_IO.File_Type;
contents : Unbounded_String;
ignore : Gtkada.Dialogs.Message_Dialog_Buttons;
begin
Ada.Text_IO.Open(File => file,
Mode => Ada.Text_IO.In_File,
Name => To_String(openPath));
-- read in entire file before assigning to text buffer.
while not Ada.Text_IO.End_Of_File(file) loop
declare
use ASCII;
nextChr : Character;
-- lookAhead : Character;
begin
Ada.Text_IO.Get_Immediate(file, nextChr);
Append(contents, nextChr);
end;
end loop;
--Ada.Text_IO.Put_Line("Open: " & To_String(openPath) & " contents: " & To_String(contents));
Ada.Text_IO.Close(file);
gui.textbuf.Set_Text(Text => To_String(contents));
unsavedChanges := False;
curFileName := openPath;
gui.setTitle("YOTROC Assembler / Emulator: " & To_String(curFileName));
exception
when others =>
ignore := Gtkada.Dialogs.Message_Dialog
(Msg => "Error opening file.",
Buttons => Gtkada.Dialogs.Button_OK,
Dialog_Type => Gtkada.Dialogs.Warning,
Title => "Uh oh!");
end;
end if;
end openCB;
-- underlying function for file saves
procedure saveFile(savePath : Unbounded_String) is
ignore : Gtkada.Dialogs.Message_Dialog_Buttons;
file : Ada.Text_IO.File_Type;
bufContents : Unbounded_String;
start, finish : Gtk.Text_Iter.Gtk_Text_Iter;
begin
-- try to open the file
openFile : declare
begin
-- open filepath, write it all out.
Ada.Text_IO.Open(File => file,
Mode => Ada.Text_IO.Out_File,
Name => To_String(savePath));
exception
when Ada.Text_IO.Name_Error =>
Ada.Text_IO.Create(File => file,
Mode => Ada.Text_IO.Out_File,
Name => To_String(savePath));
end openFile;
gui.textbuf.Get_Bounds(start, finish);
bufContents := To_Unbounded_String(gui.textbuf.Get_Text(Start => start, The_End => finish));
Ada.Text_IO.Put_Line("Writing: ");
for i in 1 .. Length(bufContents) loop
Ada.Text_IO.Put(Element(bufContents, i));
Ada.Text_IO.Put(file, Element(bufContents, i));
end loop;
-- if successful, make this the new curFileName
curFileName := savePath;
unsavedChanges := False;
gui.setTitle("YOTROC Assembler / Emulator: " & To_String(curFileName));
Ada.Text_IO.Close(file);
exception
when others =>
ignore := Gtkada.Dialogs.Message_Dialog
(Msg => "Error saving file.",
Buttons => Gtkada.Dialogs.Button_OK,
Dialog_Type => Gtkada.Dialogs.Warning,
Title => "Uh oh!");
end saveFile;
------------
-- saveCB --
------------
procedure saveCB (Object : access Gtkada_Builder_Record'Class) is
savePath : Unbounded_String;
begin
if curFileName = "" then
saveAsCB(Object);
else
saveFile(curFileName);
end if;
end saveCB;
--------------
-- saveAsCB --
--------------
procedure saveAsCB (Object : access Gtkada_Builder_Record'Class) is
pragma Unreferenced(Object);
savePath : Unbounded_String;
begin
savePath := To_Unbounded_String(Gtkada.File_Selection.File_Selection_Dialog
(Title => "Save As",
Default_Dir => "",
Dir_Only => False,
Must_Exist => False));
if savePath /= "" then
saveFile(savePath);
end if;
return;
end saveAsCB;
-------------
-- aboutCB --
-------------
procedure aboutCB (Object : access Gtkada_Builder_Record'Class) is
use Gtk.Dialog;
retButton : Gtkada.Dialogs.Message_Dialog_Buttons;
begin
retButton := Gtkada.Dialogs.Message_Dialog(
Msg => "YOTROC Assembler & Emulator, written by Jon Andrew for Syracuse CIS655. All rights reserved.",
Buttons => Gtkada.Dialogs.Button_OK,
Dialog_Type => Gtkada.Dialogs.Information,
Title => "About");
-- confirmDialog.Destroy;
end aboutCB;
----------------------------------------------------------------------------
-- editCB - called whenever changes are made to the textbuffer
----------------------------------------------------------------------------
procedure editCB (Object : access Gtk.Text_Buffer.Gtk_Text_Buffer_Record'Class) is
begin
--TODO: it would be kind of fun to add syntax highlighting here.
--Ada.Text_IO.Put_Line("textview changed");
unsavedChanges := True;
end editCB;
---------------------------------------------------------------------------
-- confirmUnsaved
-- pop up a dialog confirming that they want to exit/open file, etc.
-- when there are unsaved changes. Return True if they want to proceed.
---------------------------------------------------------------------------
function areYouSure return Boolean is
use Gtk.Dialog;
confirmDialog : Gtk.Message_Dialog.Gtk_Message_Dialog;
confirmYesNo : Gtk.Dialog.Gtk_Response_Type;
confirmFlags : Gtk.Dialog.Gtk_Dialog_Flags;
begin
confirmFlags := Gtk.Dialog.Modal;
confirmDialog := Gtk.Message_Dialog.Gtk_Message_Dialog_New
(Parent => null,
The_Type => Gtk.Message_Dialog.Message_Question,
Flags => confirmFlags,
Buttons => Gtk.Message_Dialog.Buttons_Yes_No,
Message => "You have unsaved changes, are you sure you want to do this?");
confirmYesNo := confirmDialog.Run;
confirmDialog.Destroy;
return confirmYesNo = Gtk.Dialog.Gtk_Response_Yes;
end areYouSure;
end callbacks;
|
-- { dg-do compile }
-- { dg-options "-g" }
with Taft_Type3_Pkg; use Taft_Type3_Pkg;
procedure Taft_Type3 is
subtype S is String (1..32);
Empty : constant S := (others => ' ');
procedure Proc (Data : in out T) is begin null; end;
task type Task_T is
entry Send (Data : in out T);
end;
task body Task_T is
type List_T is array (1 .. 4) of S;
L : List_T := (others => Empty);
begin
accept Send (Data : in out T) do
Proc (Data);
end;
end;
begin
null;
end;
|
with Ada.Text_IO; use Ada.Text_IO;
procedure Man_Or_Boy is
function Zero return Integer is begin return 0; end Zero;
function One return Integer is begin return 1; end One;
function Neg return Integer is begin return -1; end Neg;
function A
( K : Integer;
X1, X2, X3, X4, X5 : access function return Integer
) return Integer is
M : Integer := K; -- K is read-only in Ada. Here is a mutable copy of
function B return Integer is
begin
M := M - 1;
return A (M, B'Access, X1, X2, X3, X4);
end B;
begin
if M <= 0 then
return X4.all + X5.all;
else
return B;
end if;
end A;
begin
Put_Line
( Integer'Image
( A
( 10,
One'Access, -- Returns 1
Neg'Access, -- Returns -1
Neg'Access, -- Returns -1
One'Access, -- Returns 1
Zero'Access -- Returns 0
) ) );
end Man_Or_Boy;
|
-----------------------------------------------------------------------
-- asf-factory -- Component and tag factory
-- Copyright (C) 2009, 2010, 2011, 2012, 2013, 2018 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Views.Nodes;
with ASF.Converters;
with ASF.Validators;
with EL.Objects;
private with Util.Beans.Objects.Hash;
private with Ada.Containers;
private with Ada.Containers.Hashed_Maps;
-- The <b>ASF.Factory</b> is the main factory for building the facelet
-- node tree and defining associated component factory. A binding library
-- must be registered before the application starts. The binding library
-- must not be changed (this is a read-only static definition of names
-- associated with create functions).
package ASF.Factory is
-- ------------------------------
-- List of bindings
-- ------------------------------
-- The binding array defines a set of XML entity names that represent
-- a library accessible through a XML name-space. The binding array
-- must be sorted on the binding name. The <b>Check</b> procedure will
-- verify this assumption when the bindings are registered in the factory.
type Binding_Array is array (Natural range <>) of aliased ASF.Views.Nodes.Binding_Type;
type Binding_Array_Access is access constant Binding_Array;
type Factory_Bindings is limited record
URI : ASF.Views.Nodes.Name_Access;
Bindings : Binding_Array_Access;
end record;
type Factory_Bindings_Access is access constant Factory_Bindings;
-- ------------------------------
-- Component Factory
-- ------------------------------
-- The <b>Component_Factory</b> is the main entry point to register bindings
-- and resolve them when an XML file is read.
type Component_Factory is limited private;
-- Register a binding library in the factory.
procedure Register (Factory : in out Component_Factory;
Bindings : in Factory_Bindings_Access);
procedure Register (Factory : in out Component_Factory;
URI : in ASF.Views.Nodes.Name_Access;
Name : in ASF.Views.Nodes.Name_Access;
Tag : in ASF.Views.Nodes.Tag_Node_Create_Access;
Create : in ASF.Views.Nodes.Create_Access);
-- Find the create function in bound to the name in the given URI name-space.
-- Returns null if no such binding exist.
function Find (Factory : in Component_Factory;
URI : in String;
Name : in String) return ASF.Views.Nodes.Binding_Type;
-- ------------------------------
-- Converter Factory
-- ------------------------------
-- The <b>Converter_Factory</b> registers the converters which can be used
-- to convert a value into a string or the opposite.
-- Register the converter instance under the given name.
procedure Register (Factory : in out Component_Factory;
Name : in String;
Converter : in ASF.Converters.Converter_Access);
-- Find the converter instance that was registered under the given name.
-- Returns null if no such converter exist.
function Find (Factory : in Component_Factory;
Name : in EL.Objects.Object) return ASF.Converters.Converter_Access;
-- ------------------------------
-- Validator Factory
-- ------------------------------
-- Register the validator instance under the given name.
procedure Register (Factory : in out Component_Factory;
Name : in String;
Validator : in ASF.Validators.Validator_Access);
-- Find the validator instance that was registered under the given name.
-- Returns null if no such validator exist.
function Find (Factory : in Component_Factory;
Name : in EL.Objects.Object) return ASF.Validators.Validator_Access;
private
use ASF.Converters;
use ASF.Validators;
use ASF.Views.Nodes;
-- The tag name defines a URI with the name.
type Tag_Name is record
URI : ASF.Views.Nodes.Name_Access;
Name : ASF.Views.Nodes.Name_Access;
end record;
-- Compute a hash for the tag name.
function Hash (Key : in Tag_Name) return Ada.Containers.Hash_Type;
-- Returns true if both tag names are identical.
function "=" (Left, Right : in Tag_Name) return Boolean;
-- Tag library map indexed on the library namespace.
package Factory_Maps is new
Ada.Containers.Hashed_Maps (Key_Type => Tag_Name,
Element_Type => Binding_Type,
Hash => Hash,
Equivalent_Keys => "=");
-- Converter map indexed on the converter name.
-- The key is an EL.Objects.Object to minimize the conversions when searching
-- for a converter.
package Converter_Maps is new
Ada.Containers.Hashed_Maps (Key_Type => EL.Objects.Object,
Element_Type => Converter_Access,
Hash => EL.Objects.Hash,
Equivalent_Keys => EL.Objects."=");
-- Validator map indexed on the validator name.
-- The key is an EL.Objects.Object to minimize the conversions when searching
-- for a validator.
package Validator_Maps is new
Ada.Containers.Hashed_Maps (Key_Type => EL.Objects.Object,
Element_Type => Validator_Access,
Hash => EL.Objects.Hash,
Equivalent_Keys => EL.Objects."=");
type Component_Factory is limited record
Map : Factory_Maps.Map;
Converters : Converter_Maps.Map;
Validators : Validator_Maps.Map;
end record;
end ASF.Factory;
|
with AVR, AVR.MCU; use AVR;
with Interfaces;
use Interfaces;
package Hardware.PWM is
-- Set Servo_ISR as the TIMER1 COMPA handler. See page 101 of the
-- ATmega2560 datasheet for more details.
procedure Servo_ISR;
pragma Machine_Attribute (Entity => Servo_ISR,
Attribute_Name => "interrupt");
pragma Export (C, Servo_ISR, MCU.Sig_Timer1_COMPA_String);
Max_Servos : constant := 4; -- Board has 4 PWM connectors.
type Servo_Index is range 1 .. Max_Servos;
procedure Connect (pin : in AVR.Bit_Number; which : out Servo_Index);
procedure Trim (which : in Servo_Index; trim : in Integer_16);
procedure Set (which : in Servo_Index; us : in Unsigned_16);
private
Duty_Cycle : constant := 20000; -- 20ms pulse width
Update_Interval : constant := 40000;
Update_Wait : constant := 5; -- Allow for minor interrupt delays.
-- Specified in the servo datasheet and common to this hardware
-- configuration.
Min_Pulse : constant := 1300;
Mid_Pulse : constant := 1500;
Max_Pulse : constant := 1700;
type Servo is
record
Pin : AVR.Bit_Number;
Ticks : Unsigned_16;
Min : Unsigned_16;
Max : Unsigned_16;
Trim : Integer_16;
end record;
type Servo_ptr is access Servo;
Servos : array (1 .. Max_Servos) of Servo_ptr;
-- 0 is used to indicate the refresh cycle has completed.
Active_Servos : Integer range 0 .. Max_Servos := 0;
Current_Servo : Integer range 0 .. Max_Servos := 1;
end Hardware.PWM;
|
with Courbes.Singletons; use Courbes.Singletons;
with Courbes.Droites; use Courbes.Droites;
with Courbes.Bezier_Cubiques; use Courbes.Bezier_Cubiques;
with Courbes.Bezier_Quadratiques; use Courbes.Bezier_Quadratiques;
package Courbes.Visiteurs is
type Visiteur_Courbe is abstract tagged null record;
procedure Visiter(Self : Visiteur_Courbe; C : Courbe);
procedure Visiter(Self : Visiteur_Courbe; D : Droite);
procedure Visiter(Self : Visiteur_Courbe; S : Singleton);
procedure Visiter(Self : Visiteur_Courbe; BC : Bezier_Cubique);
procedure Visiter(Self : Visiteur_Courbe; BQ : Bezier_Quadratique);
end Courbes.Visiteurs;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2019, Fabien Chouteau --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Text_IO;
with Ada.Command_Line;
with GNAT.Command_Line; use GNAT.Command_Line;
with GNAT.Strings; use GNAT.Strings;
with LibRISCV.Sim.Hart;
with LibRISCV.Sim.Platform;
with LibRISCV.Sim.Memory_Bus;
with LibRISCV.Loader;
with LibRISCV.Signature;
with LibRISCV.Sim.Shutdown;
with LibRISCV.Sim.Log;
with LibRISCV.Sim.GDB_Remote_Target;
use LibRISCV;
procedure Main is
Config : Command_Line_Configuration;
Signature_Path : aliased String_Access := null;
Log_Enable : aliased String_Access := null;
HTIF_Enable : aliased Boolean := False;
GDB_Enable : aliased Boolean := False;
SOC : aliased Sim.Platform.Instance (Hart_Count => 1);
Bus : aliased Sim.Memory_Bus.Instance (RAM_Base => 16#8000_0000#,
RAM_Size => 256 * 1024);
GDB_Target : Sim.GDB_Remote_Target.Instance (SOC'Unchecked_Access,
Bus'Unchecked_Access,
256);
use type Sim.Platform.State_Kind;
use type Sim.Hart.State_Kind;
begin
declare
begin
Define_Switch
(Config, Signature_Path'Access, "-s:",
Long_Switch => "--signature=",
Help => "Pathname for the test signature output");
Define_Switch
(Config, Log_Enable'Access, "-l:",
Long_Switch => "--log=",
Help =>
"Comma separated list of log topics to enable/disable");
Define_Switch
(Config, HTIF_Enable'Access, "-t",
Long_Switch => "--htif",
Help => "Enable the Host Target interface");
Define_Switch
(Config, GDB_Enable'Access, "-g",
Long_Switch => "--gdb",
Help => "Enable the GDB remote interface (localhost:1234)");
Set_Usage
(Config,
"[switches] binary.elf",
"RISC-V simulator");
Getopt (Config);
exception
when GNAT.Command_Line.Invalid_Switch =>
Ada.Command_Line.Set_Exit_Status (1);
return;
when GNAT.Command_Line.Exit_From_Command_Line =>
return;
end;
if Signature_Path /= null and then Signature_Path.all /= "" then
Signature.Signature_Filepath (Signature_Path.all);
end if;
if Log_Enable /= null and then Log_Enable.all /= "" then
if not LibRISCV.Sim.Log.Set_Arg (Log_Enable.all) then
Ada.Text_IO.Put_Line ("Invalid log argument: '" &
Log_Enable.all & "'");
Ada.Command_Line.Set_Exit_Status (1);
return;
end if;
end if;
if HTIF_Enable then
Bus.Enable_HTIF;
end if;
loop
declare
Arg : constant String := Get_Argument (Do_Expansion => True);
begin
exit when Arg'Length = 0;
Loader.Load_Elf (Bus, Arg);
end;
end loop;
SOC.Reset;
if GDB_Enable then
GDB_Target.Start_Server;
else
SOC.Resume;
end if;
loop
if GDB_Enable then
GDB_Target.Poll;
end if;
SOC.Cycle (Bus);
if SOC.Get_Hart (1).State = Sim.Hart.Debug_Halt then
case SOC.Get_Hart (1).Halt_Source is
when Sim.Hart.None => null;
when Sim.Hart.Single_Step => GDB_Target.Halted_On_Single_Step;
when Sim.Hart.Breakpoint => GDB_Target.Halted_On_Breakpoint;
when Sim.Hart.Watchpoint => null;
end case;
end if;
exit when SOC.State = Sim.Platform.Reset or else Sim.Shutdown.Requested;
end loop;
Signature.Dump_Signature (Bus);
end Main;
|
-- ////////////////////////////////////////////////////////////
-- //
-- // SFML - Simple and Fast Multimedia Library
-- // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
-- //
-- // This software is provided 'as-is', without any express or implied warranty.
-- // In no event will the authors be held liable for any damages arising from the use of this software.
-- //
-- // Permission is granted to anyone to use this software for any purpose,
-- // including commercial applications, and to alter it and redistribute it freely,
-- // subject to the following restrictions:
-- //
-- // 1. The origin of this software must not be misrepresented;
-- // you must not claim that you wrote the original software.
-- // If you use this software in a product, an acknowledgment
-- // in the product documentation would be appreciated but is not required.
-- //
-- // 2. Altered source versions must be plainly marked as such,
-- // and must not be misrepresented as being the original software.
-- //
-- // 3. This notice may not be removed or altered from any source distribution.
-- //
-- ////////////////////////////////////////////////////////////
-- ////////////////////////////////////////////////////////////
-- // Headers
-- ////////////////////////////////////////////////////////////
with Sf.Config;
with Sf.Graphics.Types;
package Sf.Graphics.PostFX is
use Sf.Config;
use Sf.Graphics.Types;
-- ////////////////////////////////////////////////////////////
-- /// Create a new post-fx from a file
-- ///
-- /// \param Filename : File to load
-- ///
-- /// \return A new sfPostFX object, or NULL if it failed
-- ///
-- ////////////////////////////////////////////////////////////
function sfPostFX_CreateFromFile (Filename : String) return sfPostFX_Ptr;
-- ////////////////////////////////////////////////////////////
-- /// Create a new post-fx from an effect source code
-- ///
-- /// \param Effect : Source code of the effect
-- ///
-- /// \return A new sfPostFX object, or NULL if it failed
-- ///
-- ////////////////////////////////////////////////////////////
function sfPostFX_CreateFromMemory (Effect : String) return sfPostFX_Ptr;
-- ////////////////////////////////////////////////////////////
-- /// Destroy an existing post-fx
-- ///
-- /// \param PostFX : PostFX to delete
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfPostFX_Destroy (PostFX : sfPostFX_Ptr);
-- ////////////////////////////////////////////////////////////
-- /// Change a parameter of a post-fx (1 float)
-- ///
-- /// \param PostFX : Post-effect to modify
-- /// \param Name : Parameter name in the effect
-- /// \param X : Value to assign
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfPostFX_SetParameter1 (PostFX : sfPostFX_Ptr; Name : String; X : Float);
-- ////////////////////////////////////////////////////////////
-- /// Change a parameter of a post-fx (2 floats)
-- ///
-- /// \param PostFX : Post-effect to modify
-- /// \param Name : Parameter name in the effect
-- /// \param X, Y : Values to assign
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfPostFX_SetParameter2 (PostFX : sfPostFX_Ptr; Name : String; X, Y : Float);
-- ////////////////////////////////////////////////////////////
-- /// Change a parameter of a post-fx (3 floats)
-- ///
-- /// \param PostFX : Post-effect to modify
-- /// \param Name : Parameter name in the effect
-- /// \param X, Y, Z : Values to assign
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfPostFX_SetParameter3 (PostFX : sfPostFX_Ptr; Name : String; X, Y, Z : Float);
-- ////////////////////////////////////////////////////////////
-- /// Change a parameter of a post-fx (4 floats)
-- ///
-- /// \param PostFX : Post-effect to modify
-- /// \param Name : Parameter name in the effect
-- /// \param X, Y, Z, W : Values to assign
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfPostFX_SetParameter4 (PostFX : sfPostFX_Ptr; Name : String; X, Y, Z, W : Float);
-- ////////////////////////////////////////////////////////////
-- /// Set a texture parameter in a post-fx
-- ///
-- /// \param PostFX : Post-effect to modify
-- /// \param Name : Texture name in the effect
-- /// \param Texture : Image to set (pass NULL to use content of current framebuffer)
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfPostFX_SetTexture (PostFX : sfPostFX_Ptr; Name : String; Texture : sfImage_Ptr);
-- ////////////////////////////////////////////////////////////
-- /// Tell whether or not the system supports post-effects
-- ///
-- /// \return sfTrue if the system can use post-effects
-- ///
-- ////////////////////////////////////////////////////////////
function sfPostFX_CanUsePostFX return sfBool;
private
pragma Import (C, sfPostFX_Destroy, "sfPostFX_Destroy");
pragma Import (C, sfPostFX_CanUsePostFX, "sfPostFX_CanUsePostFX");
end Sf.Graphics.PostFX;
|
-- 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.
package Orka.Contexts.EGL.Wayland is
pragma Preelaborate;
type Wayland_EGL_Context is limited new Context with private;
overriding
function Create_Context
(Version : Context_Version;
Flags : Context_Flags := (others => False)) return Wayland_EGL_Context;
-- Raise Program_Error due to the missing native Wayland display
--
-- This function must be overriden and internally call the function below.
function Create_Context
(Window : Standard.EGL.Native_Display_Ptr;
Version : Context_Version;
Flags : Context_Flags := (others => False)) return Wayland_EGL_Context;
-- Return a Wayland EGL context
private
type Wayland_EGL_Context is limited new EGL_Context with record
Context : Standard.EGL.Objects.Contexts.Context (Standard.EGL.Objects.Displays.Wayland);
end record;
overriding
function Is_Current (Object : Wayland_EGL_Context; Kind : Task_Kind) return Boolean is
(Object.Context.Is_Current
(case Kind is
when Current_Task => Standard.EGL.Objects.Contexts.Current_Task,
when Any_Task => Standard.EGL.Objects.Contexts.Any_Task));
overriding
procedure Make_Current (Object : Wayland_EGL_Context);
overriding
procedure Make_Not_Current (Object : Wayland_EGL_Context);
end Orka.Contexts.EGL.Wayland;
|
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Google_Naive;
procedure test_google_naive is
type Double is digits 10 ;
package Double_Text_Io is new Ada.Text_IO.Float_IO (Double);
use Double_Text_Io;
Fichier : constant String := "Fichier_Test.net";
Alpha : constant Double := 0.85;
package Google_Naive_Test is new Google_Naive(2, Double);
use Google_Naive_Test;
procedure Construire_Fichier is
File : File_Type;
begin
Create(File, Out_File, Fichier);
Put(File, 3, 0);
New_Line(File);
For I in 0..2 loop
if I = 1 then
Put(File, I, 0);
Put(File, 0, 2);
New_Line(File);
Put(File, I, 0);
Put(File, 2, 2);
New_Line(File);
elsif I = 0 then
Put(File, I, 0);
Put(File, 1, 2);
New_Line(File);
else
null;
end if;
end loop;
Close(File);
end Construire_Fichier;
procedure Initialiser_Vecteur_Poids(V : out T_Vecteur) is
begin
for I in 0..2 loop
if I = 0 then
Modifier(V,I,0.2587);
elsif I = 1 then
Modifier(V,I,2.33654);
else
Modifier(V,I,1.2587);
end if;
end loop;
end Initialiser_Vecteur_Poids;
procedure Construire_exemple_Sujet (A, B : out T_Google; C : out T_Vecteur) is
begin
Initialiser(A);
Initialiser(B);
Initialiser(C,1.0);
For i in 0..2 loop
For j in 0..2 loop
Modifier(A,i,j,Double(j*i));
Modifier(B,i,j,1.0);
end loop;
end loop;
end Construire_exemple_Sujet;
procedure Tester_Sont_Egaux is
A, B : T_Google;
begin
Put_Line ("=== Tester_Sont_Egaux..."); New_Line;
Initialiser(A);
Initialiser(B);
For i in 0..2 loop
For j in 0..2 loop
Modifier(A,i,j,1.0);
Modifier(B,i,j,Double(1));
end loop;
Pragma Assert(Sont_Egaux(A,B));
end loop;
end Tester_Sont_Egaux;
procedure Tester_Calcul_Google is
G : T_Google;
begin
Put_Line ("=== Tester_Calcul_Google..."); New_Line;
Calcul_Google(G, Fichier, Alpha);
Afficher(G);
New_Line;
pragma Assert(Composante(G,0,0) = (1.0-Alpha)/3.0);
pragma Assert(Composante(G,1,0) = Alpha/2.0 + (1.0-Alpha)/3.0);
pragma Assert(Composante(G,2,2) = 1.0/3.0);
pragma Assert(Composante(G,0,0) = Composante(G,1,1));
pragma Assert(Composante(G,2,0) = Composante(G,2,1));
end Tester_Calcul_Google;
procedure Tester_Remplir_Fichier is
Fichier1, Fichier2 : File_Type;
V : T_Vecteur;
Indice, N, Nb_Iter : Integer;
Poids, alph : Double;
begin
Put_Line ("=== Tester_Remplir_Fichiers..."); New_Line;
Initialiser_Vecteur_Poids(V);
Remplir_Fichier(V, 3, 150, Alpha, Fichier);
Open(Fichier1,In_File,"Fichier_Test.p");
Open(Fichier2,In_File,"Fichier_Test.ord");
Get(Fichier1, N);
pragma Assert(N = 3);
Get(Fichier1, alph);
pragma Assert(alph = Alpha);
Get(Fichier1, Nb_Iter);
pragma Assert(Nb_Iter = 150);
for I in 0..2 loop
Get(Fichier2, Indice);
Get(Fichier1, Poids);
if I = 0 then
pragma Assert(Indice = 1);
pragma Assert(Poids = 2.33654);
elsif I = 1 then
pragma Assert(Indice = 2);
pragma Assert(Poids = 1.2587);
else
pragma Assert(Indice = 0);
pragma Assert(Poids = 0.2587);
end if;
end loop;
Close(Fichier1);
Close(Fichier2);
end Tester_Remplir_Fichier;
procedure Tester_Produit_Matriciel is
A : T_Google;
B : T_Google;
V : T_Vecteur;
somme : Double;
begin
Put_Line ("=== Tester_Produit_Matriciel..."); New_Line;
Construire_Exemple_Sujet (A, B, V);
Produit_Matriciel(V,A);
For i in 0..2 loop
somme := 0.0;
For j in 0..2 loop
somme := somme + Double(i*j);
end loop;
Pragma Assert(Composante(V,i)=somme);
end loop;
Initialiser(V,1.0);
Produit_Matriciel(V,B);
For I in 0..2 loop
pragma Assert(Composante(V,i) = 3.0);
end loop;
end Tester_Produit_Matriciel;
begin
Construire_Fichier;
Tester_Produit_Matriciel;
Tester_Sont_Egaux;
Tester_Calcul_Google;
Tester_Remplir_Fichier;
Put_Line("Fin des tests. Ok!");
end test_google_naive;
|
package body SomeClass is
function someFunction (Self : in SomeClass) return Integer is
begin
return Self.someAttribute;
end someFunction;
procedure someProcedure (Self : in SomeClass) is
begin
null;
end someProcedure;
procedure someUnrelatedProcedure is
begin
null;
end someUnrelatedProcedure;
end SomeClass;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2018, Universidad Politécnica de Madrid --
-- --
-- This is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
-- License for more details. You should have received a copy of the GNU --
-- General Public License distributed with this software; see file --
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy --
-- of the license. --
-- --
------------------------------------------------------------------------------
-- TMP36 temperature sensor reading
-- See TMP35/TMP36/TMP37 datasheet
package HK_Data.TMP36 is
type Temperature_Range is digits 5 range -40.0 .. +125.0;
function Temperature (R : Sensor_Reading) return Temperature_Range
with Inline;
end HK_Data.TMP36;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- T R E E _ I O --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- 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 Debug; use Debug;
with Output; use Output;
with Unchecked_Conversion;
package body Tree_IO is
Debug_Flag_Tree : Boolean := False;
-- Debug flag for debug output from tree read/write
-------------------------------------------
-- Compression Scheme Used for Tree File --
-------------------------------------------
-- We don't just write the data directly, but instead do a mild form
-- of compression, since we expect lots of compressible zeroes and
-- blanks. The compression scheme is as follows:
-- 00nnnnnn followed by nnnnnn bytes (non compressed data)
-- 01nnnnnn indicates nnnnnn binary zero bytes
-- 10nnnnnn indicates nnnnnn ASCII space bytes
-- 11nnnnnn bbbbbbbb indicates nnnnnnnn occurrences of byte bbbbbbbb
-- Since we expect many zeroes in trees, and many spaces in sources,
-- this compression should be reasonably efficient. We can put in
-- something better later on.
-- Note that this compression applies to the Write_Tree_Data and
-- Read_Tree_Data calls, not to the calls to read and write single
-- scalar values, which are written in memory format without any
-- compression.
C_Noncomp : constant := 2#00_000000#;
C_Zeros : constant := 2#01_000000#;
C_Spaces : constant := 2#10_000000#;
C_Repeat : constant := 2#11_000000#;
-- Codes for compression sequences
Max_Count : constant := 63;
-- Maximum data length for one compression sequence
Max_Comp : constant := Max_Count + 1;
-- Maximum length of one compression sequence
-- The above compression scheme applies only to data written with the
-- Tree_Write routine and read with Tree_Read. Data written using the
-- Tree_Write_Char or Tree_Write_Int routines and read using the
-- corresponding input routines is not compressed.
type Int_Bytes is array (1 .. 4) of Byte;
for Int_Bytes'Size use 32;
function To_Int_Bytes is new Unchecked_Conversion (Int, Int_Bytes);
function To_Int is new Unchecked_Conversion (Int_Bytes, Int);
----------------------
-- Global Variables --
----------------------
Tree_FD : File_Descriptor;
-- File descriptor for tree
Buflen : constant Int := 8_192;
-- Length of buffer for read and write file data
Buf : array (Pos range 1 .. Buflen) of Byte;
-- Read/write file data buffer
Bufn : Nat;
-- Number of bytes read/written from/to buffer
Buft : Nat;
-- Total number of bytes in input buffer containing valid data. Used only
-- for input operations. There is data left to be processed in the buffer
-- if Buft > Bufn. A value of zero for Buft means that the buffer is empty.
-----------------------
-- Local Subprograms --
-----------------------
procedure Read_Buffer;
-- Reads data into buffer, setting Bufe appropriately
function Read_Byte return Byte;
pragma Inline (Read_Byte);
-- Returns next byte from input file, raises Tree_Format_Error if none left
procedure Write_Buffer;
-- Writes out current buffer contents
procedure Write_Byte (B : Byte);
pragma Inline (Write_Byte);
-- Write one byte to output buffer, checking for buffer-full condition
-----------------
-- Read_Buffer --
-----------------
procedure Read_Buffer is
begin
Buft := Int (Read (Tree_FD, Buf (1)'Address, Integer (Buflen)));
if Buft = 0 then
raise Tree_Format_Error;
else
Bufn := 0;
end if;
end Read_Buffer;
---------------
-- Read_Byte --
---------------
function Read_Byte return Byte is
begin
if Bufn = Buft then
Read_Buffer;
end if;
Bufn := Bufn + 1;
return Buf (Bufn);
end Read_Byte;
--------------------
-- Tree_Read_Bool --
--------------------
procedure Tree_Read_Bool (B : out Boolean) is
begin
B := Boolean'Val (Read_Byte);
if Debug_Flag_Tree then
if B then
Write_Str ("True");
else
Write_Str ("False");
end if;
Write_Eol;
end if;
end Tree_Read_Bool;
--------------------
-- Tree_Read_Char --
--------------------
procedure Tree_Read_Char (C : out Character) is
begin
C := Character'Val (Read_Byte);
if Debug_Flag_Tree then
Write_Str ("==> transmitting Character = ");
Write_Char (C);
Write_Eol;
end if;
end Tree_Read_Char;
--------------------
-- Tree_Read_Data --
--------------------
procedure Tree_Read_Data (Addr : Address; Length : Int) is
type S is array (Pos) of Byte;
-- This is a big array, for which we have to suppress the warning
type SP is access all S;
function To_SP is new Unchecked_Conversion (Address, SP);
Data : constant SP := To_SP (Addr);
-- Data buffer to be read as an indexable array of bytes
OP : Pos := 1;
-- Pointer to next byte of data buffer to be read into
B : Byte;
C : Byte;
L : Int;
begin
if Debug_Flag_Tree then
Write_Str ("==> transmitting ");
Write_Int (Length);
Write_Str (" data bytes");
Write_Eol;
end if;
-- Verify data length
Tree_Read_Int (L);
if L /= Length then
Write_Str ("==> transmitting, expected ");
Write_Int (Length);
Write_Str (" bytes, found length = ");
Write_Int (L);
Write_Eol;
raise Tree_Format_Error;
end if;
-- Loop to read data
while OP <= Length loop
-- Get compression control character
B := Read_Byte;
C := B and 2#00_111111#;
B := B and 2#11_000000#;
-- Non-repeat case
if B = C_Noncomp then
if Debug_Flag_Tree then
Write_Str ("==> uncompressed: ");
Write_Int (Int (C));
Write_Str (", starting at ");
Write_Int (OP);
Write_Eol;
end if;
for J in 1 .. C loop
Data (OP) := Read_Byte;
OP := OP + 1;
end loop;
-- Repeated zeroes
elsif B = C_Zeros then
if Debug_Flag_Tree then
Write_Str ("==> zeroes: ");
Write_Int (Int (C));
Write_Str (", starting at ");
Write_Int (OP);
Write_Eol;
end if;
for J in 1 .. C loop
Data (OP) := 0;
OP := OP + 1;
end loop;
-- Repeated spaces
elsif B = C_Spaces then
if Debug_Flag_Tree then
Write_Str ("==> spaces: ");
Write_Int (Int (C));
Write_Str (", starting at ");
Write_Int (OP);
Write_Eol;
end if;
for J in 1 .. C loop
Data (OP) := Character'Pos (' ');
OP := OP + 1;
end loop;
-- Specified repeated character
else -- B = C_Repeat
B := Read_Byte;
if Debug_Flag_Tree then
Write_Str ("==> other char: ");
Write_Int (Int (C));
Write_Str (" (");
Write_Int (Int (B));
Write_Char (')');
Write_Str (", starting at ");
Write_Int (OP);
Write_Eol;
end if;
for J in 1 .. C loop
Data (OP) := B;
OP := OP + 1;
end loop;
end if;
end loop;
-- At end of loop, data item must be exactly filled
if OP /= Length + 1 then
raise Tree_Format_Error;
end if;
end Tree_Read_Data;
--------------------------
-- Tree_Read_Initialize --
--------------------------
procedure Tree_Read_Initialize (Desc : File_Descriptor) is
begin
Buft := 0;
Bufn := 0;
Tree_FD := Desc;
Debug_Flag_Tree := Debug_Flag_5;
end Tree_Read_Initialize;
-------------------
-- Tree_Read_Int --
-------------------
procedure Tree_Read_Int (N : out Int) is
N_Bytes : Int_Bytes;
begin
for J in 1 .. 4 loop
N_Bytes (J) := Read_Byte;
end loop;
N := To_Int (N_Bytes);
if Debug_Flag_Tree then
Write_Str ("==> transmitting Int = ");
Write_Int (N);
Write_Eol;
end if;
end Tree_Read_Int;
-------------------
-- Tree_Read_Str --
-------------------
procedure Tree_Read_Str (S : out String_Ptr) is
N : Nat;
begin
Tree_Read_Int (N);
S := new String (1 .. Natural (N));
Tree_Read_Data (S.all (1)'Address, N);
end Tree_Read_Str;
-------------------------
-- Tree_Read_Terminate --
-------------------------
procedure Tree_Read_Terminate is
begin
-- Must be at end of input buffer, so we should get Tree_Format_Error
-- if we try to read one more byte, if not, we have a format error.
declare
B : Byte;
begin
B := Read_Byte;
exception
when Tree_Format_Error => return;
end;
raise Tree_Format_Error;
end Tree_Read_Terminate;
---------------------
-- Tree_Write_Bool --
---------------------
procedure Tree_Write_Bool (B : Boolean) is
begin
if Debug_Flag_Tree then
Write_Str ("==> transmitting Boolean = ");
if B then
Write_Str ("True");
else
Write_Str ("False");
end if;
Write_Eol;
end if;
Write_Byte (Boolean'Pos (B));
end Tree_Write_Bool;
---------------------
-- Tree_Write_Char --
---------------------
procedure Tree_Write_Char (C : Character) is
begin
if Debug_Flag_Tree then
Write_Str ("==> transmitting Character = ");
Write_Char (C);
Write_Eol;
end if;
Write_Byte (Character'Pos (C));
end Tree_Write_Char;
---------------------
-- Tree_Write_Data --
---------------------
procedure Tree_Write_Data (Addr : Address; Length : Int) is
type S is array (Pos) of Byte;
-- This is a big array, for which we have to suppress the warning
type SP is access all S;
function To_SP is new Unchecked_Conversion (Address, SP);
Data : constant SP := To_SP (Addr);
-- Pointer to data to be written, converted to array type
IP : Pos := 1;
-- Input buffer pointer, next byte to be processed
NC : Nat range 0 .. Max_Count := 0;
-- Number of bytes of non-compressible sequence
C : Byte;
procedure Write_Non_Compressed_Sequence;
-- Output currently collected sequence of non-compressible data
procedure Write_Non_Compressed_Sequence is
begin
if NC > 0 then
Write_Byte (C_Noncomp + Byte (NC));
if Debug_Flag_Tree then
Write_Str ("==> uncompressed: ");
Write_Int (NC);
Write_Str (", starting at ");
Write_Int (IP - NC);
Write_Eol;
end if;
for J in reverse 1 .. NC loop
Write_Byte (Data (IP - J));
end loop;
NC := 0;
end if;
end Write_Non_Compressed_Sequence;
-- Start of processing for Tree_Write_Data
begin
if Debug_Flag_Tree then
Write_Str ("==> transmitting ");
Write_Int (Length);
Write_Str (" data bytes");
Write_Eol;
end if;
-- We write the count at the start, so that we can check it on
-- the corresponding read to make sure that reads and writes match
Tree_Write_Int (Length);
-- Conversion loop
-- IP is index of next input character
-- NC is number of non-compressible bytes saved up
loop
-- If input is completely processed, then we are all done
if IP > Length then
Write_Non_Compressed_Sequence;
return;
end if;
-- Test for compressible sequence, must be at least three identical
-- bytes in a row to be worthwhile compressing.
if IP + 2 <= Length
and then Data (IP) = Data (IP + 1)
and then Data (IP) = Data (IP + 2)
then
Write_Non_Compressed_Sequence;
-- Count length of new compression sequence
C := 3;
IP := IP + 3;
while IP < Length
and then Data (IP) = Data (IP - 1)
and then C < Max_Count
loop
C := C + 1;
IP := IP + 1;
end loop;
-- Output compression sequence
if Data (IP - 1) = 0 then
if Debug_Flag_Tree then
Write_Str ("==> zeroes: ");
Write_Int (Int (C));
Write_Str (", starting at ");
Write_Int (IP - Int (C));
Write_Eol;
end if;
Write_Byte (C_Zeros + C);
elsif Data (IP - 1) = Character'Pos (' ') then
if Debug_Flag_Tree then
Write_Str ("==> spaces: ");
Write_Int (Int (C));
Write_Str (", starting at ");
Write_Int (IP - Int (C));
Write_Eol;
end if;
Write_Byte (C_Spaces + C);
else
if Debug_Flag_Tree then
Write_Str ("==> other char: ");
Write_Int (Int (C));
Write_Str (" (");
Write_Int (Int (Data (IP - 1)));
Write_Char (')');
Write_Str (", starting at ");
Write_Int (IP - Int (C));
Write_Eol;
end if;
Write_Byte (C_Repeat + C);
Write_Byte (Data (IP - 1));
end if;
-- No compression possible here
else
-- Output non-compressed sequence if at maximum length
if NC = Max_Count then
Write_Non_Compressed_Sequence;
end if;
NC := NC + 1;
IP := IP + 1;
end if;
end loop;
end Tree_Write_Data;
---------------------------
-- Tree_Write_Initialize --
---------------------------
procedure Tree_Write_Initialize (Desc : File_Descriptor) is
begin
Bufn := 0;
Tree_FD := Desc;
Set_Standard_Error;
Debug_Flag_Tree := Debug_Flag_5;
end Tree_Write_Initialize;
--------------------
-- Tree_Write_Int --
--------------------
procedure Tree_Write_Int (N : Int) is
N_Bytes : constant Int_Bytes := To_Int_Bytes (N);
begin
if Debug_Flag_Tree then
Write_Str ("==> transmitting Int = ");
Write_Int (N);
Write_Eol;
end if;
for J in 1 .. 4 loop
Write_Byte (N_Bytes (J));
end loop;
end Tree_Write_Int;
--------------------
-- Tree_Write_Str --
--------------------
procedure Tree_Write_Str (S : String_Ptr) is
begin
Tree_Write_Int (S'Length);
Tree_Write_Data (S (1)'Address, S'Length);
end Tree_Write_Str;
--------------------------
-- Tree_Write_Terminate --
--------------------------
procedure Tree_Write_Terminate is
begin
if Bufn > 0 then
Write_Buffer;
end if;
end Tree_Write_Terminate;
------------------
-- Write_Buffer --
------------------
procedure Write_Buffer is
begin
if Integer (Bufn) = Write (Tree_FD, Buf'Address, Integer (Bufn)) then
Bufn := 0;
else
Set_Standard_Error;
Write_Str ("fatal error: disk full");
OS_Exit (2);
end if;
end Write_Buffer;
----------------
-- Write_Byte --
----------------
procedure Write_Byte (B : Byte) is
begin
Bufn := Bufn + 1;
Buf (Bufn) := B;
if Bufn = Buflen then
Write_Buffer;
end if;
end Write_Byte;
end Tree_IO;
|
package body GL.Text.UTF8 is
type Byte is mod 2**8;
subtype Surrogate_Halves is UTF8_Code_Point range 16#D800# .. 16#DFFF#;
procedure Read (Buffer : String; Position : in out Positive;
Result : out UTF8_Code_Point) is
Cur : Byte := Character'Pos (Buffer (Position));
Additional_Bytes : Positive;
begin
if (Cur and 2#10000000#) = 0 then
Result := UTF8_Code_Point (Cur);
Position := Position + 1;
return;
elsif (Cur and 2#01000000#) = 0 then
raise Rendering_Error with "Encoding error at code point starting byte"
& Position'Img;
elsif (Cur and 2#00100000#) = 0 then
Additional_Bytes := 1;
Result := UTF8_Code_Point (Cur and 2#00011111#) * 2**6;
elsif (Cur and 2#00010000#) = 0 then
Additional_Bytes := 2;
Result := UTF8_Code_Point (Cur and 2#00001111#) * 2**12;
elsif (Cur and 2#00001000#) = 0 then
Additional_Bytes := 3;
Result := UTF8_Code_Point (Cur and 2#00000111#) * 2**18;
else
raise Rendering_Error with "Encoding error at code point starting byte"
& Position'Img;
end if;
for Index in 1 .. Additional_Bytes loop
Cur := Character'Pos (Buffer (Position + Index));
if (Cur and 2#11000000#) /= 2#10000000# then
raise Rendering_Error with
"Encoding error at code point continuation byte" &
Positive'Image (Position + Index);
end if;
Result := Result + UTF8_Code_Point (Cur and 2#00111111#) *
2**(6 * (Additional_Bytes - Index));
end loop;
if Result in Surrogate_Halves then
raise Rendering_Error with
"Surrogate half not valid in UTF-8 at position" & Position'Img;
end if;
Position := Position + Additional_Bytes + 1;
end Read;
end GL.Text.UTF8;
|
with Asis;
with A_Nodes;
with Dot;
package Asis_Tool_2.Context is
type Class is tagged limited private;
procedure Process
(This : in out Class;
Tree_File_Name : in String;
Outputs : in Outputs_Record);
private
type Class is tagged limited -- Initialized
record
Asis_Context : Asis.Context; -- Initialized
end record;
end Asis_Tool_2.Context;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2011, 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$
------------------------------------------------------------------------------
-- The http://x0213.org/codetable/sjis-0213-2004-std.txt file was used to
-- construct conversion tables:
--
-- Shift_JIS-2004 (JIS X 0213:2004 Appendix 1) vs Unicode mapping table
--
-- Date: 3 May 2009
-- License:
-- Copyright (C) 2001 earthian@tama.or.jp, All Rights Reserved.
-- Copyright (C) 2001 I'O, All Rights Reserved.
-- Copyright (C) 2006, 2009 Project X0213, All Rights Reserved.
-- You can use, modify, distribute this table freely.
------------------------------------------------------------------------------
with Matreshka.Internals.Strings.Configuration;
with Matreshka.Internals.Text_Codecs.SHIFTJIS.Tables;
with Matreshka.Internals.Utf16;
package body Matreshka.Internals.Text_Codecs.SHIFTJIS is
use Matreshka.Internals.Strings.Configuration;
Accept_Single_State : constant SHIFTJIS_DFA_State := 0;
Accept_Double_State : constant SHIFTJIS_DFA_State := 1;
Reject_State : constant SHIFTJIS_DFA_State := 2;
Transition : constant
array (SHIFTJIS_DFA_State range 0 .. 31) of SHIFTJIS_DFA_State
:= (0, 0, 3, 3, 2, 2, 2, 2,
0, 0, 3, 3, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2,
1, 2, 1, 2, 1, 2, 2, 2);
-------------------
-- Decode_Append --
-------------------
overriding procedure Decode_Append
(Self : in out SHIFTJIS_Decoder;
Data : Ada.Streams.Stream_Element_Array;
String : in out Matreshka.Internals.Strings.Shared_String_Access)
is
use type Matreshka.Internals.Unicode.Code_Point;
use type Matreshka.Internals.Utf16.Utf16_String_Index;
Current_State : SHIFTJIS_DFA_State := Self.State;
Current_First : Ada.Streams.Stream_Element := Self.First;
Current_Code : Matreshka.Internals.Unicode.Code_Unit_32;
begin
Matreshka.Internals.Strings.Mutate (String, String.Unused + Data'Length);
for J in Data'Range loop
declare
M : constant SHIFTJIS_Meta_Class := Tables.Meta_Class (Data (J));
begin
Current_State :=
Transition (Current_State * 8 + SHIFTJIS_DFA_State (M));
if Current_State = Accept_Single_State then
Self.Unchecked_Append
(Self, String, Tables.Decode_Single (Data (J)));
elsif Current_State = Accept_Double_State then
Current_Code := Tables.Decode_Double (Current_First) (Data (J));
if Current_Code = 16#0000# then
Current_State := Reject_State;
elsif Current_Code in Tables.Expansion'Range then
Self.Unchecked_Append
(Self, String, Tables.Expansion (Current_Code).First);
Self.Unchecked_Append
(Self, String, Tables.Expansion (Current_Code).Second);
else
Self.Unchecked_Append (Self, String, Current_Code);
end if;
else
Current_First := Data (J);
end if;
end;
end loop;
Self.State := Current_State;
Self.First := Current_First;
String_Handler.Fill_Null_Terminator (String);
end Decode_Append;
-------------
-- Decoder --
-------------
function Decoder (Mode : Decoder_Mode) return Abstract_Decoder'Class is
begin
case Mode is
when Raw =>
return
SHIFTJIS_Decoder'
(Skip_LF => False,
Unchecked_Append => Unchecked_Append_Raw'Access,
State => Accept_Single_State,
First => 0);
when XML_1_0 =>
return
SHIFTJIS_Decoder'
(Skip_LF => False,
Unchecked_Append => Unchecked_Append_XML10'Access,
State => Accept_Single_State,
First => 0);
when XML_1_1 =>
return
SHIFTJIS_Decoder'
(Skip_LF => False,
Unchecked_Append => Unchecked_Append_XML11'Access,
State => Accept_Single_State,
First => 0);
end case;
end Decoder;
--------------
-- Is_Error --
--------------
overriding function Is_Error (Self : SHIFTJIS_Decoder) return Boolean is
begin
return Self.State = Reject_State;
end Is_Error;
-------------------
-- Is_Mailformed --
-------------------
overriding function Is_Mailformed
(Self : SHIFTJIS_Decoder) return Boolean is
begin
return Self.State not in Accept_Single_State .. Accept_Double_State;
end Is_Mailformed;
end Matreshka.Internals.Text_Codecs.SHIFTJIS;
|
with System; use System;
package body Deferred_Const2_Pkg is
procedure Dummy is begin null; end;
begin
if S'Address /= I'Address then
raise Program_Error;
end if;
end Deferred_Const2_Pkg;
|
with System.Storage_Elements;
package Array14_Pkg is
package SSE renames System.Storage_Elements;
function Parity_Byte_Count return SSE.Storage_Count;
Length2 : constant SSE.Storage_Count := Parity_Byte_Count;
subtype Encoded_Index_Type2 is SSE.Storage_Count range 1 .. Length2;
subtype Encoded_Type2 is SSE.Storage_Array (Encoded_Index_Type2'Range);
procedure Encode2 (Input : in Integer; Output : out Encoded_Type2);
end Array14_Pkg;
|
--
-- Jan & Uwe R. Zimmer, Australia, July 2011
--
package Graphics_Setup is
procedure Initialize_Graphics (Operations : access procedure);
procedure Window_Resize (Size_x, Size_y : Integer);
end Graphics_Setup;
|
---------------------------------------------------------------------------
-- package body QR_Symmetric_Eigen, QR based eigen-decomposition
-- Copyright (C) 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.
---------------------------------------------------------------------------
with Ada.numerics.Generic_Elementary_Functions;
with Tridiagonal;
with Hypot;
package body QR_Symmetric_Eigen is
package Maths is new Ada.numerics.Generic_Elementary_Functions(Real); use Maths;
package Hypo is new Hypot (Real);
package Tridi is new Tridiagonal (Real, Index, Matrix);
Zero : constant Real := +0.0;
One : constant Real := +1.0;
Two : constant Real := +2.0;
--
-- Matrix
--
-- |a b|
-- |b c|
--
-- has eigenvals x satisfying:
--
-- x^2 - (a + c) * x + a*c - b*b = 0
-- x^2 - (a + c) * x + a_0 = 0
--
-- Solution (x) is always real:
--
-- x = (a + c)/2 +/- Sqrt (((a + c)/2)^2 - a_0)
-- x = (a + c)/2 +/- Sqrt (((a - c)/2)^2 + b*b)
--
-- Let y = x - c, and Beta = (a - c)/2. Then
--
-- y = (a - c)/2 +/- Sqrt (((a - c)/2)^2 + b*b)
-- y = Beta +/- Sqrt (Beta^2 + b*b)
--
-- General Soln:
--
-- Eig_Val - c = y = Beta * (1 +/- Sgn(Beta) * Sqrt (Beta^2 + b*b))
--
-- Use
--
-- Sqrt (Beta^2 + b*b) - 1 = b^2 / (Beta^2 + |Beta| * Sqrt (Beta^2 + b*b))
--
-- and
--
-- 1 + Sqrt (Beta^2 + b*b) = 2 + (Sqrt (Beta^2 + b*b) - 1)
--
-- to get
--
-- Eig_1 = a + Sgn(Beta) * b^2 / (|Beta| + Sqrt (Beta^2 + b*b))
-- Eig_2 = c - Sgn(Beta) * b^2 / (|Beta| + Sqrt (Beta^2 + b*b))
--
--
procedure Quadratic_Eigs
(a, b, c : in Real;
Eig_Val_1 : out Real;
Eig_Val_2 : out Real)
is
Beta : constant Real := 0.5 * (a - c);
begin
if b = Zero then
Eig_Val_1 := a;
Eig_Val_2 := c;
return;
end if;
if Beta = Zero then -- a = c
Eig_Val_1 := a + Abs b;
Eig_Val_2 := c - Abs b;
return;
end if;
-- Hypot = Sqrt (Beta^2 + b^2);
declare
Hypot : constant Real := Hypo.Hypotenuse (b, Beta);
Shift : Real := b * (b / (Hypot + Abs Beta));
begin
Shift := Real'Copy_Sign (Shift, Beta);
Eig_Val_1 := a + Shift;
Eig_Val_2 := c - Shift;
end;
-- -- test using: x^2 - (a + c) * x + a_0 = 0
--
-- declare
-- x, tst : Real;
-- Min_R : Real := Min_Allowed_Real;
-- a_0 : constant Real := a*c - b*b;
-- begin
-- x := Eig_Val_1;
-- tst := ((x - a)*(x - c) - b*b) / (x*x + b*b + Abs a_0 + Min_R);
-- if Abs tst > Real'Epsilon * 16.0 then
-- new_line; put(Real'Image(tst)); new_line;
-- null;
-- end if;
-- x := Eig_Val_2;
-- tst := ((x - a)*(x - c) - b*b) / (x*x + b*b + Abs a_0 + Min_R);
-- if Abs tst > Real'Epsilon * 16.0 then
-- new_line; put(Real'Image(tst)); new_line;
-- null;
-- end if;
-- end;
end Quadratic_Eigs;
procedure Swap (A, B : in out Real) is
tmp : constant Real := A;
begin
A := B; B := tmp;
end Swap;
---------------
-- Sort_Eigs --
---------------
procedure Sort_Eigs
(Eigenvals : in out Col_Vector;
Q : in out Matrix; -- Columns are the eigvectors
Start_Col : in Index := Index'First;
Final_Col : in Index := Index'Last;
Sort_Eigvecs_Also : in Boolean := False)
is
Max_Eig : Real;
Max_id : Index;
begin
if Start_Col < Final_Col then
for i in Start_Col .. Final_Col-1 loop
Max_Eig := Eigenvals(i); Max_id := i;
for j in i+1 .. Final_Col loop
if Eigenvals(j) > Max_Eig then
Max_Eig := Eigenvals(j); Max_id := j;
end if;
end loop;
-- swap i with Max_id:
Swap (Eigenvals(i), Eigenvals(Max_id));
if Sort_Eigvecs_Also then
for r in Start_Col .. Final_Col loop
Swap (Q(r, i), Q(r, Max_id));
end loop;
end if;
end loop;
end if;
end Sort_Eigs;
----------
-- Norm --
----------
function Norm
(Q : in Col_Vector;
Starting_Col : in Index := Index'First;
Final_Col : in Index := Index'Last)
return Real
is
Max : Real := Zero;
Sum, tst : Real := Zero;
Scale_Factor : Real := One;
Scaled : Boolean := False;
Scale_Exp : Integer;
Max_Exp : constant Integer := Real'Machine_Emax - 8;
Sqrt_Max_Allowed_Real : constant Real := Two**(Max_Exp / 2);
Min_Exp : constant Integer := Real'Machine_Emin + 8;
Sqrt_Min_Allowed_Real : constant Real := Two**(Min_Exp / 2);
begin
for i in Starting_Col .. Final_Col loop
tst := Abs (Q(i));
if tst > Max then Max := tst; end if;
end loop;
if Max > Sqrt_Max_Allowed_Real then
Scale_Exp := Integer'Min (Real'Exponent (Max), Real'Machine_Emax-4);
Scale_Factor := Two**(-Scale_Exp);
Scaled := True;
end if;
if Max < Sqrt_Min_Allowed_Real then
Scale_Exp := Integer'Max (Real'Exponent (Max), Real'Machine_Emin+4);
Scale_Factor := Two**(-Scale_Exp);
Scaled := True;
end if;
if Scaled then
for k in Starting_Col .. Final_Col loop
Sum := Sum + (Scale_Factor * Q(k))**2;
end loop;
else
for k in Starting_Col .. Final_Col loop
Sum := Sum + Q(k)**2;
end loop;
end if;
if Scaled then
return Sqrt (Abs Sum) * Two**Scale_Exp;
else
return Sqrt (Abs Sum);
end if;
end Norm;
---------------------
-- Eigen_Decompose --
---------------------
procedure Eigen_Decompose
(A : in out Matrix;
Q : out Matrix;
Eigenvals : out Col_Vector;
Start_Col : in Index := Index'First;
Final_Col : in Index := Index'Last;
Eigenvectors_Desired : in Boolean := False)
is
Shift, e1, e2 : Real;
N : constant Integer := Integer (Final_Col) - Integer (Start_Col) + 1;
Min_Exp : constant Integer := Real'Machine_Emin;
Min_Allowed_Real : constant Real := 2.0 ** (Min_Exp - Min_Exp/32);
begin
-- Q starts as Identity; is rotated into set of Eigenvectors of A.
Q := (others => (others => Zero));
for j in Index loop
Q(j,j) := One;
end loop;
Eigenvals := (others => Zero);
-- A_tridiag = Q_tr * A_true * Q.
--
-- A_true = Q * A_tridiag * Q_tr
Tridi.Tridiagonalize
(A => A, -- A = A_true is replaced with: A_tridiag
Q => Q, -- A_true = Q * A_tridiag * Q_tr
Starting_Col => Start_Col,
Final_Col => Final_Col,
Initial_Q => Q,
Q_Matrix_Desired => Eigenvectors_Desired);
-- A is now in Upper_Hessenberg form, thanks to Q:
--
-- A_true = Q A Q' = Q A_tridiag Q'
--
-- Procedure Upper_Hessenberg initialized "out" parameter Q as the new Z_r.
--
for i in reverse Start_Col+1 .. Final_Col loop
Iterate: for iter_id in 0 .. 30 + N / 4 loop -- 15 iters is very rare
if Abs A(i,i-1) < Min_Allowed_Real then
A(i,i-1) := Zero; A(i-1,i) := Zero;
end if;
--if Abs A(i,i-1) = Zero then
-- text_io.put(integer'image(iter_id)); exit;
--end if;
exit Iterate when Abs A(i,i-1) = Zero;
Quadratic_Eigs
(a => A(i-1,i-1),
b => A(i,i-1),
c => A(i,i),
Eig_Val_1 => e1,
Eig_Val_2 => e2);
if Abs(e2-A(i,i))<Abs(e1-A(i,i)) then Shift:=e2; else Shift:=e1; end if;
Tridi.Lower_Diagonal_QR_Iteration
(A => A,
Q => Q,
Shift => Shift,
--Final_Shift_Col => Final_Col,
Final_Shift_Col => i, -- short cut, hardly matters
Starting_Col => Start_Col,
Final_Col => Final_Col,
Q_Matrix_Desired => Eigenvectors_Desired);
end loop iterate;
end loop;
-- Eigenvectors of A are returned as the Columns of matrix Q.
--
-- so Q_tr * A * Q = D = Diagonal_Eigs
--
-- so Q * D * Q_tr = A = Original Matrix
for i in Index range Start_Col .. Final_Col loop
Eigenvals(i) := A(i,i);
end loop;
end Eigen_Decompose;
end QR_Symmetric_Eigen;
|
with Ada.Text_Io;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
procedure Sort_Composite is
type Composite_Record is record
Name : Unbounded_String;
Value : Unbounded_String;
end record;
type Pairs_Array is array(Positive range <>) of Composite_Record;
procedure Swap(Left, Right : in out Composite_Record) is
Temp : Composite_Record := Left;
begin
Left := Right;
Right := Temp;
end Swap;
-- Sort_Names uses a bubble sort
procedure Sort_Name(Pairs : in out Pairs_Array) is
Swap_Performed : Boolean := True;
begin
while Swap_Performed loop
Swap_Performed := False;
for I in Pairs'First..(Pairs'Last - 1) loop
if Pairs(I).Name > Pairs(I + 1).Name then
Swap (Pairs(I), Pairs(I + 1));
Swap_Performed := True;
end if;
end loop;
end loop;
end Sort_Name;
procedure Print(Item : Pairs_Array) is
begin
for I in Item'range loop
Ada.Text_Io.Put_Line(To_String(Item(I).Name) & ", " &
to_String(Item(I).Value));
end loop;
end Print;
type Names is (Fred, Barney, Wilma, Betty, Pebbles);
type Values is (Home, Work, Cook, Eat, Bowl);
My_Pairs : Pairs_Array(1..5);
begin
for I in My_Pairs'range loop
My_Pairs(I).Name := To_Unbounded_String(Names'Image(Names'Val(Integer(I - 1))));
My_Pairs(I).Value := To_Unbounded_String(Values'Image(Values'Val(Integer(I - 1))));
end loop;
Print(My_Pairs);
Ada.Text_Io.Put_Line("=========================");
Sort_Name(My_Pairs);
Print(My_Pairs);
end Sort_Composite;
|
with Ada.Text_IO, Ada.Numerics.Discrete_Random;
-- can play human-human, human-computer, computer-human or computer-computer
-- the computer isn't very clever: it just chooses a legal random move
procedure Tic_Tac_Toe is
type The_Range is range 1 .. 3;
type Board_Type is array (The_Range, The_Range) of Character;
package Rand is new Ada.Numerics.Discrete_Random(The_Range);
Gen: Rand.Generator; -- required for the random moves
procedure Show_Board(Board: Board_Type) is
use Ada.Text_IO;
begin
for Row in The_Range loop
for Column in The_Range loop
Put(Board(Row, Column));
end loop;
Put_Line("");
end loop;
Put_Line("");
end Show_Board;
function Find_Winner(Board: Board_Type) return Character is
-- if 'x' or 'o' wins, it returns that, else it returns ' '
function Three_Equal(A,B,C: Character) return Boolean is
begin
return (A=B) and (A=C);
end Three_Equal;
begin -- Find_Winner
for I in The_Range loop
if Three_Equal(Board(I,1), Board(I,2), Board(I,3)) then
return Board(I,1);
elsif Three_Equal(Board(1,I), Board(2,I), Board(3,I)) then
return Board(1,I);
end if;
end loop;
if Three_Equal(Board(1,1), Board(2,2), Board (3,3)) or
Three_Equal(Board(3,1), Board(2,2), Board (1,3)) then
return Board(2,2);
end if;
return ' ';
end Find_Winner;
procedure Do_Move(Board: in out Board_Type;
New_Char: Character; Computer_Move: Boolean) is
Done: Boolean := False;
C: Character;
use Ada.Text_IO;
procedure Do_C_Move(Board: in out Board_Type; New_Char: Character) is
Found: Boolean := False;
X,Y: The_Range;
begin
while not Found loop
X := Rand.Random(Gen);
Y := Rand.Random(Gen);
if (Board(X,Y) /= 'x') and (Board(X,Y) /= 'o') then
Found := True;
Board(X,Y) := New_Char;
end if;
end loop;
end Do_C_Move;
begin
if Computer_Move then
Do_C_Move(Board, New_Char);
else -- read move;
Put_Line("Choose your move, " & New_Char);
while not Done loop
Get(C);
for Row in The_Range loop
for Col in The_Range loop
if Board(Row, Col) = C then
Board(Row, Col) := New_Char;
Done := True;
end if;
end loop;
end loop;
end loop;
end if;
end Do_Move;
The_Board : Board_Type := (('1','2','3'), ('4','5','6'), ('7','8','9'));
Cnt_Moves: Natural := 0;
Players: array(0 .. 1) of Character := ('x', 'o'); -- 'x' begins
C_Player: array(0 .. 1) of Boolean := (False, False);
Reply: Character;
begin -- Tic_Tac_Toe
-- firstly, ask whether the computer shall take over either player
for I in Players'Range loop
Ada.Text_IO.Put_Line("Shall " & Players(I) &
" be run by the computer? (y=yes)");
Ada.Text_IO.Get(Reply);
if Reply='y' or Reply='Y' then
C_Player(I) := True;
Ada.Text_IO.Put_Line("Yes!");
else
Ada.Text_IO.Put_Line("No!");
end if;
end loop;
Rand.Reset(Gen); -- to initalize the random generator
-- now run the game
while (Find_Winner(The_Board) = ' ') and (Cnt_Moves < 9) loop
Show_Board(The_Board);
Do_Move(The_Board, Players(Cnt_Moves mod 2), C_Player(Cnt_Moves mod 2));
Cnt_Moves := Cnt_Moves + 1;
end loop;
Ada.Text_IO.Put_Line("This is the end!");
-- finally, output the outcome
Show_Board (The_Board);
if Find_Winner(The_Board) = ' ' then
Ada.Text_IO.Put_Line("Draw");
else
Ada.Text_IO.Put_Line("The winner is: " & Find_Winner(The_Board));
end if;
end Tic_Tac_Toe;
|
------------------------------------------------------------------------------
-- --
-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K I N G . P R O T E C T E D _ O B J E C T S . --
-- O P E R A T I O N S --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1991-2001, Florida State University --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNARL; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. It is --
-- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
-- State University (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
-- This package contains all the extended primitives related to
-- Protected_Objects with entries.
-- The handling of protected objects with no entries is done in
-- System.Tasking.Protected_Objects, the simple routines for protected
-- objects with entries in System.Tasking.Protected_Objects.Entries.
-- The split between Entries and Operations is needed to break circular
-- dependencies inside the run time.
-- This package contains all primitives related to Protected_Objects.
-- Note: the compiler generates direct calls to this interface, via Rtsfind.
with Ada.Exceptions;
-- Used for Exception_ID
-- Null_Id
-- Raise_Exception
with System.Task_Primitives.Operations;
-- used for Initialize_Lock
-- Write_Lock
-- Unlock
-- Get_Priority
-- Wakeup
with System.Tasking.Entry_Calls;
-- used for Wait_For_Completion
-- Wait_Until_Abortable
with System.Tasking.Initialization;
-- Used for Defer_Abort,
-- Undefer_Abort,
-- Change_Base_Priority
pragma Elaborate_All (System.Tasking.Initialization);
-- This insures that tasking is initialized if any protected objects are
-- created.
with System.Tasking.Queuing;
-- used for Enqueue
-- Broadcast_Program_Error
-- Select_Protected_Entry_Call
-- Onqueue
-- Count_Waiting
with System.Tasking.Rendezvous;
-- used for Task_Do_Or_Queue
with System.Tasking.Debug;
-- used for Trace
package body System.Tasking.Protected_Objects.Operations is
package STPO renames System.Task_Primitives.Operations;
use Task_Primitives;
use Tasking;
use Ada.Exceptions;
use Entries;
-----------------------
-- Local Subprograms --
-----------------------
procedure Update_For_Queue_To_PO
(Entry_Call : Entry_Call_Link;
With_Abort : Boolean);
pragma Inline (Update_For_Queue_To_PO);
-- Update the state of an existing entry call to reflect
-- the fact that it is being enqueued, based on
-- whether the current queuing action is with or without abort.
-- Call this only while holding the PO's lock.
-- It returns with the PO's lock still held.
---------------------------------
-- Cancel_Protected_Entry_Call --
---------------------------------
-- Compiler interface only. Do not call from within the RTS.
-- This should have analogous effect to Cancel_Task_Entry_Call,
-- setting the value of Block.Cancelled instead of returning
-- the parameter value Cancelled.
-- The effect should be idempotent, since the call may already
-- have been dequeued.
-- source code:
-- select r.e;
-- ...A...
-- then abort
-- ...B...
-- end select;
-- expanded code:
-- declare
-- X : protected_entry_index := 1;
-- B80b : communication_block;
-- _init_proc (B80b);
-- begin
-- begin
-- A79b : label
-- A79b : declare
-- procedure _clean is
-- begin
-- if enqueued (B80b) then
-- cancel_protected_entry_call (B80b);
-- end if;
-- return;
-- end _clean;
-- begin
-- protected_entry_call (rTV!(r)._object'unchecked_access, X,
-- null_address, asynchronous_call, B80b, objectF => 0);
-- if enqueued (B80b) then
-- ...B...
-- end if;
-- at end
-- _clean;
-- end A79b;
-- exception
-- when _abort_signal =>
-- abort_undefer.all;
-- null;
-- end;
-- if not cancelled (B80b) then
-- x := ...A...
-- end if;
-- end;
-- If the entry call completes after we get into the abortable part,
-- Abort_Signal should be raised and ATC will take us to the at-end
-- handler, which will call _clean.
-- If the entry call returns with the call already completed,
-- we can skip this, and use the "if enqueued()" to go past
-- the at-end handler, but we will still call _clean.
-- If the abortable part completes before the entry call is Done,
-- it will call _clean.
-- If the entry call or the abortable part raises an exception,
-- we will still call _clean, but the value of Cancelled should not matter.
-- Whoever calls _clean first gets to decide whether the call
-- has been "cancelled".
-- Enqueued should be true if there is any chance that the call
-- is still on a queue. It seems to be safe to make it True if
-- the call was Onqueue at some point before return from
-- Protected_Entry_Call.
-- Cancelled should be true iff the abortable part completed
-- and succeeded in cancelling the entry call before it completed.
-- ?????
-- The need for Enqueued is less obvious.
-- The "if enqueued()" tests are not necessary, since both
-- Cancel_Protected_Entry_Call and Protected_Entry_Call must
-- do the same test internally, with locking. The one that
-- makes cancellation conditional may be a useful heuristic
-- since at least 1/2 the time the call should be off-queue
-- by that point. The other one seems totally useless, since
-- Protected_Entry_Call must do the same check and then
-- possibly wait for the call to be abortable, internally.
-- We can check Call.State here without locking the caller's mutex,
-- since the call must be over after returning from Wait_For_Completion.
-- No other task can access the call record at this point.
procedure Cancel_Protected_Entry_Call
(Block : in out Communication_Block)
is
begin
Entry_Calls.Try_To_Cancel_Entry_Call (Block.Cancelled);
end Cancel_Protected_Entry_Call;
---------------
-- Cancelled --
---------------
function Cancelled (Block : Communication_Block) return Boolean is
begin
return Block.Cancelled;
end Cancelled;
-------------------------
-- Complete_Entry_Body --
-------------------------
procedure Complete_Entry_Body (Object : Protection_Entries_Access) is
begin
Exceptional_Complete_Entry_Body (Object, Ada.Exceptions.Null_Id);
end Complete_Entry_Body;
--------------
-- Enqueued --
--------------
function Enqueued (Block : Communication_Block) return Boolean is
begin
return Block.Enqueued;
end Enqueued;
-------------------------------------
-- Exceptional_Complete_Entry_Body --
-------------------------------------
procedure Exceptional_Complete_Entry_Body
(Object : Protection_Entries_Access;
Ex : Ada.Exceptions.Exception_Id)
is
Entry_Call : constant Entry_Call_Link := Object.Call_In_Progress;
begin
pragma Debug
(Debug.Trace (STPO.Self, "Exceptional_Complete_Entry_Body", 'P'));
-- We must have abort deferred, since we are inside
-- a protected operation.
if Entry_Call /= null then
-- The call was not requeued.
Entry_Call.Exception_To_Raise := Ex;
-- ?????
-- The caller should do the following, after return from this
-- procedure, if Call_In_Progress /= null
-- Write_Lock (Entry_Call.Self);
-- Initialization.Wakeup_Entry_Caller (STPO.Self, Entry_Call, Done);
-- Unlock (Entry_Call.Self);
end if;
end Exceptional_Complete_Entry_Body;
--------------------
-- PO_Do_Or_Queue --
--------------------
procedure PO_Do_Or_Queue
(Self_ID : Task_ID;
Object : Protection_Entries_Access;
Entry_Call : Entry_Call_Link;
With_Abort : Boolean)
is
E : Protected_Entry_Index := Protected_Entry_Index (Entry_Call.E);
New_Object : Protection_Entries_Access;
Ceiling_Violation : Boolean;
Barrier_Value : Boolean;
begin
-- When the Action procedure for an entry body returns, it is either
-- completed (having called [Exceptional_]Complete_Entry_Body) or it
-- is queued, having executed a requeue statement.
Barrier_Value :=
Object.Entry_Bodies (
Object.Find_Body_Index (Object.Compiler_Info, E)).
Barrier (Object.Compiler_Info, E);
if Barrier_Value then
-- Not abortable while service is in progress.
if Entry_Call.State = Now_Abortable then
Entry_Call.State := Was_Abortable;
end if;
Object.Call_In_Progress := Entry_Call;
pragma Debug
(Debug.Trace (Self_ID, "PODOQ: start entry body", 'P'));
Object.Entry_Bodies (
Object.Find_Body_Index (Object.Compiler_Info, E)).Action (
Object.Compiler_Info, Entry_Call.Uninterpreted_Data, E);
if Object.Call_In_Progress /= null then
-- Body of current entry served call to completion
Object.Call_In_Progress := null;
Initialization.Wakeup_Entry_Caller (Self_ID, Entry_Call, Done);
else
-- Body of current entry requeued the call
New_Object := To_Protection (Entry_Call.Called_PO);
if New_Object = null then
-- Call was requeued to a task
if not Rendezvous.Task_Do_Or_Queue
(Self_ID, Entry_Call,
With_Abort => Entry_Call.Requeue_With_Abort)
then
Queuing.Broadcast_Program_Error
(Self_ID, Object, Entry_Call);
end if;
return;
end if;
if Object /= New_Object then
-- Requeue is on a different object
Lock_Entries (New_Object, Ceiling_Violation);
if Ceiling_Violation then
Object.Call_In_Progress := null;
Queuing.Broadcast_Program_Error
(Self_ID, Object, Entry_Call);
else
PO_Do_Or_Queue (Self_ID, New_Object, Entry_Call, With_Abort);
PO_Service_Entries (Self_ID, New_Object);
Unlock_Entries (New_Object);
end if;
else
-- Requeue is on same protected object
if Entry_Call.Requeue_With_Abort
and then Entry_Call.Cancellation_Attempted
then
-- If this is a requeue with abort and someone tried
-- to cancel this call, cancel it at this point.
Entry_Call.State := Cancelled;
return;
end if;
if not With_Abort or else
Entry_Call.Mode /= Conditional_Call
then
E := Protected_Entry_Index (Entry_Call.E);
Queuing.Enqueue
(New_Object.Entry_Queues (E), Entry_Call);
Update_For_Queue_To_PO (Entry_Call, With_Abort);
else
-- ?????
-- Can we convert this recursion to a loop?
PO_Do_Or_Queue (Self_ID, New_Object, Entry_Call, With_Abort);
end if;
end if;
end if;
elsif Entry_Call.Mode /= Conditional_Call or else
not With_Abort then
Queuing.Enqueue (Object.Entry_Queues (E), Entry_Call);
Update_For_Queue_To_PO (Entry_Call, With_Abort);
else
-- Conditional_Call and With_Abort
STPO.Write_Lock (Entry_Call.Self);
pragma Assert (Entry_Call.State >= Was_Abortable);
Initialization.Wakeup_Entry_Caller (Self_ID, Entry_Call, Cancelled);
STPO.Unlock (Entry_Call.Self);
end if;
exception
when others =>
Queuing.Broadcast_Program_Error (Self_ID, Object, Entry_Call);
end PO_Do_Or_Queue;
------------------------
-- PO_Service_Entries --
------------------------
procedure PO_Service_Entries
(Self_ID : Task_ID;
Object : Protection_Entries_Access)
is
Entry_Call : Entry_Call_Link;
E : Protected_Entry_Index;
Caller : Task_ID;
New_Object : Protection_Entries_Access;
Ceiling_Violation : Boolean;
begin
loop
Queuing.Select_Protected_Entry_Call (Self_ID, Object, Entry_Call);
if Entry_Call /= null then
E := Protected_Entry_Index (Entry_Call.E);
-- Not abortable while service is in progress.
if Entry_Call.State = Now_Abortable then
Entry_Call.State := Was_Abortable;
end if;
Object.Call_In_Progress := Entry_Call;
begin
pragma Debug
(Debug.Trace (Self_ID, "POSE: start entry body", 'P'));
Object.Entry_Bodies (
Object.Find_Body_Index (Object.Compiler_Info, E)).Action (
Object.Compiler_Info, Entry_Call.Uninterpreted_Data, E);
exception
when others =>
Queuing.Broadcast_Program_Error
(Self_ID, Object, Entry_Call);
end;
if Object.Call_In_Progress /= null then
Object.Call_In_Progress := null;
Caller := Entry_Call.Self;
STPO.Write_Lock (Caller);
Initialization.Wakeup_Entry_Caller (Self_ID, Entry_Call, Done);
STPO.Unlock (Caller);
else
-- Call needs to be requeued
New_Object := To_Protection (Entry_Call.Called_PO);
if New_Object = null then
-- Call is to be requeued to a task entry
if not Rendezvous.Task_Do_Or_Queue
(Self_ID, Entry_Call,
With_Abort => Entry_Call.Requeue_With_Abort)
then
Queuing.Broadcast_Program_Error
(Self_ID, Object, Entry_Call);
end if;
else
-- Call should be requeued to a PO
if Object /= New_Object then
-- Requeue is to different PO
Lock_Entries (New_Object, Ceiling_Violation);
if Ceiling_Violation then
Object.Call_In_Progress := null;
Queuing.Broadcast_Program_Error
(Self_ID, Object, Entry_Call);
else
PO_Do_Or_Queue (Self_ID, New_Object, Entry_Call,
Entry_Call.Requeue_With_Abort);
PO_Service_Entries (Self_ID, New_Object);
Unlock_Entries (New_Object);
end if;
else
-- Requeue is to same protected object
-- ??? Try to compensate apparent failure of the
-- scheduler on some OS (e.g VxWorks) to give higher
-- priority tasks a chance to run (see CXD6002).
STPO.Yield (False);
if Entry_Call.Requeue_With_Abort
and then Entry_Call.Cancellation_Attempted
then
-- If this is a requeue with abort and someone tried
-- to cancel this call, cancel it at this point.
Entry_Call.State := Cancelled;
exit;
end if;
if not Entry_Call.Requeue_With_Abort or else
Entry_Call.Mode /= Conditional_Call
then
E := Protected_Entry_Index (Entry_Call.E);
Queuing.Enqueue
(New_Object.Entry_Queues (E), Entry_Call);
Update_For_Queue_To_PO (Entry_Call,
Entry_Call.Requeue_With_Abort);
else
PO_Do_Or_Queue (Self_ID, New_Object, Entry_Call,
Entry_Call.Requeue_With_Abort);
end if;
end if;
end if;
end if;
else
exit;
end if;
end loop;
end PO_Service_Entries;
---------------------
-- Protected_Count --
---------------------
function Protected_Count
(Object : Protection_Entries'Class;
E : Protected_Entry_Index)
return Natural
is
begin
return Queuing.Count_Waiting (Object.Entry_Queues (E));
end Protected_Count;
--------------------------
-- Protected_Entry_Call --
--------------------------
-- Compiler interface only. Do not call from within the RTS.
-- select r.e;
-- ...A...
-- else
-- ...B...
-- end select;
-- declare
-- X : protected_entry_index := 1;
-- B85b : communication_block;
-- _init_proc (B85b);
-- begin
-- protected_entry_call (rTV!(r)._object'unchecked_access, X,
-- null_address, conditional_call, B85b, objectF => 0);
-- if cancelled (B85b) then
-- ...B...
-- else
-- ...A...
-- end if;
-- end;
-- See also Cancel_Protected_Entry_Call for code expansion of
-- asynchronous entry call.
-- The initial part of this procedure does not need to lock the
-- the calling task's ATCB, up to the point where the call record
-- first may be queued (PO_Do_Or_Queue), since before that no
-- other task will have access to the record.
-- If this is a call made inside of an abort deferred region,
-- the call should be never abortable.
-- If the call was not queued abortably, we need to wait
-- until it is before proceeding with the abortable part.
-- There are some heuristics here, just to save time for
-- frequently occurring cases. For example, we check
-- Initially_Abortable to try to avoid calling the procedure
-- Wait_Until_Abortable, since the normal case for async.
-- entry calls is to be queued abortably.
-- Another heuristic uses the Block.Enqueued to try to avoid
-- calling Cancel_Protected_Entry_Call if the call can be
-- served immediately.
procedure Protected_Entry_Call
(Object : Protection_Entries_Access;
E : Protected_Entry_Index;
Uninterpreted_Data : System.Address;
Mode : Call_Modes;
Block : out Communication_Block)
is
Self_ID : Task_ID := STPO.Self;
Entry_Call : Entry_Call_Link;
Initially_Abortable : Boolean;
Ceiling_Violation : Boolean;
begin
pragma Debug
(Debug.Trace (Self_ID, "Protected_Entry_Call", 'P'));
if Self_ID.ATC_Nesting_Level = ATC_Level'Last then
Raise_Exception (Storage_Error'Identity,
"not enough ATC nesting levels");
end if;
Initialization.Defer_Abort (Self_ID);
Lock_Entries (Object, Ceiling_Violation);
if Ceiling_Violation then
-- Failed ceiling check
Initialization.Undefer_Abort (Self_ID);
raise Program_Error;
end if;
Block.Self := Self_ID;
Self_ID.ATC_Nesting_Level := Self_ID.ATC_Nesting_Level + 1;
pragma Debug
(Debug.Trace (Self_ID, "PEC: entered ATC level: " &
ATC_Level'Image (Self_ID.ATC_Nesting_Level), 'A'));
Entry_Call :=
Self_ID.Entry_Calls (Self_ID.ATC_Nesting_Level)'Access;
Entry_Call.Next := null;
Entry_Call.Mode := Mode;
Entry_Call.Cancellation_Attempted := False;
if Self_ID.Deferral_Level > 1 then
Entry_Call.State := Never_Abortable;
else
Entry_Call.State := Now_Abortable;
end if;
Entry_Call.E := Entry_Index (E);
Entry_Call.Prio := STPO.Get_Priority (Self_ID);
Entry_Call.Uninterpreted_Data := Uninterpreted_Data;
Entry_Call.Called_PO := To_Address (Object);
Entry_Call.Called_Task := null;
Entry_Call.Exception_To_Raise := Ada.Exceptions.Null_Id;
PO_Do_Or_Queue (Self_ID, Object, Entry_Call, With_Abort => True);
Initially_Abortable := Entry_Call.State = Now_Abortable;
PO_Service_Entries (Self_ID, Object);
Unlock_Entries (Object);
-- Try to prevent waiting later (in Cancel_Protected_Entry_Call)
-- for completed or cancelled calls. (This is a heuristic, only.)
if Entry_Call.State >= Done then
-- Once State >= Done it will not change any more.
Self_ID.ATC_Nesting_Level := Self_ID.ATC_Nesting_Level - 1;
pragma Debug
(Debug.Trace (Self_ID, "PEC: exited to ATC level: " &
ATC_Level'Image (Self_ID.ATC_Nesting_Level), 'A'));
Block.Enqueued := False;
Block.Cancelled := Entry_Call.State = Cancelled;
Initialization.Undefer_Abort (Self_ID);
Entry_Calls.Check_Exception (Self_ID, Entry_Call);
return;
else
-- In this case we cannot conclude anything,
-- since State can change concurrently.
null;
end if;
-- Now for the general case.
if Mode = Asynchronous_Call then
-- Try to avoid an expensive call.
if not Initially_Abortable then
Entry_Calls.Wait_Until_Abortable (Self_ID, Entry_Call);
end if;
elsif Mode < Asynchronous_Call then
-- Simple_Call or Conditional_Call
STPO.Write_Lock (Self_ID);
Entry_Calls.Wait_For_Completion (Self_ID, Entry_Call);
STPO.Unlock (Self_ID);
Block.Cancelled := Entry_Call.State = Cancelled;
else
pragma Assert (False);
null;
end if;
Initialization.Undefer_Abort (Self_ID);
Entry_Calls.Check_Exception (Self_ID, Entry_Call);
end Protected_Entry_Call;
----------------------------
-- Protected_Entry_Caller --
----------------------------
function Protected_Entry_Caller (Object : Protection_Entries'Class)
return Task_ID is
begin
return Object.Call_In_Progress.Self;
end Protected_Entry_Caller;
-----------------------------
-- Requeue_Protected_Entry --
-----------------------------
-- Compiler interface only. Do not call from within the RTS.
-- entry e when b is
-- begin
-- b := false;
-- ...A...
-- requeue e2;
-- end e;
-- procedure rPT__E10b (O : address; P : address; E :
-- protected_entry_index) is
-- type rTVP is access rTV;
-- freeze rTVP []
-- _object : rTVP := rTVP!(O);
-- begin
-- declare
-- rR : protection renames _object._object;
-- vP : integer renames _object.v;
-- bP : boolean renames _object.b;
-- begin
-- b := false;
-- ...A...
-- requeue_protected_entry (rR'unchecked_access, rR'
-- unchecked_access, 2, false, objectF => 0, new_objectF =>
-- 0);
-- return;
-- end;
-- complete_entry_body (_object._object'unchecked_access, objectF =>
-- 0);
-- return;
-- exception
-- when others =>
-- abort_undefer.all;
-- exceptional_complete_entry_body (_object._object'
-- unchecked_access, current_exception, objectF => 0);
-- return;
-- end rPT__E10b;
procedure Requeue_Protected_Entry
(Object : Protection_Entries_Access;
New_Object : Protection_Entries_Access;
E : Protected_Entry_Index;
With_Abort : Boolean)
is
Entry_Call : constant Entry_Call_Link := Object.Call_In_Progress;
begin
pragma Debug
(Debug.Trace (STPO.Self, "Requeue_Protected_Entry", 'P'));
pragma Assert (STPO.Self.Deferral_Level > 0);
Entry_Call.E := Entry_Index (E);
Entry_Call.Called_PO := To_Address (New_Object);
Entry_Call.Called_Task := null;
Entry_Call.Requeue_With_Abort := With_Abort;
Object.Call_In_Progress := null;
end Requeue_Protected_Entry;
-------------------------------------
-- Requeue_Task_To_Protected_Entry --
-------------------------------------
-- Compiler interface only.
-- accept e1 do
-- ...A...
-- requeue r.e2;
-- end e1;
-- A79b : address;
-- L78b : label
-- begin
-- accept_call (1, A79b);
-- ...A...
-- requeue_task_to_protected_entry (rTV!(r)._object'
-- unchecked_access, 2, false, new_objectF => 0);
-- goto L78b;
-- <<L78b>>
-- complete_rendezvous;
-- exception
-- when all others =>
-- exceptional_complete_rendezvous (get_gnat_exception);
-- end;
procedure Requeue_Task_To_Protected_Entry
(New_Object : Protection_Entries_Access;
E : Protected_Entry_Index;
With_Abort : Boolean)
is
Self_ID : constant Task_ID := STPO.Self;
Entry_Call : constant Entry_Call_Link := Self_ID.Common.Call;
begin
Initialization.Defer_Abort (Self_ID);
STPO.Write_Lock (Self_ID);
Entry_Call.Needs_Requeue := True;
Entry_Call.Requeue_With_Abort := With_Abort;
Entry_Call.Called_PO := To_Address (New_Object);
Entry_Call.Called_Task := null;
STPO.Unlock (Self_ID);
Entry_Call.E := Entry_Index (E);
Initialization.Undefer_Abort (Self_ID);
end Requeue_Task_To_Protected_Entry;
-- ??????
-- Do we really need to lock Self_ID above?
-- Might the caller be trying to cancel?
-- If so, it should fail, since the call state should not be
-- abortable while the call is in service.
---------------------
-- Service_Entries --
---------------------
procedure Service_Entries (Object : Protection_Entries_Access) is
Self_ID : constant Task_ID := STPO.Self;
begin
PO_Service_Entries (Self_ID, Object);
end Service_Entries;
--------------------------------
-- Timed_Protected_Entry_Call --
--------------------------------
-- Compiler interface only. Do not call from within the RTS.
procedure Timed_Protected_Entry_Call
(Object : Protection_Entries_Access;
E : Protected_Entry_Index;
Uninterpreted_Data : System.Address;
Timeout : Duration;
Mode : Delay_Modes;
Entry_Call_Successful : out Boolean)
is
Self_ID : Task_ID := STPO.Self;
Entry_Call : Entry_Call_Link;
Ceiling_Violation : Boolean;
begin
if Self_ID.ATC_Nesting_Level = ATC_Level'Last then
Raise_Exception (Storage_Error'Identity,
"not enough ATC nesting levels");
end if;
Initialization.Defer_Abort (Self_ID);
Lock_Entries (Object, Ceiling_Violation);
if Ceiling_Violation then
Initialization.Undefer_Abort (Self_ID);
raise Program_Error;
end if;
Self_ID.ATC_Nesting_Level := Self_ID.ATC_Nesting_Level + 1;
pragma Debug
(Debug.Trace (Self_ID, "TPEC: exited to ATC level: " &
ATC_Level'Image (Self_ID.ATC_Nesting_Level), 'A'));
Entry_Call :=
Self_ID.Entry_Calls (Self_ID.ATC_Nesting_Level)'Access;
Entry_Call.Next := null;
Entry_Call.Mode := Timed_Call;
Entry_Call.Cancellation_Attempted := False;
if Self_ID.Deferral_Level > 1 then
Entry_Call.State := Never_Abortable;
else
Entry_Call.State := Now_Abortable;
end if;
Entry_Call.E := Entry_Index (E);
Entry_Call.Prio := STPO.Get_Priority (Self_ID);
Entry_Call.Uninterpreted_Data := Uninterpreted_Data;
Entry_Call.Called_PO := To_Address (Object);
Entry_Call.Called_Task := null;
Entry_Call.Exception_To_Raise := Ada.Exceptions.Null_Id;
PO_Do_Or_Queue (Self_ID, Object, Entry_Call, With_Abort => True);
PO_Service_Entries (Self_ID, Object);
Unlock_Entries (Object);
-- Try to avoid waiting for completed or cancelled calls.
if Entry_Call.State >= Done then
Self_ID.ATC_Nesting_Level := Self_ID.ATC_Nesting_Level - 1;
pragma Debug
(Debug.Trace (Self_ID, "TPEC: exited to ATC level: " &
ATC_Level'Image (Self_ID.ATC_Nesting_Level), 'A'));
Entry_Call_Successful := Entry_Call.State = Done;
Initialization.Undefer_Abort (Self_ID);
Entry_Calls.Check_Exception (Self_ID, Entry_Call);
return;
end if;
Entry_Calls.Wait_For_Completion_With_Timeout
(Self_ID, Entry_Call, Timeout, Mode);
Initialization.Undefer_Abort (Self_ID);
Entry_Call_Successful := Entry_Call.State = Done;
Entry_Calls.Check_Exception (Self_ID, Entry_Call);
end Timed_Protected_Entry_Call;
----------------------------
-- Update_For_Queue_To_PO --
----------------------------
-- Update the state of an existing entry call, based on
-- whether the current queuing action is with or without abort.
-- Call this only while holding the server's lock.
-- It returns with the server's lock released.
New_State : constant array (Boolean, Entry_Call_State)
of Entry_Call_State :=
(True =>
(Never_Abortable => Never_Abortable,
Not_Yet_Abortable => Now_Abortable,
Was_Abortable => Now_Abortable,
Now_Abortable => Now_Abortable,
Done => Done,
Cancelled => Cancelled),
False =>
(Never_Abortable => Never_Abortable,
Not_Yet_Abortable => Not_Yet_Abortable,
Was_Abortable => Was_Abortable,
Now_Abortable => Now_Abortable,
Done => Done,
Cancelled => Cancelled)
);
procedure Update_For_Queue_To_PO
(Entry_Call : Entry_Call_Link;
With_Abort : Boolean)
is
Old : Entry_Call_State := Entry_Call.State;
begin
pragma Assert (Old < Done);
Entry_Call.State := New_State (With_Abort, Entry_Call.State);
if Entry_Call.Mode = Asynchronous_Call then
if Old < Was_Abortable and then
Entry_Call.State = Now_Abortable
then
STPO.Write_Lock (Entry_Call.Self);
if Entry_Call.Self.Common.State = Async_Select_Sleep then
STPO.Wakeup (Entry_Call.Self, Async_Select_Sleep);
end if;
STPO.Unlock (Entry_Call.Self);
end if;
elsif Entry_Call.Mode = Conditional_Call then
pragma Assert (Entry_Call.State < Was_Abortable);
null;
end if;
end Update_For_Queue_To_PO;
end System.Tasking.Protected_Objects.Operations;
|
-- C32107A.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 OBJECT DECLARATIONS ARE ELABORATED IN THE ORDER OF THEIR
-- OCCURRENCE, I.E., THAT EXPRESSIONS ASSOCIATED WITH ONE DECLARATION
-- (INCLUDING DEFAULT EXPRESSIONS, IF APPROPRIATE) ARE EVALUATED BEFORE
-- ANY EXPRESSION BELONGING TO THE NEXT DECLARATION. ALSO, CHECK THAT
-- EXPRESSIONS IN THE SUBTYPE INDICATION OR THE CONSTRAINED ARRAY
-- DEFINITION ARE EVALUATED BEFORE ANY INITIALIZATION EXPRESSIONS ARE
-- EVALUATED.
-- R.WILLIAMS 9/24/86
WITH REPORT; USE REPORT;
PROCEDURE C32107A IS
BUMP : INTEGER := 0;
ORDER_CHECK : INTEGER;
G1, H1, I1 : INTEGER;
FIRST_CALL : BOOLEAN := TRUE;
TYPE ARR1 IS ARRAY (POSITIVE RANGE <>) OF INTEGER;
TYPE ARR1_NAME IS ACCESS ARR1;
TYPE ARR2 IS ARRAY (POSITIVE RANGE <>, POSITIVE RANGE <>) OF
INTEGER;
TYPE REC (D : INTEGER) IS
RECORD
COMP : INTEGER;
END RECORD;
TYPE REC_NAME IS ACCESS REC;
FUNCTION F RETURN INTEGER IS
BEGIN
BUMP := BUMP + 1;
RETURN BUMP;
END F;
FUNCTION G RETURN INTEGER IS
BEGIN
BUMP := BUMP + 1;
G1 := BUMP;
RETURN BUMP;
END G;
FUNCTION H RETURN INTEGER IS
BEGIN
BUMP := BUMP + 1;
H1 := BUMP;
RETURN BUMP;
END H;
FUNCTION I RETURN INTEGER IS
BEGIN
IF FIRST_CALL THEN
BUMP := BUMP + 1;
I1 := BUMP;
FIRST_CALL := FALSE;
END IF;
RETURN I1;
END I;
BEGIN
TEST ( "C32107A", "CHECK THAT OBJECT DECLARATIONS ARE " &
"ELABORATED IN THE ORDER OF THEIR " &
"OCCURRENCE, I.E., THAT EXPRESSIONS " &
"ASSOCIATED WITH ONE DECLARATION (INCLUDING " &
"DEFAULT EXPRESSIONS, IF APPROPRIATE) ARE " &
"EVALUATED BEFORE ANY EXPRESSION BELONGING " &
"TO THE NEXT DECLARATION. ALSO, CHECK THAT " &
"EXPRESSIONS IN THE SUBTYPE INDICATION OR " &
"THE CONSTRAINED ARRAY DEFINITION ARE " &
"EVALUATED BEFORE ANY INITIALIZATION " &
"EXPRESSIONS ARE EVALUATED" );
DECLARE -- (A).
I1 : INTEGER := 10000 * F;
A1 : CONSTANT ARRAY (1 .. H) OF REC (G * 100) :=
(1 .. H1 => (G1 * 100, I * 10));
I2 : CONSTANT INTEGER := F * 1000;
BEGIN
ORDER_CHECK := I1 + I2 + A1'LAST + A1 (1).D + A1 (1).COMP;
IF ORDER_CHECK = 15243 OR ORDER_CHECK = 15342 THEN
COMMENT ( "ORDER_CHECK HAS VALUE " &
INTEGER'IMAGE (ORDER_CHECK) & " - (A)" );
ELSE
FAILED ( "OBJECTS NOT ELABORATED IN PROPER ORDER " &
"VALUE OF ORDER_CHECK SHOULD BE 15343 OR " &
"15242 -- ACTUAL VALUE IS " &
INTEGER'IMAGE (ORDER_CHECK) & " - (A)" );
END IF;
END; -- (A).
BUMP := 0;
DECLARE -- (B).
A : ARR2 (1 .. F, 1 .. F * 10);
R : REC (G * 100) := (G1 * 100, F * 1000);
I : INTEGER RANGE 1 .. H;
S : REC (F * 10);
BEGIN
ORDER_CHECK :=
A'LAST (1) + A'LAST (2) + R.D + R.COMP;
IF (H1 + S.D = 65) AND
(ORDER_CHECK = 4321 OR ORDER_CHECK = 4312) THEN
COMMENT ( "ORDER_CHECK HAS VALUE 65 " &
INTEGER'IMAGE (ORDER_CHECK) & " - (B)" );
ELSE
FAILED ( "OBJECTS NOT ELABORATED IN PROPER ORDER " &
"VALUE OF ORDER_CHECK SHOULD BE 65 4321 OR " &
"65 4312 -- ACTUAL VALUE IS " &
INTEGER'IMAGE (H1 + S.D) &
INTEGER'IMAGE (ORDER_CHECK) & " - (B)" );
END IF;
END; -- (B).
BUMP := 0;
DECLARE -- (C).
I1 : CONSTANT INTEGER RANGE 1 .. G * 10 := F;
A1 : ARRAY (1 .. F * 100) OF INTEGER RANGE 1 .. H * 1000;
BEGIN
ORDER_CHECK := I1 + (G1 * 10) + A1'LAST + (H1 * 1000);
IF ORDER_CHECK = 4312 OR ORDER_CHECK = 3412 THEN
COMMENT ( "ORDER_CHECK HAS VALUE " &
INTEGER'IMAGE (ORDER_CHECK) & " - (C)" );
ELSE
FAILED ( "OBJECTS NOT ELABORATED IN PROPER ORDER " &
"VALUE OF ORDER_CHECK SHOULD BE 4312 OR " &
"3412 -- ACTUAL VALUE IS " &
INTEGER'IMAGE (ORDER_CHECK) & " - (C)" );
END IF;
END; -- (C).
BUMP := 0;
FIRST_CALL := TRUE;
DECLARE -- (D).
A1 : ARRAY (1 .. G) OF REC (H * 10000) :=
(1 .. G1 => (H1 * 10000, I * 100));
R1 : CONSTANT REC := (F * 1000, F * 10);
BEGIN
ORDER_CHECK :=
A1'LAST + A1 (1).D + A1 (1).COMP + R1.D + R1.COMP;
IF ORDER_CHECK = 25341 OR ORDER_CHECK = 24351 OR
ORDER_CHECK = 15342 OR ORDER_CHECK = 14352 THEN
COMMENT ( "ORDER_CHECK HAS VALUE " &
INTEGER'IMAGE (ORDER_CHECK) & " - (D)" );
ELSE
FAILED ( "OBJECTS NOT ELABORATED IN PROPER ORDER " &
"VALUE OF ORDER_CHECK SHOULD BE 25341, " &
"24351, 15342 OR 14352 -- ACTUAL VALUE IS " &
INTEGER'IMAGE (ORDER_CHECK) & " - (D)" );
END IF;
END; -- (D).
BUMP := 0;
DECLARE -- (E).
A1 : CONSTANT ARR1_NAME := NEW ARR1' (1 .. F => F * 10);
R1 : REC_NAME (H * 100) := NEW REC'(H1 * 100, F * 1000);
BEGIN
ORDER_CHECK := A1.ALL'LAST + A1.ALL (1) + R1.D + R1.COMP;
IF ORDER_CHECK /= 4321 THEN
FAILED ( "OBJECTS NOT ELABORATED IN PROPER ORDER " &
"VALUE OF ORDER_CHECK SHOULD BE 4321 " &
"-- ACTUAL VALUE IS " &
INTEGER'IMAGE (ORDER_CHECK) & " - (E)" );
END IF;
END; -- (E).
BUMP := 0;
FIRST_CALL := TRUE;
DECLARE -- (F).
A1 : CONSTANT ARRAY (1 .. G) OF INTEGER RANGE 1 .. H * 100 :=
(1 .. G1 => I * 10);
A2 : ARR1 (1 .. F * 1000);
BEGIN
ORDER_CHECK :=
A1'LAST + (H1 * 100) + A1 (1) + A2'LAST;
IF ORDER_CHECK = 4231 OR ORDER_CHECK = 4132 THEN
COMMENT ( "ORDER_CHECK HAS VALUE " &
INTEGER'IMAGE (ORDER_CHECK) & " - (F)" );
ELSE
FAILED ( "OBJECTS NOT ELABORATED IN PROPER ORDER " &
"VALUE OF ORDER_CHECK SHOULD BE 4231 OR " &
"4132 -- ACTUAL VALUE IS " &
INTEGER'IMAGE (ORDER_CHECK) & " - (F)" );
END IF;
END; -- (F).
BUMP := 0;
DECLARE -- (G).
A1 : ARR1_NAME (1 .. G) := NEW ARR1 (1 .. G1);
R1 : CONSTANT REC_NAME (H * 10) :=
NEW REC'(H1 * 10, F * 100);
BEGIN
ORDER_CHECK := A1.ALL'LAST + R1.D + R1.COMP;
IF ORDER_CHECK /= 321 THEN
FAILED ( "OBJECTS NOT ELABORATED IN PROPER ORDER " &
"VALUE OF ORDER_CHECK SHOULD BE 321 OR " &
"-- ACTUAL VALUE IS " &
INTEGER'IMAGE (ORDER_CHECK) & " - (G)" );
END IF;
END; -- (G).
BUMP := 0;
DECLARE -- (H).
TYPE REC (D : INTEGER := F) IS
RECORD
COMP : INTEGER := F * 10;
END RECORD;
R1 : REC;
R2 : REC (G * 100) := (G1 * 100, F * 1000);
BEGIN
ORDER_CHECK := R1.D + R1.COMP + R2.D + R2.COMP;
IF ORDER_CHECK = 4321 OR ORDER_CHECK = 4312 OR
ORDER_CHECK = 3421 OR ORDER_CHECK = 3412 THEN
COMMENT ( "ORDER_CHECK HAS VALUE " &
INTEGER'IMAGE (ORDER_CHECK) & " - (H)" );
ELSE
FAILED ( "OBJECTS NOT ELABORATED IN PROPER ORDER " &
"VALUE OF ORDER_CHECK SHOULD BE 4321, " &
"4312, 3421, OR 3412 -- ACTUAL VALUE IS " &
INTEGER'IMAGE (ORDER_CHECK) & " - (H)" );
END IF;
END; -- (H).
BUMP := 0;
DECLARE -- (I).
TYPE REC2 (D1, D2 : INTEGER) IS
RECORD
COMP : INTEGER;
END RECORD;
R1 : REC2 (G * 1000, H * 10000) :=
(G1 * 1000, H1 * 10000, F * 100);
R2 : REC2 (F, F * 10);
BEGIN
ORDER_CHECK := R1.D1 + R1.D2 + R1.COMP + R2.D1 + R2.D2;
IF ORDER_CHECK = 21354 OR ORDER_CHECK = 21345 OR
ORDER_CHECK = 12345 OR ORDER_CHECK = 12354 THEN
COMMENT ( "ORDER_CHECK HAS VALUE " &
INTEGER'IMAGE (ORDER_CHECK) & " - (I)" );
ELSE
FAILED ( "OBJECTS NOT ELABORATED IN PROPER ORDER " &
"VALUE OF ORDER_CHECK SHOULD BE 21354, " &
"21345, 12354, OR 12345 -- ACTUAL VALUE IS " &
INTEGER'IMAGE (ORDER_CHECK) & " - (I)" );
END IF;
END; -- (I).
BUMP := 0;
DECLARE -- (J).
PACKAGE P IS
TYPE PRIV (D : INTEGER) IS PRIVATE;
P1 : CONSTANT PRIV;
P2 : CONSTANT PRIV;
FUNCTION GET_A (P : PRIV) RETURN INTEGER;
PRIVATE
TYPE PRIV (D : INTEGER) IS
RECORD
COMP : INTEGER;
END RECORD;
P1 : CONSTANT PRIV := (F , F * 10);
P2 : CONSTANT PRIV := (F * 100, F * 1000);
END P;
PACKAGE BODY P IS
FUNCTION GET_A (P : PRIV) RETURN INTEGER IS
BEGIN
RETURN P.COMP;
END GET_A;
END P;
USE P;
BEGIN
ORDER_CHECK := P1.D + GET_A (P1) + P2.D + GET_A (P2);
IF ORDER_CHECK = 4321 OR ORDER_CHECK = 4312 OR
ORDER_CHECK = 3412 OR ORDER_CHECK = 3421 THEN
COMMENT ( "ORDER_CHECK HAS VALUE " &
INTEGER'IMAGE (ORDER_CHECK) & " - (J)" );
ELSE
FAILED ( "OBJECTS NOT ELABORATED IN PROPER ORDER " &
"VALUE OF ORDER_CHECK SHOULD BE 4321, " &
"4312, 3421, OR 3412 -- ACTUAL VALUE IS " &
INTEGER'IMAGE (ORDER_CHECK) & " - (J)" );
END IF;
END; -- (J).
BUMP := 0;
DECLARE -- (K).
PACKAGE P IS
TYPE PRIV (D1, D2 : INTEGER) IS PRIVATE;
PRIVATE
TYPE PRIV (D1, D2 : INTEGER) IS
RECORD
NULL;
END RECORD;
END P;
USE P;
P1 : PRIV (F, F * 10);
P2 : PRIV (F * 100, F * 1000);
BEGIN
ORDER_CHECK := P1.D1 + P1.D2 + P2.D1 + P2.D2;
IF ORDER_CHECK = 4321 OR ORDER_CHECK = 4312 OR
ORDER_CHECK = 3412 OR ORDER_CHECK = 3421 THEN
COMMENT ( "ORDER_CHECK HAS VALUE " &
INTEGER'IMAGE (ORDER_CHECK) & " - (K)" );
ELSE
FAILED ( "OBJECTS NOT ELABORATED IN PROPER ORDER " &
"VALUE OF ORDER_CHECK SHOULD BE 4321, 4312, " &
"3421, OR 3412 -- ACTUAL VALUE IS " &
INTEGER'IMAGE (ORDER_CHECK) & " - (K)" );
END IF;
END; -- (K).
RESULT;
END C32107A;
|
-- { dg-do compile }
with Limited_With4_Pkg;
package body Limited_With4 is
procedure Proc1 (A : Limited_With4_Pkg.Rec12 ; I : Integer) is
begin
if A.R.I /= I then
raise Program_Error;
end if;
end;
function Func1 (I : Integer) return Limited_With4_Pkg.Rec12 is
begin
return (I => I, R => (I => I));
end;
procedure Proc2 (A : Limited_With4_Pkg.Rec22 ; I : Integer) is
begin
if A.R.I /= I then
raise Program_Error;
end if;
end;
function Func2 (I : Integer) return Limited_With4_Pkg.Rec22 is
begin
return (I => I, R => (I => I));
end;
procedure Proc3 (A : Limited_With4_Pkg.Rec12 ; B : Limited_With4_Pkg.Rec22) is
begin
if A.R.I /= B.R.I then
raise Program_Error;
end if;
end;
function Func3 (A : Limited_With4_Pkg.Rec12) return Limited_With4_Pkg.Rec22 is
begin
return (I => A.R.I, R => (I => A.R.I));
end;
end Limited_With4;
|
-------------------------------------------------------------------------------
-- Copyright (c) 2019, Daniel King
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * The name of the copyright holder may not be used to endorse or promote
-- Products derived from this software without specific prior written
-- permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with Ada.Containers.Doubly_Linked_Lists;
with Ada.Containers.Indefinite_Doubly_Linked_Lists;
with Ada.Containers.Indefinite_Hashed_Maps;
with Ada.Containers.Hashed_Maps;
with Ada.Finalization; use Ada.Finalization;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Strings.Unbounded.Hash;
with Keccak.Types;
package Test_Vectors is
type Byte_Array_Access is access Keccak.Types.Byte_Array;
type Value_Type is
(String_Type,
Integer_Type,
Hex_Array_Type);
type Value_Choice (VType : Value_Type) is
new Ada.Finalization.Controlled with
record
case VType is
when String_Type =>
Str : Unbounded_String;
when Integer_Type =>
Int : Integer;
when Hex_Array_Type =>
Hex : Byte_Array_Access;
end case;
end record;
procedure Initialize (Object : in out Value_Choice);
procedure Adjust (Object : in out Value_Choice);
procedure Finalize (Object : in out Value_Choice);
package Value_Choice_Lists is new Ada.Containers.Indefinite_Doubly_Linked_Lists
(Element_Type => Value_Choice,
"=" => "=");
type Schema_Entry is record
VType : Value_Type := Integer_Type;
Required : Boolean := True;
Is_List : Boolean := False;
end record;
package Schema_Maps is new Ada.Containers.Hashed_Maps
(Key_Type => Unbounded_String,
Element_Type => Schema_Entry,
Hash => Ada.Strings.Unbounded.Hash,
Equivalent_Keys => "=",
"=" => "=");
-- Maps test vector keys to their required types.
package Test_Vector_Maps is new Ada.Containers.Indefinite_Hashed_Maps
(Key_Type => Unbounded_String,
Element_Type => Value_Choice_Lists.List,
Hash => Ada.Strings.Unbounded.Hash,
Equivalent_Keys => "=",
"=" => Value_Choice_Lists."=");
-- Stores all information relating to a single test vector.
-- For example, the line: MD = 00112233 from the test vector file
-- will be stored in the map with the key "MD" and the value "00112233"
-- as a byte array or string (depending on the schema).
package Lists is new Ada.Containers.Doubly_Linked_Lists
(Element_Type => Test_Vector_Maps.Map,
"=" => Test_Vector_Maps."=");
-- A list of test vectors.
function Hex_String_To_Byte_Array (Str : in String) return Byte_Array_Access;
-- Convert a string of hex characters to a byte array.
--
-- E.g. a string "01afBC" is converted to the array (16#01#, 16#AF#, 16#BC#)
function String_To_Byte_Array (Str : in String) return Byte_Array_Access;
-- Convert a string to its byte array representation.
--
-- This is just a conversion of each Character to its Byte representation.
function Byte_Array_To_String (Data : in Keccak.Types.Byte_Array) return String;
-- Convert a byte array to a hex string representation.
procedure Load (File_Name : in String;
Schema : in Schema_Maps.Map;
Vectors_List : out Lists.List);
-- Load test vectors from a file.
--
-- A test vector is in the form: Key = Value where the Value may optionally
-- have quotes " around it.
--
-- For example:
-- Len = 17
-- Msg = 4FF400
-- MD = 94D5B162A324674454BBADB377375DA15C3BE74225D346010AE557A9
--
-- Test vectors should be separated by a blank line, but is not mandatory
-- provided that each test vector has the same keys.
--
-- Comments appear on their own line and start with the '#' character.
--
-- The schema defines which Keys are expected, the required type of the
-- corresponding Value.
Schema_Error : exception;
end Test_Vectors;
|
------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- ANNEXI-STRAYLINE Reference Implementation --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Strings;
with Ada.Strings.Unbounded;
with Ada.Containers.Vectors;
with Ada.Exceptions;
with Ada.Environment_Variables;
with Ada.Directories;
package body Child_Processes.Path_Searching is
procedure Not_Found_Error (Program: String) with Inline, No_Return is
begin
raise Not_In_Path with
"Program """ & Program & """ was not found in PATH.";
end;
-----------------
-- Search_Path --
-----------------
function Search_Path (Program: String) return String is
use Ada.Strings.Unbounded;
package ENV renames Ada.Environment_Variables;
package Path_Vectors is new Ada.Containers.Vectors
(Index_Type => Positive,
Element_Type => Unbounded_String);
Path_List: Path_Vectors.Vector;
begin
-- Parse the PATH environment varaible - a colon-separated list
declare
use Ada.Strings;
PATH: Unbounded_String;
First: Positive := 1;
Last : Natural := 1;
begin
if not ENV.Exists ("PATH") then
raise Not_In_Path with
"PATH environment variable not set.";
end if;
Set_Unbounded_String
(Target => PATH,
Source => ENV.Value ("PATH"));
while First <= Length (PATH) loop
Last := Index (Source => PATH,
Pattern => ":",
From => First);
if Last < First then
Last := Length (PATH);
elsif Last = First then
raise Not_In_Path with "PATH format error.";
else
Last := Last - 1;
end if;
Path_List.Append (Unbounded_Slice (Source => PATH,
Low => First,
High => Last));
First := Last + 2;
end loop;
end;
declare
use Ada.Directories;
Ordinary_Files: constant Filter_Type := (Ordinary_File => True,
others => False);
Search: Search_Type;
Match : Directory_Entry_Type;
begin
-- Search through the paths in order
for Path of Path_List loop
-- We don't want an exception raised if the indiciated path of
-- the PATH environment variable is not a valid path, we just
-- want to skip it
if Exists (To_String (Path)) then
Start_Search (Search => Search,
Directory => To_String (Path),
Pattern => Program,
Filter => Ordinary_Files);
if More_Entries (Search) then
-- We have a match
Get_Next_Entry (Search => Search,
Directory_Entry => Match);
return Full_Name (Match);
end if;
-- Otherwise try the next directory
end if;
end loop;
end;
-- If we get here, we didn't find it
Not_Found_Error (Program);
exception
when Not_In_Path =>
raise;
when e: others =>
raise Not_In_Path with
"Unable to execute path search due to an exception: " &
Ada.Exceptions.Exception_Information (e);
end Search_Path;
--
-- Elaboration_Path_Search
--
----------------
-- Initialize --
----------------
function Initialize (Program: aliased String)
return Elaboration_Path_Search
is
use Image_Path_Strings;
begin
return Search: Elaboration_Path_Search (Program'Access) do
Search.Result := To_Bounded_String (Search_Path (Program));
exception
when Ada.Directories.Name_Error =>
Search.Result := Null_Bounded_String;
when Ada.Strings.Length_Error =>
raise Ada.Strings.Length_Error with
"Full path for program"""
& Program
& """ is too long. Child_Processes.Path_Searching must "
& "be modified.";
end return;
end Initialize;
-----------
-- Found --
-----------
function Found (Search: Elaboration_Path_Search) return Boolean is
use Image_Path_Strings;
begin
return Length (Search.Result) > 0;
end;
----------------
-- Image_Path --
----------------
function Image_Path (Search: Elaboration_Path_Search) return String is
use Image_Path_Strings;
begin
if not Found (Search) then
Not_Found_Error (Search.Program.all);
else
return To_String (Search.Result);
end if;
end Image_Path;
end Child_Processes.Path_Searching;
|
-- ----------------------------------------------------------------- --
-- --
-- This is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public --
-- License as published by the Free Software Foundation; either --
-- version 2 of the License, or (at your option) any later version. --
-- --
-- This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public --
-- License along with this library; if not, write to the --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
-- Boston, MA 02111-1307, USA. --
-- --
-- ----------------------------------------------------------------- --
-- ----------------------------------------------------------------- --
-- This is a translation, to the Ada programming language, of the --
-- original C test files written by Sam Lantinga - www.libsdl.org --
-- translation made by Antonio F. Vargas - www.adapower.net/~avargas --
-- ----------------------------------------------------------------- --
with Ada.Text_IO; use Ada.Text_IO;
with SDL.Active;
with SDL.Mouse;
with SDL.Keysym;
with SDL_Framebuffer;
package body Testwm_Sprogs is
package It renames Interfaces;
package A renames SDL.Active;
use type A.Active_State;
package Ks renames SDL.Keysym;
use type Ks.Key;
use type Ks.SDLMod;
use type C.int;
use type V.Surface_Flags;
use type V.Surface_ptr;
use type V.Palette_ptr;
use type V.GrabMode;
package Fb renames SDL_Framebuffer;
package M renames SDL.Mouse;
use type M.Mouse_Button_State;
visible : C.int := 1;
-- =============================================
procedure LoadIconSurface (
file : in string;
maskp : in out Icon_Mask_Array_Access;
icon : out V.Surface_ptr)
is
use type Interfaces.Unsigned_8;
mlen : C.int;
i : Integer;
pixels : Fb.Framebuffer_8bPointer;
use V.Color_PtrOps;
begin
-- Load the icon surface
icon := V.LoadBMP (file);
if icon = null then
Put_Line ("Couldn't load " & file & Er.Get_Error);
return;
end if;
-- Check width and height
if icon.w mod 8 /= 0 then
Put_Line ("Icon width must be a multiple of 8!");
V.FreeSurface (icon);
icon := null;
return;
end if;
if icon.format.palette = null then
Put_Line ("Icon must have a palette!");
V.FreeSurface (icon);
icon := null;
return;
end if;
-- Set the colorkey
V.SetColorKey (icon, V.SRCCOLORKEY,
Fb.Get_Framebuffer (icon).all);
-- Create the mask
pixels := Fb.Get_Framebuffer (icon);
Put_Line ("Transparent pixel: (" &
Uint8'Image (Fb.Get_Palette_Red (icon, pixels.all))
& "," &
Uint8'Image (Fb.Get_Palette_Green (icon, pixels.all))
& "," &
Uint8'Image (Fb.Get_Palette_Blue (icon, pixels.all))
& ")");
mlen := icon.w * icon.h;
maskp := new V.Icon_Mask_Array(0 .. Integer(mlen/8 - 1));
maskp.all := (others => 0);
i := 0;
while i < Integer (mlen) loop
if Fb.Go_Right_Unchecked (pixels, i).all /= pixels.all then
maskp (i / 8) := Uint8 (
It.Unsigned_8 (maskp (i / 8)) or 16#01#);
end if;
i := i + 1;
if i mod 8 /= 0 then
maskp (i / 8) := Shift_Left (maskp (i / 8), 1);
end if;
end loop;
end LoadIconSurface;
-- =============================================
procedure HotKey_ToggleFullScreen is
screen : V.Surface_ptr;
begin
screen := V.GetVideoSurface;
if V.WM_ToggleFullScreen (screen) /= 0 then
Put ("Toggled fullscreen mode - now ");
if (screen.flags and V.FULLSCREEN) /= 0 then
Put_Line ("fullscreen");
else
Put_Line ("windowed");
end if;
else
Put_Line ("Unable to toggle fullscreen mode");
end if;
end HotKey_ToggleFullScreen;
-- =============================================
procedure HotKey_ToggleGrab is
mode : V.GrabMode;
begin
Put_Line ("Ctrl-G: toggling input grab!");
mode := V.WM_GrabInput (V.GRAB_QUERY);
if mode = V.GRAB_ON then
Put_Line ("Grab was on");
else
Put_Line ("Grab was off");
end if;
if mode /= 0 then
mode := 0;
else
mode := 1;
end if;
mode := V.WM_GrabInput (mode);
if mode = V.GRAB_ON then
Put_Line ("Grab is now on");
else
Put_Line ("Grab is now off");
end if;
end HotKey_ToggleGrab;
-- =============================================
procedure HotKey_Iconify is
begin
Put_Line ("Ctrl-Z: iconifying window!");
V.WM_IconifyWindow;
end HotKey_Iconify;
-- =============================================
procedure HotKey_Quit is
event : Ev.Event;
begin
Put_Line ("Posting internal quit request");
event.the_type := Ev.ISUSEREVENT;
Ev.PushEvent (event);
end HotKey_Quit;
-- =============================================
reallyquit : C.int := 0;
function FilterEvents (event : Ev.Event_ptr) return C.int is
begin
case event.the_type is
when Ev.ISACTIVEEVENT =>
-- See what happened
Put("App ");
if event.active.gain /= 0 then
Put ("gained ");
else
Put ("lost ");
end if;
if (event.active.state and A.APPACTIVE) /= 0 then
Put ("active ");
end if;
if (event.active.state and A.APPMOUSEFOCUS) /= 0 then
Put ("mouse ");
end if;
Put_Line ("focus");
-- See if we are iconified or restored
if (event.active.state and A.APPACTIVE) /= 0 then
Put ("App has been ");
if event.active.gain /= 0 then
Put_Line ("restored");
else
Put_Line ("iconified");
end if;
end if;
return 0;
-- We want to toggle visibility on buttonpress
when Ev.MOUSEBUTTONDOWN | Ev.MOUSEBUTTONUP =>
if event.button.state = M.PRESSED then
if visible /= 0 then
visible := 0;
else
visible := 1;
end if;
M.ShowCursor (visible);
end if;
Put ("Mouse button " &
Uint8'Image (event.button.button) &
" has been");
if event.button.state = M.PRESSED then
Put_Line (" pressed");
else
Put_Line (" released");
end if;
return 0;
-- Show relative mouse motion
when Ev.MOUSEMOTION =>
Put_Line ("Mouse relative motion: {" &
Sint16'Image (event.motion.xrel) &
", " &
Sint16'Image (event.motion.yrel) &
"}");
return 0;
when Ev.KEYDOWN =>
if event.key.keysym.sym = Ks.K_ESCAPE then
HotKey_Quit;
end if;
if (event.key.keysym.sym = Ks.K_g) and
((event.key.keysym.the_mod and Ks.KMOD_CTRL) /= 0)
then
HotKey_ToggleGrab;
end if;
if (event.key.keysym.sym = Ks.K_z) and
((event.key.keysym.the_mod and Ks.KMOD_CTRL) /= 0)
then
HotKey_Iconify;
end if;
if (event.key.keysym.sym = Ks.K_RETURN) and
((event.key.keysym.the_mod and Ks.KMOD_ALT) /= 0)
then
HotKey_ToggleFullScreen;
end if;
return 0;
-- this is important! Queue it if we want to quit.
when Ev.QUIT =>
if reallyquit = 0 then
reallyquit := 1;
Put_Line ("Quit requested");
return 0;
end if;
Put_Line ("Quit demanded");
return 1;
-- This will never happen because events queued directly
-- to the event queue are not filtred.
when Ev.ISUSEREVENT =>
return 1;
-- Drop all other events
when others =>
return 0;
end case;
end FilterEvents;
end Testwm_Sprogs;
|
package body any_Math.any_Geometry
is
function Image (Self : in Triangle) return String
is
begin
return "(" & Vertex_Id'Image (Self (1)) & ","
& Vertex_Id'Image (Self (2)) & ","
& Vertex_Id'Image (Self (3)) & ")";
end Image;
function Image (Self : in Triangles) return String
is
Result : String (1 .. 1024);
Last : Standard.Natural := 0;
begin
for Each in Self'Range
loop
declare
Id_Image : constant String := Image (Self (Each));
begin
Result (Last + 1 .. Last + Id_Image'Length) := Id_Image;
Last := Last + Id_Image'Length;
end;
end loop;
return Result (1 .. Last);
exception
when Constraint_Error =>
declare
Ellipsis : constant String := " ...";
begin
Result (Result'Last - ellipsis'Length + 1 .. Result'Last) := ellipsis;
return Result (1 .. Last);
end;
end Image;
function Image (Self : in Model) return String
is
begin
return Self.Triangles.Image;
end Image;
function Image (Self : in Model_Triangles) return String
is
begin
return "Triangle_Count =>" & standard.Positive'Image (Self.Triangle_Count)
& Image (Self.Triangles);
end Image;
end any_Math.any_Geometry;
|
with
any_Math.any_Analysis;
package float_Math.Analysis is new float_Math.any_Analysis;
pragma Pure (float_Math.Analysis);
|
with Ada.Numerics.Discrete_Random;
function lanzar_dado (dado: in out Integer) return Integer is
subtype rango is Integer range 1..6;
package miRango is new Ada.Numerics.Discrete_Random(rango);
semilla : miRango.generator;
begin
miRango.reset(semilla);
dado:= miRango.random(semilla);
return dado;
end lanzar_dado;
|
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Access_Types;
with Program.Lexical_Elements;
with Program.Elements.Subtype_Indications;
package Program.Elements.Object_Access_Types is
pragma Pure (Program.Elements.Object_Access_Types);
type Object_Access_Type is
limited interface and Program.Elements.Access_Types.Access_Type;
type Object_Access_Type_Access is access all Object_Access_Type'Class
with Storage_Size => 0;
not overriding function Subtype_Indication
(Self : Object_Access_Type)
return not null Program.Elements.Subtype_Indications
.Subtype_Indication_Access is abstract;
not overriding function Has_Not_Null
(Self : Object_Access_Type)
return Boolean is abstract;
not overriding function Has_All (Self : Object_Access_Type) return Boolean
is abstract;
not overriding function Has_Constant
(Self : Object_Access_Type)
return Boolean is abstract;
type Object_Access_Type_Text is limited interface;
type Object_Access_Type_Text_Access is
access all Object_Access_Type_Text'Class with Storage_Size => 0;
not overriding function To_Object_Access_Type_Text
(Self : aliased in out Object_Access_Type)
return Object_Access_Type_Text_Access is abstract;
not overriding function Not_Token
(Self : Object_Access_Type_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Null_Token
(Self : Object_Access_Type_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Access_Token
(Self : Object_Access_Type_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function All_Token
(Self : Object_Access_Type_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Constant_Token
(Self : Object_Access_Type_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
end Program.Elements.Object_Access_Types;
|
------------------------------------------------------------------------------
-- --
-- J E W L . M E S S A G E _ H A N D L I N G --
-- --
-- The body of a private package which defines the message-handling task --
-- required by JEWL.Windows, the protected record used to communicate --
-- with it, and related operations. --
-- --
-- Copyright (C) John English 2000. Contact address: je@brighton.ac.uk --
-- This software is released under the terms of the GNU General Public --
-- License and is intended primarily for educational use. Please contact --
-- the author to report bugs, suggestions and modifications. --
-- --
------------------------------------------------------------------------------
-- $Id: jewl-message_handling.adb 1.7 2007/01/08 17:00:00 JE Exp $
------------------------------------------------------------------------------
--
-- $Log: jewl-message_handling.adb $
-- Revision 1.7 2007/01/08 17:00:00 JE
-- * Fixed linker options in JEWL.Win32_Interface to accommodate changes to GNAT
-- GPL 2006 compiler (thanks to John McCormick for this)
-- * Added delay in message loop to avoid the appearance of hogging 100% of CPU
-- time
--
-- Revision 1.6 2001/11/02 16:00:00 JE
-- * Fixed canvas bug when saving an empty canvas
-- * Restore with no prior save now acts as erase
-- * Removed redundant variable declaration in Image function
--
-- Revision 1.5 2001/08/22 15:00:00 JE
-- * Minor bugfix to Get_Text for combo boxes
-- * Minor changes to documentation (including new example involving dialogs)
--
-- Revision 1.4 2001/01/25 09:00:00 je
-- Changes visible to the user:
--
-- * Added support for drawing bitmaps on canvases (Draw_Image operations
-- and new type Image_Type)
-- * Added Play_Sound
-- * Added several new operations on all windows: Get_Origin, Get_Width,
-- Get_Height, Set_Origin, Set_Size and Focus
-- * Added several functions giving screen and window dimensions: Screen_Width,
-- Screen_Height, Frame_Width, Frame_Height, Dialog_Width, Dialog_Height and
-- Menu_Height
-- * Canvases can now handle keyboard events: new constructor and Key_Code added
-- * Added procedure Play_Sound
-- * Operations "+" and "-" added for Point_Type
-- * Pens can now be zero pixels wide
-- * The absolute origin of a frame can now have be specified when the frame
-- is created
-- * Added new File_Dialog operations Add_Filter and Set_Directory
-- * Added Get_Line renames to JEWL.IO for compatibility with Ada.Text_IO
-- * Added all the Get(File,Item) operations mentioned in documentation but
-- unaccountably missing :-(
-- * Documentation updated to reflect the above changes
-- * HTML versions of public package specifications added with links from
-- main documentation pages
--
-- Other internal changes:
--
-- * Canvas fonts, pens etc. now use JEWL.Reference_Counted_Type rather than
-- reinventing this particular wheel, as do images
-- * Various minor code formatting changes: some code reordered for clarity,
-- some comments added or amended,
-- * Changes introduced in 1.2 to support GNAT 3.10 have been reversed, since
-- GNAT 3.10 still couldn't compile this code correctly... ;-(
--
-- Outstanding issues:
--
-- * Optimisation breaks the code (workaround: don't optimise)
--
-- Revision 1.3 2000/07/07 12:00:00 je
-- * JEWL.Simple_Windows added; JEWL.IO modified to use JEWL.Simple_Windows.
-- * JEWL.IO bug fix: Put_Line to file wrote newline to standard output
-- instead of to the file (thanks to Jeff Carter for pointing this out).
-- * Panels fixed so that mouse clicks are passed on correctly to subwindows.
-- * Memos fixed so that tabs are handled properly.
-- * Password feature added to editboxes.
-- * Minor typos fixed in comments within the package sources.
-- * Documentation corrected and updated following comments from Moti Ben-Ari
-- and Don Overheu.
--
-- Revision 1.2 2000/04/18 20:00:00 je
-- * Minor code changes to enable compilation by GNAT 3.10
-- * Minor documentation errors corrected
-- * Some redundant "with" clauses removed
--
-- Revision 1.1 2000/04/09 21:00:00 je
-- Initial revision
--
------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
package body JEWL.Message_Handling is
use JEWL.Window_Implementation;
use JEWL.Win32_Interface;
use Ada.Exceptions;
use type System.Address;
use type Win32_BOOL, Win32_DWORD, Win32_LONG, Win32_UINT;
-----------------------------------------------------------------------------
-- Type conversions (needed below)
-----------------------------------------------------------------------------
function To_Window_Ptr is new Ada.Unchecked_Conversion
(Win32_LONG,Window_Ptr);
function To_LONG is new Ada.Unchecked_Conversion
(Window_Ptr,Win32_LONG);
----------------------------------------------------------------------------
--
-- W I N D O W _ I N F O
--
----------------------------------------------------------------------------
protected body Window_Info is
--------------------------------------------------------------------------
--
-- Get_Command: block until a command is available (or the message loop
-- has failed) and then return it. The command is also reset.
-- Program_Error is raised if the message loop has failed.
--
entry Get_Command (Cmd : out Natural)
when Command /= 0 or Task_Failed is
begin
if Task_Failed then
Raise_Exception (Program_Error'Identity,
"caused by " & Exception_Name(Failure_Info) &
": " & Exception_Message(Failure_Info));
end if;
Cmd := Command - WM_USER;
Command := 0;
end Get_Command;
--------------------------------------------------------------------------
--
-- Test_Command: test if a command is pending. Program_Error is raised
-- if the message loop task has failed.
--
function Test_Command return Boolean is
begin
if Task_Failed then
Raise_Exception (Program_Error'Identity,
"caused by " & Exception_Name(Failure_Info) &
": " & Exception_Message(Failure_Info));
end if;
return Command /= 0;
end Test_Command;
--------------------------------------------------------------------------
--
-- Set_Command: store the code for an available command. This is a
-- procedure, not an entry, so the the message loop won't
-- stall. If commands aren't handled in time, they'll be
-- overwritten by the next one that comes along.
--
procedure Set_Command (Cmd : in Natural) is
begin
Command := Cmd;
end Set_Command;
--------------------------------------------------------------------------
--
-- Get_Dialog: swap the handle of the current active window with the
-- parameter (i.e. record the new handle and return the
-- old one).
--
procedure Get_Dialog (Dlg : in out Win32_HWND) is
D : Win32_HWND := Dialog;
begin
Dialog := Dlg;
Dlg := D;
end Get_Dialog;
--------------------------------------------------------------------------
--
-- Active_Window: get the handle of the current active window.
--
function Active_Window return Win32_HWND is
begin
return Dialog;
end Active_Window;
--------------------------------------------------------------------------
--
-- Record_Error : record the occurrence of an exception which aborted
-- the message loop task.
--
procedure Record_Error (Err : in Ada.Exceptions.Exception_Occurrence) is
begin
Task_Failed := True;
Ada.Exceptions.Save_Occurrence (Failure_Info, Err);
end Record_Error;
end Window_Info;
----------------------------------------------------------------------------
--
-- U T I L I T Y F U N C T I O N S
--
----------------------------------------------------------------------------
--
-- Get_Actual_Bounds: check if any bounds supplied are non-positive
-- (i.e. relative to parent size) and recalculate
-- the bounds if so. Resize is set True if any
-- bounds have been updated.
--
procedure Get_Actual_Bounds (Parent : in Win32_HWND;
Top : in out Integer;
Left : in out Integer;
Width : in out Integer;
Height : in out Integer;
Resize : out Boolean) is
R : aliased Win32_RECT;
begin
-- Do any bounds need recalculationg?
Resize := Top < 0 or Left < 0 or Width <= 0 or Height <= 0;
if Resize then
-- Top-level windows take their bounds from the screen, child windows
-- take them from their parent
if Parent = System.Null_Address then
R := (0, 0, Win32_LONG(GetSystemMetrics(SM_CXSCREEN)),
Win32_LONG(GetSystemMetrics(SM_CYSCREEN)));
else
Bool_Dummy := GetClientRect (Parent, R'Unchecked_Access);
end if;
-- Recalculate left side relative to parent bounds if necessary
if Left < 0 then
Left := Left + Integer(R.Right);
end if;
-- Recalculate top relative to parent bounds if necessary
if Top < 0 then
Top := Top + Integer(R.Bottom);
end if;
-- Recalculate width relative to parent bounds if necessary
if Width <= 0 then
Width := Width + Integer(R.Right);
end if;
-- Recalculate height relative to parent bounds if necessary
if Height <= 0 then
Height := Height + Integer(R.Bottom);
end if;
end if;
end Get_Actual_Bounds;
----------------------------------------------------------------------------
--
-- Build_Window: construct a top-level window of the specified class,
-- with extended and normal styles as specified, and
-- make the window visible or invisible as requested.
--
procedure Build_Window (Window : in Main_Window_Ptr;
Class : in Win32_String;
Title : in Win32_String;
XStyle : in Win32_DWORD;
Style : in Win32_DWORD;
Show : in Boolean) is
S : Win32_DWORD := Style;
begin
-- Add the VISIBLE style if the window is to be shown
if Show then
S := S or WS_VISIBLE;
end if;
-- Create the window using the supplied parameters
Window.Handle := CreateWindowEx (XStyle,
To_LPCSTR(Class),
To_LPCSTR(Title),
S,
Win32_INT(Window.Left),
Win32_INT(Window.Top),
Win32_INT(Window.Width),
Win32_INT(Window.Height),
System.Null_Address,
System.Null_Address,
Get_hInstance,
Window.all'Address);
-- Store a pointer to the Window_Internals in the user data area
-- so that the message loop can find it
Long_Dummy := SendMessage (Window.Handle, WM_SETFONT,
To_WPARAM(Window.Font),0);
-- Show or hide the window as requested
if Show then
Bool_Dummy := ShowWindow (Window.Handle, SW_SHOWNORMAL);
else
Bool_Dummy := ShowWindow (Window.Handle, SW_HIDE);
end if;
-- Mark the window for repainting
Bool_Dummy := UpdateWindow (Window.Handle);
end Build_Window;
----------------------------------------------------------------------------
--
-- Build_Child: build a child window attached to the specified parent
-- belonging to the specified class, using the specified
-- title (caption text) as appropriate. Use the specified
-- extended styles and normal styles, and set the window
-- dimensions (relative to the parent's client area).
--
procedure Build_Child (Window : in Window_Ptr;
Parent : in Container_Ptr;
Class : in Win32_String;
Title : in Win32_String;
XStyle : in Win32_DWORD;
Style : in Win32_DWORD;
Top : in Integer;
Left : in Integer;
Width : in Integer;
Height : in Integer) is
W : Window_Ptr := Window;
H : Win32_HWND;
S : Win32_DWORD := Style;
begin
-- The parent window's Group flag determines whether the WS_GROUP style
-- should be applied to the child control in case it isn't already set.
if Parent.Group then
S := S or WS_GROUP;
end if;
-- All child windows except radiobuttons have WS_GROUP set anyway; the
-- first radiobutton in a group also needs it set, so record if it was
-- already set in the requested style to ensure that it will be applied
-- to the next control regardless.
Parent.Group := (Style and WS_GROUP) /= 0;
-- Create the window using the supplied parameters
Window.Handle := CreateWindowEx
(XStyle,
To_LPCSTR(Class), To_LPCSTR(Title),
S or WS_CHILD or WS_VISIBLE,
Win32_INT(Left), Win32_INT(Top),
Win32_INT(Width), Win32_INT(Height),
Parent.Handle, To_Handle(Window.Action),
Get_hInstance,
System.Null_Address);
-- Store a pointer to the Window_Internals in the user data area
-- so that the message loop can find it
Long_Dummy := SetWindowLong (Window.Handle,
GWL_USERDATA, To_LONG(Window));
-- Scan the parent chain until a font is found if there isn't one
-- for this window (i.e. Parent_Font has been used)
while W.Font = System.Null_Address and W.Parent /= null loop
W := Window_Ptr(W.Parent);
end loop;
-- If a font was found, select it
if W.Font /= System.Null_Address then
Long_Dummy := SendMessage (Window.Handle, WM_SETFONT,
To_WPARAM(W.Font),0);
end if;
-- If this is a tabstop control (i.e. the tab key will activate it),
-- find the top-level parent and check if it's the first tabstop in
-- the window. If it is, give it the keyboard focus. The WM_ACTIVATE
-- message handler will track it once it's been set. Don't explicitly
-- set the focus unless the control is visible.
if (Style and WS_TABSTOP) /= 0 then
while W.Parent /= null loop
W := Window_Ptr(W.Parent); -- climb the parent chain
end loop;
if Main_Window_Ptr(W).Focus = System.Null_Address then
-- At this point, we know that this is the first tabstop control
-- to be attached to the top-level window W. Record the fact, and
-- focus on this window if it's visible.
Main_Window_Ptr(W).Focus := Window.Handle;
if IsWindowVisible(W.Handle) /= 0 then
H := SetFocus (Window.Handle); -- set focus if visible
end if;
end if;
end if;
end Build_Child;
----------------------------------------------------------------------------
--
-- M E S S A G E _ L O O P
--
-- This task drives the Windows message loop, and starts as soon as the
-- package body is elaborated. It uses a global variable Frames to keep
-- track of the number of top-level windows to allow it to terminate if
-- there are no top-level windows open. The repetition of entry handlers
-- is required because we need a terminate alternative (which rules out
-- having an else part) and we also need to handle Windows messages (which
-- must be done by the task that creates the windows, i.e. this one) which
-- can only be done by checking for messages in an else part.
--
----------------------------------------------------------------------------
Frames : Integer := 0; -- a global variable used by the message loop
-- to record the number of top-level windows.
task body Message_Loop is
M : aliased Win32_MSG;
H : Win32_HWND;
begin
loop
-- The following select statement is executed when there are no
-- top level windows. The alternatives are to create a window,
-- destroy a window, show a common dialog or to terminate. The
-- destroy alternative is needed because the main window cleanup
-- operation will call it if the window handle is still valid
-- when the internal window structure is being finalized.
select
accept Create_Window (Window : in Main_Window_Ptr;
Class : in Win32_String;
Title : in Win32_String;
XStyle : in Win32_DWORD;
Style : in Win32_DWORD;
Show : in Boolean)
do
Build_Window (Window, Class, Title, XStyle, Style, Show);
Frames := Frames + 1;
end Create_Window;
or
accept Destroy_Window (Handle : in Win32_HWND)
do
Bool_Dummy := DestroyWindow (Handle);
end Destroy_Window;
or
accept Show_Dialog (Dialog : in Common_Dialog_Ptr;
Result : out Boolean)
do
Result := Show_Dialog(Dialog);
end Show_Dialog;
or
terminate;
end select;
-- Once the first top-level window has been created, this inner loop
-- will accept requests to create top-level or child windows, to show
-- common dialogs or to destroy windows. When there are no pending
-- requests it will look to see if there is a pending Windows message
-- and process it if so. The loop ends when the last top-level window
-- is destroyed, which then takes us back to the top of the outer loop
-- to wait for a top-level window to be created or destroyed, or a
-- termination request.
while Frames > 0 loop
select
accept Create_Child (Window : in Window_Ptr;
Parent : in Container_Ptr;
Class : in Win32_String;
Title : in Win32_String;
XStyle : in Win32_DWORD;
Style : in Win32_DWORD;
Top : in Integer;
Left : in Integer;
Width : in Integer;
Height : in Integer)
do
Build_Child (Window, Parent, Class, Title, XStyle, Style,
Top, Left, Width, Height);
end Create_Child;
or
accept Create_Window (Window : in Main_Window_Ptr;
Class : in Win32_String;
Title : in Win32_String;
XStyle : in Win32_DWORD;
Style : in Win32_DWORD;
Show : in Boolean)
do
Build_Window (Window, Class, Title, XStyle, Style, Show);
Frames := Frames + 1;
end Create_Window;
or
accept Set_Focus (Window : in Win32_HWND)
do
Long_Dummy := To_LONG (SetFocus(Window));
end Set_Focus;
or
accept Destroy_Window (Handle : in Win32_HWND)
do
Bool_Dummy := DestroyWindow (Handle);
end Destroy_Window;
or
accept Show_Dialog (Dialog : in Common_Dialog_Ptr;
Result : out Boolean)
do
Result := Show_Dialog(Dialog);
end Show_Dialog;
else
-- If nothing else appeals: there is at least one window in
-- existence, so try to pump any pending Windows messages
while PeekMessage(M'Unchecked_Access, System.Null_Address,
0, 0, PM_REMOVE) /= 0 loop
-- A message is pending, so find the top-level parent of the
-- window it's aimed at
H := M.hwnd;
while GetParent(H) /= System.Null_Address loop
H := GetParent(H);
end loop;
-- Now dispatch it in the classic Windows fashion, using the
-- top-level window handle to ensure that dialog messages
-- (TAB and other navigation keys) are translated before
-- any other processing
if IsDialogMessage (H, M'Unchecked_Access) = 0 then
Bool_Dummy := TranslateMessage(M'Unchecked_Access);
Long_Dummy := DispatchMessage(M'Unchecked_Access);
end if;
end loop;
delay 0.001; -- to avoid hogging the CPU
end select;
end loop;
end loop;
exception
when E : others => -- task failure
Window_Info.Record_Error (E);
end Message_Loop;
----------------------------------------------------------------------------
--
-- C A L L B A C K F U N C T I O N S
--
-- These functions are called from the Windows message handler callbacks.
--
-- Enable (Window, Active): enable or disable the specified window
-- Resize (Window, unused): recalculate the size of the specified window
--
----------------------------------------------------------------------------
function Enable (Window : Win32_HWND;
Active : Win32_LPARAM) return Win32_BOOL;
pragma Convention(StdCall, Enable);
function Resize (Window : Win32_HWND;
unused : Win32_LPARAM) return Win32_BOOL;
pragma Convention(StdCall, Resize);
----------------------------------------------------------------------------
--
-- Enable Window to the opposite of its current state
--
function Enable (Window : Win32_HWND;
Active : Win32_LPARAM) return Win32_BOOL is
begin
if Window /= Window_Info.Active_Window then
Bool_Dummy := EnableWindow (Window, Boolean'Pos(Active=0));
end if;
return 1; -- continue with next window
end Enable;
----------------------------------------------------------------------------
--
-- Resize Window if necessary by reference to the size of its parent.
--
function Resize (Window : Win32_HWND; unused : Win32_LPARAM) return Win32_BOOL is
P : Window_Ptr;
T : Integer;
L : Integer;
W : Integer;
H : Integer;
B : Boolean;
X : Win32_LONG := GetWindowLong(Window,GWL_USERDATA);
begin
-- Not all windows will have been created by this library, but all that
-- haven't will have their user data (now in X) set to zero.
if X /= 0 then
-- X is really a Window_Ptr if we reach this point
P := To_Window_Ptr(X);
-- Copy the original (relative) coordinates
T := P.Top;
L := P.Left;
W := P.Width;
H := P.Height;
-- Convert them to absolute (parent-based) coordinates
Get_Actual_Bounds (GetParent(Window), T, L, W, H, B);
-- B will have been set true if any of T/L/W/H are relative coordinates
-- and T/L/W/H will have been set to absolute (parent-based) values, so
-- resize the window if necessary
if B then
Bool_Dummy := SetWindowPos(Window, System.Null_Address,
Win32_INT(L), Win32_INT(T),
Win32_INT(W), Win32_INT(H),
SWP_NOZORDER);
end if;
end if;
return 1; -- continue with next window
end Resize;
----------------------------------------------------------------------------
--
-- F R A M E _ P R O C
--
-- The Windows message handler callback for Frame_Type windows.
--
----------------------------------------------------------------------------
function Frame_Proc (hwnd : Win32_HWND;
msg : Win32_UINT;
wParam : Win32_WPARAM;
lParam : Win32_LPARAM) return Win32_LONG is
L : Win32_LONG := GetWindowLong(hwnd,GWL_USERDATA);
P : Main_Window_Ptr := Main_Window_Ptr(To_Window_Ptr(L));
H : Win32_HWND;
N : Natural;
begin
case msg is
-- Frame creation: a pointer to the Window_Internals is passed
-- in the CREATESTRUCT pointed to by lParam, so save this for
-- later use in the user data area of the Windows data structure
-- (retrieved into P, above, which will be zero until initialised).
when WM_CREATE =>
L := To_LONG(To_CREATESTRUCT(lParam).lpCreateParams);
Long_Dummy := SetWindowLong (hwnd, GWL_USERDATA, L);
-- Frame activation or deactivation: save or restore the focused
-- control for the next activation
when WM_ACTIVATE =>
if (wParam and 16#FFFF#) /= 0 then -- activation
H := SetFocus (P.Focus);
elsif GetFocus /= System.Null_Address then -- deactivation
P.Focus := GetFocus;
end if;
return 0; -- don't do anything else
-- Frame closing: issue the command for this frame
when WM_CLOSE =>
Window_Info.Set_Command (P.Action + WM_USER);
-- Frame being destroyed: decrement the frame count and clear the
-- window handle
when WM_DESTROY =>
Frames := Frames - 1;
-- Frame resized: resize all the child windows which have relative
-- sizes or positions
when WM_SIZE =>
Bool_Dummy := EnumChildWindows (hwnd, Resize'Access, 0);
-- An action has occurred (command code in low 16 bits of wParam);
-- issue a command code if it's in the appropriate range, or ignore
-- it if not
when WM_COMMAND =>
N := Natural(wParam and 16#FFFF#);
if N in WM_USER .. 16#7FFF# then
Window_Info.Set_Command (N);
return 0; -- don't do anything else
end if;
-- Ignore all other messages
when others =>
null;
end case;
-- Perform the default action for any messages that don't return before
-- this point
return DefWindowProc(hwnd, msg, wParam, lParam);
end Frame_Proc;
----------------------------------------------------------------------------
--
-- D I A L O G _ P R O C
--
-- The Windows message handler callback for Dialog_Type windows.
--
----------------------------------------------------------------------------
function Dialog_Proc (hwnd : Win32_HWND;
msg : Win32_UINT;
wParam : Win32_WPARAM;
lParam : Win32_LPARAM) return Win32_LONG is
P : Window_Ptr := To_Window_Ptr(GetWindowLong(hwnd,GWL_USERDATA));
H : Win32_HWND;
begin
case msg is
-- Dialog deactivation: don't do anything more so that the current
-- focused control isn't saved, and so the first control will get
-- the focus the next time the dialog is activated
when WM_ACTIVATE =>
if (wParam and 16#FFFF#) = 0 then
return 0; -- don't do anything else
end if;
-- Dialog being shown/hidden: disable/enable all the other windows
-- for this thread (i.e. this application), and set a new active
-- window if the dialog is being hidden
when WM_SHOWWINDOW =>
Bool_Dummy := EnumThreadWindows (GetCurrentThreadID,
Enable'Access,
Win32_LONG(wParam));
if wParam = 0 then
H := SetActiveWindow(GetWindow(P.Handle,GW_HWNDNEXT));
end if;
-- Dialog closing: don't close, just hide
when WM_CLOSE =>
Bool_Dummy := ShowWindow (hwnd, SW_HIDE);
Window_Info.Set_Command (P.Action + WM_USER);
return 0; -- don't do anything else
-- Ignore all other messages
when others =>
null;
end case;
-- If nothing else has happened yet, treat this the same way as a
-- Frame_Type top-level window
return Frame_Proc(hwnd, msg, wParam, lParam);
end Dialog_Proc;
----------------------------------------------------------------------------
--
-- C A N V A S _ P R O C
--
-- The Windows message handler callback for Canvas_Type windows.
--
----------------------------------------------------------------------------
function Canvas_Proc (hwnd : Win32_HWND;
msg : Win32_UINT;
wParam : Win32_WPARAM;
lParam : Win32_LPARAM) return Win32_LONG is
C : Canvas_Ptr := Canvas_Ptr(To_Window_Ptr(GetWindowLong(hwnd,GWL_USERDATA)));
H : Win32_HWND;
M : Win32_POINTS;
begin
case msg is
-- Canvas background being erased: get the client area rectangle and
-- fill it with the chosen background colour (from the canvas monitor)
when WM_ERASEBKGND =>
declare
R : aliased Win32_RECT;
I : Win32_INT;
begin
Bool_Dummy := GetClientRect(hwnd,R'Unchecked_Access);
I := FillRect (To_HDC(wParam), R'Unchecked_Access,
C.Monitor.Background);
end;
return 1; -- result of this message must be 1, not 0
-- Canvas being painted: ask the monitor to draw all the objects in the
-- drawing list
when WM_PAINT =>
C.Monitor.Draw (hwnd, C.Font);
-- Mouse button down (ignored if this canvas does not generate a
-- command): capture the mouse and ask the canvas monitor to record
-- the mouse position and button state, then issue the command
when WM_LBUTTONDOWN =>
if C.Action >= 0 then
H := SetCapture(hwnd);
M := MakePoint (lParam);
C.Monitor.Set_Start (Integer(M.X), Integer(M.Y));
C.Monitor.Set_Button (True);
Window_Info.Set_Command (C.Action + WM_USER);
return 0; -- don't do anything else
end if;
-- Mouse button up (ignored if this canvas does not generate a
-- a command): release the mouse and ask the canvas monitor to
-- record the current position and button state
when WM_LBUTTONUP =>
if C.Action >= 0 then
Bool_Dummy := ReleaseCapture;
M := MakePoint (lParam);
C.Monitor.Set_End (Integer(M.X), Integer(M.Y));
C.Monitor.Set_Button (False);
return 0; -- don't do anything else
end if;
-- Mouse has moved (ignored if this canvas does not generate
-- a command or the mouse button isn't down): ask the canvas
-- monitor to record the current mouse position
when WM_MOUSEMOVE =>
if C.Action >= 0 and C.Monitor.Mouse_Down then
M := MakePoint (lParam);
C.Monitor.Set_End (Integer(M.X), Integer(M.Y));
return 0; -- don't do anything else
end if;
-- Key pressed (ignored if this canvas does not generate a keypress
-- command): capture the mouse and ask the canvas monitor to record
-- the mouse position and button state, then issue the command
when WM_CHAR =>
if C.Keypress >= 0 then
C.Monitor.Set_Key (Character'Val(wParam and 16#FF#));
Window_Info.Set_Command (C.Keypress + WM_USER);
return 0; -- don't do anything else
end if;
-- Because messages are processed by IsDialogMessage, WM_CHAR messages
-- won't be seen unless they are asked for in response to WM_GETDLCODE
when WM_GETDLGCODE =>
return DLGC_WANTMESSAGE; -- request WM_CHAR for all keyboard input
-- Ignore all other messages
when others =>
null;
end case;
-- Perform the default action for any messages that don't return before
-- this point
return DefWindowProc(hwnd, msg, wParam, lParam);
end Canvas_Proc;
----------------------------------------------------------------------------
--
-- P A N E L _ P R O C
--
-- The Windows message handler callback for Panel_Type windows. Command
-- messages are sent to the parent window, all others are processed in
-- the normal way.
--
----------------------------------------------------------------------------
function Panel_Proc (hwnd : Win32_HWND;
msg : Win32_UINT;
wParam : Win32_WPARAM;
lParam : Win32_LPARAM) return Win32_LONG is
W : Window_Ptr := To_Window_Ptr(GetWindowLong(hwnd,GWL_USERDATA));
begin
case msg is
when WM_COMMAND =>
Long_Dummy := SendMessage (GetParent(hwnd), msg, wParam, lParam);
when others =>
null;
end case;
return CallWindowProc (W.WndProc, hwnd, msg, wParam, lParam);
end Panel_Proc;
----------------------------------------------------------------------------
--
-- M E M O _ P R O C
--
-- The Windows message handler callback for Memo_Type windows. Tab keys
-- cause a tab to be inserted, all other messages are processed in the
-- normal way.
--
----------------------------------------------------------------------------
function Memo_Proc (hwnd : Win32_HWND;
msg : Win32_UINT;
wParam : Win32_WPARAM;
lParam : Win32_LPARAM) return Win32_LONG is
W : Window_Ptr := To_Window_Ptr(GetWindowLong(hwnd,GWL_USERDATA));
S : aliased Win32_String := To_Array (ASCII.HT & ASCII.NUL);
begin
case msg is
when WM_KEYDOWN =>
if wParam = Character'Pos(ASCII.HT) then
Long_Dummy := SendMessage (hwnd, EM_REPLACESEL, 1, To_LPARAM(S));
end if;
when others =>
null;
end case;
return CallWindowProc (W.WndProc, hwnd, msg, wParam, lParam);
end Memo_Proc;
end JEWL.Message_Handling;
|
with
Gtk.Widget;
package aIDE.Style
is
procedure define;
procedure apply_CSS (Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class);
end aIDE.Style;
|
with Ada.Exception_Identification.From_Here;
with Ada.Exceptions.Finally;
with System.Formatting;
with System.UTF_Conversions;
package body Ada.Text_IO.Formatting is
use Exception_Identification.From_Here;
use type System.Long_Long_Integer_Types.Word_Integer;
use type System.Long_Long_Integer_Types.Word_Unsigned;
use type System.Long_Long_Integer_Types.Long_Long_Unsigned;
subtype Word_Integer is System.Long_Long_Integer_Types.Word_Integer;
subtype Word_Unsigned is System.Long_Long_Integer_Types.Word_Unsigned;
subtype Long_Long_Unsigned is
System.Long_Long_Integer_Types.Long_Long_Unsigned;
procedure Skip_Spaces (
File : File_Type); -- Input_File_Type
procedure Skip_Spaces (
File : File_Type)
is
Item : Character;
End_Of_Line : Boolean;
begin
loop
Look_Ahead (File, Item, End_Of_Line); -- checking the predicate
exit when not End_Of_Line
and then Item /= ' '
and then Item /= Character'Val (9);
Skip_Ahead (File);
end loop;
end Skip_Spaces;
procedure Adjust (
File : File_Type; -- Output_File_Type
Width : Field);
procedure Adjust (
File : File_Type;
Width : Field)
is
Line : constant Count := Line_Length (File); -- checking the predicate
begin
if Line > 0 then
if Count (Width) > Line then
Raise_Exception (Layout_Error'Identity);
elsif Col (File) + Count (Width) - 1 > Line then
New_Line (File);
end if;
end if;
end Adjust;
procedure Add (
Buffer : in out String_Access;
Last : in out Natural;
Item : Character);
procedure Add (
Buffer : in out String_Access;
Last : in out Natural;
Item : Character) is
begin
Last := Last + 1;
if Last > Buffer'Last then
Reallocate (Buffer, 1, String_Grow (Buffer'Last)); -- Buffer'First = 1
end if;
Buffer (Last) := Item;
end Add;
procedure Get_Num (
File : File_Type; -- Input_File_Type
Buffer : in out String_Access;
Last : in out Natural;
Based : Boolean);
procedure Get_Num (
File : File_Type;
Buffer : in out String_Access;
Last : in out Natural;
Based : Boolean)
is
Start : constant Natural := Last;
Item : Character;
End_Of_Line : Boolean;
begin
Look_Ahead (File, Item, End_Of_Line); -- checking the predicate
loop
if Item = '_' then
exit when Last = Start;
Add (Buffer, Last, Item);
Skip_Ahead (File);
Look_Ahead (File, Item, End_Of_Line);
end if;
exit when Item not in '0' .. '9'
and then (
not Based
or else (
Item not in 'A' .. 'F' and then Item not in 'a' .. 'f'));
Add (Buffer, Last, Item);
Skip_Ahead (File);
Look_Ahead (File, Item, End_Of_Line);
end loop;
end Get_Num;
procedure Get_Numeric_Literal_To_Buffer (
File : File_Type; -- Input_File_Type
Buffer : in out String_Access;
Last : in out Natural;
Real : Boolean);
procedure Get_Numeric_Literal_To_Buffer (
File : File_Type; -- Input_File_Type
Buffer : in out String_Access;
Last : in out Natural;
Real : Boolean)
is
Prev_Last : Natural;
Mark : Character;
Item : Character;
End_Of_Line : Boolean;
begin
Look_Ahead (File, Item, End_Of_Line);
if Item = '+' or else Item = '-' then
Add (Buffer, Last, Item);
Skip_Ahead (File);
Look_Ahead (File, Item, End_Of_Line);
end if;
Prev_Last := Last;
Get_Num (File, Buffer, Last, Based => False);
if Last > Prev_Last then
Look_Ahead (File, Item, End_Of_Line);
if Item = '#' or else Item = ':' then
Mark := Item;
Add (Buffer, Last, Item);
Skip_Ahead (File);
Get_Num (File, Buffer, Last, Based => True);
Look_Ahead (File, Item, End_Of_Line);
if Item = '.' and then Real then
Add (Buffer, Last, Item);
Skip_Ahead (File);
Get_Num (File, Buffer, Last, Based => False);
Look_Ahead (File, Item, End_Of_Line);
end if;
if Item = Mark then
Add (Buffer, Last, Item);
Skip_Ahead (File);
Look_Ahead (File, Item, End_Of_Line);
end if;
elsif Item = '.' and then Real then
Add (Buffer, Last, Item);
Skip_Ahead (File);
Get_Num (File, Buffer, Last, Based => False);
Look_Ahead (File, Item, End_Of_Line);
end if;
if Item = 'E' or else Item = 'e' then
Add (Buffer, Last, Item);
Skip_Ahead (File);
Look_Ahead (File, Item, End_Of_Line);
if Item = '+' or else Item = '-' then
Add (Buffer, Last, Item);
Skip_Ahead (File);
Look_Ahead (File, Item, End_Of_Line);
end if;
Get_Num (File, Buffer, Last, Based => False);
end if;
end if;
end Get_Numeric_Literal_To_Buffer;
-- implementation
procedure Integer_Image (
To : out String;
Last : out Natural;
Item : System.Long_Long_Integer_Types.Word_Integer;
Base : Number_Base)
is
Unsigned_Item : Word_Unsigned;
begin
Last := To'First - 1;
if Item < 0 then
Last := Last + 1;
To (Last) := '-';
Unsigned_Item := -Word_Unsigned'Mod (Item);
else
Unsigned_Item := Word_Unsigned (Item);
end if;
Modular_Image (To (Last + 1 .. To'Last), Last, Unsigned_Item, Base);
end Integer_Image;
procedure Integer_Image (
To : out String;
Last : out Natural;
Item : Long_Long_Integer;
Base : Number_Base) is
begin
if Standard'Word_Size < Long_Long_Unsigned'Size then
-- optimized for 32bit
declare
Unsigned_Item : Long_Long_Unsigned;
begin
Last := To'First - 1;
if Item < 0 then
Last := Last + 1;
To (Last) := '-';
Unsigned_Item := -Long_Long_Unsigned'Mod (Item);
else
Unsigned_Item := Long_Long_Unsigned (Item);
end if;
Modular_Image (
To (Last + 1 .. To'Last),
Last,
Unsigned_Item,
Base);
end;
else
-- optimized for 64bit
Integer_Image (To, Last, Word_Integer (Item), Base);
end if;
end Integer_Image;
procedure Modular_Image (
To : out String;
Last : out Natural;
Item : System.Long_Long_Integer_Types.Word_Unsigned;
Base : Number_Base)
is
Error : Boolean;
begin
Last := To'First - 1;
if Base /= 10 then
System.Formatting.Image (
Word_Unsigned (Base),
To (Last + 1 .. To'Last),
Last,
Error => Error);
if Error then
Raise_Exception (Layout_Error'Identity);
end if;
Last := Last + 1;
if Last > To'Last then
Raise_Exception (Layout_Error'Identity);
end if;
To (Last) := '#';
end if;
System.Formatting.Image (
Item,
To (Last + 1 .. To'Last),
Last,
Base => Base,
Error => Error);
if Error then
Raise_Exception (Layout_Error'Identity);
end if;
if Base /= 10 then
Last := Last + 1;
if Last > To'Last then
Raise_Exception (Layout_Error'Identity);
end if;
To (Last) := '#';
end if;
end Modular_Image;
procedure Modular_Image (
To : out String;
Last : out Natural;
Item : System.Long_Long_Integer_Types.Long_Long_Unsigned;
Base : Number_Base) is
begin
if Standard'Word_Size < Long_Long_Unsigned'Size then
-- optimized for 32bit
declare
Error : Boolean;
begin
Last := To'First - 1;
if Base /= 10 then
System.Formatting.Image (
Word_Unsigned (Base),
To (Last + 1 .. To'Last),
Last,
Error => Error);
if Error then
Raise_Exception (Layout_Error'Identity);
end if;
Last := Last + 1;
if Last > To'Last then
Raise_Exception (Layout_Error'Identity);
end if;
To (Last) := '#';
end if;
System.Formatting.Image (
Item,
To (Last + 1 .. To'Last),
Last,
Base => Base,
Error => Error);
if Error then
Raise_Exception (Layout_Error'Identity);
end if;
if Base /= 10 then
Last := Last + 1;
if Last > To'Last then
Raise_Exception (Layout_Error'Identity);
end if;
To (Last) := '#';
end if;
end;
else
-- optimized for 64bit
Modular_Image (To, Last, Word_Unsigned (Item), Base);
end if;
end Modular_Image;
function Get_Numeric_Literal (
File : File_Type;
Real : Boolean)
return String is
begin
Skip_Spaces (File); -- checking the predicate
declare
Buffer : aliased String_Access := new String (1 .. 256);
Last : Natural := 0;
package Holder is
new Exceptions.Finally.Scoped_Holder (String_Access, Free);
begin
Holder.Assign (Buffer);
Get_Numeric_Literal_To_Buffer (File, Buffer, Last, Real => Real);
return Buffer (1 .. Last);
end;
end Get_Numeric_Literal;
function Get_Complex_Literal (
File : File_Type)
return String is
begin
Skip_Spaces (File); -- checking the predicate
declare
Buffer : aliased String_Access := new String (1 .. 256);
Last : Natural := 0;
package Holder is
new Exceptions.Finally.Scoped_Holder (String_Access, Free);
begin
Holder.Assign (Buffer);
declare
Item : Character;
End_Of_Line : Boolean;
Paren : Boolean;
begin
Look_Ahead (File, Item, End_Of_Line);
Paren := Item = '(';
if Paren then
Add (Buffer, Last, Item);
Skip_Ahead (File);
Skip_Spaces (File);
end if;
Get_Numeric_Literal_To_Buffer (File, Buffer, Last, Real => True);
Skip_Spaces (File);
Look_Ahead (File, Item, End_Of_Line);
if Item = ',' then
Add (Buffer, Last, Item);
Skip_Ahead (File);
Skip_Spaces (File);
else
Add (Buffer, Last, ' ');
end if;
Get_Numeric_Literal_To_Buffer (File, Buffer, Last, Real => True);
if Paren then
Skip_Spaces (File);
Look_Ahead (File, Item, End_Of_Line);
if Item = ')' then
Add (Buffer, Last, Item);
Skip_Ahead (File);
else
Raise_Exception (Data_Error'Identity);
end if;
end if;
end;
return Buffer (1 .. Last);
end;
end Get_Complex_Literal;
function Get_Enum_Literal (
File : File_Type)
return String is
begin
Skip_Spaces (File); -- checking the predicate
declare
Buffer : aliased String_Access := new String (1 .. 256);
Last : Natural := 0;
package Holder is
new Exceptions.Finally.Scoped_Holder (String_Access, Free);
begin
Holder.Assign (Buffer);
declare
Item : Character;
End_Of_Line : Boolean;
begin
Look_Ahead (File, Item, End_Of_Line);
if Item = ''' then
Add (Buffer, Last, Item);
Skip_Ahead (File);
Look_Ahead (File, Item, End_Of_Line);
if not End_Of_Line then
declare
Length : Natural;
Sequence_Status :
System.UTF_Conversions.Sequence_Status_Type; -- ignore
begin
System.UTF_Conversions.UTF_8_Sequence (
Item,
Length,
Sequence_Status);
Add (Buffer, Last, Item);
Skip_Ahead (File);
for I in 2 .. Length loop
Look_Ahead (File, Item, End_Of_Line);
exit when End_Of_Line;
Add (Buffer, Last, Item);
Skip_Ahead (File);
end loop;
end;
Look_Ahead (File, Item, End_Of_Line);
if Item = ''' then
Add (Buffer, Last, Item);
Skip_Ahead (File);
end if;
end if;
elsif Item in 'A' .. 'Z'
or else Item in 'a' .. 'z'
or else Item >= Character'Val (16#80#)
then
while not End_Of_Line
and then Item /= ' '
and then Item /= Character'Val (9)
loop
if Item = '_' then
Add (Buffer, Last, Item);
Skip_Ahead (File);
Look_Ahead (File, Item, End_Of_Line);
end if;
exit when not (
Item in 'A' .. 'Z'
or else Item in 'a' .. 'z'
or else Item in '0' .. '9'
or else Item >= Character'Val (16#80#));
Add (Buffer, Last, Item);
Skip_Ahead (File);
Look_Ahead (File, Item, End_Of_Line);
end loop;
end if;
end;
return Buffer (1 .. Last);
end;
end Get_Enum_Literal;
procedure Get_Field (
File : File_Type;
Item : out String;
Last : out Natural)
is
pragma Check (Dynamic_Predicate,
Check => Is_Open (File) or else raise Status_Error);
pragma Check (Dynamic_Predicate,
Check => Mode (File) = In_File or else raise Mode_Error);
Has_Data : Boolean := False;
End_Of_Line : Boolean;
begin
Last := Item'First - 1;
for I in Item'Range loop
Look_Ahead (File, Item (I), End_Of_Line);
exit when End_Of_Line;
Skip_Ahead (File);
if Item (I) = Character'Val (9) then
Item (I) := ' '; -- treat tab as space, RM A.10.6(5/2)
elsif Item (I) /= ' ' then
Has_Data := True;
end if;
Last := I;
end loop;
if not Has_Data then
if End_Of_File (File) then
Raise_Exception (End_Error'Identity);
else
Raise_Exception (Data_Error'Identity);
end if;
end if;
end Get_Field;
procedure Head (
File : File_Type;
Item : String;
Width : Field) is
begin
Adjust (File, Field'Max (Width, Item'Last)); -- checking the predicate
Put (File, Item);
for I in Item'Length + 1 .. Width loop
Put (File, ' ');
end loop;
end Head;
procedure Tail (
File : File_Type;
Item : String;
Width : Field) is
begin
Adjust (File, Field'Max (Width, Item'Last)); -- checking the predicate
for I in Item'Length + 1 .. Width loop
Put (File, ' ');
end loop;
Put (File, Item);
end Tail;
procedure Get_Head (
Item : String;
First : out Positive;
Last : out Natural) is
begin
Get_Tail (Item, First); -- skip first spaces
Last := First;
while Last < Item'Last
and then Item (Last + 1) /= ' '
and then Item (Last + 1) /= Character'Val (9)
loop
Last := Last + 1;
end loop;
end Get_Head;
procedure Get_Tail (Item : String; First : out Positive) is
begin
First := Item'First;
loop
if First > Item'Last then
Raise_Exception (End_Error'Identity);
end if;
exit when Item (First) /= ' '
and then Item (First) /= Character'Val (9);
First := First + 1;
end loop;
end Get_Tail;
procedure Head (Target : out String; Source : String) is
Source_Length : constant Natural := Source'Length;
begin
if Target'Length < Source_Length then
Raise_Exception (Layout_Error'Identity);
end if;
Target (Target'First .. Target'First + Source_Length - 1) := Source;
System.Formatting.Fill_Padding (
Target (Target'First + Source_Length .. Target'Last),
' ');
end Head;
procedure Tail (Target : out String; Source : String) is
Source_Length : constant Natural := Source'Length;
begin
if Target'Length < Source_Length then
Raise_Exception (Layout_Error'Identity);
end if;
Target (Target'Last - Source_Length + 1 .. Target'Last) := Source;
System.Formatting.Fill_Padding (
Target (Target'First .. Target'Last - Source_Length),
' ');
end Tail;
procedure Tail (Target : out Wide_String; Source : Wide_String) is
Source_Length : constant Natural := Source'Length;
begin
if Target'Length < Source_Length then
Raise_Exception (Layout_Error'Identity);
end if;
for I in Target'First .. Target'Last - Source_Length loop
Target (I) := ' ';
end loop;
Target (Target'Last - Source_Length + 1 .. Target'Last) := Source;
end Tail;
procedure Tail (Target : out Wide_Wide_String; Source : Wide_Wide_String) is
Source_Length : constant Natural := Source'Length;
begin
if Target'Length < Source_Length then
Raise_Exception (Layout_Error'Identity);
end if;
for I in Target'First .. Target'Last - Source_Length loop
Target (I) := ' ';
end loop;
Target (Target'Last - Source_Length + 1 .. Target'Last) := Source;
end Tail;
end Ada.Text_IO.Formatting;
|
-- 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.
with Ada.Text_IO;
with EGL.Objects.Displays;
with EGL.Objects.Devices;
with EGL.Errors;
procedure Orka_EGL_Info is
use Ada.Text_IO;
Devices : constant EGL.Objects.Devices.Device_List := EGL.Objects.Devices.Devices;
begin
Put_Line ("Client extensions:");
for Extension of EGL.Objects.Displays.Client_Extensions loop
Put_Line (" " & EGL.SU.To_String (Extension));
end loop;
Put_Line ("");
Put_Line ("Platforms:");
for Platform in EGL.Objects.Displays.Platform_Kind'Range loop
Put_Line ("");
begin
declare
Display : constant EGL.Objects.Displays.Display :=
EGL.Objects.Displays.Create_Display (Platform);
begin
Put_Line (Display.Platform'Image & ":");
Put_Line (" vendor: " & Display.Vendor);
Put_Line (" version: " & Display.Version);
Put_Line (" extensions:");
for Extension of Display.Extensions loop
Put_Line (" " & EGL.SU.To_String (Extension));
end loop;
end;
exception
when EGL.Errors.Not_Initialized_Error =>
Put_Line (Platform'Image & ": not supported");
when EGL.Errors.Invalid_Value_Error =>
Put_Line (Platform'Image & ": creating display failed");
end;
end loop;
Put_Line ("");
Put_Line ("Devices:");
for Device of Devices loop
Put_Line ("");
declare
Name : constant String := Device.Name;
begin
Put_Line (if Name /= "" then Device.Name else "unknown");
end;
Put_Line (" extensions:");
for Extension of Device.Extensions loop
Put_Line (" " & EGL.SU.To_String (Extension));
end loop;
end loop;
end Orka_EGL_Info;
|
with Ada.Real_Time; use Ada.Real_Time;
with System; use System;
package pulse_interrupt is
---------------------------------------------------------------------
------ declaracion de procedimientos de acceso a DISPOSITIVOS E/S --
---------------------------------------------------------------------
Interr_1: constant Time_Span := To_Time_Span (0.5);
Interr_2: constant Time_Span := To_Time_Span (0.5);
Interr_3: constant Time_Span := To_Time_Span (0.7);
Interr_4: constant Time_Span := To_Time_Span (0.9);
Interr_5: constant Time_Span := To_Time_Span (0.9);
Interr_6: constant Time_Span := To_Time_Span (0.8);
Interr_7: constant Time_Span := To_Time_Span (0.7);
Interr_8: constant Time_Span := To_Time_Span (0.7);
Interr_9: constant Time_Span := To_Time_Span (0.6);
Interr_10: constant Time_Span := To_Time_Span (0.6);
--------------------------------------------------------------------------
-- Tarea que fuerza la interrupcion externa 2 en los instantes indicados --
--------------------------------------------------------------------------
Priority_Of_External_Interrupts_2 : constant System.Interrupt_Priority
:= System.Interrupt_Priority'First + 9;
task Interrupt is
pragma Priority (Priority_Of_External_Interrupts_2);
end Interrupt;
end pulse_interrupt;
|
with System.Long_Long_Elementary_Functions;
with System.Long_Long_Integer_Types;
package body Ada.Numerics.Distributions is
use type System.Long_Long_Integer_Types.Long_Long_Unsigned;
subtype Long_Long_Unsigned is
System.Long_Long_Integer_Types.Long_Long_Unsigned;
function popcountll (x : Long_Long_Unsigned) return Integer
with Import,
Convention => Intrinsic, External_Name => "__builtin_popcountll";
-- Simple distributions
function Linear_Discrete (X : Source) return Target is
Source_W : constant Long_Long_Unsigned :=
Source'Pos (Source'Last) - Source'Pos (Source'First);
Target_W : constant Long_Long_Unsigned :=
Target'Pos (Target'Last) - Target'Pos (Target'First);
begin
if Source_W = 0 or else Target_W = 0 then
-- 0 bit value
return Target'First;
elsif Source_W = Target_W then
-- 1:1 mapping
return Target'Val (
Long_Long_Unsigned (X) + Target'Pos (Target'First));
elsif Long_Long_Unsigned'Max (Source_W, Target_W) <
Long_Long_Unsigned'Last
and then (Source_W + 1) * (Target_W + 1) >= Source_W
and then (Source_W + 1) * (Target_W + 1) >= Target_W
then
-- no overflow
return Target'Val (
Long_Long_Unsigned (X) * (Target_W + 1) / (Source_W + 1)
+ Target'Pos (Target'First));
else
-- use Long_Long_Float
declare
function To_Float is
new Linear_Float_0_To_Less_Than_1 (
Source,
Long_Long_Float);
begin
return Target'Val (
Long_Long_Unsigned (
Long_Long_Float'Floor (
To_Float (X) * (Long_Long_Float (Target_W) + 1.0)))
+ Target'Pos (Target'First));
end;
end if;
end Linear_Discrete;
function Linear_Float_0_To_1 (X : Source) return Target'Base is
begin
return Target'Base (X) * Target'Base (1.0 / (Source'Modulus - 1));
end Linear_Float_0_To_1;
function Linear_Float_0_To_Less_Than_1 (X : Source) return Target'Base is
begin
return Target'Base (X) * Target'Base (1.0 / Source'Modulus);
end Linear_Float_0_To_Less_Than_1;
function Linear_Float_Greater_Than_0_To_Less_Than_1 (X : Source)
return Target'Base is
begin
return (Target'Base (X) + 0.5) * Target'Base (1.0 / Source'Modulus);
end Linear_Float_Greater_Than_0_To_Less_Than_1;
function Exponentially_Float (X : Source) return Target'Base is
subtype Float_Type is Target;
function Fast_Log (X : Float_Type'Base) return Float_Type'Base;
function Fast_Log (X : Float_Type'Base) return Float_Type'Base is
begin
if Float_Type'Digits <= Float'Digits then
declare
function logf (A1 : Float) return Float
with Import,
Convention => Intrinsic,
External_Name => "__builtin_logf";
begin
return Float_Type'Base (logf (Float (X)));
end;
elsif Float_Type'Digits <= Long_Float'Digits then
declare
function log (A1 : Long_Float) return Long_Float
with Import,
Convention => Intrinsic, External_Name => "__builtin_log";
begin
return Float_Type'Base (log (Long_Float (X)));
end;
else
return Float_Type'Base (
System.Long_Long_Elementary_Functions.Fast_Log (
Long_Long_Float (X)));
end if;
end Fast_Log;
function Float_0_To_Less_Than_1 is
new Linear_Float_0_To_Less_Than_1 (Source, Target'Base);
Y : constant Target'Base := Float_0_To_Less_Than_1 (X); -- [0,1)
Z : constant Target'Base := 1.0 - Y; -- (0,1]
begin
return -Fast_Log (Z);
end Exponentially_Float;
-- Simple distributions for random number
function Linear_Discrete_Random (Gen : aliased in out Generator)
return Target is
begin
if Target'First > Target'Last then
raise Constraint_Error;
end if;
declare
function To_Target is new Linear_Discrete (Source, Target);
begin
return To_Target (Get (Gen));
end;
end Linear_Discrete_Random;
-- Strict uniform distributions for random number
function Uniform_Discrete_Random (Gen : aliased in out Generator)
return Target is
begin
if Target'First > Target'Last then
raise Constraint_Error;
end if;
declare
Source_W : constant Long_Long_Unsigned :=
Source'Pos (Source'Last) - Source'Pos (Source'First);
Target_W : constant Long_Long_Unsigned :=
Target'Pos (Target'Last) - Target'Pos (Target'First);
begin
if Source_W = 0 or else Target_W = 0 then
-- 0 bit value
return Target'First;
elsif Source_W = Target_W then
-- 1:1 mapping
declare
X : constant Long_Long_Unsigned :=
Long_Long_Unsigned (Get (Gen));
begin
return Target'Val (X + Target'Pos (Target'First));
end;
elsif Source_W > Target_W
and then (
Source_W = Long_Long_Unsigned'Last
or else popcountll (Source_W + 1) = 1)
and then popcountll (Target_W + 1) = 1
then
-- narrow, and 2 ** n
declare
X : constant Long_Long_Unsigned :=
Long_Long_Unsigned (Get (Gen));
begin
return Target'Val (
X / (Source_W / (Target_W + 1) + 1)
+ Target'Pos (Target'First));
end;
else
loop
declare
Max : Long_Long_Unsigned;
X : Long_Long_Unsigned;
begin
if Source_W > Target_W then
-- narrow
Max := Source_W;
X := Long_Long_Unsigned (Get (Gen));
else
-- wide
Max := 0;
X := 0;
loop
declare
Old_Max : constant Long_Long_Unsigned := Max;
begin
Max := (Max * (Source_W + 1)) + Source_W;
X := (X * (Source_W + 1))
+ Long_Long_Unsigned (Get (Gen));
exit when Max >= Target_W
or else Max <= Old_Max; -- overflow
end;
end loop;
end if;
if Target_W = Long_Long_Unsigned'Last then
-- Source'Range_Length <
-- Target'Range_Length =
-- Long_Long_Unsigned'Range_Length
return Target'Val (X + Target'Pos (Target'First));
else
declare
-- (Max + 1) mod (Target_W + 1)
R : constant Long_Long_Unsigned :=
(Max mod (Target_W + 1) + 1) mod (Target_W + 1);
begin
-- (Max - R + 1) mod (Target_W + 1) = 0
if R = 0 or else X <= Max - R then
return Target'Val (
X mod (Target_W + 1)
+ Target'Pos (Target'First));
end if;
end;
end if;
end;
end loop;
end if;
end;
end Uniform_Discrete_Random;
function Uniform_Float_Random_0_To_1 (Gen : aliased in out Generator)
return Target is
begin
if Target'Machine_Mantissa <= 24 then -- Float'Machine_Mantissa
declare
type Unsigned_24_plus_1 is range 0 .. 2 ** 24;
function Unsigned_24_plus_1_Random is
new Uniform_Discrete_Random (
Source,
Unsigned_24_plus_1,
Generator,
Get);
X : constant Unsigned_24_plus_1 := Unsigned_24_plus_1_Random (Gen);
begin
return Target'Base (X) * Target'Base (1.0 / 2 ** 24);
end;
elsif Target'Machine_Mantissa <= 53 then -- Long_Float'Machine_Mantissa
declare
type Unsigned_53_plus_1 is range 0 .. 2 ** 53;
function Unsigned_53_plus_1_Random is
new Uniform_Discrete_Random (
Source,
Unsigned_53_plus_1,
Generator,
Get);
X : constant Unsigned_53_plus_1 := Unsigned_53_plus_1_Random (Gen);
begin
return Target'Base (X) * Target'Base (1.0 / 2 ** 53);
end;
else
declare
type Unsigned_1 is mod 2; -- high 1 bit
type Unsigned_64 is mod 2 ** 64; -- low bits
function Unsigned_1_Random is
new Uniform_Discrete_Random (
Source,
Unsigned_1,
Generator,
Get);
function Unsigned_64_Random is
new Uniform_Discrete_Random (
Source,
Unsigned_64,
Generator,
Get);
begin
loop
declare
X : constant Unsigned_64 := Unsigned_64_Random (Gen);
begin
if Unsigned_1_Random (Gen) = 1 then
if X = 0 then -- a 128 bit random value = 2 ** 64
return 1.0;
end if;
else
return Target'Base (X) * Target'Base (1.0 / 2 ** 64);
end if;
end;
end loop;
end;
end if;
end Uniform_Float_Random_0_To_1;
function Uniform_Float_Random_0_To_Less_Than_1 (
Gen : aliased in out Generator)
return Target is
begin
if Target'Machine_Mantissa <= 24 then -- Float'Machine_Mantissa
declare
type Unsigned_24 is mod 2 ** 24;
function Unsigned_24_Random is
new Uniform_Discrete_Random (
Source,
Unsigned_24,
Generator,
Get);
function Float_0_To_Less_Than_1 is
new Linear_Float_0_To_Less_Than_1 (Unsigned_24, Target);
begin
return Float_0_To_Less_Than_1 (Unsigned_24_Random (Gen));
end;
elsif Target'Machine_Mantissa <= 53 then -- Long_Float'Machine_Mantissa
declare
type Unsigned_53 is mod 2 ** 53;
function Unsigned_53_Random is
new Uniform_Discrete_Random (
Source,
Unsigned_53,
Generator,
Get);
function Float_0_To_Less_Than_1 is
new Linear_Float_0_To_Less_Than_1 (Unsigned_53, Target);
begin
return Float_0_To_Less_Than_1 (Unsigned_53_Random (Gen));
end;
else
declare
type Unsigned_64 is mod 2 ** 64;
function Unsigned_64_Random is
new Uniform_Discrete_Random (
Source,
Unsigned_64,
Generator,
Get);
function Float_0_To_Less_Than_1 is
new Linear_Float_0_To_Less_Than_1 (Unsigned_64, Target);
begin
return Float_0_To_Less_Than_1 (Unsigned_64_Random (Gen));
end;
end if;
end Uniform_Float_Random_0_To_Less_Than_1;
function Uniform_Float_Random_Greater_Than_0_To_Less_Than_1 (
Gen : aliased in out Generator)
return Target is
begin
if Target'Machine_Mantissa <= 24 then -- Float'Machine_Mantissa
declare
type Unsigned_24 is mod 2 ** 24;
subtype Repr is Unsigned_24 range 1 .. Unsigned_24'Last;
function Unsigned_24_Random is
new Uniform_Discrete_Random (Source, Repr, Generator, Get);
function Float_0_To_Less_Than_1 is
new Linear_Float_0_To_Less_Than_1 (Unsigned_24, Target);
begin
return Float_0_To_Less_Than_1 (Unsigned_24_Random (Gen));
end;
elsif Target'Machine_Mantissa <= 53 then -- Long_Float'Machine_Mantissa
declare
type Unsigned_53 is mod 2 ** 53;
subtype Repr is Unsigned_53 range 1 .. Unsigned_53'Last;
function Unsigned_53_Random is
new Uniform_Discrete_Random (Source, Repr, Generator, Get);
function Float_0_To_Less_Than_1 is
new Linear_Float_0_To_Less_Than_1 (Unsigned_53, Target);
begin
return Float_0_To_Less_Than_1 (Unsigned_53_Random (Gen));
end;
else
declare
type Unsigned_64 is mod 2 ** 64;
subtype Repr is Unsigned_64 range 1 .. Unsigned_64'Last;
function Unsigned_64_Random is
new Uniform_Discrete_Random (Source, Repr, Generator, Get);
function Float_0_To_Less_Than_1 is
new Linear_Float_0_To_Less_Than_1 (Unsigned_64, Target);
begin
return Float_0_To_Less_Than_1 (Unsigned_64_Random (Gen));
end;
end if;
end Uniform_Float_Random_Greater_Than_0_To_Less_Than_1;
end Ada.Numerics.Distributions;
|
-----------------------------------------------------------------------
-- ADO Statements -- Database statements
-- Copyright (C) 2009, 2010, 2011, 2012, 2013, 2015, 2018, 2019 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Calendar.Formatting;
with Util.Log;
with Util.Log.Loggers;
with System.Storage_Elements;
with Ada.Unchecked_Deallocation;
package body ADO.Statements is
use System.Storage_Elements;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("ADO.Statements");
function Get_Query (Query : Statement) return ADO.SQL.Query_Access is
begin
return Query.Query;
end Get_Query;
procedure Add_Parameter (Query : in out Statement;
Param : in ADO.Parameters.Parameter) is
begin
Query.Query.Add_Parameter (Param);
end Add_Parameter;
procedure Set_Parameters (Query : in out Statement;
From : in ADO.Parameters.Abstract_List'Class) is
begin
Query.Query.Set_Parameters (From);
end Set_Parameters;
-- ------------------------------
-- Return the number of parameters in the list.
-- ------------------------------
function Length (Query : in Statement) return Natural is
begin
return Query.Query.Length;
end Length;
-- ------------------------------
-- Return the parameter at the given position
-- ------------------------------
function Element (Query : in Statement;
Position : in Natural) return ADO.Parameters.Parameter is
begin
return Query.Query.Element (Position);
end Element;
-- ------------------------------
-- Execute the <b>Process</b> procedure with the given parameter as argument.
-- ------------------------------
procedure Query_Element (Query : in Statement;
Position : in Natural;
Process : not null access
procedure (Element : in ADO.Parameters.Parameter)) is
begin
Query.Query.Query_Element (Position, Process);
end Query_Element;
-- ------------------------------
-- Clear the list of parameters.
-- ------------------------------
procedure Clear (Query : in out Statement) is
begin
Query.Query.Clear;
end Clear;
procedure Add_Param (Params : in out Statement;
Value : in ADO.Objects.Object_Key) is
begin
case Value.Of_Type is
when ADO.Objects.KEY_INTEGER =>
declare
V : constant Identifier := Objects.Get_Value (Value);
begin
Params.Query.Add_Param (V);
end;
when ADO.Objects.KEY_STRING =>
declare
V : constant Unbounded_String := Objects.Get_Value (Value);
begin
Params.Query.Add_Param (V);
end;
end case;
end Add_Param;
-- ------------------------------
-- Add the parameter by using the primary key of the object.
-- Use null if the object is a null reference.
-- ------------------------------
procedure Add_Param (Params : in out Statement;
Value : in ADO.Objects.Object_Ref'Class) is
begin
if Value.Is_Null then
Params.Query.Add_Null_Param;
else
Params.Add_Param (Value.Get_Key);
end if;
end Add_Param;
procedure Append (Query : in out Statement; SQL : in String) is
begin
ADO.SQL.Append (Target => Query.Query.SQL, SQL => SQL);
end Append;
procedure Append (Query : in out Statement; Value : in Integer) is
begin
ADO.SQL.Append_Value (Target => Query.Query.SQL, Value => Long_Integer (Value));
end Append;
procedure Append (Query : in out Statement; Value : in Long_Integer) is
begin
ADO.SQL.Append_Value (Target => Query.Query.SQL, Value => Value);
end Append;
procedure Append (Query : in out Statement; SQL : in Unbounded_String) is
begin
ADO.SQL.Append_Value (Target => Query.Query.SQL, Value => To_String (SQL));
end Append;
procedure Set_Filter (Query : in out Statement;
Filter : in String) is
begin
Query.Query.Set_Filter (Filter);
end Set_Filter;
-- ------------------------------
-- Get the filter condition or the empty string
-- ------------------------------
-- function Get_Filter (Parameters : in Statement) return String is
-- begin
-- return Parameters.Query.Get_Filter;
-- end Get_Filter;
procedure Execute (Query : in out Statement;
SQL : in Unbounded_String;
Params : in ADO.Parameters.Abstract_List'Class) is
begin
null;
end Execute;
-- ------------------------------
-- Append the value to the SQL query string.
-- ------------------------------
procedure Append_Escape (Query : in out Statement; Value : in String) is
begin
ADO.SQL.Append_Value (Query.Query.SQL, Value);
end Append_Escape;
-- ------------------------------
-- Append the value to the SQL query string.
-- ------------------------------
procedure Append_Escape (Query : in out Statement; Value : in Unbounded_String) is
begin
ADO.SQL.Append_Value (Query.Query.SQL, To_String (Value));
end Append_Escape;
function "+" (Left : chars_ptr; Right : Size_T) return chars_ptr is
begin
return To_Chars_Ptr (To_Address (Left) + Storage_Offset (Right));
end "+";
-- ------------------------------
-- Get the query result as an integer
-- ------------------------------
function Get_Result_Integer (Query : Query_Statement) return Integer is
begin
if not Query_Statement'Class (Query).Has_Elements then
return 0;
end if;
if Query_Statement'Class (Query).Is_Null (0) then
return 0;
end if;
return Query_Statement'Class (Query).Get_Integer (0);
end Get_Result_Integer;
-- ------------------------------
-- Get the query result as a blob
-- ------------------------------
function Get_Result_Blob (Query : in Query_Statement) return ADO.Blob_Ref is
begin
if not Query_Statement'Class (Query).Has_Elements then
return Null_Blob;
end if;
return Query_Statement'Class (Query).Get_Blob (0);
end Get_Result_Blob;
-- ------------------------------
-- Get an unsigned 64-bit number from a C string terminated by \0
-- ------------------------------
function Get_Uint64 (Str : chars_ptr) return unsigned_long is
C : Character;
P : chars_ptr := Str;
Result : unsigned_long := 0;
begin
loop
C := P.all;
if C /= ' ' then
exit;
end if;
P := P + 1;
end loop;
while C >= '0' and C <= '9' loop
Result := Result * 10 + unsigned_long (Character'Pos (C) - Character'Pos ('0'));
P := P + 1;
C := P.all;
end loop;
if C /= ASCII.NUL then
raise Invalid_Type with "Invalid integer value";
end if;
return Result;
end Get_Uint64;
-- ------------------------------
-- Get a signed 64-bit number from a C string terminated by \0
-- ------------------------------
function Get_Int64 (Str : chars_ptr) return Int64 is
C : Character;
P : chars_ptr := Str;
begin
if P = null then
return 0;
end if;
loop
C := P.all;
if C /= ' ' then
exit;
end if;
P := P + 1;
end loop;
if C = '+' then
P := P + 1;
return Int64 (Get_Uint64 (P));
elsif C = '-' then
P := P + 1;
return -Int64 (Get_Uint64 (P));
else
return Int64 (Get_Uint64 (P));
end if;
end Get_Int64;
-- ------------------------------
-- Get a double number from a C string terminated by \0
-- ------------------------------
function Get_Double (Str : chars_ptr) return Long_Float is
C : Character;
P : chars_ptr := Str;
begin
if P = null then
return 0.0;
end if;
loop
C := P.all;
if C /= ' ' then
exit;
end if;
P := P + 1;
end loop;
declare
S : String (1 .. 100);
begin
for I in S'Range loop
C := P.all;
S (I) := C;
if C = ASCII.NUL then
return Long_Float'Value (S (S'First .. I - 1));
end if;
P := P + 1;
end loop;
raise Invalid_Type with "Invalid floating point value";
end;
end Get_Double;
-- ------------------------------
-- Get a time from the C string passed in <b>Value</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Time (Value : in chars_ptr) return Ada.Calendar.Time is
use Ada.Calendar;
Year : Year_Number := Year_Number'First;
Month : Month_Number := Month_Number'First;
Day : Day_Number := Day_Number'First;
Hours : Natural := 0;
Mins : Natural := 0;
Secs : Natural := 0;
Dt : Duration := 0.0;
Field : chars_ptr := Value;
function Get_Number (P : in chars_ptr;
Nb_Digits : in Positive) return Natural;
-- ------------------------------
-- Get a number composed of N digits
-- ------------------------------
function Get_Number (P : in chars_ptr;
Nb_Digits : in Positive) return Natural is
Ptr : chars_ptr := P;
Result : Natural := 0;
C : Character;
begin
for I in 1 .. Nb_Digits loop
C := Ptr.all;
if not (C >= '0' and C <= '9') then
raise Invalid_Type with "Invalid date format";
end if;
Result := Result * 10 + Character'Pos (C) - Character'Pos ('0');
Ptr := Ptr + 1;
end loop;
return Result;
end Get_Number;
begin
if Field /= null then
declare
C : Character;
N : Natural;
begin
N := Get_Number (Field, 4);
if N /= 0 then
Year := Year_Number (N);
end if;
Field := Field + 4;
C := Field.all;
if C /= '-' then
raise Invalid_Type with "Invalid date format";
end if;
Field := Field + 1;
N := Get_Number (Field, 2);
if N /= 0 then
Month := Month_Number (N);
end if;
Field := Field + 2;
C := Field.all;
if C /= '-' then
raise Invalid_Type with "Invalid date format";
end if;
Field := Field + 1;
N := Get_Number (Field, 2);
if N /= 0 then
Day := Day_Number (N);
end if;
Field := Field + 2;
C := Field.all;
if C /= ASCII.NUL then
if C /= ' ' then
raise Invalid_Type with "Invalid date format";
end if;
Field := Field + 1;
Hours := Get_Number (Field, 2);
Field := Field + 2;
C := Field.all;
if C /= ':' then
raise Invalid_Type with "Invalid date format";
end if;
Field := Field + 1;
Mins := Get_Number (Field, 2);
Field := Field + 2;
C := Field.all;
if C /= ':' then
raise Invalid_Type with "Invalid date format";
end if;
Field := Field + 1;
Secs := Get_Number (Field, 2);
Field := Field + 2;
C := Field.all;
if C /= '.' and C /= ASCII.NUL then
raise Invalid_Type with "Invalid date format";
end if;
Dt := Duration (Hours * 3600) + Duration (Mins * 60) + Duration (Secs);
end if;
end;
end if;
return Ada.Calendar.Formatting.Time_Of (Year, Month, Day, Dt, False, 0);
end Get_Time;
-- ------------------------------
-- Create a blob initialized with the given data buffer pointed to by <b>Data</b>
-- and which contains <b>Size</b> bytes.
-- ------------------------------
function Get_Blob (Data : in chars_ptr;
Size : in Natural) return Blob_Ref is
use Util.Refs;
use Ada.Streams;
B : constant Blob_Access := new Blob '(Ref_Entity with
Len => Stream_Element_Offset (Size),
others => <>);
P : chars_ptr := Data;
begin
for I in 1 .. Stream_Element_Offset (Size) loop
B.Data (I) := Character'Pos (P.all);
P := P + 1;
end loop;
return Blob_References.Create (B);
end Get_Blob;
-- ------------------------------
-- Execute the query
-- ------------------------------
overriding
procedure Execute (Query : in out Query_Statement) is
begin
if Query.Proxy = null then
raise Invalid_Statement with "Query statement is not initialized";
end if;
Query.Proxy.Execute;
end Execute;
-- ------------------------------
-- Get the number of rows returned by the query
-- ------------------------------
function Get_Row_Count (Query : in Query_Statement) return Natural is
begin
if Query.Proxy = null then
return 0;
else
return Query.Proxy.Get_Row_Count;
end if;
end Get_Row_Count;
-- ------------------------------
-- Returns True if there is more data (row) to fetch
-- ------------------------------
function Has_Elements (Query : in Query_Statement) return Boolean is
begin
if Query.Proxy = null then
return False;
else
return Query.Proxy.Has_Elements;
end if;
end Has_Elements;
-- ------------------------------
-- Fetch the next row
-- ------------------------------
procedure Next (Query : in out Query_Statement) is
begin
if Query.Proxy = null then
raise Invalid_Statement with "Query statement is not initialized";
end if;
Query.Proxy.Next;
end Next;
-- ------------------------------
-- Returns true if the column <b>Column</b> is null.
-- ------------------------------
function Is_Null (Query : in Query_Statement;
Column : in Natural) return Boolean is
begin
if Query.Proxy = null then
raise Invalid_Statement with "Query statement is not initialized";
end if;
return Query.Proxy.Is_Null (Column);
end Is_Null;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Int64</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Int64 (Query : Query_Statement;
Column : Natural) return Int64 is
begin
if Query.Proxy = null then
raise Invalid_Statement with "Int64 is not supported by database driver";
end if;
return Query.Proxy.Get_Int64 (Column);
end Get_Int64;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Integer</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Integer (Query : Query_Statement;
Column : Natural) return Integer is
begin
if Query.Proxy = null then
return Integer (Query_Statement'Class (Query).Get_Int64 (Column));
else
return Query.Proxy.Get_Integer (Column);
end if;
end Get_Integer;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Integer</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Natural (Query : in Query_Statement;
Column : in Natural) return Natural is
begin
return Natural (Query.Get_Integer (Column));
end Get_Natural;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Nullable_Integer</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Nullable_Integer (Query : Query_Statement;
Column : Natural) return Nullable_Integer is
begin
if Query.Proxy = null then
return Result : Nullable_Integer do
Result.Is_Null := Query_Statement'Class (Query).Is_Null (Column);
if not Result.Is_Null then
Result.Value := Integer (Query_Statement'Class (Query).Get_Int64 (Column));
end if;
end return;
else
return Query.Proxy.Get_Nullable_Integer (Column);
end if;
end Get_Nullable_Integer;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Float</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Float (Query : Query_Statement;
Column : Natural) return Float is
begin
if Query.Proxy = null then
return Float (Query_Statement'Class (Query).Get_Double (Column));
else
return Query.Proxy.Get_Float (Column);
end if;
end Get_Float;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Long_Float</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Double (Query : Query_Statement;
Column : Natural) return Long_Float is
begin
if Query.Proxy = null then
raise Invalid_Statement with "Double is not supported by database driver";
else
return Query.Proxy.Get_Double (Column);
end if;
end Get_Double;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Boolean</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Boolean (Query : Query_Statement;
Column : Natural) return Boolean is
begin
if Query.Proxy = null then
return Query_Statement'Class (Query).Get_Integer (Column) /= 0;
else
return Query.Proxy.Get_Boolean (Column);
end if;
end Get_Boolean;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as a <b>Nullable_Boolean</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Nullable_Boolean (Query : Query_Statement;
Column : Natural) return Nullable_Boolean is
begin
if Query.Proxy = null then
if Query_Statement'Class (Query).Is_Null (Column) then
return ADO.Null_Boolean;
else
return (Is_Null => False,
Value => Query_Statement'Class (Query).Get_Boolean (Column));
end if;
else
if Query.Is_Null (Column) then
return ADO.Null_Boolean;
end if;
return (Is_Null => False,
Value => Query.Proxy.Get_Boolean (Column));
end if;
end Get_Nullable_Boolean;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Identifier</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Identifier (Query : Query_Statement;
Column : Natural) return Identifier is
begin
if Query.Proxy = null then
if Query_Statement'Class (Query).Is_Null (Column) then
return ADO.NO_IDENTIFIER;
else
return Identifier (Query_Statement'Class (Query).Get_Int64 (Column));
end if;
else
if Query.Is_Null (Column) then
return ADO.NO_IDENTIFIER;
end if;
return Query.Proxy.Get_Identifier (Column);
end if;
end Get_Identifier;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Unbounded_String</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Unbounded_String (Query : Query_Statement;
Column : Natural) return Unbounded_String is
begin
if Query.Proxy = null then
raise Invalid_Statement with "Query statement is not initialized";
end if;
return Query.Proxy.Get_Unbounded_String (Column);
end Get_Unbounded_String;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Nullable_String</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Nullable_String (Query : Query_Statement;
Column : Natural) return Nullable_String is
begin
if Query.Proxy = null then
return Result : Nullable_String do
Result.Is_Null := Query_Statement'Class (Query).Is_Null (Column);
if not Result.Is_Null then
Result.Value := Query_Statement'Class (Query).Get_Unbounded_String (Column);
end if;
end return;
else
return Query.Proxy.Get_Nullable_String (Column);
end if;
end Get_Nullable_String;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Unbounded_String</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_String (Query : Query_Statement;
Column : Natural) return String is
begin
if Query.Proxy = null then
return To_String (Query_Statement'Class (Query).Get_Unbounded_String (Column));
else
return Query.Proxy.Get_String (Column);
end if;
end Get_String;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as a <b>Blob</b> reference.
-- ------------------------------
function Get_Blob (Query : in Query_Statement;
Column : in Natural) return ADO.Blob_Ref is
begin
if Query.Proxy = null then
return Empty : ADO.Blob_Ref;
else
return Query.Proxy.Get_Blob (Column);
end if;
end Get_Blob;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Time</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Time (Query : Query_Statement;
Column : Natural) return Ada.Calendar.Time is
begin
if Query.Proxy = null then
raise Invalid_Statement with "Query statement is not initialized";
end if;
return Query.Proxy.all.Get_Time (Column);
end Get_Time;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as a <b>Nullable_Time</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Nullable_Time (Query : in Query_Statement;
Column : in Natural) return Nullable_Time is
begin
if Query.Proxy = null then
return Result : Nullable_Time do
Result.Is_Null := Query_Statement'Class (Query).Is_Null (Column);
if not Result.Is_Null then
Result.Value := Query_Statement'Class (Query).Get_Time (Column);
end if;
end return;
end if;
return Query.Proxy.all.Get_Nullable_Time (Column);
end Get_Nullable_Time;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Nullable_Entity_Type</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Nullable_Entity_Type (Query : Query_Statement;
Column : Natural) return Nullable_Entity_Type is
begin
if Query.Proxy = null then
return Result : Nullable_Entity_Type do
Result.Is_Null := Query_Statement'Class (Query).Is_Null (Column);
if not Result.Is_Null then
Result.Value := Entity_Type (Query_Statement'Class (Query).Get_Integer (Column));
end if;
end return;
end if;
return Query.Proxy.all.Get_Nullable_Entity_Type (Column);
end Get_Nullable_Entity_Type;
-- ------------------------------
-- Get the column type
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Column_Type (Query : Query_Statement;
Column : Natural)
return ADO.Schemas.Column_Type is
begin
if Query.Proxy = null then
raise Invalid_Statement with "Query statement is not initialized";
end if;
return Query.Proxy.Get_Column_Type (Column);
end Get_Column_Type;
-- ------------------------------
-- Get the column name.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
function Get_Column_Name (Query : in Query_Statement;
Column : in Natural)
return String is
begin
if Query.Proxy = null then
raise Invalid_Statement with "Query statement is not initialized";
end if;
return Query.Proxy.Get_Column_Name (Column);
end Get_Column_Name;
-- ------------------------------
-- Get the number of columns in the result.
-- ------------------------------
function Get_Column_Count (Query : in Query_Statement)
return Natural is
begin
if Query.Proxy = null then
raise Invalid_Statement with "Query statement is not initialized";
end if;
return Query.Proxy.Get_Column_Count;
end Get_Column_Count;
overriding
procedure Adjust (Stmt : in out Query_Statement) is
begin
if Stmt.Proxy /= null then
Stmt.Proxy.Ref_Counter := Stmt.Proxy.Ref_Counter + 1;
end if;
end Adjust;
overriding
procedure Finalize (Stmt : in out Query_Statement) is
procedure Free is new
Ada.Unchecked_Deallocation (Object => Query_Statement'Class,
Name => Query_Statement_Access);
begin
if Stmt.Proxy /= null then
Stmt.Proxy.Ref_Counter := Stmt.Proxy.Ref_Counter - 1;
if Stmt.Proxy.Ref_Counter = 0 then
Free (Stmt.Proxy);
end if;
end if;
end Finalize;
-- Execute the delete query.
overriding
procedure Execute (Query : in out Delete_Statement) is
Result : Natural;
begin
Log.Info ("Delete statement");
if Query.Proxy = null then
raise Invalid_Statement with "Delete statement not initialized";
end if;
Query.Proxy.Execute (Result);
end Execute;
-- ------------------------------
-- Execute the query
-- Returns the number of rows deleted.
-- ------------------------------
procedure Execute (Query : in out Delete_Statement;
Result : out Natural) is
begin
Log.Info ("Delete statement");
if Query.Proxy = null then
raise Invalid_Statement with "Delete statement not initialized";
end if;
Query.Proxy.Execute (Result);
end Execute;
-- ------------------------------
-- Get the update query object associated with this update statement.
-- ------------------------------
function Get_Update_Query (Update : in Update_Statement)
return ADO.SQL.Update_Query_Access is
begin
return Update.Update;
end Get_Update_Query;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in Boolean) is
begin
Update.Update.Save_Field (Name => Name, Value => Value);
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in Nullable_Boolean) is
begin
if Value.Is_Null then
Update.Save_Null_Field (Name);
else
Update.Update.Save_Field (Name => Name, Value => Value.Value);
end if;
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in Integer) is
begin
Update.Update.Save_Field (Name => Name, Value => Value);
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in Nullable_Integer) is
begin
if Value.Is_Null then
Update.Save_Null_Field (Name);
else
Update.Update.Save_Field (Name => Name, Value => Value.Value);
end if;
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in Long_Long_Integer) is
begin
Update.Update.Save_Field (Name => Name, Value => Value);
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in Float) is
begin
Update.Update.Save_Field (Name => Name, Value => Long_Float (Value));
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in Long_Float) is
begin
Update.Update.Save_Field (Name => Name, Value => Value);
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in Identifier) is
begin
Update.Update.Save_Field (Name => Name, Value => Value);
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in Entity_Type) is
begin
Update.Update.Save_Field (Name => Name, Value => Value);
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in Nullable_Entity_Type) is
begin
if Value.Is_Null then
Update.Save_Null_Field (Name);
else
Update.Update.Save_Field (Name => Name, Value => Value.Value);
end if;
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in Ada.Calendar.Time) is
begin
Update.Update.Save_Field (Name => Name, Value => Value);
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in Nullable_Time) is
begin
if Value.Is_Null then
Update.Save_Null_Field (Name);
else
Update.Save_Field (Name, Value.Value);
end if;
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in String) is
begin
Update.Update.Save_Field (Name => Name, Value => Value);
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in Unbounded_String) is
begin
Update.Update.Save_Field (Name => Name, Value => Value);
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in Nullable_String) is
begin
if Value.Is_Null then
Update.Save_Null_Field (Name);
else
Update.Save_Field (Name, Value.Value);
end if;
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in ADO.Objects.Object_Key) is
begin
case Value.Of_Type is
when ADO.Objects.KEY_INTEGER =>
declare
V : constant Identifier := Objects.Get_Value (Value);
begin
Update.Update.Save_Field (Name => Name, Value => V);
end;
when ADO.Objects.KEY_STRING =>
declare
V : constant Unbounded_String := Objects.Get_Value (Value);
begin
Update.Update.Save_Field (Name => Name, Value => V);
end;
end case;
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field.
-- identified by <b>Name</b> and set it to the identifier key held by <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in ADO.Objects.Object_Ref'Class) is
begin
if Value.Is_Null then
Update.Save_Null_Field (Name);
else
Update.Save_Field (Name, Value.Get_Key);
end if;
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
-- ------------------------------
procedure Save_Field (Update : in out Update_Statement;
Name : in String;
Value : in ADO.Blob_Ref) is
begin
if Value.Is_Null then
Update.Save_Null_Field (Name);
else
Update.Update.Save_Field (Name, Value);
end if;
end Save_Field;
-- ------------------------------
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to NULL.
-- ------------------------------
procedure Save_Null_Field (Update : in out Update_Statement;
Name : in String) is
begin
Update.Update.Save_Null_Field (Name);
end Save_Null_Field;
-- ------------------------------
-- Check if the update/insert query has some fields to update.
-- ------------------------------
function Has_Save_Fields (Update : in Update_Statement) return Boolean is
begin
return Update.Update.Has_Save_Fields;
end Has_Save_Fields;
-- ------------------------------
-- Execute the query
-- ------------------------------
overriding
procedure Execute (Query : in out Update_Statement) is
begin
if Query.Proxy = null then
raise Invalid_Statement with "Update statement not initialized";
end if;
Query.Proxy.Execute;
end Execute;
-- ------------------------------
-- Execute the query
-- ------------------------------
overriding
procedure Execute (Query : in out Insert_Statement) is
begin
if Query.Proxy = null then
raise Invalid_Statement with "Insert statement not initialized";
end if;
Query.Proxy.Execute;
end Execute;
-- ------------------------------
-- Execute the query
-- ------------------------------
procedure Execute (Query : in out Update_Statement;
Result : out Integer) is
begin
if Query.Proxy = null then
raise Invalid_Statement with "Update statement not initialized";
end if;
Query.Proxy.Execute (Result);
end Execute;
overriding
procedure Adjust (Stmt : in out Delete_Statement) is
begin
if Stmt.Proxy /= null then
Stmt.Proxy.Ref_Counter := Stmt.Proxy.Ref_Counter + 1;
end if;
end Adjust;
overriding
procedure Finalize (Stmt : in out Delete_Statement) is
procedure Free is new
Ada.Unchecked_Deallocation (Object => Delete_Statement'Class,
Name => Delete_Statement_Access);
begin
if Stmt.Proxy /= null then
Stmt.Proxy.Ref_Counter := Stmt.Proxy.Ref_Counter - 1;
if Stmt.Proxy.Ref_Counter = 0 then
Free (Stmt.Proxy);
end if;
end if;
end Finalize;
overriding
procedure Adjust (Stmt : in out Update_Statement) is
begin
if Stmt.Proxy /= null then
Stmt.Proxy.Ref_Counter := Stmt.Proxy.Ref_Counter + 1;
end if;
end Adjust;
overriding
procedure Finalize (Stmt : in out Update_Statement) is
procedure Free is new
Ada.Unchecked_Deallocation (Object => Update_Statement'Class,
Name => Update_Statement_Access);
begin
if Stmt.Proxy /= null then
Stmt.Proxy.Ref_Counter := Stmt.Proxy.Ref_Counter - 1;
if Stmt.Proxy.Ref_Counter = 0 then
Free (Stmt.Proxy);
end if;
end if;
end Finalize;
end ADO.Statements;
|
with Ada.Integer_Text_IO;
with Ada.Text_IO;
package body Problem_18 is
package IO renames Ada.Text_IO;
package I_IO renames Ada.Integer_Text_IO;
procedure Solve is
num_rows : constant Positive := 15;
cache : Array (1 .. num_rows) of Natural;
input : IO.File_Type;
begin
for item in cache'Range loop
cache(item) := 0;
end loop;
IO.Open(input, IO.In_File, "input/Problem_18.txt");
for row in 1 .. num_rows loop
declare
current_row : Array (1 .. row) of Natural;
begin
-- Read in line
for column in 1 .. row loop
I_IO.Get(input, current_row(column), 0);
end loop;
-- If we go backwards through the row, it allows us to perform the
-- replacement in memory instead of requiring a backup copy of the
-- cache.
for column in reverse 1 .. row loop
declare
max : Natural := 0;
from_right : constant Natural := cache(column) + current_row(column);
begin
-- coming from left
if column > 1 then
max := cache(column - 1) + current_row(column);
end if;
-- coming from right
if from_right > max then
max := from_right;
end if;
cache(column) := max;
end;
end loop;
end;
end loop;
declare
max : Natural := 0;
begin
for item in cache'Range loop
if cache(item) > max then
max := cache(item);
end if;
end loop;
I_IO.Put(max);
IO.New_Line;
end;
end Solve;
end Problem_18;
|
package body Depends_Exercise is
procedure Initialize is
begin
Stack_Pointer := 0;
Stack := (others => 0);
end Initialize;
procedure Push (X : in Integer) is
begin
Stack_Pointer := Stack_Pointer + 1;
Stack (Stack_Pointer) := X;
end Push;
function Is_Full return Boolean is
begin
return Stack_Pointer = Stack_Size;
end Is_Full;
function Wait_X_Return_True (X : in Integer) return Boolean is
begin
for I in Integer range 1 .. X loop
null;
end loop;
return True;
end Wait_X_return_True;
end Depends_Exercise;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- L A Y O U T --
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Atree; use Atree;
with Debug; use Debug;
with Einfo; use Einfo;
with Errout; use Errout;
with Opt; use Opt;
with Sem_Aux; use Sem_Aux;
with Sem_Ch13; use Sem_Ch13;
with Sem_Eval; use Sem_Eval;
with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Snames; use Snames;
with Ttypes; use Ttypes;
with Uintp; use Uintp;
package body Layout is
------------------------
-- Local Declarations --
------------------------
SSU : constant Int := Ttypes.System_Storage_Unit;
-- Short hand for System_Storage_Unit
-----------------------
-- Local Subprograms --
-----------------------
procedure Compute_Size_Depends_On_Discriminant (E : Entity_Id);
-- Given an array type or an array subtype E, compute whether its size
-- depends on the value of one or more discriminants and set the flag
-- Size_Depends_On_Discriminant accordingly. This need not be called
-- in front end layout mode since it does the computation on its own.
procedure Set_Composite_Alignment (E : Entity_Id);
-- This procedure is called for record types and subtypes, and also for
-- atomic array types and subtypes. If no alignment is set, and the size
-- is 2 or 4 (or 8 if the word size is 8), then the alignment is set to
-- match the size.
----------------------------
-- Adjust_Esize_Alignment --
----------------------------
procedure Adjust_Esize_Alignment (E : Entity_Id) is
Abits : Int;
Esize_Set : Boolean;
begin
-- Nothing to do if size unknown
if Unknown_Esize (E) then
return;
end if;
-- Determine if size is constrained by an attribute definition clause
-- which must be obeyed. If so, we cannot increase the size in this
-- routine.
-- For a type, the issue is whether an object size clause has been set.
-- A normal size clause constrains only the value size (RM_Size)
if Is_Type (E) then
Esize_Set := Has_Object_Size_Clause (E);
-- For an object, the issue is whether a size clause is present
else
Esize_Set := Has_Size_Clause (E);
end if;
-- If size is known it must be a multiple of the storage unit size
if Esize (E) mod SSU /= 0 then
-- If not, and size specified, then give error
if Esize_Set then
Error_Msg_NE
("size for& not a multiple of storage unit size",
Size_Clause (E), E);
return;
-- Otherwise bump up size to a storage unit boundary
else
Set_Esize (E, (Esize (E) + SSU - 1) / SSU * SSU);
end if;
end if;
-- Now we have the size set, it must be a multiple of the alignment
-- nothing more we can do here if the alignment is unknown here.
if Unknown_Alignment (E) then
return;
end if;
-- At this point both the Esize and Alignment are known, so we need
-- to make sure they are consistent.
Abits := UI_To_Int (Alignment (E)) * SSU;
if Esize (E) mod Abits = 0 then
return;
end if;
-- Here we have a situation where the Esize is not a multiple of the
-- alignment. We must either increase Esize or reduce the alignment to
-- correct this situation.
-- The case in which we can decrease the alignment is where the
-- alignment was not set by an alignment clause, and the type in
-- question is a discrete type, where it is definitely safe to reduce
-- the alignment. For example:
-- t : integer range 1 .. 2;
-- for t'size use 8;
-- In this situation, the initial alignment of t is 4, copied from
-- the Integer base type, but it is safe to reduce it to 1 at this
-- stage, since we will only be loading a single storage unit.
if Is_Discrete_Type (Etype (E)) and then not Has_Alignment_Clause (E)
then
loop
Abits := Abits / 2;
exit when Esize (E) mod Abits = 0;
end loop;
Init_Alignment (E, Abits / SSU);
return;
end if;
-- Now the only possible approach left is to increase the Esize but we
-- can't do that if the size was set by a specific clause.
if Esize_Set then
Error_Msg_NE
("size for& is not a multiple of alignment",
Size_Clause (E), E);
-- Otherwise we can indeed increase the size to a multiple of alignment
else
Set_Esize (E, ((Esize (E) + (Abits - 1)) / Abits) * Abits);
end if;
end Adjust_Esize_Alignment;
------------------------------------------
-- Compute_Size_Depends_On_Discriminant --
------------------------------------------
procedure Compute_Size_Depends_On_Discriminant (E : Entity_Id) is
Indx : Node_Id;
Ityp : Entity_Id;
Lo : Node_Id;
Hi : Node_Id;
Res : Boolean := False;
begin
-- Loop to process array indexes
Indx := First_Index (E);
while Present (Indx) loop
Ityp := Etype (Indx);
-- If an index of the array is a generic formal type then there is
-- no point in determining a size for the array type.
if Is_Generic_Type (Ityp) then
return;
end if;
Lo := Type_Low_Bound (Ityp);
Hi := Type_High_Bound (Ityp);
if (Nkind (Lo) = N_Identifier
and then Ekind (Entity (Lo)) = E_Discriminant)
or else
(Nkind (Hi) = N_Identifier
and then Ekind (Entity (Hi)) = E_Discriminant)
then
Res := True;
end if;
Next_Index (Indx);
end loop;
if Res then
Set_Size_Depends_On_Discriminant (E);
end if;
end Compute_Size_Depends_On_Discriminant;
-------------------
-- Layout_Object --
-------------------
procedure Layout_Object (E : Entity_Id) is
pragma Unreferenced (E);
begin
-- Nothing to do for now, assume backend does the layout
return;
end Layout_Object;
-----------------
-- Layout_Type --
-----------------
procedure Layout_Type (E : Entity_Id) is
Desig_Type : Entity_Id;
begin
-- For string literal types, for now, kill the size always, this is
-- because gigi does not like or need the size to be set ???
if Ekind (E) = E_String_Literal_Subtype then
Set_Esize (E, Uint_0);
Set_RM_Size (E, Uint_0);
return;
end if;
-- For access types, set size/alignment. This is system address size,
-- except for fat pointers (unconstrained array access types), where the
-- size is two times the address size, to accommodate the two pointers
-- that are required for a fat pointer (data and template). Note that
-- E_Access_Protected_Subprogram_Type is not an access type for this
-- purpose since it is not a pointer but is equivalent to a record. For
-- access subtypes, copy the size from the base type since Gigi
-- represents them the same way.
if Is_Access_Type (E) then
Desig_Type := Underlying_Type (Designated_Type (E));
-- If we only have a limited view of the type, see whether the
-- non-limited view is available.
if From_Limited_With (Designated_Type (E))
and then Ekind (Designated_Type (E)) = E_Incomplete_Type
and then Present (Non_Limited_View (Designated_Type (E)))
then
Desig_Type := Non_Limited_View (Designated_Type (E));
end if;
-- If Esize already set (e.g. by a size clause), then nothing further
-- to be done here.
if Known_Esize (E) then
null;
-- Access to subprogram is a strange beast, and we let the backend
-- figure out what is needed (it may be some kind of fat pointer,
-- including the static link for example.
elsif Is_Access_Protected_Subprogram_Type (E) then
null;
-- For access subtypes, copy the size information from base type
elsif Ekind (E) = E_Access_Subtype then
Set_Size_Info (E, Base_Type (E));
Set_RM_Size (E, RM_Size (Base_Type (E)));
-- For other access types, we use either address size, or, if a fat
-- pointer is used (pointer-to-unconstrained array case), twice the
-- address size to accommodate a fat pointer.
elsif Present (Desig_Type)
and then Is_Array_Type (Desig_Type)
and then not Is_Constrained (Desig_Type)
and then not Has_Completion_In_Body (Desig_Type)
-- Debug Flag -gnatd6 says make all pointers to unconstrained thin
and then not Debug_Flag_6
then
Init_Size (E, 2 * System_Address_Size);
-- Check for bad convention set
if Warn_On_Export_Import
and then
(Convention (E) = Convention_C
or else
Convention (E) = Convention_CPP)
then
Error_Msg_N
("?x?this access type does not correspond to C pointer", E);
end if;
-- If the designated type is a limited view it is unanalyzed. We can
-- examine the declaration itself to determine whether it will need a
-- fat pointer.
elsif Present (Desig_Type)
and then Present (Parent (Desig_Type))
and then Nkind (Parent (Desig_Type)) = N_Full_Type_Declaration
and then Nkind (Type_Definition (Parent (Desig_Type))) =
N_Unconstrained_Array_Definition
and then not Debug_Flag_6
then
Init_Size (E, 2 * System_Address_Size);
-- If unnesting subprograms, subprogram access types contain the
-- address of both the subprogram and an activation record. But if we
-- set that, we'll get a warning on different unchecked conversion
-- sizes in the RTS. So leave unset in that case.
elsif Unnest_Subprogram_Mode
and then Is_Access_Subprogram_Type (E)
then
null;
-- Normal case of thin pointer
else
Init_Size (E, System_Address_Size);
end if;
Set_Elem_Alignment (E);
-- Scalar types: set size and alignment
elsif Is_Scalar_Type (E) then
-- For discrete types, the RM_Size and Esize must be set already,
-- since this is part of the earlier processing and the front end is
-- always required to lay out the sizes of such types (since they are
-- available as static attributes). All we do is to check that this
-- rule is indeed obeyed.
if Is_Discrete_Type (E) then
-- If the RM_Size is not set, then here is where we set it
-- Note: an RM_Size of zero looks like not set here, but this
-- is a rare case, and we can simply reset it without any harm.
if not Known_RM_Size (E) then
Set_Discrete_RM_Size (E);
end if;
-- If Esize for a discrete type is not set then set it
if not Known_Esize (E) then
declare
S : Int := 8;
begin
loop
-- If size is big enough, set it and exit
if S >= RM_Size (E) then
Init_Esize (E, S);
exit;
-- If the RM_Size is greater than System_Max_Integer_Size
-- (happens only when strange values are specified by the
-- user), then Esize is simply a copy of RM_Size, it will
-- be further refined later on).
elsif S = System_Max_Integer_Size then
Set_Esize (E, RM_Size (E));
exit;
-- Otherwise double possible size and keep trying
else
S := S * 2;
end if;
end loop;
end;
end if;
-- For non-discrete scalar types, if the RM_Size is not set, then set
-- it now to a copy of the Esize if the Esize is set.
else
if Known_Esize (E) and then Unknown_RM_Size (E) then
Set_RM_Size (E, Esize (E));
end if;
end if;
Set_Elem_Alignment (E);
-- Non-elementary (composite) types
else
-- For packed arrays, take size and alignment values from the packed
-- array type if a packed array type has been created and the fields
-- are not currently set.
if Is_Array_Type (E)
and then Present (Packed_Array_Impl_Type (E))
then
declare
PAT : constant Entity_Id := Packed_Array_Impl_Type (E);
begin
if Unknown_Esize (E) then
Set_Esize (E, Esize (PAT));
end if;
if Unknown_RM_Size (E) then
Set_RM_Size (E, RM_Size (PAT));
end if;
if Unknown_Alignment (E) then
Set_Alignment (E, Alignment (PAT));
end if;
end;
end if;
-- For array base types, set the component size if object size of the
-- component type is known and is a small power of 2 (8, 16, 32, 64),
-- since this is what will always be used, except if a very large
-- alignment was specified and so Adjust_Esize_For_Alignment gave up
-- because, in this case, the object size is not a multiple of the
-- alignment and, therefore, cannot be the component size.
if Ekind (E) = E_Array_Type and then Unknown_Component_Size (E) then
declare
CT : constant Entity_Id := Component_Type (E);
begin
-- For some reason, access types can cause trouble, So let's
-- just do this for scalar types ???
if Present (CT)
and then Is_Scalar_Type (CT)
and then Known_Static_Esize (CT)
and then not (Known_Alignment (CT)
and then Alignment_In_Bits (CT) >
Standard_Long_Long_Integer_Size)
then
declare
S : constant Uint := Esize (CT);
begin
if Addressable (S) then
Set_Component_Size (E, S);
end if;
end;
end if;
end;
end if;
-- For non-packed arrays set the alignment of the array to the
-- alignment of the component type if it is unknown. Skip this
-- in atomic/VFA case since a larger alignment may be needed.
if Is_Array_Type (E)
and then not Is_Packed (E)
and then Unknown_Alignment (E)
and then Known_Alignment (Component_Type (E))
and then Known_Static_Component_Size (E)
and then Known_Static_Esize (Component_Type (E))
and then Component_Size (E) = Esize (Component_Type (E))
and then not Is_Atomic_Or_VFA (E)
then
Set_Alignment (E, Alignment (Component_Type (E)));
end if;
end if;
-- Even if the backend performs the layout, we still do a little in
-- the front end
-- Processing for record types
if Is_Record_Type (E) then
-- Special remaining processing for record types with a known
-- size of 16, 32, or 64 bits whose alignment is not yet set.
-- For these types, we set a corresponding alignment matching
-- the size if possible, or as large as possible if not.
if Convention (E) = Convention_Ada and then not Debug_Flag_Q then
Set_Composite_Alignment (E);
end if;
-- Processing for array types
elsif Is_Array_Type (E) then
-- For arrays that are required to be atomic/VFA, we do the same
-- processing as described above for short records, since we
-- really need to have the alignment set for the whole array.
if Is_Atomic_Or_VFA (E) and then not Debug_Flag_Q then
Set_Composite_Alignment (E);
end if;
-- For unpacked array types, set an alignment of 1 if we know
-- that the component alignment is not greater than 1. The reason
-- we do this is to avoid unnecessary copying of slices of such
-- arrays when passed to subprogram parameters (see special test
-- in Exp_Ch6.Expand_Actuals).
if not Is_Packed (E) and then Unknown_Alignment (E) then
if Known_Static_Component_Size (E)
and then Component_Size (E) = 1
then
Set_Alignment (E, Uint_1);
end if;
end if;
-- We need to know whether the size depends on the value of one
-- or more discriminants to select the return mechanism. Skip if
-- errors are present, to prevent cascaded messages.
if Serious_Errors_Detected = 0 then
Compute_Size_Depends_On_Discriminant (E);
end if;
end if;
-- Final step is to check that Esize and RM_Size are compatible
if Known_Static_Esize (E) and then Known_Static_RM_Size (E) then
if Esize (E) < RM_Size (E) then
-- Esize is less than RM_Size. That's not good. First we test
-- whether this was set deliberately with an Object_Size clause
-- and if so, object to the clause.
if Has_Object_Size_Clause (E) then
Error_Msg_Uint_1 := RM_Size (E);
Error_Msg_F
("object size is too small, minimum allowed is ^",
Expression (Get_Attribute_Definition_Clause
(E, Attribute_Object_Size)));
end if;
-- Adjust Esize up to RM_Size value
declare
Size : constant Uint := RM_Size (E);
begin
Set_Esize (E, RM_Size (E));
-- For scalar types, increase Object_Size to power of 2, but
-- not less than a storage unit in any case (i.e., normally
-- this means it will be storage-unit addressable).
if Is_Scalar_Type (E) then
if Size <= SSU then
Init_Esize (E, SSU);
elsif Size <= 16 then
Init_Esize (E, 16);
elsif Size <= 32 then
Init_Esize (E, 32);
else
Set_Esize (E, (Size + 63) / 64 * 64);
end if;
-- Finally, make sure that alignment is consistent with
-- the newly assigned size.
while Alignment (E) * SSU < Esize (E)
and then Alignment (E) < Maximum_Alignment
loop
Set_Alignment (E, 2 * Alignment (E));
end loop;
end if;
end;
end if;
end if;
end Layout_Type;
-----------------------------
-- Set_Composite_Alignment --
-----------------------------
procedure Set_Composite_Alignment (E : Entity_Id) is
Siz : Uint;
Align : Nat;
begin
-- If alignment is already set, then nothing to do
if Known_Alignment (E) then
return;
end if;
-- Alignment is not known, see if we can set it, taking into account
-- the setting of the Optimize_Alignment mode.
-- If Optimize_Alignment is set to Space, then we try to give packed
-- records an aligmment of 1, unless there is some reason we can't.
if Optimize_Alignment_Space (E)
and then Is_Record_Type (E)
and then Is_Packed (E)
then
-- No effect for record with atomic/VFA components
if Is_Atomic_Or_VFA (E) then
Error_Msg_N ("Optimize_Alignment has no effect for &??", E);
if Is_Atomic (E) then
Error_Msg_N
("\pragma ignored for atomic record??", E);
else
Error_Msg_N
("\pragma ignored for bolatile full access record??", E);
end if;
return;
end if;
-- No effect if independent components
if Has_Independent_Components (E) then
Error_Msg_N ("Optimize_Alignment has no effect for &??", E);
Error_Msg_N
("\pragma ignored for record with independent components??", E);
return;
end if;
-- No effect if any component is atomic/VFA or is a by-reference type
declare
Ent : Entity_Id;
begin
Ent := First_Component_Or_Discriminant (E);
while Present (Ent) loop
if Is_By_Reference_Type (Etype (Ent))
or else Is_Atomic_Or_VFA (Etype (Ent))
or else Is_Atomic_Or_VFA (Ent)
then
Error_Msg_N ("Optimize_Alignment has no effect for &??", E);
if Is_Atomic (Etype (Ent)) or else Is_Atomic (Ent) then
Error_Msg_N
("\pragma is ignored if atomic "
& "components present??", E);
else
Error_Msg_N
("\pragma is ignored if bolatile full access "
& "components present??", E);
end if;
return;
else
Next_Component_Or_Discriminant (Ent);
end if;
end loop;
end;
-- Optimize_Alignment has no effect on variable length record
if not Size_Known_At_Compile_Time (E) then
Error_Msg_N ("Optimize_Alignment has no effect for &??", E);
Error_Msg_N ("\pragma is ignored for variable length record??", E);
return;
end if;
-- All tests passed, we can set alignment to 1
Align := 1;
-- Not a record, or not packed
else
-- The only other cases we worry about here are where the size is
-- statically known at compile time.
if Known_Static_Esize (E) then
Siz := Esize (E);
elsif Unknown_Esize (E) and then Known_Static_RM_Size (E) then
Siz := RM_Size (E);
else
return;
end if;
-- Size is known, alignment is not set
-- Reset alignment to match size if the known size is exactly 2, 4,
-- or 8 storage units.
if Siz = 2 * SSU then
Align := 2;
elsif Siz = 4 * SSU then
Align := 4;
elsif Siz = 8 * SSU then
Align := 8;
-- If Optimize_Alignment is set to Space, then make sure the
-- alignment matches the size, for example, if the size is 17
-- bytes then we want an alignment of 1 for the type.
elsif Optimize_Alignment_Space (E) then
if Siz mod (8 * SSU) = 0 then
Align := 8;
elsif Siz mod (4 * SSU) = 0 then
Align := 4;
elsif Siz mod (2 * SSU) = 0 then
Align := 2;
else
Align := 1;
end if;
-- If Optimize_Alignment is set to Time, then we reset for odd
-- "in between sizes", for example a 17 bit record is given an
-- alignment of 4.
elsif Optimize_Alignment_Time (E)
and then Siz > SSU
and then Siz <= 8 * SSU
then
if Siz <= 2 * SSU then
Align := 2;
elsif Siz <= 4 * SSU then
Align := 4;
else -- Siz <= 8 * SSU then
Align := 8;
end if;
-- No special alignment fiddling needed
else
return;
end if;
end if;
-- Here we have Set Align to the proposed improved value. Make sure the
-- value set does not exceed Maximum_Alignment for the target.
if Align > Maximum_Alignment then
Align := Maximum_Alignment;
end if;
-- Further processing for record types only to reduce the alignment
-- set by the above processing in some specific cases. We do not
-- do this for atomic/VFA records, since we need max alignment there,
if Is_Record_Type (E) and then not Is_Atomic_Or_VFA (E) then
-- For records, there is generally no point in setting alignment
-- higher than word size since we cannot do better than move by
-- words in any case. Omit this if we are optimizing for time,
-- since conceivably we may be able to do better.
if Align > System_Word_Size / SSU
and then not Optimize_Alignment_Time (E)
then
Align := System_Word_Size / SSU;
end if;
-- Check components. If any component requires a higher alignment,
-- then we set that higher alignment in any case. Don't do this if we
-- have Optimize_Alignment set to Space. Note that covers the case of
-- packed records, where we already set alignment to 1.
if not Optimize_Alignment_Space (E) then
declare
Comp : Entity_Id;
begin
Comp := First_Component (E);
while Present (Comp) loop
if Known_Alignment (Etype (Comp)) then
declare
Calign : constant Uint := Alignment (Etype (Comp));
begin
-- The cases to process are when the alignment of the
-- component type is larger than the alignment we have
-- so far, and either there is no component clause for
-- the component, or the length set by the component
-- clause matches the length of the component type.
if Calign > Align
and then
(Unknown_Esize (Comp)
or else (Known_Static_Esize (Comp)
and then
Esize (Comp) = Calign * SSU))
then
Align := UI_To_Int (Calign);
end if;
end;
end if;
Next_Component (Comp);
end loop;
end;
end if;
end if;
-- Set chosen alignment, and increase Esize if necessary to match the
-- chosen alignment.
Set_Alignment (E, UI_From_Int (Align));
if Known_Static_Esize (E)
and then Esize (E) < Align * SSU
then
Set_Esize (E, UI_From_Int (Align * SSU));
end if;
end Set_Composite_Alignment;
--------------------------
-- Set_Discrete_RM_Size --
--------------------------
procedure Set_Discrete_RM_Size (Def_Id : Entity_Id) is
FST : constant Entity_Id := First_Subtype (Def_Id);
begin
-- All discrete types except for the base types in standard are
-- constrained, so indicate this by setting Is_Constrained.
Set_Is_Constrained (Def_Id);
-- Set generic types to have an unknown size, since the representation
-- of a generic type is irrelevant, in view of the fact that they have
-- nothing to do with code.
if Is_Generic_Type (Root_Type (FST)) then
Set_RM_Size (Def_Id, Uint_0);
-- If the subtype statically matches the first subtype, then it is
-- required to have exactly the same layout. This is required by
-- aliasing considerations.
elsif Def_Id /= FST and then
Subtypes_Statically_Match (Def_Id, FST)
then
Set_RM_Size (Def_Id, RM_Size (FST));
Set_Size_Info (Def_Id, FST);
-- In all other cases the RM_Size is set to the minimum size. Note that
-- this routine is never called for subtypes for which the RM_Size is
-- set explicitly by an attribute clause.
else
Set_RM_Size (Def_Id, UI_From_Int (Minimum_Size (Def_Id)));
end if;
end Set_Discrete_RM_Size;
------------------------
-- Set_Elem_Alignment --
------------------------
procedure Set_Elem_Alignment (E : Entity_Id; Align : Nat := 0) is
begin
-- Do not set alignment for packed array types, this is handled in the
-- backend.
if Is_Packed_Array_Impl_Type (E) then
return;
-- If there is an alignment clause, then we respect it
elsif Has_Alignment_Clause (E) then
return;
-- If the size is not set, then don't attempt to set the alignment. This
-- happens in the backend layout case for access-to-subprogram types.
elsif not Known_Static_Esize (E) then
return;
-- For access types, do not set the alignment if the size is less than
-- the allowed minimum size. This avoids cascaded error messages.
elsif Is_Access_Type (E) and then Esize (E) < System_Address_Size then
return;
end if;
-- We attempt to set the alignment in all the other cases
declare
S : Int;
A : Nat;
M : Nat;
begin
-- The given Esize may be larger that int'last because of a previous
-- error, and the call to UI_To_Int will fail, so use default.
if Esize (E) / SSU > Ttypes.Maximum_Alignment then
S := Ttypes.Maximum_Alignment;
-- If this is an access type and the target doesn't have strict
-- alignment, then cap the alignment to that of a regular access
-- type. This will avoid giving fat pointers twice the usual
-- alignment for no practical benefit since the misalignment doesn't
-- really matter.
elsif Is_Access_Type (E)
and then not Target_Strict_Alignment
then
S := System_Address_Size / SSU;
else
S := UI_To_Int (Esize (E)) / SSU;
end if;
-- If the default alignment of "double" floating-point types is
-- specifically capped, enforce the cap.
if Ttypes.Target_Double_Float_Alignment > 0
and then S = 8
and then Is_Floating_Point_Type (E)
then
M := Ttypes.Target_Double_Float_Alignment;
-- If the default alignment of "double" or larger scalar types is
-- specifically capped, enforce the cap.
elsif Ttypes.Target_Double_Scalar_Alignment > 0
and then S >= 8
and then Is_Scalar_Type (E)
then
M := Ttypes.Target_Double_Scalar_Alignment;
-- Otherwise enforce the overall alignment cap
else
M := Ttypes.Maximum_Alignment;
end if;
-- We calculate the alignment as the largest power-of-two multiple
-- of System.Storage_Unit that does not exceed the object size of
-- the type and the maximum allowed alignment, if none was specified.
-- Otherwise we only cap it to the maximum allowed alignment.
if Align = 0 then
A := 1;
while 2 * A <= S and then 2 * A <= M loop
A := 2 * A;
end loop;
else
A := Nat'Min (Align, M);
end if;
-- If alignment is currently not set, then we can safely set it to
-- this new calculated value.
if Unknown_Alignment (E) then
Init_Alignment (E, A);
-- Cases where we have inherited an alignment
-- For constructed types, always reset the alignment, these are
-- generally invisible to the user anyway, and that way we are
-- sure that no constructed types have weird alignments.
elsif not Comes_From_Source (E) then
Init_Alignment (E, A);
-- If this inherited alignment is the same as the one we computed,
-- then obviously everything is fine, and we do not need to reset it.
elsif Alignment (E) = A then
null;
else
-- Now we come to the difficult cases of subtypes for which we
-- have inherited an alignment different from the computed one.
-- We resort to the presence of alignment and size clauses to
-- guide our choices. Note that they can generally be present
-- only on the first subtype (except for Object_Size) and that
-- we need to look at the Rep_Item chain to correctly handle
-- derived types.
declare
FST : constant Entity_Id := First_Subtype (E);
function Has_Attribute_Clause
(E : Entity_Id;
Id : Attribute_Id) return Boolean;
-- Wrapper around Get_Attribute_Definition_Clause which tests
-- for the presence of the specified attribute clause.
--------------------------
-- Has_Attribute_Clause --
--------------------------
function Has_Attribute_Clause
(E : Entity_Id;
Id : Attribute_Id) return Boolean is
begin
return Present (Get_Attribute_Definition_Clause (E, Id));
end Has_Attribute_Clause;
begin
-- If the alignment comes from a clause, then we respect it.
-- Consider for example:
-- type R is new Character;
-- for R'Alignment use 1;
-- for R'Size use 16;
-- subtype S is R;
-- Here R has a specified size of 16 and a specified alignment
-- of 1, and it seems right for S to inherit both values.
if Has_Attribute_Clause (FST, Attribute_Alignment) then
null;
-- Now we come to the cases where we have inherited alignment
-- and size, and overridden the size but not the alignment.
elsif Has_Attribute_Clause (FST, Attribute_Size)
or else Has_Attribute_Clause (FST, Attribute_Object_Size)
or else Has_Attribute_Clause (E, Attribute_Object_Size)
then
-- This is tricky, it might be thought that we should try to
-- inherit the alignment, since that's what the RM implies,
-- but that leads to complex rules and oddities. Consider
-- for example:
-- type R is new Character;
-- for R'Size use 16;
-- It seems quite bogus in this case to inherit an alignment
-- of 1 from the parent type Character. Furthermore, if that
-- is what the programmer really wanted for some odd reason,
-- then he could specify the alignment directly.
-- Moreover we really don't want to inherit the alignment in
-- the case of a specified Object_Size for a subtype, since
-- there would be no way of overriding to give a reasonable
-- value (as we don't have an Object_Alignment attribute).
-- Consider for example:
-- subtype R is Character;
-- for R'Object_Size use 16;
-- If we inherit the alignment of 1, then it will be very
-- inefficient for the subtype and this cannot be fixed.
-- So we make the decision that if Size (or Object_Size) is
-- given and the alignment is not specified with a clause,
-- we reset the alignment to the appropriate value for the
-- specified size. This is a nice simple rule to implement
-- and document.
-- There is a theoretical glitch, which is that a confirming
-- size clause could now change the alignment, which, if we
-- really think that confirming rep clauses should have no
-- effect, could be seen as a no-no. However that's already
-- implemented by Alignment_Check_For_Size_Change so we do
-- not change the philosophy here.
-- Historical note: in versions prior to Nov 6th, 2011, an
-- odd distinction was made between inherited alignments
-- larger than the computed alignment (where the larger
-- alignment was inherited) and inherited alignments smaller
-- than the computed alignment (where the smaller alignment
-- was overridden). This was a dubious fix to get around an
-- ACATS problem which seems to have disappeared anyway, and
-- in any case, this peculiarity was never documented.
Init_Alignment (E, A);
-- If no Size (or Object_Size) was specified, then we have
-- inherited the object size, so we should also inherit the
-- alignment and not modify it.
else
null;
end if;
end;
end if;
end;
end Set_Elem_Alignment;
end Layout;
|
package body CSV is
function Line(S: String; Separator: Character := ',')
return Row is
(Length => S'Length, Str => S,
Fst => S'First, Lst => S'Last, Nxt => S'First, Sep => Separator);
function Item(R: Row) return String is
(R.Str(R.Fst .. R.Lst));
function Next(R: in out Row) return Boolean is
Last: Natural := R.Nxt;
begin
R.Fst := R.Nxt;
while Last <= R.Str'Last and then R.Str(Last) /= R.Sep loop
-- find Separator
Last := Last + 1;
end loop;
R.Lst := Last - 1;
R.Nxt := Last + 1;
return (R.Fst <= R.Str'Last);
end Next;
end CSV;
|
pragma License (Unrestricted);
-- implementation unit specialized for POSIX (Darwin, FreeBSD, or Linux)
with Ada.Command_Line;
with Ada.IO_Exceptions;
with Ada.Streams.Naked_Stream_IO;
with C.sys.types;
package System.Native_Processes is
use type C.sys.types.pid_t;
subtype Command_Type is C.char_ptr_ptr;
procedure Free (X : in out Command_Type);
function Image (Command : Command_Type) return String;
procedure Value (
Command_Line : String;
Command : aliased out Command_Type);
procedure Append (
Command : aliased in out Command_Type;
New_Item : String);
procedure Append (
Command : aliased in out Command_Type;
First : Positive;
Last : Natural);
-- Copy arguments from argv.
procedure Append_Argument (
Command_Line : in out String;
Last : in out Natural;
Argument : String);
-- Child process type
type Process is new C.sys.types.pid_t;
Null_Process : constant Process := -1;
-- Child process management
function Is_Open (Child : Process) return Boolean;
pragma Inline (Is_Open);
Process_Disable_Controlled : constant Boolean := True;
procedure Create (
Child : in out Process;
Command : Command_Type;
Directory : String := "";
Search_Path : Boolean := False;
Input : Ada.Streams.Naked_Stream_IO.Non_Controlled_File_Type;
Output : Ada.Streams.Naked_Stream_IO.Non_Controlled_File_Type;
Error : Ada.Streams.Naked_Stream_IO.Non_Controlled_File_Type);
procedure Create (
Child : in out Process;
Command_Line : String;
Directory : String := "";
Search_Path : Boolean := False;
Input : Ada.Streams.Naked_Stream_IO.Non_Controlled_File_Type;
Output : Ada.Streams.Naked_Stream_IO.Non_Controlled_File_Type;
Error : Ada.Streams.Naked_Stream_IO.Non_Controlled_File_Type);
procedure Close (Child : in out Process) is null;
pragma Inline (Close); -- [gcc-7] can not skip calling null procedure
procedure Wait (
Child : in out Process;
Status : out Ada.Command_Line.Exit_Status);
procedure Wait_Immediate (
Child : in out Process;
Terminated : out Boolean;
Status : out Ada.Command_Line.Exit_Status);
procedure Abort_Process (Child : Process);
procedure Forced_Abort_Process (Child : Process);
-- Pass a command to the shell
procedure Shell (
Command : Command_Type;
Status : out Ada.Command_Line.Exit_Status);
procedure Shell (
Command_Line : String;
Status : out Ada.Command_Line.Exit_Status);
-- Exceptions
Name_Error : exception
renames Ada.IO_Exceptions.Name_Error;
Use_Error : exception
renames Ada.IO_Exceptions.Use_Error;
Device_Error : exception
renames Ada.IO_Exceptions.Device_Error;
end System.Native_Processes;
|
-- C38005A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT ALL (UNINITIALIZED) ACCESS OBJECTS ARE INITIALIZED
-- TO NULL BY DEFAULT. VARIABLES, ARRAYS, RECORDS, ARRAYS OF RECORDS,
-- ARRAYS OF ARRAYS, RECORDS WITH ARRAYS AND RECORD COMPONENTS
-- ARE ALL CHECKED.
-- FUNCTION RESULTS (I.E. RETURNED FROM IMPLICIT FUNCTION RETURN)
-- ARE NOT CHECKED.
-- DAT 3/6/81
-- VKG 1/5/83
-- SPS 2/17/83
WITH REPORT; USE REPORT;
PROCEDURE C38005A IS
TYPE REC;
TYPE ACC_REC IS ACCESS REC;
TYPE VECTOR IS ARRAY ( NATURAL RANGE <> ) OF ACC_REC;
TYPE REC IS RECORD
VECT : VECTOR (3 .. 5);
END RECORD;
TYPE ACC_VECT IS ACCESS VECTOR;
TYPE ARR_REC IS ARRAY (1 .. 2) OF REC;
TYPE REC2;
TYPE ACC_REC2 IS ACCESS REC2;
TYPE REC2 IS RECORD
C1 : ACC_REC;
C2 : ACC_VECT;
C3 : ARR_REC;
C4 : REC;
C5 : ACC_REC2;
END RECORD;
N_REC : REC;
N_ACC_REC : ACC_REC;
N_VEC : VECTOR (3 .. IDENT_INT (5));
N_ACC_VECT : ACC_VECT;
N_ARR_REC : ARR_REC;
N_REC2 : REC2;
N_ACC_REC2 : ACC_REC2;
N_ARR : ARRAY (1..2) OF VECTOR (1..2);
Q : REC2 :=
(C1 => NEW REC,
C2 => NEW VECTOR'(NEW REC, NEW REC'(N_REC)),
C3 => (1 | 2 => (VECT=>(3|4=> NEW REC,
5=>N_ACC_REC)
)),
C4 => N_REC2.C4,
C5 => NEW REC2'(N_REC2));
BEGIN
TEST ("C38005A", "DEFAULT VALUE FOR ACCESS OBJECTS IS NULL");
IF N_REC /= REC'(VECT => (3..5 => NULL))
THEN
FAILED ("INCORRECT ACCESS TYPE INITIALIZATION - 1");
END IF;
IF N_ACC_REC /= NULL
THEN
FAILED ("INCORRECT ACCESS TYPE INITIALIZATION - 2");
END IF;
IF N_VEC /= N_REC.VECT
THEN
FAILED ("INCORRECT ACCESS TYPE INITIALIZATION - 3");
END IF;
IF N_ARR /= ((NULL, NULL), (NULL, NULL))
THEN
FAILED ("INCORRECT ACCESS TYPE INITIALIZATION - 4");
END IF;
IF N_ACC_VECT /= NULL
THEN
FAILED ("INCORRECT ACCESS TYPE INITIALIZATION - 5");
END IF;
IF N_ARR_REC /= (N_REC, N_REC)
THEN
FAILED ("INCORRECT ACCESS TYPE INITIALIZATION - 6");
END IF;
IF N_REC2 /= (NULL, NULL, N_ARR_REC, N_REC, NULL)
THEN
FAILED ("INCORRECT ACCESS TYPE INITIALIZATION - 7");
END IF;
IF N_ACC_REC2 /= NULL
THEN
FAILED ("INCORRECT ACCESS TYPE INITIALIZATION - 8");
END IF;
IF Q /= (Q.C1, Q.C2, (Q.C3(1), Q.C3(2)), N_REC, Q.C5)
THEN
FAILED ("INCORRECT ACCESS TYPE INITIALIZATION - 9");
END IF;
IF Q.C1.ALL /= N_REC
THEN
FAILED ("INCORRECT ACCESS TYPE INITIALIZATION - 10");
END IF;
IF Q.C2.ALL(0).ALL /= N_REC
THEN
FAILED ("INCORRECT ACCESS TYPE INITIALIZATION - 11");
END IF;
IF Q.C2(1).VECT /= N_VEC
THEN
FAILED ("INCORRECT ACCESS TYPE INITIALIZATION - 12");
END IF;
IF Q.C3(2).VECT /= (3 => Q.C3(2).VECT(3),
4 => Q.C3(2).VECT(4),
5=>NULL)
THEN
FAILED ("INCORRECT ACCESS TYPE INITIALIZATION - 13");
END IF;
IF Q.C3(2).VECT(3).ALL /= N_REC
THEN
FAILED ("INCORRECT ACCESS TYPE INITIALIZATION - 14");
END IF;
IF Q.C5.ALL /= N_REC2
THEN
FAILED ("INCORRECT ACCESS TYPE INITIALIZATION - 15");
END IF;
DECLARE
PROCEDURE T (R : OUT REC2) IS
BEGIN
NULL;
END T;
BEGIN
N_REC2 := Q;
T(Q);
IF Q /= N_REC2 THEN
FAILED ("INCORRECT OUT PARM INIT 2");
END IF;
END;
RESULT;
END C38005A;
|
package Agar.Core.Config is
function Load return Boolean;
function Save return Boolean;
end Agar.Core.Config;
|
-----------------------------------------------------------------------
-- are-generator-c-tests -- Tests for C generator
-- Copyright (C) 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.Directories;
with Util.Test_Caller;
package body Are.Generator.C.Tests is
Expect_Dir : constant String := "regtests/expect/c/";
function Tool return String;
package Caller is new Util.Test_Caller (Test, "Are.Generator.C");
function Tool return String is
begin
return "bin/are" & Are.Testsuite.EXE;
end Tool;
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test Are.Generate_C1",
Test_Generate_C1'Access);
Caller.Add_Test (Suite, "Test Are.Generate_C2",
Test_Generate_C2'Access);
Caller.Add_Test (Suite, "Test Are.Generate_Lines",
Test_Generate_Lines'Access);
end Add_Tests;
procedure Test_Generate_C1 (T : in out Test) is
Dir : constant String := Util.Tests.Get_Test_Path ("");
Web : constant String := "regtests/files/test-c-1/web";
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
-- Generate the resources.ad[bs] files
T.Execute (Tool & " --lang=c -o " & Dir & " --name-access "
& "--resource=Resources1 --fileset '**/*' "
& Web, Result);
T.Assert (Ada.Directories.Exists (Ada.Directories.Compose (Dir, "resources1.h")),
"Resource file 'resources1.h' not generated");
T.Assert (Ada.Directories.Exists (Ada.Directories.Compose (Dir, "resources1.c")),
"Resource file 'resources1.c' not generated");
-- Build the test program.
T.Execute ("make -C regtests/files/test-c-1", Result);
T.Assert (Ada.Directories.Exists ("bin/test-c-1" & Are.Testsuite.EXE),
"Binary file 'bin/test-c-1' not created");
T.Execute ("bin/test-c-1" & Are.Testsuite.EXE, Result);
Util.Tests.Assert_Matches (T, "PASS: body { background: #eee; }p"
& " { color: #2a2a2a; }", Result,
"Invalid generation");
end Test_Generate_C1;
procedure Test_Generate_C2 (T : in out Test) is
Dir : constant String := Util.Tests.Get_Test_Path ("");
Web : constant String := "regtests/files/test-c-2/web";
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
-- Generate the resources.ad[bs] files
T.Execute (Tool & " --lang=c -o " & Dir
& " --name-access --var-prefix Id_ --resource=Resources2 --fileset '**/*' "
& Web, Result);
T.Assert (Ada.Directories.Exists (Ada.Directories.Compose (Dir, "resources2.h")),
"Resource file 'resources2.h' not generated");
T.Assert (Ada.Directories.Exists (Ada.Directories.Compose (Dir, "resources2.c")),
"Resource file 'resources2.c' not generated");
-- Build the test program.
T.Execute ("make -C regtests/files/test-c-2", Result);
T.Assert (Ada.Directories.Exists ("bin/test-c-2" & Are.Testsuite.EXE),
"Binary file 'bin/test-c-2' not created");
T.Execute ("bin/test-c-2" & Are.Testsuite.EXE, Result);
Util.Tests.Assert_Matches (T, "PASS: body { background: #eee; }p"
& " { color: #2a2a2a; }", Result,
"Invalid generation");
end Test_Generate_C2;
procedure Test_Generate_Lines (T : in out Test) is
Dir : constant String := Util.Tests.Get_Test_Path ("");
Rule : constant String := "regtests/files/package-lines.xml";
Files : constant String := "regtests/files";
Lines_H : constant String := Ada.Directories.Compose (Dir, "lines.h");
Lines_C : constant String := Ada.Directories.Compose (Dir, "lines.c");
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
-- Generate the lines.ads files
T.Execute (Tool & " -o " & Dir & " --lang=c --content-only --var-prefix Id_ --rule="
& Rule & " " & Files & "/lines-empty", Result);
T.Assert (Ada.Directories.Exists (Lines_H),
"Resource file 'lines.h' not generated");
Util.Tests.Assert_Equal_Files
(T => T,
Expect => Util.Tests.Get_Path (Expect_Dir & "lines-empty.h"),
Test => Lines_H,
Message => "Invalid lines-empty.h generation");
T.Assert (Ada.Directories.Exists (Lines_C),
"Resource file 'lines.c' not generated");
Util.Tests.Assert_Equal_Files
(T => T,
Expect => Util.Tests.Get_Path (Expect_Dir & "lines-empty.c"),
Test => Lines_C,
Message => "Invalid lines-empty.c generation");
Ada.Directories.Delete_File (Lines_H);
Ada.Directories.Delete_File (Lines_C);
T.Execute (Tool & " -o " & Dir & " --lang=c --content-only --var-prefix Id_ --rule="
& Rule & " " & Files & "/lines-single", Result);
T.Assert (Ada.Directories.Exists (Lines_H),
"Resource file 'lines.h' not generated");
Util.Tests.Assert_Equal_Files
(T => T,
Expect => Util.Tests.Get_Path (Expect_Dir & "lines-single.h"),
Test => Lines_H,
Message => "Invalid lines-single.h generation");
T.Assert (Ada.Directories.Exists (Lines_C),
"Resource file 'lines.c' not generated");
Util.Tests.Assert_Equal_Files
(T => T,
Expect => Util.Tests.Get_Path (Expect_Dir & "lines-single.c"),
Test => Lines_C,
Message => "Invalid lines-single.c generation");
Ada.Directories.Delete_File (Lines_H);
Ada.Directories.Delete_File (Lines_C);
T.Execute (Tool & " -o " & Dir & " --lang=c --content-only --var-prefix Id_ --rule="
& Rule & " " & Files & "/lines-multiple", Result);
T.Assert (Ada.Directories.Exists (Lines_H),
"Resource file 'lines.h' not generated");
Util.Tests.Assert_Equal_Files
(T => T,
Expect => Util.Tests.Get_Path (Expect_Dir & "lines-multiple.h"),
Test => Lines_H,
Message => "Invalid lines-multiple.h generation");
T.Assert (Ada.Directories.Exists (Lines_C),
"Resource file 'lines.c' not generated");
Util.Tests.Assert_Equal_Files
(T => T,
Expect => Util.Tests.Get_Path (Expect_Dir & "lines-multiple.c"),
Test => Lines_C,
Message => "Invalid lines-multiple.c generation");
end Test_Generate_Lines;
end Are.Generator.C.Tests;
|
------------------------------------------------------------------------------
-- Copyright (c) 2014, 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 System.Storage_Pools;
with GNAT.Debug_Pools;
with Natools.S_Expressions.Atom_Buffers;
with Natools.S_Expressions.Caches;
with Natools.S_Expressions.Generic_Caches;
with Natools.S_Expressions.Lockable.Tests;
with Natools.S_Expressions.Parsers;
with Natools.S_Expressions.Printers;
with Natools.S_Expressions.Test_Tools;
package body Natools.S_Expressions.Cache_Tests is
Pool : GNAT.Debug_Pools.Debug_Pool;
package Debug_Caches is new Generic_Caches
(System.Storage_Pools.Root_Storage_Pool'Class (Pool),
System.Storage_Pools.Root_Storage_Pool'Class (Pool),
System.Storage_Pools.Root_Storage_Pool'Class (Pool));
procedure Inject_Test (Printer : in out Printers.Printer'Class);
-- Inject test S-expression into Pr
function Canonical_Test return Atom;
-- Return canonical encoding of test S-expression above
------------------------
-- Helper Subprograms --
------------------------
function Canonical_Test return Atom is
begin
return To_Atom ("5:begin(()(4:head4:tail))3:end");
end Canonical_Test;
procedure Inject_Test (Printer : in out Printers.Printer'Class) is
begin
Printer.Append_Atom (To_Atom ("begin"));
Printer.Open_List;
Printer.Open_List;
Printer.Close_List;
Printer.Open_List;
Printer.Append_Atom (To_Atom ("head"));
Printer.Append_Atom (To_Atom ("tail"));
Printer.Close_List;
Printer.Close_List;
Printer.Append_Atom (To_Atom ("end"));
end Inject_Test;
-------------------------
-- Complete Test Suite --
-------------------------
procedure All_Tests (Report : in out NT.Reporter'Class) is
begin
Default_Instantiation (Report);
Debug_Instantiation (Report);
Descriptor_Interface (Report);
Lockable_Interface (Report);
Replayable_Interface (Report);
Duplication (Report);
end All_Tests;
-----------------------
-- Inidividual Tests --
-----------------------
procedure Debug_Instantiation (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Debug instantiation");
Buffer : Atom_Buffers.Atom_Buffer;
procedure Put (S : in String);
procedure Put_Line (S : in String);
procedure Flush;
procedure Info_Pool;
procedure Put (S : in String) is
begin
Buffer.Append (To_Atom (S));
end Put;
procedure Put_Line (S : in String) is
begin
Test.Info (To_String (Buffer.Data) & S);
Buffer.Soft_Reset;
end Put_Line;
procedure Flush is
begin
if Buffer.Length > 0 then
Test.Info (To_String (Buffer.Data));
end if;
Buffer.Hard_Reset;
end Flush;
procedure Info_Pool is
procedure Print_Info is new GNAT.Debug_Pools.Print_Info;
begin
Print_Info (Pool);
Flush;
end Info_Pool;
begin
declare
Cache, Deep, Shallow : Debug_Caches.Reference;
begin
declare
Empty_Cursor : Debug_Caches.Cursor := Deep.First;
Event : Events.Event;
begin
Event := Empty_Cursor.Current_Event;
if Event /= Events.End_Of_Input then
Test.Fail ("Unexpected Empty_Cursor.Current_Event "
& Events.Event'Image (Event)
& " (expected End_Of_Input)");
end if;
Test_Tools.Next_And_Check
(Test, Empty_Cursor, Events.End_Of_Input, 0);
end;
Inject_Test (Cache);
declare
First : Debug_Caches.Cursor := Cache.First;
Output : aliased Test_Tools.Memory_Stream;
Pr : Printers.Canonical (Output'Access);
begin
Output.Set_Expected (Canonical_Test);
Printers.Transfer (First, Pr);
Output.Check_Stream (Test);
end;
Deep := Cache.Duplicate;
Shallow := Deep;
Deep.Append_Atom (To_Atom ("more"));
declare
Other : Debug_Caches.Cursor := Deep.First;
Output : aliased Test_Tools.Memory_Stream;
Pr : Printers.Canonical (Output'Access);
begin
Output.Set_Expected (Canonical_Test & To_Atom ("4:more"));
Printers.Transfer (Other, Pr);
Output.Check_Stream (Test);
end;
declare
Second : Debug_Caches.Cursor := Cache.First;
Output : aliased Test_Tools.Memory_Stream;
Pr : Printers.Canonical (Output'Access);
begin
Output.Set_Expected (Canonical_Test);
Printers.Transfer (Second, Pr);
Output.Check_Stream (Test);
end;
declare
Second_Other : Debug_Caches.Cursor := Shallow.First;
Output : aliased Test_Tools.Memory_Stream;
Pr : Printers.Canonical (Output'Access);
begin
Output.Set_Expected (Canonical_Test & To_Atom ("4:more"));
Printers.Transfer (Second_Other, Pr);
Output.Check_Stream (Test);
end;
end;
Info_Pool;
exception
when Error : others => Test.Report_Exception (Error);
end Debug_Instantiation;
procedure Default_Instantiation (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Default instantiation");
begin
declare
Cache, Deep, Shallow : Caches.Reference;
begin
declare
Empty_Cursor : Caches.Cursor := Deep.First;
Event : Events.Event;
begin
Event := Empty_Cursor.Current_Event;
if Event /= Events.End_Of_Input then
Test.Fail ("Unexpected Empty_Cursor.Current_Event "
& Events.Event'Image (Event)
& " (expected End_Of_Input)");
end if;
Test_Tools.Next_And_Check
(Test, Empty_Cursor, Events.End_Of_Input, 0);
end;
Inject_Test (Cache);
declare
First : Caches.Cursor := Cache.First;
Output : aliased Test_Tools.Memory_Stream;
Pr : Printers.Canonical (Output'Access);
begin
Output.Set_Expected (Canonical_Test);
Printers.Transfer (First, Pr);
Output.Check_Stream (Test);
end;
Deep := Cache.Duplicate;
Shallow := Deep;
Deep.Append_Atom (To_Atom ("more"));
declare
Other : Caches.Cursor := Deep.First;
Output : aliased Test_Tools.Memory_Stream;
Pr : Printers.Canonical (Output'Access);
begin
Output.Set_Expected (Canonical_Test & To_Atom ("4:more"));
Printers.Transfer (Other, Pr);
Output.Check_Stream (Test);
end;
declare
Second : Caches.Cursor := Cache.First;
Output : aliased Test_Tools.Memory_Stream;
Pr : Printers.Canonical (Output'Access);
begin
Output.Set_Expected (Canonical_Test);
Printers.Transfer (Second, Pr);
Output.Check_Stream (Test);
end;
declare
Second_Other : Caches.Cursor := Shallow.First;
Output : aliased Test_Tools.Memory_Stream;
Pr : Printers.Canonical (Output'Access);
begin
Output.Set_Expected (Canonical_Test & To_Atom ("4:more"));
Printers.Transfer (Second_Other, Pr);
Output.Check_Stream (Test);
end;
end;
exception
when Error : others => Test.Report_Exception (Error);
end Default_Instantiation;
procedure Descriptor_Interface (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Descriptor insterface");
begin
declare
Cache : Caches.Reference;
First, Second : Caches.Cursor;
begin
Cache.Append_Atom (To_Atom ("begin"));
Cache.Open_List;
Cache.Append_Atom (To_Atom ("command"));
Cache.Open_List;
Cache.Append_Atom (To_Atom ("first"));
Cache.Append_Atom (To_Atom ("second"));
Cache.Close_List;
Cache.Close_List;
Cache.Append_Atom (To_Atom ("end"));
First := Cache.First;
Second := First;
Test_Tools.Test_Atom_Accessors (Test, First, To_Atom ("begin"), 0);
Test_Tools.Test_Atom_Accessors (Test, Second, To_Atom ("begin"), 0);
Test_Tools.Next_And_Check (Test, First, Events.Open_List, 1);
Test_Tools.Test_Atom_Accessor_Exceptions (Test, First);
Test_Tools.Next_And_Check (Test, First, To_Atom ("command"), 1);
Test_Tools.Next_And_Check (Test, First, Events.Open_List, 2);
Test_Tools.Next_And_Check (Test, Second, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, First, To_Atom ("first"), 2);
Test_Tools.Next_And_Check (Test, Second, To_Atom ("command"), 1);
Test_Tools.Next_And_Check (Test, First, To_Atom ("second"), 2);
Test_Tools.Next_And_Check (Test, First, Events.Close_List, 1);
Test_Tools.Next_And_Check (Test, Second, Events.Open_List, 2);
Test_Tools.Next_And_Check (Test, Second, To_Atom ("first"), 2);
Test_Tools.Next_And_Check (Test, Second, To_Atom ("second"), 2);
Test_Tools.Next_And_Check (Test, First, Events.Close_List, 0);
Test_Tools.Next_And_Check (Test, Second, Events.Close_List, 1);
Test_Tools.Test_Atom_Accessor_Exceptions (Test, Second);
Test_Tools.Next_And_Check (Test, Second, Events.Close_List, 0);
Test_Tools.Next_And_Check (Test, Second, To_Atom ("end"), 0);
Test_Tools.Next_And_Check (Test, First, To_Atom ("end"), 0);
Test_Tools.Next_And_Check (Test, First, Events.End_Of_Input, 0);
Test_Tools.Next_And_Check (Test, Second, Events.End_Of_Input, 0);
end;
exception
when Error : others => Test.Report_Exception (Error);
end Descriptor_Interface;
procedure Duplication (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Duplication of general descriptor");
begin
Full_Duplication :
declare
Input : aliased Test_Tools.Memory_Stream;
Parser : Parsers.Stream_Parser (Input'Access);
begin
Input.Set_Data (Lockable.Tests.Test_Expression);
Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 1);
declare
Image : Caches.Cursor := Caches.Move (Parser);
begin
Lockable.Tests.Test_Interface (Test, Image);
end;
end Full_Duplication;
Partial_Duplication :
declare
Input : aliased Test_Tools.Memory_Stream;
Parser : Parsers.Stream_Parser (Input'Access);
Copy : Caches.Cursor;
begin
Input.Set_Data (To_Atom
("(first_part (command-1) (command-2 arg-1 arg-2) end)"
& "(second_part (command-3 arg-3) final)"));
Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, Parser, To_Atom ("first_part"), 1);
Copy := Caches.Move (Parser);
Test_Tools.Test_Atom_Accessors
(Test, Copy, To_Atom ("first_part"), 0);
Test_Tools.Next_And_Check (Test, Copy, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, Copy, To_Atom ("command-1"), 1);
Test_Tools.Next_And_Check (Test, Copy, Events.Close_List, 0);
Test_Tools.Next_And_Check (Test, Copy, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, Copy, To_Atom ("command-2"), 1);
Test_Tools.Next_And_Check (Test, Copy, To_Atom ("arg-1"), 1);
Test_Tools.Next_And_Check (Test, Copy, To_Atom ("arg-2"), 1);
Test_Tools.Next_And_Check (Test, Copy, Events.Close_List, 0);
Test_Tools.Next_And_Check (Test, Copy, To_Atom ("end"), 0);
Test_Tools.Next_And_Check (Test, Copy, Events.End_Of_Input, 0);
Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, Parser, To_Atom ("second_part"), 1);
Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 2);
Test_Tools.Next_And_Check (Test, Parser, To_Atom ("command-3"), 2);
Test_Tools.Next_And_Check (Test, Parser, To_Atom ("arg-3"), 2);
Test_Tools.Next_And_Check (Test, Parser, Events.Close_List, 1);
Test_Tools.Next_And_Check (Test, Parser, To_Atom ("final"), 1);
Test_Tools.Next_And_Check (Test, Parser, Events.Close_List, 0);
end Partial_Duplication;
exception
when Error : others => Test.Report_Exception (Error);
end Duplication;
procedure Lockable_Interface (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Lockable.Descriptor insterface");
begin
declare
Cache : Caches.Reference;
begin
declare
Input : aliased Test_Tools.Memory_Stream;
Parser : Parsers.Stream_Parser (Input'Access);
begin
Input.Set_Data (Lockable.Tests.Test_Expression);
Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 1);
Printers.Transfer (Parser, Cache);
end;
declare
Cursor : Caches.Cursor := Cache.First;
begin
Lockable.Tests.Test_Interface (Test, Cursor);
end;
end;
exception
when Error : others => Test.Report_Exception (Error);
end Lockable_Interface;
procedure Replayable_Interface (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Replayable.Descriptor insterface");
begin
declare
Cache : Caches.Reference;
First, Second : Caches.Cursor;
begin
Cache.Append_Atom (To_Atom ("begin"));
Cache.Open_List;
Cache.Append_Atom (To_Atom ("command"));
Cache.Open_List;
Cache.Append_Atom (To_Atom ("first"));
Cache.Append_Atom (To_Atom ("second"));
Cache.Close_List;
Cache.Close_List;
Cache.Append_Atom (To_Atom ("end"));
First := Cache.First;
Test_Tools.Test_Atom_Accessors (Test, First, To_Atom ("begin"), 0);
Test_Tools.Next_And_Check (Test, First, Events.Open_List, 1);
Test_Tools.Test_Atom_Accessor_Exceptions (Test, First);
Test_Tools.Next_And_Check (Test, First, To_Atom ("command"), 1);
Second := First.Duplicate;
Test_Tools.Next_And_Check (Test, First, Events.Open_List, 2);
Test_Tools.Next_And_Check (Test, First, To_Atom ("first"), 2);
Test_Tools.Next_And_Check (Test, First, To_Atom ("second"), 2);
Test_Tools.Next_And_Check (Test, First, Events.Close_List, 1);
Test_Tools.Next_And_Check (Test, Second, Events.Open_List, 2);
Test_Tools.Next_And_Check (Test, Second, To_Atom ("first"), 2);
Test_Tools.Next_And_Check (Test, Second, To_Atom ("second"), 2);
Test_Tools.Next_And_Check (Test, First, Events.Close_List, 0);
Test_Tools.Next_And_Check (Test, Second, Events.Close_List, 1);
Test_Tools.Test_Atom_Accessor_Exceptions (Test, Second);
Test_Tools.Next_And_Check (Test, Second, Events.Close_List, 0);
Test_Tools.Next_And_Check (Test, Second, To_Atom ("end"), 0);
Test_Tools.Next_And_Check (Test, First, To_Atom ("end"), 0);
Test_Tools.Next_And_Check (Test, First, Events.End_Of_Input, 0);
Test_Tools.Next_And_Check (Test, Second, Events.End_Of_Input, 0);
end;
exception
when Error : others => Test.Report_Exception (Error);
end Replayable_Interface;
end Natools.S_Expressions.Cache_Tests;
|
pragma License (Unrestricted);
-- implementation unit specialized for POSIX (Darwin, FreeBSD, or Linux)
private with C.pthread;
package System.Synchronous_Objects is
pragma Preelaborate;
-- mutex
type Mutex is limited private;
procedure Initialize (Object : in out Mutex);
procedure Finalize (Object : in out Mutex);
procedure Enter (Object : in out Mutex);
procedure Leave (Object : in out Mutex);
-- condition variable (pthread only)
type Condition_Variable is limited private;
procedure Initialize (Object : in out Condition_Variable);
procedure Finalize (Object : in out Condition_Variable);
procedure Notify_All (Object : in out Condition_Variable);
procedure Wait (
Object : in out Condition_Variable;
Mutex : in out Synchronous_Objects.Mutex);
-- queue
type Mutex_Access is access all Mutex;
for Mutex_Access'Storage_Size use 0;
type Queue_Node is limited private;
type Queue_Node_Access is access all Queue_Node;
type Queue_Filter is access function (
Item : not null Queue_Node_Access;
Params : Address)
return Boolean;
type Queue is limited private;
procedure Initialize (
Object : in out Queue;
Mutex : not null Mutex_Access);
procedure Finalize (Object : in out Queue);
function Count (
Object : Queue;
Params : Address;
Filter : Queue_Filter)
return Natural;
function Unsynchronized_Count (
Object : Queue;
Params : Address;
Filter : Queue_Filter)
return Natural;
function Canceled (Object : Queue) return Boolean;
procedure Cancel (
Object : in out Queue;
Cancel_Node : access procedure (X : in out Queue_Node_Access));
procedure Unsynchronized_Prepend (
Object : in out Queue;
Item : not null Queue_Node_Access;
Canceled : out Boolean);
procedure Add (
Object : in out Queue;
Item : not null Queue_Node_Access;
Canceled : out Boolean);
procedure Take (
Object : in out Queue;
Item : out Queue_Node_Access;
Params : Address;
Filter : Queue_Filter);
-- no waiting
procedure Unsynchronized_Take (
Object : in out Queue;
Item : out Queue_Node_Access;
Params : Address;
Filter : Queue_Filter);
pragma Inline (Canceled);
-- event
type Event is limited private;
procedure Initialize (Object : in out Event);
procedure Finalize (Object : in out Event);
function Get (Object : Event) return Boolean;
procedure Set (Object : in out Event);
procedure Reset (Object : in out Event);
procedure Wait (
Object : in out Event);
procedure Wait (
Object : in out Event;
Timeout : Duration;
Value : out Boolean);
-- multi-read/exclusive-write lock for protected
type RW_Lock is limited private;
procedure Initialize (Object : in out RW_Lock);
procedure Finalize (Object : in out RW_Lock);
procedure Enter_Reading (Object : in out RW_Lock);
procedure Enter_Writing (Object : in out RW_Lock);
procedure Leave (Object : in out RW_Lock); -- leave reading or writing
private
type Mutex is limited record
Handle : aliased C.pthread.pthread_mutex_t;
end record;
pragma Suppress_Initialization (Mutex);
type Condition_Variable is limited record
Handle : aliased C.pthread.pthread_cond_t;
end record;
pragma Suppress_Initialization (Condition_Variable);
type Queue is limited record
Mutex : not null Mutex_Access;
Pipe : Synchronous_Objects.Event; -- count bytes in the pipe
Head : aliased Queue_Node_Access;
Tail : Queue_Node_Access;
Params : Address;
Filter : Queue_Filter;
Waiting : Boolean;
Canceled : Boolean;
end record;
pragma Suppress_Initialization (Queue);
type Queue_Node is limited record
Next : aliased Queue_Node_Access;
end record;
pragma Suppress_Initialization (Queue_Node);
procedure Take_No_Sync (
Object : in out Queue;
Item : out Queue_Node_Access;
Params : Address;
Filter : Queue_Filter;
Previous : in out Queue_Node_Access;
Current : in out Queue_Node_Access);
procedure Notify_All (
Object : in out Queue;
Item : not null Queue_Node_Access);
-- awake Abortable.Take
type Event is limited record
Reading_Pipe : C.signed_int;
Writing_Pipe : C.signed_int;
end record;
pragma Suppress_Initialization (Event);
procedure Read_1 (Reading_Pipe : C.signed_int);
procedure Write_1 (Writing_Pipe : C.signed_int);
type RW_Lock is limited record
Handle : aliased C.pthread.pthread_rwlock_t;
end record;
pragma Suppress_Initialization (RW_Lock);
end System.Synchronous_Objects;
|
-- Copyright (c) 2020-2021 Bartek thindil Jasicki <thindil@laeran.pl>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Ada.Containers.Generic_Array_Sort;
with GNAT.String_Split; use GNAT.String_Split;
with Tcl.Ada; use Tcl.Ada;
with Tcl.Tk.Ada; use Tcl.Tk.Ada;
with Tcl.Tk.Ada.Busy;
with Tcl.Tk.Ada.Grid;
with Tcl.Tk.Ada.Widgets; use Tcl.Tk.Ada.Widgets;
with Tcl.Tk.Ada.Widgets.Canvas; use Tcl.Tk.Ada.Widgets.Canvas;
with Tcl.Tk.Ada.Widgets.Menu; use Tcl.Tk.Ada.Widgets.Menu;
with Tcl.Tk.Ada.Widgets.Toplevel; use Tcl.Tk.Ada.Widgets.Toplevel;
with Tcl.Tk.Ada.Widgets.Toplevel.MainWindow;
use Tcl.Tk.Ada.Widgets.Toplevel.MainWindow;
with Tcl.Tk.Ada.Widgets.TtkButton; use Tcl.Tk.Ada.Widgets.TtkButton;
with Tcl.Tk.Ada.Widgets.TtkEntry.TtkComboBox;
use Tcl.Tk.Ada.Widgets.TtkEntry.TtkComboBox;
with Tcl.Tk.Ada.Widgets.TtkEntry.TtkSpinBox;
use Tcl.Tk.Ada.Widgets.TtkEntry.TtkSpinBox;
with Tcl.Tk.Ada.Widgets.TtkFrame; use Tcl.Tk.Ada.Widgets.TtkFrame;
with Tcl.Tk.Ada.Widgets.TtkLabel; use Tcl.Tk.Ada.Widgets.TtkLabel;
with Tcl.Tk.Ada.Widgets.TtkScrollbar; use Tcl.Tk.Ada.Widgets.TtkScrollbar;
with Tcl.Tk.Ada.Winfo; use Tcl.Tk.Ada.Winfo;
with Config; use Config;
with CoreUI; use CoreUI;
with Crew.Inventory; use Crew.Inventory;
with Dialogs; use Dialogs;
with Maps.UI; use Maps.UI;
with Messages; use Messages;
with Missions; use Missions;
with Ships.Cargo; use Ships.Cargo;
with Stories; use Stories;
with Table; use Table;
with Utils.UI; use Utils.UI;
package body Ships.UI.Cargo is
-- ****iv* SUCargo/SUCargo.CargoTable
-- FUNCTION
-- Table with info about the player ship cargo
-- SOURCE
CargoTable: Table_Widget (5);
-- ****
-- ****iv* SUCargo/SUCargo.Cargo_Indexes
-- FUNCTION
-- Indexes of the player ship cargo
-- SOURCE
Cargo_Indexes: Positive_Container.Vector;
-- ****
-- ****o* SUCargo/SUCargo.Show_Cargo_Command
-- FUNCTION
-- Show the cargo of the player ship
-- PARAMETERS
-- ClientData - Custom data send to the command. Unused
-- Interp - Tcl interpreter in which command was executed.
-- Argc - Number of arguments passed to the command.
-- Argv - Values of arguments passed to the command.
-- RESULT
-- This function always return TCL_OK
-- COMMANDS
-- ShowCargo ?page?
-- Optional paramater page is the number of the page of cargo list to show
-- SOURCE
function Show_Cargo_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
Convention => C;
-- ****
function Show_Cargo_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is
pragma Unreferenced(ClientData);
ShipCanvas: constant Tk_Canvas :=
Get_Widget(Main_Paned & ".shipinfoframe.cargo.canvas", Interp);
CargoInfoFrame: constant Ttk_Frame :=
Get_Widget(ShipCanvas & ".frame", Interp);
Tokens: Slice_Set;
Rows: Natural := 0;
ItemType, ProtoIndex: Unbounded_String;
ItemsTypes: Unbounded_String := To_Unbounded_String("All");
TypeBox: constant Ttk_ComboBox :=
Get_Widget(CargoInfoFrame & ".selecttype.combo", Interp);
ItemsType: constant String := Get(TypeBox);
Page: constant Positive :=
(if Argc = 2 then Positive'Value(CArgv.Arg(Argv, 1)) else 1);
Start_Row: constant Positive :=
((Page - 1) * Game_Settings.Lists_Limit) + 1;
Current_Row: Positive := 1;
Free_Space_Label: constant Ttk_Label :=
Get_Widget(CargoInfoFrame & ".freespace", Interp);
begin
Create(Tokens, Tcl.Tk.Ada.Grid.Grid_Size(CargoInfoFrame), " ");
Rows := Natural'Value(Slice(Tokens, 2));
Delete_Widgets(3, Rows - 1, CargoInfoFrame);
CargoTable :=
CreateTable
(Widget_Image(CargoInfoFrame),
(To_Unbounded_String("Name"), To_Unbounded_String("Durability"),
To_Unbounded_String("Type"), To_Unbounded_String("Amount"),
To_Unbounded_String("Weight")),
Get_Widget(Main_Paned & ".shipinfoframe.cargo.scrolly"),
"SortShipCargo", "Press mouse button to sort the cargo.");
if Cargo_Indexes.Length /= Player_Ship.Cargo.Length then
Cargo_Indexes.Clear;
for I in Player_Ship.Cargo.Iterate loop
Cargo_Indexes.Append(Inventory_Container.To_Index(I));
end loop;
end if;
configure
(Free_Space_Label,
"-text {Free cargo space:" & Integer'Image(FreeCargo(0)) & " kg}");
Load_Cargo_Loop :
for I of Cargo_Indexes loop
if Current_Row < Start_Row then
Current_Row := Current_Row + 1;
goto End_Of_Loop;
end if;
ProtoIndex := Player_Ship.Cargo(I).ProtoIndex;
ItemType :=
(if Items_List(ProtoIndex).ShowType /= Null_Unbounded_String then
Items_List(ProtoIndex).ShowType
else Items_List(ProtoIndex).IType);
if Index(ItemsTypes, "{" & To_String(ItemType) & "}") = 0 then
Append(ItemsTypes, " {" & To_String(ItemType) & "}");
end if;
if ItemsType /= "All" and then To_String(ItemType) /= ItemsType then
goto End_Of_Loop;
end if;
AddButton
(CargoTable, GetItemName(Player_Ship.Cargo(I)),
"Show available item's options",
"ShowCargoMenu" & Positive'Image(I), 1);
AddProgressBar
(CargoTable, Player_Ship.Cargo(I).Durability,
Default_Item_Durability,
"The current durability of the selected crew member",
"ShowCargoMenu" & Positive'Image(I), 2);
AddButton
(CargoTable, To_String(ItemType), "The type of the selected item",
"ShowCargoMenu" & Positive'Image(I), 3);
AddButton
(CargoTable, Positive'Image(Player_Ship.Cargo(I).Amount),
"The amount of the selected item",
"ShowCargoMenu" & Positive'Image(I), 4);
AddButton
(CargoTable,
Positive'Image
(Player_Ship.Cargo(I).Amount * Items_List(ProtoIndex).Weight) &
" kg",
"The total weight of the selected item",
"ShowCargoMenu" & Positive'Image(I), 5, True);
exit Load_Cargo_Loop when CargoTable.Row =
Game_Settings.Lists_Limit + 1;
<<End_Of_Loop>>
end loop Load_Cargo_Loop;
if Page > 1 then
AddPagination
(CargoTable, "ShowCargo" & Positive'Image(Page - 1),
(if CargoTable.Row < Game_Settings.Lists_Limit + 1 then ""
else "ShowCargo" & Positive'Image(Page + 1)));
elsif CargoTable.Row = Game_Settings.Lists_Limit + 1 then
AddPagination(CargoTable, "", "ShowCargo" & Positive'Image(Page + 1));
end if;
UpdateTable(CargoTable);
configure(TypeBox, "-values [list " & To_String(ItemsTypes) & "]");
Tcl_Eval(Get_Context, "update");
configure
(ShipCanvas, "-scrollregion [list " & BBox(ShipCanvas, "all") & "]");
Xview_Move_To(ShipCanvas, "0.0");
Yview_Move_To(ShipCanvas, "0.0");
return TCL_OK;
end Show_Cargo_Command;
-- ****it* SUCargo/SUCargo.Cargo_Sort_Orders
-- FUNCTION
-- Sorting orders for the player ship cargo
-- OPTIONS
-- NAMEASC - Sort items by name ascending
-- NAMEDESC - Sort items by name descending
-- DURABILITYASC - Sort items by durability ascending
-- DURABILITYDESC - Sort items by durability descending
-- TYPEASC - Sort items by type ascending
-- TYPEDESC - Sort items by type descending
-- AMOUNTASC - Sort items by amount ascending
-- AMOUNTDESC - Sort items by amount descending
-- WEIGHTASC - Sort items by total weight ascending
-- WEIGHTDESC - Sort items by total weight descending
-- NONE - No sorting items (default)
-- HISTORY
-- 6.4 - Added
-- SOURCE
type Cargo_Sort_Orders is
(NAMEASC, NAMEDESC, DURABILITYASC, DURABILITYDESC, TYPEASC, TYPEDESC,
AMOUNTASC, AMOUNTDESC, WEIGHTASC, WEIGHTDESC, NONE) with
Default_Value => NONE;
-- ****
-- ****id* SUCargo/SUCargo.Default_Cargo_Sort_Order
-- FUNCTION
-- Default sorting order for items in the player's ship cargo
-- HISTORY
-- 6.4 - Added
-- SOURCE
Default_Cargo_Sort_Order: constant Cargo_Sort_Orders := NONE;
-- ****
-- ****iv* SUCargo/SUCargo.Cargo_Sort_Order
-- FUNCTION
-- The current sorting order of items in the player's ship cargo
-- SOURCE
Cargo_Sort_Order: Cargo_Sort_Orders := Default_Cargo_Sort_Order;
-- ****
-- ****o* SUCargo/SUCargo.Sort_Cargo_Command
-- FUNCTION
-- Sort the player's ship's cargo list
-- PARAMETERS
-- ClientData - Custom data send to the command.
-- Interp - Tcl interpreter in which command was executed.
-- Argc - Number of arguments passed to the command. Unused
-- Argv - Values of arguments passed to the command.
-- RESULT
-- This function always return TCL_OK
-- COMMANDS
-- SortShipCargo x
-- X is X axis coordinate where the player clicked the mouse button
-- SOURCE
function Sort_Cargo_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
Convention => C;
-- ****
function Sort_Cargo_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is
pragma Unreferenced(Argc);
Column: constant Positive :=
(if CArgv.Arg(Argv, 1) = "-1" then Positive'Last
else Get_Column_Number
(CargoTable, Natural'Value(CArgv.Arg(Argv, 1))));
type Local_Cargo_Data is record
Name: Unbounded_String;
Damage: Float;
Item_Type: Unbounded_String;
Amount: Positive;
Weight: Positive;
Id: Positive;
end record;
type Cargo_Array is array(Positive range <>) of Local_Cargo_Data;
Local_Cargo: Cargo_Array(1 .. Positive(Player_Ship.Cargo.Length));
function "<"(Left, Right: Local_Cargo_Data) return Boolean is
begin
if Cargo_Sort_Order = NAMEASC and then Left.Name < Right.Name then
return True;
end if;
if Cargo_Sort_Order = NAMEDESC and then Left.Name > Right.Name then
return True;
end if;
if Cargo_Sort_Order = DURABILITYASC
and then Left.Damage < Right.Damage then
return True;
end if;
if Cargo_Sort_Order = DURABILITYDESC
and then Left.Damage > Right.Damage then
return True;
end if;
if Cargo_Sort_Order = TYPEASC
and then Left.Item_Type < Right.Item_Type then
return True;
end if;
if Cargo_Sort_Order = TYPEDESC
and then Left.Item_Type > Right.Item_Type then
return True;
end if;
if Cargo_Sort_Order = AMOUNTASC
and then Left.Amount < Right.Amount then
return True;
end if;
if Cargo_Sort_Order = AMOUNTDESC
and then Left.Amount > Right.Amount then
return True;
end if;
if Cargo_Sort_Order = WEIGHTASC
and then Left.Weight < Right.Weight then
return True;
end if;
if Cargo_Sort_Order = WEIGHTDESC
and then Left.Weight > Right.Weight then
return True;
end if;
return False;
end "<";
procedure Sort_Cargo is new Ada.Containers.Generic_Array_Sort
(Index_Type => Positive, Element_Type => Local_Cargo_Data,
Array_Type => Cargo_Array);
begin
case Column is
when 1 =>
if Cargo_Sort_Order = NAMEASC then
Cargo_Sort_Order := NAMEDESC;
else
Cargo_Sort_Order := NAMEASC;
end if;
when 2 =>
if Cargo_Sort_Order = DURABILITYASC then
Cargo_Sort_Order := DURABILITYDESC;
else
Cargo_Sort_Order := DURABILITYASC;
end if;
when 3 =>
if Cargo_Sort_Order = TYPEASC then
Cargo_Sort_Order := TYPEDESC;
else
Cargo_Sort_Order := TYPEASC;
end if;
when 4 =>
if Cargo_Sort_Order = AMOUNTASC then
Cargo_Sort_Order := AMOUNTDESC;
else
Cargo_Sort_Order := AMOUNTASC;
end if;
when 5 =>
if Cargo_Sort_Order = WEIGHTASC then
Cargo_Sort_Order := WEIGHTDESC;
else
Cargo_Sort_Order := WEIGHTASC;
end if;
when others =>
null;
end case;
if Cargo_Sort_Order = NONE then
return
Show_Cargo_Command
(ClientData, Interp, 1, CArgv.Empty & "ShowCargo");
end if;
for I in Player_Ship.Cargo.Iterate loop
Local_Cargo(Inventory_Container.To_Index(I)) :=
(Name =>
To_Unbounded_String
(GetItemName(Player_Ship.Cargo(I), False, False)),
Damage =>
Float(Player_Ship.Cargo(I).Durability) /
Float(Default_Item_Durability),
Item_Type =>
(if
Items_List(Player_Ship.Cargo(I).ProtoIndex).ShowType /=
Null_Unbounded_String
then Items_List(Player_Ship.Cargo(I).ProtoIndex).ShowType
else Items_List(Player_Ship.Cargo(I).ProtoIndex).IType),
Amount => Player_Ship.Cargo(I).Amount,
Weight =>
Player_Ship.Cargo(I).Amount *
Items_List(Player_Ship.Cargo(I).ProtoIndex).Weight,
Id => Inventory_Container.To_Index(I));
end loop;
Sort_Cargo(Local_Cargo);
Cargo_Indexes.Clear;
for Item of Local_Cargo loop
Cargo_Indexes.Append(Item.Id);
end loop;
return
Show_Cargo_Command(ClientData, Interp, 1, CArgv.Empty & "ShowCargo");
end Sort_Cargo_Command;
-- ****o* SUCargo/SUCargo.Show_Give_Item_Command
-- FUNCTION
-- Show UI to give the selected item from the ship cargo to the selected
-- crew member
-- PARAMETERS
-- ClientData - Custom data send to the command. Unused
-- Interp - Tcl interpreter in which command was executed. Unused
-- Argc - Number of arguments passed to the command. Unused
-- Argv - Values of arguments passed to the command.
-- RESULT
-- This function always return TCL_OK
-- COMMANDS
-- ShowGiveItem itemindex
-- Itemindex is the index of the item which will be set
-- SOURCE
function Show_Give_Item_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
Convention => C;
-- ****
function Show_Give_Item_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is
pragma Unreferenced(ClientData, Interp, Argc);
ItemIndex: constant Positive := Positive'Value(CArgv.Arg(Argv, 1));
ItemDialog: constant Ttk_Frame :=
Create_Dialog
(".itemdialog",
"Give " & GetItemName(Player_Ship.Cargo(ItemIndex)) &
" from the ship's cargo to the selected crew member",
370, 2);
Button: Ttk_Button :=
Create
(ItemDialog & ".givebutton",
"-text Give -command {GiveItem " & CArgv.Arg(Argv, 1) & "}");
Label: Ttk_Label;
AmountBox: constant Ttk_SpinBox :=
Create
(ItemDialog & ".giveamount",
"-width 15 -from 1 -to" &
Positive'Image(Player_Ship.Cargo(ItemIndex).Amount) &
" -validate key -validatecommand {CheckAmount %W" &
Positive'Image(ItemIndex) & " %P} -command {ValidateAmount " &
ItemDialog & ".giveamount" & Positive'Image(ItemIndex) & "}");
CrewBox: constant Ttk_ComboBox :=
Create(ItemDialog & ".member", "-state readonly -width 14");
MembersNames: Unbounded_String;
begin
Label := Create(ItemDialog & ".amountlbl", "-text {Amount:}");
Tcl.Tk.Ada.Grid.Grid(Label, "-pady {0 5}");
Set(AmountBox, "1");
Tcl.Tk.Ada.Grid.Grid(AmountBox, "-column 1 -row 1 -pady {0 5}");
Bind
(AmountBox, "<Escape>",
"{" & ItemDialog & ".cancelbutton invoke;break}");
Label := Create(ItemDialog & ".memberlbl", "-text {To:}");
Tcl.Tk.Ada.Grid.Grid(Label);
Load_Crew_Names_Loop :
for Member of Player_Ship.Crew loop
Append(MembersNames, " " & Member.Name);
end loop Load_Crew_Names_Loop;
configure(CrewBox, "-values [list" & To_String(MembersNames) & "]");
Current(CrewBox, "0");
Tcl.Tk.Ada.Grid.Grid(CrewBox, "-column 1 -row 2");
Bind
(CrewBox, "<Escape>",
"{" & ItemDialog & ".cancelbutton invoke;break}");
Label :=
Create
(ItemDialog & ".errorlbl",
"-style Headerred.TLabel -wraplength 370");
Tcl.Tk.Ada.Grid.Grid(Label, "-columnspan 2 -padx 5");
Tcl.Tk.Ada.Grid.Grid_Remove(Label);
Tcl.Tk.Ada.Grid.Grid(Button, "-column 0 -row 4 -padx {5 0} -pady 5");
Bind
(Button, "<Escape>", "{" & ItemDialog & ".cancelbutton invoke;break}");
Button :=
Create
(ItemDialog & ".cancelbutton",
"-text Cancel -command {CloseDialog " & ItemDialog & "}");
Tcl.Tk.Ada.Grid.Grid
(Button, "-column 1 -row 4 -padx {0 5} -pady 5 -sticky e");
Focus(Button);
Bind(Button, "<Tab>", "{focus .itemdialog.givebutton;break}");
Bind(Button, "<Escape>", "{" & Button & " invoke;break}");
Show_Dialog(ItemDialog);
return TCL_OK;
end Show_Give_Item_Command;
-- ****o* SUCargo/SUCargo.Give_Item_Command
-- FUNCTION
-- Give selected amount of the selected item from the ship's cargo to the
-- selected crew member
-- PARAMETERS
-- ClientData - Custom data send to the command.
-- Interp - Tcl interpreter in which command was executed.
-- Argc - Number of arguments passed to the command. Unused
-- Argv - Values of arguments passed to the command.
-- RESULT
-- This function always return TCL_OK
-- COMMANDS
-- GiveItem
-- SOURCE
function Give_Item_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
Convention => C;
-- ****
function Give_Item_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is
pragma Unreferenced(Argc);
MemberIndex, Amount: Positive;
ItemIndex: constant Positive := Positive'Value(CArgv.Arg(Argv, 1));
Item: constant InventoryData := Player_Ship.Cargo(ItemIndex);
ItemDialog: Tk_Toplevel := Get_Widget(".itemdialog", Interp);
SpinBox: constant Ttk_SpinBox := Get_Widget(ItemDialog & ".giveamount");
ComboBox: constant Ttk_ComboBox := Get_Widget(ItemDialog & ".member");
begin
Amount := Natural'Value(Get(SpinBox));
MemberIndex := Natural'Value(Current(ComboBox)) + 1;
if FreeInventory
(MemberIndex, 0 - (Items_List(Item.ProtoIndex).Weight * Amount)) <
0 then
ShowMessage
(Text =>
"No free space in " &
To_String(Player_Ship.Crew(MemberIndex).Name) &
"'s inventory for that amount of " & GetItemName(Item),
Title => "Can't give item");
return TCL_OK;
end if;
AddMessage
("You gave" & Positive'Image(Amount) & " " &
GetItemName(Player_Ship.Cargo(ItemIndex)) & " to " &
To_String(Player_Ship.Crew(MemberIndex).Name) & ".",
OtherMessage);
UpdateInventory
(MemberIndex => MemberIndex, Amount => Amount,
ProtoIndex => Item.ProtoIndex, Durability => Item.Durability,
Price => Item.Price);
UpdateCargo
(Ship => Player_Ship, Amount => (0 - Amount), CargoIndex => ItemIndex,
Price => Item.Price);
Destroy(ItemDialog);
Tcl.Tk.Ada.Busy.Forget(Main_Paned);
Tcl.Tk.Ada.Busy.Forget(Game_Header);
UpdateHeader;
Update_Messages;
return
Sort_Cargo_Command
(ClientData, Interp, 2, CArgv.Empty & "SortShipCargo" & "-1");
end Give_Item_Command;
-- ****o* SUCargo/SUCargo.Show_Drop_Item_Command
-- FUNCTION
-- Show UI to drop the selected item from the ship cargo
-- PARAMETERS
-- ClientData - Custom data send to the command. Unused
-- Interp - Tcl interpreter in which command was executed. Unused
-- Argc - Number of arguments passed to the command. Unused
-- Argv - Values of arguments passed to the command.
-- RESULT
-- This function always return TCL_OK
-- COMMANDS
-- ShowDropItem itemindex
-- Itemindex is the index of the item which will be set
-- SOURCE
function Show_Drop_Item_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
Convention => C;
-- ****
function Show_Drop_Item_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is
pragma Unreferenced(ClientData, Argc, Interp);
ItemIndex: constant Positive := Positive'Value(CArgv.Arg(Argv, 1));
begin
ShowManipulateItem
("Drop " & GetItemName(Player_Ship.Cargo(ItemIndex)) &
" from the ship's cargo",
"DropItem " & CArgv.Arg(Argv, 1), "drop", ItemIndex);
return TCL_OK;
end Show_Drop_Item_Command;
-- ****o* SUCargo/SUCargo.Drop_Item_Command
-- FUNCTION
-- Drop selected amount of the selected item from the ship's cargo
-- PARAMETERS
-- ClientData - Custom data send to the command.
-- Interp - Tcl interpreter in which command was executed.
-- Argc - Number of arguments passed to the command. Unused
-- Argv - Values of arguments passed to the command.
-- RESULT
-- This function always return TCL_OK
-- COMMANDS
-- DropItem
-- SOURCE
function Drop_Item_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
Convention => C;
-- ****
function Drop_Item_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is
pragma Unreferenced(Argc);
DropAmount, DropAmount2: Natural;
ItemDialog: constant Ttk_Frame := Get_Widget(".itemdialog", Interp);
SpinBox: constant Ttk_SpinBox :=
Get_Widget(ItemDialog & ".amount", Interp);
ItemIndex: constant Positive := Positive'Value(CArgv.Arg(Argv, 1));
begin
DropAmount := Natural'Value(Get(SpinBox));
DropAmount2 := DropAmount;
if Items_List(Player_Ship.Cargo(ItemIndex).ProtoIndex).IType =
Mission_Items_Type then
Check_Drop_Items_Loop :
for J in 1 .. DropAmount2 loop
Delete_Missions_Loop :
for I in AcceptedMissions.Iterate loop
if AcceptedMissions(I).MType = Deliver and
AcceptedMissions(I).ItemIndex =
Player_Ship.Cargo(ItemIndex).ProtoIndex then
DeleteMission(Mission_Container.To_Index(I));
DropAmount := DropAmount - 1;
exit Delete_Missions_Loop;
end if;
end loop Delete_Missions_Loop;
end loop Check_Drop_Items_Loop;
elsif CurrentStory.Index /= Null_Unbounded_String
and then Stories_List(CurrentStory.Index).StartData(1) =
Player_Ship.Cargo(ItemIndex).ProtoIndex then
FinishedStories.Delete(FinishedStories.Last_Index);
ClearCurrentStory;
end if;
if DropAmount > 0 then
AddMessage
("You dropped" & Positive'Image(DropAmount) & " " &
GetItemName(Player_Ship.Cargo(ItemIndex)) & ".",
OtherMessage);
UpdateCargo
(Ship => Player_Ship,
ProtoIndex => Player_Ship.Cargo.Element(ItemIndex).ProtoIndex,
Amount => (0 - DropAmount),
Durability => Player_Ship.Cargo.Element(ItemIndex).Durability,
Price => Player_Ship.Cargo.Element(ItemIndex).Price);
end if;
if Close_Dialog_Command
(ClientData, Interp, 2,
CArgv.Empty & "CloseDialog" & ".itemdialog") =
TCL_ERROR then
return TCL_ERROR;
end if;
UpdateHeader;
Update_Messages;
return
Sort_Cargo_Command
(ClientData, Interp, 2, CArgv.Empty & "SortShipCargo" & "-1");
end Drop_Item_Command;
-- ****o* SUCargo/SUCargo.Show_Cargo_Item_Info_Command
-- FUNCTION
-- Show detailed information about the selected item in the player ship
-- cargo
-- PARAMETERS
-- ClientData - Custom data send to the command. Unused
-- Interp - Tcl interpreter in which command was executed.
-- Argc - Number of arguments passed to the command.
-- Argv - Values of arguments passed to the command.
-- RESULT
-- This function always return TCL_OK
-- COMMANDS
-- ValidateMoveAmount
-- SOURCE
function Show_Cargo_Item_Info_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
Convention => C;
-- ****
function Show_Cargo_Item_Info_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is
pragma Unreferenced(ClientData, Interp, Argc);
begin
Show_Inventory_Item_Info(".", Positive'Value(CArgv.Arg(Argv, 1)), 0);
return TCL_OK;
end Show_Cargo_Item_Info_Command;
-- ****if* SUCargo/SUCargo.Show_Cargo_Menu_Command
-- FUNCTION
-- Show the menu with available the selected item options
-- PARAMETERS
-- ClientData - Custom data send to the command. Unused
-- Interp - Tcl interpreter in which command was executed.
-- Argc - Number of arguments passed to the command. Unused
-- Argv - Values of arguments passed to the command.
-- RESULT
-- This function always return TCL_OK
-- COMMANDS
-- ShowCargoMenu moduleindex
-- ModuleIndex is the index of the item's menu to show
-- SOURCE
function Show_Cargo_Menu_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
Convention => C;
-- ****
function Show_Cargo_Menu_Command
(ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is
pragma Unreferenced(ClientData, Argc);
ItemMenu: Tk_Menu := Get_Widget(".cargoitemmenu", Interp);
begin
if (Winfo_Get(ItemMenu, "exists")) = "0" then
ItemMenu := Create(".cargoitemmenu", "-tearoff false");
end if;
Delete(ItemMenu, "0", "end");
Menu.Add
(ItemMenu, "command",
"-label {Give the item to a crew member} -command {ShowGiveItem " &
CArgv.Arg(Argv, 1) & "}");
Menu.Add
(ItemMenu, "command",
"-label {Drop the item from the ship's cargo} -command {ShowDropItem " &
CArgv.Arg(Argv, 1) & "}");
Menu.Add
(ItemMenu, "command",
"-label {Show more info about the item} -command {ShowCargoItemInfo " &
CArgv.Arg(Argv, 1) & "}");
Tk_Popup
(ItemMenu, Winfo_Get(Get_Main_Window(Interp), "pointerx"),
Winfo_Get(Get_Main_Window(Interp), "pointery"));
return TCL_OK;
end Show_Cargo_Menu_Command;
procedure AddCommands is
begin
Add_Command("ShowCargo", Show_Cargo_Command'Access);
Add_Command("ShowCargoItemInfo", Show_Cargo_Item_Info_Command'Access);
Add_Command("ShowGiveItem", Show_Give_Item_Command'Access);
Add_Command("GiveItem", Give_Item_Command'Access);
Add_Command("ShowDropItem", Show_Drop_Item_Command'Access);
Add_Command("DropItem", Drop_Item_Command'Access);
Add_Command("ShowCargoMenu", Show_Cargo_Menu_Command'Access);
Add_Command("SortShipCargo", Sort_Cargo_Command'Access);
end AddCommands;
end Ships.UI.Cargo;
|
with
openGL.Light,
openGL.Visual,
openGL.Model.Sphere.lit_colored_textured,
openGL.Model.Sphere.lit_colored,
openGL.Palette,
openGL.Demo;
procedure launch_render_Lighting
--
-- Exercise the rendering of lit models.
--
is
use openGL,
openGL.Model,
openGL.Math,
openGL.linear_Algebra_3d;
the_Texture : constant asset_Name := to_Asset ("assets/opengl/texture/Face1.bmp");
begin
Demo.print_Usage ("To see the light move, disable 'Sync to VBlank'.");
Demo.define ("openGL 'render Lighting' Demo");
Demo.Camera.Position_is ((0.0, 0.0, 10.0),
y_Rotation_from (to_Radians (0.0)));
declare
use openGL.Palette;
-- The Models.
--
the_Ball_1_Model : constant Model.Sphere.lit_colored_textured.view
:= openGL.Model.Sphere.lit_colored_textured.new_Sphere (Radius => 1.0,
Image => the_Texture);
the_Ball_2_Model : constant Model.Sphere.lit_colored.view
:= openGL.Model.Sphere.lit_colored.new_Sphere (Radius => 1.0,
Color => (light_Apricot, Opaque));
-- The Visuals.
--
use openGL.Visual.Forge;
the_Visuals : constant openGL.Visual.views := (1 => new_Visual (the_Ball_1_Model.all'Access),
2 => new_Visual (the_Ball_2_Model.all'Access));
the_Light : openGL.Light.item := Demo.Renderer.new_Light;
-- Light movement.
--
initial_Site : constant openGL.Vector_3 := (-10_000.0, 0.0, 10_000.0);
site_Delta : openGL.Vector_3 := ( 1.0, 0.0, 0.0);
begin
the_Visuals (1).Site_is ((0.0, 1.0, 0.0));
the_Visuals (2).Site_is ((0.0, -1.0, 0.0));
-- Set the lights initial position to far behind and far to the left.
--
the_Light.Site_is (initial_Site);
Demo.Renderer.set (the_Light);
-- Main loop.
--
while not Demo.Done
loop
-- Handle user commands.
--
Demo.Dolly.evolve;
Demo.Done := Demo.Dolly.quit_Requested;
-- Move the light.
--
if the_Light.Site (1) > 10_000.0
then
site_Delta (1) := -1.0;
the_Light.Color_is (Palette.dark_Green);
elsif the_Light.Site (1) < -10_000.0
then
site_Delta (1) := 1.0;
the_Light.Color_is (openGL.Palette.dark_Red);
end if;
the_Light.Site_is (the_Light.Site + site_Delta);
Demo.Renderer.set (the_Light);
-- Render the sprites.
--
Demo.Camera.render (the_Visuals);
while not Demo.Camera.cull_Completed
loop
delay Duration'Small;
end loop;
Demo.Renderer.render;
Demo.FPS_Counter.increment; -- Frames per second display.
end loop;
end;
Demo.destroy;
end launch_render_Lighting;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . T R A C E B A C K . S Y M B O L I C --
-- --
-- S p e c --
-- --
-- Copyright (C) 1999-2020, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Run-time symbolic traceback support
-- The full capability is currently supported on the following targets:
-- GNU/Linux x86, x86_64, ia64
-- Note: on targets other than those listed above, a dummy implementation
-- of the body returns a series of LF separated strings of the form "0x..."
-- corresponding to the addresses.
-- The routines provided in this package assume that your application has been
-- compiled with debugging information turned on, since this information is
-- used to build a symbolic traceback.
-- If you want to retrieve tracebacks from exception occurrences, it is also
-- necessary to invoke the binder with -E switch. Please refer to the gnatbind
-- documentation for more information.
-- Note that it is also possible (and often recommended) to compute symbolic
-- traceback outside the program execution, which in addition allows you to
-- distribute the executable with no debug info:
--
-- - build your executable with debug info
-- - archive this executable
-- - strip a copy of the executable and distribute/deploy this version
-- - at run time, compute absolute traceback (-bargs -E) from your
-- executable and log it using Ada.Exceptions.Exception_Information
-- - off line, compute the symbolic traceback using the executable archived
-- with debug info and addr2line or gdb (using info line *<addr>) on the
-- absolute addresses logged by your application.
-- In order to retrieve symbolic information, functions in this package will
-- read on disk all the debug information of the executable file (found via
-- Argument (0), and looked in the PATH if needed) or shared libraries using
-- OS facilities, and load them in memory, causing a significant cpu and
-- memory overhead.
-- Symbolic traceback from shared libraries is only supported for Windows and
-- Linux. On other targets symbolic tracebacks are only supported for the main
-- executable. You should consider using gdb to obtain symbolic traceback in
-- such cases.
with Ada.Exceptions;
package System.Traceback.Symbolic is
pragma Elaborate_Body;
function Symbolic_Traceback
(Traceback : System.Traceback_Entries.Tracebacks_Array) return String;
function Symbolic_Traceback_No_Hex
(Traceback : System.Traceback_Entries.Tracebacks_Array) return String;
-- Build a string containing a symbolic traceback of the given call
-- chain. Note: These procedures may be installed by Set_Trace_Decorator,
-- to get a symbolic traceback on all exceptions raised (see
-- System.Exception_Traces).
function Symbolic_Traceback
(E : Ada.Exceptions.Exception_Occurrence) return String;
function Symbolic_Traceback_No_Hex
(E : Ada.Exceptions.Exception_Occurrence) return String;
-- Build string containing symbolic traceback of given exception occurrence
-- In the above, _No_Hex means do not print any hexadecimal addresses, even
-- if the symbol is not available. This is useful for getting deterministic
-- output from tests.
procedure Enable_Cache (Include_Modules : Boolean := False);
-- Read symbolic information from binary files and cache them in memory.
-- This will speed up the above functions but will require more memory. If
-- Include_Modules is true, shared modules (or DLL) will also be cached.
-- This procedure may do nothing if not supported. The profile of this
-- subprogram may change in the future (new parameters can be added
-- with default value), but backward compatibility for direct calls
-- is supported.
end System.Traceback.Symbolic;
|
-- Institution: Technische Universitaet Muenchen
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
--
-- Authors: Emanuel Regnath (emanuel.regnath@tum.de)
--
-- Description: Generic vector package
--
-- ToDo:
-- [ ] Implementation
with Ada.Numerics.Generic_Elementary_Functions;
generic
type Index_Type is (3);
type Data_Type is Float;
package Generic_Vector3D with SPARK_Mode is
type Karthesian_Coordinate_Dimension_Type is (X, Y, Z);
type Polar_Coordinate_Dimesion_Type is (Phi, Rho, Psi);
type Earth_Coordinate_Dimension_Type is (LONGITUDE, LATITUDE, ALTITUDE);
type Vector3D_Type is tagged array (Index_Type) of Float;
type Karthesian_Vector_Type is record
x : Data_Type;
y : Data_Type;
z : Data_Type;
end record;
function norm(vector : Karthesian_Vector_Type) return Data_Type;
function "+" (Right : Vector3D_Type) return Vector3D_Type;
function "-" (Right : Vector3D_Type) return Vector3D_Type;
function "abs" (Right : Vector3D_Type) return Vector3D_Type;
end Generic_Vector3D;
|
with Math; use Math;
with Courbes.Visiteurs; use Courbes.Visiteurs;
package body Courbes.Droites is
function Ctor_Droite (Debut, Fin : Point2D) return Droite is
Diff : constant Point2D := Fin - Debut;
Longueur : constant Float := Hypot(Diff);
begin
return
(Debut => Debut,
Fin => Fin,
Longueur => Longueur,
Vecteur_Directeur => Diff / Longueur);
end;
overriding function Obtenir_Point(Self : Droite; X : Coordonnee_Normalisee) return Point2D is
begin
return Self.Obtenir_Debut + Self.Longueur * X * Self.Vecteur_Directeur;
end;
overriding procedure Accepter (Self : Droite; Visiteur : Visiteur_Courbe'Class) is
begin
Visiteur.Visiter (Self);
end;
end Courbes.Droites;
|
with Ada.Unchecked_Conversion;
with System.Formatting.Address;
with System.Long_Long_Integer_Types;
with System.Termination;
package body Ada.Containers.Binary_Trees.Arne_Andersson.Debug is
subtype Word_Unsigned is System.Long_Long_Integer_Types.Word_Unsigned;
function To_Address (Value : Node_Access) return System.Address
with Import, Convention => Intrinsic;
-- Address_To_Named_Access_Conversions could not be used because
-- Node_Access is not access "all" type.
type AA_Node_Access is access Node;
function Downcast is new Unchecked_Conversion (Node_Access, AA_Node_Access);
function Height (Container : Node_Access) return Natural;
function Height (Container : Node_Access) return Natural is
procedure Nonnull_First (
Item : in out Node_Access;
Height : in out Natural);
procedure Nonnull_First (
Item : in out Node_Access;
Height : in out Natural) is
begin
while Item.Left /= null loop
Item := Item.Left;
Height := Height + 1;
end loop;
end Nonnull_First;
procedure Next (Item : in out Node_Access; Height : in out Natural);
procedure Next (Item : in out Node_Access; Height : in out Natural) is
begin
if Item.Right /= null then
Item := Item.Right;
Height := Height + 1;
Nonnull_First (Item, Height);
else
loop
declare
P : constant Node_Access := Item;
begin
Item := Item.Parent;
Height := Height - 1;
exit when Item = null or else Item.Right /= P;
end;
end loop;
end if;
end Next;
Result : Integer := 0;
begin
if Container /= null then
declare
I : Node_Access := Container;
H : Natural := 1;
begin
Nonnull_First (I, H);
while I /= null loop
Result := Integer'Max (Result, H);
Next (I, H);
end loop;
end;
end if;
return Result;
end Height;
-- implementation
function Root (Node : not null Node_Access) return not null Node_Access is
Result : not null Node_Access := Node;
begin
while Result.Parent /= null loop
Result := Result.Parent;
end loop;
return Result;
end Root;
function Dump (
Container : Node_Access;
Marker : Node_Access;
Message : String := "")
return Boolean
is
subtype Buffer_Type is String (1 .. 256);
procedure Put (
Buffer : in out Buffer_Type;
Last : in out Natural;
S : String);
procedure Put (
Buffer : in out Buffer_Type;
Last : in out Natural;
S : String)
is
First : constant Natural := Last + 1;
begin
Last := Last + S'Length;
Buffer (First .. Last) := S;
end Put;
Buffer : Buffer_Type;
Last : Natural;
Indent_S : String (1 .. 2 * Height (Container)) := (others => ' ');
Mark : constant array (Boolean) of Character := "-*";
begin
Last := 0;
Put (Buffer, Last, "Tree:");
if Message'Length > 0 then
Put (Buffer, Last, " ");
Put (Buffer, Last, Message);
end if;
System.Termination.Error_Put_Line (Buffer (1 .. Last));
declare
Position : Node_Access := First (Container);
begin
while Position /= null loop
declare
Indent : Natural := 2;
B : Character;
C : Character;
begin
declare
P : Node_Access := Position.Parent;
begin
while P /= null loop
Indent := Indent + 2;
P := P.Parent;
end loop;
end;
if Position.Left = null then
Indent_S (Indent) := '|';
end if;
if Indent > 2 then
if Indent_S (Indent - 2) = ' ' then
C := '|';
else
C := ' ';
end if;
Indent_S (Indent - 2) := '+';
end if;
Indent_S (Indent - 1) := Mark (Position = Marker);
B := Indent_S (Indent);
if Position.Left = null and then Position.Right = null then
Indent_S (Indent) := '-';
else
Indent_S (Indent) := '+';
end if;
Last := 0;
Put (Buffer, Last, Indent_S);
Put (Buffer, Last, " 0x");
System.Formatting.Address.Image (
To_Address (Position),
Buffer (
Last + 1 ..
Last + System.Formatting.Address.Address_String'Length),
Set => System.Formatting.Lower_Case);
Last := Last + System.Formatting.Address.Address_String'Length;
Put (Buffer, Last, " (level = ");
declare
Error : Boolean;
begin
System.Formatting.Image (
Word_Unsigned (Downcast (Position).Level),
Buffer (Last + 1 .. Buffer'Last),
Last,
Error => Error);
end;
Put (Buffer, Last, ")");
System.Termination.Error_Put_Line (Buffer (1 .. Last));
Indent_S (Indent) := B;
Indent_S (Indent - 1) := ' ';
if Indent > 2 then
Indent_S (Indent - 2) := C;
end if;
if Position.Right = null then
Indent_S (Indent) := ' ';
end if;
end;
Position := Next (Position);
end loop;
end;
return True;
end Dump;
function Valid (
Container : Node_Access;
Length : Count_Type;
Level_Check : Boolean := True)
return Boolean
is
Position : Node_Access := First (Container);
Count : Count_Type := 0;
begin
while Position /= null loop
Count := Count + 1;
if Level_Check then
if Downcast (Position).Level > 0 then
if Position.Left = null or else Position.Right = null then
return False;
end if;
else
if Position.Left /= null then
return False;
end if;
end if;
if Position.Left /= null then
if Downcast (Position).Level /=
Downcast (Position.Left).Level + 1
then
return False;
end if;
end if;
if Position.Right /= null then
if Downcast (Position).Level not in
Downcast (Position.Right).Level ..
Downcast (Position.Right).Level + 1
then
return False;
end if;
if Position.Right.Right /= null then
if Downcast (Position).Level <=
Downcast (Position.Right.Right).Level
then
return False;
end if;
end if;
end if;
end if;
if Position.Left /= null then
if Position.Left.Parent /= Position then
return False;
end if;
end if;
if Position.Right /= null then
if Position.Right.Parent /= Position then
return False;
end if;
end if;
if Position.Parent = null then
if Container /= Position then
return False;
end if;
else
if Position.Parent.Left /= Position
and then Position.Parent.Right /= Position
then
return False;
end if;
end if;
Position := Next (Position);
end loop;
return Count = Length;
end Valid;
end Ada.Containers.Binary_Trees.Arne_Andersson.Debug;
|
------------------------------------------------------------------------------
-- 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; use Ada.Strings;
procedure Natools.Chunked_Strings.Tests.CXA4011
(Report : in out Natools.Tests.Reporter'Class)
is
package NT renames Natools.Tests;
procedure Test (Test_Name : String;
C_1 : Character;
C_2 : Character;
Name_1 : String;
Name_2 : String);
procedure Test (Test_Name : String;
C_1 : Character;
C_2 : Character;
Name_1 : String;
Name_2 : String) is
begin
if C_1 = C_2 then
NT.Item (Report, Test_Name, NT.Success);
else
NT.Item (Report, Test_Name, NT.Fail);
NT.Info (Report, Name_1 & ": " & Character'Image (C_1));
NT.Info (Report, Name_2 & ": " & Character'Image (C_2));
end if;
end Test;
begin
NT.Section (Report, "Port of ACATS CXA4011");
declare
Cad_String : constant Chunked_String
:= To_Chunked_String ("cad");
Complete_String : constant Chunked_String
:= To_Chunked_String ("Incomplete")
& Ada.Strings.Space
& To_Chunked_String ("String");
Incomplete_String : Chunked_String
:= To_Chunked_String ("ncomplete Strin");
Incorrect_Spelling : Chunked_String
:= To_Chunked_String ("Guob Dai");
Magic_String : constant Chunked_String
:= To_Chunked_String ("abracadabra");
Incantation : Chunked_String := Magic_String;
A_Small_G : constant Character := 'g';
A_Small_D : constant Character := 'd';
ABCD_Set : constant Maps.Character_Set := Maps.To_Set ("abcd");
B_Set : constant Maps.Character_Set := Maps.To_Set ("b");
AB_Set : constant Maps.Character_Set
:= Maps."OR" (Maps.To_Set ('a'), B_Set);
Code_Map : constant Maps.Character_Mapping
:= Maps.To_Mapping (From => "abcd", To => "wxyz");
Reverse_Code_Map : constant Maps.Character_Mapping
:= Maps.To_Mapping (From => "wxyz", To => "abcd");
Non_Existent_Map : constant Maps.Character_Mapping
:= Maps.To_Mapping (From => "jkl", To => "mno");
Token_Start : array (1 .. 3) of Positive;
Token_End : array (1 .. 3) of Natural := (0, 0, 0);
Matching_Letters : Natural := 0;
Tests : array (1 .. 5) of Boolean;
begin
declare
Name : constant String := "Operator ""&""";
Tests : array (1 .. 3) of Boolean;
begin
Incomplete_String := 'I' & Incomplete_String;
Incomplete_String := Incomplete_String & A_Small_G;
if not Is_Valid (Incomplete_String)
or not Is_Valid (Complete_String)
then
NT.Item (Report, Name, NT.Error);
if not Is_Valid (Incomplete_String) then
NT.Info (Report, "Incomplete_String is invalid");
end if;
if not Is_Valid (Complete_String) then
NT.Info (Report, "Complete_String is invalid");
end if;
else
Tests (1) := Incomplete_String < Complete_String;
Tests (2) := Incomplete_String > Complete_String;
Tests (3) := Incomplete_String /= Complete_String;
if Tests (1) or Tests (2) or Tests (3) then
NT.Item (Report, Name, NT.Fail);
NT.Info (Report, "Incomplete_String: """
& To_String (Incomplete_String) & '"');
NT.Info (Report, "Complete_String: """
& To_String (Complete_String) & '"');
if Tests (1) then
NT.Info (Report, "-> Incomplete_String < Complete_String");
end if;
if Tests (2) then
NT.Info (Report, "-> Incomplete_String < Complete_String");
end if;
if Tests (3) then
NT.Info (Report, "-> Incomplete_String /= Complete_String");
end if;
else
NT.Item (Report, Name, NT.Success);
end if;
end if;
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
NT.Section (Report, "Function Element");
declare
Name : constant String := "Element of complete vs constant";
begin
Test (Name,
Element (Incomplete_String, Length (Incomplete_String)),
A_Small_G,
"Element (""" & To_String (Incomplete_String)
& ',' & Natural'Image (Length (Incomplete_String)) & ')',
"A_Small_G");
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Element of complete vs Element of Tail";
begin
Test (Name,
Element (Incomplete_String, 2),
Element (Tail (Incomplete_String, 2), 1),
"Element (""" & To_String (Incomplete_String) & ", 2)",
"Element (""" & To_String (Tail (Incomplete_String, 2))
& ", 1)");
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Element of Head vs Element of constant";
begin
Test (Name,
Element (Head (Incomplete_String, 4), 2),
Element (To_Chunked_String ("wnqz"), 2),
"Element (""" & To_String (Head (Incomplete_String, 4))
& ", 2)",
"Element (""wnqz"", 2)");
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
NT.End_Section (Report);
declare
Name : constant String := "Procedure Replace_Element";
begin
Replace_Element (Incorrect_Spelling, 2, 'o');
Replace_Element (Incorrect_Spelling,
Index (Incorrect_Spelling, B_Set),
A_Small_D);
Replace_Element (Source => Incorrect_Spelling,
Index => Length (Incorrect_Spelling),
By => 'y');
Test (Report, Name, Incorrect_Spelling, "Good Day");
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
-- Function Count
Matching_Letters := Count (Source => Magic_String,
Set => ABCD_Set);
NT.Item (Report, "Function Count with Set parameter",
NT.To_Result (Matching_Letters = 9));
if Matching_Letters /= 9 then
NT.Info
(Report,
"Count (""" & To_String (Magic_String) & """, ABCD_Set) "
& Natural'Image (Matching_Letters)
& " (should be 9)");
Dump (Report, Magic_String);
end if;
Tests (1) := Count (Magic_String, "ab")
= Count (Magic_String, "ac") + Count (Magic_String, "ad");
Tests (2) := Count (Magic_String, "ab") = 2;
NT.Item (Report, "Function Count with String parameter",
NT.To_Result (Tests (1) and Tests (2)));
if not Tests (1) or not Tests (2) then
NT.Info
(Report,
"Count (""" & To_String (Magic_String) & """, ""ab"") "
& Natural'Image (Count (Magic_String, "ab"))
& " (should be 2)");
NT.Info
(Report,
"Count (""" & To_String (Magic_String) & """, ""ac"") "
& Natural'Image (Count (Magic_String, "ac")));
NT.Info
(Report,
"Count (""" & To_String (Magic_String) & """, ""ad"") "
& Natural'Image (Count (Magic_String, "ad")));
end if;
-- Find_Token
Find_Token (Magic_String,
AB_Set,
Ada.Strings.Inside,
Token_Start (1),
Token_End (1));
Tests (1) := Natural (Token_Start (1)) = To_String (Magic_String)'First
and Token_End (1) = Index (Magic_String, B_Set);
Find_Token (Source => Magic_String,
Set => ABCD_Set,
Test => Ada.Strings.Outside,
First => Token_Start (2),
Last => Token_End (2));
Tests (2) := Natural (Token_Start (2)) = 3 and Token_End (2) = 3;
Find_Token (Magic_String,
Maps.To_Set (A_Small_G),
Ada.Strings.Inside,
First => Token_Start (3),
Last => Token_End (3));
Tests (3) := Token_Start (3) = To_String (Magic_String)'First
and Token_End (3) = 0;
NT.Item (Report, "Procedure Find_Token",
NT.To_Result (Tests (1) and Tests (2) and Tests (3)));
if not Tests (1) then
NT.Info (Report,
"Start: "
& Positive'Image (Token_Start (1)) & " /= "
& Positive'Image (To_String (Magic_String)'First)
& " (should be both 1)");
NT.Info (Report,
"End: "
& Natural'Image (Token_End (1)) & " /= "
& Natural'Image (Index (Magic_String, B_Set))
& " (should be both 2)");
end if;
if not Tests (2) then
NT.Info
(Report,
"Start: " & Positive'Image (Token_Start (2)) & " (should be 3)");
NT.Info
(Report,
"End: " & Natural'Image (Token_End (2)) & " (should be 3)");
end if;
if not Tests (3) then
NT.Info
(Report,
"Start: "
& Positive'Image (Token_Start (3)) & " /= "
& Positive'Image (To_String (Magic_String)'First)
& " (should be 1)");
NT.Info
(Report,
"End: "
& Natural'Image (Token_End (3)) & " (should be 0)");
end if;
-- Translate
Incantation := Translate (Magic_String, Code_Map);
Tests (1) := Incantation = To_Chunked_String ("wxrwywzwxrw");
NT.Item (Report, "Function Translate",
NT.To_Result (Tests (1)));
if not Tests (1) then
NT.Info (Report,
'"' & To_String (Incantation)
& """ /= ""wxrwywzwxrw""");
end if;
Translate (Incantation, Reverse_Code_Map);
Tests (1) := Incantation = Translate (Magic_String, Non_Existent_Map);
NT.Item
(Report, "Procedure Translate", NT.To_Result (Tests (1)));
if not Tests (1) then
NT.Info (Report,
'"' & To_String (Incantation) & """ /= """
& To_String (Translate (Magic_String,
Non_Existent_Map))
& """ (should be """
& To_String (Magic_String) & """)");
end if;
-- Trim
declare
XYZ_Set : constant Maps.Character_Set := Maps.To_Set ("xyz");
PQR_Set : constant Maps.Character_Set := Maps.To_Set ("pqr");
Pad : constant Chunked_String := To_Chunked_String ("Pad");
The_New_Ada : constant Chunked_String := To_Chunked_String ("Ada9X");
Space_Array : constant array (1 .. 4) of Chunked_String
:= (To_Chunked_String (" Pad "),
To_Chunked_String ("Pad "),
To_Chunked_String (" Pad"),
Pad);
String_Array : constant array (1 .. 5) of Chunked_String
:= (To_Chunked_String ("xyzxAda9Xpqr"),
To_Chunked_String ("Ada9Xqqrp"),
To_Chunked_String ("zxyxAda9Xqpqr"),
To_Chunked_String ("xxxyAda9X"),
The_New_Ada);
begin
for I in 1 .. 4 loop
Tests (I) := Trim (Space_Array (I), Ada.Strings.Both) = Pad;
end loop;
NT.Item
(Report, "Trim spaces",
NT.To_Result (Tests (1) and Tests (2)
and Tests (3) and Tests (4)));
for I in 1 .. 4 loop
if not Tests (I) then
NT.Info
(Report,
"Part" & Positive'Image (I) & ": Trim ("""
& To_String (Space_Array (I)) & """, Both) -> """
& To_String (Trim (Space_Array (I), Ada.Strings.Both))
& """ (shoud be """ & To_String (Pad) & '"');
end if;
end loop;
for I in 1 .. 5 loop
Tests (I) := Trim (String_Array (I),
Left => XYZ_Set,
Right => PQR_Set)
= The_New_Ada;
end loop;
NT.Item
(Report, "Trim sets of characters",
NT.To_Result (Tests (1) and Tests (2) and Tests (3)
and Tests (4) and Tests (5)));
for I in 1 .. 5 loop
if not Tests (I) then
NT.Info
(Report,
"Part" & Positive'Image (I) & ": Trim ("""
& To_String (String_Array (I))
& """, XYZ_Set, PQR_Set) -> """
& To_String (Trim (String_Array (I), XYZ_Set, PQR_Set))
& """ (shoud be """ & To_String (The_New_Ada) & '"');
end if;
end loop;
end;
-- Delete
Tests (1) := Delete (Source => Delete (Magic_String,
8, Length (Magic_String)),
From => To_String (Magic_String)'First,
Through => 4)
= Cad_String;
NT.Item (Report, "Function Delete",
NT.To_Result (Tests (1)));
if not Tests (1) then
NT.Info
(Report,
'"' & To_String (Delete (Delete (Magic_String,
8, Length (Magic_String)),
To_String (Magic_String)'First, 4))
& """ /= """ & To_String (Cad_String) & '"');
end if;
-- Constructors "*"
declare
SOS : Chunked_String;
Dot : constant Chunked_String := To_Chunked_String ("Dot_");
Dash : constant String := "Dash_";
Distress : constant Chunked_String
:= To_Chunked_String ("Dot_Dot_Dot_")
& To_Chunked_String ("Dash_Dash_Dash_")
& To_Chunked_String ("Dot_Dot_Dot");
Repeat : constant Natural := 3;
Separator : constant Character := '_';
Separator_Set : constant Maps.Character_Set
:= Maps.To_Set (Separator);
begin
SOS := Repeat * Dot;
SOS := SOS & Repeat * Dash & Repeat * Dot;
if Trim (SOS, Maps.Null_Set, Separator_Set) /= Distress then
NT.Item (Report, "Function ""*""", NT.Fail);
NT.Info
(Report,
'"' & To_String (Trim (SOS, Maps.Null_Set, Separator_Set))
& """ /= """ & To_String (Distress) & '"');
else
NT.Item (Report, "Function ""*""",
NT.Success);
end if;
end;
exception
when Error : others =>
NT.Report_Exception (Report, "Preparation", Error);
end;
NT.End_Section (Report);
end Natools.Chunked_Strings.Tests.CXA4011;
|
with Tarmi.Environments; use Tarmi.Environments;
package Tarmi.Combiners is
type Combiner_R is abstract new Datum_R with null record;
type Combiner is not null access constant Combiner_R'Class;
type Operative_R is new Combiner_R with
record
Param_Tree_Formals : Datum;
Dyn_Env_Formal : Datum;
Static_Env : Environment;
Body_Form : Datum;
end record;
type Operative is not null access constant Operative_R;
type Applicative_R is new Combiner_R with
record
Underlying : Combiner;
end record;
type Applicative is not null access constant Applicative_R;
end Tarmi.Combiners;
|
with Ada.Text_IO;
procedure Count_The_Coins is
type Counter_Type is range 0 .. 2**63-1; -- works with gnat
type Coin_List is array(Positive range <>) of Positive;
function Count(Goal: Natural; Coins: Coin_List) return Counter_Type is
Cnt: array(0 .. Goal) of Counter_Type := (0 => 1, others => 0);
-- 0 => we already know one way to choose (no) coins that sum up to zero
-- 1 .. Goal => we do not (yet) other ways to choose coins
begin
for C in Coins'Range loop
for Amount in 1 .. Cnt'Last loop
if Coins(C) <= Amount then
Cnt(Amount) := Cnt(Amount) + Cnt(Amount-Coins(C));
-- Amount-Coins(C) plus Coins(C) sums up to Amount;
end if;
end loop;
end loop;
return Cnt(Goal);
end Count;
procedure Print(C: Counter_Type) is
begin
Ada.Text_IO.Put_Line(Counter_Type'Image(C));
end Print;
begin
Print(Count( 1_00, (25, 10, 5, 1)));
Print(Count(1000_00, (100, 50, 25, 10, 5, 1)));
end Count_The_Coins;
|
pragma License (Unrestricted);
-- optional runtime unit
with System;
package nosig is
pragma Preelaborate;
procedure Install_Exception_Handler (SEH : System.Address) is null
with Export, -- for weak linking
Convention => Ada,
External_Name => "__drake_install_exception_handler";
procedure Install_Task_Exception_Handler (
SEH : System.Address;
Signal_Stack : System.Address) is null
with Export,
Convention => Ada,
External_Name => "__drake_install_task_exception_handler";
procedure Reinstall_Exception_Handler is null
with Export,
Convention => Ada,
External_Name => "__drake_reinstall_exception_handler";
-- Win64 SEH only
function New_Machine_Occurrence_From_SEH (
Exception_Record : System.Address)
return System.Address is (System.Null_Address)
with Export,
Convention => Ada,
External_Name => "__drake_new_machine_occurrence_from_seh";
end nosig;
|
------------------------------------------------------------------------------
-- A d a r u n - t i m e s p e c i f i c a t i o n --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of ada.ads file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
package Interfaces is
pragma Pure(Interfaces);
type Integer_8 is range -2**(8-1) .. 2**(8-1) - 1;
type Unsigned_8 is mod 2**8;
function Shift_Left (Value : Unsigned_8; Amount : Natural)
return Unsigned_8;
function Shift_Right (Value : Unsigned_8; Amount : Natural)
return Unsigned_8;
function Shift_Right_Arithmetic (Value : Unsigned_8; Amount : Natural)
return Unsigned_8;
function Rotate_Left (Value : Unsigned_8; Amount : Natural)
return Unsigned_8;
function Rotate_Right (Value : Unsigned_8; Amount : Natural)
return Unsigned_8;
type Integer_16 is range -2**(16-1) .. 2**(16-1) - 1;
type Unsigned_16 is mod 2**16;
function Shift_Left (Value : Unsigned_16; Amount : Natural)
return Unsigned_16;
function Shift_Right (Value : Unsigned_16; Amount : Natural)
return Unsigned_16;
function Shift_Right_Arithmetic (Value : Unsigned_16; Amount : Natural)
return Unsigned_16;
function Rotate_Left (Value : Unsigned_16; Amount : Natural)
return Unsigned_16;
function Rotate_Right (Value : Unsigned_16; Amount : Natural)
return Unsigned_16;
type Integer_32 is range -2**(32-1) .. 2**(32-1) - 1;
type Unsigned_32 is mod 2**32;
function Shift_Left (Value : Unsigned_32; Amount : Natural)
return Unsigned_32;
function Shift_Right (Value : Unsigned_32; Amount : Natural)
return Unsigned_32;
function Shift_Right_Arithmetic (Value : Unsigned_32; Amount : Natural)
return Unsigned_32;
function Rotate_Left (Value : Unsigned_32; Amount : Natural)
return Unsigned_32;
function Rotate_Right (Value : Unsigned_32; Amount : Natural)
return Unsigned_32;
type Integer_64 is range -2**(64-1) .. 2**(64-1) - 1;
type Unsigned_64 is mod 2**64;
function Shift_Left (Value : Unsigned_64; Amount : Natural)
return Unsigned_64;
function Shift_Right (Value : Unsigned_64; Amount : Natural)
return Unsigned_64;
function Shift_Right_Arithmetic (Value : Unsigned_64; Amount : Natural)
return Unsigned_64;
function Rotate_Left (Value : Unsigned_64; Amount : Natural)
return Unsigned_64;
function Rotate_Right (Value : Unsigned_64; Amount : Natural)
return Unsigned_64;
end Interfaces;
|
package GESTE_Fonts.FreeSerif12pt7b is
Font : constant Bitmap_Font_Ref;
private
FreeSerif12pt7bBitmaps : aliased constant Font_Bitmap := (
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#80#,
16#00#, 16#07#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#70#, 16#00#,
16#01#, 16#80#, 16#00#, 16#02#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#,
16#20#, 16#00#, 16#00#, 16#80#, 16#00#, 16#02#, 16#00#, 16#00#, 16#08#,
16#00#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#,
16#00#, 16#1C#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#02#, 16#20#, 16#00#, 16#19#, 16#80#, 16#00#,
16#22#, 16#00#, 16#00#, 16#88#, 16#00#, 16#02#, 16#20#, 16#00#, 16#08#,
16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#C4#, 16#00#, 16#03#, 16#10#, 16#00#, 16#08#, 16#40#, 16#00#, 16#23#,
16#00#, 16#00#, 16#8C#, 16#00#, 16#1F#, 16#FC#, 16#00#, 16#18#, 16#80#,
16#00#, 16#62#, 16#00#, 16#01#, 16#08#, 16#00#, 16#04#, 16#20#, 16#00#,
16#FF#, 16#E0#, 16#00#, 16#46#, 16#00#, 16#03#, 16#10#, 16#00#, 16#0C#,
16#40#, 16#00#, 16#31#, 16#00#, 16#00#, 16#84#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#10#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#0D#, 16#30#,
16#00#, 16#64#, 16#40#, 16#01#, 16#91#, 16#00#, 16#06#, 16#40#, 16#00#,
16#0D#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#00#,
16#78#, 16#00#, 16#01#, 16#70#, 16#00#, 16#04#, 16#E0#, 16#00#, 16#11#,
16#80#, 16#04#, 16#46#, 16#00#, 16#11#, 16#18#, 16#00#, 16#64#, 16#C0#,
16#00#, 16#7C#, 16#00#, 16#00#, 16#40#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#08#,
16#00#, 16#70#, 16#60#, 16#07#, 16#3F#, 16#00#, 16#18#, 16#8C#, 16#00#,
16#C2#, 16#20#, 16#03#, 16#09#, 16#00#, 16#18#, 16#24#, 16#00#, 16#21#,
16#20#, 16#00#, 16#C8#, 16#8F#, 16#01#, 16#C4#, 16#64#, 16#00#, 16#33#,
16#08#, 16#00#, 16#98#, 16#40#, 16#04#, 16#61#, 16#00#, 16#11#, 16#84#,
16#00#, 16#86#, 16#20#, 16#02#, 16#18#, 16#80#, 16#10#, 16#3C#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#01#,
16#88#, 16#00#, 16#06#, 16#10#, 16#00#, 16#18#, 16#C0#, 16#00#, 16#66#,
16#00#, 16#01#, 16#F3#, 16#E0#, 16#03#, 16#07#, 16#00#, 16#3E#, 16#18#,
16#01#, 16#B8#, 16#40#, 16#0C#, 16#71#, 16#00#, 16#20#, 16#C8#, 16#01#,
16#83#, 16#E0#, 16#06#, 16#07#, 16#00#, 16#1C#, 16#1C#, 16#00#, 16#78#,
16#FC#, 16#40#, 16#7C#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#02#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#20#, 16#00#,
16#00#, 16#80#, 16#00#, 16#02#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#20#, 16#00#,
16#01#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#, 16#40#, 16#00#, 16#03#,
16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#20#, 16#00#, 16#01#, 16#80#,
16#00#, 16#06#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#60#, 16#00#,
16#01#, 16#80#, 16#00#, 16#06#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#,
16#30#, 16#00#, 16#00#, 16#40#, 16#00#, 16#01#, 16#00#, 16#00#, 16#02#,
16#00#, 16#00#, 16#04#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#04#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#, 16#10#,
16#00#, 16#00#, 16#20#, 16#00#, 16#00#, 16#80#, 16#00#, 16#03#, 16#00#,
16#00#, 16#04#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#60#, 16#00#,
16#01#, 16#80#, 16#00#, 16#06#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#,
16#60#, 16#00#, 16#01#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#,
16#00#, 16#00#, 16#80#, 16#00#, 16#04#, 16#00#, 16#00#, 16#20#, 16#00#,
16#01#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#01#, 16#80#, 16#00#, 16#26#, 16#40#, 16#00#, 16#D3#, 16#00#,
16#01#, 16#D8#, 16#00#, 16#01#, 16#80#, 16#00#, 16#0D#, 16#00#, 16#00#,
16#D3#, 16#00#, 16#00#, 16#60#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#,
16#00#, 16#00#, 16#C0#, 16#00#, 16#7F#, 16#F8#, 16#00#, 16#0C#, 16#00#,
16#00#, 16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#,
16#0C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#,
16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#80#,
16#00#, 16#04#, 16#00#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#0C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#60#, 16#00#, 16#01#,
16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#80#,
16#00#, 16#06#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#40#, 16#00#,
16#03#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#20#, 16#00#, 16#01#,
16#80#, 16#00#, 16#06#, 16#00#, 16#00#, 16#10#, 16#00#, 16#00#, 16#C0#,
16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3C#,
16#00#, 16#01#, 16#98#, 16#00#, 16#0C#, 16#30#, 16#00#, 16#60#, 16#60#,
16#01#, 16#81#, 16#80#, 16#06#, 16#06#, 16#00#, 16#18#, 16#18#, 16#00#,
16#60#, 16#60#, 16#01#, 16#81#, 16#80#, 16#06#, 16#06#, 16#00#, 16#18#,
16#18#, 16#00#, 16#60#, 16#60#, 16#01#, 16#81#, 16#80#, 16#06#, 16#06#,
16#00#, 16#0C#, 16#30#, 16#00#, 16#19#, 16#80#, 16#00#, 16#3C#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#, 16#E0#, 16#00#,
16#01#, 16#80#, 16#00#, 16#06#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#,
16#60#, 16#00#, 16#01#, 16#80#, 16#00#, 16#06#, 16#00#, 16#00#, 16#18#,
16#00#, 16#00#, 16#60#, 16#00#, 16#01#, 16#80#, 16#00#, 16#06#, 16#00#,
16#00#, 16#18#, 16#00#, 16#00#, 16#60#, 16#00#, 16#01#, 16#80#, 16#00#,
16#06#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#C0#, 16#00#, 16#21#,
16#80#, 16#01#, 16#03#, 16#00#, 16#04#, 16#0C#, 16#00#, 16#00#, 16#30#,
16#00#, 16#00#, 16#C0#, 16#00#, 16#02#, 16#00#, 16#00#, 16#18#, 16#00#,
16#00#, 16#40#, 16#00#, 16#02#, 16#00#, 16#00#, 16#10#, 16#00#, 16#00#,
16#80#, 16#00#, 16#04#, 16#00#, 16#00#, 16#30#, 16#20#, 16#01#, 16#FF#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F0#,
16#00#, 16#08#, 16#60#, 16#00#, 16#41#, 16#C0#, 16#00#, 16#02#, 16#00#,
16#00#, 16#18#, 16#00#, 16#00#, 16#40#, 16#00#, 16#07#, 16#80#, 16#00#,
16#3F#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#,
16#C0#, 16#00#, 16#01#, 16#00#, 16#00#, 16#04#, 16#00#, 16#00#, 16#20#,
16#00#, 16#71#, 16#80#, 16#00#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#60#, 16#00#,
16#03#, 16#80#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#58#, 16#00#, 16#02#,
16#60#, 16#00#, 16#11#, 16#80#, 16#00#, 16#46#, 16#00#, 16#02#, 16#18#,
16#00#, 16#10#, 16#60#, 16#00#, 16#41#, 16#80#, 16#03#, 16#FF#, 16#80#,
16#00#, 16#18#, 16#00#, 16#00#, 16#60#, 16#00#, 16#01#, 16#80#, 16#00#,
16#06#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#FC#, 16#00#, 16#04#, 16#00#, 16#00#, 16#10#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#03#, 16#E0#, 16#00#, 16#07#, 16#E0#, 16#00#, 16#03#, 16#C0#,
16#00#, 16#07#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#,
16#00#, 16#40#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#,
16#20#, 16#00#, 16#71#, 16#00#, 16#01#, 16#F8#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#78#, 16#00#, 16#03#, 16#80#,
16#00#, 16#1C#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#03#, 16#00#, 16#00#,
16#1D#, 16#E0#, 16#00#, 16#79#, 16#C0#, 16#01#, 16#83#, 16#80#, 16#06#,
16#06#, 16#00#, 16#18#, 16#18#, 16#00#, 16#60#, 16#60#, 16#01#, 16#81#,
16#80#, 16#07#, 16#06#, 16#00#, 16#0C#, 16#10#, 16#00#, 16#18#, 16#C0#,
16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#03#, 16#FE#, 16#00#, 16#10#, 16#10#, 16#00#, 16#80#, 16#C0#, 16#00#,
16#03#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#, 16#60#, 16#00#, 16#01#,
16#80#, 16#00#, 16#04#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#,
16#00#, 16#02#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#, 16#60#, 16#00#,
16#01#, 16#80#, 16#00#, 16#04#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#03#, 16#18#, 16#00#, 16#08#,
16#30#, 16#00#, 16#20#, 16#40#, 16#00#, 16#C3#, 16#00#, 16#03#, 16#0C#,
16#00#, 16#0E#, 16#60#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#3C#, 16#00#,
16#01#, 16#38#, 16#00#, 16#0C#, 16#70#, 16#00#, 16#20#, 16#E0#, 16#01#,
16#81#, 16#80#, 16#06#, 16#06#, 16#00#, 16#0C#, 16#10#, 16#00#, 16#30#,
16#C0#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3C#,
16#00#, 16#03#, 16#18#, 16#00#, 16#08#, 16#30#, 16#00#, 16#60#, 16#C0#,
16#01#, 16#83#, 16#80#, 16#06#, 16#06#, 16#00#, 16#18#, 16#18#, 16#00#,
16#60#, 16#60#, 16#01#, 16#C1#, 16#80#, 16#03#, 16#0E#, 16#00#, 16#07#,
16#F8#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#18#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#07#, 16#00#, 16#00#, 16#70#, 16#00#,
16#07#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#,
16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#,
16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#,
16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#70#,
16#00#, 16#00#, 16#40#, 16#00#, 16#02#, 16#00#, 16#00#, 16#10#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#03#, 16#80#, 16#00#, 16#3C#, 16#00#, 16#03#, 16#C0#, 16#00#,
16#3C#, 16#00#, 16#03#, 16#80#, 16#00#, 16#18#, 16#00#, 16#00#, 16#78#,
16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#78#,
16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#FF#, 16#E0#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#07#, 16#FF#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#04#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#1E#, 16#00#,
16#00#, 16#1E#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#1E#, 16#00#,
16#00#, 16#18#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#3C#, 16#00#, 16#03#,
16#C0#, 16#00#, 16#3C#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#7C#, 16#00#, 16#02#, 16#18#, 16#00#, 16#08#, 16#70#,
16#00#, 16#30#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#,
16#00#, 16#60#, 16#00#, 16#01#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#,
16#20#, 16#00#, 16#01#, 16#00#, 16#00#, 16#04#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#0E#, 16#00#,
16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#0F#, 16#C0#, 16#00#, 16#C0#, 16#C0#, 16#06#, 16#01#, 16#80#,
16#30#, 16#03#, 16#01#, 16#83#, 16#A4#, 16#06#, 16#19#, 16#98#, 16#30#,
16#C6#, 16#20#, 16#C2#, 16#18#, 16#83#, 16#18#, 16#42#, 16#0C#, 16#63#,
16#10#, 16#31#, 16#8C#, 16#40#, 16#66#, 16#72#, 16#01#, 16#8E#, 16#70#,
16#03#, 16#00#, 16#00#, 16#07#, 16#01#, 16#00#, 16#03#, 16#F8#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#,
16#30#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#07#, 16#00#, 16#00#, 16#2E#,
16#00#, 16#00#, 16#98#, 16#00#, 16#06#, 16#70#, 16#00#, 16#10#, 16#C0#,
16#00#, 16#43#, 16#80#, 16#02#, 16#06#, 16#00#, 16#0F#, 16#FC#, 16#00#,
16#60#, 16#70#, 16#01#, 16#00#, 16#E0#, 16#0C#, 16#03#, 16#80#, 16#30#,
16#0F#, 16#03#, 16#E0#, 16#7E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#0F#, 16#FE#, 16#00#, 16#0E#, 16#1C#, 16#00#, 16#18#, 16#38#,
16#00#, 16#60#, 16#60#, 16#01#, 16#81#, 16#80#, 16#06#, 16#06#, 16#00#,
16#18#, 16#30#, 16#00#, 16#7F#, 16#00#, 16#01#, 16#83#, 16#80#, 16#06#,
16#07#, 16#00#, 16#18#, 16#1C#, 16#00#, 16#60#, 16#70#, 16#01#, 16#81#,
16#C0#, 16#06#, 16#07#, 16#00#, 16#38#, 16#38#, 16#03#, 16#FF#, 16#80#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#20#,
16#03#, 16#83#, 16#80#, 16#18#, 16#06#, 16#00#, 16#E0#, 16#08#, 16#03#,
16#00#, 16#20#, 16#1C#, 16#00#, 16#00#, 16#70#, 16#00#, 16#01#, 16#C0#,
16#00#, 16#07#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#70#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#03#, 16#80#, 16#00#, 16#07#, 16#00#, 16#80#,
16#0E#, 16#0C#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#0F#, 16#FE#, 16#00#, 16#0E#, 16#1E#, 16#00#, 16#38#,
16#1C#, 16#00#, 16#E0#, 16#38#, 16#03#, 16#80#, 16#70#, 16#0E#, 16#01#,
16#C0#, 16#38#, 16#03#, 16#00#, 16#E0#, 16#0C#, 16#03#, 16#80#, 16#30#,
16#0E#, 16#00#, 16#C0#, 16#38#, 16#07#, 16#00#, 16#E0#, 16#1C#, 16#03#,
16#80#, 16#60#, 16#0E#, 16#03#, 16#00#, 16#38#, 16#38#, 16#03#, 16#FF#,
16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#FF#,
16#80#, 16#0E#, 16#02#, 16#00#, 16#38#, 16#08#, 16#00#, 16#E0#, 16#00#,
16#03#, 16#80#, 16#00#, 16#0E#, 16#04#, 16#00#, 16#38#, 16#10#, 16#00#,
16#FF#, 16#C0#, 16#03#, 16#81#, 16#00#, 16#0E#, 16#04#, 16#00#, 16#38#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#03#, 16#80#, 16#40#, 16#0E#, 16#01#,
16#00#, 16#38#, 16#1C#, 16#03#, 16#FF#, 16#E0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#0F#, 16#FF#, 16#80#, 16#0E#, 16#02#, 16#00#,
16#38#, 16#08#, 16#00#, 16#E0#, 16#00#, 16#03#, 16#80#, 16#00#, 16#0E#,
16#04#, 16#00#, 16#38#, 16#30#, 16#00#, 16#FF#, 16#C0#, 16#03#, 16#83#,
16#00#, 16#0E#, 16#04#, 16#00#, 16#38#, 16#00#, 16#00#, 16#E0#, 16#00#,
16#03#, 16#80#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#38#, 16#00#, 16#03#,
16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#3F#, 16#20#, 16#03#, 16#83#, 16#80#, 16#1C#, 16#06#, 16#00#, 16#E0#,
16#08#, 16#03#, 16#00#, 16#20#, 16#1C#, 16#00#, 16#00#, 16#70#, 16#00#,
16#01#, 16#C0#, 16#7E#, 16#07#, 16#00#, 16#70#, 16#1C#, 16#01#, 16#80#,
16#70#, 16#06#, 16#01#, 16#C0#, 16#18#, 16#03#, 16#80#, 16#60#, 16#07#,
16#01#, 16#80#, 16#0E#, 16#0E#, 16#00#, 16#0F#, 16#E0#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#E3#, 16#F8#, 16#0E#, 16#03#,
16#80#, 16#38#, 16#0E#, 16#00#, 16#E0#, 16#38#, 16#03#, 16#80#, 16#E0#,
16#0E#, 16#03#, 16#80#, 16#38#, 16#0E#, 16#00#, 16#FF#, 16#F8#, 16#03#,
16#80#, 16#E0#, 16#0E#, 16#03#, 16#80#, 16#38#, 16#0E#, 16#00#, 16#E0#,
16#38#, 16#03#, 16#80#, 16#E0#, 16#0E#, 16#03#, 16#80#, 16#38#, 16#0E#,
16#03#, 16#F8#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#0F#, 16#E0#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#,
16#60#, 16#00#, 16#01#, 16#80#, 16#00#, 16#06#, 16#00#, 16#00#, 16#18#,
16#00#, 16#00#, 16#60#, 16#00#, 16#01#, 16#80#, 16#00#, 16#06#, 16#00#,
16#00#, 16#18#, 16#00#, 16#00#, 16#60#, 16#00#, 16#01#, 16#80#, 16#00#,
16#06#, 16#00#, 16#00#, 16#38#, 16#00#, 16#03#, 16#F8#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#F8#, 16#00#, 16#03#,
16#80#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#03#, 16#80#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#38#, 16#00#,
16#00#, 16#E0#, 16#00#, 16#03#, 16#80#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#38#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#EC#,
16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#0F#, 16#E7#, 16#F0#, 16#0E#, 16#07#, 16#00#, 16#38#, 16#10#,
16#00#, 16#60#, 16#80#, 16#01#, 16#84#, 16#00#, 16#06#, 16#60#, 16#00#,
16#1B#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#01#, 16#B8#, 16#00#, 16#06#,
16#70#, 16#00#, 16#18#, 16#E0#, 16#00#, 16#61#, 16#C0#, 16#01#, 16#83#,
16#80#, 16#0E#, 16#07#, 16#00#, 16#38#, 16#1E#, 16#03#, 16#F8#, 16#FE#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#E0#, 16#00#,
16#0E#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#03#,
16#80#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#03#, 16#80#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#38#, 16#00#,
16#00#, 16#E0#, 16#00#, 16#03#, 16#80#, 16#40#, 16#0E#, 16#01#, 16#00#,
16#38#, 16#1C#, 16#03#, 16#FF#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#0F#, 16#80#, 16#0F#, 16#8F#, 16#00#, 16#78#, 16#1C#,
16#01#, 16#E0#, 16#78#, 16#0F#, 16#81#, 16#E0#, 16#2E#, 16#05#, 16#C0#,
16#B8#, 16#17#, 16#04#, 16#E0#, 16#4E#, 16#13#, 16#81#, 16#38#, 16#CE#,
16#04#, 16#72#, 16#38#, 16#11#, 16#D8#, 16#E0#, 16#43#, 16#C3#, 16#81#,
16#0F#, 16#0E#, 16#04#, 16#18#, 16#38#, 16#30#, 16#60#, 16#E3#, 16#F1#,
16#0F#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#81#,
16#F8#, 16#0F#, 16#01#, 16#80#, 16#1C#, 16#02#, 16#00#, 16#78#, 16#08#,
16#01#, 16#70#, 16#20#, 16#04#, 16#E0#, 16#80#, 16#13#, 16#C2#, 16#00#,
16#47#, 16#88#, 16#01#, 16#0E#, 16#20#, 16#04#, 16#1C#, 16#80#, 16#10#,
16#3A#, 16#00#, 16#40#, 16#78#, 16#01#, 16#01#, 16#E0#, 16#04#, 16#03#,
16#80#, 16#30#, 16#06#, 16#03#, 16#F0#, 16#08#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#00#, 16#03#, 16#86#, 16#00#,
16#18#, 16#0E#, 16#00#, 16#E0#, 16#18#, 16#07#, 16#00#, 16#70#, 16#1C#,
16#00#, 16#C0#, 16#70#, 16#03#, 16#01#, 16#C0#, 16#0E#, 16#07#, 16#00#,
16#38#, 16#1C#, 16#00#, 16#C0#, 16#70#, 16#07#, 16#01#, 16#C0#, 16#1C#,
16#03#, 16#80#, 16#60#, 16#06#, 16#03#, 16#80#, 16#0C#, 16#1C#, 16#00#,
16#0F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#,
16#FC#, 16#00#, 16#0E#, 16#1C#, 16#00#, 16#38#, 16#38#, 16#00#, 16#E0#,
16#E0#, 16#03#, 16#83#, 16#80#, 16#0E#, 16#0E#, 16#00#, 16#38#, 16#30#,
16#00#, 16#E1#, 16#C0#, 16#03#, 16#FC#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#38#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#03#, 16#80#, 16#00#, 16#0E#,
16#00#, 16#00#, 16#38#, 16#00#, 16#03#, 16#F8#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#00#, 16#03#, 16#86#,
16#00#, 16#18#, 16#0E#, 16#00#, 16#E0#, 16#18#, 16#07#, 16#00#, 16#70#,
16#1C#, 16#00#, 16#C0#, 16#70#, 16#03#, 16#01#, 16#C0#, 16#0E#, 16#07#,
16#00#, 16#38#, 16#1C#, 16#00#, 16#C0#, 16#70#, 16#07#, 16#00#, 16#C0#,
16#1C#, 16#03#, 16#80#, 16#60#, 16#06#, 16#03#, 16#00#, 16#0E#, 16#18#,
16#00#, 16#0F#, 16#80#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#00#, 16#3C#, 16#00#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#0F#, 16#FC#, 16#00#, 16#0E#, 16#1C#, 16#00#, 16#38#, 16#38#, 16#00#,
16#E0#, 16#E0#, 16#03#, 16#83#, 16#80#, 16#0E#, 16#0E#, 16#00#, 16#38#,
16#38#, 16#00#, 16#E3#, 16#C0#, 16#03#, 16#FC#, 16#00#, 16#0E#, 16#60#,
16#00#, 16#39#, 16#C0#, 16#00#, 16#E3#, 16#80#, 16#03#, 16#87#, 16#00#,
16#0E#, 16#0E#, 16#00#, 16#38#, 16#1C#, 16#03#, 16#F8#, 16#7C#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F4#, 16#00#, 16#0C#,
16#38#, 16#00#, 16#30#, 16#60#, 16#01#, 16#C0#, 16#80#, 16#07#, 16#02#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#3C#, 16#00#,
16#00#, 16#7C#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#E0#, 16#01#,
16#01#, 16#80#, 16#04#, 16#06#, 16#00#, 16#18#, 16#18#, 16#00#, 16#70#,
16#C0#, 16#01#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#0F#, 16#FF#, 16#C0#, 16#30#, 16#E3#, 16#00#, 16#83#, 16#84#,
16#02#, 16#0E#, 16#10#, 16#00#, 16#38#, 16#00#, 16#00#, 16#E0#, 16#00#,
16#03#, 16#80#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#,
16#E0#, 16#00#, 16#03#, 16#80#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#38#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#03#, 16#80#, 16#00#, 16#3F#, 16#80#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#E1#, 16#F8#,
16#0E#, 16#01#, 16#80#, 16#38#, 16#02#, 16#00#, 16#60#, 16#08#, 16#01#,
16#80#, 16#20#, 16#06#, 16#00#, 16#80#, 16#18#, 16#02#, 16#00#, 16#60#,
16#08#, 16#01#, 16#80#, 16#20#, 16#06#, 16#00#, 16#80#, 16#18#, 16#02#,
16#00#, 16#60#, 16#08#, 16#01#, 16#80#, 16#40#, 16#07#, 16#01#, 16#00#,
16#0E#, 16#08#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#0F#, 16#E0#, 16#F8#, 16#0E#, 16#01#, 16#80#, 16#38#,
16#06#, 16#00#, 16#60#, 16#10#, 16#01#, 16#C0#, 16#40#, 16#03#, 16#02#,
16#00#, 16#0E#, 16#08#, 16#00#, 16#18#, 16#60#, 16#00#, 16#71#, 16#00#,
16#00#, 16#CC#, 16#00#, 16#03#, 16#A0#, 16#00#, 16#06#, 16#80#, 16#00#,
16#1E#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#02#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#CF#,
16#C3#, 16#DE#, 16#1C#, 16#06#, 16#38#, 16#30#, 16#18#, 16#60#, 16#E0#,
16#41#, 16#C1#, 16#81#, 16#07#, 16#07#, 16#08#, 16#0C#, 16#3C#, 16#20#,
16#38#, 16#B0#, 16#80#, 16#66#, 16#E4#, 16#01#, 16#D1#, 16#90#, 16#07#,
16#47#, 16#80#, 16#0E#, 16#1E#, 16#00#, 16#38#, 16#38#, 16#00#, 16#E0#,
16#C0#, 16#01#, 16#01#, 16#00#, 16#04#, 16#04#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#07#, 16#F1#, 16#F8#, 16#0F#, 16#01#, 16#80#,
16#1C#, 16#0C#, 16#00#, 16#38#, 16#60#, 16#00#, 16#71#, 16#00#, 16#00#,
16#C8#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#07#, 16#00#, 16#00#, 16#1E#,
16#00#, 16#00#, 16#D8#, 16#00#, 16#06#, 16#70#, 16#00#, 16#10#, 16#E0#,
16#00#, 16#81#, 16#C0#, 16#04#, 16#07#, 16#00#, 16#30#, 16#1E#, 16#03#,
16#F0#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#,
16#E1#, 16#F8#, 16#0E#, 16#01#, 16#80#, 16#1C#, 16#04#, 16#00#, 16#70#,
16#20#, 16#00#, 16#E1#, 16#80#, 16#01#, 16#C4#, 16#00#, 16#03#, 16#20#,
16#00#, 16#0F#, 16#80#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#70#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#07#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#,
16#70#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#1F#, 16#C0#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#FF#, 16#C0#, 16#18#, 16#0E#,
16#00#, 16#40#, 16#30#, 16#02#, 16#01#, 16#C0#, 16#00#, 16#0E#, 16#00#,
16#00#, 16#70#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#70#, 16#00#, 16#01#, 16#80#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#70#,
16#00#, 16#03#, 16#80#, 16#40#, 16#0E#, 16#01#, 16#00#, 16#70#, 16#0C#,
16#03#, 16#FF#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#03#, 16#E0#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#,
16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#,
16#00#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#,
16#00#, 16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#,
16#0C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#03#,
16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#F8#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#10#,
16#00#, 16#00#, 16#60#, 16#00#, 16#01#, 16#80#, 16#00#, 16#02#, 16#00#,
16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#40#, 16#00#,
16#01#, 16#80#, 16#00#, 16#06#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#,
16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#01#, 16#00#, 16#00#, 16#06#,
16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#07#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#,
16#00#, 16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#,
16#0C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#03#,
16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#,
16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#,
16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#01#,
16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#,
16#03#, 16#80#, 16#00#, 16#0B#, 16#00#, 16#00#, 16#6C#, 16#00#, 16#01#,
16#18#, 16#00#, 16#0C#, 16#60#, 16#00#, 16#20#, 16#C0#, 16#01#, 16#83#,
16#00#, 16#04#, 16#06#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#F0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#,
16#00#, 16#18#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#20#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#,
16#80#, 16#00#, 16#63#, 16#00#, 16#01#, 16#84#, 16#00#, 16#00#, 16#18#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#0D#, 16#80#, 16#00#, 16#C6#, 16#00#,
16#06#, 16#18#, 16#00#, 16#18#, 16#60#, 16#00#, 16#63#, 16#80#, 16#01#,
16#F7#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#0F#,
16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#,
16#00#, 16#03#, 16#00#, 16#00#, 16#0D#, 16#E0#, 16#00#, 16#38#, 16#C0#,
16#00#, 16#C1#, 16#80#, 16#03#, 16#06#, 16#00#, 16#0C#, 16#18#, 16#00#,
16#30#, 16#60#, 16#00#, 16#C1#, 16#80#, 16#03#, 16#06#, 16#00#, 16#0C#,
16#10#, 16#00#, 16#30#, 16#80#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#03#, 16#C0#, 16#00#, 16#31#, 16#80#, 16#00#, 16#86#, 16#00#, 16#06#,
16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#40#, 16#00#, 16#01#, 16#80#,
16#00#, 16#06#, 16#00#, 16#00#, 16#18#, 16#10#, 16#00#, 16#30#, 16#80#,
16#00#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#,
16#00#, 16#3C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#, 16#00#,
16#03#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#03#, 16#B0#, 16#00#, 16#31#,
16#C0#, 16#00#, 16#83#, 16#00#, 16#06#, 16#0C#, 16#00#, 16#18#, 16#30#,
16#00#, 16#60#, 16#C0#, 16#01#, 16#83#, 16#00#, 16#06#, 16#0C#, 16#00#,
16#18#, 16#30#, 16#00#, 16#31#, 16#E0#, 16#00#, 16#7B#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#07#, 16#C0#, 16#00#, 16#21#, 16#80#, 16#01#, 16#86#, 16#00#,
16#07#, 16#FC#, 16#00#, 16#10#, 16#00#, 16#00#, 16#40#, 16#00#, 16#01#,
16#80#, 16#00#, 16#06#, 16#00#, 16#00#, 16#18#, 16#10#, 16#00#, 16#30#,
16#80#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3C#,
16#00#, 16#01#, 16#98#, 16#00#, 16#04#, 16#00#, 16#00#, 16#30#, 16#00#,
16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#3F#, 16#80#, 16#00#,
16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#,
16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#00#,
16#00#, 16#0C#, 16#00#, 16#00#, 16#38#, 16#00#, 16#03#, 16#F0#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#07#, 16#80#, 16#00#, 16#33#, 16#E0#, 16#00#, 16#86#,
16#00#, 16#06#, 16#18#, 16#00#, 16#1C#, 16#20#, 16#00#, 16#31#, 16#80#,
16#00#, 16#3C#, 16#00#, 16#03#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#,
16#3F#, 16#C0#, 16#00#, 16#80#, 16#80#, 16#04#, 16#02#, 16#00#, 16#10#,
16#08#, 16#00#, 16#C0#, 16#40#, 16#01#, 16#82#, 16#00#, 16#03#, 16#F0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#C0#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#,
16#00#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0D#, 16#E0#,
16#00#, 16#38#, 16#C0#, 16#00#, 16#C3#, 16#00#, 16#03#, 16#0C#, 16#00#,
16#0C#, 16#30#, 16#00#, 16#30#, 16#C0#, 16#00#, 16#C3#, 16#00#, 16#03#,
16#0C#, 16#00#, 16#0C#, 16#30#, 16#00#, 16#30#, 16#C0#, 16#03#, 16#E7#,
16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#,
16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#,
16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#,
16#00#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#,
16#00#, 16#38#, 16#00#, 16#03#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#,
16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#,
16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#,
16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#,
16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#,
16#00#, 16#03#, 16#20#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#0F#,
16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#,
16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#7C#, 16#00#, 16#30#, 16#C0#,
16#00#, 16#C4#, 16#00#, 16#03#, 16#20#, 16#00#, 16#0F#, 16#00#, 16#00#,
16#36#, 16#00#, 16#00#, 16#DC#, 16#00#, 16#03#, 16#38#, 16#00#, 16#0C#,
16#60#, 16#00#, 16#30#, 16#E0#, 16#03#, 16#F7#, 16#C0#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#C0#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#0C#, 16#00#,
16#00#, 16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#,
16#0C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#03#,
16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#,
16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#,
16#03#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3C#, 16#E3#, 16#C0#, 16#3C#,
16#F3#, 16#00#, 16#C3#, 16#06#, 16#03#, 16#0C#, 16#18#, 16#0C#, 16#30#,
16#60#, 16#30#, 16#C1#, 16#80#, 16#C3#, 16#06#, 16#03#, 16#0C#, 16#18#,
16#0C#, 16#30#, 16#60#, 16#30#, 16#E1#, 16#83#, 16#F7#, 16#DF#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#3D#, 16#E0#, 16#00#, 16#39#, 16#C0#, 16#00#, 16#C3#, 16#00#,
16#03#, 16#0C#, 16#00#, 16#0C#, 16#30#, 16#00#, 16#30#, 16#C0#, 16#00#,
16#C3#, 16#00#, 16#03#, 16#0C#, 16#00#, 16#0C#, 16#30#, 16#00#, 16#30#,
16#C0#, 16#03#, 16#EF#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#00#,
16#31#, 16#C0#, 16#01#, 16#83#, 16#00#, 16#06#, 16#06#, 16#00#, 16#18#,
16#18#, 16#00#, 16#60#, 16#60#, 16#01#, 16#81#, 16#80#, 16#06#, 16#06#,
16#00#, 16#1C#, 16#10#, 16#00#, 16#38#, 16#C0#, 16#00#, 16#3C#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#3D#, 16#E0#, 16#00#, 16#38#, 16#C0#, 16#00#, 16#C1#,
16#80#, 16#03#, 16#06#, 16#00#, 16#0C#, 16#18#, 16#00#, 16#30#, 16#60#,
16#00#, 16#C1#, 16#80#, 16#03#, 16#06#, 16#00#, 16#0C#, 16#10#, 16#00#,
16#38#, 16#C0#, 16#00#, 16#DC#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#,
16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#0F#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#D0#,
16#00#, 16#31#, 16#C0#, 16#00#, 16#83#, 16#00#, 16#06#, 16#0C#, 16#00#,
16#18#, 16#30#, 16#00#, 16#60#, 16#C0#, 16#01#, 16#83#, 16#00#, 16#06#,
16#0C#, 16#00#, 16#18#, 16#30#, 16#00#, 16#70#, 16#C0#, 16#00#, 16#7F#,
16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#,
16#00#, 16#03#, 16#00#, 16#00#, 16#3F#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#0D#, 16#C0#, 16#00#, 16#7B#, 16#00#, 16#00#,
16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#,
16#00#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#,
16#00#, 16#30#, 16#00#, 16#03#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#,
16#80#, 16#00#, 16#62#, 16#00#, 16#01#, 16#08#, 16#00#, 16#06#, 16#00#,
16#00#, 16#1E#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#3C#, 16#00#,
16#00#, 16#30#, 16#00#, 16#10#, 16#C0#, 16#00#, 16#62#, 16#00#, 16#00#,
16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#40#,
16#00#, 16#03#, 16#00#, 16#00#, 16#1F#, 16#00#, 16#00#, 16#30#, 16#00#,
16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#,
16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#,
16#00#, 16#00#, 16#32#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#3C#, 16#F0#, 16#00#, 16#70#, 16#C0#, 16#00#, 16#C3#, 16#00#, 16#03#,
16#0C#, 16#00#, 16#0C#, 16#30#, 16#00#, 16#30#, 16#C0#, 16#00#, 16#C3#,
16#00#, 16#03#, 16#0C#, 16#00#, 16#0C#, 16#30#, 16#00#, 16#31#, 16#C0#,
16#00#, 16#7B#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#38#, 16#00#, 16#70#,
16#40#, 16#00#, 16#C1#, 16#00#, 16#03#, 16#08#, 16#00#, 16#06#, 16#20#,
16#00#, 16#19#, 16#00#, 16#00#, 16#34#, 16#00#, 16#00#, 16#D0#, 16#00#,
16#01#, 16#80#, 16#00#, 16#06#, 16#00#, 16#00#, 16#10#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#3C#, 16#F9#, 16#C0#, 16#61#, 16#83#, 16#01#, 16#C3#, 16#08#,
16#03#, 16#0C#, 16#20#, 16#0C#, 16#31#, 16#00#, 16#19#, 16#64#, 16#00#,
16#65#, 16#A0#, 16#00#, 16#E3#, 16#80#, 16#03#, 16#8E#, 16#00#, 16#0C#,
16#30#, 16#00#, 16#10#, 16#40#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#F0#, 16#00#,
16#31#, 16#80#, 16#00#, 16#64#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#03#,
16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#01#, 16#30#,
16#00#, 16#08#, 16#60#, 16#00#, 16#61#, 16#C0#, 16#03#, 16#CF#, 16#80#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#3E#, 16#38#, 16#00#, 16#70#, 16#40#, 16#00#, 16#C1#,
16#00#, 16#03#, 16#08#, 16#00#, 16#06#, 16#20#, 16#00#, 16#18#, 16#80#,
16#00#, 16#34#, 16#00#, 16#00#, 16#D0#, 16#00#, 16#01#, 16#80#, 16#00#,
16#06#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#, 16#40#, 16#00#, 16#01#,
16#00#, 16#00#, 16#08#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#07#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#E0#,
16#00#, 16#43#, 16#80#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#60#, 16#00#,
16#03#, 16#80#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#60#, 16#00#, 16#03#,
16#80#, 16#00#, 16#0C#, 16#10#, 16#00#, 16#60#, 16#80#, 16#03#, 16#FE#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#60#,
16#00#, 16#01#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#,
16#00#, 16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#,
16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#0C#,
16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#00#,
16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#, 16#00#,
16#01#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#80#, 16#00#, 16#02#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#,
16#20#, 16#00#, 16#00#, 16#80#, 16#00#, 16#02#, 16#00#, 16#00#, 16#08#,
16#00#, 16#00#, 16#20#, 16#00#, 16#00#, 16#80#, 16#00#, 16#02#, 16#00#,
16#00#, 16#08#, 16#00#, 16#00#, 16#20#, 16#00#, 16#00#, 16#80#, 16#00#,
16#02#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#, 16#20#, 16#00#, 16#00#,
16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#C0#, 16#00#, 16#01#, 16#80#, 16#00#, 16#02#, 16#00#, 16#00#, 16#0C#,
16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#00#,
16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#C0#, 16#00#,
16#00#, 16#C0#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#,
16#C0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#30#,
16#00#, 16#00#, 16#C0#, 16#00#, 16#02#, 16#00#, 16#00#, 16#18#, 16#00#,
16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#66#, 16#20#, 16#01#, 16#07#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#);
Font_D : aliased constant Bitmap_Font :=
(
Bytes_Per_Glyph => 77,
Glyph_Width => 22,
Glyph_Height => 28,
Data => FreeSerif12pt7bBitmaps'Access);
Font : constant Bitmap_Font_Ref := Font_D'Access;
end GESTE_Fonts.FreeSerif12pt7b;
|
-----------------------------------------------------------------------
-- mat-frames - Representation of stack frames
-- Copyright (C) 2014, 2015, 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 MAT.Types;
package MAT.Frames is
Not_Found : exception;
type Frame_Type is private;
type Frame_Table is array (Natural range <>) of MAT.Types.Target_Addr;
-- Return the parent frame.
function Parent (Frame : in Frame_Type) return Frame_Type;
-- Returns the backtrace of the current frame (up to the root).
-- When <tt>Max_Level</tt> is positive, limit the number of PC frames to the value.
function Backtrace (Frame : in Frame_Type;
Max_Level : in Natural := 0) return Frame_Table;
-- Returns all the direct calls made by the current frame.
function Calls (Frame : in Frame_Type) return Frame_Table;
-- Returns the number of children in the frame.
-- When recursive is true, compute in the sub-tree.
function Count_Children (Frame : in Frame_Type;
Recursive : in Boolean := False) return Natural;
-- Returns the current stack depth (# of calls from the root
-- to reach the frame).
function Current_Depth (Frame : in Frame_Type) return Natural;
-- Find the child frame which has the given PC address.
-- Returns that frame pointer or raises the Not_Found exception.
function Find (Frame : in Frame_Type;
Pc : in MAT.Types.Target_Addr) return Frame_Type;
-- Check whether the frame contains a call to the function described by the address range.
function In_Function (Frame : in Frame_Type;
From : in MAT.Types.Target_Addr;
To : in MAT.Types.Target_Addr) return Boolean;
-- Check whether the inner most frame contains a call to the function described by
-- the address range. This function looks only at the inner most frame and not the
-- whole stack frame.
function By_Function (Frame : in Frame_Type;
From : in MAT.Types.Target_Addr;
To : in MAT.Types.Target_Addr) return Boolean;
private
type Frame;
type Frame_Type is access all Frame;
-- The frame information is readonly and we can safely use the By_Function, In_Function
-- and Backtrace without protection. Insertion and creation of stack frame must be
-- protected through a protected type managed by Target_Frames. All the frame instances
-- are released when the Target_Frames protected type is released.
type Frame (Parent : Frame_Type;
Depth : Natural;
Pc : MAT.Types.Target_Addr) is limited
record
Next : Frame_Type := null;
Children : Frame_Type := null;
Used : Natural := 0;
end record;
-- Create a root for stack frame representation.
function Create_Root return Frame_Type;
-- Insert in the frame tree the new stack frame represented by <tt>Pc</tt>.
-- If the frame is already known, the frame reference counter is incremented.
-- The frame represented by <tt>Pc</tt> is returned in <tt>Result</tt>.
procedure Insert (Frame : in Frame_Type;
Pc : in Frame_Table;
Result : out Frame_Type);
-- Destroy the frame tree recursively.
procedure Destroy (Frame : in out Frame_Type);
end MAT.Frames;
|
package body gel.remote.World
is
function refined (Self : in coarse_Vector_3) return math.Vector_3
is
begin
return (math.Real (Self (1)),
math.Real (Self (2)),
math.Real (Self (3)));
end refined;
function coarsen (Self : in math.Vector_3) return coarse_Vector_3
is
Result : coarse_Vector_3;
begin
begin
Result (1) := coarse_Real (Self (1));
exception
when constraint_Error =>
if Self (1) > 0.0 then
Result (1) := coarse_Real'Last;
else
Result (1) := coarse_Real'First;
end if;
end;
begin
Result (2) := coarse_Real (Self (2));
exception
when constraint_Error =>
if Self (2) > 0.0 then
Result (2) := coarse_Real'Last;
else
Result (2) := coarse_Real'First;
end if;
end;
begin
Result (3) := coarse_Real (Self (3));
exception
when constraint_Error =>
if Self (3) > 0.0 then
Result (3) := coarse_Real'Last;
else
Result (3) := coarse_Real'First;
end if;
end;
return Result;
end coarsen;
function refined (Self : in coarse_Quaternion) return math.Quaternion
is
begin
return (R => math.Real (Self (1)),
V => (math.Real (Self (2)),
math.Real (Self (3)),
math.Real (Self (4))));
end refined;
function coarsen (Self : in math.Quaternion) return coarse_Quaternion
is
Result : coarse_Quaternion;
begin
begin
Result (1) := coarse_Real2 (Self.R);
exception
when constraint_Error =>
if Self.R > 0.0 then
Result (1) := coarse_Real2'Last;
else
Result (1) := coarse_Real2'First;
end if;
end;
begin
Result (2) := coarse_Real2 (Self.V (1));
exception
when constraint_Error =>
if Self.V (1) > 0.0 then
Result (2) := coarse_Real2'Last;
else
Result (2) := coarse_Real2'First;
end if;
end;
begin
Result (3) := coarse_Real2 (Self.V (2));
exception
when constraint_Error =>
if Self.V (2) > 0.0 then
Result (3) := coarse_Real2'Last;
else
Result (3) := coarse_Real2'First;
end if;
end;
begin
Result (4) := coarse_Real2 (Self.V (3));
exception
when Constraint_Error =>
if Self.V (3) > 0.0 then
Result (4) := coarse_Real2'Last;
else
Result (4) := coarse_Real2'First;
end if;
end;
return Result;
end coarsen;
-----------
--- Streams
--
use ada.Streams;
number_of_stream_Elements_for_a_motion_Update : constant Stream_Element_Offset
:= motion_Update'Size / Stream_Element'Size;
procedure motion_Updates_write (Stream : access ada.Streams.Root_Stream_type'Class; Item : in motion_Updates)
is
stream_element_array_Length : constant Stream_Element_Offset
:= Item'Length * number_of_stream_Elements_for_a_Motion_Update;
subtype the_Stream_Element_Array is Stream_Element_Array (1 .. stream_element_array_Length);
function to_Stream_Element_Array is new ada.unchecked_Conversion (motion_Updates, the_Stream_Element_Array);
begin
write (Stream.all, to_Stream_Element_Array (Item));
end motion_Updates_write;
procedure motion_Updates_read (Stream : access ada.Streams.Root_Stream_type'Class; Item : out motion_Updates)
is
subtype the_Stream_Element_Array
is Stream_Element_Array (1 .. Item'Length * number_of_stream_Elements_for_a_motion_Update);
subtype the_motion_Updates is motion_Updates (1 .. Item'Length);
function to_motion_Updates is new ada.unchecked_Conversion (the_Stream_Element_Array, the_motion_Updates);
the_Stream_Array : the_Stream_Element_Array;
Last : Stream_Element_Offset;
begin
read (Stream.all, the_Stream_Array, Last);
pragma assert (Last = the_Stream_Array'Last);
Item := to_motion_Updates (the_Stream_Array (1 .. Last));
end motion_Updates_read;
procedure Write (Stream : not null access ada.Streams.Root_Stream_type'Class;
the_Event : in new_model_Event)
is
begin
openGL.remote_Model.item'Class'Output (Stream,
the_Event.Model.all);
end Write;
procedure Read (Stream : not null access ada.Streams.Root_Stream_type'Class;
the_Event : out new_model_Event)
is
begin
the_Event.Model := new openGL.remote_Model.item'Class' (openGL.remote_Model.item'Class'Input (Stream));
end Read;
procedure Write (Stream : not null access ada.Streams.Root_Stream_type'Class;
the_Event : in new_physics_model_Event)
is
begin
physics.Remote.Model.item'Class'Output (Stream, the_Event.Model.all);
end Write;
procedure Read (Stream : not null access ada.Streams.Root_Stream_type'Class;
the_Event : out new_physics_model_Event)
is
begin
the_Event.Model := new physics.remote.Model.item'Class' (physics.remote.Model.item'Class'Input (Stream));
end Read;
end gel.remote.World;
|
with Ada.Text_IO;
with Ada.Unchecked_Deallocation;
with ARM_Output;
with ARM_Contents;
package ARM_Texinfo is
--
-- Ada reference manual formatter.
--
-- This package defines the TEXINFO output object.
-- Output objects are responsible for implementing the details of
-- a particular format.
--
-- ---------------------------------------
--
-- Copyright (C) 2003, 2007, 2011, 2013, 2018 Stephen Leake. All Rights Reserved.
-- E-Mail: stephen_leake@stephe-leake.org
--
-- This library is free software; you can redistribute it and/or
-- modify it under terms of the GNU General Public License as
-- published by the Free Software Foundation; either version 3, or (at
-- your option) any later version. This library is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-- PURPOSE. See the GNU General Public License for more details. You
-- should have received a copy of the GNU General Public License
-- distributed with this program; see file gnu-3-0.txt. If not, write to
-- the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
-- MA 02111-1307, USA.
-- ---------------------------------------
--
-- Edit History:
--
-- Ancient - S L - Developed package as add-on to Arm_Form.
-- 10/19/11 - RLB - Integrated outside-developed package into Arm_Form.
-- Commented out/replaced Ada 2005 features (this is
-- Ada 95 code). Updated for a few other changes since
-- the last update.
-- 10/25/11 - RLB - Added old insertion version to Revised_Clause_Header.
-- 4/ 1/12 - S L - Various revisions.
-- 8/31/12 - RLB - Added Output_Path.
-- 11/26/12 - RLB - Added subdivision names to Clause_Header and
-- Revised_Clause_Header.
type Texinfo_Output_Type is new ARM_Output.Output_Type with private;
--not overriding - Ada 2005-only
procedure Create
(Output_Object : in out Texinfo_Output_Type;
File_Prefix : in String;
Output_Path : in String;
Change_Version : in ARM_Contents.Change_Version_Type;
Title : in String);
-- Create an Output_Object for a document.
-- overriding - Ada 2005-only
procedure Close (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Section
(Output_Object : in out Texinfo_Output_Type;
Section_Title : in String;
Section_Name : in String);
-- overriding
procedure Set_Columns
(Output_Object : in out Texinfo_Output_Type;
Number_of_Columns : in ARM_Output.Column_Count);
-- overriding
procedure Start_Paragraph
(Output_Object : in out Texinfo_Output_Type;
Style : in ARM_Output.Paragraph_Style_Type;
Indent : in ARM_Output.Paragraph_Indent_Type;
Number : in String;
No_Prefix : in Boolean := False;
Tab_Stops : in ARM_Output.Tab_Info := ARM_Output.NO_TABS;
No_Breaks : in Boolean := False;
Keep_with_Next : in Boolean := False;
Space_After : in ARM_Output.Space_After_Type := ARM_Output.Normal;
Justification : in ARM_Output.Justification_Type := ARM_Output.Default);
-- overriding
procedure End_Paragraph (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Category_Header
(Output_Object : in out Texinfo_Output_Type;
Header_Text : String);
-- overriding
procedure Clause_Header
(Output_Object : in out Texinfo_Output_Type;
Header_Text : in String;
Level : in ARM_Contents.Level_Type;
Clause_Number : in String;
Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind;
No_Page_Break : in Boolean := False);
-- overriding
procedure Revised_Clause_Header
(Output_Object : in out Texinfo_Output_Type;
New_Header_Text : in String;
Old_Header_Text : in String;
Level : in ARM_Contents.Level_Type;
Clause_Number : in String;
Version : in ARM_Contents.Change_Version_Type;
Old_Version : in ARM_Contents.Change_Version_Type;
Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind;
No_Page_Break : in Boolean := False);
-- overriding
procedure TOC_Marker (Output_Object : in out Texinfo_Output_Type;
For_Start : in Boolean);
-- overriding
procedure New_Page (Output_Object : in out Texinfo_Output_Type;
Kind : ARM_Output.Page_Kind_Type := ARM_Output.Any_Page);
-- overriding
procedure New_Column (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Separator_Line (Output_Object : in out Texinfo_Output_Type;
Is_Thin : Boolean := True);
-- overriding
procedure Start_Table
(Output_Object : in out Texinfo_Output_Type;
Columns : in ARM_Output.Column_Count;
First_Column_Width : in ARM_Output.Column_Count;
Last_Column_Width : in ARM_Output.Column_Count;
Alignment : in ARM_Output.Column_Text_Alignment;
No_Page_Break : in Boolean;
Has_Border : in Boolean;
Small_Text_Size : in Boolean;
Header_Kind : in ARM_Output.Header_Kind_Type);
-- overriding
procedure Table_Marker (Output_Object : in out Texinfo_Output_Type;
Marker : in ARM_Output.Table_Marker_Type);
-- overriding
procedure Ordinary_Text (Output_Object : in out Texinfo_Output_Type;
Text : in String);
-- overriding
procedure Ordinary_Character (Output_Object : in out Texinfo_Output_Type;
Char : in Character);
-- overriding
procedure Hard_Space (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Line_Break (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Index_Line_Break (Output_Object : in out Texinfo_Output_Type;
Clear_Keep_with_Next : in Boolean);
-- overriding
procedure Soft_Line_Break (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Soft_Hyphen_Break (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Tab (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Special_Character
(Output_Object : in out Texinfo_Output_Type;
Char : in ARM_Output.Special_Character_Type);
-- overriding
procedure Unicode_Character
(Output_Object : in out Texinfo_Output_Type;
Char : in ARM_Output.Unicode_Type);
-- overriding
procedure End_Hang_Item (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Text_Format
(Output_Object : in out Texinfo_Output_Type;
Format : in ARM_Output.Format_Type);
-- overriding
procedure Clause_Reference (Output_Object : in out Texinfo_Output_Type;
Text : in String;
Clause_Number : in String);
-- overriding
procedure Index_Target
(Output_Object : in out Texinfo_Output_Type;
Index_Key : in Natural);
-- overriding
procedure Index_Reference
(Output_Object : in out Texinfo_Output_Type;
Text : in String;
Index_Key : in Natural;
Clause_Number : in String);
-- overriding
procedure DR_Reference
(Output_Object : in out Texinfo_Output_Type;
Text : in String;
DR_Number : in String);
-- overriding
procedure AI_Reference
(Output_Object : in out Texinfo_Output_Type;
Text : in String;
AI_Number : in String);
-- overriding
procedure Local_Target
(Output_Object : in out Texinfo_Output_Type;
Text : in String;
Target : in String);
-- overriding
procedure Local_Link
(Output_Object : in out Texinfo_Output_Type;
Text : in String;
Target : in String;
Clause_Number : in String);
-- overriding
procedure Local_Link_Start
(Output_Object : in out Texinfo_Output_Type;
Target : in String;
Clause_Number : in String);
-- overriding
procedure Local_Link_End
(Output_Object : in out Texinfo_Output_Type;
Target : in String;
Clause_Number : in String);
-- overriding
procedure URL_Link
(Output_Object : in out Texinfo_Output_Type;
Text : in String;
URL : in String);
-- overriding
procedure Picture
(Output_Object : in out Texinfo_Output_Type;
Name : in String;
Descr : in String;
Alignment : in ARM_Output.Picture_Alignment;
Height, Width : in Natural;
Border : in ARM_Output.Border_Kind);
private
subtype Column_Index_Type is Integer range 1 .. 5;
type Column_Text_Item_Type;
type Column_Text_Ptr is access Column_Text_Item_Type;
type Column_Text_Item_Type is record
Text : String (1 .. 80);
Length : Natural;
Row : Natural; -- Which row in the column.
Next : Column_Text_Ptr;
end record;
type Column_Text_Ptrs_Type is array (Column_Index_Type) of Column_Text_Ptr;
type Column_Widths_Type is array (Column_Index_Type) of Natural;
procedure Free is new Ada.Unchecked_Deallocation (Column_Text_Item_Type, Column_Text_Ptr);
type State_Type is (Title, Contents, Table_Header, Multi_Column, Normal, Index_Start, Index);
type Texinfo_Output_Type is new ARM_Output.Output_Type with record
File : Ada.Text_IO.File_Type;
Is_Valid : Boolean := False;
State : State_Type;
In_Paragraph : Boolean := False; -- Sub-state within major states
Style : ARM_Output.Paragraph_Style_Type;
Indent : ARM_Output.Paragraph_Indent_Type;
Format : ARM_Output.Format_Type := ARM_Output.Normal_Format;
End_Hang_Seen : Boolean;
-- Detecting end of title page
Line_Empty : Boolean := False; -- True if current line contains only whitespace.
First_Word : String (1 .. 80);
First_Word_Last : Natural;
-- Building menus
Menu_Section : ARM_Contents.Section_Number_Type := 0;
Menu_Clause : Natural := 0;
-- Table and Multi-Column format
Column_Count : ARM_Output.Column_Count;
Current_Column : Natural;
Current_Row : Natural;
Column_Text : Column_Text_Ptrs_Type := (others => null);
Column_Widths : Column_Widths_Type;
Max_Row : Natural := 0;
end record;
end ARM_Texinfo;
|
package Vect15 is
type Sarray is array (1 .. 4) of Long_Float;
for Sarray'Alignment use 16;
procedure Add (X, Y : Sarray; R : out Sarray);
end Vect15;
|
package body Setup is
protected body Motor_Setup is
procedure Calibrate_Motors_If_Required is
begin
if not Setup_Done then
--Calibrating left and right ESC
Put("Start Setup");
delay 4.0;
--Write(3,1000);
--Set_Analog_Period_Us(20000);
--Write(28,1000);
--Set_Analog_Period_Us(20000);
--NRF52_DK.Time.Delay_Ms(2000);
--Write(3,2000);
--Set_Analog_Period_Us(20000);
--Write(28,2000);
--Set_Analog_Period_Us(20000);
--NRF52_DK.Time.Delay_Ms (2000);
Setup_Done := True;
end if;
end Calibrate_Motors_If_Required;
end Motor_Setup;
end Setup;
|
--
-- Copyright (C) 2015 secunet Security Networks AG
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
package HW.Debug is
procedure Put (Item : String);
procedure Put_Line (Item : String);
procedure New_Line;
procedure Put_Word8 (Item : Word8);
procedure Put_Word16 (Item : Word16);
procedure Put_Word32 (Item : Word32);
procedure Put_Word64 (Item : Word64);
procedure Put_Int8 (Item : Int8);
procedure Put_Int16 (Item : Int16);
procedure Put_Int32 (Item : Int32);
procedure Put_Int64 (Item : Int64);
procedure Put_Reg8 (Name : String; Item : Word8);
procedure Put_Reg16 (Name : String; Item : Word16);
procedure Put_Reg32 (Name : String; Item : Word32);
procedure Put_Reg64 (Name : String; Item : Word64);
procedure Put_Buffer (Name : String; Buf : in Buffer; Len : in Buffer_Range);
procedure Set_Register_Write_Delay (Value : Word64);
Procedure Register_Write_Wait;
end HW.Debug;
-- vim: set ts=8 sts=3 sw=3 et:
|
-- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../../License.txt
with AdaBase.Results.Field;
with Ada.Containers.Vectors;
with Ada.Containers.Indefinite_Hashed_Maps;
with Ada.Strings.Hash;
package AdaBase.Results.Sets is
package ARF renames AdaBase.Results.Field;
type Datarow is tagged private;
type Datarow_Access is access all Datarow;
type Datarow_Set is array (Positive range <>) of Datarow;
Empty_Datarow : constant Datarow;
function column (row : Datarow; index : Positive) return ARF.Std_Field;
function column (row : Datarow; heading : String) return ARF.Std_Field;
function count (row : Datarow) return Natural;
function data_exhausted (row : Datarow) return Boolean;
-- Since it doesn't seem to be possible to construct this type with
-- descriminates, it needs to be created first and populated with data,
-- field by field. The "push" procedure is public only for the driver
-- or driver's statement, but when pushing is done, the record is locked
-- to block any attempt by user to push more data onto this.
procedure push (row : out Datarow;
heading : String;
field : ARF.Std_Field;
last_field : Boolean := False);
private
use type ARF.Std_Field;
function Same_Strings (S, T : String) return Boolean;
package field_crate is new Ada.Containers.Vectors
(Index_Type => Positive,
Element_Type => ARF.Std_Field);
package heading_map is new Ada.Containers.Indefinite_Hashed_Maps
(Key_Type => String,
Element_Type => Positive,
Equivalent_Keys => Same_Strings,
Hash => Ada.Strings.Hash);
type Datarow is tagged
record
crate : field_crate.Vector;
map : heading_map.Map;
locked : Boolean := False;
done : Boolean := False;
end record;
Empty_Datarow : constant Datarow := (field_crate.Empty_Vector,
heading_map.Empty_Map,
True, True);
end AdaBase.Results.Sets;
|
------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- ncurses --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 2000,2004 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Eugene V. Melaragno <aldomel@ix.netcom.com> 2000
-- Version Control
-- $Revision: 1.4 $
-- $Date: 2004/08/21 21:37:00 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with ncurses2.util; use ncurses2.util;
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels;
with Terminal_Interface.Curses.Panels.User_Data;
with ncurses2.genericPuts;
procedure ncurses2.demo_panels (nap_mseci : Integer) is
use Int_IO;
function mkpanel (color : Color_Number;
rows : Line_Count;
cols : Column_Count;
tly : Line_Position;
tlx : Column_Position) return Panel;
procedure rmpanel (pan : in out Panel);
procedure pflush;
procedure wait_a_while (msec : Integer);
procedure saywhat (text : String);
procedure fill_panel (pan : Panel);
nap_msec : Integer := nap_mseci;
function mkpanel (color : Color_Number;
rows : Line_Count;
cols : Column_Count;
tly : Line_Position;
tlx : Column_Position) return Panel is
win : Window;
pan : Panel := Null_Panel;
begin
win := New_Window (rows, cols, tly, tlx);
if Null_Window /= win then
pan := New_Panel (win);
if pan = Null_Panel then
Delete (win);
elsif Has_Colors then
declare
fg, bg : Color_Number;
begin
if color = Blue then
fg := White;
else
fg := Black;
end if;
bg := color;
Init_Pair (Color_Pair (color), fg, bg);
Set_Background (win, (Ch => ' ',
Attr => Normal_Video,
Color => Color_Pair (color)));
end;
else
Set_Background (win, (Ch => ' ',
Attr => (Bold_Character => True,
others => False),
Color => Color_Pair (color)));
end if;
end if;
return pan;
end mkpanel;
procedure rmpanel (pan : in out Panel) is
win : Window := Panel_Window (pan);
begin
Delete (pan);
Delete (win);
end rmpanel;
procedure pflush is
begin
Update_Panels;
Update_Screen;
end pflush;
procedure wait_a_while (msec : Integer) is
begin
-- The C version had some #ifdef blocks here
if msec = 1 then
Getchar;
else
Nap_Milli_Seconds (msec);
end if;
end wait_a_while;
procedure saywhat (text : String) is
begin
Move_Cursor (Line => Lines - 1, Column => 0);
Clear_To_End_Of_Line;
Add (Str => text);
end saywhat;
-- from sample-curses_demo.adb
type User_Data is new String (1 .. 2);
type User_Data_Access is access all User_Data;
package PUD is new Panels.User_Data (User_Data, User_Data_Access);
use PUD;
procedure fill_panel (pan : Panel) is
win : constant Window := Panel_Window (pan);
num : constant Character := Get_User_Data (pan) (2);
tmp6 : String (1 .. 6) := "-panx-";
maxy : Line_Count;
maxx : Column_Count;
begin
Move_Cursor (win, 1, 1);
tmp6 (5) := num;
Add (win, Str => tmp6);
Clear_To_End_Of_Line (win);
Box (win);
Get_Size (win, maxy, maxx);
for y in 2 .. maxy - 2 loop
for x in 1 .. maxx - 2 loop
Move_Cursor (win, y, x);
Add (win, num);
end loop;
end loop;
end fill_panel;
modstr : constant array (0 .. 5) of String (1 .. 5) :=
("test ",
"TEST ",
"(**) ",
"*()* ",
"<--> ",
"LAST "
);
package p is new ncurses2.genericPuts (1024);
use p;
use p.BS;
-- the C version said register int y, x;
tmpb : BS.Bounded_String;
begin
Refresh;
for y in 0 .. Integer (Lines - 2) loop
for x in 0 .. Integer (Columns - 1) loop
myPut (tmpb, (y + x) mod 10);
myAdd (Str => tmpb);
end loop;
end loop;
for y in 0 .. 4 loop
declare
p1, p2, p3, p4, p5 : Panel;
U1 : constant User_Data_Access := new User_Data'("p1");
U2 : constant User_Data_Access := new User_Data'("p2");
U3 : constant User_Data_Access := new User_Data'("p3");
U4 : constant User_Data_Access := new User_Data'("p4");
U5 : constant User_Data_Access := new User_Data'("p5");
begin
p1 := mkpanel (Red, Lines / 2 - 2, Columns / 8 + 1, 0, 0);
Set_User_Data (p1, U1);
p2 := mkpanel (Green, Lines / 2 + 1, Columns / 7, Lines / 4,
Columns / 10);
Set_User_Data (p2, U2);
p3 := mkpanel (Yellow, Lines / 4, Columns / 10, Lines / 2,
Columns / 9);
Set_User_Data (p3, U3);
p4 := mkpanel (Blue, Lines / 2 - 2, Columns / 8, Lines / 2 - 2,
Columns / 3);
Set_User_Data (p4, U4);
p5 := mkpanel (Magenta, Lines / 2 - 2, Columns / 8, Lines / 2,
Columns / 2 - 2);
Set_User_Data (p5, U5);
fill_panel (p1);
fill_panel (p2);
fill_panel (p3);
fill_panel (p4);
fill_panel (p5);
Hide (p4);
Hide (p5);
pflush;
saywhat ("press any key to continue");
wait_a_while (nap_msec);
saywhat ("h3 s1 s2 s4 s5; press any key to continue");
Move (p1, 0, 0);
Hide (p3);
Show (p1);
Show (p2);
Show (p4);
Show (p5);
pflush;
wait_a_while (nap_msec);
saywhat ("s1; press any key to continue");
Show (p1);
pflush;
wait_a_while (nap_msec);
saywhat ("s2; press any key to continue");
Show (p2);
pflush;
wait_a_while (nap_msec);
saywhat ("m2; press any key to continue");
Move (p2, Lines / 3 + 1, Columns / 8);
pflush;
wait_a_while (nap_msec);
saywhat ("s3;");
Show (p3);
pflush;
wait_a_while (nap_msec);
saywhat ("m3; press any key to continue");
Move (p3, Lines / 4 + 1, Columns / 15);
pflush;
wait_a_while (nap_msec);
saywhat ("b3; press any key to continue");
Bottom (p3);
pflush;
wait_a_while (nap_msec);
saywhat ("s4; press any key to continue");
Show (p4);
pflush;
wait_a_while (nap_msec);
saywhat ("s5; press any key to continue");
Show (p5);
pflush;
wait_a_while (nap_msec);
saywhat ("t3; press any key to continue");
Top (p3);
pflush;
wait_a_while (nap_msec);
saywhat ("t1; press any key to continue");
Top (p1);
pflush;
wait_a_while (nap_msec);
saywhat ("t2; press any key to continue");
Top (p2);
pflush;
wait_a_while (nap_msec);
saywhat ("t3; press any key to continue");
Top (p3);
pflush;
wait_a_while (nap_msec);
saywhat ("t4; press any key to continue");
Top (p4);
pflush;
wait_a_while (nap_msec);
for itmp in 0 .. 5 loop
declare
w4 : constant Window := Panel_Window (p4);
w5 : constant Window := Panel_Window (p5);
begin
saywhat ("m4; press any key to continue");
Move_Cursor (w4, Lines / 8, 1);
Add (w4, modstr (itmp));
Move (p4, Lines / 6, Column_Position (itmp) * (Columns / 8));
Move_Cursor (w5, Lines / 6, 1);
Add (w5, modstr (itmp));
pflush;
wait_a_while (nap_msec);
saywhat ("m5; press any key to continue");
Move_Cursor (w4, Lines / 6, 1);
Add (w4, modstr (itmp));
Move (p5, Lines / 3 - 1, (Column_Position (itmp) * 10) + 6);
Move_Cursor (w5, Lines / 8, 1);
Add (w5, modstr (itmp));
pflush;
wait_a_while (nap_msec);
end;
end loop;
saywhat ("m4; press any key to continue");
Move (p4, Lines / 6, 6 * (Columns / 8));
-- Move(p4, Lines / 6, itmp * (Columns / 8));
pflush;
wait_a_while (nap_msec);
saywhat ("t5; press any key to continue");
Top (p5);
pflush;
wait_a_while (nap_msec);
saywhat ("t2; press any key to continue");
Top (p2);
pflush;
wait_a_while (nap_msec);
saywhat ("t1; press any key to continue");
Top (p1);
pflush;
wait_a_while (nap_msec);
saywhat ("d2; press any key to continue");
rmpanel (p2);
pflush;
wait_a_while (nap_msec);
saywhat ("h3; press any key to continue");
Hide (p3);
pflush;
wait_a_while (nap_msec);
saywhat ("d1; press any key to continue");
rmpanel (p1);
pflush;
wait_a_while (nap_msec);
saywhat ("d4; press any key to continue");
rmpanel (p4);
pflush;
wait_a_while (nap_msec);
saywhat ("d5; press any key to continue");
rmpanel (p5);
pflush;
wait_a_while (nap_msec);
if nap_msec = 1 then
exit;
else
nap_msec := 100;
end if;
end;
end loop;
Erase;
End_Windows;
end ncurses2.demo_panels;
|
generic
type Character_Type is (<>); -- Character, Wide_Character, Wide_Wide_Character (or whatever)
type String_Type is array(Positive range <>) of Character_Type;
Carriage_Return: in Character_Type; -- CR in the corresponding type
Line_Feed: in Character_Type; -- LF in the corresponding type
type Coder_Base is abstract tagged private; -- Type to derive
package Encodings.Line_Endings.Generic_Add_CR is
type Coder is new Coder_Base with private;
procedure Convert(
This: in out Coder; -- Coder state
Source: in String_Type; -- String to be converted
Source_Last: out Natural; -- Last index of source string read (length if string is starting at 1)
Target: out String_Type; -- Converted string
Target_Last: out Natural -- Last Index of destination string written
);
private
type Coder_State is (
Initial,
Have_CR,
Need_LF
);
type Coder is new Coder_Base with record
State: Coder_State := Initial;
end record;
end Encodings.Line_Endings.Generic_Add_CR;
|
with Ada.Text_IO;
procedure A_Plus_B is
type Small_Integers is range -2_000 .. +2_000;
subtype Input_Values is Small_Integers range -1_000 .. +1_000;
package IO is new Ada.Text_IO.Integer_IO (Num => Small_Integers);
A, B : Input_Values;
begin
IO.Get (A);
IO.Get (B);
IO.Put (A + B, Width => 4, Base => 10);
end A_Plus_B;
|
package Forward_AD.Hamiltonian is
function Func (Q, V : in Real_Array; T : in Real) return AD_Type;
end Forward_AD.Hamiltonian;
|
with OpenAL.Types;
package OpenAL.Error is
type Error_t is
(No_Error,
Invalid_Name,
Invalid_Enumeration,
Invalid_Value,
Invalid_Operation,
Out_Of_Memory,
Unknown_Error);
-- proc_map : alGetError
function Get_Error return Error_t;
private
function Map_Constant_To_Error (Error : in Types.Enumeration_t) return Error_t;
end OpenAL.Error;
|
with Ada.Text_IO;
package body HIL.UART is
procedure configure is null;
procedure write (Device : in Device_ID_Type; Data : in Data_Type) is
begin
--ada.Text_IO.Put (String (Data));
null;
end write;
procedure read (Device : in Device_ID_Type; Data : out Data_Type; n_read : out Natural) is
begin
null;
end;
function toData_Type (Message : String) return Data_Type is
a : Data_Type(1..2);
begin
return a;
end;
end HIL.UART;
|
-----------------------------------------------------------------------
-- ado-utils-streams -- IO stream utilities
-- Copyright (C) 2018, 2019 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body ADO.Utils.Streams is
use type Ada.Streams.Stream_Element_Offset;
subtype Offset is Ada.Streams.Stream_Element_Offset;
-- ------------------------------
-- Initialize the blob stream to read the content of the blob.
-- ------------------------------
procedure Initialize (Stream : in out Blob_Input_Stream;
Blob : in ADO.Blob_Ref) is
begin
Stream.Data := Blob;
Stream.Pos := 1;
end Initialize;
-- ------------------------------
-- Read into the buffer as many bytes as possible and return in
-- <b>last</b> the position of the last byte read.
-- ------------------------------
overriding
procedure Read (Stream : in out Blob_Input_Stream;
Into : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset) is
begin
if Stream.Data.Is_Null then
Last := Into'First - 1;
else
declare
Blob : constant Blob_Accessor := Stream.Data.Value;
Avail : Offset := Blob.Data'Last - Stream.Pos + 1;
begin
if Avail > Into'Length then
Avail := Into'Length;
end if;
Last := Into'First + Avail - 1;
if Avail > 0 then
Into (Into'First .. Last) := Blob.Data (Stream.Pos .. Stream.Pos + Avail - 1);
Stream.Pos := Stream.Pos + Avail;
end if;
end;
end if;
end Read;
function Get_Blob (Stream : in Blob_Output_Stream) return Blob_Ref is
Size : constant Offset := Offset (Stream.Get_Size);
Buffer : constant Util.Streams.Buffered.Buffer_Access := Stream.Get_Buffer;
begin
return Create_Blob (Data => Buffer (Buffer'First .. Buffer'First + Size - 1));
end Get_Blob;
end ADO.Utils.Streams;
|
-- { dg-do run }
-- { dg-options "-gnatws -gnatVa" }
pragma Initialize_Scalars;
procedure Invalid1 is
X : Boolean;
A : Boolean := False;
procedure Uninit (B : out Boolean) is
begin
if A then
B := True;
raise Program_Error;
end if;
end;
begin
-- first, check that initialize_scalars is enabled
begin
if X then
A := False;
end if;
raise Program_Error;
exception
when Constraint_Error => null;
end;
-- second, check if copyback of an invalid value raises constraint error
begin
Uninit (A);
if A then
-- we expect constraint error in the 'if' above according to gnat ug:
-- ....
-- call. Note that there is no specific option to test `out'
-- parameters, but any reference within the subprogram will be tested
-- in the usual manner, and if an invalid value is copied back, any
-- reference to it will be subject to validity checking.
-- ...
raise Program_Error;
end if;
raise Program_Error;
exception
when Constraint_Error => null;
end;
end;
|
------------------------------------------------------------------------------
-- AGAR CORE LIBRARY --
-- A G A R . E R R O R --
-- B o d y --
-- --
-- Copyright (c) 2018-2019, Julien Nadeau Carriere (vedge@csoft.net) --
-- Copyright (c) 2010, coreland (mark@coreland.ath.cx) --
-- --
-- Permission to use, copy, modify, and/or distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
package body Agar.Error is
function Get_Error return String is
begin
return C.To_Ada (CS.Value (AG_GetError));
end;
procedure Set_Error (Message : in String) is
Ch_Message : aliased C.char_array := C.To_C (Message);
begin
AG_SetErrorS
(Message => CS.To_Chars_Ptr (Ch_Message'Unchecked_Access));
end;
procedure Fatal_Error (Message : in String) is
Ch_Message : aliased C.char_array := C.To_C (Message);
begin
AG_FatalError
(Message => CS.To_Chars_Ptr (Ch_Message'Unchecked_Access));
end;
--
-- Proxy procedure to call error callback from C code.
--
Error_Callback_Fn : Error_Callback_Access := null;
procedure Error_Callback_Proxy (Message : CS.chars_ptr) with Convention => C;
procedure Error_Callback_Proxy (Message : CS.chars_ptr) is
begin
if Error_Callback_Fn /= null then
Error_Callback_Fn.all (C.To_Ada (CS.Value (Message)));
end if;
end;
procedure Set_Fatal_Callback (Callback : Error_Callback_Access) is
begin
Error_Callback_Fn := Callback;
AG_SetFatalCallback (Error_Callback_Proxy'Access);
end;
end Agar.Error;
|
with Interfaces.C_Streams;
with Simple_Logging; use Simple_Logging;
with Simple_Logging.Decorators;
package body CLIC.TTY is
use all type ANSI.Colors;
use all type ANSI.Styles;
Use_Color : Boolean := False; -- Err on the safe side
function Regular_Decorator (Level : Simple_Logging.Levels;
Message : String) return String;
function Verbose_Decorator (Level : Simple_Logging.Levels;
Message : String) return String;
Disabled_By_User : Boolean := False;
-----------------------
-- Force_Disable_TTY --
-----------------------
procedure Force_Disable_TTY is
begin
Disabled_By_User := True;
end Force_Disable_TTY;
---------------
-- Check_TTY --
---------------
function Check_TTY return Boolean is
use Interfaces.C_Streams;
begin
return isatty (fileno (stdout)) /= 0;
end Check_TTY;
------------
-- Is_TTY --
------------
function Is_TTY return Boolean
is (if Disabled_By_User then False else Check_TTY);
-------------------
-- Color_Enabled --
-------------------
function Color_Enabled return Boolean is (Use_Color);
-------------------
-- Disable_Color --
-------------------
procedure Disable_Color is
begin
Use_Color := False;
end Disable_Color;
------------------
-- Enable_Color --
------------------
procedure Enable_Color (Force : Boolean := False) is
begin
-- Enable when appropriate
if Force or else Is_TTY then
Use_Color := True;
Simple_Logging.Debug ("Color output enabled");
else
Simple_Logging.Debug ("Color output was requested but not enabled:"
& " force=" & Force'Img
& "; Is_TTY=" & Is_TTY'Img);
end if;
-- Set debug colors. When Detail/Debug are also enabled, we add the
-- "info:" prefix to otherwise normal output, so it's seen more easily.
if Use_Color then
case Simple_Logging.Level is
when Always .. Info =>
Decorators.Level_Decorator :=
Regular_Decorator'Access;
when others =>
Decorators.Level_Decorator :=
Verbose_Decorator'Access;
end case;
end if;
end Enable_Color;
------------
-- Format --
------------
function Format (Text : String;
Fore : ANSI.Colors := ANSI.Default;
Back : ANSI.Colors := ANSI.Default;
Style : ANSI.Styles := ANSI.Default)
return String
is
use ANSI;
begin
if not Use_Color then
return Text;
end if;
return
((if Fore /= Default then Foreground (Fore) else "")
& (if Back /= Default then Background (Fore) else "")
& (if Style /= Default then ANSI.Style (Style, On) else "")
& Text
& (if Fore /= Default then Foreground (Default) else "")
& (if Back /= Default then Background (Default) else "")
& (if Style /= Default then ANSI.Style (Style, Off) else ""));
end Format;
-----------------------
-- Regular_Decorator --
-----------------------
function Regular_Decorator (Level : Simple_Logging.Levels;
Message : String) return String is
(case Level is
when Info => Message,
when others => Verbose_Decorator (Level, Message));
-----------------------
-- Verbose_Decorator --
-----------------------
function Verbose_Decorator (Level : Simple_Logging.Levels;
Message : String) return String
is
use ANSI;
begin
return
(case Level is
when Always => Message,
when Error =>
ANSI.Wrap (Text => "error:",
Style => Bright,
Foreground => ANSI.Foreground (Red)) & " " & Message,
when Warning =>
ANSI.Wrap (Text => "warn:",
Style => Bright,
Foreground => ANSI.Foreground (Yellow)) & " " & Message,
when Info =>
ANSI.Wrap (Text => "info:",
Style => Bright,
Foreground => ANSI.Foreground (Green)) & " " & Message,
when Detail =>
ANSI.Wrap (Text => "detail:",
Style => Bright,
Foreground => ANSI.Foreground (Cyan)) & " " & Message,
when Debug =>
ANSI.Wrap (Text => "debug:",
Style => Default,
Foreground => ANSI.Foreground (Grey)) & " "
& ANSI.Wrap (Text => Message,
Style => Dim));
end Verbose_Decorator;
end CLIC.TTY;
|
with Raylib;
with Surface.elements;
with tracker.datasource;
package body tracker.presentation is
PURE_BLUE : constant := 16#0000FFFF#;
PURE_RED : constant := 16#FF0000FF#;
PURE_GREEN : constant := 16#00FF00FF#;
WHITE : constant := 16#FFFFFFFF#;
BLUE : constant := 16#447FFFFF#;
GOLD : constant := 16#FF8833FF#;
CYAN : constant := 16#11AABBFF#;
DARKGRAY : constant := 16#101A1AFF#;
-- BG ; SHADE ; SHADOW ; TEXT ; LABEL
Theme : array (element'range) of Raylib.Color;
procedure setup (self : in out instance) is
begin
Background_Color (self, Theme(BG));
Size (self, 800, 800);
Title (self, "Tracker");
tracker.datasource.Load;
end setup;
procedure update (self : in out instance ; dt : Float) is
use Surface.elements;
I : Item;
--book renames self.book_Completion;
begin
quad (100, 90, 250, 25);
print (100, 90, Activities.Collections(1).name);
raylib.shapes.draw_rectangle_lines_ex (
rec => (96.0, 121.0, 250.0+8.0, 25.0+8.0),
line_thick => 2,
c => theme(HIGHLIGHT));
for number in 1..Activities.Collections(1).Items_Count loop
I := Activities.Collections(1).Items(number);
raylib.shapes.draw_rectangle_rounded(
rec => (100.0,125.0 + float(number-1) *40.0,250.0,25.0),
roundness => 0.2,
segments => 6,
c => Theme (SHADE));
print (100, 125 + (number-1) * 40, I.name(1..I.name_length));
end loop;
end update;
procedure Set_Color (E : Element ; C : Color_Value) is
begin
Theme (E) := raylib.colors.get_color(raylib.unsigned(C));
end Set_Color;
begin
Set_Color (BG, BLUE);
Set_Color (SHADE, WHITE);
Set_Color (HIGHLIGHT, GOLD);
Set_Color (SHADOW, DARKGRAY);
Set_Color (TEXT, DARKGRAY);
Set_Color (LABEL, DARKGRAY);
end tracker.presentation;
|
with HAL; use HAL;
with STM32.GPIO; use STM32.GPIO;
with STM32.Timers; use STM32.Timers;
with STM32.PWM; use STM32.PWM;
with STM32.CORDIC; use STM32.CORDIC;
with STM_Board; use STM_Board;
with Inverter_ADC; use Inverter_ADC;
package Inverter_PWM is
-----------------
-- Definitions --
-----------------
type PWM_Phase is (A, B);
-- Each phase of a full bridge circuit.
type PWM_Alignment is
(Edge, -- Positive edge
Center -- Center of positive part
);
-- Describes where on the PWM waveform the signals shall be aligned.
-- The final maximum amplitude for the sine voltage is defined by the
-- maximum sine value, that is 1.0.
-- Considering that the battery nominal voltage is 12 Volts, this will
-- be the peak AC value, which corresponds to a primary AC RMS voltage
-- of 12 V / sqrt(2) = 8.485 V.
-- With a minimum battery voltage of 10 V, the minimum AC RMS voltage
-- will be 10 V / sqrt(2) = 7.07 V.
-- The transformer voltage ratio between the primary and secondary, for
-- a maximum output voltage of 230 V RMS, will be 230 V / 7.07 V = 32.5,
-- so the turns ratio of the transformer will be (Ns / Np) = 33.
subtype Sine_Range is Float range 0.0 .. 1.0;
Sine_Amplitude : Sine_Range := 0.0;
subtype Duty_Cycle is Float range 0.0 .. 100.0;
-- The upload frequency of the duty cycle is defined by the number of points
-- for each semi-sinusoid.
-- For 50 Hz we have 2 half senoids * 50 Hz * 256 points = 25600 Hz.
-- For 60 Hz we have 2 half senoids * 60 Hz * 256 points = 30720 Hz.
-- For 400 Hz we have 2 half senoids * 400 Hz * 256 points = 204800 Hz.
PWM_Frequency_Hz : Frequency_Hz := 30_720.0; -- for 60 Hz
-- Actually the STM32G474 operates at 150 MHz with 150 MHz into Prescaler.
-- With (10 - 1) for prescaler we have 15 MHz for counter period, that has
-- values of 586, 488 and 73 for 25.597, 30.7377 and 205.479 KHz, that
-- will result in 49.99, 60.035 and 401.327 Hz.
subtype Deadtime_Range is Float range 0.0 .. 400.0e-9;
-- Maximum deadtime permissible is 126 us.
-- Maximum deadtime chosen is 1% of the PWM_Frequency_Hz = 0.01/25_000.
PWM_Deadtime : constant Deadtime_Range := 166.7e-9;
-- The delay exists in the rising edges.
-- It depends on the electronic circuit rise and fall times.
-- 166.7e-9 * 30 kHz * 100 = 0.5% of the total period.
-----------------------------
-- Procedures and function --
-----------------------------
procedure Initialize_CORDIC;
-- Enable clock and configure CORDIC coprocessor with sine function.
procedure Initialize_PWM
(Frequency : Frequency_Hz;
Deadtime : Deadtime_Range;
Alignment : PWM_Alignment);
-- Initialize the timer peripheral for PWM.
-- Each phase needs to be enabled manually after this.
procedure Enable_Phase (This : PWM_Phase)
with inline;
-- Enable PWM generation for the specified phase.
procedure Disable_Phase (This : PWM_Phase)
with inline;
-- Disable PWM generation for the specified phase.
procedure Start_PWM
with
Pre => Is_Initialized;
-- Start the generation of sinusoid wave by enabling interrupt.
procedure Stop_PWM
with
Pre => Is_Initialized;
-- Stop the generation of sinusoid wave by disabling interrupt.
function Get_Duty_Resolution return Duty_Cycle;
-- Return the minimum step that the duty can be changed, in percent.
procedure Set_Duty_Cycle
(This : PWM_Phase;
Value : Duty_Cycle);
-- Sets the duty cycle in percent for the specified phase.
procedure Set_Duty_Cycle
(This : PWM_Phase;
Amplitude : Sine_Range;
Gain : Gain_Range);
-- Sets the duty cycle for the specified phase.
procedure Set_PWM_Gate_Power (Enabled : in Boolean)
with
Pre => STM_Board.Is_Initialized and (if Enabled then Is_Initialized);
-- Enable or disable the output of the gate drivers. This routine must be
-- altered in accordance to your hardware because some chips enable with
-- True and others with False.
procedure Reset_Sine_Step;
-- Set the Sine_Step variable to the first angle value, or 0.0 whose
-- amplitude value is 0.
procedure Safe_State;
-- Forces the inverter into a state that is considered safe.
-- Typically this disables the PWM generation (all switches off), and
-- turns off the power to the gate drivers.
function Is_Initialized return Boolean;
-- Returns True if the board specifics are initialized.
private
Initialized : Boolean := False;
-- A table for sine generation is produced knowing the number of points
-- to complete 1/2 sine period. The sine function goes from 0 to 1 to 0 in
-- 1/2 sine period, that corresponds to 0 to Pi/2 to Pi.
-- The equation which defines the value of each point is:
--
-- D = A * sin(pi * x/N)
-- D = Duty cycle at a given discrete point;
-- A = Signal amplitude of the maximum duty cycle. We adopt 1.
-- pi = 1/2 of the sine period
-- x = Step number
-- N = Number of points = 256
-- The STM32F474 CPU has hardware acceleration of mathematical functions
-- (mainly trigonometric ones), so we benefit of it with sine calculations
-- and, instead of using a sine table, we calculate it directly.
-- The values introduced into the CORDIC doesn't need the Pi multiplication,
-- so Pi corresponds to 1.0 and -Pi corresponds to -1.0. See the definition
-- for Fraction_16 and Fraction_32 in the stm32-cordic.ads file.
-- The only limitation is that any value introduced into the CORDIC must be
-- a multiple of 2**(-31) when using Fraction_32 or 2**(-15) when using
-- Fraction_16.
Sine_Step_Number : constant Positive := 256;
-- Number of steps for the half-sine.
Increment : constant Q1_15 := 1.0 / Sine_Step_Number;
-- This value must be a multiple of delta (2.0**(-15)).
-- The Increment value determine the number of points to complete 1/2
-- sine period, so the interval is between 0.0 and 1.0 (0 to Pi). The
-- complete sinusoid or sine period is completed with these same points but
-- using the second half-bridge, so it will be 512 points.
subtype Sine_Step_Range is Q1_15 range 0.0 .. 1.0 - Increment;
-- This range gives exactly 256 x Increment values.
-- For sine function, the first argument is the angle, while the second
-- argument is the modulus, that in this case doesn't change.
Sine_Step : Sine_Step_Range;
Modulus : constant UInt16 := 16#7FFF#; -- 1 - 2**(-31)
Initial_Step : constant Sine_Step_Range := Sine_Step_Range'Last;
-- The initial angle would be the first point after 0.0, and the last point
-- would be 1.0. But this CORDIC only accept values between -1.0 and
-- 1.0 - 2**(-15), so the last point couldn't be 1.0. Then we choose to
-- count down from [1.0 - Increment] to 0.0 and restart this same count down
-- for the next semi-senoid. This way we have exactly 256 points for the
-- semi-senoid and the last point (0.0) will return a sine value of 0.0.
-- Buffers with the data in and out to the CORDIC.
Data_In : UInt16_Array := (Q1_15_To_UInt16 (Initial_Step), Modulus);
Data_Out : UInt16_Array := (0, 0);
PWM_Timer_Ref : access Timer := PWM_Timer'Access;
Modulators : array (PWM_Phase'Range) of PWM_Modulator;
type Gate_Setting is record
Channel : Timer_Channel;
Pin_H : GPIO_Point;
Pin_L : GPIO_Point;
Pin_AF : STM32.GPIO_Alternate_Function;
end record;
type Gate_Settings is array (PWM_Phase'Range) of Gate_Setting;
Gate_Phase_Settings : constant Gate_Settings :=
((A) => Gate_Setting'(Channel => PWM_A_Channel,
Pin_H => PWM_A_H_Pin,
Pin_L => PWM_A_L_Pin,
Pin_AF => PWM_A_GPIO_AF),
(B) => Gate_Setting'(Channel => PWM_B_Channel,
Pin_H => PWM_B_H_Pin,
Pin_L => PWM_B_L_Pin,
Pin_AF => PWM_B_GPIO_AF));
protected PWM_Handler is
pragma Interrupt_Priority (PWM_ISR_Priority);
private
Counter : Integer := 0;
-- For testing the output.
Semi_Senoid : Boolean := False;
-- Defines False = 1'st half sinusoid, True = 2'nd half sinusoid.
procedure PWM_ISR_Handler with
Attach_Handler => PWM_Interrupt;
end PWM_Handler;
end Inverter_PWM;
|
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Directories;
package body Torrent.Storages is
use type Ada.Streams.Stream_Element_Count;
protected body Storage is
----------------
-- Initialize --
----------------
procedure Initialize
(Path : League.Strings.Universal_String)
is
Offset : Ada.Streams.Stream_Element_Count := 0;
begin
Root_Path := Path;
Is_Empty := True;
for J in 1 .. Meta.File_Count loop
declare
use type League.Strings.Universal_String;
Name : constant League.Strings.Universal_String :=
Path & "/" & Meta.File_Path (J).Join ("/");
File : constant String := Name.To_UTF_8_String;
Dir : constant String :=
Ada.Directories.Containing_Directory (File);
begin
if not Ada.Directories.Exists (Dir) then
Ada.Directories.Create_Path (Dir);
end if;
if not Ada.Directories.Exists (File) then
declare
Dummy : Ada.Streams.Stream_IO.File_Type;
begin
Ada.Streams.Stream_IO.Create
(Dummy, Name => File);
Ada.Streams.Stream_IO.Close (Dummy);
end;
elsif Ada.Directories.Size (File) not in 0 then
Is_Empty := False;
end if;
end;
if Meta.File_Length (J) > 0 then
Files.Insert (Offset, J);
Offset := Offset + Meta.File_Length (J);
end if;
end loop;
end Initialize;
----------------------
-- Is_Empty_Storage --
----------------------
function Is_Empty_Storage return Boolean is
begin
return Is_Empty;
end Is_Empty_Storage;
----------
-- Read --
----------
entry Read
(Offset : Ada.Streams.Stream_Element_Count;
Data : out Ada.Streams.Stream_Element_Array)
when Reading
is
use type League.Strings.Universal_String;
Name : League.Strings.Universal_String;
From : Ada.Streams.Stream_Element_Count := Data'First;
Last : Ada.Streams.Stream_Element_Count;
Cursor : File_Index_Maps.Cursor := Files.Floor (Offset);
-- The last node whose key is not greater (i.e. less or equal).
-- The first key in map is 0, so we expect Floor fine some item.
Skip : Ada.Streams.Stream_Element_Count := -- Offset inside a file
Offset - File_Index_Maps.Key (Cursor);
File : Positive := File_Index_Maps.Element (Cursor);
File_Length : Ada.Streams.Stream_Element_Count :=
Meta.File_Length (File);
begin
if Skip >= File_Length then
return; -- Offset is greater then torrent size.
end if;
loop
Name := Root_Path & "/" & Meta.File_Path (File).Join ('/');
if Skip + Data'Last - From + 1 > File_Length then
Last := From + File_Length - Skip - 1;
else
Last := Data'Last;
end if;
if Read_Cache.Name /= Name then
if Ada.Streams.Stream_IO.Is_Open (Read_Cache.Input) then
Ada.Streams.Stream_IO.Close (Read_Cache.Input);
end if;
Ada.Streams.Stream_IO.Open
(Read_Cache.Input,
Ada.Streams.Stream_IO.In_File,
Name.To_UTF_8_String,
Form => "shared=no");
Read_Cache.Name := Name;
end if;
declare
use type Ada.Streams.Stream_IO.Count;
Done : Ada.Streams.Stream_Element_Offset;
begin
if Ada.Streams.Stream_IO.Size (Read_Cache.Input) >=
Ada.Streams.Stream_IO.Count (Skip + Last - From + 1)
then
Ada.Streams.Stream_IO.Read
(File => Read_Cache.Input,
Item => Data (From .. Last),
Last => Done,
From => Ada.Streams.Stream_IO.Count (Skip + 1));
pragma Assert (Done = Last);
else
Data := (others => 0);
end if;
end;
exit when Last >= Data'Last;
File_Index_Maps.Next (Cursor);
Skip := 0;
File := File_Index_Maps.Element (Cursor);
File_Length := Meta.File_Length (File);
From := Last + 1;
end loop;
end Read;
-------------------
-- Start_Reading --
-------------------
entry Start_Reading when not Reading is
begin
Reading := True;
end Start_Reading;
------------------
-- Stop_Reading --
------------------
entry Stop_Reading when Reading is
begin
Reading := False;
end Stop_Reading;
-----------
-- Write --
-----------
entry Write
(Offset : Ada.Streams.Stream_Element_Count;
Data : Ada.Streams.Stream_Element_Array)
when not Reading
is
Cursor : File_Index_Maps.Cursor := Files.Floor (Offset);
-- The last node whose key is not greater (i.e. less or equal).
-- The first key in map is 0, so we expect Floor fine some item.
Skip : Ada.Streams.Stream_Element_Count := -- File offset
Offset - File_Index_Maps.Key (Cursor);
File : Positive := File_Index_Maps.Element (Cursor);
File_Length : Ada.Streams.Stream_Element_Count :=
Meta.File_Length (File);
From : Ada.Streams.Stream_Element_Count := Data'First;
Last : Ada.Streams.Stream_Element_Count;
begin
if Skip >= File_Length then
return; -- Offset is greater then torrent size.
end if;
loop
if Skip + Data'Last - From + 1 > File_Length then
Last := From + File_Length - Skip - 1;
else
Last := Data'Last;
end if;
declare
use type League.Strings.Universal_String;
Output : Ada.Streams.Stream_IO.File_Type;
Name : constant League.Strings.Universal_String :=
Root_Path & "/" & Meta.File_Path (File).Join ('/');
begin
if Read_Cache.Name = Name then
Read_Cache.Name.Clear;
Ada.Streams.Stream_IO.Close (Read_Cache.Input);
end if;
Ada.Streams.Stream_IO.Open
(Output,
Ada.Streams.Stream_IO.Out_File,
Name.To_UTF_8_String,
Form => "shared=no");
Ada.Streams.Stream_IO.Write
(File => Output,
Item => Data (From .. Last),
To => Ada.Streams.Stream_IO.Count (Skip + 1));
Ada.Streams.Stream_IO.Close (Output);
end;
exit when Last >= Data'Last;
File_Index_Maps.Next (Cursor);
Skip := 0;
File := File_Index_Maps.Element (Cursor);
File_Length := Meta.File_Length (File);
From := Last + 1;
end loop;
end Write;
end Storage;
end Torrent.Storages;
|
--
-- A characteristic of Ada task is that if an exception happens they
-- silently die. This can make debugging difficult. The procedure
-- Install_Reaper installs a handler that print some useful information
-- to standard error when a task dies.
--
package Utilities.Task_Reaper is
type Verbosity_Level is (Exception_Only, Abort_Or_Exception, Always);
procedure Install_Reaper (Level : Verbosity_Level := Exception_Only);
-- Install a reaper. If Level is Exception_Only, a message is printed
-- only if a task die because of an exception; if Level is
-- Abort_Or_Exception a message is printed if the task call is aborted
-- or die by an exception; if Level is Always the message is printed
-- also for normal termination.
end Utilities.Task_Reaper;
|
-----------------------------------------------------------------------
-- import -- Import some HTML content and generate Wiki text
-- Copyright (C) 2015, 2016, 2020, 2021 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Text_IO;
with Ada.Wide_Wide_Text_IO;
with Ada.IO_Exceptions;
with Ada.Strings.Unbounded;
with Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
with GNAT.Command_Line;
with Util.Files;
with Util.Streams.Pipes;
with Util.Streams.Buffered;
with Util.Strings.Transforms;
with Wiki.Strings;
with Wiki.Filters.Html;
with Wiki.Filters.TOC;
with Wiki.Streams.Builders;
with Wiki.Streams.Html.Builders;
with Wiki.Render.Html;
with Wiki.Render.Text;
with Wiki.Render.Wiki;
with Wiki.Documents;
with Wiki.Parsers;
procedure Import is
use GNAT.Command_Line;
use Ada.Strings.Unbounded;
use Ada.Strings.UTF_Encoding;
procedure Usage;
function Is_Url (Name : in String) return Boolean;
procedure Parse_Url (Url : in String);
procedure Parse (Content : in String);
procedure Print (Item : in Wiki.Strings.WString);
Html_Filter : aliased Wiki.Filters.Html.Html_Filter_Type;
TOC : aliased Wiki.Filters.TOC.TOC_Filter;
Count : Natural := 0;
Html_Mode : Boolean := True;
Wiki_Mode : Boolean := False;
Syntax : Wiki.Wiki_Syntax := Wiki.SYNTAX_MARKDOWN;
procedure Usage is
begin
Ada.Text_IO.Put_Line ("Import HTML into a target Wiki format");
Ada.Text_IO.Put_Line ("Usage: import [-t] [-m] [-M] [-H] [-d] [-c] {URL | file}");
Ada.Text_IO.Put_Line (" -t Convert to text only");
Ada.Text_IO.Put_Line (" -m Convert to Markdown");
Ada.Text_IO.Put_Line (" -M Convert to Mediawiki");
Ada.Text_IO.Put_Line (" -H Convert to HTML");
Ada.Text_IO.Put_Line (" -d Convert to Dotclear");
Ada.Text_IO.Put_Line (" -c Convert to Creole");
end Usage;
procedure Print (Item : in Wiki.Strings.WString) is
begin
Ada.Wide_Wide_Text_IO.Put (Item);
end Print;
procedure Parse (Content : in String) is
Doc : Wiki.Documents.Document;
Engine : Wiki.Parsers.Parser;
begin
Engine.Add_Filter (TOC'Unchecked_Access);
Engine.Add_Filter (Html_Filter'Unchecked_Access);
if Wiki_Mode then
declare
Stream : aliased Wiki.Streams.Builders.Output_Builder_Stream;
Renderer : aliased Wiki.Render.Wiki.Wiki_Renderer;
begin
Engine.Set_Syntax (Wiki.SYNTAX_HTML);
Engine.Parse (Wide_Wide_Strings.Decode (Content), Doc);
Renderer.Set_Output_Stream (Stream'Unchecked_Access, Syntax);
Renderer.Render (Doc);
Stream.Iterate (Print'Access);
end;
elsif Html_Mode then
declare
Stream : aliased Wiki.Streams.Html.Builders.Html_Output_Stream;
Renderer : aliased Wiki.Render.Html.Html_Renderer;
begin
Engine.Set_Syntax (Syntax);
Engine.Parse (Wide_Wide_Strings.Decode (Content), Doc);
Renderer.Set_Output_Stream (Stream'Unchecked_Access);
Renderer.Render (Doc);
Stream.Iterate (Print'Access);
end;
else
declare
Stream : aliased Wiki.Streams.Builders.Output_Builder_Stream;
Renderer : aliased Wiki.Render.Text.Text_Renderer;
begin
Engine.Set_Syntax (Syntax);
Engine.Parse (Wide_Wide_Strings.Decode (Content), Doc);
Renderer.Set_Output_Stream (Stream'Unchecked_Access);
Renderer.Render (Doc);
Stream.Iterate (Print'Access);
end;
end if;
Ada.Wide_Wide_Text_IO.New_Line;
end Parse;
procedure Parse_Url (Url : in String) is
Command : constant String := "wget -q -O - " & Url;
Pipe : aliased Util.Streams.Pipes.Pipe_Stream;
Buffer : Util.Streams.Buffered.Input_Buffer_Stream;
Content : Ada.Strings.Unbounded.Unbounded_String;
begin
Pipe.Open (Command);
Buffer.Initialize (Pipe'Unchecked_Access, 1024 * 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));
else
Parse (To_String (Content));
end if;
end Parse_Url;
function Is_Url (Name : in String) return Boolean is
begin
if Name'Length <= 9 then
return False;
else
return Name (Name'First .. Name'First + 6) = "http://"
or Name (Name'First .. Name'First + 7) = "https://";
end if;
end Is_Url;
begin
loop
case Getopt ("m M H d c t f:") is
when 'm' =>
Syntax := Wiki.SYNTAX_MARKDOWN;
Wiki_Mode := True;
when 'M' =>
Syntax := Wiki.SYNTAX_MEDIA_WIKI;
Wiki_Mode := True;
when 'H' =>
Syntax := Wiki.SYNTAX_HTML;
when 'c' =>
Syntax := Wiki.SYNTAX_CREOLE;
Wiki_Mode := True;
when 'd' =>
Syntax := Wiki.SYNTAX_DOTCLEAR;
Wiki_Mode := True;
when 't' =>
Html_Mode := False;
when 'f' =>
declare
Value : constant String := Util.Strings.Transforms.To_Upper_Case (Parameter);
begin
Html_Filter.Hide (Wiki.Html_Tag'Value (Value & "_TAG"));
exception
when Constraint_Error =>
Ada.Text_IO.Put_Line ("Invalid tag " & Value);
end;
when others =>
exit;
end case;
end loop;
loop
declare
Name : constant String := GNAT.Command_Line.Get_Argument;
Data : Unbounded_String;
begin
if Name = "" then
if Count = 0 then
Usage;
end if;
return;
end if;
Count := Count + 1;
if Is_Url (Name) then
Parse_Url (Name);
else
Util.Files.Read_File (Name, Data);
Parse (To_String (Data));
end if;
exception
when Ada.IO_Exceptions.Name_Error =>
Ada.Text_IO.Put_Line ("Cannot read file '" & Name & "'");
end;
end loop;
exception
when Invalid_Switch =>
Ada.Text_IO.Put_Line ("Invalid option.");
Usage;
end Import;
|
with Text_IO; use Text_IO;
procedure Nextdate is
type Month_Type is
(Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec);
subtype Day_Subtype is Integer range 1 .. 31;
type Date is
record
Day : Day_Subtype;
Month : Month_Type;
Year : Positive;
end record;
Passed : Boolean := True;
function Tomorrow(Today : in Date) return Date is separate;
procedure Display (S : in String; D : in Date) is
package Int_IO is new Integer_IO(Integer); use Int_IO;
begin
Put(S);
Put(D.Day, Width => 3);
Put(" " & Month_Type'Image(D.Month));
Put(D.Year, Width => 5);
New_Line;
end Display;
procedure Compare(Today, Right_Answer : in Date) is
My_Answer : Date := Tomorrow(Today);
begin
if My_Answer /= Right_Answer then
Display("Today: ", Today);
Display("My answer: ", My_Answer);
Display("Right answer:", Right_Answer);
New_Line;
Passed := False;
end if;
end Compare;
begin
Compare((12,Dec,1815), (13,Dec,1815)); -- ordinary date
Compare(( 3,Feb,1986), ( 4,Feb,1986)); -- ordinary date in Feb.
Compare((30,Jun,1981), ( 1,Jul,1981)); -- last day of 30-day month
Compare((30,Sep,3999), ( 1,Oct,3999)); -- last day of 30-day month
Compare((31,Mar,1876), ( 1,Apr,1876)); -- last day of 31-day month
Compare((31,Aug,1984), ( 1,Sep,1984)); -- last day of 31-day month
Compare((31,Dec,1966), ( 1,Jan,1967)); -- last day of year
Compare((28,Feb,1980), (29,Feb,1980)); -- leap year
Compare((28,Feb,1600), (29,Feb,1600)); -- century leap year
Compare((28,Feb,2200), ( 1,Mar,2200)); -- century non-leap year
Compare((28,Feb,1982), ( 1,Mar,1982)); -- non-leap year
Compare((29,Feb,1980), ( 1,Mar,1980)); -- leap day in leap year
if Passed then
Put_Line("Congratulations, you completed the assignment!");
end if;
end Nextdate;
|
package body afrl.cmasi.keyValuePair is
function getFullLmcpTypeName (this : KeyValuePair) return String is ("afrl.cmasi.keyValuePair.KeyValuePair");
function getLmcpTypeName (this : KeyValuePair) return String is ("KeyValuePair");
function getLmcpType (this : KeyValuePair) return UInt32_t is (CMASIEnum'Pos(KEYVALUEPAIR_ENUM));
function getKey (this : KeyValuePair'Class) return Unbounded_String is (this.Key);
procedure setKey(this : out KeyValuePair'Class; Key : in Unbounded_String) is
begin
this.Key := Key;
end setKey;
function getValue (this : KeyValuePair'Class) return Unbounded_String is (this.Value);
procedure setValue (this : out KeyValuePair'Class; Value : in Unbounded_String) is
begin
this.Value := Value;
end setValue;
end afrl.cmasi.keyValuePair;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S T R I N G S . W I D E _ M A P S . W I D E _ C O N S T A N T S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Characters.Wide_Latin_1;
package Ada.Strings.Wide_Maps.Wide_Constants is
pragma Preelaborate;
Control_Set : constant Wide_Maps.Wide_Character_Set;
Graphic_Set : constant Wide_Maps.Wide_Character_Set;
Letter_Set : constant Wide_Maps.Wide_Character_Set;
Lower_Set : constant Wide_Maps.Wide_Character_Set;
Upper_Set : constant Wide_Maps.Wide_Character_Set;
Basic_Set : constant Wide_Maps.Wide_Character_Set;
Decimal_Digit_Set : constant Wide_Maps.Wide_Character_Set;
Hexadecimal_Digit_Set : constant Wide_Maps.Wide_Character_Set;
Alphanumeric_Set : constant Wide_Maps.Wide_Character_Set;
Special_Graphic_Set : constant Wide_Maps.Wide_Character_Set;
ISO_646_Set : constant Wide_Maps.Wide_Character_Set;
Character_Set : constant Wide_Maps.Wide_Character_Set;
Lower_Case_Map : constant Wide_Maps.Wide_Character_Mapping;
-- Maps to lower case for letters, else identity
Upper_Case_Map : constant Wide_Maps.Wide_Character_Mapping;
-- Maps to upper case for letters, else identity
Basic_Map : constant Wide_Maps.Wide_Character_Mapping;
-- Maps to basic letter for letters, else identity
private
package W renames Ada.Characters.Wide_Latin_1;
subtype WC is Wide_Character;
Control_Ranges : aliased constant Wide_Character_Ranges :=
((W.NUL, W.US),
(W.DEL, W.APC));
Control_Set : constant Wide_Character_Set :=
(AF.Controlled with
Control_Ranges'Unrestricted_Access);
Graphic_Ranges : aliased constant Wide_Character_Ranges :=
((W.Space, W.Tilde),
(WC'Val (256), WC'Last));
Graphic_Set : constant Wide_Character_Set :=
(AF.Controlled with
Graphic_Ranges'Unrestricted_Access);
Letter_Ranges : aliased constant Wide_Character_Ranges :=
(('A', 'Z'),
(W.LC_A, W.LC_Z),
(W.UC_A_Grave, W.UC_O_Diaeresis),
(W.UC_O_Oblique_Stroke, W.LC_O_Diaeresis),
(W.LC_O_Oblique_Stroke, W.LC_Y_Diaeresis));
Letter_Set : constant Wide_Character_Set :=
(AF.Controlled with
Letter_Ranges'Unrestricted_Access);
Lower_Ranges : aliased constant Wide_Character_Ranges :=
(1 => (W.LC_A, W.LC_Z),
2 => (W.LC_German_Sharp_S, W.LC_O_Diaeresis),
3 => (W.LC_O_Oblique_Stroke, W.LC_Y_Diaeresis));
Lower_Set : constant Wide_Character_Set :=
(AF.Controlled with
Lower_Ranges'Unrestricted_Access);
Upper_Ranges : aliased constant Wide_Character_Ranges :=
(1 => ('A', 'Z'),
2 => (W.UC_A_Grave, W.UC_O_Diaeresis),
3 => (W.UC_O_Oblique_Stroke, W.UC_Icelandic_Thorn));
Upper_Set : constant Wide_Character_Set :=
(AF.Controlled with
Upper_Ranges'Unrestricted_Access);
Basic_Ranges : aliased constant Wide_Character_Ranges :=
(1 => ('A', 'Z'),
2 => (W.LC_A, W.LC_Z),
3 => (W.UC_AE_Diphthong, W.UC_AE_Diphthong),
4 => (W.LC_AE_Diphthong, W.LC_AE_Diphthong),
5 => (W.LC_German_Sharp_S, W.LC_German_Sharp_S),
6 => (W.UC_Icelandic_Thorn, W.UC_Icelandic_Thorn),
7 => (W.LC_Icelandic_Thorn, W.LC_Icelandic_Thorn),
8 => (W.UC_Icelandic_Eth, W.UC_Icelandic_Eth),
9 => (W.LC_Icelandic_Eth, W.LC_Icelandic_Eth));
Basic_Set : constant Wide_Character_Set :=
(AF.Controlled with
Basic_Ranges'Unrestricted_Access);
Decimal_Digit_Ranges : aliased constant Wide_Character_Ranges :=
(1 => ('0', '9'));
Decimal_Digit_Set : constant Wide_Character_Set :=
(AF.Controlled with
Decimal_Digit_Ranges'Unrestricted_Access);
Hexadecimal_Digit_Ranges : aliased constant Wide_Character_Ranges :=
(1 => ('0', '9'),
2 => ('A', 'F'),
3 => (W.LC_A, W.LC_F));
Hexadecimal_Digit_Set : constant Wide_Character_Set :=
(AF.Controlled with
Hexadecimal_Digit_Ranges'Unrestricted_Access);
Alphanumeric_Ranges : aliased constant Wide_Character_Ranges :=
(1 => ('0', '9'),
2 => ('A', 'Z'),
3 => (W.LC_A, W.LC_Z),
4 => (W.UC_A_Grave, W.UC_O_Diaeresis),
5 => (W.UC_O_Oblique_Stroke, W.LC_O_Diaeresis),
6 => (W.LC_O_Oblique_Stroke, W.LC_Y_Diaeresis));
Alphanumeric_Set : constant Wide_Character_Set :=
(AF.Controlled with
Alphanumeric_Ranges'Unrestricted_Access);
Special_Graphic_Ranges : aliased constant Wide_Character_Ranges :=
(1 => (Wide_Space, W.Solidus),
2 => (W.Colon, W.Commercial_At),
3 => (W.Left_Square_Bracket, W.Grave),
4 => (W.Left_Curly_Bracket, W.Tilde),
5 => (W.No_Break_Space, W.Inverted_Question),
6 => (W.Multiplication_Sign, W.Multiplication_Sign),
7 => (W.Division_Sign, W.Division_Sign));
Special_Graphic_Set : constant Wide_Character_Set :=
(AF.Controlled with
Special_Graphic_Ranges'Unrestricted_Access);
ISO_646_Ranges : aliased constant Wide_Character_Ranges :=
(1 => (W.NUL, W.DEL));
ISO_646_Set : constant Wide_Character_Set :=
(AF.Controlled with
ISO_646_Ranges'Unrestricted_Access);
Character_Ranges : aliased constant Wide_Character_Ranges :=
(1 => (W.NUL, WC'Val (255)));
Character_Set : constant Wide_Character_Set :=
(AF.Controlled with
Character_Ranges'Unrestricted_Access);
Lower_Case_Mapping : aliased constant Wide_Character_Mapping_Values :=
(Length => 56,
Domain =>
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" &
W.UC_A_Grave &
W.UC_A_Acute &
W.UC_A_Circumflex &
W.UC_A_Tilde &
W.UC_A_Diaeresis &
W.UC_A_Ring &
W.UC_AE_Diphthong &
W.UC_C_Cedilla &
W.UC_E_Grave &
W.UC_E_Acute &
W.UC_E_Circumflex &
W.UC_E_Diaeresis &
W.UC_I_Grave &
W.UC_I_Acute &
W.UC_I_Circumflex &
W.UC_I_Diaeresis &
W.UC_Icelandic_Eth &
W.UC_N_Tilde &
W.UC_O_Grave &
W.UC_O_Acute &
W.UC_O_Circumflex &
W.UC_O_Tilde &
W.UC_O_Diaeresis &
W.UC_O_Oblique_Stroke &
W.UC_U_Grave &
W.UC_U_Acute &
W.UC_U_Circumflex &
W.UC_U_Diaeresis &
W.UC_Y_Acute &
W.UC_Icelandic_Thorn,
Rangev =>
"abcdefghijklmnopqrstuvwxyz" &
W.LC_A_Grave &
W.LC_A_Acute &
W.LC_A_Circumflex &
W.LC_A_Tilde &
W.LC_A_Diaeresis &
W.LC_A_Ring &
W.LC_AE_Diphthong &
W.LC_C_Cedilla &
W.LC_E_Grave &
W.LC_E_Acute &
W.LC_E_Circumflex &
W.LC_E_Diaeresis &
W.LC_I_Grave &
W.LC_I_Acute &
W.LC_I_Circumflex &
W.LC_I_Diaeresis &
W.LC_Icelandic_Eth &
W.LC_N_Tilde &
W.LC_O_Grave &
W.LC_O_Acute &
W.LC_O_Circumflex &
W.LC_O_Tilde &
W.LC_O_Diaeresis &
W.LC_O_Oblique_Stroke &
W.LC_U_Grave &
W.LC_U_Acute &
W.LC_U_Circumflex &
W.LC_U_Diaeresis &
W.LC_Y_Acute &
W.LC_Icelandic_Thorn);
Lower_Case_Map : constant Wide_Character_Mapping :=
(AF.Controlled with
Map => Lower_Case_Mapping'Unrestricted_Access);
Upper_Case_Mapping : aliased constant Wide_Character_Mapping_Values :=
(Length => 56,
Domain =>
"abcdefghijklmnopqrstuvwxyz" &
W.LC_A_Grave &
W.LC_A_Acute &
W.LC_A_Circumflex &
W.LC_A_Tilde &
W.LC_A_Diaeresis &
W.LC_A_Ring &
W.LC_AE_Diphthong &
W.LC_C_Cedilla &
W.LC_E_Grave &
W.LC_E_Acute &
W.LC_E_Circumflex &
W.LC_E_Diaeresis &
W.LC_I_Grave &
W.LC_I_Acute &
W.LC_I_Circumflex &
W.LC_I_Diaeresis &
W.LC_Icelandic_Eth &
W.LC_N_Tilde &
W.LC_O_Grave &
W.LC_O_Acute &
W.LC_O_Circumflex &
W.LC_O_Tilde &
W.LC_O_Diaeresis &
W.LC_O_Oblique_Stroke &
W.LC_U_Grave &
W.LC_U_Acute &
W.LC_U_Circumflex &
W.LC_U_Diaeresis &
W.LC_Y_Acute &
W.LC_Icelandic_Thorn,
Rangev =>
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" &
W.UC_A_Grave &
W.UC_A_Acute &
W.UC_A_Circumflex &
W.UC_A_Tilde &
W.UC_A_Diaeresis &
W.UC_A_Ring &
W.UC_AE_Diphthong &
W.UC_C_Cedilla &
W.UC_E_Grave &
W.UC_E_Acute &
W.UC_E_Circumflex &
W.UC_E_Diaeresis &
W.UC_I_Grave &
W.UC_I_Acute &
W.UC_I_Circumflex &
W.UC_I_Diaeresis &
W.UC_Icelandic_Eth &
W.UC_N_Tilde &
W.UC_O_Grave &
W.UC_O_Acute &
W.UC_O_Circumflex &
W.UC_O_Tilde &
W.UC_O_Diaeresis &
W.UC_O_Oblique_Stroke &
W.UC_U_Grave &
W.UC_U_Acute &
W.UC_U_Circumflex &
W.UC_U_Diaeresis &
W.UC_Y_Acute &
W.UC_Icelandic_Thorn);
Upper_Case_Map : constant Wide_Character_Mapping :=
(AF.Controlled with
Upper_Case_Mapping'Unrestricted_Access);
Basic_Mapping : aliased constant Wide_Character_Mapping_Values :=
(Length => 55,
Domain =>
W.UC_A_Grave &
W.UC_A_Acute &
W.UC_A_Circumflex &
W.UC_A_Tilde &
W.UC_A_Diaeresis &
W.UC_A_Ring &
W.UC_C_Cedilla &
W.UC_E_Grave &
W.UC_E_Acute &
W.UC_E_Circumflex &
W.UC_E_Diaeresis &
W.UC_I_Grave &
W.UC_I_Acute &
W.UC_I_Circumflex &
W.UC_I_Diaeresis &
W.UC_N_Tilde &
W.UC_O_Grave &
W.UC_O_Acute &
W.UC_O_Circumflex &
W.UC_O_Tilde &
W.UC_O_Diaeresis &
W.UC_O_Oblique_Stroke &
W.UC_U_Grave &
W.UC_U_Acute &
W.UC_U_Circumflex &
W.UC_U_Diaeresis &
W.UC_Y_Acute &
W.LC_A_Grave &
W.LC_A_Acute &
W.LC_A_Circumflex &
W.LC_A_Tilde &
W.LC_A_Diaeresis &
W.LC_A_Ring &
W.LC_C_Cedilla &
W.LC_E_Grave &
W.LC_E_Acute &
W.LC_E_Circumflex &
W.LC_E_Diaeresis &
W.LC_I_Grave &
W.LC_I_Acute &
W.LC_I_Circumflex &
W.LC_I_Diaeresis &
W.LC_N_Tilde &
W.LC_O_Grave &
W.LC_O_Acute &
W.LC_O_Circumflex &
W.LC_O_Tilde &
W.LC_O_Diaeresis &
W.LC_O_Oblique_Stroke &
W.LC_U_Grave &
W.LC_U_Acute &
W.LC_U_Circumflex &
W.LC_U_Diaeresis &
W.LC_Y_Acute &
W.LC_Y_Diaeresis,
Rangev =>
'A' & -- UC_A_Grave
'A' & -- UC_A_Acute
'A' & -- UC_A_Circumflex
'A' & -- UC_A_Tilde
'A' & -- UC_A_Diaeresis
'A' & -- UC_A_Ring
'C' & -- UC_C_Cedilla
'E' & -- UC_E_Grave
'E' & -- UC_E_Acute
'E' & -- UC_E_Circumflex
'E' & -- UC_E_Diaeresis
'I' & -- UC_I_Grave
'I' & -- UC_I_Acute
'I' & -- UC_I_Circumflex
'I' & -- UC_I_Diaeresis
'N' & -- UC_N_Tilde
'O' & -- UC_O_Grave
'O' & -- UC_O_Acute
'O' & -- UC_O_Circumflex
'O' & -- UC_O_Tilde
'O' & -- UC_O_Diaeresis
'O' & -- UC_O_Oblique_Stroke
'U' & -- UC_U_Grave
'U' & -- UC_U_Acute
'U' & -- UC_U_Circumflex
'U' & -- UC_U_Diaeresis
'Y' & -- UC_Y_Acute
'a' & -- LC_A_Grave
'a' & -- LC_A_Acute
'a' & -- LC_A_Circumflex
'a' & -- LC_A_Tilde
'a' & -- LC_A_Diaeresis
'a' & -- LC_A_Ring
'c' & -- LC_C_Cedilla
'e' & -- LC_E_Grave
'e' & -- LC_E_Acute
'e' & -- LC_E_Circumflex
'e' & -- LC_E_Diaeresis
'i' & -- LC_I_Grave
'i' & -- LC_I_Acute
'i' & -- LC_I_Circumflex
'i' & -- LC_I_Diaeresis
'n' & -- LC_N_Tilde
'o' & -- LC_O_Grave
'o' & -- LC_O_Acute
'o' & -- LC_O_Circumflex
'o' & -- LC_O_Tilde
'o' & -- LC_O_Diaeresis
'o' & -- LC_O_Oblique_Stroke
'u' & -- LC_U_Grave
'u' & -- LC_U_Acute
'u' & -- LC_U_Circumflex
'u' & -- LC_U_Diaeresis
'y' & -- LC_Y_Acute
'y'); -- LC_Y_Diaeresis
Basic_Map : constant Wide_Character_Mapping :=
(AF.Controlled with
Basic_Mapping'Unrestricted_Access);
end Ada.Strings.Wide_Maps.Wide_Constants;
|
pragma License (Unrestricted);
-- implementation unit
package Ada.Containers.Binary_Trees.Simple is
pragma Preelaborate;
Node_Size : constant := Standard'Address_Size * 3;
type Node is new Binary_Trees.Node;
for Node'Size use Node_Size;
procedure Insert (
Container : in out Node_Access;
Length : in out Count_Type;
Before : Node_Access;
New_Item : not null Node_Access);
procedure Remove (
Container : in out Node_Access;
Length : in out Count_Type;
Position : not null Node_Access);
procedure Copy (
Target : out Node_Access;
Length : out Count_Type;
Source : Node_Access;
Copy : not null access procedure (
Target : out Node_Access;
Source : not null Node_Access));
-- set operations
procedure Merge is
new Binary_Trees.Merge (Insert => Insert, Remove => Remove);
procedure Copying_Merge is
new Binary_Trees.Copying_Merge (Insert => Insert);
end Ada.Containers.Binary_Trees.Simple;
|
-----------------------------------------------------------------------
-- awa-workspaces-module -- Module workspaces
-- Copyright (C) 2011, 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 ADO.Objects;
with ADO.Sessions;
with Security.Permissions;
with ASF.Applications;
with AWA.Modules;
with AWA.Services.Contexts;
with AWA.Workspaces.Models;
with AWA.Users.Services;
with AWA.Users.Models;
with AWA.Permissions.Services;
with AWA.Events;
private with Ada.Strings.Unbounded;
-- == Events ==
-- The *workspaces* module provides several events that are posted when some action are performed.
--
-- === invite-user ===
-- This event is posted when an invitation is created for a user. The event can be used to
-- send the associated invitation email to the invitee. The event contains the following
-- attributes:
--
-- key
-- email
-- name
-- message
-- inviter
--
-- === accept-invitation ===
-- This event is posted when an invitation is accepted by a user.
package AWA.Workspaces.Modules is
subtype Permission_Index_Array is Security.Permissions.Permission_Index_Array;
Not_Found : exception;
-- The name under which the module is registered.
NAME : constant String := "workspaces";
-- The configuration parameter that defines the list of permissions to grant
-- to a user when his workspace is created.
PARAM_PERMISSIONS_LIST : constant String := "permissions_list";
-- A boolean configuration parameter that indicates that new users can create
-- a workspace. When a user is created, the 'workspace-create' permission is
-- added so that they can create the workspace.
PARAM_ALLOW_WORKSPACE_CREATE : constant String := "allow_workspace_create";
-- Permission to create a workspace.
package ACL_Create_Workspace is new Security.Permissions.Definition ("workspace-create");
package ACL_Invite_User is new Security.Permissions.Definition ("workspace-invite-user");
package ACL_Delete_User is new Security.Permissions.Definition ("workspace-delete-user");
package Invite_User_Event is new AWA.Events.Definition (Name => "invite-user");
package Accept_Invitation_Event is new AWA.Events.Definition (Name => "accept-invitation");
-- ------------------------------
-- Module workspaces
-- ------------------------------
type Workspace_Module is new AWA.Modules.Module and AWA.Users.Services.Listener with private;
type Workspace_Module_Access is access all Workspace_Module'Class;
-- Initialize the workspaces module.
overriding
procedure Initialize (Plugin : in out Workspace_Module;
App : in AWA.Modules.Application_Access;
Props : in ASF.Applications.Config);
-- Configures the module after its initialization and after having read its XML configuration.
overriding
procedure Configure (Plugin : in out Workspace_Module;
Props : in ASF.Applications.Config);
-- Get the list of permissions for the workspace owner.
function Get_Owner_Permissions (Manager : in Workspace_Module) return Permission_Index_Array;
-- Get the workspace module.
function Get_Workspace_Module return Workspace_Module_Access;
-- Get the current workspace associated with the current user.
-- If the user has not workspace, create one.
procedure Get_Workspace (Session : in out ADO.Sessions.Master_Session;
Context : in AWA.Services.Contexts.Service_Context_Access;
Workspace : out AWA.Workspaces.Models.Workspace_Ref);
-- Create a workspace for the user.
procedure Create_Workspace (Module : in Workspace_Module;
Workspace : out AWA.Workspaces.Models.Workspace_Ref);
-- Load the invitation from the access key and verify that the key is still valid.
procedure Load_Invitation (Module : in Workspace_Module;
Key : in String;
Invitation : in out AWA.Workspaces.Models.Invitation_Ref'Class;
Inviter : in out AWA.Users.Models.User_Ref);
-- Accept the invitation identified by the access key.
procedure Accept_Invitation (Module : in Workspace_Module;
Key : in String);
-- Send the invitation to the user.
procedure Send_Invitation (Module : in Workspace_Module;
Invitation : in out AWA.Workspaces.Models.Invitation_Ref'Class);
-- Delete the member from the workspace. Remove the invitation if there is one.
procedure Delete_Member (Module : in Workspace_Module;
Member_Id : in ADO.Identifier);
-- Add a list of permissions for all the users of the workspace that have the appropriate
-- role. Workspace members will be able to access the given database entity for the
-- specified list of permissions.
procedure Add_Permission (Session : in out ADO.Sessions.Master_Session;
User : in ADO.Identifier;
Entity : in ADO.Objects.Object_Ref'Class;
Workspace : in ADO.Identifier;
List : in Security.Permissions.Permission_Index_Array);
-- The `On_Create` procedure is called by `Notify_Create` to notify the creation of the user.
overriding
procedure On_Create (Module : in Workspace_Module;
User : in AWA.Users.Models.User_Ref'Class);
-- The `On_Update` procedure is called by `Notify_Update` to notify the update of the user.
overriding
procedure On_Update (Module : in Workspace_Module;
User : in AWA.Users.Models.User_Ref'Class) is null;
-- The `On_Delete` procedure is called by `Notify_Delete` to notify the deletion of the user.
overriding
procedure On_Delete (Module : in Workspace_Module;
User : in AWA.Users.Models.User_Ref'Class) is null;
private
type Workspace_Module is new AWA.Modules.Module and AWA.Users.Services.Listener with record
User_Manager : AWA.Users.Services.User_Service_Access;
-- The permission manager.
Perm_Manager : AWA.Permissions.Services.Permission_Manager_Access;
-- The list of permissions to grant to a user who creates the workspace.
Owner_Permissions : Ada.Strings.Unbounded.Unbounded_String;
-- When set, allow new users to create a workspace.
Allow_WS_Create : Boolean := False;
end record;
end AWA.Workspaces.Modules;
|
with Cairo; use Cairo;
with Cairo.Png; use Cairo.Png;
with Cairo.Image_Surface; use Cairo.Image_Surface;
procedure XorPattern is
type xorable is mod 256;
Surface : Cairo_Surface;
Data : RGB24_Array_Access;
Status : Cairo_Status;
Num : Byte;
begin
Data := new RGB24_Array(0..256*256-1);
for x in Natural range 0..255 loop
for y in Natural range 0..255 loop
Num := Byte(xorable(x) xor xorable(y));
Data(x+256*y) := RGB24_Data'(Num,0,Num);
end loop;
end loop;
Surface := Create_For_Data_RGB24(Data, 256, 256);
Status := Write_To_Png (Surface, "AdaXorPattern.png");
pragma Assert (Status = Cairo_Status_Success);
end XorPattern;
|
procedure Access_Variable is
type Button is null record;
type ButtonRef is access all Button;
procedure Press (B : ButtonRef) is
begin
null;
end Press;
Red_Button : aliased Button;
begin
Press(Red_Button'Access);
end Access_Variable;
|
-- This file is an Ada file containing test data
-- for etags (Ada83 and Ada95 support).
package Pkg1 is
type Private_T is private;
package Inner1 is
procedure Private_T;
end Inner1;
package Inner2 is
task Private_T;
end Inner2;
type Public_T is
record
A : Integer;
B : Integer;
end record;
procedure Pkg1_Proc1;
procedure Pkg1_Proc2 (I : Integer);
function Pkg1_Func1 return Boolean;
function Pkg1_Func2 (Ijk : Integer; Z : Integer) return Natural;
package Pkg1_Pkg1 is
procedure Pkg1_Pkg1_Proc1;
end Pkg1_Pkg1;
task type Task_Type is
entry Entry1;
entry Entry2 (I : Integer);
end;
private
type Private_T is
record
Z : Integer;
W : Boolean;
end record;
end Pkg1;
package body Pkg1 is
procedure Pkg1_Proc1 is
begin
null;
end;
package body Inner1 is
procedure Private_T is
begin
null;
end;
end Inner1;
package body Inner2 is
task body Private_T is
begin
loop
null;
end loop;
end;
end Inner2;
task body Task_Type is
begin
select
accept Entry1 do
null;
end;
or
accept Entry2 (I : Integer) do
null;
end;
end select;
end;
procedure Pkg1_Proc2 (I : Integer) is
begin
null;
end Pkg1_Proc2;
function Pkg1_Func1 return Boolean is separate;
function Pkg1_Func2 (Ijk : Integer; Z : Integer) return Natural is
begin
return 1;
end;
package body Pkg1_Pkg1 is separate;
end Pkg1;
separate (Pkg1)
package body Pkg1_Pkg1 is
procedure Pkg1_Pkg1_Proc1 is
begin
null;
end;
end Pkg1_Pkg1;
separate (Pkg1)
function Pkg1_Func1 return Boolean is
begin
return False;
end;
-- from now on, this is Ada 95 specific.
package Truc is
I : Integer;
end Truc;
with Pkg1;
package Truc.Bidule is
use type Pkg1.Public_T;
use Pkg1;
use
type Pkg1.Public_T;
use -- comment
type -- comment
Pkg1.Public_T;
protected Bidule is
entry Basar;
private
Ok : Boolean;
end Bidule;
protected type Machin_T is
entry Truc;
private
Ok : Boolean;
end Machin_T;
end Truc.Bidule;
package body Truc.Bidule is
protected body Bidule is
entry Basar when Ok is
begin
null;
end;
end Bidule;
protected body Machin_T is
entry Truc when Ok is
begin
null;
end;
end Machin_T;
end Truc.Bidule;
|
with Ada.Text_IO; use Ada.Text_IO;
procedure Adventofcode.Day_24.Main is
begin
Put_Line ("Day-24");
end Adventofcode.Day_24.Main;
|
with Ada.Tags;
with Generic_Logging;
with Langkit_Support.Slocs;
with Langkit_Support.Text;
With System.Address_Image;
package body Lal_Adapter.Node is
package Slocs renames Langkit_Support.Slocs;
package Text renames Langkit_Support.Text;
-----------------------------------------------------------------------------
-- Element_ID support
-- Unlike ASIS Elements, libadalang Nodes have no unique ID as far as I can tell.
-- Until we can come up with something better, we will just use an incrementing
-- counter. THIS GIVES A DIFFERENT ANSWER EVERY TIME Get_Element_ID IS CALLED.
-- This is good to keep all nodes from having the same ID, but it is bad for
-- determinining if two nodes are the same.
-- TODO: Implement by storing and hashing Nodes?
Last_Node_ID : Natural := anhS.Empty_ID;
Node_Map : Node_ID_Map.Map := Node_ID_Map.Empty_Map;
------------
-- EXPORTED:
------------
function Get_Element_ID
(Node : in LAL.Ada_Node'Class)
return Element_ID is
-- Tried to use address for mapping but got nodes with same address.
-- Use Image for now till we have better option for the mapping.
Node_Image : String := LAL.Image(Node);
C : constant Node_ID_Map.Cursor := Node_Map.Find (Node_Image);
use type Node_ID_Map.Cursor;
Node_Id : Integer := 0;
begin
-- Put_Line("Node: " & Node_Image);
if LAL.Is_Null (Node) then
return No_Element_ID;
else
if C = Node_ID_Map.No_Element then
Last_Node_ID := Last_Node_ID + 1;
Node_Map.Insert (Node_Image, Last_Node_ID);
Node_Id := Last_Node_ID;
else
Node_Id := Node_ID_Map.Element (C);
end if;
return (Node_ID => Node_Id,
Kind => Node.Kind);
end if;
end Get_Element_ID;
------------
-- EXPORTED:
------------
function To_Element_ID
(This : in Element_ID)
return a_nodes_h.Element_ID
is
Result : Integer;
begin
Result := Integer (This.Node_ID) * 1000 +
LALCO.Ada_Node_Kind_Type'Pos(This.Kind);
return a_nodes_h.Element_ID (Result);
end To_Element_ID;
------------
-- EXPORTED:
------------
function Get_Element_ID
(Element : in LAL.Ada_Node'Class)
return a_nodes_h.Element_ID
is
(To_Element_ID (Get_Element_ID (Element)));
------------
-- EXPORTED:
------------
function To_String
(This : in a_nodes_h.Element_ID)
return String
is
(To_String (This, Element_ID_Kind));
-- END Element_ID support
-----------------------------------------------------------------------------
----------------------
-- EXPORTED (private):
----------------------
procedure Add_To_Dot_Label
(This : in out Class;
Value : in String) is
begin
Add_To_Dot_Label (Dot_Label => This.Dot_Label,
Outputs => This.Outputs,
Value => Value);
end Add_To_Dot_Label;
procedure Add_To_Dot_Label
(This : in out Class;
Name : in String;
Value : in String) is
begin
Add_To_Dot_Label (Dot_Label => This.Dot_Label,
Outputs => This.Outputs,
Name => Name,
Value => Value);
end Add_To_Dot_Label;
procedure Add_To_Dot_Label
(This : in out Class;
Name : in String;
Value : in a_nodes_h.Element_ID) is
begin
This.Add_To_Dot_Label (Name, To_String (Value));
end Add_To_Dot_Label;
procedure Add_To_Dot_Label
(This : in out Class;
Name : in String;
Value : in Boolean) is
begin
Add_To_Dot_Label (Dot_Label => This.Dot_Label,
Outputs => This.Outputs,
Name => Name,
Value => Value);
end Add_To_Dot_Label;
procedure Add_Dot_Edge
(This : in out Class;
From : in a_nodes_h.Element_ID;
To : in a_nodes_h.Element_ID;
Label : in String)
is
begin
Add_Dot_Edge (Outputs => This.Outputs,
From => From,
From_Kind => Element_ID_Kind,
To => To,
To_Kind => Element_ID_Kind,
Label => Label);
end Add_Dot_Edge;
procedure Add_To_Dot_Label_And_Edge
(This : in out Class;
Label : in String;
To : in a_nodes_h.Element_ID) is
begin
This.Add_To_Dot_Label (Label, To_String (To));
This.Add_Dot_Edge (From => This.Element_IDs.First_Element,
To => To,
Label => Label);
end Add_To_Dot_Label_And_Edge;
procedure Add_Not_Implemented
(This : in out Class;
Ada_Version : in Ada_Versions := Supported_Ada_Version) is
begin
if Ada_Version <= Supported_Ada_Version then
This.Add_To_Dot_Label
("LIBADALANG_PROCESSING", String'("NOT_IMPLEMENTED_COMPLETELY"));
This.Outputs.A_Nodes.Add_Not_Implemented;
else
This.Add_To_Dot_Label
("LIBADALANG_PROCESSING",
Ada_Version'Image & "_FEATURE_NOT_IMPLEMENTED_IN_" &
Supported_Ada_Version'Image);
end if;
end Add_Not_Implemented;
------------
-- Exported:
------------
procedure Process_Ada_Abort_Node
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Abort_Node";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Abort_Node := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Abort_Node
case Kind is
when Ada_Abort_Absent =>
declare
Abort_Absent_Node : constant LAL.Abort_Absent := LAL.As_Abort_Absent (Node);
begin
NULL;
end;
when Ada_Abort_Present =>
declare
Abort_Present_Node : constant LAL.Abort_Present := LAL.As_Abort_Present (Node);
begin
NULL;
end;
end case;
end Process_Ada_Abort_Node;
procedure Process_Ada_Abstract_Node
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Abstract_Node";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Abstract_Node := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Abstract_Node
case Kind is
when Ada_Abstract_Absent =>
declare
Abstract_Absent_Node : constant LAL.Abstract_Absent := LAL.As_Abstract_Absent (Node);
begin
NULL;
end;
when Ada_Abstract_Present =>
declare
Abstract_Present_Node : constant LAL.Abstract_Present := LAL.As_Abstract_Present (Node);
begin
NULL;
end;
end case;
end Process_Ada_Abstract_Node;
procedure Process_Ada_Ada_List
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Ada_List";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Ada_List := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Ada_List
case Kind is
when Ada_Ada_Node_List =>
declare
Ada_Node_List_Node : constant LAL.Ada_Node_List := LAL.As_Ada_Node_List (Node);
NodeListFirst : constant Positive := LAL.Ada_Node_List_First (Ada_Node_List_Node);
begin
Log ("NodeListFirst: " & NodeListFirst'Image);
end;
when Ada_Alternatives_List =>
declare
Alternatives_List_Node : constant LAL.Alternatives_List := LAL.As_Alternatives_List (Node);
begin
NULL;
end;
when Ada_Constraint_List =>
declare
Constraint_List_Node : constant LAL.Constraint_List := LAL.As_Constraint_List (Node);
begin
NULL;
end;
when Ada_Decl_List =>
declare
Decl_List_Node : constant LAL.Decl_List := LAL.As_Decl_List (Node);
begin
NULL;
end;
when Ada_Stmt_List =>
declare
Stmt_List_Node : constant LAL.Stmt_List := LAL.As_Stmt_List (Node);
begin
NULL;
end;
when Ada_Aspect_Assoc_List =>
declare
Aspect_Assoc_List_Node : constant LAL.Aspect_Assoc_List := LAL.As_Aspect_Assoc_List (Node);
AspectAsoocListFirst : constant Positive := LAL.Aspect_Assoc_List_First (Aspect_Assoc_List_Node);
begin
Log ("AspectAsoocListFirst: " & AspectAsoocListFirst'Image);
end;
when Ada_Base_Assoc_List =>
declare
Base_Assoc_List_Node : constant LAL.Base_Assoc_List := LAL.As_Base_Assoc_List (Node);
BaseAsoocListFirst : constant Positive := LAL.Base_Assoc_List_First (Base_Assoc_List_Node);
begin
Log ("BaseAsoocListFirst: " & BaseAsoocListFirst'Image);
end;
when Ada_Assoc_List =>
declare
Assoc_list_Node : constant LAL.Assoc_list := LAL.As_Assoc_list (Node);
begin
NULL;
end;
when Ada_Case_Expr_Alternative_List =>
declare
Case_Expr_Alternative_List_Node : constant LAL.Case_Expr_Alternative_List := LAL.As_Case_Expr_Alternative_List (Node);
CaseExprAlternativeListFirst : constant Positive := LAL.Case_Expr_Alternative_List_First (Case_Expr_Alternative_List_Node);
begin
Log ("CaseExprAlternativeListFirst: " & CaseExprAlternativeListFirst'Image);
end;
when Ada_Case_Stmt_Alternative_List =>
declare
Case_Stmt_Alternative_List_Node : constant LAL.Case_Stmt_Alternative_List := LAL.As_Case_Stmt_Alternative_List (Node);
CaseStmtAlernativeListFirst : constant Positive := LAL.Case_Stmt_Alternative_List_First (Case_Stmt_Alternative_List_Node);
begin
Log ("CaseStmtAlernativeListFirst: " & CaseStmtAlernativeListFirst'Image);
end;
when Ada_Compilation_Unit_List =>
declare
Compilation_Unit_List_Node : constant LAL.Compilation_Unit_List := LAL.As_Compilation_Unit_List (Node);
CompilationUnitListFirst : constant Positive := LAL.Compilation_Unit_List_First (Compilation_Unit_List_Node);
begin
Log ("CompilationUnitListFirst: " & CompilationUnitListFirst'Image);
end;
when Ada_Contract_Case_Assoc_List =>
declare
Contract_Case_Assoc_List_Node : constant LAL.Contract_Case_Assoc_List := LAL.As_Contract_Case_Assoc_List (Node);
ContractCastAssocListFirst : constant Positive := LAL.Contract_Case_Assoc_List_First (Contract_Case_Assoc_List_Node);
begin
Log ("ContractCastAssocListFirst: " & ContractCastAssocListFirst'Image);
end;
when Ada_Defining_Name_List =>
declare
Defining_Name_List_Node : constant LAL.Defining_Name_List := LAL.As_Defining_Name_List (Node);
DefiningNameListFirst : constant Positive := LAL.Defining_Name_List_First (Defining_Name_List_Node);
begin
Log ("DefiningNameListFirst: " & DefiningNameListFirst'Image);
end;
when Ada_Discriminant_Spec_List =>
declare
Discriminant_Spec_List_Node : constant LAL.Discriminant_Spec_List := LAL.As_Discriminant_Spec_List (Node);
DiscriminantSpecListNodeFirst : constant Positive := LAL.Discriminant_Spec_List_First (Discriminant_Spec_List_Node);
begin
Log ("DiscriminantSpecListNodeFirst: " & DiscriminantSpecListNodeFirst'Image);
end;
when Ada_Elsif_Expr_Part_List =>
declare
Elsif_Expr_Part_List_Node : constant LAL.Elsif_Expr_Part_List := LAL.As_Elsif_Expr_Part_List (Node);
ElsifExprPartListNodeFirst : constant Positive := LAL.Elsif_Expr_Part_List_First (Elsif_Expr_Part_List_Node);
begin
Log ("ElsifExprPartListNodeFirst: " & ElsifExprPartListNodeFirst'Image);
end;
when Ada_Elsif_Stmt_Part_List =>
declare
Elsif_Stmt_Part_List_Node : constant LAL.Elsif_Stmt_Part_List := LAL.As_Elsif_Stmt_Part_List (Node);
ElsifStmtPartListNodeFirst : constant Positive := LAL.Elsif_Stmt_Part_List_First (Elsif_Stmt_Part_List_Node);
begin
Log ("ElsifExprPartListNodeFirst: " & ElsifStmtPartListNodeFirst'Image);
end;
when Ada_Enum_Literal_Decl_List =>
declare
Enum_Literal_Decl_List_Node : constant LAL.Enum_Literal_Decl_List := LAL.As_Enum_Literal_Decl_List (Node);
EnumLiteralDeclListNodeFirst : constant Positive := LAL.Enum_Literal_Decl_List_First (Enum_Literal_Decl_List_Node);
begin
Log ("EnumLiteralDeclListNodeFirst: " & EnumLiteralDeclListNodeFirst'Image);
end;
when Ada_Expr_Alternatives_List =>
declare
Expr_Alternatives_List_Node : constant LAL.Expr_Alternatives_List := LAL.As_Expr_Alternatives_List (Node);
begin
NULL;
end;
when Ada_Discriminant_Choice_List =>
declare
Discriminant_Choice_List_Node : constant LAL.Discriminant_Choice_List := LAL.As_Discriminant_Choice_List (Node);
begin
NULL;
end;
when Ada_Name_List =>
declare
Name_List_Node : constant LAL.Name_List := LAL.As_Name_List (Node);
NameListFirst : constant Positive := LAL.Name_List_First (Name_List_Node);
begin
Log ("NameListFirst: " & NameListFirst'Image);
end;
when Ada_Parent_List =>
declare
Parent_List_Node : constant LAL.Parent_List := LAL.As_Parent_List (Node);
begin
NULL;
end;
when Ada_Param_Spec_List =>
declare
Param_Spec_List_Node : constant LAL.Param_Spec_List := LAL.As_Param_Spec_List (Node);
ParamSpecListFirst : constant Positive := LAL.Param_Spec_List_First (Param_Spec_List_Node);
begin
Log ("ParamSpecListFirst: " & ParamSpecListFirst'Image);
end;
when Ada_Pragma_Node_List =>
declare
Pragma_Node_List_Node : constant LAL.Pragma_Node_List := LAL.As_Pragma_Node_List (Node);
PragmaNodeListFirst : constant Positive := LAL.Pragma_Node_List_First (Pragma_Node_List_Node);
begin
Log ("PragmaNodeListFirst: " & PragmaNodeListFirst'Image);
end;
when Ada_Select_When_Part_List =>
declare
Select_When_Part_List_Node : constant LAL.Select_When_Part_List := LAL.As_Select_When_Part_List (Node);
SelectWhenPartListFirst : constant Positive := LAL.Select_When_Part_List_First (Select_When_Part_List_Node);
begin
Log ("SelectWhenPartListFirst: " & SelectWhenPartListFirst'Image);
end;
when Ada_Unconstrained_Array_Index_List =>
declare
Unconstrained_Array_Index_List_Node : constant LAL.Unconstrained_Array_Index_List := LAL.As_Unconstrained_Array_Index_List (Node);
UnconstrainedArrayIndexListFirst : constant Positive := LAL.Unconstrained_Array_Index_List_First (Unconstrained_Array_Index_List_Node);
begin
Log ("UnconstrainedArrayIndexListFirst: " & UnconstrainedArrayIndexListFirst'Image);
end;
when Ada_Variant_List =>
declare
Variant_List_Node : constant LAL.Variant_List := LAL.As_Variant_List (Node);
VariantListFirst : constant Positive := LAL.Variant_List_First (Variant_List_Node);
begin
Log ("VariantListFirst: " & VariantListFirst'Image);
end;
end case;
end Process_Ada_Ada_List;
procedure Process_Ada_Aliased_Node
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Aliased_Node";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Aliased_Node := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Aliased_Node
case Kind is
when Ada_Aliased_Absent =>
declare
Aliased_Absent_Node : constant LAL.Aliased_Absent := LAL.As_Aliased_Absent (Node);
begin
NULL;
end;
when Ada_Aliased_Present =>
declare
Aliased_Present_Node : constant LAL.Aliased_Present := LAL.As_Aliased_Present (Node);
begin
NULL;
end;
end case;
end Process_Ada_Aliased_Node;
procedure Process_Ada_All_Node
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_All_Node";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_All_Node := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_All_Node
case Kind is
when Ada_All_Absent =>
declare
All_Absent_Node : constant LAL.All_Absent := LAL.As_All_Absent (Node);
begin
NULL;
end;
when Ada_All_Present =>
declare
All_Present_Node : constant LAL.All_Present := LAL.As_All_Present (Node);
begin
NULL;
end;
end case;
end Process_Ada_All_Node;
procedure Process_Ada_Array_Indices
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Array_Indices";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Array_Indices := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Array_Indices
case Kind is
when Ada_Constrained_Array_Indices =>
declare
Constrained_Array_Indices_Node : constant LAL.Constrained_Array_Indices := LAL.As_Constrained_Array_Indices (Node);
ConstraintList : constant LAL.Constraint_List := LAL.F_List (Constrained_Array_Indices_Node);
begin
Log ("ConstraintList: " & ConstraintList.Debug_Text);
end;
when Ada_Unconstrained_Array_Indices =>
declare
Unconstrained_Array_Indices_Node : constant LAL.Unconstrained_Array_Indices := LAL.As_Unconstrained_Array_Indices (Node);
UnconstrainedArrayIndexList : constant LAL.Unconstrained_Array_Index_List := LAL.F_Types (Unconstrained_Array_Indices_Node);
begin
Log ("UnconstrainedArrayIndexList: " & UnconstrainedArrayIndexList.Debug_Text);
end;
end case;
end Process_Ada_Array_Indices;
procedure Process_Ada_Aspect_Assoc_Range
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Aspect_Assoc_Range";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Aspect_Assoc_Range := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Aspect_Assoc_Range
case Kind is
when Ada_Aspect_Assoc =>
declare
Aspect_Assoc_Node : constant LAL.Aspect_Assoc := LAL.As_Aspect_Assoc (Node);
name : constant LAL.Name := LAL.F_Id (Aspect_Assoc_Node);
expr : constant LAL.Expr := LAL.F_Expr (Aspect_Assoc_Node);
begin
Log ("name: " & name.Debug_Text);
if not expr.Is_Null then
Log ("expr: " & expr.Debug_Text);
end if;
end;
end case;
end Process_Ada_Aspect_Assoc_Range;
procedure Process_Ada_Aspect_Clause
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Aspect_Clause";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Aspect_Clause := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Aspect_Clause
case Kind is
when Ada_At_Clause =>
declare
At_Clause_Node : constant LAL.At_Clause := LAL.As_At_Clause (Node);
baseID : constant LAL.Base_Id := LAL.F_Name (At_Clause_Node);
expr : constant LAL.Expr := LAL.F_Expr (At_Clause_Node);
begin
Log ("baseID: " & baseID.Debug_Text);
Log ("expr: " & expr.Debug_Text);
end;
when Ada_Attribute_Def_Clause =>
declare
Attribute_Def_Clause_Node : constant LAL.Attribute_Def_Clause := LAL.As_Attribute_Def_Clause (Node);
name : constant LAL.Name := LAL.F_Attribute_Expr (Attribute_Def_Clause_Node);
expr : constant LAL.Expr := LAL.F_Expr (Attribute_Def_Clause_Node);
begin
Log ("name: " & name.Debug_Text);
Log ("expr: " & expr.Debug_Text);
end;
when Ada_Enum_Rep_Clause =>
declare
Enum_Rep_Clause_Node : constant LAL.Enum_Rep_Clause := LAL.As_Enum_Rep_Clause (Node);
name : constant LAL.Name := LAL.F_Type_Name (Enum_Rep_Clause_Node);
baseAggregate : constant LAL.Base_Aggregate := LAL.F_Aggregate (Enum_Rep_Clause_Node);
begin
Log ("name: " & name.Debug_Text);
Log ("baseAggregate: " & baseAggregate.Debug_Text);
end;
when Ada_Record_Rep_Clause =>
declare
Record_Rep_Clause_Node : constant LAL.Record_Rep_Clause := LAL.As_Record_Rep_Clause (Node);
name : constant LAL.Name := LAL.F_Name (Record_Rep_Clause_Node);
expr : constant LAL.Expr := LAL.F_At_Expr (Record_Rep_Clause_Node);
nodeList : constant LAL.Ada_Node_List := LAL.F_Components (Record_Rep_Clause_Node);
begin
Log ("name: " & name.Debug_Text);
if not expr.Is_Null then
Log ("expr: " & expr.Debug_Text);
end if;
Log ("nodeList: " & nodeList.Debug_Text);
end;
end case;
end Process_Ada_Aspect_Clause;
procedure Process_Ada_Aspect_Spec_Range
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Aspect_Spec_Range";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Aspect_Spec_Range := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Aspect_Spec_Range
case Kind is
when Ada_Aspect_Spec =>
declare
Aspect_Spec_Node : constant LAL.Aspect_Spec := LAL.As_Aspect_Spec (Node);
aspectAssocList : constant LAL.Aspect_Assoc_List := LAL.F_Aspect_Assocs (Aspect_Spec_Node);
begin
Log ("aspectAssocList: " & aspectAssocList.Debug_Text);
end;
end case;
end Process_Ada_Aspect_Spec_Range;
procedure Process_Ada_Base_Assoc
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Base_Assoc";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Base_Assoc := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Base_Assoc
case Kind is
when Ada_Contract_Case_Assoc =>
declare
Contract_Case_Assoc_Node : constant LAL.Contract_Case_Assoc := LAL.As_Contract_Case_Assoc (Node);
guard : constant LAL.Ada_Node := LAL.F_Guard (Contract_Case_Assoc_Node);
consequence : constant LAL.Expr := LAL.F_Consequence (Contract_Case_Assoc_Node);
begin
Log ("guard: " & guard.Debug_Text);
Log ("consequence: " & consequence.Debug_Text);
end;
when Ada_Pragma_Argument_Assoc =>
declare
Pragma_Argument_Assoc_Node : constant LAL.Pragma_Argument_Assoc := LAL.As_Pragma_Argument_Assoc (Node);
id : constant LAL.Identifier := LAL.F_Id (Pragma_Argument_Assoc_Node);
expr : constant LAL.Expr := LAL.F_Expr (Pragma_Argument_Assoc_Node);
begin
if not id.Is_Null then
Log ("id: " & id.Debug_Text);
end if;
if not expr.Is_Null then
Log ("expr: " & expr.Debug_Text);
end if;
end;
end case;
end Process_Ada_Base_Assoc;
procedure Process_Ada_Base_Formal_Param_Holder
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Base_Formal_Param_Holder";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Base_Formal_Param_Holder := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Base_Formal_Param_Holder
case Kind is
when Ada_Entry_Spec =>
declare
Entry_Spec_Node : constant LAL.Entry_Spec := LAL.As_Entry_Spec (Node);
entryName : constant LAL.Defining_Name := LAL.F_Entry_Name (Entry_Spec_Node);
familyType : constant LAL.Ada_Node := LAL.F_Family_Type (Entry_Spec_Node);
entryParams : constant LAL.Params := LAL.F_Entry_Params (Entry_Spec_Node);
begin
Log ("entryName: " & entryName.Debug_Text);
if not familyType.Is_Null then
Log ("familyType: " & familyType.Debug_Text);
end if;
if not entryParams.Is_Null then
Log ("entryParams: " & entryParams.Debug_Text);
end if;
end;
when Ada_Enum_Subp_Spec =>
declare
Enum_Subp_Spec_Node : constant LAL.Enum_Subp_Spec := LAL.As_Enum_Subp_Spec (Node);
begin
NULL;
end;
when Ada_Subp_Spec =>
declare
Subp_Spec_Node : constant LAL.Subp_Spec := LAL.As_Subp_Spec (Node);
subpKind : constant LAL.Subp_Kind := LAL.F_Subp_Kind (Subp_Spec_Node);
subpName : constant LAL.Defining_Name := LAL.F_Subp_Name (Subp_Spec_Node);
subpParams : constant LAL.Params := LAL.F_Subp_Params (Subp_Spec_Node);
subpReturn : constant LAL.Type_Expr := LAL.F_Subp_Returns (Subp_Spec_Node);
begin
Log ("subpKind: " & subpKind.Debug_Text);
if not subpName.Is_Null then
Log ("subpName: " & subpName.Debug_Text);
end if;
if not subpParams.Is_Null then
Log ("subpParams: " & subpParams.Debug_Text);
end if;
if not subpReturn.Is_Null then
Log ("subpReturn: " & subpReturn.Debug_Text);
end if;
end;
when Ada_Component_List =>
declare
Component_List_Node : constant LAL.Component_List := LAL.As_Component_List (Node);
components : constant LAL.Ada_Node_List := LAL.F_Components (Component_List_Node);
variantPart : constant LAL.Variant_Part := LAL.F_Variant_Part (Component_List_Node);
begin
Log ("components: " & components.Debug_Text);
if not variantPart.Is_Null then
Log ("variantPart: " & variantPart.Debug_Text);
end if;
end;
when Ada_Known_Discriminant_Part =>
declare
Known_Discriminant_Part_Node : constant LAL.Known_Discriminant_Part := LAL.As_Known_Discriminant_Part (Node);
discrSpecs : constant LAL.Discriminant_Spec_List := LAL.F_Discr_Specs (Known_Discriminant_Part_Node);
begin
Log ("discrSpecs: " & discrSpecs.Debug_Text);
end;
when Ada_Unknown_Discriminant_Part =>
declare
Unknown_Discriminant_Part_Node : constant LAL.Unknown_Discriminant_Part := LAL.As_Unknown_Discriminant_Part (Node);
begin
NULL;
end;
when Ada_Entry_Completion_Formal_Params =>
declare
Entry_Completion_Formal_Params_Node : constant LAL.Entry_Completion_Formal_Params := LAL.As_Entry_Completion_Formal_Params (Node);
params : constant LAL.Params := LAL.F_Params (Entry_Completion_Formal_Params_Node);
begin
if not params.Is_Null then
Log ("params: " & params.Debug_Text);
end if;
end;
when Ada_Generic_Formal_Part =>
declare
Generic_Formal_Part_Node : constant LAL.Generic_Formal_Part := LAL.As_Generic_Formal_Part (Node);
decls : constant LAL.Ada_Node_List := LAL.F_Decls (Generic_Formal_Part_Node);
begin
Log ("decls: " & decls.Debug_Text);
end;
end case;
end Process_Ada_Base_Formal_Param_Holder;
procedure Process_Ada_Base_Record_Def
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Base_Record_Def";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Base_Record_Def := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Base_Record_Def
case Kind is
when Ada_Null_Record_Def =>
declare
Null_Record_Def_Node : constant LAL.Null_Record_Def := LAL.As_Null_Record_Def (Node);
begin
NULL;
end;
when Ada_Record_Def =>
declare
Record_Def_Node : constant LAL.Record_Def := LAL.As_Record_Def (Node);
begin
NULL;
end;
end case;
end Process_Ada_Base_Record_Def;
procedure Process_Ada_Basic_Assoc
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Basic_Assoc";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Basic_Assoc := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Basic_Assoc
case Kind is
when Ada_Aggregate_Assoc =>
declare
Aggregate_Assoc_Node : constant LAL.Aggregate_Assoc := LAL.As_Aggregate_Assoc (Node);
designators : constant LAL.Alternatives_List := LAL.F_Designators (Aggregate_Assoc_Node);
rExpr : constant LAL.Expr := LAL.F_R_Expr (Aggregate_Assoc_Node);
begin
Log ("designators: " & designators.Debug_Text);
Log ("rExpr: " & rExpr.Debug_Text);
end;
when Ada_Multi_Dim_Array_Assoc =>
declare
Multi_Dim_Array_Assoc_Node : constant LAL.Multi_Dim_Array_Assoc := LAL.As_Multi_Dim_Array_Assoc (Node);
begin
NULL;
end;
when Ada_Discriminant_Assoc =>
declare
Discriminant_Assoc_Node : constant LAL.Discriminant_Assoc := LAL.As_Discriminant_Assoc (Node);
ids : constant LAL.Discriminant_Choice_List := LAL.F_Ids (Discriminant_Assoc_Node);
discrExpr : constant LAL.Expr := LAL.F_Discr_Expr (Discriminant_Assoc_Node);
begin
Log ("ids: " & ids.Debug_Text);
Log ("discrExpr: " & discrExpr.Debug_Text);
end;
when Ada_Param_Assoc =>
declare
Param_Assoc_Node : constant LAL.Param_Assoc := LAL.As_Param_Assoc (Node);
designators : constant LAL.Ada_Node := LAL.F_Designator (Param_Assoc_Node);
rExpr : constant LAL.Expr := LAL.F_R_Expr (Param_Assoc_Node);
begin
if not designators.Is_Null then
Log ("designators: " & designators.Debug_Text);
end if;
if not rExpr.Is_Null then
Log ("rExpr: " & rExpr.Debug_Text);
end if;
end;
end case;
end Process_Ada_Basic_Assoc;
procedure Process_Ada_Basic_Decl
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Ada_Basic_Decl";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Basic_Decl := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Basic_Decl
case Kind is
--when Ada_Base_Formal_Param_Decl =>
-- This.Add_Not_Implemented;
when Ada_Component_Decl =>
declare
Component_Decl_Node : constant LAL.Component_Decl := LAL.As_Component_Decl (Node);
NameList : constant LAL.Defining_Name_List := LAL.F_Ids (Component_Decl_Node);
Component_Def : constant LAL.Component_Def := LAL.F_Component_Def (Component_Decl_Node);
Expr : constant LAL.Expr := LAL.F_Default_Expr (Component_Decl_Node);
begin
Log ("NameList: " & NameList.Debug_Text);
Log ("Component_Def: " & Component_Def.Debug_Text);
if not Expr.Is_Null then
Log ("Expr: " & Expr.Debug_Text);
end if;
end;
This.Add_Not_Implemented;
when Ada_Discriminant_Spec =>
declare
Discriminant_Spec_Node : constant LAL.Discriminant_Spec := LAL.As_Discriminant_Spec (Node);
NameList : constant LAL.Defining_Name_List := LAL.F_Ids (Discriminant_Spec_Node);
TypeExpr : constant LAL.Type_Expr := LAL.F_Type_Expr (Discriminant_Spec_Node);
DefaultExpr : constant LAL.Expr := LAL.F_Default_Expr (Discriminant_Spec_Node);
begin
Log ("NameList: " & NameList.Debug_Text);
Log ("TypeExpr: " & TypeExpr.Debug_Text);
if not DefaultExpr.Is_Null then
Log ("DefaultExpr: " & DefaultExpr.Debug_Text);
end if;
end;
This.Add_Not_Implemented;
--when Ada_Generic_Formal =>
-- This.Add_Not_Implemented;
when Ada_Generic_Formal_Obj_Decl =>
declare
Generic_Formal_Obj_Decl_Node : constant LAL.Generic_Formal_Obj_Decl := LAL.As_Generic_Formal_Obj_Decl (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Generic_Formal_Package =>
declare
Generic_Formal_Package_Node : constant LAL.Generic_Formal_Package := LAL.As_Generic_Formal_Package (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Generic_Formal_Subp_Decl =>
declare
Generic_Formal_Subp_Decl_Node : constant LAL.Generic_Formal_Subp_Decl := LAL.As_Generic_Formal_Subp_Decl (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Generic_Formal_Type_Decl =>
declare
Generic_Formal_Type_Decl_Node : constant LAL.Generic_Formal_Type_Decl := LAL.As_Generic_Formal_Type_Decl (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Param_Spec =>
declare
Param_Spec_Node : constant LAL.Param_Spec := LAL.As_Param_Spec (Node);
NameList : constant LAL.Defining_Name_List := LAL.F_Ids (Param_Spec_Node);
Has_Aliased : constant Boolean := LAL.F_Has_Aliased (Param_Spec_Node);
Mode : constant LAL.Mode := LAL.F_Mode (Param_Spec_Node);
begin
Log ("NameList: " & NameList.Debug_Text);
Log ("Has_Alias: " & Boolean'Image (Has_Aliased));
Log ("Mode: " & Mode.Debug_Text);
end;
This.Add_Not_Implemented;
--when Ada_Base_Package_Decl =>
-- This.Add_Not_Implemented;
when Ada_Generic_Package_Internal =>
declare
Generic_Package_Internal_Node : constant LAL.Generic_Package_Internal := LAL.As_Generic_Package_Internal (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Package_Decl =>
declare
Package_Decl_Node : constant LAL.Package_Decl := LAL.As_Package_Decl (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
--when Ada_Base_Type_Decl =>
-- This.Add_Not_Implemented;
--when Ada_Base_Subtype_Decl =>
-- This.Add_Not_Implemented;
when Ada_Discrete_Base_Subtype_Decl =>
declare
Discrete_Base_Subtype_Decl_Node : constant LAL.Discrete_Base_Subtype_Decl := LAL.As_Discrete_Base_Subtype_Decl (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Subtype_Decl =>
declare
Subtype_Decl_Node : constant LAL.Subtype_Decl := LAL.As_Subtype_Decl (Node);
bareSubtype : constant LAL.Subtype_Indication := LAL.F_Subtype (Subtype_Decl_Node);
begin
Log ("bareSubtype: " & bareSubtype.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Classwide_Type_Decl =>
declare
Classwide_Type_Decl_Node : constant LAL.Classwide_Type_Decl := LAL.As_Classwide_Type_Decl (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Incomplete_Type_Decl =>
declare
Incomplete_Type_Decl_Node : constant LAL.Incomplete_Type_Decl := LAL.As_Incomplete_Type_Decl (Node);
Discriminants : constant LAL.Discriminant_Part := LAL.F_Discriminants (Incomplete_Type_Decl_Node);
begin
if not Discriminants.Is_Null then
Log ("Discriminants: " & Discriminants.Debug_Text);
end if;
end;
This.Add_Not_Implemented;
when Ada_Incomplete_Tagged_Type_Decl =>
declare
Incomplete_Tagged_Type_Decl_Node : constant LAL.Incomplete_Tagged_Type_Decl := LAL.As_Incomplete_Tagged_Type_Decl (Node);
Has_Abstract : constant Boolean := LAL.F_Has_Abstract (Incomplete_Tagged_Type_Decl_Node);
begin
Log ("Has_Abstract: " & Boolean'Image (Has_Abstract));
end;
This.Add_Not_Implemented;
when Ada_Protected_Type_Decl =>
declare
Protected_Type_Decl_Node : constant LAL.Protected_Type_Decl := LAL.As_Protected_Type_Decl (Node);
Discriminants : constant LAL.Discriminant_Part := LAL.F_Discriminants (Protected_Type_Decl_Node);
Definition : constant LAL.Protected_Def := LAL.F_Definition (Protected_Type_Decl_Node);
begin
if not Discriminants.Is_Null then
Log ("Discriminants: " & Discriminants.Debug_Text);
end if;
if not Definition.Is_Null then
Log ("Definition: " & Definition.Debug_Text);
end if;
end;
This.Add_Not_Implemented;
when Ada_Task_Type_Decl =>
declare
Task_Type_Decl_Node : constant LAL.Task_Type_Decl := LAL.As_Task_Type_Decl (Node);
Discriminants : constant LAL.Discriminant_Part := LAL.F_Discriminants (Task_Type_Decl_Node);
Definition : constant LAL.Task_Def := LAL.F_Definition (Task_Type_Decl_Node);
begin
if not Discriminants.Is_Null then
Log ("Discriminants: " & Discriminants.Debug_Text);
end if;
if not Definition.Is_Null then
Log ("Definition: " & Definition.Debug_Text);
end if;
end;
This.Add_Not_Implemented;
when Ada_Single_Task_Type_Decl =>
declare
Single_Task_Type_Decl_Node : constant LAL.Single_Task_Type_Decl := LAL.As_Single_Task_Type_Decl (Node);
begin
NULL;
end;
when Ada_Type_Decl =>
declare
Type_Decl_Node : constant LAL.Type_Decl := LAL.As_Type_Decl (Node);
Discriminants : constant LAL.Discriminant_Part := LAL.F_Discriminants (Type_Decl_Node);
typeDef : constant LAL.Type_Def := LAL.F_Type_Def (Type_Decl_Node);
begin
if not Discriminants.Is_Null then
Log ("Discriminants: " & Discriminants.Debug_Text);
end if;
Log ("typeDef: " & typeDef.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Anonymous_Type_Decl =>
declare
Anonymous_Type_Decl_Node : constant LAL.Anonymous_Type_Decl := LAL.As_Anonymous_Type_Decl (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Synth_Anonymous_Type_Decl =>
declare
Synth_Anonymous_Type_Decl_Node : constant LAL.Synth_Anonymous_Type_Decl := LAL.As_Synth_Anonymous_Type_Decl (Node);
begin
NULL;
end;
when Ada_Abstract_Subp_Decl =>
declare
Abstract_Subp_Decl_Node : constant LAL.Abstract_Subp_Decl := LAL.As_Abstract_Subp_Decl (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
--when Ada_Formal_Subp_Decl =>
-- This.Add_Not_Implemented;
when Ada_Abstract_Formal_Subp_Decl =>
declare
Abstract_Formal_Subp_Decl_Node : constant LAL.Abstract_Formal_Subp_Decl := LAL.As_Abstract_Formal_Subp_Decl (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Concrete_Formal_Subp_Decl =>
declare
Concrete_Formal_Subp_Decl_Node : constant LAL.Concrete_Formal_Subp_Decl := LAL.As_Concrete_Formal_Subp_Decl (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Subp_Decl =>
declare
Subp_Decl_Node : constant LAL.Subp_Decl := LAL.As_Subp_Decl (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Entry_Decl =>
declare
Entry_Decl_Node : constant LAL.Entry_Decl := LAL.As_Entry_Decl (Node);
overridding : constant LAL.Overriding_Node := LAL.F_Overriding (Entry_Decl_Node);
spec : constant LAL.Entry_Spec := LAL.F_Spec (Entry_Decl_Node);
begin
Log ("overridding: " & overridding.Debug_Text);
Log ("spec: " & spec.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Enum_Literal_Decl =>
declare
Enum_Literal_Decl_Node : constant LAL.Enum_Literal_Decl := LAL.As_Enum_Literal_Decl (Node);
name : constant LAL.Defining_Name := LAL.F_Name (Enum_Literal_Decl_Node);
enumType : constant LAL.Type_Decl := LAL.P_Enum_Type (Enum_Literal_Decl_Node);
begin
Log ("name: " & name.Debug_Text);
Log ("enumType: " & enumType.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Generic_Subp_Internal =>
declare
Generic_Subp_Internal_Node : constant LAL.Generic_Subp_Internal := LAL.As_Generic_Subp_Internal (Node);
subpSpec : constant LAL.Subp_Spec := LAL.F_Subp_Spec (Generic_Subp_Internal_Node);
begin
Log ("subpSpec: " & subpSpec.Debug_Text);
end;
This.Add_Not_Implemented;
--when Ada_Body_Node =>
-- This.Add_Not_Implemented;
--when Ada_Base_Subp_Body =>
-- This.Add_Not_Implemented;
when Ada_Expr_Function =>
declare
Expr_Function_Node : constant LAL.Expr_Function := LAL.As_Expr_Function (Node);
expr : constant LAL.Expr := LAL.F_Expr (Expr_Function_Node);
begin
Log ("expr: " & expr.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Null_Subp_Decl =>
declare
Null_Subp_Decl_Node : constant LAL.Null_Subp_Decl := LAL.As_Null_Subp_Decl (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Subp_Body =>
declare
Subp_Body_Node : constant LAL.Subp_Body := LAL.As_Subp_Body (Node);
decl : constant LAL.Declarative_Part := LAL.F_Decls (Subp_Body_Node);
stmt : constant LAL.Handled_Stmts := LAL.F_Stmts (Subp_Body_Node);
endname : constant LAL.End_Name := LAL.F_End_Name (Subp_Body_Node);
begin
Log ("decl: " & decl.Debug_Text);
Log ("stmt: " & stmt.Debug_Text);
if not endname.Is_Null then
Log ("endname: " & endname.Debug_Text);
end if;
end;
This.Add_Not_Implemented;
when Ada_Subp_Renaming_Decl =>
declare
Subp_Renaming_Decl_Node : constant LAL.Subp_Renaming_Decl := LAL.As_Subp_Renaming_Decl (Node);
rename : constant LAL.Renaming_Clause := LAL.F_Renames (Subp_Renaming_Decl_Node);
begin
Log ("rename: " & rename.Debug_Text);
end;
This.Add_Not_Implemented;
--when Ada_Body_Stub =>
-- This.Add_Not_Implemented;
when Ada_Package_Body_Stub =>
declare
Package_Body_Stub_Node : constant LAL.Package_Body_Stub := LAL.As_Package_Body_Stub (Node);
name : constant LAL.Defining_Name := LAL.F_Name (Package_Body_Stub_Node);
begin
Log ("name: " & name.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Protected_Body_Stub =>
declare
Protected_Body_Stub_Node : constant LAL.Protected_Body_Stub := LAL.As_Protected_Body_Stub (Node);
name : constant LAL.Defining_Name := LAL.F_Name (Protected_Body_Stub_Node);
begin
Log ("name: " & name.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Subp_Body_Stub =>
declare
Subp_Body_Stub_Node : constant LAL.Subp_Body_Stub := LAL.As_Subp_Body_Stub (Node);
overridding : constant LAL.Overriding_Node := LAL.F_Overriding (Subp_Body_Stub_Node);
subSpec : constant LAL.Subp_Spec := LAL.F_Subp_Spec (Subp_Body_Stub_Node);
begin
Log ("overridding: " & overridding.Debug_Text);
Log ("subSpec: " & subSpec.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Task_Body_Stub =>
declare
Task_Body_Stub_Node : constant LAL.Task_Body_Stub := LAL.As_Task_Body_Stub (Node);
name : constant LAL.Defining_Name := LAL.F_Name (Task_Body_Stub_Node);
begin
Log ("name: " & name.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Entry_Body =>
declare
Entry_Body_Node : constant LAL.Entry_Body := LAL.As_Entry_Body (Node);
params : constant LAL.Entry_Completion_Formal_Params := LAL.F_Params (Entry_Body_Node);
barrier : constant LAL.Expr := LAL.F_Barrier (Entry_Body_Node);
decls : constant LAL.Declarative_Part := LAL.F_Decls (Entry_Body_Node);
stmts : constant LAL.Handled_Stmts := LAL.F_Stmts (Entry_Body_Node);
endname : constant LAL.End_Name := LAL.F_End_Name (Entry_Body_Node);
begin
Log ("params: " & params.Debug_Text);
Log ("barrier: " & barrier.Debug_Text);
Log ("decls: " & decls.Debug_Text);
Log ("stmts: " & stmts.Debug_Text);
if not endname.Is_Null then
Log ("endname: " & endname.Debug_Text);
end if;
end;
This.Add_Not_Implemented;
when Ada_Package_Body =>
declare
Package_Body_Node : constant LAL.Package_Body := LAL.As_Package_Body (Node);
name : constant LAL.Defining_Name := LAL.F_Package_Name (Package_Body_Node);
decls : constant LAL.Declarative_Part := LAL.F_Decls (Package_Body_Node);
stmts : constant LAL.Handled_Stmts := LAL.F_Stmts (Package_Body_Node);
endname : constant LAL.End_Name := LAL.F_End_Name (Package_Body_Node);
begin
Log ("name: " & name.Debug_Text);
Log ("decls: " & decls.Debug_Text);
if not stmts.Is_Null then
Log ("stmts: " & stmts.Debug_Text);
end if;
if not endname.Is_Null then
Log ("endname: " & endname.Debug_Text);
end if;
end;
This.Add_Not_Implemented;
when Ada_Protected_Body =>
declare
Protected_Body_Node : constant LAL.Protected_Body := LAL.As_Protected_Body (Node);
name : constant LAL.Defining_Name := LAL.F_Name (Protected_Body_Node);
decls : constant LAL.Declarative_Part := LAL.F_Decls (Protected_Body_Node);
endname : constant LAL.End_Name := LAL.F_End_Name (Protected_Body_Node);
begin
Log ("name: " & name.Debug_Text);
Log ("decls: " & decls.Debug_Text);
Log ("endname: " & endname.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Task_Body =>
declare
Task_Body_Node : constant LAL.Task_Body := LAL.As_Task_Body (Node);
name : constant LAL.Defining_Name := LAL.F_Name (Task_Body_Node);
decls : constant LAL.Declarative_Part := LAL.F_Decls (Task_Body_Node);
stmts : constant LAL.Declarative_Part := LAL.F_Decls (Task_Body_Node);
endname : constant LAL.End_Name := LAL.F_End_Name (Task_Body_Node);
begin
Log ("name: " & name.Debug_Text);
Log ("decls: " & decls.Debug_Text);
Log ("stmts: " & stmts.Debug_Text);
Log ("endname: " & endname.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Entry_Index_Spec =>
declare
Entry_Index_Spec_Node : constant LAL.Entry_Index_Spec := LAL.As_Entry_Index_Spec (Node);
id : constant LAL.Defining_Name := LAL.F_Id (Entry_Index_Spec_Node);
sub_type : constant LAL.Ada_Node := LAL.F_Subtype (Entry_Index_Spec_Node);
begin
Log ("id: " & id.Debug_Text);
Log ("sub_type: " & sub_type.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Error_Decl =>
declare
Error_Decl_Node : constant LAL.Error_Decl := LAL.As_Error_Decl (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Exception_Decl =>
declare
Exception_Decl_Node : constant LAL.Exception_Decl := LAL.As_Exception_Decl (Node);
ids : constant LAL.Defining_Name_List := LAL.F_Ids (Exception_Decl_Node);
rename : constant LAL.Renaming_Clause := LAL.F_Renames (Exception_Decl_Node);
begin
Log ("ids: " & ids.Debug_Text);
if not rename.Is_Null then
Log ("rename: " & rename.Debug_Text);
end if;
end;
This.Add_Not_Implemented;
when Ada_Exception_Handler =>
declare
Exception_Handler_Node : constant LAL.Exception_Handler := LAL.As_Exception_Handler (Node);
exceptionName : constant LAL.Defining_Name := LAL.F_Exception_Name (Exception_Handler_Node);
handledExceptions : constant LAL.Alternatives_List := LAL.F_Handled_Exceptions (Exception_Handler_Node);
stmts : constant LAL.Stmt_List := LAL.F_Stmts (Exception_Handler_Node);
begin
if not exceptionName.Is_Null then
Log ("exceptionName: " & exceptionName.Debug_Text);
end if;
Log ("handledExceptions: " & handledExceptions.Debug_Text);
Log ("stmts: " & stmts.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_For_Loop_Var_Decl =>
declare
For_Loop_Var_Decl_Node : constant LAL.For_Loop_Var_Decl := LAL.As_For_Loop_Var_Decl (Node);
id : constant LAL.Defining_Name := LAL.F_Id (For_Loop_Var_Decl_Node);
idType : constant LAL.Subtype_Indication := LAL.F_Id_Type (For_Loop_Var_Decl_Node);
begin
Log ("id: " & id.Debug_Text);
if not idType.Is_Null then
Log ("idType: " & idType.Debug_Text);
end if;
end;
This.Add_Not_Implemented;
--when Ada_Generic_Decl =>
-- This.Add_Not_Implemented;
when Ada_Generic_Package_Decl =>
declare
Generic_Package_Decl_Node : constant LAL.Generic_Package_Decl := LAL.As_Generic_Package_Decl (Node);
packageDecl : constant LAL.Generic_Package_Internal := LAL.F_Package_Decl (Generic_Package_Decl_Node);
bodyPart : constant LAL.Package_Body := LAL.P_Body_Part (Generic_Package_Decl_Node);
begin
Log ("packageDecl: " & packageDecl.Debug_Text);
if not bodyPart.Is_Null then
Log ("bodyPart: " & bodyPart.Debug_Text);
end if;
end;
This.Add_Not_Implemented;
when Ada_Generic_Subp_Decl =>
declare
Generic_Subp_Decl_Node : constant LAL.Generic_Subp_Decl := LAL.As_Generic_Subp_Decl (Node);
subpDecl : constant LAL.Generic_Subp_Internal := LAL.F_Subp_Decl (Generic_Subp_Decl_Node);
-- bodyPart : constant LAL.Base_Subp_Body := LAL.P_Body_Part (Generic_Subp_Decl_Node);
begin
Log ("subpDecl: " & subpDecl.Debug_Text);
-- Log ("bodyPart: " & bodyPart.Debug_Text);
end;
This.Add_Not_Implemented;
--when Ada_Generic_Instantiation =>
-- This.Add_Not_Implemented;
when Ada_Generic_Package_Instantiation =>
declare
Generic_Package_Instantiation_Node : constant LAL.Generic_Package_Instantiation := LAL.As_Generic_Package_Instantiation (Node);
name : constant LAL.Defining_Name := LAL.F_Name (Generic_Package_Instantiation_Node);
gericPackageName : constant LAL.Name := LAL.F_Generic_Pkg_Name (Generic_Package_Instantiation_Node);
params : constant LAL.Assoc_List := LAL.F_Params (Generic_Package_Instantiation_Node);
begin
Log ("name: " & name.Debug_Text);
Log ("gericPackageName: " & gericPackageName.Debug_Text);
Log ("params: " & params.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Generic_Subp_Instantiation =>
declare
Generic_Subp_Instantiation_Node : constant LAL.Generic_Subp_Instantiation := LAL.As_Generic_Subp_Instantiation (Node);
--kind : constant Ada_Subp_Kind := LAL.F_Kind (Generic_Subp_Instantiation_Node);
subpName : constant LAL.Defining_Name := LAL.F_Subp_Name (Generic_Subp_Instantiation_Node);
genericSubpName : constant LAL.Name := LAL.F_Generic_Subp_Name (Generic_Subp_Instantiation_Node);
params : constant LAL.Assoc_List := LAL.F_Params (Generic_Subp_Instantiation_Node);
designatedSubp : constant LAL.Ada_Node := LAL.P_Designated_Subp (Generic_Subp_Instantiation_Node);
begin
--Log ("kind: " & kind.Debug_Text);
Log ("subpName: " & subpName.Debug_Text);
Log ("genericSubpName: " & genericSubpName.Debug_Text);
Log ("params: " & params.Debug_Text);
Log ("designatedSubp: " & designatedSubp.Debug_Text);
end;
This.Add_Not_Implemented;
--when Ada_Generic_Renaming_Decl =>
-- This.Add_Not_Implemented;
when Ada_Generic_Package_Renaming_Decl =>
declare
Generic_Package_Renaming_Decl_Node : constant LAL.Generic_Package_Renaming_Decl := LAL.As_Generic_Package_Renaming_Decl (Node);
name : constant LAL.Defining_Name := LAL.F_Name (Generic_Package_Renaming_Decl_Node);
rename : constant LAL.Name := LAL.F_Renames (Generic_Package_Renaming_Decl_Node);
begin
Log ("name: " & name.Debug_Text);
Log ("rename: " & rename.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Generic_Subp_Renaming_Decl =>
declare
Generic_Subp_Renaming_Decl_Node : constant LAL.Generic_Subp_Renaming_Decl := LAL.As_Generic_Subp_Renaming_Decl (Node);
kind : constant LAL.Subp_Kind := LAL.F_Kind (Generic_Subp_Renaming_Decl_Node);
name : constant LAL.Defining_Name := LAL.F_Name (Generic_Subp_Renaming_Decl_Node);
rename : constant LAL.Name := LAL.F_Renames (Generic_Subp_Renaming_Decl_Node);
begin
--Log ("kind: " & kind.Debug_Text);
Log ("kind: " & kind.Debug_Text);
Log ("name: " & name.Debug_Text);
Log ("rename: " & rename.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Label_Decl =>
declare
Label_Decl_Node : constant LAL.Label_Decl := LAL.As_Label_Decl (Node);
name : constant LAL.Defining_Name := LAL.F_Name (Label_Decl_Node);
begin
--Log ("kind: " & kind.Debug_Text);
Log ("name: " & name.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Named_Stmt_Decl =>
declare
Named_Stmt_Decl_Node : constant LAL.Named_Stmt_Decl := LAL.As_Named_Stmt_Decl (Node);
name : constant LAL.Defining_Name := LAL.F_Name (Named_Stmt_Decl_Node);
begin
--Log ("kind: " & kind.Debug_Text);
Log ("name: " & name.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Number_Decl =>
declare
Number_Decl_Node : constant LAL.Number_Decl := LAL.As_Number_Decl (Node);
ids : constant LAL.Defining_Name_List := LAL.F_Ids (Number_Decl_Node);
expr : constant LAL.Expr := LAL.F_Expr (Number_Decl_Node);
begin
--Log ("kind: " & kind.Debug_Text);
Log ("ids: " & ids.Debug_Text);
Log ("expr: " & expr.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Object_Decl =>
declare
Object_Decl_Node : constant LAL.Object_Decl := LAL.As_Object_Decl (Node);
FIds : constant LAL.Defining_Name_List := LAL.F_Ids (Object_Decl_Node);
Has_Aliased : constant Boolean := LAL.F_Has_Aliased (Object_Decl_Node);
Has_Constant : constant Boolean := LAL.F_Has_Constant (Object_Decl_Node);
mode : constant LAL.Mode := LAL.F_Mode (Object_Decl_Node);
typeExpr : constant LAL.Type_Expr := LAL.F_Type_Expr (Object_Decl_Node);
defaultExpr : constant LAL.Expr := LAL.F_Default_Expr (Object_Decl_Node);
renamingClause : constant LAL.Renaming_Clause := LAL.F_Renaming_Clause (Object_Decl_Node);
publicPartDecl : constant LAL.Basic_Decl := LAL.P_Public_Part_Decl (Object_Decl_Node);
begin
Log ("FIds: " & FIds.Debug_Text);
Log ("Has_Aliased: " & Boolean'Image (Has_Constant));
Log ("F_Has_Constant: " & Boolean'Image (Has_Constant));
Log ("mode: " & mode.Debug_Text);
if not typeExpr.Is_Null then
Log ("typeExpr: " & typeExpr.Debug_Text);
end if;
if not defaultExpr.Is_Null then
Log ("defaultExpr: " & defaultExpr.Debug_Text);
end if;
if not renamingClause.Is_Null then
Log ("renamingClause: " & renamingClause.Debug_Text);
end if;
if not publicPartDecl.Is_Null then
Log ("publicPartDecl: " & publicPartDecl.Debug_Text);
end if;
end;
This.Add_Not_Implemented;
when Ada_Anonymous_Object_Decl =>
declare
Anonymous_Object_Decl_Node : constant LAL.Anonymous_Object_Decl := LAL.As_Anonymous_Object_Decl (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Extended_Return_Stmt_Object_Decl =>
declare
Extended_Return_Stmt_Object_Decl_Node : constant LAL.Extended_Return_Stmt_Object_Decl := LAL.As_Extended_Return_Stmt_Object_Decl (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Package_Renaming_Decl =>
declare
Package_Renaming_Decl_Node : constant LAL.Package_Renaming_Decl := LAL.As_Package_Renaming_Decl (Node);
name : constant LAL.Defining_Name := LAL.F_Name (Package_Renaming_Decl_Node);
rename : constant LAL.Renaming_Clause := LAL.F_Renames (Package_Renaming_Decl_Node);
renamedPackage : constant LAL.Basic_Decl := LAL.P_Renamed_Package (Package_Renaming_Decl_Node);
finalRenamedPackage : constant LAL.Basic_Decl := LAL.P_Final_Renamed_Package (Package_Renaming_Decl_Node);
begin
Log ("name: " & name.Debug_Text);
Log ("rename: " & rename.Debug_Text);
Log ("renamedPackage: " & renamedPackage.Debug_Text);
Log ("finalRenamedPackage: " & finalRenamedPackage.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Single_Protected_Decl =>
declare
Single_Protected_Decl_Node : constant LAL.Single_Protected_Decl := LAL.As_Single_Protected_Decl (Node);
name : constant LAL.Defining_Name := LAL.F_Name (Single_Protected_Decl_Node);
interfaces : constant LAL.Parent_List := LAL.F_Interfaces (Single_Protected_Decl_Node);
definition : constant LAL.Protected_Def := LAL.F_Definition (Single_Protected_Decl_Node);
begin
Log ("name: " & name.Debug_Text);
Log ("interfaces: " & interfaces.Debug_Text);
Log ("definition: " & definition.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Single_Task_Decl =>
declare
Single_Task_Decl_Node : constant LAL.Single_Task_Decl := LAL.As_Single_Task_Decl (Node);
taskType : constant LAL.Single_Task_Type_Decl := LAL.F_Task_Type (Single_Task_Decl_Node);
begin
Log ("taskType: " & taskType.Debug_Text);
end;
This.Add_Not_Implemented;
end case;
end Process_Ada_Basic_Decl;
procedure Process_Ada_Case_Stmt_Alternative_Range
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Case_Stmt_Alternative_Range";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Case_Stmt_Alternative_Range := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Case_Stmt_Alternative_Range
case Kind is
when Ada_Case_Stmt_Alternative =>
declare
Case_Stmt_Alternative_Node : constant LAL.Case_Stmt_Alternative := LAL.As_Case_Stmt_Alternative (Node);
choices : constant LAL.Alternatives_List := LAL.F_Choices (Case_Stmt_Alternative_Node);
stmts : constant LAL.Stmt_List := LAL.F_Stmts (Case_Stmt_Alternative_Node);
begin
Log ("choices: " & choices.Debug_Text);
Log ("stmts: " & stmts.Debug_Text);
end;
end case;
end Process_Ada_Case_Stmt_Alternative_Range;
procedure Process_Ada_Compilation_Unit_Range
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Compilation_Unit_Range";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Compilation_Unit_Range := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Compilation_Unit_Range
case Kind is
when Ada_Compilation_Unit =>
declare
Compilation_Unit_Node : constant LAL.Compilation_Unit := LAL.As_Compilation_Unit (Node);
prelude : constant LAL.Ada_Node_List := LAL.F_Prelude (Compilation_Unit_Node);
bodyunit : constant LAL.Ada_Node := LAL.F_Body (Compilation_Unit_Node);
pragmas : constant LAL.Pragma_Node_List := LAL.F_Pragmas (Compilation_Unit_Node);
syntaticQualifiedName : constant LAL.Unbounded_Text_Type_Array := LAL.P_Syntactic_Fully_Qualified_Name (Compilation_Unit_Node);
unitKind : constant LALCO.Analysis_Unit_Kind := LAL.P_Unit_Kind (Compilation_Unit_Node);
begin
Log ("prelude: " & prelude.Debug_Text);
Log ("bodyunit: " & bodyunit.Debug_Text);
Log ("pragmas: " & pragmas.Debug_Text);
-- Log ("syntaticQualifiedName: " & syntaticQualifiedName.Debug_Text);
-- Log ("unitKind: " & unitKind.Debug_Text);
end;
end case;
end Process_Ada_Compilation_Unit_Range;
procedure Process_Ada_Component_Clause_Range
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Component_Clause_Range";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Component_Clause_Range := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Component_Clause_Range
case Kind is
when Ada_Component_Clause =>
declare
Component_Clause_Node : constant LAL.Component_Clause := LAL.As_Component_Clause (Node);
id : constant LAL.Identifier := LAL.F_Id (Component_Clause_Node);
position : constant LAL.Expr := LAL.F_Position (Component_Clause_Node);
ranges : constant LAL.Range_Spec := LAL.F_Range (Component_Clause_Node);
begin
Log ("id: " & id.Debug_Text);
Log ("position: " & position.Debug_Text);
Log ("ranges: " & ranges.Debug_Text);
end;
end case;
end Process_Ada_Component_Clause_Range;
procedure Process_Ada_Component_Def_Range
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Component_Def_Range";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Component_Def_Range := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Component_Def_Range
case Kind is
when Ada_Component_Def =>
declare
Component_Def_Node : constant LAL.Component_Def := LAL.As_Component_Def (Node);
Has_Aliased : constant Boolean := LAL.F_Has_Aliased (Component_Def_Node);
Has_Constant : constant Boolean := LAL.F_Has_Constant (Component_Def_Node);
begin
Log ("Has_Aliased: " & Boolean'Image (Has_Aliased));
Log ("Has_Constant: " & Boolean'Image (Has_Constant));
end;
end case;
end Process_Ada_Component_Def_Range;
procedure Process_Ada_Constraint
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Constraint";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Constraint := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Constraint
case Kind is
when Ada_Delta_Constraint =>
declare
Delta_Constraint_Node : constant LAL.Delta_Constraint := LAL.As_Delta_Constraint (Node);
Digit : constant LAL.Expr := LAL.F_Digits (Delta_Constraint_Node);
ranges : constant LAL.Range_Spec := LAL.F_Range (Delta_Constraint_Node);
begin
Log ("Digit: " & Digit.Debug_Text);
Log ("ranges: " & ranges.Debug_Text);
end;
when Ada_Digits_Constraint =>
declare
Digits_Constraint_Node : constant LAL.Digits_Constraint := LAL.As_Digits_Constraint (Node);
Digit : constant LAL.Expr := LAL.F_Digits (Digits_Constraint_Node);
ranges : constant LAL.Range_Spec := LAL.F_Range (Digits_Constraint_Node);
begin
Log ("Digit: " & Digit.Debug_Text);
Log ("ranges: " & ranges.Debug_Text);
end;
when Ada_Discriminant_Constraint =>
declare
Discriminant_Constraint_Node : constant LAL.Discriminant_Constraint := LAL.As_Discriminant_Constraint (Node);
constraints : constant LAL.Assoc_List := LAL.F_Constraints (Discriminant_Constraint_Node);
begin
Log ("constraints: " & constraints.Debug_Text);
end;
when Ada_Index_Constraint =>
declare
Index_Constraint_Node : constant LAL.Index_Constraint := LAL.As_Index_Constraint (Node);
constraints : constant LAL.Constraint_List := LAL.F_Constraints (Index_Constraint_Node);
begin
Log ("constraints: " & constraints.Debug_Text);
end;
when Ada_Range_Constraint =>
declare
Range_Constraint_Node : constant LAL.Range_Constraint := LAL.As_Range_Constraint (Node);
ranges : constant LAL.Range_Spec := LAL.F_Range (Range_Constraint_Node);
begin
Log ("Range: " & ranges.Debug_Text);
end;
end case;
end Process_Ada_Constraint;
procedure Process_Ada_Constant_Node
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Constant_Node";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constant_Node_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Constant_Node := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Constant_Node
case Kind is
when Ada_Constant_Absent =>
declare
Constant_Absent_Node : constant LAL.Constant_Absent := LAL.As_Constant_Absent (Node);
begin
NULL;
end;
when Ada_Constant_Present =>
declare
Constant_Present_Node : constant LAL.Constant_Present := LAL.As_Constant_Present (Node);
begin
NULL;
end;
end case;
end Process_Ada_Constant_Node;
procedure Process_Ada_Declarative_Part_Range
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Declarative_Part_Range";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Declarative_Part_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Declarative_Part_Range := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Declarative_Part_Range
case Kind is
when Ada_Declarative_Part =>
declare
Declarative_Part_Node : constant LAL.Declarative_Part := LAL.As_Declarative_Part (Node);
decls : constant LAL.Ada_Node_List := LAL.F_Decls (Declarative_Part_Node);
begin
Log ("decls: " & decls.Debug_Text);
end;
when Ada_Private_Part =>
declare
Private_Part_Node : constant LAL.Private_Part := LAL.As_Private_Part (Node);
begin
NULL;
end;
when Ada_Public_Part =>
declare
Public_Part_Node : constant LAL.Public_Part := LAL.As_Public_Part (Node);
begin
NULL;
end;
end case;
end Process_Ada_Declarative_Part_Range;
procedure Process_Ada_Elsif_Expr_Part_Range
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Elsif_Expr_Part_Range";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Declarative_Part_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Elsif_Expr_Part_Range := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Elsif_Expr_Part_Range
case Kind is
when Ada_Elsif_Expr_Part =>
declare
Elsif_Expr_Part_Node : constant LAL.Elsif_Expr_Part := LAL.As_Elsif_Expr_Part (Node);
Cond_Expr : constant LAL.Expr := LAL.F_Cond_Expr (Elsif_Expr_Part_Node);
Then_Expr : constant LAL.Expr := LAL.F_Then_Expr (Elsif_Expr_Part_Node);
begin
Log ("Cond_Expr: " & Cond_Expr.Debug_Text);
Log ("Then_Expr: " & Then_Expr.Debug_Text);
end;
end case;
end Process_Ada_Elsif_Expr_Part_Range;
procedure Process_Ada_Elsif_Stmt_Part_Range
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Elsif_Stmt_Part_Range";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Declarative_Part_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Elsif_Stmt_Part_Range := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Elsif_Stmt_Part_Range
case Kind is
when Ada_Elsif_Stmt_Part =>
declare
Elsif_Stmt_Part_Node : constant LAL.Elsif_Stmt_Part := LAL.As_Elsif_Stmt_Part (Node);
Cond_Expr : constant LAL.Expr := LAL.F_Cond_Expr (Elsif_Stmt_Part_Node);
Stmts : constant LAL.Stmt_List := LAL.F_Stmts (Elsif_Stmt_Part_Node);
begin
Log ("Cond_Expr: " & Cond_Expr.Debug_Text);
Log ("Stmts: " & Stmts.Debug_Text);
end;
end case;
end Process_Ada_Elsif_Stmt_Part_Range;
procedure Process_Ada_Expr
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Ada_Expr";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Expr := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Expr
case Kind is
when Ada_Allocator =>
declare
Allocator_Node : constant LAL.Allocator := LAL.As_Allocator (Node);
Subpool : constant LAL.Name := LAL.F_Subpool (Allocator_Node);
Type_Or_Expr : constant LAL.Ada_Node := LAL.F_Type_Or_Expr (Allocator_Node);
Get_Allocated_Type : constant LAL.Base_Type_Decl := LAL.P_Get_Allocated_Type (Allocator_Node);
begin
if not Subpool.Is_Null then
Log ("Subpool: " & Subpool.Debug_Text);
end if;
if not Type_Or_Expr.Is_Null then
Log ("Type_Or_Expr: " & Type_Or_Expr.Debug_Text);
end if;
if not Get_Allocated_Type.Is_Null then
Log ("Get_Allocated_Type: " & Get_Allocated_Type.Debug_Text);
end if;
end;
when Ada_Aggregate =>
declare
Aggregate_Node : constant LAL.Aggregate := LAL.As_Aggregate (Node);
begin
NULL;
end;
when Ada_Null_Record_Aggregate =>
declare
Null_Record_Aggregate_Node : constant LAL.Null_Record_Aggregate := LAL.As_Null_Record_Aggregate (Node);
begin
NULL;
end;
when Ada_Bin_Op =>
declare
Bin_Op_Node : constant LAL.Bin_Op := LAL.As_Bin_Op (Node);
Left : constant LAL.Expr := LAL.F_Left (Bin_Op_Node);
Op : constant LAL.Op := LAL.F_Op (Bin_Op_Node);
Right : constant LAL.Expr := LAL.F_Right (Bin_Op_Node);
begin
Log ("Left: " & Left.Debug_Text);
Log ("Op: " & Op.Debug_Text);
Log ("Right: " & Right.Debug_Text);
end;
when Ada_Relation_Op =>
declare
Relation_Op_Node : constant LAL.Relation_Op := LAL.As_Relation_Op (Node);
begin
NULL;
end;
when Ada_Box_Expr =>
declare
Box_Expr_Node : constant LAL.Box_Expr := LAL.As_Box_Expr (Node);
begin
NULL;
end;
when Ada_Case_Expr =>
declare
Case_Expr_Node : constant LAL.Case_Expr := LAL.As_Case_Expr (Node);
Expr : constant LAL.Expr := LAL.F_Expr (Case_Expr_Node);
Cases : constant LAL.Case_Expr_Alternative_List := LAL.F_Cases (Case_Expr_Node);
begin
Log ("Expr: " & Expr.Debug_Text);
Log ("Cases: " & Cases.Debug_Text);
end;
when Ada_Case_Expr_Alternative =>
declare
Case_Expr_Alternative_Node : constant LAL.Case_Expr_Alternative := LAL.As_Case_Expr_Alternative (Node);
choices : constant LAL.Alternatives_List := LAL.F_Choices (Case_Expr_Alternative_Node);
expr : constant LAL.Expr := LAL.F_Expr (Case_Expr_Alternative_Node);
begin
Log ("choices: " & choices.Debug_Text);
Log ("expr: " & expr.Debug_Text);
end;
when Ada_Contract_Cases =>
declare
Contract_Cases_Node : constant LAL.Contract_Cases := LAL.As_Contract_Cases (Node);
contract_cases : constant LAL.Contract_Case_Assoc_List := LAL.F_Contract_Cases (Contract_Cases_Node);
begin
Log ("contract_cases: " & contract_cases.Debug_Text);
end;
when Ada_If_Expr =>
declare
If_Expr_Node : constant LAL.If_Expr := LAL.As_If_Expr (Node);
Cond_Expr : constant LAL.Expr := LAL.F_Cond_Expr (If_Expr_Node);
Then_Expr : constant LAL.Expr := LAL.F_Then_Expr (If_Expr_Node);
Alternatives : constant LAL.Elsif_Expr_Part_List := LAL.F_Alternatives (If_Expr_Node);
Else_Expr : constant LAL.Expr := LAL.F_Else_Expr (If_Expr_Node);
begin
Log ("Cond_Expr: " & Cond_Expr.Debug_Text);
Log ("Then_Expr: " & Then_Expr.Debug_Text);
Log ("Alternatives: " & Alternatives.Debug_Text);
if not Else_Expr.Is_Null then
Log ("Else_Expr: " & Else_Expr.Debug_Text);
end if;
end;
when Ada_Membership_Expr =>
declare
Membership_Expr_Node : constant LAL.Membership_Expr := LAL.As_Membership_Expr (Node);
Expr : constant LAL.Expr := LAL.F_Expr (Membership_Expr_Node);
Op : constant LAL.Op := LAL.F_Op (Membership_Expr_Node);
Membership_Exprs : constant LAL.Expr_Alternatives_List := LAL.F_Membership_Exprs (Membership_Expr_Node);
begin
Log ("Expr: " & Expr.Debug_Text);
Log ("Op: " & Op.Debug_Text);
Log ("Membership_Exprs: " & Membership_Exprs.Debug_Text);
end;
when Ada_Attribute_Ref =>
declare
Attribute_Ref_Node : constant LAL.Attribute_Ref := LAL.As_Attribute_Ref (Node);
Prefix : constant LAL.Name := LAL.F_Prefix (Attribute_Ref_Node);
Attribute : constant LAL.Identifier := LAL.F_Attribute (Attribute_Ref_Node);
Args : constant LAL.Ada_Node := LAL.F_Args (Attribute_Ref_Node);
begin
Log ("Prefix: " & Prefix.Debug_Text);
Log ("Attribute: " & Attribute.Debug_Text);
if not Args.Is_Null then
Log ("Args: " & Args.Debug_Text);
end if;
end;
when Ada_Update_Attribute_Ref =>
declare
Update_Attribute_Ref_Node : constant LAL.Update_Attribute_Ref := LAL.As_Update_Attribute_Ref (Node);
begin
NULL;
end;
when Ada_Call_Expr =>
declare
Call_Expr_Node : constant LAL.Call_Expr := LAL.As_Call_Expr (Node);
Name : constant LAL.Name := LAL.F_Name (Call_Expr_Node);
Suffix : constant LAL.Ada_Node := LAL.F_Suffix (Call_Expr_Node);
-- Is_Array_Slice : constant Boolean := LAL.P_Is_Array_Slice (Call_Expr_Node);
begin
Log ("Name: " & Name.Debug_Text);
Log ("Suffix: " & Suffix.Debug_Text);
-- Log ("Is_Array_Slice: " & Boolean'Image(Is_Array_Slice));
end;
when Ada_Defining_Name =>
declare
Defining_Name_Node : constant LAL.Defining_Name := LAL.As_Defining_Name (Node);
begin
NULL;
end;
when Ada_Discrete_Subtype_Name =>
declare
Discrete_Subtype_Name_Node : constant LAL.Discrete_Subtype_Name := LAL.As_Discrete_Subtype_Name (Node);
Sub_Type : constant LAL.Discrete_Subtype_Indication := LAL.F_Subtype (Discrete_Subtype_Name_Node);
begin
Log ("Sub_Type: " & Sub_Type.Debug_Text);
end;
when Ada_Dotted_Name =>
declare
Dotted_Name_Node : constant LAL.Dotted_Name := LAL.As_Dotted_Name (Node);
Prefix : constant LAL.Name := LAL.F_Prefix (Dotted_Name_Node);
Suffix : constant LAL.Base_Id := LAL.F_Suffix (Dotted_Name_Node);
begin
Log ("Prefix: " & Prefix.Debug_Text);
Log ("Suffix: " & Suffix.Debug_Text);
end;
when Ada_End_Name =>
declare
End_Name_Node : constant LAL.End_Name := LAL.As_End_Name (Node);
Name : constant LAL.Name := LAL.F_Name (End_Name_Node);
Basic_Decl : constant LAL.Basic_Decl := LAL.P_Basic_Decl (End_Name_Node);
begin
Log ("Name: " & Name.Debug_Text);
Log ("Basic_Decl: " & Basic_Decl.Debug_Text);
end;
when Ada_Explicit_Deref =>
declare
Explicit_Deref_Node : constant LAL.Explicit_Deref := LAL.As_Explicit_Deref (Node);
Prefix : constant LAL.Name := LAL.F_Prefix (Explicit_Deref_Node);
begin
Log ("Prefix: " & Prefix.Debug_Text);
end;
when Ada_Qual_Expr =>
declare
Qual_Expr_Node : constant LAL.Qual_Expr := LAL.As_Qual_Expr (Node);
Prefix : constant LAL.Name := LAL.F_Prefix (Qual_Expr_Node);
Suffix : constant LAL.Expr := LAL.F_Suffix (Qual_Expr_Node);
begin
Log ("Prefix: " & Prefix.Debug_Text);
Log ("Suffix: " & Suffix.Debug_Text);
end;
when Ada_Char_Literal =>
declare
Char_Literal_Node : constant LAL.Char_Literal := LAL.As_Char_Literal (Node);
-- Denoted_Value : constant LALCO.Character_Type := LAL.P_Denoted_Value (Char_Literal_Node);
begin
-- Log ("Denoted_Value: " & Denoted_Value.Debug_Text);
NULL;
end;
when Ada_Identifier =>
declare
Identifier_Node : constant LAL.Identifier := LAL.As_Identifier (Node);
begin
NULL;
end;
when Ada_Op_Abs =>
declare
Op_Abs_Node : constant LAL.Op_Abs := LAL.As_Op_Abs (Node);
begin
NULL;
end;
when Ada_Op_And =>
declare
Op_And_Node : constant LAL.Op_And := LAL.As_Op_And (Node);
begin
NULL;
end;
when Ada_Op_And_Then =>
declare
Op_And_Then_Node : constant LAL.Op_And_Then := LAL.As_Op_And_Then (Node);
begin
NULL;
end;
when Ada_Op_Concat =>
declare
Op_Concat_Node : constant LAL.Op_Concat := LAL.As_Op_Concat (Node);
begin
NULL;
end;
when Ada_Op_Div =>
declare
Op_Div_Node : constant LAL.Op_Div := LAL.As_Op_Div (Node);
begin
NULL;
end;
when Ada_Op_Double_Dot =>
declare
Op_Double_Dot_Node : constant LAL.Op_Double_Dot := LAL.As_Op_Double_Dot (Node);
begin
NULL;
end;
when Ada_Op_Eq =>
declare
Op_Eq_Node : constant LAL.Op_Eq := LAL.As_Op_Eq (Node);
begin
NULL;
end;
when Ada_Op_Gt =>
declare
Op_Gt_Node : constant LAL.Op_Gt := LAL.As_Op_Gt (Node);
begin
NULL;
end;
when Ada_Op_Gte =>
declare
Op_Gte_Node : constant LAL.Op_Gte := LAL.As_Op_Gte (Node);
begin
NULL;
end;
when Ada_Op_In =>
declare
Op_In_Node : constant LAL.Op_In := LAL.As_Op_In (Node);
begin
NULL;
end;
when Ada_Op_Lt =>
declare
Op_Lt_Node : constant LAL.Op_Lt := LAL.As_Op_Lt (Node);
begin
NULL;
end;
when Ada_Op_Lte =>
declare
Op_Lte_Node : constant LAL.Op_Lte := LAL.As_Op_Lte (Node);
begin
NULL;
end;
when Ada_Op_Minus =>
declare
Op_Minus_Node : constant LAL.Op_Minus := LAL.As_Op_Minus (Node);
begin
NULL;
end;
when Ada_Op_Mod =>
declare
Op_Mod_Node : constant LAL.Op_Mod := LAL.As_Op_Mod (Node);
begin
NULL;
end;
when Ada_Op_Mult =>
declare
Op_Mult_Node : constant LAL.Op_Mult := LAL.As_Op_Mult (Node);
begin
NULL;
end;
when Ada_Op_Neq =>
declare
Op_Neq_Node : constant LAL.Op_Neq := LAL.As_Op_Neq (Node);
begin
NULL;
end;
when Ada_Op_Not =>
declare
Op_Not_Node : constant LAL.Op_Not := LAL.As_Op_Not (Node);
begin
NULL;
end;
when Ada_Op_Not_In =>
declare
Op_Not_In_Node : constant LAL.Op_Not_In := LAL.As_Op_Not_In (Node);
begin
NULL;
end;
when Ada_Op_Or =>
declare
Op_Or_Node : constant LAL.Op_Or := LAL.As_Op_Or (Node);
begin
NULL;
end;
when Ada_Op_Or_Else =>
declare
Op_Or_Else_Node : constant LAL.Op_Or_Else := LAL.As_Op_Or_Else (Node);
begin
NULL;
end;
when Ada_Op_Plus =>
declare
Op_Plus_Node : constant LAL.Op_Plus := LAL.As_Op_Plus (Node);
begin
NULL;
end;
when Ada_Op_Pow =>
declare
Op_Pow_Node : constant LAL.Op_Pow := LAL.As_Op_Pow (Node);
begin
NULL;
end;
when Ada_Op_Rem =>
declare
Op_Rem_Node : constant LAL.Op_Rem := LAL.As_Op_Rem (Node);
begin
NULL;
end;
when Ada_Op_Xor =>
declare
Op_Xor_Node : constant LAL.Op_Xor := LAL.As_Op_Xor (Node);
begin
NULL;
end;
when Ada_String_Literal =>
declare
String_Literal_Node : constant LAL.String_Literal := LAL.As_String_Literal (Node);
-- Denoted_Value : constant LALCO.Stringacter_Type := LAL.P_Denoted_Value (String_Literal_Node);
begin
-- Log ("Denoted_Value: " & Denoted_Value.Debug_Text);
NULL;
end;
when Ada_Null_Literal =>
declare
Null_Literal_Node : constant LAL.Null_Literal := LAL.As_Null_Literal (Node);
begin
NULL;
end;
when Ada_Int_Literal =>
declare
Int_Literal_Node : constant LAL.Int_Literal := LAL.As_Int_Literal (Node);
-- Denoted_Value : constant LALCO.Big_Integer := LAL.P_Denoted_Value (Int_Literal_Node);
begin
-- Log ("Denoted_Value: " & Denoted_Value.Debug_Text);
NULL;
end;
when Ada_Real_Literal =>
declare
Real_Literal_Node : constant LAL.Real_Literal := LAL.As_Real_Literal (Node);
begin
NULL;
end;
when Ada_Target_Name =>
declare
Target_Name_Node : constant LAL.Target_Name := LAL.As_Target_Name (Node);
begin
NULL;
end;
when Ada_Paren_Expr =>
declare
Paren_Expr_Node : constant LAL.Paren_Expr := LAL.As_Paren_Expr (Node);
Expr : constant LAL.Expr := LAL.F_Expr (Paren_Expr_Node);
begin
Log ("Expr: " & Expr.Debug_Text);
end;
when Ada_Quantified_Expr =>
declare
Quantified_Expr_Node : constant LAL.Quantified_Expr := LAL.As_Quantified_Expr (Node);
Quantifier : constant LAL.Quantifier := LAL.F_Quantifier (Quantified_Expr_Node);
Loop_Spec : constant LAL.For_Loop_Spec := LAL.F_Loop_Spec (Quantified_Expr_Node);
Expr : constant LAL.Expr := LAL.F_Expr (Quantified_Expr_Node);
begin
Log ("Quantifier: " & Quantifier.Debug_Text);
Log ("Loop_Spec: " & Loop_Spec.Debug_Text);
Log ("Expr: " & Expr.Debug_Text);
end;
when Ada_Raise_Expr =>
declare
Raise_Expr_Node : constant LAL.Raise_Expr := LAL.As_Raise_Expr (Node);
Exception_Name : constant LAL.Name := LAL.F_Exception_Name (Raise_Expr_Node);
Error_Message : constant LAL.Expr := LAL.F_Error_Message (Raise_Expr_Node);
begin
Log ("Exception_Name: " & Exception_Name.Debug_Text);
Log ("Error_Message: " & Error_Message.Debug_Text);
end;
when Ada_Un_Op =>
declare
Un_Op_Node : constant LAL.Un_Op := LAL.As_Un_Op (Node);
Op : constant LAL.Op := LAL.F_Op (Un_Op_Node);
begin
Log ("Op: " & Op.Debug_Text);
end;
end case;
end Process_Ada_Expr;
procedure Process_Ada_Handled_Stmts_Range
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Handled_Stmts_Range";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Declarative_Part_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Handled_Stmts_Range := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Handled_Stmts_Range
case Kind is
when Ada_Handled_Stmts =>
declare
Handled_Stmts_Node : constant LAL.Handled_Stmts := LAL.As_Handled_Stmts (Node);
Stmts : constant LAL.Stmt_List := LAL.F_Stmts (Handled_Stmts_Node);
Exceptions : constant LAL.Ada_Node_List := LAL.F_Exceptions (Handled_Stmts_Node);
begin
Log ("Stmts: " & Stmts.Debug_Text);
Log ("Exceptions: " & Exceptions.Debug_Text);
end;
end case;
end Process_Ada_Handled_Stmts_Range;
procedure process_ada_interface_kind
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Handled_Stmts_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_interface_kind := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_interface_kind
case kind is
when ada_interface_kind_limited =>
declare
interface_kind_limited_Node : constant LAL.interface_kind_limited := LAL.As_interface_kind_limited (Node);
begin
NULL;
end;
when ada_interface_kind_protected =>
declare
interface_kind_protected_Node : constant LAL.interface_kind_protected := LAL.As_interface_kind_protected (Node);
begin
NULL;
end;
when ada_interface_kind_synchronized =>
declare
interface_kind_synchronized_Node : constant LAL.interface_kind_synchronized := LAL.As_interface_kind_synchronized (Node);
begin
NULL;
end;
when ada_interface_kind_task =>
declare
interface_kind_task_Node : constant LAL.interface_kind_task := LAL.As_interface_kind_task (Node);
begin
NULL;
end;
end case;
end process_ada_interface_kind;
procedure process_ada_Iter_Type
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Iter_Type";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Iter_Type := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Iter_Type
case kind is
when ada_Iter_Type_In =>
declare
Iter_Type_In_Node : constant LAL.Iter_Type_In := LAL.As_Iter_Type_In (Node);
begin
NULL;
end;
when ada_Iter_Type_Of =>
declare
Iter_Type_Of_Node : constant LAL.Iter_Type_Of := LAL.As_Iter_Type_Of (Node);
begin
NULL;
end;
end case;
end process_ada_Iter_Type;
procedure process_ada_Library_Item_Range
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Library_Item_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Library_Item_Range := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Library_Item_Range
case kind is
when ada_Library_Item =>
declare
Library_Item_Node : constant LAL.Library_Item := LAL.As_Library_Item (Node);
Has_Private : constant Boolean := LAL.F_Has_Private (Library_Item_Node);
item : constant LAL.Basic_Decl := LAL.F_Item (Library_Item_Node);
begin
Log ("Has_Private: " & Boolean'Image (Has_Private));
Log ("item: " & item.Debug_Text);
end;
this.add_not_implemented;
end case;
end process_ada_Library_Item_Range;
procedure process_ada_Limited_Node
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Library_Item_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Limited_Node := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Limited_Node
case kind is
when ada_Limited_Absent =>
declare
Limited_Absent_Node : constant LAL.Limited_Absent := LAL.As_Limited_Absent (Node);
begin
NULL;
end;
this.add_not_implemented;
when ada_Limited_Present =>
declare
Limited_Present_Node : constant LAL.Limited_Present := LAL.As_Limited_Present (Node);
begin
NULL;
end;
this.add_not_implemented;
end case;
end process_ada_Limited_Node;
procedure process_ada_Loop_Spec
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Loop_Spec";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Loop_Spec := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Loop_Spec
case kind is
when ada_For_Loop_Spec =>
declare
For_Loop_Spec_Node : constant LAL.For_Loop_Spec := LAL.As_For_Loop_Spec (Node);
Has_Reverse : constant Boolean := LAL.F_Has_Reverse (For_Loop_Spec_Node);
var_decl : constant LAL.For_Loop_Var_Decl := LAL.F_Var_Decl (For_Loop_Spec_Node);
loop_type : constant LAL.Iter_Type := LAL.F_Loop_Type (For_Loop_Spec_Node);
begin
Log ("F_Has_Reverse: " & Boolean'Image (Has_Reverse));
Log ("var_decl: " & var_decl.Debug_Text);
Log ("loop_type: " & loop_type.Debug_Text);
end;
this.add_not_implemented;
when ada_While_Loop_Spec =>
declare
While_Loop_Spec_Node : constant LAL.While_Loop_Spec := LAL.As_While_Loop_Spec (Node);
expr : constant LAL.Expr := LAL.F_Expr (While_Loop_Spec_Node);
begin
Log ("expr: " & expr.Debug_Text);
end;
this.add_not_implemented;
end case;
end process_ada_Loop_Spec;
procedure process_ada_Mode
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Mode";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Mode := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Mode
case kind is
when ada_Mode_Default =>
declare
Mode_Default_Node : constant LAL.Mode_Default := LAL.As_Mode_Default (Node);
begin
NULL;
end;
this.add_not_implemented;
when ada_Mode_In =>
declare
Mode_In_Node : constant LAL.Mode_In := LAL.As_Mode_In (Node);
begin
NULL;
end;
this.add_not_implemented;
when ada_Mode_In_Out =>
declare
Mode_In_Out_Node : constant LAL.Mode_In_Out := LAL.As_Mode_In_Out (Node);
begin
NULL;
end;
this.add_not_implemented;
when ada_Mode_Out =>
declare
Mode_Out_Node : constant LAL.Mode_Out := LAL.As_Mode_Out (Node);
begin
NULL;
end;
this.add_not_implemented;
end case;
end process_ada_Mode;
procedure process_ada_Not_Null
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Not_Null";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Not_Null := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Not_Null
case kind is
when ada_Not_Null_Absent =>
declare
Not_Null_Absent_Node : constant LAL.Not_Null_Absent := LAL.As_Not_Null_Absent (Node);
begin
NULL;
end;
this.add_not_implemented;
when ada_Not_Null_Present =>
declare
Not_Null_Present_Node : constant LAL.Not_Null_Present := LAL.As_Not_Null_Present (Node);
begin
NULL;
end;
this.add_not_implemented;
end case;
end process_ada_Not_Null;
procedure process_ada_Null_Component_Decl_Range
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Null_Component_Decl_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Null_Component_Decl_Range := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Null_Component_Decl_Range
case kind is
when ada_Null_Component_Decl =>
declare
Null_Component_Decl_Node : constant LAL.Null_Component_Decl := LAL.As_Null_Component_Decl (Node);
begin
NULL;
end;
this.add_not_implemented;
end case;
end process_ada_Null_Component_Decl_Range;
procedure process_ada_Others_Designator_Range
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Others_Designator_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Others_Designator_Range := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Others_Designator_Range
case kind is
when ada_Others_Designator =>
declare
Others_Designator_Node : constant LAL.Others_Designator := LAL.As_Others_Designator (Node);
begin
NULL;
end;
this.add_not_implemented;
end case;
end process_ada_Others_Designator_Range;
procedure process_ada_Overriding_Node
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Overriding_Node";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Overriding_Node := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Overriding_Node
case kind is
when ada_Overriding_Not_Overriding =>
declare
Overriding_Not_Overriding_Node : constant LAL.Overriding_Not_Overriding := LAL.As_Overriding_Not_Overriding (Node);
begin
NULL;
end;
this.add_not_implemented;
when ada_Overriding_Overriding =>
declare
Overriding_Overriding_Node : constant LAL.Overriding_Overriding := LAL.As_Overriding_Overriding (Node);
begin
NULL;
end;
this.add_not_implemented;
when ada_Overriding_Unspecified =>
declare
Overriding_Unspecified_Node : constant LAL.Overriding_Unspecified := LAL.As_Overriding_Unspecified (Node);
begin
NULL;
end;
this.add_not_implemented;
end case;
end process_ada_Overriding_Node;
procedure process_ada_Params_Range
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Params_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Params_Range := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Params_Range
case kind is
when ada_Params =>
declare
Params_Node : constant LAL.Params := LAL.As_Params (Node);
params : constant LAL.Param_Spec_List := LAL.F_Params (Params_Node);
begin
Log ("params: " & params.Debug_Text);
end;
this.add_not_implemented;
end case;
end process_ada_Params_Range;
procedure process_ada_Pragma_Node_Range
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Pragma_Node_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Pragma_Node_Range := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Pragma_Node_Range
case kind is
when ada_Pragma_Node =>
declare
Pragma_Node_Node : constant LAL.Pragma_Node := LAL.As_Pragma_Node (Node);
id : constant LAL.Identifier := LAL.F_Id (Pragma_Node_Node);
args : constant LAL.Base_Assoc_List := LAL.F_Args (Pragma_Node_Node);
-- associated_Decls : constant LAL.Basic_Decl_Array := LAL.P_Associated_Decls (Pragma_Node_Node);
begin
Log ("id: " & id.Debug_Text);
Log ("args: " & args.Debug_Text);
-- Log ("associated_Decls: " & associated_Decls.Debug_Text);
end;
this.add_not_implemented;
end case;
end process_ada_Pragma_Node_Range;
procedure process_ada_Prim_Type_Accessor_Range
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Prim_Type_Accessor_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Prim_Type_Accessor_Range := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Prim_Type_Accessor_Range
case kind is
when ada_Prim_Type_Accessor =>
declare
Prim_Type_Accessor_Node : constant LAL.Prim_Type_Accessor := LAL.As_Prim_Type_Accessor (Node);
begin
NULL;
end;
this.add_not_implemented;
end case;
end process_ada_Prim_Type_Accessor_Range;
procedure process_ada_Private_Node
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Private_Node";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Private_Node := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Private_Node
case kind is
when ada_Private_Absent =>
declare
Private_Absent_Node : constant LAL.Private_Absent := LAL.As_Private_Absent (Node);
begin
NULL;
end;
this.add_not_implemented;
when ada_Private_Present =>
declare
Private_Present_Node : constant LAL.Private_Present := LAL.As_Private_Present (Node);
begin
NULL;
end;
this.add_not_implemented;
end case;
end process_ada_Private_Node;
procedure process_ada_Protected_Node
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Protected_Node";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Protected_Node := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Protected_Node
case kind is
when ada_Protected_Absent =>
declare
Protected_Absent_Node : constant LAL.Protected_Absent := LAL.As_Protected_Absent (Node);
begin
NULL;
end;
this.add_not_implemented;
when ada_Protected_Present =>
declare
Protected_Present_Node : constant LAL.Protected_Present := LAL.As_Protected_Present (Node);
begin
NULL;
end;
this.add_not_implemented;
end case;
end process_ada_Protected_Node;
procedure process_ada_Protected_Def_Range
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Protected_Def_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Protected_Def_Range := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Protected_Def_Range
case kind is
when ada_Protected_Def =>
declare
Protected_Def_Node : constant LAL.Protected_Def := LAL.As_Protected_Def (Node);
public_part : constant LAL.Public_Part := LAL.F_Public_Part (Protected_Def_Node);
private_part : constant LAL.Private_Part := LAL.F_Private_Part (Protected_Def_Node);
end_name : constant LAL.End_Name := LAL.F_End_Name (Protected_Def_Node);
begin
Log ("public_part: " & public_part.Debug_Text);
if not private_part.Is_Null then
Log ("private_part: " & private_part.Debug_Text);
end if;
if not end_name.Is_Null then
Log ("end_name: " & end_name.Debug_Text);
end if;
end;
this.add_not_implemented;
end case;
end process_ada_Protected_Def_Range;
procedure process_ada_Quantifier
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Quantifier";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Quantifier := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Quantifier
case kind is
when ada_Quantifier_All =>
declare
Quantifier_All_Node : constant LAL.Quantifier_All := LAL.As_Quantifier_All (Node);
begin
NULL;
end;
this.add_not_implemented;
when ada_Quantifier_Some =>
declare
Quantifier_Some_Node : constant LAL.Quantifier_Some := LAL.As_Quantifier_Some (Node);
begin
NULL;
end;
this.add_not_implemented;
end case;
end process_ada_Quantifier;
procedure process_ada_Range_Spec_Range
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Range_Spec_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Range_Spec_Range := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Range_Spec_Range
case kind is
when ada_Range_Spec =>
declare
Range_Spec_Node : constant LAL.Range_Spec := LAL.As_Range_Spec (Node);
F_Range : constant LAL.Expr := LAL.F_Range (Range_Spec_Node);
begin
Log ("F_Range: " & F_Range.Debug_Text);
end;
this.add_not_implemented;
end case;
end process_ada_Range_Spec_Range;
procedure process_ada_Renaming_Clause_Range
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Renaming_Clause_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Renaming_Clause_Range := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Renaming_Clause_Range
case kind is
when ada_Renaming_Clause =>
declare
Renaming_Clause_Node : constant LAL.Renaming_Clause := LAL.As_Renaming_Clause (Node);
renamed_object : constant LAL.Name := LAL.F_Renamed_Object (Renaming_Clause_Node);
begin
Log ("renamed_object: " & renamed_object.Debug_Text);
end;
this.add_not_implemented;
when ada_Synthetic_Renaming_Clause =>
declare
Synthetic_Renaming_Clause_Node : constant LAL.Synthetic_Renaming_Clause := LAL.As_Synthetic_Renaming_Clause (Node);
begin
NULL;
end;
this.add_not_implemented;
end case;
end process_ada_Renaming_Clause_Range;
procedure process_ada_Reverse_Node
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Reverse_Node";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Reverse_Node := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Reverse_Node
case kind is
when ada_Reverse_Absent =>
declare
Reverse_Absent_Node : constant LAL.Reverse_Absent := LAL.As_Reverse_Absent (Node);
begin
NULL;
end;
this.add_not_implemented;
when ada_Reverse_Present =>
declare
Reverse_Present_Node : constant LAL.Reverse_Present := LAL.As_Reverse_Present (Node);
begin
NULL;
end;
this.add_not_implemented;
end case;
end process_ada_Reverse_Node;
procedure process_ada_Select_When_Part_Range
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Select_When_Part_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Select_When_Part_Range := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Select_When_Part_Range
case kind is
when ada_Select_When_Part =>
declare
Select_When_Part_Node : constant LAL.Select_When_Part := LAL.As_Select_When_Part (Node);
cond_expr : constant LAL.Expr := LAL.F_Cond_Expr (Select_When_Part_Node);
stmts : constant LAL.Stmt_List := LAL.F_Stmts (Select_When_Part_Node);
begin
if not cond_expr.Is_Null then
Log ("cond_expr: " & cond_expr.Debug_Text);
end if;
if not stmts.Is_Null then
Log ("stmts: " & stmts.Debug_Text);
end if;
end;
this.add_not_implemented;
end case;
end process_ada_Select_When_Part_Range;
procedure Process_Ada_Stmt
(This : in out Class;
-- Node : in LAL.Stmt'Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Ada_Stmt";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
-- Will raise Constraint_Error if Node.Kind is not in Ada_Stmt:
Kind : constant LALCO.Ada_Stmt := Node.Kind;
use LALCO; -- For subtype names in case stmt
begin -- Process_Ada_Stmt
case Kind is
when Ada_Accept_Stmt =>
declare
Accept_Stmt_Node : constant LAL.Accept_Stmt := LAL.As_Accept_Stmt (Node);
Name : constant LAL.Identifier := LAL.F_Name (Accept_Stmt_Node);
Entry_Index_Expr : constant LAL.Expr := LAL.F_Entry_Index_Expr (Accept_Stmt_Node);
Params : constant LAL.Entry_Completion_Formal_Params := LAL.F_Params (Accept_Stmt_Node);
begin
Log ("Name: " & Name.Debug_Text);
if not Entry_Index_Expr.Is_Null then
Log ("Entry_Index_Expr: " & Entry_Index_Expr.Debug_Text);
end if;
Log ("Params: " & Params.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Accept_Stmt_With_Stmts =>
declare
Accept_Stmt_With_Stmts_Node : constant LAL.Accept_Stmt_With_Stmts := LAL.As_Accept_Stmt_With_Stmts (Node);
Stmts : constant LAL.Handled_Stmts := LAL.F_Stmts (Accept_Stmt_With_Stmts_Node);
End_Name : constant LAL.End_Name := LAL.F_End_Name (Accept_Stmt_With_Stmts_Node);
begin
Log ("Stmts: " & Stmts.Debug_Text);
Log ("End_Name: " & End_Name.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_For_Loop_Stmt =>
declare
For_Loop_Stmt_Node : constant LAL.For_Loop_Stmt := LAL.As_For_Loop_Stmt (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Loop_Stmt =>
declare
Loop_Stmt_Node : constant LAL.Loop_Stmt := LAL.As_Loop_Stmt (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_While_Loop_Stmt =>
declare
While_Loop_Stmt_Node : constant LAL.While_Loop_Stmt := LAL.As_While_Loop_Stmt (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Begin_Block =>
declare
Begin_Block_Node : constant LAL.Begin_Block := LAL.As_Begin_Block (Node);
Stmt : constant LAL.Handled_Stmts := LAL.F_Stmts (Begin_Block_Node);
End_Name : constant LAL.End_Name := LAL.F_End_Name (Begin_Block_Node);
begin
Log ("Stmt: " & Stmt.Debug_Text);
if not End_Name.Is_Null then
Log ("End_Name: " & End_Name.Debug_Text);
end if;
end;
This.Add_Not_Implemented;
when Ada_Decl_Block =>
declare
Decl_Block_Node : constant LAL.Decl_Block := LAL.As_Decl_Block (Node);
Decl : constant LAL.Declarative_Part := LAL.F_Decls (Decl_Block_Node);
Stmt : constant LAL.Handled_Stmts := LAL.F_Stmts (Decl_Block_Node);
End_Name : constant LAL.End_Name := LAL.F_End_Name (Decl_Block_Node);
begin
Log ("Decl: " & Decl.Debug_Text);
Log ("Stmt: " & Stmt.Debug_Text);
if not End_Name.Is_Null then
Log ("End_Name: " & End_Name.Debug_Text);
end if;
end;
This.Add_Not_Implemented;
when Ada_Case_Stmt =>
declare
Case_Stmt_Node : constant LAL.Case_Stmt := LAL.As_Case_Stmt (Node);
Expr : constant LAL.Expr := LAL.F_Expr (Case_Stmt_Node);
Alternatives : constant LAL.Case_Stmt_Alternative_List := LAL.F_Alternatives (Case_Stmt_Node);
begin
Log ("Expr: " & Expr.Debug_Text);
Log ("Alternatives: " & Alternatives.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Extended_Return_Stmt =>
declare
Extended_Return_Stmt_Node : constant LAL.Extended_Return_Stmt := LAL.As_Extended_Return_Stmt (Node);
Decl_Stmt : constant LAL.Extended_Return_Stmt_Object_Decl := LAL.F_Decl (Extended_Return_Stmt_Node);
Stmt : constant LAL.Handled_Stmts := LAL.F_Stmts (Extended_Return_Stmt_Node);
begin
Log ("Decl_Stmt: " & Decl_Stmt.Debug_Text);
Log ("Stmt: " & Stmt.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_If_Stmt =>
declare
If_Stmt_Node : constant LAL.If_Stmt := LAL.As_If_Stmt (Node);
Then_Stmt : constant LAL.Stmt_List := LAL.F_Then_Stmts (If_Stmt_Node);
Alternative : constant LAL.Elsif_Stmt_Part_List := LAL.F_Alternatives (If_Stmt_Node);
Else_Stmt : constant LAL.Stmt_List := LAL.F_Else_Stmts (If_Stmt_Node);
begin
Log ("Then_Stmt: " & Then_Stmt.Debug_Text);
Log ("Alternative: " & Alternative.Debug_Text);
Log ("Else_Stmt: " & Else_Stmt.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Named_Stmt =>
declare
Named_Stmt_Node : constant LAL.Named_Stmt := LAL.As_Named_Stmt (Node);
Decl_Stmt : constant LAL.Named_Stmt_Decl := LAL.F_Decl (Named_Stmt_Node);
Stmt : constant LAL.Composite_Stmt := LAL.F_Stmt (Named_Stmt_Node);
begin
Log ("Decl_Stmt: " & Decl_Stmt.Debug_Text);
Log ("Stmt: " & Stmt.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Select_Stmt =>
declare
Select_Stmt_Node : constant LAL.Select_Stmt := LAL.As_Select_Stmt (Node);
Guards : constant LAL.Select_When_Part_List := LAL.F_Guards (Select_Stmt_Node);
Else_Stmt : constant LAL.Stmt_List := LAL.F_Else_Stmts (Select_Stmt_Node);
Abort_Stmts : constant LAL.Stmt_List := LAL.F_Abort_Stmts (Select_Stmt_Node);
begin
Log ("F_Guards: " & Guards.Debug_Text);
Log ("F_Else_Stmts: " & Else_Stmt.Debug_Text);
Log ("F_Abort_Stmts: " & Abort_Stmts.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Error_Stmt =>
declare
Error_Stmt_Node : constant LAL.Error_Stmt := LAL.As_Error_Stmt (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Abort_Stmt =>
declare
Abort_Stmt_Node : constant LAL.Abort_Stmt := LAL.As_Abort_Stmt (Node);
Names : constant LAL.Name_List := LAL.F_Names (Abort_Stmt_Node);
begin
Log ("F_Names: " & Names.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Assign_Stmt =>
declare
Assign_Stmt_Node : constant LAL.Assign_Stmt := LAL.As_Assign_Stmt (Node);
Dest : constant LAL.Name := LAL.F_Dest (Assign_Stmt_Node);
Expr : constant LAL.Expr := LAL.F_Expr (Assign_Stmt_Node);
begin
Log ("F_Dest: " & Dest.Debug_Text);
Log ("F_Expr: " & Expr.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Call_Stmt =>
declare
Call_Stmt_Node : constant LAL.Call_Stmt := LAL.As_Call_Stmt (Node);
Call : constant LAL.Name := LAL.F_Call (Call_Stmt_Node);
begin
Log ("F_Call: " & Call.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Delay_Stmt =>
declare
Delay_Stmt_Node : constant LAL.Delay_Stmt := LAL.As_Delay_Stmt (Node);
Has_Until : constant Boolean := LAL.F_Has_Until (Delay_Stmt_Node);
Seconds : constant LAL.Expr := LAL.F_Expr (Delay_Stmt_Node);
begin
Log ("F_Has_Until: " & Boolean'Image (Has_Until));
Log ("Seconds: " & Seconds.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Exit_Stmt =>
declare
Exit_Stmt_Node : constant LAL.Exit_Stmt := LAL.As_Exit_Stmt (Node);
Loop_Name : constant LAL.Identifier := LAL.F_Loop_Name (Exit_Stmt_Node);
Cond_Expr : constant LAL.Expr := LAL.F_Cond_Expr (Exit_Stmt_Node);
begin
if not Loop_Name.Is_Null then
Log ("F_Loop_Name: " & Loop_Name.Debug_Text);
end if;
if not Cond_Expr.Is_Null then
Log ("F_Cond_Expr: " & Cond_Expr.Debug_Text);
end if;
end;
This.Add_Not_Implemented;
when Ada_Goto_Stmt =>
declare
Goto_Stmt_Node : constant LAL.Goto_Stmt := LAL.As_Goto_Stmt (Node);
Label : constant LAL.Name := LAL.F_Label_Name (Goto_Stmt_Node);
begin
Log ("F_Label_Name: " & Label.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Label =>
declare
Label_Node : constant LAL.Label := LAL.As_Label (Node);
Label_Decl : constant LAL.Label_Decl := LAL.F_Decl (Label_Node);
begin
Log ("F_Decl: " & Label_Decl.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Null_Stmt =>
declare
Null_Stmt_Node : constant LAL.Null_Stmt := LAL.As_Null_Stmt (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
when Ada_Raise_Stmt =>
declare
Raise_Stmt_Node : constant LAL.Raise_Stmt := LAL.As_Raise_Stmt (Node);
Exception_Name : constant LAL.Name := LAL.F_Exception_Name (Raise_Stmt_Node);
Error_Message : constant LAL.Expr := LAL.F_Error_Message (Raise_Stmt_Node);
begin
Log ("F_Exception_Name: " & Exception_Name.Debug_Text);
if not Error_Message.Is_Null then
Log ("Error_Message: " & Error_Message.Debug_Text);
end if;
end;
This.Add_Not_Implemented;
when Ada_Requeue_Stmt =>
declare
Requeue_Stmt_Node : constant LAL.Requeue_Stmt := LAL.As_Requeue_Stmt (Node);
Call_Name : constant LAL.Name := LAL.F_Call_Name (Requeue_Stmt_Node);
Has_Abort : constant Boolean := LAL.F_Has_Abort (Requeue_Stmt_Node);
begin
Log ("F_Call_Name: " & Call_Name.Debug_Text);
Log ("F_Has_Abort: " & Boolean'Image (Has_Abort));
end;
This.Add_Not_Implemented;
when Ada_Return_Stmt =>
declare
Return_Stmt_Node : constant LAL.Return_Stmt := LAL.As_Return_Stmt (Node);
Return_Expr : constant LAL.Expr := LAL.F_Return_Expr (Return_Stmt_Node);
begin
Log ("F_Return_Expr: " & Return_Expr.Debug_Text);
end;
This.Add_Not_Implemented;
when Ada_Terminate_Alternative =>
declare
Terminate_Alternative_Node : constant LAL.Terminate_Alternative := LAL.As_Terminate_Alternative (Node);
begin
NULL;
end;
This.Add_Not_Implemented;
end case;
exception
when X : External_Error | Internal_Error | Usage_Error =>
raise;
when X: others =>
Log_Exception (X);
Log ("No handler for this exception. Raising Internal_Error");
raise Internal_Error;
end Process_Ada_Stmt;
procedure process_ada_Subp_Kind
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Subp_Kind";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Subp_Kind := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Subp_Kind
case kind is
when ada_Subp_Kind_Function =>
declare
Subp_Kind_Function_Node : constant LAL.Subp_Kind_Function := LAL.As_Subp_Kind_Function (Node);
begin
NULL;
end;
when ada_Subp_Kind_Procedure =>
declare
Subp_Kind_Procedure_Node : constant LAL.Subp_Kind_Procedure := LAL.As_Subp_Kind_Procedure (Node);
begin
NULL;
end;
end case;
end process_ada_Subp_Kind;
procedure process_ada_Subunit_Range
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Subunit_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Subunit_Range := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Subunit_Range
case kind is
when ada_Subunit =>
declare
Subunit_Node : constant LAL.Subunit := LAL.As_Subunit (Node);
name : constant LAL.Name := LAL.F_Name (Subunit_Node);
f_body : constant LAL.Body_Node := LAL.F_Body (Subunit_Node);
body_root : constant LAL.Basic_Decl := LAL.P_Body_Root (Subunit_Node);
begin
Log ("name: " & name.Debug_Text);
Log ("f_body: " & f_body.Debug_Text);
Log ("body_root: " & body_root.Debug_Text);
end;
end case;
end process_ada_Subunit_Range;
procedure process_ada_Synchronized_Node
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Synchronized_Node";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Synchronized_Node := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Synchronized_Node
case kind is
when ada_Synchronized_Absent =>
declare
Synchronized_Absent_Node : constant LAL.Synchronized_Absent := LAL.As_Synchronized_Absent (Node);
begin
NULL;
end;
when ada_Synchronized_Present =>
declare
Synchronized_Present_Node : constant LAL.Synchronized_Present := LAL.As_Synchronized_Present (Node);
begin
NULL;
end;
end case;
end process_ada_Synchronized_Node;
procedure process_ada_Tagged_Node
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Tagged_Node";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Tagged_Node := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Tagged_Node
case kind is
when ada_Tagged_Absent =>
declare
Tagged_Absent_Node : constant LAL.Tagged_Absent := LAL.As_Tagged_Absent (Node);
begin
NULL;
end;
when ada_Tagged_Present =>
declare
Tagged_Present_Node : constant LAL.Tagged_Present := LAL.As_Tagged_Present (Node);
begin
NULL;
end;
end case;
end process_ada_Tagged_Node;
procedure process_ada_Task_Def_Range
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Task_Def_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Task_Def_Range := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Task_Def_Range
case kind is
when ada_Task_Def =>
declare
Task_Def_Node : constant LAL.Task_Def := LAL.As_Task_Def (Node);
interfaces : constant LAL.Parent_List := LAL.F_Interfaces (Task_Def_Node);
public_part : constant LAL.Public_Part := LAL.F_Public_Part (Task_Def_Node);
private_part : constant LAL.Private_part := LAL.F_Private_Part (Task_Def_Node);
end_name : constant LAL.End_Name := LAL.F_End_Name (Task_Def_Node);
begin
Log ("interfaces: " & interfaces.Debug_Text);
Log ("public_part: " & public_part.Debug_Text);
if not private_part.Is_Null then
Log ("private_part: " & private_part.Debug_Text);
end if;
Log ("end_name: " & end_name.Debug_Text);
end;
end case;
end process_ada_Task_Def_Range;
procedure process_ada_Type_Def
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Def_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Type_Def := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Type_Def
case kind is
when ada_Access_To_Subp_Def =>
declare
Access_To_Subp_Def_Node : constant LAL.Access_To_Subp_Def := LAL.As_Access_To_Subp_Def (Node);
has_protected : constant Boolean := LAL.F_Has_Protected (Access_To_Subp_Def_Node);
sub_spec : constant LAL.Subp_Spec := LAL.F_Subp_Spec (Access_To_Subp_Def_Node);
begin
Log ("has_protected: " & Boolean'Image(has_protected));
Log ("sub_spec: " & sub_spec.Debug_Text);
end;
when ada_Anonymous_Type_Access_Def =>
declare
Anonymous_Type_Access_Def_Node : constant LAL.Anonymous_Type_Access_Def := LAL.As_Anonymous_Type_Access_Def (Node);
type_decl : constant LAL.Base_Type_Decl := LAL.F_Type_Decl (Anonymous_Type_Access_Def_Node);
begin
Log ("type_decl: " & type_decl.Debug_Text);
end;
when ada_Type_Access_Def =>
declare
Type_Access_Def_Node : constant LAL.Type_Access_Def := LAL.As_Type_Access_Def (Node);
has_all : constant Boolean := LAL.F_Has_All (Type_Access_Def_Node);
has_constant : constant Boolean := LAL.F_Has_Constant (Type_Access_Def_Node);
begin
Log ("has_all: " & Boolean'Image(has_all));
Log ("has_constant: " & Boolean'Image(has_constant));
end;
when ada_Array_Type_Def =>
declare
Array_Type_Def_Node : constant LAL.Array_Type_Def := LAL.As_Array_Type_Def (Node);
indices : constant LAL.Array_Indices := LAL.F_Indices (Array_Type_Def_Node);
component_type : constant LAL.Component_Def := LAL.F_Component_Type (Array_Type_Def_Node);
begin
Log ("indices: " & indices.Debug_Text);
Log ("component_type: " & component_type.Debug_Text);
end;
when ada_Derived_Type_Def =>
declare
Derived_Type_Def_Node : constant LAL.Derived_Type_Def := LAL.As_Derived_Type_Def (Node);
interfaces : constant LAL.Parent_List := LAL.F_Interfaces (Derived_Type_Def_Node);
record_extension : constant LAL.Base_Record_Def := LAL.F_Record_Extension (Derived_Type_Def_Node);
has_with_private : constant Boolean := LAL.F_Has_With_Private (Derived_Type_Def_Node);
begin
if not interfaces.Is_Null then
Log ("interfaces: " & interfaces.Debug_Text);
end if;
if not record_extension.Is_Null then
Log ("record_extension: " & record_extension.Debug_Text);
end if;
Log ("has_with_private: " & Boolean'Image(has_with_private));
end;
when ada_Enum_Type_Def =>
declare
Enum_Type_Def_Node : constant LAL.Enum_Type_Def := LAL.As_Enum_Type_Def (Node);
enum_literals : constant LAL.Enum_Literal_Decl_List := LAL.F_Enum_Literals (Enum_Type_Def_Node);
begin
Log ("enum_literals: " & enum_literals.Debug_Text);
end;
when ada_Formal_Discrete_Type_Def =>
declare
Formal_Discrete_Type_Def_Node : constant LAL.Formal_Discrete_Type_Def := LAL.As_Formal_Discrete_Type_Def (Node);
begin
NULL;
end;
when ada_Interface_Type_Def =>
declare
Interface_Type_Def_Node : constant LAL.Interface_Type_Def := LAL.As_Interface_Type_Def (Node);
interface_kind : constant LAL.Interface_Kind := LAL.F_Interface_Kind (Interface_Type_Def_Node);
begin
Log ("interface_kind: " & interface_kind.Debug_Text);
end;
when ada_Mod_Int_Type_Def =>
declare
Mod_Int_Type_Def_Node : constant LAL.Mod_Int_Type_Def := LAL.As_Mod_Int_Type_Def (Node);
expr : constant LAL.Expr := LAL.F_Expr (Mod_Int_Type_Def_Node);
begin
Log ("expr: " & expr.Debug_Text);
end;
when ada_Private_Type_Def =>
declare
Private_Type_Def_Node : constant LAL.Private_Type_Def := LAL.As_Private_Type_Def (Node);
has_abstract : constant Boolean := LAL.F_Has_Abstract (Private_Type_Def_Node);
has_tagged : constant Boolean := LAL.F_Has_Tagged (Private_Type_Def_Node);
has_limited : constant Boolean := LAL.F_Has_Limited (Private_Type_Def_Node);
begin
Log ("has_abstract: " & Boolean'Image(has_abstract));
Log ("has_tagged: " & Boolean'Image(has_tagged));
Log ("has_limited: " & Boolean'Image(has_limited));
end;
when ada_Decimal_Fixed_Point_Def =>
declare
Decimal_Fixed_Point_Def_Node : constant LAL.Decimal_Fixed_Point_Def := LAL.As_Decimal_Fixed_Point_Def (Node);
f_delta : constant LAL.Expr := LAL.F_Delta (Decimal_Fixed_Point_Def_Node);
f_digits : constant LAL.Expr := LAL.F_Digits (Decimal_Fixed_Point_Def_Node);
f_range : constant LAL.Range_Spec := LAL.F_Range (Decimal_Fixed_Point_Def_Node);
begin
Log ("f_delta: " & f_delta.Debug_Text);
Log ("f_digits: " & f_digits.Debug_Text);
if not f_range.Is_Null then
Log ("f_range: " & f_range.Debug_Text);
end if;
end;
when ada_Floating_Point_Def =>
declare
Floating_Point_Def_Node : constant LAL.Floating_Point_Def := LAL.As_Floating_Point_Def (Node);
num_digits : constant LAL.Expr := LAL.F_Num_Digits (Floating_Point_Def_Node);
f_range : constant LAL.Range_Spec := LAL.F_Range (Floating_Point_Def_Node);
begin
Log ("num_digits: " & num_digits.Debug_Text);
if not f_range.Is_Null then
Log ("f_range: " & f_range.Debug_Text);
end if;
end;
when ada_Ordinary_Fixed_Point_Def =>
declare
Ordinary_Fixed_Point_Def_Node : constant LAL.Ordinary_Fixed_Point_Def := LAL.As_Ordinary_Fixed_Point_Def (Node);
f_delta : constant LAL.Expr := LAL.F_Delta (Ordinary_Fixed_Point_Def_Node);
f_range : constant LAL.Range_Spec := LAL.F_Range (Ordinary_Fixed_Point_Def_Node);
begin
Log ("f_delta: " & f_delta.Debug_Text);
Log ("f_range: " & f_range.Debug_Text);
end;
when ada_Record_Type_Def =>
declare
Record_Type_Def_Node : constant LAL.Record_Type_Def := LAL.As_Record_Type_Def (Node);
has_abstract : constant Boolean := LAL.F_Has_Abstract (Record_Type_Def_Node);
has_tagged : constant Boolean := LAL.F_Has_Tagged (Record_Type_Def_Node);
has_limited : constant Boolean := LAL.F_Has_Limited (Record_Type_Def_Node);
begin
Log ("has_abstract: " & Boolean'Image(has_abstract));
Log ("has_tagged: " & Boolean'Image(has_tagged));
Log ("has_limited: " & Boolean'Image(has_limited));
end;
when ada_Signed_Int_Type_Def =>
declare
Signed_Int_Type_Def_Node : constant LAL.Signed_Int_Type_Def := LAL.As_Signed_Int_Type_Def (Node);
f_range : constant LAL.Range_Spec := LAL.F_Range (Signed_Int_Type_Def_Node);
begin
Log ("f_range: " & f_range.Debug_Text);
end;
end case;
end process_ada_Type_Def;
procedure process_ada_Type_Expr
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Type_Expr";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Type_Expr := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Type_Expr
case kind is
when ada_Anonymous_Type =>
declare
Anonymous_Type_Node : constant LAL.Anonymous_Type := LAL.As_Anonymous_Type (Node);
type_Decl : constant LAL.Anonymous_Type_Decl := LAL.F_Type_Decl (Anonymous_Type_Node);
begin
Log ("type_Decl: " & type_Decl.Debug_Text);
end;
when ada_Enum_Lit_Synth_Type_Expr =>
declare
Enum_Lit_Synth_Type_Expr_Node : constant LAL.Enum_Lit_Synth_Type_Expr := LAL.As_Enum_Lit_Synth_Type_Expr (Node);
begin
NULL;
end;
when ada_Subtype_Indication =>
declare
Subtype_Indication_Node : constant LAL.Subtype_Indication := LAL.As_Subtype_Indication (Node);
has_not_null : constant Boolean := LAL.F_Has_Not_Null (Subtype_Indication_Node);
name : constant LAL.Name := LAL.F_Name (Subtype_Indication_Node);
constraint : constant LAL.Constraint := LAL.F_Constraint (Subtype_Indication_Node);
begin
Log ("has_not_null: " & Boolean'Image(has_not_null));
Log ("name: " & name.Debug_Text);
if not constraint.Is_Null then
Log ("constraint: " & constraint.Debug_Text);
end if;
end;
when ada_Constrained_Subtype_Indication =>
declare
Constrained_Subtype_Indication_Node : constant LAL.Constrained_Subtype_Indication := LAL.As_Constrained_Subtype_Indication (Node);
begin
NULL;
end;
when ada_Discrete_Subtype_Indication =>
declare
Discrete_Subtype_Indication_Node : constant LAL.Discrete_Subtype_Indication := LAL.As_Discrete_Subtype_Indication (Node);
begin
NULL;
end;
end case;
end process_ada_Type_Expr;
procedure process_ada_Unconstrained_Array_Index_Range
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Unconstrained_Array_Index_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Unconstrained_Array_Index_Range := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Unconstrained_Array_Index_Range
case kind is
when ada_Unconstrained_Array_Index =>
declare
Unconstrained_Array_Index_Node : constant LAL.Unconstrained_Array_Index := LAL.As_Unconstrained_Array_Index (Node);
begin
NULL;
end;
end case;
end process_ada_Unconstrained_Array_Index_Range;
procedure process_ada_Until_Node
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Until_Node";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Until_Node := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Until_Node
case kind is
when ada_Until_Absent =>
declare
Until_Absent_Node : constant LAL.Until_Absent := LAL.As_Until_Absent (Node);
begin
NULL;
end;
when ada_Until_Present =>
declare
Until_Present_Node : constant LAL.Until_Present := LAL.As_Until_Present (Node);
begin
NULL;
end;
end case;
end process_ada_Until_Node;
procedure process_ada_Use_Clause
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Use_Clause";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Use_Clause := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Use_Clause
case kind is
when ada_Use_Package_Clause =>
declare
Use_Package_Clause_Node : constant LAL.Use_Package_Clause := LAL.As_Use_Package_Clause (Node);
packages : constant LAL.Name_List := LAL.F_Packages (Use_Package_Clause_Node);
begin
Log ("packages: " & packages.Debug_Text);
end;
when ada_Use_Type_Clause =>
declare
Use_Type_Clause_Node : constant LAL.Use_Type_Clause := LAL.As_Use_Type_Clause (Node);
has_all : constant Boolean := LAL.F_Has_All (Use_Type_Clause_Node);
types : constant LAL.Name_List := LAL.F_Types (Use_Type_Clause_Node);
begin
Log ("has_all: " & Boolean'Image(has_all));
Log ("types: " & types.Debug_Text);
end;
end case;
end process_ada_Use_Clause;
procedure process_ada_Variant_Range
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Variant_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Variant_Range := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Variant_Range
case kind is
when ada_Variant =>
declare
Variant_Node : constant LAL.Variant := LAL.As_Variant (Node);
choices : constant LAL.Alternatives_List := LAL.F_Choices (Variant_Node);
components : constant LAL.Component_List := LAL.F_Components (Variant_Node);
begin
Log ("choices: " & choices.Debug_Text);
Log ("components: " & components.Debug_Text);
end;
end case;
end process_ada_Variant_Range;
procedure process_ada_Variant_Part_Range
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_Variant_Part_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_Variant_Part_Range := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_Variant_Part_Range
case kind is
when ada_Variant_Part =>
declare
Variant_Part_Node : constant LAL.Variant_Part := LAL.As_Variant_Part (Node);
discr_name : constant LAL.Identifier := LAL.F_Discr_Name (Variant_Part_Node);
variant : constant LAL.Variant_List := LAL.F_Variant (Variant_Part_Node);
begin
Log ("discr_name: " & discr_name.Debug_Text);
Log ("variant: " & variant.Debug_Text);
end;
end case;
end process_ada_Variant_Part_Range;
procedure process_ada_With_Clause_Range
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_With_Clause_Range";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_With_Clause_Range := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_With_Clause_Range
case kind is
when ada_With_Clause =>
declare
With_Clause_Node : constant LAL.With_Clause := LAL.As_With_Clause (Node);
packages : constant LAL.Name_List := LAL.F_Packages (With_Clause_Node);
has_private : constant Boolean := LAL.F_Has_Private (With_Clause_Node);
has_limited : constant Boolean := LAL.F_Has_Limited (With_Clause_Node);
begin
Log ("packages: " & packages.Debug_Text);
Log ("has_private: " & Boolean'Image(has_private));
Log ("has_limited: " & Boolean'Image(has_limited));
end;
end case;
end process_ada_With_Clause_Range;
procedure process_ada_With_Private
(this : in out class;
-- node : in lal.stmt'class;
node : in lal.ada_node'class)
is
parent_name : constant string := module_name;
module_name : constant string := parent_name & ".process_With_Private";
package logging is new generic_logging (module_name); use logging;
-- auto : logging.auto_logger; -- logs begin and end
-- will raise declarative_part_error if node.kind is not in ada_stmt:
kind : constant lalco.ada_With_Private := node.kind;
use lalco; -- for subtype names in case stmt
begin -- process_ada_With_Private
case kind is
when ada_With_Private_Absent =>
declare
With_Private_Absent_Node : constant LAL.With_Private_Absent := LAL.As_With_Private_Absent (Node);
begin
NULL;
end;
when ada_With_Private_Present =>
declare
With_Private_Present_Node : constant LAL.With_Private_Present := LAL.As_With_Private_Present (Node);
begin
NULL;
end;
end case;
end process_ada_With_Private;
-- Do_Pre_Child_Processing and Do_Post_Child_Processing below are preserved
-- from Asis_Adapter for familiarity.
--
-- Asis_Adapter.Unit.Process indirectly calls Asis_Adapter.Element.
-- Process_Element_Tree, which calls an instance of generic
-- Asis.Iterator.Traverse_Element, instantiated with
-- Do_Pre_Child_Processing and Do_Post_Child_Processing.
--
-- Lal_Adapter.Unit.Process indirectly calls LAL.Compilation_Unit.Traverse
-- with a pointer that indrectly calls Lal_Adapter.Node.Process, which calls
-- Do_Pre_Child_Processing and Do_Post_Child_Processing.
procedure Do_Pre_Child_Processing
(This : in out Class;
Node : in LAL.Ada_Node'Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Do_Pre_Child_Processing";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
Result : a_nodes_h.Element_Struct renames This.A_Element;
Sloc_Range_Image : constant string := Slocs.Image (Node.Sloc_Range);
Kind : constant LALCO.Ada_Node_Kind_Type := Node.Kind;
Kind_Image : constant String := LALCO.Ada_Node_Kind_Type'Image (Kind);
Kind_Name : constant String := Node.Kind_Name;
Debug_Text : constant String := Node.Debug_Text;
procedure Add_Element_ID is begin
-- ID is in the Dot node twice (once in the Label and once in
-- Node_ID), but not in the a_node twice.
This.Add_To_Dot_Label (To_String (This.Element_IDs.First_Element));
Result.id := This.Element_IDs.First_Element;
end;
procedure Add_Node_Kind is begin
This.Add_To_Dot_Label ("Node_Kind", Kind_Image);
-- TODO: Result.Element_Kind := anhS.To_Element_Kinds (Element_Kind);
end;
procedure Add_Source_Location is
Unit : constant LAL.Analysis_Unit := Node.Unit;
File_Name : constant String := Unit.Get_Filename;
Sloc_Range : constant Slocs.Source_Location_Range := Node.Sloc_Range;
Image : constant String := To_String (Node.Full_Sloc_Image);
begin
This.Add_To_Dot_Label ("Source", Image);
Result.Source_Location :=
(Unit_Name => To_Chars_Ptr (File_Name),
First_Line => Interfaces.C.int (Sloc_Range.Start_Line),
First_Column => Interfaces.C.int (Sloc_Range.Start_Column),
Last_Line => Interfaces.C.int (Sloc_Range.End_Line),
Last_Column => Interfaces.C.int (Sloc_Range.End_Column));
end;
procedure Add_Enclosing_Element is
Value : constant a_nodes_h.Element_ID :=
-- Get_Element_ID (Node.P_Semantic_Parent);
Get_Element_ID (Node.Parent);
begin
-- State.Add_Dot_Edge (From => Enclosing_Element_Id,
-- To => State.Element_Id,
-- Label => "Child");
This.Add_To_Dot_Label ("Enclosing_Element", Value);
Result.Enclosing_Element_Id := Value;
end;
procedure Start_Output is
Default_Node : Dot.Node_Stmt.Class; -- Initialized
Default_Label : Dot.HTML_Like_Labels.Class; -- Initialized
-- Parent_Name : constant String := Module_Name;
-- Module_Name : constant String := Parent_Name & ".Start_Output";
-- package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
begin -- Start_Output
-- Set defaults:
Result := a_nodes_h.Support.Default_Element_Struct;
This.Outputs.Text.End_Line;
-- Element ID comes out on next line via Add_Element_ID:
This.Outputs.Text.Put_Indented_Line (String'("BEGIN "));
This.Outputs.Text.Indent;
This.Dot_Node := Default_Node;
This.Dot_Label := Default_Label;
-- Get ID:
This.Element_IDs.Prepend (Get_Element_ID (Node));
-- Log ( " Elem ID: " & To_String(Get_Element_ID (Node)));
This.Dot_Node.Node_ID.ID :=
To_Dot_ID_Type (This.Element_IDs.First_Element, Element_ID_Kind);
-- Result.Debug_Image := Debug_Image;
-- Put_Debug;
Add_Element_ID;
Add_Node_Kind;
Add_Enclosing_Element;
Add_Source_Location;
end Start_Output;
procedure Finish_Output is
-- Parent_Name : constant String := Module_Name;
-- Module_Name : constant String := Parent_Name & ".Finish_Output";
-- package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
begin
This.Dot_Node.Add_Label (This.Dot_Label);
This.Outputs.Graph.Append_Stmt
(new Dot.Node_Stmt.Class'(This.Dot_Node));
-- Depends on unique node ids:
This.Outputs.A_Nodes.Push (Result);
end Finish_Output;
use LALCO; -- For subtype names in case stmt
-- use type LALCO.Ada_Node_Kind_Type; -- For "="
begin -- Do_Pre_Child_Processing
-- Log ("Line" & Start_Line_Image & ": " & Kind_Image & ": " & Debug_Text);
-- if Node.Kind /= LALCO.Ada_Compilation_Unit then
Log ("Kind enum: " & Kind_Image & "; Kind name: " & Kind_Name & " at " & Sloc_Range_Image);
Start_Output;
-- Log (LAL.Image(Node));
-- if Kind in LALCO.Ada_Stmt then
-- Log ("Statement");
-- else
-- Log ("NOT a statement");
-- end if;
--
case Kind is
-- 3 included kinds:
when Ada_Abort_Node'First .. Ada_Abort_Node'Last =>
This.Process_Ada_Abort_Node (Node);
-- 3 included kinds:
when Ada_Abstract_Node'First .. Ada_Abstract_Node'Last =>
This.Process_Ada_Abstract_Node (Node);
-- 30 included kinds:
when Ada_Ada_List'First .. Ada_Ada_List'Last =>
This.Process_Ada_Ada_List (Node);
-- 3 included kinds:
when Ada_Aliased_Node'First .. Ada_Aliased_Node'Last =>
This.Process_Ada_Aliased_Node (Node);
-- 3 included kinds:
when Ada_All_Node'First .. Ada_All_Node'Last =>
This.Process_Ada_All_Node (Node);
-- 3 included kinds:
when Ada_Array_Indices'First .. Ada_Array_Indices'Last =>
This.Process_Ada_Array_Indices (Node);
-- 1 included kinds:
when Ada_Aspect_Assoc_Range'First .. Ada_Aspect_Assoc_Range'Last =>
This.Process_Ada_Aspect_Assoc_Range (Node);
-- 5 included kinds:
when Ada_Aspect_Clause'First .. Ada_Aspect_Clause'Last =>
This.Process_Ada_Aspect_Clause (Node);
-- 2 included kinds:
when Ada_Aspect_Spec_Range'First .. Ada_Aspect_Spec_Range'Last =>
this.process_ada_aspect_spec_range (node);
-- 3 included kinds:
when Ada_Base_Assoc'First .. Ada_Base_Assoc'Last =>
this.process_ada_Base_Assoc (node);
-- 3 included kinds:
when Ada_Base_Formal_Param_Holder'First .. Ada_Base_Formal_Param_Holder'Last =>
this.process_ada_Base_Formal_Param_Holder (node);
-- 3 included kinds:
when Ada_Base_Record_Def'First .. Ada_Base_Record_Def'Last =>
this.process_ada_Base_Record_Def (node);
-- 5 included kinds:
when Ada_Basic_Assoc'First .. Ada_Basic_Assoc'Last =>
this.process_ada_Basic_Assoc (node);
-- 74 included kinds:
when Ada_Basic_Decl'First .. Ada_Basic_Decl'Last =>
This.Process_Ada_Basic_Decl (Node);
-- 1 included kinds:
when Ada_Case_Stmt_Alternative_Range'First .. Ada_Case_Stmt_Alternative_Range'Last =>
This.Process_Ada_Case_Stmt_Alternative_Range (Node);
-- 1 included kinds:
when Ada_Compilation_Unit_Range'First .. Ada_Compilation_Unit_Range'Last =>
This.Process_Ada_Compilation_Unit_Range (Node);
-- 1 included kinds:
when Ada_Component_Clause_Range'First .. Ada_Component_Clause_Range'Last =>
This.Process_Ada_Component_Clause_Range (Node);
-- 1 included kinds:
when Ada_Component_Def_Range'First .. Ada_Component_Def_Range'Last =>
This.Process_Ada_Component_Def_Range (Node);
-- 6 included kinds:
when Ada_Constraint'First .. Ada_Constraint'Last =>
This.Process_Ada_Constraint (Node);
-- 3 included kinds:
when Ada_Constant_Node'First .. Ada_Constant_Node'Last =>
This.Process_Ada_Constant_Node (Node);
-- 3 included kinds:
when Ada_Declarative_Part_Range'First .. Ada_Declarative_Part_Range'Last =>
This.Process_Ada_Declarative_Part_Range (Node);
-- 1 included kinds:
when Ada_Elsif_Expr_Part_Range'First .. Ada_Elsif_Expr_Part_Range'Last =>
This.Process_Ada_Elsif_Expr_Part_Range (Node);
-- 1 included kinds:
when Ada_Elsif_Stmt_Part_Range'First .. Ada_Elsif_Stmt_Part_Range'Last =>
This.Process_Ada_Elsif_Stmt_Part_Range (Node);
-- 60 included kinds:
when Ada_Expr'First .. Ada_Expr'Last =>
This.Process_Ada_Expr (Node);
-- 1 included kinds:
when Ada_Handled_Stmts_Range'First .. Ada_Handled_Stmts_Range'Last =>
This.Process_Ada_Handled_Stmts_Range (Node);
-- 5 included kinds:
when Ada_Interface_Kind'First .. Ada_Interface_Kind'Last =>
This.Process_Ada_Interface_Kind (Node);
-- 3 included kinds:
when Ada_Iter_Type'First .. Ada_Iter_Type'Last =>
This.Process_Ada_Iter_Type (Node);
-- 2 included kinds:
when Ada_Library_Item_Range'First .. Ada_Library_Item_Range'Last =>
This.Process_Ada_Library_Item_Range (Node);
-- 3 included kinds:
when Ada_Limited_Node'First .. Ada_Limited_Node'Last =>
This.Process_Ada_Limited_Node (Node);
-- 3 included kinds:
when Ada_Loop_Spec'First .. Ada_Loop_Spec'Last =>
This.Process_Ada_Loop_Spec (Node);
-- 3 included kinds:
when Ada_Mode'First .. Ada_Mode'Last =>
This.Process_Ada_Mode (Node);
-- 3 included kinds:
when Ada_Not_Null'First .. Ada_Not_Null'Last =>
This.Process_Ada_Not_Null (Node);
-- 2 included kinds:
when Ada_Null_Component_Decl_Range'First .. Ada_Null_Component_Decl_Range'Last =>
This.Process_Ada_Null_Component_Decl_Range (Node);
-- 2 included kinds:
when Ada_Others_Designator_Range'First .. Ada_Others_Designator_Range'Last =>
This.Process_Ada_Others_Designator_Range (Node);
-- 4 included kinds:
when Ada_Overriding_Node'First .. Ada_Overriding_Node'Last =>
This.Process_Ada_Overriding_Node (Node);
-- 4 included kinds:
when Ada_Params_Range'First .. Ada_Params_Range'Last =>
This.Process_Ada_Params_Range (Node);
-- 4 included kinds:
when Ada_Pragma_Node_Range'First .. Ada_Pragma_Node_Range'Last =>
This.Process_Ada_Pragma_Node_Range (Node);
-- 4 included kinds:
when Ada_Prim_Type_Accessor_Range'First .. Ada_Prim_Type_Accessor_Range'Last =>
This.Process_Ada_Prim_Type_Accessor_Range (Node);
-- 4 included kinds:
when Ada_Private_Node'First .. Ada_Private_Node'Last =>
This.Process_Ada_Private_Node (Node);
-- 4 included kinds:
when Ada_Protected_Node'First .. Ada_Protected_Node'Last =>
This.Process_Ada_Protected_Node (Node);
-- 4 included kinds:
when Ada_Protected_Def_Range'First .. Ada_Protected_Def_Range'Last =>
This.Process_Ada_Protected_Def_Range (Node);
-- 3 included kinds:
when Ada_Quantifier'First .. Ada_Quantifier'Last =>
This.Process_Ada_Quantifier (Node);
-- 2 included kinds:
when Ada_Range_Spec_Range'First .. Ada_Range_Spec_Range'Last =>
This.Process_Ada_Range_Spec_Range (Node);
-- 3 included kinds:
when Ada_Renaming_Clause_Range'First .. Ada_Renaming_Clause_Range'Last =>
This.Process_Ada_Renaming_Clause_Range (Node);
-- 3 included kinds:
when Ada_Reverse_Node'First .. Ada_Reverse_Node'Last =>
This.Process_Ada_Reverse_Node (Node);
-- 2 included kinds:
when Ada_Select_When_Part_Range'First .. Ada_Select_When_Part_Range'Last =>
This.Process_Ada_Select_When_Part_Range (Node);
-- 31 (25?) included kinds:
when Ada_Stmt'First .. Ada_Stmt'Last =>
-- Log ("Tag: " & Ada.Tags.Expanded_Name (Node'Tag));
-- This.Process_Ada_Stmt (LAL.Stmt'Class (Node), Outputs);
This.Process_Ada_Stmt (Node);
-- 3 included kinds:
when Ada_Subp_Kind'First .. Ada_Subp_Kind'Last =>
This.Process_Ada_Subp_Kind (Node);
-- 2 included kinds:
when Ada_Subunit_Range'First .. Ada_Subunit_Range'Last =>
This.Process_Ada_Subunit_Range (Node);
-- 3 included kinds:
when Ada_Synchronized_Node'First .. Ada_Synchronized_Node'Last =>
This.Process_Ada_Synchronized_Node (Node);
-- 3 included kinds:
when Ada_Tagged_Node'First .. Ada_Tagged_Node'Last =>
This.Process_Ada_Tagged_Node (Node);
-- 2 included kinds:
when Ada_Task_Def_Range'First .. Ada_Task_Def_Range'Last =>
This.Process_Ada_Task_Def_Range (Node);
-- 17 included kinds:
when Ada_Type_Def'First .. Ada_Type_Def'Last =>
This.Process_Ada_Type_Def (Node);
-- 5 included kinds:
when Ada_Type_Expr'First .. Ada_Type_Expr'Last =>
This.Process_Ada_Type_Expr (Node);
-- 2 included kinds:
when Ada_Unconstrained_Array_Index_Range'First .. Ada_Unconstrained_Array_Index_Range'Last =>
This.Process_Ada_Unconstrained_Array_Index_Range (Node);
-- 3 included kinds:
when Ada_Until_Node'First .. Ada_Until_Node'Last =>
This.Process_Ada_Until_Node (Node);
-- 3 included kinds:
when Ada_Use_Clause'First .. Ada_Use_Clause'Last =>
This.Process_Ada_Use_Clause (Node);
-- 2 included kinds:
when Ada_Variant_Range'First .. Ada_Variant_Range'Last =>
This.Process_Ada_Variant_Range (Node);
-- 2 included kinds:
when Ada_Variant_Part_Range'First .. Ada_Variant_Part_Range'Last =>
This.Process_Ada_Variant_Part_Range (Node);
-- 2 included kinds:
when Ada_With_Clause_Range'First .. Ada_With_Clause_Range'Last =>
This.Process_Ada_With_Clause_Range (Node);
-- 3 included kinds:
when Ada_With_Private'First .. Ada_With_Private'Last =>
This.Process_Ada_With_Private (Node);
-- when Ada_Abort_Node'First .. Ada_Abort_Node'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Abstract_Node'First .. Ada_Abstract_Node'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Ada_List'First .. Ada_Ada_List'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Aliased_Node'First .. Ada_Aliased_Node'Last =>
-- This.Add_Not_Implemented;
-- when Ada_All_Node'First .. Ada_All_Node'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Array_Indices'First .. Ada_Array_Indices'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Aspect_Assoc_Range'First .. Ada_Aspect_Assoc_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Aspect_Clause'First .. Ada_Aspect_Clause'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Aspect_Spec_Range'First .. Ada_Aspect_Spec_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Base_Assoc'First .. Ada_Base_Assoc'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Base_Formal_Param_Holder'First .. Ada_Base_Formal_Param_Holder'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Base_Record_Def'First .. Ada_Base_Record_Def'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Basic_Assoc'First .. Ada_Basic_Assoc'Last =>
-- This.Add_Not_Implemented;
-- Moved to top:
-- when Ada_Basic_Decl'First .. Ada_Basic_Decl'Last =>
-- when Ada_Case_Stmt_Alternative_Range'First .. Ada_Case_Stmt_Alternative_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Compilation_Unit_Range'First .. Ada_Compilation_Unit_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Component_Clause_Range'First .. Ada_Component_Clause_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Component_Def_Range'First .. Ada_Component_Def_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Constraint'First .. Ada_Constraint'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Constant_Node'First .. Ada_Constant_Node'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Declarative_Part_Range'First .. Ada_Declarative_Part_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Elsif_Expr_Part_Range'First .. Ada_Elsif_Expr_Part_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Elsif_Stmt_Part_Range'First .. Ada_Elsif_Stmt_Part_Range'Last =>
-- This.Add_Not_Implemented;
-- Moved to top:
-- when Ada_Expr'First .. Ada_Expr'Last =>
-- when Ada_Handled_Stmts_Range'First .. Ada_Handled_Stmts_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Interface_Kind'First .. Ada_Interface_Kind'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Iter_Type'First .. Ada_Iter_Type'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Library_Item_Range'First .. Ada_Library_Item_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Limited_Node'First .. Ada_Limited_Node'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Loop_Spec'First .. Ada_Loop_Spec'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Mode'First .. Ada_Mode'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Not_Null'First .. Ada_Not_Null'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Null_Component_Decl_Range'First .. Ada_Null_Component_Decl_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Others_Designator_Range'First .. Ada_Others_Designator_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Overriding_Node'First .. Ada_Overriding_Node'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Params_Range'First .. Ada_Params_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Pragma_Node_Range'First .. Ada_Pragma_Node_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Prim_Type_Accessor_Range'First .. Ada_Prim_Type_Accessor_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Private_Node'First .. Ada_Private_Node'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Protected_Node'First .. Ada_Protected_Node'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Protected_Def_Range'First .. Ada_Protected_Def_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Quantifier'First .. Ada_Quantifier'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Range_Spec_Range'First .. Ada_Range_Spec_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Renaming_Clause_Range'First .. Ada_Renaming_Clause_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Reverse_Node'First .. Ada_Reverse_Node'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Select_When_Part_Range'First .. Ada_Select_When_Part_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Subp_Kind'First .. Ada_Subp_Kind'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Subunit_Range'First .. Ada_Subunit_Range'Last =>
-- This.Add_Not_Implemented;
-- Moved to top:
-- when Ada_Stmt'First .. Ada_Stmt'Last =>
-- when Ada_Synchronized_Node'First .. Ada_Synchronized_Node'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Tagged_Node'First .. Ada_Tagged_Node'Last =>
-- This.Add_Not_Implemented;
-- Moved to top:
-- when Ada_Type_Def'First .. Ada_Type_Def'Last =>
-- when Ada_Task_Def_Range'First .. Ada_Task_Def_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Type_Expr'First .. Ada_Type_Expr'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Unconstrained_Array_Index_Range'First .. Ada_Unconstrained_Array_Index_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Until_Node'First .. Ada_Until_Node'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Use_Clause'First .. Ada_Use_Clause'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Variant_Range'First .. Ada_Variant_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_Variant_Part_Range'First .. Ada_Variant_Part_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_With_Clause_Range'First .. Ada_With_Clause_Range'Last =>
-- This.Add_Not_Implemented;
-- when Ada_With_Private'First .. Ada_With_Private'Last =>
-- This.Add_Not_Implemented;
end case;
Finish_Output;
-- end if;
exception
when X : External_Error | Internal_Error | Usage_Error =>
raise;
when X: others =>
Log_Exception (X);
Log ("No handler for this exception. Raising Internal_Error");
raise Internal_Error;
end Do_Pre_Child_Processing;
procedure Do_Post_Child_Processing
(This : in out Class) is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Do_Post_Child_Processing";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
begin -- Do_Post_Child_Processing
This.Outputs.Text.End_Line;
This.Outputs.Text.Dedent;
This.Outputs.Text.Put_Indented_Line
(String'("END " & To_String (This.Element_IDs.First_Element)));
This.Element_IDs.Delete_First;
exception
when X : External_Error | Internal_Error | Usage_Error =>
raise;
when X: others =>
Log_Exception (X);
Log ("No handler for this exception. Raising Internal_Error");
raise Internal_Error;
end Do_Post_Child_Processing;
------------
-- Exported:
------------
procedure Process
(This : in out Class;
Node : in LAL.Ada_Node'Class;
-- Options : in Options_Record;
Outputs : in Output_Accesses_Record)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process";
package Logging is new Generic_Logging (Module_Name); use Logging;
-- Auto : Logging.Auto_Logger; -- Logs BEGIN and END
begin
This.Outputs := Outputs;
Do_Pre_Child_Processing (This, Node);
Do_Post_Child_Processing (This);
end Process;
end Lal_Adapter.Node;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.