repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
godunko/adawebui | Ada | 3,776 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2016-2020, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision: 5703 $ $Date: 2017-01-20 22:17:20 +0300 (Fri, 20 Jan 2017) $
------------------------------------------------------------------------------
package body Web.Core.Connectables.Slots_0 is
---------------------
-- Create_Slot_End --
---------------------
not overriding function Create_Slot_End
(Self : Slot) return not null Slot_End_Access is
begin
raise Program_Error with "Slot.Create_Slot_End must be overrided";
return null;
end Create_Slot_End;
end Web.Core.Connectables.Slots_0;
|
gerr135/gnat_bugs | Ada | 510 | adb | --
-- a test unit.
--
-- 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.
--
with Ada.Text_IO; use Ada.Text_IO;
with lists.dynamic;
procedure run_gb_02 is
type TstType is new Integer;
package PL is new Lists(Natural, TstType);
package PLD is new PL.dynamic;
begin -- main
Null;
end run_gb_02;
|
Fabien-Chouteau/AGATE | Ada | 2,789 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017-2018, Fabien Chouteau --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with AGATE.Traces;
package body AGATE.API.Dynamic_Semaphore is
------------
-- Create --
------------
function Create
(Initial_Count : Semaphore_Count := 0;
Name : String)
return Semaphore_ID
is
Ret : constant Semaphore_ID := new Semaphore (Initial_Count);
begin
Traces.Register (Ret, Name);
return Ret;
end Create;
end AGATE.API.Dynamic_Semaphore;
|
Gabriel-Degret/adalib | Ada | 1,976 | ads | -- Standard Ada library specification
-- Copyright (c) 2003-2018 Maxim Reznik <[email protected]>
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
package Ada.Calendar is
type Time is private;
subtype Year_Number is Integer range 1901 .. 2399;
subtype Month_Number is Integer range 1 .. 12;
subtype Day_Number is Integer range 1 .. 31;
subtype Day_Duration is Duration range 0.0 .. 86_400.0;
function Clock return Time;
function Year (Date : Time) return Year_Number;
function Month (Date : Time) return Month_Number;
function Day (Date : Time) return Day_Number;
function Seconds(Date : Time) return Day_Duration;
procedure Split (Date : in Time;
Year : out Year_Number;
Month : out Month_Number;
Day : out Day_Number;
Seconds : out Day_Duration);
function Time_Of(Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Seconds : Day_Duration := 0.0)
return Time;
function "+" (Left : Time; Right : Duration) return Time;
function "+" (Left : Duration; Right : Time) return Time;
function "-" (Left : Time; Right : Duration) return Time;
function "-" (Left : Time; Right : Time) return Duration;
function "<" (Left, Right : Time) return Boolean;
function "<="(Left, Right : Time) return Boolean;
function ">" (Left, Right : Time) return Boolean;
function ">="(Left, Right : Time) return Boolean;
Time_Error : exception;
private
pragma Import (Ada, Time);
end Ada.Calendar;
|
stcarrez/dynamo | Ada | 315,675 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P R J . N M S C --
-- --
-- B o d y --
-- --
-- Copyright (C) 2000-2015, 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 Err_Vars; use Err_Vars;
with Opt; use Opt;
with Osint; use Osint;
with Output; use Output;
with Prj.Com;
with Prj.Env; use Prj.Env;
with Prj.Err; use Prj.Err;
with Prj.Tree; use Prj.Tree;
with Prj.Util; use Prj.Util;
with Sinput.P;
with Snames; use Snames;
with Ada; use Ada;
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Directories; use Ada.Directories;
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants;
with GNAT.Case_Util; use GNAT.Case_Util;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with GNAT.Dynamic_HTables;
with GNAT.Regexp; use GNAT.Regexp;
with GNAT.Table;
package body Prj.Nmsc is
function To_Lower (S : in String) return String
renames Ada.Characters.Handling.To_Lower;
No_Continuation_String : aliased String := "";
Continuation_String : aliased String := "\";
-- Used in Check_Library for continuation error messages at the same
-- location.
type Name_Location is record
Name : File_Name_Type;
-- Key is duplicated, so that it is known when using functions Get_First
-- and Get_Next, as these functions only return an Element.
Location : Source_Ptr;
Source : Source_Id := No_Source;
Listed : Boolean := False;
Found : Boolean := False;
end record;
No_Name_Location : constant Name_Location :=
(Name => No_File,
Location => No_Location,
Source => No_Source,
Listed => False,
Found => False);
package Source_Names_Htable is new GNAT.Dynamic_HTables.Simple_HTable
(Header_Num => Header_Num,
Element => Name_Location,
No_Element => No_Name_Location,
Key => File_Name_Type,
Hash => Hash,
Equal => "=");
-- File name information found in string list attribute (Source_Files or
-- Source_List_File). Used to check that all referenced files were indeed
-- found on the disk.
type Unit_Exception is record
Name : Name_Id;
-- Key is duplicated, so that it is known when using functions Get_First
-- and Get_Next, as these functions only return an Element.
Spec : File_Name_Type;
Impl : File_Name_Type;
end record;
No_Unit_Exception : constant Unit_Exception := (No_Name, No_File, No_File);
package Unit_Exceptions_Htable is new GNAT.Dynamic_HTables.Simple_HTable
(Header_Num => Header_Num,
Element => Unit_Exception,
No_Element => No_Unit_Exception,
Key => Name_Id,
Hash => Hash,
Equal => "=");
-- Record special naming schemes for Ada units (name of spec file and name
-- of implementation file). The elements in this list come from the naming
-- exceptions specified in the project files.
type File_Found is record
File : File_Name_Type := No_File;
Excl_File : File_Name_Type := No_File;
Excl_Line : Natural := 0;
Found : Boolean := False;
Location : Source_Ptr := No_Location;
end record;
No_File_Found : constant File_Found :=
(No_File, No_File, 0, False, No_Location);
package Excluded_Sources_Htable is new GNAT.Dynamic_HTables.Simple_HTable
(Header_Num => Header_Num,
Element => File_Found,
No_Element => No_File_Found,
Key => File_Name_Type,
Hash => Hash,
Equal => "=");
-- A hash table to store the base names of excluded files, if any
package Object_File_Names_Htable is new GNAT.Dynamic_HTables.Simple_HTable
(Header_Num => Header_Num,
Element => Source_Id,
No_Element => No_Source,
Key => File_Name_Type,
Hash => Hash,
Equal => "=");
-- A hash table to store the object file names for a project, to check that
-- two different sources have different object file names.
type Project_Processing_Data is record
Project : Project_Id;
Source_Names : Source_Names_Htable.Instance;
Unit_Exceptions : Unit_Exceptions_Htable.Instance;
Excluded : Excluded_Sources_Htable.Instance;
Source_List_File_Location : Source_Ptr;
-- Location of the Source_List_File attribute, for error messages
end record;
-- This is similar to Tree_Processing_Data, but contains project-specific
-- information which is only useful while processing the project, and can
-- be discarded as soon as we have finished processing the project
type Tree_Processing_Data is record
Tree : Project_Tree_Ref;
Node_Tree : Prj.Tree.Project_Node_Tree_Ref;
Flags : Prj.Processing_Flags;
In_Aggregate_Lib : Boolean;
end record;
-- Temporary data which is needed while parsing a project. It does not need
-- to be kept in memory once a project has been fully loaded, but is
-- necessary while performing consistency checks (duplicate sources,...)
-- This data must be initialized before processing any project, and the
-- same data is used for processing all projects in the tree.
type Lib_Data is record
Name : Name_Id;
Proj : Project_Id;
Tree : Project_Tree_Ref;
end record;
package Lib_Data_Table is new GNAT.Table
(Table_Component_Type => Lib_Data,
Table_Index_Type => Natural,
Table_Low_Bound => 1,
Table_Initial => 10,
Table_Increment => 100);
-- A table to record library names in order to check that two library
-- projects do not have the same library names.
procedure Initialize
(Data : out Tree_Processing_Data;
Tree : Project_Tree_Ref;
Node_Tree : Prj.Tree.Project_Node_Tree_Ref;
Flags : Prj.Processing_Flags);
-- Initialize Data
procedure Free (Data : in out Tree_Processing_Data);
-- Free the memory occupied by Data
procedure Initialize
(Data : in out Project_Processing_Data;
Project : Project_Id);
procedure Free (Data : in out Project_Processing_Data);
-- Initialize or free memory for a project-specific data
procedure Find_Excluded_Sources
(Project : in out Project_Processing_Data;
Data : in out Tree_Processing_Data);
-- Find the list of files that should not be considered as source files
-- for this project. Sets the list in the Project.Excluded_Sources_Htable.
procedure Override_Kind (Source : Source_Id; Kind : Source_Kind);
-- Override the reference kind for a source file. This properly updates
-- the unit data if necessary.
procedure Load_Naming_Exceptions
(Project : in out Project_Processing_Data;
Data : in out Tree_Processing_Data);
-- All source files in Data.First_Source are considered as naming
-- exceptions, and copied into the Source_Names and Unit_Exceptions tables
-- as appropriate.
type Search_Type is (Search_Files, Search_Directories);
generic
with procedure Callback
(Path : Path_Information;
Pattern_Index : Natural);
procedure Expand_Subdirectory_Pattern
(Project : Project_Id;
Data : in out Tree_Processing_Data;
Patterns : String_List_Id;
Ignore : String_List_Id;
Search_For : Search_Type;
Resolve_Links : Boolean);
-- Search the subdirectories of Project's directory for files or
-- directories that match the globbing patterns found in Patterns (for
-- instance "**/*.adb"). Typically, Patterns will be the value of the
-- Source_Dirs or Excluded_Source_Dirs attributes.
--
-- Every time such a file or directory is found, the callback is called.
-- Resolve_Links indicates whether we should resolve links while
-- normalizing names.
--
-- In the callback, Pattern_Index is the index within Patterns where the
-- expanded pattern was found (1 for the first element of Patterns and
-- all its matching directories, then 2,...).
--
-- We use a generic and not an access-to-subprogram because in some cases
-- this code is compiled with the restriction No_Implicit_Dynamic_Code.
-- An error message is raised if a pattern does not match any file.
procedure Add_Source
(Id : out Source_Id;
Data : in out Tree_Processing_Data;
Project : Project_Id;
Source_Dir_Rank : Natural;
Lang_Id : Language_Ptr;
Kind : Source_Kind;
File_Name : File_Name_Type;
Display_File : File_Name_Type;
Naming_Exception : Naming_Exception_Type := No;
Path : Path_Information := No_Path_Information;
Alternate_Languages : Language_List := null;
Unit : Name_Id := No_Name;
Index : Int := 0;
Locally_Removed : Boolean := False;
Location : Source_Ptr := No_Location);
-- Add a new source to the different lists: list of all sources in the
-- project tree, list of source of a project and list of sources of a
-- language. If Path is specified, the file is also added to
-- Source_Paths_HT. Location is used for error messages
function Canonical_Case_File_Name (Name : Name_Id) return File_Name_Type;
-- Same as Osint.Canonical_Case_File_Name but applies to Name_Id.
-- This alters Name_Buffer.
function Suffix_Matches
(Filename : String;
Suffix : File_Name_Type) return Boolean;
-- True if the file name ends with the given suffix. Always returns False
-- if Suffix is No_Name.
procedure Replace_Into_Name_Buffer
(Str : String;
Pattern : String;
Replacement : Character);
-- Copy Str into Name_Buffer, replacing Pattern with Replacement. Str is
-- converted to lower-case at the same time.
procedure Check_Abstract_Project
(Project : Project_Id;
Data : in out Tree_Processing_Data);
-- Check abstract projects attributes
procedure Check_Configuration
(Project : Project_Id;
Data : in out Tree_Processing_Data);
-- Check the configuration attributes for the project
procedure Check_If_Externally_Built
(Project : Project_Id;
Data : in out Tree_Processing_Data);
-- Check attribute Externally_Built of project Project in project tree
-- Data.Tree and modify its data Data if it has the value "true".
procedure Check_Interfaces
(Project : Project_Id;
Data : in out Tree_Processing_Data);
-- If a list of sources is specified in attribute Interfaces, set
-- In_Interfaces only for the sources specified in the list.
procedure Check_Library_Attributes
(Project : Project_Id;
Data : in out Tree_Processing_Data);
-- Check the library attributes of project Project in project tree
-- and modify its data Data accordingly.
procedure Check_Package_Naming
(Project : Project_Id;
Data : in out Tree_Processing_Data);
-- Check the naming scheme part of Data, and initialize the naming scheme
-- data in the config of the various languages.
procedure Check_Programming_Languages
(Project : Project_Id;
Data : in out Tree_Processing_Data);
-- Check attribute Languages for the project with data Data in project
-- tree Data.Tree and set the components of Data for all the programming
-- languages indicated in attribute Languages, if any.
procedure Check_Stand_Alone_Library
(Project : Project_Id;
Data : in out Tree_Processing_Data);
-- Check if project Project in project tree Data.Tree is a Stand-Alone
-- Library project, and modify its data Data accordingly if it is one.
procedure Check_Unit_Name (Name : String; Unit : out Name_Id);
-- Check that a name is a valid unit name
function Compute_Directory_Last (Dir : String) return Natural;
-- Return the index of the last significant character in Dir. This is used
-- to avoid duplicate '/' (slash) characters at the end of directory names.
procedure Search_Directories
(Project : in out Project_Processing_Data;
Data : in out Tree_Processing_Data;
For_All_Sources : Boolean);
-- Search the source directories to find the sources. If For_All_Sources is
-- True, check each regular file name against the naming schemes of the
-- various languages. Otherwise consider only the file names in hash table
-- Source_Names. If Allow_Duplicate_Basenames then files with identical
-- base names are permitted within a project for source-based languages
-- (never for unit based languages).
procedure Check_File
(Project : in out Project_Processing_Data;
Data : in out Tree_Processing_Data;
Source_Dir_Rank : Natural;
Path : Path_Name_Type;
Display_Path : Path_Name_Type;
File_Name : File_Name_Type;
Display_File_Name : File_Name_Type;
Locally_Removed : Boolean;
For_All_Sources : Boolean);
-- Check if file File_Name is a valid source of the project. This is used
-- in multi-language mode only. When the file matches one of the naming
-- schemes, it is added to various htables through Add_Source and to
-- Source_Paths_Htable.
--
-- File_Name is the same as Display_File_Name, but has been normalized.
-- They do not include the directory information.
--
-- Path and Display_Path on the other hand are the full path to the file.
-- Path must have been normalized (canonical casing and possibly links
-- resolved).
--
-- Source_Directory is the directory in which the file was found. It is
-- neither normalized nor has had links resolved, and must not end with a
-- a directory separator, to avoid duplicates later on.
--
-- If For_All_Sources is True, then all possible file names are analyzed
-- otherwise only those currently set in the Source_Names hash table.
procedure Check_File_Naming_Schemes
(Project : Project_Processing_Data;
File_Name : File_Name_Type;
Alternate_Languages : out Language_List;
Language : out Language_Ptr;
Display_Language_Name : out Name_Id;
Unit : out Name_Id;
Lang_Kind : out Language_Kind;
Kind : out Source_Kind);
-- Check if the file name File_Name conforms to one of the naming schemes
-- of the project. If the file does not match one of the naming schemes,
-- set Language to No_Language_Index. Filename is the name of the file
-- being investigated. It has been normalized (case-folded). File_Name is
-- the same value.
procedure Get_Directories
(Project : Project_Id;
Data : in out Tree_Processing_Data);
-- Get the object directory, the exec directory and the source directories
-- of a project.
procedure Get_Mains
(Project : Project_Id;
Data : in out Tree_Processing_Data);
-- Get the mains of a project from attribute Main, if it exists, and put
-- them in the project data.
procedure Get_Sources_From_File
(Path : String;
Location : Source_Ptr;
Project : in out Project_Processing_Data;
Data : in out Tree_Processing_Data);
-- Get the list of sources from a text file and put them in hash table
-- Source_Names.
procedure Find_Sources
(Project : in out Project_Processing_Data;
Data : in out Tree_Processing_Data);
-- Process the Source_Files and Source_List_File attributes, and store the
-- list of source files into the Source_Names htable. When these attributes
-- are not defined, find all files matching the naming schemes in the
-- source directories. If Allow_Duplicate_Basenames, then files with the
-- same base names are authorized within a project for source-based
-- languages (never for unit based languages)
procedure Compute_Unit_Name
(File_Name : File_Name_Type;
Naming : Lang_Naming_Data;
Kind : out Source_Kind;
Unit : out Name_Id;
Project : Project_Processing_Data);
-- Check whether the file matches the naming scheme. If it does,
-- compute its unit name. If Unit is set to No_Name on exit, none of the
-- other out parameters are relevant.
procedure Check_Illegal_Suffix
(Project : Project_Id;
Suffix : File_Name_Type;
Dot_Replacement : File_Name_Type;
Attribute_Name : String;
Location : Source_Ptr;
Data : in out Tree_Processing_Data);
-- Display an error message if the given suffix is illegal for some reason.
-- The name of the attribute we are testing is specified in Attribute_Name,
-- which is used in the error message. Location is the location where the
-- suffix is defined.
procedure Locate_Directory
(Project : Project_Id;
Name : File_Name_Type;
Path : out Path_Information;
Dir_Exists : out Boolean;
Data : in out Tree_Processing_Data;
Create : String := "";
Location : Source_Ptr := No_Location;
Must_Exist : Boolean := True;
Externally_Built : Boolean := False);
-- Locate a directory. Name is the directory name. Relative paths are
-- resolved relative to the project's directory. If the directory does not
-- exist and Setup_Projects is True and Create is a non null string, an
-- attempt is made to create the directory. If the directory does not
-- exist, it is either created if Setup_Projects is False (and then
-- returned), or simply returned without checking for its existence (if
-- Must_Exist is False) or No_Path_Information is returned. In all cases,
-- Dir_Exists indicates whether the directory now exists. Create is also
-- used for debugging traces to show which path we are computing.
procedure Look_For_Sources
(Project : in out Project_Processing_Data;
Data : in out Tree_Processing_Data);
-- Find all the sources of project Project in project tree Data.Tree and
-- update its Data accordingly. This assumes that the special naming
-- exceptions have already been processed.
function Path_Name_Of
(File_Name : File_Name_Type;
Directory : Path_Name_Type) return String;
-- Returns the path name of a (non project) file. Returns an empty string
-- if file cannot be found.
procedure Remove_Source
(Tree : Project_Tree_Ref;
Id : Source_Id;
Replaced_By : Source_Id);
-- Remove a file from the list of sources of a project. This might be
-- because the file is replaced by another one in an extending project,
-- or because a file was added as a naming exception but was not found
-- in the end.
procedure Report_No_Sources
(Project : Project_Id;
Lang_Name : String;
Data : Tree_Processing_Data;
Location : Source_Ptr;
Continuation : Boolean := False);
-- Report an error or a warning depending on the value of When_No_Sources
-- when there are no sources for language Lang_Name.
procedure Show_Source_Dirs
(Project : Project_Id;
Shared : Shared_Project_Tree_Data_Access);
-- List all the source directories of a project
procedure Write_Attr (Name, Value : String);
-- Debug print a value for a specific property. Does nothing when not in
-- debug mode
procedure Error_Or_Warning
(Flags : Processing_Flags;
Kind : Error_Warning;
Msg : String;
Location : Source_Ptr;
Project : Project_Id);
-- Emits either an error or warning message (or nothing), depending on Kind
function No_Space_Img (N : Natural) return String;
-- Image of a Natural without the initial space
----------------------
-- Error_Or_Warning --
----------------------
procedure Error_Or_Warning
(Flags : Processing_Flags;
Kind : Error_Warning;
Msg : String;
Location : Source_Ptr;
Project : Project_Id) is
begin
case Kind is
when Error => Error_Msg (Flags, Msg, Location, Project);
when Warning => Error_Msg (Flags, "?" & Msg, Location, Project);
when Silent => null;
end case;
end Error_Or_Warning;
------------------------------
-- Replace_Into_Name_Buffer --
------------------------------
procedure Replace_Into_Name_Buffer
(Str : String;
Pattern : String;
Replacement : Character)
is
Max : constant Integer := Str'Last - Pattern'Length + 1;
J : Positive;
begin
Name_Len := 0;
J := Str'First;
while J <= Str'Last loop
Name_Len := Name_Len + 1;
if J <= Max and then Str (J .. J + Pattern'Length - 1) = Pattern then
Name_Buffer (Name_Len) := Replacement;
J := J + Pattern'Length;
else
Name_Buffer (Name_Len) := GNAT.Case_Util.To_Lower (Str (J));
J := J + 1;
end if;
end loop;
end Replace_Into_Name_Buffer;
--------------------
-- Suffix_Matches --
--------------------
function Suffix_Matches
(Filename : String;
Suffix : File_Name_Type) return Boolean
is
Min_Prefix_Length : Natural := 0;
begin
if Suffix = No_File or else Suffix = Empty_File then
return False;
end if;
declare
Suf : String := Get_Name_String (Suffix);
begin
-- On non case-sensitive systems, use proper suffix casing
Canonical_Case_File_Name (Suf);
-- The file name must end with the suffix (which is not an extension)
-- For instance a suffix "configure.in" must match a file with the
-- same name. To avoid dummy cases, though, a suffix starting with
-- '.' requires a file that is at least one character longer ('.cpp'
-- should not match a file with the same name).
if Suf (Suf'First) = '.' then
Min_Prefix_Length := 1;
end if;
return Filename'Length >= Suf'Length + Min_Prefix_Length
and then
Filename (Filename'Last - Suf'Length + 1 .. Filename'Last) = Suf;
end;
end Suffix_Matches;
----------------
-- Write_Attr --
----------------
procedure Write_Attr (Name, Value : String) is
begin
if Current_Verbosity = High then
Debug_Output (Name & " = """ & Value & '"');
end if;
end Write_Attr;
----------------
-- Add_Source --
----------------
procedure Add_Source
(Id : out Source_Id;
Data : in out Tree_Processing_Data;
Project : Project_Id;
Source_Dir_Rank : Natural;
Lang_Id : Language_Ptr;
Kind : Source_Kind;
File_Name : File_Name_Type;
Display_File : File_Name_Type;
Naming_Exception : Naming_Exception_Type := No;
Path : Path_Information := No_Path_Information;
Alternate_Languages : Language_List := null;
Unit : Name_Id := No_Name;
Index : Int := 0;
Locally_Removed : Boolean := False;
Location : Source_Ptr := No_Location)
is
Config : constant Language_Config := Lang_Id.Config;
UData : Unit_Index;
Add_Src : Boolean;
Source : Source_Id;
Prev_Unit : Unit_Index := No_Unit_Index;
Source_To_Replace : Source_Id := No_Source;
begin
-- Check if the same file name or unit is used in the prj tree
Add_Src := True;
if Unit /= No_Name then
Prev_Unit := Units_Htable.Get (Data.Tree.Units_HT, Unit);
end if;
if Prev_Unit /= No_Unit_Index
and then (Kind = Impl or else Kind = Spec)
and then Prev_Unit.File_Names (Kind) /= null
then
-- Suspicious, we need to check later whether this is authorized
Add_Src := False;
Source := Prev_Unit.File_Names (Kind);
else
Source := Source_Files_Htable.Get
(Data.Tree.Source_Files_HT, File_Name);
if Source /= No_Source and then Source.Index = Index then
Add_Src := False;
end if;
end if;
-- Always add the source if it is locally removed, to avoid incorrect
-- duplicate checks.
if Locally_Removed then
Add_Src := True;
-- A locally removed source may first replace a source in a project
-- being extended.
if Source /= No_Source
and then Is_Extending (Project, Source.Project)
and then Naming_Exception /= Inherited
then
Source_To_Replace := Source;
end if;
else
-- Duplication of file/unit in same project is allowed if order of
-- source directories is known, or if there is no compiler for the
-- language.
if Add_Src = False then
Add_Src := True;
if Project = Source.Project then
if Prev_Unit = No_Unit_Index then
if Data.Flags.Allow_Duplicate_Basenames then
Add_Src := True;
elsif Lang_Id.Config.Compiler_Driver = Empty_File then
Add_Src := True;
elsif Source_Dir_Rank /= Source.Source_Dir_Rank then
Add_Src := False;
else
Error_Msg_File_1 := File_Name;
Error_Msg
(Data.Flags, "duplicate source file name {",
Location, Project);
Add_Src := False;
end if;
else
if Source_Dir_Rank /= Source.Source_Dir_Rank then
Add_Src := False;
-- We might be seeing the same file through a different
-- path (for instance because of symbolic links).
elsif Source.Path.Name /= Path.Name then
if not Source.Duplicate_Unit then
Error_Msg_Name_1 := Unit;
Error_Msg
(Data.Flags,
"\duplicate unit %%",
Location,
Project);
Source.Duplicate_Unit := True;
end if;
Add_Src := False;
end if;
end if;
-- Do not allow the same unit name in different projects,
-- except if one is extending the other.
-- For a file based language, the same file name replaces a
-- file in a project being extended, but it is allowed to have
-- the same file name in unrelated projects.
elsif Is_Extending (Project, Source.Project) then
if not Locally_Removed and then Naming_Exception /= Inherited
then
Source_To_Replace := Source;
end if;
elsif Prev_Unit /= No_Unit_Index
and then Prev_Unit.File_Names (Kind) /= null
and then not Source.Locally_Removed
and then Source.Replaced_By = No_Source
and then not Data.In_Aggregate_Lib
then
-- Path is set if this is a source we found on the disk, in
-- which case we can provide more explicit error message. Path
-- is unset when the source is added from one of the naming
-- exceptions in the project.
if Path /= No_Path_Information then
Error_Msg_Name_1 := Unit;
Error_Msg
(Data.Flags,
"unit %% cannot belong to several projects",
Location, Project);
Error_Msg_Name_1 := Project.Name;
Error_Msg_Name_2 := Name_Id (Path.Display_Name);
Error_Msg
(Data.Flags, "\ project %%, %%", Location, Project);
Error_Msg_Name_1 := Source.Project.Name;
Error_Msg_Name_2 := Name_Id (Source.Path.Display_Name);
Error_Msg
(Data.Flags, "\ project %%, %%", Location, Project);
else
Error_Msg_Name_1 := Unit;
Error_Msg_Name_2 := Source.Project.Name;
Error_Msg
(Data.Flags, "unit %% already belongs to project %%",
Location, Project);
end if;
Add_Src := False;
elsif not Source.Locally_Removed
and then Source.Replaced_By /= No_Source
and then not Data.Flags.Allow_Duplicate_Basenames
and then Lang_Id.Config.Kind = Unit_Based
and then Source.Language.Config.Kind = Unit_Based
and then not Data.In_Aggregate_Lib
then
Error_Msg_File_1 := File_Name;
Error_Msg_File_2 := File_Name_Type (Source.Project.Name);
Error_Msg
(Data.Flags,
"{ is already a source of project {", Location, Project);
-- Add the file anyway, to avoid further warnings like
-- "language unknown".
Add_Src := True;
end if;
end if;
end if;
if not Add_Src then
return;
end if;
-- Add the new file
Id := new Source_Data;
if Current_Verbosity = High then
Debug_Indent;
Write_Str ("adding source File: ");
Write_Str (Get_Name_String (Display_File));
if Index /= 0 then
Write_Str (" at" & Index'Img);
end if;
if Lang_Id.Config.Kind = Unit_Based then
Write_Str (" Unit: ");
-- ??? in gprclean, it seems we sometimes pass an empty Unit name
-- (see test extended_projects).
if Unit /= No_Name then
Write_Str (Get_Name_String (Unit));
end if;
Write_Str (" Kind: ");
Write_Str (Source_Kind'Image (Kind));
end if;
Write_Eol;
end if;
Id.Project := Project;
Id.Location := Location;
Id.Source_Dir_Rank := Source_Dir_Rank;
Id.Language := Lang_Id;
Id.Kind := Kind;
Id.Alternate_Languages := Alternate_Languages;
Id.Locally_Removed := Locally_Removed;
Id.Index := Index;
Id.File := File_Name;
Id.Display_File := Display_File;
Id.Dep_Name := Dependency_Name
(File_Name, Lang_Id.Config.Dependency_Kind);
Id.Naming_Exception := Naming_Exception;
Id.Object := Object_Name
(File_Name, Config.Object_File_Suffix);
Id.Switches := Switches_Name (File_Name);
-- Add the source id to the Unit_Sources_HT hash table, if the unit name
-- is not null.
if Unit /= No_Name then
-- Note: we might be creating a dummy unit here, when we in fact have
-- a separate. For instance, file file-bar.adb will initially be
-- assumed to be the IMPL of unit "file.bar". Only later on (in
-- Check_Object_Files) will we parse those units that only have an
-- impl and no spec to make sure whether we have a Separate in fact
-- (that significantly reduces the number of times we need to parse
-- the files, since we are then only interested in those with no
-- spec). We still need those dummy units in the table, since that's
-- the name we find in the ALI file
UData := Units_Htable.Get (Data.Tree.Units_HT, Unit);
if UData = No_Unit_Index then
UData := new Unit_Data;
UData.Name := Unit;
if Naming_Exception /= Inherited then
Units_Htable.Set (Data.Tree.Units_HT, Unit, UData);
end if;
end if;
Id.Unit := UData;
-- Note that this updates Unit information as well
if Naming_Exception /= Inherited and then not Locally_Removed then
Override_Kind (Id, Kind);
end if;
end if;
if Path /= No_Path_Information then
Id.Path := Path;
Source_Paths_Htable.Set (Data.Tree.Source_Paths_HT, Path.Name, Id);
end if;
Id.Next_With_File_Name :=
Source_Files_Htable.Get (Data.Tree.Source_Files_HT, File_Name);
Source_Files_Htable.Set (Data.Tree.Source_Files_HT, File_Name, Id);
if Index /= 0 then
Project.Has_Multi_Unit_Sources := True;
end if;
-- Add the source to the language list
Id.Next_In_Lang := Lang_Id.First_Source;
Lang_Id.First_Source := Id;
if Source_To_Replace /= No_Source then
Remove_Source (Data.Tree, Source_To_Replace, Id);
end if;
if Data.Tree.Replaced_Source_Number > 0
and then
Replaced_Source_HTable.Get
(Data.Tree.Replaced_Sources, Id.File) /= No_File
then
Replaced_Source_HTable.Remove (Data.Tree.Replaced_Sources, Id.File);
Data.Tree.Replaced_Source_Number :=
Data.Tree.Replaced_Source_Number - 1;
end if;
end Add_Source;
------------------------------
-- Canonical_Case_File_Name --
------------------------------
function Canonical_Case_File_Name (Name : Name_Id) return File_Name_Type is
begin
if Osint.File_Names_Case_Sensitive then
return File_Name_Type (Name);
else
Get_Name_String (Name);
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
return Name_Find;
end if;
end Canonical_Case_File_Name;
---------------------------------
-- Process_Aggregated_Projects --
---------------------------------
procedure Process_Aggregated_Projects
(Tree : Project_Tree_Ref;
Project : Project_Id;
Node_Tree : Prj.Tree.Project_Node_Tree_Ref;
Flags : Processing_Flags)
is
Data : Tree_Processing_Data :=
(Tree => Tree,
Node_Tree => Node_Tree,
Flags => Flags,
In_Aggregate_Lib => False);
Project_Files : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Project_Files,
Project.Decl.Attributes,
Tree.Shared);
Project_Path_For_Aggregate : Prj.Env.Project_Search_Path;
procedure Found_Project_File (Path : Path_Information; Rank : Natural);
-- Called for each project file aggregated by Project
procedure Expand_Project_Files is
new Expand_Subdirectory_Pattern (Callback => Found_Project_File);
-- Search for all project files referenced by the patterns given in
-- parameter. Calls Found_Project_File for each of them.
------------------------
-- Found_Project_File --
------------------------
procedure Found_Project_File (Path : Path_Information; Rank : Natural) is
pragma Unreferenced (Rank);
begin
if Path.Name /= Project.Path.Name then
Debug_Output ("aggregates: ", Name_Id (Path.Display_Name));
-- For usual "with" statement, this phase will have been done when
-- parsing the project itself. However, for aggregate projects, we
-- can only do this when processing the aggregate project, since
-- the exact list of project files or project directories can
-- depend on scenario variables.
--
-- We only load the projects explicitly here, but do not process
-- them. For the processing, Prj.Proc will take care of processing
-- them, within the same call to Recursive_Process (thus avoiding
-- the processing of a given project multiple times).
--
-- ??? We might already have loaded the project
Add_Aggregated_Project (Project, Path => Path.Name);
else
Debug_Output ("pattern returned the aggregate itself, ignored");
end if;
end Found_Project_File;
-- Start of processing for Check_Aggregate_Project
begin
pragma Assert (Project.Qualifier in Aggregate_Project);
if Project_Files.Default then
Error_Msg_Name_1 := Snames.Name_Project_Files;
Error_Msg
(Flags,
"Attribute %% must be specified in aggregate project",
Project.Location, Project);
return;
end if;
-- The aggregated projects are only searched relative to the directory
-- of the aggregate project, not in the default project path.
Initialize_Empty (Project_Path_For_Aggregate);
Free (Project.Aggregated_Projects);
-- Look for aggregated projects. For similarity with source files and
-- dirs, the aggregated project files are not searched for on the
-- project path, and are only found through the path specified in
-- the Project_Files attribute.
Expand_Project_Files
(Project => Project,
Data => Data,
Patterns => Project_Files.Values,
Ignore => Nil_String,
Search_For => Search_Files,
Resolve_Links => Opt.Follow_Links_For_Files);
Free (Project_Path_For_Aggregate);
end Process_Aggregated_Projects;
----------------------------
-- Check_Abstract_Project --
----------------------------
procedure Check_Abstract_Project
(Project : Project_Id;
Data : in out Tree_Processing_Data)
is
Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared;
Source_Dirs : constant Variable_Value :=
Util.Value_Of
(Name_Source_Dirs,
Project.Decl.Attributes, Shared);
Source_Files : constant Variable_Value :=
Util.Value_Of
(Name_Source_Files,
Project.Decl.Attributes, Shared);
Source_List_File : constant Variable_Value :=
Util.Value_Of
(Name_Source_List_File,
Project.Decl.Attributes, Shared);
Languages : constant Variable_Value :=
Util.Value_Of
(Name_Languages,
Project.Decl.Attributes, Shared);
begin
if Project.Source_Dirs /= Nil_String then
if Source_Dirs.Values = Nil_String
and then Source_Files.Values = Nil_String
and then Languages.Values = Nil_String
and then Source_List_File.Default
then
Project.Source_Dirs := Nil_String;
else
Error_Msg
(Data.Flags,
"at least one of Source_Files, Source_Dirs or Languages "
& "must be declared empty for an abstract project",
Project.Location, Project);
end if;
end if;
end Check_Abstract_Project;
-------------------------
-- Check_Configuration --
-------------------------
procedure Check_Configuration
(Project : Project_Id;
Data : in out Tree_Processing_Data)
is
Shared : constant Shared_Project_Tree_Data_Access :=
Data.Tree.Shared;
Dot_Replacement : File_Name_Type := No_File;
Casing : Casing_Type := All_Lower_Case;
Separate_Suffix : File_Name_Type := No_File;
Lang_Index : Language_Ptr := No_Language_Index;
-- The index of the language data being checked
Prev_Index : Language_Ptr := No_Language_Index;
-- The index of the previous language
procedure Process_Project_Level_Simple_Attributes;
-- Process the simple attributes at the project level
procedure Process_Project_Level_Array_Attributes;
-- Process the associate array attributes at the project level
procedure Process_Packages;
-- Read the packages of the project
----------------------
-- Process_Packages --
----------------------
procedure Process_Packages is
Packages : Package_Id;
Element : Package_Element;
procedure Process_Binder (Arrays : Array_Id);
-- Process the associated array attributes of package Binder
procedure Process_Builder (Attributes : Variable_Id);
-- Process the simple attributes of package Builder
procedure Process_Clean (Attributes : Variable_Id);
-- Process the simple attributes of package Clean
procedure Process_Clean (Arrays : Array_Id);
-- Process the associated array attributes of package Clean
procedure Process_Compiler (Arrays : Array_Id);
-- Process the associated array attributes of package Compiler
procedure Process_Naming (Attributes : Variable_Id);
-- Process the simple attributes of package Naming
procedure Process_Naming (Arrays : Array_Id);
-- Process the associated array attributes of package Naming
procedure Process_Linker (Attributes : Variable_Id);
-- Process the simple attributes of package Linker of a
-- configuration project.
--------------------
-- Process_Binder --
--------------------
procedure Process_Binder (Arrays : Array_Id) is
Current_Array_Id : Array_Id;
Current_Array : Array_Data;
Element_Id : Array_Element_Id;
Element : Array_Element;
begin
-- Process the associative array attribute of package Binder
Current_Array_Id := Arrays;
while Current_Array_Id /= No_Array loop
Current_Array := Shared.Arrays.Table (Current_Array_Id);
Element_Id := Current_Array.Value;
while Element_Id /= No_Array_Element loop
Element := Shared.Array_Elements.Table (Element_Id);
if Element.Index /= All_Other_Names then
-- Get the name of the language
Lang_Index :=
Get_Language_From_Name
(Project, Get_Name_String (Element.Index));
if Lang_Index /= No_Language_Index then
case Current_Array.Name is
when Name_Driver =>
-- Attribute Driver (<language>)
Lang_Index.Config.Binder_Driver :=
File_Name_Type (Element.Value.Value);
when Name_Required_Switches =>
Put
(Into_List =>
Lang_Index.Config.Binder_Required_Switches,
From_List => Element.Value.Values,
In_Tree => Data.Tree);
when Name_Prefix =>
-- Attribute Prefix (<language>)
Lang_Index.Config.Binder_Prefix :=
Element.Value.Value;
when Name_Objects_Path =>
-- Attribute Objects_Path (<language>)
Lang_Index.Config.Objects_Path :=
Element.Value.Value;
when Name_Objects_Path_File =>
-- Attribute Objects_Path (<language>)
Lang_Index.Config.Objects_Path_File :=
Element.Value.Value;
when others =>
null;
end case;
end if;
end if;
Element_Id := Element.Next;
end loop;
Current_Array_Id := Current_Array.Next;
end loop;
end Process_Binder;
---------------------
-- Process_Builder --
---------------------
procedure Process_Builder (Attributes : Variable_Id) is
Attribute_Id : Variable_Id;
Attribute : Variable;
begin
-- Process non associated array attribute from package Builder
Attribute_Id := Attributes;
while Attribute_Id /= No_Variable loop
Attribute := Shared.Variable_Elements.Table (Attribute_Id);
if not Attribute.Value.Default then
if Attribute.Name = Name_Executable_Suffix then
-- Attribute Executable_Suffix: the suffix of the
-- executables.
Project.Config.Executable_Suffix :=
Attribute.Value.Value;
end if;
end if;
Attribute_Id := Attribute.Next;
end loop;
end Process_Builder;
-------------------
-- Process_Clean --
-------------------
procedure Process_Clean (Attributes : Variable_Id) is
Attribute_Id : Variable_Id;
Attribute : Variable;
List : String_List_Id;
begin
-- Process non associated array attributes from package Clean
Attribute_Id := Attributes;
while Attribute_Id /= No_Variable loop
Attribute := Shared.Variable_Elements.Table (Attribute_Id);
if not Attribute.Value.Default then
if Attribute.Name = Name_Artifacts_In_Exec_Dir then
-- Attribute Artifacts_In_Exec_Dir: the list of file
-- names to be cleaned in the exec dir of the main
-- project.
List := Attribute.Value.Values;
if List /= Nil_String then
Put (Into_List =>
Project.Config.Artifacts_In_Exec_Dir,
From_List => List,
In_Tree => Data.Tree);
end if;
elsif Attribute.Name = Name_Artifacts_In_Object_Dir then
-- Attribute Artifacts_In_Exec_Dir: the list of file
-- names to be cleaned in the object dir of every
-- project.
List := Attribute.Value.Values;
if List /= Nil_String then
Put (Into_List =>
Project.Config.Artifacts_In_Object_Dir,
From_List => List,
In_Tree => Data.Tree);
end if;
end if;
end if;
Attribute_Id := Attribute.Next;
end loop;
end Process_Clean;
procedure Process_Clean (Arrays : Array_Id) is
Current_Array_Id : Array_Id;
Current_Array : Array_Data;
Element_Id : Array_Element_Id;
Element : Array_Element;
List : String_List_Id;
begin
-- Process the associated array attributes of package Clean
Current_Array_Id := Arrays;
while Current_Array_Id /= No_Array loop
Current_Array := Shared.Arrays.Table (Current_Array_Id);
Element_Id := Current_Array.Value;
while Element_Id /= No_Array_Element loop
Element := Shared.Array_Elements.Table (Element_Id);
-- Get the name of the language
Lang_Index :=
Get_Language_From_Name
(Project, Get_Name_String (Element.Index));
if Lang_Index /= No_Language_Index then
case Current_Array.Name is
-- Attribute Object_Artifact_Extensions (<language>)
when Name_Object_Artifact_Extensions =>
List := Element.Value.Values;
if List /= Nil_String then
Put (Into_List =>
Lang_Index.Config.Clean_Object_Artifacts,
From_List => List,
In_Tree => Data.Tree);
end if;
-- Attribute Source_Artifact_Extensions (<language>)
when Name_Source_Artifact_Extensions =>
List := Element.Value.Values;
if List /= Nil_String then
Put (Into_List =>
Lang_Index.Config.Clean_Source_Artifacts,
From_List => List,
In_Tree => Data.Tree);
end if;
when others =>
null;
end case;
end if;
Element_Id := Element.Next;
end loop;
Current_Array_Id := Current_Array.Next;
end loop;
end Process_Clean;
----------------------
-- Process_Compiler --
----------------------
procedure Process_Compiler (Arrays : Array_Id) is
Current_Array_Id : Array_Id;
Current_Array : Array_Data;
Element_Id : Array_Element_Id;
Element : Array_Element;
List : String_List_Id;
begin
-- Process the associative array attribute of package Compiler
Current_Array_Id := Arrays;
while Current_Array_Id /= No_Array loop
Current_Array := Shared.Arrays.Table (Current_Array_Id);
Element_Id := Current_Array.Value;
while Element_Id /= No_Array_Element loop
Element := Shared.Array_Elements.Table (Element_Id);
if Element.Index /= All_Other_Names then
-- Get the name of the language
Lang_Index := Get_Language_From_Name
(Project, Get_Name_String (Element.Index));
if Lang_Index /= No_Language_Index then
case Current_Array.Name is
-- Attribute Dependency_Kind (<language>)
when Name_Dependency_Kind =>
Get_Name_String (Element.Value.Value);
begin
Lang_Index.Config.Dependency_Kind :=
Dependency_File_Kind'Value
(Name_Buffer (1 .. Name_Len));
exception
when Constraint_Error =>
Error_Msg
(Data.Flags,
"illegal value for Dependency_Kind",
Element.Value.Location,
Project);
end;
-- Attribute Dependency_Switches (<language>)
when Name_Dependency_Switches =>
if Lang_Index.Config.Dependency_Kind = None then
Lang_Index.Config.Dependency_Kind := Makefile;
end if;
List := Element.Value.Values;
if List /= Nil_String then
Put (Into_List =>
Lang_Index.Config.Dependency_Option,
From_List => List,
In_Tree => Data.Tree);
end if;
-- Attribute Dependency_Driver (<language>)
when Name_Dependency_Driver =>
if Lang_Index.Config.Dependency_Kind = None then
Lang_Index.Config.Dependency_Kind := Makefile;
end if;
List := Element.Value.Values;
if List /= Nil_String then
Put (Into_List =>
Lang_Index.Config.Compute_Dependency,
From_List => List,
In_Tree => Data.Tree);
end if;
-- Attribute Language_Kind (<language>)
when Name_Language_Kind =>
Get_Name_String (Element.Value.Value);
begin
Lang_Index.Config.Kind :=
Language_Kind'Value
(Name_Buffer (1 .. Name_Len));
exception
when Constraint_Error =>
Error_Msg
(Data.Flags,
"illegal value for Language_Kind",
Element.Value.Location,
Project);
end;
-- Attribute Include_Switches (<language>)
when Name_Include_Switches =>
List := Element.Value.Values;
if List = Nil_String then
Error_Msg
(Data.Flags, "include option cannot be null",
Element.Value.Location, Project);
end if;
Put (Into_List => Lang_Index.Config.Include_Option,
From_List => List,
In_Tree => Data.Tree);
-- Attribute Include_Path (<language>)
when Name_Include_Path =>
Lang_Index.Config.Include_Path :=
Element.Value.Value;
-- Attribute Include_Path_File (<language>)
when Name_Include_Path_File =>
Lang_Index.Config.Include_Path_File :=
Element.Value.Value;
-- Attribute Driver (<language>)
when Name_Driver =>
Lang_Index.Config.Compiler_Driver :=
File_Name_Type (Element.Value.Value);
when Name_Required_Switches
| Name_Leading_Required_Switches
=>
Put (Into_List =>
Lang_Index.Config.
Compiler_Leading_Required_Switches,
From_List => Element.Value.Values,
In_Tree => Data.Tree);
when Name_Trailing_Required_Switches =>
Put (Into_List =>
Lang_Index.Config.
Compiler_Trailing_Required_Switches,
From_List => Element.Value.Values,
In_Tree => Data.Tree);
when Name_Multi_Unit_Switches =>
Put (Into_List =>
Lang_Index.Config.Multi_Unit_Switches,
From_List => Element.Value.Values,
In_Tree => Data.Tree);
when Name_Multi_Unit_Object_Separator =>
Get_Name_String (Element.Value.Value);
if Name_Len /= 1 then
Error_Msg
(Data.Flags,
"multi-unit object separator must have " &
"a single character",
Element.Value.Location, Project);
elsif Name_Buffer (1) = ' ' then
Error_Msg
(Data.Flags,
"multi-unit object separator cannot be " &
"a space",
Element.Value.Location, Project);
else
Lang_Index.Config.Multi_Unit_Object_Separator :=
Name_Buffer (1);
end if;
when Name_Path_Syntax =>
begin
Lang_Index.Config.Path_Syntax :=
Path_Syntax_Kind'Value
(Get_Name_String (Element.Value.Value));
exception
when Constraint_Error =>
Error_Msg
(Data.Flags,
"invalid value for Path_Syntax",
Element.Value.Location, Project);
end;
when Name_Source_File_Switches =>
Put (Into_List =>
Lang_Index.Config.Source_File_Switches,
From_List => Element.Value.Values,
In_Tree => Data.Tree);
when Name_Object_File_Suffix =>
if Get_Name_String (Element.Value.Value) = "" then
Error_Msg
(Data.Flags,
"object file suffix cannot be empty",
Element.Value.Location, Project);
else
Lang_Index.Config.Object_File_Suffix :=
Element.Value.Value;
end if;
when Name_Object_File_Switches =>
Put (Into_List =>
Lang_Index.Config.Object_File_Switches,
From_List => Element.Value.Values,
In_Tree => Data.Tree);
when Name_Object_Path_Switches =>
Put (Into_List =>
Lang_Index.Config.Object_Path_Switches,
From_List => Element.Value.Values,
In_Tree => Data.Tree);
-- Attribute Compiler_Pic_Option (<language>)
when Name_Pic_Option =>
List := Element.Value.Values;
if List = Nil_String then
Error_Msg
(Data.Flags,
"compiler PIC option cannot be null",
Element.Value.Location, Project);
end if;
Put (Into_List =>
Lang_Index.Config.Compilation_PIC_Option,
From_List => List,
In_Tree => Data.Tree);
-- Attribute Mapping_File_Switches (<language>)
when Name_Mapping_File_Switches =>
List := Element.Value.Values;
if List = Nil_String then
Error_Msg
(Data.Flags,
"mapping file switches cannot be null",
Element.Value.Location, Project);
end if;
Put (Into_List =>
Lang_Index.Config.Mapping_File_Switches,
From_List => List,
In_Tree => Data.Tree);
-- Attribute Mapping_Spec_Suffix (<language>)
when Name_Mapping_Spec_Suffix =>
Lang_Index.Config.Mapping_Spec_Suffix :=
File_Name_Type (Element.Value.Value);
-- Attribute Mapping_Body_Suffix (<language>)
when Name_Mapping_Body_Suffix =>
Lang_Index.Config.Mapping_Body_Suffix :=
File_Name_Type (Element.Value.Value);
-- Attribute Config_File_Switches (<language>)
when Name_Config_File_Switches =>
List := Element.Value.Values;
if List = Nil_String then
Error_Msg
(Data.Flags,
"config file switches cannot be null",
Element.Value.Location, Project);
end if;
Put (Into_List =>
Lang_Index.Config.Config_File_Switches,
From_List => List,
In_Tree => Data.Tree);
-- Attribute Objects_Path (<language>)
when Name_Objects_Path =>
Lang_Index.Config.Objects_Path :=
Element.Value.Value;
-- Attribute Objects_Path_File (<language>)
when Name_Objects_Path_File =>
Lang_Index.Config.Objects_Path_File :=
Element.Value.Value;
-- Attribute Config_Body_File_Name (<language>)
when Name_Config_Body_File_Name =>
Lang_Index.Config.Config_Body :=
Element.Value.Value;
-- Attribute Config_Body_File_Name_Index (< Language>)
when Name_Config_Body_File_Name_Index =>
Lang_Index.Config.Config_Body_Index :=
Element.Value.Value;
-- Attribute Config_Body_File_Name_Pattern(<language>)
when Name_Config_Body_File_Name_Pattern =>
Lang_Index.Config.Config_Body_Pattern :=
Element.Value.Value;
-- Attribute Config_Spec_File_Name (<language>)
when Name_Config_Spec_File_Name =>
Lang_Index.Config.Config_Spec :=
Element.Value.Value;
-- Attribute Config_Spec_File_Name_Index (<language>)
when Name_Config_Spec_File_Name_Index =>
Lang_Index.Config.Config_Spec_Index :=
Element.Value.Value;
-- Attribute Config_Spec_File_Name_Pattern(<language>)
when Name_Config_Spec_File_Name_Pattern =>
Lang_Index.Config.Config_Spec_Pattern :=
Element.Value.Value;
-- Attribute Config_File_Unique (<language>)
when Name_Config_File_Unique =>
begin
Lang_Index.Config.Config_File_Unique :=
Boolean'Value
(Get_Name_String (Element.Value.Value));
exception
when Constraint_Error =>
Error_Msg
(Data.Flags,
"illegal value for Config_File_Unique",
Element.Value.Location, Project);
end;
when others =>
null;
end case;
end if;
end if;
Element_Id := Element.Next;
end loop;
Current_Array_Id := Current_Array.Next;
end loop;
end Process_Compiler;
--------------------
-- Process_Naming --
--------------------
procedure Process_Naming (Attributes : Variable_Id) is
Attribute_Id : Variable_Id;
Attribute : Variable;
begin
-- Process non associated array attribute from package Naming
Attribute_Id := Attributes;
while Attribute_Id /= No_Variable loop
Attribute := Shared.Variable_Elements.Table (Attribute_Id);
if not Attribute.Value.Default then
if Attribute.Name = Name_Separate_Suffix then
-- Attribute Separate_Suffix
Get_Name_String (Attribute.Value.Value);
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Separate_Suffix := Name_Find;
elsif Attribute.Name = Name_Casing then
-- Attribute Casing
begin
Casing :=
Value (Get_Name_String (Attribute.Value.Value));
exception
when Constraint_Error =>
Error_Msg
(Data.Flags,
"invalid value for Casing",
Attribute.Value.Location, Project);
end;
elsif Attribute.Name = Name_Dot_Replacement then
-- Attribute Dot_Replacement
Dot_Replacement := File_Name_Type (Attribute.Value.Value);
end if;
end if;
Attribute_Id := Attribute.Next;
end loop;
end Process_Naming;
procedure Process_Naming (Arrays : Array_Id) is
Current_Array_Id : Array_Id;
Current_Array : Array_Data;
Element_Id : Array_Element_Id;
Element : Array_Element;
begin
-- Process the associative array attribute of package Naming
Current_Array_Id := Arrays;
while Current_Array_Id /= No_Array loop
Current_Array := Shared.Arrays.Table (Current_Array_Id);
Element_Id := Current_Array.Value;
while Element_Id /= No_Array_Element loop
Element := Shared.Array_Elements.Table (Element_Id);
-- Get the name of the language
Lang_Index := Get_Language_From_Name
(Project, Get_Name_String (Element.Index));
if Lang_Index /= No_Language_Index
and then Element.Value.Kind = Single
and then Element.Value.Value /= No_Name
then
case Current_Array.Name is
when Name_Spec_Suffix | Name_Specification_Suffix =>
-- Attribute Spec_Suffix (<language>)
Get_Name_String (Element.Value.Value);
Canonical_Case_File_Name
(Name_Buffer (1 .. Name_Len));
Lang_Index.Config.Naming_Data.Spec_Suffix :=
Name_Find;
when Name_Implementation_Suffix | Name_Body_Suffix =>
Get_Name_String (Element.Value.Value);
Canonical_Case_File_Name
(Name_Buffer (1 .. Name_Len));
-- Attribute Body_Suffix (<language>)
Lang_Index.Config.Naming_Data.Body_Suffix :=
Name_Find;
Lang_Index.Config.Naming_Data.Separate_Suffix :=
Lang_Index.Config.Naming_Data.Body_Suffix;
when others =>
null;
end case;
end if;
Element_Id := Element.Next;
end loop;
Current_Array_Id := Current_Array.Next;
end loop;
end Process_Naming;
--------------------
-- Process_Linker --
--------------------
procedure Process_Linker (Attributes : Variable_Id) is
Attribute_Id : Variable_Id;
Attribute : Variable;
begin
-- Process non associated array attribute from package Linker
Attribute_Id := Attributes;
while Attribute_Id /= No_Variable loop
Attribute := Shared.Variable_Elements.Table (Attribute_Id);
if not Attribute.Value.Default then
if Attribute.Name = Name_Driver then
-- Attribute Linker'Driver: the default linker to use
Project.Config.Linker :=
Path_Name_Type (Attribute.Value.Value);
-- Linker'Driver is also used to link shared libraries
-- if the obsolescent attribute Library_GCC has not been
-- specified.
if Project.Config.Shared_Lib_Driver = No_File then
Project.Config.Shared_Lib_Driver :=
File_Name_Type (Attribute.Value.Value);
end if;
elsif Attribute.Name = Name_Required_Switches then
-- Attribute Required_Switches: the minimum trailing
-- options to use when invoking the linker
Put (Into_List =>
Project.Config.Trailing_Linker_Required_Switches,
From_List => Attribute.Value.Values,
In_Tree => Data.Tree);
elsif Attribute.Name = Name_Map_File_Option then
Project.Config.Map_File_Option := Attribute.Value.Value;
elsif Attribute.Name = Name_Max_Command_Line_Length then
begin
Project.Config.Max_Command_Line_Length :=
Natural'Value (Get_Name_String
(Attribute.Value.Value));
exception
when Constraint_Error =>
Error_Msg
(Data.Flags,
"value must be positive or equal to 0",
Attribute.Value.Location, Project);
end;
elsif Attribute.Name = Name_Response_File_Format then
declare
Name : Name_Id;
begin
Get_Name_String (Attribute.Value.Value);
To_Lower (Name_Buffer (1 .. Name_Len));
Name := Name_Find;
if Name = Name_None then
Project.Config.Resp_File_Format := None;
elsif Name = Name_Gnu then
Project.Config.Resp_File_Format := GNU;
elsif Name = Name_Object_List then
Project.Config.Resp_File_Format := Object_List;
elsif Name = Name_Option_List then
Project.Config.Resp_File_Format := Option_List;
elsif Name_Buffer (1 .. Name_Len) = "gcc" then
Project.Config.Resp_File_Format := GCC;
elsif Name_Buffer (1 .. Name_Len) = "gcc_gnu" then
Project.Config.Resp_File_Format := GCC_GNU;
elsif
Name_Buffer (1 .. Name_Len) = "gcc_option_list"
then
Project.Config.Resp_File_Format := GCC_Option_List;
elsif
Name_Buffer (1 .. Name_Len) = "gcc_object_list"
then
Project.Config.Resp_File_Format := GCC_Object_List;
else
Error_Msg
(Data.Flags,
"illegal response file format",
Attribute.Value.Location, Project);
end if;
end;
elsif Attribute.Name = Name_Response_File_Switches then
Put (Into_List => Project.Config.Resp_File_Options,
From_List => Attribute.Value.Values,
In_Tree => Data.Tree);
end if;
end if;
Attribute_Id := Attribute.Next;
end loop;
end Process_Linker;
-- Start of processing for Process_Packages
begin
Packages := Project.Decl.Packages;
while Packages /= No_Package loop
Element := Shared.Packages.Table (Packages);
case Element.Name is
when Name_Binder =>
-- Process attributes of package Binder
Process_Binder (Element.Decl.Arrays);
when Name_Builder =>
-- Process attributes of package Builder
Process_Builder (Element.Decl.Attributes);
when Name_Clean =>
-- Process attributes of package Clean
Process_Clean (Element.Decl.Attributes);
Process_Clean (Element.Decl.Arrays);
when Name_Compiler =>
-- Process attributes of package Compiler
Process_Compiler (Element.Decl.Arrays);
when Name_Linker =>
-- Process attributes of package Linker
Process_Linker (Element.Decl.Attributes);
when Name_Naming =>
-- Process attributes of package Naming
Process_Naming (Element.Decl.Attributes);
Process_Naming (Element.Decl.Arrays);
when others =>
null;
end case;
Packages := Element.Next;
end loop;
end Process_Packages;
---------------------------------------------
-- Process_Project_Level_Simple_Attributes --
---------------------------------------------
procedure Process_Project_Level_Simple_Attributes is
Attribute_Id : Variable_Id;
Attribute : Variable;
List : String_List_Id;
begin
-- Process non associated array attribute at project level
Attribute_Id := Project.Decl.Attributes;
while Attribute_Id /= No_Variable loop
Attribute := Shared.Variable_Elements.Table (Attribute_Id);
if not Attribute.Value.Default then
if Attribute.Name = Name_Target then
-- Attribute Target: the target specified
Project.Config.Target := Attribute.Value.Value;
elsif Attribute.Name = Name_Library_Builder then
-- Attribute Library_Builder: the application to invoke
-- to build libraries.
Project.Config.Library_Builder :=
Path_Name_Type (Attribute.Value.Value);
elsif Attribute.Name = Name_Archive_Builder then
-- Attribute Archive_Builder: the archive builder
-- (usually "ar") and its minimum options (usually "cr").
List := Attribute.Value.Values;
if List = Nil_String then
Error_Msg
(Data.Flags,
"archive builder cannot be null",
Attribute.Value.Location, Project);
end if;
Put (Into_List => Project.Config.Archive_Builder,
From_List => List,
In_Tree => Data.Tree);
elsif Attribute.Name = Name_Archive_Builder_Append_Option then
-- Attribute Archive_Builder: the archive builder
-- (usually "ar") and its minimum options (usually "cr").
List := Attribute.Value.Values;
if List /= Nil_String then
Put
(Into_List =>
Project.Config.Archive_Builder_Append_Option,
From_List => List,
In_Tree => Data.Tree);
end if;
elsif Attribute.Name = Name_Archive_Indexer then
-- Attribute Archive_Indexer: the optional archive
-- indexer (usually "ranlib") with its minimum options
-- (usually none).
List := Attribute.Value.Values;
if List = Nil_String then
Error_Msg
(Data.Flags,
"archive indexer cannot be null",
Attribute.Value.Location, Project);
end if;
Put (Into_List => Project.Config.Archive_Indexer,
From_List => List,
In_Tree => Data.Tree);
elsif Attribute.Name = Name_Library_Partial_Linker then
-- Attribute Library_Partial_Linker: the optional linker
-- driver with its minimum options, to partially link
-- archives.
List := Attribute.Value.Values;
if List = Nil_String then
Error_Msg
(Data.Flags,
"partial linker cannot be null",
Attribute.Value.Location, Project);
end if;
Put (Into_List => Project.Config.Lib_Partial_Linker,
From_List => List,
In_Tree => Data.Tree);
elsif Attribute.Name = Name_Library_GCC then
Project.Config.Shared_Lib_Driver :=
File_Name_Type (Attribute.Value.Value);
Error_Msg
(Data.Flags,
"?Library_'G'C'C is an obsolescent attribute, " &
"use Linker''Driver instead",
Attribute.Value.Location, Project);
elsif Attribute.Name = Name_Archive_Suffix then
Project.Config.Archive_Suffix :=
File_Name_Type (Attribute.Value.Value);
elsif Attribute.Name = Name_Linker_Executable_Option then
-- Attribute Linker_Executable_Option: optional options
-- to specify an executable name. Defaults to "-o".
List := Attribute.Value.Values;
if List = Nil_String then
Error_Msg
(Data.Flags,
"linker executable option cannot be null",
Attribute.Value.Location, Project);
end if;
Put (Into_List => Project.Config.Linker_Executable_Option,
From_List => List,
In_Tree => Data.Tree);
elsif Attribute.Name = Name_Linker_Lib_Dir_Option then
-- Attribute Linker_Lib_Dir_Option: optional options
-- to specify a library search directory. Defaults to
-- "-L".
Get_Name_String (Attribute.Value.Value);
if Name_Len = 0 then
Error_Msg
(Data.Flags,
"linker library directory option cannot be empty",
Attribute.Value.Location, Project);
end if;
Project.Config.Linker_Lib_Dir_Option :=
Attribute.Value.Value;
elsif Attribute.Name = Name_Linker_Lib_Name_Option then
-- Attribute Linker_Lib_Name_Option: optional options
-- to specify the name of a library to be linked in.
-- Defaults to "-l".
Get_Name_String (Attribute.Value.Value);
if Name_Len = 0 then
Error_Msg
(Data.Flags,
"linker library name option cannot be empty",
Attribute.Value.Location, Project);
end if;
Project.Config.Linker_Lib_Name_Option :=
Attribute.Value.Value;
elsif Attribute.Name = Name_Run_Path_Option then
-- Attribute Run_Path_Option: optional options to
-- specify a path for libraries.
List := Attribute.Value.Values;
if List /= Nil_String then
Put (Into_List => Project.Config.Run_Path_Option,
From_List => List,
In_Tree => Data.Tree);
end if;
elsif Attribute.Name = Name_Run_Path_Origin then
Get_Name_String (Attribute.Value.Value);
if Name_Len = 0 then
Error_Msg
(Data.Flags,
"run path origin cannot be empty",
Attribute.Value.Location, Project);
end if;
Project.Config.Run_Path_Origin := Attribute.Value.Value;
elsif Attribute.Name = Name_Library_Install_Name_Option then
Project.Config.Library_Install_Name_Option :=
Attribute.Value.Value;
elsif Attribute.Name = Name_Separate_Run_Path_Options then
declare
pragma Unsuppress (All_Checks);
begin
Project.Config.Separate_Run_Path_Options :=
Boolean'Value (Get_Name_String (Attribute.Value.Value));
exception
when Constraint_Error =>
Error_Msg
(Data.Flags,
"invalid value """ &
Get_Name_String (Attribute.Value.Value) &
""" for Separate_Run_Path_Options",
Attribute.Value.Location, Project);
end;
elsif Attribute.Name = Name_Library_Support then
declare
pragma Unsuppress (All_Checks);
begin
Project.Config.Lib_Support :=
Library_Support'Value (Get_Name_String
(Attribute.Value.Value));
if Project.Config.Lib_Support = Prj.None then
Project.Config.Lib_Support := Prj.Static_Only;
end if;
exception
when Constraint_Error =>
Error_Msg
(Data.Flags,
"invalid value """ &
Get_Name_String (Attribute.Value.Value) &
""" for Library_Support",
Attribute.Value.Location, Project);
end;
elsif
Attribute.Name = Name_Library_Encapsulated_Supported
then
declare
pragma Unsuppress (All_Checks);
begin
Project.Config.Lib_Encapsulated_Supported :=
Boolean'Value (Get_Name_String (Attribute.Value.Value));
exception
when Constraint_Error =>
Error_Msg
(Data.Flags,
"invalid value """
& Get_Name_String (Attribute.Value.Value)
& """ for Library_Encapsulated_Supported",
Attribute.Value.Location, Project);
end;
elsif Attribute.Name = Name_Shared_Library_Prefix then
Project.Config.Shared_Lib_Prefix :=
File_Name_Type (Attribute.Value.Value);
elsif Attribute.Name = Name_Shared_Library_Suffix then
Project.Config.Shared_Lib_Suffix :=
File_Name_Type (Attribute.Value.Value);
elsif Attribute.Name = Name_Symbolic_Link_Supported then
declare
pragma Unsuppress (All_Checks);
begin
Project.Config.Symbolic_Link_Supported :=
Boolean'Value (Get_Name_String
(Attribute.Value.Value));
exception
when Constraint_Error =>
Error_Msg
(Data.Flags,
"invalid value """
& Get_Name_String (Attribute.Value.Value)
& """ for Symbolic_Link_Supported",
Attribute.Value.Location, Project);
end;
elsif
Attribute.Name = Name_Library_Major_Minor_Id_Supported
then
declare
pragma Unsuppress (All_Checks);
begin
Project.Config.Lib_Maj_Min_Id_Supported :=
Boolean'Value (Get_Name_String
(Attribute.Value.Value));
exception
when Constraint_Error =>
Error_Msg
(Data.Flags,
"invalid value """ &
Get_Name_String (Attribute.Value.Value) &
""" for Library_Major_Minor_Id_Supported",
Attribute.Value.Location, Project);
end;
elsif Attribute.Name = Name_Library_Auto_Init_Supported then
declare
pragma Unsuppress (All_Checks);
begin
Project.Config.Auto_Init_Supported :=
Boolean'Value (Get_Name_String (Attribute.Value.Value));
exception
when Constraint_Error =>
Error_Msg
(Data.Flags,
"invalid value """
& Get_Name_String (Attribute.Value.Value)
& """ for Library_Auto_Init_Supported",
Attribute.Value.Location, Project);
end;
elsif Attribute.Name = Name_Shared_Library_Minimum_Switches then
List := Attribute.Value.Values;
if List /= Nil_String then
Put (Into_List => Project.Config.Shared_Lib_Min_Options,
From_List => List,
In_Tree => Data.Tree);
end if;
elsif Attribute.Name = Name_Library_Version_Switches then
List := Attribute.Value.Values;
if List /= Nil_String then
Put (Into_List => Project.Config.Lib_Version_Options,
From_List => List,
In_Tree => Data.Tree);
end if;
end if;
end if;
Attribute_Id := Attribute.Next;
end loop;
end Process_Project_Level_Simple_Attributes;
--------------------------------------------
-- Process_Project_Level_Array_Attributes --
--------------------------------------------
procedure Process_Project_Level_Array_Attributes is
Current_Array_Id : Array_Id;
Current_Array : Array_Data;
Element_Id : Array_Element_Id;
Element : Array_Element;
List : String_List_Id;
begin
-- Process the associative array attributes at project level
Current_Array_Id := Project.Decl.Arrays;
while Current_Array_Id /= No_Array loop
Current_Array := Shared.Arrays.Table (Current_Array_Id);
Element_Id := Current_Array.Value;
while Element_Id /= No_Array_Element loop
Element := Shared.Array_Elements.Table (Element_Id);
-- Get the name of the language
Lang_Index :=
Get_Language_From_Name
(Project, Get_Name_String (Element.Index));
if Lang_Index /= No_Language_Index then
case Current_Array.Name is
when Name_Inherit_Source_Path =>
List := Element.Value.Values;
if List /= Nil_String then
Put
(Into_List =>
Lang_Index.Config.Include_Compatible_Languages,
From_List => List,
In_Tree => Data.Tree,
Lower_Case => True);
end if;
when Name_Toolchain_Description =>
-- Attribute Toolchain_Description (<language>)
Lang_Index.Config.Toolchain_Description :=
Element.Value.Value;
when Name_Toolchain_Version =>
-- Attribute Toolchain_Version (<language>)
Lang_Index.Config.Toolchain_Version :=
Element.Value.Value;
-- For Ada, set proper checksum computation mode,
-- which has changed from version to version.
if Lang_Index.Name = Name_Ada then
declare
Vers : constant String :=
Get_Name_String (Element.Value.Value);
pragma Assert (Vers'First = 1);
begin
-- Version 6.3 or earlier
if Vers'Length >= 8
and then Vers (1 .. 5) = "GNAT "
and then Vers (7) = '.'
and then
(Vers (6) < '6'
or else
(Vers (6) = '6' and then Vers (8) < '4'))
then
Checksum_GNAT_6_3 := True;
-- Version 5.03 or earlier
if Vers (6) < '5'
or else (Vers (6) = '5'
and then Vers (Vers'Last) < '4')
then
Checksum_GNAT_5_03 := True;
-- Version 5.02 or earlier (no checksums)
if Vers (6) /= '5'
or else Vers (Vers'Last) < '3'
then
Checksum_Accumulate_Token_Checksum :=
False;
end if;
end if;
end if;
end;
end if;
when Name_Runtime_Library_Dir =>
-- Attribute Runtime_Library_Dir (<language>)
Lang_Index.Config.Runtime_Library_Dir :=
Element.Value.Value;
when Name_Runtime_Source_Dir =>
-- Attribute Runtime_Source_Dir (<language>)
Lang_Index.Config.Runtime_Source_Dir :=
Element.Value.Value;
when Name_Object_Generated =>
declare
pragma Unsuppress (All_Checks);
Value : Boolean;
begin
Value :=
Boolean'Value
(Get_Name_String (Element.Value.Value));
Lang_Index.Config.Object_Generated := Value;
-- If no object is generated, no object may be
-- linked.
if not Value then
Lang_Index.Config.Objects_Linked := False;
end if;
exception
when Constraint_Error =>
Error_Msg
(Data.Flags,
"invalid value """
& Get_Name_String (Element.Value.Value)
& """ for Object_Generated",
Element.Value.Location, Project);
end;
when Name_Objects_Linked =>
declare
pragma Unsuppress (All_Checks);
Value : Boolean;
begin
Value :=
Boolean'Value
(Get_Name_String (Element.Value.Value));
-- No change if Object_Generated is False, as this
-- forces Objects_Linked to be False too.
if Lang_Index.Config.Object_Generated then
Lang_Index.Config.Objects_Linked := Value;
end if;
exception
when Constraint_Error =>
Error_Msg
(Data.Flags,
"invalid value """
& Get_Name_String (Element.Value.Value)
& """ for Objects_Linked",
Element.Value.Location, Project);
end;
when others =>
null;
end case;
end if;
Element_Id := Element.Next;
end loop;
Current_Array_Id := Current_Array.Next;
end loop;
end Process_Project_Level_Array_Attributes;
-- Start of processing for Check_Configuration
begin
Process_Project_Level_Simple_Attributes;
Process_Project_Level_Array_Attributes;
Process_Packages;
-- For unit based languages, set Casing, Dot_Replacement and
-- Separate_Suffix in Naming_Data.
Lang_Index := Project.Languages;
while Lang_Index /= No_Language_Index loop
if Lang_Index.Config.Kind = Unit_Based then
Lang_Index.Config.Naming_Data.Casing := Casing;
Lang_Index.Config.Naming_Data.Dot_Replacement := Dot_Replacement;
if Separate_Suffix /= No_File then
Lang_Index.Config.Naming_Data.Separate_Suffix :=
Separate_Suffix;
end if;
exit;
end if;
Lang_Index := Lang_Index.Next;
end loop;
-- Give empty names to various prefixes/suffixes, if they have not
-- been specified in the configuration.
if Project.Config.Archive_Suffix = No_File then
Project.Config.Archive_Suffix := Empty_File;
end if;
if Project.Config.Shared_Lib_Prefix = No_File then
Project.Config.Shared_Lib_Prefix := Empty_File;
end if;
if Project.Config.Shared_Lib_Suffix = No_File then
Project.Config.Shared_Lib_Suffix := Empty_File;
end if;
Lang_Index := Project.Languages;
while Lang_Index /= No_Language_Index loop
-- For all languages, Compiler_Driver needs to be specified. This is
-- only needed if we do intend to compile (not in GPS for instance).
if Data.Flags.Compiler_Driver_Mandatory
and then Lang_Index.Config.Compiler_Driver = No_File
and then not Project.Externally_Built
then
Error_Msg_Name_1 := Lang_Index.Display_Name;
Error_Msg
(Data.Flags,
"?\no compiler specified for language %%" &
", ignoring all its sources",
No_Location, Project);
if Lang_Index = Project.Languages then
Project.Languages := Lang_Index.Next;
else
Prev_Index.Next := Lang_Index.Next;
end if;
elsif Lang_Index.Config.Kind = Unit_Based then
Prev_Index := Lang_Index;
-- For unit based languages, Dot_Replacement, Spec_Suffix and
-- Body_Suffix need to be specified.
if Lang_Index.Config.Naming_Data.Dot_Replacement = No_File then
Error_Msg
(Data.Flags,
"Dot_Replacement not specified for " &
Get_Name_String (Lang_Index.Name),
No_Location, Project);
end if;
if Lang_Index.Config.Naming_Data.Spec_Suffix = No_File then
Error_Msg
(Data.Flags,
"\Spec_Suffix not specified for " &
Get_Name_String (Lang_Index.Name),
No_Location, Project);
end if;
if Lang_Index.Config.Naming_Data.Body_Suffix = No_File then
Error_Msg
(Data.Flags,
"\Body_Suffix not specified for " &
Get_Name_String (Lang_Index.Name),
No_Location, Project);
end if;
else
Prev_Index := Lang_Index;
-- For file based languages, either Spec_Suffix or Body_Suffix
-- need to be specified.
if Data.Flags.Require_Sources_Other_Lang
and then Lang_Index.Config.Naming_Data.Spec_Suffix = No_File
and then Lang_Index.Config.Naming_Data.Body_Suffix = No_File
then
Error_Msg_Name_1 := Lang_Index.Display_Name;
Error_Msg
(Data.Flags,
"\no suffixes specified for %%",
No_Location, Project);
end if;
end if;
Lang_Index := Lang_Index.Next;
end loop;
end Check_Configuration;
-------------------------------
-- Check_If_Externally_Built --
-------------------------------
procedure Check_If_Externally_Built
(Project : Project_Id;
Data : in out Tree_Processing_Data)
is
Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared;
Externally_Built : constant Variable_Value :=
Util.Value_Of
(Name_Externally_Built,
Project.Decl.Attributes, Shared);
begin
if not Externally_Built.Default then
Get_Name_String (Externally_Built.Value);
To_Lower (Name_Buffer (1 .. Name_Len));
if Name_Buffer (1 .. Name_Len) = "true" then
Project.Externally_Built := True;
elsif Name_Buffer (1 .. Name_Len) /= "false" then
Error_Msg (Data.Flags,
"Externally_Built may only be true or false",
Externally_Built.Location, Project);
end if;
end if;
-- A virtual project extending an externally built project is itself
-- externally built.
if Project.Virtual and then Project.Extends /= No_Project then
Project.Externally_Built := Project.Extends.Externally_Built;
end if;
if Project.Externally_Built then
Debug_Output ("project is externally built");
else
Debug_Output ("project is not externally built");
end if;
end Check_If_Externally_Built;
----------------------
-- Check_Interfaces --
----------------------
procedure Check_Interfaces
(Project : Project_Id;
Data : in out Tree_Processing_Data)
is
Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared;
Interfaces : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Interfaces,
Project.Decl.Attributes,
Shared);
Library_Interface : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Interface,
Project.Decl.Attributes,
Shared);
List : String_List_Id;
Element : String_Element;
Name : File_Name_Type;
Iter : Source_Iterator;
Source : Source_Id;
Project_2 : Project_Id;
Other : Source_Id;
Unit_Found : Boolean;
Interface_ALIs : String_List_Id := Nil_String;
Other_Interfaces : String_List_Id := Nil_String;
begin
if not Interfaces.Default then
-- Set In_Interfaces to False for all sources. It will be set to True
-- later for the sources in the Interfaces list.
Project_2 := Project;
while Project_2 /= No_Project loop
Iter := For_Each_Source (Data.Tree, Project_2);
loop
Source := Prj.Element (Iter);
exit when Source = No_Source;
Source.In_Interfaces := False;
Next (Iter);
end loop;
Project_2 := Project_2.Extends;
end loop;
List := Interfaces.Values;
while List /= Nil_String loop
Element := Shared.String_Elements.Table (List);
Name := Canonical_Case_File_Name (Element.Value);
Project_2 := Project;
Big_Loop : while Project_2 /= No_Project loop
if Project.Qualifier = Aggregate_Library then
-- For an aggregate library we want to consider sources of
-- all aggregated projects.
Iter := For_Each_Source (Data.Tree);
else
Iter := For_Each_Source (Data.Tree, Project_2);
end if;
loop
Source := Prj.Element (Iter);
exit when Source = No_Source;
if Source.File = Name then
if not Source.Locally_Removed then
Source.In_Interfaces := True;
Source.Declared_In_Interfaces := True;
Other := Other_Part (Source);
if Other /= No_Source then
Other.In_Interfaces := True;
Other.Declared_In_Interfaces := True;
end if;
-- Unit based case
if Source.Language.Config.Kind = Unit_Based then
if Source.Kind = Spec
and then Other_Part (Source) /= No_Source
then
Source := Other_Part (Source);
end if;
String_Element_Table.Increment_Last
(Shared.String_Elements);
Shared.String_Elements.Table
(String_Element_Table.Last
(Shared.String_Elements)) :=
(Value => Name_Id (Source.Dep_Name),
Index => 0,
Display_Value => Name_Id (Source.Dep_Name),
Location => No_Location,
Flag => False,
Next => Interface_ALIs);
Interface_ALIs :=
String_Element_Table.Last
(Shared.String_Elements);
-- File based case
else
String_Element_Table.Increment_Last
(Shared.String_Elements);
Shared.String_Elements.Table
(String_Element_Table.Last
(Shared.String_Elements)) :=
(Value => Name_Id (Source.File),
Index => 0,
Display_Value => Name_Id (Source.Display_File),
Location => No_Location,
Flag => False,
Next => Other_Interfaces);
Other_Interfaces :=
String_Element_Table.Last
(Shared.String_Elements);
end if;
Debug_Output
("interface: ", Name_Id (Source.Path.Name));
end if;
exit Big_Loop;
end if;
Next (Iter);
end loop;
Project_2 := Project_2.Extends;
end loop Big_Loop;
if Source = No_Source then
Error_Msg_File_1 := File_Name_Type (Element.Value);
Error_Msg_Name_1 := Project.Name;
Error_Msg
(Data.Flags,
"{ cannot be an interface of project %% "
& "as it is not one of its sources",
Element.Location, Project);
end if;
List := Element.Next;
end loop;
Project.Interfaces_Defined := True;
Project.Lib_Interface_ALIs := Interface_ALIs;
Project.Other_Interfaces := Other_Interfaces;
elsif Project.Library and then not Library_Interface.Default then
-- Set In_Interfaces to False for all sources. It will be set to True
-- later for the sources in the Library_Interface list.
Project_2 := Project;
while Project_2 /= No_Project loop
Iter := For_Each_Source (Data.Tree, Project_2);
loop
Source := Prj.Element (Iter);
exit when Source = No_Source;
Source.In_Interfaces := False;
Next (Iter);
end loop;
Project_2 := Project_2.Extends;
end loop;
List := Library_Interface.Values;
while List /= Nil_String loop
Element := Shared.String_Elements.Table (List);
Get_Name_String (Element.Value);
To_Lower (Name_Buffer (1 .. Name_Len));
Name := Name_Find;
Unit_Found := False;
Project_2 := Project;
Big_Loop_2 : while Project_2 /= No_Project loop
if Project.Qualifier = Aggregate_Library then
-- For an aggregate library we want to consider sources of
-- all aggregated projects.
Iter := For_Each_Source (Data.Tree);
else
Iter := For_Each_Source (Data.Tree, Project_2);
end if;
loop
Source := Prj.Element (Iter);
exit when Source = No_Source;
if Source.Unit /= No_Unit_Index
and then Source.Unit.Name = Name_Id (Name)
then
if not Source.Locally_Removed then
Source.In_Interfaces := True;
Source.Declared_In_Interfaces := True;
Project.Interfaces_Defined := True;
Other := Other_Part (Source);
if Other /= No_Source then
Other.In_Interfaces := True;
Other.Declared_In_Interfaces := True;
end if;
Debug_Output
("interface: ", Name_Id (Source.Path.Name));
if Source.Kind = Spec
and then Other_Part (Source) /= No_Source
then
Source := Other_Part (Source);
end if;
String_Element_Table.Increment_Last
(Shared.String_Elements);
Shared.String_Elements.Table
(String_Element_Table.Last
(Shared.String_Elements)) :=
(Value => Name_Id (Source.Dep_Name),
Index => 0,
Display_Value => Name_Id (Source.Dep_Name),
Location => No_Location,
Flag => False,
Next => Interface_ALIs);
Interface_ALIs :=
String_Element_Table.Last (Shared.String_Elements);
end if;
Unit_Found := True;
exit Big_Loop_2;
end if;
Next (Iter);
end loop;
Project_2 := Project_2.Extends;
end loop Big_Loop_2;
if not Unit_Found then
Error_Msg_Name_1 := Name_Id (Name);
Error_Msg
(Data.Flags,
"%% is not a unit of this project",
Element.Location, Project);
end if;
List := Element.Next;
end loop;
Project.Lib_Interface_ALIs := Interface_ALIs;
elsif Project.Extends /= No_Project
and then Project.Extends.Interfaces_Defined
then
Project.Interfaces_Defined := True;
Iter := For_Each_Source (Data.Tree, Project);
loop
Source := Prj.Element (Iter);
exit when Source = No_Source;
if not Source.Declared_In_Interfaces then
Source.In_Interfaces := False;
end if;
Next (Iter);
end loop;
Project.Lib_Interface_ALIs := Project.Extends.Lib_Interface_ALIs;
end if;
end Check_Interfaces;
------------------------------
-- Check_Library_Attributes --
------------------------------
-- This procedure is awfully long (over 700 lines) should be broken up???
procedure Check_Library_Attributes
(Project : Project_Id;
Data : in out Tree_Processing_Data)
is
Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared;
Attributes : constant Prj.Variable_Id := Project.Decl.Attributes;
Lib_Dir : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Dir, Attributes, Shared);
Lib_Name : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Name, Attributes, Shared);
Lib_Standalone : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Standalone,
Attributes, Shared);
Lib_Version : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Version, Attributes, Shared);
Lib_ALI_Dir : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Ali_Dir, Attributes, Shared);
Lib_GCC : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_GCC, Attributes, Shared);
The_Lib_Kind : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Kind, Attributes, Shared);
Imported_Project_List : Project_List;
Continuation : String_Access := No_Continuation_String'Access;
Support_For_Libraries : Library_Support;
Library_Directory_Present : Boolean;
procedure Check_Library (Proj : Project_Id; Extends : Boolean);
-- Check if an imported or extended project if also a library project
procedure Check_Aggregate_Library_Dirs;
-- Check that the library directory and the library ALI directory of an
-- aggregate library project are not the same as the object directory or
-- the library directory of any of its aggregated projects.
----------------------------------
-- Check_Aggregate_Library_Dirs --
----------------------------------
procedure Check_Aggregate_Library_Dirs is
procedure Process_Aggregate (Proj : Project_Id);
-- Recursive procedure to check the aggregated projects, as they may
-- also be aggregated library projects.
-----------------------
-- Process_Aggregate --
-----------------------
procedure Process_Aggregate (Proj : Project_Id) is
Agg : Aggregated_Project_List;
begin
Agg := Proj.Aggregated_Projects;
while Agg /= null loop
Error_Msg_Name_1 := Agg.Project.Name;
if Agg.Project.Qualifier /= Aggregate_Library
and then Project.Library_ALI_Dir.Name =
Agg.Project.Object_Directory.Name
then
Error_Msg
(Data.Flags,
"aggregate library 'A'L'I directory cannot be shared with"
& " object directory of aggregated project %%",
The_Lib_Kind.Location, Project);
elsif Project.Library_ALI_Dir.Name =
Agg.Project.Library_Dir.Name
then
Error_Msg
(Data.Flags,
"aggregate library 'A'L'I directory cannot be shared with"
& " library directory of aggregated project %%",
The_Lib_Kind.Location, Project);
elsif Agg.Project.Qualifier /= Aggregate_Library
and then Project.Library_Dir.Name =
Agg.Project.Object_Directory.Name
then
Error_Msg
(Data.Flags,
"aggregate library directory cannot be shared with"
& " object directory of aggregated project %%",
The_Lib_Kind.Location, Project);
elsif Project.Library_Dir.Name =
Agg.Project.Library_Dir.Name
then
Error_Msg
(Data.Flags,
"aggregate library directory cannot be shared with"
& " library directory of aggregated project %%",
The_Lib_Kind.Location, Project);
end if;
if Agg.Project.Qualifier = Aggregate_Library then
Process_Aggregate (Agg.Project);
end if;
Agg := Agg.Next;
end loop;
end Process_Aggregate;
-- Start of processing for Check_Aggregate_Library_Dirs
begin
if Project.Qualifier = Aggregate_Library then
Process_Aggregate (Project);
end if;
end Check_Aggregate_Library_Dirs;
-------------------
-- Check_Library --
-------------------
procedure Check_Library (Proj : Project_Id; Extends : Boolean) is
Src_Id : Source_Id;
Iter : Source_Iterator;
begin
if Proj /= No_Project then
if not Proj.Library then
-- The only not library projects that are OK are those that
-- have no sources. However, header files from non-Ada
-- languages are OK, as there is nothing to compile.
Iter := For_Each_Source (Data.Tree, Proj);
loop
Src_Id := Prj.Element (Iter);
exit when Src_Id = No_Source
or else Src_Id.Language.Config.Kind /= File_Based
or else Src_Id.Kind /= Spec;
Next (Iter);
end loop;
if Src_Id /= No_Source then
Error_Msg_Name_1 := Project.Name;
Error_Msg_Name_2 := Proj.Name;
if Extends then
if Project.Library_Kind /= Static then
Error_Msg
(Data.Flags,
Continuation.all &
"shared library project %% cannot extend " &
"project %% that is not a library project",
Project.Location, Project);
Continuation := Continuation_String'Access;
end if;
elsif not Unchecked_Shared_Lib_Imports
and then Project.Library_Kind /= Static
then
Error_Msg
(Data.Flags,
Continuation.all &
"shared library project %% cannot import project %% " &
"that is not a shared library project",
Project.Location, Project);
Continuation := Continuation_String'Access;
end if;
end if;
elsif Project.Library_Kind /= Static
and then not Lib_Standalone.Default
and then Get_Name_String (Lib_Standalone.Value) = "encapsulated"
and then Proj.Library_Kind /= Static
then
-- An encapsulated library must depend only on static libraries
Error_Msg_Name_1 := Project.Name;
Error_Msg_Name_2 := Proj.Name;
Error_Msg
(Data.Flags,
Continuation.all &
"encapsulated library project %% cannot import shared " &
"library project %%",
Project.Location, Project);
Continuation := Continuation_String'Access;
elsif Project.Library_Kind /= Static
and then Proj.Library_Kind = Static
and then
(Lib_Standalone.Default
or else
Get_Name_String (Lib_Standalone.Value) /= "encapsulated")
then
Error_Msg_Name_1 := Project.Name;
Error_Msg_Name_2 := Proj.Name;
if Extends then
Error_Msg
(Data.Flags,
Continuation.all &
"shared library project %% cannot extend static " &
"library project %%",
Project.Location, Project);
Continuation := Continuation_String'Access;
elsif not Unchecked_Shared_Lib_Imports then
Error_Msg
(Data.Flags,
Continuation.all &
"shared library project %% cannot import static " &
"library project %%",
Project.Location, Project);
Continuation := Continuation_String'Access;
end if;
end if;
end if;
end Check_Library;
Dir_Exists : Boolean;
-- Start of processing for Check_Library_Attributes
begin
Library_Directory_Present := Lib_Dir.Value /= Empty_String;
-- Special case of extending project
if Project.Extends /= No_Project then
-- If the project extended is a library project, we inherit the
-- library name, if it is not redefined; we check that the library
-- directory is specified.
if Project.Extends.Library then
if Project.Qualifier = Standard then
Error_Msg
(Data.Flags,
"a standard project cannot extend a library project",
Project.Location, Project);
else
if Lib_Name.Default then
Project.Library_Name := Project.Extends.Library_Name;
end if;
if Lib_Dir.Default then
if not Project.Virtual then
Error_Msg
(Data.Flags,
"a project extending a library project must " &
"specify an attribute Library_Dir",
Project.Location, Project);
else
-- For a virtual project extending a library project,
-- inherit library directory and library kind.
Project.Library_Dir := Project.Extends.Library_Dir;
Library_Directory_Present := True;
Project.Library_Kind := Project.Extends.Library_Kind;
end if;
end if;
end if;
end if;
end if;
pragma Assert (Lib_Name.Kind = Single);
if Lib_Name.Value = Empty_String then
if Current_Verbosity = High
and then Project.Library_Name = No_Name
then
Debug_Indent;
Write_Line ("no library name");
end if;
else
-- There is no restriction on the syntax of library names
Project.Library_Name := Lib_Name.Value;
end if;
if Project.Library_Name /= No_Name then
if Current_Verbosity = High then
Write_Attr
("Library name: ", Get_Name_String (Project.Library_Name));
end if;
pragma Assert (Lib_Dir.Kind = Single);
if not Library_Directory_Present then
Debug_Output ("no library directory");
else
-- Find path name (unless inherited), check that it is a directory
if Project.Library_Dir = No_Path_Information then
Locate_Directory
(Project,
File_Name_Type (Lib_Dir.Value),
Path => Project.Library_Dir,
Dir_Exists => Dir_Exists,
Data => Data,
Create => "library",
Must_Exist => False,
Location => Lib_Dir.Location,
Externally_Built => Project.Externally_Built);
else
Dir_Exists :=
Is_Directory
(Get_Name_String (Project.Library_Dir.Display_Name));
end if;
if not Dir_Exists then
if Directories_Must_Exist_In_Projects then
-- Get the absolute name of the library directory that does
-- not exist, to report an error.
Err_Vars.Error_Msg_File_1 :=
File_Name_Type (Project.Library_Dir.Display_Name);
Error_Msg
(Data.Flags,
"library directory { does not exist",
Lib_Dir.Location, Project);
end if;
-- Checks for object/source directories
elsif not Project.Externally_Built
-- An aggregate library does not have sources or objects, so
-- these tests are not required in this case.
and then Project.Qualifier /= Aggregate_Library
then
-- Library directory cannot be the same as Object directory
if Project.Library_Dir.Name = Project.Object_Directory.Name then
Error_Msg
(Data.Flags,
"library directory cannot be the same " &
"as object directory",
Lib_Dir.Location, Project);
Project.Library_Dir := No_Path_Information;
else
declare
OK : Boolean := True;
Dirs_Id : String_List_Id;
Dir_Elem : String_Element;
Pid : Project_List;
begin
-- The library directory cannot be the same as a source
-- directory of the current project.
Dirs_Id := Project.Source_Dirs;
while Dirs_Id /= Nil_String loop
Dir_Elem := Shared.String_Elements.Table (Dirs_Id);
Dirs_Id := Dir_Elem.Next;
if Project.Library_Dir.Name =
Path_Name_Type (Dir_Elem.Value)
then
Err_Vars.Error_Msg_File_1 :=
File_Name_Type (Dir_Elem.Value);
Error_Msg
(Data.Flags,
"library directory cannot be the same "
& "as source directory {",
Lib_Dir.Location, Project);
OK := False;
exit;
end if;
end loop;
if OK then
-- The library directory cannot be the same as a
-- source directory of another project either.
Pid := Data.Tree.Projects;
Project_Loop : loop
exit Project_Loop when Pid = null;
if Pid.Project /= Project then
Dirs_Id := Pid.Project.Source_Dirs;
Dir_Loop : while Dirs_Id /= Nil_String loop
Dir_Elem :=
Shared.String_Elements.Table (Dirs_Id);
Dirs_Id := Dir_Elem.Next;
if Project.Library_Dir.Name =
Path_Name_Type (Dir_Elem.Value)
then
Err_Vars.Error_Msg_File_1 :=
File_Name_Type (Dir_Elem.Value);
Err_Vars.Error_Msg_Name_1 :=
Pid.Project.Name;
Error_Msg
(Data.Flags,
"library directory cannot be the same "
& "as source directory { of project %%",
Lib_Dir.Location, Project);
OK := False;
exit Project_Loop;
end if;
end loop Dir_Loop;
end if;
Pid := Pid.Next;
end loop Project_Loop;
end if;
if not OK then
Project.Library_Dir := No_Path_Information;
elsif Current_Verbosity = High then
-- Display the Library directory in high verbosity
Write_Attr
("Library directory",
Get_Name_String (Project.Library_Dir.Display_Name));
end if;
end;
end if;
end if;
end if;
end if;
Project.Library :=
Project.Library_Dir /= No_Path_Information
and then Project.Library_Name /= No_Name;
if Project.Extends = No_Project then
case Project.Qualifier is
when Standard =>
if Project.Library then
Error_Msg
(Data.Flags,
"a standard project cannot be a library project",
Lib_Name.Location, Project);
end if;
when Library | Aggregate_Library =>
if not Project.Library then
if Project.Library_Name = No_Name then
Error_Msg
(Data.Flags,
"attribute Library_Name not declared",
Project.Location, Project);
if not Library_Directory_Present then
Error_Msg
(Data.Flags,
"\attribute Library_Dir not declared",
Project.Location, Project);
end if;
elsif Project.Library_Dir = No_Path_Information then
Error_Msg
(Data.Flags,
"attribute Library_Dir not declared",
Project.Location, Project);
end if;
end if;
when others =>
null;
end case;
end if;
if Project.Library then
Support_For_Libraries := Project.Config.Lib_Support;
if Support_For_Libraries = Prj.None then
Support_For_Libraries := Prj.Static_Only;
end if;
if not Project.Externally_Built
and then Support_For_Libraries = Prj.None
then
Error_Msg
(Data.Flags,
"?libraries are not supported on this platform",
Lib_Name.Location, Project);
Project.Library := False;
else
if Lib_ALI_Dir.Value = Empty_String then
Debug_Output ("no library ALI directory specified");
Project.Library_ALI_Dir := Project.Library_Dir;
else
-- Find path name, check that it is a directory
Locate_Directory
(Project,
File_Name_Type (Lib_ALI_Dir.Value),
Path => Project.Library_ALI_Dir,
Create => "library ALI",
Dir_Exists => Dir_Exists,
Data => Data,
Must_Exist => False,
Location => Lib_ALI_Dir.Location,
Externally_Built => Project.Externally_Built);
if not Dir_Exists then
-- Get the absolute name of the library ALI directory that
-- does not exist, to report an error.
Err_Vars.Error_Msg_File_1 :=
File_Name_Type (Project.Library_ALI_Dir.Display_Name);
Error_Msg
(Data.Flags,
"library 'A'L'I directory { does not exist",
Lib_ALI_Dir.Location, Project);
end if;
if not Project.Externally_Built
and then Project.Library_ALI_Dir /= Project.Library_Dir
then
-- The library ALI directory cannot be the same as the
-- Object directory.
if Project.Library_ALI_Dir = Project.Object_Directory then
Error_Msg
(Data.Flags,
"library 'A'L'I directory cannot be the same " &
"as object directory",
Lib_ALI_Dir.Location, Project);
Project.Library_ALI_Dir := No_Path_Information;
else
declare
OK : Boolean := True;
Dirs_Id : String_List_Id;
Dir_Elem : String_Element;
Pid : Project_List;
begin
-- The library ALI directory cannot be the same as
-- a source directory of the current project.
Dirs_Id := Project.Source_Dirs;
while Dirs_Id /= Nil_String loop
Dir_Elem := Shared.String_Elements.Table (Dirs_Id);
Dirs_Id := Dir_Elem.Next;
if Project.Library_ALI_Dir.Name =
Path_Name_Type (Dir_Elem.Value)
then
Err_Vars.Error_Msg_File_1 :=
File_Name_Type (Dir_Elem.Value);
Error_Msg
(Data.Flags,
"library 'A'L'I directory cannot be " &
"the same as source directory {",
Lib_ALI_Dir.Location, Project);
OK := False;
exit;
end if;
end loop;
if OK then
-- The library ALI directory cannot be the same as
-- a source directory of another project either.
Pid := Data.Tree.Projects;
ALI_Project_Loop : loop
exit ALI_Project_Loop when Pid = null;
if Pid.Project /= Project then
Dirs_Id := Pid.Project.Source_Dirs;
ALI_Dir_Loop :
while Dirs_Id /= Nil_String loop
Dir_Elem :=
Shared.String_Elements.Table (Dirs_Id);
Dirs_Id := Dir_Elem.Next;
if Project.Library_ALI_Dir.Name =
Path_Name_Type (Dir_Elem.Value)
then
Err_Vars.Error_Msg_File_1 :=
File_Name_Type (Dir_Elem.Value);
Err_Vars.Error_Msg_Name_1 :=
Pid.Project.Name;
Error_Msg
(Data.Flags,
"library 'A'L'I directory cannot " &
"be the same as source directory " &
"{ of project %%",
Lib_ALI_Dir.Location, Project);
OK := False;
exit ALI_Project_Loop;
end if;
end loop ALI_Dir_Loop;
end if;
Pid := Pid.Next;
end loop ALI_Project_Loop;
end if;
if not OK then
Project.Library_ALI_Dir := No_Path_Information;
elsif Current_Verbosity = High then
-- Display Library ALI directory in high verbosity
Write_Attr
("Library ALI dir",
Get_Name_String
(Project.Library_ALI_Dir.Display_Name));
end if;
end;
end if;
end if;
end if;
pragma Assert (Lib_Version.Kind = Single);
if Lib_Version.Value = Empty_String then
Debug_Output ("no library version specified");
else
Project.Lib_Internal_Name := Lib_Version.Value;
end if;
pragma Assert (The_Lib_Kind.Kind = Single);
if The_Lib_Kind.Value = Empty_String then
Debug_Output ("no library kind specified");
else
Get_Name_String (The_Lib_Kind.Value);
declare
Kind_Name : constant String :=
To_Lower (Name_Buffer (1 .. Name_Len));
OK : Boolean := True;
begin
if Kind_Name = "static" then
Project.Library_Kind := Static;
elsif Kind_Name = "dynamic" then
Project.Library_Kind := Dynamic;
elsif Kind_Name = "relocatable" then
Project.Library_Kind := Relocatable;
else
Error_Msg
(Data.Flags,
"illegal value for Library_Kind",
The_Lib_Kind.Location, Project);
OK := False;
end if;
if Current_Verbosity = High and then OK then
Write_Attr ("Library kind", Kind_Name);
end if;
if Project.Library_Kind /= Static then
if not Project.Externally_Built
and then Support_For_Libraries = Prj.Static_Only
then
Error_Msg
(Data.Flags,
"only static libraries are supported " &
"on this platform",
The_Lib_Kind.Location, Project);
Project.Library := False;
else
-- Check if (obsolescent) attribute Library_GCC or
-- Linker'Driver is declared.
if Lib_GCC.Value /= Empty_String then
Error_Msg
(Data.Flags,
"?Library_'G'C'C is an obsolescent attribute, " &
"use Linker''Driver instead",
Lib_GCC.Location, Project);
Project.Config.Shared_Lib_Driver :=
File_Name_Type (Lib_GCC.Value);
else
declare
Linker : constant Package_Id :=
Value_Of
(Name_Linker,
Project.Decl.Packages,
Shared);
Driver : constant Variable_Value :=
Value_Of
(Name => No_Name,
Attribute_Or_Array_Name =>
Name_Driver,
In_Package => Linker,
Shared => Shared);
begin
if Driver /= Nil_Variable_Value
and then Driver.Value /= Empty_String
then
Project.Config.Shared_Lib_Driver :=
File_Name_Type (Driver.Value);
end if;
end;
end if;
end if;
end if;
end;
end if;
if Project.Library
and then Project.Qualifier /= Aggregate_Library
then
Debug_Output ("this is a library project file");
Check_Library (Project.Extends, Extends => True);
Imported_Project_List := Project.Imported_Projects;
while Imported_Project_List /= null loop
Check_Library
(Imported_Project_List.Project,
Extends => False);
Imported_Project_List := Imported_Project_List.Next;
end loop;
end if;
end if;
end if;
-- Check if Linker'Switches or Linker'Default_Switches are declared.
-- Warn if they are declared, as it is a common error to think that
-- library are "linked" with Linker switches.
if Project.Library then
declare
Linker_Package_Id : constant Package_Id :=
Util.Value_Of
(Name_Linker,
Project.Decl.Packages, Shared);
Linker_Package : Package_Element;
Switches : Array_Element_Id := No_Array_Element;
begin
if Linker_Package_Id /= No_Package then
Linker_Package := Shared.Packages.Table (Linker_Package_Id);
Switches :=
Value_Of
(Name => Name_Switches,
In_Arrays => Linker_Package.Decl.Arrays,
Shared => Shared);
if Switches = No_Array_Element then
Switches :=
Value_Of
(Name => Name_Default_Switches,
In_Arrays => Linker_Package.Decl.Arrays,
Shared => Shared);
end if;
if Switches /= No_Array_Element then
Error_Msg
(Data.Flags,
"?\Linker switches not taken into account in library " &
"projects",
No_Location, Project);
end if;
end if;
end;
end if;
if Project.Extends /= No_Project and then Project.Extends.Library then
-- Remove the library name from Lib_Data_Table
for J in 1 .. Lib_Data_Table.Last loop
if Lib_Data_Table.Table (J).Proj = Project.Extends then
Lib_Data_Table.Table (J) :=
Lib_Data_Table.Table (Lib_Data_Table.Last);
Lib_Data_Table.Set_Last (Lib_Data_Table.Last - 1);
exit;
end if;
end loop;
end if;
if Project.Library and then not Lib_Name.Default then
-- Check if the same library name is used in an other library project
for J in 1 .. Lib_Data_Table.Last loop
if Lib_Data_Table.Table (J).Name = Project.Library_Name
and then Lib_Data_Table.Table (J).Tree = Data.Tree
then
Error_Msg_Name_1 := Lib_Data_Table.Table (J).Proj.Name;
Error_Msg
(Data.Flags,
"Library name cannot be the same as in project %%",
Lib_Name.Location, Project);
Project.Library := False;
exit;
end if;
end loop;
end if;
if not Lib_Standalone.Default
and then Project.Library_Kind = Static
then
-- An standalone library must be a shared library
Error_Msg_Name_1 := Project.Name;
Error_Msg
(Data.Flags,
Continuation.all &
"standalone library project %% must be a shared library",
Project.Location, Project);
Continuation := Continuation_String'Access;
end if;
-- Check that aggregated libraries do not share the aggregate
-- Library_ALI_Dir.
if Project.Qualifier = Aggregate_Library then
Check_Aggregate_Library_Dirs;
end if;
if Project.Library and not Data.In_Aggregate_Lib then
-- Record the library name
Lib_Data_Table.Append
((Name => Project.Library_Name,
Proj => Project,
Tree => Data.Tree));
end if;
end Check_Library_Attributes;
--------------------------
-- Check_Package_Naming --
--------------------------
procedure Check_Package_Naming
(Project : Project_Id;
Data : in out Tree_Processing_Data)
is
Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared;
Naming_Id : constant Package_Id :=
Util.Value_Of
(Name_Naming, Project.Decl.Packages, Shared);
Naming : Package_Element;
Ada_Body_Suffix_Loc : Source_Ptr := No_Location;
procedure Check_Naming;
-- Check the validity of the Naming package (suffixes valid, ...)
procedure Check_Common
(Dot_Replacement : in out File_Name_Type;
Casing : in out Casing_Type;
Casing_Defined : out Boolean;
Separate_Suffix : in out File_Name_Type;
Sep_Suffix_Loc : out Source_Ptr);
-- Check attributes common
procedure Process_Exceptions_File_Based
(Lang_Id : Language_Ptr;
Kind : Source_Kind);
procedure Process_Exceptions_Unit_Based
(Lang_Id : Language_Ptr;
Kind : Source_Kind);
-- Process the naming exceptions for the two types of languages
procedure Initialize_Naming_Data;
-- Initialize internal naming data for the various languages
------------------
-- Check_Common --
------------------
procedure Check_Common
(Dot_Replacement : in out File_Name_Type;
Casing : in out Casing_Type;
Casing_Defined : out Boolean;
Separate_Suffix : in out File_Name_Type;
Sep_Suffix_Loc : out Source_Ptr)
is
Dot_Repl : constant Variable_Value :=
Util.Value_Of
(Name_Dot_Replacement,
Naming.Decl.Attributes,
Shared);
Casing_String : constant Variable_Value :=
Util.Value_Of
(Name_Casing,
Naming.Decl.Attributes,
Shared);
Sep_Suffix : constant Variable_Value :=
Util.Value_Of
(Name_Separate_Suffix,
Naming.Decl.Attributes,
Shared);
Dot_Repl_Loc : Source_Ptr;
begin
Sep_Suffix_Loc := No_Location;
if not Dot_Repl.Default then
pragma Assert
(Dot_Repl.Kind = Single, "Dot_Replacement is not a string");
if Length_Of_Name (Dot_Repl.Value) = 0 then
Error_Msg
(Data.Flags, "Dot_Replacement cannot be empty",
Dot_Repl.Location, Project);
end if;
Dot_Replacement := Canonical_Case_File_Name (Dot_Repl.Value);
Dot_Repl_Loc := Dot_Repl.Location;
declare
Repl : constant String := Get_Name_String (Dot_Replacement);
begin
-- Dot_Replacement cannot
-- - be empty
-- - start or end with an alphanumeric
-- - be a single '_'
-- - start with an '_' followed by an alphanumeric
-- - contain a '.' except if it is "."
if Repl'Length = 0
or else Is_Alphanumeric (Repl (Repl'First))
or else Is_Alphanumeric (Repl (Repl'Last))
or else (Repl (Repl'First) = '_'
and then
(Repl'Length = 1
or else
Is_Alphanumeric (Repl (Repl'First + 1))))
or else (Repl'Length > 1
and then
Index (Source => Repl, Pattern => ".") /= 0)
then
Error_Msg
(Data.Flags,
'"' & Repl &
""" is illegal for Dot_Replacement.",
Dot_Repl_Loc, Project);
end if;
end;
end if;
if Dot_Replacement /= No_File then
Write_Attr
("Dot_Replacement", Get_Name_String (Dot_Replacement));
end if;
Casing_Defined := False;
if not Casing_String.Default then
pragma Assert
(Casing_String.Kind = Single, "Casing is not a string");
declare
Casing_Image : constant String :=
Get_Name_String (Casing_String.Value);
begin
if Casing_Image'Length = 0 then
Error_Msg
(Data.Flags,
"Casing cannot be an empty string",
Casing_String.Location, Project);
end if;
Casing := Value (Casing_Image);
Casing_Defined := True;
exception
when Constraint_Error =>
Name_Len := Casing_Image'Length;
Name_Buffer (1 .. Name_Len) := Casing_Image;
Err_Vars.Error_Msg_Name_1 := Name_Find;
Error_Msg
(Data.Flags,
"%% is not a correct Casing",
Casing_String.Location, Project);
end;
end if;
Write_Attr ("Casing", Image (Casing));
if not Sep_Suffix.Default then
if Length_Of_Name (Sep_Suffix.Value) = 0 then
Error_Msg
(Data.Flags,
"Separate_Suffix cannot be empty",
Sep_Suffix.Location, Project);
else
Separate_Suffix := Canonical_Case_File_Name (Sep_Suffix.Value);
Sep_Suffix_Loc := Sep_Suffix.Location;
Check_Illegal_Suffix
(Project, Separate_Suffix,
Dot_Replacement, "Separate_Suffix", Sep_Suffix.Location,
Data);
end if;
end if;
if Separate_Suffix /= No_File then
Write_Attr
("Separate_Suffix", Get_Name_String (Separate_Suffix));
end if;
end Check_Common;
-----------------------------------
-- Process_Exceptions_File_Based --
-----------------------------------
procedure Process_Exceptions_File_Based
(Lang_Id : Language_Ptr;
Kind : Source_Kind)
is
Lang : constant Name_Id := Lang_Id.Name;
Exceptions : Array_Element_Id;
Exception_List : Variable_Value;
Element_Id : String_List_Id;
Element : String_Element;
File_Name : File_Name_Type;
Source : Source_Id;
begin
case Kind is
when Impl | Sep =>
Exceptions :=
Value_Of
(Name_Implementation_Exceptions,
In_Arrays => Naming.Decl.Arrays,
Shared => Shared);
when Spec =>
Exceptions :=
Value_Of
(Name_Specification_Exceptions,
In_Arrays => Naming.Decl.Arrays,
Shared => Shared);
end case;
Exception_List :=
Value_Of
(Index => Lang,
In_Array => Exceptions,
Shared => Shared);
if Exception_List /= Nil_Variable_Value then
Element_Id := Exception_List.Values;
while Element_Id /= Nil_String loop
Element := Shared.String_Elements.Table (Element_Id);
File_Name := Canonical_Case_File_Name (Element.Value);
Source :=
Source_Files_Htable.Get
(Data.Tree.Source_Files_HT, File_Name);
while Source /= No_Source
and then Source.Project /= Project
loop
Source := Source.Next_With_File_Name;
end loop;
if Source = No_Source then
Add_Source
(Id => Source,
Data => Data,
Project => Project,
Source_Dir_Rank => 0,
Lang_Id => Lang_Id,
Kind => Kind,
File_Name => File_Name,
Display_File => File_Name_Type (Element.Value),
Naming_Exception => Yes,
Location => Element.Location);
else
-- Check if the file name is already recorded for another
-- language or another kind.
if Source.Language /= Lang_Id then
Error_Msg
(Data.Flags,
"the same file cannot be a source of two languages",
Element.Location, Project);
elsif Source.Kind /= Kind then
Error_Msg
(Data.Flags,
"the same file cannot be a source and a template",
Element.Location, Project);
end if;
-- If the file is already recorded for the same
-- language and the same kind, it means that the file
-- name appears several times in the *_Exceptions
-- attribute; so there is nothing to do.
end if;
Element_Id := Element.Next;
end loop;
end if;
end Process_Exceptions_File_Based;
-----------------------------------
-- Process_Exceptions_Unit_Based --
-----------------------------------
procedure Process_Exceptions_Unit_Based
(Lang_Id : Language_Ptr;
Kind : Source_Kind)
is
Exceptions : Array_Element_Id;
Element : Array_Element;
Unit : Name_Id;
Index : Int;
File_Name : File_Name_Type;
Source : Source_Id;
Naming_Exception : Naming_Exception_Type;
begin
case Kind is
when Impl | Sep =>
Exceptions :=
Value_Of
(Name_Body,
In_Arrays => Naming.Decl.Arrays,
Shared => Shared);
if Exceptions = No_Array_Element then
Exceptions :=
Value_Of
(Name_Implementation,
In_Arrays => Naming.Decl.Arrays,
Shared => Shared);
end if;
when Spec =>
Exceptions :=
Value_Of
(Name_Spec,
In_Arrays => Naming.Decl.Arrays,
Shared => Shared);
if Exceptions = No_Array_Element then
Exceptions :=
Value_Of
(Name_Specification,
In_Arrays => Naming.Decl.Arrays,
Shared => Shared);
end if;
end case;
while Exceptions /= No_Array_Element loop
Element := Shared.Array_Elements.Table (Exceptions);
if Element.Restricted then
Naming_Exception := Inherited;
else
Naming_Exception := Yes;
end if;
File_Name := Canonical_Case_File_Name (Element.Value.Value);
Get_Name_String (Element.Index);
To_Lower (Name_Buffer (1 .. Name_Len));
Index := Element.Value.Index;
-- Check if it is a valid unit name
Get_Name_String (Element.Index);
Check_Unit_Name (Name_Buffer (1 .. Name_Len), Unit);
if Unit = No_Name then
Err_Vars.Error_Msg_Name_1 := Element.Index;
Error_Msg
(Data.Flags,
"%% is not a valid unit name.",
Element.Value.Location, Project);
end if;
if Unit /= No_Name then
Add_Source
(Id => Source,
Data => Data,
Project => Project,
Source_Dir_Rank => 0,
Lang_Id => Lang_Id,
Kind => Kind,
File_Name => File_Name,
Display_File => File_Name_Type (Element.Value.Value),
Unit => Unit,
Index => Index,
Location => Element.Value.Location,
Naming_Exception => Naming_Exception);
end if;
Exceptions := Element.Next;
end loop;
end Process_Exceptions_Unit_Based;
------------------
-- Check_Naming --
------------------
procedure Check_Naming is
Dot_Replacement : File_Name_Type :=
File_Name_Type
(First_Name_Id + Character'Pos ('-'));
Separate_Suffix : File_Name_Type := No_File;
Casing : Casing_Type := All_Lower_Case;
Casing_Defined : Boolean;
Lang_Id : Language_Ptr;
Sep_Suffix_Loc : Source_Ptr;
Suffix : Variable_Value;
Lang : Name_Id;
begin
Check_Common
(Dot_Replacement => Dot_Replacement,
Casing => Casing,
Casing_Defined => Casing_Defined,
Separate_Suffix => Separate_Suffix,
Sep_Suffix_Loc => Sep_Suffix_Loc);
-- For all unit based languages, if any, set the specified value
-- of Dot_Replacement, Casing and/or Separate_Suffix. Do not
-- systematically overwrite, since the defaults come from the
-- configuration file.
if Dot_Replacement /= No_File
or else Casing_Defined
or else Separate_Suffix /= No_File
then
Lang_Id := Project.Languages;
while Lang_Id /= No_Language_Index loop
if Lang_Id.Config.Kind = Unit_Based then
if Dot_Replacement /= No_File then
Lang_Id.Config.Naming_Data.Dot_Replacement :=
Dot_Replacement;
end if;
if Casing_Defined then
Lang_Id.Config.Naming_Data.Casing := Casing;
end if;
end if;
Lang_Id := Lang_Id.Next;
end loop;
end if;
-- Next, get the spec and body suffixes
Lang_Id := Project.Languages;
while Lang_Id /= No_Language_Index loop
Lang := Lang_Id.Name;
-- Spec_Suffix
Suffix := Value_Of
(Name => Lang,
Attribute_Or_Array_Name => Name_Spec_Suffix,
In_Package => Naming_Id,
Shared => Shared);
if Suffix = Nil_Variable_Value then
Suffix := Value_Of
(Name => Lang,
Attribute_Or_Array_Name => Name_Specification_Suffix,
In_Package => Naming_Id,
Shared => Shared);
end if;
if Suffix /= Nil_Variable_Value
and then Suffix.Value /= No_Name
then
Lang_Id.Config.Naming_Data.Spec_Suffix :=
File_Name_Type (Suffix.Value);
Check_Illegal_Suffix
(Project,
Lang_Id.Config.Naming_Data.Spec_Suffix,
Lang_Id.Config.Naming_Data.Dot_Replacement,
"Spec_Suffix", Suffix.Location, Data);
Write_Attr
("Spec_Suffix",
Get_Name_String (Lang_Id.Config.Naming_Data.Spec_Suffix));
end if;
-- Body_Suffix
Suffix :=
Value_Of
(Name => Lang,
Attribute_Or_Array_Name => Name_Body_Suffix,
In_Package => Naming_Id,
Shared => Shared);
if Suffix = Nil_Variable_Value then
Suffix :=
Value_Of
(Name => Lang,
Attribute_Or_Array_Name => Name_Implementation_Suffix,
In_Package => Naming_Id,
Shared => Shared);
end if;
if Suffix /= Nil_Variable_Value
and then Suffix.Value /= No_Name
then
Lang_Id.Config.Naming_Data.Body_Suffix :=
File_Name_Type (Suffix.Value);
-- The default value of separate suffix should be the same as
-- the body suffix, so we need to compute that first.
if Separate_Suffix = No_File then
Lang_Id.Config.Naming_Data.Separate_Suffix :=
Lang_Id.Config.Naming_Data.Body_Suffix;
Write_Attr
("Sep_Suffix",
Get_Name_String
(Lang_Id.Config.Naming_Data.Separate_Suffix));
else
Lang_Id.Config.Naming_Data.Separate_Suffix :=
Separate_Suffix;
end if;
Check_Illegal_Suffix
(Project,
Lang_Id.Config.Naming_Data.Body_Suffix,
Lang_Id.Config.Naming_Data.Dot_Replacement,
"Body_Suffix", Suffix.Location, Data);
Write_Attr
("Body_Suffix",
Get_Name_String (Lang_Id.Config.Naming_Data.Body_Suffix));
elsif Separate_Suffix /= No_File then
Lang_Id.Config.Naming_Data.Separate_Suffix := Separate_Suffix;
end if;
-- Spec_Suffix cannot be equal to Body_Suffix or Separate_Suffix,
-- since that would cause a clear ambiguity. Note that we do allow
-- a Spec_Suffix to have the same termination as one of these,
-- which causes a potential ambiguity, but we resolve that by
-- matching the longest possible suffix.
if Lang_Id.Config.Naming_Data.Spec_Suffix /= No_File
and then Lang_Id.Config.Naming_Data.Spec_Suffix =
Lang_Id.Config.Naming_Data.Body_Suffix
then
Error_Msg
(Data.Flags,
"Body_Suffix ("""
& Get_Name_String (Lang_Id.Config.Naming_Data.Body_Suffix)
& """) cannot be the same as Spec_Suffix.",
Ada_Body_Suffix_Loc, Project);
end if;
if Lang_Id.Config.Naming_Data.Body_Suffix /=
Lang_Id.Config.Naming_Data.Separate_Suffix
and then Lang_Id.Config.Naming_Data.Spec_Suffix =
Lang_Id.Config.Naming_Data.Separate_Suffix
then
Error_Msg
(Data.Flags,
"Separate_Suffix ("""
& Get_Name_String
(Lang_Id.Config.Naming_Data.Separate_Suffix)
& """) cannot be the same as Spec_Suffix.",
Sep_Suffix_Loc, Project);
end if;
Lang_Id := Lang_Id.Next;
end loop;
-- Get the naming exceptions for all languages, but not for virtual
-- projects.
if not Project.Virtual then
for Kind in Spec_Or_Body loop
Lang_Id := Project.Languages;
while Lang_Id /= No_Language_Index loop
case Lang_Id.Config.Kind is
when File_Based =>
Process_Exceptions_File_Based (Lang_Id, Kind);
when Unit_Based =>
Process_Exceptions_Unit_Based (Lang_Id, Kind);
end case;
Lang_Id := Lang_Id.Next;
end loop;
end loop;
end if;
end Check_Naming;
----------------------------
-- Initialize_Naming_Data --
----------------------------
procedure Initialize_Naming_Data is
Specs : Array_Element_Id :=
Util.Value_Of
(Name_Spec_Suffix,
Naming.Decl.Arrays,
Shared);
Impls : Array_Element_Id :=
Util.Value_Of
(Name_Body_Suffix,
Naming.Decl.Arrays,
Shared);
Lang : Language_Ptr;
Lang_Name : Name_Id;
Value : Variable_Value;
Extended : Project_Id;
begin
-- At this stage, the project already contains the default extensions
-- for the various languages. We now merge those suffixes read in the
-- user project, and they override the default.
while Specs /= No_Array_Element loop
Lang_Name := Shared.Array_Elements.Table (Specs).Index;
Lang :=
Get_Language_From_Name
(Project, Name => Get_Name_String (Lang_Name));
-- An extending project inherits its parent projects' languages
-- so if needed we should create entries for those languages
if Lang = null then
Extended := Project.Extends;
while Extended /= null loop
Lang := Get_Language_From_Name
(Extended, Name => Get_Name_String (Lang_Name));
exit when Lang /= null;
Extended := Extended.Extends;
end loop;
if Lang /= null then
Lang := new Language_Data'(Lang.all);
Lang.First_Source := null;
Lang.Next := Project.Languages;
Project.Languages := Lang;
end if;
end if;
-- If language was not found in project or the projects it extends
if Lang = null then
Debug_Output
("ignoring spec naming data (lang. not in project): ",
Lang_Name);
else
Value := Shared.Array_Elements.Table (Specs).Value;
if Value.Kind = Single then
Lang.Config.Naming_Data.Spec_Suffix :=
Canonical_Case_File_Name (Value.Value);
end if;
end if;
Specs := Shared.Array_Elements.Table (Specs).Next;
end loop;
while Impls /= No_Array_Element loop
Lang_Name := Shared.Array_Elements.Table (Impls).Index;
Lang :=
Get_Language_From_Name
(Project, Name => Get_Name_String (Lang_Name));
if Lang = null then
Debug_Output
("ignoring impl naming data (lang. not in project): ",
Lang_Name);
else
Value := Shared.Array_Elements.Table (Impls).Value;
if Lang.Name = Name_Ada then
Ada_Body_Suffix_Loc := Value.Location;
end if;
if Value.Kind = Single then
Lang.Config.Naming_Data.Body_Suffix :=
Canonical_Case_File_Name (Value.Value);
end if;
end if;
Impls := Shared.Array_Elements.Table (Impls).Next;
end loop;
end Initialize_Naming_Data;
-- Start of processing for Check_Naming_Schemes
begin
-- No Naming package or parsing a configuration file? nothing to do
if Naming_Id /= No_Package
and then Project.Qualifier /= Configuration
then
Naming := Shared.Packages.Table (Naming_Id);
Debug_Increase_Indent ("checking package Naming for ", Project.Name);
Initialize_Naming_Data;
Check_Naming;
Debug_Decrease_Indent ("done checking package naming");
end if;
end Check_Package_Naming;
---------------------------------
-- Check_Programming_Languages --
---------------------------------
procedure Check_Programming_Languages
(Project : Project_Id;
Data : in out Tree_Processing_Data)
is
Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared;
Languages : Variable_Value := Nil_Variable_Value;
Def_Lang : Variable_Value := Nil_Variable_Value;
Def_Lang_Id : Name_Id;
procedure Add_Language (Name, Display_Name : Name_Id);
-- Add a new language to the list of languages for the project.
-- Nothing is done if the language has already been defined
------------------
-- Add_Language --
------------------
procedure Add_Language (Name, Display_Name : Name_Id) is
Lang : Language_Ptr;
begin
Lang := Project.Languages;
while Lang /= No_Language_Index loop
if Name = Lang.Name then
return;
end if;
Lang := Lang.Next;
end loop;
Lang := new Language_Data'(No_Language_Data);
Lang.Next := Project.Languages;
Project.Languages := Lang;
Lang.Name := Name;
Lang.Display_Name := Display_Name;
end Add_Language;
-- Start of processing for Check_Programming_Languages
begin
Project.Languages := null;
Languages :=
Prj.Util.Value_Of (Name_Languages, Project.Decl.Attributes, Shared);
Def_Lang :=
Prj.Util.Value_Of
(Name_Default_Language, Project.Decl.Attributes, Shared);
if Project.Source_Dirs /= Nil_String then
-- Check if languages are specified in this project
if Languages.Default then
-- Fail if there is no default language defined
if Def_Lang.Default then
Error_Msg
(Data.Flags,
"no languages defined for this project",
Project.Location, Project);
Def_Lang_Id := No_Name;
else
Get_Name_String (Def_Lang.Value);
To_Lower (Name_Buffer (1 .. Name_Len));
Def_Lang_Id := Name_Find;
end if;
if Def_Lang_Id /= No_Name then
Get_Name_String (Def_Lang_Id);
Name_Buffer (1) := GNAT.Case_Util.To_Upper (Name_Buffer (1));
Add_Language
(Name => Def_Lang_Id,
Display_Name => Name_Find);
end if;
else
declare
Current : String_List_Id := Languages.Values;
Element : String_Element;
begin
-- If there are no languages declared, there are no sources
if Current = Nil_String then
Project.Source_Dirs := Nil_String;
if Project.Qualifier = Standard then
Error_Msg
(Data.Flags,
"a standard project must have at least one language",
Languages.Location, Project);
end if;
else
-- Look through all the languages specified in attribute
-- Languages.
while Current /= Nil_String loop
Element := Shared.String_Elements.Table (Current);
Get_Name_String (Element.Value);
To_Lower (Name_Buffer (1 .. Name_Len));
Add_Language
(Name => Name_Find,
Display_Name => Element.Value);
Current := Element.Next;
end loop;
end if;
end;
end if;
end if;
end Check_Programming_Languages;
-------------------------------
-- Check_Stand_Alone_Library --
-------------------------------
procedure Check_Stand_Alone_Library
(Project : Project_Id;
Data : in out Tree_Processing_Data)
is
Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared;
Lib_Name : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Name,
Project.Decl.Attributes,
Shared);
Lib_Standalone : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Standalone,
Project.Decl.Attributes,
Shared);
Lib_Auto_Init : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Auto_Init,
Project.Decl.Attributes,
Shared);
Lib_Src_Dir : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Src_Dir,
Project.Decl.Attributes,
Shared);
Lib_Symbol_File : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Symbol_File,
Project.Decl.Attributes,
Shared);
Lib_Symbol_Policy : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Symbol_Policy,
Project.Decl.Attributes,
Shared);
Lib_Ref_Symbol_File : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Reference_Symbol_File,
Project.Decl.Attributes,
Shared);
Auto_Init_Supported : Boolean;
OK : Boolean := True;
begin
Auto_Init_Supported := Project.Config.Auto_Init_Supported;
-- It is a stand-alone library project file if there is at least one
-- unit in the declared or inherited interface.
if Project.Lib_Interface_ALIs = Nil_String then
if not Lib_Standalone.Default
and then Get_Name_String (Lib_Standalone.Value) /= "no"
then
Error_Msg
(Data.Flags,
"Library_Standalone valid only if library has Ada interfaces",
Lib_Standalone.Location, Project);
end if;
else
if Project.Standalone_Library = No then
Project.Standalone_Library := Standard;
end if;
-- The name of a stand-alone library needs to have the syntax of an
-- Ada identifier.
declare
Name : constant String := Get_Name_String (Project.Library_Name);
OK : Boolean := Is_Letter (Name (Name'First));
Underline : Boolean := False;
begin
for J in Name'First + 1 .. Name'Last loop
exit when not OK;
if Is_Alphanumeric (Name (J)) then
Underline := False;
elsif Name (J) = '_' then
if Underline then
OK := False;
else
Underline := True;
end if;
else
OK := False;
end if;
end loop;
OK := OK and not Underline;
if not OK then
Error_Msg
(Data.Flags,
"Incorrect library name for a Stand-Alone Library",
Lib_Name.Location, Project);
return;
end if;
end;
if Lib_Standalone.Default then
Project.Standalone_Library := Standard;
else
Get_Name_String (Lib_Standalone.Value);
To_Lower (Name_Buffer (1 .. Name_Len));
if Name_Buffer (1 .. Name_Len) = "standard" then
Project.Standalone_Library := Standard;
elsif Name_Buffer (1 .. Name_Len) = "encapsulated" then
Project.Standalone_Library := Encapsulated;
elsif Name_Buffer (1 .. Name_Len) = "no" then
Project.Standalone_Library := No;
Error_Msg
(Data.Flags,
"wrong value for Library_Standalone "
& "when Library_Interface defined",
Lib_Standalone.Location, Project);
else
Error_Msg
(Data.Flags,
"invalid value for attribute Library_Standalone",
Lib_Standalone.Location, Project);
end if;
end if;
-- Check value of attribute Library_Auto_Init and set Lib_Auto_Init
-- accordingly.
if Lib_Auto_Init.Default then
-- If no attribute Library_Auto_Init is declared, then set auto
-- init only if it is supported.
Project.Lib_Auto_Init := Auto_Init_Supported;
else
Get_Name_String (Lib_Auto_Init.Value);
To_Lower (Name_Buffer (1 .. Name_Len));
if Name_Buffer (1 .. Name_Len) = "false" then
Project.Lib_Auto_Init := False;
elsif Name_Buffer (1 .. Name_Len) = "true" then
if Auto_Init_Supported then
Project.Lib_Auto_Init := True;
else
-- Library_Auto_Init cannot be "true" if auto init is not
-- supported.
Error_Msg
(Data.Flags,
"library auto init not supported " &
"on this platform",
Lib_Auto_Init.Location, Project);
end if;
else
Error_Msg
(Data.Flags,
"invalid value for attribute Library_Auto_Init",
Lib_Auto_Init.Location, Project);
end if;
end if;
-- If attribute Library_Src_Dir is defined and not the empty string,
-- check if the directory exist and is not the object directory or
-- one of the source directories. This is the directory where copies
-- of the interface sources will be copied. Note that this directory
-- may be the library directory.
if Lib_Src_Dir.Value /= Empty_String then
declare
Dir_Id : constant File_Name_Type :=
File_Name_Type (Lib_Src_Dir.Value);
Dir_Exists : Boolean;
begin
Locate_Directory
(Project,
Dir_Id,
Path => Project.Library_Src_Dir,
Dir_Exists => Dir_Exists,
Data => Data,
Must_Exist => False,
Create => "library source copy",
Location => Lib_Src_Dir.Location,
Externally_Built => Project.Externally_Built);
-- If directory does not exist, report an error
if not Dir_Exists then
-- Get the absolute name of the library directory that does
-- not exist, to report an error.
Err_Vars.Error_Msg_File_1 :=
File_Name_Type (Project.Library_Src_Dir.Display_Name);
Error_Msg
(Data.Flags,
"Directory { does not exist",
Lib_Src_Dir.Location, Project);
-- Report error if it is the same as the object directory
elsif Project.Library_Src_Dir = Project.Object_Directory then
Error_Msg
(Data.Flags,
"directory to copy interfaces cannot be " &
"the object directory",
Lib_Src_Dir.Location, Project);
Project.Library_Src_Dir := No_Path_Information;
else
declare
Src_Dirs : String_List_Id;
Src_Dir : String_Element;
Pid : Project_List;
begin
-- Interface copy directory cannot be one of the source
-- directory of the current project.
Src_Dirs := Project.Source_Dirs;
while Src_Dirs /= Nil_String loop
Src_Dir := Shared.String_Elements.Table (Src_Dirs);
-- Report error if it is one of the source directories
if Project.Library_Src_Dir.Name =
Path_Name_Type (Src_Dir.Value)
then
Error_Msg
(Data.Flags,
"directory to copy interfaces cannot " &
"be one of the source directories",
Lib_Src_Dir.Location, Project);
Project.Library_Src_Dir := No_Path_Information;
exit;
end if;
Src_Dirs := Src_Dir.Next;
end loop;
if Project.Library_Src_Dir /= No_Path_Information then
-- It cannot be a source directory of any other
-- project either.
Pid := Data.Tree.Projects;
Project_Loop : loop
exit Project_Loop when Pid = null;
Src_Dirs := Pid.Project.Source_Dirs;
Dir_Loop : while Src_Dirs /= Nil_String loop
Src_Dir :=
Shared.String_Elements.Table (Src_Dirs);
-- Report error if it is one of the source
-- directories.
if Project.Library_Src_Dir.Name =
Path_Name_Type (Src_Dir.Value)
then
Error_Msg_File_1 :=
File_Name_Type (Src_Dir.Value);
Error_Msg_Name_1 := Pid.Project.Name;
Error_Msg
(Data.Flags,
"directory to copy interfaces cannot " &
"be the same as source directory { of " &
"project %%",
Lib_Src_Dir.Location, Project);
Project.Library_Src_Dir :=
No_Path_Information;
exit Project_Loop;
end if;
Src_Dirs := Src_Dir.Next;
end loop Dir_Loop;
Pid := Pid.Next;
end loop Project_Loop;
end if;
end;
-- In high verbosity, if there is a valid Library_Src_Dir,
-- display its path name.
if Project.Library_Src_Dir /= No_Path_Information
and then Current_Verbosity = High
then
Write_Attr
("Directory to copy interfaces",
Get_Name_String (Project.Library_Src_Dir.Name));
end if;
end if;
end;
end if;
-- Check the symbol related attributes
-- First, the symbol policy
if not Lib_Symbol_Policy.Default then
declare
Value : constant String :=
To_Lower
(Get_Name_String (Lib_Symbol_Policy.Value));
begin
-- Symbol policy must have one of a limited number of values
if Value = "autonomous" or else Value = "default" then
Project.Symbol_Data.Symbol_Policy := Autonomous;
elsif Value = "compliant" then
Project.Symbol_Data.Symbol_Policy := Compliant;
elsif Value = "controlled" then
Project.Symbol_Data.Symbol_Policy := Controlled;
elsif Value = "restricted" then
Project.Symbol_Data.Symbol_Policy := Restricted;
elsif Value = "direct" then
Project.Symbol_Data.Symbol_Policy := Direct;
else
Error_Msg
(Data.Flags,
"illegal value for Library_Symbol_Policy",
Lib_Symbol_Policy.Location, Project);
end if;
end;
end if;
-- If attribute Library_Symbol_File is not specified, symbol policy
-- cannot be Restricted.
if Lib_Symbol_File.Default then
if Project.Symbol_Data.Symbol_Policy = Restricted then
Error_Msg
(Data.Flags,
"Library_Symbol_File needs to be defined when " &
"symbol policy is Restricted",
Lib_Symbol_Policy.Location, Project);
end if;
else
-- Library_Symbol_File is defined
Project.Symbol_Data.Symbol_File :=
Path_Name_Type (Lib_Symbol_File.Value);
Get_Name_String (Lib_Symbol_File.Value);
if Name_Len = 0 then
Error_Msg
(Data.Flags,
"symbol file name cannot be an empty string",
Lib_Symbol_File.Location, Project);
else
OK := not Is_Absolute_Path (Name_Buffer (1 .. Name_Len));
if OK then
for J in 1 .. Name_Len loop
if Is_Directory_Separator (Name_Buffer (J)) then
OK := False;
exit;
end if;
end loop;
end if;
if not OK then
Error_Msg_File_1 := File_Name_Type (Lib_Symbol_File.Value);
Error_Msg
(Data.Flags,
"symbol file name { is illegal. " &
"Name cannot include directory info.",
Lib_Symbol_File.Location, Project);
end if;
end if;
end if;
-- If attribute Library_Reference_Symbol_File is not defined,
-- symbol policy cannot be Compliant or Controlled.
if Lib_Ref_Symbol_File.Default then
if Project.Symbol_Data.Symbol_Policy = Compliant
or else Project.Symbol_Data.Symbol_Policy = Controlled
then
Error_Msg
(Data.Flags,
"a reference symbol file needs to be defined",
Lib_Symbol_Policy.Location, Project);
end if;
else
-- Library_Reference_Symbol_File is defined, check file exists
Project.Symbol_Data.Reference :=
Path_Name_Type (Lib_Ref_Symbol_File.Value);
Get_Name_String (Lib_Ref_Symbol_File.Value);
if Name_Len = 0 then
Error_Msg
(Data.Flags,
"reference symbol file name cannot be an empty string",
Lib_Symbol_File.Location, Project);
else
if not Is_Absolute_Path (Name_Buffer (1 .. Name_Len)) then
Name_Len := 0;
Add_Str_To_Name_Buffer
(Get_Name_String (Project.Directory.Name));
Add_Str_To_Name_Buffer
(Get_Name_String (Lib_Ref_Symbol_File.Value));
Project.Symbol_Data.Reference := Name_Find;
end if;
if not Is_Regular_File
(Get_Name_String (Project.Symbol_Data.Reference))
then
Error_Msg_File_1 :=
File_Name_Type (Lib_Ref_Symbol_File.Value);
-- For controlled and direct symbol policies, it is an error
-- if the reference symbol file does not exist. For other
-- symbol policies, this is just a warning
Error_Msg_Warn :=
Project.Symbol_Data.Symbol_Policy /= Controlled
and then Project.Symbol_Data.Symbol_Policy /= Direct;
Error_Msg
(Data.Flags,
"<library reference symbol file { does not exist",
Lib_Ref_Symbol_File.Location, Project);
-- In addition in the non-controlled case, if symbol policy
-- is Compliant, it is changed to Autonomous, because there
-- is no reference to check against, and we don't want to
-- fail in this case.
if Project.Symbol_Data.Symbol_Policy /= Controlled then
if Project.Symbol_Data.Symbol_Policy = Compliant then
Project.Symbol_Data.Symbol_Policy := Autonomous;
end if;
end if;
end if;
-- If both the reference symbol file and the symbol file are
-- defined, then check that they are not the same file.
if Project.Symbol_Data.Symbol_File /= No_Path then
Get_Name_String (Project.Symbol_Data.Symbol_File);
if Name_Len > 0 then
declare
-- We do not need to pass a Directory to
-- Normalize_Pathname, since the path_information
-- already contains absolute information.
Symb_Path : constant String :=
Normalize_Pathname
(Get_Name_String
(Project.Object_Directory.Name) &
Name_Buffer (1 .. Name_Len),
Directory => "/",
Resolve_Links =>
Opt.Follow_Links_For_Files);
Ref_Path : constant String :=
Normalize_Pathname
(Get_Name_String
(Project.Symbol_Data.Reference),
Directory => "/",
Resolve_Links =>
Opt.Follow_Links_For_Files);
begin
if Symb_Path = Ref_Path then
Error_Msg
(Data.Flags,
"library reference symbol file and library" &
" symbol file cannot be the same file",
Lib_Ref_Symbol_File.Location, Project);
end if;
end;
end if;
end if;
end if;
end if;
end if;
end Check_Stand_Alone_Library;
---------------------
-- Check_Unit_Name --
---------------------
procedure Check_Unit_Name (Name : String; Unit : out Name_Id) is
The_Name : String := Name;
Real_Name : Name_Id;
Need_Letter : Boolean := True;
Last_Underscore : Boolean := False;
OK : Boolean := The_Name'Length > 0;
First : Positive;
function Is_Reserved (Name : Name_Id) return Boolean;
function Is_Reserved (S : String) return Boolean;
-- Check that the given name is not an Ada 95 reserved word. The reason
-- for the Ada 95 here is that we do not want to exclude the case of an
-- Ada 95 unit called Interface (for example). In Ada 2005, such a unit
-- name would be rejected anyway by the compiler. That means there is no
-- requirement that the project file parser reject this.
-----------------
-- Is_Reserved --
-----------------
function Is_Reserved (S : String) return Boolean is
begin
Name_Len := 0;
Add_Str_To_Name_Buffer (S);
return Is_Reserved (Name_Find);
end Is_Reserved;
-----------------
-- Is_Reserved --
-----------------
function Is_Reserved (Name : Name_Id) return Boolean is
begin
if Get_Name_Table_Byte (Name) /= 0
and then
not Nam_In (Name, Name_Project, Name_Extends, Name_External)
and then Name not in Ada_2005_Reserved_Words
then
Unit := No_Name;
Debug_Output ("Ada reserved word: ", Name);
return True;
else
return False;
end if;
end Is_Reserved;
-- Start of processing for Check_Unit_Name
begin
To_Lower (The_Name);
Name_Len := The_Name'Length;
Name_Buffer (1 .. Name_Len) := The_Name;
Real_Name := Name_Find;
if Is_Reserved (Real_Name) then
return;
end if;
First := The_Name'First;
for Index in The_Name'Range loop
if Need_Letter then
-- We need a letter (at the beginning, and following a dot),
-- but we don't have one.
if Is_Letter (The_Name (Index)) then
Need_Letter := False;
else
OK := False;
if Current_Verbosity = High then
Debug_Indent;
Write_Int (Types.Int (Index));
Write_Str (": '");
Write_Char (The_Name (Index));
Write_Line ("' is not a letter.");
end if;
exit;
end if;
elsif Last_Underscore
and then (The_Name (Index) = '_' or else The_Name (Index) = '.')
then
-- Two underscores are illegal, and a dot cannot follow
-- an underscore.
OK := False;
if Current_Verbosity = High then
Debug_Indent;
Write_Int (Types.Int (Index));
Write_Str (": '");
Write_Char (The_Name (Index));
Write_Line ("' is illegal here.");
end if;
exit;
elsif The_Name (Index) = '.' then
-- First, check if the name before the dot is not a reserved word
if Is_Reserved (The_Name (First .. Index - 1)) then
return;
end if;
First := Index + 1;
-- We need a letter after a dot
Need_Letter := True;
elsif The_Name (Index) = '_' then
Last_Underscore := True;
else
-- We need an letter or a digit
Last_Underscore := False;
if not Is_Alphanumeric (The_Name (Index)) then
OK := False;
if Current_Verbosity = High then
Debug_Indent;
Write_Int (Types.Int (Index));
Write_Str (": '");
Write_Char (The_Name (Index));
Write_Line ("' is not alphanumeric.");
end if;
exit;
end if;
end if;
end loop;
-- Cannot end with an underscore or a dot
OK := OK and then not Need_Letter and then not Last_Underscore;
if OK then
if First /= Name'First
and then Is_Reserved (The_Name (First .. The_Name'Last))
then
return;
end if;
Unit := Real_Name;
else
-- Signal a problem with No_Name
Unit := No_Name;
end if;
end Check_Unit_Name;
----------------------------
-- Compute_Directory_Last --
----------------------------
function Compute_Directory_Last (Dir : String) return Natural is
begin
if Dir'Length > 1
and then Is_Directory_Separator (Dir (Dir'Last - 1))
then
return Dir'Last - 1;
else
return Dir'Last;
end if;
end Compute_Directory_Last;
---------------------
-- Get_Directories --
---------------------
procedure Get_Directories
(Project : Project_Id;
Data : in out Tree_Processing_Data)
is
Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared;
Object_Dir : constant Variable_Value :=
Util.Value_Of
(Name_Object_Dir, Project.Decl.Attributes, Shared);
Exec_Dir : constant Variable_Value :=
Util.Value_Of
(Name_Exec_Dir, Project.Decl.Attributes, Shared);
Source_Dirs : constant Variable_Value :=
Util.Value_Of
(Name_Source_Dirs, Project.Decl.Attributes, Shared);
Ignore_Source_Sub_Dirs : constant Variable_Value :=
Util.Value_Of
(Name_Ignore_Source_Sub_Dirs,
Project.Decl.Attributes,
Shared);
Excluded_Source_Dirs : constant Variable_Value :=
Util.Value_Of
(Name_Excluded_Source_Dirs,
Project.Decl.Attributes,
Shared);
Source_Files : constant Variable_Value :=
Util.Value_Of
(Name_Source_Files,
Project.Decl.Attributes, Shared);
Last_Source_Dir : String_List_Id := Nil_String;
Last_Src_Dir_Rank : Number_List_Index := No_Number_List;
Languages : constant Variable_Value :=
Prj.Util.Value_Of
(Name_Languages, Project.Decl.Attributes, Shared);
Remove_Source_Dirs : Boolean := False;
procedure Add_To_Or_Remove_From_Source_Dirs
(Path : Path_Information;
Rank : Natural);
-- When Removed = False, the directory Path_Id to the list of
-- source_dirs if not already in the list. When Removed = True,
-- removed directory Path_Id if in the list.
procedure Find_Source_Dirs is new Expand_Subdirectory_Pattern
(Add_To_Or_Remove_From_Source_Dirs);
---------------------------------------
-- Add_To_Or_Remove_From_Source_Dirs --
---------------------------------------
procedure Add_To_Or_Remove_From_Source_Dirs
(Path : Path_Information;
Rank : Natural)
is
List : String_List_Id;
Prev : String_List_Id;
Rank_List : Number_List_Index;
Prev_Rank : Number_List_Index;
Element : String_Element;
begin
Prev := Nil_String;
Prev_Rank := No_Number_List;
List := Project.Source_Dirs;
Rank_List := Project.Source_Dir_Ranks;
while List /= Nil_String loop
Element := Shared.String_Elements.Table (List);
exit when Element.Value = Name_Id (Path.Name);
Prev := List;
List := Element.Next;
Prev_Rank := Rank_List;
Rank_List := Shared.Number_Lists.Table (Prev_Rank).Next;
end loop;
-- The directory is in the list if List is not Nil_String
if not Remove_Source_Dirs and then List = Nil_String then
Debug_Output ("adding source dir=", Name_Id (Path.Display_Name));
String_Element_Table.Increment_Last (Shared.String_Elements);
Element :=
(Value => Name_Id (Path.Name),
Index => 0,
Display_Value => Name_Id (Path.Display_Name),
Location => No_Location,
Flag => False,
Next => Nil_String);
Number_List_Table.Increment_Last (Shared.Number_Lists);
if Last_Source_Dir = Nil_String then
-- This is the first source directory
Project.Source_Dirs :=
String_Element_Table.Last (Shared.String_Elements);
Project.Source_Dir_Ranks :=
Number_List_Table.Last (Shared.Number_Lists);
else
-- We already have source directories, link the previous
-- last to the new one.
Shared.String_Elements.Table (Last_Source_Dir).Next :=
String_Element_Table.Last (Shared.String_Elements);
Shared.Number_Lists.Table (Last_Src_Dir_Rank).Next :=
Number_List_Table.Last (Shared.Number_Lists);
end if;
-- And register this source directory as the new last
Last_Source_Dir :=
String_Element_Table.Last (Shared.String_Elements);
Shared.String_Elements.Table (Last_Source_Dir) := Element;
Last_Src_Dir_Rank := Number_List_Table.Last (Shared.Number_Lists);
Shared.Number_Lists.Table (Last_Src_Dir_Rank) :=
(Number => Rank, Next => No_Number_List);
elsif Remove_Source_Dirs and then List /= Nil_String then
-- Remove source dir if present
if Prev = Nil_String then
Project.Source_Dirs := Shared.String_Elements.Table (List).Next;
Project.Source_Dir_Ranks :=
Shared.Number_Lists.Table (Rank_List).Next;
else
Shared.String_Elements.Table (Prev).Next :=
Shared.String_Elements.Table (List).Next;
Shared.Number_Lists.Table (Prev_Rank).Next :=
Shared.Number_Lists.Table (Rank_List).Next;
end if;
end if;
end Add_To_Or_Remove_From_Source_Dirs;
-- Local declarations
Dir_Exists : Boolean;
No_Sources : constant Boolean :=
Project.Qualifier = Abstract_Project
or else (((not Source_Files.Default
and then Source_Files.Values = Nil_String)
or else
(not Source_Dirs.Default
and then Source_Dirs.Values = Nil_String)
or else
(not Languages.Default
and then Languages.Values = Nil_String))
and then Project.Extends = No_Project);
-- Start of processing for Get_Directories
begin
Debug_Output ("starting to look for directories");
-- Set the object directory to its default which may be nil, if there
-- is no sources in the project.
if No_Sources then
Project.Object_Directory := No_Path_Information;
else
Project.Object_Directory := Project.Directory;
end if;
-- Check the object directory
if Object_Dir.Value /= Empty_String then
Get_Name_String (Object_Dir.Value);
if Name_Len = 0 then
Error_Msg
(Data.Flags,
"Object_Dir cannot be empty",
Object_Dir.Location, Project);
elsif Setup_Projects
and then No_Sources
and then Project.Extends = No_Project
then
-- Do not create an object directory for a non extending project
-- with no sources.
Locate_Directory
(Project,
File_Name_Type (Object_Dir.Value),
Path => Project.Object_Directory,
Dir_Exists => Dir_Exists,
Data => Data,
Location => Object_Dir.Location,
Must_Exist => False,
Externally_Built => Project.Externally_Built);
else
-- We check that the specified object directory does exist.
-- However, even when it doesn't exist, we set it to a default
-- value. This is for the benefit of tools that recover from
-- errors; for example, these tools could create the non existent
-- directory. We always return an absolute directory name though.
Locate_Directory
(Project,
File_Name_Type (Object_Dir.Value),
Path => Project.Object_Directory,
Create => "object",
Dir_Exists => Dir_Exists,
Data => Data,
Location => Object_Dir.Location,
Must_Exist => False,
Externally_Built => Project.Externally_Built);
if not Dir_Exists and then not Project.Externally_Built then
if Opt.Directories_Must_Exist_In_Projects then
-- The object directory does not exist, report an error if
-- the project is not externally built.
Err_Vars.Error_Msg_File_1 :=
File_Name_Type (Object_Dir.Value);
Error_Or_Warning
(Data.Flags, Data.Flags.Require_Obj_Dirs,
"object directory { not found",
Project.Location, Project);
end if;
end if;
end if;
elsif not No_Sources and then Subdirs /= null then
Name_Len := 1;
Name_Buffer (1) := '.';
Locate_Directory
(Project,
Name_Find,
Path => Project.Object_Directory,
Create => "object",
Dir_Exists => Dir_Exists,
Data => Data,
Location => Object_Dir.Location,
Externally_Built => Project.Externally_Built);
end if;
if Current_Verbosity = High then
if Project.Object_Directory = No_Path_Information then
Debug_Output ("no object directory");
else
Write_Attr
("Object directory",
Get_Name_String (Project.Object_Directory.Display_Name));
end if;
end if;
-- Check the exec directory
-- We set the object directory to its default
Project.Exec_Directory := Project.Object_Directory;
if Exec_Dir.Value /= Empty_String then
Get_Name_String (Exec_Dir.Value);
if Name_Len = 0 then
Error_Msg
(Data.Flags,
"Exec_Dir cannot be empty",
Exec_Dir.Location, Project);
elsif Setup_Projects
and then No_Sources
and then Project.Extends = No_Project
then
-- Do not create an exec directory for a non extending project
-- with no sources.
Locate_Directory
(Project,
File_Name_Type (Exec_Dir.Value),
Path => Project.Exec_Directory,
Dir_Exists => Dir_Exists,
Data => Data,
Location => Exec_Dir.Location,
Externally_Built => Project.Externally_Built);
else
-- We check that the specified exec directory does exist
Locate_Directory
(Project,
File_Name_Type (Exec_Dir.Value),
Path => Project.Exec_Directory,
Dir_Exists => Dir_Exists,
Data => Data,
Create => "exec",
Location => Exec_Dir.Location,
Externally_Built => Project.Externally_Built);
if not Dir_Exists then
if Opt.Directories_Must_Exist_In_Projects then
Err_Vars.Error_Msg_File_1 := File_Name_Type (Exec_Dir.Value);
Error_Or_Warning
(Data.Flags, Data.Flags.Missing_Source_Files,
"exec directory { not found", Project.Location, Project);
else
Project.Exec_Directory := No_Path_Information;
end if;
end if;
end if;
end if;
if Current_Verbosity = High then
if Project.Exec_Directory = No_Path_Information then
Debug_Output ("no exec directory");
else
Debug_Output
("exec directory: ",
Name_Id (Project.Exec_Directory.Display_Name));
end if;
end if;
-- Look for the source directories
Debug_Output ("starting to look for source directories");
pragma Assert (Source_Dirs.Kind = List, "Source_Dirs is not a list");
if not Source_Files.Default and then Source_Files.Values = Nil_String
then
Project.Source_Dirs := Nil_String;
if Project.Qualifier = Standard then
Error_Msg
(Data.Flags,
"a standard project cannot have no sources",
Source_Files.Location, Project);
end if;
elsif Source_Dirs.Default then
-- No Source_Dirs specified: the single source directory is the one
-- containing the project file.
Remove_Source_Dirs := False;
Add_To_Or_Remove_From_Source_Dirs
(Path => (Name => Project.Directory.Name,
Display_Name => Project.Directory.Display_Name),
Rank => 1);
else
Remove_Source_Dirs := False;
Find_Source_Dirs
(Project => Project,
Data => Data,
Patterns => Source_Dirs.Values,
Ignore => Ignore_Source_Sub_Dirs.Values,
Search_For => Search_Directories,
Resolve_Links => Opt.Follow_Links_For_Dirs);
if Project.Source_Dirs = Nil_String
and then Project.Qualifier = Standard
then
Error_Msg
(Data.Flags,
"a standard project cannot have no source directories",
Source_Dirs.Location, Project);
end if;
end if;
if not Excluded_Source_Dirs.Default
and then Excluded_Source_Dirs.Values /= Nil_String
then
Remove_Source_Dirs := True;
Find_Source_Dirs
(Project => Project,
Data => Data,
Patterns => Excluded_Source_Dirs.Values,
Ignore => Nil_String,
Search_For => Search_Directories,
Resolve_Links => Opt.Follow_Links_For_Dirs);
end if;
Debug_Output ("putting source directories in canonical cases");
declare
Current : String_List_Id := Project.Source_Dirs;
Element : String_Element;
begin
while Current /= Nil_String loop
Element := Shared.String_Elements.Table (Current);
if Element.Value /= No_Name then
Element.Value :=
Name_Id (Canonical_Case_File_Name (Element.Value));
Shared.String_Elements.Table (Current) := Element;
end if;
Current := Element.Next;
end loop;
end;
end Get_Directories;
---------------
-- Get_Mains --
---------------
procedure Get_Mains
(Project : Project_Id;
Data : in out Tree_Processing_Data)
is
Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared;
Mains : constant Variable_Value :=
Prj.Util.Value_Of
(Name_Main, Project.Decl.Attributes, Shared);
List : String_List_Id;
Elem : String_Element;
begin
Project.Mains := Mains.Values;
-- If no Mains were specified, and if we are an extending project,
-- inherit the Mains from the project we are extending.
if Mains.Default then
if not Project.Library and then Project.Extends /= No_Project then
Project.Mains := Project.Extends.Mains;
end if;
-- In a library project file, Main cannot be specified
elsif Project.Library then
Error_Msg
(Data.Flags,
"a library project file cannot have Main specified",
Mains.Location, Project);
else
List := Mains.Values;
while List /= Nil_String loop
Elem := Shared.String_Elements.Table (List);
if Length_Of_Name (Elem.Value) = 0 then
Error_Msg
(Data.Flags,
"?a main cannot have an empty name",
Elem.Location, Project);
exit;
end if;
List := Elem.Next;
end loop;
end if;
end Get_Mains;
---------------------------
-- Get_Sources_From_File --
---------------------------
procedure Get_Sources_From_File
(Path : String;
Location : Source_Ptr;
Project : in out Project_Processing_Data;
Data : in out Tree_Processing_Data)
is
File : Prj.Util.Text_File;
Line : String (1 .. 250);
Last : Natural;
Source_Name : File_Name_Type;
Name_Loc : Name_Location;
begin
if Current_Verbosity = High then
Debug_Output ("opening """ & Path & '"');
end if;
-- Open the file
Prj.Util.Open (File, Path);
if not Prj.Util.Is_Valid (File) then
Error_Msg
(Data.Flags, "file does not exist", Location, Project.Project);
else
-- Read the lines one by one
while not Prj.Util.End_Of_File (File) loop
Prj.Util.Get_Line (File, Line, Last);
-- A non empty, non comment line should contain a file name
if Last /= 0 and then (Last = 1 or else Line (1 .. 2) /= "--") then
Name_Len := Last;
Name_Buffer (1 .. Name_Len) := Line (1 .. Last);
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Source_Name := Name_Find;
-- Check that there is no directory information
for J in 1 .. Last loop
if Is_Directory_Separator (Line (J)) then
Error_Msg_File_1 := Source_Name;
Error_Msg
(Data.Flags,
"file name cannot include directory information ({)",
Location, Project.Project);
exit;
end if;
end loop;
Name_Loc := Source_Names_Htable.Get
(Project.Source_Names, Source_Name);
if Name_Loc = No_Name_Location then
Name_Loc :=
(Name => Source_Name,
Location => Location,
Source => No_Source,
Listed => True,
Found => False);
else
Name_Loc.Listed := True;
end if;
Source_Names_Htable.Set
(Project.Source_Names, Source_Name, Name_Loc);
end if;
end loop;
Prj.Util.Close (File);
end if;
end Get_Sources_From_File;
------------------
-- No_Space_Img --
------------------
function No_Space_Img (N : Natural) return String is
Image : constant String := N'Img;
begin
return Image (2 .. Image'Last);
end No_Space_Img;
-----------------------
-- Compute_Unit_Name --
-----------------------
procedure Compute_Unit_Name
(File_Name : File_Name_Type;
Naming : Lang_Naming_Data;
Kind : out Source_Kind;
Unit : out Name_Id;
Project : Project_Processing_Data)
is
Filename : constant String := Get_Name_String (File_Name);
Last : Integer := Filename'Last;
Sep_Len : Integer;
Body_Len : Integer;
Spec_Len : Integer;
Unit_Except : Unit_Exception;
Masked : Boolean := False;
begin
Unit := No_Name;
Kind := Spec;
if Naming.Separate_Suffix = No_File
or else Naming.Body_Suffix = No_File
or else Naming.Spec_Suffix = No_File
then
return;
end if;
if Naming.Dot_Replacement = No_File then
Debug_Output ("no dot_replacement specified");
return;
end if;
Sep_Len := Integer (Length_Of_Name (Naming.Separate_Suffix));
Spec_Len := Integer (Length_Of_Name (Naming.Spec_Suffix));
Body_Len := Integer (Length_Of_Name (Naming.Body_Suffix));
-- Choose the longest suffix that matches. If there are several matches,
-- give priority to specs, then bodies, then separates.
if Naming.Separate_Suffix /= Naming.Body_Suffix
and then Suffix_Matches (Filename, Naming.Separate_Suffix)
then
Last := Filename'Last - Sep_Len;
Kind := Sep;
end if;
if Filename'Last - Body_Len <= Last
and then Suffix_Matches (Filename, Naming.Body_Suffix)
then
Last := Natural'Min (Last, Filename'Last - Body_Len);
Kind := Impl;
end if;
if Filename'Last - Spec_Len <= Last
and then Suffix_Matches (Filename, Naming.Spec_Suffix)
then
Last := Natural'Min (Last, Filename'Last - Spec_Len);
Kind := Spec;
end if;
if Last = Filename'Last then
Debug_Output ("no matching suffix");
return;
end if;
-- Check that the casing matches
if File_Names_Case_Sensitive then
case Naming.Casing is
when All_Lower_Case =>
for J in Filename'First .. Last loop
if Is_Letter (Filename (J))
and then not Is_Lower (Filename (J))
then
Debug_Output ("invalid casing");
return;
end if;
end loop;
when All_Upper_Case =>
for J in Filename'First .. Last loop
if Is_Letter (Filename (J))
and then not Is_Upper (Filename (J))
then
Debug_Output ("invalid casing");
return;
end if;
end loop;
when Mixed_Case | Unknown =>
null;
end case;
end if;
-- If Dot_Replacement is not a single dot, then there should not
-- be any dot in the name.
declare
Dot_Repl : constant String :=
Get_Name_String (Naming.Dot_Replacement);
begin
if Dot_Repl /= "." then
for Index in Filename'First .. Last loop
if Filename (Index) = '.' then
Debug_Output ("invalid name, contains dot");
return;
end if;
end loop;
Replace_Into_Name_Buffer
(Filename (Filename'First .. Last), Dot_Repl, '.');
else
Name_Len := Last - Filename'First + 1;
Name_Buffer (1 .. Name_Len) := Filename (Filename'First .. Last);
Fixed.Translate
(Source => Name_Buffer (1 .. Name_Len),
Mapping => Lower_Case_Map);
end if;
end;
-- In the standard GNAT naming scheme, check for special cases: children
-- or separates of A, G, I or S, and run time sources.
if Is_Standard_GNAT_Naming (Naming) and then Name_Len >= 3 then
declare
S1 : constant Character := Name_Buffer (1);
S2 : constant Character := Name_Buffer (2);
S3 : constant Character := Name_Buffer (3);
begin
if S1 = 'a' or else S1 = 'g' or else S1 = 'i' or else S1 = 's' then
-- Children or separates of packages A, G, I or S. These names
-- are x__ ... or x~... (where x is a, g, i, or s). Both
-- versions (x__... and x~...) are allowed in all platforms,
-- because it is not possible to know the platform before
-- processing of the project files.
if S2 = '_' and then S3 = '_' then
Name_Buffer (2) := '.';
Name_Buffer (3 .. Name_Len - 1) :=
Name_Buffer (4 .. Name_Len);
Name_Len := Name_Len - 1;
elsif S2 = '~' then
Name_Buffer (2) := '.';
elsif S2 = '.' then
-- If it is potentially a run time source
null;
end if;
end if;
end;
end if;
-- Name_Buffer contains the name of the unit in lower-cases. Check
-- that this is a valid unit name
Check_Unit_Name (Name_Buffer (1 .. Name_Len), Unit);
-- If there is a naming exception for the same unit, the file is not
-- a source for the unit.
if Unit /= No_Name then
Unit_Except :=
Unit_Exceptions_Htable.Get (Project.Unit_Exceptions, Unit);
if Kind = Spec then
Masked := Unit_Except.Spec /= No_File
and then
Unit_Except.Spec /= File_Name;
else
Masked := Unit_Except.Impl /= No_File
and then
Unit_Except.Impl /= File_Name;
end if;
if Masked then
if Current_Verbosity = High then
Debug_Indent;
Write_Str (" """ & Filename & """ contains the ");
if Kind = Spec then
Write_Str ("spec of a unit found in """);
Write_Str (Get_Name_String (Unit_Except.Spec));
else
Write_Str ("body of a unit found in """);
Write_Str (Get_Name_String (Unit_Except.Impl));
end if;
Write_Line (""" (ignored)");
end if;
Unit := No_Name;
end if;
end if;
if Unit /= No_Name and then Current_Verbosity = High then
case Kind is
when Spec => Debug_Output ("spec of", Unit);
when Impl => Debug_Output ("body of", Unit);
when Sep => Debug_Output ("sep of", Unit);
end case;
end if;
end Compute_Unit_Name;
--------------------------
-- Check_Illegal_Suffix --
--------------------------
procedure Check_Illegal_Suffix
(Project : Project_Id;
Suffix : File_Name_Type;
Dot_Replacement : File_Name_Type;
Attribute_Name : String;
Location : Source_Ptr;
Data : in out Tree_Processing_Data)
is
Suffix_Str : constant String := Get_Name_String (Suffix);
begin
if Suffix_Str'Length = 0 then
-- Always valid
return;
elsif Index (Suffix_Str, ".") = 0 then
Err_Vars.Error_Msg_File_1 := Suffix;
Error_Msg
(Data.Flags,
"{ is illegal for " & Attribute_Name & ": must have a dot",
Location, Project);
return;
end if;
-- Case of dot replacement is a single dot, and first character of
-- suffix is also a dot.
if Dot_Replacement /= No_File
and then Get_Name_String (Dot_Replacement) = "."
and then Suffix_Str (Suffix_Str'First) = '.'
then
for Index in Suffix_Str'First + 1 .. Suffix_Str'Last loop
-- If there are multiple dots in the name
if Suffix_Str (Index) = '.' then
-- It is illegal to have a letter following the initial dot
if Is_Letter (Suffix_Str (Suffix_Str'First + 1)) then
Err_Vars.Error_Msg_File_1 := Suffix;
Error_Msg
(Data.Flags,
"{ is illegal for " & Attribute_Name
& ": ambiguous prefix when Dot_Replacement is a dot",
Location, Project);
end if;
return;
end if;
end loop;
end if;
end Check_Illegal_Suffix;
----------------------
-- Locate_Directory --
----------------------
procedure Locate_Directory
(Project : Project_Id;
Name : File_Name_Type;
Path : out Path_Information;
Dir_Exists : out Boolean;
Data : in out Tree_Processing_Data;
Create : String := "";
Location : Source_Ptr := No_Location;
Must_Exist : Boolean := True;
Externally_Built : Boolean := False)
is
Parent : constant Path_Name_Type :=
Project.Directory.Display_Name;
The_Parent : constant String :=
Get_Name_String (Parent);
The_Parent_Last : constant Natural :=
Compute_Directory_Last (The_Parent);
Full_Name : File_Name_Type;
The_Name : File_Name_Type;
begin
Get_Name_String (Name);
-- Add Subdirs.all if it is a directory that may be created and
-- Subdirs is not null;
if Create /= "" and then Subdirs /= null then
if Name_Buffer (Name_Len) /= Directory_Separator then
Add_Char_To_Name_Buffer (Directory_Separator);
end if;
Add_Str_To_Name_Buffer (Subdirs.all);
end if;
-- Convert '/' to directory separator (for Windows)
for J in 1 .. Name_Len loop
if Name_Buffer (J) = '/' then
Name_Buffer (J) := Directory_Separator;
end if;
end loop;
The_Name := Name_Find;
if Current_Verbosity = High then
Debug_Indent;
Write_Str ("Locate_Directory (""");
Write_Str (Get_Name_String (The_Name));
Write_Str (""", in """);
Write_Str (The_Parent);
Write_Line (""")");
end if;
Path := No_Path_Information;
Dir_Exists := False;
if Is_Absolute_Path (Get_Name_String (The_Name)) then
Full_Name := The_Name;
else
Name_Len := 0;
Add_Str_To_Name_Buffer
(The_Parent (The_Parent'First .. The_Parent_Last));
Add_Str_To_Name_Buffer (Get_Name_String (The_Name));
Full_Name := Name_Find;
end if;
declare
Full_Path_Name : String_Access :=
new String'(Get_Name_String (Full_Name));
begin
if (Setup_Projects or else Subdirs /= null)
and then Create'Length > 0
then
if not Is_Directory (Full_Path_Name.all) then
-- If project is externally built, do not create a subdir,
-- use the specified directory, without the subdir.
if Externally_Built then
if Is_Absolute_Path (Get_Name_String (Name)) then
Get_Name_String (Name);
else
Name_Len := 0;
Add_Str_To_Name_Buffer
(The_Parent (The_Parent'First .. The_Parent_Last));
Add_Str_To_Name_Buffer (Get_Name_String (Name));
end if;
Full_Path_Name := new String'(Name_Buffer (1 .. Name_Len));
else
begin
Create_Path (Full_Path_Name.all);
if not Quiet_Output then
Write_Str (Create);
Write_Str (" directory """);
Write_Str (Full_Path_Name.all);
Write_Str (""" created for project ");
Write_Line (Get_Name_String (Project.Name));
end if;
exception
when Use_Error =>
-- Output message with name of directory. Note that we
-- use the ~ insertion method here in case the name
-- has special characters in it.
Error_Msg_Strlen := Full_Path_Name'Length;
Error_Msg_String (1 .. Error_Msg_Strlen) :=
Full_Path_Name.all;
Error_Msg
(Data.Flags,
"could not create " & Create & " directory ~",
Location,
Project);
end;
end if;
end if;
end if;
Dir_Exists := Is_Directory (Full_Path_Name.all);
if not Must_Exist or Dir_Exists then
declare
Normed : constant String :=
Normalize_Pathname
(Full_Path_Name.all,
Directory =>
The_Parent (The_Parent'First .. The_Parent_Last),
Resolve_Links => False,
Case_Sensitive => True);
Canonical_Path : constant String :=
Normalize_Pathname
(Normed,
Directory =>
The_Parent
(The_Parent'First .. The_Parent_Last),
Resolve_Links =>
Opt.Follow_Links_For_Dirs,
Case_Sensitive => False);
begin
Name_Len := Normed'Length;
Name_Buffer (1 .. Name_Len) := Normed;
-- Directories should always end with a directory separator
if Name_Buffer (Name_Len) /= Directory_Separator then
Add_Char_To_Name_Buffer (Directory_Separator);
end if;
Path.Display_Name := Name_Find;
Name_Len := Canonical_Path'Length;
Name_Buffer (1 .. Name_Len) := Canonical_Path;
if Name_Buffer (Name_Len) /= Directory_Separator then
Add_Char_To_Name_Buffer (Directory_Separator);
end if;
Path.Name := Name_Find;
end;
end if;
Free (Full_Path_Name);
end;
end Locate_Directory;
---------------------------
-- Find_Excluded_Sources --
---------------------------
procedure Find_Excluded_Sources
(Project : in out Project_Processing_Data;
Data : in out Tree_Processing_Data)
is
Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared;
Excluded_Source_List_File : constant Variable_Value :=
Util.Value_Of
(Name_Excluded_Source_List_File,
Project.Project.Decl.Attributes,
Shared);
Excluded_Sources : Variable_Value := Util.Value_Of
(Name_Excluded_Source_Files,
Project.Project.Decl.Attributes,
Shared);
Current : String_List_Id;
Element : String_Element;
Location : Source_Ptr;
Name : File_Name_Type;
File : Prj.Util.Text_File;
Line : String (1 .. 300);
Last : Natural;
Locally_Removed : Boolean := False;
begin
-- If Excluded_Source_Files is not declared, check Locally_Removed_Files
if Excluded_Sources.Default then
Locally_Removed := True;
Excluded_Sources :=
Util.Value_Of
(Name_Locally_Removed_Files,
Project.Project.Decl.Attributes, Shared);
end if;
-- If there are excluded sources, put them in the table
if not Excluded_Sources.Default then
if not Excluded_Source_List_File.Default then
if Locally_Removed then
Error_Msg
(Data.Flags,
"?both attributes Locally_Removed_Files and " &
"Excluded_Source_List_File are present",
Excluded_Source_List_File.Location, Project.Project);
else
Error_Msg
(Data.Flags,
"?both attributes Excluded_Source_Files and " &
"Excluded_Source_List_File are present",
Excluded_Source_List_File.Location, Project.Project);
end if;
end if;
Current := Excluded_Sources.Values;
while Current /= Nil_String loop
Element := Shared.String_Elements.Table (Current);
Name := Canonical_Case_File_Name (Element.Value);
-- If the element has no location, then use the location of
-- Excluded_Sources to report possible errors.
if Element.Location = No_Location then
Location := Excluded_Sources.Location;
else
Location := Element.Location;
end if;
Excluded_Sources_Htable.Set
(Project.Excluded, Name,
(Name, No_File, 0, False, Location));
Current := Element.Next;
end loop;
elsif not Excluded_Source_List_File.Default then
Location := Excluded_Source_List_File.Location;
declare
Source_File_Name : constant File_Name_Type :=
File_Name_Type
(Excluded_Source_List_File.Value);
Source_File_Line : Natural := 0;
Source_File_Path_Name : constant String :=
Path_Name_Of
(Source_File_Name,
Project.Project.Directory.Name);
begin
if Source_File_Path_Name'Length = 0 then
Err_Vars.Error_Msg_File_1 :=
File_Name_Type (Excluded_Source_List_File.Value);
Error_Msg
(Data.Flags,
"file with excluded sources { does not exist",
Excluded_Source_List_File.Location, Project.Project);
else
-- Open the file
Prj.Util.Open (File, Source_File_Path_Name);
if not Prj.Util.Is_Valid (File) then
Error_Msg
(Data.Flags, "file does not exist",
Location, Project.Project);
else
-- Read the lines one by one
while not Prj.Util.End_Of_File (File) loop
Prj.Util.Get_Line (File, Line, Last);
Source_File_Line := Source_File_Line + 1;
-- Non empty, non comment line should contain a file name
if Last /= 0
and then (Last = 1 or else Line (1 .. 2) /= "--")
then
Name_Len := Last;
Name_Buffer (1 .. Name_Len) := Line (1 .. Last);
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Name := Name_Find;
-- Check that there is no directory information
for J in 1 .. Last loop
if Is_Directory_Separator (Line (J)) then
Error_Msg_File_1 := Name;
Error_Msg
(Data.Flags,
"file name cannot include "
& "directory information ({)",
Location, Project.Project);
exit;
end if;
end loop;
Excluded_Sources_Htable.Set
(Project.Excluded,
Name,
(Name, Source_File_Name, Source_File_Line,
False, Location));
end if;
end loop;
Prj.Util.Close (File);
end if;
end if;
end;
end if;
end Find_Excluded_Sources;
------------------
-- Find_Sources --
------------------
procedure Find_Sources
(Project : in out Project_Processing_Data;
Data : in out Tree_Processing_Data)
is
Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared;
Sources : constant Variable_Value :=
Util.Value_Of
(Name_Source_Files,
Project.Project.Decl.Attributes,
Shared);
Source_List_File : constant Variable_Value :=
Util.Value_Of
(Name_Source_List_File,
Project.Project.Decl.Attributes,
Shared);
Name_Loc : Name_Location;
Has_Explicit_Sources : Boolean;
begin
pragma Assert (Sources.Kind = List, "Source_Files is not a list");
pragma Assert
(Source_List_File.Kind = Single,
"Source_List_File is not a single string");
Project.Source_List_File_Location := Source_List_File.Location;
-- If the user has specified a Source_Files attribute
if not Sources.Default then
if not Source_List_File.Default then
Error_Msg
(Data.Flags,
"?both attributes source_files and " &
"source_list_file are present",
Source_List_File.Location, Project.Project);
end if;
-- Sources is a list of file names
declare
Current : String_List_Id := Sources.Values;
Element : String_Element;
Location : Source_Ptr;
Name : File_Name_Type;
begin
if Current = Nil_String then
Project.Project.Languages := No_Language_Index;
-- This project contains no source. For projects that don't
-- extend other projects, this also means that there is no
-- need for an object directory, if not specified.
if Project.Project.Extends = No_Project
and then
Project.Project.Object_Directory = Project.Project.Directory
and then not (Project.Project.Qualifier = Aggregate_Library)
then
Project.Project.Object_Directory := No_Path_Information;
end if;
end if;
while Current /= Nil_String loop
Element := Shared.String_Elements.Table (Current);
Name := Canonical_Case_File_Name (Element.Value);
Get_Name_String (Element.Value);
-- If the element has no location, then use the location of
-- Sources to report possible errors.
if Element.Location = No_Location then
Location := Sources.Location;
else
Location := Element.Location;
end if;
-- Check that there is no directory information
for J in 1 .. Name_Len loop
if Is_Directory_Separator (Name_Buffer (J)) then
Error_Msg_File_1 := Name;
Error_Msg
(Data.Flags,
"file name cannot include directory " &
"information ({)",
Location, Project.Project);
exit;
end if;
end loop;
-- Check whether the file is already there: the same file name
-- may be in the list. If the source is missing, the error will
-- be on the first mention of the source file name.
Name_Loc := Source_Names_Htable.Get
(Project.Source_Names, Name);
if Name_Loc = No_Name_Location then
Name_Loc :=
(Name => Name,
Location => Location,
Source => No_Source,
Listed => True,
Found => False);
else
Name_Loc.Listed := True;
end if;
Source_Names_Htable.Set
(Project.Source_Names, Name, Name_Loc);
Current := Element.Next;
end loop;
Has_Explicit_Sources := True;
end;
-- If we have no Source_Files attribute, check the Source_List_File
-- attribute.
elsif not Source_List_File.Default then
-- Source_List_File is the name of the file that contains the source
-- file names.
declare
Source_File_Path_Name : constant String :=
Path_Name_Of
(File_Name_Type
(Source_List_File.Value),
Project.Project.
Directory.Display_Name);
begin
Has_Explicit_Sources := True;
if Source_File_Path_Name'Length = 0 then
Err_Vars.Error_Msg_File_1 :=
File_Name_Type (Source_List_File.Value);
Error_Msg
(Data.Flags,
"file with sources { does not exist",
Source_List_File.Location, Project.Project);
else
Get_Sources_From_File
(Source_File_Path_Name, Source_List_File.Location,
Project, Data);
end if;
end;
else
-- Neither Source_Files nor Source_List_File has been specified. Find
-- all the files that satisfy the naming scheme in all the source
-- directories.
Has_Explicit_Sources := False;
end if;
-- Remove any exception that is not in the specified list of sources
if Has_Explicit_Sources then
declare
Source : Source_Id;
Iter : Source_Iterator;
NL : Name_Location;
Again : Boolean;
begin
Iter_Loop :
loop
Again := False;
Iter := For_Each_Source (Data.Tree, Project.Project);
Source_Loop :
loop
Source := Prj.Element (Iter);
exit Source_Loop when Source = No_Source;
if Source.Naming_Exception /= No then
NL := Source_Names_Htable.Get
(Project.Source_Names, Source.File);
if NL /= No_Name_Location and then not NL.Listed then
-- Remove the exception
Source_Names_Htable.Set
(Project.Source_Names,
Source.File,
No_Name_Location);
Remove_Source (Data.Tree, Source, No_Source);
if Source.Naming_Exception = Yes then
Error_Msg_Name_1 := Name_Id (Source.File);
Error_Msg
(Data.Flags,
"? unknown source file %%",
NL.Location,
Project.Project);
end if;
Again := True;
exit Source_Loop;
end if;
end if;
Next (Iter);
end loop Source_Loop;
exit Iter_Loop when not Again;
end loop Iter_Loop;
end;
end if;
Search_Directories
(Project,
Data => Data,
For_All_Sources => Sources.Default and then Source_List_File.Default);
-- Check if all exceptions have been found
declare
Source : Source_Id;
Iter : Source_Iterator;
Found : Boolean := False;
begin
Iter := For_Each_Source (Data.Tree, Project.Project);
loop
Source := Prj.Element (Iter);
exit when Source = No_Source;
-- If the full source path is unknown for this source_id, there
-- could be several reasons:
-- * we simply did not find the file itself, this is an error
-- * we have a multi-unit source file. Another Source_Id from
-- the same file has received the full path, so we need to
-- propagate it.
if Source.Path = No_Path_Information then
if Source.Naming_Exception = Yes then
if Source.Unit /= No_Unit_Index then
Found := False;
if Source.Index /= 0 then -- Only multi-unit files
declare
S : Source_Id :=
Source_Files_Htable.Get
(Data.Tree.Source_Files_HT, Source.File);
begin
while S /= null loop
if S.Path /= No_Path_Information then
Source.Path := S.Path;
Found := True;
if Current_Verbosity = High then
Debug_Output
("setting full path for "
& Get_Name_String (Source.File)
& " at" & Source.Index'Img
& " to "
& Get_Name_String (Source.Path.Name));
end if;
exit;
end if;
S := S.Next_With_File_Name;
end loop;
end;
end if;
if not Found then
Error_Msg_Name_1 := Name_Id (Source.Display_File);
Error_Msg_Name_2 := Source.Unit.Name;
Error_Or_Warning
(Data.Flags, Data.Flags.Missing_Source_Files,
"\source file %% for unit %% not found",
No_Location, Project.Project);
end if;
end if;
if Source.Path = No_Path_Information then
Remove_Source (Data.Tree, Source, No_Source);
end if;
elsif Source.Naming_Exception = Inherited then
Remove_Source (Data.Tree, Source, No_Source);
end if;
end if;
Next (Iter);
end loop;
end;
-- It is an error if a source file name in a source list or in a source
-- list file is not found.
if Has_Explicit_Sources then
declare
NL : Name_Location;
First_Error : Boolean;
begin
NL := Source_Names_Htable.Get_First (Project.Source_Names);
First_Error := True;
while NL /= No_Name_Location loop
if not NL.Found then
Err_Vars.Error_Msg_File_1 := NL.Name;
if First_Error then
Error_Or_Warning
(Data.Flags, Data.Flags.Missing_Source_Files,
"source file { not found",
NL.Location, Project.Project);
First_Error := False;
else
Error_Or_Warning
(Data.Flags, Data.Flags.Missing_Source_Files,
"\source file { not found",
NL.Location, Project.Project);
end if;
end if;
NL := Source_Names_Htable.Get_Next (Project.Source_Names);
end loop;
end;
end if;
end Find_Sources;
----------------
-- Initialize --
----------------
procedure Initialize
(Data : out Tree_Processing_Data;
Tree : Project_Tree_Ref;
Node_Tree : Prj.Tree.Project_Node_Tree_Ref;
Flags : Prj.Processing_Flags)
is
begin
Data.Tree := Tree;
Data.Node_Tree := Node_Tree;
Data.Flags := Flags;
end Initialize;
----------
-- Free --
----------
procedure Free (Data : in out Tree_Processing_Data) is
pragma Unreferenced (Data);
begin
null;
end Free;
----------------
-- Initialize --
----------------
procedure Initialize
(Data : in out Project_Processing_Data;
Project : Project_Id)
is
begin
Data.Project := Project;
end Initialize;
----------
-- Free --
----------
procedure Free (Data : in out Project_Processing_Data) is
begin
Source_Names_Htable.Reset (Data.Source_Names);
Unit_Exceptions_Htable.Reset (Data.Unit_Exceptions);
Excluded_Sources_Htable.Reset (Data.Excluded);
end Free;
-------------------------------
-- Check_File_Naming_Schemes --
-------------------------------
procedure Check_File_Naming_Schemes
(Project : Project_Processing_Data;
File_Name : File_Name_Type;
Alternate_Languages : out Language_List;
Language : out Language_Ptr;
Display_Language_Name : out Name_Id;
Unit : out Name_Id;
Lang_Kind : out Language_Kind;
Kind : out Source_Kind)
is
Filename : constant String := Get_Name_String (File_Name);
Config : Language_Config;
Tmp_Lang : Language_Ptr;
Header_File : Boolean := False;
-- True if we found at least one language for which the file is a header
-- In such a case, we search for all possible languages where this is
-- also a header (C and C++ for instance), since the file might be used
-- for several such languages.
procedure Check_File_Based_Lang;
-- Does the naming scheme test for file-based languages. For those,
-- there is no Unit. Just check if the file name has the implementation
-- or, if it is specified, the template suffix of the language.
--
-- Returns True if the file belongs to the current language and we
-- should stop searching for matching languages. Not that a given header
-- file could belong to several languages (C and C++ for instance). Thus
-- if we found a header we'll check whether it matches other languages.
---------------------------
-- Check_File_Based_Lang --
---------------------------
procedure Check_File_Based_Lang is
begin
if not Header_File
and then Suffix_Matches (Filename, Config.Naming_Data.Body_Suffix)
then
Unit := No_Name;
Kind := Impl;
Language := Tmp_Lang;
Debug_Output
("implementation of language ", Display_Language_Name);
elsif Suffix_Matches (Filename, Config.Naming_Data.Spec_Suffix) then
Debug_Output
("header of language ", Display_Language_Name);
if Header_File then
Alternate_Languages := new Language_List_Element'
(Language => Language,
Next => Alternate_Languages);
else
Header_File := True;
Kind := Spec;
Unit := No_Name;
Language := Tmp_Lang;
end if;
end if;
end Check_File_Based_Lang;
-- Start of processing for Check_File_Naming_Schemes
begin
Language := No_Language_Index;
Alternate_Languages := null;
Display_Language_Name := No_Name;
Unit := No_Name;
Lang_Kind := File_Based;
Kind := Spec;
Tmp_Lang := Project.Project.Languages;
while Tmp_Lang /= No_Language_Index loop
if Current_Verbosity = High then
Debug_Output
("testing language "
& Get_Name_String (Tmp_Lang.Name)
& " Header_File=" & Header_File'Img);
end if;
Display_Language_Name := Tmp_Lang.Display_Name;
Config := Tmp_Lang.Config;
Lang_Kind := Config.Kind;
case Config.Kind is
when File_Based =>
Check_File_Based_Lang;
exit when Kind = Impl;
when Unit_Based =>
-- We know it belongs to a least a file_based language, no
-- need to check unit-based ones.
if not Header_File then
Compute_Unit_Name
(File_Name => File_Name,
Naming => Config.Naming_Data,
Kind => Kind,
Unit => Unit,
Project => Project);
if Unit /= No_Name then
Language := Tmp_Lang;
exit;
end if;
end if;
end case;
Tmp_Lang := Tmp_Lang.Next;
end loop;
if Language = No_Language_Index then
Debug_Output ("not a source of any language");
end if;
end Check_File_Naming_Schemes;
-------------------
-- Override_Kind --
-------------------
procedure Override_Kind (Source : Source_Id; Kind : Source_Kind) is
begin
-- If the file was previously already associated with a unit, change it
if Source.Unit /= null
and then Source.Kind in Spec_Or_Body
and then Source.Unit.File_Names (Source.Kind) /= null
then
-- If we had another file referencing the same unit (for instance it
-- was in an extended project), that source file is in fact invisible
-- from now on, and in particular doesn't belong to the same unit.
-- If the source is an inherited naming exception, then it may not
-- really exist: the source potentially replaced is left untouched.
if Source.Unit.File_Names (Source.Kind) /= Source then
Source.Unit.File_Names (Source.Kind).Unit := No_Unit_Index;
end if;
Source.Unit.File_Names (Source.Kind) := null;
end if;
Source.Kind := Kind;
if Current_Verbosity = High and then Source.File /= No_File then
Debug_Output ("override kind for "
& Get_Name_String (Source.File)
& " idx=" & Source.Index'Img
& " kind=" & Source.Kind'Img);
end if;
if Source.Unit /= null then
if Source.Kind = Spec then
Source.Unit.File_Names (Spec) := Source;
else
Source.Unit.File_Names (Impl) := Source;
end if;
end if;
end Override_Kind;
----------------
-- Check_File --
----------------
procedure Check_File
(Project : in out Project_Processing_Data;
Data : in out Tree_Processing_Data;
Source_Dir_Rank : Natural;
Path : Path_Name_Type;
Display_Path : Path_Name_Type;
File_Name : File_Name_Type;
Display_File_Name : File_Name_Type;
Locally_Removed : Boolean;
For_All_Sources : Boolean)
is
Name_Loc : Name_Location :=
Source_Names_Htable.Get
(Project.Source_Names, File_Name);
Check_Name : Boolean := False;
Alternate_Languages : Language_List;
Language : Language_Ptr;
Source : Source_Id;
Src_Ind : Source_File_Index;
Unit : Name_Id;
Display_Language_Name : Name_Id;
Lang_Kind : Language_Kind;
Kind : Source_Kind := Spec;
begin
if Current_Verbosity = High then
Debug_Increase_Indent
("checking file (rank=" & Source_Dir_Rank'Img & ")",
Name_Id (Display_Path));
end if;
if Name_Loc = No_Name_Location then
Check_Name := For_All_Sources;
else
if Name_Loc.Found then
-- Check if it is OK to have the same file name in several
-- source directories.
if Name_Loc.Source /= No_Source
and then Source_Dir_Rank = Name_Loc.Source.Source_Dir_Rank
then
Error_Msg_File_1 := File_Name;
Error_Msg
(Data.Flags,
"{ is found in several source directories",
Name_Loc.Location, Project.Project);
end if;
else
Name_Loc.Found := True;
Source_Names_Htable.Set
(Project.Source_Names, File_Name, Name_Loc);
if Name_Loc.Source = No_Source then
Check_Name := True;
else
-- Set the full path for the source_id (which might have been
-- created when parsing the naming exceptions, and therefore
-- might not have the full path).
-- We only set this for this source_id, but not for other
-- source_id in the same file (case of multi-unit source files)
-- For the latter, they will be set in Find_Sources when we
-- check that all source_id have known full paths.
-- Doing this later saves one htable lookup per file in the
-- common case where the user is not using multi-unit files.
Name_Loc.Source.Path := (Path, Display_Path);
Source_Paths_Htable.Set
(Data.Tree.Source_Paths_HT, Path, Name_Loc.Source);
-- Check if this is a subunit
if Name_Loc.Source.Unit /= No_Unit_Index
and then Name_Loc.Source.Kind = Impl
then
Src_Ind := Sinput.P.Load_Project_File
(Get_Name_String (Display_Path));
if Sinput.P.Source_File_Is_Subunit (Src_Ind) then
Override_Kind (Name_Loc.Source, Sep);
end if;
end if;
-- If this is an inherited naming exception, make sure that
-- the naming exception it replaces is no longer a source.
if Name_Loc.Source.Naming_Exception = Inherited then
declare
Proj : Project_Id := Name_Loc.Source.Project.Extends;
Iter : Source_Iterator;
Src : Source_Id;
begin
while Proj /= No_Project loop
Iter := For_Each_Source (Data.Tree, Proj);
Src := Prj.Element (Iter);
while Src /= No_Source loop
if Src.File = Name_Loc.Source.File then
Src.Replaced_By := Name_Loc.Source;
exit;
end if;
Next (Iter);
Src := Prj.Element (Iter);
end loop;
Proj := Proj.Extends;
end loop;
end;
if Name_Loc.Source.Unit /= No_Unit_Index then
if Name_Loc.Source.Kind = Spec then
Name_Loc.Source.Unit.File_Names (Spec) :=
Name_Loc.Source;
elsif Name_Loc.Source.Kind = Impl then
Name_Loc.Source.Unit.File_Names (Impl) :=
Name_Loc.Source;
end if;
Units_Htable.Set
(Data.Tree.Units_HT,
Name_Loc.Source.Unit.Name,
Name_Loc.Source.Unit);
end if;
end if;
end if;
end if;
end if;
if Check_Name then
Check_File_Naming_Schemes
(Project => Project,
File_Name => File_Name,
Alternate_Languages => Alternate_Languages,
Language => Language,
Display_Language_Name => Display_Language_Name,
Unit => Unit,
Lang_Kind => Lang_Kind,
Kind => Kind);
if Language = No_Language_Index then
-- A file name in a list must be a source of a language
if Data.Flags.Error_On_Unknown_Language and then Name_Loc.Found
then
Error_Msg_File_1 := File_Name;
Error_Msg
(Data.Flags,
"language unknown for {",
Name_Loc.Location, Project.Project);
end if;
else
Add_Source
(Id => Source,
Project => Project.Project,
Source_Dir_Rank => Source_Dir_Rank,
Lang_Id => Language,
Kind => Kind,
Data => Data,
Alternate_Languages => Alternate_Languages,
File_Name => File_Name,
Display_File => Display_File_Name,
Unit => Unit,
Locally_Removed => Locally_Removed,
Path => (Path, Display_Path));
-- If it is a source specified in a list, update the entry in
-- the Source_Names table.
if Name_Loc.Found and then Name_Loc.Source = No_Source then
Name_Loc.Source := Source;
Source_Names_Htable.Set
(Project.Source_Names, File_Name, Name_Loc);
end if;
end if;
end if;
Debug_Decrease_Indent;
end Check_File;
---------------------------------
-- Expand_Subdirectory_Pattern --
---------------------------------
procedure Expand_Subdirectory_Pattern
(Project : Project_Id;
Data : in out Tree_Processing_Data;
Patterns : String_List_Id;
Ignore : String_List_Id;
Search_For : Search_Type;
Resolve_Links : Boolean)
is
Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared;
package Recursive_Dirs is new GNAT.Dynamic_HTables.Simple_HTable
(Header_Num => Header_Num,
Element => Boolean,
No_Element => False,
Key => Path_Name_Type,
Hash => Hash,
Equal => "=");
-- Hash table stores recursive source directories, to avoid looking
-- several times, and to avoid cycles that may be introduced by symbolic
-- links.
File_Pattern : GNAT.Regexp.Regexp;
-- Pattern to use when matching file names
Visited : Recursive_Dirs.Instance;
procedure Find_Pattern
(Pattern_Id : Name_Id;
Rank : Natural;
Location : Source_Ptr);
-- Find a specific pattern
function Recursive_Find_Dirs
(Path : Path_Information;
Rank : Natural) return Boolean;
-- Search all the subdirectories (recursively) of Path.
-- Return True if at least one file or directory was processed
function Subdirectory_Matches
(Path : Path_Information;
Rank : Natural) return Boolean;
-- Called when a matching directory was found. If the user is in fact
-- searching for files, we then search for those files matching the
-- pattern within the directory.
-- Return True if at least one file or directory was processed
--------------------------
-- Subdirectory_Matches --
--------------------------
function Subdirectory_Matches
(Path : Path_Information;
Rank : Natural) return Boolean
is
Dir : Dir_Type;
Name : String (1 .. 250);
Last : Natural;
Found : Path_Information;
Success : Boolean := False;
begin
case Search_For is
when Search_Directories =>
Callback (Path, Rank);
return True;
when Search_Files =>
Open (Dir, Get_Name_String (Path.Display_Name));
loop
Read (Dir, Name, Last);
exit when Last = 0;
if Name (Name'First .. Last) /= "."
and then Name (Name'First .. Last) /= ".."
and then Match (Name (Name'First .. Last), File_Pattern)
then
Get_Name_String (Path.Display_Name);
Add_Str_To_Name_Buffer (Name (Name'First .. Last));
Found.Display_Name := Name_Find;
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Found.Name := Name_Find;
Callback (Found, Rank);
Success := True;
end if;
end loop;
Close (Dir);
return Success;
end case;
end Subdirectory_Matches;
-------------------------
-- Recursive_Find_Dirs --
-------------------------
function Recursive_Find_Dirs
(Path : Path_Information;
Rank : Natural) return Boolean
is
Path_Str : constant String := Get_Name_String (Path.Display_Name);
Dir : Dir_Type;
Name : String (1 .. 250);
Last : Natural;
Success : Boolean := False;
begin
Debug_Output ("looking for subdirs of ", Name_Id (Path.Display_Name));
if Recursive_Dirs.Get (Visited, Path.Name) then
return Success;
end if;
Recursive_Dirs.Set (Visited, Path.Name, True);
Success := Subdirectory_Matches (Path, Rank) or Success;
Open (Dir, Path_Str);
loop
Read (Dir, Name, Last);
exit when Last = 0;
if Name (1 .. Last) /= "." and then Name (1 .. Last) /= ".." then
declare
Path_Name : constant String :=
Normalize_Pathname
(Name => Name (1 .. Last),
Directory => Path_Str,
Resolve_Links => Resolve_Links)
& Directory_Separator;
Path2 : Path_Information;
OK : Boolean := True;
begin
if Is_Directory (Path_Name) then
if Ignore /= Nil_String then
declare
Dir_Name : String := Name (1 .. Last);
List : String_List_Id := Ignore;
begin
Canonical_Case_File_Name (Dir_Name);
while List /= Nil_String loop
Get_Name_String
(Shared.String_Elements.Table (List).Value);
Canonical_Case_File_Name
(Name_Buffer (1 .. Name_Len));
OK := Name_Buffer (1 .. Name_Len) /= Dir_Name;
exit when not OK;
List := Shared.String_Elements.Table (List).Next;
end loop;
end;
end if;
if OK then
Name_Len := 0;
Add_Str_To_Name_Buffer (Path_Name);
Path2.Display_Name := Name_Find;
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Path2.Name := Name_Find;
Success :=
Recursive_Find_Dirs (Path2, Rank) or Success;
end if;
end if;
end;
end if;
end loop;
Close (Dir);
return Success;
exception
when Directory_Error =>
return Success;
end Recursive_Find_Dirs;
------------------
-- Find_Pattern --
------------------
procedure Find_Pattern
(Pattern_Id : Name_Id;
Rank : Natural;
Location : Source_Ptr)
is
Pattern : constant String := Get_Name_String (Pattern_Id);
Pattern_End : Natural := Pattern'Last;
Recursive : Boolean;
Dir : File_Name_Type;
Path_Name : Path_Information;
Dir_Exists : Boolean;
Has_Error : Boolean := False;
Success : Boolean;
begin
Debug_Increase_Indent ("Find_Pattern", Pattern_Id);
-- If we are looking for files, find the pattern for the files
if Search_For = Search_Files then
while Pattern_End >= Pattern'First
and then not Is_Directory_Separator (Pattern (Pattern_End))
loop
Pattern_End := Pattern_End - 1;
end loop;
if Pattern_End = Pattern'Last then
Err_Vars.Error_Msg_File_1 := File_Name_Type (Pattern_Id);
Error_Or_Warning
(Data.Flags, Data.Flags.Missing_Source_Files,
"Missing file name or pattern in {", Location, Project);
return;
end if;
if Current_Verbosity = High then
Debug_Indent;
Write_Str ("file_pattern=");
Write_Str (Pattern (Pattern_End + 1 .. Pattern'Last));
Write_Str (" dir_pattern=");
Write_Line (Pattern (Pattern'First .. Pattern_End));
end if;
File_Pattern := Compile
(Pattern (Pattern_End + 1 .. Pattern'Last),
Glob => True,
Case_Sensitive => File_Names_Case_Sensitive);
-- If we had just "*.gpr", this is equivalent to "./*.gpr"
if Pattern_End > Pattern'First then
Pattern_End := Pattern_End - 1; -- Skip directory separator
end if;
end if;
Recursive :=
Pattern_End - 1 >= Pattern'First
and then Pattern (Pattern_End - 1 .. Pattern_End) = "**"
and then
(Pattern_End - 1 = Pattern'First
or else Is_Directory_Separator (Pattern (Pattern_End - 2)));
if Recursive then
Pattern_End := Pattern_End - 2;
if Pattern_End > Pattern'First then
Pattern_End := Pattern_End - 1; -- Skip '/'
end if;
end if;
Name_Len := Pattern_End - Pattern'First + 1;
Name_Buffer (1 .. Name_Len) := Pattern (Pattern'First .. Pattern_End);
Dir := Name_Find;
Locate_Directory
(Project => Project,
Name => Dir,
Path => Path_Name,
Dir_Exists => Dir_Exists,
Data => Data,
Must_Exist => False);
if not Dir_Exists then
Err_Vars.Error_Msg_File_1 := Dir;
Error_Or_Warning
(Data.Flags, Data.Flags.Missing_Source_Files,
"{ is not a valid directory", Location, Project);
Has_Error := Data.Flags.Missing_Source_Files = Error;
end if;
if not Has_Error then
-- Links have been resolved if necessary, and Path_Name
-- always ends with a directory separator.
if Recursive then
Success := Recursive_Find_Dirs (Path_Name, Rank);
else
Success := Subdirectory_Matches (Path_Name, Rank);
end if;
if not Success then
case Search_For is
when Search_Directories =>
null; -- Error can't occur
when Search_Files =>
Err_Vars.Error_Msg_File_1 := File_Name_Type (Pattern_Id);
Error_Or_Warning
(Data.Flags, Data.Flags.Missing_Source_Files,
"file { not found", Location, Project);
end case;
end if;
end if;
Debug_Decrease_Indent ("done Find_Pattern");
end Find_Pattern;
-- Local variables
Pattern_Id : String_List_Id := Patterns;
Element : String_Element;
Rank : Natural := 1;
-- Start of processing for Expand_Subdirectory_Pattern
begin
while Pattern_Id /= Nil_String loop
Element := Shared.String_Elements.Table (Pattern_Id);
Find_Pattern (Element.Value, Rank, Element.Location);
Rank := Rank + 1;
Pattern_Id := Element.Next;
end loop;
Recursive_Dirs.Reset (Visited);
end Expand_Subdirectory_Pattern;
------------------------
-- Search_Directories --
------------------------
procedure Search_Directories
(Project : in out Project_Processing_Data;
Data : in out Tree_Processing_Data;
For_All_Sources : Boolean)
is
Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared;
Source_Dir : String_List_Id;
Element : String_Element;
Src_Dir_Rank : Number_List_Index;
Num_Nod : Number_Node;
Dir : Dir_Type;
Name : String (1 .. 1_000);
Last : Natural;
File_Name : File_Name_Type;
Display_File_Name : File_Name_Type;
begin
Debug_Increase_Indent ("looking for sources of", Project.Project.Name);
-- Loop through subdirectories
Src_Dir_Rank := Project.Project.Source_Dir_Ranks;
Source_Dir := Project.Project.Source_Dirs;
while Source_Dir /= Nil_String loop
begin
Num_Nod := Shared.Number_Lists.Table (Src_Dir_Rank);
Element := Shared.String_Elements.Table (Source_Dir);
-- Use Element.Value in this test, not Display_Value, because we
-- want the symbolic links to be resolved when appropriate.
if Element.Value /= No_Name then
declare
Source_Directory : constant String :=
Get_Name_String (Element.Value)
& Directory_Separator;
Dir_Last : constant Natural :=
Compute_Directory_Last (Source_Directory);
Display_Source_Directory : constant String :=
Get_Name_String
(Element.Display_Value)
& Directory_Separator;
-- Display_Source_Directory is to allow us to open a UTF-8
-- encoded directory on Windows.
begin
if Current_Verbosity = High then
Debug_Increase_Indent
("Source_Dir (node=" & Num_Nod.Number'Img & ") """
& Source_Directory (Source_Directory'First .. Dir_Last)
& '"');
end if;
-- We look to every entry in the source directory
Open (Dir, Display_Source_Directory);
loop
Read (Dir, Name, Last);
exit when Last = 0;
-- In fast project loading mode (without -eL), the user
-- guarantees that no directory has a name which is a
-- valid source name, so we can avoid doing a system call
-- here. This provides a very significant speed up on
-- slow file systems (remote files for instance).
if not Opt.Follow_Links_For_Files
or else Is_Regular_File
(Display_Source_Directory & Name (1 .. Last))
then
Name_Len := Last;
Name_Buffer (1 .. Name_Len) := Name (1 .. Last);
Display_File_Name := Name_Find;
if Osint.File_Names_Case_Sensitive then
File_Name := Display_File_Name;
else
Canonical_Case_File_Name
(Name_Buffer (1 .. Name_Len));
File_Name := Name_Find;
end if;
declare
Path_Name : constant String :=
Normalize_Pathname
(Name (1 .. Last),
Directory =>
Source_Directory
(Source_Directory'First ..
Dir_Last),
Resolve_Links =>
Opt.Follow_Links_For_Files,
Case_Sensitive => True);
Path : Path_Name_Type;
FF : File_Found :=
Excluded_Sources_Htable.Get
(Project.Excluded, File_Name);
To_Remove : Boolean := False;
begin
Name_Len := Path_Name'Length;
Name_Buffer (1 .. Name_Len) := Path_Name;
if Osint.File_Names_Case_Sensitive then
Path := Name_Find;
else
Canonical_Case_File_Name
(Name_Buffer (1 .. Name_Len));
Path := Name_Find;
end if;
if FF /= No_File_Found then
if not FF.Found then
FF.Found := True;
Excluded_Sources_Htable.Set
(Project.Excluded, File_Name, FF);
Debug_Output
("excluded source ",
Name_Id (Display_File_Name));
-- Will mark the file as removed, but we
-- still need to add it to the list: if we
-- don't, the file will not appear in the
-- mapping file and will cause the compiler
-- to fail.
To_Remove := True;
end if;
end if;
-- Preserve the user's original casing and use of
-- links. The display_value (a directory) already
-- ends with a directory separator by construction,
-- so no need to add one.
Get_Name_String (Element.Display_Value);
Get_Name_String_And_Append (Display_File_Name);
Check_File
(Project => Project,
Source_Dir_Rank => Num_Nod.Number,
Data => Data,
Path => Path,
Display_Path => Name_Find,
File_Name => File_Name,
Locally_Removed => To_Remove,
Display_File_Name => Display_File_Name,
For_All_Sources => For_All_Sources);
end;
else
if Current_Verbosity = High then
Debug_Output ("ignore " & Name (1 .. Last));
end if;
end if;
end loop;
Debug_Decrease_Indent;
Close (Dir);
end;
end if;
exception
when Directory_Error =>
null;
end;
Source_Dir := Element.Next;
Src_Dir_Rank := Num_Nod.Next;
end loop;
Debug_Decrease_Indent ("end looking for sources.");
end Search_Directories;
----------------------------
-- Load_Naming_Exceptions --
----------------------------
procedure Load_Naming_Exceptions
(Project : in out Project_Processing_Data;
Data : in out Tree_Processing_Data)
is
Source : Source_Id;
Iter : Source_Iterator;
begin
Iter := For_Each_Source (Data.Tree, Project.Project);
loop
Source := Prj.Element (Iter);
exit when Source = No_Source;
-- An excluded file cannot also be an exception file name
if Excluded_Sources_Htable.Get (Project.Excluded, Source.File) /=
No_File_Found
then
Error_Msg_File_1 := Source.File;
Error_Msg
(Data.Flags,
"\{ cannot be both excluded and an exception file name",
No_Location, Project.Project);
end if;
Debug_Output
("naming exception: adding source file to source_Names: ",
Name_Id (Source.File));
Source_Names_Htable.Set
(Project.Source_Names,
K => Source.File,
E => Name_Location'
(Name => Source.File,
Location => Source.Location,
Source => Source,
Listed => False,
Found => False));
-- If this is an Ada exception, record in table Unit_Exceptions
if Source.Unit /= No_Unit_Index then
declare
Unit_Except : Unit_Exception :=
Unit_Exceptions_Htable.Get
(Project.Unit_Exceptions, Source.Unit.Name);
begin
Unit_Except.Name := Source.Unit.Name;
if Source.Kind = Spec then
Unit_Except.Spec := Source.File;
else
Unit_Except.Impl := Source.File;
end if;
Unit_Exceptions_Htable.Set
(Project.Unit_Exceptions, Source.Unit.Name, Unit_Except);
end;
end if;
Next (Iter);
end loop;
end Load_Naming_Exceptions;
----------------------
-- Look_For_Sources --
----------------------
procedure Look_For_Sources
(Project : in out Project_Processing_Data;
Data : in out Tree_Processing_Data)
is
Object_Files : Object_File_Names_Htable.Instance;
Iter : Source_Iterator;
Src : Source_Id;
procedure Check_Object (Src : Source_Id);
-- Check if object file name of Src is already used in the project tree,
-- and report an error if so.
procedure Check_Object_Files;
-- Check that no two sources of this project have the same object file
procedure Mark_Excluded_Sources;
-- Mark as such the sources that are declared as excluded
procedure Check_Missing_Sources;
-- Check whether one of the languages has no sources, and report an
-- error when appropriate
procedure Get_Sources_From_Source_Info;
-- Get the source information from the tables that were created when a
-- source info file was read.
---------------------------
-- Check_Missing_Sources --
---------------------------
procedure Check_Missing_Sources is
Extending : constant Boolean :=
Project.Project.Extends /= No_Project;
Language : Language_Ptr;
Source : Source_Id;
Alt_Lang : Language_List;
Continuation : Boolean := False;
Iter : Source_Iterator;
begin
if not Project.Project.Externally_Built and then not Extending then
Language := Project.Project.Languages;
while Language /= No_Language_Index loop
-- If there are no sources for this language, check if there
-- are sources for which this is an alternate language.
if Language.First_Source = No_Source
and then (Data.Flags.Require_Sources_Other_Lang
or else Language.Name = Name_Ada)
then
Iter := For_Each_Source (In_Tree => Data.Tree,
Project => Project.Project);
Source_Loop : loop
Source := Element (Iter);
exit Source_Loop when Source = No_Source
or else Source.Language = Language;
Alt_Lang := Source.Alternate_Languages;
while Alt_Lang /= null loop
exit Source_Loop when Alt_Lang.Language = Language;
Alt_Lang := Alt_Lang.Next;
end loop;
Next (Iter);
end loop Source_Loop;
if Source = No_Source then
Report_No_Sources
(Project.Project,
Get_Name_String (Language.Display_Name),
Data,
Project.Source_List_File_Location,
Continuation);
Continuation := True;
end if;
end if;
Language := Language.Next;
end loop;
end if;
end Check_Missing_Sources;
------------------
-- Check_Object --
------------------
procedure Check_Object (Src : Source_Id) is
Source : Source_Id;
begin
Source := Object_File_Names_Htable.Get (Object_Files, Src.Object);
-- We cannot just check on "Source /= Src", since we might have
-- two different entries for the same file (and since that's
-- the same file it is expected that it has the same object)
if Source /= No_Source
and then Source.Replaced_By = No_Source
and then Source.Path /= Src.Path
and then Source.Index = 0
and then Src.Index = 0
and then Is_Extending (Src.Project, Source.Project)
then
Error_Msg_File_1 := Src.File;
Error_Msg_File_2 := Source.File;
Error_Msg
(Data.Flags,
"\{ and { have the same object file name",
No_Location, Project.Project);
else
Object_File_Names_Htable.Set (Object_Files, Src.Object, Src);
end if;
end Check_Object;
---------------------------
-- Mark_Excluded_Sources --
---------------------------
procedure Mark_Excluded_Sources is
Source : Source_Id := No_Source;
Excluded : File_Found;
Proj : Project_Id;
begin
-- Minor optimization: if there are no excluded files, no need to
-- traverse the list of sources. We cannot however also check whether
-- the existing exceptions have ".Found" set to True (indicating we
-- found them before) because we need to do some final processing on
-- them in any case.
if Excluded_Sources_Htable.Get_First (Project.Excluded) /=
No_File_Found
then
Proj := Project.Project;
while Proj /= No_Project loop
Iter := For_Each_Source (Data.Tree, Proj);
while Prj.Element (Iter) /= No_Source loop
Source := Prj.Element (Iter);
Excluded := Excluded_Sources_Htable.Get
(Project.Excluded, Source.File);
if Excluded /= No_File_Found then
Source.In_Interfaces := False;
Source.Locally_Removed := True;
if Proj = Project.Project then
Source.Suppressed := True;
end if;
if Current_Verbosity = High then
Debug_Indent;
Write_Str ("removing file ");
Write_Line
(Get_Name_String (Excluded.File)
& " " & Get_Name_String (Source.Project.Name));
end if;
Excluded_Sources_Htable.Remove
(Project.Excluded, Source.File);
end if;
Next (Iter);
end loop;
Proj := Proj.Extends;
end loop;
end if;
-- If we have any excluded element left, that means we did not find
-- the source file
Excluded := Excluded_Sources_Htable.Get_First (Project.Excluded);
while Excluded /= No_File_Found loop
if not Excluded.Found then
-- Check if the file belongs to another imported project to
-- provide a better error message.
Src := Find_Source
(In_Tree => Data.Tree,
Project => Project.Project,
In_Imported_Only => True,
Base_Name => Excluded.File);
Err_Vars.Error_Msg_File_1 := Excluded.File;
if Src = No_Source then
if Excluded.Excl_File = No_File then
Error_Msg
(Data.Flags,
"unknown file {", Excluded.Location, Project.Project);
else
Error_Msg
(Data.Flags,
"in " &
Get_Name_String (Excluded.Excl_File) & ":" &
No_Space_Img (Excluded.Excl_Line) &
": unknown file {", Excluded.Location, Project.Project);
end if;
else
if Excluded.Excl_File = No_File then
Error_Msg
(Data.Flags,
"cannot remove a source from an imported project: {",
Excluded.Location, Project.Project);
else
Error_Msg
(Data.Flags,
"in " &
Get_Name_String (Excluded.Excl_File) & ":" &
No_Space_Img (Excluded.Excl_Line) &
": cannot remove a source from an imported project: {",
Excluded.Location, Project.Project);
end if;
end if;
end if;
Excluded := Excluded_Sources_Htable.Get_Next (Project.Excluded);
end loop;
end Mark_Excluded_Sources;
------------------------
-- Check_Object_Files --
------------------------
procedure Check_Object_Files is
Iter : Source_Iterator;
Src_Id : Source_Id;
Src_Ind : Source_File_Index;
begin
Iter := For_Each_Source (Data.Tree);
loop
Src_Id := Prj.Element (Iter);
exit when Src_Id = No_Source;
if Is_Compilable (Src_Id)
and then Src_Id.Language.Config.Object_Generated
and then Is_Extending (Project.Project, Src_Id.Project)
then
if Src_Id.Unit = No_Unit_Index then
if Src_Id.Kind = Impl then
Check_Object (Src_Id);
end if;
else
case Src_Id.Kind is
when Spec =>
if Other_Part (Src_Id) = No_Source then
Check_Object (Src_Id);
end if;
when Sep =>
null;
when Impl =>
if Other_Part (Src_Id) /= No_Source then
Check_Object (Src_Id);
else
-- Check if it is a subunit
Src_Ind :=
Sinput.P.Load_Project_File
(Get_Name_String (Src_Id.Path.Display_Name));
if Sinput.P.Source_File_Is_Subunit (Src_Ind) then
Override_Kind (Src_Id, Sep);
else
Check_Object (Src_Id);
end if;
end if;
end case;
end if;
end if;
Next (Iter);
end loop;
end Check_Object_Files;
----------------------------------
-- Get_Sources_From_Source_Info --
----------------------------------
procedure Get_Sources_From_Source_Info is
Iter : Source_Info_Iterator;
Src : Source_Info;
Id : Source_Id;
Lang_Id : Language_Ptr;
begin
Initialize (Iter, Project.Project.Name);
loop
Src := Source_Info_Of (Iter);
exit when Src = No_Source_Info;
Id := new Source_Data;
Id.Project := Project.Project;
Lang_Id := Project.Project.Languages;
while Lang_Id /= No_Language_Index
and then Lang_Id.Name /= Src.Language
loop
Lang_Id := Lang_Id.Next;
end loop;
if Lang_Id = No_Language_Index then
Prj.Com.Fail
("unknown language " &
Get_Name_String (Src.Language) &
" for project " &
Get_Name_String (Src.Project) &
" in source info file");
end if;
Id.Language := Lang_Id;
Id.Kind := Src.Kind;
Id.Index := Src.Index;
Id.Path :=
(Path_Name_Type (Src.Display_Path_Name),
Path_Name_Type (Src.Path_Name));
Name_Len := 0;
Add_Str_To_Name_Buffer
(Directories.Simple_Name (Get_Name_String (Src.Path_Name)));
Id.File := Name_Find;
Id.Next_With_File_Name :=
Source_Files_Htable.Get (Data.Tree.Source_Files_HT, Id.File);
Source_Files_Htable.Set (Data.Tree.Source_Files_HT, Id.File, Id);
Name_Len := 0;
Add_Str_To_Name_Buffer
(Directories.Simple_Name
(Get_Name_String (Src.Display_Path_Name)));
Id.Display_File := Name_Find;
Id.Dep_Name :=
Dependency_Name (Id.File, Id.Language.Config.Dependency_Kind);
Id.Naming_Exception := Src.Naming_Exception;
Id.Object :=
Object_Name (Id.File, Id.Language.Config.Object_File_Suffix);
Id.Switches := Switches_Name (Id.File);
-- Add the source id to the Unit_Sources_HT hash table, if the
-- unit name is not null.
if Src.Kind /= Sep and then Src.Unit_Name /= No_Name then
declare
UData : Unit_Index :=
Units_Htable.Get (Data.Tree.Units_HT, Src.Unit_Name);
begin
if UData = No_Unit_Index then
UData := new Unit_Data;
UData.Name := Src.Unit_Name;
Units_Htable.Set
(Data.Tree.Units_HT, Src.Unit_Name, UData);
end if;
Id.Unit := UData;
end;
-- Note that this updates Unit information as well
Override_Kind (Id, Id.Kind);
end if;
if Src.Index /= 0 then
Project.Project.Has_Multi_Unit_Sources := True;
end if;
-- Add the source to the language list
Id.Next_In_Lang := Id.Language.First_Source;
Id.Language.First_Source := Id;
Next (Iter);
end loop;
end Get_Sources_From_Source_Info;
-- Start of processing for Look_For_Sources
begin
if Data.Tree.Source_Info_File_Exists then
Get_Sources_From_Source_Info;
else
if Project.Project.Source_Dirs /= Nil_String then
Find_Excluded_Sources (Project, Data);
if Project.Project.Languages /= No_Language_Index then
Load_Naming_Exceptions (Project, Data);
Find_Sources (Project, Data);
Mark_Excluded_Sources;
Check_Object_Files;
Check_Missing_Sources;
end if;
end if;
Object_File_Names_Htable.Reset (Object_Files);
end if;
end Look_For_Sources;
------------------
-- Path_Name_Of --
------------------
function Path_Name_Of
(File_Name : File_Name_Type;
Directory : Path_Name_Type) return String
is
Result : String_Access;
The_Directory : constant String := Get_Name_String (Directory);
begin
Debug_Output ("Path_Name_Of file name=", Name_Id (File_Name));
Debug_Output ("Path_Name_Of directory=", Name_Id (Directory));
Get_Name_String (File_Name);
Result :=
Locate_Regular_File
(File_Name => Name_Buffer (1 .. Name_Len),
Path => The_Directory);
if Result = null then
return "";
else
declare
R : constant String := Result.all;
begin
Free (Result);
return R;
end;
end if;
end Path_Name_Of;
-------------------
-- Remove_Source --
-------------------
procedure Remove_Source
(Tree : Project_Tree_Ref;
Id : Source_Id;
Replaced_By : Source_Id)
is
Source : Source_Id;
begin
if Current_Verbosity = High then
Debug_Indent;
Write_Str ("removing source ");
Write_Str (Get_Name_String (Id.File));
if Id.Index /= 0 then
Write_Str (" at" & Id.Index'Img);
end if;
Write_Eol;
end if;
if Replaced_By /= No_Source then
Id.Replaced_By := Replaced_By;
Replaced_By.Declared_In_Interfaces := Id.Declared_In_Interfaces;
if Id.File /= Replaced_By.File then
declare
Replacement : constant File_Name_Type :=
Replaced_Source_HTable.Get
(Tree.Replaced_Sources, Id.File);
begin
Replaced_Source_HTable.Set
(Tree.Replaced_Sources, Id.File, Replaced_By.File);
if Replacement = No_File then
Tree.Replaced_Source_Number :=
Tree.Replaced_Source_Number + 1;
end if;
end;
end if;
end if;
Id.In_Interfaces := False;
Id.Locally_Removed := True;
-- ??? Should we remove the source from the unit ? The file is not used,
-- so probably should not be referenced from the unit. On the other hand
-- it might give useful additional info
-- if Id.Unit /= null then
-- Id.Unit.File_Names (Id.Kind) := null;
-- end if;
Source := Id.Language.First_Source;
if Source = Id then
Id.Language.First_Source := Id.Next_In_Lang;
else
while Source.Next_In_Lang /= Id loop
Source := Source.Next_In_Lang;
end loop;
Source.Next_In_Lang := Id.Next_In_Lang;
end if;
end Remove_Source;
-----------------------
-- Report_No_Sources --
-----------------------
procedure Report_No_Sources
(Project : Project_Id;
Lang_Name : String;
Data : Tree_Processing_Data;
Location : Source_Ptr;
Continuation : Boolean := False)
is
begin
case Data.Flags.When_No_Sources is
when Silent =>
null;
when Warning | Error =>
declare
Msg : constant String :=
"<there are no "
& Lang_Name & " sources in this project";
begin
Error_Msg_Warn := Data.Flags.When_No_Sources = Warning;
if Continuation then
Error_Msg (Data.Flags, "\" & Msg, Location, Project);
else
Error_Msg (Data.Flags, Msg, Location, Project);
end if;
end;
end case;
end Report_No_Sources;
----------------------
-- Show_Source_Dirs --
----------------------
procedure Show_Source_Dirs
(Project : Project_Id;
Shared : Shared_Project_Tree_Data_Access)
is
Current : String_List_Id;
Element : String_Element;
begin
if Project.Source_Dirs = Nil_String then
Debug_Output ("no Source_Dirs");
else
Debug_Increase_Indent ("Source_Dirs:");
Current := Project.Source_Dirs;
while Current /= Nil_String loop
Element := Shared.String_Elements.Table (Current);
Debug_Output (Get_Name_String (Element.Display_Value));
Current := Element.Next;
end loop;
Debug_Decrease_Indent ("end Source_Dirs.");
end if;
end Show_Source_Dirs;
---------------------------
-- Process_Naming_Scheme --
---------------------------
procedure Process_Naming_Scheme
(Tree : Project_Tree_Ref;
Root_Project : Project_Id;
Node_Tree : Prj.Tree.Project_Node_Tree_Ref;
Flags : Processing_Flags)
is
procedure Check
(Project : Project_Id;
In_Aggregate_Lib : Boolean;
Data : in out Tree_Processing_Data);
-- Process the naming scheme for a single project
procedure Recursive_Check
(Project : Project_Id;
Prj_Tree : Project_Tree_Ref;
Context : Project_Context;
Data : in out Tree_Processing_Data);
-- Check_Naming_Scheme for the project
-----------
-- Check --
-----------
procedure Check
(Project : Project_Id;
In_Aggregate_Lib : Boolean;
Data : in out Tree_Processing_Data)
is
procedure Check_Aggregated;
-- Check aggregated projects which should not be externally built
----------------------
-- Check_Aggregated --
----------------------
procedure Check_Aggregated is
L : Aggregated_Project_List;
begin
-- Check that aggregated projects are not externally built
L := Project.Aggregated_Projects;
while L /= null loop
declare
Var : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Externally_Built,
L.Project.Decl.Attributes,
Data.Tree.Shared);
begin
if not Var.Default then
Error_Msg_Name_1 := L.Project.Display_Name;
Error_Msg
(Data.Flags,
"cannot aggregate externally built project %%",
Var.Location, Project);
end if;
end;
L := L.Next;
end loop;
end Check_Aggregated;
-- Local Variables
Shared : constant Shared_Project_Tree_Data_Access :=
Data.Tree.Shared;
Prj_Data : Project_Processing_Data;
-- Start of processing for Check
begin
Debug_Increase_Indent ("check", Project.Name);
Initialize (Prj_Data, Project);
Check_If_Externally_Built (Project, Data);
case Project.Qualifier is
when Aggregate =>
Check_Aggregated;
when Aggregate_Library =>
Check_Aggregated;
if Project.Object_Directory = No_Path_Information then
Project.Object_Directory := Project.Directory;
end if;
when others =>
Get_Directories (Project, Data);
Check_Programming_Languages (Project, Data);
if Current_Verbosity = High then
Show_Source_Dirs (Project, Shared);
end if;
if Project.Qualifier = Abstract_Project then
Check_Abstract_Project (Project, Data);
end if;
end case;
-- Check configuration. Must be done for gnatmake (even though no
-- user configuration file was provided) since the default config we
-- generate indicates whether libraries are supported for instance.
Check_Configuration (Project, Data);
if Project.Qualifier /= Aggregate then
Check_Library_Attributes (Project, Data);
Check_Package_Naming (Project, Data);
-- An aggregate library has no source, no need to look for them
if Project.Qualifier /= Aggregate_Library then
Look_For_Sources (Prj_Data, Data);
end if;
Check_Interfaces (Project, Data);
-- If this library is part of an aggregated library don't check it
-- as it has no sources by itself and so interface won't be found.
if Project.Library and not In_Aggregate_Lib then
Check_Stand_Alone_Library (Project, Data);
end if;
Get_Mains (Project, Data);
end if;
Free (Prj_Data);
Debug_Decrease_Indent ("done check");
end Check;
---------------------
-- Recursive_Check --
---------------------
procedure Recursive_Check
(Project : Project_Id;
Prj_Tree : Project_Tree_Ref;
Context : Project_Context;
Data : in out Tree_Processing_Data)
is
begin
if Current_Verbosity = High then
Debug_Increase_Indent
("Processing_Naming_Scheme for project", Project.Name);
end if;
Data.Tree := Prj_Tree;
Data.In_Aggregate_Lib := Context.In_Aggregate_Lib;
Check (Project, Context.In_Aggregate_Lib, Data);
if Current_Verbosity = High then
Debug_Decrease_Indent ("done Processing_Naming_Scheme");
end if;
end Recursive_Check;
procedure Check_All_Projects is new For_Every_Project_Imported_Context
(Tree_Processing_Data, Recursive_Check);
-- Comment required???
-- Local Variables
Data : Tree_Processing_Data;
-- Start of processing for Process_Naming_Scheme
begin
Lib_Data_Table.Init;
Initialize (Data, Tree => Tree, Node_Tree => Node_Tree, Flags => Flags);
Check_All_Projects (Root_Project, Tree, Data, Imported_First => True);
Free (Data);
-- Adjust language configs for projects that are extended
declare
List : Project_List;
Proj : Project_Id;
Exte : Project_Id;
Lang : Language_Ptr;
Elng : Language_Ptr;
begin
List := Tree.Projects;
while List /= null loop
Proj := List.Project;
Exte := Proj;
while Exte.Extended_By /= No_Project loop
Exte := Exte.Extended_By;
end loop;
if Exte /= Proj then
Lang := Proj.Languages;
if Lang /= No_Language_Index then
loop
Elng := Get_Language_From_Name
(Exte, Get_Name_String (Lang.Name));
exit when Elng /= No_Language_Index;
Exte := Exte.Extends;
end loop;
if Elng /= Lang then
Lang.Config := Elng.Config;
end if;
end if;
end if;
List := List.Next;
end loop;
end;
end Process_Naming_Scheme;
end Prj.Nmsc;
|
sungyeon/drake | Ada | 1,018 | ads | pragma License (Unrestricted);
with Ada.Task_Identification;
-- with System;
package Ada.Execution_Time.Timers is
type Timer (T : not null access constant Task_Identification.Task_Id) is
tagged limited private;
type Timer_Handler is access protected procedure (TM : in out Timer);
-- Min_Handler_Ceiling : constant System.Any_Priority :=
-- implementation-defined;
-- procedure Set_Handler (
-- TM : in out Timer;
-- In_Time : Real_Time.Time_Span;
-- Handler : Timer_Handler);
-- procedure Set_Handler (
-- TM : in out Timer;
-- At_Time : CPU_Time;
-- Handler : Timer_Handler);
-- function Current_Handler (TM : Timer) return Timer_Handler;
-- procedure Cancel_Handler (TM : in out Timer; Cancelled : out Boolean);
-- function Time_Remaining (TM : Timer) return Real_Time.Time_Span;
Timer_Resource_Error : exception;
private
type Timer (T : not null access constant Task_Identification.Task_Id) is
tagged limited null record;
end Ada.Execution_Time.Timers;
|
onox/orka | Ada | 1,827 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Orka.Rendering.Buffers;
with Orka.Resources.Locations;
with Orka.Types;
private with GL.Low_Level.Enums;
private with Orka.Rendering.Programs.Uniforms;
package Orka.Algorithms.FFT is
pragma Preelaborate;
type FFT is tagged limited private;
function Create_FFT
(Location : Resources.Locations.Location_Ptr) return FFT;
use type Types.Element_Type;
procedure Compute_FFT
(Object : in out FFT;
Buffer : Rendering.Buffers.Buffer;
Width, Height : Positive;
Transpose, Inverse : Boolean)
with Pre => Buffer.Kind = Types.Single_Type
and Width * Height * 2 = Buffer.Length
and Types.Is_Power_Of_Two (if Transpose then Height else Width);
private
package LE renames GL.Low_Level.Enums;
type FFT is tagged limited record
Program_FFT : Rendering.Programs.Program;
Local_Size : Positive;
Uniform_Size : Rendering.Programs.Uniforms.Uniform (LE.UInt_Vec2);
Uniform_Transpose : Rendering.Programs.Uniforms.Uniform (LE.Bool_Type);
Uniform_Inverse : Rendering.Programs.Uniforms.Uniform (LE.Bool_Type);
end record;
end Orka.Algorithms.FFT;
|
davidkristola/vole | Ada | 5,399 | ads | with Interfaces;
with kv.avm.Actor_References;
with kv.avm.Actor_References.Sets;
with kv.avm.Tuples;
with kv.avm.Registers;
with kv.avm.Memories;
with kv.avm.Executables;
with kv.avm.Processors;
with kv.avm.Control;
with kv.avm.Messages;
with kv.avm.Executable_Lists;
with kv.avm.Capabilities;
with kv.avm.Routers;
package kv.avm.Machines is
Machine_Error : exception;
type Machine_Type is new kv.avm.Control.Control_Interface with private;
type Machine_Access is access all Machine_Type;
procedure Initialize
(Self : in out Machine_Type;
Processor : in kv.avm.Processors.Processor_Access;
Factory : in kv.avm.Executables.Factory_Access);
function Get_Router(Self : Machine_Type) return kv.avm.Routers.Router_Type;
procedure Step
(Self : in out Machine_Type);
procedure Deliver_Messages
(Self : in out Machine_Type);
function Current_Instance(Self : Machine_Type) return kv.avm.Executables.Executable_Access;
function Done(Self : Machine_Type) return Boolean;
function Get_Steps(Self : Machine_Type) return Natural;
function Get_Total(Self : Machine_Type) return Natural;
function Get_Active(Self : Machine_Type) return Natural;
function Get_Idle(Self : Machine_Type) return Natural;
function Get_Blocked(Self : Machine_Type) return Natural;
function Get_Deferred(Self : Machine_Type) return Natural;
function Get_Queue_Size(Self : Machine_Type) return Natural;
procedure Set_Queue_Limit(Self : in out Machine_Type; Queue_Limit : in Natural);
function Get_Cycles(Self : Machine_Type) return Natural;
function Get_Reaped(Self : Machine_Type) return Natural;
procedure Set_Capabilities(Self : in out Machine_Type; Capabilities : in kv.avm.Capabilities.Capabilities_Type);
procedure Set_Garbage_Trigger(Self : in out Machine_Type; Garbage_Trigger : in Natural);
overriding
procedure New_Actor
(Self : in out Machine_Type;
Name : in String;
Instance : out kv.avm.Actor_References.Actor_Reference_Type);
overriding
procedure Post_Message
(Self : in out Machine_Type;
Message : in kv.avm.Messages.Message_Type;
Status : out kv.avm.Control.Status_Type);
overriding
procedure Post_Response
(Self : in out Machine_Type;
Reply_To : in kv.avm.Actor_References.Actor_Reference_Type;
Answer : in kv.avm.Tuples.Tuple_Type;
Future : in Interfaces.Unsigned_32);
overriding
procedure Generate_Next_Future
(Self : in out Machine_Type;
Future : out Interfaces.Unsigned_32);
overriding
procedure Trap_To_The_Machine
(Self : in out Machine_Type;
Trap : in String;
Data : in kv.avm.Registers.Register_Type;
Answer : out kv.avm.Registers.Register_Type;
Status : out kv.avm.Control.Status_Type);
overriding
procedure Activate_Instance
(Self : in out Machine_Type;
Instance : in kv.avm.Actor_References.Actor_Reference_Type);
-- Create an instance of the Actor, sending it an empty CONSTRUCTOR message,
-- and then sending it Message containing Data.
--
procedure Start_With
(Self : in out Machine_Type;
Actor : in String;
Message : in String;
Data : in kv.avm.Memories.Register_Array_Type);
private
subtype Executable_State_Type is kv.avm.Control.Status_Type range kv.avm.Control.Active .. kv.avm.Control.Idle;
type Lists_Type is array (Executable_State_Type) of kv.avm.Executable_Lists.Executable_Holder_Type;
type Machine_Type is new kv.avm.control.Control_Interface with
record
Processor : kv.avm.Processors.Processor_Access;
Factory : kv.avm.Executables.Factory_Access;
Future : Interfaces.Unsigned_32;
Lists : Lists_Type;
Router : kv.avm.Routers.Router_Type;
Cursor : kv.avm.Executable_Lists.Cursor_Type := 0;
Capabilities : kv.avm.Capabilities.Capabilities_Type;
Steps : Natural;
Cycles : Natural;
Reaped : Natural;
Old_Idle : Natural := 0;
Garbage_Trigger : Natural := 500;
end record;
function Check_For_Beginning_Of_Cycle(Self : Machine_Type) return Boolean;
function Check_Message_Delivery_Policy(Self : Machine_Type) return Boolean;
function Check_Undeferral_Policy(Self : Machine_Type) return Boolean;
function Check_Garbage_Collection_Policy(Self : Machine_Type) return Boolean;
procedure Beginning_Of_Cycle
(Self : in out Machine_Type);
procedure Process_Current_Executable
(Self : in out Machine_Type);
procedure Activate_Instance
(Self : in out Machine_Type;
Instance : in kv.avm.Executables.Executable_Access);
procedure Undefer
(Self : in out Machine_Type);
function Non_Idle(Self : Machine_Type) return kv.avm.Actor_References.Sets.Set;
function Expand_Reachable_Set
(Self : Machine_Type;
Starting : kv.avm.Actor_References.Sets.Set) return kv.avm.Actor_References.Sets.Set;
procedure Delete_Unreachable_Executables
(Self : in out Machine_Type;
Reachable : in kv.avm.Actor_References.Sets.Set);
procedure Garbage_Collection
(Self : in out Machine_Type);
end kv.avm.Machines;
|
ohenley/ada-util | Ada | 8,597 | ads | -----------------------------------------------------------------------
-- util-streams-buffered -- Buffered streams utilities
-- Copyright (C) 2010, 2013, 2015, 2016, 2017, 2018 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
with Ada.Finalization;
-- == Buffered Streams ==
-- The `Output_Buffer_Stream` and `Input_Buffer_Stream` implement an output
-- and input stream respectively which manages an output or input buffer. The data is
-- first written to the buffer and when the buffer is full or flushed, it gets written
-- to the target output stream.
--
-- The `Output_Buffer_Stream` must be initialized to indicate the buffer size as well
-- as the target output stream onto which the data will be flushed. For example, a
-- pipe stream could be created and configured to use the buffer as follows:
--
-- with Util.Streams.Buffered;
-- with Util.Streams.Pipes;
-- ...
-- Pipe : aliased Util.Streams.Pipes.Pipe_Stream;
-- Buffer : Util.Streams.Buffered.Output_Buffer_Stream;
-- ...
-- Buffer.Initialize (Output => Pipe'Unchecked_Access,
-- Size => 1024);
--
-- In this example, the buffer of 1024 bytes is configured to flush its content to the
-- pipe input stream so that what is written to the buffer will be received as input by
-- the program.
-- The `Output_Buffer_Stream` provides write operation that deal only with binary data
-- (`Stream_Element`). To write text, it is best to use the `Print_Stream` type from
-- the `Util.Streams.Texts` package as it extends the `Output_Buffer_Stream` and provides
-- several operations to write character and strings.
--
-- The `Input_Buffer_Stream` must also be initialized to also indicate the buffer size
-- and either an input stream or an input content. When configured, the input stream is used
-- to fill the input stream buffer. The buffer configuration is very similar as the
-- output stream:
--
-- with Util.Streams.Buffered;
-- with Util.Streams.Pipes;
-- ...
-- Pipe : aliased Util.Streams.Pipes.Pipe_Stream;
-- Buffer : Util.Streams.Buffered.Input_Buffer_Stream;
-- ...
-- Buffer.Initialize (Input => Pipe'Unchecked_Access, Size => 1024);
--
-- In this case, the buffer of 1024 bytes is filled by reading the pipe stream, and thus
-- getting the program's output.
package Util.Streams.Buffered is
pragma Preelaborate;
type Buffer_Access is access Ada.Streams.Stream_Element_Array;
-- -----------------------
-- Output buffer stream
-- -----------------------
-- The <b>Output_Buffer_Stream</b> is an output stream which uses
-- an intermediate buffer to write the data.
--
-- It is necessary to call <b>Flush</b> to make sure the data
-- is written to the target stream. The <b>Flush</b> operation will
-- be called when finalizing the output buffer stream.
type Output_Buffer_Stream is limited new Output_Stream with private;
-- Initialize the stream to write on the given streams.
-- An internal buffer is allocated for writing the stream.
procedure Initialize (Stream : in out Output_Buffer_Stream;
Output : in Output_Stream_Access;
Size : in Positive);
-- Initialize the stream with a buffer of <b>Size</b> bytes.
procedure Initialize (Stream : in out Output_Buffer_Stream;
Size : in Positive);
-- Close the sink.
overriding
procedure Close (Stream : in out Output_Buffer_Stream);
-- Get the direct access to the buffer.
function Get_Buffer (Stream : in Output_Buffer_Stream) return Buffer_Access;
-- Write the buffer array to the output stream.
overriding
procedure Write (Stream : in out Output_Buffer_Stream;
Buffer : in Ada.Streams.Stream_Element_Array);
-- Flush the buffer by writing on the output stream.
-- Raises Data_Error if there is no output stream.
overriding
procedure Flush (Stream : in out Output_Buffer_Stream);
-- Flush the buffer in the <tt>Into</tt> array and return the index of the
-- last element (inclusive) in <tt>Last</tt>.
procedure Flush (Stream : in out Output_Buffer_Stream;
Into : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
-- Flush the buffer stream to the unbounded string.
procedure Flush (Stream : in out Output_Buffer_Stream;
Into : out Ada.Strings.Unbounded.Unbounded_String);
-- Get the number of element in the stream.
function Get_Size (Stream : in Output_Buffer_Stream) return Natural;
type Input_Buffer_Stream is limited new Input_Stream with private;
-- Initialize the stream to read from the string.
procedure Initialize (Stream : in out Input_Buffer_Stream;
Content : in String);
-- Initialize the stream to read the given streams.
procedure Initialize (Stream : in out Input_Buffer_Stream;
Input : in Input_Stream_Access;
Size : in Positive);
-- Fill the buffer by reading the input stream.
-- Raises Data_Error if there is no input stream;
procedure Fill (Stream : in out Input_Buffer_Stream);
-- Read one character from the input stream.
procedure Read (Stream : in out Input_Buffer_Stream;
Char : out Character);
-- 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 Input_Buffer_Stream;
Into : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
-- Read into the buffer as many bytes as possible and return in
-- <b>last</b> the position of the last byte read.
procedure Read (Stream : in out Input_Buffer_Stream;
Into : in out Ada.Strings.Unbounded.Unbounded_String);
-- Returns True if the end of the stream is reached.
function Is_Eof (Stream : in Input_Buffer_Stream) return Boolean;
private
use Ada.Streams;
type Output_Buffer_Stream is limited new Ada.Finalization.Limited_Controlled
and Output_Stream with record
-- The buffer where the data is written before being flushed.
Buffer : Buffer_Access := null;
-- The next write position within the buffer.
Write_Pos : Stream_Element_Offset := 0;
-- The next read position within the buffer.
Read_Pos : Stream_Element_Offset := 1;
-- The last valid write position within the buffer.
Last : Stream_Element_Offset := 0;
-- The output stream to use for flushing the buffer.
Output : Output_Stream_Access := null;
No_Flush : Boolean := False;
end record;
-- Flush the stream and release the buffer.
overriding
procedure Finalize (Object : in out Output_Buffer_Stream);
type Input_Buffer_Stream is limited new Ada.Finalization.Limited_Controlled
and Input_Stream with record
-- The buffer where the data is written before being flushed.
Buffer : Buffer_Access := null;
-- The next write position within the buffer.
Write_Pos : Stream_Element_Offset := 0;
-- The next read position within the buffer.
Read_Pos : Stream_Element_Offset := 1;
-- The last valid write position within the buffer.
Last : Stream_Element_Offset := 0;
-- The input stream to use to fill the buffer.
Input : Input_Stream_Access := null;
-- Reached end of file when reading.
Eof : Boolean := False;
end record;
-- Release the buffer.
overriding
procedure Finalize (Object : in out Input_Buffer_Stream);
end Util.Streams.Buffered;
|
ptrebuc/ewok-kernel | Ada | 15,060 | adb | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with system.machine_code;
with ewok.tasks; use ewok.tasks;
with ewok.devices_shared; use ewok.devices_shared;
with ewok.sleep;
with ewok.devices;
with ewok.syscalls.handler;
with ewok.mpu;
with ewok.layout;
with ewok.interrupts;
with ewok.debug;
with soc.interrupts;
with soc.dwt;
with m4.scb;
with m4.mpu;
with m4.systick;
with applications; -- Automatically generated
package body ewok.sched
with spark_mode => off
is
package TSK renames ewok.tasks;
sched_period : unsigned_32 := 0;
current_task_id : t_task_id := ID_KERNEL;
last_main_user_task_id : t_task_id := applications.list'first;
-----------------------------------------------
-- SPARK/ghost specific functions & procedures
-----------------------------------------------
function current_task_is_valid
return boolean
is
begin
return (current_task_id /= ID_UNUSED);
end current_task_is_valid;
----------------------------------------------
-- sched functions
----------------------------------------------
function get_current return ewok.tasks_shared.t_task_id
is
begin
return current_task_id;
end get_current;
procedure request_schedule
with spark_mode => off
is
begin
m4.scb.SCB.ICSR.PENDSVSET := 1;
end request_schedule;
function task_elect
return t_task_id
with spark_mode => off
is
elected : t_task_id;
begin
--
-- Execute pending user ISRs first
--
for id in applications.list'range loop
if TSK.tasks_list(id).mode = TASK_MODE_ISRTHREAD
and then
ewok.tasks.get_state (id, TASK_MODE_ISRTHREAD) = TASK_STATE_RUNNABLE
and then
ewok.tasks.get_state (id, TASK_MODE_MAINTHREAD) /= TASK_STATE_LOCKED
then
elected := id;
goto ok_return;
end if;
end loop;
--
-- Execute tasks in critical sections
--
for id in applications.list'range loop
if TSK.tasks_list(id).state = TASK_STATE_LOCKED then
elected := id;
if TSK.tasks_list(id).mode = TASK_MODE_MAINTHREAD then
last_main_user_task_id := elected;
end if;
goto ok_return;
end if;
end loop;
--
-- Updating finished ISRs state
--
for id in applications.list'range loop
if TSK.tasks_list(id).mode = TASK_MODE_ISRTHREAD
and then
ewok.tasks.get_state (id, TASK_MODE_ISRTHREAD) = TASK_STATE_ISR_DONE
then
ewok.tasks.set_state
(id, TASK_MODE_ISRTHREAD, TASK_STATE_IDLE);
TSK.tasks_list(id).isr_ctx.frame_a := NULL;
TSK.tasks_list(id).isr_ctx.device_id := ID_DEV_UNUSED;
TSK.tasks_list(id).isr_ctx.sched_policy := ISR_STANDARD;
ewok.tasks.set_mode (id, TASK_MODE_MAINTHREAD);
-- When a task has just finished its ISR its main thread might
-- become runnable
if ewok.sleep.is_sleeping (id) then
ewok.sleep.try_waking_up (id);
elsif TSK.tasks_list(id).state = TASK_STATE_IDLE then
ewok.tasks.set_state
(id, TASK_MODE_MAINTHREAD, TASK_STATE_RUNNABLE);
end if;
end if;
end loop;
--
-- Execute SOFTIRQ if there are some pending ISRs and/or syscalls
--
if ewok.tasks.get_state
(ID_SOFTIRQ, TASK_MODE_MAINTHREAD) = TASK_STATE_RUNNABLE then
elected := ID_SOFTIRQ;
goto ok_return;
end if;
--
-- IPC can force task election to reduce IPC overhead
--
for id in applications.list'range loop
if TSK.tasks_list(id).state = TASK_STATE_FORCED then
ewok.tasks.set_state
(id, TASK_MODE_MAINTHREAD, TASK_STATE_RUNNABLE);
elected := id;
goto ok_return;
end if;
end loop;
#if CONFIG_SCHED_RAND
declare
random : aliased unsigned_32;
id : t_task_id;
ok : boolean;
pragma unreferenced (ok);
begin
ewok.rng.random (random'access, ok);
id := t_task_id'val ((applications.list'first)'pos +
(random mod applications.list'length));
for i in 1 .. applications.list'length loop
if ewok.tasks.get_state
(id, TASK_MODE_MAINTHREAD) = TASK_STATE_RUNNABLE then
elected := id;
goto ok_return;
end if;
if id /= applications.list'last then
id := t_task_id'succ (id);
else
id := applications.list'first;
end if;
end loop;
end;
#end if;
#if CONFIG_SCHED_RR
declare
id : t_task_id;
begin
id := last_main_user_task_id;
for i in 1 .. applications.list'length loop
if id < applications.list'last then
id := t_task_id'succ (id);
else
id := applications.list'first;
end if;
if ewok.tasks.get_state
(id, TASK_MODE_MAINTHREAD) = TASK_STATE_RUNNABLE then
elected := id;
last_main_user_task_id := elected;
goto ok_return;
end if;
end loop;
end;
#end if;
#if CONFIG_SCHED_MLQ_RR
declare
max_prio : unsigned_8 := 0;
id : t_task_id;
begin
-- Max priority
for id in applications.list'range loop
if TSK.tasks_list(id).prio > max_prio
and
ewok.tasks.get_state (id, TASK_MODE_MAINTHREAD)
= TASK_STATE_RUNNABLE
then
max_prio := TSK.tasks_list(id).prio;
end if;
end loop;
-- Round Robin election on tasks with the max priority
id := last_main_user_task_id;
for i in 1 .. applications.list'length loop
if id < applications.list'last then
id := t_task_id'succ (id);
else
id := applications.list'first;
end if;
if TSK.tasks_list(id).prio = max_prio
and
ewok.tasks.get_state (id, TASK_MODE_MAINTHREAD)
= TASK_STATE_RUNNABLE
then
elected := id;
last_main_user_task_id := elected;
goto ok_return;
end if;
end loop;
end;
#end if;
-- Default
elected := ID_KERNEL;
<<ok_return>>
--pragma DEBUG (debug.log (debug.DEBUG, "task " & t_task_id'image (elected) & " elected"));
return elected;
end task_elect;
procedure mpu_switching
(id : in t_task_id)
with spark_mode => off
is
new_task : t_task renames ewok.tasks.tasks_list(id);
dev_id : t_device_id;
ok : boolean;
begin
-- Notes about mapping user devices:
--
-- - EXTIs are a special case where an interrupt can trigger a
-- user ISR without any device_id associated
-- - DMAs are not registered in devices
-- Kernel tasks are already granted with privileged accesses
if new_task.ttype = TASK_TYPE_KERNEL then
return;
end if;
-- User task
if new_task.mode = TASK_MODE_ISRTHREAD then
--------------
-- ISR mode --
--------------
dev_id := new_task.isr_ctx.device_id;
if dev_id /= ID_DEV_UNUSED then
ewok.devices.mpu_mapping_device
(dev_id, ewok.mpu.USER_ISR_DEVICE_REGION, ok);
if not ok then
debug.panic ("mpu_switching(): mapping device failed!");
end if;
else
-- Unmapping devices eventually mapped by other tasks
-- Note: can be time consumming if no device was mapped
m4.mpu.disable_region (ewok.mpu.USER_ISR_DEVICE_REGION);
end if;
-- Mapping the ISR stack
ewok.mpu.set_region
(region_number => ewok.mpu.USER_ISR_STACK_REGION,
addr => ewok.layout.STACK_BOTTOM_TASK_ISR,
size => m4.mpu.REGION_SIZE_4KB,
region_type => ewok.mpu.REGION_TYPE_ISR_STACK,
subregion_mask => 0);
else
-----------------
-- Main thread --
-----------------
--
-- Mapping the user devices
--
for i in new_task.mounted_device'range loop
dev_id := new_task.mounted_device(i);
if dev_id /= ID_DEV_UNUSED then
ewok.devices.mpu_mapping_device
(dev_id, ewok.mpu.device_regions(i), ok);
if not ok then
debug.panic ("mpu_switching(): mapping device failed!");
end if;
else
-- Unmapping devices eventually mapped by other tasks
-- Note: can be time consumming if no device was mapped
m4.mpu.disable_region (ewok.mpu.device_regions(i));
end if;
end loop;
end if; -- ISR or MAIN thread
--------------------------------
-- Mapping user code and data --
--------------------------------
declare
type t_mask is array (unsigned_8 range 1 .. 8) of bit
with pack, size => 8;
function to_unsigned_8 is new ada.unchecked_conversion
(t_mask, unsigned_8);
mask : t_mask := (others => 1);
begin
for i in 0 .. new_task.num_slots - 1 loop
mask(new_task.slot + i) := 0;
end loop;
ewok.mpu.update_subregions
(region_number => ewok.mpu.USER_CODE_REGION,
subregion_mask => to_unsigned_8 (mask));
ewok.mpu.update_subregions
(region_number => ewok.mpu.USER_DATA_REGION,
subregion_mask => to_unsigned_8 (mask));
end;
end mpu_switching;
function pendsv_handler
(frame_a : ewok.t_stack_frame_access)
return ewok.t_stack_frame_access
with spark_mode => off
is
begin
-- Keep ISR threads running until they finish
if TSK.tasks_list(current_task_id).mode = TASK_MODE_ISRTHREAD and then
ewok.tasks.get_state
(current_task_id, TASK_MODE_ISRTHREAD) = TASK_STATE_RUNNABLE
then
return frame_a;
end if;
-- Save current context
if TSK.tasks_list(current_task_id).mode = TASK_MODE_ISRTHREAD then
TSK.tasks_list(current_task_id).isr_ctx.frame_a := frame_a;
else
TSK.tasks_list(current_task_id).ctx.frame_a := frame_a;
end if;
-- Elect a new task and change current_task_id
current_task_id := task_elect;
-- Apply MPU specific configuration
mpu_switching (current_task_id);
-- Return the new context
if TSK.tasks_list(current_task_id).mode = TASK_MODE_ISRTHREAD then
return TSK.tasks_list(current_task_id).isr_ctx.frame_a;
else
return TSK.tasks_list(current_task_id).ctx.frame_a;
end if;
end pendsv_handler;
function systick_handler
(frame_a : ewok.t_stack_frame_access)
return ewok.t_stack_frame_access
with spark_mode => off
is
begin
m4.systick.increment;
sched_period := sched_period + 1;
-- Managing DWT cycle count overflow
soc.dwt.ovf_manage;
-- FIXME - CONFIG_SCHED_PERIOD must be in milliseconds,
-- not in ticks
if sched_period /= $CONFIG_SCHED_PERIOD then
return frame_a;
else
sched_period := 0;
end if;
-- Waking-up sleeping tasks
ewok.sleep.check_is_awoke;
-- Keep ISR threads running until they finish
if TSK.tasks_list(current_task_id).mode = TASK_MODE_ISRTHREAD and then
ewok.tasks.get_state
(current_task_id, TASK_MODE_ISRTHREAD) = TASK_STATE_RUNNABLE
then
return frame_a;
end if;
-- Save current context
if TSK.tasks_list(current_task_id).mode = TASK_MODE_ISRTHREAD then
TSK.tasks_list(current_task_id).isr_ctx.frame_a := frame_a;
else
TSK.tasks_list(current_task_id).ctx.frame_a := frame_a;
end if;
-- Elect a new task
current_task_id := task_elect;
-- Apply MPU specific configuration
mpu_switching (current_task_id);
-- Return the new context
if TSK.tasks_list(current_task_id).mode = TASK_MODE_ISRTHREAD then
return TSK.tasks_list(current_task_id).isr_ctx.frame_a;
else
return TSK.tasks_list(current_task_id).ctx.frame_a;
end if;
end systick_handler;
procedure init
with spark_mode => off
is
idle_task : t_task renames ewok.tasks.tasks_list(ID_KERNEL);
ok : boolean;
begin
current_task_id := ID_KERNEL;
ewok.interrupts.set_task_switching_handler
(soc.interrupts.INT_SYSTICK,
systick_handler'access,
ID_KERNEL,
ID_DEV_UNUSED,
ok);
if not ok then raise program_error; end if;
ewok.interrupts.set_task_switching_handler
(soc.interrupts.INT_PENDSV,
pendsv_handler'access,
ID_KERNEL,
ID_DEV_UNUSED,
ok);
if not ok then raise program_error; end if;
ewok.interrupts.set_task_switching_handler
(soc.interrupts.INT_SVC,
ewok.syscalls.handler.svc_handler'access,
ID_KERNEL,
ID_DEV_UNUSED,
ok);
if not ok then raise program_error; end if;
--
-- Jump to the kernel task
--
system.machine_code.asm
("mov r0, %0" & ascii.lf &
"msr psp, r0" & ascii.lf &
"mov r0, 2" & ascii.lf &
"msr control, r0" & ascii.lf &
"mov r1, %1" & ascii.lf &
"bx r1",
inputs =>
(system_address'asm_input
("r", to_system_address (idle_task.ctx.frame_a)),
system_address'asm_input
("r", idle_task.entry_point)),
clobber => "r0, r1",
volatile => true);
end init;
end ewok.sched;
|
reznikmm/matreshka | Ada | 25,584 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Elements;
with AMF.Internals.Element_Collections;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.UML_Attributes;
with AMF.Visitors.UML_Iterators;
with AMF.Visitors.UML_Visitors;
with League.Strings.Internals;
with Matreshka.Internals.Strings;
package body AMF.Internals.UML_Reduce_Actions is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Reduce_Action_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Enter_Reduce_Action
(AMF.UML.Reduce_Actions.UML_Reduce_Action_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Reduce_Action_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Leave_Reduce_Action
(AMF.UML.Reduce_Actions.UML_Reduce_Action_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Reduce_Action_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then
AMF.Visitors.UML_Iterators.UML_Iterator'Class
(Iterator).Visit_Reduce_Action
(Visitor,
AMF.UML.Reduce_Actions.UML_Reduce_Action_Access (Self),
Control);
end if;
end Visit_Element;
--------------------
-- Get_Collection --
--------------------
overriding function Get_Collection
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Input_Pins.UML_Input_Pin_Access is
begin
return
AMF.UML.Input_Pins.UML_Input_Pin_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Collection
(Self.Element)));
end Get_Collection;
--------------------
-- Set_Collection --
--------------------
overriding procedure Set_Collection
(Self : not null access UML_Reduce_Action_Proxy;
To : AMF.UML.Input_Pins.UML_Input_Pin_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Collection
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Collection;
--------------------
-- Get_Is_Ordered --
--------------------
overriding function Get_Is_Ordered
(Self : not null access constant UML_Reduce_Action_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Ordered
(Self.Element);
end Get_Is_Ordered;
--------------------
-- Set_Is_Ordered --
--------------------
overriding procedure Set_Is_Ordered
(Self : not null access UML_Reduce_Action_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Ordered
(Self.Element, To);
end Set_Is_Ordered;
-----------------
-- Get_Reducer --
-----------------
overriding function Get_Reducer
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Behaviors.UML_Behavior_Access is
begin
return
AMF.UML.Behaviors.UML_Behavior_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Reducer
(Self.Element)));
end Get_Reducer;
-----------------
-- Set_Reducer --
-----------------
overriding procedure Set_Reducer
(Self : not null access UML_Reduce_Action_Proxy;
To : AMF.UML.Behaviors.UML_Behavior_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Reducer
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Reducer;
----------------
-- Get_Result --
----------------
overriding function Get_Result
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Output_Pins.UML_Output_Pin_Access is
begin
return
AMF.UML.Output_Pins.UML_Output_Pin_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Result
(Self.Element)));
end Get_Result;
----------------
-- Set_Result --
----------------
overriding procedure Set_Result
(Self : not null access UML_Reduce_Action_Proxy;
To : AMF.UML.Output_Pins.UML_Output_Pin_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Result
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Result;
-----------------
-- Get_Context --
-----------------
overriding function Get_Context
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access is
begin
return
AMF.UML.Classifiers.UML_Classifier_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Context
(Self.Element)));
end Get_Context;
---------------
-- Get_Input --
---------------
overriding function Get_Input
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Input_Pins.Collections.Ordered_Set_Of_UML_Input_Pin is
begin
return
AMF.UML.Input_Pins.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Input
(Self.Element)));
end Get_Input;
------------------------------
-- Get_Is_Locally_Reentrant --
------------------------------
overriding function Get_Is_Locally_Reentrant
(Self : not null access constant UML_Reduce_Action_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Locally_Reentrant
(Self.Element);
end Get_Is_Locally_Reentrant;
------------------------------
-- Set_Is_Locally_Reentrant --
------------------------------
overriding procedure Set_Is_Locally_Reentrant
(Self : not null access UML_Reduce_Action_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Locally_Reentrant
(Self.Element, To);
end Set_Is_Locally_Reentrant;
-----------------------------
-- Get_Local_Postcondition --
-----------------------------
overriding function Get_Local_Postcondition
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Postcondition
(Self.Element)));
end Get_Local_Postcondition;
----------------------------
-- Get_Local_Precondition --
----------------------------
overriding function Get_Local_Precondition
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Precondition
(Self.Element)));
end Get_Local_Precondition;
----------------
-- Get_Output --
----------------
overriding function Get_Output
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Output_Pins.Collections.Ordered_Set_Of_UML_Output_Pin is
begin
return
AMF.UML.Output_Pins.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Output
(Self.Element)));
end Get_Output;
-----------------
-- Get_Handler --
-----------------
overriding function Get_Handler
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Exception_Handlers.Collections.Set_Of_UML_Exception_Handler is
begin
return
AMF.UML.Exception_Handlers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Handler
(Self.Element)));
end Get_Handler;
------------------
-- Get_Activity --
------------------
overriding function Get_Activity
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Activities.UML_Activity_Access is
begin
return
AMF.UML.Activities.UML_Activity_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Activity
(Self.Element)));
end Get_Activity;
------------------
-- Set_Activity --
------------------
overriding procedure Set_Activity
(Self : not null access UML_Reduce_Action_Proxy;
To : AMF.UML.Activities.UML_Activity_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Activity
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Activity;
------------------
-- Get_In_Group --
------------------
overriding function Get_In_Group
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Activity_Groups.Collections.Set_Of_UML_Activity_Group is
begin
return
AMF.UML.Activity_Groups.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Group
(Self.Element)));
end Get_In_Group;
---------------------------------
-- Get_In_Interruptible_Region --
---------------------------------
overriding function Get_In_Interruptible_Region
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Interruptible_Activity_Regions.Collections.Set_Of_UML_Interruptible_Activity_Region is
begin
return
AMF.UML.Interruptible_Activity_Regions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Interruptible_Region
(Self.Element)));
end Get_In_Interruptible_Region;
----------------------
-- Get_In_Partition --
----------------------
overriding function Get_In_Partition
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Activity_Partitions.Collections.Set_Of_UML_Activity_Partition is
begin
return
AMF.UML.Activity_Partitions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Partition
(Self.Element)));
end Get_In_Partition;
----------------------------
-- Get_In_Structured_Node --
----------------------------
overriding function Get_In_Structured_Node
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access is
begin
return
AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Structured_Node
(Self.Element)));
end Get_In_Structured_Node;
----------------------------
-- Set_In_Structured_Node --
----------------------------
overriding procedure Set_In_Structured_Node
(Self : not null access UML_Reduce_Action_Proxy;
To : AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_In_Structured_Node
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_In_Structured_Node;
------------------
-- Get_Incoming --
------------------
overriding function Get_Incoming
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is
begin
return
AMF.UML.Activity_Edges.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Incoming
(Self.Element)));
end Get_Incoming;
------------------
-- Get_Outgoing --
------------------
overriding function Get_Outgoing
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is
begin
return
AMF.UML.Activity_Edges.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Outgoing
(Self.Element)));
end Get_Outgoing;
------------------------
-- Get_Redefined_Node --
------------------------
overriding function Get_Redefined_Node
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is
begin
return
AMF.UML.Activity_Nodes.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Node
(Self.Element)));
end Get_Redefined_Node;
-----------------
-- Get_Is_Leaf --
-----------------
overriding function Get_Is_Leaf
(Self : not null access constant UML_Reduce_Action_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf
(Self.Element);
end Get_Is_Leaf;
-----------------
-- Set_Is_Leaf --
-----------------
overriding procedure Set_Is_Leaf
(Self : not null access UML_Reduce_Action_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf
(Self.Element, To);
end Set_Is_Leaf;
---------------------------
-- Get_Redefined_Element --
---------------------------
overriding function Get_Redefined_Element
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is
begin
return
AMF.UML.Redefinable_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element
(Self.Element)));
end Get_Redefined_Element;
------------------------------
-- Get_Redefinition_Context --
------------------------------
overriding function Get_Redefinition_Context
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context
(Self.Element)));
end Get_Redefinition_Context;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
begin
return
AMF.UML.Dependencies.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
(Self.Element)));
end Get_Client_Dependency;
-------------------------
-- Get_Name_Expression --
-------------------------
overriding function Get_Name_Expression
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access is
begin
return
AMF.UML.String_Expressions.UML_String_Expression_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
(Self.Element)));
end Get_Name_Expression;
-------------------------
-- Set_Name_Expression --
-------------------------
overriding procedure Set_Name_Expression
(Self : not null access UML_Reduce_Action_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Name_Expression;
-------------------
-- Get_Namespace --
-------------------
overriding function Get_Namespace
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
return
AMF.UML.Namespaces.UML_Namespace_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
(Self.Element)));
end Get_Namespace;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Qualified_Name;
-------------
-- Context --
-------------
overriding function Context
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Context unimplemented");
raise Program_Error with "Unimplemented procedure UML_Reduce_Action_Proxy.Context";
return Context (Self);
end Context;
------------------------
-- Is_Consistent_With --
------------------------
overriding function Is_Consistent_With
(Self : not null access constant UML_Reduce_Action_Proxy;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Reduce_Action_Proxy.Is_Consistent_With";
return Is_Consistent_With (Self, Redefinee);
end Is_Consistent_With;
-----------------------------------
-- Is_Redefinition_Context_Valid --
-----------------------------------
overriding function Is_Redefinition_Context_Valid
(Self : not null access constant UML_Reduce_Action_Proxy;
Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented");
raise Program_Error with "Unimplemented procedure UML_Reduce_Action_Proxy.Is_Redefinition_Context_Valid";
return Is_Redefinition_Context_Valid (Self, Redefined);
end Is_Redefinition_Context_Valid;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
raise Program_Error with "Unimplemented procedure UML_Reduce_Action_Proxy.All_Owning_Packages";
return All_Owning_Packages (Self);
end All_Owning_Packages;
-----------------------------
-- Is_Distinguishable_From --
-----------------------------
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Reduce_Action_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
raise Program_Error with "Unimplemented procedure UML_Reduce_Action_Proxy.Is_Distinguishable_From";
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
---------------
-- Namespace --
---------------
overriding function Namespace
(Self : not null access constant UML_Reduce_Action_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
raise Program_Error with "Unimplemented procedure UML_Reduce_Action_Proxy.Namespace";
return Namespace (Self);
end Namespace;
end AMF.Internals.UML_Reduce_Actions;
|
thierr26/ada-keystore | Ada | 23,540 | adb | -----------------------------------------------------------------------
-- keystore-repository -- Repository management for the keystore
-- Copyright (C) 2019 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Log.Loggers;
with Ada.Unchecked_Deallocation;
with Keystore.Marshallers;
with Keystore.Repository.Data;
with Keystore.Repository.Entries;
with Keystore.Repository.Workers;
with Keystore.Repository.Keys;
-- Block = 4K, 8K, 16K, 64K, 128K ?
--
-- Block types:
-- * Wallet File First Block
-- * Wallet Header
-- * Wallet Repository
-- * Wallet Data
--
-- Generic Block header
-- +------------------+
-- | Block HMAC-256 | 32b
-- +------------------+
-- | Block type | 4b
-- | Wallet id | 4b
-- | PAD 0 | 4b
-- | PAD 0 | 4b
-- +------------------+
-- | ...AES-CTR... | B
-- +------------------+
package body Keystore.Repository is
use type Interfaces.Unsigned_64;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Keystore.Repository");
procedure Free is
new Ada.Unchecked_Deallocation (Object => Wallet_Entry,
Name => Wallet_Entry_Access);
procedure Free is
new Ada.Unchecked_Deallocation (Object => Wallet_Directory_Entry,
Name => Wallet_Directory_Entry_Access);
procedure Free is
new Ada.Unchecked_Deallocation (Object => Keystore.Repository.Workers.Wallet_Worker,
Name => Wallet_Worker_Access);
function Hash (Value : in Wallet_Entry_Index) return Ada.Containers.Hash_Type is
begin
return Ada.Containers.Hash_Type (Value);
end Hash;
function Get_Identifier (Repository : in Wallet_Repository) return Wallet_Identifier is
begin
return Repository.Id;
end Get_Identifier;
procedure Open (Repository : in out Wallet_Repository;
Config : in Keystore.Wallet_Config;
Ident : in Wallet_Identifier;
Stream : in IO.Wallet_Stream_Access) is
begin
Repository.Id := Ident;
Repository.Stream := Stream;
Repository.Next_Id := 1;
Repository.Next_Wallet_Id := Ident + 1;
Repository.Config.Randomize := Config.Randomize;
end Open;
procedure Open (Repository : in out Wallet_Repository;
Name : in String;
Password : in out Keystore.Passwords.Provider'Class;
Keys : in out Keystore.Keys.Key_Manager;
Master_Block : in out Keystore.IO.Storage_Block;
Master_Ident : in out Wallet_Identifier;
Wallet : in out Wallet_Repository) is
Pos : constant Wallet_Maps.Cursor := Repository.Map.Find (Name);
begin
if not Wallet_Maps.Has_Element (Pos) then
Log.Info ("Wallet entry '{0}' not found", Name);
raise Not_Found;
end if;
declare
Item : constant Wallet_Entry_Access := Wallet_Maps.Element (Pos);
begin
if Item.Kind /= T_WALLET then
raise Invalid_Keystore;
end if;
Master_Block := Repository.Root;
Master_Block.Block := Item.Master;
Master_Ident := Item.Wallet_Id;
Wallet.Stream := Repository.Stream;
Wallet.Next_Id := 1;
Wallet.Id := Item.Wallet_Id;
Wallet.Parent := Repository'Unchecked_Access;
Keystore.Repository.Keys.Open_Wallet (Repository, Item, Keys);
Keystore.Keys.Open (Keys, Password, Wallet.Id, Master_Block,
Wallet.Root, Wallet.Config, null, Repository.Stream.all);
Wallet.Workers := Workers.Create (Wallet'Unchecked_Access, null, 1).all'Access;
Entries.Load_Complete_Directory (Wallet, Wallet.Root);
end;
end Open;
procedure Create (Repository : in out Wallet_Repository;
Password : in out Keystore.Passwords.Provider'Class;
Config : in Wallet_Config;
Block : in IO.Storage_Block;
Ident : in Wallet_Identifier;
Keys : in out Keystore.Keys.Key_Manager;
Stream : in IO.Wallet_Stream_Access) is
Entry_Block : Wallet_Directory_Entry_Access;
begin
Stream.Allocate (IO.DIRECTORY_BLOCK, Repository.Root);
Repository.Id := Ident;
Repository.Next_Id := 1;
Repository.Next_Wallet_Id := Ident + 1;
Repository.Stream := Stream;
Repository.Config.Randomize := Config.Randomize;
Repository.Config.Max_Counter := Interfaces.Unsigned_32 (Config.Max_Counter);
Repository.Config.Min_Counter := Interfaces.Unsigned_32 (Config.Min_Counter);
Keystore.Keys.Create (Keys, Password, 1, Ident, Block, Repository.Root,
Repository.Config, Stream.all);
Repository.Workers := Workers.Create (Repository'Unchecked_Access, null, 1).all'Access;
-- We need a new wallet directory block.
Entries.Initialize_Directory_Block (Repository, Repository.Root, 0, Entry_Block);
Repository.Current.Buffer := Buffers.Allocate (Repository.Root);
-- Fill the root directory block with random values or with zeros.
if Repository.Config.Randomize then
Repository.Random.Generate (Repository.Current.Buffer.Data.Value.Data);
else
Repository.Current.Buffer.Data.Value.Data := (others => 0);
end if;
Marshallers.Set_Header (Into => Repository.Current,
Tag => IO.BT_WALLET_DIRECTORY,
Id => Repository.Id);
Marshallers.Put_Unsigned_32 (Repository.Current, 0);
Marshallers.Put_Block_Index (Repository.Current, IO.Block_Index'Last);
Marshallers.Put_Unsigned_32 (Repository.Current, 0);
Keystore.Keys.Set_IV (Repository.Config.Dir, Repository.Root.Block);
Stream.Write (From => Repository.Current.Buffer,
Cipher => Repository.Config.Dir.Cipher,
Sign => Repository.Config.Dir.Sign);
end Create;
procedure Unlock (Repository : in out Wallet_Repository;
Password : in out Keystore.Passwords.Provider'Class;
Block : in Keystore.IO.Storage_Block;
Keys : in out Keystore.Keys.Key_Manager) is
begin
Keystore.Keys.Open (Keys, Password, Repository.Id, Block,
Repository.Root, Repository.Config, null, Repository.Stream.all);
Repository.Workers := Workers.Create (Repository'Unchecked_Access, null, 1).all'Access;
Entries.Load_Complete_Directory (Repository, Repository.Root);
end Unlock;
procedure Add (Repository : in out Wallet_Repository;
Name : in String;
Kind : in Entry_Type;
Content : in Ada.Streams.Stream_Element_Array) is
Item : Wallet_Entry_Access;
Data_Offset : Interfaces.Unsigned_64 := 0;
Iterator : Keys.Data_Key_Iterator;
begin
Entries.Add_Entry (Repository, Name, Kind, Item);
Entries.Update_Entry (Repository, Item, Kind, Content'Length);
if Content'Length > 0 then
Keys.Initialize (Repository, Iterator, Item);
Data.Add_Data (Repository, Iterator, Content, Data_Offset);
Entries.Update_Entry (Repository, Item, Kind, Data_Offset);
end if;
Entries.Save (Manager => Repository);
end Add;
procedure Add (Repository : in out Wallet_Repository;
Name : in String;
Kind : in Entry_Type;
Input : in out Util.Streams.Input_Stream'Class) is
Item : Wallet_Entry_Access;
Data_Offset : Interfaces.Unsigned_64 := 0;
Iterator : Keys.Data_Key_Iterator;
begin
Entries.Add_Entry (Repository, Name, Kind, Item);
Entries.Update_Entry (Repository, Item, Kind, 1);
Keys.Initialize (Repository, Iterator, Item);
Data.Add_Data (Repository, Iterator, Input, Data_Offset);
Entries.Update_Entry (Repository, Item, Kind, Data_Offset);
Entries.Save (Manager => Repository);
end Add;
procedure Add_Wallet (Repository : in out Wallet_Repository;
Name : in String;
Password : in out Keystore.Passwords.Provider'Class;
Keys : in out Keystore.Keys.Key_Manager;
Master_Block : in out Keystore.IO.Storage_Block;
Master_Ident : in out Wallet_Identifier;
Wallet : in out Wallet_Repository) is
Item : Wallet_Entry_Access;
Entry_Block : Wallet_Directory_Entry_Access;
begin
Entries.Add_Entry (Repository, Name, T_WALLET, Item);
-- Repository.Value.Add (Name, Password, Wallet, Stream);
Repository.Stream.Allocate (IO.MASTER_BLOCK, Master_Block);
Repository.Stream.Allocate (IO.DIRECTORY_BLOCK, Wallet.Root);
Item.Master := Master_Block.Block;
Wallet.Stream := Repository.Stream;
Wallet.Next_Id := 1;
Wallet.Id := Item.Wallet_Id;
Master_Ident := Wallet.Id;
Entries.Update_Entry (Repository, Item, T_WALLET, 0);
Keystore.Repository.Keys.Create_Wallet (Repository, Item, Master_Block, Keys);
Keystore.Keys.Create (Keys, Password, 1, Master_Ident, Master_Block, Wallet.Root,
Wallet.Config, Repository.Stream.all);
-- We need a new wallet directory block.
Entries.Initialize_Directory_Block (Wallet, Wallet.Root, 0, Entry_Block);
Entries.Save (Repository);
Wallet.Current.Buffer := Buffers.Allocate (Wallet.Root);
Wallet.Current.Buffer.Data.Value.Data := (others => 0);
Marshallers.Set_Header (Into => Wallet.Current,
Tag => IO.BT_WALLET_DIRECTORY,
Id => Wallet.Id);
Marshallers.Put_Unsigned_32 (Wallet.Current, 0);
Marshallers.Put_Block_Index (Wallet.Current, IO.Block_Index'Last);
Keystore.Keys.Set_IV (Wallet.Config.Dir, Wallet.Root.Block);
Repository.Stream.Write (From => Wallet.Current.Buffer,
Cipher => Wallet.Config.Dir.Cipher,
Sign => Wallet.Config.Dir.Sign);
Wallet.Workers := Workers.Create (Wallet'Unchecked_Access, null, 1).all'Access;
end Add_Wallet;
procedure Set (Repository : in out Wallet_Repository;
Name : in String;
Kind : in Entry_Type;
Content : in Ada.Streams.Stream_Element_Array) is
begin
if Repository.Map.Contains (Name) then
Repository.Update (Name, Kind, Content);
else
Repository.Add (Name, Kind, Content);
end if;
end Set;
procedure Set (Repository : in out Wallet_Repository;
Name : in String;
Kind : in Entry_Type;
Input : in out Util.Streams.Input_Stream'Class) is
begin
if Repository.Map.Contains (Name) then
Repository.Update (Name, Kind, Input);
else
Repository.Add (Name, Kind, Input);
end if;
end Set;
procedure Update (Repository : in out Wallet_Repository;
Name : in String;
Kind : in Entry_Type;
Content : in Ada.Streams.Stream_Element_Array) is
Pos : constant Wallet_Maps.Cursor := Repository.Map.Find (Name);
Data_Offset : Interfaces.Unsigned_64 := 0;
begin
Log.Debug ("Update keystore entry {0}", Name);
if not Wallet_Maps.Has_Element (Pos) then
Log.Info ("Data entry '{0}' not found", Name);
raise Not_Found;
end if;
declare
Item : constant Wallet_Entry_Access := Wallet_Maps.Element (Pos);
Iterator : Keys.Data_Key_Iterator;
Last_Pos : Stream_Element_Offset;
begin
if Item.Is_Wallet then
Log.Info ("Data entry '{0}' is a wallet", Name);
raise No_Content;
end if;
Item.Kind := Kind;
Keys.Initialize (Repository, Iterator, Item);
Data.Update_Data (Repository, Iterator, Content, Last_Pos, Data_Offset);
if Last_Pos > Content'Last then
Data.Delete_Data (Repository, Iterator);
else
Data.Add_Data (Repository, Iterator,
Content (Last_Pos .. Content'Last), Data_Offset);
end if;
Entries.Update_Entry (Repository, Item, Kind, Data_Offset);
Entries.Save (Repository);
end;
end Update;
procedure Update (Repository : in out Wallet_Repository;
Name : in String;
Kind : in Entry_Type;
Input : in out Util.Streams.Input_Stream'Class) is
Item_Pos : constant Wallet_Maps.Cursor := Repository.Map.Find (Name);
Data_Offset : Interfaces.Unsigned_64 := 0;
begin
Log.Debug ("Update keystore entry {0}", Name);
if not Wallet_Maps.Has_Element (Item_Pos) then
Log.Info ("Data entry '{0}' not found", Name);
raise Not_Found;
end if;
declare
Item : constant Wallet_Entry_Access := Wallet_Maps.Element (Item_Pos);
Iterator : Keys.Data_Key_Iterator;
End_Of_Stream : Boolean;
begin
if Item.Is_Wallet then
Log.Info ("Data entry '{0}' is a wallet", Name);
raise No_Content;
end if;
Item.Kind := Kind;
Keys.Initialize (Repository, Iterator, Item);
Data.Update_Data (Repository, Iterator, Input, End_Of_Stream, Data_Offset);
if End_Of_Stream then
Data.Delete_Data (Repository, Iterator);
else
Data.Add_Data (Repository, Iterator, Input, Data_Offset);
end if;
Entries.Update_Entry (Repository, Item, Kind, Data_Offset);
Entries.Save (Repository);
end;
end Update;
-- ------------------------------
-- Delete the value associated with the given name.
-- Raises the Not_Found exception if the name was not found.
-- ------------------------------
procedure Delete (Repository : in out Wallet_Repository;
Name : in String) is
Pos : Wallet_Maps.Cursor := Repository.Map.Find (Name);
begin
if not Wallet_Maps.Has_Element (Pos) then
Log.Info ("Data entry '{0}' not found", Name);
raise Not_Found;
end if;
declare
Item : Wallet_Entry_Access := Wallet_Maps.Element (Pos);
Iterator : Keys.Data_Key_Iterator;
begin
Keys.Initialize (Repository, Iterator, Item);
-- Erase the data fragments used by the entry.
Data.Delete_Data (Repository, Iterator);
-- Erase the entry from the repository.
Entries.Delete_Entry (Manager => Repository,
Item => Item);
Entries.Save (Manager => Repository);
Repository.Entry_Indexes.Delete (Item.Id);
Repository.Map.Delete (Pos);
Free (Item);
exception
when others =>
-- Handle data or directory block corruption or IO error.
Repository.Entry_Indexes.Delete (Item.Id);
Repository.Map.Delete (Pos);
Free (Item);
raise;
end;
end Delete;
function Contains (Repository : in Wallet_Repository;
Name : in String) return Boolean is
begin
return Repository.Map.Contains (Name);
end Contains;
procedure Find (Repository : in out Wallet_Repository;
Name : in String;
Result : out Entry_Info) is
Pos : constant Wallet_Maps.Cursor := Repository.Map.Find (Name);
Item : Wallet_Entry_Access;
begin
if not Wallet_Maps.Has_Element (Pos) then
Log.Info ("Data entry '{0}' not found", Name);
raise Not_Found;
end if;
Item := Wallet_Maps.Element (Pos);
if Item.Kind = T_INVALID then
Log.Error ("Wallet entry {0} is corrupted", Name);
raise Corrupted;
end if;
if not Item.Is_Wallet then
Result.Size := Item.Size;
Result.Block_Count := Item.Block_Count;
else
Result.Size := 0;
Result.Block_Count := 0;
end if;
Result.Kind := Item.Kind;
Result.Create_Date := Item.Create_Date;
Result.Update_Date := Item.Update_Date;
end Find;
procedure Get_Data (Repository : in out Wallet_Repository;
Name : in String;
Result : out Entry_Info;
Output : out Ada.Streams.Stream_Element_Array) is
Pos : constant Wallet_Maps.Cursor := Repository.Map.Find (Name);
begin
if not Wallet_Maps.Has_Element (Pos) then
Log.Info ("Data entry '{0}' not found", Name);
raise Not_Found;
end if;
declare
Item : constant Wallet_Entry_Access := Wallet_Maps.Element (Pos);
Iterator : Keys.Data_Key_Iterator;
begin
if Item.Is_Wallet then
Log.Info ("Data entry '{0}' is a wallet", Name);
raise No_Content;
end if;
Result.Size := Item.Size;
Result.Kind := Item.Kind;
Result.Create_Date := Item.Create_Date;
Result.Update_Date := Item.Update_Date;
Keys.Initialize (Repository, Iterator, Item);
Data.Get_Data (Repository, Iterator, Output);
if Iterator.Current_Offset /= Item.Size then
pragma Assert (Iterator.Current_Offset = Item.Size);
end if;
end;
end Get_Data;
procedure Get_Data (Repository : in out Wallet_Repository;
Name : in String;
Output : in out Util.Streams.Output_Stream'Class) is
Pos : constant Wallet_Maps.Cursor := Repository.Map.Find (Name);
begin
if not Wallet_Maps.Has_Element (Pos) then
Log.Info ("Data entry '{0}' not found", Name);
raise Not_Found;
end if;
declare
Item : constant Wallet_Entry_Access := Wallet_Maps.Element (Pos);
Iterator : Keys.Data_Key_Iterator;
begin
if Item.Is_Wallet then
Log.Info ("Data entry '{0}' is a wallet", Name);
raise No_Content;
end if;
Keys.Initialize (Repository, Iterator, Item);
Data.Get_Data (Repository, Iterator, Output);
end;
end Get_Data;
-- ------------------------------
-- Get the list of entries contained in the wallet that correspond to the optional filter.
-- ------------------------------
procedure List (Repository : in out Wallet_Repository;
Filter : in Filter_Type;
Content : out Entry_Map) is
Value : Entry_Info;
begin
for Item of Repository.Map loop
if Filter (Item.Kind) then
if not Item.Is_Wallet then
Value.Size := Item.Size;
Value.Block_Count := Item.Block_Count;
else
Value.Size := 0;
Value.Block_Count := 1;
end if;
Value.Kind := Item.Kind;
Value.Create_Date := Item.Create_Date;
Value.Update_Date := Item.Update_Date;
Content.Include (Key => Item.Name,
New_Item => Value);
end if;
end loop;
end List;
procedure List (Repository : in out Wallet_Repository;
Pattern : in GNAT.Regpat.Pattern_Matcher;
Filter : in Filter_Type;
Content : out Entry_Map) is
Value : Entry_Info;
begin
for Item of Repository.Map loop
if Filter (Item.Kind) and then GNAT.Regpat.Match (Pattern, Item.Name) then
if not Item.Is_Wallet then
Value.Size := Item.Size;
Value.Block_Count := Item.Block_Count;
else
Value.Size := 0;
Value.Block_Count := 1;
end if;
Value.Kind := Item.Kind;
Value.Create_Date := Item.Create_Date;
Value.Update_Date := Item.Update_Date;
Content.Include (Key => Item.Name,
New_Item => Value);
end if;
end loop;
end List;
-- ------------------------------
-- Get the keystore UUID.
-- ------------------------------
function Get_UUID (Repository : in Wallet_Repository) return UUID_Type is
begin
return Repository.Config.UUID;
end Get_UUID;
-- ------------------------------
-- Get the key slot number that was used to unlock the keystore.
-- ------------------------------
function Get_Key_Slot (Repository : in Wallet_Repository) return Key_Slot is
begin
return Repository.Config.Slot;
end Get_Key_Slot;
-- ------------------------------
-- Get stats information about the wallet (the number of entries, used key slots).
-- ------------------------------
procedure Fill_Stats (Repository : in Wallet_Repository;
Stats : in out Wallet_Stats) is
begin
Stats.UUID := Repository.Config.UUID;
Stats.Keys := Repository.Config.Keys;
Stats.Entry_Count := Natural (Repository.Map.Length);
end Fill_Stats;
procedure Close (Repository : in out Wallet_Repository) is
Dir : Wallet_Directory_Entry_Access;
First : Wallet_Maps.Cursor;
Item : Wallet_Entry_Access;
begin
while not Repository.Directory_List.Is_Empty loop
Dir := Repository.Directory_List.First_Element;
Repository.Directory_List.Delete_First;
Free (Dir);
end loop;
Repository.Entry_Indexes.Clear;
while not Repository.Map.Is_Empty loop
First := Repository.Map.First;
Item := Wallet_Maps.Element (First);
Free (Item);
Repository.Map.Delete (First);
end loop;
Free (Repository.Workers);
end Close;
procedure Set_Work_Manager (Repository : in out Wallet_Repository;
Workers : in Keystore.Task_Manager_Access) is
begin
Free (Repository.Workers);
Repository.Workers
:= Keystore.Repository.Workers.Create (Repository'Unchecked_Access,
Workers, Workers.Count).all'Access;
end Set_Work_Manager;
overriding
procedure Finalize (Manager : in out Wallet_Repository) is
begin
Manager.Close;
end Finalize;
end Keystore.Repository;
|
renekroka/Amass | Ada | 2,056 | ads | -- Copyright 2017 Jeff Foley. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local json = require("json")
name = "Censys"
type = "cert"
function start()
setratelimit(3)
end
function vertical(ctx, domain)
if api == nil then
webscrape(ctx, domain)
return
end
apiquery(ctx, domain)
end
function apiquery(ctx, domain)
local p = 1
while(true) do
local body, err = json.encode({
query="parsed.names: " .. domain,
page=p,
fields={"parsed.names"},
})
if (err ~= nil and err ~= "") then
return
end
local page, err = request({
method="POST",
data=body,
url=apiurl(),
headers={['Content-Type']="application/json"},
id=api["key"],
pass=api["secret"],
})
if (err ~= nil and err ~= "") then
return
end
local resp = json.decode(page)
if (resp == nil or resp.status ~= "ok" or #(resp.results) == 0) then
return
end
for i, r in pairs(resp.results) do
for j, v in pairs(r["parsed.names"]) do
sendnames(ctx, v)
end
end
if resp["metadata"].page >= resp["metadata"].pages then
return
end
checkratelimit()
active(ctx)
p = p + 1
end
end
function apiurl()
return "https://www.censys.io/api/v1/search/certificates"
end
function webscrape(ctx, domain)
local page, err = request({
url=scrapeurl(domain),
})
if (err ~= nil and err ~= '') then
return
end
sendnames(ctx, page)
end
function scrapeurl(domain)
return "https://www.censys.io/domain/" .. domain .. "/table"
end
function sendnames(ctx, content)
local names = find(content, subdomainre)
if names == nil then
return
end
for i, v in pairs(names) do
newname(ctx, v)
end
end
|
charlie5/cBound | Ada | 1,869 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with swig;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_glx_get_query_objectiv_arb_reply_t is
-- Item
--
type Item is record
response_type : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
sequence : aliased Interfaces.Unsigned_16;
length : aliased Interfaces.Unsigned_32;
pad1 : aliased swig.int8_t_Array (0 .. 3);
n : aliased Interfaces.Unsigned_32;
datum : aliased Interfaces.Integer_32;
pad2 : aliased swig.int8_t_Array (0 .. 11);
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb
.xcb_glx_get_query_objectiv_arb_reply_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_query_objectiv_arb_reply_t.Item,
Element_Array => xcb.xcb_glx_get_query_objectiv_arb_reply_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb
.xcb_glx_get_query_objectiv_arb_reply_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_query_objectiv_arb_reply_t.Pointer,
Element_Array =>
xcb.xcb_glx_get_query_objectiv_arb_reply_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_glx_get_query_objectiv_arb_reply_t;
|
flyx/OpenGLAda | Ada | 1,539 | ads | -- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
package GL.Objects.Vertex_Arrays is
type Vertex_Array_Object is new GL_Object with private;
procedure Bind (Object : Vertex_Array_Object);
procedure Draw_Arrays (Mode : Connection_Mode; First, Count : Size);
procedure Draw_Arrays_Instanced (Mode : Connection_Mode;
First, Count, Instances : Size);
function Current_Array_Object return Vertex_Array_Object;
-- bind this object to unbind the current array object.
Null_Array_Object : constant Vertex_Array_Object;
-- Specifies the vertex array element index used to indicate that a new
-- primitive should be started during rendering. When processing of
-- vertex-array element indices encounters a value that matches index, no
-- vertex data is processed, the current graphics primitive is terminated,
-- and a new one of the identical type is started from the next vertex.
procedure Set_Primitive_Restart_Index (Index : UInt);
private
type Vertex_Array_Object is new GL_Object with null record;
overriding
procedure Internal_Create_Id (Object : Vertex_Array_Object; Id : out UInt);
overriding
procedure Internal_Release_Id (Object : Vertex_Array_Object; Id : UInt);
Null_Array_Object : constant Vertex_Array_Object
:= Vertex_Array_Object'(Ada.Finalization.Controlled with
Reference => Reference_To_Null_Object'Access);
end GL.Objects.Vertex_Arrays;
|
redparavoz/ada-wiki | Ada | 9,104 | adb | -----------------------------------------------------------------------
-- wiki-render-text -- Wiki Text renderer
-- Copyright (C) 2011, 2012, 2013, 2015, 2016, 2018 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Wiki.Helpers;
package body Wiki.Render.Text is
-- ------------------------------
-- Set the output writer.
-- ------------------------------
procedure Set_Output_Stream (Engine : in out Text_Renderer;
Stream : in Streams.Output_Stream_Access) is
begin
Engine.Output := Stream;
end Set_Output_Stream;
-- ------------------------------
-- Emit a new line.
-- ------------------------------
procedure New_Line (Document : in out Text_Renderer) is
begin
Document.Output.Write (Wiki.Helpers.LF);
Document.Empty_Line := True;
end New_Line;
-- ------------------------------
-- Add a line break (<br>).
-- ------------------------------
procedure Add_Line_Break (Document : in out Text_Renderer) is
begin
Document.Output.Write (Wiki.Helpers.LF);
Document.Empty_Line := True;
end Add_Line_Break;
-- ------------------------------
-- Render a blockquote (<blockquote>). The level indicates the blockquote nested level.
-- The blockquote must be closed at the next header.
-- ------------------------------
procedure Render_Blockquote (Engine : in out Text_Renderer;
Level : in Natural) is
begin
Engine.Close_Paragraph;
for I in 1 .. Level loop
Engine.Output.Write (" ");
end loop;
end Render_Blockquote;
-- ------------------------------
-- Render a list item (<li>). Close the previous paragraph and list item if any.
-- The list item will be closed at the next list item, next paragraph or next header.
-- ------------------------------
procedure Render_List_Item (Engine : in out Text_Renderer;
Level : in Positive;
Ordered : in Boolean) is
pragma Unreferenced (Level, Ordered);
begin
if not Engine.Empty_Line then
Engine.Add_Line_Break;
end if;
Engine.Need_Paragraph := False;
Engine.Open_Paragraph;
end Render_List_Item;
procedure Close_Paragraph (Document : in out Text_Renderer) is
begin
if Document.Has_Paragraph then
Document.Add_Line_Break;
end if;
Document.Has_Paragraph := False;
end Close_Paragraph;
procedure Open_Paragraph (Document : in out Text_Renderer) is
begin
if Document.Need_Paragraph then
Document.Has_Paragraph := True;
Document.Need_Paragraph := False;
end if;
end Open_Paragraph;
-- ------------------------------
-- Render a link.
-- ------------------------------
procedure Render_Link (Engine : in out Text_Renderer;
Title : in Wiki.Strings.WString;
Attr : in Wiki.Attributes.Attribute_List) is
Href : constant Wiki.Strings.WString := Wiki.Attributes.Get_Attribute (Attr, "href");
begin
Engine.Open_Paragraph;
if Title'Length /= 0 then
Engine.Output.Write (Title);
end if;
if Title /= Href and Href'Length /= 0 then
if Title'Length /= 0 then
Engine.Output.Write (" (");
end if;
Engine.Output.Write (Href);
if Title'Length /= 0 then
Engine.Output.Write (")");
end if;
end if;
Engine.Empty_Line := False;
end Render_Link;
-- ------------------------------
-- Render an image.
-- ------------------------------
procedure Render_Image (Engine : in out Text_Renderer;
Title : in Wiki.Strings.WString;
Attr : in Wiki.Attributes.Attribute_List) is
Desc : constant Wiki.Strings.WString := Wiki.Attributes.Get_Attribute (Attr, "longdesc");
begin
Engine.Open_Paragraph;
if Title'Length > 0 then
Engine.Output.Write (Title);
end if;
if Title'Length > 0 and Desc'Length > 0 then
Engine.Output.Write (' ');
end if;
if Desc'Length > 0 then
Engine.Output.Write (Desc);
end if;
Engine.Empty_Line := False;
end Render_Image;
-- ------------------------------
-- Render a text block that is pre-formatted.
-- ------------------------------
procedure Render_Preformatted (Engine : in out Text_Renderer;
Text : in Wiki.Strings.WString;
Format : in Wiki.Strings.WString) is
pragma Unreferenced (Format);
begin
Engine.Close_Paragraph;
Engine.Output.Write (Text);
Engine.Empty_Line := False;
end Render_Preformatted;
-- Render the node instance from the document.
overriding
procedure Render (Engine : in out Text_Renderer;
Doc : in Wiki.Documents.Document;
Node : in Wiki.Nodes.Node_Type) is
use type Wiki.Nodes.Node_List_Access;
begin
case Node.Kind is
when Wiki.Nodes.N_HEADER =>
Engine.Close_Paragraph;
if not Engine.Empty_Line then
Engine.Add_Line_Break;
end if;
Engine.Output.Write (Node.Header);
Engine.Add_Line_Break;
when Wiki.Nodes.N_LINE_BREAK =>
Engine.Add_Line_Break;
when Wiki.Nodes.N_HORIZONTAL_RULE =>
Engine.Close_Paragraph;
Engine.Output.Write ("---------------------------------------------------------");
Engine.Add_Line_Break;
when Wiki.Nodes.N_PARAGRAPH =>
Engine.Close_Paragraph;
Engine.Need_Paragraph := True;
Engine.Add_Line_Break;
when Wiki.Nodes.N_INDENT =>
Engine.Indent_Level := Node.Level;
when Wiki.Nodes.N_BLOCKQUOTE =>
Engine.Render_Blockquote (Node.Level);
when Wiki.Nodes.N_LIST =>
Engine.Render_List_Item (Node.Level, False);
when Wiki.Nodes.N_NUM_LIST =>
Engine.Render_List_Item (Node.Level, True);
when Wiki.Nodes.N_TEXT =>
if Engine.Empty_Line and Engine.Indent_Level /= 0 then
for I in 1 .. Engine.Indent_Level loop
Engine.Output.Write (' ');
end loop;
end if;
Engine.Output.Write (Node.Text);
Engine.Empty_Line := False;
when Wiki.Nodes.N_QUOTE =>
Engine.Open_Paragraph;
Engine.Output.Write (Node.Title);
Engine.Empty_Line := False;
when Wiki.Nodes.N_LINK =>
Engine.Render_Link (Node.Title, Node.Link_Attr);
when Wiki.Nodes.N_IMAGE =>
Engine.Render_Image (Node.Title, Node.Link_Attr);
when Wiki.Nodes.N_PREFORMAT =>
Engine.Render_Preformatted (Node.Preformatted, "");
when Wiki.Nodes.N_TAG_START =>
if Node.Children /= null then
if Node.Tag_Start = Wiki.DT_TAG then
Engine.Close_Paragraph;
Engine.Indent_Level := 0;
Engine.Render (Doc, Node.Children);
Engine.Close_Paragraph;
Engine.Indent_Level := 0;
elsif Node.Tag_Start = Wiki.DD_TAG then
Engine.Close_Paragraph;
Engine.Empty_Line := True;
Engine.Indent_Level := 4;
Engine.Render (Doc, Node.Children);
Engine.Close_Paragraph;
Engine.Indent_Level := 0;
else
Engine.Render (Doc, Node.Children);
if Node.Tag_Start = Wiki.DL_TAG then
Engine.Close_Paragraph;
Engine.New_Line;
end if;
end if;
end if;
when others =>
null;
end case;
end Render;
-- ------------------------------
-- Finish the document after complete wiki text has been parsed.
-- ------------------------------
overriding
procedure Finish (Engine : in out Text_Renderer;
Doc : in Wiki.Documents.Document) is
pragma Unreferenced (Doc);
begin
Engine.Close_Paragraph;
end Finish;
end Wiki.Render.Text;
|
lumalisan/EspeblancaYLos7PPs | Ada | 319 | ads | package def_monitor is
protected type Monitor is
entry cadiraLock;
procedure cadiraUnlock;
entry menjarLock;
procedure menjarUnlock;
function ferMenjar return Boolean;
private
contCadires : Integer := 0;
potsMenjar : Boolean := False;
end Monitor;
end def_monitor;
|
zhmu/ananas | Ada | 113 | adb | -- { dg-do run }
-- { dg-options "-flto" { target lto } }
with Lto5_Pkg;
procedure Lto5 is
begin
null;
end;
|
tum-ei-rcs/StratoX | Ada | 3,483 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . I M G _ L L I --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
-- signed integer types larger than Size Integer'Size, and also for conversion
-- operations required in Text_IO.Integer_IO for such types.
package System.Img_LLI is
pragma Pure;
procedure Image_Long_Long_Integer
(V : Long_Long_Integer;
S : in out String;
P : out Natural);
-- Computes Long_Long_Integer'Image (V) and stores the result in
-- S (1 .. P) setting the resulting value of P. The caller guarantees
-- that S is long enough to hold the result, and that S'First is 1.
procedure Set_Image_Long_Long_Integer
(V : Long_Long_Integer;
S : in out String;
P : in out Natural);
-- Stores the image of V in S starting at S (P + 1), P is updated to point
-- to the last character stored. The value stored is identical to the value
-- of Long_Long_Integer'Image (V) except that no leading space is stored
-- when V is non-negative. The caller guarantees that S is long enough to
-- hold the result. S need not have a lower bound of 1.
end System.Img_LLI;
|
LionelDraghi/List_Image | Ada | 3,015 | ads | -- -----------------------------------------------------------------------------
-- Copyright 2018 Lionel Draghi
--
-- 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.
-- -----------------------------------------------------------------------------
-- This file is part of the List_Image project
-- available at https://github.com/LionelDraghi/List_Image
-- -----------------------------------------------------------------------------
package List_Image.Windows_Predefined_Styles is
EOL : constant String := Windows_EOL;
-- Note that two identical packages exist, named :
-- List_Image.[Unix|Windows]_Predefined_Styles
-- The only difference between those packages is this platform specific
-- EOL definition.
-- --------------------------------------------------------------------------
-- Predefined multi-line style
-- --------------------------------------------------------------------------
--
-- - Bulleted_List_Style :
-- > - A
-- > - B
-- > - C
--
-- - Markdown_Bulleted_List_Style :
-- Like the bulleted list, but surrounded by
-- two empty lines (in some Markdown implementation, if the first bullet
-- is not preceded by an empty line, the list is not recognized)
--
-- - HTML_Bulleted_List_Style :
-- > <ul>
-- > <li>A</li>
-- > <li>B</li>
-- > <li>C</li>
-- > </ul>
-- Note : <ul></ul>, an empty list, is recognized by most navigator,
-- but seems to be illegal html.
-- No problem here, thanks to _If_Empty parameters nothing will
-- be generated if the list is empty.
--
-- --------------------------------------------------------------------------
package Bulleted_List_Style is new Image_Style
(Prefix => EOL & "- ",
Separator => EOL & "- ",
Postfix => EOL,
Prefix_If_Empty => "",
Postfix_If_Empty => "");
package Markdown_Bulleted_List_Style is new Image_Style
(Prefix => EOL & EOL & "- ",
Separator => EOL & "- ",
Postfix => EOL & EOL,
Prefix_If_Empty => EOL,
Postfix_If_Empty => "");
package HTML_Bulleted_List_Style is new Image_Style
(Prefix => "<ul>" & EOL & " <li>",
Separator => "</li>" & EOL & " <li>",
Postfix => "</li>" & EOL & "</ul>",
Prefix_If_Empty => "",
Postfix_If_Empty => "");
end List_Image.Windows_Predefined_Styles;
|
Componolit/libsparkcrypto | Ada | 2,316 | ads | -------------------------------------------------------------------------------
-- This file is part of libsparkcrypto.
--
-- @author Alexander Senier
-- @date 2019-01-21
--
-- Copyright (C) 2018 Componolit GmbH
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- * Neither the name of the nor the names of its contributors may be used
-- to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
-- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with AUnit; use AUnit;
with AUnit.Test_Cases; use AUnit.Test_Cases;
-- @summary Tests HMAC SHA-2
package LSC_Test_HMAC_SHA2 is
type Test_Case is new Test_Cases.Test_Case with null record;
procedure Register_Tests (T : in out Test_Case);
-- Register routines to be run
function Name (T : Test_Case) return Message_String;
-- Provide name identifying the test case
end LSC_Test_HMAC_SHA2;
|
reznikmm/matreshka | Ada | 3,814 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.ODF_Elements.Style.Font_Face;
package ODF.DOM.Elements.Style.Font_Face.Internals is
function Create
(Node : Matreshka.ODF_Elements.Style.Font_Face.Style_Font_Face_Access)
return ODF.DOM.Elements.Style.Font_Face.ODF_Style_Font_Face;
function Wrap
(Node : Matreshka.ODF_Elements.Style.Font_Face.Style_Font_Face_Access)
return ODF.DOM.Elements.Style.Font_Face.ODF_Style_Font_Face;
end ODF.DOM.Elements.Style.Font_Face.Internals;
|
reznikmm/matreshka | Ada | 4,656 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Table.Scenario_Ranges_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Table_Scenario_Ranges_Attribute_Node is
begin
return Self : Table_Scenario_Ranges_Attribute_Node do
Matreshka.ODF_Table.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Table_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Table_Scenario_Ranges_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Scenario_Ranges_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Table_URI,
Matreshka.ODF_String_Constants.Scenario_Ranges_Attribute,
Table_Scenario_Ranges_Attribute_Node'Tag);
end Matreshka.ODF_Table.Scenario_Ranges_Attributes;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 5,754 | ads | -- This spec has been automatically generated from STM32L0x1.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.Firewall is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Code segment start address
type FIREWALL_CSSA_Register is record
-- unspecified
Reserved_0_7 : STM32_SVD.Byte;
-- code segment start address
ADD : STM32_SVD.UInt16;
-- unspecified
Reserved_24_31 : STM32_SVD.Byte;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FIREWALL_CSSA_Register use record
Reserved_0_7 at 0 range 0 .. 7;
ADD at 0 range 8 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
-- Code segment length
type FIREWALL_CSL_Register is record
-- unspecified
Reserved_0_7 : STM32_SVD.Byte;
-- code segment length
LENG : STM32_SVD.UInt14;
-- unspecified
Reserved_22_31 : STM32_SVD.UInt10;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FIREWALL_CSL_Register use record
Reserved_0_7 at 0 range 0 .. 7;
LENG at 0 range 8 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
-- Non-volatile data segment start address
type FIREWALL_NVDSSA_Register is record
-- unspecified
Reserved_0_7 : STM32_SVD.Byte;
-- Non-volatile data segment start address
ADD : STM32_SVD.UInt16;
-- unspecified
Reserved_24_31 : STM32_SVD.Byte;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FIREWALL_NVDSSA_Register use record
Reserved_0_7 at 0 range 0 .. 7;
ADD at 0 range 8 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
-- Non-volatile data segment length
type FIREWALL_NVDSL_Register is record
-- unspecified
Reserved_0_7 : STM32_SVD.Byte;
-- Non-volatile data segment length
LENG : STM32_SVD.UInt14;
-- unspecified
Reserved_22_31 : STM32_SVD.UInt10;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FIREWALL_NVDSL_Register use record
Reserved_0_7 at 0 range 0 .. 7;
LENG at 0 range 8 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
-- Volatile data segment start address
type FIREWALL_VDSSA_Register is record
-- unspecified
Reserved_0_5 : STM32_SVD.UInt6;
-- Volatile data segment start address
ADD : STM32_SVD.UInt10;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FIREWALL_VDSSA_Register use record
Reserved_0_5 at 0 range 0 .. 5;
ADD at 0 range 6 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- Volatile data segment length
type FIREWALL_VDSL_Register is record
-- unspecified
Reserved_0_5 : STM32_SVD.UInt6;
-- Non-volatile data segment length
LENG : STM32_SVD.UInt10;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FIREWALL_VDSL_Register use record
Reserved_0_5 at 0 range 0 .. 5;
LENG at 0 range 6 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- Configuration register
type FIREWALL_CR_Register is record
-- Firewall pre alarm
FPA : STM32_SVD.Bit;
-- Volatile data shared
VDS : STM32_SVD.Bit;
-- Volatile data execution
VDE : STM32_SVD.Bit;
-- unspecified
Reserved_3_31 : STM32_SVD.UInt29;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FIREWALL_CR_Register use record
FPA at 0 range 0 .. 0;
VDS at 0 range 1 .. 1;
VDE at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Firewall
type Firewall_Peripheral is record
-- Code segment start address
FIREWALL_CSSA : aliased FIREWALL_CSSA_Register;
-- Code segment length
FIREWALL_CSL : aliased FIREWALL_CSL_Register;
-- Non-volatile data segment start address
FIREWALL_NVDSSA : aliased FIREWALL_NVDSSA_Register;
-- Non-volatile data segment length
FIREWALL_NVDSL : aliased FIREWALL_NVDSL_Register;
-- Volatile data segment start address
FIREWALL_VDSSA : aliased FIREWALL_VDSSA_Register;
-- Volatile data segment length
FIREWALL_VDSL : aliased FIREWALL_VDSL_Register;
-- Configuration register
FIREWALL_CR : aliased FIREWALL_CR_Register;
end record
with Volatile;
for Firewall_Peripheral use record
FIREWALL_CSSA at 16#0# range 0 .. 31;
FIREWALL_CSL at 16#4# range 0 .. 31;
FIREWALL_NVDSSA at 16#8# range 0 .. 31;
FIREWALL_NVDSL at 16#C# range 0 .. 31;
FIREWALL_VDSSA at 16#10# range 0 .. 31;
FIREWALL_VDSL at 16#14# range 0 .. 31;
FIREWALL_CR at 16#20# range 0 .. 31;
end record;
-- Firewall
Firewall_Periph : aliased Firewall_Peripheral
with Import, Address => Firewall_Base;
end STM32_SVD.Firewall;
|
zhmu/ananas | Ada | 2,735 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- A D A . U N C H E C K E D _ D E A L L O C A T E _ S U B P O O L --
-- --
-- B o d y --
-- --
-- Copyright (C) 2011-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Storage_Pools.Subpools,
System.Storage_Pools.Subpools.Finalization;
use System.Storage_Pools.Subpools,
System.Storage_Pools.Subpools.Finalization;
procedure Ada.Unchecked_Deallocate_Subpool
(Subpool : in out System.Storage_Pools.Subpools.Subpool_Handle)
is
begin
Finalize_And_Deallocate (Subpool);
end Ada.Unchecked_Deallocate_Subpool;
|
Componolit/libsparkcrypto | Ada | 3,309 | adb | -------------------------------------------------------------------------------
-- This file is part of libsparkcrypto.
--
-- Copyright (C) 2010, Alexander Senier
-- Copyright (C) 2010, secunet Security Networks AG
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- * Neither the name of the nor the names of its contributors may be used
-- to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
-- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with LSC.Internal.Byteswap32;
with LSC.Internal.Byteswap64;
with AUnit.Assertions; use AUnit.Assertions;
with Interfaces;
use type Interfaces.Unsigned_32;
use type Interfaces.Unsigned_64;
pragma Style_Checks ("-s");
pragma Warnings (Off, "formal parameter ""T"" is not referenced");
package body LSC_Internal_Test_Shadow
is
procedure Test_Byteswap32 (T : in out Test_Cases.Test_Case'Class)
is
begin
Assert (LSC.Internal.Byteswap32.Swap (16#aabbccdd#) = 16#ddccbbaa#, "Invalid result");
end Test_Byteswap32;
---------------------------------------------------------------------------
procedure Test_Byteswap64 (T : in out Test_Cases.Test_Case'Class)
is
begin
Assert (LSC.Internal.Byteswap64.Swap (16#aabbccddeeff0011#) = 16#1100ffeeddccbbaa#, "Invalid result");
end Test_Byteswap64;
---------------------------------------------------------------------------
procedure Register_Tests (T : in out Test_Case) is
use AUnit.Test_Cases.Registration;
begin
Register_Routine (T, Test_Byteswap32'Access, "Byte swap (32-bit)");
Register_Routine (T, Test_Byteswap64'Access, "Byte swap (64-bit)");
end Register_Tests;
---------------------------------------------------------------------------
function Name (T : Test_Case) return Test_String is
begin
return Format ("Shadow");
end Name;
end LSC_Internal_Test_Shadow;
|
reznikmm/matreshka | Ada | 4,169 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014-2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This package provides abstract block element parser to construct nestable
-- block element parsers. There are two specialized block element parsers
-- right now: paragraph and list.
------------------------------------------------------------------------------
package Wiki.Block_Parsers.Nestables is
pragma Preelaborate;
type Nestable_Block_Parser is abstract new Abstract_Block_Parser with record
Offset : Positive;
-- Offset of block to control nesting of nestable blocks.
end record;
overriding function End_Block
(Self : not null access Nestable_Block_Parser;
Next : access Abstract_Block_Parser'Class) return End_Block_Action;
-- Provides default implementation to make decision is it needed or not to
-- unwind nesting block element.
end Wiki.Block_Parsers.Nestables;
|
reznikmm/matreshka | Ada | 15,240 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Internals.UML_Packageable_Elements;
with AMF.UML.Dependencies.Collections;
with AMF.UML.Named_Elements;
with AMF.UML.Namespaces;
with AMF.UML.Packages.Collections;
with AMF.UML.Parameterable_Elements;
with AMF.UML.String_Expressions;
with AMF.UML.Template_Parameters;
with AMF.UML.Time_Expressions;
with AMF.UML.Time_Intervals;
with AMF.UML.Types;
with AMF.UML.Value_Specifications;
with AMF.Visitors;
package AMF.Internals.UML_Time_Intervals is
type UML_Time_Interval_Proxy is
limited new AMF.Internals.UML_Packageable_Elements.UML_Packageable_Element_Proxy
and AMF.UML.Time_Intervals.UML_Time_Interval with null record;
overriding function Get_Max
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.UML.Time_Expressions.UML_Time_Expression_Access;
-- Getter of TimeInterval::max.
--
-- Refers to the TimeExpression denoting the maximum value of the range.
overriding procedure Set_Max
(Self : not null access UML_Time_Interval_Proxy;
To : AMF.UML.Time_Expressions.UML_Time_Expression_Access);
-- Setter of TimeInterval::max.
--
-- Refers to the TimeExpression denoting the maximum value of the range.
overriding function Get_Min
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.UML.Time_Expressions.UML_Time_Expression_Access;
-- Getter of TimeInterval::min.
--
-- Refers to the TimeExpression denoting the minimum value of the range.
overriding procedure Set_Min
(Self : not null access UML_Time_Interval_Proxy;
To : AMF.UML.Time_Expressions.UML_Time_Expression_Access);
-- Setter of TimeInterval::min.
--
-- Refers to the TimeExpression denoting the minimum value of the range.
overriding function Get_Max
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.UML.Value_Specifications.UML_Value_Specification_Access;
-- Getter of Interval::max.
--
-- Refers to the ValueSpecification denoting the maximum value of the
-- range.
overriding procedure Set_Max
(Self : not null access UML_Time_Interval_Proxy;
To : AMF.UML.Value_Specifications.UML_Value_Specification_Access);
-- Setter of Interval::max.
--
-- Refers to the ValueSpecification denoting the maximum value of the
-- range.
overriding function Get_Min
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.UML.Value_Specifications.UML_Value_Specification_Access;
-- Getter of Interval::min.
--
-- Refers to the ValueSpecification denoting the minimum value of the
-- range.
overriding procedure Set_Min
(Self : not null access UML_Time_Interval_Proxy;
To : AMF.UML.Value_Specifications.UML_Value_Specification_Access);
-- Setter of Interval::min.
--
-- Refers to the ValueSpecification denoting the minimum value of the
-- range.
overriding function Get_Type
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.UML.Types.UML_Type_Access;
-- Getter of TypedElement::type.
--
-- The type of the TypedElement.
-- This information is derived from the return result for this Operation.
overriding procedure Set_Type
(Self : not null access UML_Time_Interval_Proxy;
To : AMF.UML.Types.UML_Type_Access);
-- Setter of TypedElement::type.
--
-- The type of the TypedElement.
-- This information is derived from the return result for this Operation.
overriding function Get_Client_Dependency
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency;
-- Getter of NamedElement::clientDependency.
--
-- Indicates the dependencies that reference the client.
overriding function Get_Name_Expression
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access;
-- Getter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding procedure Set_Name_Expression
(Self : not null access UML_Time_Interval_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access);
-- Setter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding function Get_Namespace
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Getter of NamedElement::namespace.
--
-- Specifies the namespace that owns the NamedElement.
overriding function Get_Qualified_Name
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.Optional_String;
-- Getter of NamedElement::qualifiedName.
--
-- A name which allows the NamedElement to be identified within a
-- hierarchy of nested Namespaces. It is constructed from the names of the
-- containing namespaces starting at the root of the hierarchy and ending
-- with the name of the NamedElement itself.
overriding function Get_Owning_Template_Parameter
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
-- Getter of ParameterableElement::owningTemplateParameter.
--
-- The formal template parameter that owns this element.
overriding procedure Set_Owning_Template_Parameter
(Self : not null access UML_Time_Interval_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
-- Setter of ParameterableElement::owningTemplateParameter.
--
-- The formal template parameter that owns this element.
overriding function Get_Template_Parameter
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
-- Getter of ParameterableElement::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding procedure Set_Template_Parameter
(Self : not null access UML_Time_Interval_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
-- Setter of ParameterableElement::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding function Boolean_Value
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.Optional_Boolean;
-- Operation ValueSpecification::booleanValue.
--
-- The query booleanValue() gives a single Boolean value when one can be
-- computed.
overriding function Integer_Value
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.Optional_Integer;
-- Operation ValueSpecification::integerValue.
--
-- The query integerValue() gives a single Integer value when one can be
-- computed.
overriding function Is_Compatible_With
(Self : not null access constant UML_Time_Interval_Proxy;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean;
-- Operation ValueSpecification::isCompatibleWith.
--
-- The query isCompatibleWith() determines if this parameterable element
-- is compatible with the specified parameterable element. By default
-- parameterable element P is compatible with parameterable element Q if
-- the kind of P is the same or a subtype as the kind of Q. In addition,
-- for ValueSpecification, the type must be conformant with the type of
-- the specified parameterable element.
overriding function Is_Computable
(Self : not null access constant UML_Time_Interval_Proxy)
return Boolean;
-- Operation ValueSpecification::isComputable.
--
-- The query isComputable() determines whether a value specification can
-- be computed in a model. This operation cannot be fully defined in OCL.
-- A conforming implementation is expected to deliver true for this
-- operation for all value specifications that it can compute, and to
-- compute all of those for which the operation is true. A conforming
-- implementation is expected to be able to compute the value of all
-- literals.
overriding function Is_Null
(Self : not null access constant UML_Time_Interval_Proxy)
return Boolean;
-- Operation ValueSpecification::isNull.
--
-- The query isNull() returns true when it can be computed that the value
-- is null.
overriding function Real_Value
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.Optional_Real;
-- Operation ValueSpecification::realValue.
--
-- The query realValue() gives a single Real value when one can be
-- computed.
overriding function String_Value
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.Optional_String;
-- Operation ValueSpecification::stringValue.
--
-- The query stringValue() gives a single String value when one can be
-- computed.
overriding function Unlimited_Value
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.Optional_Unlimited_Natural;
-- Operation ValueSpecification::unlimitedValue.
--
-- The query unlimitedValue() gives a single UnlimitedNatural value when
-- one can be computed.
overriding function All_Owning_Packages
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package;
-- Operation NamedElement::allOwningPackages.
--
-- The query allOwningPackages() returns all the directly or indirectly
-- owning packages.
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Time_Interval_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean;
-- Operation NamedElement::isDistinguishableFrom.
--
-- The query isDistinguishableFrom() determines whether two NamedElements
-- may logically co-exist within a Namespace. By default, two named
-- elements are distinguishable if (a) they have unrelated types or (b)
-- they have related types but different names.
overriding function Namespace
(Self : not null access constant UML_Time_Interval_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Operation NamedElement::namespace.
--
-- Missing derivation for NamedElement::/namespace : Namespace
overriding function Is_Template_Parameter
(Self : not null access constant UML_Time_Interval_Proxy)
return Boolean;
-- Operation ParameterableElement::isTemplateParameter.
--
-- The query isTemplateParameter() determines if this parameterable
-- element is exposed as a formal template parameter.
overriding procedure Enter_Element
(Self : not null access constant UML_Time_Interval_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Leave_Element
(Self : not null access constant UML_Time_Interval_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Visit_Element
(Self : not null access constant UML_Time_Interval_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of iterator interface.
end AMF.Internals.UML_Time_Intervals;
|
kraileth/ravensource | Ada | 521 | ads | --- source/spawn/spawn-posix.ads.orig 2022-09-26 13:44:48 UTC
+++ source/spawn/spawn-posix.ads
@@ -154,7 +154,7 @@ package Spawn.Posix is
(fd : Interfaces.C.int;
buf : out Interfaces.C.char_array;
buflen : Interfaces.C.size_t) return Interfaces.C.int
- with Import, Convention => C, External_Name => "ptsname_r";
+ with Import, Convention => C, External_Name => "__ptsname_r";
function setsid return Interfaces.C.int
with Import, Convention => C, External_Name => "setsid";
|
MinimSecure/unum-sdk | Ada | 897 | adb | -- Copyright 2008-2016 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo is
begin
declare
procedure Call_Me is
begin
Do_Nothing; -- STOP
end Call_Me;
begin
Call_Me;
end;
end Foo;
|
reznikmm/matreshka | Ada | 3,774 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Style_Diagonal_Bl_Tr_Widths_Attributes is
pragma Preelaborate;
type ODF_Style_Diagonal_Bl_Tr_Widths_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Style_Diagonal_Bl_Tr_Widths_Attribute_Access is
access all ODF_Style_Diagonal_Bl_Tr_Widths_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Style_Diagonal_Bl_Tr_Widths_Attributes;
|
charlie5/lace | Ada | 152 | ads | with
any_Math.any_Geometry.any_d2.any_Hexagon;
package float_math.Geometry.d2.Hexagon
is
new float_Math.Geometry.any_d2.any_Hexagon
with Pure;
|
stcarrez/ada-asf | Ada | 2,741 | adb | -----------------------------------------------------------------------
-- countries - A simple bean example
-- Copyright (C) 2012 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Models.Selects;
package body Countries is
-- ------------------------------
-- Get a select item list which contains a list of countries.
-- ------------------------------
function Create_Country_List return Util.Beans.Basic.Readonly_Bean_Access is
use ASF.Models.Selects;
Result : constant Select_Item_List_Access := new Select_Item_List;
begin
Result.Append (Label => "Andorra", Value => "AD");
Result.Append (Label => "Belgium", Value => "BE");
Result.Append (Label => "Canada", Value => "CA");
Result.Append (Label => "Denmark", Value => "DK");
Result.Append (Label => "Estonia", Value => "EE");
Result.Append (Label => "France", Value => "fr");
Result.Append (Label => "Germany", Value => "DE");
Result.Append (Label => "Hungary", Value => "HU");
Result.Append (Label => "Italy", Value => "IT");
Result.Append (Label => "Japan", Value => "JP");
Result.Append (Label => "Kosovo", Value => "XK");
Result.Append (Label => "Luxembourg", Value => "LT");
Result.Append (Label => "Martinique", Value => "MQ");
Result.Append (Label => "Netherlands", Value => "NL");
Result.Append (Label => "Oman", Value => "OM");
Result.Append (Label => "Portugal", Value => "PT");
Result.Append (Label => "Qatar", Value => "QA");
Result.Append (Label => "Russia", Value => "RU");
Result.Append (Label => "Spain", Value => "ES");
Result.Append (Label => "Taiwan", Value => "TW");
Result.Append (Label => "United States", Value => "US");
Result.Append (Label => "Vietnam", Value => "VN");
Result.Append (Label => "Western Sahara", Value => "EH");
Result.Append (Label => "Yemen", Value => "YE");
Result.Append (Label => "Zambia", Value => "ZM");
return Result.all'Access;
end Create_Country_List;
end Countries;
|
zhmu/ananas | Ada | 26,592 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . S T O R A G E _ P O O L S . S U B P O O L S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2011-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Unchecked_Conversion;
with System.Address_Image;
with System.Finalization_Masters; use System.Finalization_Masters;
with System.IO; use System.IO;
with System.Soft_Links; use System.Soft_Links;
with System.Storage_Elements; use System.Storage_Elements;
with System.Storage_Pools.Subpools.Finalization;
use System.Storage_Pools.Subpools.Finalization;
package body System.Storage_Pools.Subpools is
Finalize_Address_Table_In_Use : Boolean := False;
-- This flag should be set only when a successful allocation on a subpool
-- has been performed and the associated Finalize_Address has been added to
-- the hash table in System.Finalization_Masters.
function Address_To_FM_Node_Ptr is
new Ada.Unchecked_Conversion (Address, FM_Node_Ptr);
procedure Attach (N : not null SP_Node_Ptr; L : not null SP_Node_Ptr);
-- Attach a subpool node to a pool
-----------------------------------
-- Adjust_Controlled_Dereference --
-----------------------------------
procedure Adjust_Controlled_Dereference
(Addr : in out System.Address;
Storage_Size : in out System.Storage_Elements.Storage_Count;
Alignment : System.Storage_Elements.Storage_Count)
is
Header_And_Padding : constant Storage_Offset :=
Header_Size_With_Padding (Alignment);
begin
-- Expose the two hidden pointers by shifting the address from the
-- start of the object to the FM_Node equivalent of the pointers.
Addr := Addr - Header_And_Padding;
-- Update the size of the object to include the two pointers
Storage_Size := Storage_Size + Header_And_Padding;
end Adjust_Controlled_Dereference;
--------------
-- Allocate --
--------------
overriding procedure Allocate
(Pool : in out Root_Storage_Pool_With_Subpools;
Storage_Address : out System.Address;
Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
Alignment : System.Storage_Elements.Storage_Count)
is
begin
-- Dispatch to the user-defined implementations of Allocate_From_Subpool
-- and Default_Subpool_For_Pool.
Allocate_From_Subpool
(Root_Storage_Pool_With_Subpools'Class (Pool),
Storage_Address,
Size_In_Storage_Elements,
Alignment,
Default_Subpool_For_Pool
(Root_Storage_Pool_With_Subpools'Class (Pool)));
end Allocate;
-----------------------------
-- Allocate_Any_Controlled --
-----------------------------
procedure Allocate_Any_Controlled
(Pool : in out Root_Storage_Pool'Class;
Context_Subpool : Subpool_Handle;
Context_Master : Finalization_Masters.Finalization_Master_Ptr;
Fin_Address : Finalization_Masters.Finalize_Address_Ptr;
Addr : out System.Address;
Storage_Size : System.Storage_Elements.Storage_Count;
Alignment : System.Storage_Elements.Storage_Count;
Is_Controlled : Boolean;
On_Subpool : Boolean)
is
Is_Subpool_Allocation : constant Boolean :=
Pool in Root_Storage_Pool_With_Subpools'Class;
Master : Finalization_Master_Ptr := null;
N_Addr : Address;
N_Ptr : FM_Node_Ptr;
N_Size : Storage_Count;
Subpool : Subpool_Handle := null;
Lock_Taken : Boolean := False;
Header_And_Padding : Storage_Offset;
-- This offset includes the size of a FM_Node plus any additional
-- padding due to a larger alignment.
begin
-- Step 1: Pool-related runtime checks
-- Allocation on a pool_with_subpools. In this scenario there is a
-- master for each subpool. The master of the access type is ignored.
if Is_Subpool_Allocation then
-- Case of an allocation without a Subpool_Handle. Dispatch to the
-- implementation of Default_Subpool_For_Pool.
if Context_Subpool = null then
Subpool :=
Default_Subpool_For_Pool
(Root_Storage_Pool_With_Subpools'Class (Pool));
-- Allocation with a Subpool_Handle
else
Subpool := Context_Subpool;
end if;
-- Ensure proper ownership and chaining of the subpool
if Subpool.Owner /=
Root_Storage_Pool_With_Subpools'Class (Pool)'Unchecked_Access
or else Subpool.Node = null
or else Subpool.Node.Prev = null
or else Subpool.Node.Next = null
then
raise Program_Error with "incorrect owner of subpool";
end if;
Master := Subpool.Master'Unchecked_Access;
-- Allocation on a simple pool. In this scenario there is a master for
-- each access-to-controlled type. No context subpool should be present.
else
-- If the master is missing, then the expansion of the access type
-- failed to create one. This is a compiler bug.
pragma Assert
(Context_Master /= null, "missing master in pool allocation");
-- If a subpool is present, then this is the result of erroneous
-- allocator expansion. This is not a serious error, but it should
-- still be detected.
if Context_Subpool /= null then
raise Program_Error
with "subpool not required in pool allocation";
end if;
-- If the allocation is intended to be on a subpool, but the access
-- type's pool does not support subpools, then this is the result of
-- incorrect end-user code.
if On_Subpool then
raise Program_Error
with "pool of access type does not support subpools";
end if;
Master := Context_Master;
end if;
-- Step 2: Master, Finalize_Address-related runtime checks and size
-- calculations.
-- Allocation of a descendant from [Limited_]Controlled, a class-wide
-- object or a record with controlled components.
if Is_Controlled then
-- Synchronization:
-- Read - allocation, finalization
-- Write - finalization
Lock_Taken := True;
Lock_Task.all;
-- Do not allow the allocation of controlled objects while the
-- associated master is being finalized.
if Finalization_Started (Master.all) then
raise Program_Error with "allocation after finalization started";
end if;
-- Check whether primitive Finalize_Address is available. If it is
-- not, then either the expansion of the designated type failed or
-- the expansion of the allocator failed. This is a compiler bug.
pragma Assert
(Fin_Address /= null, "primitive Finalize_Address not available");
-- The size must account for the hidden header preceding the object.
-- Account for possible padding space before the header due to a
-- larger alignment.
Header_And_Padding := Header_Size_With_Padding (Alignment);
N_Size := Storage_Size + Header_And_Padding;
-- Non-controlled allocation
else
N_Size := Storage_Size;
end if;
-- Step 3: Allocation of object
-- For descendants of Root_Storage_Pool_With_Subpools, dispatch to the
-- implementation of Allocate_From_Subpool.
if Is_Subpool_Allocation then
Allocate_From_Subpool
(Root_Storage_Pool_With_Subpools'Class (Pool),
N_Addr, N_Size, Alignment, Subpool);
-- For descendants of Root_Storage_Pool, dispatch to the implementation
-- of Allocate.
else
Allocate (Pool, N_Addr, N_Size, Alignment);
end if;
-- Step 4: Attachment
if Is_Controlled then
-- Note that we already did "Lock_Task.all;" in Step 2 above
-- Map the allocated memory into a FM_Node record. This converts the
-- top of the allocated bits into a list header. If there is padding
-- due to larger alignment, the header is placed right next to the
-- object:
-- N_Addr N_Ptr
-- | |
-- V V
-- +-------+---------------+----------------------+
-- |Padding| Header | Object |
-- +-------+---------------+----------------------+
-- ^ ^ ^
-- | +- Header_Size -+
-- | |
-- +- Header_And_Padding --+
N_Ptr :=
Address_To_FM_Node_Ptr (N_Addr + Header_And_Padding - Header_Size);
-- Prepend the allocated object to the finalization master
-- Synchronization:
-- Write - allocation, deallocation, finalization
Attach_Unprotected (N_Ptr, Objects (Master.all));
-- Move the address from the hidden list header to the start of the
-- object. This operation effectively hides the list header.
Addr := N_Addr + Header_And_Padding;
-- Homogeneous masters service the following:
-- 1) Allocations on / Deallocations from regular pools
-- 2) Named access types
-- 3) Most cases of anonymous access types usage
-- Synchronization:
-- Read - allocation, finalization
-- Write - outside
if Master.Is_Homogeneous then
-- Synchronization:
-- Read - finalization
-- Write - allocation, outside
Set_Finalize_Address_Unprotected (Master.all, Fin_Address);
-- Heterogeneous masters service the following:
-- 1) Allocations on / Deallocations from subpools
-- 2) Certain cases of anonymous access types usage
else
-- Synchronization:
-- Read - finalization
-- Write - allocation, deallocation
Set_Heterogeneous_Finalize_Address_Unprotected (Addr, Fin_Address);
Finalize_Address_Table_In_Use := True;
end if;
Unlock_Task.all;
Lock_Taken := False;
-- Non-controlled allocation
else
Addr := N_Addr;
end if;
exception
when others =>
-- Unlock the task in case the allocation step failed and reraise the
-- exception.
if Lock_Taken then
Unlock_Task.all;
end if;
raise;
end Allocate_Any_Controlled;
------------
-- Attach --
------------
procedure Attach (N : not null SP_Node_Ptr; L : not null SP_Node_Ptr) is
begin
-- Ensure that the node has not been attached already
pragma Assert (N.Prev = null and then N.Next = null);
Lock_Task.all;
L.Next.Prev := N;
N.Next := L.Next;
L.Next := N;
N.Prev := L;
Unlock_Task.all;
-- Note: No need to unlock in case of an exception because the above
-- code can never raise one.
end Attach;
-------------------------------
-- Deallocate_Any_Controlled --
-------------------------------
procedure Deallocate_Any_Controlled
(Pool : in out Root_Storage_Pool'Class;
Addr : System.Address;
Storage_Size : System.Storage_Elements.Storage_Count;
Alignment : System.Storage_Elements.Storage_Count;
Is_Controlled : Boolean)
is
N_Addr : Address;
N_Ptr : FM_Node_Ptr;
N_Size : Storage_Count;
Header_And_Padding : Storage_Offset;
-- This offset includes the size of a FM_Node plus any additional
-- padding due to a larger alignment.
begin
-- Step 1: Detachment
if Is_Controlled then
Lock_Task.all;
begin
-- Destroy the relation pair object - Finalize_Address since it is
-- no longer needed.
if Finalize_Address_Table_In_Use then
-- Synchronization:
-- Read - finalization
-- Write - allocation, deallocation
Delete_Finalize_Address_Unprotected (Addr);
end if;
-- Account for possible padding space before the header due to a
-- larger alignment.
Header_And_Padding := Header_Size_With_Padding (Alignment);
-- N_Addr N_Ptr Addr (from input)
-- | | |
-- V V V
-- +-------+---------------+----------------------+
-- |Padding| Header | Object |
-- +-------+---------------+----------------------+
-- ^ ^ ^
-- | +- Header_Size -+
-- | |
-- +- Header_And_Padding --+
-- Convert the bits preceding the object into a list header
N_Ptr := Address_To_FM_Node_Ptr (Addr - Header_Size);
-- Detach the object from the related finalization master. This
-- action does not need to know the prior context used during
-- allocation.
-- Synchronization:
-- Write - allocation, deallocation, finalization
Detach_Unprotected (N_Ptr);
-- Move the address from the object to the beginning of the list
-- header.
N_Addr := Addr - Header_And_Padding;
-- The size of the deallocated object must include the size of the
-- hidden list header.
N_Size := Storage_Size + Header_And_Padding;
Unlock_Task.all;
exception
when others =>
-- Unlock the task in case the computations performed above
-- fail for some reason.
Unlock_Task.all;
raise;
end;
else
N_Addr := Addr;
N_Size := Storage_Size;
end if;
-- Step 2: Deallocation
-- Dispatch to the proper implementation of Deallocate. This action
-- covers both Root_Storage_Pool and Root_Storage_Pool_With_Subpools
-- implementations.
Deallocate (Pool, N_Addr, N_Size, Alignment);
end Deallocate_Any_Controlled;
------------------------------
-- Default_Subpool_For_Pool --
------------------------------
function Default_Subpool_For_Pool
(Pool : in out Root_Storage_Pool_With_Subpools)
return not null Subpool_Handle
is
pragma Unreferenced (Pool);
begin
return raise Program_Error with
"default Default_Subpool_For_Pool called; must be overridden";
end Default_Subpool_For_Pool;
------------
-- Detach --
------------
procedure Detach (N : not null SP_Node_Ptr) is
begin
-- Ensure that the node is attached to some list
pragma Assert (N.Next /= null and then N.Prev /= null);
Lock_Task.all;
N.Prev.Next := N.Next;
N.Next.Prev := N.Prev;
N.Prev := null;
N.Next := null;
Unlock_Task.all;
-- Note: No need to unlock in case of an exception because the above
-- code can never raise one.
end Detach;
--------------
-- Finalize --
--------------
overriding procedure Finalize (Controller : in out Pool_Controller) is
begin
Finalize_Pool (Controller.Enclosing_Pool.all);
end Finalize;
-------------------
-- Finalize_Pool --
-------------------
procedure Finalize_Pool (Pool : in out Root_Storage_Pool_With_Subpools) is
Curr_Ptr : SP_Node_Ptr;
Ex_Occur : Exception_Occurrence;
Raised : Boolean := False;
function Is_Empty_List (L : not null SP_Node_Ptr) return Boolean;
-- Determine whether a list contains only one element, the dummy head
-------------------
-- Is_Empty_List --
-------------------
function Is_Empty_List (L : not null SP_Node_Ptr) return Boolean is
begin
return L.Next = L and then L.Prev = L;
end Is_Empty_List;
-- Start of processing for Finalize_Pool
begin
-- It is possible for multiple tasks to cause the finalization of a
-- common pool. Allow only one task to finalize the contents.
if Pool.Finalization_Started then
return;
end if;
-- Lock the pool to prevent the creation of additional subpools while
-- the available ones are finalized. The pool remains locked because
-- either it is about to be deallocated or the associated access type
-- is about to go out of scope.
Pool.Finalization_Started := True;
while not Is_Empty_List (Pool.Subpools'Unchecked_Access) loop
Curr_Ptr := Pool.Subpools.Next;
-- Perform the following actions:
-- 1) Finalize all objects chained on the subpool's master
-- 2) Remove the subpool from the owner's list of subpools
-- 3) Deallocate the doubly linked list node associated with the
-- subpool.
-- 4) Call Deallocate_Subpool
begin
Finalize_And_Deallocate (Curr_Ptr.Subpool);
exception
when Fin_Occur : others =>
if not Raised then
Raised := True;
Save_Occurrence (Ex_Occur, Fin_Occur);
end if;
end;
end loop;
-- If the finalization of a particular master failed, reraise the
-- exception now.
if Raised then
Reraise_Occurrence (Ex_Occur);
end if;
end Finalize_Pool;
------------------------------
-- Header_Size_With_Padding --
------------------------------
function Header_Size_With_Padding
(Alignment : System.Storage_Elements.Storage_Count)
return System.Storage_Elements.Storage_Count
is
Size : constant Storage_Count := Header_Size;
begin
if Size mod Alignment = 0 then
return Size;
-- Add enough padding to reach the nearest multiple of the alignment
-- rounding up.
else
return ((Size + Alignment - 1) / Alignment) * Alignment;
end if;
end Header_Size_With_Padding;
----------------
-- Initialize --
----------------
overriding procedure Initialize (Controller : in out Pool_Controller) is
begin
Initialize_Pool (Controller.Enclosing_Pool.all);
end Initialize;
---------------------
-- Initialize_Pool --
---------------------
procedure Initialize_Pool (Pool : in out Root_Storage_Pool_With_Subpools) is
begin
-- The dummy head must point to itself in both directions
Pool.Subpools.Next := Pool.Subpools'Unchecked_Access;
Pool.Subpools.Prev := Pool.Subpools'Unchecked_Access;
end Initialize_Pool;
---------------------
-- Pool_Of_Subpool --
---------------------
function Pool_Of_Subpool
(Subpool : not null Subpool_Handle)
return access Root_Storage_Pool_With_Subpools'Class
is
begin
return Subpool.Owner;
end Pool_Of_Subpool;
----------------
-- Print_Pool --
----------------
procedure Print_Pool (Pool : Root_Storage_Pool_With_Subpools) is
Head : constant SP_Node_Ptr := Pool.Subpools'Unrestricted_Access;
Head_Seen : Boolean := False;
SP_Ptr : SP_Node_Ptr;
begin
-- Output the contents of the pool
-- Pool : 0x123456789
-- Subpools : 0x123456789
-- Fin_Start : TRUE <or> FALSE
-- Controller: OK <or> NOK
Put ("Pool : ");
Put_Line (Address_Image (Pool'Address));
Put ("Subpools : ");
Put_Line (Address_Image (Pool.Subpools'Address));
Put ("Fin_Start : ");
Put_Line (Pool.Finalization_Started'Img);
Put ("Controlled: ");
if Pool.Controller.Enclosing_Pool = Pool'Unrestricted_Access then
Put_Line ("OK");
else
Put_Line ("NOK (ERROR)");
end if;
SP_Ptr := Head;
while SP_Ptr /= null loop -- Should never be null
Put_Line ("V");
-- We see the head initially; we want to exit when we see the head a
-- second time.
if SP_Ptr = Head then
exit when Head_Seen;
Head_Seen := True;
end if;
-- The current element is null. This should never happend since the
-- list is circular.
if SP_Ptr.Prev = null then
Put_Line ("null (ERROR)");
-- The current element points back to the correct element
elsif SP_Ptr.Prev.Next = SP_Ptr then
Put_Line ("^");
-- The current element points to an erroneous element
else
Put_Line ("? (ERROR)");
end if;
-- Output the contents of the node
Put ("|Header: ");
Put (Address_Image (SP_Ptr.all'Address));
if SP_Ptr = Head then
Put_Line (" (dummy head)");
else
Put_Line ("");
end if;
Put ("| Prev: ");
if SP_Ptr.Prev = null then
Put_Line ("null");
else
Put_Line (Address_Image (SP_Ptr.Prev.all'Address));
end if;
Put ("| Next: ");
if SP_Ptr.Next = null then
Put_Line ("null");
else
Put_Line (Address_Image (SP_Ptr.Next.all'Address));
end if;
Put ("| Subp: ");
if SP_Ptr.Subpool = null then
Put_Line ("null");
else
Put_Line (Address_Image (SP_Ptr.Subpool.all'Address));
end if;
SP_Ptr := SP_Ptr.Next;
end loop;
end Print_Pool;
-------------------
-- Print_Subpool --
-------------------
procedure Print_Subpool (Subpool : Subpool_Handle) is
begin
if Subpool = null then
Put_Line ("null");
return;
end if;
-- Output the contents of a subpool
-- Owner : 0x123456789
-- Master: 0x123456789
-- Node : 0x123456789
Put ("Owner : ");
if Subpool.Owner = null then
Put_Line ("null");
else
Put_Line (Address_Image (Subpool.Owner'Address));
end if;
Put ("Master: ");
Put_Line (Address_Image (Subpool.Master'Address));
Put ("Node : ");
if Subpool.Node = null then
Put ("null");
if Subpool.Owner = null then
Put_Line (" OK");
else
Put_Line (" (ERROR)");
end if;
else
Put_Line (Address_Image (Subpool.Node'Address));
end if;
Print_Master (Subpool.Master);
end Print_Subpool;
-------------------------
-- Set_Pool_Of_Subpool --
-------------------------
procedure Set_Pool_Of_Subpool
(Subpool : not null Subpool_Handle;
To : in out Root_Storage_Pool_With_Subpools'Class)
is
N_Ptr : SP_Node_Ptr;
begin
-- If the subpool is already owned, raise Program_Error. This is a
-- direct violation of the RM rules.
if Subpool.Owner /= null then
raise Program_Error with "subpool already belongs to a pool";
end if;
-- Prevent the creation of a new subpool while the owner is being
-- finalized. This is a serious error.
if To.Finalization_Started then
raise Program_Error
with "subpool creation after finalization started";
end if;
Subpool.Owner := To'Unchecked_Access;
-- Create a subpool node and decorate it. Since this node is not
-- allocated on the owner's pool, it must be explicitly destroyed by
-- Finalize_And_Detach.
N_Ptr := new SP_Node;
N_Ptr.Subpool := Subpool;
Subpool.Node := N_Ptr;
Attach (N_Ptr, To.Subpools'Unchecked_Access);
-- Mark the subpool's master as being a heterogeneous collection of
-- controlled objects.
Set_Is_Heterogeneous (Subpool.Master);
end Set_Pool_Of_Subpool;
end System.Storage_Pools.Subpools;
|
DavJo-dotdotdot/Ada_Drivers_Library | Ada | 20,878 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2016-2020, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with HAL; use HAL;
with nRF.GPIO; use nRF.GPIO;
with nRF.Device; use nRF.Device;
with Ada.Real_Time; use Ada.Real_Time;
with Generic_Timers;
package body MicroBit.DisplayRT is
type Animation_Mode is (None, Scroll_Text);
Animation_Step_Duration_Ms : Natural := 200;
-- How many milliseconds between two animation steps
Animation_Elapsed : Natural := 0;
-- How many milliseconds since the last animation step
Animation_State : Animation_Mode := None;
-- Current animation
subtype Width is Natural range
Coord'First .. Coord'First + Coord'Range_Length * 2;
Bitmap : array (Width, Coord) of Boolean := (others => (others => False));
-- The bitmap width is 2 time the display size so we can instert hidden
-- characters to the right of the screen and scroll them in with the
-- Shift_Left procedure.
Current_X, Current_Y : Coord := 0;
-- Current coordinate in LED matrix scan
----------------------
-- Pixel to IO Pins --
----------------------
subtype Row_Range is Natural range 1 .. 5;
subtype Column_Range is Natural range 1 .. 5;
type LED_Point is record
Row_Id : Row_Range;
Column_Id : Column_Range;
end record;
Row_Points : array (Row_Range) of GPIO_Point :=
(P21, P22, P15, P24, P19);
Column_Points : array (Column_Range) of GPIO_Point :=
(P28, P11, P31, P37, P30);
Map : constant array (Coord, Coord) of LED_Point :=
(((1, 1), (2, 1), (3, 1), (4, 1), (5, 1)),
((1, 2), (2, 2), (3, 2), (4, 2), (5, 2)),
((1, 3), (2, 3), (3, 3), (4, 3), (5, 3)),
((1, 4), (2, 4), (3, 4), (4, 4), (5, 4)),
((1, 5), (2, 5), (3, 5), (4, 5), (5, 5))
);
--------------------
-- Text scrolling --
--------------------
Scroll_Text_Buffer : String (1 .. Scroll_Text_Max_Length) :=
(others => ASCII.NUL);
-- Buffer to stored the scroll text
Scroll_Text_Length : Natural := 0;
-- Length of the text stored in the Scroll_Text_Buffer
Scroll_Text_Index : Natural := 0;
-- Index of the character to display next
Scroll_Position : Natural := 0;
-- Scroll position in the screen
----------
-- Font --
----------
type Glyph is array (0 .. 4) of UInt5;
Font : constant array (0 .. 93) of Glyph :=
((2#00100#, -- !
2#00100#,
2#00100#,
2#00000#,
2#00100#),
(2#01010#, -- "
2#01010#,
2#00000#,
2#00000#,
2#00000#),
(2#01010#, -- #
2#11111#,
2#01010#,
2#11111#,
2#01010#),
(2#11110#, -- $
2#00101#,
2#01110#,
2#00100#,
2#01111#),
(2#10001#, -- %
2#01000#,
2#00100#,
2#00010#,
2#10001#),
(2#00100#, -- &
2#01010#,
2#00100#,
2#01010#,
2#10100#),
(2#01000#, -- '
2#00100#,
2#00000#,
2#00000#,
2#00000#),
(2#01000#, -- (
2#00100#,
2#00100#,
2#00100#,
2#01000#),
(2#00010#, -- )
2#00100#,
2#00100#,
2#00100#,
2#00010#),
(2#00000#, -- *
2#00100#,
2#01010#,
2#00100#,
2#00000#),
(2#00000#, -- +
2#00100#,
2#01110#,
2#00100#,
2#00000#),
(2#00000#, -- ,
2#00000#,
2#00000#,
2#00100#,
2#00010#),
(2#00000#, -- -
2#00000#,
2#01110#,
2#00000#,
2#00000#),
(2#00000#, -- .
2#00000#,
2#00000#,
2#00000#,
2#00010#),
(2#10000#, -- /
2#01000#,
2#00100#,
2#00010#,
2#00001#),
(2#01110#, -- 0
2#10001#,
2#10001#,
2#10001#,
2#01110#),
(2#00100#, -- 1
2#00110#,
2#00100#,
2#00100#,
2#00100#),
(2#01110#, -- 2
2#10001#,
2#01000#,
2#00100#,
2#11111#),
(2#01111#, -- 3
2#10000#,
2#01111#,
2#10000#,
2#01111#),
(2#01000#, -- 4
2#01010#,
2#01001#,
2#11111#,
2#01000#),
(2#11111#, -- 5
2#00001#,
2#01111#,
2#10000#,
2#01111#),
(2#01110#, -- 6
2#00001#,
2#00111#,
2#01001#,
2#01110#),
(2#01110#, -- 7
2#01000#,
2#00100#,
2#00100#,
2#00100#),
(2#01110#, -- 8
2#10001#,
2#01110#,
2#10001#,
2#01110#),
(2#01110#, -- 9
2#10001#,
2#11110#,
2#10000#,
2#01110#),
(2#00000#, -- :
2#00100#,
2#00000#,
2#00100#,
2#00000#),
(2#00000#, -- ;
2#00100#,
2#00000#,
2#00100#,
2#00010#),
(2#00000#, -- <
2#00100#,
2#00010#,
2#00100#,
2#00000#),
(2#00000#, -- =
2#01110#,
2#00000#,
2#01110#,
2#00000#),
(2#00000#, -- >
2#00100#,
2#01000#,
2#00100#,
2#00000#),
(2#00100#, -- ?
2#01000#,
2#00100#,
2#00000#,
2#00100#),
(2#01110#, -- @
2#10001#,
2#10101#,
2#10001#,
2#00110#),
(2#01110#, -- A
2#10001#,
2#11111#,
2#10001#,
2#10001#),
(2#01111#, -- B
2#10001#,
2#01111#,
2#10001#,
2#01111#),
(2#11110#, -- C
2#00001#,
2#00001#,
2#00001#,
2#11110#),
(2#01111#, -- D
2#10001#,
2#10001#,
2#10001#,
2#01111#),
(2#11111#, -- E
2#00001#,
2#00111#,
2#00001#,
2#11111#),
(2#11111#, -- F
2#00001#,
2#00111#,
2#00001#,
2#00001#),
(2#11110#, -- G
2#00001#,
2#11101#,
2#10001#,
2#01110#),
(2#10001#, -- H
2#10001#,
2#11111#,
2#10001#,
2#10001#),
(2#00100#, -- I
2#00100#,
2#00100#,
2#00100#,
2#00100#),
(2#10000#, -- J
2#10000#,
2#10000#,
2#10001#,
2#01110#),
(2#01001#, -- K
2#00101#,
2#00011#,
2#00101#,
2#01001#),
(2#00001#, -- L
2#00001#,
2#00001#,
2#00001#,
2#11111#),
(2#10001#, -- M
2#11011#,
2#10101#,
2#10001#,
2#10001#),
(2#10001#, -- N
2#10011#,
2#10101#,
2#11001#,
2#10001#),
(2#01110#, -- O
2#10001#,
2#10001#,
2#10001#,
2#01110#),
(2#01111#, -- P
2#10001#,
2#01111#,
2#00001#,
2#00001#),
(2#01110#, -- Q
2#10001#,
2#10001#,
2#11001#,
2#11110#),
(2#01111#, -- R
2#10001#,
2#01111#,
2#01001#,
2#10001#),
(2#11110#, -- S
2#00001#,
2#01110#,
2#10000#,
2#01111#),
(2#11111#, -- T
2#00100#,
2#00100#,
2#00100#,
2#00100#),
(2#10001#, -- U
2#10001#,
2#10001#,
2#10001#,
2#01110#),
(2#10001#, -- V
2#10001#,
2#01010#,
2#01010#,
2#00100#),
(2#10101#, -- W
2#10101#,
2#10101#,
2#01010#,
2#01010#),
(2#10001#, -- X
2#01010#,
2#00100#,
2#01010#,
2#10001#),
(2#10001#, -- Y
2#01010#,
2#00100#,
2#00100#,
2#00100#),
(2#11111#, -- Z
2#01000#,
2#00100#,
2#00010#,
2#11111#),
(2#01110#, -- [
2#00010#,
2#00010#,
2#00010#,
2#01110#),
(2#00001#, -- \
2#00010#,
2#00100#,
2#01000#,
2#10000#),
(2#01110#, -- ]
2#01000#,
2#01000#,
2#01000#,
2#01110#),
(2#00100#, -- ^
2#01010#,
2#10001#,
2#00000#,
2#00000#),
(2#00000#, -- _
2#00000#,
2#00000#,
2#00000#,
2#11111#),
(2#00010#, -- `
2#00100#,
2#00000#,
2#00000#,
2#00000#),
(2#01111#, -- a
2#10000#,
2#11110#,
2#10001#,
2#11110#),
(2#00001#, -- b
2#01111#,
2#10001#,
2#10001#,
2#01111#),
(2#01110#, -- c
2#10001#,
2#00001#,
2#10001#,
2#01110#),
(2#10000#, -- d
2#11110#,
2#10001#,
2#10001#,
2#11110#),
(2#01110#, -- e
2#10001#,
2#11111#,
2#00001#,
2#11110#),
(2#11110#, -- f
2#00001#,
2#00111#,
2#00001#,
2#00001#),
(2#01110#, -- g
2#10001#,
2#11110#,
2#10000#,
2#01111#),
(2#00001#, -- h
2#01111#,
2#10001#,
2#10001#,
2#10001#),
(2#00100#, -- i
2#00000#,
2#00100#,
2#00100#,
2#00100#),
(2#10000#, -- j
2#10000#,
2#10000#,
2#10000#,
2#01111#),
(2#10001#, -- k
2#01001#,
2#00111#,
2#01001#,
2#10001#),
(2#00001#, -- l
2#00001#,
2#00001#,
2#00001#,
2#11110#),
(2#01010#, -- m
2#10101#,
2#10101#,
2#10101#,
2#10101#),
(2#01111#, -- n
2#10001#,
2#10001#,
2#10001#,
2#10001#),
(2#01110#, -- o
2#10001#,
2#10001#,
2#10001#,
2#01110#),
(2#01111#, -- p
2#10001#,
2#10001#,
2#01111#,
2#00001#),
(2#11110#, -- q
2#10001#,
2#10001#,
2#11110#,
2#10000#),
(2#01101#, -- r
2#10011#,
2#00001#,
2#00001#,
2#00001#),
(2#11110#, -- s
2#00001#,
2#01110#,
2#10000#,
2#01111#),
(2#00001#, -- t
2#00111#,
2#00001#,
2#10001#,
2#01110#),
(2#10001#, -- u
2#10001#,
2#10001#,
2#11001#,
2#10110#),
(2#10001#, -- v
2#10001#,
2#01010#,
2#01010#,
2#00100#),
(2#10101#, -- w
2#10101#,
2#10101#,
2#10101#,
2#01010#),
(2#10001#, -- x
2#10001#,
2#01110#,
2#10001#,
2#10001#),
(2#10001#, -- y
2#10001#,
2#11110#,
2#10000#,
2#01111#),
(2#11111#, -- z
2#01000#,
2#00100#,
2#00010#,
2#11111#),
(2#00100#, -- {
2#00100#,
2#00010#,
2#00100#,
2#00100#),
(2#00100#, -- |
2#00100#,
2#00100#,
2#00100#,
2#00100#),
(2#00100#, -- }
2#00100#,
2#01000#,
2#00100#,
2#00100#),
(2#00000#, -- ~
2#00000#,
2#01010#,
2#10101#,
2#00000#)
);
procedure Print_C (X_Org : Width;
C : Character);
procedure Initialize;
procedure Update_Animation;
procedure Put_Char (X_Org : Width;
C : Character);
-- Print a charater to the bitmap buffer
procedure Scroll_Character (Char : Character);
procedure Display_Update;
-- Callback for the LED matrix scan
package Display_Update_Timer is new Generic_Timers
(One_Shot => False,
Timer_Name => "Display update",
Period => Ada.Real_Time.Microseconds (900),
Action => Display_Update);
-- This timing event will call the procedure Display_Update every
-- 900 microseconds.
--------------------
-- Display_Update --
--------------------
procedure Display_Update is
begin
-- Turn Off
-- Row source current
Row_Points (Map (Current_X, Current_Y).Row_Id).Clear;
-- Column sink current
Column_Points (Map (Current_X, Current_Y).Column_Id).Set;
if Current_X = Coord'Last then
Current_X := Coord'First;
if Current_Y = Coord'Last then
Current_Y := Coord'First;
else
Current_Y := Current_Y + 1;
end if;
else
Current_X := Current_X + 1;
end if;
-- Turn on?
if Bitmap (Current_X, Current_Y) then
-- Row source current
Row_Points (Map (Current_X, Current_Y).Row_Id).Set;
-- Column sink current
Column_Points (Map (Current_X, Current_Y).Column_Id).Clear;
end if;
-- Animation
if Animation_Elapsed = Animation_Step_Duration_Ms then
Animation_Elapsed := 0;
Update_Animation;
else
Animation_Elapsed := Animation_Elapsed + 1;
end if;
end Display_Update;
-------------
-- Print_C --
-------------
procedure Print_C (X_Org : Width;
C : Character)
is
C_Index : constant Integer := Character'Pos (C) - Character'Pos ('!');
begin
if C_Index not in Font'Range then
return;
end if;
for X in Coord loop
for Y in Coord loop
if X_Org + X in Width then
if (Font (C_Index) (Y) and 2**X) /= 0 then
Bitmap (X_Org + X, Y) := True;
end if;
end if;
end loop;
end loop;
end Print_C;
----------------
-- Initialize --
----------------
procedure Initialize is
Conf : GPIO_Configuration;
begin
Conf.Mode := Mode_Out;
Conf.Resistors := Pull_Up;
for Point of Row_Points loop
Point.Configure_IO (Conf);
Point.Clear;
end loop;
for Point of Column_Points loop
Point.Configure_IO (Conf);
Point.Set;
end loop;
-- Start the LED scan timer
Display_Update_Timer.Start;
end Initialize;
----------------------
-- Update_Animation --
----------------------
procedure Update_Animation is
begin
case Animation_State is
when None =>
null;
when Scroll_Text =>
Shift_Left;
Scroll_Position := Scroll_Position + 1;
if Scroll_Position >= Coord'Range_Length + 1 then
-- We finished scrolling the current character
Scroll_Position := 0;
if Scroll_Text_Index > Scroll_Text_Length + 1 then
Animation_State := None;
elsif Scroll_Text_Index = Scroll_Text_Length + 1 then
null; -- Leave the screen empty until the character is flushed
else
-- Print new char
Print_C (5, Scroll_Text_Buffer (Scroll_Text_Index));
end if;
Scroll_Text_Index := Scroll_Text_Index + 1;
end if;
end case;
end Update_Animation;
---------
-- Set --
---------
procedure Set (X, Y : Coord) is
begin
Bitmap (X, Y) := True;
end Set;
-----------
-- Clear --
-----------
procedure Clear (X, Y : Coord) is
begin
Bitmap (X, Y) := False;
end Clear;
-----------
-- Clear --
-----------
procedure Clear is
begin
Bitmap := (others => (others => False));
end Clear;
-------------
-- Display --
-------------
procedure Display (C : Character) is
begin
Print_C (0, C);
end Display;
-------------
-- Display --
-------------
procedure Display (Str : String) is
begin
Display_Async (Str);
while Animation_State /= None loop
delay until Ada.Real_Time.Clock + Ada.Real_Time.Milliseconds (Animation_Step_Duration_Ms);
end loop;
end Display;
-------------------
-- Display_Async --
-------------------
procedure Display_Async (Str : String) is
begin
Scroll_Text_Buffer (Scroll_Text_Buffer'First .. Scroll_Text_Buffer'First + Str'Length - 1) := Str;
Animation_State := Scroll_Text;
Scroll_Text_Length := Str'Length;
Scroll_Text_Index := Scroll_Text_Buffer'First;
Scroll_Position := Coord'Last + 1;
end Display_Async;
----------------
-- Shift_Left --
----------------
procedure Shift_Left is
begin
-- Shift pixel columns to the left, erasing the left most one
for X in Bitmap'First (1) .. Bitmap'Last (1) - 1 loop
for Y in Bitmap'Range (2) loop
Bitmap (X, Y) := Bitmap (X + 1, Y);
end loop;
end loop;
-- Insert black pixels to the right most column
for Y in Bitmap'Range (2) loop
Bitmap (Bitmap'Last (1), Y) := False;
end loop;
end Shift_Left;
---------------------------------
-- Set_Animation_Step_Duration --
---------------------------------
procedure Set_Animation_Step_Duration (Ms : Natural) is
begin
Animation_Step_Duration_Ms := Ms;
end Set_Animation_Step_Duration;
---------------------------
-- Animation_In_Progress --
---------------------------
function Animation_In_Progress return Boolean
is (Animation_State /= None);
--------------
-- Put_Char --
--------------
procedure Put_Char (X_Org : Width;
C : Character)
is
C_Index : constant Integer := Character'Pos (C) - Character'Pos ('!');
begin
if C_Index not in Font'Range then
-- C is not a printable character
return;
end if;
-- Copy the glyph into the bitmap buffer
for X in Coord loop
for Y in Coord loop
if X_Org + X in Width then
if (Font (C_Index) (Y) and 2**X) /= 0 then
Bitmap (X_Org + X, Y) := True;
end if;
end if;
end loop;
end loop;
end Put_Char;
----------------------
-- Scroll_Character --
----------------------
procedure Scroll_Character (Char : Character) is
begin
-- Insert glyph in the hidden part of the buffer
Put_Char (5, Char);
-- Shift the buffer 6 times with a 150 milliseconds delay between each
-- shifts.
for Shifts in 1 .. 6 loop
Shift_Left;
delay until Ada.Real_Time.Clock + Ada.Real_Time.Milliseconds (150);
end loop;
end Scroll_Character;
-----------------
-- Scroll_Text --
-----------------
procedure Scroll_Text (Str : String) is
begin
-- Scroll each character of the string
for Char of Str loop
Scroll_Character (Char);
end loop;
end Scroll_Text;
begin
Initialize;
end MicroBit.DisplayRT;
|
reznikmm/matreshka | Ada | 3,684 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Meta_User_Defined_Elements is
pragma Preelaborate;
type ODF_Meta_User_Defined is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Meta_User_Defined_Access is
access all ODF_Meta_User_Defined'Class
with Storage_Size => 0;
end ODF.DOM.Meta_User_Defined_Elements;
|
reznikmm/matreshka | Ada | 1,677 | ads | with League.Calendars;
package Zip.IO_Types is
type Unsigned_16 is mod 2 ** 16
with Read => Read, Write => Write;
procedure Read
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : out Unsigned_16);
procedure Write
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : Unsigned_16);
type Method is new Compression_Method
with Read => Read, Write => Write, Size => Unsigned_16'Size;
for Method use (None => 0, Deflate => 8);
procedure Read
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : out Method);
procedure Write
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : Method);
type Date_Time is new League.Calendars.Date_Time
with Read => Read, Write => Write;
procedure Read
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : out Date_Time);
procedure Write
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : Date_Time);
type Unsigned_32 is mod 2 ** 32
with Read => Read, Write => Write;
procedure Read
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : out Unsigned_32);
procedure Write
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : Unsigned_32);
type Version is new Unsigned_16;
type Flags is new Unsigned_16;
type Length is new Unsigned_16;
type CRC32 is new Unsigned_32;
type Size is new Unsigned_32;
Has_Data_Descriptor : constant Flags := 16#008#;
Use_UTF_8_Names : constant Flags := 16#800#;
end Zip.IO_Types;
|
MinimSecure/unum-sdk | Ada | 909 | adb | -- Copyright 2015-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with System;
with Pack;
procedure Foo is
NT : Pack.Table_Type renames Pack.Table;
NTP : Pack.Table_Ptr_Type renames Pack.Table_Ptr;
begin
NT := NT; -- BREAK
NTP := NTP;
end Foo;
|
tum-ei-rcs/StratoX | Ada | 105,840 | ads | -- This spec has been automatically generated from STM32F427x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
with System;
with HAL;
package STM32_SVD.USB_OTG_HS is
pragma Preelaborate;
---------------
-- Registers --
---------------
-----------------------------
-- OTG_HS_GOTGCTL_Register --
-----------------------------
-- OTG_HS control and status register
type OTG_HS_GOTGCTL_Register is record
-- Read-only. Session request success
SRQSCS : Boolean := False;
-- Session request
SRQ : Boolean := False;
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
-- Read-only. Host negotiation success
HNGSCS : Boolean := False;
-- HNP request
HNPRQ : Boolean := False;
-- Host set HNP enable
HSHNPEN : Boolean := False;
-- Device HNP enabled
DHNPEN : Boolean := True;
-- unspecified
Reserved_12_15 : HAL.UInt4 := 16#0#;
-- Read-only. Connector ID status
CIDSTS : Boolean := False;
-- Read-only. Long/short debounce time
DBCT : Boolean := False;
-- Read-only. A-session valid
ASVLD : Boolean := False;
-- Read-only. B-session valid
BSVLD : Boolean := False;
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_GOTGCTL_Register use record
SRQSCS at 0 range 0 .. 0;
SRQ at 0 range 1 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
HNGSCS at 0 range 8 .. 8;
HNPRQ at 0 range 9 .. 9;
HSHNPEN at 0 range 10 .. 10;
DHNPEN at 0 range 11 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
CIDSTS at 0 range 16 .. 16;
DBCT at 0 range 17 .. 17;
ASVLD at 0 range 18 .. 18;
BSVLD at 0 range 19 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-----------------------------
-- OTG_HS_GOTGINT_Register --
-----------------------------
-- OTG_HS interrupt register
type OTG_HS_GOTGINT_Register is record
-- unspecified
Reserved_0_1 : HAL.UInt2 := 16#0#;
-- Session end detected
SEDET : Boolean := False;
-- unspecified
Reserved_3_7 : HAL.UInt5 := 16#0#;
-- Session request success status change
SRSSCHG : Boolean := False;
-- Host negotiation success status change
HNSSCHG : Boolean := False;
-- unspecified
Reserved_10_16 : HAL.UInt7 := 16#0#;
-- Host negotiation detected
HNGDET : Boolean := False;
-- A-device timeout change
ADTOCHG : Boolean := False;
-- Debounce done
DBCDNE : Boolean := False;
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_GOTGINT_Register use record
Reserved_0_1 at 0 range 0 .. 1;
SEDET at 0 range 2 .. 2;
Reserved_3_7 at 0 range 3 .. 7;
SRSSCHG at 0 range 8 .. 8;
HNSSCHG at 0 range 9 .. 9;
Reserved_10_16 at 0 range 10 .. 16;
HNGDET at 0 range 17 .. 17;
ADTOCHG at 0 range 18 .. 18;
DBCDNE at 0 range 19 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-----------------------------
-- OTG_HS_GAHBCFG_Register --
-----------------------------
subtype OTG_HS_GAHBCFG_HBSTLEN_Field is HAL.UInt4;
-- OTG_HS AHB configuration register
type OTG_HS_GAHBCFG_Register is record
-- Global interrupt mask
GINT : Boolean := False;
-- Burst length/type
HBSTLEN : OTG_HS_GAHBCFG_HBSTLEN_Field := 16#0#;
-- DMA enable
DMAEN : Boolean := False;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
-- TxFIFO empty level
TXFELVL : Boolean := False;
-- Periodic TxFIFO empty level
PTXFELVL : Boolean := False;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_GAHBCFG_Register use record
GINT at 0 range 0 .. 0;
HBSTLEN at 0 range 1 .. 4;
DMAEN at 0 range 5 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
TXFELVL at 0 range 7 .. 7;
PTXFELVL at 0 range 8 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
-----------------------------
-- OTG_HS_GUSBCFG_Register --
-----------------------------
subtype OTG_HS_GUSBCFG_TOCAL_Field is HAL.UInt3;
subtype OTG_HS_GUSBCFG_TRDT_Field is HAL.UInt4;
-- OTG_HS USB configuration register
type OTG_HS_GUSBCFG_Register is record
-- FS timeout calibration
TOCAL : OTG_HS_GUSBCFG_TOCAL_Field := 16#0#;
-- unspecified
Reserved_3_5 : HAL.UInt3 := 16#0#;
-- Write-only. USB 2.0 high-speed ULPI PHY or USB 1.1 full-speed serial
-- transceiver select
PHYSEL : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- SRP-capable
SRPCAP : Boolean := False;
-- HNP-capable
HNPCAP : Boolean := True;
-- USB turnaround time
TRDT : OTG_HS_GUSBCFG_TRDT_Field := 16#2#;
-- unspecified
Reserved_14_14 : HAL.Bit := 16#0#;
-- PHY Low-power clock select
PHYLPCS : Boolean := False;
-- unspecified
Reserved_16_16 : HAL.Bit := 16#0#;
-- ULPI FS/LS select
ULPIFSLS : Boolean := False;
-- ULPI Auto-resume
ULPIAR : Boolean := False;
-- ULPI Clock SuspendM
ULPICSM : Boolean := False;
-- ULPI External VBUS Drive
ULPIEVBUSD : Boolean := False;
-- ULPI external VBUS indicator
ULPIEVBUSI : Boolean := False;
-- TermSel DLine pulsing selection
TSDPS : Boolean := False;
-- Indicator complement
PCCI : Boolean := False;
-- Indicator pass through
PTCI : Boolean := False;
-- ULPI interface protect disable
ULPIIPD : Boolean := False;
-- unspecified
Reserved_26_28 : HAL.UInt3 := 16#0#;
-- Forced host mode
FHMOD : Boolean := False;
-- Forced peripheral mode
FDMOD : Boolean := False;
-- Corrupt Tx packet
CTXPKT : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_GUSBCFG_Register use record
TOCAL at 0 range 0 .. 2;
Reserved_3_5 at 0 range 3 .. 5;
PHYSEL at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
SRPCAP at 0 range 8 .. 8;
HNPCAP at 0 range 9 .. 9;
TRDT at 0 range 10 .. 13;
Reserved_14_14 at 0 range 14 .. 14;
PHYLPCS at 0 range 15 .. 15;
Reserved_16_16 at 0 range 16 .. 16;
ULPIFSLS at 0 range 17 .. 17;
ULPIAR at 0 range 18 .. 18;
ULPICSM at 0 range 19 .. 19;
ULPIEVBUSD at 0 range 20 .. 20;
ULPIEVBUSI at 0 range 21 .. 21;
TSDPS at 0 range 22 .. 22;
PCCI at 0 range 23 .. 23;
PTCI at 0 range 24 .. 24;
ULPIIPD at 0 range 25 .. 25;
Reserved_26_28 at 0 range 26 .. 28;
FHMOD at 0 range 29 .. 29;
FDMOD at 0 range 30 .. 30;
CTXPKT at 0 range 31 .. 31;
end record;
-----------------------------
-- OTG_HS_GRSTCTL_Register --
-----------------------------
subtype OTG_HS_GRSTCTL_TXFNUM_Field is HAL.UInt5;
-- OTG_HS reset register
type OTG_HS_GRSTCTL_Register is record
-- Core soft reset
CSRST : Boolean := False;
-- HCLK soft reset
HSRST : Boolean := False;
-- Host frame counter reset
FCRST : Boolean := False;
-- unspecified
Reserved_3_3 : HAL.Bit := 16#0#;
-- RxFIFO flush
RXFFLSH : Boolean := False;
-- TxFIFO flush
TXFFLSH : Boolean := False;
-- TxFIFO number
TXFNUM : OTG_HS_GRSTCTL_TXFNUM_Field := 16#0#;
-- unspecified
Reserved_11_29 : HAL.UInt19 := 16#40000#;
-- Read-only. DMA request signal
DMAREQ : Boolean := False;
-- Read-only. AHB master idle
AHBIDL : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_GRSTCTL_Register use record
CSRST at 0 range 0 .. 0;
HSRST at 0 range 1 .. 1;
FCRST at 0 range 2 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
RXFFLSH at 0 range 4 .. 4;
TXFFLSH at 0 range 5 .. 5;
TXFNUM at 0 range 6 .. 10;
Reserved_11_29 at 0 range 11 .. 29;
DMAREQ at 0 range 30 .. 30;
AHBIDL at 0 range 31 .. 31;
end record;
-----------------------------
-- OTG_HS_GINTSTS_Register --
-----------------------------
-- OTG_HS core interrupt register
type OTG_HS_GINTSTS_Register is record
-- Read-only. Current mode of operation
CMOD : Boolean := False;
-- Mode mismatch interrupt
MMIS : Boolean := False;
-- Read-only. OTG interrupt
OTGINT : Boolean := False;
-- Start of frame
SOF : Boolean := False;
-- Read-only. RxFIFO nonempty
RXFLVL : Boolean := False;
-- Read-only. Nonperiodic TxFIFO empty
NPTXFE : Boolean := True;
-- Read-only. Global IN nonperiodic NAK effective
GINAKEFF : Boolean := False;
-- Read-only. Global OUT NAK effective
BOUTNAKEFF : Boolean := False;
-- unspecified
Reserved_8_9 : HAL.UInt2 := 16#0#;
-- Early suspend
ESUSP : Boolean := False;
-- USB suspend
USBSUSP : Boolean := False;
-- USB reset
USBRST : Boolean := False;
-- Enumeration done
ENUMDNE : Boolean := False;
-- Isochronous OUT packet dropped interrupt
ISOODRP : Boolean := False;
-- End of periodic frame interrupt
EOPF : Boolean := False;
-- unspecified
Reserved_16_17 : HAL.UInt2 := 16#0#;
-- Read-only. IN endpoint interrupt
IEPINT : Boolean := False;
-- Read-only. OUT endpoint interrupt
OEPINT : Boolean := False;
-- Incomplete isochronous IN transfer
IISOIXFR : Boolean := False;
-- Incomplete periodic transfer
PXFR_INCOMPISOOUT : Boolean := False;
-- Data fetch suspended
DATAFSUSP : Boolean := False;
-- unspecified
Reserved_23_23 : HAL.Bit := 16#0#;
-- Read-only. Host port interrupt
HPRTINT : Boolean := False;
-- Read-only. Host channels interrupt
HCINT : Boolean := False;
-- Read-only. Periodic TxFIFO empty
PTXFE : Boolean := True;
-- unspecified
Reserved_27_27 : HAL.Bit := 16#0#;
-- Connector ID status change
CIDSCHG : Boolean := False;
-- Disconnect detected interrupt
DISCINT : Boolean := False;
-- Session request/new session detected interrupt
SRQINT : Boolean := False;
-- Resume/remote wakeup detected interrupt
WKUINT : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_GINTSTS_Register use record
CMOD at 0 range 0 .. 0;
MMIS at 0 range 1 .. 1;
OTGINT at 0 range 2 .. 2;
SOF at 0 range 3 .. 3;
RXFLVL at 0 range 4 .. 4;
NPTXFE at 0 range 5 .. 5;
GINAKEFF at 0 range 6 .. 6;
BOUTNAKEFF at 0 range 7 .. 7;
Reserved_8_9 at 0 range 8 .. 9;
ESUSP at 0 range 10 .. 10;
USBSUSP at 0 range 11 .. 11;
USBRST at 0 range 12 .. 12;
ENUMDNE at 0 range 13 .. 13;
ISOODRP at 0 range 14 .. 14;
EOPF at 0 range 15 .. 15;
Reserved_16_17 at 0 range 16 .. 17;
IEPINT at 0 range 18 .. 18;
OEPINT at 0 range 19 .. 19;
IISOIXFR at 0 range 20 .. 20;
PXFR_INCOMPISOOUT at 0 range 21 .. 21;
DATAFSUSP at 0 range 22 .. 22;
Reserved_23_23 at 0 range 23 .. 23;
HPRTINT at 0 range 24 .. 24;
HCINT at 0 range 25 .. 25;
PTXFE at 0 range 26 .. 26;
Reserved_27_27 at 0 range 27 .. 27;
CIDSCHG at 0 range 28 .. 28;
DISCINT at 0 range 29 .. 29;
SRQINT at 0 range 30 .. 30;
WKUINT at 0 range 31 .. 31;
end record;
-----------------------------
-- OTG_HS_GINTMSK_Register --
-----------------------------
-- OTG_HS interrupt mask register
type OTG_HS_GINTMSK_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- Mode mismatch interrupt mask
MMISM : Boolean := False;
-- OTG interrupt mask
OTGINT : Boolean := False;
-- Start of frame mask
SOFM : Boolean := False;
-- Receive FIFO nonempty mask
RXFLVLM : Boolean := False;
-- Nonperiodic TxFIFO empty mask
NPTXFEM : Boolean := False;
-- Global nonperiodic IN NAK effective mask
GINAKEFFM : Boolean := False;
-- Global OUT NAK effective mask
GONAKEFFM : Boolean := False;
-- unspecified
Reserved_8_9 : HAL.UInt2 := 16#0#;
-- Early suspend mask
ESUSPM : Boolean := False;
-- USB suspend mask
USBSUSPM : Boolean := False;
-- USB reset mask
USBRST : Boolean := False;
-- Enumeration done mask
ENUMDNEM : Boolean := False;
-- Isochronous OUT packet dropped interrupt mask
ISOODRPM : Boolean := False;
-- End of periodic frame interrupt mask
EOPFM : Boolean := False;
-- unspecified
Reserved_16_16 : HAL.Bit := 16#0#;
-- Endpoint mismatch interrupt mask
EPMISM : Boolean := False;
-- IN endpoints interrupt mask
IEPINT : Boolean := False;
-- OUT endpoints interrupt mask
OEPINT : Boolean := False;
-- Incomplete isochronous IN transfer mask
IISOIXFRM : Boolean := False;
-- Incomplete periodic transfer mask
PXFRM_IISOOXFRM : Boolean := False;
-- Data fetch suspended mask
FSUSPM : Boolean := False;
-- unspecified
Reserved_23_23 : HAL.Bit := 16#0#;
-- Read-only. Host port interrupt mask
PRTIM : Boolean := False;
-- Host channels interrupt mask
HCIM : Boolean := False;
-- Periodic TxFIFO empty mask
PTXFEM : Boolean := False;
-- unspecified
Reserved_27_27 : HAL.Bit := 16#0#;
-- Connector ID status change mask
CIDSCHGM : Boolean := False;
-- Disconnect detected interrupt mask
DISCINT : Boolean := False;
-- Session request/new session detected interrupt mask
SRQIM : Boolean := False;
-- Resume/remote wakeup detected interrupt mask
WUIM : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_GINTMSK_Register use record
Reserved_0_0 at 0 range 0 .. 0;
MMISM at 0 range 1 .. 1;
OTGINT at 0 range 2 .. 2;
SOFM at 0 range 3 .. 3;
RXFLVLM at 0 range 4 .. 4;
NPTXFEM at 0 range 5 .. 5;
GINAKEFFM at 0 range 6 .. 6;
GONAKEFFM at 0 range 7 .. 7;
Reserved_8_9 at 0 range 8 .. 9;
ESUSPM at 0 range 10 .. 10;
USBSUSPM at 0 range 11 .. 11;
USBRST at 0 range 12 .. 12;
ENUMDNEM at 0 range 13 .. 13;
ISOODRPM at 0 range 14 .. 14;
EOPFM at 0 range 15 .. 15;
Reserved_16_16 at 0 range 16 .. 16;
EPMISM at 0 range 17 .. 17;
IEPINT at 0 range 18 .. 18;
OEPINT at 0 range 19 .. 19;
IISOIXFRM at 0 range 20 .. 20;
PXFRM_IISOOXFRM at 0 range 21 .. 21;
FSUSPM at 0 range 22 .. 22;
Reserved_23_23 at 0 range 23 .. 23;
PRTIM at 0 range 24 .. 24;
HCIM at 0 range 25 .. 25;
PTXFEM at 0 range 26 .. 26;
Reserved_27_27 at 0 range 27 .. 27;
CIDSCHGM at 0 range 28 .. 28;
DISCINT at 0 range 29 .. 29;
SRQIM at 0 range 30 .. 30;
WUIM at 0 range 31 .. 31;
end record;
----------------------------------
-- OTG_HS_GRXSTSR_Host_Register --
----------------------------------
subtype OTG_HS_GRXSTSR_Host_CHNUM_Field is HAL.UInt4;
subtype OTG_HS_GRXSTSR_Host_BCNT_Field is HAL.UInt11;
subtype OTG_HS_GRXSTSR_Host_DPID_Field is HAL.UInt2;
subtype OTG_HS_GRXSTSR_Host_PKTSTS_Field is HAL.UInt4;
-- OTG_HS Receive status debug read register (host mode)
type OTG_HS_GRXSTSR_Host_Register is record
-- Read-only. Channel number
CHNUM : OTG_HS_GRXSTSR_Host_CHNUM_Field;
-- Read-only. Byte count
BCNT : OTG_HS_GRXSTSR_Host_BCNT_Field;
-- Read-only. Data PID
DPID : OTG_HS_GRXSTSR_Host_DPID_Field;
-- Read-only. Packet status
PKTSTS : OTG_HS_GRXSTSR_Host_PKTSTS_Field;
-- unspecified
Reserved_21_31 : HAL.UInt11;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_GRXSTSR_Host_Register use record
CHNUM at 0 range 0 .. 3;
BCNT at 0 range 4 .. 14;
DPID at 0 range 15 .. 16;
PKTSTS at 0 range 17 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
----------------------------------------
-- OTG_HS_GRXSTSR_Peripheral_Register --
----------------------------------------
subtype OTG_HS_GRXSTSR_Peripheral_EPNUM_Field is HAL.UInt4;
subtype OTG_HS_GRXSTSR_Peripheral_BCNT_Field is HAL.UInt11;
subtype OTG_HS_GRXSTSR_Peripheral_DPID_Field is HAL.UInt2;
subtype OTG_HS_GRXSTSR_Peripheral_PKTSTS_Field is HAL.UInt4;
subtype OTG_HS_GRXSTSR_Peripheral_FRMNUM_Field is HAL.UInt4;
-- OTG_HS Receive status debug read register (peripheral mode mode)
type OTG_HS_GRXSTSR_Peripheral_Register is record
-- Read-only. Endpoint number
EPNUM : OTG_HS_GRXSTSR_Peripheral_EPNUM_Field;
-- Read-only. Byte count
BCNT : OTG_HS_GRXSTSR_Peripheral_BCNT_Field;
-- Read-only. Data PID
DPID : OTG_HS_GRXSTSR_Peripheral_DPID_Field;
-- Read-only. Packet status
PKTSTS : OTG_HS_GRXSTSR_Peripheral_PKTSTS_Field;
-- Read-only. Frame number
FRMNUM : OTG_HS_GRXSTSR_Peripheral_FRMNUM_Field;
-- unspecified
Reserved_25_31 : HAL.UInt7;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_GRXSTSR_Peripheral_Register use record
EPNUM at 0 range 0 .. 3;
BCNT at 0 range 4 .. 14;
DPID at 0 range 15 .. 16;
PKTSTS at 0 range 17 .. 20;
FRMNUM at 0 range 21 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
----------------------------------
-- OTG_HS_GRXSTSP_Host_Register --
----------------------------------
subtype OTG_HS_GRXSTSP_Host_CHNUM_Field is HAL.UInt4;
subtype OTG_HS_GRXSTSP_Host_BCNT_Field is HAL.UInt11;
subtype OTG_HS_GRXSTSP_Host_DPID_Field is HAL.UInt2;
subtype OTG_HS_GRXSTSP_Host_PKTSTS_Field is HAL.UInt4;
-- OTG_HS status read and pop register (host mode)
type OTG_HS_GRXSTSP_Host_Register is record
-- Read-only. Channel number
CHNUM : OTG_HS_GRXSTSP_Host_CHNUM_Field;
-- Read-only. Byte count
BCNT : OTG_HS_GRXSTSP_Host_BCNT_Field;
-- Read-only. Data PID
DPID : OTG_HS_GRXSTSP_Host_DPID_Field;
-- Read-only. Packet status
PKTSTS : OTG_HS_GRXSTSP_Host_PKTSTS_Field;
-- unspecified
Reserved_21_31 : HAL.UInt11;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_GRXSTSP_Host_Register use record
CHNUM at 0 range 0 .. 3;
BCNT at 0 range 4 .. 14;
DPID at 0 range 15 .. 16;
PKTSTS at 0 range 17 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
----------------------------------------
-- OTG_HS_GRXSTSP_Peripheral_Register --
----------------------------------------
subtype OTG_HS_GRXSTSP_Peripheral_EPNUM_Field is HAL.UInt4;
subtype OTG_HS_GRXSTSP_Peripheral_BCNT_Field is HAL.UInt11;
subtype OTG_HS_GRXSTSP_Peripheral_DPID_Field is HAL.UInt2;
subtype OTG_HS_GRXSTSP_Peripheral_PKTSTS_Field is HAL.UInt4;
subtype OTG_HS_GRXSTSP_Peripheral_FRMNUM_Field is HAL.UInt4;
-- OTG_HS status read and pop register (peripheral mode)
type OTG_HS_GRXSTSP_Peripheral_Register is record
-- Read-only. Endpoint number
EPNUM : OTG_HS_GRXSTSP_Peripheral_EPNUM_Field;
-- Read-only. Byte count
BCNT : OTG_HS_GRXSTSP_Peripheral_BCNT_Field;
-- Read-only. Data PID
DPID : OTG_HS_GRXSTSP_Peripheral_DPID_Field;
-- Read-only. Packet status
PKTSTS : OTG_HS_GRXSTSP_Peripheral_PKTSTS_Field;
-- Read-only. Frame number
FRMNUM : OTG_HS_GRXSTSP_Peripheral_FRMNUM_Field;
-- unspecified
Reserved_25_31 : HAL.UInt7;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_GRXSTSP_Peripheral_Register use record
EPNUM at 0 range 0 .. 3;
BCNT at 0 range 4 .. 14;
DPID at 0 range 15 .. 16;
PKTSTS at 0 range 17 .. 20;
FRMNUM at 0 range 21 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
-----------------------------
-- OTG_HS_GRXFSIZ_Register --
-----------------------------
subtype OTG_HS_GRXFSIZ_RXFD_Field is HAL.Short;
-- OTG_HS Receive FIFO size register
type OTG_HS_GRXFSIZ_Register is record
-- RxFIFO depth
RXFD : OTG_HS_GRXFSIZ_RXFD_Field := 16#200#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_GRXFSIZ_Register use record
RXFD at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
------------------------------------
-- OTG_HS_GNPTXFSIZ_Host_Register --
------------------------------------
subtype OTG_HS_GNPTXFSIZ_Host_NPTXFSA_Field is HAL.Short;
subtype OTG_HS_GNPTXFSIZ_Host_NPTXFD_Field is HAL.Short;
-- OTG_HS nonperiodic transmit FIFO size register (host mode)
type OTG_HS_GNPTXFSIZ_Host_Register is record
-- Nonperiodic transmit RAM start address
NPTXFSA : OTG_HS_GNPTXFSIZ_Host_NPTXFSA_Field := 16#200#;
-- Nonperiodic TxFIFO depth
NPTXFD : OTG_HS_GNPTXFSIZ_Host_NPTXFD_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_GNPTXFSIZ_Host_Register use record
NPTXFSA at 0 range 0 .. 15;
NPTXFD at 0 range 16 .. 31;
end record;
----------------------------------------
-- OTG_HS_TX0FSIZ_Peripheral_Register --
----------------------------------------
subtype OTG_HS_TX0FSIZ_Peripheral_TX0FSA_Field is HAL.Short;
subtype OTG_HS_TX0FSIZ_Peripheral_TX0FD_Field is HAL.Short;
-- Endpoint 0 transmit FIFO size (peripheral mode)
type OTG_HS_TX0FSIZ_Peripheral_Register is record
-- Endpoint 0 transmit RAM start address
TX0FSA : OTG_HS_TX0FSIZ_Peripheral_TX0FSA_Field := 16#200#;
-- Endpoint 0 TxFIFO depth
TX0FD : OTG_HS_TX0FSIZ_Peripheral_TX0FD_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_TX0FSIZ_Peripheral_Register use record
TX0FSA at 0 range 0 .. 15;
TX0FD at 0 range 16 .. 31;
end record;
------------------------------
-- OTG_HS_GNPTXSTS_Register --
------------------------------
subtype OTG_HS_GNPTXSTS_NPTXFSAV_Field is HAL.Short;
subtype OTG_HS_GNPTXSTS_NPTQXSAV_Field is HAL.Byte;
subtype OTG_HS_GNPTXSTS_NPTXQTOP_Field is HAL.UInt7;
-- OTG_HS nonperiodic transmit FIFO/queue status register
type OTG_HS_GNPTXSTS_Register is record
-- Read-only. Nonperiodic TxFIFO space available
NPTXFSAV : OTG_HS_GNPTXSTS_NPTXFSAV_Field;
-- Read-only. Nonperiodic transmit request queue space available
NPTQXSAV : OTG_HS_GNPTXSTS_NPTQXSAV_Field;
-- Read-only. Top of the nonperiodic transmit request queue
NPTXQTOP : OTG_HS_GNPTXSTS_NPTXQTOP_Field;
-- unspecified
Reserved_31_31 : HAL.Bit;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_GNPTXSTS_Register use record
NPTXFSAV at 0 range 0 .. 15;
NPTQXSAV at 0 range 16 .. 23;
NPTXQTOP at 0 range 24 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
---------------------------
-- OTG_HS_GCCFG_Register --
---------------------------
-- OTG_HS general core configuration register
type OTG_HS_GCCFG_Register is record
-- unspecified
Reserved_0_15 : HAL.Short := 16#0#;
-- Power down
PWRDWN : Boolean := False;
-- Enable I2C bus connection for the external I2C PHY interface
I2CPADEN : Boolean := False;
-- Enable the VBUS sensing device
VBUSASEN : Boolean := False;
-- Enable the VBUS sensing device
VBUSBSEN : Boolean := False;
-- SOF output enable
SOFOUTEN : Boolean := False;
-- VBUS sensing disable option
NOVBUSSENS : Boolean := False;
-- unspecified
Reserved_22_31 : HAL.UInt10 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_GCCFG_Register use record
Reserved_0_15 at 0 range 0 .. 15;
PWRDWN at 0 range 16 .. 16;
I2CPADEN at 0 range 17 .. 17;
VBUSASEN at 0 range 18 .. 18;
VBUSBSEN at 0 range 19 .. 19;
SOFOUTEN at 0 range 20 .. 20;
NOVBUSSENS at 0 range 21 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
------------------------------
-- OTG_HS_HPTXFSIZ_Register --
------------------------------
subtype OTG_HS_HPTXFSIZ_PTXSA_Field is HAL.Short;
subtype OTG_HS_HPTXFSIZ_PTXFD_Field is HAL.Short;
-- OTG_HS Host periodic transmit FIFO size register
type OTG_HS_HPTXFSIZ_Register is record
-- Host periodic TxFIFO start address
PTXSA : OTG_HS_HPTXFSIZ_PTXSA_Field := 16#600#;
-- Host periodic TxFIFO depth
PTXFD : OTG_HS_HPTXFSIZ_PTXFD_Field := 16#200#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_HPTXFSIZ_Register use record
PTXSA at 0 range 0 .. 15;
PTXFD at 0 range 16 .. 31;
end record;
-----------------------------
-- OTG_HS_DIEPTXF_Register --
-----------------------------
subtype OTG_HS_DIEPTXF1_INEPTXSA_Field is HAL.Short;
subtype OTG_HS_DIEPTXF1_INEPTXFD_Field is HAL.Short;
-- OTG_HS device IN endpoint transmit FIFO size register
type OTG_HS_DIEPTXF_Register is record
-- IN endpoint FIFOx transmit RAM start address
INEPTXSA : OTG_HS_DIEPTXF1_INEPTXSA_Field := 16#400#;
-- IN endpoint TxFIFO depth
INEPTXFD : OTG_HS_DIEPTXF1_INEPTXFD_Field := 16#200#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DIEPTXF_Register use record
INEPTXSA at 0 range 0 .. 15;
INEPTXFD at 0 range 16 .. 31;
end record;
--------------------------
-- OTG_HS_HCFG_Register --
--------------------------
subtype OTG_HS_HCFG_FSLSPCS_Field is HAL.UInt2;
-- OTG_HS host configuration register
type OTG_HS_HCFG_Register is record
-- FS/LS PHY clock select
FSLSPCS : OTG_HS_HCFG_FSLSPCS_Field := 16#0#;
-- Read-only. FS- and LS-only support
FSLSS : Boolean := False;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_HCFG_Register use record
FSLSPCS at 0 range 0 .. 1;
FSLSS at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
--------------------------
-- OTG_HS_HFIR_Register --
--------------------------
subtype OTG_HS_HFIR_FRIVL_Field is HAL.Short;
-- OTG_HS Host frame interval register
type OTG_HS_HFIR_Register is record
-- Frame interval
FRIVL : OTG_HS_HFIR_FRIVL_Field := 16#EA60#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_HFIR_Register use record
FRIVL at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
---------------------------
-- OTG_HS_HFNUM_Register --
---------------------------
subtype OTG_HS_HFNUM_FRNUM_Field is HAL.Short;
subtype OTG_HS_HFNUM_FTREM_Field is HAL.Short;
-- OTG_HS host frame number/frame time remaining register
type OTG_HS_HFNUM_Register is record
-- Read-only. Frame number
FRNUM : OTG_HS_HFNUM_FRNUM_Field;
-- Read-only. Frame time remaining
FTREM : OTG_HS_HFNUM_FTREM_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_HFNUM_Register use record
FRNUM at 0 range 0 .. 15;
FTREM at 0 range 16 .. 31;
end record;
-----------------------------
-- OTG_HS_HPTXSTS_Register --
-----------------------------
subtype OTG_HS_HPTXSTS_PTXFSAVL_Field is HAL.Short;
subtype OTG_HS_HPTXSTS_PTXQSAV_Field is HAL.Byte;
subtype OTG_HS_HPTXSTS_PTXQTOP_Field is HAL.Byte;
-- OTG_HS_Host periodic transmit FIFO/queue status register
type OTG_HS_HPTXSTS_Register is record
-- Periodic transmit data FIFO space available
PTXFSAVL : OTG_HS_HPTXSTS_PTXFSAVL_Field := 16#100#;
-- Read-only. Periodic transmit request queue space available
PTXQSAV : OTG_HS_HPTXSTS_PTXQSAV_Field := 16#8#;
-- Read-only. Top of the periodic transmit request queue
PTXQTOP : OTG_HS_HPTXSTS_PTXQTOP_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_HPTXSTS_Register use record
PTXFSAVL at 0 range 0 .. 15;
PTXQSAV at 0 range 16 .. 23;
PTXQTOP at 0 range 24 .. 31;
end record;
---------------------------
-- OTG_HS_HAINT_Register --
---------------------------
subtype OTG_HS_HAINT_HAINT_Field is HAL.Short;
-- OTG_HS Host all channels interrupt register
type OTG_HS_HAINT_Register is record
-- Read-only. Channel interrupts
HAINT : OTG_HS_HAINT_HAINT_Field;
-- unspecified
Reserved_16_31 : HAL.Short;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_HAINT_Register use record
HAINT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
------------------------------
-- OTG_HS_HAINTMSK_Register --
------------------------------
subtype OTG_HS_HAINTMSK_HAINTM_Field is HAL.Short;
-- OTG_HS host all channels interrupt mask register
type OTG_HS_HAINTMSK_Register is record
-- Channel interrupt mask
HAINTM : OTG_HS_HAINTMSK_HAINTM_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_HAINTMSK_Register use record
HAINTM at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
--------------------------
-- OTG_HS_HPRT_Register --
--------------------------
subtype OTG_HS_HPRT_PLSTS_Field is HAL.UInt2;
subtype OTG_HS_HPRT_PTCTL_Field is HAL.UInt4;
subtype OTG_HS_HPRT_PSPD_Field is HAL.UInt2;
-- OTG_HS host port control and status register
type OTG_HS_HPRT_Register is record
-- Read-only. Port connect status
PCSTS : Boolean := False;
-- Port connect detected
PCDET : Boolean := False;
-- Port enable
PENA : Boolean := False;
-- Port enable/disable change
PENCHNG : Boolean := False;
-- Read-only. Port overcurrent active
POCA : Boolean := False;
-- Port overcurrent change
POCCHNG : Boolean := False;
-- Port resume
PRES : Boolean := False;
-- Port suspend
PSUSP : Boolean := False;
-- Port reset
PRST : Boolean := False;
-- unspecified
Reserved_9_9 : HAL.Bit := 16#0#;
-- Read-only. Port line status
PLSTS : OTG_HS_HPRT_PLSTS_Field := 16#0#;
-- Port power
PPWR : Boolean := False;
-- Port test control
PTCTL : OTG_HS_HPRT_PTCTL_Field := 16#0#;
-- Read-only. Port speed
PSPD : OTG_HS_HPRT_PSPD_Field := 16#0#;
-- unspecified
Reserved_19_31 : HAL.UInt13 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_HPRT_Register use record
PCSTS at 0 range 0 .. 0;
PCDET at 0 range 1 .. 1;
PENA at 0 range 2 .. 2;
PENCHNG at 0 range 3 .. 3;
POCA at 0 range 4 .. 4;
POCCHNG at 0 range 5 .. 5;
PRES at 0 range 6 .. 6;
PSUSP at 0 range 7 .. 7;
PRST at 0 range 8 .. 8;
Reserved_9_9 at 0 range 9 .. 9;
PLSTS at 0 range 10 .. 11;
PPWR at 0 range 12 .. 12;
PTCTL at 0 range 13 .. 16;
PSPD at 0 range 17 .. 18;
Reserved_19_31 at 0 range 19 .. 31;
end record;
----------------------------
-- OTG_HS_HCCHAR_Register --
----------------------------
subtype OTG_HS_HCCHAR0_MPSIZ_Field is HAL.UInt11;
subtype OTG_HS_HCCHAR0_EPNUM_Field is HAL.UInt4;
subtype OTG_HS_HCCHAR0_EPTYP_Field is HAL.UInt2;
subtype OTG_HS_HCCHAR0_MC_Field is HAL.UInt2;
subtype OTG_HS_HCCHAR0_DAD_Field is HAL.UInt7;
-- OTG_HS host channel-0 characteristics register
type OTG_HS_HCCHAR_Register is record
-- Maximum packet size
MPSIZ : OTG_HS_HCCHAR0_MPSIZ_Field := 16#0#;
-- Endpoint number
EPNUM : OTG_HS_HCCHAR0_EPNUM_Field := 16#0#;
-- Endpoint direction
EPDIR : Boolean := False;
-- unspecified
Reserved_16_16 : HAL.Bit := 16#0#;
-- Low-speed device
LSDEV : Boolean := False;
-- Endpoint type
EPTYP : OTG_HS_HCCHAR0_EPTYP_Field := 16#0#;
-- Multi Count (MC) / Error Count (EC)
MC : OTG_HS_HCCHAR0_MC_Field := 16#0#;
-- Device address
DAD : OTG_HS_HCCHAR0_DAD_Field := 16#0#;
-- Odd frame
ODDFRM : Boolean := False;
-- Channel disable
CHDIS : Boolean := False;
-- Channel enable
CHENA : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_HCCHAR_Register use record
MPSIZ at 0 range 0 .. 10;
EPNUM at 0 range 11 .. 14;
EPDIR at 0 range 15 .. 15;
Reserved_16_16 at 0 range 16 .. 16;
LSDEV at 0 range 17 .. 17;
EPTYP at 0 range 18 .. 19;
MC at 0 range 20 .. 21;
DAD at 0 range 22 .. 28;
ODDFRM at 0 range 29 .. 29;
CHDIS at 0 range 30 .. 30;
CHENA at 0 range 31 .. 31;
end record;
----------------------------
-- OTG_HS_HCSPLT_Register --
----------------------------
subtype OTG_HS_HCSPLT0_PRTADDR_Field is HAL.UInt7;
subtype OTG_HS_HCSPLT0_HUBADDR_Field is HAL.UInt7;
subtype OTG_HS_HCSPLT0_XACTPOS_Field is HAL.UInt2;
-- OTG_HS host channel-0 split control register
type OTG_HS_HCSPLT_Register is record
-- Port address
PRTADDR : OTG_HS_HCSPLT0_PRTADDR_Field := 16#0#;
-- Hub address
HUBADDR : OTG_HS_HCSPLT0_HUBADDR_Field := 16#0#;
-- XACTPOS
XACTPOS : OTG_HS_HCSPLT0_XACTPOS_Field := 16#0#;
-- Do complete split
COMPLSPLT : Boolean := False;
-- unspecified
Reserved_17_30 : HAL.UInt14 := 16#0#;
-- Split enable
SPLITEN : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_HCSPLT_Register use record
PRTADDR at 0 range 0 .. 6;
HUBADDR at 0 range 7 .. 13;
XACTPOS at 0 range 14 .. 15;
COMPLSPLT at 0 range 16 .. 16;
Reserved_17_30 at 0 range 17 .. 30;
SPLITEN at 0 range 31 .. 31;
end record;
---------------------------
-- OTG_HS_HCINT_Register --
---------------------------
-- OTG_HS host channel-11 interrupt register
type OTG_HS_HCINT_Register is record
-- Transfer completed
XFRC : Boolean := False;
-- Channel halted
CHH : Boolean := False;
-- AHB error
AHBERR : Boolean := False;
-- STALL response received interrupt
STALL : Boolean := False;
-- NAK response received interrupt
NAK : Boolean := False;
-- ACK response received/transmitted interrupt
ACK : Boolean := False;
-- Response received interrupt
NYET : Boolean := False;
-- Transaction error
TXERR : Boolean := False;
-- Babble error
BBERR : Boolean := False;
-- Frame overrun
FRMOR : Boolean := False;
-- Data toggle error
DTERR : Boolean := False;
-- unspecified
Reserved_11_31 : HAL.UInt21 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_HCINT_Register use record
XFRC at 0 range 0 .. 0;
CHH at 0 range 1 .. 1;
AHBERR at 0 range 2 .. 2;
STALL at 0 range 3 .. 3;
NAK at 0 range 4 .. 4;
ACK at 0 range 5 .. 5;
NYET at 0 range 6 .. 6;
TXERR at 0 range 7 .. 7;
BBERR at 0 range 8 .. 8;
FRMOR at 0 range 9 .. 9;
DTERR at 0 range 10 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
------------------------------
-- OTG_HS_HCINTMSK_Register --
------------------------------
-- OTG_HS host channel-11 interrupt mask register
type OTG_HS_HCINTMSK_Register is record
-- Transfer completed mask
XFRCM : Boolean := False;
-- Channel halted mask
CHHM : Boolean := False;
-- AHB error
AHBERR : Boolean := False;
-- STALL response received interrupt mask
STALLM : Boolean := False;
-- NAK response received interrupt mask
NAKM : Boolean := False;
-- ACK response received/transmitted interrupt mask
ACKM : Boolean := False;
-- response received interrupt mask
NYET : Boolean := False;
-- Transaction error mask
TXERRM : Boolean := False;
-- Babble error mask
BBERRM : Boolean := False;
-- Frame overrun mask
FRMORM : Boolean := False;
-- Data toggle error mask
DTERRM : Boolean := False;
-- unspecified
Reserved_11_31 : HAL.UInt21 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_HCINTMSK_Register use record
XFRCM at 0 range 0 .. 0;
CHHM at 0 range 1 .. 1;
AHBERR at 0 range 2 .. 2;
STALLM at 0 range 3 .. 3;
NAKM at 0 range 4 .. 4;
ACKM at 0 range 5 .. 5;
NYET at 0 range 6 .. 6;
TXERRM at 0 range 7 .. 7;
BBERRM at 0 range 8 .. 8;
FRMORM at 0 range 9 .. 9;
DTERRM at 0 range 10 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
----------------------------
-- OTG_HS_HCTSIZ_Register --
----------------------------
subtype OTG_HS_HCTSIZ0_XFRSIZ_Field is HAL.UInt19;
subtype OTG_HS_HCTSIZ0_PKTCNT_Field is HAL.UInt10;
subtype OTG_HS_HCTSIZ0_DPID_Field is HAL.UInt2;
-- OTG_HS host channel-11 transfer size register
type OTG_HS_HCTSIZ_Register is record
-- Transfer size
XFRSIZ : OTG_HS_HCTSIZ0_XFRSIZ_Field := 16#0#;
-- Packet count
PKTCNT : OTG_HS_HCTSIZ0_PKTCNT_Field := 16#0#;
-- Data PID
DPID : OTG_HS_HCTSIZ0_DPID_Field := 16#0#;
-- unspecified
Reserved_31_31 : HAL.Bit := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_HCTSIZ_Register use record
XFRSIZ at 0 range 0 .. 18;
PKTCNT at 0 range 19 .. 28;
DPID at 0 range 29 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
--------------------------
-- OTG_HS_DCFG_Register --
--------------------------
subtype OTG_HS_DCFG_DSPD_Field is HAL.UInt2;
subtype OTG_HS_DCFG_DAD_Field is HAL.UInt7;
subtype OTG_HS_DCFG_PFIVL_Field is HAL.UInt2;
subtype OTG_HS_DCFG_PERSCHIVL_Field is HAL.UInt2;
-- OTG_HS device configuration register
type OTG_HS_DCFG_Register is record
-- Device speed
DSPD : OTG_HS_DCFG_DSPD_Field := 16#0#;
-- Nonzero-length status OUT handshake
NZLSOHSK : Boolean := False;
-- unspecified
Reserved_3_3 : HAL.Bit := 16#0#;
-- Device address
DAD : OTG_HS_DCFG_DAD_Field := 16#0#;
-- Periodic (micro)frame interval
PFIVL : OTG_HS_DCFG_PFIVL_Field := 16#0#;
-- unspecified
Reserved_13_23 : HAL.UInt11 := 16#100#;
-- Periodic scheduling interval
PERSCHIVL : OTG_HS_DCFG_PERSCHIVL_Field := 16#2#;
-- unspecified
Reserved_26_31 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DCFG_Register use record
DSPD at 0 range 0 .. 1;
NZLSOHSK at 0 range 2 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
DAD at 0 range 4 .. 10;
PFIVL at 0 range 11 .. 12;
Reserved_13_23 at 0 range 13 .. 23;
PERSCHIVL at 0 range 24 .. 25;
Reserved_26_31 at 0 range 26 .. 31;
end record;
--------------------------
-- OTG_HS_DCTL_Register --
--------------------------
subtype OTG_HS_DCTL_TCTL_Field is HAL.UInt3;
-- OTG_HS device control register
type OTG_HS_DCTL_Register is record
-- Remote wakeup signaling
RWUSIG : Boolean := False;
-- Soft disconnect
SDIS : Boolean := False;
-- Read-only. Global IN NAK status
GINSTS : Boolean := False;
-- Read-only. Global OUT NAK status
GONSTS : Boolean := False;
-- Test control
TCTL : OTG_HS_DCTL_TCTL_Field := 16#0#;
-- Write-only. Set global IN NAK
SGINAK : Boolean := False;
-- Write-only. Clear global IN NAK
CGINAK : Boolean := False;
-- Write-only. Set global OUT NAK
SGONAK : Boolean := False;
-- Write-only. Clear global OUT NAK
CGONAK : Boolean := False;
-- Power-on programming done
POPRGDNE : Boolean := False;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DCTL_Register use record
RWUSIG at 0 range 0 .. 0;
SDIS at 0 range 1 .. 1;
GINSTS at 0 range 2 .. 2;
GONSTS at 0 range 3 .. 3;
TCTL at 0 range 4 .. 6;
SGINAK at 0 range 7 .. 7;
CGINAK at 0 range 8 .. 8;
SGONAK at 0 range 9 .. 9;
CGONAK at 0 range 10 .. 10;
POPRGDNE at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
--------------------------
-- OTG_HS_DSTS_Register --
--------------------------
subtype OTG_HS_DSTS_ENUMSPD_Field is HAL.UInt2;
subtype OTG_HS_DSTS_FNSOF_Field is HAL.UInt14;
-- OTG_HS device status register
type OTG_HS_DSTS_Register is record
-- Read-only. Suspend status
SUSPSTS : Boolean;
-- Read-only. Enumerated speed
ENUMSPD : OTG_HS_DSTS_ENUMSPD_Field;
-- Read-only. Erratic error
EERR : Boolean;
-- unspecified
Reserved_4_7 : HAL.UInt4;
-- Read-only. Frame number of the received SOF
FNSOF : OTG_HS_DSTS_FNSOF_Field;
-- unspecified
Reserved_22_31 : HAL.UInt10;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DSTS_Register use record
SUSPSTS at 0 range 0 .. 0;
ENUMSPD at 0 range 1 .. 2;
EERR at 0 range 3 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
FNSOF at 0 range 8 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
-----------------------------
-- OTG_HS_DIEPMSK_Register --
-----------------------------
-- OTG_HS device IN endpoint common interrupt mask register
type OTG_HS_DIEPMSK_Register is record
-- Transfer completed interrupt mask
XFRCM : Boolean := False;
-- Endpoint disabled interrupt mask
EPDM : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- Timeout condition mask (nonisochronous endpoints)
TOM : Boolean := False;
-- IN token received when TxFIFO empty mask
ITTXFEMSK : Boolean := False;
-- IN token received with EP mismatch mask
INEPNMM : Boolean := False;
-- IN endpoint NAK effective mask
INEPNEM : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- FIFO underrun mask
TXFURM : Boolean := False;
-- BNA interrupt mask
BIM : Boolean := False;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DIEPMSK_Register use record
XFRCM at 0 range 0 .. 0;
EPDM at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
TOM at 0 range 3 .. 3;
ITTXFEMSK at 0 range 4 .. 4;
INEPNMM at 0 range 5 .. 5;
INEPNEM at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
TXFURM at 0 range 8 .. 8;
BIM at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-----------------------------
-- OTG_HS_DOEPMSK_Register --
-----------------------------
-- OTG_HS device OUT endpoint common interrupt mask register
type OTG_HS_DOEPMSK_Register is record
-- Transfer completed interrupt mask
XFRCM : Boolean := False;
-- Endpoint disabled interrupt mask
EPDM : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- SETUP phase done mask
STUPM : Boolean := False;
-- OUT token received when endpoint disabled mask
OTEPDM : Boolean := False;
-- unspecified
Reserved_5_5 : HAL.Bit := 16#0#;
-- Back-to-back SETUP packets received mask
B2BSTUP : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- OUT packet error mask
OPEM : Boolean := False;
-- BNA interrupt mask
BOIM : Boolean := False;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DOEPMSK_Register use record
XFRCM at 0 range 0 .. 0;
EPDM at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
STUPM at 0 range 3 .. 3;
OTEPDM at 0 range 4 .. 4;
Reserved_5_5 at 0 range 5 .. 5;
B2BSTUP at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
OPEM at 0 range 8 .. 8;
BOIM at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
---------------------------
-- OTG_HS_DAINT_Register --
---------------------------
subtype OTG_HS_DAINT_IEPINT_Field is HAL.Short;
subtype OTG_HS_DAINT_OEPINT_Field is HAL.Short;
-- OTG_HS device all endpoints interrupt register
type OTG_HS_DAINT_Register is record
-- Read-only. IN endpoint interrupt bits
IEPINT : OTG_HS_DAINT_IEPINT_Field;
-- Read-only. OUT endpoint interrupt bits
OEPINT : OTG_HS_DAINT_OEPINT_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DAINT_Register use record
IEPINT at 0 range 0 .. 15;
OEPINT at 0 range 16 .. 31;
end record;
------------------------------
-- OTG_HS_DAINTMSK_Register --
------------------------------
subtype OTG_HS_DAINTMSK_IEPM_Field is HAL.Short;
subtype OTG_HS_DAINTMSK_OEPM_Field is HAL.Short;
-- OTG_HS all endpoints interrupt mask register
type OTG_HS_DAINTMSK_Register is record
-- IN EP interrupt mask bits
IEPM : OTG_HS_DAINTMSK_IEPM_Field := 16#0#;
-- OUT EP interrupt mask bits
OEPM : OTG_HS_DAINTMSK_OEPM_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DAINTMSK_Register use record
IEPM at 0 range 0 .. 15;
OEPM at 0 range 16 .. 31;
end record;
------------------------------
-- OTG_HS_DVBUSDIS_Register --
------------------------------
subtype OTG_HS_DVBUSDIS_VBUSDT_Field is HAL.Short;
-- OTG_HS device VBUS discharge time register
type OTG_HS_DVBUSDIS_Register is record
-- Device VBUS discharge time
VBUSDT : OTG_HS_DVBUSDIS_VBUSDT_Field := 16#17D7#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DVBUSDIS_Register use record
VBUSDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
--------------------------------
-- OTG_HS_DVBUSPULSE_Register --
--------------------------------
subtype OTG_HS_DVBUSPULSE_DVBUSP_Field is HAL.UInt12;
-- OTG_HS device VBUS pulsing time register
type OTG_HS_DVBUSPULSE_Register is record
-- Device VBUS pulsing time
DVBUSP : OTG_HS_DVBUSPULSE_DVBUSP_Field := 16#5B8#;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DVBUSPULSE_Register use record
DVBUSP at 0 range 0 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
-----------------------------
-- OTG_HS_DTHRCTL_Register --
-----------------------------
subtype OTG_HS_DTHRCTL_TXTHRLEN_Field is HAL.UInt9;
subtype OTG_HS_DTHRCTL_RXTHRLEN_Field is HAL.UInt9;
-- OTG_HS Device threshold control register
type OTG_HS_DTHRCTL_Register is record
-- Nonisochronous IN endpoints threshold enable
NONISOTHREN : Boolean := False;
-- ISO IN endpoint threshold enable
ISOTHREN : Boolean := False;
-- Transmit threshold length
TXTHRLEN : OTG_HS_DTHRCTL_TXTHRLEN_Field := 16#0#;
-- unspecified
Reserved_11_15 : HAL.UInt5 := 16#0#;
-- Receive threshold enable
RXTHREN : Boolean := False;
-- Receive threshold length
RXTHRLEN : OTG_HS_DTHRCTL_RXTHRLEN_Field := 16#0#;
-- unspecified
Reserved_26_26 : HAL.Bit := 16#0#;
-- Arbiter parking enable
ARPEN : Boolean := False;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DTHRCTL_Register use record
NONISOTHREN at 0 range 0 .. 0;
ISOTHREN at 0 range 1 .. 1;
TXTHRLEN at 0 range 2 .. 10;
Reserved_11_15 at 0 range 11 .. 15;
RXTHREN at 0 range 16 .. 16;
RXTHRLEN at 0 range 17 .. 25;
Reserved_26_26 at 0 range 26 .. 26;
ARPEN at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
--------------------------------
-- OTG_HS_DIEPEMPMSK_Register --
--------------------------------
subtype OTG_HS_DIEPEMPMSK_INEPTXFEM_Field is HAL.Short;
-- OTG_HS device IN endpoint FIFO empty interrupt mask register
type OTG_HS_DIEPEMPMSK_Register is record
-- IN EP Tx FIFO empty interrupt mask bits
INEPTXFEM : OTG_HS_DIEPEMPMSK_INEPTXFEM_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DIEPEMPMSK_Register use record
INEPTXFEM at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
------------------------------
-- OTG_HS_DEACHINT_Register --
------------------------------
-- OTG_HS device each endpoint interrupt register
type OTG_HS_DEACHINT_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- IN endpoint 1interrupt bit
IEP1INT : Boolean := False;
-- unspecified
Reserved_2_16 : HAL.UInt15 := 16#0#;
-- OUT endpoint 1 interrupt bit
OEP1INT : Boolean := False;
-- unspecified
Reserved_18_31 : HAL.UInt14 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DEACHINT_Register use record
Reserved_0_0 at 0 range 0 .. 0;
IEP1INT at 0 range 1 .. 1;
Reserved_2_16 at 0 range 2 .. 16;
OEP1INT at 0 range 17 .. 17;
Reserved_18_31 at 0 range 18 .. 31;
end record;
---------------------------------
-- OTG_HS_DEACHINTMSK_Register --
---------------------------------
-- OTG_HS device each endpoint interrupt register mask
type OTG_HS_DEACHINTMSK_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- IN Endpoint 1 interrupt mask bit
IEP1INTM : Boolean := False;
-- unspecified
Reserved_2_16 : HAL.UInt15 := 16#0#;
-- OUT Endpoint 1 interrupt mask bit
OEP1INTM : Boolean := False;
-- unspecified
Reserved_18_31 : HAL.UInt14 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DEACHINTMSK_Register use record
Reserved_0_0 at 0 range 0 .. 0;
IEP1INTM at 0 range 1 .. 1;
Reserved_2_16 at 0 range 2 .. 16;
OEP1INTM at 0 range 17 .. 17;
Reserved_18_31 at 0 range 18 .. 31;
end record;
----------------------------------
-- OTG_HS_DIEPEACHMSK1_Register --
----------------------------------
-- OTG_HS device each in endpoint-1 interrupt register
type OTG_HS_DIEPEACHMSK1_Register is record
-- Transfer completed interrupt mask
XFRCM : Boolean := False;
-- Endpoint disabled interrupt mask
EPDM : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- Timeout condition mask (nonisochronous endpoints)
TOM : Boolean := False;
-- IN token received when TxFIFO empty mask
ITTXFEMSK : Boolean := False;
-- IN token received with EP mismatch mask
INEPNMM : Boolean := False;
-- IN endpoint NAK effective mask
INEPNEM : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- FIFO underrun mask
TXFURM : Boolean := False;
-- BNA interrupt mask
BIM : Boolean := False;
-- unspecified
Reserved_10_12 : HAL.UInt3 := 16#0#;
-- NAK interrupt mask
NAKM : Boolean := False;
-- unspecified
Reserved_14_31 : HAL.UInt18 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DIEPEACHMSK1_Register use record
XFRCM at 0 range 0 .. 0;
EPDM at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
TOM at 0 range 3 .. 3;
ITTXFEMSK at 0 range 4 .. 4;
INEPNMM at 0 range 5 .. 5;
INEPNEM at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
TXFURM at 0 range 8 .. 8;
BIM at 0 range 9 .. 9;
Reserved_10_12 at 0 range 10 .. 12;
NAKM at 0 range 13 .. 13;
Reserved_14_31 at 0 range 14 .. 31;
end record;
----------------------------------
-- OTG_HS_DOEPEACHMSK1_Register --
----------------------------------
-- OTG_HS device each OUT endpoint-1 interrupt register
type OTG_HS_DOEPEACHMSK1_Register is record
-- Transfer completed interrupt mask
XFRCM : Boolean := False;
-- Endpoint disabled interrupt mask
EPDM : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- Timeout condition mask
TOM : Boolean := False;
-- IN token received when TxFIFO empty mask
ITTXFEMSK : Boolean := False;
-- IN token received with EP mismatch mask
INEPNMM : Boolean := False;
-- IN endpoint NAK effective mask
INEPNEM : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- OUT packet error mask
TXFURM : Boolean := False;
-- BNA interrupt mask
BIM : Boolean := False;
-- unspecified
Reserved_10_11 : HAL.UInt2 := 16#0#;
-- Bubble error interrupt mask
BERRM : Boolean := False;
-- NAK interrupt mask
NAKM : Boolean := False;
-- NYET interrupt mask
NYETM : Boolean := False;
-- unspecified
Reserved_15_31 : HAL.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DOEPEACHMSK1_Register use record
XFRCM at 0 range 0 .. 0;
EPDM at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
TOM at 0 range 3 .. 3;
ITTXFEMSK at 0 range 4 .. 4;
INEPNMM at 0 range 5 .. 5;
INEPNEM at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
TXFURM at 0 range 8 .. 8;
BIM at 0 range 9 .. 9;
Reserved_10_11 at 0 range 10 .. 11;
BERRM at 0 range 12 .. 12;
NAKM at 0 range 13 .. 13;
NYETM at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
-----------------------------
-- OTG_HS_DIEPCTL_Register --
-----------------------------
subtype OTG_HS_DIEPCTL0_MPSIZ_Field is HAL.UInt11;
subtype OTG_HS_DIEPCTL0_EPTYP_Field is HAL.UInt2;
subtype OTG_HS_DIEPCTL0_TXFNUM_Field is HAL.UInt4;
-- OTG device endpoint-0 control register
type OTG_HS_DIEPCTL_Register is record
-- Maximum packet size
MPSIZ : OTG_HS_DIEPCTL0_MPSIZ_Field := 16#0#;
-- unspecified
Reserved_11_14 : HAL.UInt4 := 16#0#;
-- USB active endpoint
USBAEP : Boolean := False;
-- Read-only. Even/odd frame
EONUM_DPID : Boolean := False;
-- Read-only. NAK status
NAKSTS : Boolean := False;
-- Endpoint type
EPTYP : OTG_HS_DIEPCTL0_EPTYP_Field := 16#0#;
-- unspecified
Reserved_20_20 : HAL.Bit := 16#0#;
-- STALL handshake
Stall : Boolean := False;
-- TxFIFO number
TXFNUM : OTG_HS_DIEPCTL0_TXFNUM_Field := 16#0#;
-- Write-only. Clear NAK
CNAK : Boolean := False;
-- Write-only. Set NAK
SNAK : Boolean := False;
-- Write-only. Set DATA0 PID
SD0PID_SEVNFRM : Boolean := False;
-- Write-only. Set odd frame
SODDFRM : Boolean := False;
-- Endpoint disable
EPDIS : Boolean := False;
-- Endpoint enable
EPENA : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DIEPCTL_Register use record
MPSIZ at 0 range 0 .. 10;
Reserved_11_14 at 0 range 11 .. 14;
USBAEP at 0 range 15 .. 15;
EONUM_DPID at 0 range 16 .. 16;
NAKSTS at 0 range 17 .. 17;
EPTYP at 0 range 18 .. 19;
Reserved_20_20 at 0 range 20 .. 20;
Stall at 0 range 21 .. 21;
TXFNUM at 0 range 22 .. 25;
CNAK at 0 range 26 .. 26;
SNAK at 0 range 27 .. 27;
SD0PID_SEVNFRM at 0 range 28 .. 28;
SODDFRM at 0 range 29 .. 29;
EPDIS at 0 range 30 .. 30;
EPENA at 0 range 31 .. 31;
end record;
-----------------------------
-- OTG_HS_DIEPINT_Register --
-----------------------------
-- OTG device endpoint-0 interrupt register
type OTG_HS_DIEPINT_Register is record
-- Transfer completed interrupt
XFRC : Boolean := False;
-- Endpoint disabled interrupt
EPDISD : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- Timeout condition
TOC : Boolean := False;
-- IN token received when TxFIFO is empty
ITTXFE : Boolean := False;
-- unspecified
Reserved_5_5 : HAL.Bit := 16#0#;
-- IN endpoint NAK effective
INEPNE : Boolean := False;
-- Read-only. Transmit FIFO empty
TXFE : Boolean := True;
-- Transmit Fifo Underrun
TXFIFOUDRN : Boolean := False;
-- Buffer not available interrupt
BNA : Boolean := False;
-- unspecified
Reserved_10_10 : HAL.Bit := 16#0#;
-- Packet dropped status
PKTDRPSTS : Boolean := False;
-- Babble error interrupt
BERR : Boolean := False;
-- NAK interrupt
NAK : Boolean := False;
-- unspecified
Reserved_14_31 : HAL.UInt18 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DIEPINT_Register use record
XFRC at 0 range 0 .. 0;
EPDISD at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
TOC at 0 range 3 .. 3;
ITTXFE at 0 range 4 .. 4;
Reserved_5_5 at 0 range 5 .. 5;
INEPNE at 0 range 6 .. 6;
TXFE at 0 range 7 .. 7;
TXFIFOUDRN at 0 range 8 .. 8;
BNA at 0 range 9 .. 9;
Reserved_10_10 at 0 range 10 .. 10;
PKTDRPSTS at 0 range 11 .. 11;
BERR at 0 range 12 .. 12;
NAK at 0 range 13 .. 13;
Reserved_14_31 at 0 range 14 .. 31;
end record;
-------------------------------
-- OTG_HS_DIEPTSIZ0_Register --
-------------------------------
subtype OTG_HS_DIEPTSIZ0_XFRSIZ_Field is HAL.UInt7;
subtype OTG_HS_DIEPTSIZ0_PKTCNT_Field is HAL.UInt2;
-- OTG_HS device IN endpoint 0 transfer size register
type OTG_HS_DIEPTSIZ0_Register is record
-- Transfer size
XFRSIZ : OTG_HS_DIEPTSIZ0_XFRSIZ_Field := 16#0#;
-- unspecified
Reserved_7_18 : HAL.UInt12 := 16#0#;
-- Packet count
PKTCNT : OTG_HS_DIEPTSIZ0_PKTCNT_Field := 16#0#;
-- unspecified
Reserved_21_31 : HAL.UInt11 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DIEPTSIZ0_Register use record
XFRSIZ at 0 range 0 .. 6;
Reserved_7_18 at 0 range 7 .. 18;
PKTCNT at 0 range 19 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
-----------------------------
-- OTG_HS_DTXFSTS_Register --
-----------------------------
subtype OTG_HS_DTXFSTS0_INEPTFSAV_Field is HAL.Short;
-- OTG_HS device IN endpoint transmit FIFO status register
type OTG_HS_DTXFSTS_Register is record
-- Read-only. IN endpoint TxFIFO space avail
INEPTFSAV : OTG_HS_DTXFSTS0_INEPTFSAV_Field;
-- unspecified
Reserved_16_31 : HAL.Short;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DTXFSTS_Register use record
INEPTFSAV at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
------------------------------
-- OTG_HS_DIEPTSIZ_Register --
------------------------------
subtype OTG_HS_DIEPTSIZ1_XFRSIZ_Field is HAL.UInt19;
subtype OTG_HS_DIEPTSIZ1_PKTCNT_Field is HAL.UInt10;
subtype OTG_HS_DIEPTSIZ1_MCNT_Field is HAL.UInt2;
-- OTG_HS device endpoint transfer size register
type OTG_HS_DIEPTSIZ_Register is record
-- Transfer size
XFRSIZ : OTG_HS_DIEPTSIZ1_XFRSIZ_Field := 16#0#;
-- Packet count
PKTCNT : OTG_HS_DIEPTSIZ1_PKTCNT_Field := 16#0#;
-- Multi count
MCNT : OTG_HS_DIEPTSIZ1_MCNT_Field := 16#0#;
-- unspecified
Reserved_31_31 : HAL.Bit := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DIEPTSIZ_Register use record
XFRSIZ at 0 range 0 .. 18;
PKTCNT at 0 range 19 .. 28;
MCNT at 0 range 29 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
------------------------------
-- OTG_HS_DOEPCTL0_Register --
------------------------------
subtype OTG_HS_DOEPCTL0_MPSIZ_Field is HAL.UInt2;
subtype OTG_HS_DOEPCTL0_EPTYP_Field is HAL.UInt2;
-- OTG_HS device control OUT endpoint 0 control register
type OTG_HS_DOEPCTL0_Register is record
-- Read-only. Maximum packet size
MPSIZ : OTG_HS_DOEPCTL0_MPSIZ_Field := 16#0#;
-- unspecified
Reserved_2_14 : HAL.UInt13 := 16#0#;
-- Read-only. USB active endpoint
USBAEP : Boolean := True;
-- unspecified
Reserved_16_16 : HAL.Bit := 16#0#;
-- Read-only. NAK status
NAKSTS : Boolean := False;
-- Read-only. Endpoint type
EPTYP : OTG_HS_DOEPCTL0_EPTYP_Field := 16#0#;
-- Snoop mode
SNPM : Boolean := False;
-- STALL handshake
Stall : Boolean := False;
-- unspecified
Reserved_22_25 : HAL.UInt4 := 16#0#;
-- Write-only. Clear NAK
CNAK : Boolean := False;
-- Write-only. Set NAK
SNAK : Boolean := False;
-- unspecified
Reserved_28_29 : HAL.UInt2 := 16#0#;
-- Read-only. Endpoint disable
EPDIS : Boolean := False;
-- Write-only. Endpoint enable
EPENA : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DOEPCTL0_Register use record
MPSIZ at 0 range 0 .. 1;
Reserved_2_14 at 0 range 2 .. 14;
USBAEP at 0 range 15 .. 15;
Reserved_16_16 at 0 range 16 .. 16;
NAKSTS at 0 range 17 .. 17;
EPTYP at 0 range 18 .. 19;
SNPM at 0 range 20 .. 20;
Stall at 0 range 21 .. 21;
Reserved_22_25 at 0 range 22 .. 25;
CNAK at 0 range 26 .. 26;
SNAK at 0 range 27 .. 27;
Reserved_28_29 at 0 range 28 .. 29;
EPDIS at 0 range 30 .. 30;
EPENA at 0 range 31 .. 31;
end record;
-----------------------------
-- OTG_HS_DOEPINT_Register --
-----------------------------
-- OTG_HS device endpoint-0 interrupt register
type OTG_HS_DOEPINT_Register is record
-- Transfer completed interrupt
XFRC : Boolean := False;
-- Endpoint disabled interrupt
EPDISD : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- SETUP phase done
STUP : Boolean := False;
-- OUT token received when endpoint disabled
OTEPDIS : Boolean := False;
-- unspecified
Reserved_5_5 : HAL.Bit := 16#0#;
-- Back-to-back SETUP packets received
B2BSTUP : Boolean := False;
-- unspecified
Reserved_7_13 : HAL.UInt7 := 16#1#;
-- NYET interrupt
NYET : Boolean := False;
-- unspecified
Reserved_15_31 : HAL.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DOEPINT_Register use record
XFRC at 0 range 0 .. 0;
EPDISD at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
STUP at 0 range 3 .. 3;
OTEPDIS at 0 range 4 .. 4;
Reserved_5_5 at 0 range 5 .. 5;
B2BSTUP at 0 range 6 .. 6;
Reserved_7_13 at 0 range 7 .. 13;
NYET at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
-------------------------------
-- OTG_HS_DOEPTSIZ0_Register --
-------------------------------
subtype OTG_HS_DOEPTSIZ0_XFRSIZ_Field is HAL.UInt7;
subtype OTG_HS_DOEPTSIZ0_STUPCNT_Field is HAL.UInt2;
-- OTG_HS device endpoint-1 transfer size register
type OTG_HS_DOEPTSIZ0_Register is record
-- Transfer size
XFRSIZ : OTG_HS_DOEPTSIZ0_XFRSIZ_Field := 16#0#;
-- unspecified
Reserved_7_18 : HAL.UInt12 := 16#0#;
-- Packet count
PKTCNT : Boolean := False;
-- unspecified
Reserved_20_28 : HAL.UInt9 := 16#0#;
-- SETUP packet count
STUPCNT : OTG_HS_DOEPTSIZ0_STUPCNT_Field := 16#0#;
-- unspecified
Reserved_31_31 : HAL.Bit := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DOEPTSIZ0_Register use record
XFRSIZ at 0 range 0 .. 6;
Reserved_7_18 at 0 range 7 .. 18;
PKTCNT at 0 range 19 .. 19;
Reserved_20_28 at 0 range 20 .. 28;
STUPCNT at 0 range 29 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
-----------------------------
-- OTG_HS_DOEPCTL_Register --
-----------------------------
subtype OTG_HS_DOEPCTL1_MPSIZ_Field is HAL.UInt11;
subtype OTG_HS_DOEPCTL1_EPTYP_Field is HAL.UInt2;
-- OTG device endpoint-1 control register
type OTG_HS_DOEPCTL_Register is record
-- Maximum packet size
MPSIZ : OTG_HS_DOEPCTL1_MPSIZ_Field := 16#0#;
-- unspecified
Reserved_11_14 : HAL.UInt4 := 16#0#;
-- USB active endpoint
USBAEP : Boolean := False;
-- Read-only. Even odd frame/Endpoint data PID
EONUM_DPID : Boolean := False;
-- Read-only. NAK status
NAKSTS : Boolean := False;
-- Endpoint type
EPTYP : OTG_HS_DOEPCTL1_EPTYP_Field := 16#0#;
-- Snoop mode
SNPM : Boolean := False;
-- STALL handshake
Stall : Boolean := False;
-- unspecified
Reserved_22_25 : HAL.UInt4 := 16#0#;
-- Write-only. Clear NAK
CNAK : Boolean := False;
-- Write-only. Set NAK
SNAK : Boolean := False;
-- Write-only. Set DATA0 PID/Set even frame
SD0PID_SEVNFRM : Boolean := False;
-- Write-only. Set odd frame
SODDFRM : Boolean := False;
-- Endpoint disable
EPDIS : Boolean := False;
-- Endpoint enable
EPENA : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DOEPCTL_Register use record
MPSIZ at 0 range 0 .. 10;
Reserved_11_14 at 0 range 11 .. 14;
USBAEP at 0 range 15 .. 15;
EONUM_DPID at 0 range 16 .. 16;
NAKSTS at 0 range 17 .. 17;
EPTYP at 0 range 18 .. 19;
SNPM at 0 range 20 .. 20;
Stall at 0 range 21 .. 21;
Reserved_22_25 at 0 range 22 .. 25;
CNAK at 0 range 26 .. 26;
SNAK at 0 range 27 .. 27;
SD0PID_SEVNFRM at 0 range 28 .. 28;
SODDFRM at 0 range 29 .. 29;
EPDIS at 0 range 30 .. 30;
EPENA at 0 range 31 .. 31;
end record;
------------------------------
-- OTG_HS_DOEPTSIZ_Register --
------------------------------
subtype OTG_HS_DOEPTSIZ1_XFRSIZ_Field is HAL.UInt19;
subtype OTG_HS_DOEPTSIZ1_PKTCNT_Field is HAL.UInt10;
subtype OTG_HS_DOEPTSIZ1_RXDPID_STUPCNT_Field is HAL.UInt2;
-- OTG_HS device endpoint-2 transfer size register
type OTG_HS_DOEPTSIZ_Register is record
-- Transfer size
XFRSIZ : OTG_HS_DOEPTSIZ1_XFRSIZ_Field := 16#0#;
-- Packet count
PKTCNT : OTG_HS_DOEPTSIZ1_PKTCNT_Field := 16#0#;
-- Received data PID/SETUP packet count
RXDPID_STUPCNT : OTG_HS_DOEPTSIZ1_RXDPID_STUPCNT_Field := 16#0#;
-- unspecified
Reserved_31_31 : HAL.Bit := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_DOEPTSIZ_Register use record
XFRSIZ at 0 range 0 .. 18;
PKTCNT at 0 range 19 .. 28;
RXDPID_STUPCNT at 0 range 29 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
---------------------------
-- OTG_HS_PCGCR_Register --
---------------------------
-- Power and clock gating control register
type OTG_HS_PCGCR_Register is record
-- Stop PHY clock
STPPCLK : Boolean := False;
-- Gate HCLK
GATEHCLK : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- PHY suspended
PHYSUSP : Boolean := False;
-- unspecified
Reserved_5_31 : HAL.UInt27 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTG_HS_PCGCR_Register use record
STPPCLK at 0 range 0 .. 0;
GATEHCLK at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
PHYSUSP at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
type OTG_HS_GLOBAL_Disc is
(
Host,
Peripheral,
Gnptxfsiz_Host,
Tx0Fsiz_Peripheral);
-- USB on the go high speed
type OTG_HS_GLOBAL_Peripheral
(Discriminent : OTG_HS_GLOBAL_Disc := Host)
is record
-- OTG_HS control and status register
OTG_HS_GOTGCTL : OTG_HS_GOTGCTL_Register;
-- OTG_HS interrupt register
OTG_HS_GOTGINT : OTG_HS_GOTGINT_Register;
-- OTG_HS AHB configuration register
OTG_HS_GAHBCFG : OTG_HS_GAHBCFG_Register;
-- OTG_HS USB configuration register
OTG_HS_GUSBCFG : OTG_HS_GUSBCFG_Register;
-- OTG_HS reset register
OTG_HS_GRSTCTL : OTG_HS_GRSTCTL_Register;
-- OTG_HS core interrupt register
OTG_HS_GINTSTS : OTG_HS_GINTSTS_Register;
-- OTG_HS interrupt mask register
OTG_HS_GINTMSK : OTG_HS_GINTMSK_Register;
-- OTG_HS Receive FIFO size register
OTG_HS_GRXFSIZ : OTG_HS_GRXFSIZ_Register;
-- OTG_HS nonperiodic transmit FIFO/queue status register
OTG_HS_GNPTXSTS : OTG_HS_GNPTXSTS_Register;
-- OTG_HS general core configuration register
OTG_HS_GCCFG : OTG_HS_GCCFG_Register;
-- OTG_HS core ID register
OTG_HS_CID : HAL.Word;
-- OTG_HS Host periodic transmit FIFO size register
OTG_HS_HPTXFSIZ : OTG_HS_HPTXFSIZ_Register;
-- OTG_HS device IN endpoint transmit FIFO size register
OTG_HS_DIEPTXF1 : OTG_HS_DIEPTXF_Register;
-- OTG_HS device IN endpoint transmit FIFO size register
OTG_HS_DIEPTXF2 : OTG_HS_DIEPTXF_Register;
-- OTG_HS device IN endpoint transmit FIFO size register
OTG_HS_DIEPTXF3 : OTG_HS_DIEPTXF_Register;
-- OTG_HS device IN endpoint transmit FIFO size register
OTG_HS_DIEPTXF4 : OTG_HS_DIEPTXF_Register;
-- OTG_HS device IN endpoint transmit FIFO size register
OTG_HS_DIEPTXF5 : OTG_HS_DIEPTXF_Register;
-- OTG_HS device IN endpoint transmit FIFO size register
OTG_HS_DIEPTXF6 : OTG_HS_DIEPTXF_Register;
-- OTG_HS device IN endpoint transmit FIFO size register
OTG_HS_DIEPTXF7 : OTG_HS_DIEPTXF_Register;
case Discriminent is
when Host =>
-- OTG_HS Receive status debug read register (host mode)
OTG_HS_GRXSTSR_Host : OTG_HS_GRXSTSR_Host_Register;
-- OTG_HS status read and pop register (host mode)
OTG_HS_GRXSTSP_Host : OTG_HS_GRXSTSP_Host_Register;
when Peripheral =>
-- OTG_HS Receive status debug read register (peripheral mode
-- mode)
OTG_HS_GRXSTSR_Peripheral : OTG_HS_GRXSTSR_Peripheral_Register;
-- OTG_HS status read and pop register (peripheral mode)
OTG_HS_GRXSTSP_Peripheral : OTG_HS_GRXSTSP_Peripheral_Register;
when Gnptxfsiz_Host =>
-- OTG_HS nonperiodic transmit FIFO size register (host mode)
OTG_HS_GNPTXFSIZ_Host : OTG_HS_GNPTXFSIZ_Host_Register;
when Tx0Fsiz_Peripheral =>
-- Endpoint 0 transmit FIFO size (peripheral mode)
OTG_HS_TX0FSIZ_Peripheral : OTG_HS_TX0FSIZ_Peripheral_Register;
end case;
end record
with Unchecked_Union, Volatile;
for OTG_HS_GLOBAL_Peripheral use record
OTG_HS_GOTGCTL at 0 range 0 .. 31;
OTG_HS_GOTGINT at 4 range 0 .. 31;
OTG_HS_GAHBCFG at 8 range 0 .. 31;
OTG_HS_GUSBCFG at 12 range 0 .. 31;
OTG_HS_GRSTCTL at 16 range 0 .. 31;
OTG_HS_GINTSTS at 20 range 0 .. 31;
OTG_HS_GINTMSK at 24 range 0 .. 31;
OTG_HS_GRXFSIZ at 36 range 0 .. 31;
OTG_HS_GNPTXSTS at 44 range 0 .. 31;
OTG_HS_GCCFG at 56 range 0 .. 31;
OTG_HS_CID at 60 range 0 .. 31;
OTG_HS_HPTXFSIZ at 256 range 0 .. 31;
OTG_HS_DIEPTXF1 at 260 range 0 .. 31;
OTG_HS_DIEPTXF2 at 264 range 0 .. 31;
OTG_HS_DIEPTXF3 at 284 range 0 .. 31;
OTG_HS_DIEPTXF4 at 288 range 0 .. 31;
OTG_HS_DIEPTXF5 at 292 range 0 .. 31;
OTG_HS_DIEPTXF6 at 296 range 0 .. 31;
OTG_HS_DIEPTXF7 at 300 range 0 .. 31;
OTG_HS_GRXSTSR_Host at 28 range 0 .. 31;
OTG_HS_GRXSTSP_Host at 32 range 0 .. 31;
OTG_HS_GRXSTSR_Peripheral at 28 range 0 .. 31;
OTG_HS_GRXSTSP_Peripheral at 32 range 0 .. 31;
OTG_HS_GNPTXFSIZ_Host at 40 range 0 .. 31;
OTG_HS_TX0FSIZ_Peripheral at 40 range 0 .. 31;
end record;
-- USB on the go high speed
OTG_HS_GLOBAL_Periph : aliased OTG_HS_GLOBAL_Peripheral
with Import, Address => OTG_HS_GLOBAL_Base;
-- USB on the go high speed
type OTG_HS_HOST_Peripheral is record
-- OTG_HS host configuration register
OTG_HS_HCFG : OTG_HS_HCFG_Register;
-- OTG_HS Host frame interval register
OTG_HS_HFIR : OTG_HS_HFIR_Register;
-- OTG_HS host frame number/frame time remaining register
OTG_HS_HFNUM : OTG_HS_HFNUM_Register;
-- OTG_HS_Host periodic transmit FIFO/queue status register
OTG_HS_HPTXSTS : OTG_HS_HPTXSTS_Register;
-- OTG_HS Host all channels interrupt register
OTG_HS_HAINT : OTG_HS_HAINT_Register;
-- OTG_HS host all channels interrupt mask register
OTG_HS_HAINTMSK : OTG_HS_HAINTMSK_Register;
-- OTG_HS host port control and status register
OTG_HS_HPRT : OTG_HS_HPRT_Register;
-- OTG_HS host channel-0 characteristics register
OTG_HS_HCCHAR0 : OTG_HS_HCCHAR_Register;
-- OTG_HS host channel-0 split control register
OTG_HS_HCSPLT0 : OTG_HS_HCSPLT_Register;
-- OTG_HS host channel-11 interrupt register
OTG_HS_HCINT0 : OTG_HS_HCINT_Register;
-- OTG_HS host channel-11 interrupt mask register
OTG_HS_HCINTMSK0 : OTG_HS_HCINTMSK_Register;
-- OTG_HS host channel-11 transfer size register
OTG_HS_HCTSIZ0 : OTG_HS_HCTSIZ_Register;
-- OTG_HS host channel-0 DMA address register
OTG_HS_HCDMA0 : HAL.Word;
-- OTG_HS host channel-1 characteristics register
OTG_HS_HCCHAR1 : OTG_HS_HCCHAR_Register;
-- OTG_HS host channel-1 split control register
OTG_HS_HCSPLT1 : OTG_HS_HCSPLT_Register;
-- OTG_HS host channel-1 interrupt register
OTG_HS_HCINT1 : OTG_HS_HCINT_Register;
-- OTG_HS host channel-1 interrupt mask register
OTG_HS_HCINTMSK1 : OTG_HS_HCINTMSK_Register;
-- OTG_HS host channel-1 transfer size register
OTG_HS_HCTSIZ1 : OTG_HS_HCTSIZ_Register;
-- OTG_HS host channel-1 DMA address register
OTG_HS_HCDMA1 : HAL.Word;
-- OTG_HS host channel-2 characteristics register
OTG_HS_HCCHAR2 : OTG_HS_HCCHAR_Register;
-- OTG_HS host channel-2 split control register
OTG_HS_HCSPLT2 : OTG_HS_HCSPLT_Register;
-- OTG_HS host channel-2 interrupt register
OTG_HS_HCINT2 : OTG_HS_HCINT_Register;
-- OTG_HS host channel-2 interrupt mask register
OTG_HS_HCINTMSK2 : OTG_HS_HCINTMSK_Register;
-- OTG_HS host channel-2 transfer size register
OTG_HS_HCTSIZ2 : OTG_HS_HCTSIZ_Register;
-- OTG_HS host channel-2 DMA address register
OTG_HS_HCDMA2 : HAL.Word;
-- OTG_HS host channel-3 characteristics register
OTG_HS_HCCHAR3 : OTG_HS_HCCHAR_Register;
-- OTG_HS host channel-3 split control register
OTG_HS_HCSPLT3 : OTG_HS_HCSPLT_Register;
-- OTG_HS host channel-3 interrupt register
OTG_HS_HCINT3 : OTG_HS_HCINT_Register;
-- OTG_HS host channel-3 interrupt mask register
OTG_HS_HCINTMSK3 : OTG_HS_HCINTMSK_Register;
-- OTG_HS host channel-3 transfer size register
OTG_HS_HCTSIZ3 : OTG_HS_HCTSIZ_Register;
-- OTG_HS host channel-3 DMA address register
OTG_HS_HCDMA3 : HAL.Word;
-- OTG_HS host channel-4 characteristics register
OTG_HS_HCCHAR4 : OTG_HS_HCCHAR_Register;
-- OTG_HS host channel-4 split control register
OTG_HS_HCSPLT4 : OTG_HS_HCSPLT_Register;
-- OTG_HS host channel-4 interrupt register
OTG_HS_HCINT4 : OTG_HS_HCINT_Register;
-- OTG_HS host channel-4 interrupt mask register
OTG_HS_HCINTMSK4 : OTG_HS_HCINTMSK_Register;
-- OTG_HS host channel-4 transfer size register
OTG_HS_HCTSIZ4 : OTG_HS_HCTSIZ_Register;
-- OTG_HS host channel-4 DMA address register
OTG_HS_HCDMA4 : HAL.Word;
-- OTG_HS host channel-5 characteristics register
OTG_HS_HCCHAR5 : OTG_HS_HCCHAR_Register;
-- OTG_HS host channel-5 split control register
OTG_HS_HCSPLT5 : OTG_HS_HCSPLT_Register;
-- OTG_HS host channel-5 interrupt register
OTG_HS_HCINT5 : OTG_HS_HCINT_Register;
-- OTG_HS host channel-5 interrupt mask register
OTG_HS_HCINTMSK5 : OTG_HS_HCINTMSK_Register;
-- OTG_HS host channel-5 transfer size register
OTG_HS_HCTSIZ5 : OTG_HS_HCTSIZ_Register;
-- OTG_HS host channel-5 DMA address register
OTG_HS_HCDMA5 : HAL.Word;
-- OTG_HS host channel-6 characteristics register
OTG_HS_HCCHAR6 : OTG_HS_HCCHAR_Register;
-- OTG_HS host channel-6 split control register
OTG_HS_HCSPLT6 : OTG_HS_HCSPLT_Register;
-- OTG_HS host channel-6 interrupt register
OTG_HS_HCINT6 : OTG_HS_HCINT_Register;
-- OTG_HS host channel-6 interrupt mask register
OTG_HS_HCINTMSK6 : OTG_HS_HCINTMSK_Register;
-- OTG_HS host channel-6 transfer size register
OTG_HS_HCTSIZ6 : OTG_HS_HCTSIZ_Register;
-- OTG_HS host channel-6 DMA address register
OTG_HS_HCDMA6 : HAL.Word;
-- OTG_HS host channel-7 characteristics register
OTG_HS_HCCHAR7 : OTG_HS_HCCHAR_Register;
-- OTG_HS host channel-7 split control register
OTG_HS_HCSPLT7 : OTG_HS_HCSPLT_Register;
-- OTG_HS host channel-7 interrupt register
OTG_HS_HCINT7 : OTG_HS_HCINT_Register;
-- OTG_HS host channel-7 interrupt mask register
OTG_HS_HCINTMSK7 : OTG_HS_HCINTMSK_Register;
-- OTG_HS host channel-7 transfer size register
OTG_HS_HCTSIZ7 : OTG_HS_HCTSIZ_Register;
-- OTG_HS host channel-7 DMA address register
OTG_HS_HCDMA7 : HAL.Word;
-- OTG_HS host channel-8 characteristics register
OTG_HS_HCCHAR8 : OTG_HS_HCCHAR_Register;
-- OTG_HS host channel-8 split control register
OTG_HS_HCSPLT8 : OTG_HS_HCSPLT_Register;
-- OTG_HS host channel-8 interrupt register
OTG_HS_HCINT8 : OTG_HS_HCINT_Register;
-- OTG_HS host channel-8 interrupt mask register
OTG_HS_HCINTMSK8 : OTG_HS_HCINTMSK_Register;
-- OTG_HS host channel-8 transfer size register
OTG_HS_HCTSIZ8 : OTG_HS_HCTSIZ_Register;
-- OTG_HS host channel-8 DMA address register
OTG_HS_HCDMA8 : HAL.Word;
-- OTG_HS host channel-9 characteristics register
OTG_HS_HCCHAR9 : OTG_HS_HCCHAR_Register;
-- OTG_HS host channel-9 split control register
OTG_HS_HCSPLT9 : OTG_HS_HCSPLT_Register;
-- OTG_HS host channel-9 interrupt register
OTG_HS_HCINT9 : OTG_HS_HCINT_Register;
-- OTG_HS host channel-9 interrupt mask register
OTG_HS_HCINTMSK9 : OTG_HS_HCINTMSK_Register;
-- OTG_HS host channel-9 transfer size register
OTG_HS_HCTSIZ9 : OTG_HS_HCTSIZ_Register;
-- OTG_HS host channel-9 DMA address register
OTG_HS_HCDMA9 : HAL.Word;
-- OTG_HS host channel-10 characteristics register
OTG_HS_HCCHAR10 : OTG_HS_HCCHAR_Register;
-- OTG_HS host channel-10 split control register
OTG_HS_HCSPLT10 : OTG_HS_HCSPLT_Register;
-- OTG_HS host channel-10 interrupt register
OTG_HS_HCINT10 : OTG_HS_HCINT_Register;
-- OTG_HS host channel-10 interrupt mask register
OTG_HS_HCINTMSK10 : OTG_HS_HCINTMSK_Register;
-- OTG_HS host channel-10 transfer size register
OTG_HS_HCTSIZ10 : OTG_HS_HCTSIZ_Register;
-- OTG_HS host channel-10 DMA address register
OTG_HS_HCDMA10 : HAL.Word;
-- OTG_HS host channel-11 characteristics register
OTG_HS_HCCHAR11 : OTG_HS_HCCHAR_Register;
-- OTG_HS host channel-11 split control register
OTG_HS_HCSPLT11 : OTG_HS_HCSPLT_Register;
-- OTG_HS host channel-11 interrupt register
OTG_HS_HCINT11 : OTG_HS_HCINT_Register;
-- OTG_HS host channel-11 interrupt mask register
OTG_HS_HCINTMSK11 : OTG_HS_HCINTMSK_Register;
-- OTG_HS host channel-11 transfer size register
OTG_HS_HCTSIZ11 : OTG_HS_HCTSIZ_Register;
-- OTG_HS host channel-11 DMA address register
OTG_HS_HCDMA11 : HAL.Word;
end record
with Volatile;
for OTG_HS_HOST_Peripheral use record
OTG_HS_HCFG at 0 range 0 .. 31;
OTG_HS_HFIR at 4 range 0 .. 31;
OTG_HS_HFNUM at 8 range 0 .. 31;
OTG_HS_HPTXSTS at 16 range 0 .. 31;
OTG_HS_HAINT at 20 range 0 .. 31;
OTG_HS_HAINTMSK at 24 range 0 .. 31;
OTG_HS_HPRT at 64 range 0 .. 31;
OTG_HS_HCCHAR0 at 256 range 0 .. 31;
OTG_HS_HCSPLT0 at 260 range 0 .. 31;
OTG_HS_HCINT0 at 264 range 0 .. 31;
OTG_HS_HCINTMSK0 at 268 range 0 .. 31;
OTG_HS_HCTSIZ0 at 272 range 0 .. 31;
OTG_HS_HCDMA0 at 276 range 0 .. 31;
OTG_HS_HCCHAR1 at 288 range 0 .. 31;
OTG_HS_HCSPLT1 at 292 range 0 .. 31;
OTG_HS_HCINT1 at 296 range 0 .. 31;
OTG_HS_HCINTMSK1 at 300 range 0 .. 31;
OTG_HS_HCTSIZ1 at 304 range 0 .. 31;
OTG_HS_HCDMA1 at 308 range 0 .. 31;
OTG_HS_HCCHAR2 at 320 range 0 .. 31;
OTG_HS_HCSPLT2 at 324 range 0 .. 31;
OTG_HS_HCINT2 at 328 range 0 .. 31;
OTG_HS_HCINTMSK2 at 332 range 0 .. 31;
OTG_HS_HCTSIZ2 at 336 range 0 .. 31;
OTG_HS_HCDMA2 at 340 range 0 .. 31;
OTG_HS_HCCHAR3 at 352 range 0 .. 31;
OTG_HS_HCSPLT3 at 356 range 0 .. 31;
OTG_HS_HCINT3 at 360 range 0 .. 31;
OTG_HS_HCINTMSK3 at 364 range 0 .. 31;
OTG_HS_HCTSIZ3 at 368 range 0 .. 31;
OTG_HS_HCDMA3 at 372 range 0 .. 31;
OTG_HS_HCCHAR4 at 384 range 0 .. 31;
OTG_HS_HCSPLT4 at 388 range 0 .. 31;
OTG_HS_HCINT4 at 392 range 0 .. 31;
OTG_HS_HCINTMSK4 at 396 range 0 .. 31;
OTG_HS_HCTSIZ4 at 400 range 0 .. 31;
OTG_HS_HCDMA4 at 404 range 0 .. 31;
OTG_HS_HCCHAR5 at 416 range 0 .. 31;
OTG_HS_HCSPLT5 at 420 range 0 .. 31;
OTG_HS_HCINT5 at 424 range 0 .. 31;
OTG_HS_HCINTMSK5 at 428 range 0 .. 31;
OTG_HS_HCTSIZ5 at 432 range 0 .. 31;
OTG_HS_HCDMA5 at 436 range 0 .. 31;
OTG_HS_HCCHAR6 at 448 range 0 .. 31;
OTG_HS_HCSPLT6 at 452 range 0 .. 31;
OTG_HS_HCINT6 at 456 range 0 .. 31;
OTG_HS_HCINTMSK6 at 460 range 0 .. 31;
OTG_HS_HCTSIZ6 at 464 range 0 .. 31;
OTG_HS_HCDMA6 at 468 range 0 .. 31;
OTG_HS_HCCHAR7 at 480 range 0 .. 31;
OTG_HS_HCSPLT7 at 484 range 0 .. 31;
OTG_HS_HCINT7 at 488 range 0 .. 31;
OTG_HS_HCINTMSK7 at 492 range 0 .. 31;
OTG_HS_HCTSIZ7 at 496 range 0 .. 31;
OTG_HS_HCDMA7 at 500 range 0 .. 31;
OTG_HS_HCCHAR8 at 512 range 0 .. 31;
OTG_HS_HCSPLT8 at 516 range 0 .. 31;
OTG_HS_HCINT8 at 520 range 0 .. 31;
OTG_HS_HCINTMSK8 at 524 range 0 .. 31;
OTG_HS_HCTSIZ8 at 528 range 0 .. 31;
OTG_HS_HCDMA8 at 532 range 0 .. 31;
OTG_HS_HCCHAR9 at 544 range 0 .. 31;
OTG_HS_HCSPLT9 at 548 range 0 .. 31;
OTG_HS_HCINT9 at 552 range 0 .. 31;
OTG_HS_HCINTMSK9 at 556 range 0 .. 31;
OTG_HS_HCTSIZ9 at 560 range 0 .. 31;
OTG_HS_HCDMA9 at 564 range 0 .. 31;
OTG_HS_HCCHAR10 at 576 range 0 .. 31;
OTG_HS_HCSPLT10 at 580 range 0 .. 31;
OTG_HS_HCINT10 at 584 range 0 .. 31;
OTG_HS_HCINTMSK10 at 588 range 0 .. 31;
OTG_HS_HCTSIZ10 at 592 range 0 .. 31;
OTG_HS_HCDMA10 at 596 range 0 .. 31;
OTG_HS_HCCHAR11 at 608 range 0 .. 31;
OTG_HS_HCSPLT11 at 612 range 0 .. 31;
OTG_HS_HCINT11 at 616 range 0 .. 31;
OTG_HS_HCINTMSK11 at 620 range 0 .. 31;
OTG_HS_HCTSIZ11 at 624 range 0 .. 31;
OTG_HS_HCDMA11 at 628 range 0 .. 31;
end record;
-- USB on the go high speed
OTG_HS_HOST_Periph : aliased OTG_HS_HOST_Peripheral
with Import, Address => OTG_HS_HOST_Base;
-- USB on the go high speed
type OTG_HS_DEVICE_Peripheral is record
-- OTG_HS device configuration register
OTG_HS_DCFG : OTG_HS_DCFG_Register;
-- OTG_HS device control register
OTG_HS_DCTL : OTG_HS_DCTL_Register;
-- OTG_HS device status register
OTG_HS_DSTS : OTG_HS_DSTS_Register;
-- OTG_HS device IN endpoint common interrupt mask register
OTG_HS_DIEPMSK : OTG_HS_DIEPMSK_Register;
-- OTG_HS device OUT endpoint common interrupt mask register
OTG_HS_DOEPMSK : OTG_HS_DOEPMSK_Register;
-- OTG_HS device all endpoints interrupt register
OTG_HS_DAINT : OTG_HS_DAINT_Register;
-- OTG_HS all endpoints interrupt mask register
OTG_HS_DAINTMSK : OTG_HS_DAINTMSK_Register;
-- OTG_HS device VBUS discharge time register
OTG_HS_DVBUSDIS : OTG_HS_DVBUSDIS_Register;
-- OTG_HS device VBUS pulsing time register
OTG_HS_DVBUSPULSE : OTG_HS_DVBUSPULSE_Register;
-- OTG_HS Device threshold control register
OTG_HS_DTHRCTL : OTG_HS_DTHRCTL_Register;
-- OTG_HS device IN endpoint FIFO empty interrupt mask register
OTG_HS_DIEPEMPMSK : OTG_HS_DIEPEMPMSK_Register;
-- OTG_HS device each endpoint interrupt register
OTG_HS_DEACHINT : OTG_HS_DEACHINT_Register;
-- OTG_HS device each endpoint interrupt register mask
OTG_HS_DEACHINTMSK : OTG_HS_DEACHINTMSK_Register;
-- OTG_HS device each in endpoint-1 interrupt register
OTG_HS_DIEPEACHMSK1 : OTG_HS_DIEPEACHMSK1_Register;
-- OTG_HS device each OUT endpoint-1 interrupt register
OTG_HS_DOEPEACHMSK1 : OTG_HS_DOEPEACHMSK1_Register;
-- OTG device endpoint-0 control register
OTG_HS_DIEPCTL0 : OTG_HS_DIEPCTL_Register;
-- OTG device endpoint-0 interrupt register
OTG_HS_DIEPINT0 : OTG_HS_DIEPINT_Register;
-- OTG_HS device IN endpoint 0 transfer size register
OTG_HS_DIEPTSIZ0 : OTG_HS_DIEPTSIZ0_Register;
-- OTG_HS device endpoint-1 DMA address register
OTG_HS_DIEPDMA1 : HAL.Word;
-- OTG_HS device IN endpoint transmit FIFO status register
OTG_HS_DTXFSTS0 : OTG_HS_DTXFSTS_Register;
-- OTG device endpoint-1 control register
OTG_HS_DIEPCTL1 : OTG_HS_DIEPCTL_Register;
-- OTG device endpoint-1 interrupt register
OTG_HS_DIEPINT1 : OTG_HS_DIEPINT_Register;
-- OTG_HS device endpoint transfer size register
OTG_HS_DIEPTSIZ1 : OTG_HS_DIEPTSIZ_Register;
-- OTG_HS device endpoint-2 DMA address register
OTG_HS_DIEPDMA2 : HAL.Word;
-- OTG_HS device IN endpoint transmit FIFO status register
OTG_HS_DTXFSTS1 : OTG_HS_DTXFSTS_Register;
-- OTG device endpoint-2 control register
OTG_HS_DIEPCTL2 : OTG_HS_DIEPCTL_Register;
-- OTG device endpoint-2 interrupt register
OTG_HS_DIEPINT2 : OTG_HS_DIEPINT_Register;
-- OTG_HS device endpoint transfer size register
OTG_HS_DIEPTSIZ2 : OTG_HS_DIEPTSIZ_Register;
-- OTG_HS device endpoint-3 DMA address register
OTG_HS_DIEPDMA3 : HAL.Word;
-- OTG_HS device IN endpoint transmit FIFO status register
OTG_HS_DTXFSTS2 : OTG_HS_DTXFSTS_Register;
-- OTG device endpoint-3 control register
OTG_HS_DIEPCTL3 : OTG_HS_DIEPCTL_Register;
-- OTG device endpoint-3 interrupt register
OTG_HS_DIEPINT3 : OTG_HS_DIEPINT_Register;
-- OTG_HS device endpoint transfer size register
OTG_HS_DIEPTSIZ3 : OTG_HS_DIEPTSIZ_Register;
-- OTG_HS device endpoint-4 DMA address register
OTG_HS_DIEPDMA4 : HAL.Word;
-- OTG_HS device IN endpoint transmit FIFO status register
OTG_HS_DTXFSTS3 : OTG_HS_DTXFSTS_Register;
-- OTG device endpoint-4 control register
OTG_HS_DIEPCTL4 : OTG_HS_DIEPCTL_Register;
-- OTG device endpoint-4 interrupt register
OTG_HS_DIEPINT4 : OTG_HS_DIEPINT_Register;
-- OTG_HS device endpoint transfer size register
OTG_HS_DIEPTSIZ4 : OTG_HS_DIEPTSIZ_Register;
-- OTG_HS device endpoint-5 DMA address register
OTG_HS_DIEPDMA5 : HAL.Word;
-- OTG_HS device IN endpoint transmit FIFO status register
OTG_HS_DTXFSTS4 : OTG_HS_DTXFSTS_Register;
-- OTG device endpoint-5 control register
OTG_HS_DIEPCTL5 : OTG_HS_DIEPCTL_Register;
-- OTG device endpoint-5 interrupt register
OTG_HS_DIEPINT5 : OTG_HS_DIEPINT_Register;
-- OTG_HS device endpoint transfer size register
OTG_HS_DIEPTSIZ5 : OTG_HS_DIEPTSIZ_Register;
-- OTG_HS device IN endpoint transmit FIFO status register
OTG_HS_DTXFSTS5 : OTG_HS_DTXFSTS_Register;
-- OTG device endpoint-6 control register
OTG_HS_DIEPCTL6 : OTG_HS_DIEPCTL_Register;
-- OTG device endpoint-6 interrupt register
OTG_HS_DIEPINT6 : OTG_HS_DIEPINT_Register;
-- OTG device endpoint-7 control register
OTG_HS_DIEPCTL7 : OTG_HS_DIEPCTL_Register;
-- OTG device endpoint-7 interrupt register
OTG_HS_DIEPINT7 : OTG_HS_DIEPINT_Register;
-- OTG_HS device control OUT endpoint 0 control register
OTG_HS_DOEPCTL0 : OTG_HS_DOEPCTL0_Register;
-- OTG_HS device endpoint-0 interrupt register
OTG_HS_DOEPINT0 : OTG_HS_DOEPINT_Register;
-- OTG_HS device endpoint-1 transfer size register
OTG_HS_DOEPTSIZ0 : OTG_HS_DOEPTSIZ0_Register;
-- OTG device endpoint-1 control register
OTG_HS_DOEPCTL1 : OTG_HS_DOEPCTL_Register;
-- OTG_HS device endpoint-1 interrupt register
OTG_HS_DOEPINT1 : OTG_HS_DOEPINT_Register;
-- OTG_HS device endpoint-2 transfer size register
OTG_HS_DOEPTSIZ1 : OTG_HS_DOEPTSIZ_Register;
-- OTG device endpoint-2 control register
OTG_HS_DOEPCTL2 : OTG_HS_DOEPCTL_Register;
-- OTG_HS device endpoint-2 interrupt register
OTG_HS_DOEPINT2 : OTG_HS_DOEPINT_Register;
-- OTG_HS device endpoint-3 transfer size register
OTG_HS_DOEPTSIZ2 : OTG_HS_DOEPTSIZ_Register;
-- OTG device endpoint-3 control register
OTG_HS_DOEPCTL3 : OTG_HS_DOEPCTL_Register;
-- OTG_HS device endpoint-3 interrupt register
OTG_HS_DOEPINT3 : OTG_HS_DOEPINT_Register;
-- OTG_HS device endpoint-4 transfer size register
OTG_HS_DOEPTSIZ3 : OTG_HS_DOEPTSIZ_Register;
-- OTG_HS device endpoint-4 interrupt register
OTG_HS_DOEPINT4 : OTG_HS_DOEPINT_Register;
-- OTG_HS device endpoint-5 transfer size register
OTG_HS_DOEPTSIZ4 : OTG_HS_DOEPTSIZ_Register;
-- OTG_HS device endpoint-5 interrupt register
OTG_HS_DOEPINT5 : OTG_HS_DOEPINT_Register;
-- OTG_HS device endpoint-6 interrupt register
OTG_HS_DOEPINT6 : OTG_HS_DOEPINT_Register;
-- OTG_HS device endpoint-7 interrupt register
OTG_HS_DOEPINT7 : OTG_HS_DOEPINT_Register;
end record
with Volatile;
for OTG_HS_DEVICE_Peripheral use record
OTG_HS_DCFG at 0 range 0 .. 31;
OTG_HS_DCTL at 4 range 0 .. 31;
OTG_HS_DSTS at 8 range 0 .. 31;
OTG_HS_DIEPMSK at 16 range 0 .. 31;
OTG_HS_DOEPMSK at 20 range 0 .. 31;
OTG_HS_DAINT at 24 range 0 .. 31;
OTG_HS_DAINTMSK at 28 range 0 .. 31;
OTG_HS_DVBUSDIS at 40 range 0 .. 31;
OTG_HS_DVBUSPULSE at 44 range 0 .. 31;
OTG_HS_DTHRCTL at 48 range 0 .. 31;
OTG_HS_DIEPEMPMSK at 52 range 0 .. 31;
OTG_HS_DEACHINT at 56 range 0 .. 31;
OTG_HS_DEACHINTMSK at 60 range 0 .. 31;
OTG_HS_DIEPEACHMSK1 at 64 range 0 .. 31;
OTG_HS_DOEPEACHMSK1 at 128 range 0 .. 31;
OTG_HS_DIEPCTL0 at 256 range 0 .. 31;
OTG_HS_DIEPINT0 at 264 range 0 .. 31;
OTG_HS_DIEPTSIZ0 at 272 range 0 .. 31;
OTG_HS_DIEPDMA1 at 276 range 0 .. 31;
OTG_HS_DTXFSTS0 at 280 range 0 .. 31;
OTG_HS_DIEPCTL1 at 288 range 0 .. 31;
OTG_HS_DIEPINT1 at 296 range 0 .. 31;
OTG_HS_DIEPTSIZ1 at 304 range 0 .. 31;
OTG_HS_DIEPDMA2 at 308 range 0 .. 31;
OTG_HS_DTXFSTS1 at 312 range 0 .. 31;
OTG_HS_DIEPCTL2 at 320 range 0 .. 31;
OTG_HS_DIEPINT2 at 328 range 0 .. 31;
OTG_HS_DIEPTSIZ2 at 336 range 0 .. 31;
OTG_HS_DIEPDMA3 at 340 range 0 .. 31;
OTG_HS_DTXFSTS2 at 344 range 0 .. 31;
OTG_HS_DIEPCTL3 at 352 range 0 .. 31;
OTG_HS_DIEPINT3 at 360 range 0 .. 31;
OTG_HS_DIEPTSIZ3 at 368 range 0 .. 31;
OTG_HS_DIEPDMA4 at 372 range 0 .. 31;
OTG_HS_DTXFSTS3 at 376 range 0 .. 31;
OTG_HS_DIEPCTL4 at 384 range 0 .. 31;
OTG_HS_DIEPINT4 at 392 range 0 .. 31;
OTG_HS_DIEPTSIZ4 at 400 range 0 .. 31;
OTG_HS_DIEPDMA5 at 404 range 0 .. 31;
OTG_HS_DTXFSTS4 at 408 range 0 .. 31;
OTG_HS_DIEPCTL5 at 416 range 0 .. 31;
OTG_HS_DIEPINT5 at 424 range 0 .. 31;
OTG_HS_DIEPTSIZ5 at 432 range 0 .. 31;
OTG_HS_DTXFSTS5 at 440 range 0 .. 31;
OTG_HS_DIEPCTL6 at 448 range 0 .. 31;
OTG_HS_DIEPINT6 at 456 range 0 .. 31;
OTG_HS_DIEPCTL7 at 480 range 0 .. 31;
OTG_HS_DIEPINT7 at 488 range 0 .. 31;
OTG_HS_DOEPCTL0 at 768 range 0 .. 31;
OTG_HS_DOEPINT0 at 776 range 0 .. 31;
OTG_HS_DOEPTSIZ0 at 784 range 0 .. 31;
OTG_HS_DOEPCTL1 at 800 range 0 .. 31;
OTG_HS_DOEPINT1 at 808 range 0 .. 31;
OTG_HS_DOEPTSIZ1 at 816 range 0 .. 31;
OTG_HS_DOEPCTL2 at 832 range 0 .. 31;
OTG_HS_DOEPINT2 at 840 range 0 .. 31;
OTG_HS_DOEPTSIZ2 at 848 range 0 .. 31;
OTG_HS_DOEPCTL3 at 864 range 0 .. 31;
OTG_HS_DOEPINT3 at 872 range 0 .. 31;
OTG_HS_DOEPTSIZ3 at 880 range 0 .. 31;
OTG_HS_DOEPINT4 at 904 range 0 .. 31;
OTG_HS_DOEPTSIZ4 at 912 range 0 .. 31;
OTG_HS_DOEPINT5 at 936 range 0 .. 31;
OTG_HS_DOEPINT6 at 968 range 0 .. 31;
OTG_HS_DOEPINT7 at 1000 range 0 .. 31;
end record;
-- USB on the go high speed
OTG_HS_DEVICE_Periph : aliased OTG_HS_DEVICE_Peripheral
with Import, Address => OTG_HS_DEVICE_Base;
-- USB on the go high speed
type OTG_HS_PWRCLK_Peripheral is record
-- Power and clock gating control register
OTG_HS_PCGCR : OTG_HS_PCGCR_Register;
end record
with Volatile;
for OTG_HS_PWRCLK_Peripheral use record
OTG_HS_PCGCR at 0 range 0 .. 31;
end record;
-- USB on the go high speed
OTG_HS_PWRCLK_Periph : aliased OTG_HS_PWRCLK_Peripheral
with Import, Address => OTG_HS_PWRCLK_Base;
end STM32_SVD.USB_OTG_HS;
|
leo-brewin/adm-bssn-numerical | Ada | 3,185 | ads | package Support.Cmdline is
procedure get_command_arg
(the_arg_string : out String; -- the unprocessed argument i.e., -xfoo in -xfoo
which_arg : Integer); -- which argument
function get_command_arg
(which_arg : Integer; -- which argument
default : String) -- default
return String;
procedure put_command_args
(item : character;
value : string);
---------------------------------------------------------------------------------------------------------
procedure read_command_arg
(value : out Integer; -- the foo in -xfoo
found : out Boolean; -- did we find it?
target_flag : Character; -- the x in -xfoo
default : Integer := 0); -- default
procedure read_command_arg
(value : out Real; -- the foo in -xfoo
found : out Boolean; -- did we find it?
target_flag : Character; -- the x in -xfoo
default : Real := 0.0); -- default
procedure read_command_arg
(value : out String; -- the foo in -xfoo
found : out Boolean; -- did we find it?
target_flag : Character; -- the x in -xfoo
default : String := "null"); -- default
procedure read_command_arg
(value : out String; -- the foo in -xfoo
found : out Boolean; -- did we find it?
target_flag : Character; -- the x in -xfoo
default : Character := '?'); -- default
function read_command_arg
(target_flag : Character; -- the x in -xfoo
default : Integer := 0) -- default
return Integer;
function read_command_arg
(target_flag : Character; -- the x in -xfoo
default : Real := 0.0) -- default
return Real;
function read_command_arg
(target_flag : Character; -- the x in -xfoo
default : String := "null") -- default
return String;
function read_command_arg
(target_flag : Character; -- the x in -xfoo
default : Character := '?') -- default
return Character;
function find_command_arg (target_flag : Character) return boolean;
function num_command_args return integer; -- number of command line arguments like -i -o
function num_command_items return integer; -- number of command line arguments of any kind, foo bar -i -o
function echo_command_name return String; -- the command name without any arguments
function echo_command_line return String; -- the full command line
function echo_command_line_args return String; -- just the command line arguments
-- echo details to standard output
procedure echo_command_name; -- the command name without any arguments
procedure echo_command_line; -- the full command line
procedure echo_command_line_args; -- just the command line arguments
end Support.Cmdline;
|
stcarrez/ada-wiki | Ada | 4,876 | adb | -----------------------------------------------------------------------
-- words -- Extract words and links from a Wiki or HTML document
-- Copyright (C) 2016 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Text_IO;
with Ada.Wide_Wide_Text_IO;
with Ada.IO_Exceptions;
with GNAT.Command_Line;
with Wiki.Documents;
with Wiki.Parsers;
with Wiki.Streams.Text_IO;
with Wiki.Filters.Html;
with Wiki.Filters.Autolink;
with Wiki.Filters.Collectors;
procedure Words is
use GNAT.Command_Line;
procedure Usage;
procedure Print (Pos : in Wiki.Filters.Collectors.Cursor);
procedure Usage is
begin
Ada.Text_IO.Put_Line ("Report list of words or links used in a wiki text file or HTML file");
Ada.Text_IO.Put_Line ("Usage: words [-l] [-i] [-m] [-H] [-M] [-d] [-c] {wiki-file}");
Ada.Text_IO.Put_Line (" -l Report links instead of words");
Ada.Text_IO.Put_Line (" -i Report images instead of words");
Ada.Text_IO.Put_Line (" -m Parse a Markdown wiki content");
Ada.Text_IO.Put_Line (" -M Parse a Mediawiki wiki content");
Ada.Text_IO.Put_Line (" -d Parse a Dotclear wiki content");
Ada.Text_IO.Put_Line (" -g Parse a Google wiki content");
Ada.Text_IO.Put_Line (" -c Parse a Creole wiki content");
Ada.Text_IO.Put_Line (" -H Parse an HTML content");
end Usage;
procedure Print (Pos : in Wiki.Filters.Collectors.Cursor) is
Count : constant Natural := Wiki.Filters.Collectors.WString_Maps.Element (Pos);
begin
Ada.Wide_Wide_Text_IO.Put (Wiki.Filters.Collectors.WString_Maps.Key (Pos));
Ada.Wide_Wide_Text_IO.Put (" ");
Ada.Wide_Wide_Text_IO.Put_Line (Natural'Wide_Wide_Image (Count));
end Print;
Count : Natural := 0;
Syntax : Wiki.Wiki_Syntax := Wiki.SYNTAX_MARKDOWN;
Link_Mode : Boolean := False;
Image_Mode : Boolean := False;
Words : aliased Wiki.Filters.Collectors.Word_Collector_Type;
Links : aliased Wiki.Filters.Collectors.Link_Collector_Type;
Images : aliased Wiki.Filters.Collectors.Image_Collector_Type;
begin
loop
case Getopt ("m M H d c g l i") is
when 'm' =>
Syntax := Wiki.SYNTAX_MARKDOWN;
when 'M' =>
Syntax := Wiki.SYNTAX_MEDIA_WIKI;
when 'H' =>
Syntax := Wiki.SYNTAX_HTML;
when 'c' =>
Syntax := Wiki.SYNTAX_CREOLE;
when 'd' =>
Syntax := Wiki.SYNTAX_DOTCLEAR;
when 'g' =>
Syntax := Wiki.SYNTAX_GOOGLE;
when 'l' =>
Link_Mode := True;
when 'i' =>
Image_Mode := True;
when others =>
exit;
end case;
end loop;
loop
declare
Name : constant String := GNAT.Command_Line.Get_Argument;
Input : aliased Wiki.Streams.Text_IO.File_Input_Stream;
Filter : aliased Wiki.Filters.Html.Html_Filter_Type;
Autolink : aliased Wiki.Filters.Autolink.Autolink_Filter;
Doc : Wiki.Documents.Document;
Engine : Wiki.Parsers.Parser;
begin
if Name = "" then
if Count = 0 then
Usage;
end if;
exit;
end if;
Count := Count + 1;
-- Open the file and parse it (assume UTF-8).
Input.Open (Name, "WCEM=8");
Engine.Add_Filter (Words'Unchecked_Access);
Engine.Add_Filter (Links'Unchecked_Access);
Engine.Add_Filter (Images'Unchecked_Access);
Engine.Add_Filter (Filter'Unchecked_Access);
Engine.Add_Filter (Autolink'Unchecked_Access);
Engine.Set_Syntax (Syntax);
Engine.Parse (Input'Unchecked_Access, Doc);
exception
when Ada.IO_Exceptions.Name_Error =>
Ada.Text_IO.Put_Line ("Cannot read file '" & Name & "'");
end;
end loop;
if Image_Mode then
Images.Iterate (Print'Access);
elsif Link_Mode then
Links.Iterate (Print'Access);
else
Words.Iterate (Print'Access);
end if;
exception
when Invalid_Switch =>
Ada.Text_IO.Put_Line ("Invalid option.");
Usage;
end Words;
|
apple-oss-distributions/old_ncurses | Ada | 4,129 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Panels.User_Data --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 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: Juergen Pfeifer <[email protected]> 1996
-- Version Control:
-- $Revision: 1.1.1.1 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Interfaces.C;
with Terminal_Interface.Curses.Aux;
use Terminal_Interface.Curses.Aux;
with Terminal_Interface.Curses.Panels;
use Terminal_Interface.Curses.Panels;
package body Terminal_Interface.Curses.Panels.User_Data is
use type Interfaces.C.int;
procedure Set_User_Data (Pan : in Panel;
Data : in User_Access)
is
function Set_Panel_Userptr (Pan : Panel;
Addr : User_Access) return C_Int;
pragma Import (C, Set_Panel_Userptr, "set_panel_userptr");
begin
if Set_Panel_Userptr (Pan, Data) = Curses_Err then
raise Panel_Exception;
end if;
end Set_User_Data;
function Get_User_Data (Pan : in Panel) return User_Access
is
function Panel_Userptr (Pan : Panel) return User_Access;
pragma Import (C, Panel_Userptr, "panel_userptr");
begin
return Panel_Userptr (Pan);
end Get_User_Data;
procedure Get_User_Data (Pan : in Panel;
Data : out User_Access)
is
begin
Data := Get_User_Data (Pan);
end Get_User_Data;
end Terminal_Interface.Curses.Panels.User_Data;
|
msrLi/portingSources | Ada | 800 | ads | -- Copyright 2011-2014 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with System;
package Pck is
procedure Do_Nothing (A : System.Address);
end Pck;
|
jscparker/math_packages | Ada | 7,067 | ads |
generic
type Real is digits <>;
package pc_2_coeff_22 is
subtype PC_Rule_Range is Integer range 0..31;
type Integration_Rule is array(PC_Rule_Range) of Real;
Starting_Id_of_First_Deriv_of_Y : constant PC_Rule_Range := 15;
-- Center_Integration Rule, applied to (d/dt)**2 Y, takes a dY/dt here, and
-- Integrates it one indice forward.
Extrap_Factor: constant Real := 1.0 / 24.0; -- val unknown
Corrector_33_22 : constant Integration_Rule :=
(
-8.02130559997354078604776522542254439E-4,
1.24416532870088974691741276214884268E-2,
-8.64795984660665687642672166948211787E-2,
3.50230302101274679029708692614152597E-1,
-8.91121460953578667337715179019697046E-1,
1.39383153917014648240732079853746142E+0,
-1.07121283818712541646971756034689810E+0,
-2.97295767060760759428837790575625762E-1,
1.28052482910646884772471445763110385E+0,
-3.48796383077358912539756432632846449E-1,
-1.18323146225282708847281583111056865E+0,
6.13830360683718379636023405051540400E-1,
1.15669753037498753526808006354467904E+0,
-6.94338273293159923319315200784758205E-1,
-1.25077139904584256785139807653322816E+0,
7.20794822429374825729635224538098316E-1,
1.77492750390194010614093059728166958E+0,
3.48406301508706280013183366668745917E-1,
-3.24702653757985544407247498269540941E-1,
1.55113657266486316345543277158075854E+0,
2.51118592351726418774359026068146849E+0,
3.82957536377735794971423254482703827E-1,
-6.54923221588828602513601179436160298E-1,
1.98098310154670126300578248795171698E+0,
2.62677613787930934327036702584321002E+0,
-8.86789566789142290186373972323935862E-1,
2.85598769943888482178532669984860663E-1,
4.02778278621156389145728011748586155E+0,
-2.15859907174040020406160913348832844E+0,
2.94403131132369272781778743704178050E+0,
2.00939488060088412087622634816136813E-1,
1.13310419806709432866152258587289993E+0
);
Final_Step_Corrector_33_22 : constant Real
:= 5.28831586172462713631478685086144395E-2;
Predictor_31_22 : constant Integration_Rule :=
(
0.0,
3.82206142445544963446204148715951607E-2,
-6.33908224331091016776700383111987143E-1,
4.77108082172046540302262546600367877E+0,
-2.13112230306056104385071748550271682E+1,
6.16394218004587635365556288368891905E+1,
-1.16455265845403402132194278236324202E+2,
1.31160078589256480618203936959714671E+2,
-4.73620760128097778046470502754138483E+1,
-8.61155833650963992491864075194045219E+1,
1.09596202456069853887869187577271935E+2,
2.70006891539818698623550090779730573E+1,
-1.23689026778934313461788121734000576E+2,
1.26308792943455875969362146348904466E+1,
1.25351440983592524456909109664479950E+2,
-3.90915067214200967699893349056174838E+1,
-1.25005696132419709068005825586513917E+2,
6.31400058836348955981727456733231437E+1,
1.25202212204700030730203205988430657E+2,
-9.01202664128768808476121572162738365E+1,
-1.13346070602251991153852098206722707E+2,
1.35832428576795315596340908178178692E+2,
7.65648954748416679820099605596069319E+1,
-1.90778807698391251633999872762198544E+2,
4.29249448929317005301844046601429694E+1,
1.90302308174625292773031958813598645E+2,
-2.76219723414219806259983408912758259E+2,
2.10878867270091505775711508404456506E+2,
-1.02199587368891636464946651890028622E+2,
3.55597890257171711903655577067406769E+1,
-6.79799476949725817083394168801447862E+0,
2.03327116014154443810644155483740520E+0
);
Center_Integration_32_22 : constant Integration_Rule :=
(
-5.48186298516234652810704051430422655E-6,
9.83867415088779031208187158666710319E-5,
-8.07566491514156651234056438130100106E-4,
3.97340757417976466081704231342063697E-3,
-1.28356892096129410337836800376618841E-2,
2.76864991077874453604989378001785406E-2,
-3.73245825355348862199480292460505598E-2,
2.12653218023217359291463822190892211E-2,
2.13745306335366393296921989209611924E-2,
-4.56656788294881115637614729100805322E-2,
3.89437307673685355200946981995831816E-3,
6.22684247056539251232690828593738376E-2,
-3.61385003611128933128201417801336908E-2,
-9.55657510587708441101932722470146491E-2,
1.33596784912141525960540060966517392E-1,
4.54185521795152227419174766084219910E-1,
4.54185521795152227419174766084219910E-1,
1.33596784912141525960540060966517392E-1,
-9.55657510587708441101932722470146491E-2,
-3.61385003611128933128201417801336908E-2,
6.22684247056539251232690828593738376E-2,
3.89437307673685355200946981995831816E-3,
-4.56656788294881115637614729100805322E-2,
2.13745306335366393296921989209611924E-2,
2.12653218023217359291463822190892211E-2,
-3.73245825355348862199480292460505598E-2,
2.76864991077874453604989378001785406E-2,
-1.28356892096129410337836800376618841E-2,
3.97340757417976466081704231342063697E-3,
-8.07566491514156651234056438130100106E-4,
9.83867415088779031208187158666710319E-5,
-5.48186298516234652810704051430422655E-6
);
Center_to_End_Integration_32_22 : constant Integration_Rule :=
(
-2.46055400745919258120729405349163691E-3,
3.94937734266237896046990985820173913E-2,
-2.85924604814419907317339235057302237E-1,
1.21775236041835015679281022068507655E+0,
-3.31119345468907190517628700742888269E+0,
5.72250882622795112186390828443613906E+0,
-5.45219585821552065525673442095904352E+0,
4.67487319274695445937703915277492695E-1,
5.04181007527642399830645261263436520E+0,
-3.55919391785093453217583112024140353E+0,
-3.53127580678341307884535450947182606E+0,
4.78039107137706694005293349536141932E+0,
2.58127452529930794024644881912956886E+0,
-5.38383054354341648182107088309022155E+0,
-2.14665605885624873975943985055075865E+0,
6.20637871667093544879506276387734096E+0,
3.05624946842682355808916099018747109E+0,
-5.09128384721184624337245342432563704E+0,
-9.81525574395439526528573186007045599E-1,
7.83552753870215262539576158282298399E+0,
2.35174419853373730752706320570413064E+0,
-6.89285619244306859389417799474804191E+0,
1.68408438510945988767883644031839272E+0,
9.80602637995232916495184306214695197E+0,
-4.76910099297560210294927249411766282E+0,
-5.10257080894008187297314868283199883E+0,
1.47380098655089154766482408672545751E+1,
-1.15093206885050787659302691253911179E+1,
8.20228332093864178792515819652974703E+0,
-1.94051634824961325307374327575866262E+0,
1.97652535686240736364681749381366289E+0,
2.52358069475392838192001455271761107E-1
);
Center_to_End_Integration
: Integration_Rule renames Center_to_End_Integration_32_22;
Predictor_Rule : Integration_Rule renames Predictor_31_22;
Corrector_Rule : Integration_Rule renames Corrector_33_22;
Center_Integration : Integration_Rule renames Center_Integration_32_22;
Final_Step_Corrector : Real renames Final_Step_Corrector_33_22;
end pc_2_coeff_22;
|
sungyeon/drake | Ada | 118 | ads | pragma License (Unrestricted);
with Ada.Text_IO;
package Ada.Long_Float_Text_IO is new Text_IO.Float_IO (Long_Float);
|
charlie5/cBound | Ada | 1,789 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_selection_request_event_t is
-- Item
--
type Item is record
response_type : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
sequence : aliased Interfaces.Unsigned_16;
time : aliased xcb.xcb_timestamp_t;
owner : aliased xcb.xcb_window_t;
requestor : aliased xcb.xcb_window_t;
selection : aliased xcb.xcb_atom_t;
target : aliased xcb.xcb_atom_t;
property : aliased xcb.xcb_atom_t;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_selection_request_event_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_selection_request_event_t.Item,
Element_Array => xcb.xcb_selection_request_event_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_selection_request_event_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_selection_request_event_t.Pointer,
Element_Array => xcb.xcb_selection_request_event_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_selection_request_event_t;
|
reznikmm/matreshka | Ada | 4,073 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Anim_Color_Interpolation_Attributes;
package Matreshka.ODF_Anim.Color_Interpolation_Attributes is
type Anim_Color_Interpolation_Attribute_Node is
new Matreshka.ODF_Anim.Abstract_Anim_Attribute_Node
and ODF.DOM.Anim_Color_Interpolation_Attributes.ODF_Anim_Color_Interpolation_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Anim_Color_Interpolation_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Anim_Color_Interpolation_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Anim.Color_Interpolation_Attributes;
|
charlie5/lace | Ada | 151 | ads | with
any_Math.any_Geometry.any_d3;
package float_math.Geometry.d3 is new float_Math.Geometry.any_d3;
pragma Pure (float_math.Geometry.d3);
|
io7m/coreland-vector-ada | Ada | 1,982 | adb | with ada.text_io;
with vector;
with vector.sub;
procedure sub_double is
package io renames ada.text_io;
package v16 is new vector (16);
package v16_sub is new v16.sub;
use type v16.scalar_d_t;
base_a : constant v16.vector_d_t := (others => 10.0);
base_b : constant v16.vector_d_t := (others => 5.0);
base_r : v16.vector_d_t := (others => 5.0);
testno : integer := 0;
procedure sys_exit (e: integer);
pragma import (c, sys_exit, "exit");
procedure fail (want, got : v16.scalar_d_t; index: integer) is
s_tnum : constant string := integer'image (testno);
s_index : constant string := integer'image (index);
s_want : constant string := v16.scalar_d_t'image (want);
s_got : constant string := v16.scalar_d_t'image (got);
begin
io.put_line ("[" & s_tnum & "][" & s_index & "] fail " & s_want & " /= " & s_got);
sys_exit (1);
end fail;
procedure pass (want, got : v16.scalar_d_t; index: integer) is
s_tnum : constant string := integer'image (testno);
s_index : constant string := integer'image (index);
s_want : constant string := v16.scalar_d_t'image (want);
s_got : constant string := v16.scalar_d_t'image (got);
begin
io.put_line ("[" & s_tnum & "][" & s_index & "] " & s_want & " = " & s_got);
end pass;
procedure check (vec : v16.vector_d_t) is
begin
for index in vec'range loop
if vec (index) /= base_r (index) then
fail (want => base_r (index), got => vec (index), index => index);
else
pass (want => base_r (index), got => vec (index), index => index);
end if;
end loop;
testno := testno + 1;
end check;
begin
--
-- sub, in place
--
declare
tmp_a : v16.vector_d_t := base_a;
begin
v16_sub.d (tmp_a, base_b);
check (tmp_a);
end;
--
-- sub, external storage
--
declare
tmp_a : v16.vector_d_t := base_a;
begin
v16_sub.d_ext (base_a, base_b, tmp_a);
check (tmp_a);
end;
end sub_double;
|
AdaCore/ada-traits-containers | Ada | 1,105 | ads | --
-- Copyright (C) 2016-2017, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--
-- This package describes the concept of property models. They are used to
-- annotate containers. Models of a map are sequences of elements indexed
-- by a discrete type. For ease of use, the content models property is
-- instantiated in the spark version of containers.
pragma Ada_2012;
package Conts.Properties.SPARK is
-----------------------------
-- Property content models --
-----------------------------
generic
type Map_Type (<>) is limited private;
type Element_Type (<>) is private;
type Model_Type is private;
type Index_Type is (<>);
with function Model (M : Map_Type) return Model_Type;
with function Get (M : Model_Type; I : Index_Type) return Element_Type;
with function First return Index_Type;
with function Last (M : Model_Type) return Index_Type;
package Content_Models with Ghost is
subtype Map is Map_Type;
subtype Element is Element_Type;
end Content_Models;
end Conts.Properties.SPARK;
|
AdaCore/libadalang | Ada | 4,964 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . T R A C E B A C K --
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- 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. --
-- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
with System.Machine_Code; use System.Machine_Code;
-- This is the bare board version of this package for PowerPC targets
package body System.Traceback is
procedure Call_Chain
(Traceback : in out System.Traceback_Entries.Tracebacks_Array;
Max_Len : Natural;
Len : out Natural;
Exclude_Min : System.Address := System.Null_Address;
Exclude_Max : System.Address := System.Null_Address;
Skip_Frames : Natural := 1)
is
type PPC_Stack_Frame;
-- Layout of the PowerPC stack frame, according to the ELF ABI
type PPC_Stack_Frame_Acc is access PPC_Stack_Frame;
pragma Convention (C, PPC_Stack_Frame_Acc);
type PPC_Stack_Frame is record
Back_Chain : PPC_Stack_Frame_Acc;
-- Pointer to previous frame
Saved_LR : System.Address;
-- LR save word
end record;
pragma Convention (C, PPC_Stack_Frame);
Frame : PPC_Stack_Frame_Acc;
-- Frame being processed
LR : System.Address;
-- Link register (return address)
Last : Integer := Traceback'First - 1;
-- Index of last traceback entry written to the buffer
function builtin_frame_address
(Level : Integer) return PPC_Stack_Frame_Acc;
pragma Import
(Intrinsic, builtin_frame_address, "__builtin_frame_address");
begin
-- We haven't filled any entry so far:
Len := 0;
-- Fetch pointer to the current frame:
Frame := builtin_frame_address (0);
-- Skip the current frame
Frame := Frame.Back_Chain;
-- Exclude Skip_Frames frames from the traceback. ABI has
-- System.Null_Address as the back pointer of the shallowest frame in
-- the stack.
for J in 1 .. Skip_Frames loop
Frame := Frame.Back_Chain;
LR := Frame.Saved_LR;
if LR = System.Null_Address or else Frame = null then
-- Something is wrong. Skip_Frames is greater than the number of
-- frames on the current stack. Do not return a trace.
return;
end if;
end loop;
while Frame /= null
and then Last < Traceback'Last
and then Len < Max_Len
loop
if LR not in Exclude_Min .. Exclude_Max then
-- Skip specified routines, if any (e.g. Ada.Exceptions)
Last := Last + 1;
Len := Len + 1;
Traceback (Last) := LR;
end if;
Frame := Frame.Back_Chain;
LR := Frame.Saved_LR;
end loop;
end Call_Chain;
end System.Traceback;
|
reznikmm/matreshka | Ada | 17,604 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Elements;
with AMF.Internals.Element_Collections;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.UML_Attributes;
with AMF.Visitors.UML_Iterators;
with AMF.Visitors.UML_Visitors;
with League.Strings.Internals;
with Matreshka.Internals.Strings;
package body AMF.Internals.UML_Deployments is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Deployment_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Enter_Deployment
(AMF.UML.Deployments.UML_Deployment_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Deployment_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Leave_Deployment
(AMF.UML.Deployments.UML_Deployment_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Deployment_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then
AMF.Visitors.UML_Iterators.UML_Iterator'Class
(Iterator).Visit_Deployment
(Visitor,
AMF.UML.Deployments.UML_Deployment_Access (Self),
Control);
end if;
end Visit_Element;
-----------------------
-- Get_Configuration --
-----------------------
overriding function Get_Configuration
(Self : not null access constant UML_Deployment_Proxy)
return AMF.UML.Deployment_Specifications.Collections.Set_Of_UML_Deployment_Specification is
begin
return
AMF.UML.Deployment_Specifications.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Configuration
(Self.Element)));
end Get_Configuration;
---------------------------
-- Get_Deployed_Artifact --
---------------------------
overriding function Get_Deployed_Artifact
(Self : not null access constant UML_Deployment_Proxy)
return AMF.UML.Deployed_Artifacts.Collections.Set_Of_UML_Deployed_Artifact is
begin
return
AMF.UML.Deployed_Artifacts.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Deployed_Artifact
(Self.Element)));
end Get_Deployed_Artifact;
------------------
-- Get_Location --
------------------
overriding function Get_Location
(Self : not null access constant UML_Deployment_Proxy)
return AMF.UML.Deployment_Targets.UML_Deployment_Target_Access is
begin
return
AMF.UML.Deployment_Targets.UML_Deployment_Target_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Location
(Self.Element)));
end Get_Location;
------------------
-- Set_Location --
------------------
overriding procedure Set_Location
(Self : not null access UML_Deployment_Proxy;
To : AMF.UML.Deployment_Targets.UML_Deployment_Target_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Location
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Location;
----------------
-- Get_Client --
----------------
overriding function Get_Client
(Self : not null access constant UML_Deployment_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
return
AMF.UML.Named_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Client
(Self.Element)));
end Get_Client;
------------------
-- Get_Supplier --
------------------
overriding function Get_Supplier
(Self : not null access constant UML_Deployment_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
return
AMF.UML.Named_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Supplier
(Self.Element)));
end Get_Supplier;
----------------
-- Get_Source --
----------------
overriding function Get_Source
(Self : not null access constant UML_Deployment_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
return
AMF.UML.Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Source
(Self.Element)));
end Get_Source;
----------------
-- Get_Target --
----------------
overriding function Get_Target
(Self : not null access constant UML_Deployment_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
return
AMF.UML.Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Target
(Self.Element)));
end Get_Target;
-------------------------
-- Get_Related_Element --
-------------------------
overriding function Get_Related_Element
(Self : not null access constant UML_Deployment_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
return
AMF.UML.Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Related_Element
(Self.Element)));
end Get_Related_Element;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Deployment_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
begin
return
AMF.UML.Dependencies.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
(Self.Element)));
end Get_Client_Dependency;
-------------------------
-- Get_Name_Expression --
-------------------------
overriding function Get_Name_Expression
(Self : not null access constant UML_Deployment_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access is
begin
return
AMF.UML.String_Expressions.UML_String_Expression_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
(Self.Element)));
end Get_Name_Expression;
-------------------------
-- Set_Name_Expression --
-------------------------
overriding procedure Set_Name_Expression
(Self : not null access UML_Deployment_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Name_Expression;
-------------------
-- Get_Namespace --
-------------------
overriding function Get_Namespace
(Self : not null access constant UML_Deployment_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
return
AMF.UML.Namespaces.UML_Namespace_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
(Self.Element)));
end Get_Namespace;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant UML_Deployment_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Qualified_Name;
-----------------------------------
-- Get_Owning_Template_Parameter --
-----------------------------------
overriding function Get_Owning_Template_Parameter
(Self : not null access constant UML_Deployment_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter
(Self.Element)));
end Get_Owning_Template_Parameter;
-----------------------------------
-- Set_Owning_Template_Parameter --
-----------------------------------
overriding procedure Set_Owning_Template_Parameter
(Self : not null access UML_Deployment_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owning_Template_Parameter;
----------------------------
-- Get_Template_Parameter --
----------------------------
overriding function Get_Template_Parameter
(Self : not null access constant UML_Deployment_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter
(Self.Element)));
end Get_Template_Parameter;
----------------------------
-- Set_Template_Parameter --
----------------------------
overriding procedure Set_Template_Parameter
(Self : not null access UML_Deployment_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Template_Parameter;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Deployment_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
raise Program_Error with "Unimplemented procedure UML_Deployment_Proxy.All_Owning_Packages";
return All_Owning_Packages (Self);
end All_Owning_Packages;
-----------------------------
-- Is_Distinguishable_From --
-----------------------------
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Deployment_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
raise Program_Error with "Unimplemented procedure UML_Deployment_Proxy.Is_Distinguishable_From";
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
---------------
-- Namespace --
---------------
overriding function Namespace
(Self : not null access constant UML_Deployment_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
raise Program_Error with "Unimplemented procedure UML_Deployment_Proxy.Namespace";
return Namespace (Self);
end Namespace;
------------------------
-- Is_Compatible_With --
------------------------
overriding function Is_Compatible_With
(Self : not null access constant UML_Deployment_Proxy;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Deployment_Proxy.Is_Compatible_With";
return Is_Compatible_With (Self, P);
end Is_Compatible_With;
---------------------------
-- Is_Template_Parameter --
---------------------------
overriding function Is_Template_Parameter
(Self : not null access constant UML_Deployment_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented");
raise Program_Error with "Unimplemented procedure UML_Deployment_Proxy.Is_Template_Parameter";
return Is_Template_Parameter (Self);
end Is_Template_Parameter;
end AMF.Internals.UML_Deployments;
|
reznikmm/matreshka | Ada | 45,996 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Elements;
with AMF.Internals.Element_Collections;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.UML_Attributes;
with AMF.Visitors.UML_Iterators;
with AMF.Visitors.UML_Visitors;
with League.Strings.Internals;
with Matreshka.Internals.Strings;
package body AMF.Internals.UML_Communication_Paths is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Communication_Path_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Enter_Communication_Path
(AMF.UML.Communication_Paths.UML_Communication_Path_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Communication_Path_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Leave_Communication_Path
(AMF.UML.Communication_Paths.UML_Communication_Path_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Communication_Path_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then
AMF.Visitors.UML_Iterators.UML_Iterator'Class
(Iterator).Visit_Communication_Path
(Visitor,
AMF.UML.Communication_Paths.UML_Communication_Path_Access (Self),
Control);
end if;
end Visit_Element;
------------------
-- Get_End_Type --
------------------
overriding function Get_End_Type
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Types.Collections.Ordered_Set_Of_UML_Type is
begin
return
AMF.UML.Types.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_End_Type
(Self.Element)));
end Get_End_Type;
--------------------
-- Get_Is_Derived --
--------------------
overriding function Get_Is_Derived
(Self : not null access constant UML_Communication_Path_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Derived
(Self.Element);
end Get_Is_Derived;
--------------------
-- Set_Is_Derived --
--------------------
overriding procedure Set_Is_Derived
(Self : not null access UML_Communication_Path_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Derived
(Self.Element, To);
end Set_Is_Derived;
--------------------
-- Get_Member_End --
--------------------
overriding function Get_Member_End
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property is
begin
return
AMF.UML.Properties.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Member_End
(Self.Element)));
end Get_Member_End;
-----------------------------
-- Get_Navigable_Owned_End --
-----------------------------
overriding function Get_Navigable_Owned_End
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Properties.Collections.Set_Of_UML_Property is
begin
return
AMF.UML.Properties.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Navigable_Owned_End
(Self.Element)));
end Get_Navigable_Owned_End;
-------------------
-- Get_Owned_End --
-------------------
overriding function Get_Owned_End
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property is
begin
return
AMF.UML.Properties.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_End
(Self.Element)));
end Get_Owned_End;
-------------------------
-- Get_Related_Element --
-------------------------
overriding function Get_Related_Element
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
return
AMF.UML.Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Related_Element
(Self.Element)));
end Get_Related_Element;
-------------------
-- Get_Attribute --
-------------------
overriding function Get_Attribute
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Properties.Collections.Set_Of_UML_Property is
begin
return
AMF.UML.Properties.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Attribute
(Self.Element)));
end Get_Attribute;
---------------------------
-- Get_Collaboration_Use --
---------------------------
overriding function Get_Collaboration_Use
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Collaboration_Uses.Collections.Set_Of_UML_Collaboration_Use is
begin
return
AMF.UML.Collaboration_Uses.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Collaboration_Use
(Self.Element)));
end Get_Collaboration_Use;
-----------------
-- Get_Feature --
-----------------
overriding function Get_Feature
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Features.Collections.Set_Of_UML_Feature is
begin
return
AMF.UML.Features.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Feature
(Self.Element)));
end Get_Feature;
-----------------
-- Get_General --
-----------------
overriding function Get_General
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_General
(Self.Element)));
end Get_General;
------------------------
-- Get_Generalization --
------------------------
overriding function Get_Generalization
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization is
begin
return
AMF.UML.Generalizations.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Generalization
(Self.Element)));
end Get_Generalization;
--------------------------
-- Get_Inherited_Member --
--------------------------
overriding function Get_Inherited_Member
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
return
AMF.UML.Named_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Inherited_Member
(Self.Element)));
end Get_Inherited_Member;
---------------------
-- Get_Is_Abstract --
---------------------
overriding function Get_Is_Abstract
(Self : not null access constant UML_Communication_Path_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Abstract
(Self.Element);
end Get_Is_Abstract;
---------------------------------
-- Get_Is_Final_Specialization --
---------------------------------
overriding function Get_Is_Final_Specialization
(Self : not null access constant UML_Communication_Path_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Final_Specialization
(Self.Element);
end Get_Is_Final_Specialization;
---------------------------------
-- Set_Is_Final_Specialization --
---------------------------------
overriding procedure Set_Is_Final_Specialization
(Self : not null access UML_Communication_Path_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Final_Specialization
(Self.Element, To);
end Set_Is_Final_Specialization;
----------------------------------
-- Get_Owned_Template_Signature --
----------------------------------
overriding function Get_Owned_Template_Signature
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access is
begin
return
AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Template_Signature
(Self.Element)));
end Get_Owned_Template_Signature;
----------------------------------
-- Set_Owned_Template_Signature --
----------------------------------
overriding procedure Set_Owned_Template_Signature
(Self : not null access UML_Communication_Path_Proxy;
To : AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Template_Signature
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owned_Template_Signature;
------------------------
-- Get_Owned_Use_Case --
------------------------
overriding function Get_Owned_Use_Case
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is
begin
return
AMF.UML.Use_Cases.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Use_Case
(Self.Element)));
end Get_Owned_Use_Case;
--------------------------
-- Get_Powertype_Extent --
--------------------------
overriding function Get_Powertype_Extent
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Generalization_Sets.Collections.Set_Of_UML_Generalization_Set is
begin
return
AMF.UML.Generalization_Sets.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Powertype_Extent
(Self.Element)));
end Get_Powertype_Extent;
------------------------------
-- Get_Redefined_Classifier --
------------------------------
overriding function Get_Redefined_Classifier
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Classifier
(Self.Element)));
end Get_Redefined_Classifier;
------------------------
-- Get_Representation --
------------------------
overriding function Get_Representation
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access is
begin
return
AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Representation
(Self.Element)));
end Get_Representation;
------------------------
-- Set_Representation --
------------------------
overriding procedure Set_Representation
(Self : not null access UML_Communication_Path_Proxy;
To : AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Representation
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Representation;
----------------------
-- Get_Substitution --
----------------------
overriding function Get_Substitution
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Substitutions.Collections.Set_Of_UML_Substitution is
begin
return
AMF.UML.Substitutions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Substitution
(Self.Element)));
end Get_Substitution;
----------------------------
-- Get_Template_Parameter --
----------------------------
overriding function Get_Template_Parameter
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access is
begin
return
AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter
(Self.Element)));
end Get_Template_Parameter;
----------------------------
-- Set_Template_Parameter --
----------------------------
overriding procedure Set_Template_Parameter
(Self : not null access UML_Communication_Path_Proxy;
To : AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Template_Parameter;
------------------
-- Get_Use_Case --
------------------
overriding function Get_Use_Case
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is
begin
return
AMF.UML.Use_Cases.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Use_Case
(Self.Element)));
end Get_Use_Case;
------------------------
-- Get_Element_Import --
------------------------
overriding function Get_Element_Import
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import is
begin
return
AMF.UML.Element_Imports.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Element_Import
(Self.Element)));
end Get_Element_Import;
-------------------------
-- Get_Imported_Member --
-------------------------
overriding function Get_Imported_Member
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
begin
return
AMF.UML.Packageable_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Imported_Member
(Self.Element)));
end Get_Imported_Member;
----------------
-- Get_Member --
----------------
overriding function Get_Member
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
return
AMF.UML.Named_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Member
(Self.Element)));
end Get_Member;
----------------------
-- Get_Owned_Member --
----------------------
overriding function Get_Owned_Member
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
return
AMF.UML.Named_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Member
(Self.Element)));
end Get_Owned_Member;
--------------------
-- Get_Owned_Rule --
--------------------
overriding function Get_Owned_Rule
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Rule
(Self.Element)));
end Get_Owned_Rule;
------------------------
-- Get_Package_Import --
------------------------
overriding function Get_Package_Import
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import is
begin
return
AMF.UML.Package_Imports.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Package_Import
(Self.Element)));
end Get_Package_Import;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
begin
return
AMF.UML.Dependencies.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
(Self.Element)));
end Get_Client_Dependency;
-------------------------
-- Get_Name_Expression --
-------------------------
overriding function Get_Name_Expression
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access is
begin
return
AMF.UML.String_Expressions.UML_String_Expression_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
(Self.Element)));
end Get_Name_Expression;
-------------------------
-- Set_Name_Expression --
-------------------------
overriding procedure Set_Name_Expression
(Self : not null access UML_Communication_Path_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Name_Expression;
-------------------
-- Get_Namespace --
-------------------
overriding function Get_Namespace
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
return
AMF.UML.Namespaces.UML_Namespace_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
(Self.Element)));
end Get_Namespace;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Qualified_Name;
-----------------
-- Get_Package --
-----------------
overriding function Get_Package
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Packages.UML_Package_Access is
begin
return
AMF.UML.Packages.UML_Package_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Package
(Self.Element)));
end Get_Package;
-----------------
-- Set_Package --
-----------------
overriding procedure Set_Package
(Self : not null access UML_Communication_Path_Proxy;
To : AMF.UML.Packages.UML_Package_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Package
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Package;
-----------------------------------
-- Get_Owning_Template_Parameter --
-----------------------------------
overriding function Get_Owning_Template_Parameter
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter
(Self.Element)));
end Get_Owning_Template_Parameter;
-----------------------------------
-- Set_Owning_Template_Parameter --
-----------------------------------
overriding procedure Set_Owning_Template_Parameter
(Self : not null access UML_Communication_Path_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owning_Template_Parameter;
----------------------------
-- Get_Template_Parameter --
----------------------------
overriding function Get_Template_Parameter
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter
(Self.Element)));
end Get_Template_Parameter;
----------------------------
-- Set_Template_Parameter --
----------------------------
overriding procedure Set_Template_Parameter
(Self : not null access UML_Communication_Path_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Template_Parameter;
----------------------------------
-- Get_Owned_Template_Signature --
----------------------------------
overriding function Get_Owned_Template_Signature
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Template_Signatures.UML_Template_Signature_Access is
begin
return
AMF.UML.Template_Signatures.UML_Template_Signature_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Template_Signature
(Self.Element)));
end Get_Owned_Template_Signature;
----------------------------------
-- Set_Owned_Template_Signature --
----------------------------------
overriding procedure Set_Owned_Template_Signature
(Self : not null access UML_Communication_Path_Proxy;
To : AMF.UML.Template_Signatures.UML_Template_Signature_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Template_Signature
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owned_Template_Signature;
--------------------------
-- Get_Template_Binding --
--------------------------
overriding function Get_Template_Binding
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding is
begin
return
AMF.UML.Template_Bindings.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Binding
(Self.Element)));
end Get_Template_Binding;
-----------------
-- Get_Is_Leaf --
-----------------
overriding function Get_Is_Leaf
(Self : not null access constant UML_Communication_Path_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf
(Self.Element);
end Get_Is_Leaf;
-----------------
-- Set_Is_Leaf --
-----------------
overriding procedure Set_Is_Leaf
(Self : not null access UML_Communication_Path_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf
(Self.Element, To);
end Set_Is_Leaf;
---------------------------
-- Get_Redefined_Element --
---------------------------
overriding function Get_Redefined_Element
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is
begin
return
AMF.UML.Redefinable_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element
(Self.Element)));
end Get_Redefined_Element;
------------------------------
-- Get_Redefinition_Context --
------------------------------
overriding function Get_Redefinition_Context
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context
(Self.Element)));
end Get_Redefinition_Context;
--------------
-- End_Type --
--------------
overriding function End_Type
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Types.Collections.Ordered_Set_Of_UML_Type is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "End_Type unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.End_Type";
return End_Type (Self);
end End_Type;
------------------
-- All_Features --
------------------
overriding function All_Features
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Features.Collections.Set_Of_UML_Feature is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Features unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.All_Features";
return All_Features (Self);
end All_Features;
-----------------
-- Conforms_To --
-----------------
overriding function Conforms_To
(Self : not null access constant UML_Communication_Path_Proxy;
Other : AMF.UML.Classifiers.UML_Classifier_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Conforms_To";
return Conforms_To (Self, Other);
end Conforms_To;
-------------
-- General --
-------------
overriding function General
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "General unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.General";
return General (Self);
end General;
-----------------------
-- Has_Visibility_Of --
-----------------------
overriding function Has_Visibility_Of
(Self : not null access constant UML_Communication_Path_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Has_Visibility_Of unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Has_Visibility_Of";
return Has_Visibility_Of (Self, N);
end Has_Visibility_Of;
-------------
-- Inherit --
-------------
overriding function Inherit
(Self : not null access constant UML_Communication_Path_Proxy;
Inhs : AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Inherit unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Inherit";
return Inherit (Self, Inhs);
end Inherit;
-------------------------
-- Inheritable_Members --
-------------------------
overriding function Inheritable_Members
(Self : not null access constant UML_Communication_Path_Proxy;
C : AMF.UML.Classifiers.UML_Classifier_Access)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Inheritable_Members unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Inheritable_Members";
return Inheritable_Members (Self, C);
end Inheritable_Members;
----------------------
-- Inherited_Member --
----------------------
overriding function Inherited_Member
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Inherited_Member unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Inherited_Member";
return Inherited_Member (Self);
end Inherited_Member;
-----------------
-- Is_Template --
-----------------
overriding function Is_Template
(Self : not null access constant UML_Communication_Path_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Template unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Is_Template";
return Is_Template (Self);
end Is_Template;
-------------------------
-- May_Specialize_Type --
-------------------------
overriding function May_Specialize_Type
(Self : not null access constant UML_Communication_Path_Proxy;
C : AMF.UML.Classifiers.UML_Classifier_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "May_Specialize_Type unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.May_Specialize_Type";
return May_Specialize_Type (Self, C);
end May_Specialize_Type;
------------------------
-- Exclude_Collisions --
------------------------
overriding function Exclude_Collisions
(Self : not null access constant UML_Communication_Path_Proxy;
Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Exclude_Collisions unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Exclude_Collisions";
return Exclude_Collisions (Self, Imps);
end Exclude_Collisions;
-------------------------
-- Get_Names_Of_Member --
-------------------------
overriding function Get_Names_Of_Member
(Self : not null access constant UML_Communication_Path_Proxy;
Element : AMF.UML.Named_Elements.UML_Named_Element_Access)
return AMF.String_Collections.Set_Of_String is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Get_Names_Of_Member unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Get_Names_Of_Member";
return Get_Names_Of_Member (Self, Element);
end Get_Names_Of_Member;
--------------------
-- Import_Members --
--------------------
overriding function Import_Members
(Self : not null access constant UML_Communication_Path_Proxy;
Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Import_Members unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Import_Members";
return Import_Members (Self, Imps);
end Import_Members;
---------------------
-- Imported_Member --
---------------------
overriding function Imported_Member
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Imported_Member unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Imported_Member";
return Imported_Member (Self);
end Imported_Member;
---------------------------------
-- Members_Are_Distinguishable --
---------------------------------
overriding function Members_Are_Distinguishable
(Self : not null access constant UML_Communication_Path_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Members_Are_Distinguishable unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Members_Are_Distinguishable";
return Members_Are_Distinguishable (Self);
end Members_Are_Distinguishable;
------------------
-- Owned_Member --
------------------
overriding function Owned_Member
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Owned_Member unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Owned_Member";
return Owned_Member (Self);
end Owned_Member;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.All_Owning_Packages";
return All_Owning_Packages (Self);
end All_Owning_Packages;
-----------------------------
-- Is_Distinguishable_From --
-----------------------------
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Communication_Path_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Is_Distinguishable_From";
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
---------------
-- Namespace --
---------------
overriding function Namespace
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Namespace";
return Namespace (Self);
end Namespace;
-----------------
-- Conforms_To --
-----------------
overriding function Conforms_To
(Self : not null access constant UML_Communication_Path_Proxy;
Other : AMF.UML.Types.UML_Type_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Conforms_To";
return Conforms_To (Self, Other);
end Conforms_To;
------------------------
-- Is_Compatible_With --
------------------------
overriding function Is_Compatible_With
(Self : not null access constant UML_Communication_Path_Proxy;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Is_Compatible_With";
return Is_Compatible_With (Self, P);
end Is_Compatible_With;
---------------------------
-- Is_Template_Parameter --
---------------------------
overriding function Is_Template_Parameter
(Self : not null access constant UML_Communication_Path_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Is_Template_Parameter";
return Is_Template_Parameter (Self);
end Is_Template_Parameter;
----------------------------
-- Parameterable_Elements --
----------------------------
overriding function Parameterable_Elements
(Self : not null access constant UML_Communication_Path_Proxy)
return AMF.UML.Parameterable_Elements.Collections.Set_Of_UML_Parameterable_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Parameterable_Elements unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Parameterable_Elements";
return Parameterable_Elements (Self);
end Parameterable_Elements;
------------------------
-- Is_Consistent_With --
------------------------
overriding function Is_Consistent_With
(Self : not null access constant UML_Communication_Path_Proxy;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Is_Consistent_With";
return Is_Consistent_With (Self, Redefinee);
end Is_Consistent_With;
-----------------------------------
-- Is_Redefinition_Context_Valid --
-----------------------------------
overriding function Is_Redefinition_Context_Valid
(Self : not null access constant UML_Communication_Path_Proxy;
Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented");
raise Program_Error with "Unimplemented procedure UML_Communication_Path_Proxy.Is_Redefinition_Context_Valid";
return Is_Redefinition_Context_Valid (Self, Redefined);
end Is_Redefinition_Context_Valid;
end AMF.Internals.UML_Communication_Paths;
|
jwarwick/aoc_2019_ada | Ada | 3,659 | adb | -- IntCode Interpreter
with Ada.Strings.Unbounded;
with Ada.Strings.Maps;
with Ada.Strings.Hash;
with Ada.Strings.Fixed;
with Ada.Text_IO;
package body IntCode is
package TIO renames Ada.Text_IO;
procedure append_input(val : Integer) is
begin
input_vector.append(val);
end append_input;
function take_output return Integer is
val : constant Integer := output_vector.First_Element;
begin
output_vector.Delete_First;
return val;
end take_output;
function integer_hash(i: Integer) return Ada.Containers.Hash_Type is (Ada.Strings.Hash(Integer'Image(i)));
type Program_Counter is new Natural;
pc : Program_Counter;
function to_pc(i : Integer) return Program_Counter is (Program_Counter(i));
function to_index(p : Program_Counter) return Natural is (Natural(p));
function val(offset : Integer) return Integer is (memory(memory(offset + to_index(pc))));
function val_a(offset : Integer := 1) return Integer renames val;
function val_b(offset : Integer := 2) return Integer renames val;
function loc_a return Integer is (memory(to_index(pc) + 1));
function loc_b return Integer is (memory(to_index(pc) + 2));
function loc_c return Integer is (memory(to_index(pc) + 3));
procedure increment_pc(s : Integer := 4) is
begin
pc := to_pc(to_index(pc) + s);
end increment_pc;
procedure load_file(path : String) is
file : TIO.File_Type;
begin
TIO.open(File => file, Mode => TIO.In_File, Name => path);
declare
str : String := TIO.get_line(file);
begin
load(str);
end;
TIO.close(file);
end load_file;
procedure load(s : String) is
start : Natural := s'First;
finish : Natural;
delimiters : constant Ada.Strings.Maps.Character_Set := Ada.Strings.Maps.to_set(Sequence => ",");
begin
memory.clear;
while start <= s'Last loop
Ada.Strings.Fixed.find_token(Source => s(start .. s'Last),
Set => delimiters,
Test => Ada.Strings.outside,
First => start, Last => finish);
if not(finish = 0 and then start = s'First) then
memory.append(Integer'Value(s(start .. finish)));
end if;
start := finish + 1;
end loop;
pc := to_pc(memory.first_index);
end load;
procedure eval is
should_halt : Boolean := False;
val : Integer;
begin
pc := to_pc(memory.first_index);
while not(should_halt) loop
val := memory(to_index(pc));
case OpCode_Map(val) is
when Add =>
memory(loc_c) := val_a + val_b;
increment_pc;
when Mult =>
memory(loc_c) := val_a * val_b;
increment_pc;
when Input =>
memory(loc_a) := input_vector.First_Element;
input_vector.Delete_First;
increment_pc(2);
when Output =>
output_vector.Append(val_a);
increment_pc(2);
when Halt =>
should_halt := True;
end case;
end loop;
end eval;
procedure poke(addr : Natural; value : Integer) is
begin
memory(addr) := value;
end poke;
function peek(addr : Natural) return Integer is (memory(addr));
function dump return String is
package Unbounded renames Ada.Strings.Unbounded;
str : Ada.Strings.Unbounded.Unbounded_String;
begin
for m of memory loop
Unbounded.append(str, (Integer'Image(m) & ", "));
end loop;
return Unbounded.to_string(str);
end dump;
begin
OpCode_Map.insert(1, Add);
OpCode_Map.insert(2, Mult);
OpCode_Map.insert(3, Input);
OpCode_Map.insert(4, Output);
OpCode_Map.insert(99, Halt);
end IntCode;
|
reznikmm/matreshka | Ada | 6,827 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Containers;
with League.Strings;
private with OPM.Stores;
limited private with AWFC.Accounts.Users.Stores;
package AWFC.Accounts.Users is
type User_Identifier is private;
Anonymous_User_Identifier : constant User_Identifier;
-- XXX It can be reasonable to remove this constant to enforce use of
-- User_Factory.Get_Anonymous_User subprogram.
type User is limited interface;
type User_Access is access all User'Class;
not overriding function Get_User_Identifier
(Self : not null access constant User) return User_Identifier is abstract;
not overriding function Is_Anonymous
(Self : not null access constant User) return Boolean is abstract;
not overriding function Is_Enabled
(Self : not null access constant User) return Boolean is abstract;
not overriding procedure Enable (Self : not null access User) is abstract;
-- Enable user's account.
not overriding procedure Disable (Self : not null access User) is abstract;
-- Disable user's account.
not overriding function Get_Email
(Self : not null access constant User)
return League.Strings.Universal_String is abstract;
-- Returns user's email address.
function Hash (Item : User_Identifier) return Ada.Containers.Hash_Type;
private
type User_Identifier is range 0 .. 2**63 - 1;
Anonymous_User_Identifier : constant User_Identifier := 0;
-------------------------
-- Anonymous_User_Type --
-------------------------
type Anonymous_User_Type is
limited new AWFC.Accounts.Users.User with null record;
overriding procedure Disable (Self : not null access Anonymous_User_Type);
overriding procedure Enable (Self : not null access Anonymous_User_Type);
overriding function Get_Email
(Self : not null access constant Anonymous_User_Type)
return League.Strings.Universal_String;
overriding function Get_User_Identifier
(Self : not null access constant Anonymous_User_Type)
return User_Identifier;
overriding function Is_Anonymous
(Self : not null access constant Anonymous_User_Type) return Boolean;
overriding function Is_Enabled
(Self : not null access constant Anonymous_User_Type) return Boolean;
-----------------------------
-- Non_Anonymous_User_Type --
-----------------------------
type Non_Anonymous_User_Type
(Store : not null access AWFC.Accounts.Users.Stores.User_Store'Class)
is limited new AWFC.Accounts.Users.User with
record
Identifier : User_Identifier;
Email : League.Strings.Universal_String;
Enabled : Boolean;
end record;
overriding procedure Disable
(Self : not null access Non_Anonymous_User_Type);
overriding procedure Enable
(Self : not null access Non_Anonymous_User_Type);
overriding function Get_Email
(Self : not null access constant Non_Anonymous_User_Type)
return League.Strings.Universal_String;
overriding function Get_User_Identifier
(Self : not null access constant Non_Anonymous_User_Type)
return User_Identifier;
overriding function Is_Anonymous
(Self : not null access constant Non_Anonymous_User_Type) return Boolean;
overriding function Is_Enabled
(Self : not null access constant Non_Anonymous_User_Type) return Boolean;
not overriding function Initialize
(Store : not null access AWFC.Accounts.Users.Stores.User_Store'Class)
return Non_Anonymous_User_Type;
end AWFC.Accounts.Users;
|
reznikmm/matreshka | Ada | 3,520 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
separate (League.Environment_Variables)
function To_Key (Item : League.Strings.Universal_String) return Key_Type is
begin
return Key_Type'(Item with null record);
end To_Key;
|
Rodeo-McCabe/orka | Ada | 2,823 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with GL.Types;
package Orka.Inputs.Pointers is
pragma Preelaborate;
type Button is (Left, Right, Middle);
type Button_State is (Released, Pressed);
type Pointer_Input is limited interface;
type Pointer_Input_Ptr is not null access Pointer_Input'Class;
function Position_X (Object : Pointer_Input) return GL.Types.Double is abstract;
-- The X position of the pointer. Does not change while the pointer
-- is locked.
function Position_Y (Object : Pointer_Input) return GL.Types.Double is abstract;
-- The Y position of the pointer. Does not change while the pointer
-- is locked.
function Delta_X (Object : Pointer_Input) return GL.Types.Double is abstract;
-- Pointer movement in the X direction since previous frame. May
-- change irrespective of whether pointer is locked or not.
function Delta_Y (Object : Pointer_Input) return GL.Types.Double is abstract;
-- Pointer movement in the Y direction since previous frame. May
-- change irrespective of whether pointer is locked or not.
function Scroll_X (Object : Pointer_Input) return GL.Types.Double is abstract;
-- Scroll movement of pointer in the X direction since the previous frame
function Scroll_Y (Object : Pointer_Input) return GL.Types.Double is abstract;
-- Scroll movement of pointer in the Y direction since the previous frame
function Locked (Object : Pointer_Input) return Boolean is abstract;
function Visible (Object : Pointer_Input) return Boolean is abstract;
procedure Lock_Pointer (Object : in out Pointer_Input; Locked : Boolean) is abstract;
-- Lock the pointer to the current position
--
-- The position of the pointer when queried via Position_X / Position_Y
-- will no longer change, but the movement relative to the previous
-- frame (Delta_X / Delta_Y) still can. The delta movement can be used
-- to control a camera using the pointer.
procedure Set_Visible (Object : in out Pointer_Input; Visible : Boolean) is abstract;
function Button_Pressed
(Object : Pointer_Input;
Subject : Button) return Boolean is abstract;
end Orka.Inputs.Pointers;
|
riccardo-bernardini/eugen | Ada | 9,911 | adb | pragma Ada_2012;
with Ada.Strings.Fixed;
package body Latex_Writer is
-- The result of function 'Image associated to discrete types has
-- a space at the beginning. That space is quite annoying and needs
-- to be trimmed. This function is here so that everyone can use it
function Chop (X : String) return String
is (Ada.Strings.Fixed.Trim (X, Ada.Strings.Both));
function Image (X : Integer) return String
is (Chop (Integer'Image (X)));
-------------------------
-- Print_Default_Macro --
-------------------------
procedure Print_Default_Macro (Output : File_Access;
Command_Name : String;
Definition : String;
N_Parameters : Natural)
is
begin
Put (File =>
Output.all,
Item =>
"\ifdef{" & Command_Name & "}"
& "{}"
& "{\newcommand{" & Command_Name & "}");
if N_Parameters > 0 then
Put (Output.all, "[" & Image (N_Parameters) & "]");
end if;
Put_Line (Output.all, "{" & Definition & "}}");
end Print_Default_Macro;
------------
-- Within --
------------
procedure Within
(Output : File_Access;
Env_Name : String;
Callback : access procedure (Output : File_Access);
Parameter : String := "")
is
begin
Put (Output.all, "\begin{" & Env_Name & "}");
if Parameter /= "" then
Put (Output.all, "{" & Parameter & "}");
end if;
New_Line (Output.all);
Callback (Output);
New_Line (Output.all);
Put_Line (Output.all, "\end{" & Env_Name & "}");
end Within;
-----------------------
-- Within_Table_Like --
-----------------------
procedure Within_Table_Like
(Output : File_Access;
Env_Name : String;
Callback : access procedure (Output : File_Access;
Table : in out Table_Handler))
is
Arg : constant Parameter_List (2 .. 1) := (others => <>);
begin
Within_Table_Like (Output => Output,
Env_Name => Env_Name,
Callback => Callback,
Parameters => Arg);
end Within_Table_Like;
-----------------------
-- Within_Table_Like --
-----------------------
procedure Within_Table_Like
(Output : File_Access;
Env_Name : String;
Callback : access procedure (Output : File_Access;
Table : in out Table_Handler);
Parameter : String)
is
begin
Within_Table_Like (Output => Output,
Env_Name => Env_Name,
Callback => Callback,
Parameters => (1 => To_Unbounded_String (Parameter)));
end Within_Table_Like;
-----------------------
-- Within_Table_Like --
-----------------------
procedure Within_Table_Like
(Output : File_Access;
Env_Name : String;
Callback : access procedure (Output : File_Access;
Table : in out Table_Handler);
Parameters : Parameter_List)
is
T : Table_Handler := Table_Handler'(State => Begin_Row,
Output => Output,
Default_Style => To_Unbounded_String (""),
Default_Head => To_Unbounded_String (""));
begin
Put (Output.all, "\begin{" & Env_Name & "}");
for K in Parameters'Range loop
Put (Output.all, "{" & To_String (Parameters (K)) & "}");
end loop;
New_Line (Output.all);
Callback (Output, T);
New_Line (Output.all);
Put_Line (Output.all, "\end{" & Env_Name & "}");
end Within_Table_Like;
------------------
-- Within_Table --
------------------
procedure Within_Table
(Output : File_Access;
Table_Spec : String;
Callback : access procedure (Output : File_Access;
Table : in out Table_Handler);
Default_Style : String := "";
Default_Head : String := "";
Caption : String := "";
Width : String := "\textwidth")
is
use Ada.Strings.Fixed;
T : Table_Handler := Table_Handler'(State => Begin_Row,
Output => Output,
Default_Style => To_Unbounded_String (Default_Style),
Default_Head => To_Unbounded_String (Default_Head));
Use_Tabularx : constant Boolean := Index (Table_Spec, "X") > 0;
Env_Name : constant String :=
(if Use_Tabularx then "tabularx" else "tabular");
Width_Spec : constant String := (if Use_Tabularx then "{" & Width & "}" else "");
begin
if Caption /= "" then
Put_Line (Output.all, "\begin{table}");
Put_Line (Output.all, "\caption{" & Caption & "}");
end if;
Put_Line (Output.all, "\centering");
Put_Line (Output.all,
"\begin{" & Env_Name & "}"
& Width_Spec
& "{" & Table_Spec & "}");
Callback (Output, T);
New_Line (Output.all);
Put_Line (Output.all, "\end{" & Env_Name & "}");
if Caption /= "" then
Put_Line (Output.all, "\end{table}");
end if;
end Within_Table;
-----------------
-- Apply_Style --
-----------------
function Apply_Style (Content : String;
Style : Style_Spec;
Default_Style : Unbounded_String)
return String
is
begin
if Style /= "" then
return String (Style) & "{" & Content & "}";
elsif Default_Style /= "" then
return To_String (Default_Style) & "{" & Content & "}";
else
return Content;
end if;
end Apply_Style;
procedure Put_If_In_State (Table : in out Table_Handler;
Content : String;
State : Table_State)
is
begin
if Table.State = State then
Put (Table.Output.all, Content);
end if;
end Put_If_In_State;
---------
-- Put --
---------
procedure Put
(Table : in out Table_Handler; Content : String; Style : String := "")
is
begin
Put_If_In_State (Table, " & ", Middle_Row);
Put (Table.Output.all, Apply_Style (Content, Style_Spec (Style), Table.Default_Style));
Table.State := Middle_Row;
end Put;
-------------
-- New_Row --
-------------
procedure New_Row (Table : in out Table_Handler) is
begin
Put_Line (Table.Output.all, "\\");
Table.State := Begin_Row;
end New_Row;
-----------
-- hline --
-----------
procedure Hline (Table : in out Table_Handler;
Full : Boolean := True) is
begin
Put_If_In_State (Table, "\\", Middle_Row);
if Full then
Put_Line (Table.Output.all, "\hline");
end if;
Table.State := Begin_Row;
end Hline;
procedure Cline (Table : in out Table_Handler; From, To : Positive)
is
begin
Put_If_In_State (Table, "\\", Middle_Row);
Put_Line (Table.Output.all, "\cline{" & Image (From) & "-" & Image (To) & "}");
Table.State := Begin_Row;
end Cline;
-----------------
-- Multicolumn --
-----------------
procedure Multicolumn (Table : in out Table_Handler;
Span : Positive;
Spec : String;
Content : String)
is
begin
Put_If_In_State (Table, "&", Middle_Row);
Put (Table.Output.all, "\multicolumn{" & Image (Span) & "}{" & Spec & "}");
Put_Line (Table.Output.all, "{" & Content & "}");
Table.State := Middle_Row;
end Multicolumn;
----------
-- Head --
----------
procedure Head (Table : in out Table_Handler;
Content : String;
Bar : Bar_Position := Default;
Style : String := "")
is
True_Bar : constant Bar_Position :=
(if Bar /= Default
then
Bar
elsif Table.State = Begin_Row then
Both
else
Right);
function Bar_Maybe (X : Boolean) return String
is (if X then "|" else "");
begin
Table.Multicolumn (Span => 1,
Content => Apply_Style (Content => Content,
Style => Style_Spec (Style),
Default_Style => Table.Default_Head),
Spec =>
Bar_Maybe (True_Bar = Left or True_Bar = Both) &
"c" &
Bar_Maybe (True_Bar = Right or True_Bar = Both));
end Head;
----------
-- Hbox --
----------
function Hbox (Content : String;
Size : Latex_Length := Zero;
Align : Align_Type := Center)
return String
is
begin
return "\hbox to "
& Image (Size)
& "{"
& (case Align is
when Center | Left => "\hss",
when Right => "")
& "{" & Content & "}"
& (case Align is
when Center | Right => "\hss",
when Left => "")
& "}";
end Hbox;
end Latex_Writer;
|
reznikmm/matreshka | Ada | 4,536 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with League.Strings;
private with Web_Services.SOAP.Messages;
with Web_Services.SOAP.Modules;
package Web_Services.SOAP.Security.Modules is
type Security_Module is
new Web_Services.SOAP.Modules.Abstract_SOAP_Module with private;
type Authentication_Data_Provider is
access procedure
(Username : League.Strings.Universal_String;
Password : out League.Strings.Universal_String;
Success : out Boolean);
procedure Set_Authentication_Data_Provider
(Provider : Authentication_Data_Provider);
-- Sets subprogram to obtain authentication data.
private
type Security_Module is
new Web_Services.SOAP.Modules.Abstract_SOAP_Module with null record;
overriding procedure Receive_Request
(Self : in out Security_Module;
Message : in out Web_Services.SOAP.Messages.SOAP_Message;
Output : in out Web_Services.SOAP.Messages.SOAP_Message_Access);
overriding procedure Send_Request
(Self : in out Security_Module;
Message : in out Web_Services.SOAP.Messages.SOAP_Message;
User : League.Strings.Universal_String;
Password : League.Strings.Universal_String);
end Web_Services.SOAP.Security.Modules;
|
persan/A-gst | Ada | 5,108 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with glib;
with glib.Values;
with System;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpluginfeature_h;
with glib;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstindex_h;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstindexfactory_h is
-- unsupported macro: GST_TYPE_INDEX_FACTORY (gst_index_factory_get_type())
-- arg-macro: function GST_INDEX_FACTORY (obj)
-- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_INDEX_FACTORY, GstIndexFactory);
-- arg-macro: function GST_IS_INDEX_FACTORY (obj)
-- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_INDEX_FACTORY);
-- arg-macro: function GST_INDEX_FACTORY_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_INDEX_FACTORY, GstIndexFactoryClass);
-- arg-macro: function GST_IS_INDEX_FACTORY_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_INDEX_FACTORY);
-- arg-macro: function GST_INDEX_FACTORY_GET_CLASS (obj)
-- return G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_INDEX_FACTORY, GstIndexFactoryClass);
-- GStreamer
-- * Copyright (C) 1999,2000 Erik Walthinsen <[email protected]>
-- * 2000 Wim Taymans <[email protected]>
-- *
-- * gstindexfactory.h: Header for GstIndexFactory, base class to handle efficient
-- * storage or caching of seeking information.
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library 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.
--
type GstIndexFactory;
type u_GstIndexFactory_u_gst_reserved_array is array (0 .. 3) of System.Address;
--subtype GstIndexFactory is u_GstIndexFactory; -- gst/gstindexfactory.h:40
type GstIndexFactoryClass;
type u_GstIndexFactoryClass_u_gst_reserved_array is array (0 .. 3) of System.Address;
--subtype GstIndexFactoryClass is u_GstIndexFactoryClass; -- gst/gstindexfactory.h:41
--*
-- * GstIndexFactory:
-- *
-- * The GstIndexFactory object
--
type GstIndexFactory is record
feature : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpluginfeature_h.GstPluginFeature; -- gst/gstindexfactory.h:49
longdesc : access GLIB.gchar; -- gst/gstindexfactory.h:51
c_type : aliased GLIB.GType; -- gst/gstindexfactory.h:52
u_gst_reserved : u_GstIndexFactory_u_gst_reserved_array; -- gst/gstindexfactory.h:54
end record;
pragma Convention (C_Pass_By_Copy, GstIndexFactory); -- gst/gstindexfactory.h:48
-- long description of the index (well, don't overdo it..)
-- unique GType of the index
type GstIndexFactoryClass is record
parent : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpluginfeature_h.GstPluginFeatureClass; -- gst/gstindexfactory.h:58
u_gst_reserved : u_GstIndexFactoryClass_u_gst_reserved_array; -- gst/gstindexfactory.h:60
end record;
pragma Convention (C_Pass_By_Copy, GstIndexFactoryClass); -- gst/gstindexfactory.h:57
function gst_index_factory_get_type return GLIB.GType; -- gst/gstindexfactory.h:63
pragma Import (C, gst_index_factory_get_type, "gst_index_factory_get_type");
function gst_index_factory_new
(name : access GLIB.gchar;
longdesc : access GLIB.gchar;
c_type : GLIB.GType) return access GstIndexFactory; -- gst/gstindexfactory.h:65
pragma Import (C, gst_index_factory_new, "gst_index_factory_new");
procedure gst_index_factory_destroy (factory : access GstIndexFactory); -- gst/gstindexfactory.h:67
pragma Import (C, gst_index_factory_destroy, "gst_index_factory_destroy");
function gst_index_factory_find (name : access GLIB.gchar) return access GstIndexFactory; -- gst/gstindexfactory.h:69
pragma Import (C, gst_index_factory_find, "gst_index_factory_find");
function gst_index_factory_create (factory : access GstIndexFactory) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstindex_h.GstIndex; -- gst/gstindexfactory.h:71
pragma Import (C, gst_index_factory_create, "gst_index_factory_create");
function gst_index_factory_make (name : access GLIB.gchar) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstindex_h.GstIndex; -- gst/gstindexfactory.h:72
pragma Import (C, gst_index_factory_make, "gst_index_factory_make");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstindexfactory_h;
|
charlie5/cBound | Ada | 1,386 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces.C;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_get_input_focus_cookie_t is
-- Item
--
type Item is record
sequence : aliased Interfaces.C.unsigned;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_get_input_focus_cookie_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_get_input_focus_cookie_t.Item,
Element_Array => xcb.xcb_get_input_focus_cookie_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_get_input_focus_cookie_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_get_input_focus_cookie_t.Pointer,
Element_Array => xcb.xcb_get_input_focus_cookie_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_get_input_focus_cookie_t;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 6,067 | ads | pragma Style_Checks (Off);
-- This spec has been automatically generated from STM32L0x1.svd
pragma Restrictions (No_Elaboration_Code);
with System;
package STM32_SVD.DBGMCU is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype IDCODE_DEV_ID_Field is STM32_SVD.UInt12;
subtype IDCODE_REV_ID_Field is STM32_SVD.UInt16;
-- MCU Device ID Code Register
type IDCODE_Register is record
-- Read-only. Device Identifier
DEV_ID : IDCODE_DEV_ID_Field;
-- unspecified
Reserved_12_15 : STM32_SVD.UInt4;
-- Read-only. Revision Identifier
REV_ID : IDCODE_REV_ID_Field;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for IDCODE_Register use record
DEV_ID at 0 range 0 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
REV_ID at 0 range 16 .. 31;
end record;
subtype CR_DBG_SLEEP_Field is STM32_SVD.Bit;
subtype CR_DBG_STOP_Field is STM32_SVD.Bit;
subtype CR_DBG_STANDBY_Field is STM32_SVD.Bit;
-- Debug MCU Configuration Register
type CR_Register is record
-- Debug Sleep Mode
DBG_SLEEP : CR_DBG_SLEEP_Field := 16#0#;
-- Debug Stop Mode
DBG_STOP : CR_DBG_STOP_Field := 16#0#;
-- Debug Standby Mode
DBG_STANDBY : CR_DBG_STANDBY_Field := 16#0#;
-- unspecified
Reserved_3_31 : STM32_SVD.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
DBG_SLEEP at 0 range 0 .. 0;
DBG_STOP at 0 range 1 .. 1;
DBG_STANDBY at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype APB1_FZ_DBG_TIMER2_STOP_Field is STM32_SVD.Bit;
subtype APB1_FZ_DBG_TIMER6_STOP_Field is STM32_SVD.Bit;
subtype APB1_FZ_DBG_RTC_STOP_Field is STM32_SVD.Bit;
subtype APB1_FZ_DBG_WWDG_STOP_Field is STM32_SVD.Bit;
subtype APB1_FZ_DBG_IWDG_STOP_Field is STM32_SVD.Bit;
subtype APB1_FZ_DBG_I2C1_STOP_Field is STM32_SVD.Bit;
subtype APB1_FZ_DBG_I2C2_STOP_Field is STM32_SVD.Bit;
subtype APB1_FZ_DBG_LPTIMER_STOP_Field is STM32_SVD.Bit;
-- APB Low Freeze Register
type APB1_FZ_Register is record
-- Debug Timer 2 stopped when Core is halted
DBG_TIMER2_STOP : APB1_FZ_DBG_TIMER2_STOP_Field := 16#0#;
-- unspecified
Reserved_1_3 : STM32_SVD.UInt3 := 16#0#;
-- Debug Timer 6 stopped when Core is halted
DBG_TIMER6_STOP : APB1_FZ_DBG_TIMER6_STOP_Field := 16#0#;
-- unspecified
Reserved_5_9 : STM32_SVD.UInt5 := 16#0#;
-- Debug RTC stopped when Core is halted
DBG_RTC_STOP : APB1_FZ_DBG_RTC_STOP_Field := 16#0#;
-- Debug Window Wachdog stopped when Core is halted
DBG_WWDG_STOP : APB1_FZ_DBG_WWDG_STOP_Field := 16#0#;
-- Debug Independent Wachdog stopped when Core is halted
DBG_IWDG_STOP : APB1_FZ_DBG_IWDG_STOP_Field := 16#0#;
-- unspecified
Reserved_13_20 : STM32_SVD.Byte := 16#0#;
-- I2C1 SMBUS timeout mode stopped when core is halted
DBG_I2C1_STOP : APB1_FZ_DBG_I2C1_STOP_Field := 16#0#;
-- I2C2 SMBUS timeout mode stopped when core is halted
DBG_I2C2_STOP : APB1_FZ_DBG_I2C2_STOP_Field := 16#0#;
-- unspecified
Reserved_23_30 : STM32_SVD.Byte := 16#0#;
-- LPTIM1 counter stopped when core is halted
DBG_LPTIMER_STOP : APB1_FZ_DBG_LPTIMER_STOP_Field := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for APB1_FZ_Register use record
DBG_TIMER2_STOP at 0 range 0 .. 0;
Reserved_1_3 at 0 range 1 .. 3;
DBG_TIMER6_STOP at 0 range 4 .. 4;
Reserved_5_9 at 0 range 5 .. 9;
DBG_RTC_STOP at 0 range 10 .. 10;
DBG_WWDG_STOP at 0 range 11 .. 11;
DBG_IWDG_STOP at 0 range 12 .. 12;
Reserved_13_20 at 0 range 13 .. 20;
DBG_I2C1_STOP at 0 range 21 .. 21;
DBG_I2C2_STOP at 0 range 22 .. 22;
Reserved_23_30 at 0 range 23 .. 30;
DBG_LPTIMER_STOP at 0 range 31 .. 31;
end record;
subtype APB2_FZ_DBG_TIMER21_STOP_Field is STM32_SVD.Bit;
subtype APB2_FZ_DBG_TIMER22_STO_Field is STM32_SVD.Bit;
-- APB High Freeze Register
type APB2_FZ_Register is record
-- unspecified
Reserved_0_1 : STM32_SVD.UInt2 := 16#0#;
-- Debug Timer 21 stopped when Core is halted
DBG_TIMER21_STOP : APB2_FZ_DBG_TIMER21_STOP_Field := 16#0#;
-- unspecified
Reserved_3_5 : STM32_SVD.UInt3 := 16#0#;
-- Debug Timer 22 stopped when Core is halted
DBG_TIMER22_STO : APB2_FZ_DBG_TIMER22_STO_Field := 16#0#;
-- unspecified
Reserved_7_31 : STM32_SVD.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for APB2_FZ_Register use record
Reserved_0_1 at 0 range 0 .. 1;
DBG_TIMER21_STOP at 0 range 2 .. 2;
Reserved_3_5 at 0 range 3 .. 5;
DBG_TIMER22_STO at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Debug support
type DBG_Peripheral is record
-- MCU Device ID Code Register
IDCODE : aliased IDCODE_Register;
-- Debug MCU Configuration Register
CR : aliased CR_Register;
-- APB Low Freeze Register
APB1_FZ : aliased APB1_FZ_Register;
-- APB High Freeze Register
APB2_FZ : aliased APB2_FZ_Register;
end record
with Volatile;
for DBG_Peripheral use record
IDCODE at 16#0# range 0 .. 31;
CR at 16#4# range 0 .. 31;
APB1_FZ at 16#8# range 0 .. 31;
APB2_FZ at 16#C# range 0 .. 31;
end record;
-- Debug support
DBG_Periph : aliased DBG_Peripheral
with Import, Address => DBG_Base;
end STM32_SVD.DBGMCU;
|
ellamosi/Ada_BMP_Library | Ada | 11,500 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2017, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with System.Storage_Elements; use System.Storage_Elements;
with Bitmap.Color_Conversion; use Bitmap.Color_Conversion;
package body Bitmap.Memory_Mapped is
procedure Handle_Swap
(Buffer : Bitmap_Buffer'Class;
X : in out Natural;
Y : in out Natural);
-----------------
-- Handle_Swap --
-----------------
procedure Handle_Swap
(Buffer : Bitmap_Buffer'Class;
X : in out Natural;
Y : in out Natural)
is
Tmp : Natural;
begin
if not Buffer.Swapped then
return;
end if;
Tmp := X;
X := Y;
Y := Buffer.Width - Tmp - 1;
end Handle_Swap;
---------------
-- Set_Pixel --
---------------
overriding
procedure Set_Pixel
(Buffer : in out Memory_Mapped_Bitmap_Buffer;
Pt : Point;
Value : Bitmap_Color)
is
Col : constant UInt32 :=
Bitmap_Color_To_Word (Buffer.Color_Mode, Value);
begin
Set_Pixel (Bitmap_Buffer'Class (Buffer), Pt, Col);
end Set_Pixel;
---------------
-- Set_Pixel --
---------------
overriding
procedure Set_Pixel
(Buffer : in out Memory_Mapped_Bitmap_Buffer;
Pt : Point;
Value : UInt32)
is
X0 : Natural := Pt.X;
Y0 : Natural := Pt.Y;
Offset : Natural;
begin
if Pt.X >= Buffer.Width
or else Pt.Y >= Buffer.Height
then
return;
end if;
if Buffer.Swapped then
Handle_Swap (Buffer, X0, Y0);
Offset := X0 + Y0 * Buffer.Height;
else
Offset := Pt.X + Pt.Y * Buffer.Width;
end if;
case Buffer.Color_Mode is
when ARGB_8888 =>
declare
Pixel : aliased UInt32
with Import,
Address => Buffer.Addr + Storage_Offset (Offset * 4);
begin
Pixel := Value;
end;
when RGB_888 =>
declare
Pixel_B : aliased UInt8
with Import,
Address => Buffer.Addr + Storage_Offset (Offset * 3);
Pixel_G : aliased UInt8
with Import,
Address => Buffer.Addr + Storage_Offset (Offset * 3 + 1);
Pixel_R : aliased UInt8
with Import,
Address => Buffer.Addr + Storage_Offset (Offset * 3 + 2);
R : constant UInt8 :=
UInt8 (Shift_Right (Value and 16#FF0000#, 16));
G : constant UInt8 :=
UInt8 (Shift_Right (Value and 16#FF00#, 8));
B : constant UInt8 := UInt8 (Value and 16#FF#);
begin
Pixel_B := B;
Pixel_G := G;
Pixel_R := R;
end;
when ARGB_1555 | ARGB_4444 | RGB_565 | AL_88 =>
declare
Pixel : aliased UInt16
with Import,
Address => Buffer.Addr + Storage_Offset (Offset * 2);
begin
Pixel := UInt16 (Value and 16#FF_FF#);
end;
when L_8 | AL_44 | A_8 =>
declare
Pixel : aliased UInt8
with Import,
Address => Buffer.Addr + Storage_Offset (Offset);
begin
Pixel := UInt8 (Value and 16#FF#);
end;
when L_4 | A_4 =>
declare
Pixel : aliased UInt8
with Import,
Address => Buffer.Addr + Storage_Offset (Offset / 2);
begin
if Offset mod 2 = 0 then
Pixel :=
(Pixel and 16#0F#) or
Shift_Left (UInt8 (Value and 16#0F#), 4);
else
Pixel := (Pixel and 16#F0#) or UInt8 (Value and 16#0F#);
end if;
end;
when M_1 =>
declare
type Mono_BM is array (Natural range <>) of Bit with Pack;
BM : aliased Mono_BM (0 .. (Buffer.Height * Buffer.Width) - 1)
with Import, Address => Buffer.Addr;
begin
BM (Offset) := (if Value /= 0 then 1 else 0);
end;
end case;
end Set_Pixel;
---------------------
-- Set_Pixel_Blend --
---------------------
overriding
procedure Set_Pixel_Blend
(Buffer : in out Memory_Mapped_Bitmap_Buffer;
Pt : Point;
Value : Bitmap_Color)
is
Col : Bitmap_Color;
FgA, FgR, FgG, FgB : Float;
BgA, BgR, BgG, BgB : Float;
RA, RR, RG, RB : Float;
begin
if Value.Alpha = 255 then
Set_Pixel (Memory_Mapped_Bitmap_Buffer'Class (Buffer), Pt, Value);
else
Col := Pixel (Bitmap_Buffer'Class (Buffer), Pt);
BgA := Float (Col.Alpha) / 255.0;
BgR := Float (Col.Red) / 255.0;
BgG := Float (Col.Green) / 255.0;
BgB := Float (Col.Blue) / 255.0;
FgA := Float (Value.Alpha) / 255.0;
FgR := Float (Value.Red) / 255.0;
FgG := Float (Value.Green) / 255.0;
FgB := Float (Value.Blue) / 255.0;
RA := 1.0 - (1.0 - FgA) * (1.0 - FgB);
RR := FgR * FgA / RA + BgR * BgA * (1.0 - FgA) / RA;
RG := FgG * FgA / RA + BgG * BgA * (1.0 - FgA) / RA;
RB := FgB * FgA / RA + BgB * BgA * (1.0 - FgA) / RA;
Col := (Alpha => UInt8 (RA * 255.0),
Red => UInt8 (RR * 255.0),
Green => UInt8 (RG * 255.0),
Blue => UInt8 (RB * 255.0));
Set_Pixel (Bitmap_Buffer'Class (Buffer), Pt, Col);
end if;
end Set_Pixel_Blend;
-----------
-- Pixel --
-----------
overriding
function Pixel
(Buffer : Memory_Mapped_Bitmap_Buffer;
Pt : Point)
return Bitmap_Color
is
Native_Color : UInt32;
begin
Native_Color := Pixel (Bitmap_Buffer'Class (Buffer), Pt);
return Word_To_Bitmap_Color (Buffer.Color_Mode, Native_Color);
end Pixel;
-----------
-- Pixel --
-----------
overriding
function Pixel
(Buffer : Memory_Mapped_Bitmap_Buffer;
Pt : Point)
return UInt32
is
X0 : Natural := Pt.X;
Y0 : Natural := Pt.Y;
Offset : Natural;
begin
if Buffer.Swapped then
Handle_Swap (Buffer, X0, Y0);
Offset := X0 + Y0 * Buffer.Height;
else
Offset := Pt.X + Pt.Y * Buffer.Width;
end if;
case Buffer.Color_Mode is
when ARGB_8888 =>
declare
Pixel : aliased UInt32
with Import,
Address => Buffer.Addr + Storage_Offset (Offset * 4);
begin
return Pixel;
end;
when RGB_888 =>
declare
Pixel_B : aliased UInt8
with Import,
Address => Buffer.Addr + Storage_Offset (Offset * 3);
Pixel_G : aliased UInt8
with Import,
Address => Buffer.Addr + Storage_Offset (Offset * 3 + 1);
Pixel_R : aliased UInt8
with Import,
Address => Buffer.Addr + Storage_Offset (Offset * 3 + 2);
begin
return Shift_Left (UInt32 (Pixel_R), 16)
or Shift_Left (UInt32 (Pixel_G), 8) or UInt32 (Pixel_B);
end;
when ARGB_1555 | ARGB_4444 | RGB_565 | AL_88 =>
declare
Pixel : aliased UInt16
with Import,
Address => Buffer.Addr + Storage_Offset (Offset * 2);
begin
return UInt32 (Pixel);
end;
when L_8 | AL_44 | A_8 =>
declare
Pixel : aliased UInt8
with Import,
Address => Buffer.Addr + Storage_Offset (Offset);
begin
return UInt32 (Pixel);
end;
when L_4 | A_4 =>
declare
Pixel : aliased UInt8
with Import,
Address => Buffer.Addr + Storage_Offset (Offset / 2);
begin
if Offset mod 2 = 0 then
return UInt32 (Shift_Right (Pixel and 16#F0#, 4));
else
return UInt32 (Pixel and 16#0F#);
end if;
end;
when M_1 =>
declare
type Mono_BM is array (Natural range <>) of Bit with Pack;
BM : aliased Mono_BM (0 .. (Buffer.Height * Buffer.Width) - 1)
with Import, Address => Buffer.Addr;
begin
return UInt32 (BM (Offset));
end;
end case;
end Pixel;
-----------------
-- Buffer_Size --
-----------------
overriding
function Buffer_Size (Buffer : Memory_Mapped_Bitmap_Buffer) return Natural
is
begin
return Bits_Per_Pixel (Buffer.Color_Mode) *
Buffer.Width * Buffer.Height / 8;
end Buffer_Size;
end Bitmap.Memory_Mapped;
|
AaronC98/PlaneSystem | Ada | 4,709 | ads | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2000-2015, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
pragma Ada_2012;
with AWS.Client;
with SOAP.Message.Payload;
with SOAP.Message.Response;
with SOAP.WSDL.Schema;
package SOAP.Message.XML is
SOAP_Error : exception renames SOAP.SOAP_Error;
function Load_Payload
(XML : aliased String;
Envelope : Boolean := True;
Schema : WSDL.Schema.Definition := WSDL.Schema.Empty)
return Message.Payload.Object;
-- Build a Payload object by parsing the XML payload string.
-- If Envelope is False, the message could consists only from body
-- with arbitrary named root tag without mandatory SOAP Envelope wrapper.
function Load_Payload
(XML : Unbounded_String;
Envelope : Boolean := True;
Schema : WSDL.Schema.Definition := WSDL.Schema.Empty)
return Message.Payload.Object;
-- Build a Payload object by parsing the XML payload string
function Load_Response
(Connection : AWS.Client.HTTP_Connection;
Envelope : Boolean := True;
Schema : WSDL.Schema.Definition := WSDL.Schema.Empty)
return Message.Response.Object'Class;
-- Build a Response object (either a standard response or an error
-- response) by parsing the HTTP client connection output.
-- If Envelope is False, the message could consists only from body
-- with arbitrary named root tag without mandatory SOAP Envelope wrapper.
function Load_Response
(XML : aliased String;
Envelope : Boolean := True;
Schema : WSDL.Schema.Definition := WSDL.Schema.Empty)
return Message.Response.Object'Class;
-- Build a Response object (either a standard response or an error
-- response) by parsing the XML response string.
-- If Envelope is False, the message could consists only from body
-- with arbitrary named root tag without mandatory SOAP Envelope wrapper.
function Load_Response
(XML : Unbounded_String;
Envelope : Boolean := True;
Schema : WSDL.Schema.Definition := WSDL.Schema.Empty)
return Message.Response.Object'Class;
-- As above but using an Unbounded_String
function Image
(O : Object'Class;
Schema : WSDL.Schema.Definition := WSDL.Schema.Empty) return String;
-- Returns XML representation of object O
function Image
(O : Object'Class;
Schema : WSDL.Schema.Definition :=
WSDL.Schema.Empty) return Unbounded_String;
-- Idem as above but returns an Unbounded_String instead of a String
end SOAP.Message.XML;
|
AdaCore/Ada-IntelliJ | Ada | 374 | ads |
with AWS.Status;
with AWS.Templates;
with AWS.Services.Web_Block.Context;
package @[email protected] is
use AWS;
use AWS.Services;
procedure Onclick_Incr
(Request : in Status.Data;
Context : not null access Web_Block.Context.Object;
Translations : in out Templates.Translate_Set);
end @[email protected];
|
zhmu/ananas | Ada | 28,240 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . R A N D O M _ N U M B E R S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2007-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- --
-- The implementation here is derived from a C-program for MT19937, with --
-- initialization improved 2002/1/26. As required, the following notice is --
-- copied from the original program. --
-- --
-- Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution.--
-- --
-- 3. The names of its contributors 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 --
-- 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. --
-- --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- --
-- This is an implementation of the Mersenne Twister, twisted generalized --
-- feedback shift register of rational normal form, with state-bit --
-- reflection and tempering. This version generates 32-bit integers with a --
-- period of 2**19937 - 1 (a Mersenne prime, hence the name). For --
-- applications requiring more than 32 bits (up to 64), we concatenate two --
-- 32-bit numbers. --
-- --
-- See http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html for --
-- details. --
-- --
-- In contrast to the original code, we do not generate random numbers in --
-- batches of N. Measurement seems to show this has very little if any --
-- effect on performance, and it may be marginally better for real-time --
-- applications with hard deadlines. --
-- --
------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
with System.Random_Seed;
with Interfaces; use Interfaces;
use Ada;
package body System.Random_Numbers with
SPARK_Mode => Off
is
Image_Numeral_Length : constant := Max_Image_Width / N;
subtype Image_String is String (1 .. Max_Image_Width);
----------------------------
-- Algorithmic Parameters --
----------------------------
Lower_Mask : constant := 2**31 - 1;
Upper_Mask : constant := 2**31;
Matrix_A : constant array (State_Val range 0 .. 1) of State_Val
:= [0, 16#9908b0df#];
-- The twist transformation is represented by a matrix of the form
--
-- [ 0 I(31) ]
-- [ _a ]
--
-- where 0 is a 31x31 block of 0s, I(31) is the 31x31 identity matrix and
-- _a is a particular bit row-vector, represented here by a 32-bit integer.
-- If integer x represents a row vector of bits (with x(0), the units bit,
-- last), then
-- x * A = [0 x(31..1)] xor Matrix_A(x(0)).
U : constant := 11;
S : constant := 7;
B_Mask : constant := 16#9d2c5680#;
T : constant := 15;
C_Mask : constant := 16#efc60000#;
L : constant := 18;
-- The tempering shifts and bit masks, in the order applied
Seed0 : constant := 5489;
-- Default seed, used to initialize the state vector when Reset not called
Seed1 : constant := 19650218;
-- Seed used to initialize the state vector when calling Reset with an
-- initialization vector.
Mult0 : constant := 1812433253;
-- Multiplier for a modified linear congruential generator used to
-- initialize the state vector when calling Reset with a single integer
-- seed.
Mult1 : constant := 1664525;
Mult2 : constant := 1566083941;
-- Multipliers for two modified linear congruential generators used to
-- initialize the state vector when calling Reset with an initialization
-- vector.
-----------------------
-- Local Subprograms --
-----------------------
procedure Init (Gen : Generator; Initiator : Unsigned_32);
-- Perform a default initialization of the state of Gen. The resulting
-- state is identical for identical values of Initiator.
procedure Insert_Image
(S : in out Image_String;
Index : Integer;
V : State_Val);
-- Insert image of V into S, in the Index'th 11-character substring
function Extract_Value (S : String; Index : Integer) return State_Val;
-- Treat S as a sequence of 11-character decimal numerals and return
-- the result of converting numeral #Index (numbering from 0)
function To_Unsigned is
new Unchecked_Conversion (Integer_32, Unsigned_32);
function To_Unsigned is
new Unchecked_Conversion (Integer_64, Unsigned_64);
------------
-- Random --
------------
function Random (Gen : Generator) return Unsigned_32 is
G : Generator renames Gen.Writable.Self.all;
Y : State_Val;
I : Integer;
-- Naming exception: I is fine to use here as it is the name used in
-- the original paper describing the Mersenne Twister and in common
-- descriptions of the algorithm.
begin
I := G.I;
if I < N - M then
Y := (G.S (I) and Upper_Mask) or (G.S (I + 1) and Lower_Mask);
Y := G.S (I + M) xor Shift_Right (Y, 1) xor Matrix_A (Y and 1);
I := I + 1;
elsif I < N - 1 then
Y := (G.S (I) and Upper_Mask) or (G.S (I + 1) and Lower_Mask);
Y := G.S (I + (M - N))
xor Shift_Right (Y, 1)
xor Matrix_A (Y and 1);
I := I + 1;
elsif I = N - 1 then
Y := (G.S (I) and Upper_Mask) or (G.S (0) and Lower_Mask);
Y := G.S (M - 1) xor Shift_Right (Y, 1) xor Matrix_A (Y and 1);
I := 0;
else
Init (G, Seed0);
return Random (Gen);
end if;
G.S (G.I) := Y;
G.I := I;
Y := Y xor Shift_Right (Y, U);
Y := Y xor (Shift_Left (Y, S) and B_Mask);
Y := Y xor (Shift_Left (Y, T) and C_Mask);
Y := Y xor Shift_Right (Y, L);
return Y;
end Random;
generic
type Unsigned is mod <>;
type Real is digits <>;
with function Random (G : Generator) return Unsigned is <>;
function Random_Float_Template (Gen : Generator) return Real;
pragma Inline (Random_Float_Template);
-- Template for a random-number generator implementation that delivers
-- values of type Real in the range [0 .. 1], using values from Gen,
-- assuming that Unsigned is large enough to hold the bits of a mantissa
-- for type Real.
---------------------------
-- Random_Float_Template --
---------------------------
function Random_Float_Template (Gen : Generator) return Real is
pragma Compile_Time_Error
(Unsigned'Last <= 2**(Real'Machine_Mantissa - 1),
"insufficiently large modular type used to hold mantissa");
begin
-- This code generates random floating-point numbers from unsigned
-- integers. Assuming that Real'Machine_Radix = 2, it can deliver all
-- machine values of type Real (as implied by Real'Machine_Mantissa and
-- Real'Machine_Emin), which is not true of the standard method (to
-- which we fall back for nonbinary radix): computing Real(<random
-- integer>) / (<max random integer>+1). To do so, we first extract an
-- (M-1)-bit significand (where M is Real'Machine_Mantissa), and then
-- decide on a normalized exponent by repeated coin flips, decrementing
-- from 0 as long as we flip heads (1 bits). This process yields the
-- proper geometric distribution for the exponent: in a uniformly
-- distributed set of floating-point numbers, 1/2 of them will be in
-- (0.5, 1], 1/4 will be in (0.25, 0.5], and so forth. It makes a
-- further adjustment at binade boundaries (see comments below) to give
-- the effect of selecting a uniformly distributed real deviate in
-- [0..1] and then rounding to the nearest representable floating-point
-- number. The algorithm attempts to be stingy with random integers. In
-- the worst case, it can consume roughly -Real'Machine_Emin/32 32-bit
-- integers, but this case occurs with probability around
-- 2**Machine_Emin, and the expected number of calls to integer-valued
-- Random is 1. For another discussion of the issues addressed by this
-- process, see Allen Downey's unpublished paper at
-- http://allendowney.com/research/rand/downey07randfloat.pdf.
if Real'Machine_Radix /= 2 then
return Real'Machine
(Real (Unsigned'(Random (Gen))) * 2.0**(-Unsigned'Size));
else
declare
type Bit_Count is range 0 .. 4;
subtype T is Real'Base;
Trailing_Ones : constant array (Unsigned_32 range 0 .. 15)
of Bit_Count :=
[2#00000# => 0, 2#00001# => 1, 2#00010# => 0, 2#00011# => 2,
2#00100# => 0, 2#00101# => 1, 2#00110# => 0, 2#00111# => 3,
2#01000# => 0, 2#01001# => 1, 2#01010# => 0, 2#01011# => 2,
2#01100# => 0, 2#01101# => 1, 2#01110# => 0, 2#01111# => 4];
Pow_Tab : constant array (Bit_Count range 0 .. 3) of Real
:= [0 => 2.0**(0 - T'Machine_Mantissa),
1 => 2.0**(-1 - T'Machine_Mantissa),
2 => 2.0**(-2 - T'Machine_Mantissa),
3 => 2.0**(-3 - T'Machine_Mantissa)];
Extra_Bits : constant Natural :=
(Unsigned'Size - T'Machine_Mantissa + 1);
-- Random bits left over after selecting mantissa
Mantissa : Unsigned;
X : Real; -- Scaled mantissa
R : Unsigned_32; -- Supply of random bits
R_Bits : Natural; -- Number of bits left in R
K : Bit_Count; -- Next decrement to exponent
begin
K := 0;
Mantissa := Random (Gen) / 2**Extra_Bits;
R := Unsigned_32 (Mantissa mod 2**Extra_Bits);
R_Bits := Extra_Bits;
X := Real (2**(T'Machine_Mantissa - 1) + Mantissa); -- Exact
if Extra_Bits < 4 and then R < 2 ** Extra_Bits - 1 then
-- We got lucky and got a zero in our few extra bits
K := Trailing_Ones (R);
else
Find_Zero : loop
-- R has R_Bits unprocessed random bits, a multiple of 4.
-- X needs to be halved for each trailing one bit. The
-- process stops as soon as a 0 bit is found. If R_Bits
-- becomes zero, reload R.
-- Process 4 bits at a time for speed: the two iterations
-- on average with three tests each was still too slow,
-- probably because the branches are not predictable.
-- This loop now will only execute once 94% of the cases,
-- doing more bits at a time will not help.
while R_Bits >= 4 loop
K := Trailing_Ones (R mod 16);
exit Find_Zero when K < 4; -- Exits 94% of the time
R_Bits := R_Bits - 4;
X := X / 16.0;
R := R / 16;
end loop;
-- Do not allow us to loop endlessly even in the (very
-- unlikely) case that Random (Gen) keeps yielding all ones.
exit Find_Zero when X = 0.0;
R := Random (Gen);
R_Bits := 32;
end loop Find_Zero;
end if;
-- K has the count of trailing ones not reflected yet in X. The
-- following multiplication takes care of that, as well as the
-- correction to move the radix point to the left of the mantissa.
-- Doing it at the end avoids repeated rounding errors in the
-- exceedingly unlikely case of ever having a subnormal result.
X := X * Pow_Tab (K);
-- The smallest value in each binade is rounded to by 0.75 of
-- the span of real numbers as its next larger neighbor, and
-- 1.0 is rounded to by half of the span of real numbers as its
-- next smaller neighbor. To account for this, when we encounter
-- the smallest number in a binade, we substitute the smallest
-- value in the next larger binade with probability 1/2.
if Mantissa = 0 and then Unsigned_32'(Random (Gen)) mod 2 = 0 then
X := 2.0 * X;
end if;
return X;
end;
end if;
end Random_Float_Template;
------------
-- Random --
------------
function Random (Gen : Generator) return Float is
function F is new Random_Float_Template (Unsigned_32, Float);
begin
return F (Gen);
end Random;
function Random (Gen : Generator) return Long_Float is
function F is new Random_Float_Template (Unsigned_64, Long_Float);
begin
return F (Gen);
end Random;
function Random (Gen : Generator) return Unsigned_64 is
begin
return Shift_Left (Unsigned_64 (Unsigned_32'(Random (Gen))), 32)
or Unsigned_64 (Unsigned_32'(Random (Gen)));
end Random;
function Random (Gen : Generator) return Unsigned_128 is
begin
return Shift_Left (Unsigned_128 (Unsigned_64'(Random (Gen))), 64)
or Unsigned_128 (Unsigned_64'(Random (Gen)));
end Random;
---------------------
-- Random_Discrete --
---------------------
function Random_Discrete
(Gen : Generator;
Min : Result_Subtype := Default_Min;
Max : Result_Subtype := Result_Subtype'Last) return Result_Subtype
is
begin
if Max = Min then
return Max;
elsif Max < Min then
raise Constraint_Error;
-- In the 128-bit case, we have to be careful since not all 128-bit
-- unsigned values are representable in GNAT's universal integer.
elsif Result_Subtype'Base'Size > 64 then
declare
-- Ignore unequal-size warnings since GNAT's handling is correct.
pragma Warnings ("Z");
function Conv_To_Unsigned is
new Unchecked_Conversion (Result_Subtype'Base, Unsigned_128);
function Conv_To_Result is
new Unchecked_Conversion (Unsigned_128, Result_Subtype'Base);
pragma Warnings ("z");
N : constant Unsigned_128 :=
Conv_To_Unsigned (Max) - Conv_To_Unsigned (Min) + 1;
X, Slop : Unsigned_128;
begin
if N = 0 then
return Conv_To_Result (Conv_To_Unsigned (Min) + Random (Gen));
else
Slop := Unsigned_128'Last rem N + 1;
loop
X := Random (Gen);
exit when Slop = N or else X <= Unsigned_128'Last - Slop;
end loop;
return Conv_To_Result (Conv_To_Unsigned (Min) + X rem N);
end if;
end;
-- In the 64-bit case, we have to be careful since not all 64-bit
-- unsigned values are representable in GNAT's universal integer.
elsif Result_Subtype'Base'Size > 32 then
declare
-- Ignore unequal-size warnings since GNAT's handling is correct.
pragma Warnings ("Z");
function Conv_To_Unsigned is
new Unchecked_Conversion (Result_Subtype'Base, Unsigned_64);
function Conv_To_Result is
new Unchecked_Conversion (Unsigned_64, Result_Subtype'Base);
pragma Warnings ("z");
N : constant Unsigned_64 :=
Conv_To_Unsigned (Max) - Conv_To_Unsigned (Min) + 1;
X, Slop : Unsigned_64;
begin
if N = 0 then
return Conv_To_Result (Conv_To_Unsigned (Min) + Random (Gen));
else
Slop := Unsigned_64'Last rem N + 1;
loop
X := Random (Gen);
exit when Slop = N or else X <= Unsigned_64'Last - Slop;
end loop;
return Conv_To_Result (Conv_To_Unsigned (Min) + X rem N);
end if;
end;
-- In the 32-bit case, we need to handle both integer and enumeration
-- types and, therefore, rely on 'Pos and 'Val in the computation.
elsif Result_Subtype'Pos (Max) - Result_Subtype'Pos (Min) = 2 ** 32 - 1
then
return Result_Subtype'Val
(Result_Subtype'Pos (Min) + Unsigned_32'Pos (Random (Gen)));
else
declare
N : constant Unsigned_32 :=
Unsigned_32 (Result_Subtype'Pos (Max) -
Result_Subtype'Pos (Min) + 1);
Slop : constant Unsigned_32 := Unsigned_32'Last rem N + 1;
X : Unsigned_32;
begin
loop
X := Random (Gen);
exit when Slop = N or else X <= Unsigned_32'Last - Slop;
end loop;
return
Result_Subtype'Val
(Result_Subtype'Pos (Min) + Unsigned_32'Pos (X rem N));
end;
end if;
end Random_Discrete;
------------------
-- Random_Float --
------------------
function Random_Float (Gen : Generator) return Result_Subtype is
begin
if Result_Subtype'Base'Digits > Float'Digits then
return Result_Subtype'Machine (Result_Subtype
(Long_Float'(Random (Gen))));
else
return Result_Subtype'Machine (Result_Subtype
(Float'(Random (Gen))));
end if;
end Random_Float;
-----------
-- Reset --
-----------
procedure Reset (Gen : Generator) is
begin
Init (Gen, Unsigned_32'Mod (Random_Seed.Get_Seed));
end Reset;
procedure Reset (Gen : Generator; Initiator : Integer_32) is
begin
Init (Gen, To_Unsigned (Initiator));
end Reset;
procedure Reset (Gen : Generator; Initiator : Unsigned_32) is
begin
Init (Gen, Initiator);
end Reset;
procedure Reset (Gen : Generator; Initiator : Integer) is
begin
-- This is probably an unnecessary precaution against future change, but
-- since the test is a static expression, no extra code is involved.
if Integer'Size <= 32 then
Init (Gen, To_Unsigned (Integer_32 (Initiator)));
else
declare
Initiator1 : constant Unsigned_64 :=
To_Unsigned (Integer_64 (Initiator));
Init0 : constant Unsigned_32 :=
Unsigned_32 (Initiator1 mod 2 ** 32);
Init1 : constant Unsigned_32 :=
Unsigned_32 (Shift_Right (Initiator1, 32));
begin
Reset (Gen, Initialization_Vector'(Init0, Init1));
end;
end if;
end Reset;
procedure Reset (Gen : Generator; Initiator : Initialization_Vector) is
G : Generator renames Gen.Writable.Self.all;
I, J : Integer;
begin
Init (G, Seed1);
I := 1;
J := 0;
if Initiator'Length > 0 then
for K in reverse 1 .. Integer'Max (N, Initiator'Length) loop
G.S (I) :=
(G.S (I) xor ((G.S (I - 1)
xor Shift_Right (G.S (I - 1), 30)) * Mult1))
+ Initiator (J + Initiator'First) + Unsigned_32 (J);
I := I + 1;
J := J + 1;
if I >= N then
G.S (0) := G.S (N - 1);
I := 1;
end if;
if J >= Initiator'Length then
J := 0;
end if;
end loop;
end if;
for K in reverse 1 .. N - 1 loop
G.S (I) :=
(G.S (I) xor ((G.S (I - 1)
xor Shift_Right (G.S (I - 1), 30)) * Mult2))
- Unsigned_32 (I);
I := I + 1;
if I >= N then
G.S (0) := G.S (N - 1);
I := 1;
end if;
end loop;
G.S (0) := Upper_Mask;
end Reset;
procedure Reset (Gen : Generator; From_State : Generator) is
G : Generator renames Gen.Writable.Self.all;
begin
G.S := From_State.S;
G.I := From_State.I;
end Reset;
procedure Reset (Gen : Generator; From_State : State) is
G : Generator renames Gen.Writable.Self.all;
begin
G.I := 0;
G.S := From_State;
end Reset;
procedure Reset (Gen : Generator; From_Image : String) is
G : Generator renames Gen.Writable.Self.all;
begin
G.I := 0;
for J in 0 .. N - 1 loop
G.S (J) := Extract_Value (From_Image, J);
end loop;
end Reset;
----------
-- Save --
----------
procedure Save (Gen : Generator; To_State : out State) is
Gen2 : Generator;
begin
if Gen.I = N then
Init (Gen2, 5489);
To_State := Gen2.S;
else
To_State (0 .. N - 1 - Gen.I) := Gen.S (Gen.I .. N - 1);
To_State (N - Gen.I .. N - 1) := Gen.S (0 .. Gen.I - 1);
end if;
end Save;
-----------
-- Image --
-----------
function Image (Of_State : State) return String is
Result : Image_String;
begin
Result := [others => ' '];
for J in Of_State'Range loop
Insert_Image (Result, J, Of_State (J));
end loop;
return Result;
end Image;
function Image (Gen : Generator) return String is
Result : Image_String;
begin
Result := [others => ' '];
for J in 0 .. N - 1 loop
Insert_Image (Result, J, Gen.S ((J + Gen.I) mod N));
end loop;
return Result;
end Image;
---------------
-- Put_Image --
---------------
procedure Put_Image
(S : in out Strings.Text_Buffers.Root_Buffer_Type'Class; V : State) is
begin
Strings.Text_Buffers.Put (S, Image (V));
end Put_Image;
-----------
-- Value --
-----------
function Value (Coded_State : String) return State is
Gen : Generator;
S : State;
begin
Reset (Gen, Coded_State);
Save (Gen, S);
return S;
end Value;
----------
-- Init --
----------
procedure Init (Gen : Generator; Initiator : Unsigned_32) is
G : Generator renames Gen.Writable.Self.all;
begin
G.S (0) := Initiator;
for I in 1 .. N - 1 loop
G.S (I) :=
(G.S (I - 1) xor Shift_Right (G.S (I - 1), 30)) * Mult0
+ Unsigned_32 (I);
end loop;
G.I := 0;
end Init;
------------------
-- Insert_Image --
------------------
procedure Insert_Image
(S : in out Image_String;
Index : Integer;
V : State_Val)
is
Value : constant String := State_Val'Image (V);
begin
S (Index * 11 + 1 .. Index * 11 + Value'Length) := Value;
end Insert_Image;
-------------------
-- Extract_Value --
-------------------
function Extract_Value (S : String; Index : Integer) return State_Val is
Start : constant Integer := S'First + Index * Image_Numeral_Length;
begin
return State_Val'Value (S (Start .. Start + Image_Numeral_Length - 1));
end Extract_Value;
end System.Random_Numbers;
|
zhmu/ananas | Ada | 2,262 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . G E N E R I C _ A R R A Y _ S O R T --
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
generic
type Index_Type is (<>);
type Element_Type is private;
type Array_Type is array (Index_Type range <>) of Element_Type;
with function "<" (Left, Right : Element_Type) return Boolean is <>;
procedure Ada.Containers.Generic_Array_Sort (Container : in out Array_Type);
pragma Pure (Ada.Containers.Generic_Array_Sort);
-- Reorders the elements of Container such that the elements are sorted
-- smallest first as determined by the generic formal "<" operator provided.
-- Any exception raised during evaluation of "<" is propagated.
--
-- The actual function for the generic formal function "<" is expected to
-- return the same value each time it is called with a particular pair of
-- element values. It should not modify Container and it should define a
-- strict weak ordering relationship: irreflexive, asymmetric, transitive, and
-- in addition, if x < y for any values x and y, then for all other values z,
-- (x < z) or (z < y). If the actual for "<" behaves in some other manner,
-- the behavior of the instance of Generic_Array_Sort is unspecified. The
-- number of times Generic_Array_Sort calls "<" is unspecified.
|
reznikmm/matreshka | Ada | 10,573 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2009-2017, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- Internal representation of string data in the UTF-16 form.
--
-- Internal representation and operations on it use several optimization
-- techniques, so some important assumption must be taken into account to
-- have expected results:
--
-- - alignment of string's value must be compatible with alignment of the
-- largest supported by platform Unsigned_X type (for portable version of
-- implementation for any 32-bit or 64-bit platform) or with alignment of
-- largest supported vector operand for Single Instruction Multiple Data
-- instructions set when it is used to implement string operations (for
-- x86_64) - to speedup memory access and satisfy typical SIMD
-- requirements;
--
-- - all unused code points in the last largest element must be filled by
-- zero code point - to allows to use optimized version of compare
-- operations.
------------------------------------------------------------------------------
pragma Ada_2012;
with League;
with Matreshka.Atomics.Counters;
with Matreshka.Internals.Unicode.Ucd;
with Matreshka.Internals.Utf16;
package Matreshka.Internals.Strings is
pragma Preelaborate;
use type Matreshka.Internals.Utf16.Utf16_String_Index;
type Utf16_String_Index_Array is
array (Matreshka.Internals.Utf16.Utf16_String_Index range <>)
of Matreshka.Internals.Utf16.Utf16_String_Index;
type Index_Map (Length : Matreshka.Internals.Utf16.Utf16_String_Index) is
record
Map : Utf16_String_Index_Array (0 .. Length);
end record;
-- GNAT: GNAT uses fat pointers for arrays, thus makes impossible to define
-- atomic compare-and-swap operations for access-to-unconstrained-array
-- type.
type Index_Map_Access is access all Index_Map;
pragma Volatile (Index_Map_Access);
type Shared_String (Capacity : Matreshka.Internals.Utf16.Utf16_String_Index)
is limited record
Counter : Matreshka.Atomics.Counters.Counter;
-- Atomic reference counter.
Unused : Matreshka.Internals.Utf16.Utf16_String_Index := 0;
-- First unused element in the Value array.
Length : Natural := 0;
-- Precomputed length of the string in Unicode code points.
Index_Map : aliased Index_Map_Access := null;
pragma Atomic (Index_Map);
pragma Volatile (Index_Map);
-- Mapping of the string's characters index to position inside internal
-- buffer. Used only if string has both BMP and non-BMP characters.
-- Is built on-demand.
Value : Matreshka.Internals.Utf16.Utf16_String (0 .. Capacity);
-- String data. Internal data always has well-formed UTF-16 encoded
-- sequence of valid Unicode code points. Validity checks proceed only
-- for potentially invalid user specified data, and never proceed for
-- the internal data.
end record;
type Shared_String_Access is access all Shared_String;
Shared_Empty : aliased Shared_String :=
(Capacity => Standard'Maximum_Alignment / 2 - 1,
Value => (others => 0),
others => <>);
-- Globally defined empty shared string to be used as default value.
-- Reference and Dereference subprograms known about this object and
-- never change its reference counter for speed optimization (atomic
-- increment/decrement operations have significant perfomance penalty)
-- and allows to be used in Preelaborateable_Initialization types.
procedure Reference (Self : not null Shared_String_Access)
with Inline => True;
-- Increment reference counter. Change of reference counter of Shared_Empty
-- object is prevented to provide speedup and to allow to use it to
-- initialize components of Preelaborateable_Initialization types.
procedure Dereference (Self : in out Shared_String_Access);
-- Decrement reference counter and free resources if it reach zero value.
-- Self is setted to null. Decrement of reference counter and deallocation
-- of Shared_Empty object is prevented to provide minor speedup and to
-- allow use it to initialize components of Preelaborateable_Initialization
-- types.
function Allocate
(Size : Matreshka.Internals.Utf16.Utf16_String_Index)
return not null Shared_String_Access;
-- Allocates new instance of string with specified size. Actual size of the
-- allocated string can be greater. Returns reference to Shared_Empty with
-- incremented counter when Size is zero.
function Can_Be_Reused
(Self : not null Shared_String_Access;
Size : Matreshka.Internals.Utf16.Utf16_String_Index) return Boolean;
pragma Inline (Can_Be_Reused);
-- Returns True when specified shared string can be reused safely. There
-- are two criteria: reference counter must be one (it means this object
-- is not used anywhere); and size of the object is sufficient to store
-- at least specified amount of code units.
procedure Mutate
(Self : in out not null Shared_String_Access;
Size : Matreshka.Internals.Utf16.Utf16_String_Index);
-- Checks whether specified string can be reused to store data of specified
-- size and prepare it to be changed; otherwise allocates new string and
-- copy data.
procedure Compute_Index_Map (Self : in out Shared_String);
-- Compute index map. This operation is thread-safe.
function Hash
(Self : not null Shared_String_Access) return League.Hash_Type;
-- Returns hash value for the string. MurmurHash2, by Austin Appleby is
-- used.
type Sort_Key_Array is
array (Positive range <>)
of Matreshka.Internals.Unicode.Ucd.Collation_Weight;
type Shared_Sort_Key (Size : Natural) is record
Counter : Matreshka.Atomics.Counters.Counter;
-- Atomic reference counter.
Data : Sort_Key_Array (1 .. Size);
-- Sort key data.
Last : Natural := 0;
-- Last element in the data.
end record;
type Shared_Sort_Key_Access is access all Shared_Sort_Key;
Shared_Empty_Key : aliased Shared_Sort_Key := (Size => 0, others => <>);
-- Globally defined shared empty sort key to be used as default value.
-- Reference and Dereference subprograms knoen about this object and
-- never change its reference counter for speed optimization (atomic
-- increment/decrement operations have significant performance penalty)
-- and allows to be used in Preelaborateable_Initialization types.
procedure Reference (Self : not null Shared_Sort_Key_Access)
with Inline => True;
-- Increment reference counter. Change of refernce counter of
-- Shared_Empty_Key object is prevented to provide speedup and to allow
-- to use it to initialize components of Preelaborateable_Initialization
-- types.
procedure Dereference (Self : in out Shared_Sort_Key_Access);
-- Decrement reference counter and free resources if it reach zero value.
-- Self is setted to null for safety reasons. Decrement of reference
-- counter and deallocation of Shared_Empty_Key object is prevented to
-- provide minor speedup and to allow to use it to initialize components
-- of Preelaborateable_Initialization types.
end Matreshka.Internals.Strings;
|
charlie5/aIDE | Ada | 18,019 | adb | with
aIDE,
aIDE.Gui,
aIDE.Palette.of_packages_subpackages,
-- AdaM.a_Package,
AdaM.Environment,
AdaM.Assist,
Glib,
Glib.Error,
Glib.Object,
Gtk.Builder,
Gtk.Handlers,
Gtk.Label,
Pango.Font,
Common_Gtk,
Ada.Containers.Ordered_Sets,
Ada.Containers.Vectors;
with Ada.Text_IO; use Ada.Text_IO;
package body aIDE.Palette.of_packages
is
use Glib,
Glib.Error,
Glib.Object,
Gtk.Builder,
Gtk.Button,
Gtk.GEntry,
Common_Gtk,
Gtk.Window;
-- Recent Packages - ToDo: Refactor this out, if possible.
--
package body recent_Packages
is
type package_Usage is
record
the_Package : AdaM.a_Package.view;
-- Name : AdaM.Text; -- The package name.
Count : Natural; -- Number of times the package has been used.
end record;
function "<" (L, R : in package_Usage) return Boolean
is
use type AdaM.Identifier;
begin
return L.the_Package.full_Name < R.the_Package.full_Name;
end "<";
overriding function "=" (L, R : in package_Usage) return Boolean
is
use type AdaM.Identifier;
begin
return L.the_Package.full_Name = R.the_Package.full_Name;
end "=";
package package_Usage_Sets is new ada.Containers.Ordered_Sets (package_Usage);
the_usage_Stats : package_Usage_Sets.Set;
-- procedure register_Usage (package_Name : in AdaM.Text;
-- the_Package : in AdaM.a_Package.view)
-- is
-- use package_Usage_Sets;
--
-- the_type_Usage : package_Usage := (the_Package, package_Name, others => <>);
-- Current : constant package_Usage_Sets.Cursor := the_usage_Stats.find (the_type_Usage);
-- begin
-- if Current /= No_Element
-- then
-- the_type_Usage.Count := Element (Current).Count + 1;
-- the_usage_Stats.replace_Element (Current, the_type_Usage);
-- else
-- the_type_Usage.Count := 1;
-- the_usage_Stats.insert (the_type_Usage);
-- end if;
-- end register_Usage;
procedure register_Usage (the_Package : in AdaM.a_Package.view)
is
use package_Usage_Sets;
the_type_Usage : package_Usage := (the_Package, others => <>);
Current : constant package_Usage_Sets.Cursor := the_usage_Stats.find (the_type_Usage);
begin
if Current /= No_Element
then
the_type_Usage.Count := Element (Current).Count + 1;
the_usage_Stats.replace_Element (Current, the_type_Usage);
else
the_type_Usage.Count := 1;
the_usage_Stats.insert (the_type_Usage);
end if;
end register_Usage;
function fetch return AdaM.a_Package.vector
is
use package_Usage_Sets,
ada.Containers;
-- the_Lines : AdaM.text_Lines;
the_Packages : AdaM.a_Package.vector;
package type_Usage_Vectors is new ada.Containers.Vectors (Positive, package_Usage);
use type_Usage_Vectors;
the_usage_List : type_Usage_Vectors.Vector;
begin
declare
Cursor : package_Usage_Sets.Cursor := the_usage_Stats.First;
begin
while has_Element (Cursor)
loop
if Element (Cursor).Count > 0 then
the_usage_List.append (Element (Cursor));
end if;
exit when the_Packages.Length = 25; -- Limit results to 25 entries.
next (Cursor);
end loop;
end;
declare
function "<" (L, R : in package_Usage) return Boolean
is
begin
return L.Count > R.Count;
end "<";
package Sorter is new type_Usage_Vectors.Generic_Sorting ("<");
begin
Sorter.sort (the_usage_List);
end;
declare
Cursor : type_Usage_Vectors.Cursor := the_usage_List.First;
begin
while has_Element (Cursor)
loop
if Element (Cursor).Count > 0
then
the_Packages.append (Element (Cursor).the_Package);
end if;
next (Cursor);
end loop;
end;
return the_Packages;
end fetch;
-- function fetch return AdaM.text_Lines
-- is
-- use package_Usage_Sets,
-- ada.Containers;
--
-- the_Lines : AdaM.text_Lines;
--
-- package type_Usage_Vectors is new ada.Containers.Vectors (Positive, package_Usage);
-- use type_Usage_Vectors;
--
-- the_usage_List : type_Usage_Vectors.Vector;
--
-- begin
-- declare
-- Cursor : package_Usage_Sets.Cursor := the_usage_Stats.First;
-- begin
-- while has_Element (Cursor)
-- loop
-- if Element (Cursor).Count > 0 then
-- the_usage_List.append (Element (Cursor));
-- end if;
--
-- exit when the_Lines.Length = 25;
-- next (Cursor);
-- end loop;
-- end;
--
-- declare
-- function "<" (L, R : in package_Usage) return Boolean
-- is
-- begin
-- return L.Count > R.Count;
-- end "<";
--
-- package Sorter is new type_Usage_Vectors.Generic_Sorting ("<");
-- begin
-- Sorter.sort (the_usage_List);
-- end;
--
-- declare
-- Cursor : type_Usage_Vectors.Cursor := the_usage_List.First;
-- begin
-- while has_Element (Cursor)
-- loop
-- if Element (Cursor).Count > 0 then
-- the_Lines.Append (Element (Cursor).Name);
-- end if;
--
-- exit when the_Lines.Length = 25;
-- next (Cursor);
-- end loop;
-- end;
--
-- return the_Lines;
-- end fetch;
procedure read (From : access Ada.Streams.Root_Stream_Type'Class)
is
begin
package_Usage_Sets.Set'read (From, the_usage_Stats);
end read;
procedure write (To : access Ada.Streams.Root_Stream_Type'Class)
is
begin
package_Usage_Sets.Set'write (To, the_usage_Stats);
end write;
end recent_Packages;
----------
-- Events
--
procedure on_ok_Button_clicked (the_Button : access Gtk_Button_Record'Class;
Self : in aIDE.Palette.of_packages.view)
is
pragma Unreferenced (the_Button);
begin
Self.choice_is (Self.new_package_Entry.get_Text, null);
Self.Top.hide;
end on_ok_Button_clicked;
procedure on_close_Button_clicked (the_Button : access Gtk_Button_Record'Class;
Self : in aIDE.Palette.of_packages.view)
is
pragma Unreferenced (the_Button);
begin
Self.Top.hide;
end on_close_Button_clicked;
package Button_Callbacks is new Gtk.Handlers.User_Callback (Gtk_Button_Record,
aIDE.Palette.of_packages.view);
use gtk.Label;
type label_Info is
record
package_Name : AdaM.Text;
Palette : aIDE.Palette.of_packages.view;
the_Package : Adam.a_Package.view;
end record;
function on_tab_Label_clicked (the_Label : access Gtk_Label_Record'Class;
Info : in label_Info) return Boolean
is
use AdaM,
gtk.Widget;
Self : aIDE.Palette.of_packages.view renames Info.Palette;
the_Notebook : constant gtk_Notebook := gtk_Notebook (the_Label.Get_Parent);
the_page_Num : gInt;
begin
for i in 0 .. the_Notebook.Get_N_Pages - 1
loop
if the_Notebook.get_tab_Label (the_Notebook.Get_Nth_Page (i)) = gtk_Widget (the_Label)
then
the_page_Num := i;
end if;
end loop;
if the_page_Num = the_Notebook.get_current_Page
then
Self.choice_is (+Info.package_Name, Info.the_Package);
Self.Top.hide;
else
the_Notebook.set_current_Page (the_page_Num);
end if;
return False;
end on_tab_Label_clicked;
package Label_return_Callbacks is new Gtk.Handlers.User_Return_Callback (Gtk_Label_Record,
Boolean,
label_Info);
---------
-- Forge
--
function to_packages_Palette return View
is
Self : constant Palette.of_packages.view := new Palette.of_packages.item;
the_Builder : Gtk_Builder;
Error : aliased GError;
Result : Guint;
pragma Unreferenced (Result);
begin
gtk_New (the_Builder);
Result := the_Builder.add_from_File ("glade/palette/packages_palette.glade", Error'Access);
if Error /= null
then
Put_Line ("Error: 'adam.Palette.packages.to_packages_Palette' ~ " & Get_Message (Error));
Error_Free (Error);
end if;
Self.Top := gtk_Window (the_Builder.get_Object ("top_Window"));
Self.top_Notebook := gtk_Notebook (the_Builder.get_Object ("top_Notebook"));
Self.all_Notebook := gtk_Notebook (the_Builder.get_Object ("all_Notebook"));
Self.recent_Table := gtk_Table (the_Builder.get_Object ("recent_Table"));
Self.close_Button := gtk_Button (the_Builder.get_Object ("close_Button"));
Self.ok_Button := gtk_Button (the_Builder.get_Object ("ok_Button"));
Self.new_package_Entry := gtk_Entry (the_Builder.get_Object ("new_package_Entry"));
Self.Top.modify_Font (Font_Desc => Pango.Font.From_String ("Courier 10"));
Button_Callbacks.connect (Self.ok_Button,
"clicked",
on_ok_Button_clicked'Access,
Self);
Button_Callbacks.connect (Self.close_Button,
"clicked",
on_close_Button_clicked'Access,
Self);
Self.freshen;
enable_bold_Tabs_for (Self.top_Notebook);
enable_bold_Tabs_for (Self.all_Notebook);
return Self;
end to_packages_Palette;
-- Attributes
--
function top_Widget (Self : in Item) return gtk.Widget.Gtk_Widget
is
begin
return gtk.Widget.Gtk_Widget (Self.Top);
end top_Widget;
-- Operations
--
procedure choice_is (Self : in out Item; package_Name : in String;
the_Package : in AdaM.a_Package.view)
is
use AdaM,
AdaM.Assist;
use type AdaM.context_Line.view,
AdaM.a_Package.view;
full_Name : constant String := package_Name;
begin
-- recent_Packages.register_Usage (+full_Name, the_Package);
recent_Packages.register_Usage (the_Package);
Self.build_recent_List;
if Self.Invoked_by /= null
then
-- Self.Invoked_by.set_Label (full_Name);
Self.Invoked_by.set_Label (String (identifier_Suffix (the_Package.full_Name, 2)));
Self.Invoked_by.set_Tooltip_Text (String (the_Package.full_Name));
end if;
if Self.Target /= null and Self.Target_2 /= null
then
raise program_Error with "Self.Target /= null and Self.Target_2 /= null";
end if;
if Self.Target /= null
then
Self.Target.Name_is (full_Name);
Self.Target.Package_is (the_Package.all'Access);
elsif Self.Target_2 /= null
then
-- put_Line ("JJJJJ " & String (Self.Target_2.Name));
-- aIDE.Gui.set_selected_Package (to => Self.Target_2);
put_Line ("JJJJJ " & String (the_Package.Name));
aIDE.Gui.set_selected_Package (to => the_Package);
else
raise program_Error with "No target has been set";
end if;
Self.Top.hide;
end choice_is;
procedure show (Self : in out Item; Invoked_by : in Gtk.Button.gtk_Button;
Target : in AdaM.context_Line.view)
is
begin
Self.Invoked_by := Invoked_by;
Self.Target := Target;
Self.Target_2 := null;
Self.Top.show_All;
end show;
procedure show (Self : in out Item; Invoked_by : in Gtk.Button.gtk_Button;
Target : in AdaM.a_Package.view)
is
begin
Self.Invoked_by := Invoked_by;
Self.Target_2 := Target;
Self.Target := null;
Self.freshen;
Self.Top.show_All;
end show;
procedure freshen (Self : in out Item)
is
use AdaM;
-- the_Environ : AdaM.Environment.Item renames aIDE.the_Environ;
begin
-- Clear out old notebook pages.
--
while Self.all_Notebook.Get_N_Pages > 0
loop
Self.all_Notebook.Get_Nth_Page (0).Destroy;
end loop;
-- Build the Gui tree.
--
build_Gui_Tree:
declare
procedure build_Gui_for (the_Package : in AdaM.a_Package.view;
children_Notebook : in gtk_Notebook)
is
the_Children : AdaM.a_Package.Vector renames the_Package.child_Packages;
the_packages_Palette_package : constant Palette.of_packages_subpackages.view
:= aIDE.Palette.of_packages_subpackages.to_packages_Palette_package;
begin
-- Build the package pane.
--
the_packages_Palette_package.Parent_is (Self'unchecked_Access);
the_packages_Palette_package.top_Widget.reparent (children_Notebook);
children_Notebook.set_Tab_Label_Text (the_packages_Palette_package.top_Widget,
+the_Package.Name);
-- Configure event handling.
--
declare
use gtk.Label;
the_tab_Label : constant gtk_Label
:= gtk_Label (children_Notebook.get_tab_Label (the_packages_Palette_package.top_Widget));
begin
the_tab_Label.set_Selectable (True);
label_return_Callbacks.connect (the_tab_Label,
"button-release-event",
on_tab_Label_clicked'Access,
(package_name => +(+the_Package.Name),
palette => Self'unchecked_Access,
the_Package => the_Package));
end;
-- Build each childs Gui.
--
for i in 1 .. Integer (the_Children.Length)
loop
build_Gui_for (the_Children.Element (i),
the_packages_Palette_package.children_Notebook); -- Recurse.
end loop;
the_packages_Palette_package.children_Notebook.Popup_enable;
enable_bold_Tabs_for (the_packages_Palette_package.children_Notebook);
end build_Gui_for;
begin
-- Recursively add sub-gui's for each package, rooted at 'Standard'.
--
for i in 1 .. Integer (a_Package.item (the_entity_Environ.standard_Package.all).child_Packages.Length)
loop
put_Line ("Building GUI for '" & (+the_entity_Environ.standard_Package.child_Packages.Element (i).Name) & "'");
build_Gui_for (the_entity_Environ.standard_Package.child_Packages.Element (i),
Self.all_Notebook);
end loop;
Self.all_Notebook.Popup_enable;
Self.all_Notebook.Show_All;
end build_Gui_Tree;
Self.build_recent_List;
end freshen;
procedure destroy_Callback (Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class)
is
begin
Widget.destroy;
end destroy_Callback;
procedure build_recent_List (Self : in out Item)
is
-- the_Recent : constant AdaM.text_Lines := recent_Packages.fetch;
the_Recent : constant AdaM.a_Package.vector := recent_Packages.fetch;
the_Button : gtk_Button;
Row, Col : Guint := 0;
begin
put_Line ("build_recent_List");
Self.recent_Table.Foreach (destroy_Callback'Access);
for i in 1 .. Integer (the_Recent.Length)
loop
declare
use AdaM;
the_Package : AdaM.a_Package.view renames the_Recent.Element (i);
begin
the_Button := aIDE.Palette.of_packages_subpackages.new_Button (for_Package => the_Package,
Named => +the_Package.Name,
packages_Palette => Self'unchecked_Access);
Self.recent_Table.attach (the_Button,
Col, Col + 1,
Row, Row + 1,
Xoptions => 0,
Yoptions => 0);
the_Button.show_All;
if Row = 6
then
Row := 0;
Col := Col + 1;
else
Row := Row + 1;
end if;
end;
end loop;
end build_recent_List;
end aIDE.Palette.of_packages;
|
charlie5/lace | Ada | 6,032 | ads | with
openGL.Glyph.Container,
freetype.Face,
freetype.charMap,
Freetype_C,
interfaces.C.Pointers;
limited
with
openGL.Font;
private
with
freetype.face_Size;
package openGL.FontImpl
--
-- Implements an openGL font.
--
is
type Item is tagged limited private;
type View is access all Item'Class;
---------
-- Types
--
type RenderMode is (RENDER_FRONT, RENDER_BACK, RENDER_SIDE, RENDER_ALL);
for RenderMode use (RENDER_FRONT => 16#0001#,
RENDER_BACK => 16#0002#,
RENDER_SIDE => 16#0004#,
RENDER_ALL => 16#ffff#);
type TextAlignment is (ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT, ALIGN_JUSTIFY);
for TextAlignment use (ALIGN_LEFT => 0,
ALIGN_CENTER => 1,
ALIGN_RIGHT => 2,
ALIGN_JUSTIFY => 3);
-- unsigned_char_Pointer
--
use Interfaces;
type unsigned_char_array is array (C.size_t range <>) of aliased C.unsigned_char;
package unsigned_char_Pointers is new C.Pointers (Index => C.size_t,
Element => C.unsigned_char,
Element_array => unsigned_char_array,
default_Terminator => 0);
subtype unsigned_char_Pointer is unsigned_char_Pointers.Pointer;
---------
-- Forge
--
procedure define (Self : access Item; ftFont : access Font.item'Class;
fontFilePath : in String);
procedure define (Self : access Item; ftFont : access Font.item'Class;
pBufferBytes : access C.unsigned_char;
bufferSizeInBytes : in Integer);
procedure destruct (Self : in out Item);
---------------
-- 'Protected' ~ For derived class use only.
--
function Err (Self : in Item) return freetype_c.FT_Error;
function attach (Self : access Item; fontFilePath : in String) return Boolean;
function attach (Self : access Item; pBufferBytes : access C.unsigned_char;
bufferSizeInBytes : in Integer) return Boolean;
function FaceSize (Self : access Item; Size : in Natural;
x_Res,
y_Res : in Natural) return Boolean;
function FaceSize (Self : in Item) return Natural;
procedure Depth (Self : in out Item; Depth : in Real);
procedure Outset (Self : in out Item; Outset : in Real);
procedure Outset (Self : in out Item; Front : in Real;
Back : in Real);
procedure GlyphLoadFlags (Self : in out Item; Flags : in freetype_c.FT_Int);
function CharMap (Self : access Item; Encoding : in freetype_c.FT_Encoding) return Boolean;
function CharMapCount (Self : in Item) return Natural;
function CharMapList (Self : access Item) return freetype.face.FT_Encodings_view;
function Ascender (Self : in Item) return Real;
function Descender (Self : in Item) return Real;
function LineHeight (Self : in Item) return Real;
function BBox (Self : access Item; Text : in String;
Length : in Integer;
Position : in Vector_3;
Spacing : in Vector_3) return Bounds;
function Advance (Self : access Item; Text : in String;
Length : in Integer;
Spacing : in Vector_3) return Real;
function kern_Advance (Self : in Item; From, To : in Character) return Real;
function x_PPEM (Self : in Item) return Real;
function x_Scale (Self : in Item) return Real;
function y_Scale (Self : in Item) return Real;
function render (Self : access Item; Text : in String;
Length : in Integer;
Position : in Vector_3;
Spacing : in Vector_3;
renderMode : in Integer) return Vector_3;
private
type glyph_Container_view is access all openGL.Glyph.Container.item'Class;
type Item is tagged limited
record
Face : aliased freetype.Face.item; -- Current face object.
charSize : freetype.face_Size.item; -- Current size object.
load_Flags : freetype_c.FT_Int; -- The default glyph loading flags.
Err : freetype_c.FT_Error; -- Current error code. Zero means no error.
Intf : access Font.item'Class; -- A link back to the interface of which we implement.
glyphList : Glyph_Container_view; -- An object that holds a list of glyphs
Pen : Vector_3; -- Current pen or cursor position;
end record;
function CheckGlyph (Self : access Item; Character : in freetype.charmap.CharacterCode) return Boolean;
--
-- Check that the glyph at <code>chr</code> exist. If not load it.
--
-- Character: The character index.
--
-- Returns true if the glyph can be created.
end openGL.FontImpl;
|
Fabien-Chouteau/GESTE | Ada | 241,357 | ads | with GESTE;
pragma Style_Checks (Off);
package Game_Assets.Tileset_Collisions is
Tiles : aliased constant GESTE.Tile_Collisions_Array :=
(
1 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
2 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
3 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
4 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
5 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
6 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
7 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
8 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
9 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
10 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
11 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
12 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
13 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
14 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
15 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
16 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
17 => ((False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
18 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
19 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True)),
20 => ((False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
21 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,True,True,True,True,True,True,True,True)),
22 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True)),
23 => ((False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
24 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
25 => ((False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
26 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
27 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
28 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False)),
29 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True)),
30 => ((False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
31 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True)),
32 => ((False,False,False,False,False,False,False,False,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,True)),
33 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
34 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
35 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
36 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
37 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
38 => ((True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
39 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False)),
40 => ((False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
41 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
42 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
43 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True)),
44 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
45 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
46 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
47 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
48 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
49 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
50 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
51 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
52 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
53 => ((True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
54 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
55 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,False,False,False,False,False,False,False,False,False)),
56 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
57 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
58 => ((True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
59 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
60 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
61 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False)),
62 => ((True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
63 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
64 => ((False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
65 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False)),
66 => ((True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
67 => ((True,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False)),
68 => ((True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
69 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
70 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
71 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
72 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
73 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
74 => ((False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True)),
75 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(False,False,False,True,True,True,True,True,True,True,True,True,True,False,False,False),
(False,False,False,False,True,True,True,True,True,True,True,True,False,False,False,False)),
76 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False)),
77 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
78 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False)),
79 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
80 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
81 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
82 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,True,True,True,True)),
83 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
84 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
85 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
86 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
87 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
88 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
89 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
90 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
91 => ((False,False,False,False,True,True,True,True,True,True,True,True,False,False,False,False),
(False,False,False,True,True,True,True,True,True,True,True,True,True,False,False,False),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
92 => ((True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False)),
93 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
94 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
95 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
96 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
97 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
98 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
99 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
100 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
101 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
102 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
103 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
104 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
105 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
106 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
107 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True)),
108 => ((False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
109 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
110 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
111 => ((True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
112 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False)),
113 => ((False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
114 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
115 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
116 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
117 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
118 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
119 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
120 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
121 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
122 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
123 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
124 => ((False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
125 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,True,True,True,True)),
126 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
127 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
128 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False)),
129 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
130 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
131 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False)),
132 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False)),
133 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
134 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
135 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
136 => ((True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
137 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
138 => ((False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False)),
139 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True)),
140 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
141 => ((False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
142 => ((True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
143 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True)),
144 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
145 => ((True,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,False,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,False,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,False,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False)),
146 => ((False,False,False,False,False,False,False,False,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,True,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,True)),
147 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
148 => ((True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,False,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,False,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,False,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,False,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,False),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
149 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False),
(False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,True),
(False,False,False,False,False,False,False,False,False,False,False,False,False,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,False,True,True,True,True,True,True),
(False,False,False,False,False,False,False,False,True,True,True,True,True,True,True,True),
(False,False,False,False,False,False,True,True,True,True,True,True,True,True,True,True),
(False,False,False,False,True,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
150 => ((False,False,False,False,False,False,False,False,False,False,False,False,False,True,True,True),
(False,False,False,False,False,False,False,False,False,False,False,True,True,True,True,True),
(False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True),
(False,False,False,False,False,False,False,True,True,True,True,True,True,True,True,True),
(False,False,False,False,False,True,True,True,True,True,True,True,True,True,True,True),
(False,False,False,True,True,True,True,True,True,True,True,True,True,True,True,True),
(False,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)),
151 => ((True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True),
(True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True)));
end Game_Assets.Tileset_Collisions;
|
wookey-project/ewok-legacy | Ada | 10,538 | adb | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with ewok.tasks; use ewok.tasks;
with ewok.tasks_shared; use ewok.tasks_shared;
with ewok.devices_shared; use ewok.devices_shared;
with ewok.exported.devices; use ewok.exported.devices;
with ewok.devices;
with ewok.sanitize;
with ewok.dma;
with ewok.syscalls.dma;
with ewok.mpu;
with ewok.perm;
with ewok.sched;
with ewok.debug;
package body ewok.syscalls.init
with spark_mode => off
is
package TSK renames ewok.tasks;
procedure init_do_reg_devaccess
(caller_id : in ewok.tasks_shared.t_task_id;
params : in t_parameters;
mode : in ewok.tasks_shared.t_task_mode)
is
udev : aliased ewok.exported.devices.t_user_device
with import, address => to_address (params(1));
-- Device descriptor transmitted to userspace
descriptor : unsigned_8 range 0 .. ewok.tasks.MAX_DEVS_PER_TASK
with address => to_address (params(2));
dev_id : ewok.devices_shared.t_device_id;
ok : boolean;
begin
-- Forbidden after end of task initialization
if TSK.is_init_done (caller_id) then
goto ret_denied;
end if;
-- NOTE
-- The kernel might register some devices using this syscall
-- for user tasks. The device_t structure may be stored in
-- RAM (.data section) or in flash (.rodata section)
if TSK.is_real_user (caller_id) and then
(not ewok.sanitize.is_range_in_data_slot
(to_system_address (udev'address),
udev'size/8,
caller_id,
mode)
and
not ewok.sanitize.is_range_in_txt_slot
(to_system_address (udev'address),
udev'size/8,
caller_id))
then
pragma DEBUG (debug.log (debug.ERROR,
"init_do_reg_devaccess(): udev not in task's memory space"));
goto ret_denied;
end if;
if TSK.is_real_user (caller_id) and then
not ewok.sanitize.is_word_in_data_slot
(to_system_address (descriptor'address), caller_id, mode)
then
pragma DEBUG (debug.log (debug.ERROR,
"init_do_reg_devaccess(): descriptor not in task's memory space"));
goto ret_denied;
end if;
-- Ada based sanitization
if not udev'valid_scalars
then
pragma DEBUG (debug.log (debug.ERROR, "init_do_reg_devaccess(): invalid udev scalars"));
goto ret_inval;
end if;
if TSK.is_real_user (caller_id) and then
not ewok.devices.sanitize_user_defined_device
(udev'unchecked_access, caller_id)
then
pragma DEBUG (debug.log (debug.ERROR, "init_do_reg_devaccess(): invalid udev"));
goto ret_inval;
end if;
if TSK.tasks_list(caller_id).num_devs = TSK.MAX_DEVS_PER_TASK then
pragma DEBUG (debug.log (debug.ERROR,
"init_do_reg_devaccess(): no space left to register the device"));
goto ret_busy;
end if;
if udev.size > 0 and
udev.map_mode = DEV_MAP_AUTO and
TSK.tasks_list(caller_id).num_devs_mounted = ewok.mpu.MAX_DEVICE_REGIONS
then
pragma DEBUG (debug.log (debug.ERROR,
"init_do_reg_devaccess(): no free region left to map the device"));
goto ret_busy;
end if;
--
-- Registering the device
--
ewok.devices.register_device (caller_id, udev'unchecked_access, dev_id, ok);
if not ok then
pragma DEBUG (debug.log (debug.ERROR,
"init_do_reg_devaccess(): failed to register the device"));
goto ret_denied;
end if;
--
-- Recording registered devices in the task record
--
TSK.append_device
(caller_id, dev_id, descriptor, ok);
if not ok then
raise program_error; -- Should never happen here
end if;
-- Mount DEV_MAP_AUTO devices in memory
if udev.size > 0 and udev.map_mode = DEV_MAP_AUTO then
TSK.mount_device (caller_id, dev_id, ok);
if not ok then
raise program_error; -- Should never happen here
end if;
end if;
set_return_value (caller_id, mode, SYS_E_DONE);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_busy>>
set_return_value (caller_id, mode, SYS_E_BUSY);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_inval>>
set_return_value (caller_id, mode, SYS_E_INVAL);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_denied>>
set_return_value (caller_id, mode, SYS_E_DENIED);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
end init_do_reg_devaccess;
procedure init_do_done
(caller_id : in ewok.tasks_shared.t_task_id;
mode : in ewok.tasks_shared.t_task_mode)
is
ok : boolean;
udev : ewok.devices.t_checked_user_device_access;
begin
-- Forbidden after end of task initialization
if TSK.is_init_done (caller_id) then
goto ret_denied;
end if;
-- We enable auto mapped devices (MAP_AUTO)
for i in TSK.tasks_list(caller_id).device_id'range loop
if TSK.tasks_list(caller_id).device_id(i) /= ID_DEV_UNUSED then
udev := ewok.devices.get_user_device
(TSK.tasks_list(caller_id).device_id(i));
if udev.all.map_mode = DEV_MAP_AUTO then
-- FIXME - Create new syscalls for enabling/disabling devices?
ewok.devices.enable_device
(TSK.tasks_list(caller_id).device_id(i), ok);
if not ok then
goto ret_denied;
end if;
end if;
end if;
end loop;
#if CONFIG_KERNEL_DMA_ENABLE
for i in 1 .. TSK.tasks_list(caller_id).num_dma_id loop
ewok.dma.enable_dma_irq (TSK.tasks_list(caller_id).dma_id(i));
end loop;
#end if;
TSK.tasks_list(caller_id).init_done := true;
set_return_value (caller_id, mode, SYS_E_DONE);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
-- Request a schedule to ensure that the task has its devices mapped
-- afterward
-- FIXME - has to be changed when device mapping will be synchronously done
ewok.sched.request_schedule;
return;
<<ret_denied>>
set_return_value (caller_id, mode, SYS_E_DENIED);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
end init_do_done;
procedure init_do_get_taskid
(caller_id : in ewok.tasks_shared.t_task_id;
params : in t_parameters;
mode : in ewok.tasks_shared.t_task_mode)
is
target_name : TSK.t_task_name
with address => to_address (params(1));
target_id : ewok.tasks_shared.t_task_id
with address => to_address (params(2));
tmp_id : ewok.tasks_shared.t_task_id;
begin
-- Forbidden after end of task initialization
if TSK.is_init_done (caller_id) then
goto ret_denied;
end if;
-- Does &target_id is in the caller address space ?
if not ewok.sanitize.is_word_in_data_slot
(to_system_address (target_id'address), caller_id, mode)
then
goto ret_denied;
end if;
-- We retrieve the 'id' related to the target name. Before updating the
-- parameter passed by the user, we must check that the 2 tasked are
-- allowed to communicate
tmp_id := TSK.get_task_id (target_name);
if tmp_id = ID_UNUSED then
goto ret_inval;
end if;
#if CONFIG_KERNEL_DOMAIN
if TSK.get_domain (tmp_id) /= TSK.get_domain (caller_id) then
goto ret_inval;
end if;
#end if;
-- Are tasks allowed to communicate through IPCs or DMA_SHM ?
if not ewok.perm.ipc_is_granted (caller_id, tmp_id) and
not ewok.perm.dmashm_is_granted (caller_id, tmp_id)
then
goto ret_inval;
end if;
-- We may update the target_id
target_id := tmp_id;
set_return_value (caller_id, mode, SYS_E_DONE);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_inval>>
set_return_value (caller_id, mode, SYS_E_INVAL);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_denied>>
set_return_value (caller_id, mode, SYS_E_DENIED);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
end init_do_get_taskid;
procedure sys_init
(caller_id : in ewok.tasks_shared.t_task_id;
params : in out t_parameters;
mode : in ewok.tasks_shared.t_task_mode)
is
syscall : t_syscalls_init
with import, address => params(0)'address;
begin
if not syscall'valid then
set_return_value (caller_id, mode, SYS_E_INVAL);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
end if;
case syscall is
when INIT_DEVACCESS => init_do_reg_devaccess
(caller_id, params, mode);
#if CONFIG_KERNEL_DMA_ENABLE
when INIT_DMA => ewok.syscalls.dma.init_do_reg_dma
(caller_id, params, mode);
when INIT_DMA_SHM => ewok.syscalls.dma.init_do_reg_dma_shm
(caller_id, params, mode);
#end if;
when INIT_GETTASKID => init_do_get_taskid (caller_id, params, mode);
when INIT_DONE => init_do_done (caller_id, mode);
end case;
end sys_init;
end ewok.syscalls.init;
|
reznikmm/matreshka | Ada | 3,694 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Style_Width_Attributes is
pragma Preelaborate;
type ODF_Style_Width_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Style_Width_Attribute_Access is
access all ODF_Style_Width_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Style_Width_Attributes;
|
skordal/ada-regex | Ada | 4,077 | ads | -- Ada regular expression library
-- (c) Kristian Klomsten Skordal 2020 <[email protected]>
-- Report bugs and issues on <https://github.com/skordal/ada-regex>
with Ada.Iterator_Interfaces;
private with Ada.Finalization;
private with Ada.Unchecked_Deallocation;
-- Simple ordered set designed for use with few items. Inserting identical
-- elements will not cause exceptions to be raised, they will instead be
-- merged with existing items.
generic
type Element_Type is private;
with function "=" (Left, Right : in Element_Type) return Boolean is <>;
with function "<" (Left, Right : in Element_Type) return Boolean is <>;
package Regex.Utilities.Sorted_Sets is
-- Sorted set object.
type Sorted_Set is tagged private with
Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type;
-- Converts a single value of the Element_Type to a sorted set:
function To_Set (Item : in Element_Type) return Sorted_Set;
-- Creates a set with the specified capacity:
function Create_Set (Capacity : in Natural) return Sorted_Set;
-- Creates an empty set:
function Empty_Set return Sorted_Set is (Create_Set (0));
-- Gets the number of items in the set:
function Length (This : in Sorted_Set) return Natural with Inline;
-- Adds an item to the set:
procedure Add (This : in out Sorted_Set; Item : in Element_Type);
-- Adds all items of another set to a set:
procedure Add (This : in out Sorted_Set; Items : in Sorted_Set);
-- Checks if an element exists in the set:
function Element_Exists (This : in Sorted_Set; Item : in Element_Type) return Boolean;
-- Appends an item to a set, returning the new set:
function "&" (Left : in Sorted_Set; Right : in Element_Type) return Sorted_Set;
-- Merges two sorted sets:
function "&" (Left, Right : in Sorted_Set) return Sorted_Set;
-- Compares two sorted sets for equality by comparing each element in the sets:
function "=" (Left, Right : in Sorted_Set) return Boolean;
-- Create iterators for sorted sets:
type Cursor is private;
function Has_Element (Position : in Cursor) return Boolean;
package Set_Iterators is new Ada.Iterator_Interfaces (Cursor, Has_Element);
-- Returns an iterator that can be used to iterate throught the items in a set:
function Iterate (This : in Sorted_Set) return Set_Iterators.Forward_Iterator'Class;
-- Returns the value of an element:
function Element_Value (This : in Sorted_Set; Position : in Cursor) return Element_Type;
-- Indexing:
type Constant_Reference_Type (Item : not null access constant Element_Type) is private
with Implicit_Dereference => Item;
function Constant_Reference (This : in Sorted_Set; Position : in Cursor)
return Constant_Reference_Type;
private
Default_Capacity : constant Natural := 5;
type Item_Array is array (Positive range <>) of aliased Element_Type;
type Item_Array_Access is access Item_Array;
procedure Free_Item_Array is new Ada.Unchecked_Deallocation (
Item_Array, Item_Array_Access);
type Sorted_Set is new Ada.Finalization.Controlled with record
Items : Item_Array_Access := null;
Capacity : Natural := 0;
Item_Count : Natural := 0;
end record;
overriding procedure Adjust (This : in out Sorted_Set);
overriding procedure Finalize (This : in out Sorted_Set);
procedure Enlarge_Item_Array (This : in out Sorted_Set);
type Cursor is record
Items : Item_Array_Access;
Index, End_Index : Natural;
end record;
type Set_Iterator is new Set_Iterators.Forward_Iterator with record
Items : Item_Array_Access;
Item_Count : Natural;
end record;
overriding function First (This : in Set_Iterator) return Cursor;
overriding function Next (This : in Set_Iterator; Position : in Cursor) return Cursor;
type Constant_Reference_Type (Item : not null access constant Element_Type) is null record;
end Regex.Utilities.Sorted_Sets;
|
tum-ei-rcs/StratoX | Ada | 5,265 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K _ P R I M I T I V E S .O P E R A T I O N S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-2016, AdaCore --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This is the version of this package for Ravenscar bare board targets
-- This package contains all the GNULL primitives that interface directly with
-- the underlying OS.
pragma Restrictions (No_Elaboration_Code);
with System.Multiprocessors;
with System.Parameters;
with System.Tasking;
with System.OS_Interface;
package System.Task_Primitives.Operations
with SPARK_Mode => Off is
pragma Preelaborate;
package ST renames System.Tasking;
package OSI renames System.OS_Interface;
Environment_Task : ST.Task_Id := ST.Null_Task;
-- Task ID of the environment task
-- See s-taprop.ads for up to date specs of the following subprograms
procedure Initialize (Environment_Task : ST.Task_Id);
pragma Inline (Initialize);
-- Perform initialization and set up of the environment task for proper
-- operation of the tasking run-time. This must be called once, before any
-- other subprograms of this package are called.
procedure Create_Task
(T : ST.Task_Id;
Wrapper : System.Address;
Stack_Size : System.Parameters.Size_Type;
Priority : ST.Extended_Priority;
Base_CPU : System.Multiprocessors.CPU_Range;
Succeeded : out Boolean);
pragma Inline (Create_Task);
procedure Enter_Task (Self_ID : ST.Task_Id);
pragma Inline (Enter_Task);
procedure Initialize_TCB (Self_ID : ST.Task_Id; Succeeded : out Boolean);
pragma Inline (Initialize_TCB);
function Self return ST.Task_Id;
pragma Inline (Self);
procedure Set_Priority (T : ST.Task_Id; Prio : ST.Extended_Priority);
pragma Inline (Set_Priority);
function Get_Priority (T : ST.Task_Id) return ST.Extended_Priority;
pragma Inline (Get_Priority);
function Get_Affinity
(T : ST.Task_Id) return System.Multiprocessors.CPU_Range;
function Get_CPU (T : ST.Task_Id) return System.Multiprocessors.CPU;
function Get_Thread_Id (T : ST.Task_Id) return OSI.Thread_Id;
-- Return the thread id of the specified task
type Time is new System.OS_Interface.Time;
function Monotonic_Clock return Time;
pragma Inline (Monotonic_Clock);
----------------
-- Extensions --
----------------
procedure Sleep
(Self_ID : ST.Task_Id;
Reason : System.Tasking.Task_States);
pragma Inline (Sleep);
-- The caller should hold no lock when calling this procedure
procedure Delay_Until (Abs_Time : Time);
pragma Inline (Delay_Until);
procedure Wakeup
(T : ST.Task_Id;
Reason : System.Tasking.Task_States);
pragma Inline (Wakeup);
-- The caller should hold no lock when calling this procedure
function Is_Task_Context return Boolean;
pragma Inline (Is_Task_Context);
-- This function returns True if the current execution is in the context
-- of a task, and False if it is an interrupt context.
end System.Task_Primitives.Operations;
|
reznikmm/matreshka | Ada | 4,725 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Fo.Hyphenation_Push_Char_Count_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Fo_Hyphenation_Push_Char_Count_Attribute_Node is
begin
return Self : Fo_Hyphenation_Push_Char_Count_Attribute_Node do
Matreshka.ODF_Fo.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Fo_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Fo_Hyphenation_Push_Char_Count_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Hyphenation_Push_Char_Count_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Fo_URI,
Matreshka.ODF_String_Constants.Hyphenation_Push_Char_Count_Attribute,
Fo_Hyphenation_Push_Char_Count_Attribute_Node'Tag);
end Matreshka.ODF_Fo.Hyphenation_Push_Char_Count_Attributes;
|
AdaCore/libadalang | Ada | 280 | ads | with Vector;
generic
type T is private;
package Vector_Ops is
package Internal_Vector is new Vector (Integer);
generic
with function Predicate (El : T) return Boolean;
function Filter (V : Internal_Vector.Vector) return Internal_Vector.Vector;
end Vector_Ops;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 4,145 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of STMicroelectronics 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 file is based on: --
-- --
-- @file stm32f407xx.h et al. --
-- @author MCD Application Team --
-- @version V1.1.0 --
-- @date 19-June-2014 --
-- @brief CMSIS STM32F407xx Device Peripheral Access Layer Header File. --
-- --
-- COPYRIGHT(c) 2014 STMicroelectronics --
------------------------------------------------------------------------------
-- This file provides register definitions for the STM32F4 (ARM Cortex M4F)
-- microcontrollers from ST Microelectronics.
with STM32_SVD; use STM32_SVD;
with STM32_SVD.EXTI; use STM32_SVD.EXTI;
package body STM32GD.EXTI.IRQ is
protected body IRQ_Handler is
entry Wait when Triggered is
begin
Triggered := False;
end Wait;
procedure Cancel is
begin
Triggered := True;
end Cancel;
function Status (Line : External_Line_Number) return Boolean is
begin
return EXTI_Status.PR.Arr (Line'Enum_Rep) = 1;
end Status;
procedure Reset_Status (Line : External_Line_Number) is
begin
EXTI_Status.PR.Arr (Line'Enum_Rep) := 0;
end Reset_Status;
procedure Handler is
begin
EXTI_Status.PR.Val := EXTI_Periph.PR.PR.Val;
EXTI_Periph.PR.PR.Arr := (others => 1);
Triggered := True;
end Handler;
end IRQ_Handler;
end STM32GD.EXTI.IRQ;
|
Rodeo-McCabe/orka | Ada | 834 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2019 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Glfw.API;
package body Glfw.Input.Mouse is
function Raw_Motion_Supported return Boolean is
(Boolean (API.Raw_Mouse_Motion_Supported));
end Glfw.Input.Mouse;
|
kjseefried/coreland-cgbc | Ada | 877 | adb | with Ada.Strings;
with CGBC.Bounded_Wide_Wide_Strings;
with Test;
procedure T_WWBstr_Append_LB01 is
package BS renames CGBC.Bounded_Wide_Wide_Strings;
TC : Test.Context_t;
S1 : BS.Bounded_String (8);
S : constant Wide_Wide_String := " 012345678 ";
begin
Test.Initialize
(Test_Context => TC,
Program => "t_wwbstr_append_lb01",
Test_DB => "TEST_DB",
Test_Results => "TEST_RESULTS");
BS.Append (S1, "ABCD");
pragma Assert (S (9 .. 17) = "012345678");
BS.Append
(Source => S1,
New_Item => S (9 .. 17),
Drop => Ada.Strings.Left);
Test.Check (TC, 2218, BS.Length (S1) = 8, "BS.Length (S1) = 8");
Test.Check (TC, 2219, BS.Maximum_Length (S1) = 8, "BS.Maximum_Length (S1) = 8");
Test.Check (TC, 2220, BS.To_String (S1) = "12345678", "BS.To_String (S1) = ""12345678""");
end T_WWBstr_Append_LB01;
|
reznikmm/matreshka | Ada | 18,644 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements;
with AMF.Internals.Element_Collections;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.OCL_Attributes;
with AMF.UML.Comments.Collections;
with AMF.UML.Dependencies.Collections;
with AMF.UML.Elements.Collections;
with AMF.UML.Named_Elements;
with AMF.UML.Namespaces.Collections;
with AMF.UML.Packages.Collections;
with AMF.UML.String_Expressions;
with AMF.UML.Types;
with AMF.Visitors.OCL_Iterators;
with AMF.Visitors.OCL_Visitors;
with League.Strings.Internals;
with Matreshka.Internals.Strings;
package body AMF.Internals.OCL_Unlimited_Natural_Literal_Exps is
----------------------------------
-- Get_Unlimited_Natural_Symbol --
----------------------------------
overriding function Get_Unlimited_Natural_Symbol
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return AMF.Unlimited_Natural is
begin
return
AMF.Internals.Tables.OCL_Attributes.Internal_Get_Unlimited_Natural_Symbol
(Self.Element);
end Get_Unlimited_Natural_Symbol;
----------------------------------
-- Set_Unlimited_Natural_Symbol --
----------------------------------
overriding procedure Set_Unlimited_Natural_Symbol
(Self : not null access OCL_Unlimited_Natural_Literal_Exp_Proxy;
To : AMF.Unlimited_Natural) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Unlimited_Natural_Symbol
(Self.Element, To);
end Set_Unlimited_Natural_Symbol;
--------------
-- Get_Type --
--------------
overriding function Get_Type
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return AMF.UML.Types.UML_Type_Access is
begin
return
AMF.UML.Types.UML_Type_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Type
(Self.Element)));
end Get_Type;
--------------
-- Set_Type --
--------------
overriding procedure Set_Type
(Self : not null access OCL_Unlimited_Natural_Literal_Exp_Proxy;
To : AMF.UML.Types.UML_Type_Access) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Type
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Type;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
begin
return
AMF.UML.Dependencies.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Client_Dependency
(Self.Element)));
end Get_Client_Dependency;
--------------
-- Get_Name --
--------------
overriding function Get_Name
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.OCL_Attributes.Internal_Get_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Name;
--------------
-- Set_Name --
--------------
overriding procedure Set_Name
(Self : not null access OCL_Unlimited_Natural_Literal_Exp_Proxy;
To : AMF.Optional_String) is
begin
if To.Is_Empty then
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name
(Self.Element, null);
else
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name
(Self.Element,
League.Strings.Internals.Internal (To.Value));
end if;
end Set_Name;
-------------------------
-- Get_Name_Expression --
-------------------------
overriding function Get_Name_Expression
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access is
begin
return
AMF.UML.String_Expressions.UML_String_Expression_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Name_Expression
(Self.Element)));
end Get_Name_Expression;
-------------------------
-- Set_Name_Expression --
-------------------------
overriding procedure Set_Name_Expression
(Self : not null access OCL_Unlimited_Natural_Literal_Exp_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name_Expression
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Name_Expression;
-------------------
-- Get_Namespace --
-------------------
overriding function Get_Namespace
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
return
AMF.UML.Namespaces.UML_Namespace_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Namespace
(Self.Element)));
end Get_Namespace;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.OCL_Attributes.Internal_Get_Qualified_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Qualified_Name;
--------------------
-- Get_Visibility --
--------------------
overriding function Get_Visibility
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return AMF.UML.Optional_UML_Visibility_Kind is
begin
return
AMF.Internals.Tables.OCL_Attributes.Internal_Get_Visibility
(Self.Element);
end Get_Visibility;
--------------------
-- Set_Visibility --
--------------------
overriding procedure Set_Visibility
(Self : not null access OCL_Unlimited_Natural_Literal_Exp_Proxy;
To : AMF.UML.Optional_UML_Visibility_Kind) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Visibility
(Self.Element, To);
end Set_Visibility;
-----------------------
-- Get_Owned_Comment --
-----------------------
overriding function Get_Owned_Comment
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return AMF.UML.Comments.Collections.Set_Of_UML_Comment is
begin
return
AMF.UML.Comments.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Comment
(Self.Element)));
end Get_Owned_Comment;
-----------------------
-- Get_Owned_Element --
-----------------------
overriding function Get_Owned_Element
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
return
AMF.UML.Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Element
(Self.Element)));
end Get_Owned_Element;
---------------
-- Get_Owner --
---------------
overriding function Get_Owner
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return AMF.UML.Elements.UML_Element_Access is
begin
return
AMF.UML.Elements.UML_Element_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owner
(Self.Element)));
end Get_Owner;
--------------------
-- All_Namespaces --
--------------------
overriding function All_Namespaces
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return AMF.UML.Namespaces.Collections.Ordered_Set_Of_UML_Namespace is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Namespaces unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Unlimited_Natural_Literal_Exp_Proxy.All_Namespaces";
return All_Namespaces (Self);
end All_Namespaces;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Unlimited_Natural_Literal_Exp_Proxy.All_Owning_Packages";
return All_Owning_Packages (Self);
end All_Owning_Packages;
-----------------------------
-- Is_Distinguishable_From --
-----------------------------
overriding function Is_Distinguishable_From
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Unlimited_Natural_Literal_Exp_Proxy.Is_Distinguishable_From";
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
---------------
-- Namespace --
---------------
overriding function Namespace
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Unlimited_Natural_Literal_Exp_Proxy.Namespace";
return Namespace (Self);
end Namespace;
--------------------
-- Qualified_Name --
--------------------
overriding function Qualified_Name
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return League.Strings.Universal_String is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Qualified_Name unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Unlimited_Natural_Literal_Exp_Proxy.Qualified_Name";
return Qualified_Name (Self);
end Qualified_Name;
---------------
-- Separator --
---------------
overriding function Separator
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return League.Strings.Universal_String is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Separator unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Unlimited_Natural_Literal_Exp_Proxy.Separator";
return Separator (Self);
end Separator;
------------------------
-- All_Owned_Elements --
------------------------
overriding function All_Owned_Elements
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owned_Elements unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Unlimited_Natural_Literal_Exp_Proxy.All_Owned_Elements";
return All_Owned_Elements (Self);
end All_Owned_Elements;
-------------------
-- Must_Be_Owned --
-------------------
overriding function Must_Be_Owned
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Must_Be_Owned unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Unlimited_Natural_Literal_Exp_Proxy.Must_Be_Owned";
return Must_Be_Owned (Self);
end Must_Be_Owned;
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.OCL_Visitors.OCL_Visitor'Class then
AMF.Visitors.OCL_Visitors.OCL_Visitor'Class
(Visitor).Enter_Unlimited_Natural_Literal_Exp
(AMF.OCL.Unlimited_Natural_Literal_Exps.OCL_Unlimited_Natural_Literal_Exp_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.OCL_Visitors.OCL_Visitor'Class then
AMF.Visitors.OCL_Visitors.OCL_Visitor'Class
(Visitor).Leave_Unlimited_Natural_Literal_Exp
(AMF.OCL.Unlimited_Natural_Literal_Exps.OCL_Unlimited_Natural_Literal_Exp_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant OCL_Unlimited_Natural_Literal_Exp_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.OCL_Iterators.OCL_Iterator'Class then
AMF.Visitors.OCL_Iterators.OCL_Iterator'Class
(Iterator).Visit_Unlimited_Natural_Literal_Exp
(Visitor,
AMF.OCL.Unlimited_Natural_Literal_Exps.OCL_Unlimited_Natural_Literal_Exp_Access (Self),
Control);
end if;
end Visit_Element;
end AMF.Internals.OCL_Unlimited_Natural_Literal_Exps;
|
eqcola/ada-ado | Ada | 306,467 | ads | with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
-- with Interfaces.C.Extensions;
with System;
package Sqlite3_H is
pragma Preelaborate;
pragma Warnings (Off);
pragma Warnings (Off, "*style*");
-- unsupported macro: SQLITE_EXTERN extern
SQLITE_VERSION : aliased constant String := "3.6.22" & ASCII.NUL; -- /usr/include/sqlite3.h:110
SQLITE_VERSION_NUMBER : constant := 3006022; -- /usr/include/sqlite3.h:111
SQLITE_SOURCE_ID : aliased constant String := "2010-01-05 15:30:36 28d0d7710761114a44a1a3a425a6883c661f06e7" & ASCII.NUL; -- /usr/include/sqlite3.h:112
SQLITE_OK : constant := 0; -- /usr/include/sqlite3.h:353
SQLITE_ERROR : constant := 1; -- /usr/include/sqlite3.h:355
SQLITE_INTERNAL : constant := 2; -- /usr/include/sqlite3.h:356
SQLITE_PERM : constant := 3; -- /usr/include/sqlite3.h:357
SQLITE_ABORT : constant := 4; -- /usr/include/sqlite3.h:358
SQLITE_BUSY : constant := 5; -- /usr/include/sqlite3.h:359
SQLITE_LOCKED : constant := 6; -- /usr/include/sqlite3.h:360
SQLITE_NOMEM : constant := 7; -- /usr/include/sqlite3.h:361
SQLITE_READONLY : constant := 8; -- /usr/include/sqlite3.h:362
SQLITE_INTERRUPT : constant := 9; -- /usr/include/sqlite3.h:363
SQLITE_IOERR : constant := 10; -- /usr/include/sqlite3.h:364
SQLITE_CORRUPT : constant := 11; -- /usr/include/sqlite3.h:365
SQLITE_NOTFOUND : constant := 12; -- /usr/include/sqlite3.h:366
SQLITE_FULL : constant := 13; -- /usr/include/sqlite3.h:367
SQLITE_CANTOPEN : constant := 14; -- /usr/include/sqlite3.h:368
SQLITE_PROTOCOL : constant := 15; -- /usr/include/sqlite3.h:369
SQLITE_EMPTY : constant := 16; -- /usr/include/sqlite3.h:370
SQLITE_SCHEMA : constant := 17; -- /usr/include/sqlite3.h:371
SQLITE_TOOBIG : constant := 18; -- /usr/include/sqlite3.h:372
SQLITE_CONSTRAINT : constant := 19; -- /usr/include/sqlite3.h:373
SQLITE_MISMATCH : constant := 20; -- /usr/include/sqlite3.h:374
SQLITE_MISUSE : constant := 21; -- /usr/include/sqlite3.h:375
SQLITE_NOLFS : constant := 22; -- /usr/include/sqlite3.h:376
SQLITE_AUTH : constant := 23; -- /usr/include/sqlite3.h:377
SQLITE_FORMAT : constant := 24; -- /usr/include/sqlite3.h:378
SQLITE_RANGE : constant := 25; -- /usr/include/sqlite3.h:379
SQLITE_NOTADB : constant := 26; -- /usr/include/sqlite3.h:380
SQLITE_ROW : constant := 100; -- /usr/include/sqlite3.h:381
SQLITE_DONE : constant := 101; -- /usr/include/sqlite3.h:382
-- unsupported macro: SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8))
-- unsupported macro: SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8))
-- unsupported macro: SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8))
-- unsupported macro: SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8))
-- unsupported macro: SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8))
-- unsupported macro: SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6<<8))
-- unsupported macro: SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7<<8))
-- unsupported macro: SQLITE_IOERR_UNLOCK (SQLITE_IOERR | (8<<8))
-- unsupported macro: SQLITE_IOERR_RDLOCK (SQLITE_IOERR | (9<<8))
-- unsupported macro: SQLITE_IOERR_DELETE (SQLITE_IOERR | (10<<8))
-- unsupported macro: SQLITE_IOERR_BLOCKED (SQLITE_IOERR | (11<<8))
-- unsupported macro: SQLITE_IOERR_NOMEM (SQLITE_IOERR | (12<<8))
-- unsupported macro: SQLITE_IOERR_ACCESS (SQLITE_IOERR | (13<<8))
-- unsupported macro: SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8))
-- unsupported macro: SQLITE_IOERR_LOCK (SQLITE_IOERR | (15<<8))
-- unsupported macro: SQLITE_IOERR_CLOSE (SQLITE_IOERR | (16<<8))
-- unsupported macro: SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17<<8))
-- unsupported macro: SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8) )
SQLITE_OPEN_READONLY : constant := 16#00000001#; -- /usr/include/sqlite3.h:435
SQLITE_OPEN_READWRITE : constant := 16#00000002#; -- /usr/include/sqlite3.h:436
SQLITE_OPEN_CREATE : constant := 16#00000004#; -- /usr/include/sqlite3.h:437
SQLITE_OPEN_DELETEONCLOSE : constant := 16#00000008#; -- /usr/include/sqlite3.h:438
SQLITE_OPEN_EXCLUSIVE : constant := 16#00000010#; -- /usr/include/sqlite3.h:439
SQLITE_OPEN_MAIN_DB : constant := 16#00000100#; -- /usr/include/sqlite3.h:440
SQLITE_OPEN_TEMP_DB : constant := 16#00000200#; -- /usr/include/sqlite3.h:441
SQLITE_OPEN_TRANSIENT_DB : constant := 16#00000400#; -- /usr/include/sqlite3.h:442
SQLITE_OPEN_MAIN_JOURNAL : constant := 16#00000800#; -- /usr/include/sqlite3.h:443
SQLITE_OPEN_TEMP_JOURNAL : constant := 16#00001000#; -- /usr/include/sqlite3.h:444
SQLITE_OPEN_SUBJOURNAL : constant := 16#00002000#; -- /usr/include/sqlite3.h:445
SQLITE_OPEN_MASTER_JOURNAL : constant := 16#00004000#; -- /usr/include/sqlite3.h:446
SQLITE_OPEN_NOMUTEX : constant := 16#00008000#; -- /usr/include/sqlite3.h:447
SQLITE_OPEN_FULLMUTEX : constant := 16#00010000#; -- /usr/include/sqlite3.h:448
SQLITE_OPEN_SHAREDCACHE : constant := 16#00020000#; -- /usr/include/sqlite3.h:449
SQLITE_OPEN_PRIVATECACHE : constant := 16#00040000#; -- /usr/include/sqlite3.h:450
SQLITE_IOCAP_ATOMIC : constant := 16#00000001#; -- /usr/include/sqlite3.h:472
SQLITE_IOCAP_ATOMIC512 : constant := 16#00000002#; -- /usr/include/sqlite3.h:473
SQLITE_IOCAP_ATOMIC1K : constant := 16#00000004#; -- /usr/include/sqlite3.h:474
SQLITE_IOCAP_ATOMIC2K : constant := 16#00000008#; -- /usr/include/sqlite3.h:475
SQLITE_IOCAP_ATOMIC4K : constant := 16#00000010#; -- /usr/include/sqlite3.h:476
SQLITE_IOCAP_ATOMIC8K : constant := 16#00000020#; -- /usr/include/sqlite3.h:477
SQLITE_IOCAP_ATOMIC16K : constant := 16#00000040#; -- /usr/include/sqlite3.h:478
SQLITE_IOCAP_ATOMIC32K : constant := 16#00000080#; -- /usr/include/sqlite3.h:479
SQLITE_IOCAP_ATOMIC64K : constant := 16#00000100#; -- /usr/include/sqlite3.h:480
SQLITE_IOCAP_SAFE_APPEND : constant := 16#00000200#; -- /usr/include/sqlite3.h:481
SQLITE_IOCAP_SEQUENTIAL : constant := 16#00000400#; -- /usr/include/sqlite3.h:482
SQLITE_LOCK_NONE : constant := 0; -- /usr/include/sqlite3.h:491
SQLITE_LOCK_SHARED : constant := 1; -- /usr/include/sqlite3.h:492
SQLITE_LOCK_RESERVED : constant := 2; -- /usr/include/sqlite3.h:493
SQLITE_LOCK_PENDING : constant := 3; -- /usr/include/sqlite3.h:494
SQLITE_LOCK_EXCLUSIVE : constant := 4; -- /usr/include/sqlite3.h:495
SQLITE_SYNC_NORMAL : constant := 16#00002#; -- /usr/include/sqlite3.h:511
SQLITE_SYNC_FULL : constant := 16#00003#; -- /usr/include/sqlite3.h:512
SQLITE_SYNC_DATAONLY : constant := 16#00010#; -- /usr/include/sqlite3.h:513
SQLITE_FCNTL_LOCKSTATE : constant := 1; -- /usr/include/sqlite3.h:651
SQLITE_GET_LOCKPROXYFILE : constant := 2; -- /usr/include/sqlite3.h:652
SQLITE_SET_LOCKPROXYFILE : constant := 3; -- /usr/include/sqlite3.h:653
SQLITE_LAST_ERRNO : constant := 4; -- /usr/include/sqlite3.h:654
SQLITE_ACCESS_EXISTS : constant := 0; -- /usr/include/sqlite3.h:835
SQLITE_ACCESS_READWRITE : constant := 1; -- /usr/include/sqlite3.h:836
SQLITE_ACCESS_READ : constant := 2; -- /usr/include/sqlite3.h:837
SQLITE_CONFIG_SINGLETHREAD : constant := 1; -- /usr/include/sqlite3.h:1247
SQLITE_CONFIG_MULTITHREAD : constant := 2; -- /usr/include/sqlite3.h:1248
SQLITE_CONFIG_SERIALIZED : constant := 3; -- /usr/include/sqlite3.h:1249
SQLITE_CONFIG_MALLOC : constant := 4; -- /usr/include/sqlite3.h:1250
SQLITE_CONFIG_GETMALLOC : constant := 5; -- /usr/include/sqlite3.h:1251
SQLITE_CONFIG_SCRATCH : constant := 6; -- /usr/include/sqlite3.h:1252
SQLITE_CONFIG_PAGECACHE : constant := 7; -- /usr/include/sqlite3.h:1253
SQLITE_CONFIG_HEAP : constant := 8; -- /usr/include/sqlite3.h:1254
SQLITE_CONFIG_MEMSTATUS : constant := 9; -- /usr/include/sqlite3.h:1255
SQLITE_CONFIG_MUTEX : constant := 10; -- /usr/include/sqlite3.h:1256
SQLITE_CONFIG_GETMUTEX : constant := 11; -- /usr/include/sqlite3.h:1257
SQLITE_CONFIG_LOOKASIDE : constant := 13; -- /usr/include/sqlite3.h:1259
SQLITE_CONFIG_PCACHE : constant := 14; -- /usr/include/sqlite3.h:1260
SQLITE_CONFIG_GETPCACHE : constant := 15; -- /usr/include/sqlite3.h:1261
SQLITE_DBCONFIG_LOOKASIDE : constant := 1001; -- /usr/include/sqlite3.h:1296
SQLITE_DENY : constant := 1; -- /usr/include/sqlite3.h:1982
SQLITE_IGNORE : constant := 2; -- /usr/include/sqlite3.h:1983
SQLITE_CREATE_INDEX : constant := 1; -- /usr/include/sqlite3.h:2005
SQLITE_CREATE_TABLE : constant := 2; -- /usr/include/sqlite3.h:2006
SQLITE_CREATE_TEMP_INDEX : constant := 3; -- /usr/include/sqlite3.h:2007
SQLITE_CREATE_TEMP_TABLE : constant := 4; -- /usr/include/sqlite3.h:2008
SQLITE_CREATE_TEMP_TRIGGER : constant := 5; -- /usr/include/sqlite3.h:2009
SQLITE_CREATE_TEMP_VIEW : constant := 6; -- /usr/include/sqlite3.h:2010
SQLITE_CREATE_TRIGGER : constant := 7; -- /usr/include/sqlite3.h:2011
SQLITE_CREATE_VIEW : constant := 8; -- /usr/include/sqlite3.h:2012
SQLITE_DELETE : constant := 9; -- /usr/include/sqlite3.h:2013
SQLITE_DROP_INDEX : constant := 10; -- /usr/include/sqlite3.h:2014
SQLITE_DROP_TABLE : constant := 11; -- /usr/include/sqlite3.h:2015
SQLITE_DROP_TEMP_INDEX : constant := 12; -- /usr/include/sqlite3.h:2016
SQLITE_DROP_TEMP_TABLE : constant := 13; -- /usr/include/sqlite3.h:2017
SQLITE_DROP_TEMP_TRIGGER : constant := 14; -- /usr/include/sqlite3.h:2018
SQLITE_DROP_TEMP_VIEW : constant := 15; -- /usr/include/sqlite3.h:2019
SQLITE_DROP_TRIGGER : constant := 16; -- /usr/include/sqlite3.h:2020
SQLITE_DROP_VIEW : constant := 17; -- /usr/include/sqlite3.h:2021
SQLITE_INSERT : constant := 18; -- /usr/include/sqlite3.h:2022
SQLITE_PRAGMA : constant := 19; -- /usr/include/sqlite3.h:2023
SQLITE_READ : constant := 20; -- /usr/include/sqlite3.h:2024
SQLITE_SELECT : constant := 21; -- /usr/include/sqlite3.h:2025
SQLITE_TRANSACTION : constant := 22; -- /usr/include/sqlite3.h:2026
SQLITE_UPDATE : constant := 23; -- /usr/include/sqlite3.h:2027
SQLITE_ATTACH : constant := 24; -- /usr/include/sqlite3.h:2028
SQLITE_DETACH : constant := 25; -- /usr/include/sqlite3.h:2029
SQLITE_ALTER_TABLE : constant := 26; -- /usr/include/sqlite3.h:2030
SQLITE_REINDEX : constant := 27; -- /usr/include/sqlite3.h:2031
SQLITE_ANALYZE : constant := 28; -- /usr/include/sqlite3.h:2032
SQLITE_CREATE_VTABLE : constant := 29; -- /usr/include/sqlite3.h:2033
SQLITE_DROP_VTABLE : constant := 30; -- /usr/include/sqlite3.h:2034
SQLITE_FUNCTION : constant := 31; -- /usr/include/sqlite3.h:2035
SQLITE_SAVEPOINT : constant := 32; -- /usr/include/sqlite3.h:2036
SQLITE_COPY : constant := 0; -- /usr/include/sqlite3.h:2037
SQLITE_LIMIT_LENGTH : constant := 0; -- /usr/include/sqlite3.h:2337
SQLITE_LIMIT_SQL_LENGTH : constant := 1; -- /usr/include/sqlite3.h:2338
SQLITE_LIMIT_COLUMN : constant := 2; -- /usr/include/sqlite3.h:2339
SQLITE_LIMIT_EXPR_DEPTH : constant := 3; -- /usr/include/sqlite3.h:2340
SQLITE_LIMIT_COMPOUND_SELECT : constant := 4; -- /usr/include/sqlite3.h:2341
SQLITE_LIMIT_VDBE_OP : constant := 5; -- /usr/include/sqlite3.h:2342
SQLITE_LIMIT_FUNCTION_ARG : constant := 6; -- /usr/include/sqlite3.h:2343
SQLITE_LIMIT_ATTACHED : constant := 7; -- /usr/include/sqlite3.h:2344
SQLITE_LIMIT_LIKE_PATTERN_LENGTH : constant := 8; -- /usr/include/sqlite3.h:2345
SQLITE_LIMIT_VARIABLE_NUMBER : constant := 9; -- /usr/include/sqlite3.h:2346
SQLITE_LIMIT_TRIGGER_DEPTH : constant := 10; -- /usr/include/sqlite3.h:2347
SQLITE_INTEGER : constant := 1; -- /usr/include/sqlite3.h:2895
SQLITE_FLOAT : constant := 2; -- /usr/include/sqlite3.h:2896
SQLITE_BLOB : constant := 4; -- /usr/include/sqlite3.h:2897
SQLITE_NULL : constant := 5; -- /usr/include/sqlite3.h:2898
SQLITE_TEXT : constant := 3; -- /usr/include/sqlite3.h:2902
SQLITE3_TEXT : constant := 3; -- /usr/include/sqlite3.h:2904
SQLITE_UTF8 : constant := 1; -- /usr/include/sqlite3.h:3222
SQLITE_UTF16LE : constant := 2; -- /usr/include/sqlite3.h:3223
SQLITE_UTF16BE : constant := 3; -- /usr/include/sqlite3.h:3224
SQLITE_UTF16 : constant := 4; -- /usr/include/sqlite3.h:3225
SQLITE_ANY : constant := 5; -- /usr/include/sqlite3.h:3226
SQLITE_UTF16_ALIGNED : constant := 8; -- /usr/include/sqlite3.h:3227
-- unsupported macro: SQLITE_STATIC ((sqlite3_destructor_type)0)
-- unsupported macro: SQLITE_TRANSIENT ((sqlite3_destructor_type)-1)
SQLITE_INDEX_CONSTRAINT_EQ : constant := 2; -- /usr/include/sqlite3.h:4255
SQLITE_INDEX_CONSTRAINT_GT : constant := 4; -- /usr/include/sqlite3.h:4256
SQLITE_INDEX_CONSTRAINT_LE : constant := 8; -- /usr/include/sqlite3.h:4257
SQLITE_INDEX_CONSTRAINT_LT : constant := 16; -- /usr/include/sqlite3.h:4258
SQLITE_INDEX_CONSTRAINT_GE : constant := 32; -- /usr/include/sqlite3.h:4259
SQLITE_INDEX_CONSTRAINT_MATCH : constant := 64; -- /usr/include/sqlite3.h:4260
SQLITE_MUTEX_FAST : constant := 0; -- /usr/include/sqlite3.h:4852
SQLITE_MUTEX_RECURSIVE : constant := 1; -- /usr/include/sqlite3.h:4853
SQLITE_MUTEX_STATIC_MASTER : constant := 2; -- /usr/include/sqlite3.h:4854
SQLITE_MUTEX_STATIC_MEM : constant := 3; -- /usr/include/sqlite3.h:4855
SQLITE_MUTEX_STATIC_MEM2 : constant := 4; -- /usr/include/sqlite3.h:4856
SQLITE_MUTEX_STATIC_OPEN : constant := 4; -- /usr/include/sqlite3.h:4857
SQLITE_MUTEX_STATIC_PRNG : constant := 5; -- /usr/include/sqlite3.h:4858
SQLITE_MUTEX_STATIC_LRU : constant := 6; -- /usr/include/sqlite3.h:4859
SQLITE_MUTEX_STATIC_LRU2 : constant := 7; -- /usr/include/sqlite3.h:4860
SQLITE_TESTCTRL_FIRST : constant := 5; -- /usr/include/sqlite3.h:4931
SQLITE_TESTCTRL_PRNG_SAVE : constant := 5; -- /usr/include/sqlite3.h:4932
SQLITE_TESTCTRL_PRNG_RESTORE : constant := 6; -- /usr/include/sqlite3.h:4933
SQLITE_TESTCTRL_PRNG_RESET : constant := 7; -- /usr/include/sqlite3.h:4934
SQLITE_TESTCTRL_BITVEC_TEST : constant := 8; -- /usr/include/sqlite3.h:4935
SQLITE_TESTCTRL_FAULT_INSTALL : constant := 9; -- /usr/include/sqlite3.h:4936
SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS : constant := 10; -- /usr/include/sqlite3.h:4937
SQLITE_TESTCTRL_PENDING_BYTE : constant := 11; -- /usr/include/sqlite3.h:4938
SQLITE_TESTCTRL_ASSERT : constant := 12; -- /usr/include/sqlite3.h:4939
SQLITE_TESTCTRL_ALWAYS : constant := 13; -- /usr/include/sqlite3.h:4940
SQLITE_TESTCTRL_RESERVE : constant := 14; -- /usr/include/sqlite3.h:4941
SQLITE_TESTCTRL_OPTIMIZATIONS : constant := 15; -- /usr/include/sqlite3.h:4942
SQLITE_TESTCTRL_ISKEYWORD : constant := 16; -- /usr/include/sqlite3.h:4943
SQLITE_TESTCTRL_LAST : constant := 16; -- /usr/include/sqlite3.h:4944
SQLITE_STATUS_MEMORY_USED : constant := 0; -- /usr/include/sqlite3.h:5056
SQLITE_STATUS_PAGECACHE_USED : constant := 1; -- /usr/include/sqlite3.h:5057
SQLITE_STATUS_PAGECACHE_OVERFLOW : constant := 2; -- /usr/include/sqlite3.h:5058
SQLITE_STATUS_SCRATCH_USED : constant := 3; -- /usr/include/sqlite3.h:5059
SQLITE_STATUS_SCRATCH_OVERFLOW : constant := 4; -- /usr/include/sqlite3.h:5060
SQLITE_STATUS_MALLOC_SIZE : constant := 5; -- /usr/include/sqlite3.h:5061
SQLITE_STATUS_PARSER_STACK : constant := 6; -- /usr/include/sqlite3.h:5062
SQLITE_STATUS_PAGECACHE_SIZE : constant := 7; -- /usr/include/sqlite3.h:5063
SQLITE_STATUS_SCRATCH_SIZE : constant := 8; -- /usr/include/sqlite3.h:5064
SQLITE_DBSTATUS_LOOKASIDE_USED : constant := 0; -- /usr/include/sqlite3.h:5105
SQLITE_STMTSTATUS_FULLSCAN_STEP : constant := 1; -- /usr/include/sqlite3.h:5156
SQLITE_STMTSTATUS_SORT : constant := 2; -- /usr/include/sqlite3.h:5157
--** 2001 September 15
--**
--** The author disclaims copyright to this source code. In place of
--** a legal notice, here is a blessing:
--**
--** May you do good and not evil.
--** May you find forgiveness for yourself and forgive others.
--** May you share freely, never taking more than you give.
--**
--*************************************************************************
--** This header file defines the interface that the SQLite library
--** presents to client programs. If a C-function, structure, datatype,
--** or constant definition does not appear in this file, then it is
--** not a published API of SQLite, is subject to change without
--** notice, and should not be referenced by programs that use SQLite.
--**
--** Some of the definitions that are in this file are marked as
--** "experimental". Experimental interfaces are normally new
--** features recently added to SQLite. We do not anticipate changes
--** to experimental interfaces but reserve the right to make minor changes
--** if experience from use "in the wild" suggest such changes are prudent.
--**
--** The official C-language API documentation for SQLite is derived
--** from comments in this file. This file is the authoritative source
--** on how SQLite interfaces are suppose to operate.
--**
--** The name of this file under configuration management is "sqlite.h.in".
--** The makefile makes some minor changes to this file (such as inserting
--** the version number) and changes its name to "sqlite3.h" as
--** part of the build process.
--
-- Needed for the definition of va_list
--** Make sure we can call this stuff from C++.
--
--** Add the ability to override 'extern'
--
--** These no-op macros are used in front of interfaces to mark those
--** interfaces as either deprecated or experimental. New applications
--** should not use deprecated interfaces - they are support for backwards
--** compatibility only. Application writers should be aware that
--** experimental interfaces are subject to change in point releases.
--**
--** These macros used to resolve to various kinds of compiler magic that
--** would generate warning messages when they were used. But that
--** compiler magic ended up generating such a flurry of bug reports
--** that we have taken it all out and gone back to using simple
--** noop macros.
--
--** Ensure these symbols were not defined by some previous header file.
--
--** CAPI3REF: Compile-Time Library Version Numbers
--**
--** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header
--** evaluates to a string literal that is the SQLite version in the
--** format "X.Y.Z" where X is the major version number (always 3 for
--** SQLite3) and Y is the minor version number and Z is the release number.)^
--** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer
--** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same
--** numbers used in [SQLITE_VERSION].)^
--** The SQLITE_VERSION_NUMBER for any given release of SQLite will also
--** be larger than the release from which it is derived. Either Y will
--** be held constant and Z will be incremented or else Y will be incremented
--** and Z will be reset to zero.
--**
--** Since version 3.6.18, SQLite source code has been stored in the
--** <a href="http://www.fossil-scm.org/">Fossil configuration management
--** system</a>. ^The SQLITE_SOURCE_ID macro evalutes to
--** a string which identifies a particular check-in of SQLite
--** within its configuration management system. ^The SQLITE_SOURCE_ID
--** string contains the date and time of the check-in (UTC) and an SHA1
--** hash of the entire source tree.
--**
--** See also: [sqlite3_libversion()],
--** [sqlite3_libversion_number()], [sqlite3_sourceid()],
--** [sqlite_version()] and [sqlite_source_id()].
--
--** CAPI3REF: Run-Time Library Version Numbers
--** KEYWORDS: sqlite3_version
--**
--** These interfaces provide the same information as the [SQLITE_VERSION],
--** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
--** but are associated with the library instead of the header file. ^(Cautious
--** programmers might include assert() statements in their application to
--** verify that values returned by these interfaces match the macros in
--** the header, and thus insure that the application is
--** compiled with matching library and header files.
--**
--** <blockquote><pre>
--** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
--** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );
--** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
--** </pre></blockquote>)^
--**
--** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION]
--** macro. ^The sqlite3_libversion() function returns a pointer to the
--** to the sqlite3_version[] string constant. The sqlite3_libversion()
--** function is provided for use in DLLs since DLL users usually do not have
--** direct access to string constants within the DLL. ^The
--** sqlite3_libversion_number() function returns an integer equal to
--** [SQLITE_VERSION_NUMBER]. ^The sqlite3_sourceid() function a pointer
--** to a string constant whose value is the same as the [SQLITE_SOURCE_ID]
--** C preprocessor macro.
--**
--** See also: [sqlite_version()] and [sqlite_source_id()].
--
sqlite3_version : aliased array (0 .. int'Last) of aliased char; -- /usr/include/sqlite3.h:144:37
pragma Import (C, sqlite3_version, "sqlite3_version");
function sqlite3_libversion return Interfaces.C.Strings.chars_ptr; -- /usr/include/sqlite3.h:145:24
pragma Import (C, sqlite3_libversion, "sqlite3_libversion");
function sqlite3_sourceid return Interfaces.C.Strings.chars_ptr; -- /usr/include/sqlite3.h:146:24
pragma Import (C, sqlite3_sourceid, "sqlite3_sourceid");
function sqlite3_libversion_number return int; -- /usr/include/sqlite3.h:147:16
pragma Import (C, sqlite3_libversion_number, "sqlite3_libversion_number");
--** CAPI3REF: Test To See If The Library Is Threadsafe
--**
--** ^The sqlite3_threadsafe() function returns zero if and only if
--** SQLite was compiled mutexing code omitted due to the
--** [SQLITE_THREADSAFE] compile-time option being set to 0.
--**
--** SQLite can be compiled with or without mutexes. When
--** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes
--** are enabled and SQLite is threadsafe. When the
--** [SQLITE_THREADSAFE] macro is 0,
--** the mutexes are omitted. Without the mutexes, it is not safe
--** to use SQLite concurrently from more than one thread.
--**
--** Enabling mutexes incurs a measurable performance penalty.
--** So if speed is of utmost importance, it makes sense to disable
--** the mutexes. But for maximum safety, mutexes should be enabled.
--** ^The default behavior is for mutexes to be enabled.
--**
--** This interface can be used by an application to make sure that the
--** version of SQLite that it is linking against was compiled with
--** the desired setting of the [SQLITE_THREADSAFE] macro.
--**
--** This interface only reports on the compile-time mutex setting
--** of the [SQLITE_THREADSAFE] flag. If SQLite is compiled with
--** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but
--** can be fully or partially disabled using a call to [sqlite3_config()]
--** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD],
--** or [SQLITE_CONFIG_MUTEX]. ^(The return value of the
--** sqlite3_threadsafe() function shows only the compile-time setting of
--** thread safety, not any run-time changes to that setting made by
--** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()
--** is unchanged by calls to sqlite3_config().)^
--**
--** See the [threading mode] documentation for additional information.
--
function sqlite3_threadsafe return int; -- /usr/include/sqlite3.h:185:16
pragma Import (C, sqlite3_threadsafe, "sqlite3_threadsafe");
--** CAPI3REF: Database Connection Handle
--** KEYWORDS: {database connection} {database connections}
--**
--** Each open SQLite database is represented by a pointer to an instance of
--** the opaque structure named "sqlite3". It is useful to think of an sqlite3
--** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and
--** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]
--** is its destructor. There are many other interfaces (such as
--** [sqlite3_prepare_v2()], [sqlite3_create_function()], and
--** [sqlite3_busy_timeout()] to name but three) that are methods on an
--** sqlite3 object.
--
-- skipped empty struct sqlite3
--** CAPI3REF: 64-Bit Integer Types
--** KEYWORDS: sqlite_int64 sqlite_uint64
--**
--** Because there is no cross-platform way to specify 64-bit integer types
--** SQLite includes typedefs for 64-bit signed and unsigned integers.
--**
--** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions.
--** The sqlite_int64 and sqlite_uint64 types are supported for backwards
--** compatibility only.
--**
--** ^The sqlite3_int64 and sqlite_int64 types can store integer values
--** between -9223372036854775808 and +9223372036854775807 inclusive. ^The
--** sqlite3_uint64 and sqlite_uint64 types can store integer values
--** between 0 and +18446744073709551615 inclusive.
--
subtype sqlite_int64 is Long_Long_Integer; -- /usr/include/sqlite3.h:225:25
-- subtype sqlite_uint64 is Extensions.unsigned_long_long; -- /usr/include/sqlite3.h:226:34
subtype sqlite_uint64 is Long_Long_Integer;
subtype sqlite3_int64 is sqlite_int64; -- /usr/include/sqlite3.h:228:22
subtype sqlite3_uint64 is sqlite_uint64; -- /usr/include/sqlite3.h:229:23
--** If compiling for a processor that lacks floating point support,
--** substitute integer for floating-point.
--
--** CAPI3REF: Closing A Database Connection
--**
--** ^The sqlite3_close() routine is the destructor for the [sqlite3] object.
--** ^Calls to sqlite3_close() return SQLITE_OK if the [sqlite3] object is
--** successfullly destroyed and all associated resources are deallocated.
--**
--** Applications must [sqlite3_finalize | finalize] all [prepared statements]
--** and [sqlite3_blob_close | close] all [BLOB handles] associated with
--** the [sqlite3] object prior to attempting to close the object. ^If
--** sqlite3_close() is called on a [database connection] that still has
--** outstanding [prepared statements] or [BLOB handles], then it returns
--** SQLITE_BUSY.
--**
--** ^If [sqlite3_close()] is invoked while a transaction is open,
--** the transaction is automatically rolled back.
--**
--** The C parameter to [sqlite3_close(C)] must be either a NULL
--** pointer or an [sqlite3] object pointer obtained
--** from [sqlite3_open()], [sqlite3_open16()], or
--** [sqlite3_open_v2()], and not previously closed.
--** ^Calling sqlite3_close() with a NULL pointer argument is a
--** harmless no-op.
--
function sqlite3_close (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:263:16
pragma Import (C, sqlite3_close, "sqlite3_close");
--** The type for a callback function.
--** This is legacy and deprecated. It is included for historical
--** compatibility and is not documented.
--
type sqlite3_callback is access function
(arg1 : System.Address;
arg2 : int;
arg3 : System.Address;
arg4 : System.Address) return int; -- /usr/include/sqlite3.h:270:15
--** CAPI3REF: One-Step Query Execution Interface
--**
--** The sqlite3_exec() interface is a convenience wrapper around
--** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()],
--** that allows an application to run multiple statements of SQL
--** without having to use a lot of C code.
--**
--** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded,
--** semicolon-separate SQL statements passed into its 2nd argument,
--** in the context of the [database connection] passed in as its 1st
--** argument. ^If the callback function of the 3rd argument to
--** sqlite3_exec() is not NULL, then it is invoked for each result row
--** coming out of the evaluated SQL statements. ^The 4th argument to
--** to sqlite3_exec() is relayed through to the 1st argument of each
--** callback invocation. ^If the callback pointer to sqlite3_exec()
--** is NULL, then no callback is ever invoked and result rows are
--** ignored.
--**
--** ^If an error occurs while evaluating the SQL statements passed into
--** sqlite3_exec(), then execution of the current statement stops and
--** subsequent statements are skipped. ^If the 5th parameter to sqlite3_exec()
--** is not NULL then any error message is written into memory obtained
--** from [sqlite3_malloc()] and passed back through the 5th parameter.
--** To avoid memory leaks, the application should invoke [sqlite3_free()]
--** on error message strings returned through the 5th parameter of
--** of sqlite3_exec() after the error message string is no longer needed.
--** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors
--** occur, then sqlite3_exec() sets the pointer in its 5th parameter to
--** NULL before returning.
--**
--** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec()
--** routine returns SQLITE_ABORT without invoking the callback again and
--** without running any subsequent SQL statements.
--**
--** ^The 2nd argument to the sqlite3_exec() callback function is the
--** number of columns in the result. ^The 3rd argument to the sqlite3_exec()
--** callback is an array of pointers to strings obtained as if from
--** [sqlite3_column_text()], one for each column. ^If an element of a
--** result row is NULL then the corresponding string pointer for the
--** sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the
--** sqlite3_exec() callback is an array of pointers to strings where each
--** entry represents the name of corresponding result column as obtained
--** from [sqlite3_column_name()].
--**
--** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer
--** to an empty string, or a pointer that contains only whitespace and/or
--** SQL comments, then no SQL statements are evaluated and the database
--** is not changed.
--**
--** Restrictions:
--**
--** <ul>
--** <li> The application must insure that the 1st parameter to sqlite3_exec()
--** is a valid and open [database connection].
--** <li> The application must not close [database connection] specified by
--** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
--** <li> The application must not modify the SQL statement text passed into
--** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
--** </ul>
--
function sqlite3_exec
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : access function
(arg1 : System.Address;
arg2 : int;
arg3 : System.Address;
arg4 : System.Address) return int;
arg4 : System.Address;
arg5 : System.Address) return int; -- /usr/include/sqlite3.h:333:16
pragma Import (C, sqlite3_exec, "sqlite3_exec");
-- An open database
-- SQL to be evaluated
-- Callback function
-- 1st argument to callback
-- Error msg written here
--** CAPI3REF: Result Codes
--** KEYWORDS: SQLITE_OK {error code} {error codes}
--** KEYWORDS: {result code} {result codes}
--**
--** Many SQLite functions return an integer result code from the set shown
--** here in order to indicates success or failure.
--**
--** New error codes may be added in future versions of SQLite.
--**
--** See also: [SQLITE_IOERR_READ | extended result codes]
--
-- beginning-of-error-codes
-- end-of-error-codes
--** CAPI3REF: Extended Result Codes
--** KEYWORDS: {extended error code} {extended error codes}
--** KEYWORDS: {extended result code} {extended result codes}
--**
--** In its default configuration, SQLite API routines return one of 26 integer
--** [SQLITE_OK | result codes]. However, experience has shown that many of
--** these result codes are too coarse-grained. They do not provide as
--** much information about problems as programmers might like. In an effort to
--** address this, newer versions of SQLite (version 3.3.8 and later) include
--** support for additional result codes that provide more detailed information
--** about errors. The extended result codes are enabled or disabled
--** on a per database connection basis using the
--** [sqlite3_extended_result_codes()] API.
--**
--** Some of the available extended result codes are listed here.
--** One may expect the number of extended result codes will be expand
--** over time. Software that uses extended result codes should expect
--** to see new result codes in future releases of SQLite.
--**
--** The SQLITE_OK result code will never be extended. It will always
--** be exactly zero.
--
--** CAPI3REF: Flags For File Open Operations
--**
--** These bit values are intended for use in the
--** 3rd parameter to the [sqlite3_open_v2()] interface and
--** in the 4th parameter to the xOpen method of the
--** [sqlite3_vfs] object.
--
--** CAPI3REF: Device Characteristics
--**
--** The xDeviceCapabilities method of the [sqlite3_io_methods]
--** object returns an integer which is a vector of the these
--** bit values expressing I/O characteristics of the mass storage
--** device that holds the file that the [sqlite3_io_methods]
--** refers to.
--**
--** The SQLITE_IOCAP_ATOMIC property means that all writes of
--** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values
--** mean that writes of blocks that are nnn bytes in size and
--** are aligned to an address which is an integer multiple of
--** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means
--** that when data is appended to a file, the data is appended
--** first then the size of the file is extended, never the other
--** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
--** information is written to disk in the same order as calls
--** to xWrite().
--
--** CAPI3REF: File Locking Levels
--**
--** SQLite uses one of these integer values as the second
--** argument to calls it makes to the xLock() and xUnlock() methods
--** of an [sqlite3_io_methods] object.
--
--** CAPI3REF: Synchronization Type Flags
--**
--** When SQLite invokes the xSync() method of an
--** [sqlite3_io_methods] object it uses a combination of
--** these integer values as the second argument.
--**
--** When the SQLITE_SYNC_DATAONLY flag is used, it means that the
--** sync operation only needs to flush data to mass storage. Inode
--** information need not be flushed. If the lower four bits of the flag
--** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.
--** If the lower four bits equal SQLITE_SYNC_FULL, that means
--** to use Mac OS X style fullsync instead of fsync().
--
--** CAPI3REF: OS Interface Open File Handle
--**
--** An [sqlite3_file] object represents an open file in the
--** [sqlite3_vfs | OS interface layer]. Individual OS interface
--** implementations will
--** want to subclass this object by appending additional fields
--** for their own use. The pMethods entry is a pointer to an
--** [sqlite3_io_methods] object that defines methods for performing
--** I/O operations on the open file.
--
-- Methods for an open file
type sqlite3_file is record
pMethods : System.Address; -- /usr/include/sqlite3.h:528:36
end record;
pragma Convention (C, sqlite3_file); -- /usr/include/sqlite3.h:526:16
--** CAPI3REF: OS Interface File Virtual Methods Object
--**
--** Every file opened by the [sqlite3_vfs] xOpen method populates an
--** [sqlite3_file] object (or, more commonly, a subclass of the
--** [sqlite3_file] object) with a pointer to an instance of this object.
--** This object defines the methods used to perform various operations
--** against the open file represented by the [sqlite3_file] object.
--**
--** If the xOpen method sets the sqlite3_file.pMethods element
--** to a non-NULL pointer, then the sqlite3_io_methods.xClose method
--** may be invoked even if the xOpen reported that it failed. The
--** only way to prevent a call to xClose following a failed xOpen
--** is for the xOpen to set the sqlite3_file.pMethods element to NULL.
--**
--** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or
--** [SQLITE_SYNC_FULL]. The first choice is the normal fsync().
--** The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY]
--** flag may be ORed in to indicate that only the data of the file
--** and not its inode needs to be synced.
--**
--** The integer values to xLock() and xUnlock() are one of
--** <ul>
--** <li> [SQLITE_LOCK_NONE],
--** <li> [SQLITE_LOCK_SHARED],
--** <li> [SQLITE_LOCK_RESERVED],
--** <li> [SQLITE_LOCK_PENDING], or
--** <li> [SQLITE_LOCK_EXCLUSIVE].
--** </ul>
--** xLock() increases the lock. xUnlock() decreases the lock.
--** The xCheckReservedLock() method checks whether any database connection,
--** either in this process or in some other process, is holding a RESERVED,
--** PENDING, or EXCLUSIVE lock on the file. It returns true
--** if such a lock exists and false otherwise.
--**
--** The xFileControl() method is a generic interface that allows custom
--** VFS implementations to directly control an open file using the
--** [sqlite3_file_control()] interface. The second "op" argument is an
--** integer opcode. The third argument is a generic pointer intended to
--** point to a structure that may contain arguments or space in which to
--** write return values. Potential uses for xFileControl() might be
--** functions to enable blocking locks with timeouts, to change the
--** locking strategy (for example to use dot-file locks), to inquire
--** about the status of a lock, or to break stale locks. The SQLite
--** core reserves all opcodes less than 100 for its own use.
--** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available.
--** Applications that define a custom xFileControl method should use opcodes
--** greater than 100 to avoid conflicts.
--**
--** The xSectorSize() method returns the sector size of the
--** device that underlies the file. The sector size is the
--** minimum write that can be performed without disturbing
--** other bytes in the file. The xDeviceCharacteristics()
--** method returns a bit vector describing behaviors of the
--** underlying device:
--**
--** <ul>
--** <li> [SQLITE_IOCAP_ATOMIC]
--** <li> [SQLITE_IOCAP_ATOMIC512]
--** <li> [SQLITE_IOCAP_ATOMIC1K]
--** <li> [SQLITE_IOCAP_ATOMIC2K]
--** <li> [SQLITE_IOCAP_ATOMIC4K]
--** <li> [SQLITE_IOCAP_ATOMIC8K]
--** <li> [SQLITE_IOCAP_ATOMIC16K]
--** <li> [SQLITE_IOCAP_ATOMIC32K]
--** <li> [SQLITE_IOCAP_ATOMIC64K]
--** <li> [SQLITE_IOCAP_SAFE_APPEND]
--** <li> [SQLITE_IOCAP_SEQUENTIAL]
--** </ul>
--**
--** The SQLITE_IOCAP_ATOMIC property means that all writes of
--** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values
--** mean that writes of blocks that are nnn bytes in size and
--** are aligned to an address which is an integer multiple of
--** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means
--** that when data is appended to a file, the data is appended
--** first then the size of the file is extended, never the other
--** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
--** information is written to disk in the same order as calls
--** to xWrite().
--**
--** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill
--** in the unread portions of the buffer with zeros. A VFS that
--** fails to zero-fill short reads might seem to work. However,
--** failure to zero-fill short reads will eventually lead to
--** database corruption.
--
type sqlite3_io_methods is record
iVersion : aliased int; -- /usr/include/sqlite3.h:620:7
xClose : access function (arg1 : access sqlite3_file) return int; -- /usr/include/sqlite3.h:621:9
xRead : access function
(arg1 : access sqlite3_file;
arg2 : System.Address;
arg3 : int;
arg4 : sqlite3_int64) return int; -- /usr/include/sqlite3.h:622:9
xWrite : access function
(arg1 : access sqlite3_file;
arg2 : System.Address;
arg3 : int;
arg4 : sqlite3_int64) return int; -- /usr/include/sqlite3.h:623:9
xTruncate : access function (arg1 : access sqlite3_file; arg2 : sqlite3_int64) return int; -- /usr/include/sqlite3.h:624:9
xSync : access function (arg1 : access sqlite3_file; arg2 : int) return int; -- /usr/include/sqlite3.h:625:9
xFileSize : access function (arg1 : access sqlite3_file; arg2 : access sqlite3_int64) return int; -- /usr/include/sqlite3.h:626:9
xLock : access function (arg1 : access sqlite3_file; arg2 : int) return int; -- /usr/include/sqlite3.h:627:9
xUnlock : access function (arg1 : access sqlite3_file; arg2 : int) return int; -- /usr/include/sqlite3.h:628:9
xCheckReservedLock : access function (arg1 : access sqlite3_file; arg2 : access int) return int; -- /usr/include/sqlite3.h:629:9
xFileControl : access function
(arg1 : access sqlite3_file;
arg2 : int;
arg3 : System.Address) return int; -- /usr/include/sqlite3.h:630:9
xSectorSize : access function (arg1 : access sqlite3_file) return int; -- /usr/include/sqlite3.h:631:9
xDeviceCharacteristics : access function (arg1 : access sqlite3_file) return int; -- /usr/include/sqlite3.h:632:9
end record;
pragma Convention (C, sqlite3_io_methods); -- /usr/include/sqlite3.h:528:16
-- Additional methods may be added in future releases
--** CAPI3REF: Standard File Control Opcodes
--**
--** These integer constants are opcodes for the xFileControl method
--** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
--** interface.
--**
--** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This
--** opcode causes the xFileControl method to write the current state of
--** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
--** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
--** into an integer that the pArg argument points to. This capability
--** is used during testing and only needs to be supported when SQLITE_TEST
--** is defined.
--
--** CAPI3REF: Mutex Handle
--**
--** The mutex module within SQLite defines [sqlite3_mutex] to be an
--** abstract type for a mutex object. The SQLite core never looks
--** at the internal representation of an [sqlite3_mutex]. It only
--** deals with pointers to the [sqlite3_mutex] object.
--**
--** Mutexes are created using [sqlite3_mutex_alloc()].
--
-- skipped empty struct sqlite3_mutex
--** CAPI3REF: OS Interface Object
--**
--** An instance of the sqlite3_vfs object defines the interface between
--** the SQLite core and the underlying operating system. The "vfs"
--** in the name of the object stands for "virtual file system".
--**
--** The value of the iVersion field is initially 1 but may be larger in
--** future versions of SQLite. Additional fields may be appended to this
--** object when the iVersion value is increased. Note that the structure
--** of the sqlite3_vfs object changes in the transaction between
--** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not
--** modified.
--**
--** The szOsFile field is the size of the subclassed [sqlite3_file]
--** structure used by this VFS. mxPathname is the maximum length of
--** a pathname in this VFS.
--**
--** Registered sqlite3_vfs objects are kept on a linked list formed by
--** the pNext pointer. The [sqlite3_vfs_register()]
--** and [sqlite3_vfs_unregister()] interfaces manage this list
--** in a thread-safe way. The [sqlite3_vfs_find()] interface
--** searches the list. Neither the application code nor the VFS
--** implementation should use the pNext pointer.
--**
--** The pNext field is the only field in the sqlite3_vfs
--** structure that SQLite will ever modify. SQLite will only access
--** or modify this field while holding a particular static mutex.
--** The application should never modify anything within the sqlite3_vfs
--** object once the object has been registered.
--**
--** The zName field holds the name of the VFS module. The name must
--** be unique across all VFS modules.
--**
--** SQLite will guarantee that the zFilename parameter to xOpen
--** is either a NULL pointer or string obtained
--** from xFullPathname(). SQLite further guarantees that
--** the string will be valid and unchanged until xClose() is
--** called. Because of the previous sentence,
--** the [sqlite3_file] can safely store a pointer to the
--** filename if it needs to remember the filename for some reason.
--** If the zFilename parameter is xOpen is a NULL pointer then xOpen
--** must invent its own temporary name for the file. Whenever the
--** xFilename parameter is NULL it will also be the case that the
--** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
--**
--** The flags argument to xOpen() includes all bits set in
--** the flags argument to [sqlite3_open_v2()]. Or if [sqlite3_open()]
--** or [sqlite3_open16()] is used, then flags includes at least
--** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE].
--** If xOpen() opens a file read-only then it sets *pOutFlags to
--** include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set.
--**
--** SQLite will also add one of the following flags to the xOpen()
--** call, depending on the object being opened:
--**
--** <ul>
--** <li> [SQLITE_OPEN_MAIN_DB]
--** <li> [SQLITE_OPEN_MAIN_JOURNAL]
--** <li> [SQLITE_OPEN_TEMP_DB]
--** <li> [SQLITE_OPEN_TEMP_JOURNAL]
--** <li> [SQLITE_OPEN_TRANSIENT_DB]
--** <li> [SQLITE_OPEN_SUBJOURNAL]
--** <li> [SQLITE_OPEN_MASTER_JOURNAL]
--** </ul>
--**
--** The file I/O implementation can use the object type flags to
--** change the way it deals with files. For example, an application
--** that does not care about crash recovery or rollback might make
--** the open of a journal file a no-op. Writes to this journal would
--** also be no-ops, and any attempt to read the journal would return
--** SQLITE_IOERR. Or the implementation might recognize that a database
--** file will be doing page-aligned sector reads and writes in a random
--** order and set up its I/O subsystem accordingly.
--**
--** SQLite might also add one of the following flags to the xOpen method:
--**
--** <ul>
--** <li> [SQLITE_OPEN_DELETEONCLOSE]
--** <li> [SQLITE_OPEN_EXCLUSIVE]
--** </ul>
--**
--** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
--** deleted when it is closed. The [SQLITE_OPEN_DELETEONCLOSE]
--** will be set for TEMP databases, journals and for subjournals.
--**
--** The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
--** with the [SQLITE_OPEN_CREATE] flag, which are both directly
--** analogous to the O_EXCL and O_CREAT flags of the POSIX open()
--** API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the
--** SQLITE_OPEN_CREATE, is used to indicate that file should always
--** be created, and that it is an error if it already exists.
--** It is <i>not</i> used to indicate the file should be opened
--** for exclusive access.
--**
--** At least szOsFile bytes of memory are allocated by SQLite
--** to hold the [sqlite3_file] structure passed as the third
--** argument to xOpen. The xOpen method does not have to
--** allocate the structure; it should just fill it in. Note that
--** the xOpen method must set the sqlite3_file.pMethods to either
--** a valid [sqlite3_io_methods] object or to NULL. xOpen must do
--** this even if the open fails. SQLite expects that the sqlite3_file.pMethods
--** element will be valid after xOpen returns regardless of the success
--** or failure of the xOpen call.
--**
--** The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
--** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
--** test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
--** to test whether a file is at least readable. The file can be a
--** directory.
--**
--** SQLite will always allocate at least mxPathname+1 bytes for the
--** output buffer xFullPathname. The exact size of the output buffer
--** is also passed as a parameter to both methods. If the output buffer
--** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
--** handled as a fatal error by SQLite, vfs implementations should endeavor
--** to prevent this by setting mxPathname to a sufficiently large value.
--**
--** The xRandomness(), xSleep(), and xCurrentTime() interfaces
--** are not strictly a part of the filesystem, but they are
--** included in the VFS structure for completeness.
--** The xRandomness() function attempts to return nBytes bytes
--** of good-quality randomness into zOut. The return value is
--** the actual number of bytes of randomness obtained.
--** The xSleep() method causes the calling thread to sleep for at
--** least the number of microseconds given. The xCurrentTime()
--** method returns a Julian Day Number for the current date and time.
--**
--
-- Structure version number
type sqlite3_vfs is record
iVersion : aliased int; -- /usr/include/sqlite3.h:799:7
szOsFile : aliased int; -- /usr/include/sqlite3.h:800:7
mxPathname : aliased int; -- /usr/include/sqlite3.h:801:7
pNext : access sqlite3_vfs; -- /usr/include/sqlite3.h:802:16
zName : Interfaces.C.Strings.chars_ptr; -- /usr/include/sqlite3.h:803:15
pAppData : System.Address; -- /usr/include/sqlite3.h:804:9
xOpen : access function
(arg1 : access sqlite3_vfs;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : access sqlite3_file;
arg4 : int;
arg5 : access int) return int; -- /usr/include/sqlite3.h:805:9
xDelete : access function
(arg1 : access sqlite3_vfs;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : int) return int; -- /usr/include/sqlite3.h:807:9
xAccess : access function
(arg1 : access sqlite3_vfs;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : int;
arg4 : access int) return int; -- /usr/include/sqlite3.h:808:9
xFullPathname : access function
(arg1 : access sqlite3_vfs;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : int;
arg4 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/sqlite3.h:809:9
xDlOpen : access function (arg1 : access sqlite3_vfs; arg2 : Interfaces.C.Strings.chars_ptr) return System.Address; -- /usr/include/sqlite3.h:810:11
xDlError : access procedure
(arg1 : access sqlite3_vfs;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr); -- /usr/include/sqlite3.h:811:10
xDlSym : access function
(arg1 : access sqlite3_vfs;
arg2 : System.Address;
arg3 : Interfaces.C.Strings.chars_ptr) return access procedure; -- /usr/include/sqlite3.h:812:12
xDlClose : access procedure (arg1 : access sqlite3_vfs; arg2 : System.Address); -- /usr/include/sqlite3.h:813:10
xRandomness : access function
(arg1 : access sqlite3_vfs;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/sqlite3.h:814:9
xSleep : access function (arg1 : access sqlite3_vfs; arg2 : int) return int; -- /usr/include/sqlite3.h:815:9
xCurrentTime : access function (arg1 : access sqlite3_vfs; arg2 : access double) return int; -- /usr/include/sqlite3.h:816:9
xGetLastError : access function
(arg1 : access sqlite3_vfs;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/sqlite3.h:817:9
end record;
pragma Convention (C, sqlite3_vfs); -- /usr/include/sqlite3.h:797:16
-- Size of subclassed sqlite3_file
-- Maximum file pathname length
-- Next registered VFS
-- Name of this virtual file system
-- Pointer to application-specific data
-- New fields may be appended in figure versions. The iVersion
-- ** value will increment whenever this happens.
--** CAPI3REF: Flags for the xAccess VFS method
--**
--** These integer constants can be used as the third parameter to
--** the xAccess method of an [sqlite3_vfs] object. They determine
--** what kind of permissions the xAccess method is looking for.
--** With SQLITE_ACCESS_EXISTS, the xAccess method
--** simply checks whether the file exists.
--** With SQLITE_ACCESS_READWRITE, the xAccess method
--** checks whether the file is both readable and writable.
--** With SQLITE_ACCESS_READ, the xAccess method
--** checks whether the file is readable.
--
--** CAPI3REF: Initialize The SQLite Library
--**
--** ^The sqlite3_initialize() routine initializes the
--** SQLite library. ^The sqlite3_shutdown() routine
--** deallocates any resources that were allocated by sqlite3_initialize().
--** These routines are designed to aid in process initialization and
--** shutdown on embedded systems. Workstation applications using
--** SQLite normally do not need to invoke either of these routines.
--**
--** A call to sqlite3_initialize() is an "effective" call if it is
--** the first time sqlite3_initialize() is invoked during the lifetime of
--** the process, or if it is the first time sqlite3_initialize() is invoked
--** following a call to sqlite3_shutdown(). ^(Only an effective call
--** of sqlite3_initialize() does any initialization. All other calls
--** are harmless no-ops.)^
--**
--** A call to sqlite3_shutdown() is an "effective" call if it is the first
--** call to sqlite3_shutdown() since the last sqlite3_initialize(). ^(Only
--** an effective call to sqlite3_shutdown() does any deinitialization.
--** All other valid calls to sqlite3_shutdown() are harmless no-ops.)^
--**
--** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown()
--** is not. The sqlite3_shutdown() interface must only be called from a
--** single thread. All open [database connections] must be closed and all
--** other SQLite resources must be deallocated prior to invoking
--** sqlite3_shutdown().
--**
--** Among other things, ^sqlite3_initialize() will invoke
--** sqlite3_os_init(). Similarly, ^sqlite3_shutdown()
--** will invoke sqlite3_os_end().
--**
--** ^The sqlite3_initialize() routine returns [SQLITE_OK] on success.
--** ^If for some reason, sqlite3_initialize() is unable to initialize
--** the library (perhaps it is unable to allocate a needed resource such
--** as a mutex) it returns an [error code] other than [SQLITE_OK].
--**
--** ^The sqlite3_initialize() routine is called internally by many other
--** SQLite interfaces so that an application usually does not need to
--** invoke sqlite3_initialize() directly. For example, [sqlite3_open()]
--** calls sqlite3_initialize() so the SQLite library will be automatically
--** initialized when [sqlite3_open()] is called if it has not be initialized
--** already. ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT]
--** compile-time option, then the automatic calls to sqlite3_initialize()
--** are omitted and the application must call sqlite3_initialize() directly
--** prior to using any other SQLite interface. For maximum portability,
--** it is recommended that applications always invoke sqlite3_initialize()
--** directly prior to using any other SQLite interface. Future releases
--** of SQLite may require this. In other words, the behavior exhibited
--** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the
--** default behavior in some future release of SQLite.
--**
--** The sqlite3_os_init() routine does operating-system specific
--** initialization of the SQLite library. The sqlite3_os_end()
--** routine undoes the effect of sqlite3_os_init(). Typical tasks
--** performed by these routines include allocation or deallocation
--** of static resources, initialization of global variables,
--** setting up a default [sqlite3_vfs] module, or setting up
--** a default configuration using [sqlite3_config()].
--**
--** The application should never invoke either sqlite3_os_init()
--** or sqlite3_os_end() directly. The application should only invoke
--** sqlite3_initialize() and sqlite3_shutdown(). The sqlite3_os_init()
--** interface is called automatically by sqlite3_initialize() and
--** sqlite3_os_end() is called by sqlite3_shutdown(). Appropriate
--** implementations for sqlite3_os_init() and sqlite3_os_end()
--** are built into SQLite when it is compiled for Unix, Windows, or OS/2.
--** When [custom builds | built for other platforms]
--** (using the [SQLITE_OS_OTHER=1] compile-time
--** option) the application must supply a suitable implementation for
--** sqlite3_os_init() and sqlite3_os_end(). An application-supplied
--** implementation of sqlite3_os_init() or sqlite3_os_end()
--** must return [SQLITE_OK] on success and some other [error code] upon
--** failure.
--
function sqlite3_initialize return int; -- /usr/include/sqlite3.h:914:16
pragma Import (C, sqlite3_initialize, "sqlite3_initialize");
function sqlite3_shutdown return int; -- /usr/include/sqlite3.h:915:16
pragma Import (C, sqlite3_shutdown, "sqlite3_shutdown");
function sqlite3_os_init return int; -- /usr/include/sqlite3.h:916:16
pragma Import (C, sqlite3_os_init, "sqlite3_os_init");
function sqlite3_os_end return int; -- /usr/include/sqlite3.h:917:16
pragma Import (C, sqlite3_os_end, "sqlite3_os_end");
--** CAPI3REF: Configuring The SQLite Library
--** EXPERIMENTAL
--**
--** The sqlite3_config() interface is used to make global configuration
--** changes to SQLite in order to tune SQLite to the specific needs of
--** the application. The default configuration is recommended for most
--** applications and so this routine is usually not necessary. It is
--** provided to support rare applications with unusual needs.
--**
--** The sqlite3_config() interface is not threadsafe. The application
--** must insure that no other SQLite interfaces are invoked by other
--** threads while sqlite3_config() is running. Furthermore, sqlite3_config()
--** may only be invoked prior to library initialization using
--** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
--** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
--** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.
--** Note, however, that ^sqlite3_config() can be called as part of the
--** implementation of an application-defined [sqlite3_os_init()].
--**
--** The first argument to sqlite3_config() is an integer
--** [SQLITE_CONFIG_SINGLETHREAD | configuration option] that determines
--** what property of SQLite is to be configured. Subsequent arguments
--** vary depending on the [SQLITE_CONFIG_SINGLETHREAD | configuration option]
--** in the first argument.
--**
--** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
--** ^If the option is unknown or SQLite is unable to set the option
--** then this routine returns a non-zero [error code].
--
function sqlite3_config (arg1 : int -- , ...
) return int; -- /usr/include/sqlite3.h:949:36
pragma Import (C, sqlite3_config, "sqlite3_config");
--** CAPI3REF: Configure database connections
--** EXPERIMENTAL
--**
--** The sqlite3_db_config() interface is used to make configuration
--** changes to a [database connection]. The interface is similar to
--** [sqlite3_config()] except that the changes apply to a single
--** [database connection] (specified in the first argument). The
--** sqlite3_db_config() interface should only be used immediately after
--** the database connection is created using [sqlite3_open()],
--** [sqlite3_open16()], or [sqlite3_open_v2()].
--**
--** The second argument to sqlite3_db_config(D,V,...) is the
--** configuration verb - an integer code that indicates what
--** aspect of the [database connection] is being configured.
--** The only choice for this value is [SQLITE_DBCONFIG_LOOKASIDE].
--** New verbs are likely to be added in future releases of SQLite.
--** Additional arguments depend on the verb.
--**
--** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if
--** the call is considered successful.
--
function sqlite3_db_config (arg1 : System.Address; arg2 : int -- , ...
) return int; -- /usr/include/sqlite3.h:973:36
pragma Import (C, sqlite3_db_config, "sqlite3_db_config");
--** CAPI3REF: Memory Allocation Routines
--** EXPERIMENTAL
--**
--** An instance of this object defines the interface between SQLite
--** and low-level memory allocation routines.
--**
--** This object is used in only one place in the SQLite interface.
--** A pointer to an instance of this object is the argument to
--** [sqlite3_config()] when the configuration option is
--** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC].
--** By creating an instance of this object
--** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC])
--** during configuration, an application can specify an alternative
--** memory allocation subsystem for SQLite to use for all of its
--** dynamic memory needs.
--**
--** Note that SQLite comes with several [built-in memory allocators]
--** that are perfectly adequate for the overwhelming majority of applications
--** and that this object is only useful to a tiny minority of applications
--** with specialized memory allocation requirements. This object is
--** also used during testing of SQLite in order to specify an alternative
--** memory allocator that simulates memory out-of-memory conditions in
--** order to verify that SQLite recovers gracefully from such
--** conditions.
--**
--** The xMalloc and xFree methods must work like the
--** malloc() and free() functions from the standard C library.
--** The xRealloc method must work like realloc() from the standard C library
--** with the exception that if the second argument to xRealloc is zero,
--** xRealloc must be a no-op - it must not perform any allocation or
--** deallocation. ^SQLite guarantees that the second argument to
--** xRealloc is always a value returned by a prior call to xRoundup.
--** And so in cases where xRoundup always returns a positive number,
--** xRealloc can perform exactly as the standard library realloc() and
--** still be in compliance with this specification.
--**
--** xSize should return the allocated size of a memory allocation
--** previously obtained from xMalloc or xRealloc. The allocated size
--** is always at least as big as the requested size but may be larger.
--**
--** The xRoundup method returns what would be the allocated size of
--** a memory allocation given a particular requested size. Most memory
--** allocators round up memory allocations at least to the next multiple
--** of 8. Some allocators round up to a larger multiple or to a power of 2.
--** Every memory allocation request coming in through [sqlite3_malloc()]
--** or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0,
--** that causes the corresponding memory allocation to fail.
--**
--** The xInit method initializes the memory allocator. (For example,
--** it might allocate any require mutexes or initialize internal data
--** structures. The xShutdown method is invoked (indirectly) by
--** [sqlite3_shutdown()] and should deallocate any resources acquired
--** by xInit. The pAppData pointer is used as the only parameter to
--** xInit and xShutdown.
--**
--** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes
--** the xInit method, so the xInit method need not be threadsafe. The
--** xShutdown method is only called from [sqlite3_shutdown()] so it does
--** not need to be threadsafe either. For all other methods, SQLite
--** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the
--** [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which
--** it is by default) and so the methods are automatically serialized.
--** However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other
--** methods must be threadsafe or else make their own arrangements for
--** serialization.
--**
--** SQLite will never invoke xInit() more than once without an intervening
--** call to xShutdown().
--
-- Memory allocation function
type sqlite3_mem_methods is record
xMalloc : access function (arg1 : int) return System.Address; -- /usr/include/sqlite3.h:1047:11
xFree : access procedure (arg1 : System.Address); -- /usr/include/sqlite3.h:1048:10
xRealloc : access function (arg1 : System.Address; arg2 : int) return System.Address; -- /usr/include/sqlite3.h:1049:11
xSize : access function (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:1050:9
xRoundup : access function (arg1 : int) return int; -- /usr/include/sqlite3.h:1051:9
xInit : access function (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:1052:9
xShutdown : access procedure (arg1 : System.Address); -- /usr/include/sqlite3.h:1053:10
pAppData : System.Address; -- /usr/include/sqlite3.h:1054:9
end record;
pragma Convention (C, sqlite3_mem_methods); -- /usr/include/sqlite3.h:1045:16
-- Free a prior allocation
-- Resize an allocation
-- Return the size of an allocation
-- Round up request size to allocation size
-- Initialize the memory allocator
-- Deinitialize the memory allocator
-- Argument to xInit() and xShutdown()
--** CAPI3REF: Configuration Options
--** EXPERIMENTAL
--**
--** These constants are the available integer configuration options that
--** can be passed as the first argument to the [sqlite3_config()] interface.
--**
--** New configuration options may be added in future releases of SQLite.
--** Existing configuration options might be discontinued. Applications
--** should check the return code from [sqlite3_config()] to make sure that
--** the call worked. The [sqlite3_config()] interface will return a
--** non-zero [error code] if a discontinued or unsupported configuration option
--** is invoked.
--**
--** <dl>
--** <dt>SQLITE_CONFIG_SINGLETHREAD</dt>
--** <dd>There are no arguments to this option. ^This option sets the
--** [threading mode] to Single-thread. In other words, it disables
--** all mutexing and puts SQLite into a mode where it can only be used
--** by a single thread. ^If SQLite is compiled with
--** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
--** it is not possible to change the [threading mode] from its default
--** value of Single-thread and so [sqlite3_config()] will return
--** [SQLITE_ERROR] if called with the SQLITE_CONFIG_SINGLETHREAD
--** configuration option.</dd>
--**
--** <dt>SQLITE_CONFIG_MULTITHREAD</dt>
--** <dd>There are no arguments to this option. ^This option sets the
--** [threading mode] to Multi-thread. In other words, it disables
--** mutexing on [database connection] and [prepared statement] objects.
--** The application is responsible for serializing access to
--** [database connections] and [prepared statements]. But other mutexes
--** are enabled so that SQLite will be safe to use in a multi-threaded
--** environment as long as no two threads attempt to use the same
--** [database connection] at the same time. ^If SQLite is compiled with
--** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
--** it is not possible to set the Multi-thread [threading mode] and
--** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
--** SQLITE_CONFIG_MULTITHREAD configuration option.</dd>
--**
--** <dt>SQLITE_CONFIG_SERIALIZED</dt>
--** <dd>There are no arguments to this option. ^This option sets the
--** [threading mode] to Serialized. In other words, this option enables
--** all mutexes including the recursive
--** mutexes on [database connection] and [prepared statement] objects.
--** In this mode (which is the default when SQLite is compiled with
--** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access
--** to [database connections] and [prepared statements] so that the
--** application is free to use the same [database connection] or the
--** same [prepared statement] in different threads at the same time.
--** ^If SQLite is compiled with
--** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
--** it is not possible to set the Serialized [threading mode] and
--** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
--** SQLITE_CONFIG_SERIALIZED configuration option.</dd>
--**
--** <dt>SQLITE_CONFIG_MALLOC</dt>
--** <dd> ^(This option takes a single argument which is a pointer to an
--** instance of the [sqlite3_mem_methods] structure. The argument specifies
--** alternative low-level memory allocation routines to be used in place of
--** the memory allocation routines built into SQLite.)^ ^SQLite makes
--** its own private copy of the content of the [sqlite3_mem_methods] structure
--** before the [sqlite3_config()] call returns.</dd>
--**
--** <dt>SQLITE_CONFIG_GETMALLOC</dt>
--** <dd> ^(This option takes a single argument which is a pointer to an
--** instance of the [sqlite3_mem_methods] structure. The [sqlite3_mem_methods]
--** structure is filled with the currently defined memory allocation routines.)^
--** This option can be used to overload the default memory allocation
--** routines with a wrapper that simulations memory allocation failure or
--** tracks memory usage, for example. </dd>
--**
--** <dt>SQLITE_CONFIG_MEMSTATUS</dt>
--** <dd> ^This option takes single argument of type int, interpreted as a
--** boolean, which enables or disables the collection of memory allocation
--** statistics. ^(When memory allocation statistics are disabled, the
--** following SQLite interfaces become non-operational:
--** <ul>
--** <li> [sqlite3_memory_used()]
--** <li> [sqlite3_memory_highwater()]
--** <li> [sqlite3_soft_heap_limit()]
--** <li> [sqlite3_status()]
--** </ul>)^
--** ^Memory allocation statistics are enabled by default unless SQLite is
--** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory
--** allocation statistics are disabled by default.
--** </dd>
--**
--** <dt>SQLITE_CONFIG_SCRATCH</dt>
--** <dd> ^This option specifies a static memory buffer that SQLite can use for
--** scratch memory. There are three arguments: A pointer an 8-byte
--** aligned memory buffer from which the scrach allocations will be
--** drawn, the size of each scratch allocation (sz),
--** and the maximum number of scratch allocations (N). The sz
--** argument must be a multiple of 16. The sz parameter should be a few bytes
--** larger than the actual scratch space required due to internal overhead.
--** The first argument must be a pointer to an 8-byte aligned buffer
--** of at least sz*N bytes of memory.
--** ^SQLite will use no more than one scratch buffer per thread. So
--** N should be set to the expected maximum number of threads. ^SQLite will
--** never require a scratch buffer that is more than 6 times the database
--** page size. ^If SQLite needs needs additional scratch memory beyond
--** what is provided by this configuration option, then
--** [sqlite3_malloc()] will be used to obtain the memory needed.</dd>
--**
--** <dt>SQLITE_CONFIG_PAGECACHE</dt>
--** <dd> ^This option specifies a static memory buffer that SQLite can use for
--** the database page cache with the default page cache implemenation.
--** This configuration should not be used if an application-define page
--** cache implementation is loaded using the SQLITE_CONFIG_PCACHE option.
--** There are three arguments to this option: A pointer to 8-byte aligned
--** memory, the size of each page buffer (sz), and the number of pages (N).
--** The sz argument should be the size of the largest database page
--** (a power of two between 512 and 32768) plus a little extra for each
--** page header. ^The page header size is 20 to 40 bytes depending on
--** the host architecture. ^It is harmless, apart from the wasted memory,
--** to make sz a little too large. The first
--** argument should point to an allocation of at least sz*N bytes of memory.
--** ^SQLite will use the memory provided by the first argument to satisfy its
--** memory needs for the first N pages that it adds to cache. ^If additional
--** page cache memory is needed beyond what is provided by this option, then
--** SQLite goes to [sqlite3_malloc()] for the additional storage space.
--** ^The implementation might use one or more of the N buffers to hold
--** memory accounting information. The pointer in the first argument must
--** be aligned to an 8-byte boundary or subsequent behavior of SQLite
--** will be undefined.</dd>
--**
--** <dt>SQLITE_CONFIG_HEAP</dt>
--** <dd> ^This option specifies a static memory buffer that SQLite will use
--** for all of its dynamic memory allocation needs beyond those provided
--** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE].
--** There are three arguments: An 8-byte aligned pointer to the memory,
--** the number of bytes in the memory buffer, and the minimum allocation size.
--** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts
--** to using its default memory allocator (the system malloc() implementation),
--** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the
--** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or
--** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory
--** allocator is engaged to handle all of SQLites memory allocation needs.
--** The first pointer (the memory pointer) must be aligned to an 8-byte
--** boundary or subsequent behavior of SQLite will be undefined.</dd>
--**
--** <dt>SQLITE_CONFIG_MUTEX</dt>
--** <dd> ^(This option takes a single argument which is a pointer to an
--** instance of the [sqlite3_mutex_methods] structure. The argument specifies
--** alternative low-level mutex routines to be used in place
--** the mutex routines built into SQLite.)^ ^SQLite makes a copy of the
--** content of the [sqlite3_mutex_methods] structure before the call to
--** [sqlite3_config()] returns. ^If SQLite is compiled with
--** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
--** the entire mutexing subsystem is omitted from the build and hence calls to
--** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will
--** return [SQLITE_ERROR].</dd>
--**
--** <dt>SQLITE_CONFIG_GETMUTEX</dt>
--** <dd> ^(This option takes a single argument which is a pointer to an
--** instance of the [sqlite3_mutex_methods] structure. The
--** [sqlite3_mutex_methods]
--** structure is filled with the currently defined mutex routines.)^
--** This option can be used to overload the default mutex allocation
--** routines with a wrapper used to track mutex usage for performance
--** profiling or testing, for example. ^If SQLite is compiled with
--** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
--** the entire mutexing subsystem is omitted from the build and hence calls to
--** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will
--** return [SQLITE_ERROR].</dd>
--**
--** <dt>SQLITE_CONFIG_LOOKASIDE</dt>
--** <dd> ^(This option takes two arguments that determine the default
--** memory allocation for the lookaside memory allocator on each
--** [database connection]. The first argument is the
--** size of each lookaside buffer slot and the second is the number of
--** slots allocated to each database connection.)^ ^(This option sets the
--** <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
--** verb to [sqlite3_db_config()] can be used to change the lookaside
--** configuration on individual connections.)^ </dd>
--**
--** <dt>SQLITE_CONFIG_PCACHE</dt>
--** <dd> ^(This option takes a single argument which is a pointer to
--** an [sqlite3_pcache_methods] object. This object specifies the interface
--** to a custom page cache implementation.)^ ^SQLite makes a copy of the
--** object and uses it for page cache memory allocations.</dd>
--**
--** <dt>SQLITE_CONFIG_GETPCACHE</dt>
--** <dd> ^(This option takes a single argument which is a pointer to an
--** [sqlite3_pcache_methods] object. SQLite copies of the current
--** page cache implementation into that object.)^ </dd>
--**
--** </dl>
--
-- previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused.
--** CAPI3REF: Configuration Options
--** EXPERIMENTAL
--**
--** These constants are the available integer configuration options that
--** can be passed as the second argument to the [sqlite3_db_config()] interface.
--**
--** New configuration options may be added in future releases of SQLite.
--** Existing configuration options might be discontinued. Applications
--** should check the return code from [sqlite3_db_config()] to make sure that
--** the call worked. ^The [sqlite3_db_config()] interface will return a
--** non-zero [error code] if a discontinued or unsupported configuration option
--** is invoked.
--**
--** <dl>
--** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
--** <dd> ^This option takes three additional arguments that determine the
--** [lookaside memory allocator] configuration for the [database connection].
--** ^The first argument (the third parameter to [sqlite3_db_config()] is a
--** pointer to an memory buffer to use for lookaside memory.
--** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
--** may be NULL in which case SQLite will allocate the
--** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
--** size of each lookaside buffer slot. ^The third argument is the number of
--** slots. The size of the buffer in the first argument must be greater than
--** or equal to the product of the second and third arguments. The buffer
--** must be aligned to an 8-byte boundary. ^If the second argument to
--** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally
--** rounded down to the next smaller
--** multiple of 8. See also: [SQLITE_CONFIG_LOOKASIDE]</dd>
--**
--** </dl>
--
--** CAPI3REF: Enable Or Disable Extended Result Codes
--**
--** ^The sqlite3_extended_result_codes() routine enables or disables the
--** [extended result codes] feature of SQLite. ^The extended result
--** codes are disabled by default for historical compatibility.
--
function sqlite3_extended_result_codes (arg1 : System.Address; arg2 : int) return int; -- /usr/include/sqlite3.h:1306:16
pragma Import (C, sqlite3_extended_result_codes, "sqlite3_extended_result_codes");
--** CAPI3REF: Last Insert Rowid
--**
--** ^Each entry in an SQLite table has a unique 64-bit signed
--** integer key called the [ROWID | "rowid"]. ^The rowid is always available
--** as an undeclared column named ROWID, OID, or _ROWID_ as long as those
--** names are not also used by explicitly declared columns. ^If
--** the table has a column of type [INTEGER PRIMARY KEY] then that column
--** is another alias for the rowid.
--**
--** ^This routine returns the [rowid] of the most recent
--** successful [INSERT] into the database from the [database connection]
--** in the first argument. ^If no successful [INSERT]s
--** have ever occurred on that database connection, zero is returned.
--**
--** ^(If an [INSERT] occurs within a trigger, then the [rowid] of the inserted
--** row is returned by this routine as long as the trigger is running.
--** But once the trigger terminates, the value returned by this routine
--** reverts to the last value inserted before the trigger fired.)^
--**
--** ^An [INSERT] that fails due to a constraint violation is not a
--** successful [INSERT] and does not change the value returned by this
--** routine. ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK,
--** and INSERT OR ABORT make no changes to the return value of this
--** routine when their insertion fails. ^(When INSERT OR REPLACE
--** encounters a constraint violation, it does not fail. The
--** INSERT continues to completion after deleting rows that caused
--** the constraint problem so INSERT OR REPLACE will always change
--** the return value of this interface.)^
--**
--** ^For the purposes of this routine, an [INSERT] is considered to
--** be successful even if it is subsequently rolled back.
--**
--** This function is accessible to SQL statements via the
--** [last_insert_rowid() SQL function].
--**
--** If a separate thread performs a new [INSERT] on the same
--** database connection while the [sqlite3_last_insert_rowid()]
--** function is running and thus changes the last insert [rowid],
--** then the value returned by [sqlite3_last_insert_rowid()] is
--** unpredictable and might not equal either the old or the new
--** last insert [rowid].
--
function sqlite3_last_insert_rowid (arg1 : System.Address) return sqlite3_int64; -- /usr/include/sqlite3.h:1351:26
pragma Import (C, sqlite3_last_insert_rowid, "sqlite3_last_insert_rowid");
--** CAPI3REF: Count The Number Of Rows Modified
--**
--** ^This function returns the number of database rows that were changed
--** or inserted or deleted by the most recently completed SQL statement
--** on the [database connection] specified by the first parameter.
--** ^(Only changes that are directly specified by the [INSERT], [UPDATE],
--** or [DELETE] statement are counted. Auxiliary changes caused by
--** triggers or [foreign key actions] are not counted.)^ Use the
--** [sqlite3_total_changes()] function to find the total number of changes
--** including changes caused by triggers and foreign key actions.
--**
--** ^Changes to a view that are simulated by an [INSTEAD OF trigger]
--** are not counted. Only real table changes are counted.
--**
--** ^(A "row change" is a change to a single row of a single table
--** caused by an INSERT, DELETE, or UPDATE statement. Rows that
--** are changed as side effects of [REPLACE] constraint resolution,
--** rollback, ABORT processing, [DROP TABLE], or by any other
--** mechanisms do not count as direct row changes.)^
--**
--** A "trigger context" is a scope of execution that begins and
--** ends with the script of a [CREATE TRIGGER | trigger].
--** Most SQL statements are
--** evaluated outside of any trigger. This is the "top level"
--** trigger context. If a trigger fires from the top level, a
--** new trigger context is entered for the duration of that one
--** trigger. Subtriggers create subcontexts for their duration.
--**
--** ^Calling [sqlite3_exec()] or [sqlite3_step()] recursively does
--** not create a new trigger context.
--**
--** ^This function returns the number of direct row changes in the
--** most recent INSERT, UPDATE, or DELETE statement within the same
--** trigger context.
--**
--** ^Thus, when called from the top level, this function returns the
--** number of changes in the most recent INSERT, UPDATE, or DELETE
--** that also occurred at the top level. ^(Within the body of a trigger,
--** the sqlite3_changes() interface can be called to find the number of
--** changes in the most recently completed INSERT, UPDATE, or DELETE
--** statement within the body of the same trigger.
--** However, the number returned does not include changes
--** caused by subtriggers since those have their own context.)^
--**
--** See also the [sqlite3_total_changes()] interface, the
--** [count_changes pragma], and the [changes() SQL function].
--**
--** If a separate thread makes changes on the same database connection
--** while [sqlite3_changes()] is running then the value returned
--** is unpredictable and not meaningful.
--
function sqlite3_changes (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:1405:16
pragma Import (C, sqlite3_changes, "sqlite3_changes");
--** CAPI3REF: Total Number Of Rows Modified
--**
--** ^This function returns the number of row changes caused by [INSERT],
--** [UPDATE] or [DELETE] statements since the [database connection] was opened.
--** ^(The count returned by sqlite3_total_changes() includes all changes
--** from all [CREATE TRIGGER | trigger] contexts and changes made by
--** [foreign key actions]. However,
--** the count does not include changes used to implement [REPLACE] constraints,
--** do rollbacks or ABORT processing, or [DROP TABLE] processing. The
--** count does not include rows of views that fire an [INSTEAD OF trigger],
--** though if the INSTEAD OF trigger makes changes of its own, those changes
--** are counted.)^
--** ^The sqlite3_total_changes() function counts the changes as soon as
--** the statement that makes them is completed (when the statement handle
--** is passed to [sqlite3_reset()] or [sqlite3_finalize()]).
--**
--** See also the [sqlite3_changes()] interface, the
--** [count_changes pragma], and the [total_changes() SQL function].
--**
--** If a separate thread makes changes on the same database connection
--** while [sqlite3_total_changes()] is running then the value
--** returned is unpredictable and not meaningful.
--
function sqlite3_total_changes (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:1431:16
pragma Import (C, sqlite3_total_changes, "sqlite3_total_changes");
--** CAPI3REF: Interrupt A Long-Running Query
--**
--** ^This function causes any pending database operation to abort and
--** return at its earliest opportunity. This routine is typically
--** called in response to a user action such as pressing "Cancel"
--** or Ctrl-C where the user wants a long query operation to halt
--** immediately.
--**
--** ^It is safe to call this routine from a thread different from the
--** thread that is currently running the database operation. But it
--** is not safe to call this routine with a [database connection] that
--** is closed or might close before sqlite3_interrupt() returns.
--**
--** ^If an SQL operation is very nearly finished at the time when
--** sqlite3_interrupt() is called, then it might not have an opportunity
--** to be interrupted and might continue to completion.
--**
--** ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT].
--** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE
--** that is inside an explicit transaction, then the entire transaction
--** will be rolled back automatically.
--**
--** ^The sqlite3_interrupt(D) call is in effect until all currently running
--** SQL statements on [database connection] D complete. ^Any new SQL statements
--** that are started after the sqlite3_interrupt() call and before the
--** running statements reaches zero are interrupted as if they had been
--** running prior to the sqlite3_interrupt() call. ^New SQL statements
--** that are started after the running statement count reaches zero are
--** not effected by the sqlite3_interrupt().
--** ^A call to sqlite3_interrupt(D) that occurs when there are no running
--** SQL statements is a no-op and has no effect on SQL statements
--** that are started after the sqlite3_interrupt() call returns.
--**
--** If the database connection closes while [sqlite3_interrupt()]
--** is running then bad things will likely happen.
--
procedure sqlite3_interrupt (arg1 : System.Address); -- /usr/include/sqlite3.h:1470:17
pragma Import (C, sqlite3_interrupt, "sqlite3_interrupt");
--** CAPI3REF: Determine If An SQL Statement Is Complete
--**
--** These routines are useful during command-line input to determine if the
--** currently entered text seems to form a complete SQL statement or
--** if additional input is needed before sending the text into
--** SQLite for parsing. ^These routines return 1 if the input string
--** appears to be a complete SQL statement. ^A statement is judged to be
--** complete if it ends with a semicolon token and is not a prefix of a
--** well-formed CREATE TRIGGER statement. ^Semicolons that are embedded within
--** string literals or quoted identifier names or comments are not
--** independent tokens (they are part of the token in which they are
--** embedded) and thus do not count as a statement terminator. ^Whitespace
--** and comments that follow the final semicolon are ignored.
--**
--** ^These routines return 0 if the statement is incomplete. ^If a
--** memory allocation fails, then SQLITE_NOMEM is returned.
--**
--** ^These routines do not parse the SQL statements thus
--** will not detect syntactically incorrect SQL.
--**
--** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior
--** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked
--** automatically by sqlite3_complete16(). If that initialization fails,
--** then the return value from sqlite3_complete16() will be non-zero
--** regardless of whether or not the input SQL is complete.)^
--**
--** The input to [sqlite3_complete()] must be a zero-terminated
--** UTF-8 string.
--**
--** The input to [sqlite3_complete16()] must be a zero-terminated
--** UTF-16 string in native byte order.
--
function sqlite3_complete (arg1 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/sqlite3.h:1505:16
pragma Import (C, sqlite3_complete, "sqlite3_complete");
function sqlite3_complete16 (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:1506:16
pragma Import (C, sqlite3_complete16, "sqlite3_complete16");
--** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
--**
--** ^This routine sets a callback function that might be invoked whenever
--** an attempt is made to open a database table that another thread
--** or process has locked.
--**
--** ^If the busy callback is NULL, then [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED]
--** is returned immediately upon encountering the lock. ^If the busy callback
--** is not NULL, then the callback might be invoked with two arguments.
--**
--** ^The first argument to the busy handler is a copy of the void* pointer which
--** is the third argument to sqlite3_busy_handler(). ^The second argument to
--** the busy handler callback is the number of times that the busy handler has
--** been invoked for this locking event. ^If the
--** busy callback returns 0, then no additional attempts are made to
--** access the database and [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] is returned.
--** ^If the callback returns non-zero, then another attempt
--** is made to open the database for reading and the cycle repeats.
--**
--** The presence of a busy handler does not guarantee that it will be invoked
--** when there is lock contention. ^If SQLite determines that invoking the busy
--** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY]
--** or [SQLITE_IOERR_BLOCKED] instead of invoking the busy handler.
--** Consider a scenario where one process is holding a read lock that
--** it is trying to promote to a reserved lock and
--** a second process is holding a reserved lock that it is trying
--** to promote to an exclusive lock. The first process cannot proceed
--** because it is blocked by the second and the second process cannot
--** proceed because it is blocked by the first. If both processes
--** invoke the busy handlers, neither will make any progress. Therefore,
--** SQLite returns [SQLITE_BUSY] for the first process, hoping that this
--** will induce the first process to release its read lock and allow
--** the second process to proceed.
--**
--** ^The default busy callback is NULL.
--**
--** ^The [SQLITE_BUSY] error is converted to [SQLITE_IOERR_BLOCKED]
--** when SQLite is in the middle of a large transaction where all the
--** changes will not fit into the in-memory cache. SQLite will
--** already hold a RESERVED lock on the database file, but it needs
--** to promote this lock to EXCLUSIVE so that it can spill cache
--** pages into the database file without harm to concurrent
--** readers. ^If it is unable to promote the lock, then the in-memory
--** cache will be left in an inconsistent state and so the error
--** code is promoted from the relatively benign [SQLITE_BUSY] to
--** the more severe [SQLITE_IOERR_BLOCKED]. ^This error code promotion
--** forces an automatic rollback of the changes. See the
--** <a href="/cvstrac/wiki?p=CorruptionFollowingBusyError">
--** CorruptionFollowingBusyError</a> wiki page for a discussion of why
--** this is important.
--**
--** ^(There can only be a single busy handler defined for each
--** [database connection]. Setting a new busy handler clears any
--** previously set handler.)^ ^Note that calling [sqlite3_busy_timeout()]
--** will also set or clear the busy handler.
--**
--** The busy callback should not take any actions which modify the
--** database connection that invoked the busy handler. Any such actions
--** result in undefined behavior.
--**
--** A busy handler must not close the database connection
--** or [prepared statement] that invoked the busy handler.
--
function sqlite3_busy_handler
(arg1 : System.Address;
arg2 : access function (arg1 : System.Address; arg2 : int) return int;
arg3 : System.Address) return int; -- /usr/include/sqlite3.h:1572:16
pragma Import (C, sqlite3_busy_handler, "sqlite3_busy_handler");
--** CAPI3REF: Set A Busy Timeout
--**
--** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps
--** for a specified amount of time when a table is locked. ^The handler
--** will sleep multiple times until at least "ms" milliseconds of sleeping
--** have accumulated. ^After at least "ms" milliseconds of sleeping,
--** the handler returns 0 which causes [sqlite3_step()] to return
--** [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED].
--**
--** ^Calling this routine with an argument less than or equal to zero
--** turns off all busy handlers.
--**
--** ^(There can only be a single busy handler for a particular
--** [database connection] any any given moment. If another busy handler
--** was defined (using [sqlite3_busy_handler()]) prior to calling
--** this routine, that other busy handler is cleared.)^
--
function sqlite3_busy_timeout (arg1 : System.Address; arg2 : int) return int; -- /usr/include/sqlite3.h:1592:16
pragma Import (C, sqlite3_busy_timeout, "sqlite3_busy_timeout");
--** CAPI3REF: Convenience Routines For Running Queries
--**
--** Definition: A <b>result table</b> is memory data structure created by the
--** [sqlite3_get_table()] interface. A result table records the
--** complete query results from one or more queries.
--**
--** The table conceptually has a number of rows and columns. But
--** these numbers are not part of the result table itself. These
--** numbers are obtained separately. Let N be the number of rows
--** and M be the number of columns.
--**
--** A result table is an array of pointers to zero-terminated UTF-8 strings.
--** There are (N+1)*M elements in the array. The first M pointers point
--** to zero-terminated strings that contain the names of the columns.
--** The remaining entries all point to query results. NULL values result
--** in NULL pointers. All other values are in their UTF-8 zero-terminated
--** string representation as returned by [sqlite3_column_text()].
--**
--** A result table might consist of one or more memory allocations.
--** It is not safe to pass a result table directly to [sqlite3_free()].
--** A result table should be deallocated using [sqlite3_free_table()].
--**
--** As an example of the result table format, suppose a query result
--** is as follows:
--**
--** <blockquote><pre>
--** Name | Age
--** -----------------------
--** Alice | 43
--** Bob | 28
--** Cindy | 21
--** </pre></blockquote>
--**
--** There are two column (M==2) and three rows (N==3). Thus the
--** result table has 8 entries. Suppose the result table is stored
--** in an array names azResult. Then azResult holds this content:
--**
--** <blockquote><pre>
--** azResult[0] = "Name";
--** azResult[1] = "Age";
--** azResult[2] = "Alice";
--** azResult[3] = "43";
--** azResult[4] = "Bob";
--** azResult[5] = "28";
--** azResult[6] = "Cindy";
--** azResult[7] = "21";
--** </pre></blockquote>
--**
--** ^The sqlite3_get_table() function evaluates one or more
--** semicolon-separated SQL statements in the zero-terminated UTF-8
--** string of its 2nd parameter and returns a result table to the
--** pointer given in its 3rd parameter.
--**
--** After the application has finished with the result from sqlite3_get_table(),
--** it should pass the result table pointer to sqlite3_free_table() in order to
--** release the memory that was malloced. Because of the way the
--** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling
--** function must not try to call [sqlite3_free()] directly. Only
--** [sqlite3_free_table()] is able to release the memory properly and safely.
--**
--** ^(The sqlite3_get_table() interface is implemented as a wrapper around
--** [sqlite3_exec()]. The sqlite3_get_table() routine does not have access
--** to any internal data structures of SQLite. It uses only the public
--** interface defined here. As a consequence, errors that occur in the
--** wrapper layer outside of the internal [sqlite3_exec()] call are not
--** reflected in subsequent calls to [sqlite3_errcode()] or
--** [sqlite3_errmsg()].)^
--
function sqlite3_get_table
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : System.Address;
arg4 : access int;
arg5 : access int;
arg6 : System.Address) return int; -- /usr/include/sqlite3.h:1663:16
pragma Import (C, sqlite3_get_table, "sqlite3_get_table");
-- An open database
-- SQL to be evaluated
-- Results of the query
-- Number of result rows written here
-- Number of result columns written here
-- Error msg written here
procedure sqlite3_free_table (arg1 : System.Address); -- /usr/include/sqlite3.h:1671:17
pragma Import (C, sqlite3_free_table, "sqlite3_free_table");
--** CAPI3REF: Formatted String Printing Functions
--**
--** These routines are work-alikes of the "printf()" family of functions
--** from the standard C library.
--**
--** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their
--** results into memory obtained from [sqlite3_malloc()].
--** The strings returned by these two routines should be
--** released by [sqlite3_free()]. ^Both routines return a
--** NULL pointer if [sqlite3_malloc()] is unable to allocate enough
--** memory to hold the resulting string.
--**
--** ^(In sqlite3_snprintf() routine is similar to "snprintf()" from
--** the standard C library. The result is written into the
--** buffer supplied as the second parameter whose size is given by
--** the first parameter. Note that the order of the
--** first two parameters is reversed from snprintf().)^ This is an
--** historical accident that cannot be fixed without breaking
--** backwards compatibility. ^(Note also that sqlite3_snprintf()
--** returns a pointer to its buffer instead of the number of
--** characters actually written into the buffer.)^ We admit that
--** the number of characters written would be a more useful return
--** value but we cannot change the implementation of sqlite3_snprintf()
--** now without breaking compatibility.
--**
--** ^As long as the buffer size is greater than zero, sqlite3_snprintf()
--** guarantees that the buffer is always zero-terminated. ^The first
--** parameter "n" is the total size of the buffer, including space for
--** the zero terminator. So the longest string that can be completely
--** written will be n-1 characters.
--**
--** These routines all implement some additional formatting
--** options that are useful for constructing SQL statements.
--** All of the usual printf() formatting options apply. In addition, there
--** is are "%q", "%Q", and "%z" options.
--**
--** ^(The %q option works like %s in that it substitutes a null-terminated
--** string from the argument list. But %q also doubles every '\'' character.
--** %q is designed for use inside a string literal.)^ By doubling each '\''
--** character it escapes that character and allows it to be inserted into
--** the string.
--**
--** For example, assume the string variable zText contains text as follows:
--**
--** <blockquote><pre>
--** char *zText = "It's a happy day!";
--** </pre></blockquote>
--**
--** One can use this text in an SQL statement as follows:
--**
--** <blockquote><pre>
--** char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText);
--** sqlite3_exec(db, zSQL, 0, 0, 0);
--** sqlite3_free(zSQL);
--** </pre></blockquote>
--**
--** Because the %q format string is used, the '\'' character in zText
--** is escaped and the SQL generated is as follows:
--**
--** <blockquote><pre>
--** INSERT INTO table1 VALUES('It''s a happy day!')
--** </pre></blockquote>
--**
--** This is correct. Had we used %s instead of %q, the generated SQL
--** would have looked like this:
--**
--** <blockquote><pre>
--** INSERT INTO table1 VALUES('It's a happy day!');
--** </pre></blockquote>
--**
--** This second example is an SQL syntax error. As a general rule you should
--** always use %q instead of %s when inserting text into a string literal.
--**
--** ^(The %Q option works like %q except it also adds single quotes around
--** the outside of the total string. Additionally, if the parameter in the
--** argument list is a NULL pointer, %Q substitutes the text "NULL" (without
--** single quotes).)^ So, for example, one could say:
--**
--** <blockquote><pre>
--** char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText);
--** sqlite3_exec(db, zSQL, 0, 0, 0);
--** sqlite3_free(zSQL);
--** </pre></blockquote>
--**
--** The code above will render a correct SQL statement in the zSQL
--** variable even if the zText variable is a NULL pointer.
--**
--** ^(The "%z" formatting option works like "%s" but with the
--** addition that after the string has been read and copied into
--** the result, [sqlite3_free()] is called on the input string.)^
--
function sqlite3_mprintf (arg1 : Interfaces.C.Strings.chars_ptr -- , ...
) return Interfaces.C.Strings.chars_ptr; -- /usr/include/sqlite3.h:1765:18
pragma Import (C, sqlite3_mprintf, "sqlite3_mprintf");
--
-- function sqlite3_vmprintf (arg1 : Interfaces.C.Strings.chars_ptr; arg2 : stdarg_h.va_list) return Interfaces.C.Strings.chars_ptr; -- /usr/include/sqlite3.h:1766:18
-- pragma Import (C, sqlite3_vmprintf, "sqlite3_vmprintf");
--
-- function sqlite3_snprintf
-- (arg1 : int;
-- arg2 : Interfaces.C.Strings.chars_ptr;
-- arg3 : Interfaces.C.Strings.chars_ptr -- , ...
-- ) return Interfaces.C.Strings.chars_ptr; -- /usr/include/sqlite3.h:1767:18
-- pragma Import (C, sqlite3_snprintf, "sqlite3_snprintf");
--** CAPI3REF: Memory Allocation Subsystem
--**
--** The SQLite core uses these three routines for all of its own
--** internal memory allocation needs. "Core" in the previous sentence
--** does not include operating-system specific VFS implementation. The
--** Windows VFS uses native malloc() and free() for some operations.
--**
--** ^The sqlite3_malloc() routine returns a pointer to a block
--** of memory at least N bytes in length, where N is the parameter.
--** ^If sqlite3_malloc() is unable to obtain sufficient free
--** memory, it returns a NULL pointer. ^If the parameter N to
--** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns
--** a NULL pointer.
--**
--** ^Calling sqlite3_free() with a pointer previously returned
--** by sqlite3_malloc() or sqlite3_realloc() releases that memory so
--** that it might be reused. ^The sqlite3_free() routine is
--** a no-op if is called with a NULL pointer. Passing a NULL pointer
--** to sqlite3_free() is harmless. After being freed, memory
--** should neither be read nor written. Even reading previously freed
--** memory might result in a segmentation fault or other severe error.
--** Memory corruption, a segmentation fault, or other severe error
--** might result if sqlite3_free() is called with a non-NULL pointer that
--** was not obtained from sqlite3_malloc() or sqlite3_realloc().
--**
--** ^(The sqlite3_realloc() interface attempts to resize a
--** prior memory allocation to be at least N bytes, where N is the
--** second parameter. The memory allocation to be resized is the first
--** parameter.)^ ^ If the first parameter to sqlite3_realloc()
--** is a NULL pointer then its behavior is identical to calling
--** sqlite3_malloc(N) where N is the second parameter to sqlite3_realloc().
--** ^If the second parameter to sqlite3_realloc() is zero or
--** negative then the behavior is exactly the same as calling
--** sqlite3_free(P) where P is the first parameter to sqlite3_realloc().
--** ^sqlite3_realloc() returns a pointer to a memory allocation
--** of at least N bytes in size or NULL if sufficient memory is unavailable.
--** ^If M is the size of the prior allocation, then min(N,M) bytes
--** of the prior allocation are copied into the beginning of buffer returned
--** by sqlite3_realloc() and the prior allocation is freed.
--** ^If sqlite3_realloc() returns NULL, then the prior allocation
--** is not freed.
--**
--** ^The memory returned by sqlite3_malloc() and sqlite3_realloc()
--** is always aligned to at least an 8 byte boundary.
--**
--** In SQLite version 3.5.0 and 3.5.1, it was possible to define
--** the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in
--** implementation of these routines to be omitted. That capability
--** is no longer provided. Only built-in memory allocators can be used.
--**
--** The Windows OS interface layer calls
--** the system malloc() and free() directly when converting
--** filenames between the UTF-8 encoding used by SQLite
--** and whatever filename encoding is used by the particular Windows
--** installation. Memory allocation errors are detected, but
--** they are reported back as [SQLITE_CANTOPEN] or
--** [SQLITE_IOERR] rather than [SQLITE_NOMEM].
--**
--** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()]
--** must be either NULL or else pointers obtained from a prior
--** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have
--** not yet been released.
--**
--** The application must not read or write any part of
--** a block of memory after it has been released using
--** [sqlite3_free()] or [sqlite3_realloc()].
--
function sqlite3_malloc (arg1 : int) return System.Address; -- /usr/include/sqlite3.h:1837:18
pragma Import (C, sqlite3_malloc, "sqlite3_malloc");
function sqlite3_realloc (arg1 : System.Address; arg2 : int) return System.Address; -- /usr/include/sqlite3.h:1838:18
pragma Import (C, sqlite3_realloc, "sqlite3_realloc");
procedure sqlite3_free (arg1 : System.Address); -- /usr/include/sqlite3.h:1839:17
pragma Import (C, sqlite3_free, "sqlite3_free");
--** CAPI3REF: Memory Allocator Statistics
--**
--** SQLite provides these two interfaces for reporting on the status
--** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()]
--** routines, which form the built-in memory allocation subsystem.
--**
--** ^The [sqlite3_memory_used()] routine returns the number of bytes
--** of memory currently outstanding (malloced but not freed).
--** ^The [sqlite3_memory_highwater()] routine returns the maximum
--** value of [sqlite3_memory_used()] since the high-water mark
--** was last reset. ^The values returned by [sqlite3_memory_used()] and
--** [sqlite3_memory_highwater()] include any overhead
--** added by SQLite in its implementation of [sqlite3_malloc()],
--** but not overhead added by the any underlying system library
--** routines that [sqlite3_malloc()] may call.
--**
--** ^The memory high-water mark is reset to the current value of
--** [sqlite3_memory_used()] if and only if the parameter to
--** [sqlite3_memory_highwater()] is true. ^The value returned
--** by [sqlite3_memory_highwater(1)] is the high-water mark
--** prior to the reset.
--
function sqlite3_memory_used return sqlite3_int64; -- /usr/include/sqlite3.h:1864:26
pragma Import (C, sqlite3_memory_used, "sqlite3_memory_used");
function sqlite3_memory_highwater (arg1 : int) return sqlite3_int64; -- /usr/include/sqlite3.h:1865:26
pragma Import (C, sqlite3_memory_highwater, "sqlite3_memory_highwater");
--** CAPI3REF: Pseudo-Random Number Generator
--**
--** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
--** select random [ROWID | ROWIDs] when inserting new records into a table that
--** already uses the largest possible [ROWID]. The PRNG is also used for
--** the build-in random() and randomblob() SQL functions. This interface allows
--** applications to access the same PRNG for other purposes.
--**
--** ^A call to this routine stores N bytes of randomness into buffer P.
--**
--** ^The first time this routine is invoked (either internally or by
--** the application) the PRNG is seeded using randomness obtained
--** from the xRandomness method of the default [sqlite3_vfs] object.
--** ^On all subsequent invocations, the pseudo-randomness is generated
--** internally and without recourse to the [sqlite3_vfs] xRandomness
--** method.
--
procedure sqlite3_randomness (arg1 : int; arg2 : System.Address); -- /usr/include/sqlite3.h:1885:17
pragma Import (C, sqlite3_randomness, "sqlite3_randomness");
--** CAPI3REF: Compile-Time Authorization Callbacks
--**
--** ^This routine registers a authorizer callback with a particular
--** [database connection], supplied in the first argument.
--** ^The authorizer callback is invoked as SQL statements are being compiled
--** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
--** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various
--** points during the compilation process, as logic is being created
--** to perform various actions, the authorizer callback is invoked to
--** see if those actions are allowed. ^The authorizer callback should
--** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the
--** specific action but allow the SQL statement to continue to be
--** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be
--** rejected with an error. ^If the authorizer callback returns
--** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY]
--** then the [sqlite3_prepare_v2()] or equivalent call that triggered
--** the authorizer will fail with an error message.
--**
--** When the callback returns [SQLITE_OK], that means the operation
--** requested is ok. ^When the callback returns [SQLITE_DENY], the
--** [sqlite3_prepare_v2()] or equivalent call that triggered the
--** authorizer will fail with an error message explaining that
--** access is denied.
--**
--** ^The first parameter to the authorizer callback is a copy of the third
--** parameter to the sqlite3_set_authorizer() interface. ^The second parameter
--** to the callback is an integer [SQLITE_COPY | action code] that specifies
--** the particular action to be authorized. ^The third through sixth parameters
--** to the callback are zero-terminated strings that contain additional
--** details about the action to be authorized.
--**
--** ^If the action code is [SQLITE_READ]
--** and the callback returns [SQLITE_IGNORE] then the
--** [prepared statement] statement is constructed to substitute
--** a NULL value in place of the table column that would have
--** been read if [SQLITE_OK] had been returned. The [SQLITE_IGNORE]
--** return can be used to deny an untrusted user access to individual
--** columns of a table.
--** ^If the action code is [SQLITE_DELETE] and the callback returns
--** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the
--** [truncate optimization] is disabled and all rows are deleted individually.
--**
--** An authorizer is used when [sqlite3_prepare | preparing]
--** SQL statements from an untrusted source, to ensure that the SQL statements
--** do not try to access data they are not allowed to see, or that they do not
--** try to execute malicious statements that damage the database. For
--** example, an application may allow a user to enter arbitrary
--** SQL queries for evaluation by a database. But the application does
--** not want the user to be able to make arbitrary changes to the
--** database. An authorizer could then be put in place while the
--** user-entered SQL is being [sqlite3_prepare | prepared] that
--** disallows everything except [SELECT] statements.
--**
--** Applications that need to process SQL from untrusted sources
--** might also consider lowering resource limits using [sqlite3_limit()]
--** and limiting database size using the [max_page_count] [PRAGMA]
--** in addition to using an authorizer.
--**
--** ^(Only a single authorizer can be in place on a database connection
--** at a time. Each call to sqlite3_set_authorizer overrides the
--** previous call.)^ ^Disable the authorizer by installing a NULL callback.
--** The authorizer is disabled by default.
--**
--** The authorizer callback must not do anything that will modify
--** the database connection that invoked the authorizer callback.
--** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
--** database connections for the meaning of "modify" in this paragraph.
--**
--** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the
--** statement might be re-prepared during [sqlite3_step()] due to a
--** schema change. Hence, the application should ensure that the
--** correct authorizer callback remains in place during the [sqlite3_step()].
--**
--** ^Note that the authorizer callback is invoked only during
--** [sqlite3_prepare()] or its variants. Authorization is not
--** performed during statement evaluation in [sqlite3_step()], unless
--** as stated in the previous paragraph, sqlite3_step() invokes
--** sqlite3_prepare_v2() to reprepare a statement after a schema change.
--
function sqlite3_set_authorizer
(arg1 : System.Address;
arg2 : access function
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : Interfaces.C.Strings.chars_ptr;
arg5 : Interfaces.C.Strings.chars_ptr;
arg6 : Interfaces.C.Strings.chars_ptr) return int;
arg3 : System.Address) return int; -- /usr/include/sqlite3.h:1967:16
pragma Import (C, sqlite3_set_authorizer, "sqlite3_set_authorizer");
--** CAPI3REF: Authorizer Return Codes
--**
--** The [sqlite3_set_authorizer | authorizer callback function] must
--** return either [SQLITE_OK] or one of these two constants in order
--** to signal SQLite whether or not the action is permitted. See the
--** [sqlite3_set_authorizer | authorizer documentation] for additional
--** information.
--
--** CAPI3REF: Authorizer Action Codes
--**
--** The [sqlite3_set_authorizer()] interface registers a callback function
--** that is invoked to authorize certain SQL statement actions. The
--** second parameter to the callback is an integer code that specifies
--** what action is being authorized. These are the integer action codes that
--** the authorizer callback may be passed.
--**
--** These action code values signify what kind of operation is to be
--** authorized. The 3rd and 4th parameters to the authorization
--** callback function will be parameters or NULL depending on which of these
--** codes is used as the second parameter. ^(The 5th parameter to the
--** authorizer callback is the name of the database ("main", "temp",
--** etc.) if applicable.)^ ^The 6th parameter to the authorizer callback
--** is the name of the inner-most trigger or view that is responsible for
--** the access attempt or NULL if this access attempt is directly from
--** top-level SQL code.
--
--****************************************** 3rd ************ 4th **********
--** CAPI3REF: Tracing And Profiling Functions
--** EXPERIMENTAL
--**
--** These routines register callback functions that can be used for
--** tracing and profiling the execution of SQL statements.
--**
--** ^The callback function registered by sqlite3_trace() is invoked at
--** various times when an SQL statement is being run by [sqlite3_step()].
--** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the
--** SQL statement text as the statement first begins executing.
--** ^(Additional sqlite3_trace() callbacks might occur
--** as each triggered subprogram is entered. The callbacks for triggers
--** contain a UTF-8 SQL comment that identifies the trigger.)^
--**
--** ^The callback function registered by sqlite3_profile() is invoked
--** as each SQL statement finishes. ^The profile callback contains
--** the original statement text and an estimate of wall-clock time
--** of how long that statement took to run.
--
function sqlite3_trace
(arg1 : System.Address;
arg2 : access procedure (arg1 : System.Address; arg2 : Interfaces.C.Strings.chars_ptr);
arg3 : System.Address) return System.Address; -- /usr/include/sqlite3.h:2059:38
pragma Import (C, sqlite3_trace, "sqlite3_trace");
function sqlite3_profile
(arg1 : System.Address;
arg2 : access procedure
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : sqlite3_uint64);
arg3 : System.Address) return System.Address; -- /usr/include/sqlite3.h:2060:38
pragma Import (C, sqlite3_profile, "sqlite3_profile");
--** CAPI3REF: Query Progress Callbacks
--**
--** ^This routine configures a callback function - the
--** progress callback - that is invoked periodically during long
--** running calls to [sqlite3_exec()], [sqlite3_step()] and
--** [sqlite3_get_table()]. An example use for this
--** interface is to keep a GUI updated during a large query.
--**
--** ^If the progress callback returns non-zero, the operation is
--** interrupted. This feature can be used to implement a
--** "Cancel" button on a GUI progress dialog box.
--**
--** The progress handler must not do anything that will modify
--** the database connection that invoked the progress handler.
--** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
--** database connections for the meaning of "modify" in this paragraph.
--**
--
procedure sqlite3_progress_handler
(arg1 : System.Address;
arg2 : int;
arg3 : access function (arg1 : System.Address) return int;
arg4 : System.Address); -- /usr/include/sqlite3.h:2082:17
pragma Import (C, sqlite3_progress_handler, "sqlite3_progress_handler");
--** CAPI3REF: Opening A New Database Connection
--**
--** ^These routines open an SQLite database file whose name is given by the
--** filename argument. ^The filename argument is interpreted as UTF-8 for
--** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte
--** order for sqlite3_open16(). ^(A [database connection] handle is usually
--** returned in *ppDb, even if an error occurs. The only exception is that
--** if SQLite is unable to allocate memory to hold the [sqlite3] object,
--** a NULL will be written into *ppDb instead of a pointer to the [sqlite3]
--** object.)^ ^(If the database is opened (and/or created) successfully, then
--** [SQLITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The
--** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain
--** an English language description of the error following a failure of any
--** of the sqlite3_open() routines.
--**
--** ^The default encoding for the database will be UTF-8 if
--** sqlite3_open() or sqlite3_open_v2() is called and
--** UTF-16 in the native byte order if sqlite3_open16() is used.
--**
--** Whether or not an error occurs when it is opened, resources
--** associated with the [database connection] handle should be released by
--** passing it to [sqlite3_close()] when it is no longer required.
--**
--** The sqlite3_open_v2() interface works like sqlite3_open()
--** except that it accepts two additional parameters for additional control
--** over the new database connection. ^(The flags parameter to
--** sqlite3_open_v2() can take one of
--** the following three values, optionally combined with the
--** [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], [SQLITE_OPEN_SHAREDCACHE],
--** and/or [SQLITE_OPEN_PRIVATECACHE] flags:)^
--**
--** <dl>
--** ^(<dt>[SQLITE_OPEN_READONLY]</dt>
--** <dd>The database is opened in read-only mode. If the database does not
--** already exist, an error is returned.</dd>)^
--**
--** ^(<dt>[SQLITE_OPEN_READWRITE]</dt>
--** <dd>The database is opened for reading and writing if possible, or reading
--** only if the file is write protected by the operating system. In either
--** case the database must already exist, otherwise an error is returned.</dd>)^
--**
--** ^(<dt>[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]</dt>
--** <dd>The database is opened for reading and writing, and is creates it if
--** it does not already exist. This is the behavior that is always used for
--** sqlite3_open() and sqlite3_open16().</dd>)^
--** </dl>
--**
--** If the 3rd parameter to sqlite3_open_v2() is not one of the
--** combinations shown above or one of the combinations shown above combined
--** with the [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX],
--** [SQLITE_OPEN_SHAREDCACHE] and/or [SQLITE_OPEN_SHAREDCACHE] flags,
--** then the behavior is undefined.
--**
--** ^If the [SQLITE_OPEN_NOMUTEX] flag is set, then the database connection
--** opens in the multi-thread [threading mode] as long as the single-thread
--** mode has not been set at compile-time or start-time. ^If the
--** [SQLITE_OPEN_FULLMUTEX] flag is set then the database connection opens
--** in the serialized [threading mode] unless single-thread was
--** previously selected at compile-time or start-time.
--** ^The [SQLITE_OPEN_SHAREDCACHE] flag causes the database connection to be
--** eligible to use [shared cache mode], regardless of whether or not shared
--** cache is enabled using [sqlite3_enable_shared_cache()]. ^The
--** [SQLITE_OPEN_PRIVATECACHE] flag causes the database connection to not
--** participate in [shared cache mode] even if it is enabled.
--**
--** ^If the filename is ":memory:", then a private, temporary in-memory database
--** is created for the connection. ^This in-memory database will vanish when
--** the database connection is closed. Future versions of SQLite might
--** make use of additional special filenames that begin with the ":" character.
--** It is recommended that when a database filename actually does begin with
--** a ":" character you should prefix the filename with a pathname such as
--** "./" to avoid ambiguity.
--**
--** ^If the filename is an empty string, then a private, temporary
--** on-disk database will be created. ^This private database will be
--** automatically deleted as soon as the database connection is closed.
--**
--** ^The fourth parameter to sqlite3_open_v2() is the name of the
--** [sqlite3_vfs] object that defines the operating system interface that
--** the new database connection should use. ^If the fourth parameter is
--** a NULL pointer then the default [sqlite3_vfs] object is used.
--**
--** <b>Note to Windows users:</b> The encoding used for the filename argument
--** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever
--** codepage is currently defined. Filenames containing international
--** characters must be converted to UTF-8 prior to passing them into
--** sqlite3_open() or sqlite3_open_v2().
--
function sqlite3_open (arg1 : Interfaces.C.Strings.chars_ptr; arg2 : access System.Address) return int; -- /usr/include/sqlite3.h:2173:16
pragma Import (C, sqlite3_open, "sqlite3_open");
-- Database filename (UTF-8)
-- OUT: SQLite db handle
function sqlite3_open16 (arg1 : System.Address; arg2 : System.Address) return int; -- /usr/include/sqlite3.h:2177:16
pragma Import (C, sqlite3_open16, "sqlite3_open16");
-- Database filename (UTF-16)
-- OUT: SQLite db handle
function sqlite3_open_v2
(arg1 : Interfaces.C.Strings.chars_ptr;
arg2 : access System.Address;
arg3 : int;
arg4 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/sqlite3.h:2181:16
pragma Import (C, sqlite3_open_v2, "sqlite3_open_v2");
-- Database filename (UTF-8)
-- OUT: SQLite db handle
-- Flags
-- Name of VFS module to use
--** CAPI3REF: Error Codes And Messages
--**
--** ^The sqlite3_errcode() interface returns the numeric [result code] or
--** [extended result code] for the most recent failed sqlite3_* API call
--** associated with a [database connection]. If a prior API call failed
--** but the most recent API call succeeded, the return value from
--** sqlite3_errcode() is undefined. ^The sqlite3_extended_errcode()
--** interface is the same except that it always returns the
--** [extended result code] even when extended result codes are
--** disabled.
--**
--** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
--** text that describes the error, as either UTF-8 or UTF-16 respectively.
--** ^(Memory to hold the error message string is managed internally.
--** The application does not need to worry about freeing the result.
--** However, the error string might be overwritten or deallocated by
--** subsequent calls to other SQLite interface functions.)^
--**
--** When the serialized [threading mode] is in use, it might be the
--** case that a second error occurs on a separate thread in between
--** the time of the first error and the call to these interfaces.
--** When that happens, the second error will be reported since these
--** interfaces always report the most recent result. To avoid
--** this, each thread can obtain exclusive use of the [database connection] D
--** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning
--** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after
--** all calls to the interfaces listed here are completed.
--**
--** If an interface fails with SQLITE_MISUSE, that means the interface
--** was invoked incorrectly by the application. In that case, the
--** error code and message may or may not be set.
--
function sqlite3_errcode (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:2221:16
pragma Import (C, sqlite3_errcode, "sqlite3_errcode");
function sqlite3_extended_errcode (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:2222:16
pragma Import (C, sqlite3_extended_errcode, "sqlite3_extended_errcode");
function sqlite3_errmsg (arg1 : System.Address) return Interfaces.C.Strings.chars_ptr; -- /usr/include/sqlite3.h:2223:24
pragma Import (C, sqlite3_errmsg, "sqlite3_errmsg");
function sqlite3_errmsg16 (arg1 : System.Address) return System.Address; -- /usr/include/sqlite3.h:2224:24
pragma Import (C, sqlite3_errmsg16, "sqlite3_errmsg16");
--** CAPI3REF: SQL Statement Object
--** KEYWORDS: {prepared statement} {prepared statements}
--**
--** An instance of this object represents a single SQL statement.
--** This object is variously known as a "prepared statement" or a
--** "compiled SQL statement" or simply as a "statement".
--**
--** The life of a statement object goes something like this:
--**
--** <ol>
--** <li> Create the object using [sqlite3_prepare_v2()] or a related
--** function.
--** <li> Bind values to [host parameters] using the sqlite3_bind_*()
--** interfaces.
--** <li> Run the SQL by calling [sqlite3_step()] one or more times.
--** <li> Reset the statement using [sqlite3_reset()] then go back
--** to step 2. Do this zero or more times.
--** <li> Destroy the object using [sqlite3_finalize()].
--** </ol>
--**
--** Refer to documentation on individual methods above for additional
--** information.
--
-- skipped empty struct sqlite3_stmt
--** CAPI3REF: Run-time Limits
--**
--** ^(This interface allows the size of various constructs to be limited
--** on a connection by connection basis. The first parameter is the
--** [database connection] whose limit is to be set or queried. The
--** second parameter is one of the [limit categories] that define a
--** class of constructs to be size limited. The third parameter is the
--** new limit for that construct. The function returns the old limit.)^
--**
--** ^If the new limit is a negative number, the limit is unchanged.
--** ^(For the limit category of SQLITE_LIMIT_XYZ there is a
--** [limits | hard upper bound]
--** set by a compile-time C preprocessor macro named
--** [limits | SQLITE_MAX_XYZ].
--** (The "_LIMIT_" in the name is changed to "_MAX_".))^
--** ^Attempts to increase a limit above its hard upper bound are
--** silently truncated to the hard upper bound.
--**
--** Run-time limits are intended for use in applications that manage
--** both their own internal database and also databases that are controlled
--** by untrusted external sources. An example application might be a
--** web browser that has its own databases for storing history and
--** separate databases controlled by JavaScript applications downloaded
--** off the Internet. The internal databases can be given the
--** large, default limits. Databases managed by external sources can
--** be given much smaller limits designed to prevent a denial of service
--** attack. Developers might also want to use the [sqlite3_set_authorizer()]
--** interface to further control untrusted SQL. The size of the database
--** created by an untrusted script can be contained using the
--** [max_page_count] [PRAGMA].
--**
--** New run-time limit categories may be added in future releases.
--
function sqlite3_limit
(arg1 : System.Address;
arg2 : int;
arg3 : int) return int; -- /usr/include/sqlite3.h:2286:16
pragma Import (C, sqlite3_limit, "sqlite3_limit");
--** CAPI3REF: Run-Time Limit Categories
--** KEYWORDS: {limit category} {*limit categories}
--**
--** These constants define various performance limits
--** that can be lowered at run-time using [sqlite3_limit()].
--** The synopsis of the meanings of the various limits is shown below.
--** Additional information is available at [limits | Limits in SQLite].
--**
--** <dl>
--** ^(<dt>SQLITE_LIMIT_LENGTH</dt>
--** <dd>The maximum size of any string or BLOB or table row.<dd>)^
--**
--** ^(<dt>SQLITE_LIMIT_SQL_LENGTH</dt>
--** <dd>The maximum length of an SQL statement, in bytes.</dd>)^
--**
--** ^(<dt>SQLITE_LIMIT_COLUMN</dt>
--** <dd>The maximum number of columns in a table definition or in the
--** result set of a [SELECT] or the maximum number of columns in an index
--** or in an ORDER BY or GROUP BY clause.</dd>)^
--**
--** ^(<dt>SQLITE_LIMIT_EXPR_DEPTH</dt>
--** <dd>The maximum depth of the parse tree on any expression.</dd>)^
--**
--** ^(<dt>SQLITE_LIMIT_COMPOUND_SELECT</dt>
--** <dd>The maximum number of terms in a compound SELECT statement.</dd>)^
--**
--** ^(<dt>SQLITE_LIMIT_VDBE_OP</dt>
--** <dd>The maximum number of instructions in a virtual machine program
--** used to implement an SQL statement.</dd>)^
--**
--** ^(<dt>SQLITE_LIMIT_FUNCTION_ARG</dt>
--** <dd>The maximum number of arguments on a function.</dd>)^
--**
--** ^(<dt>SQLITE_LIMIT_ATTACHED</dt>
--** <dd>The maximum number of [ATTACH | attached databases].)^</dd>
--**
--** ^(<dt>SQLITE_LIMIT_LIKE_PATTERN_LENGTH</dt>
--** <dd>The maximum length of the pattern argument to the [LIKE] or
--** [GLOB] operators.</dd>)^
--**
--** ^(<dt>SQLITE_LIMIT_VARIABLE_NUMBER</dt>
--** <dd>The maximum number of variables in an SQL statement that can
--** be bound.</dd>)^
--**
--** ^(<dt>SQLITE_LIMIT_TRIGGER_DEPTH</dt>
--** <dd>The maximum depth of recursion for triggers.</dd>)^
--** </dl>
--
--** CAPI3REF: Compiling An SQL Statement
--** KEYWORDS: {SQL statement compiler}
--**
--** To execute an SQL query, it must first be compiled into a byte-code
--** program using one of these routines.
--**
--** The first argument, "db", is a [database connection] obtained from a
--** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or
--** [sqlite3_open16()]. The database connection must not have been closed.
--**
--** The second argument, "zSql", is the statement to be compiled, encoded
--** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2()
--** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2()
--** use UTF-16.
--**
--** ^If the nByte argument is less than zero, then zSql is read up to the
--** first zero terminator. ^If nByte is non-negative, then it is the maximum
--** number of bytes read from zSql. ^When nByte is non-negative, the
--** zSql string ends at either the first '\000' or '\u0000' character or
--** the nByte-th byte, whichever comes first. If the caller knows
--** that the supplied string is nul-terminated, then there is a small
--** performance advantage to be gained by passing an nByte parameter that
--** is equal to the number of bytes in the input string <i>including</i>
--** the nul-terminator bytes.
--**
--** ^If pzTail is not NULL then *pzTail is made to point to the first byte
--** past the end of the first SQL statement in zSql. These routines only
--** compile the first statement in zSql, so *pzTail is left pointing to
--** what remains uncompiled.
--**
--** ^*ppStmt is left pointing to a compiled [prepared statement] that can be
--** executed using [sqlite3_step()]. ^If there is an error, *ppStmt is set
--** to NULL. ^If the input text contains no SQL (if the input is an empty
--** string or a comment) then *ppStmt is set to NULL.
--** The calling procedure is responsible for deleting the compiled
--** SQL statement using [sqlite3_finalize()] after it has finished with it.
--** ppStmt may not be NULL.
--**
--** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK];
--** otherwise an [error code] is returned.
--**
--** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are
--** recommended for all new programs. The two older interfaces are retained
--** for backwards compatibility, but their use is discouraged.
--** ^In the "v2" interfaces, the prepared statement
--** that is returned (the [sqlite3_stmt] object) contains a copy of the
--** original SQL text. This causes the [sqlite3_step()] interface to
--** behave differently in three ways:
--**
--** <ol>
--** <li>
--** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it
--** always used to do, [sqlite3_step()] will automatically recompile the SQL
--** statement and try to run it again. ^If the schema has changed in
--** a way that makes the statement no longer valid, [sqlite3_step()] will still
--** return [SQLITE_SCHEMA]. But unlike the legacy behavior, [SQLITE_SCHEMA] is
--** now a fatal error. Calling [sqlite3_prepare_v2()] again will not make the
--** error go away. Note: use [sqlite3_errmsg()] to find the text
--** of the parsing error that results in an [SQLITE_SCHEMA] return.
--** </li>
--**
--** <li>
--** ^When an error occurs, [sqlite3_step()] will return one of the detailed
--** [error codes] or [extended error codes]. ^The legacy behavior was that
--** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code
--** and the application would have to make a second call to [sqlite3_reset()]
--** in order to find the underlying cause of the problem. With the "v2" prepare
--** interfaces, the underlying reason for the error is returned immediately.
--** </li>
--**
--** <li>
--** ^If the value of a [parameter | host parameter] in the WHERE clause might
--** change the query plan for a statement, then the statement may be
--** automatically recompiled (as if there had been a schema change) on the first
--** [sqlite3_step()] call following any change to the
--** [sqlite3_bind_text | bindings] of the [parameter].
--** </li>
--** </ol>
--
function sqlite3_prepare
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : int;
arg4 : System.Address;
arg5 : System.Address) return int; -- /usr/include/sqlite3.h:2429:16
pragma Import (C, sqlite3_prepare, "sqlite3_prepare");
-- Database handle
-- SQL statement, UTF-8 encoded
-- Maximum length of zSql in bytes.
-- OUT: Statement handle
-- OUT: Pointer to unused portion of zSql
function sqlite3_prepare_v2
(db : System.Address;
zSql : Interfaces.C.Strings.chars_ptr;
nByte : int;
ppStmt : System.Address;
pzTail : System.Address) return int; -- /usr/include/sqlite3.h:2436:16
pragma Import (C, sqlite3_prepare_v2, "sqlite3_prepare_v2");
-- Database handle
-- SQL statement, UTF-8 encoded
-- Maximum length of zSql in bytes.
-- OUT: Statement handle
-- OUT: Pointer to unused portion of zSql
function sqlite3_prepare16
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int;
arg4 : System.Address;
arg5 : System.Address) return int; -- /usr/include/sqlite3.h:2443:16
pragma Import (C, sqlite3_prepare16, "sqlite3_prepare16");
-- Database handle
-- SQL statement, UTF-16 encoded
-- Maximum length of zSql in bytes.
-- OUT: Statement handle
-- OUT: Pointer to unused portion of zSql
function sqlite3_prepare16_v2
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int;
arg4 : System.Address;
arg5 : System.Address) return int; -- /usr/include/sqlite3.h:2450:16
pragma Import (C, sqlite3_prepare16_v2, "sqlite3_prepare16_v2");
-- Database handle
-- SQL statement, UTF-16 encoded
-- Maximum length of zSql in bytes.
-- OUT: Statement handle
-- OUT: Pointer to unused portion of zSql
--** CAPI3REF: Retrieving Statement SQL
--**
--** ^This interface can be used to retrieve a saved copy of the original
--** SQL text used to create a [prepared statement] if that statement was
--** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()].
--
function sqlite3_sql (arg1 : System.Address) return Interfaces.C.Strings.chars_ptr; -- /usr/include/sqlite3.h:2465:24
pragma Import (C, sqlite3_sql, "sqlite3_sql");
--** CAPI3REF: Dynamically Typed Value Object
--** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
--**
--** SQLite uses the sqlite3_value object to represent all values
--** that can be stored in a database table. SQLite uses dynamic typing
--** for the values it stores. ^Values stored in sqlite3_value objects
--** can be integers, floating point values, strings, BLOBs, or NULL.
--**
--** An sqlite3_value object may be either "protected" or "unprotected".
--** Some interfaces require a protected sqlite3_value. Other interfaces
--** will accept either a protected or an unprotected sqlite3_value.
--** Every interface that accepts sqlite3_value arguments specifies
--** whether or not it requires a protected sqlite3_value.
--**
--** The terms "protected" and "unprotected" refer to whether or not
--** a mutex is held. A internal mutex is held for a protected
--** sqlite3_value object but no mutex is held for an unprotected
--** sqlite3_value object. If SQLite is compiled to be single-threaded
--** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
--** or if SQLite is run in one of reduced mutex modes
--** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
--** then there is no distinction between protected and unprotected
--** sqlite3_value objects and they can be used interchangeably. However,
--** for maximum code portability it is recommended that applications
--** still make the distinction between between protected and unprotected
--** sqlite3_value objects even when not strictly required.
--**
--** ^The sqlite3_value objects that are passed as parameters into the
--** implementation of [application-defined SQL functions] are protected.
--** ^The sqlite3_value object returned by
--** [sqlite3_column_value()] is unprotected.
--** Unprotected sqlite3_value objects may only be used with
--** [sqlite3_result_value()] and [sqlite3_bind_value()].
--** The [sqlite3_value_blob | sqlite3_value_type()] family of
--** interfaces require protected sqlite3_value objects.
--
-- skipped empty struct Mem
-- skipped empty struct sqlite3_value
--** CAPI3REF: SQL Function Context Object
--**
--** The context in which an SQL function executes is stored in an
--** sqlite3_context object. ^A pointer to an sqlite3_context object
--** is always first parameter to [application-defined SQL functions].
--** The application-defined SQL function implementation will pass this
--** pointer through into calls to [sqlite3_result_int | sqlite3_result()],
--** [sqlite3_aggregate_context()], [sqlite3_user_data()],
--** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()],
--** and/or [sqlite3_set_auxdata()].
--
-- skipped empty struct sqlite3_context
--** CAPI3REF: Binding Values To Prepared Statements
--** KEYWORDS: {host parameter} {host parameters} {host parameter name}
--** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding}
--**
--** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
--** literals may be replaced by a [parameter] that matches one of following
--** templates:
--**
--** <ul>
--** <li> ?
--** <li> ?NNN
--** <li> :VVV
--** <li> @VVV
--** <li> $VVV
--** </ul>
--**
--** In the templates above, NNN represents an integer literal,
--** and VVV represents an alphanumeric identifer.)^ ^The values of these
--** parameters (also called "host parameter names" or "SQL parameters")
--** can be set using the sqlite3_bind_*() routines defined here.
--**
--** ^The first argument to the sqlite3_bind_*() routines is always
--** a pointer to the [sqlite3_stmt] object returned from
--** [sqlite3_prepare_v2()] or its variants.
--**
--** ^The second argument is the index of the SQL parameter to be set.
--** ^The leftmost SQL parameter has an index of 1. ^When the same named
--** SQL parameter is used more than once, second and subsequent
--** occurrences have the same index as the first occurrence.
--** ^The index for named parameters can be looked up using the
--** [sqlite3_bind_parameter_index()] API if desired. ^The index
--** for "?NNN" parameters is the value of NNN.
--** ^The NNN value must be between 1 and the [sqlite3_limit()]
--** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 999).
--**
--** ^The third argument is the value to bind to the parameter.
--**
--** ^(In those routines that have a fourth argument, its value is the
--** number of bytes in the parameter. To be clear: the value is the
--** number of <u>bytes</u> in the value, not the number of characters.)^
--** ^If the fourth parameter is negative, the length of the string is
--** the number of bytes up to the first zero terminator.
--**
--** ^The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and
--** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or
--** string after SQLite has finished with it. ^If the fifth argument is
--** the special value [SQLITE_STATIC], then SQLite assumes that the
--** information is in static, unmanaged space and does not need to be freed.
--** ^If the fifth argument has the value [SQLITE_TRANSIENT], then
--** SQLite makes its own private copy of the data immediately, before
--** the sqlite3_bind_*() routine returns.
--**
--** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that
--** is filled with zeroes. ^A zeroblob uses a fixed amount of memory
--** (just an integer to hold its size) while it is being processed.
--** Zeroblobs are intended to serve as placeholders for BLOBs whose
--** content is later written using
--** [sqlite3_blob_open | incremental BLOB I/O] routines.
--** ^A negative value for the zeroblob results in a zero-length BLOB.
--**
--** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer
--** for the [prepared statement] or with a prepared statement for which
--** [sqlite3_step()] has been called more recently than [sqlite3_reset()],
--** then the call will return [SQLITE_MISUSE]. If any sqlite3_bind_()
--** routine is passed a [prepared statement] that has been finalized, the
--** result is undefined and probably harmful.
--**
--** ^Bindings are not cleared by the [sqlite3_reset()] routine.
--** ^Unbound parameters are interpreted as NULL.
--**
--** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an
--** [error code] if anything goes wrong.
--** ^[SQLITE_RANGE] is returned if the parameter
--** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails.
--**
--** See also: [sqlite3_bind_parameter_count()],
--** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
--
function sqlite3_bind_blob
(arg1 : System.Address;
arg2 : int;
arg3 : System.Address;
arg4 : int;
arg5 : access procedure (arg1 : System.Address)) return int; -- /usr/include/sqlite3.h:2599:16
pragma Import (C, sqlite3_bind_blob, "sqlite3_bind_blob");
function sqlite3_bind_double
(arg1 : System.Address;
arg2 : int;
arg3 : double) return int; -- /usr/include/sqlite3.h:2600:16
pragma Import (C, sqlite3_bind_double, "sqlite3_bind_double");
function sqlite3_bind_int
(arg1 : System.Address;
arg2 : int;
arg3 : int) return int; -- /usr/include/sqlite3.h:2601:16
pragma Import (C, sqlite3_bind_int, "sqlite3_bind_int");
function sqlite3_bind_int64
(arg1 : System.Address;
arg2 : int;
arg3 : sqlite3_int64) return int; -- /usr/include/sqlite3.h:2602:16
pragma Import (C, sqlite3_bind_int64, "sqlite3_bind_int64");
function sqlite3_bind_null (arg1 : System.Address; arg2 : int) return int; -- /usr/include/sqlite3.h:2603:16
pragma Import (C, sqlite3_bind_null, "sqlite3_bind_null");
function sqlite3_bind_text
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : int;
arg5 : access procedure (arg1 : System.Address)) return int; -- /usr/include/sqlite3.h:2604:16
pragma Import (C, sqlite3_bind_text, "sqlite3_bind_text");
function sqlite3_bind_text16
(arg1 : System.Address;
arg2 : int;
arg3 : System.Address;
arg4 : int;
arg5 : access procedure (arg1 : System.Address)) return int; -- /usr/include/sqlite3.h:2605:16
pragma Import (C, sqlite3_bind_text16, "sqlite3_bind_text16");
function sqlite3_bind_value
(arg1 : System.Address;
arg2 : int;
arg3 : System.Address) return int; -- /usr/include/sqlite3.h:2606:16
pragma Import (C, sqlite3_bind_value, "sqlite3_bind_value");
function sqlite3_bind_zeroblob
(arg1 : System.Address;
arg2 : int;
arg3 : int) return int; -- /usr/include/sqlite3.h:2607:16
pragma Import (C, sqlite3_bind_zeroblob, "sqlite3_bind_zeroblob");
--** CAPI3REF: Number Of SQL Parameters
--**
--** ^This routine can be used to find the number of [SQL parameters]
--** in a [prepared statement]. SQL parameters are tokens of the
--** form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as
--** placeholders for values that are [sqlite3_bind_blob | bound]
--** to the parameters at a later time.
--**
--** ^(This routine actually returns the index of the largest (rightmost)
--** parameter. For all forms except ?NNN, this will correspond to the
--** number of unique parameters. If parameters of the ?NNN form are used,
--** there may be gaps in the list.)^
--**
--** See also: [sqlite3_bind_blob|sqlite3_bind()],
--** [sqlite3_bind_parameter_name()], and
--** [sqlite3_bind_parameter_index()].
--
function sqlite3_bind_parameter_count (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:2627:16
pragma Import (C, sqlite3_bind_parameter_count, "sqlite3_bind_parameter_count");
--** CAPI3REF: Name Of A Host Parameter
--**
--** ^The sqlite3_bind_parameter_name(P,N) interface returns
--** the name of the N-th [SQL parameter] in the [prepared statement] P.
--** ^(SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA"
--** have a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA"
--** respectively.
--** In other words, the initial ":" or "$" or "@" or "?"
--** is included as part of the name.)^
--** ^Parameters of the form "?" without a following integer have no name
--** and are referred to as "nameless" or "anonymous parameters".
--**
--** ^The first host parameter has an index of 1, not 0.
--**
--** ^If the value N is out of range or if the N-th parameter is
--** nameless, then NULL is returned. ^The returned string is
--** always in UTF-8 encoding even if the named parameter was
--** originally specified as UTF-16 in [sqlite3_prepare16()] or
--** [sqlite3_prepare16_v2()].
--**
--** See also: [sqlite3_bind_blob|sqlite3_bind()],
--** [sqlite3_bind_parameter_count()], and
--** [sqlite3_bind_parameter_index()].
--
function sqlite3_bind_parameter_name (arg1 : System.Address; arg2 : int) return Interfaces.C.Strings.chars_ptr; -- /usr/include/sqlite3.h:2654:24
pragma Import (C, sqlite3_bind_parameter_name, "sqlite3_bind_parameter_name");
--** CAPI3REF: Index Of A Parameter With A Given Name
--**
--** ^Return the index of an SQL parameter given its name. ^The
--** index value returned is suitable for use as the second
--** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero
--** is returned if no matching parameter is found. ^The parameter
--** name must be given in UTF-8 even if the original statement
--** was prepared from UTF-16 text using [sqlite3_prepare16_v2()].
--**
--** See also: [sqlite3_bind_blob|sqlite3_bind()],
--** [sqlite3_bind_parameter_count()], and
--** [sqlite3_bind_parameter_index()].
--
function sqlite3_bind_parameter_index (arg1 : System.Address; arg2 : Interfaces.C.Strings.chars_ptr) return int; -- /usr/include/sqlite3.h:2670:16
pragma Import (C, sqlite3_bind_parameter_index, "sqlite3_bind_parameter_index");
--** CAPI3REF: Reset All Bindings On A Prepared Statement
--**
--** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset
--** the [sqlite3_bind_blob | bindings] on a [prepared statement].
--** ^Use this routine to reset all host parameters to NULL.
--
function sqlite3_clear_bindings (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:2679:16
pragma Import (C, sqlite3_clear_bindings, "sqlite3_clear_bindings");
--** CAPI3REF: Number Of Columns In A Result Set
--**
--** ^Return the number of columns in the result set returned by the
--** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
--** statement that does not return data (for example an [UPDATE]).
--
function sqlite3_column_count (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:2688:16
pragma Import (C, sqlite3_column_count, "sqlite3_column_count");
--** CAPI3REF: Column Names In A Result Set
--**
--** ^These routines return the name assigned to a particular column
--** in the result set of a [SELECT] statement. ^The sqlite3_column_name()
--** interface returns a pointer to a zero-terminated UTF-8 string
--** and sqlite3_column_name16() returns a pointer to a zero-terminated
--** UTF-16 string. ^The first parameter is the [prepared statement]
--** that implements the [SELECT] statement. ^The second parameter is the
--** column number. ^The leftmost column is number 0.
--**
--** ^The returned string pointer is valid until either the [prepared statement]
--** is destroyed by [sqlite3_finalize()] or until the next call to
--** sqlite3_column_name() or sqlite3_column_name16() on the same column.
--**
--** ^If sqlite3_malloc() fails during the processing of either routine
--** (for example during a conversion from UTF-8 to UTF-16) then a
--** NULL pointer is returned.
--**
--** ^The name of a result column is the value of the "AS" clause for
--** that column, if there is an AS clause. If there is no AS clause
--** then the name of the column is unspecified and may change from
--** one release of SQLite to the next.
--
function sqlite3_column_name (arg1 : System.Address; arg2 : int) return Interfaces.C.Strings.chars_ptr; -- /usr/include/sqlite3.h:2714:24
pragma Import (C, sqlite3_column_name, "sqlite3_column_name");
function sqlite3_column_name16 (arg1 : System.Address; arg2 : int) return System.Address; -- /usr/include/sqlite3.h:2715:24
pragma Import (C, sqlite3_column_name16, "sqlite3_column_name16");
--** CAPI3REF: Source Of Data In A Query Result
--**
--** ^These routines provide a means to determine the database, table, and
--** table column that is the origin of a particular result column in
--** [SELECT] statement.
--** ^The name of the database or table or column can be returned as
--** either a UTF-8 or UTF-16 string. ^The _database_ routines return
--** the database name, the _table_ routines return the table name, and
--** the origin_ routines return the column name.
--** ^The returned string is valid until the [prepared statement] is destroyed
--** using [sqlite3_finalize()] or until the same information is requested
--** again in a different encoding.
--**
--** ^The names returned are the original un-aliased names of the
--** database, table, and column.
--**
--** ^The first argument to these interfaces is a [prepared statement].
--** ^These functions return information about the Nth result column returned by
--** the statement, where N is the second function argument.
--** ^The left-most column is column 0 for these routines.
--**
--** ^If the Nth column returned by the statement is an expression or
--** subquery and is not a column value, then all of these functions return
--** NULL. ^These routine might also return NULL if a memory allocation error
--** occurs. ^Otherwise, they return the name of the attached database, table,
--** or column that query result column was extracted from.
--**
--** ^As with all other SQLite APIs, those whose names end with "16" return
--** UTF-16 encoded strings and the other functions return UTF-8.
--**
--** ^These APIs are only available if the library was compiled with the
--** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol.
--**
--** If two or more threads call one or more of these routines against the same
--** prepared statement and column at the same time then the results are
--** undefined.
--**
--** If two or more threads call one or more
--** [sqlite3_column_database_name | column metadata interfaces]
--** for the same [prepared statement] and result column
--** at the same time then the results are undefined.
--
function sqlite3_column_database_name (arg1 : System.Address; arg2 : int) return Interfaces.C.Strings.chars_ptr; -- /usr/include/sqlite3.h:2760:24
pragma Import (C, sqlite3_column_database_name, "sqlite3_column_database_name");
function sqlite3_column_database_name16 (arg1 : System.Address; arg2 : int) return System.Address; -- /usr/include/sqlite3.h:2761:24
pragma Import (C, sqlite3_column_database_name16, "sqlite3_column_database_name16");
function sqlite3_column_table_name (arg1 : System.Address; arg2 : int) return Interfaces.C.Strings.chars_ptr; -- /usr/include/sqlite3.h:2762:24
pragma Import (C, sqlite3_column_table_name, "sqlite3_column_table_name");
function sqlite3_column_table_name16 (arg1 : System.Address; arg2 : int) return System.Address; -- /usr/include/sqlite3.h:2763:24
pragma Import (C, sqlite3_column_table_name16, "sqlite3_column_table_name16");
function sqlite3_column_origin_name (arg1 : System.Address; arg2 : int) return Interfaces.C.Strings.chars_ptr; -- /usr/include/sqlite3.h:2764:24
pragma Import (C, sqlite3_column_origin_name, "sqlite3_column_origin_name");
function sqlite3_column_origin_name16 (arg1 : System.Address; arg2 : int) return System.Address; -- /usr/include/sqlite3.h:2765:24
pragma Import (C, sqlite3_column_origin_name16, "sqlite3_column_origin_name16");
--** CAPI3REF: Declared Datatype Of A Query Result
--**
--** ^(The first parameter is a [prepared statement].
--** If this statement is a [SELECT] statement and the Nth column of the
--** returned result set of that [SELECT] is a table column (not an
--** expression or subquery) then the declared type of the table
--** column is returned.)^ ^If the Nth column of the result set is an
--** expression or subquery, then a NULL pointer is returned.
--** ^The returned string is always UTF-8 encoded.
--**
--** ^(For example, given the database schema:
--**
--** CREATE TABLE t1(c1 VARIANT);
--**
--** and the following statement to be compiled:
--**
--** SELECT c1 + 1, c1 FROM t1;
--**
--** this routine would return the string "VARIANT" for the second result
--** column (i==1), and a NULL pointer for the first result column (i==0).)^
--**
--** ^SQLite uses dynamic run-time typing. ^So just because a column
--** is declared to contain a particular type does not mean that the
--** data stored in that column is of the declared type. SQLite is
--** strongly typed, but the typing is dynamic not static. ^Type
--** is associated with individual values, not with the containers
--** used to hold those values.
--
function sqlite3_column_decltype (arg1 : System.Address; arg2 : int) return Interfaces.C.Strings.chars_ptr; -- /usr/include/sqlite3.h:2796:24
pragma Import (C, sqlite3_column_decltype, "sqlite3_column_decltype");
function sqlite3_column_decltype16 (arg1 : System.Address; arg2 : int) return System.Address; -- /usr/include/sqlite3.h:2797:24
pragma Import (C, sqlite3_column_decltype16, "sqlite3_column_decltype16");
--** CAPI3REF: Evaluate An SQL Statement
--**
--** After a [prepared statement] has been prepared using either
--** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy
--** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function
--** must be called one or more times to evaluate the statement.
--**
--** The details of the behavior of the sqlite3_step() interface depend
--** on whether the statement was prepared using the newer "v2" interface
--** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy
--** interface [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the
--** new "v2" interface is recommended for new applications but the legacy
--** interface will continue to be supported.
--**
--** ^In the legacy interface, the return value will be either [SQLITE_BUSY],
--** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE].
--** ^With the "v2" interface, any of the other [result codes] or
--** [extended result codes] might be returned as well.
--**
--** ^[SQLITE_BUSY] means that the database engine was unable to acquire the
--** database locks it needs to do its job. ^If the statement is a [COMMIT]
--** or occurs outside of an explicit transaction, then you can retry the
--** statement. If the statement is not a [COMMIT] and occurs within a
--** explicit transaction then you should rollback the transaction before
--** continuing.
--**
--** ^[SQLITE_DONE] means that the statement has finished executing
--** successfully. sqlite3_step() should not be called again on this virtual
--** machine without first calling [sqlite3_reset()] to reset the virtual
--** machine back to its initial state.
--**
--** ^If the SQL statement being executed returns any data, then [SQLITE_ROW]
--** is returned each time a new row of data is ready for processing by the
--** caller. The values may be accessed using the [column access functions].
--** sqlite3_step() is called again to retrieve the next row of data.
--**
--** ^[SQLITE_ERROR] means that a run-time error (such as a constraint
--** violation) has occurred. sqlite3_step() should not be called again on
--** the VM. More information may be found by calling [sqlite3_errmsg()].
--** ^With the legacy interface, a more specific error code (for example,
--** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth)
--** can be obtained by calling [sqlite3_reset()] on the
--** [prepared statement]. ^In the "v2" interface,
--** the more specific error code is returned directly by sqlite3_step().
--**
--** [SQLITE_MISUSE] means that the this routine was called inappropriately.
--** Perhaps it was called on a [prepared statement] that has
--** already been [sqlite3_finalize | finalized] or on one that had
--** previously returned [SQLITE_ERROR] or [SQLITE_DONE]. Or it could
--** be the case that the same database connection is being used by two or
--** more threads at the same moment in time.
--**
--** <b>Goofy Interface Alert:</b> In the legacy interface, the sqlite3_step()
--** API always returns a generic error code, [SQLITE_ERROR], following any
--** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call
--** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the
--** specific [error codes] that better describes the error.
--** We admit that this is a goofy design. The problem has been fixed
--** with the "v2" interface. If you prepare all of your SQL statements
--** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
--** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
--** then the more specific [error codes] are returned directly
--** by sqlite3_step(). The use of the "v2" interface is recommended.
--
function sqlite3_step (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:2864:16
pragma Import (C, sqlite3_step, "sqlite3_step");
--** CAPI3REF: Number of columns in a result set
--**
--** ^The sqlite3_data_count(P) the number of columns in the
--** of the result set of [prepared statement] P.
--
function sqlite3_data_count (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:2872:16
pragma Import (C, sqlite3_data_count, "sqlite3_data_count");
--** CAPI3REF: Fundamental Datatypes
--** KEYWORDS: SQLITE_TEXT
--**
--** ^(Every value in SQLite has one of five fundamental datatypes:
--**
--** <ul>
--** <li> 64-bit signed integer
--** <li> 64-bit IEEE floating point number
--** <li> string
--** <li> BLOB
--** <li> NULL
--** </ul>)^
--**
--** These constants are codes for each of those types.
--**
--** Note that the SQLITE_TEXT constant was also used in SQLite version 2
--** for a completely different meaning. Software that links against both
--** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT, not
--** SQLITE_TEXT.
--
--** CAPI3REF: Result Values From A Query
--** KEYWORDS: {column access functions}
--**
--** These routines form the "result set" interface.
--**
--** ^These routines return information about a single column of the current
--** result row of a query. ^In every case the first argument is a pointer
--** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
--** that was returned from [sqlite3_prepare_v2()] or one of its variants)
--** and the second argument is the index of the column for which information
--** should be returned. ^The leftmost column of the result set has the index 0.
--** ^The number of columns in the result can be determined using
--** [sqlite3_column_count()].
--**
--** If the SQL statement does not currently point to a valid row, or if the
--** column index is out of range, the result is undefined.
--** These routines may only be called when the most recent call to
--** [sqlite3_step()] has returned [SQLITE_ROW] and neither
--** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently.
--** If any of these routines are called after [sqlite3_reset()] or
--** [sqlite3_finalize()] or after [sqlite3_step()] has returned
--** something other than [SQLITE_ROW], the results are undefined.
--** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()]
--** are called from a different thread while any of these routines
--** are pending, then the results are undefined.
--**
--** ^The sqlite3_column_type() routine returns the
--** [SQLITE_INTEGER | datatype code] for the initial data type
--** of the result column. ^The returned value is one of [SQLITE_INTEGER],
--** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. The value
--** returned by sqlite3_column_type() is only meaningful if no type
--** conversions have occurred as described below. After a type conversion,
--** the value returned by sqlite3_column_type() is undefined. Future
--** versions of SQLite may change the behavior of sqlite3_column_type()
--** following a type conversion.
--**
--** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
--** routine returns the number of bytes in that BLOB or string.
--** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts
--** the string to UTF-8 and then returns the number of bytes.
--** ^If the result is a numeric value then sqlite3_column_bytes() uses
--** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns
--** the number of bytes in that string.
--** ^The value returned does not include the zero terminator at the end
--** of the string. ^For clarity: the value returned is the number of
--** bytes in the string, not the number of characters.
--**
--** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(),
--** even empty strings, are always zero terminated. ^The return
--** value from sqlite3_column_blob() for a zero-length BLOB is an arbitrary
--** pointer, possibly even a NULL pointer.
--**
--** ^The sqlite3_column_bytes16() routine is similar to sqlite3_column_bytes()
--** but leaves the result in UTF-16 in native byte order instead of UTF-8.
--** ^The zero terminator is not included in this count.
--**
--** ^The object returned by [sqlite3_column_value()] is an
--** [unprotected sqlite3_value] object. An unprotected sqlite3_value object
--** may only be used with [sqlite3_bind_value()] and [sqlite3_result_value()].
--** If the [unprotected sqlite3_value] object returned by
--** [sqlite3_column_value()] is used in any other way, including calls
--** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
--** or [sqlite3_value_bytes()], then the behavior is undefined.
--**
--** These routines attempt to convert the value where appropriate. ^For
--** example, if the internal representation is FLOAT and a text result
--** is requested, [sqlite3_snprintf()] is used internally to perform the
--** conversion automatically. ^(The following table details the conversions
--** that are applied:
--**
--** <blockquote>
--** <table border="1">
--** <tr><th> Internal<br>Type <th> Requested<br>Type <th> Conversion
--**
--** <tr><td> NULL <td> INTEGER <td> Result is 0
--** <tr><td> NULL <td> FLOAT <td> Result is 0.0
--** <tr><td> NULL <td> TEXT <td> Result is NULL pointer
--** <tr><td> NULL <td> BLOB <td> Result is NULL pointer
--** <tr><td> INTEGER <td> FLOAT <td> Convert from integer to float
--** <tr><td> INTEGER <td> TEXT <td> ASCII rendering of the integer
--** <tr><td> INTEGER <td> BLOB <td> Same as INTEGER->TEXT
--** <tr><td> FLOAT <td> INTEGER <td> Convert from float to integer
--** <tr><td> FLOAT <td> TEXT <td> ASCII rendering of the float
--** <tr><td> FLOAT <td> BLOB <td> Same as FLOAT->TEXT
--** <tr><td> TEXT <td> INTEGER <td> Use atoi()
--** <tr><td> TEXT <td> FLOAT <td> Use atof()
--** <tr><td> TEXT <td> BLOB <td> No change
--** <tr><td> BLOB <td> INTEGER <td> Convert to TEXT then use atoi()
--** <tr><td> BLOB <td> FLOAT <td> Convert to TEXT then use atof()
--** <tr><td> BLOB <td> TEXT <td> Add a zero terminator if needed
--** </table>
--** </blockquote>)^
--**
--** The table above makes reference to standard C library functions atoi()
--** and atof(). SQLite does not really use these functions. It has its
--** own equivalent internal routines. The atoi() and atof() names are
--** used in the table for brevity and because they are familiar to most
--** C programmers.
--**
--** ^Note that when type conversions occur, pointers returned by prior
--** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or
--** sqlite3_column_text16() may be invalidated.
--** ^(Type conversions and pointer invalidations might occur
--** in the following cases:
--**
--** <ul>
--** <li> The initial content is a BLOB and sqlite3_column_text() or
--** sqlite3_column_text16() is called. A zero-terminator might
--** need to be added to the string.</li>
--** <li> The initial content is UTF-8 text and sqlite3_column_bytes16() or
--** sqlite3_column_text16() is called. The content must be converted
--** to UTF-16.</li>
--** <li> The initial content is UTF-16 text and sqlite3_column_bytes() or
--** sqlite3_column_text() is called. The content must be converted
--** to UTF-8.</li>
--** </ul>)^
--**
--** ^Conversions between UTF-16be and UTF-16le are always done in place and do
--** not invalidate a prior pointer, though of course the content of the buffer
--** that the prior pointer points to will have been modified. Other kinds
--** of conversion are done in place when it is possible, but sometimes they
--** are not possible and in those cases prior pointers are invalidated.
--**
--** ^(The safest and easiest to remember policy is to invoke these routines
--** in one of the following ways:
--**
--** <ul>
--** <li>sqlite3_column_text() followed by sqlite3_column_bytes()</li>
--** <li>sqlite3_column_blob() followed by sqlite3_column_bytes()</li>
--** <li>sqlite3_column_text16() followed by sqlite3_column_bytes16()</li>
--** </ul>)^
--**
--** In other words, you should call sqlite3_column_text(),
--** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result
--** into the desired format, then invoke sqlite3_column_bytes() or
--** sqlite3_column_bytes16() to find the size of the result. Do not mix calls
--** to sqlite3_column_text() or sqlite3_column_blob() with calls to
--** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16()
--** with calls to sqlite3_column_bytes().
--**
--** ^The pointers returned are valid until a type conversion occurs as
--** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
--** [sqlite3_finalize()] is called. ^The memory space used to hold strings
--** and BLOBs is freed automatically. Do <b>not</b> pass the pointers returned
--** [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
--** [sqlite3_free()].
--**
--** ^(If a memory allocation error occurs during the evaluation of any
--** of these routines, a default value is returned. The default value
--** is either the integer 0, the floating point number 0.0, or a NULL
--** pointer. Subsequent calls to [sqlite3_errcode()] will return
--** [SQLITE_NOMEM].)^
--
function sqlite3_column_blob (arg1 : System.Address; arg2 : int) return System.Address; -- /usr/include/sqlite3.h:3060:24
pragma Import (C, sqlite3_column_blob, "sqlite3_column_blob");
function sqlite3_column_bytes (arg1 : System.Address; arg2 : int) return int; -- /usr/include/sqlite3.h:3061:16
pragma Import (C, sqlite3_column_bytes, "sqlite3_column_bytes");
function sqlite3_column_bytes16 (arg1 : System.Address; arg2 : int) return int; -- /usr/include/sqlite3.h:3062:16
pragma Import (C, sqlite3_column_bytes16, "sqlite3_column_bytes16");
function sqlite3_column_double (arg1 : System.Address; arg2 : int) return double; -- /usr/include/sqlite3.h:3063:19
pragma Import (C, sqlite3_column_double, "sqlite3_column_double");
function sqlite3_column_int (arg1 : System.Address; arg2 : int) return int; -- /usr/include/sqlite3.h:3064:16
pragma Import (C, sqlite3_column_int, "sqlite3_column_int");
function sqlite3_column_int64 (arg1 : System.Address; arg2 : int) return sqlite3_int64; -- /usr/include/sqlite3.h:3065:26
pragma Import (C, sqlite3_column_int64, "sqlite3_column_int64");
function sqlite3_column_text (arg1 : System.Address; arg2 : int) return Interfaces.C.Strings.chars_ptr; -- /usr/include/sqlite3.h:3066:33
pragma Import (C, sqlite3_column_text, "sqlite3_column_text");
function sqlite3_column_text16 (arg1 : System.Address; arg2 : int) return Interfaces.C.Strings.chars_ptr; -- /usr/include/sqlite3.h:3067:24
pragma Import (C, sqlite3_column_text16, "sqlite3_column_text16");
function sqlite3_column_type (arg1 : System.Address; arg2 : int) return int; -- /usr/include/sqlite3.h:3068:16
pragma Import (C, sqlite3_column_type, "sqlite3_column_type");
function sqlite3_column_value (arg1 : System.Address; arg2 : int) return System.Address; -- /usr/include/sqlite3.h:3069:27
pragma Import (C, sqlite3_column_value, "sqlite3_column_value");
--** CAPI3REF: Destroy A Prepared Statement Object
--**
--** ^The sqlite3_finalize() function is called to delete a [prepared statement].
--** ^If the statement was executed successfully or not executed at all, then
--** SQLITE_OK is returned. ^If execution of the statement failed then an
--** [error code] or [extended error code] is returned.
--**
--** ^This routine can be called at any point during the execution of the
--** [prepared statement]. ^If the virtual machine has not
--** completed execution when this routine is called, that is like
--** encountering an error or an [sqlite3_interrupt | interrupt].
--** ^Incomplete updates may be rolled back and transactions canceled,
--** depending on the circumstances, and the
--** [error code] returned will be [SQLITE_ABORT].
--
function sqlite3_finalize (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:3087:16
pragma Import (C, sqlite3_finalize, "sqlite3_finalize");
--** CAPI3REF: Reset A Prepared Statement Object
--**
--** The sqlite3_reset() function is called to reset a [prepared statement]
--** object back to its initial state, ready to be re-executed.
--** ^Any SQL statement variables that had values bound to them using
--** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values.
--** Use [sqlite3_clear_bindings()] to reset the bindings.
--**
--** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S
--** back to the beginning of its program.
--**
--** ^If the most recent call to [sqlite3_step(S)] for the
--** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE],
--** or if [sqlite3_step(S)] has never before been called on S,
--** then [sqlite3_reset(S)] returns [SQLITE_OK].
--**
--** ^If the most recent call to [sqlite3_step(S)] for the
--** [prepared statement] S indicated an error, then
--** [sqlite3_reset(S)] returns an appropriate [error code].
--**
--** ^The [sqlite3_reset(S)] interface does not change the values
--** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
--
function sqlite3_reset (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:3113:16
pragma Import (C, sqlite3_reset, "sqlite3_reset");
--** CAPI3REF: Create Or Redefine SQL Functions
--** KEYWORDS: {function creation routines}
--** KEYWORDS: {application-defined SQL function}
--** KEYWORDS: {application-defined SQL functions}
--**
--** ^These two functions (collectively known as "function creation routines")
--** are used to add SQL functions or aggregates or to redefine the behavior
--** of existing SQL functions or aggregates. The only difference between the
--** two is that the second parameter, the name of the (scalar) function or
--** aggregate, is encoded in UTF-8 for sqlite3_create_function() and UTF-16
--** for sqlite3_create_function16().
--**
--** ^The first parameter is the [database connection] to which the SQL
--** function is to be added. ^If an application uses more than one database
--** connection then application-defined SQL functions must be added
--** to each database connection separately.
--**
--** The second parameter is the name of the SQL function to be created or
--** redefined. ^The length of the name is limited to 255 bytes, exclusive of
--** the zero-terminator. Note that the name length limit is in bytes, not
--** characters. ^Any attempt to create a function with a longer name
--** will result in [SQLITE_ERROR] being returned.
--**
--** ^The third parameter (nArg)
--** is the number of arguments that the SQL function or
--** aggregate takes. ^If this parameter is -1, then the SQL function or
--** aggregate may take any number of arguments between 0 and the limit
--** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]). If the third
--** parameter is less than -1 or greater than 127 then the behavior is
--** undefined.
--**
--** The fourth parameter, eTextRep, specifies what
--** [SQLITE_UTF8 | text encoding] this SQL function prefers for
--** its parameters. Any SQL function implementation should be able to work
--** work with UTF-8, UTF-16le, or UTF-16be. But some implementations may be
--** more efficient with one encoding than another. ^An application may
--** invoke sqlite3_create_function() or sqlite3_create_function16() multiple
--** times with the same function but with different values of eTextRep.
--** ^When multiple implementations of the same function are available, SQLite
--** will pick the one that involves the least amount of data conversion.
--** If there is only a single implementation which does not care what text
--** encoding is used, then the fourth argument should be [SQLITE_ANY].
--**
--** ^(The fifth parameter is an arbitrary pointer. The implementation of the
--** function can gain access to this pointer using [sqlite3_user_data()].)^
--**
--** The seventh, eighth and ninth parameters, xFunc, xStep and xFinal, are
--** pointers to C-language functions that implement the SQL function or
--** aggregate. ^A scalar SQL function requires an implementation of the xFunc
--** callback only; NULL pointers should be passed as the xStep and xFinal
--** parameters. ^An aggregate SQL function requires an implementation of xStep
--** and xFinal and NULL should be passed for xFunc. ^To delete an existing
--** SQL function or aggregate, pass NULL for all three function callbacks.
--**
--** ^It is permitted to register multiple implementations of the same
--** functions with the same name but with either differing numbers of
--** arguments or differing preferred text encodings. ^SQLite will use
--** the implementation that most closely matches the way in which the
--** SQL function is used. ^A function implementation with a non-negative
--** nArg parameter is a better match than a function implementation with
--** a negative nArg. ^A function where the preferred text encoding
--** matches the database encoding is a better
--** match than a function where the encoding is different.
--** ^A function where the encoding difference is between UTF16le and UTF16be
--** is a closer match than a function where the encoding difference is
--** between UTF8 and UTF16.
--**
--** ^Built-in functions may be overloaded by new application-defined functions.
--** ^The first application-defined function with a given name overrides all
--** built-in functions in the same [database connection] with the same name.
--** ^Subsequent application-defined functions of the same name only override
--** prior application-defined functions that are an exact match for the
--** number of parameters and preferred encoding.
--**
--** ^An application-defined function is permitted to call other
--** SQLite interfaces. However, such calls must not
--** close the database connection nor finalize or reset the prepared
--** statement in which the function is running.
--
function sqlite3_create_function
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : int;
arg4 : int;
arg5 : System.Address;
arg6 : access procedure
(arg1 : System.Address;
arg2 : int;
arg3 : System.Address);
arg7 : access procedure
(arg1 : System.Address;
arg2 : int;
arg3 : System.Address);
arg8 : access procedure (arg1 : System.Address)) return int; -- /usr/include/sqlite3.h:3195:16
pragma Import (C, sqlite3_create_function, "sqlite3_create_function");
function sqlite3_create_function16
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int;
arg4 : int;
arg5 : System.Address;
arg6 : access procedure
(arg1 : System.Address;
arg2 : int;
arg3 : System.Address);
arg7 : access procedure
(arg1 : System.Address;
arg2 : int;
arg3 : System.Address);
arg8 : access procedure (arg1 : System.Address)) return int; -- /usr/include/sqlite3.h:3205:16
pragma Import (C, sqlite3_create_function16, "sqlite3_create_function16");
--** CAPI3REF: Text Encodings
--**
--** These constant define integer codes that represent the various
--** text encodings supported by SQLite.
--
--** CAPI3REF: Deprecated Functions
--** DEPRECATED
--**
--** These functions are [deprecated]. In order to maintain
--** backwards compatibility with older code, these functions continue
--** to be supported. However, new applications should avoid
--** the use of these functions. To help encourage people to avoid
--** using these functions, we are not going to tell you what they do.
--
function sqlite3_aggregate_count (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:3240:34
pragma Import (C, sqlite3_aggregate_count, "sqlite3_aggregate_count");
function sqlite3_expired (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:3241:34
pragma Import (C, sqlite3_expired, "sqlite3_expired");
function sqlite3_transfer_bindings (arg1 : System.Address; arg2 : System.Address) return int; -- /usr/include/sqlite3.h:3242:34
pragma Import (C, sqlite3_transfer_bindings, "sqlite3_transfer_bindings");
function sqlite3_global_recover return int; -- /usr/include/sqlite3.h:3243:34
pragma Import (C, sqlite3_global_recover, "sqlite3_global_recover");
procedure sqlite3_thread_cleanup; -- /usr/include/sqlite3.h:3244:35
pragma Import (C, sqlite3_thread_cleanup, "sqlite3_thread_cleanup");
function sqlite3_memory_alarm
(arg1 : access procedure
(arg1 : System.Address;
arg2 : sqlite3_int64;
arg3 : int);
arg2 : System.Address;
arg3 : sqlite3_int64) return int; -- /usr/include/sqlite3.h:3245:34
pragma Import (C, sqlite3_memory_alarm, "sqlite3_memory_alarm");
--** CAPI3REF: Obtaining SQL Function Parameter Values
--**
--** The C-language implementation of SQL functions and aggregates uses
--** this set of interface routines to access the parameter values on
--** the function or aggregate.
--**
--** The xFunc (for scalar functions) or xStep (for aggregates) parameters
--** to [sqlite3_create_function()] and [sqlite3_create_function16()]
--** define callbacks that implement the SQL functions and aggregates.
--** The 4th parameter to these callbacks is an array of pointers to
--** [protected sqlite3_value] objects. There is one [sqlite3_value] object for
--** each parameter to the SQL function. These routines are used to
--** extract values from the [sqlite3_value] objects.
--**
--** These routines work only with [protected sqlite3_value] objects.
--** Any attempt to use these routines on an [unprotected sqlite3_value]
--** object results in undefined behavior.
--**
--** ^These routines work just like the corresponding [column access functions]
--** except that these routines take a single [protected sqlite3_value] object
--** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.
--**
--** ^The sqlite3_value_text16() interface extracts a UTF-16 string
--** in the native byte-order of the host machine. ^The
--** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
--** extract UTF-16 strings as big-endian and little-endian respectively.
--**
--** ^(The sqlite3_value_numeric_type() interface attempts to apply
--** numeric affinity to the value. This means that an attempt is
--** made to convert the value to an integer or floating point. If
--** such a conversion is possible without loss of information (in other
--** words, if the value is a string that looks like a number)
--** then the conversion is performed. Otherwise no conversion occurs.
--** The [SQLITE_INTEGER | datatype] after conversion is returned.)^
--**
--** Please pay particular attention to the fact that the pointer returned
--** from [sqlite3_value_blob()], [sqlite3_value_text()], or
--** [sqlite3_value_text16()] can be invalidated by a subsequent call to
--** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()],
--** or [sqlite3_value_text16()].
--**
--** These routines must be called from the same thread as
--** the SQL function that supplied the [sqlite3_value*] parameters.
--
function sqlite3_value_blob (arg1 : System.Address) return System.Address; -- /usr/include/sqlite3.h:3293:24
pragma Import (C, sqlite3_value_blob, "sqlite3_value_blob");
function sqlite3_value_bytes (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:3294:16
pragma Import (C, sqlite3_value_bytes, "sqlite3_value_bytes");
function sqlite3_value_bytes16 (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:3295:16
pragma Import (C, sqlite3_value_bytes16, "sqlite3_value_bytes16");
function sqlite3_value_double (arg1 : System.Address) return double; -- /usr/include/sqlite3.h:3296:19
pragma Import (C, sqlite3_value_double, "sqlite3_value_double");
function sqlite3_value_int (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:3297:16
pragma Import (C, sqlite3_value_int, "sqlite3_value_int");
function sqlite3_value_int64 (arg1 : System.Address) return sqlite3_int64; -- /usr/include/sqlite3.h:3298:26
pragma Import (C, sqlite3_value_int64, "sqlite3_value_int64");
function sqlite3_value_text (arg1 : System.Address) return access unsigned_char; -- /usr/include/sqlite3.h:3299:33
pragma Import (C, sqlite3_value_text, "sqlite3_value_text");
function sqlite3_value_text16 (arg1 : System.Address) return System.Address; -- /usr/include/sqlite3.h:3300:24
pragma Import (C, sqlite3_value_text16, "sqlite3_value_text16");
function sqlite3_value_text16le (arg1 : System.Address) return System.Address; -- /usr/include/sqlite3.h:3301:24
pragma Import (C, sqlite3_value_text16le, "sqlite3_value_text16le");
function sqlite3_value_text16be (arg1 : System.Address) return System.Address; -- /usr/include/sqlite3.h:3302:24
pragma Import (C, sqlite3_value_text16be, "sqlite3_value_text16be");
function sqlite3_value_type (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:3303:16
pragma Import (C, sqlite3_value_type, "sqlite3_value_type");
function sqlite3_value_numeric_type (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:3304:16
pragma Import (C, sqlite3_value_numeric_type, "sqlite3_value_numeric_type");
--** CAPI3REF: Obtain Aggregate Function Context
--**
--** Implementions of aggregate SQL functions use this
--** routine to allocate memory for storing their state.
--**
--** ^The first time the sqlite3_aggregate_context(C,N) routine is called
--** for a particular aggregate function, SQLite
--** allocates N of memory, zeroes out that memory, and returns a pointer
--** to the new memory. ^On second and subsequent calls to
--** sqlite3_aggregate_context() for the same aggregate function instance,
--** the same buffer is returned. Sqlite3_aggregate_context() is normally
--** called once for each invocation of the xStep callback and then one
--** last time when the xFinal callback is invoked. ^(When no rows match
--** an aggregate query, the xStep() callback of the aggregate function
--** implementation is never called and xFinal() is called exactly once.
--** In those cases, sqlite3_aggregate_context() might be called for the
--** first time from within xFinal().)^
--**
--** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer if N is
--** less than or equal to zero or if a memory allocate error occurs.
--**
--** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
--** determined by the N parameter on first successful call. Changing the
--** value of N in subsequent call to sqlite3_aggregate_context() within
--** the same aggregate function instance will not resize the memory
--** allocation.)^
--**
--** ^SQLite automatically frees the memory allocated by
--** sqlite3_aggregate_context() when the aggregate query concludes.
--**
--** The first parameter must be a copy of the
--** [sqlite3_context | SQL function context] that is the first parameter
--** to the xStep or xFinal callback routine that implements the aggregate
--** function.
--**
--** This routine must be called from the same thread in which
--** the aggregate SQL function is running.
--
function sqlite3_aggregate_context (arg1 : System.Address; arg2 : int) return System.Address; -- /usr/include/sqlite3.h:3345:18
pragma Import (C, sqlite3_aggregate_context, "sqlite3_aggregate_context");
--** CAPI3REF: User Data For Functions
--**
--** ^The sqlite3_user_data() interface returns a copy of
--** the pointer that was the pUserData parameter (the 5th parameter)
--** of the [sqlite3_create_function()]
--** and [sqlite3_create_function16()] routines that originally
--** registered the application defined function.
--**
--** This routine must be called from the same thread in which
--** the application-defined function is running.
--
function sqlite3_user_data (arg1 : System.Address) return System.Address; -- /usr/include/sqlite3.h:3359:18
pragma Import (C, sqlite3_user_data, "sqlite3_user_data");
--** CAPI3REF: Database Connection For Functions
--**
--** ^The sqlite3_context_db_handle() interface returns a copy of
--** the pointer to the [database connection] (the 1st parameter)
--** of the [sqlite3_create_function()]
--** and [sqlite3_create_function16()] routines that originally
--** registered the application defined function.
--
function sqlite3_context_db_handle (arg1 : System.Address) return System.Address; -- /usr/include/sqlite3.h:3370:21
pragma Import (C, sqlite3_context_db_handle, "sqlite3_context_db_handle");
--** CAPI3REF: Function Auxiliary Data
--**
--** The following two functions may be used by scalar SQL functions to
--** associate metadata with argument values. If the same value is passed to
--** multiple invocations of the same SQL function during query execution, under
--** some circumstances the associated metadata may be preserved. This may
--** be used, for example, to add a regular-expression matching scalar
--** function. The compiled version of the regular expression is stored as
--** metadata associated with the SQL value passed as the regular expression
--** pattern. The compiled regular expression can be reused on multiple
--** invocations of the same function so that the original pattern string
--** does not need to be recompiled on each invocation.
--**
--** ^The sqlite3_get_auxdata() interface returns a pointer to the metadata
--** associated by the sqlite3_set_auxdata() function with the Nth argument
--** value to the application-defined function. ^If no metadata has been ever
--** been set for the Nth argument of the function, or if the corresponding
--** function parameter has changed since the meta-data was set,
--** then sqlite3_get_auxdata() returns a NULL pointer.
--**
--** ^The sqlite3_set_auxdata() interface saves the metadata
--** pointed to by its 3rd parameter as the metadata for the N-th
--** argument of the application-defined function. Subsequent
--** calls to sqlite3_get_auxdata() might return this data, if it has
--** not been destroyed.
--** ^If it is not NULL, SQLite will invoke the destructor
--** function given by the 4th parameter to sqlite3_set_auxdata() on
--** the metadata when the corresponding function parameter changes
--** or when the SQL statement completes, whichever comes first.
--**
--** SQLite is free to call the destructor and drop metadata on any
--** parameter of any function at any time. ^The only guarantee is that
--** the destructor will be called before the metadata is dropped.
--**
--** ^(In practice, metadata is preserved between function calls for
--** expressions that are constant at compile time. This includes literal
--** values and [parameters].)^
--**
--** These routines must be called from the same thread in which
--** the SQL function is running.
--
function sqlite3_get_auxdata (arg1 : System.Address; arg2 : int) return System.Address; -- /usr/include/sqlite3.h:3414:18
pragma Import (C, sqlite3_get_auxdata, "sqlite3_get_auxdata");
procedure sqlite3_set_auxdata
(arg1 : System.Address;
arg2 : int;
arg3 : System.Address;
arg4 : access procedure (arg1 : System.Address)); -- /usr/include/sqlite3.h:3415:17
pragma Import (C, sqlite3_set_auxdata, "sqlite3_set_auxdata");
--** CAPI3REF: Constants Defining Special Destructor Behavior
--**
--** These are special values for the destructor that is passed in as the
--** final argument to routines like [sqlite3_result_blob()]. ^If the destructor
--** argument is SQLITE_STATIC, it means that the content pointer is constant
--** and will never change. It does not need to be destroyed. ^The
--** SQLITE_TRANSIENT value means that the content will likely change in
--** the near future and that SQLite should make its own private copy of
--** the content before returning.
--**
--** The typedef is necessary to work around problems in certain
--** C++ compilers. See ticket #2191.
--
type sqlite3_destructor_type is access procedure (arg1 : System.Address); -- /usr/include/sqlite3.h:3432:16
--** CAPI3REF: Setting The Result Of An SQL Function
--**
--** These routines are used by the xFunc or xFinal callbacks that
--** implement SQL functions and aggregates. See
--** [sqlite3_create_function()] and [sqlite3_create_function16()]
--** for additional information.
--**
--** These functions work very much like the [parameter binding] family of
--** functions used to bind values to host parameters in prepared statements.
--** Refer to the [SQL parameter] documentation for additional information.
--**
--** ^The sqlite3_result_blob() interface sets the result from
--** an application-defined function to be the BLOB whose content is pointed
--** to by the second parameter and which is N bytes long where N is the
--** third parameter.
--**
--** ^The sqlite3_result_zeroblob() interfaces set the result of
--** the application-defined function to be a BLOB containing all zero
--** bytes and N bytes in size, where N is the value of the 2nd parameter.
--**
--** ^The sqlite3_result_double() interface sets the result from
--** an application-defined function to be a floating point value specified
--** by its 2nd argument.
--**
--** ^The sqlite3_result_error() and sqlite3_result_error16() functions
--** cause the implemented SQL function to throw an exception.
--** ^SQLite uses the string pointed to by the
--** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16()
--** as the text of an error message. ^SQLite interprets the error
--** message string from sqlite3_result_error() as UTF-8. ^SQLite
--** interprets the string from sqlite3_result_error16() as UTF-16 in native
--** byte order. ^If the third parameter to sqlite3_result_error()
--** or sqlite3_result_error16() is negative then SQLite takes as the error
--** message all text up through the first zero character.
--** ^If the third parameter to sqlite3_result_error() or
--** sqlite3_result_error16() is non-negative then SQLite takes that many
--** bytes (not characters) from the 2nd parameter as the error message.
--** ^The sqlite3_result_error() and sqlite3_result_error16()
--** routines make a private copy of the error message text before
--** they return. Hence, the calling function can deallocate or
--** modify the text after they return without harm.
--** ^The sqlite3_result_error_code() function changes the error code
--** returned by SQLite as a result of an error in a function. ^By default,
--** the error code is SQLITE_ERROR. ^A subsequent call to sqlite3_result_error()
--** or sqlite3_result_error16() resets the error code to SQLITE_ERROR.
--**
--** ^The sqlite3_result_toobig() interface causes SQLite to throw an error
--** indicating that a string or BLOB is too long to represent.
--**
--** ^The sqlite3_result_nomem() interface causes SQLite to throw an error
--** indicating that a memory allocation failed.
--**
--** ^The sqlite3_result_int() interface sets the return value
--** of the application-defined function to be the 32-bit signed integer
--** value given in the 2nd argument.
--** ^The sqlite3_result_int64() interface sets the return value
--** of the application-defined function to be the 64-bit signed integer
--** value given in the 2nd argument.
--**
--** ^The sqlite3_result_null() interface sets the return value
--** of the application-defined function to be NULL.
--**
--** ^The sqlite3_result_text(), sqlite3_result_text16(),
--** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces
--** set the return value of the application-defined function to be
--** a text string which is represented as UTF-8, UTF-16 native byte order,
--** UTF-16 little endian, or UTF-16 big endian, respectively.
--** ^SQLite takes the text result from the application from
--** the 2nd parameter of the sqlite3_result_text* interfaces.
--** ^If the 3rd parameter to the sqlite3_result_text* interfaces
--** is negative, then SQLite takes result text from the 2nd parameter
--** through the first zero character.
--** ^If the 3rd parameter to the sqlite3_result_text* interfaces
--** is non-negative, then as many bytes (not characters) of the text
--** pointed to by the 2nd parameter are taken as the application-defined
--** function result.
--** ^If the 4th parameter to the sqlite3_result_text* interfaces
--** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that
--** function as the destructor on the text or BLOB result when it has
--** finished using that result.
--** ^If the 4th parameter to the sqlite3_result_text* interfaces or to
--** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite
--** assumes that the text or BLOB result is in constant space and does not
--** copy the content of the parameter nor call a destructor on the content
--** when it has finished using that result.
--** ^If the 4th parameter to the sqlite3_result_text* interfaces
--** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT
--** then SQLite makes a copy of the result into space obtained from
--** from [sqlite3_malloc()] before it returns.
--**
--** ^The sqlite3_result_value() interface sets the result of
--** the application-defined function to be a copy the
--** [unprotected sqlite3_value] object specified by the 2nd parameter. ^The
--** sqlite3_result_value() interface makes a copy of the [sqlite3_value]
--** so that the [sqlite3_value] specified in the parameter may change or
--** be deallocated after sqlite3_result_value() returns without harm.
--** ^A [protected sqlite3_value] object may always be used where an
--** [unprotected sqlite3_value] object is required, so either
--** kind of [sqlite3_value] object can be used with this interface.
--**
--** If these routines are called from within the different thread
--** than the one containing the application-defined function that received
--** the [sqlite3_context] pointer, the results are undefined.
--
procedure sqlite3_result_blob
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int;
arg4 : access procedure (arg1 : System.Address)); -- /usr/include/sqlite3.h:3541:17
pragma Import (C, sqlite3_result_blob, "sqlite3_result_blob");
procedure sqlite3_result_double (arg1 : System.Address; arg2 : double); -- /usr/include/sqlite3.h:3542:17
pragma Import (C, sqlite3_result_double, "sqlite3_result_double");
procedure sqlite3_result_error
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : int); -- /usr/include/sqlite3.h:3543:17
pragma Import (C, sqlite3_result_error, "sqlite3_result_error");
procedure sqlite3_result_error16
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int); -- /usr/include/sqlite3.h:3544:17
pragma Import (C, sqlite3_result_error16, "sqlite3_result_error16");
procedure sqlite3_result_error_toobig (arg1 : System.Address); -- /usr/include/sqlite3.h:3545:17
pragma Import (C, sqlite3_result_error_toobig, "sqlite3_result_error_toobig");
procedure sqlite3_result_error_nomem (arg1 : System.Address); -- /usr/include/sqlite3.h:3546:17
pragma Import (C, sqlite3_result_error_nomem, "sqlite3_result_error_nomem");
procedure sqlite3_result_error_code (arg1 : System.Address; arg2 : int); -- /usr/include/sqlite3.h:3547:17
pragma Import (C, sqlite3_result_error_code, "sqlite3_result_error_code");
procedure sqlite3_result_int (arg1 : System.Address; arg2 : int); -- /usr/include/sqlite3.h:3548:17
pragma Import (C, sqlite3_result_int, "sqlite3_result_int");
procedure sqlite3_result_int64 (arg1 : System.Address; arg2 : sqlite3_int64); -- /usr/include/sqlite3.h:3549:17
pragma Import (C, sqlite3_result_int64, "sqlite3_result_int64");
procedure sqlite3_result_null (arg1 : System.Address); -- /usr/include/sqlite3.h:3550:17
pragma Import (C, sqlite3_result_null, "sqlite3_result_null");
procedure sqlite3_result_text
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : int;
arg4 : access procedure (arg1 : System.Address)); -- /usr/include/sqlite3.h:3551:17
pragma Import (C, sqlite3_result_text, "sqlite3_result_text");
procedure sqlite3_result_text16
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int;
arg4 : access procedure (arg1 : System.Address)); -- /usr/include/sqlite3.h:3552:17
pragma Import (C, sqlite3_result_text16, "sqlite3_result_text16");
procedure sqlite3_result_text16le
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int;
arg4 : access procedure (arg1 : System.Address)); -- /usr/include/sqlite3.h:3553:17
pragma Import (C, sqlite3_result_text16le, "sqlite3_result_text16le");
procedure sqlite3_result_text16be
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int;
arg4 : access procedure (arg1 : System.Address)); -- /usr/include/sqlite3.h:3554:17
pragma Import (C, sqlite3_result_text16be, "sqlite3_result_text16be");
procedure sqlite3_result_value (arg1 : System.Address; arg2 : System.Address); -- /usr/include/sqlite3.h:3555:17
pragma Import (C, sqlite3_result_value, "sqlite3_result_value");
procedure sqlite3_result_zeroblob (arg1 : System.Address; arg2 : int); -- /usr/include/sqlite3.h:3556:17
pragma Import (C, sqlite3_result_zeroblob, "sqlite3_result_zeroblob");
--** CAPI3REF: Define New Collating Sequences
--**
--** These functions are used to add new collation sequences to the
--** [database connection] specified as the first argument.
--**
--** ^The name of the new collation sequence is specified as a UTF-8 string
--** for sqlite3_create_collation() and sqlite3_create_collation_v2()
--** and a UTF-16 string for sqlite3_create_collation16(). ^In all cases
--** the name is passed as the second function argument.
--**
--** ^The third argument may be one of the constants [SQLITE_UTF8],
--** [SQLITE_UTF16LE], or [SQLITE_UTF16BE], indicating that the user-supplied
--** routine expects to be passed pointers to strings encoded using UTF-8,
--** UTF-16 little-endian, or UTF-16 big-endian, respectively. ^The
--** third argument might also be [SQLITE_UTF16] to indicate that the routine
--** expects pointers to be UTF-16 strings in the native byte order, or the
--** argument can be [SQLITE_UTF16_ALIGNED] if the
--** the routine expects pointers to 16-bit word aligned strings
--** of UTF-16 in the native byte order.
--**
--** A pointer to the user supplied routine must be passed as the fifth
--** argument. ^If it is NULL, this is the same as deleting the collation
--** sequence (so that SQLite cannot call it anymore).
--** ^Each time the application supplied function is invoked, it is passed
--** as its first parameter a copy of the void* passed as the fourth argument
--** to sqlite3_create_collation() or sqlite3_create_collation16().
--**
--** ^The remaining arguments to the application-supplied routine are two strings,
--** each represented by a (length, data) pair and encoded in the encoding
--** that was passed as the third argument when the collation sequence was
--** registered. The application defined collation routine should
--** return negative, zero or positive if the first string is less than,
--** equal to, or greater than the second string. i.e. (STRING1 - STRING2).
--**
--** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation()
--** except that it takes an extra argument which is a destructor for
--** the collation. ^The destructor is called when the collation is
--** destroyed and is passed a copy of the fourth parameter void* pointer
--** of the sqlite3_create_collation_v2().
--** ^Collations are destroyed when they are overridden by later calls to the
--** collation creation functions or when the [database connection] is closed
--** using [sqlite3_close()].
--**
--** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
--
function sqlite3_create_collation
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : int;
arg4 : System.Address;
arg5 : access function
(arg1 : System.Address;
arg2 : int;
arg3 : System.Address;
arg4 : int;
arg5 : System.Address) return int) return int; -- /usr/include/sqlite3.h:3604:16
pragma Import (C, sqlite3_create_collation, "sqlite3_create_collation");
function sqlite3_create_collation_v2
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : int;
arg4 : System.Address;
arg5 : access function
(arg1 : System.Address;
arg2 : int;
arg3 : System.Address;
arg4 : int;
arg5 : System.Address) return int;
arg6 : access procedure (arg1 : System.Address)) return int; -- /usr/include/sqlite3.h:3611:16
pragma Import (C, sqlite3_create_collation_v2, "sqlite3_create_collation_v2");
function sqlite3_create_collation16
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int;
arg4 : System.Address;
arg5 : access function
(arg1 : System.Address;
arg2 : int;
arg3 : System.Address;
arg4 : int;
arg5 : System.Address) return int) return int; -- /usr/include/sqlite3.h:3619:16
pragma Import (C, sqlite3_create_collation16, "sqlite3_create_collation16");
--** CAPI3REF: Collation Needed Callbacks
--**
--** ^To avoid having to register all collation sequences before a database
--** can be used, a single callback function may be registered with the
--** [database connection] to be invoked whenever an undefined collation
--** sequence is required.
--**
--** ^If the function is registered using the sqlite3_collation_needed() API,
--** then it is passed the names of undefined collation sequences as strings
--** encoded in UTF-8. ^If sqlite3_collation_needed16() is used,
--** the names are passed as UTF-16 in machine native byte order.
--** ^A call to either function replaces the existing collation-needed callback.
--**
--** ^(When the callback is invoked, the first argument passed is a copy
--** of the second argument to sqlite3_collation_needed() or
--** sqlite3_collation_needed16(). The second argument is the database
--** connection. The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE],
--** or [SQLITE_UTF16LE], indicating the most desirable form of the collation
--** sequence function required. The fourth parameter is the name of the
--** required collation sequence.)^
--**
--** The callback function should register the desired collation using
--** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
--** [sqlite3_create_collation_v2()].
--
function sqlite3_collation_needed
(arg1 : System.Address;
arg2 : System.Address;
arg3 : access procedure
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int;
arg4 : Interfaces.C.Strings.chars_ptr)) return int; -- /usr/include/sqlite3.h:3653:16
pragma Import (C, sqlite3_collation_needed, "sqlite3_collation_needed");
function sqlite3_collation_needed16
(arg1 : System.Address;
arg2 : System.Address;
arg3 : access procedure
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int;
arg4 : System.Address)) return int; -- /usr/include/sqlite3.h:3658:16
pragma Import (C, sqlite3_collation_needed16, "sqlite3_collation_needed16");
--** Specify the key for an encrypted database. This routine should be
--** called right after sqlite3_open().
--**
--** The code to implement this API is not available in the public release
--** of SQLite.
--
function sqlite3_key
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int) return int; -- /usr/include/sqlite3.h:3671:16
pragma Import (C, sqlite3_key, "sqlite3_key");
-- Database to be rekeyed
-- The key
--** Change the key on an open database. If the current database is not
--** encrypted, this routine will encrypt it. If pNew==0 or nNew==0, the
--** database is decrypted.
--**
--** The code to implement this API is not available in the public release
--** of SQLite.
--
function sqlite3_rekey
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int) return int; -- /usr/include/sqlite3.h:3684:16
pragma Import (C, sqlite3_rekey, "sqlite3_rekey");
-- Database to be rekeyed
-- The new key
--** CAPI3REF: Suspend Execution For A Short Time
--**
--** ^The sqlite3_sleep() function causes the current thread to suspend execution
--** for at least a number of milliseconds specified in its parameter.
--**
--** ^If the operating system does not support sleep requests with
--** millisecond time resolution, then the time will be rounded up to
--** the nearest second. ^The number of milliseconds of sleep actually
--** requested from the operating system is returned.
--**
--** ^SQLite implements this interface by calling the xSleep()
--** method of the default [sqlite3_vfs] object.
--
function sqlite3_sleep (arg1 : int) return int; -- /usr/include/sqlite3.h:3703:16
pragma Import (C, sqlite3_sleep, "sqlite3_sleep");
--** CAPI3REF: Name Of The Folder Holding Temporary Files
--**
--** ^(If this global variable is made to point to a string which is
--** the name of a folder (a.k.a. directory), then all temporary files
--** created by SQLite when using a built-in [sqlite3_vfs | VFS]
--** will be placed in that directory.)^ ^If this variable
--** is a NULL pointer, then SQLite performs a search for an appropriate
--** temporary file directory.
--**
--** It is not safe to read or modify this variable in more than one
--** thread at a time. It is not safe to read or modify this variable
--** if a [database connection] is being used at the same time in a separate
--** thread.
--** It is intended that this variable be set once
--** as part of process initialization and before any SQLite interface
--** routines have been called and that this variable remain unchanged
--** thereafter.
--**
--** ^The [temp_store_directory pragma] may modify this variable and cause
--** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore,
--** the [temp_store_directory pragma] always assumes that any string
--** that this variable points to is held in memory obtained from
--** [sqlite3_malloc] and the pragma may attempt to free that memory
--** using [sqlite3_free].
--** Hence, if this variable is modified directly, either it should be
--** made NULL or made to point to memory obtained from [sqlite3_malloc]
--** or else the use of the [temp_store_directory pragma] should be avoided.
--
sqlite3_temp_directory : Interfaces.C.Strings.chars_ptr; -- /usr/include/sqlite3.h:3734:32
pragma Import (C, sqlite3_temp_directory, "sqlite3_temp_directory");
--** CAPI3REF: Test For Auto-Commit Mode
--** KEYWORDS: {autocommit mode}
--**
--** ^The sqlite3_get_autocommit() interface returns non-zero or
--** zero if the given database connection is or is not in autocommit mode,
--** respectively. ^Autocommit mode is on by default.
--** ^Autocommit mode is disabled by a [BEGIN] statement.
--** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK].
--**
--** If certain kinds of errors occur on a statement within a multi-statement
--** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR],
--** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the
--** transaction might be rolled back automatically. The only way to
--** find out whether SQLite automatically rolled back the transaction after
--** an error is to use this function.
--**
--** If another thread changes the autocommit status of the database
--** connection while this routine is running, then the return value
--** is undefined.
--
function sqlite3_get_autocommit (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:3757:16
pragma Import (C, sqlite3_get_autocommit, "sqlite3_get_autocommit");
--** CAPI3REF: Find The Database Handle Of A Prepared Statement
--**
--** ^The sqlite3_db_handle interface returns the [database connection] handle
--** to which a [prepared statement] belongs. ^The [database connection]
--** returned by sqlite3_db_handle is the same [database connection]
--** that was the first argument
--** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
--** create the statement in the first place.
--
function sqlite3_db_handle (arg1 : System.Address) return System.Address; -- /usr/include/sqlite3.h:3769:21
pragma Import (C, sqlite3_db_handle, "sqlite3_db_handle");
--** CAPI3REF: Find the next prepared statement
--**
--** ^This interface returns a pointer to the next [prepared statement] after
--** pStmt associated with the [database connection] pDb. ^If pStmt is NULL
--** then this interface returns a pointer to the first prepared statement
--** associated with the database connection pDb. ^If no prepared statement
--** satisfies the conditions of this routine, it returns NULL.
--**
--** The [database connection] pointer D in a call to
--** [sqlite3_next_stmt(D,S)] must refer to an open database
--** connection and in particular must not be a NULL pointer.
--
function sqlite3_next_stmt (arg1 : System.Address; arg2 : System.Address) return System.Address; -- /usr/include/sqlite3.h:3784:26
pragma Import (C, sqlite3_next_stmt, "sqlite3_next_stmt");
--** CAPI3REF: Commit And Rollback Notification Callbacks
--**
--** ^The sqlite3_commit_hook() interface registers a callback
--** function to be invoked whenever a transaction is [COMMIT | committed].
--** ^Any callback set by a previous call to sqlite3_commit_hook()
--** for the same database connection is overridden.
--** ^The sqlite3_rollback_hook() interface registers a callback
--** function to be invoked whenever a transaction is [ROLLBACK | rolled back].
--** ^Any callback set by a previous call to sqlite3_rollback_hook()
--** for the same database connection is overridden.
--** ^The pArg argument is passed through to the callback.
--** ^If the callback on a commit hook function returns non-zero,
--** then the commit is converted into a rollback.
--**
--** ^The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions
--** return the P argument from the previous call of the same function
--** on the same [database connection] D, or NULL for
--** the first call for each function on D.
--**
--** The callback implementation must not do anything that will modify
--** the database connection that invoked the callback. Any actions
--** to modify the database connection must be deferred until after the
--** completion of the [sqlite3_step()] call that triggered the commit
--** or rollback hook in the first place.
--** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
--** database connections for the meaning of "modify" in this paragraph.
--**
--** ^Registering a NULL function disables the callback.
--**
--** ^When the commit hook callback routine returns zero, the [COMMIT]
--** operation is allowed to continue normally. ^If the commit hook
--** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK].
--** ^The rollback hook is invoked on a rollback that results from a commit
--** hook returning non-zero, just as it would be with any other rollback.
--**
--** ^For the purposes of this API, a transaction is said to have been
--** rolled back if an explicit "ROLLBACK" statement is executed, or
--** an error or constraint causes an implicit rollback to occur.
--** ^The rollback callback is not invoked if a transaction is
--** automatically rolled back because the database connection is closed.
--** ^The rollback callback is not invoked if a transaction is
--** rolled back because a commit callback returned non-zero.
--**
--** See also the [sqlite3_update_hook()] interface.
--
function sqlite3_commit_hook
(arg1 : System.Address;
arg2 : access function (arg1 : System.Address) return int;
arg3 : System.Address) return System.Address; -- /usr/include/sqlite3.h:3832:18
pragma Import (C, sqlite3_commit_hook, "sqlite3_commit_hook");
function sqlite3_rollback_hook
(arg1 : System.Address;
arg2 : access procedure (arg1 : System.Address);
arg3 : System.Address) return System.Address; -- /usr/include/sqlite3.h:3833:18
pragma Import (C, sqlite3_rollback_hook, "sqlite3_rollback_hook");
--** CAPI3REF: Data Change Notification Callbacks
--**
--** ^The sqlite3_update_hook() interface registers a callback function
--** with the [database connection] identified by the first argument
--** to be invoked whenever a row is updated, inserted or deleted.
--** ^Any callback set by a previous call to this function
--** for the same database connection is overridden.
--**
--** ^The second argument is a pointer to the function to invoke when a
--** row is updated, inserted or deleted.
--** ^The first argument to the callback is a copy of the third argument
--** to sqlite3_update_hook().
--** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],
--** or [SQLITE_UPDATE], depending on the operation that caused the callback
--** to be invoked.
--** ^The third and fourth arguments to the callback contain pointers to the
--** database and table name containing the affected row.
--** ^The final callback parameter is the [rowid] of the row.
--** ^In the case of an update, this is the [rowid] after the update takes place.
--**
--** ^(The update hook is not invoked when internal system tables are
--** modified (i.e. sqlite_master and sqlite_sequence).)^
--**
--** ^In the current implementation, the update hook
--** is not invoked when duplication rows are deleted because of an
--** [ON CONFLICT | ON CONFLICT REPLACE] clause. ^Nor is the update hook
--** invoked when rows are deleted using the [truncate optimization].
--** The exceptions defined in this paragraph might change in a future
--** release of SQLite.
--**
--** The update hook implementation must not do anything that will modify
--** the database connection that invoked the update hook. Any actions
--** to modify the database connection must be deferred until after the
--** completion of the [sqlite3_step()] call that triggered the update hook.
--** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
--** database connections for the meaning of "modify" in this paragraph.
--**
--** ^The sqlite3_update_hook(D,C,P) function
--** returns the P argument from the previous call
--** on the same [database connection] D, or NULL for
--** the first call on D.
--**
--** See also the [sqlite3_commit_hook()] and [sqlite3_rollback_hook()]
--** interfaces.
--
function sqlite3_update_hook
(arg1 : System.Address;
arg2 : access procedure
(arg1 : System.Address;
arg2 : int;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : Interfaces.C.Strings.chars_ptr;
arg5 : sqlite3_int64);
arg3 : System.Address) return System.Address; -- /usr/include/sqlite3.h:3881:18
pragma Import (C, sqlite3_update_hook, "sqlite3_update_hook");
--** CAPI3REF: Enable Or Disable Shared Pager Cache
--** KEYWORDS: {shared cache}
--**
--** ^(This routine enables or disables the sharing of the database cache
--** and schema data structures between [database connection | connections]
--** to the same database. Sharing is enabled if the argument is true
--** and disabled if the argument is false.)^
--**
--** ^Cache sharing is enabled and disabled for an entire process.
--** This is a change as of SQLite version 3.5.0. In prior versions of SQLite,
--** sharing was enabled or disabled for each thread separately.
--**
--** ^(The cache sharing mode set by this interface effects all subsequent
--** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].
--** Existing database connections continue use the sharing mode
--** that was in effect at the time they were opened.)^
--**
--** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled
--** successfully. An [error code] is returned otherwise.)^
--**
--** ^Shared cache is disabled by default. But this might change in
--** future releases of SQLite. Applications that care about shared
--** cache setting should set it explicitly.
--**
--** See Also: [SQLite Shared-Cache Mode]
--
function sqlite3_enable_shared_cache (arg1 : int) return int; -- /usr/include/sqlite3.h:3914:16
pragma Import (C, sqlite3_enable_shared_cache, "sqlite3_enable_shared_cache");
--** CAPI3REF: Attempt To Free Heap Memory
--**
--** ^The sqlite3_release_memory() interface attempts to free N bytes
--** of heap memory by deallocating non-essential memory allocations
--** held by the database library. Memory used to cache database
--** pages to improve performance is an example of non-essential memory.
--** ^sqlite3_release_memory() returns the number of bytes actually freed,
--** which might be more or less than the amount requested.
--
function sqlite3_release_memory (arg1 : int) return int; -- /usr/include/sqlite3.h:3926:16
pragma Import (C, sqlite3_release_memory, "sqlite3_release_memory");
--** CAPI3REF: Impose A Limit On Heap Size
--**
--** ^The sqlite3_soft_heap_limit() interface places a "soft" limit
--** on the amount of heap memory that may be allocated by SQLite.
--** ^If an internal allocation is requested that would exceed the
--** soft heap limit, [sqlite3_release_memory()] is invoked one or
--** more times to free up some space before the allocation is performed.
--**
--** ^The limit is called "soft" because if [sqlite3_release_memory()]
--** cannot free sufficient memory to prevent the limit from being exceeded,
--** the memory is allocated anyway and the current operation proceeds.
--**
--** ^A negative or zero value for N means that there is no soft heap limit and
--** [sqlite3_release_memory()] will only be called when memory is exhausted.
--** ^The default value for the soft heap limit is zero.
--**
--** ^(SQLite makes a best effort to honor the soft heap limit.
--** But if the soft heap limit cannot be honored, execution will
--** continue without error or notification.)^ This is why the limit is
--** called a "soft" limit. It is advisory only.
--**
--** Prior to SQLite version 3.5.0, this routine only constrained the memory
--** allocated by a single thread - the same thread in which this routine
--** runs. Beginning with SQLite version 3.5.0, the soft heap limit is
--** applied to all threads. The value specified for the soft heap limit
--** is an upper bound on the total memory allocation for all threads. In
--** version 3.5.0 there is no mechanism for limiting the heap usage for
--** individual threads.
--
procedure sqlite3_soft_heap_limit (arg1 : int); -- /usr/include/sqlite3.h:3958:17
pragma Import (C, sqlite3_soft_heap_limit, "sqlite3_soft_heap_limit");
--** CAPI3REF: Extract Metadata About A Column Of A Table
--**
--** ^This routine returns metadata about a specific column of a specific
--** database table accessible using the [database connection] handle
--** passed as the first function argument.
--**
--** ^The column is identified by the second, third and fourth parameters to
--** this function. ^The second parameter is either the name of the database
--** (i.e. "main", "temp", or an attached database) containing the specified
--** table or NULL. ^If it is NULL, then all attached databases are searched
--** for the table using the same algorithm used by the database engine to
--** resolve unqualified table references.
--**
--** ^The third and fourth parameters to this function are the table and column
--** name of the desired column, respectively. Neither of these parameters
--** may be NULL.
--**
--** ^Metadata is returned by writing to the memory locations passed as the 5th
--** and subsequent parameters to this function. ^Any of these arguments may be
--** NULL, in which case the corresponding element of metadata is omitted.
--**
--** ^(<blockquote>
--** <table border="1">
--** <tr><th> Parameter <th> Output<br>Type <th> Description
--**
--** <tr><td> 5th <td> const char* <td> Data type
--** <tr><td> 6th <td> const char* <td> Name of default collation sequence
--** <tr><td> 7th <td> int <td> True if column has a NOT NULL constraint
--** <tr><td> 8th <td> int <td> True if column is part of the PRIMARY KEY
--** <tr><td> 9th <td> int <td> True if column is [AUTOINCREMENT]
--** </table>
--** </blockquote>)^
--**
--** ^The memory pointed to by the character pointers returned for the
--** declaration type and collation sequence is valid only until the next
--** call to any SQLite API function.
--**
--** ^If the specified table is actually a view, an [error code] is returned.
--**
--** ^If the specified column is "rowid", "oid" or "_rowid_" and an
--** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output
--** parameters are set for the explicitly declared column. ^(If there is no
--** explicitly declared [INTEGER PRIMARY KEY] column, then the output
--** parameters are set as follows:
--**
--** <pre>
--** data type: "INTEGER"
--** collation sequence: "BINARY"
--** not null: 0
--** primary key: 1
--** auto increment: 0
--** </pre>)^
--**
--** ^(This function may load one or more schemas from database files. If an
--** error occurs during this process, or if the requested table or column
--** cannot be found, an [error code] is returned and an error message left
--** in the [database connection] (to be retrieved using sqlite3_errmsg()).)^
--**
--** ^This API is only available if the library was compiled with the
--** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol defined.
--
function sqlite3_table_column_metadata
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : Interfaces.C.Strings.chars_ptr;
arg5 : System.Address;
arg6 : System.Address;
arg7 : access int;
arg8 : access int;
arg9 : access int) return int; -- /usr/include/sqlite3.h:4022:16
pragma Import (C, sqlite3_table_column_metadata, "sqlite3_table_column_metadata");
-- Connection handle
-- Database name or NULL
-- Table name
-- Column name
-- OUTPUT: Declared data type
-- OUTPUT: Collation sequence name
-- OUTPUT: True if NOT NULL constraint exists
-- OUTPUT: True if column part of PK
-- OUTPUT: True if column is auto-increment
--** CAPI3REF: Load An Extension
--**
--** ^This interface loads an SQLite extension library from the named file.
--**
--** ^The sqlite3_load_extension() interface attempts to load an
--** SQLite extension library contained in the file zFile.
--**
--** ^The entry point is zProc.
--** ^zProc may be 0, in which case the name of the entry point
--** defaults to "sqlite3_extension_init".
--** ^The sqlite3_load_extension() interface returns
--** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
--** ^If an error occurs and pzErrMsg is not 0, then the
--** [sqlite3_load_extension()] interface shall attempt to
--** fill *pzErrMsg with error message text stored in memory
--** obtained from [sqlite3_malloc()]. The calling function
--** should free this memory by calling [sqlite3_free()].
--**
--** ^Extension loading must be enabled using
--** [sqlite3_enable_load_extension()] prior to calling this API,
--** otherwise an error will be returned.
--**
--** See also the [load_extension() SQL function].
--
function sqlite3_load_extension
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : System.Address) return int; -- /usr/include/sqlite3.h:4059:16
pragma Import (C, sqlite3_load_extension, "sqlite3_load_extension");
-- Load the extension into this database connection
-- Name of the shared library containing extension
-- Entry point. Derived from zFile if 0
-- Put error message here if not 0
--** CAPI3REF: Enable Or Disable Extension Loading
--**
--** ^So as not to open security holes in older applications that are
--** unprepared to deal with extension loading, and as a means of disabling
--** extension loading while evaluating user-entered SQL, the following API
--** is provided to turn the [sqlite3_load_extension()] mechanism on and off.
--**
--** ^Extension loading is off by default. See ticket #1863.
--** ^Call the sqlite3_enable_load_extension() routine with onoff==1
--** to turn extension loading on and call it with onoff==0 to turn
--** it back off again.
--
function sqlite3_enable_load_extension (arg1 : System.Address; arg2 : int) return int; -- /usr/include/sqlite3.h:4079:16
pragma Import (C, sqlite3_enable_load_extension, "sqlite3_enable_load_extension");
--** CAPI3REF: Automatically Load An Extensions
--**
--** ^This API can be invoked at program startup in order to register
--** one or more statically linked extensions that will be available
--** to all new [database connections].
--**
--** ^(This routine stores a pointer to the extension entry point
--** in an array that is obtained from [sqlite3_malloc()]. That memory
--** is deallocated by [sqlite3_reset_auto_extension()].)^
--**
--** ^This function registers an extension entry point that is
--** automatically invoked whenever a new [database connection]
--** is opened using [sqlite3_open()], [sqlite3_open16()],
--** or [sqlite3_open_v2()].
--** ^Duplicate extensions are detected so calling this routine
--** multiple times with the same extension is harmless.
--** ^Automatic extensions apply across all threads.
--
function sqlite3_auto_extension (arg1 : access procedure) return int; -- /usr/include/sqlite3.h:4100:16
pragma Import (C, sqlite3_auto_extension, "sqlite3_auto_extension");
--** CAPI3REF: Reset Automatic Extension Loading
--**
--** ^(This function disables all previously registered automatic
--** extensions. It undoes the effect of all prior
--** [sqlite3_auto_extension()] calls.)^
--**
--** ^This function disables automatic extensions in all threads.
--
procedure sqlite3_reset_auto_extension; -- /usr/include/sqlite3.h:4111:17
pragma Import (C, sqlite3_reset_auto_extension, "sqlite3_reset_auto_extension");
--** CAPI3REF: A Handle To An Open BLOB
--** KEYWORDS: {BLOB handle} {BLOB handles}
--**
--** An instance of this object represents an open BLOB on which
--** [sqlite3_blob_open | incremental BLOB I/O] can be performed.
--** ^Objects of this type are created by [sqlite3_blob_open()]
--** and destroyed by [sqlite3_blob_close()].
--** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces
--** can be used to read or write small subsections of the BLOB.
--** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes.
--
-- skipped empty struct sqlite3_blob
--** CAPI3REF: Open A BLOB For Incremental I/O
--**
--** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located
--** in row iRow, column zColumn, table zTable in database zDb;
--** in other words, the same BLOB that would be selected by:
--**
--** <pre>
--** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
--** </pre>)^
--**
--** ^If the flags parameter is non-zero, then the BLOB is opened for read
--** and write access. ^If it is zero, the BLOB is opened for read access.
--** ^It is not possible to open a column that is part of an index or primary
--** key for writing. ^If [foreign key constraints] are enabled, it is
--** not possible to open a column that is part of a [child key] for writing.
--**
--** ^Note that the database name is not the filename that contains
--** the database but rather the symbolic name of the database that
--** appears after the AS keyword when the database is connected using [ATTACH].
--** ^For the main database file, the database name is "main".
--** ^For TEMP tables, the database name is "temp".
--**
--** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is written
--** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set
--** to be a null pointer.)^
--** ^This function sets the [database connection] error code and message
--** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related
--** functions. ^Note that the *ppBlob variable is always initialized in a
--** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob
--** regardless of the success or failure of this routine.
--**
--** ^(If the row that a BLOB handle points to is modified by an
--** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
--** then the BLOB handle is marked as "expired".
--** This is true if any column of the row is changed, even a column
--** other than the one the BLOB handle is open on.)^
--** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for
--** a expired BLOB handle fail with an return code of [SQLITE_ABORT].
--** ^(Changes written into a BLOB prior to the BLOB expiring are not
--** rolled back by the expiration of the BLOB. Such changes will eventually
--** commit if the transaction continues to completion.)^
--**
--** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
--** the opened blob. ^The size of a blob may not be changed by this
--** interface. Use the [UPDATE] SQL command to change the size of a
--** blob.
--**
--** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
--** and the built-in [zeroblob] SQL function can be used, if desired,
--** to create an empty, zero-filled blob in which to read or write using
--** this interface.
--**
--** To avoid a resource leak, every open [BLOB handle] should eventually
--** be released by a call to [sqlite3_blob_close()].
--
function sqlite3_blob_open
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : Interfaces.C.Strings.chars_ptr;
arg5 : sqlite3_int64;
arg6 : int;
arg7 : System.Address) return int; -- /usr/include/sqlite3.h:4461:16
pragma Import (C, sqlite3_blob_open, "sqlite3_blob_open");
--** CAPI3REF: Close A BLOB Handle
--**
--** ^Closes an open [BLOB handle].
--**
--** ^Closing a BLOB shall cause the current transaction to commit
--** if there are no other BLOBs, no pending prepared statements, and the
--** database connection is in [autocommit mode].
--** ^If any writes were made to the BLOB, they might be held in cache
--** until the close operation if they will fit.
--**
--** ^(Closing the BLOB often forces the changes
--** out to disk and so if any I/O errors occur, they will likely occur
--** at the time when the BLOB is closed. Any errors that occur during
--** closing are reported as a non-zero return value.)^
--**
--** ^(The BLOB is closed unconditionally. Even if this routine returns
--** an error code, the BLOB is still closed.)^
--**
--** ^Calling this routine with a null pointer (such as would be returned
--** by a failed call to [sqlite3_blob_open()]) is a harmless no-op.
--
function sqlite3_blob_close (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:4493:16
pragma Import (C, sqlite3_blob_close, "sqlite3_blob_close");
--** CAPI3REF: Return The Size Of An Open BLOB
--**
--** ^Returns the size in bytes of the BLOB accessible via the
--** successfully opened [BLOB handle] in its only argument. ^The
--** incremental blob I/O routines can only read or overwriting existing
--** blob content; they cannot change the size of a blob.
--**
--** This routine only works on a [BLOB handle] which has been created
--** by a prior successful call to [sqlite3_blob_open()] and which has not
--** been closed by [sqlite3_blob_close()]. Passing any other pointer in
--** to this routine results in undefined and probably undesirable behavior.
--
function sqlite3_blob_bytes (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:4508:16
pragma Import (C, sqlite3_blob_bytes, "sqlite3_blob_bytes");
--** CAPI3REF: Read Data From A BLOB Incrementally
--**
--** ^(This function is used to read data from an open [BLOB handle] into a
--** caller-supplied buffer. N bytes of data are copied into buffer Z
--** from the open BLOB, starting at offset iOffset.)^
--**
--** ^If offset iOffset is less than N bytes from the end of the BLOB,
--** [SQLITE_ERROR] is returned and no data is read. ^If N or iOffset is
--** less than zero, [SQLITE_ERROR] is returned and no data is read.
--** ^The size of the blob (and hence the maximum value of N+iOffset)
--** can be determined using the [sqlite3_blob_bytes()] interface.
--**
--** ^An attempt to read from an expired [BLOB handle] fails with an
--** error code of [SQLITE_ABORT].
--**
--** ^(On success, sqlite3_blob_read() returns SQLITE_OK.
--** Otherwise, an [error code] or an [extended error code] is returned.)^
--**
--** This routine only works on a [BLOB handle] which has been created
--** by a prior successful call to [sqlite3_blob_open()] and which has not
--** been closed by [sqlite3_blob_close()]. Passing any other pointer in
--** to this routine results in undefined and probably undesirable behavior.
--**
--** See also: [sqlite3_blob_write()].
--
function sqlite3_blob_read
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int;
arg4 : int) return int; -- /usr/include/sqlite3.h:4536:16
pragma Import (C, sqlite3_blob_read, "sqlite3_blob_read");
--** CAPI3REF: Write Data Into A BLOB Incrementally
--**
--** ^This function is used to write data into an open [BLOB handle] from a
--** caller-supplied buffer. ^N bytes of data are copied from the buffer Z
--** into the open BLOB, starting at offset iOffset.
--**
--** ^If the [BLOB handle] passed as the first argument was not opened for
--** writing (the flags parameter to [sqlite3_blob_open()] was zero),
--** this function returns [SQLITE_READONLY].
--**
--** ^This function may only modify the contents of the BLOB; it is
--** not possible to increase the size of a BLOB using this API.
--** ^If offset iOffset is less than N bytes from the end of the BLOB,
--** [SQLITE_ERROR] is returned and no data is written. ^If N is
--** less than zero [SQLITE_ERROR] is returned and no data is written.
--** The size of the BLOB (and hence the maximum value of N+iOffset)
--** can be determined using the [sqlite3_blob_bytes()] interface.
--**
--** ^An attempt to write to an expired [BLOB handle] fails with an
--** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred
--** before the [BLOB handle] expired are not rolled back by the
--** expiration of the handle, though of course those changes might
--** have been overwritten by the statement that expired the BLOB handle
--** or by other independent statements.
--**
--** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
--** Otherwise, an [error code] or an [extended error code] is returned.)^
--**
--** This routine only works on a [BLOB handle] which has been created
--** by a prior successful call to [sqlite3_blob_open()] and which has not
--** been closed by [sqlite3_blob_close()]. Passing any other pointer in
--** to this routine results in undefined and probably undesirable behavior.
--**
--** See also: [sqlite3_blob_read()].
--
function sqlite3_blob_write
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int;
arg4 : int) return int; -- /usr/include/sqlite3.h:4574:16
pragma Import (C, sqlite3_blob_write, "sqlite3_blob_write");
--** CAPI3REF: Virtual File System Objects
--**
--** A virtual filesystem (VFS) is an [sqlite3_vfs] object
--** that SQLite uses to interact
--** with the underlying operating system. Most SQLite builds come with a
--** single default VFS that is appropriate for the host computer.
--** New VFSes can be registered and existing VFSes can be unregistered.
--** The following interfaces are provided.
--**
--** ^The sqlite3_vfs_find() interface returns a pointer to a VFS given its name.
--** ^Names are case sensitive.
--** ^Names are zero-terminated UTF-8 strings.
--** ^If there is no match, a NULL pointer is returned.
--** ^If zVfsName is NULL then the default VFS is returned.
--**
--** ^New VFSes are registered with sqlite3_vfs_register().
--** ^Each new VFS becomes the default VFS if the makeDflt flag is set.
--** ^The same VFS can be registered multiple times without injury.
--** ^To make an existing VFS into the default VFS, register it again
--** with the makeDflt flag set. If two different VFSes with the
--** same name are registered, the behavior is undefined. If a
--** VFS is registered with a name that is NULL or an empty string,
--** then the behavior is undefined.
--**
--** ^Unregister a VFS with the sqlite3_vfs_unregister() interface.
--** ^(If the default VFS is unregistered, another VFS is chosen as
--** the default. The choice for the new VFS is arbitrary.)^
--
function sqlite3_vfs_find (arg1 : Interfaces.C.Strings.chars_ptr) return access sqlite3_vfs; -- /usr/include/sqlite3.h:4605:25
pragma Import (C, sqlite3_vfs_find, "sqlite3_vfs_find");
function sqlite3_vfs_register (arg1 : access sqlite3_vfs; arg2 : int) return int; -- /usr/include/sqlite3.h:4606:16
pragma Import (C, sqlite3_vfs_register, "sqlite3_vfs_register");
function sqlite3_vfs_unregister (arg1 : access sqlite3_vfs) return int; -- /usr/include/sqlite3.h:4607:16
pragma Import (C, sqlite3_vfs_unregister, "sqlite3_vfs_unregister");
--** CAPI3REF: Mutexes
--**
--** The SQLite core uses these routines for thread
--** synchronization. Though they are intended for internal
--** use by SQLite, code that links against SQLite is
--** permitted to use any of these routines.
--**
--** The SQLite source code contains multiple implementations
--** of these mutex routines. An appropriate implementation
--** is selected automatically at compile-time. ^(The following
--** implementations are available in the SQLite core:
--**
--** <ul>
--** <li> SQLITE_MUTEX_OS2
--** <li> SQLITE_MUTEX_PTHREAD
--** <li> SQLITE_MUTEX_W32
--** <li> SQLITE_MUTEX_NOOP
--** </ul>)^
--**
--** ^The SQLITE_MUTEX_NOOP implementation is a set of routines
--** that does no real locking and is appropriate for use in
--** a single-threaded application. ^The SQLITE_MUTEX_OS2,
--** SQLITE_MUTEX_PTHREAD, and SQLITE_MUTEX_W32 implementations
--** are appropriate for use on OS/2, Unix, and Windows.
--**
--** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
--** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
--** implementation is included with the library. In this case the
--** application must supply a custom mutex implementation using the
--** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
--** before calling sqlite3_initialize() or any other public sqlite3_
--** function that calls sqlite3_initialize().)^
--**
--** ^The sqlite3_mutex_alloc() routine allocates a new
--** mutex and returns a pointer to it. ^If it returns NULL
--** that means that a mutex could not be allocated. ^SQLite
--** will unwind its stack and return an error. ^(The argument
--** to sqlite3_mutex_alloc() is one of these integer constants:
--**
--** <ul>
--** <li> SQLITE_MUTEX_FAST
--** <li> SQLITE_MUTEX_RECURSIVE
--** <li> SQLITE_MUTEX_STATIC_MASTER
--** <li> SQLITE_MUTEX_STATIC_MEM
--** <li> SQLITE_MUTEX_STATIC_MEM2
--** <li> SQLITE_MUTEX_STATIC_PRNG
--** <li> SQLITE_MUTEX_STATIC_LRU
--** <li> SQLITE_MUTEX_STATIC_LRU2
--** </ul>)^
--**
--** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)
--** cause sqlite3_mutex_alloc() to create
--** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
--** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
--** The mutex implementation does not need to make a distinction
--** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
--** not want to. ^SQLite will only request a recursive mutex in
--** cases where it really needs one. ^If a faster non-recursive mutex
--** implementation is available on the host platform, the mutex subsystem
--** might return such a mutex in response to SQLITE_MUTEX_FAST.
--**
--** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other
--** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return
--** a pointer to a static preexisting mutex. ^Six static mutexes are
--** used by the current version of SQLite. Future versions of SQLite
--** may add additional static mutexes. Static mutexes are for internal
--** use by SQLite only. Applications that use SQLite mutexes should
--** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
--** SQLITE_MUTEX_RECURSIVE.
--**
--** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
--** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
--** returns a different mutex on every call. ^But for the static
--** mutex types, the same mutex is returned on every call that has
--** the same type number.
--**
--** ^The sqlite3_mutex_free() routine deallocates a previously
--** allocated dynamic mutex. ^SQLite is careful to deallocate every
--** dynamic mutex that it allocates. The dynamic mutexes must not be in
--** use when they are deallocated. Attempting to deallocate a static
--** mutex results in undefined behavior. ^SQLite never deallocates
--** a static mutex.
--**
--** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
--** to enter a mutex. ^If another thread is already within the mutex,
--** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
--** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK]
--** upon successful entry. ^(Mutexes created using
--** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
--** In such cases the,
--** mutex must be exited an equal number of times before another thread
--** can enter.)^ ^(If the same thread tries to enter any other
--** kind of mutex more than once, the behavior is undefined.
--** SQLite will never exhibit
--** such behavior in its own use of mutexes.)^
--**
--** ^(Some systems (for example, Windows 95) do not support the operation
--** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
--** will always return SQLITE_BUSY. The SQLite core only ever uses
--** sqlite3_mutex_try() as an optimization so this is acceptable behavior.)^
--**
--** ^The sqlite3_mutex_leave() routine exits a mutex that was
--** previously entered by the same thread. ^(The behavior
--** is undefined if the mutex is not currently entered by the
--** calling thread or is not currently allocated. SQLite will
--** never do either.)^
--**
--** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
--** sqlite3_mutex_leave() is a NULL pointer, then all three routines
--** behave as no-ops.
--**
--** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
--
function sqlite3_mutex_alloc (arg1 : int) return System.Address; -- /usr/include/sqlite3.h:4723:27
pragma Import (C, sqlite3_mutex_alloc, "sqlite3_mutex_alloc");
procedure sqlite3_mutex_free (arg1 : System.Address); -- /usr/include/sqlite3.h:4724:17
pragma Import (C, sqlite3_mutex_free, "sqlite3_mutex_free");
procedure sqlite3_mutex_enter (arg1 : System.Address); -- /usr/include/sqlite3.h:4725:17
pragma Import (C, sqlite3_mutex_enter, "sqlite3_mutex_enter");
function sqlite3_mutex_try (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:4726:16
pragma Import (C, sqlite3_mutex_try, "sqlite3_mutex_try");
procedure sqlite3_mutex_leave (arg1 : System.Address); -- /usr/include/sqlite3.h:4727:17
pragma Import (C, sqlite3_mutex_leave, "sqlite3_mutex_leave");
--** CAPI3REF: Mutex Methods Object
--** EXPERIMENTAL
--**
--** An instance of this structure defines the low-level routines
--** used to allocate and use mutexes.
--**
--** Usually, the default mutex implementations provided by SQLite are
--** sufficient, however the user has the option of substituting a custom
--** implementation for specialized deployments or systems for which SQLite
--** does not provide a suitable implementation. In this case, the user
--** creates and populates an instance of this structure to pass
--** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
--** Additionally, an instance of this structure can be used as an
--** output variable when querying the system for the current mutex
--** implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
--**
--** ^The xMutexInit method defined by this structure is invoked as
--** part of system initialization by the sqlite3_initialize() function.
--** ^The xMutexInit routine is calle by SQLite exactly once for each
--** effective call to [sqlite3_initialize()].
--**
--** ^The xMutexEnd method defined by this structure is invoked as
--** part of system shutdown by the sqlite3_shutdown() function. The
--** implementation of this method is expected to release all outstanding
--** resources obtained by the mutex methods implementation, especially
--** those obtained by the xMutexInit method. ^The xMutexEnd()
--** interface is invoked exactly once for each call to [sqlite3_shutdown()].
--**
--** ^(The remaining seven methods defined by this structure (xMutexAlloc,
--** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and
--** xMutexNotheld) implement the following interfaces (respectively):
--**
--** <ul>
--** <li> [sqlite3_mutex_alloc()] </li>
--** <li> [sqlite3_mutex_free()] </li>
--** <li> [sqlite3_mutex_enter()] </li>
--** <li> [sqlite3_mutex_try()] </li>
--** <li> [sqlite3_mutex_leave()] </li>
--** <li> [sqlite3_mutex_held()] </li>
--** <li> [sqlite3_mutex_notheld()] </li>
--** </ul>)^
--**
--** The only difference is that the public sqlite3_XXX functions enumerated
--** above silently ignore any invocations that pass a NULL pointer instead
--** of a valid mutex handle. The implementations of the methods defined
--** by this structure are not required to handle this case, the results
--** of passing a NULL pointer instead of a valid mutex handle are undefined
--** (i.e. it is acceptable to provide an implementation that segfaults if
--** it is passed a NULL pointer).
--**
--** The xMutexInit() method must be threadsafe. ^It must be harmless to
--** invoke xMutexInit() mutiple times within the same process and without
--** intervening calls to xMutexEnd(). Second and subsequent calls to
--** xMutexInit() must be no-ops.
--**
--** ^xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
--** and its associates). ^Similarly, xMutexAlloc() must not use SQLite memory
--** allocation for a static mutex. ^However xMutexAlloc() may use SQLite
--** memory allocation for a fast or recursive mutex.
--**
--** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
--** called, but only if the prior call to xMutexInit returned SQLITE_OK.
--** If xMutexInit fails in any way, it is expected to clean up after itself
--** prior to returning.
--
type sqlite3_mutex_methods is record
xMutexInit : access function return int; -- /usr/include/sqlite3.h:4797:9
xMutexEnd : access function return int; -- /usr/include/sqlite3.h:4798:9
xMutexAlloc : access function (arg1 : int) return System.Address; -- /usr/include/sqlite3.h:4799:20
xMutexFree : access procedure (arg1 : System.Address); -- /usr/include/sqlite3.h:4800:10
xMutexEnter : access procedure (arg1 : System.Address); -- /usr/include/sqlite3.h:4801:10
xMutexTry : access function (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:4802:9
xMutexLeave : access procedure (arg1 : System.Address); -- /usr/include/sqlite3.h:4803:10
xMutexHeld : access function (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:4804:9
xMutexNotheld : access function (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:4805:9
end record;
pragma Convention (C, sqlite3_mutex_methods); -- /usr/include/sqlite3.h:4795:16
--** CAPI3REF: Mutex Verification Routines
--**
--** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
--** are intended for use inside assert() statements. ^The SQLite core
--** never uses these routines except inside an assert() and applications
--** are advised to follow the lead of the core. ^The SQLite core only
--** provides implementations for these routines when it is compiled
--** with the SQLITE_DEBUG flag. ^External mutex implementations
--** are only required to provide these routines if SQLITE_DEBUG is
--** defined and if NDEBUG is not defined.
--**
--** ^These routines should return true if the mutex in their argument
--** is held or not held, respectively, by the calling thread.
--**
--** ^The implementation is not required to provided versions of these
--** routines that actually work. If the implementation does not provide working
--** versions of these routines, it should at least provide stubs that always
--** return true so that one does not get spurious assertion failures.
--**
--** ^If the argument to sqlite3_mutex_held() is a NULL pointer then
--** the routine should return 1. This seems counter-intuitive since
--** clearly the mutex cannot be held if it does not exist. But the
--** the reason the mutex does not exist is because the build is not
--** using mutexes. And we do not want the assert() containing the
--** call to sqlite3_mutex_held() to fail, so a non-zero return is
--** the appropriate thing to do. ^The sqlite3_mutex_notheld()
--** interface should also return 1 when given a NULL pointer.
--
function sqlite3_mutex_held (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:4838:16
pragma Import (C, sqlite3_mutex_held, "sqlite3_mutex_held");
function sqlite3_mutex_notheld (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:4839:16
pragma Import (C, sqlite3_mutex_notheld, "sqlite3_mutex_notheld");
--** CAPI3REF: Mutex Types
--**
--** The [sqlite3_mutex_alloc()] interface takes a single argument
--** which is one of these integer constants.
--**
--** The set of static mutexes may change from one SQLite release to the
--** next. Applications that override the built-in mutex logic must be
--** prepared to accommodate additional static mutexes.
--
--** CAPI3REF: Retrieve the mutex for a database connection
--**
--** ^This interface returns a pointer the [sqlite3_mutex] object that
--** serializes access to the [database connection] given in the argument
--** when the [threading mode] is Serialized.
--** ^If the [threading mode] is Single-thread or Multi-thread then this
--** routine returns a NULL pointer.
--
function sqlite3_db_mutex (arg1 : System.Address) return System.Address; -- /usr/include/sqlite3.h:4871:27
pragma Import (C, sqlite3_db_mutex, "sqlite3_db_mutex");
--** CAPI3REF: Low-Level Control Of Database Files
--**
--** ^The [sqlite3_file_control()] interface makes a direct call to the
--** xFileControl method for the [sqlite3_io_methods] object associated
--** with a particular database identified by the second argument. ^The
--** name of the database "main" for the main database or "temp" for the
--** TEMP database, or the name that appears after the AS keyword for
--** databases that are added using the [ATTACH] SQL command.
--** ^A NULL pointer can be used in place of "main" to refer to the
--** main database file.
--** ^The third and fourth parameters to this routine
--** are passed directly through to the second and third parameters of
--** the xFileControl method. ^The return value of the xFileControl
--** method becomes the return value of this routine.
--**
--** ^If the second parameter (zDbName) does not match the name of any
--** open database file, then SQLITE_ERROR is returned. ^This error
--** code is not remembered and will not be recalled by [sqlite3_errcode()]
--** or [sqlite3_errmsg()]. The underlying xFileControl method might
--** also return SQLITE_ERROR. There is no way to distinguish between
--** an incorrect zDbName and an SQLITE_ERROR return from the underlying
--** xFileControl method.
--**
--** See also: [SQLITE_FCNTL_LOCKSTATE]
--
function sqlite3_file_control
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : int;
arg4 : System.Address) return int; -- /usr/include/sqlite3.h:4899:16
pragma Import (C, sqlite3_file_control, "sqlite3_file_control");
--** CAPI3REF: Testing Interface
--**
--** ^The sqlite3_test_control() interface is used to read out internal
--** state of SQLite and to inject faults into SQLite for testing
--** purposes. ^The first parameter is an operation code that determines
--** the number, meaning, and operation of all subsequent parameters.
--**
--** This interface is not for use by applications. It exists solely
--** for verifying the correct operation of the SQLite library. Depending
--** on how the SQLite library is compiled, this interface might not exist.
--**
--** The details of the operation codes, their meanings, the parameters
--** they take, and what they do are all subject to change without notice.
--** Unlike most of the SQLite API, this function is not guaranteed to
--** operate consistently from one release to the next.
--
function sqlite3_test_control (arg1 : int -- , ...
) return int; -- /usr/include/sqlite3.h:4918:16
pragma Import (C, sqlite3_test_control, "sqlite3_test_control");
--** CAPI3REF: Testing Interface Operation Codes
--**
--** These constants are the valid operation code parameters used
--** as the first argument to [sqlite3_test_control()].
--**
--** These parameters and their meanings are subject to change
--** without notice. These values are for testing purposes only.
--** Applications should not use any of these parameters or the
--** [sqlite3_test_control()] interface.
--
--** CAPI3REF: SQLite Runtime Status
--** EXPERIMENTAL
--**
--** ^This interface is used to retrieve runtime status information
--** about the preformance of SQLite, and optionally to reset various
--** highwater marks. ^The first argument is an integer code for
--** the specific parameter to measure. ^(Recognized integer codes
--** are of the form [SQLITE_STATUS_MEMORY_USED | SQLITE_STATUS_...].)^
--** ^The current value of the parameter is returned into *pCurrent.
--** ^The highest recorded value is returned in *pHighwater. ^If the
--** resetFlag is true, then the highest record value is reset after
--** *pHighwater is written. ^(Some parameters do not record the highest
--** value. For those parameters
--** nothing is written into *pHighwater and the resetFlag is ignored.)^
--** ^(Other parameters record only the highwater mark and not the current
--** value. For these latter parameters nothing is written into *pCurrent.)^
--**
--** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
--** non-zero [error code] on failure.
--**
--** This routine is threadsafe but is not atomic. This routine can be
--** called while other threads are running the same or different SQLite
--** interfaces. However the values returned in *pCurrent and
--** *pHighwater reflect the status of SQLite at different points in time
--** and it is possible that another thread might change the parameter
--** in between the times when *pCurrent and *pHighwater are written.
--**
--** See also: [sqlite3_db_status()]
--
function sqlite3_status
(arg1 : int;
arg2 : access int;
arg3 : access int;
arg4 : int) return int; -- /usr/include/sqlite3.h:4976:36
pragma Import (C, sqlite3_status, "sqlite3_status");
--** CAPI3REF: Status Parameters
--** EXPERIMENTAL
--**
--** These integer constants designate various run-time status parameters
--** that can be returned by [sqlite3_status()].
--**
--** <dl>
--** ^(<dt>SQLITE_STATUS_MEMORY_USED</dt>
--** <dd>This parameter is the current amount of memory checked out
--** using [sqlite3_malloc()], either directly or indirectly. The
--** figure includes calls made to [sqlite3_malloc()] by the application
--** and internal memory usage by the SQLite library. Scratch memory
--** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache
--** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in
--** this parameter. The amount returned is the sum of the allocation
--** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>)^
--**
--** ^(<dt>SQLITE_STATUS_MALLOC_SIZE</dt>
--** <dd>This parameter records the largest memory allocation request
--** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their
--** internal equivalents). Only the value returned in the
--** *pHighwater parameter to [sqlite3_status()] is of interest.
--** The value written into the *pCurrent parameter is undefined.</dd>)^
--**
--** ^(<dt>SQLITE_STATUS_PAGECACHE_USED</dt>
--** <dd>This parameter returns the number of pages used out of the
--** [pagecache memory allocator] that was configured using
--** [SQLITE_CONFIG_PAGECACHE]. The
--** value returned is in pages, not in bytes.</dd>)^
--**
--** ^(<dt>SQLITE_STATUS_PAGECACHE_OVERFLOW</dt>
--** <dd>This parameter returns the number of bytes of page cache
--** allocation which could not be statisfied by the [SQLITE_CONFIG_PAGECACHE]
--** buffer and where forced to overflow to [sqlite3_malloc()]. The
--** returned value includes allocations that overflowed because they
--** where too large (they were larger than the "sz" parameter to
--** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
--** no space was left in the page cache.</dd>)^
--**
--** ^(<dt>SQLITE_STATUS_PAGECACHE_SIZE</dt>
--** <dd>This parameter records the largest memory allocation request
--** handed to [pagecache memory allocator]. Only the value returned in the
--** *pHighwater parameter to [sqlite3_status()] is of interest.
--** The value written into the *pCurrent parameter is undefined.</dd>)^
--**
--** ^(<dt>SQLITE_STATUS_SCRATCH_USED</dt>
--** <dd>This parameter returns the number of allocations used out of the
--** [scratch memory allocator] configured using
--** [SQLITE_CONFIG_SCRATCH]. The value returned is in allocations, not
--** in bytes. Since a single thread may only have one scratch allocation
--** outstanding at time, this parameter also reports the number of threads
--** using scratch memory at the same time.</dd>)^
--**
--** ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt>
--** <dd>This parameter returns the number of bytes of scratch memory
--** allocation which could not be statisfied by the [SQLITE_CONFIG_SCRATCH]
--** buffer and where forced to overflow to [sqlite3_malloc()]. The values
--** returned include overflows because the requested allocation was too
--** larger (that is, because the requested allocation was larger than the
--** "sz" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer
--** slots were available.
--** </dd>)^
--**
--** ^(<dt>SQLITE_STATUS_SCRATCH_SIZE</dt>
--** <dd>This parameter records the largest memory allocation request
--** handed to [scratch memory allocator]. Only the value returned in the
--** *pHighwater parameter to [sqlite3_status()] is of interest.
--** The value written into the *pCurrent parameter is undefined.</dd>)^
--**
--** ^(<dt>SQLITE_STATUS_PARSER_STACK</dt>
--** <dd>This parameter records the deepest parser stack. It is only
--** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].</dd>)^
--** </dl>
--**
--** New status parameters may be added from time to time.
--
--** CAPI3REF: Database Connection Status
--** EXPERIMENTAL
--**
--** ^This interface is used to retrieve runtime status information
--** about a single [database connection]. ^The first argument is the
--** database connection object to be interrogated. ^The second argument
--** is the parameter to interrogate. ^Currently, the only allowed value
--** for the second parameter is [SQLITE_DBSTATUS_LOOKASIDE_USED].
--** Additional options will likely appear in future releases of SQLite.
--**
--** ^The current value of the requested parameter is written into *pCur
--** and the highest instantaneous value is written into *pHiwtr. ^If
--** the resetFlg is true, then the highest instantaneous value is
--** reset back down to the current value.
--**
--** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
--
function sqlite3_db_status
(arg1 : System.Address;
arg2 : int;
arg3 : access int;
arg4 : access int;
arg5 : int) return int; -- /usr/include/sqlite3.h:5084:36
pragma Import (C, sqlite3_db_status, "sqlite3_db_status");
--** CAPI3REF: Status Parameters for database connections
--** EXPERIMENTAL
--**
--** These constants are the available integer "verbs" that can be passed as
--** the second argument to the [sqlite3_db_status()] interface.
--**
--** New verbs may be added in future releases of SQLite. Existing verbs
--** might be discontinued. Applications should check the return code from
--** [sqlite3_db_status()] to make sure that the call worked.
--** The [sqlite3_db_status()] interface will return a non-zero error code
--** if a discontinued or unsupported verb is invoked.
--**
--** <dl>
--** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_USED</dt>
--** <dd>This parameter returns the number of lookaside memory slots currently
--** checked out.</dd>)^
--** </dl>
--
--** CAPI3REF: Prepared Statement Status
--** EXPERIMENTAL
--**
--** ^(Each prepared statement maintains various
--** [SQLITE_STMTSTATUS_SORT | counters] that measure the number
--** of times it has performed specific operations.)^ These counters can
--** be used to monitor the performance characteristics of the prepared
--** statements. For example, if the number of table steps greatly exceeds
--** the number of table searches or result rows, that would tend to indicate
--** that the prepared statement is using a full table scan rather than
--** an index.
--**
--** ^(This interface is used to retrieve and reset counter values from
--** a [prepared statement]. The first argument is the prepared statement
--** object to be interrogated. The second argument
--** is an integer code for a specific [SQLITE_STMTSTATUS_SORT | counter]
--** to be interrogated.)^
--** ^The current value of the requested counter is returned.
--** ^If the resetFlg is true, then the counter is reset to zero after this
--** interface call returns.
--**
--** See also: [sqlite3_status()] and [sqlite3_db_status()].
--
function sqlite3_stmt_status
(arg1 : System.Address;
arg2 : int;
arg3 : int) return int; -- /usr/include/sqlite3.h:5132:36
pragma Import (C, sqlite3_stmt_status, "sqlite3_stmt_status");
--** CAPI3REF: Status Parameters for prepared statements
--** EXPERIMENTAL
--**
--** These preprocessor macros define integer codes that name counter
--** values associated with the [sqlite3_stmt_status()] interface.
--** The meanings of the various counters are as follows:
--**
--** <dl>
--** <dt>SQLITE_STMTSTATUS_FULLSCAN_STEP</dt>
--** <dd>^This is the number of times that SQLite has stepped forward in
--** a table as part of a full table scan. Large numbers for this counter
--** may indicate opportunities for performance improvement through
--** careful use of indices.</dd>
--**
--** <dt>SQLITE_STMTSTATUS_SORT</dt>
--** <dd>^This is the number of sort operations that have occurred.
--** A non-zero value in this counter may indicate an opportunity to
--** improvement performance through careful use of indices.</dd>
--**
--** </dl>
--
--** CAPI3REF: Custom Page Cache Object
--** EXPERIMENTAL
--**
--** The sqlite3_pcache type is opaque. It is implemented by
--** the pluggable module. The SQLite core has no knowledge of
--** its size or internal structure and never deals with the
--** sqlite3_pcache object except by holding and passing pointers
--** to the object.
--**
--** See [sqlite3_pcache_methods] for additional information.
--
-- skipped empty struct sqlite3_pcache
--** CAPI3REF: Application Defined Page Cache.
--** KEYWORDS: {page cache}
--** EXPERIMENTAL
--**
--** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE], ...) interface can
--** register an alternative page cache implementation by passing in an
--** instance of the sqlite3_pcache_methods structure.)^ The majority of the
--** heap memory used by SQLite is used by the page cache to cache data read
--** from, or ready to be written to, the database file. By implementing a
--** custom page cache using this API, an application can control more
--** precisely the amount of memory consumed by SQLite, the way in which
--** that memory is allocated and released, and the policies used to
--** determine exactly which parts of a database file are cached and for
--** how long.
--**
--** ^(The contents of the sqlite3_pcache_methods structure are copied to an
--** internal buffer by SQLite within the call to [sqlite3_config]. Hence
--** the application may discard the parameter after the call to
--** [sqlite3_config()] returns.)^
--**
--** ^The xInit() method is called once for each call to [sqlite3_initialize()]
--** (usually only once during the lifetime of the process). ^(The xInit()
--** method is passed a copy of the sqlite3_pcache_methods.pArg value.)^
--** ^The xInit() method can set up up global structures and/or any mutexes
--** required by the custom page cache implementation.
--**
--** ^The xShutdown() method is called from within [sqlite3_shutdown()],
--** if the application invokes this API. It can be used to clean up
--** any outstanding resources before process shutdown, if required.
--**
--** ^SQLite holds a [SQLITE_MUTEX_RECURSIVE] mutex when it invokes
--** the xInit method, so the xInit method need not be threadsafe. ^The
--** xShutdown method is only called from [sqlite3_shutdown()] so it does
--** not need to be threadsafe either. All other methods must be threadsafe
--** in multithreaded applications.
--**
--** ^SQLite will never invoke xInit() more than once without an intervening
--** call to xShutdown().
--**
--** ^The xCreate() method is used to construct a new cache instance. SQLite
--** will typically create one cache instance for each open database file,
--** though this is not guaranteed. ^The
--** first parameter, szPage, is the size in bytes of the pages that must
--** be allocated by the cache. ^szPage will not be a power of two. ^szPage
--** will the page size of the database file that is to be cached plus an
--** increment (here called "R") of about 100 or 200. ^SQLite will use the
--** extra R bytes on each page to store metadata about the underlying
--** database page on disk. The value of R depends
--** on the SQLite version, the target platform, and how SQLite was compiled.
--** ^R is constant for a particular build of SQLite. ^The second argument to
--** xCreate(), bPurgeable, is true if the cache being created will
--** be used to cache database pages of a file stored on disk, or
--** false if it is used for an in-memory database. ^The cache implementation
--** does not have to do anything special based with the value of bPurgeable;
--** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
--** never invoke xUnpin() except to deliberately delete a page.
--** ^In other words, a cache created with bPurgeable set to false will
--** never contain any unpinned pages.
--**
--** ^(The xCachesize() method may be called at any time by SQLite to set the
--** suggested maximum cache-size (number of pages stored by) the cache
--** instance passed as the first argument. This is the value configured using
--** the SQLite "[PRAGMA cache_size]" command.)^ ^As with the bPurgeable
--** parameter, the implementation is not required to do anything with this
--** value; it is advisory only.
--**
--** ^The xPagecount() method should return the number of pages currently
--** stored in the cache.
--**
--** ^The xFetch() method is used to fetch a page and return a pointer to it.
--** ^A 'page', in this context, is a buffer of szPage bytes aligned at an
--** 8-byte boundary. ^The page to be fetched is determined by the key. ^The
--** mimimum key value is 1. After it has been retrieved using xFetch, the page
--** is considered to be "pinned".
--**
--** ^If the requested page is already in the page cache, then the page cache
--** implementation must return a pointer to the page buffer with its content
--** intact. ^(If the requested page is not already in the cache, then the
--** behavior of the cache implementation is determined by the value of the
--** createFlag parameter passed to xFetch, according to the following table:
--**
--** <table border=1 width=85% align=center>
--** <tr><th> createFlag <th> Behaviour when page is not already in cache
--** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
--** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
--** Otherwise return NULL.
--** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
--** NULL if allocating a new page is effectively impossible.
--** </table>)^
--**
--** SQLite will normally invoke xFetch() with a createFlag of 0 or 1. If
--** a call to xFetch() with createFlag==1 returns NULL, then SQLite will
--** attempt to unpin one or more cache pages by spilling the content of
--** pinned pages to disk and synching the operating system disk cache. After
--** attempting to unpin pages, the xFetch() method will be invoked again with
--** a createFlag of 2.
--**
--** ^xUnpin() is called by SQLite with a pointer to a currently pinned page
--** as its second argument. ^(If the third parameter, discard, is non-zero,
--** then the page should be evicted from the cache. In this case SQLite
--** assumes that the next time the page is retrieved from the cache using
--** the xFetch() method, it will be zeroed.)^ ^If the discard parameter is
--** zero, then the page is considered to be unpinned. ^The cache implementation
--** may choose to evict unpinned pages at any time.
--**
--** ^(The cache is not required to perform any reference counting. A single
--** call to xUnpin() unpins the page regardless of the number of prior calls
--** to xFetch().)^
--**
--** ^The xRekey() method is used to change the key value associated with the
--** page passed as the second argument from oldKey to newKey. ^If the cache
--** previously contains an entry associated with newKey, it should be
--** discarded. ^Any prior cache entry associated with newKey is guaranteed not
--** to be pinned.
--**
--** ^When SQLite calls the xTruncate() method, the cache must discard all
--** existing cache entries with page numbers (keys) greater than or equal
--** to the value of the iLimit parameter passed to xTruncate(). ^If any
--** of these pages are pinned, they are implicitly unpinned, meaning that
--** they can be safely discarded.
--**
--** ^The xDestroy() method is used to delete a cache allocated by xCreate().
--** All resources associated with the specified cache should be freed. ^After
--** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*]
--** handle invalid, and will not use it with any other sqlite3_pcache_methods
--** functions.
--
type sqlite3_pcache_methods is record
pArg : System.Address; -- /usr/include/sqlite3.h:5303:9
xInit : access function (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:5304:9
xShutdown : access procedure (arg1 : System.Address); -- /usr/include/sqlite3.h:5305:10
xCreate : access function (arg1 : int; arg2 : int) return System.Address; -- /usr/include/sqlite3.h:5306:21
xCachesize : access procedure (arg1 : System.Address; arg2 : int); -- /usr/include/sqlite3.h:5307:10
xPagecount : access function (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:5308:9
xFetch : access function
(arg1 : System.Address;
arg2 : unsigned;
arg3 : int) return System.Address; -- /usr/include/sqlite3.h:5309:11
xUnpin : access procedure
(arg1 : System.Address;
arg2 : System.Address;
arg3 : int); -- /usr/include/sqlite3.h:5310:10
xRekey : access procedure
(arg1 : System.Address;
arg2 : System.Address;
arg3 : unsigned;
arg4 : unsigned); -- /usr/include/sqlite3.h:5311:10
xTruncate : access procedure (arg1 : System.Address; arg2 : unsigned); -- /usr/include/sqlite3.h:5312:10
xDestroy : access procedure (arg1 : System.Address); -- /usr/include/sqlite3.h:5313:10
end record;
pragma Convention (C, sqlite3_pcache_methods); -- /usr/include/sqlite3.h:5301:16
--** CAPI3REF: Online Backup Object
--** EXPERIMENTAL
--**
--** The sqlite3_backup object records state information about an ongoing
--** online backup operation. ^The sqlite3_backup object is created by
--** a call to [sqlite3_backup_init()] and is destroyed by a call to
--** [sqlite3_backup_finish()].
--**
--** See Also: [Using the SQLite Online Backup API]
--
-- skipped empty struct sqlite3_backup
--** CAPI3REF: Online Backup API.
--** EXPERIMENTAL
--**
--** The backup API copies the content of one database into another.
--** It is useful either for creating backups of databases or
--** for copying in-memory databases to or from persistent files.
--**
--** See Also: [Using the SQLite Online Backup API]
--**
--** ^Exclusive access is required to the destination database for the
--** duration of the operation. ^However the source database is only
--** read-locked while it is actually being read; it is not locked
--** continuously for the entire backup operation. ^Thus, the backup may be
--** performed on a live source database without preventing other users from
--** reading or writing to the source database while the backup is underway.
--**
--** ^(To perform a backup operation:
--** <ol>
--** <li><b>sqlite3_backup_init()</b> is called once to initialize the
--** backup,
--** <li><b>sqlite3_backup_step()</b> is called one or more times to transfer
--** the data between the two databases, and finally
--** <li><b>sqlite3_backup_finish()</b> is called to release all resources
--** associated with the backup operation.
--** </ol>)^
--** There should be exactly one call to sqlite3_backup_finish() for each
--** successful call to sqlite3_backup_init().
--**
--** <b>sqlite3_backup_init()</b>
--**
--** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the
--** [database connection] associated with the destination database
--** and the database name, respectively.
--** ^The database name is "main" for the main database, "temp" for the
--** temporary database, or the name specified after the AS keyword in
--** an [ATTACH] statement for an attached database.
--** ^The S and M arguments passed to
--** sqlite3_backup_init(D,N,S,M) identify the [database connection]
--** and database name of the source database, respectively.
--** ^The source and destination [database connections] (parameters S and D)
--** must be different or else sqlite3_backup_init(D,N,S,M) will file with
--** an error.
--**
--** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
--** returned and an error code and error message are store3d in the
--** destination [database connection] D.
--** ^The error code and message for the failed call to sqlite3_backup_init()
--** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or
--** [sqlite3_errmsg16()] functions.
--** ^A successful call to sqlite3_backup_init() returns a pointer to an
--** [sqlite3_backup] object.
--** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and
--** sqlite3_backup_finish() functions to perform the specified backup
--** operation.
--**
--** <b>sqlite3_backup_step()</b>
--**
--** ^Function sqlite3_backup_step(B,N) will copy up to N pages between
--** the source and destination databases specified by [sqlite3_backup] object B.
--** ^If N is negative, all remaining source pages are copied.
--** ^If sqlite3_backup_step(B,N) successfully copies N pages and there
--** are still more pages to be copied, then the function resturns [SQLITE_OK].
--** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages
--** from source to destination, then it returns [SQLITE_DONE].
--** ^If an error occurs while running sqlite3_backup_step(B,N),
--** then an [error code] is returned. ^As well as [SQLITE_OK] and
--** [SQLITE_DONE], a call to sqlite3_backup_step() may return [SQLITE_READONLY],
--** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an
--** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code.
--**
--** ^The sqlite3_backup_step() might return [SQLITE_READONLY] if the destination
--** database was opened read-only or if
--** the destination is an in-memory database with a different page size
--** from the source database.
--**
--** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then
--** the [sqlite3_busy_handler | busy-handler function]
--** is invoked (if one is specified). ^If the
--** busy-handler returns non-zero before the lock is available, then
--** [SQLITE_BUSY] is returned to the caller. ^In this case the call to
--** sqlite3_backup_step() can be retried later. ^If the source
--** [database connection]
--** is being used to write to the source database when sqlite3_backup_step()
--** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this
--** case the call to sqlite3_backup_step() can be retried later on. ^(If
--** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or
--** [SQLITE_READONLY] is returned, then
--** there is no point in retrying the call to sqlite3_backup_step(). These
--** errors are considered fatal.)^ The application must accept
--** that the backup operation has failed and pass the backup operation handle
--** to the sqlite3_backup_finish() to release associated resources.
--**
--** ^The first call to sqlite3_backup_step() obtains an exclusive lock
--** on the destination file. ^The exclusive lock is not released until either
--** sqlite3_backup_finish() is called or the backup operation is complete
--** and sqlite3_backup_step() returns [SQLITE_DONE]. ^Every call to
--** sqlite3_backup_step() obtains a [shared lock] on the source database that
--** lasts for the duration of the sqlite3_backup_step() call.
--** ^Because the source database is not locked between calls to
--** sqlite3_backup_step(), the source database may be modified mid-way
--** through the backup process. ^If the source database is modified by an
--** external process or via a database connection other than the one being
--** used by the backup operation, then the backup will be automatically
--** restarted by the next call to sqlite3_backup_step(). ^If the source
--** database is modified by the using the same database connection as is used
--** by the backup operation, then the backup database is automatically
--** updated at the same time.
--**
--** <b>sqlite3_backup_finish()</b>
--**
--** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the
--** application wishes to abandon the backup operation, the application
--** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish().
--** ^The sqlite3_backup_finish() interfaces releases all
--** resources associated with the [sqlite3_backup] object.
--** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any
--** active write-transaction on the destination database is rolled back.
--** The [sqlite3_backup] object is invalid
--** and may not be used following a call to sqlite3_backup_finish().
--**
--** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no
--** sqlite3_backup_step() errors occurred, regardless or whether or not
--** sqlite3_backup_step() completed.
--** ^If an out-of-memory condition or IO error occurred during any prior
--** sqlite3_backup_step() call on the same [sqlite3_backup] object, then
--** sqlite3_backup_finish() returns the corresponding [error code].
--**
--** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step()
--** is not a permanent error and does not affect the return value of
--** sqlite3_backup_finish().
--**
--** <b>sqlite3_backup_remaining(), sqlite3_backup_pagecount()</b>
--**
--** ^Each call to sqlite3_backup_step() sets two values inside
--** the [sqlite3_backup] object: the number of pages still to be backed
--** up and the total number of pages in the source databae file.
--** The sqlite3_backup_remaining() and sqlite3_backup_pagecount() interfaces
--** retrieve these two values, respectively.
--**
--** ^The values returned by these functions are only updated by
--** sqlite3_backup_step(). ^If the source database is modified during a backup
--** operation, then the values are not updated to account for any extra
--** pages that need to be updated or the size of the source database file
--** changing.
--**
--** <b>Concurrent Usage of Database Handles</b>
--**
--** ^The source [database connection] may be used by the application for other
--** purposes while a backup operation is underway or being initialized.
--** ^If SQLite is compiled and configured to support threadsafe database
--** connections, then the source database connection may be used concurrently
--** from within other threads.
--**
--** However, the application must guarantee that the destination
--** [database connection] is not passed to any other API (by any thread) after
--** sqlite3_backup_init() is called and before the corresponding call to
--** sqlite3_backup_finish(). SQLite does not currently check to see
--** if the application incorrectly accesses the destination [database connection]
--** and so no error code is reported, but the operations may malfunction
--** nevertheless. Use of the destination database connection while a
--** backup is in progress might also also cause a mutex deadlock.
--**
--** If running in [shared cache mode], the application must
--** guarantee that the shared cache used by the destination database
--** is not accessed while the backup is running. In practice this means
--** that the application must guarantee that the disk file being
--** backed up to is not accessed by any connection within the process,
--** not just the specific connection that was passed to sqlite3_backup_init().
--**
--** The [sqlite3_backup] object itself is partially threadsafe. Multiple
--** threads may safely make multiple concurrent calls to sqlite3_backup_step().
--** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount()
--** APIs are not strictly speaking threadsafe. If they are invoked at the
--** same time as another thread is invoking sqlite3_backup_step() it is
--** possible that they return invalid values.
--
function sqlite3_backup_init
(arg1 : System.Address;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : System.Address;
arg4 : Interfaces.C.Strings.chars_ptr) return System.Address; -- /usr/include/sqlite3.h:5506:28
pragma Import (C, sqlite3_backup_init, "sqlite3_backup_init");
-- Destination database handle
-- Destination database name
-- Source database handle
-- Source database name
function sqlite3_backup_step (arg1 : System.Address; arg2 : int) return int; -- /usr/include/sqlite3.h:5512:16
pragma Import (C, sqlite3_backup_step, "sqlite3_backup_step");
function sqlite3_backup_finish (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:5513:16
pragma Import (C, sqlite3_backup_finish, "sqlite3_backup_finish");
function sqlite3_backup_remaining (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:5514:16
pragma Import (C, sqlite3_backup_remaining, "sqlite3_backup_remaining");
function sqlite3_backup_pagecount (arg1 : System.Address) return int; -- /usr/include/sqlite3.h:5515:16
pragma Import (C, sqlite3_backup_pagecount, "sqlite3_backup_pagecount");
--** CAPI3REF: Unlock Notification
--** EXPERIMENTAL
--**
--** ^When running in shared-cache mode, a database operation may fail with
--** an [SQLITE_LOCKED] error if the required locks on the shared-cache or
--** individual tables within the shared-cache cannot be obtained. See
--** [SQLite Shared-Cache Mode] for a description of shared-cache locking.
--** ^This API may be used to register a callback that SQLite will invoke
--** when the connection currently holding the required lock relinquishes it.
--** ^This API is only available if the library was compiled with the
--** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined.
--**
--** See Also: [Using the SQLite Unlock Notification Feature].
--**
--** ^Shared-cache locks are released when a database connection concludes
--** its current transaction, either by committing it or rolling it back.
--**
--** ^When a connection (known as the blocked connection) fails to obtain a
--** shared-cache lock and SQLITE_LOCKED is returned to the caller, the
--** identity of the database connection (the blocking connection) that
--** has locked the required resource is stored internally. ^After an
--** application receives an SQLITE_LOCKED error, it may call the
--** sqlite3_unlock_notify() method with the blocked connection handle as
--** the first argument to register for a callback that will be invoked
--** when the blocking connections current transaction is concluded. ^The
--** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
--** call that concludes the blocking connections transaction.
--**
--** ^(If sqlite3_unlock_notify() is called in a multi-threaded application,
--** there is a chance that the blocking connection will have already
--** concluded its transaction by the time sqlite3_unlock_notify() is invoked.
--** If this happens, then the specified callback is invoked immediately,
--** from within the call to sqlite3_unlock_notify().)^
--**
--** ^If the blocked connection is attempting to obtain a write-lock on a
--** shared-cache table, and more than one other connection currently holds
--** a read-lock on the same table, then SQLite arbitrarily selects one of
--** the other connections to use as the blocking connection.
--**
--** ^(There may be at most one unlock-notify callback registered by a
--** blocked connection. If sqlite3_unlock_notify() is called when the
--** blocked connection already has a registered unlock-notify callback,
--** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
--** called with a NULL pointer as its second argument, then any existing
--** unlock-notify callback is cancelled. ^The blocked connections
--** unlock-notify callback may also be canceled by closing the blocked
--** connection using [sqlite3_close()].
--**
--** The unlock-notify callback is not reentrant. If an application invokes
--** any sqlite3_xxx API functions from within an unlock-notify callback, a
--** crash or deadlock may be the result.
--**
--** ^Unless deadlock is detected (see below), sqlite3_unlock_notify() always
--** returns SQLITE_OK.
--**
--** <b>Callback Invocation Details</b>
--**
--** When an unlock-notify callback is registered, the application provides a
--** single void* pointer that is passed to the callback when it is invoked.
--** However, the signature of the callback function allows SQLite to pass
--** it an array of void* context pointers. The first argument passed to
--** an unlock-notify callback is a pointer to an array of void* pointers,
--** and the second is the number of entries in the array.
--**
--** When a blocking connections transaction is concluded, there may be
--** more than one blocked connection that has registered for an unlock-notify
--** callback. ^If two or more such blocked connections have specified the
--** same callback function, then instead of invoking the callback function
--** multiple times, it is invoked once with the set of void* context pointers
--** specified by the blocked connections bundled together into an array.
--** This gives the application an opportunity to prioritize any actions
--** related to the set of unblocked database connections.
--**
--** <b>Deadlock Detection</b>
--**
--** Assuming that after registering for an unlock-notify callback a
--** database waits for the callback to be issued before taking any further
--** action (a reasonable assumption), then using this API may cause the
--** application to deadlock. For example, if connection X is waiting for
--** connection Y's transaction to be concluded, and similarly connection
--** Y is waiting on connection X's transaction, then neither connection
--** will proceed and the system may remain deadlocked indefinitely.
--**
--** To avoid this scenario, the sqlite3_unlock_notify() performs deadlock
--** detection. ^If a given call to sqlite3_unlock_notify() would put the
--** system in a deadlocked state, then SQLITE_LOCKED is returned and no
--** unlock-notify callback is registered. The system is said to be in
--** a deadlocked state if connection A has registered for an unlock-notify
--** callback on the conclusion of connection B's transaction, and connection
--** B has itself registered for an unlock-notify callback when connection
--** A's transaction is concluded. ^Indirect deadlock is also detected, so
--** the system is also considered to be deadlocked if connection B has
--** registered for an unlock-notify callback on the conclusion of connection
--** C's transaction, where connection C is waiting on connection A. ^Any
--** number of levels of indirection are allowed.
--**
--** <b>The "DROP TABLE" Exception</b>
--**
--** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost
--** always appropriate to call sqlite3_unlock_notify(). There is however,
--** one exception. When executing a "DROP TABLE" or "DROP INDEX" statement,
--** SQLite checks if there are any currently executing SELECT statements
--** that belong to the same connection. If there are, SQLITE_LOCKED is
--** returned. In this case there is no "blocking connection", so invoking
--** sqlite3_unlock_notify() results in the unlock-notify callback being
--** invoked immediately. If the application then re-attempts the "DROP TABLE"
--** or "DROP INDEX" query, an infinite loop might be the result.
--**
--** One way around this problem is to check the extended error code returned
--** by an sqlite3_step() call. ^(If there is a blocking connection, then the
--** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in
--** the special "DROP TABLE/INDEX" case, the extended error code is just
--** SQLITE_LOCKED.)^
--
function sqlite3_unlock_notify
(arg1 : System.Address;
arg2 : access procedure (arg1 : System.Address; arg2 : int);
arg3 : System.Address) return int; -- /usr/include/sqlite3.h:5632:16
pragma Import (C, sqlite3_unlock_notify, "sqlite3_unlock_notify");
-- Waiting connection
-- Callback function to invoke
-- Argument to pass to xNotify
--** CAPI3REF: String Comparison
--** EXPERIMENTAL
--**
--** ^The [sqlite3_strnicmp()] API allows applications and extensions to
--** compare the contents of two buffers containing UTF-8 strings in a
--** case-indendent fashion, using the same definition of case independence
--** that SQLite uses internally when comparing identifiers.
--
function sqlite3_strnicmp
(arg1 : Interfaces.C.Strings.chars_ptr;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : int) return int; -- /usr/include/sqlite3.h:5648:16
pragma Import (C, sqlite3_strnicmp, "sqlite3_strnicmp");
--** Undo the hack that converts floating point types to integer for
--** builds on processors without floating point support.
--
-- End of the 'extern "C"' block
end Sqlite3_H;
|
nerilex/ada-util | Ada | 16,540 | adb | -----------------------------------------------------------------------
-- util-encodes-tests - Test for encoding
-- Copyright (C) 2009, 2010, 2011, 2012, 2016 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Test_Caller;
with Util.Measures;
with Util.Strings.Transforms;
with Ada.Text_IO;
with Util.Encoders.SHA1;
with Util.Encoders.HMAC.SHA1;
with Util.Encoders.Base16;
with Util.Encoders.Base64;
package body Util.Encoders.Tests is
use Util.Tests;
procedure Check_HMAC (T : in out Test'Class;
Key : in String;
Value : in String;
Expect : in String);
package Caller is new Util.Test_Caller (Test, "Encoders");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test Util.Encoders.Base16.Encode",
Test_Hex'Access);
Caller.Add_Test (Suite, "Test Util.Encoders.Base16.Decode",
Test_Hex'Access);
Caller.Add_Test (Suite, "Test Util.Encoders.Base64.Encode",
Test_Base64_Encode'Access);
Caller.Add_Test (Suite, "Test Util.Encoders.Base64.Decode",
Test_Base64_Decode'Access);
Caller.Add_Test (Suite, "Test Util.Encoders.Base64.Encode (URL)",
Test_Base64_URL_Encode'Access);
Caller.Add_Test (Suite, "Test Util.Encoders.Base64.Decode (URL)",
Test_Base64_URL_Decode'Access);
Caller.Add_Test (Suite, "Test Util.Encoders.Base64.Benchmark",
Test_Base64_Benchmark'Access);
Caller.Add_Test (Suite, "Test Util.Encoders.SHA1.Encode",
Test_SHA1_Encode'Access);
Caller.Add_Test (Suite, "Test Util.Encoders.SHA1.Benchmark",
Test_SHA1_Benchmark'Access);
Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA1.Sign_SHA1 (RFC2202 test1)",
Test_HMAC_SHA1_RFC2202_T1'Access);
Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA1.Sign_SHA1 (RFC2202 test2)",
Test_HMAC_SHA1_RFC2202_T2'Access);
Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA1.Sign_SHA1 (RFC2202 test3)",
Test_HMAC_SHA1_RFC2202_T3'Access);
Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA1.Sign_SHA1 (RFC2202 test4)",
Test_HMAC_SHA1_RFC2202_T4'Access);
Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA1.Sign_SHA1 (RFC2202 test5)",
Test_HMAC_SHA1_RFC2202_T5'Access);
Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA1.Sign_SHA1 (RFC2202 test6)",
Test_HMAC_SHA1_RFC2202_T6'Access);
Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA1.Sign_SHA1 (RFC2202 test7)",
Test_HMAC_SHA1_RFC2202_T7'Access);
Caller.Add_Test (Suite, "Test Util.Encoders.Encode_LEB128",
Test_LEB128'Access);
Caller.Add_Test (Suite, "Test Util.Encoders.Base64.Encode",
Test_Base64_LEB128'Access);
end Add_Tests;
procedure Test_Base64_Encode (T : in out Test) is
C : constant Util.Encoders.Encoder := Create ("base64");
begin
Assert_Equals (T, "YQ==", Util.Encoders.Encode (C, "a"));
Assert_Equals (T, "fA==", Util.Encoders.Encode (C, "|"));
Assert_Equals (T, "fHw=", Util.Encoders.Encode (C, "||"));
Assert_Equals (T, "fH5+", Util.Encoders.Encode (C, "|~~"));
end Test_Base64_Encode;
procedure Test_Base64_Decode (T : in out Test) is
C : Util.Encoders.Encoder := Create ("base64");
begin
Assert_Equals (T, "a", Util.Encoders.Decode (C, "YQ=="));
Assert_Equals (T, "|", Util.Encoders.Decode (C, "fA=="));
Assert_Equals (T, "||", Util.Encoders.Decode (C, "fHw="));
Assert_Equals (T, "|~~", Util.Encoders.Decode (C, "fH5+"));
Test_Encoder (T, C);
end Test_Base64_Decode;
procedure Test_Base64_URL_Encode (T : in out Test) is
C : constant Util.Encoders.Encoder := Create ("base64url");
begin
Assert_Equals (T, "YQ==", Util.Encoders.Encode (C, "a"));
Assert_Equals (T, "fA==", Util.Encoders.Encode (C, "|"));
Assert_Equals (T, "fHw=", Util.Encoders.Encode (C, "||"));
Assert_Equals (T, "fH5-", Util.Encoders.Encode (C, "|~~"));
Assert_Equals (T, "fH5_", Util.Encoders.Encode (C, "|~" & ASCII.DEL));
end Test_Base64_URL_Encode;
procedure Test_Base64_URL_Decode (T : in out Test) is
C : Util.Encoders.Encoder := Create ("base64url");
begin
Assert_Equals (T, "a", Util.Encoders.Decode (C, "YQ=="));
Assert_Equals (T, "|", Util.Encoders.Decode (C, "fA=="));
Assert_Equals (T, "||", Util.Encoders.Decode (C, "fHw="));
Assert_Equals (T, "|~~", Util.Encoders.Decode (C, "fH5-"));
Assert_Equals (T, "|~" & ASCII.DEL, Util.Encoders.Decode (C, "fH5_"));
Test_Encoder (T, C);
end Test_Base64_URL_Decode;
procedure Test_Encoder (T : in out Test;
C : in out Util.Encoders.Encoder) is
begin
for I in 1 .. 334 loop
declare
Pattern : String (1 .. I);
begin
for J in Pattern'Range loop
Pattern (J) := Character'Val (((J + I) mod 63) + 32);
end loop;
declare
E : constant String := Util.Encoders.Encode (C, Pattern);
D : constant String := Util.Encoders.Decode (C, E);
begin
Assert_Equals (T, Pattern, D, "Encoding failed for length "
& Integer'Image (I) & " code: " & E);
end;
exception
when others =>
Ada.Text_IO.Put_Line ("Error at index " & Integer'Image (I));
raise;
end;
end loop;
end Test_Encoder;
procedure Test_Hex (T : in out Test) is
C : Util.Encoders.Encoder := Create ("hex");
begin
Assert_Equals (T, "41424344", Util.Encoders.Encode (C, "ABCD"));
Assert_Equals (T, "ABCD", Util.Encoders.Decode (C, "41424344"));
Test_Encoder (T, C);
end Test_Hex;
procedure Test_Base64_Benchmark (T : in out Test) is
pragma Unreferenced (T);
C : constant Util.Encoders.Encoder := Create ("base64");
S : constant String (1 .. 1_024) := (others => 'a');
begin
declare
T : Util.Measures.Stamp;
R : constant String := Util.Encoders.Encode (C, S);
pragma Unreferenced (R);
begin
Util.Measures.Report (T, "Base64 encode 1024 bytes");
end;
end Test_Base64_Benchmark;
procedure Test_SHA1_Encode (T : in out Test) is
procedure Check_Hash (Value : in String;
Expect : in String);
C : Util.Encoders.SHA1.Context;
Hash : Util.Encoders.SHA1.Digest;
procedure Check_Hash (Value : in String;
Expect : in String) is
J, N : Natural;
Ctx : Util.Encoders.SHA1.Context;
begin
for I in 1 .. Value'Length loop
J := Value'First;
while J <= Value'Last loop
if J + I <= Value'Last then
N := J + I;
else
N := Value'Last;
end if;
Util.Encoders.SHA1.Update (Ctx, Value (J .. N));
J := N + 1;
end loop;
Util.Encoders.SHA1.Finish (Ctx, Hash);
Assert_Equals (T, Expect, Hash, "Invalid hash for: " & Value);
end loop;
end Check_Hash;
Hex_Decoder : Util.Encoders.Base16.Decoder;
Last : Ada.Streams.Stream_Element_Offset;
Sign : Util.Encoders.SHA1.Hash_Array;
begin
Util.Encoders.SHA1.Update (C, "a");
Util.Encoders.SHA1.Finish (C, Hash);
Assert_Equals (T, "86F7E437FAA5A7FCE15D1DDCB9EAEAEA377667B8", Hash,
"Invalid hash for 'a'");
Check_Hash ("ut", "E746699D3947443D84DAD1E0C58BF7AD34712438");
Check_Hash ("Uti", "2C669751BDC4929377245F5EEBEAED1CE4DA8A45");
Check_Hash ("Util", "4C31156EFED35EE7814650F8971C3698059440E3");
Check_Hash ("Util.Encoders", "7DB6007AD8BAEA7C167FF2AE06C9F50A4645F971");
Check_Hash ("e746699d3947443d84dad1e0c58bf7ad347124382C669751BDC492937"
& "7245F5EEBEAED1CE4DA8A45",
"875C9C0DE4CE91ED8F432DD02B5BB40CD35DAACD");
Util.Encoders.Transform (E => Hex_Decoder,
Data => "D803BA2155CD12D8997117E0846AD2D4555BEB28",
Into => Sign,
Last => Last);
Assert_Equals (T, Natural (Sign'Last), Natural (Last), "Decoding SHA1 failed");
Util.Encoders.Transform (E => Hex_Decoder,
Data => "D803BA2155CD12D8997117E0846AD2D4555BEB",
Into => Sign,
Last => Last);
Assert_Equals (T, Natural (Sign'Last) - 1, Natural (Last), "Decoding SHA1 failed");
begin
Util.Encoders.Transform (E => Hex_Decoder,
Data => "D803BA2155CD12D8997117E0846AD2D4555BEB2801",
Into => Sign,
Last => Last);
Fail (T, "No Encoding_Error exception raised");
exception
when Encoding_Error =>
null;
end;
end Test_SHA1_Encode;
-- ------------------------------
-- Benchmark test for SHA1
-- ------------------------------
procedure Test_SHA1_Benchmark (T : in out Test) is
pragma Unreferenced (T);
Hash : Util.Encoders.SHA1.Digest;
Sizes : constant array (1 .. 6) of Positive := (1, 10, 100, 1000, 10000, 100000);
begin
for I in Sizes'Range loop
declare
Size : constant Positive := Sizes (I);
S : constant String (1 .. Size) := (others => '0');
T1 : Util.Measures.Stamp;
C : Util.Encoders.SHA1.Context;
begin
Util.Encoders.SHA1.Update (C, S);
Util.Encoders.SHA1.Finish (C, Hash);
Util.Measures.Report (T1, "Encode SHA1" & Integer'Image (Size) & " bytes");
end;
end loop;
end Test_SHA1_Benchmark;
procedure Check_HMAC (T : in out Test'Class;
Key : in String;
Value : in String;
Expect : in String) is
H : constant String := Util.Encoders.HMAC.SHA1.Sign (Key, Value);
begin
Assert_Equals (T, Expect, Util.Strings.Transforms.To_Lower_Case (H),
"Invalid HMAC-SHA1");
end Check_HMAC;
-- ------------------------------
-- Test HMAC-SHA1
-- ------------------------------
procedure Test_HMAC_SHA1_RFC2202_T1 (T : in out Test) is
Key : constant String (1 .. 20) := (others => Character'Val (16#0b#));
begin
Check_HMAC (T, Key, "Hi There", "b617318655057264e28bc0b6fb378c8ef146be00");
end Test_HMAC_SHA1_RFC2202_T1;
procedure Test_HMAC_SHA1_RFC2202_T2 (T : in out Test) is
begin
Check_HMAC (T, "Jefe", "what do ya want for nothing?",
"effcdf6ae5eb2fa2d27416d5f184df9c259a7c79");
end Test_HMAC_SHA1_RFC2202_T2;
procedure Test_HMAC_SHA1_RFC2202_T3 (T : in out Test) is
Key : constant String (1 .. 20) := (others => Character'Val (16#aa#));
Data : constant String (1 .. 50) := (others => Character'Val (16#dd#));
begin
Check_HMAC (T, Key, Data,
"125d7342b9ac11cd91a39af48aa17b4f63f175d3");
end Test_HMAC_SHA1_RFC2202_T3;
procedure Test_HMAC_SHA1_RFC2202_T4 (T : in out Test) is
C : constant Util.Encoders.Encoder := Create ("hex");
Key : constant String := Util.Encoders.Decode (C, "0102030405060708090a0b0c0d0e0f"
& "10111213141516171819");
Data : constant String (1 .. 50) := (others => Character'Val (16#cd#));
begin
Check_HMAC (T, Key, Data,
"4c9007f4026250c6bc8414f9bf50c86c2d7235da");
end Test_HMAC_SHA1_RFC2202_T4;
procedure Test_HMAC_SHA1_RFC2202_T5 (T : in out Test) is
Key : constant String (1 .. 20) := (others => Character'Val (16#0c#));
begin
-- RFC2202 test case 5 but without truncation...
Check_HMAC (T, Key, "Test With Truncation",
"4c1a03424b55e07fe7f27be1d58bb9324a9a5a04");
end Test_HMAC_SHA1_RFC2202_T5;
procedure Test_HMAC_SHA1_RFC2202_T6 (T : in out Test) is
Key : constant String (1 .. 80) := (others => Character'Val (16#aa#));
begin
Check_HMAC (T, Key, "Test Using Larger Than Block-Size Key - Hash Key First",
"aa4ae5e15272d00e95705637ce8a3b55ed402112");
end Test_HMAC_SHA1_RFC2202_T6;
procedure Test_HMAC_SHA1_RFC2202_T7 (T : in out Test) is
Key : constant String (1 .. 80) := (others => Character'Val (16#Aa#));
begin
Check_HMAC (T, Key, "Test Using Larger Than Block-Size Key and Larger "
& "Than One Block-Size Data",
"e8e99d0f45237d786d6bbaa7965c7808bbff1a91");
end Test_HMAC_SHA1_RFC2202_T7;
-- ------------------------------
-- Test encoding leb128.
-- ------------------------------
procedure Test_LEB128 (T : in out Test) is
use type Interfaces.Unsigned_64;
Data : Ada.Streams.Stream_Element_Array (1 .. 100);
Last : Ada.Streams.Stream_Element_Offset;
Val : Interfaces.Unsigned_64;
Res : Interfaces.Unsigned_64;
begin
Encode_LEB128 (Into => Data,
Pos => Data'First,
Val => 1,
Last => Last);
Util.Tests.Assert_Equals (T, 1, Integer (Last), "Invalid last position");
Util.Tests.Assert_Equals (T, 1, Integer (Data (1)), "Invalid value");
Encode_LEB128 (Into => Data,
Pos => Data'First,
Val => 16#80#,
Last => Last);
Util.Tests.Assert_Equals (T, 2, Integer (Last), "Invalid last position");
Util.Tests.Assert_Equals (T, 16#80#, Integer (Data (1)), "Invalid value");
Util.Tests.Assert_Equals (T, 16#01#, Integer (Data (2)), "Invalid value");
for I in 0 .. 9 loop
Val := Interfaces.Shift_Left (1, 7 * I);
Encode_LEB128 (Into => Data,
Pos => Data'First,
Val => Val,
Last => Last);
Util.Tests.Assert_Equals (T, I + 1, Integer (Last), "Invalid last position");
Decode_LEB128 (From => Data,
Pos => Data'First,
Val => Res,
Last => Last);
Util.Tests.Assert_Equals (T, I + 2, Integer (Last), "Invalid last position after decode");
T.Assert (Val = Res, "Invalid decode with I " & Integer'Image (I));
end loop;
end Test_LEB128;
-- ------------------------------
-- Test encoding leb128 + base64
-- ------------------------------
procedure Test_Base64_LEB128 (T : in out Test) is
use type Interfaces.Unsigned_64;
Val : Interfaces.Unsigned_64 := 0;
Start : Util.Measures.Stamp;
begin
for I in 1 .. 100 loop
declare
S : constant String := Util.Encoders.Base64.Encode (Val);
V : constant Interfaces.Unsigned_64 := Util.Encoders.Base64.Decode (S);
begin
T.Assert (Val = V, "Invalid leb128+base64 encode/decode "
& Interfaces.Unsigned_64'Image (Val));
end;
val := val * 10 + 1;
end loop;
Util.Measures.Report (Start, "LEB128+Base64 encode and decode", 100);
end Test_Base64_LEB128;
end Util.Encoders.Tests;
|
reznikmm/matreshka | Ada | 4,090 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- SQL Database Access --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.Internals.SQL_Drivers.Oracle.Databases;
package body Matreshka.Internals.SQL_Drivers.Oracle.Factory is
type OCI_Factory is new Abstract_Factory with null record;
overriding function Create
(Self : not null access OCI_Factory) return not null Database_Access;
------------
-- Create --
------------
overriding function Create
(Self : not null access OCI_Factory) return not null Database_Access
is
pragma Unreferenced (Self);
begin
return new Databases.OCI_Database;
end Create;
use type Interfaces.C.int;
Factory : aliased OCI_Factory;
begin
Register (League.Strings.To_Universal_String ("ORACLE"), Factory'Access);
end Matreshka.Internals.SQL_Drivers.Oracle.Factory;
|
charlie5/cBound | Ada | 1,554 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_destroy_notify_event_t is
-- Item
--
type Item is record
response_type : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
sequence : aliased Interfaces.Unsigned_16;
event : aliased xcb.xcb_window_t;
window : aliased xcb.xcb_window_t;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C.size_t range <>) of aliased xcb.xcb_destroy_notify_event_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_destroy_notify_event_t.Item,
Element_Array => xcb.xcb_destroy_notify_event_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C.size_t range <>) of aliased xcb.xcb_destroy_notify_event_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_destroy_notify_event_t.Pointer,
Element_Array => xcb.xcb_destroy_notify_event_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_destroy_notify_event_t;
|
reznikmm/spawn | Ada | 25,268 | adb | --
-- Copyright (C) 2018-2023, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--
pragma Warnings (Off);
pragma Ada_2020;
pragma Ada_2022;
pragma Warnings (On);
-- GNAT: different versions of compiler use different pragmas to enable
-- Ada 2022 features.
with Interfaces.C;
with GNAT.OS_Lib;
with Glib.Error;
with Spawn.Internal;
with Spawn.Posix;
package body Spawn.Channels is
use type Ada.Streams.Stream_Element_Offset;
use type Glib.Gboolean;
use type Glib.IOChannel.Giochannel;
use type Glib.IOChannel.GIOCondition;
use type Glib.Main.G_Source_Id;
use type Interfaces.C.int;
function Add_Watch is new Glib.IOChannel.Generic_Add_Watch
(User_Data => Spawn.Internal.Process_Reference);
function On_Stdin_Event
(source : Glib.IOChannel.Giochannel;
condition : Glib.IOChannel.GIOCondition;
data : access Internal.Process_Reference) return Glib.Gboolean
with Convention => C;
function On_Stdout_Event
(source : Glib.IOChannel.Giochannel;
condition : Glib.IOChannel.GIOCondition;
data : access Internal.Process_Reference) return Glib.Gboolean
with Convention => C;
function On_Stderr_Event
(source : Glib.IOChannel.Giochannel;
condition : Glib.IOChannel.GIOCondition;
data : access Internal.Process_Reference) return Glib.Gboolean
with Convention => C;
procedure Start_Stdin_Watch (Self : in out Channels);
procedure Start_Stdout_Watch (Self : in out Channels);
procedure Start_Stderr_Watch (Self : in out Channels);
procedure Shutdown
(Parent : in out Glib.IOChannel.Giochannel;
Event : in out Glib.Main.G_Source_Id;
Lock : in out Glib.Gboolean);
-- Common code to stop watching and to shutdown IO channel.
procedure Start_Watch
(Parent : Glib.IOChannel.Giochannel;
Event : in out Glib.Main.G_Source_Id;
Lock : in out Glib.Gboolean;
Condition : Glib.IOChannel.GIOCondition;
Callback : access function
(Source : Glib.IOChannel.Giochannel;
Condition : Glib.IOChannel.GIOCondition;
Data : access Spawn.Internal.Process_Reference)
return Glib.Gboolean;
Data : access Spawn.Internal.Process_Reference)
with Convention => C;
-- Common code to start (continue) watching of the IO channel.
procedure Channel_Error (Self : Channels);
-- Executed on IO channel failure to report postponed Finished signal.
-------------------
-- Channel_Error --
-------------------
procedure Channel_Error (Self : Channels) is
begin
if Self.Process.Pending_Finish then
-- Check whether all IO operations are done, then emit Finished
-- callback.
if not Is_Active (Self) then
Self.Process.Pending_Finish := False;
Self.Process.Status := Not_Running;
Self.Process.Emit_Finished
(Self.Process.Exit_Status, Self.Process.Exit_Code);
end if;
end if;
end Channel_Error;
-----------------------------
-- Close_Child_Descriptors --
-----------------------------
procedure Close_Child_Descriptors (Self : in out Channels) is
Ignore : Interfaces.C.int;
begin
if Self.Stdin_Child /= -1 then
Ignore := Spawn.Posix.close (Interfaces.C.int (Self.Stdin_Child));
Self.Stdin_Child := -1;
end if;
if Self.Stdout_Child /= -1 then
Ignore := Spawn.Posix.close (Interfaces.C.int (Self.Stdout_Child));
Self.Stdout_Child := -1;
end if;
if Self.Stderr_Child /= -1 then
Ignore := Spawn.Posix.close (Interfaces.C.int (Self.Stderr_Child));
Self.Stderr_Child := -1;
end if;
if Self.PTY_Slave /= -1 then
Ignore := Spawn.Posix.close (Interfaces.C.int (Self.PTY_Slave));
Self.PTY_Slave := -1;
end if;
end Close_Child_Descriptors;
---------------
-- Is_Active --
---------------
function Is_Active (Self : Channels) return Boolean is
begin
return
Self.Stdin_Event /= Glib.Main.No_Source_Id
or Self.Stdout_Event /= Glib.Main.No_Source_Id
or Self.Stderr_Event /= Glib.Main.No_Source_Id;
end Is_Active;
---------------------
-- On_Stderr_Event --
---------------------
function On_Stderr_Event
(source : Glib.IOChannel.Giochannel;
condition : Glib.IOChannel.GIOCondition;
data : access Internal.Process_Reference) return Glib.Gboolean
is
pragma Unreferenced (source);
Self : Channels renames data.Self.Channels;
begin
Self.Stderr_Lock := @ - 1;
if (condition and Glib.IOChannel.G_Io_In) /= 0 then
Self.Process.Emit_Stderr_Available;
elsif (condition and Glib.IOChannel.G_Io_Hup) /= 0
or (condition and Glib.IOChannel.G_Io_Err) /= 0
then
Self.Process.Emit_Standard_Error_Stream_Error
("GIOChannel IO error");
end if;
if Self.Stderr_Lock = 0 then
Self.Stderr_Event := Glib.Main.No_Source_Id;
end if;
if (condition and Glib.IOChannel.G_Io_Hup) /= 0
or (condition and Glib.IOChannel.G_Io_Err) /= 0
then
Channel_Error (Self);
end if;
return Self.Stderr_Lock;
end On_Stderr_Event;
--------------------
-- On_Stdin_Event --
--------------------
function On_Stdin_Event
(source : Glib.IOChannel.Giochannel;
condition : Glib.IOChannel.GIOCondition;
data : access Internal.Process_Reference) return Glib.Gboolean
is
pragma Unreferenced (source);
Self : Channels renames data.Self.Channels;
begin
Self.Stdin_Lock := @ - 1;
if (condition and Glib.IOChannel.G_Io_Out) /= 0 then
Self.Process.Emit_Stdin_Available;
elsif (condition and Glib.IOChannel.G_Io_Hup) /= 0
or (condition and Glib.IOChannel.G_Io_Err) /= 0
then
Self.Process.Emit_Standard_Error_Stream_Error
("GIOChannel IO error");
end if;
if Self.Stdin_Lock = 0 then
Self.Stdin_Event := Glib.Main.No_Source_Id;
end if;
if (condition and Glib.IOChannel.G_Io_Hup) /= 0
or (condition and Glib.IOChannel.G_Io_Err) /= 0
then
Channel_Error (Self);
end if;
return Self.Stdin_Lock;
end On_Stdin_Event;
---------------------
-- On_Stdout_Event --
---------------------
function On_Stdout_Event
(source : Glib.IOChannel.Giochannel;
condition : Glib.IOChannel.GIOCondition;
data : access Internal.Process_Reference) return Glib.Gboolean
is
pragma Unreferenced (source);
Self : Channels renames data.Self.Channels;
begin
Self.Stdout_Lock := @ - 1;
if (condition and Glib.IOChannel.G_Io_In) /= 0 then
Self.Process.Emit_Stdout_Available;
elsif (condition and Glib.IOChannel.G_Io_Hup) /= 0
or (condition and Glib.IOChannel.G_Io_Err) /= 0
then
Self.Process.Emit_Standard_Output_Stream_Error
("GIOChannel IO error");
end if;
if Self.Stdout_Lock = 0 then
Self.Stdout_Event := Glib.Main.No_Source_Id;
end if;
if (condition and Glib.IOChannel.G_Io_Hup) /= 0
or (condition and Glib.IOChannel.G_Io_Err) /= 0
then
Channel_Error (Self);
end if;
return Self.Stdout_Lock;
end On_Stdout_Event;
---------------
-- PTY_Slave --
---------------
function PTY_Slave (Self : Channels) return Glib.Gint is
begin
return Self.PTY_Slave;
end PTY_Slave;
-----------------
-- Read_Stderr --
-----------------
procedure Read_Stderr
(Self : in out Channels;
Data : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Success : in out Boolean)
is
use type Glib.Gsize;
Error : aliased Glib.Error.GError;
Count : aliased Glib.Gsize := 0;
Status : Glib.IOChannel.GIOStatus;
begin
Last := Data'First - 1;
-- Mark operation as failed. On success of the opration corresponding
-- value is set.
if Self.Stderr_Parent = null then
return;
end if;
Status :=
Glib.IOChannel.Read_Chars
(Self => Self.Stderr_Parent,
Buf => Data,
Bytes_Read => Count'Access,
Error => Error'Access);
case Status is
when Glib.IOChannel.G_Io_Status_Eof =>
-- Reading is completed, so no watching is required
Last := Data'First - 1;
when Glib.IOChannel.G_Io_Status_Normal =>
-- Read success, so no watching is required
Last := Data'First + Ada.Streams.Stream_Element_Offset (Count) - 1;
when Glib.IOChannel.G_Io_Status_Again =>
-- No data to read, so start to watching again
pragma Assert (Count = 0);
Last := Data'First - 1;
Start_Stderr_Watch (Self);
when Glib.IOChannel.G_Io_Status_Error =>
Success := False;
end case;
end Read_Stderr;
-----------------
-- Read_Stdout --
-----------------
procedure Read_Stdout
(Self : in out Channels;
Data : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Success : in out Boolean)
is
use type Glib.Gsize;
Error : aliased Glib.Error.GError;
Count : aliased Glib.Gsize := 0;
Status : Glib.IOChannel.GIOStatus;
begin
Last := Data'First - 1;
-- Mark operation as failed. On success of the opration corresponding
-- value is set.
if Self.Stdout_Parent = null then
return;
end if;
Status :=
Glib.IOChannel.Read_Chars
(Self => Self.Stdout_Parent,
Buf => Data,
Bytes_Read => Count'Access,
Error => Error'Access);
case Status is
when Glib.IOChannel.G_Io_Status_Eof =>
-- Reading is completed, so no watching is required
Last := Data'First - 1;
when Glib.IOChannel.G_Io_Status_Normal =>
-- Read success, so no watching is required
Last :=
Data'First + Ada.Streams.Stream_Element_Offset (Count) - 1;
when Glib.IOChannel.G_Io_Status_Again =>
-- No data to read, so start to watching again
pragma Assert (Count = 0);
Last := Data'First - 1;
Start_Stdout_Watch (Self);
when Glib.IOChannel.G_Io_Status_Error =>
Success := False;
end case;
end Read_Stdout;
--------------------
-- Setup_Channels --
--------------------
procedure Setup_Channels
(Self : in out Channels;
Use_PTY : Spawn.Common.Pipe_Flags;
Child : out Pipe_Array)
is
procedure Setup_Pipe
(Kind : Spawn.Posix.Pipe_Ends;
Parent : out Glib.IOChannel.Giochannel;
Child : out Glib.Gint;
Success : in out Boolean);
-- Create a pipe of two file descriptors. Wrap one of them (according
-- to Kind) into a Giochannel and return as Parent. Return another as
-- Child. If something goes wrong emit Error_Occurred in the process
-- listener and change Success to False.
procedure Setup_PTY (Success : in out Boolean);
PTY_Channel : Glib.IOChannel.Giochannel := null;
----------------
-- Setup_Pipe --
----------------
procedure Setup_Pipe
(Kind : Spawn.Posix.Pipe_Ends;
Parent : out Glib.IOChannel.Giochannel;
Child : out Glib.Gint;
Success : in out Boolean)
is
use type Glib.IOChannel.GIOStatus;
procedure Cleanup;
-- Close file descriptors and unreference channel.
-------------
-- Cleanup --
-------------
procedure Cleanup is
Ignore : Interfaces.C.int;
begin
Glib.IOChannel.Unref (Parent);
Ignore := Spawn.Posix.close (Interfaces.C.int (Child));
Parent := null;
Child := -1;
end Cleanup;
Fds : Spawn.Posix.Fd_Pair;
Error : aliased Glib.Error.GError;
Opposite_End : constant array (Spawn.Posix.Pipe_Ends)
of Spawn.Posix.Pipe_Ends :=
[Spawn.Posix.Read_End => Spawn.Posix.Write_End,
Spawn.Posix.Write_End => Spawn.Posix.Read_End];
begin
Parent := null;
Child := -1;
if not Success then
return;
end if;
-- Create pipe
if Spawn.Posix.pipe2 (Fds, Posix.O_CLOEXEC) /= 0 then
Self.Process.Emit_Error_Occurred (GNAT.OS_Lib.Errno);
Success := False;
return;
end if;
-- Create GIOChannel and move ownership of the file descriptor to
-- the channel
Parent := Glib.IOChannel.Giochannel_Unix_New (Glib.Gint (Fds (Kind)));
Glib.IOChannel.Set_Close_On_Unref (Parent, True);
Child := Glib.Gint (Fds (Opposite_End (Kind)));
-- Setup non-blocking mode for the channel
if Glib.IOChannel.Set_Flags
(Parent,
Glib.IOChannel.G_Io_Flag_Nonblock,
Error'Access) /= Glib.IOChannel.G_Io_Status_Normal
then
Self.Process.Emit_Error_Occurred
(Integer (Glib.Error.Get_Code (Error)));
Cleanup;
Success := False;
return;
end if;
-- Setup null encoding
if Glib.IOChannel.Set_Encoding (Parent, "", Error'Access)
/= Glib.IOChannel.G_Io_Status_Normal
then
Self.Process.Emit_Error_Occurred
(Integer (Glib.Error.Get_Code (Error)));
Cleanup;
Success := False;
return;
end if;
-- Disable buffering.
Glib.IOChannel.Set_Buffered (Parent, False);
end Setup_Pipe;
---------------
-- Setup_PTY --
---------------
procedure Setup_PTY (Success : in out Boolean) is
use type Glib.IOChannel.GIOStatus;
procedure Cleanup;
PTY_Master : Interfaces.C.int;
Status : Interfaces.C.int;
Slave_Name : Interfaces.C.char_array (1 .. 64);
Error : aliased Glib.Error.GError;
-------------
-- Cleanup --
-------------
procedure Cleanup is
Ignore : Interfaces.C.int;
begin
if PTY_Master /= -1 then
Ignore := Spawn.Posix.close (PTY_Master);
PTY_Master := -1;
end if;
if Self.PTY_Slave /= -1 then
Ignore :=
Spawn.Posix.close (Interfaces.C.int (Self.PTY_Slave));
Self.PTY_Slave := -1;
end if;
if PTY_Channel /= null then
Glib.IOChannel.Unref (PTY_Channel);
PTY_Channel := null;
end if;
end Cleanup;
begin
PTY_Channel := null;
Self.PTY_Slave := -1;
if not Success then
return;
end if;
-- Open pseudoterminal's master descriptor
PTY_Master :=
Spawn.Posix.posix_openpt
(Spawn.Posix.O_RDWR + Spawn.Posix.O_NOCTTY);
if PTY_Master = -1 then
Self.Process.Emit_Error_Occurred (GNAT.OS_Lib.Errno);
Success := False;
return;
end if;
-- Mark file descriptor as be closed on exec
if Spawn.Posix.fcntl
(PTY_Master, Spawn.Posix.F_SETFD, Spawn.Posix.FD_CLOEXEC)
= -1
then
Cleanup;
Self.Process.Emit_Error_Occurred (GNAT.OS_Lib.Errno);
Success := False;
return;
end if;
-- Change mode and owner of the slave pseudoterminal device
if Spawn.Posix.grantpt (PTY_Master) /= 0 then
Cleanup;
Self.Process.Emit_Error_Occurred (GNAT.OS_Lib.Errno);
Success := False;
return;
end if;
-- Unlock slave pseudoterminal device
if Spawn.Posix.unlockpt (PTY_Master) /= 0 then
Cleanup;
Self.Process.Emit_Error_Occurred (GNAT.OS_Lib.Errno);
Success := False;
return;
end if;
-- Get name of the slave pseudoterminal device
Status :=
Spawn.Posix.ptsname_r
(PTY_Master, Slave_Name, Slave_Name'Length);
if Status /= 0 then
Cleanup;
Self.Process.Emit_Error_Occurred (Integer (Status));
Success := False;
return;
end if;
-- Open slave device
Self.PTY_Slave :=
Glib.Gint
(Spawn.Posix.open
(Slave_Name, Spawn.Posix.O_RDWR + Spawn.Posix.O_CLOEXEC, 0));
if Self.PTY_Slave = -1 then
Cleanup;
Self.Process.Emit_Error_Occurred (GNAT.OS_Lib.Errno);
Success := False;
return;
end if;
-- Create GIOChannel and move ownership of the file descriptor to
-- the channel
PTY_Channel :=
Glib.IOChannel.Giochannel_Unix_New (Glib.Gint (PTY_Master));
Glib.IOChannel.Set_Close_On_Unref (PTY_Channel, True);
PTY_Master := -1;
-- Setup non-blocking mode for the channel
if Glib.IOChannel.Set_Flags
(PTY_Channel,
Glib.IOChannel.G_Io_Flag_Nonblock,
Error'Access) /= Glib.IOChannel.G_Io_Status_Normal
then
Self.Process.Emit_Error_Occurred
(Integer (Glib.Error.Get_Code (Error)));
Cleanup;
Success := False;
return;
end if;
-- Setup null encoding
if Glib.IOChannel.Set_Encoding (PTY_Channel, "", Error'Access)
/= Glib.IOChannel.G_Io_Status_Normal
then
Self.Process.Emit_Error_Occurred
(Integer (Glib.Error.Get_Code (Error)));
Cleanup;
Success := False;
return;
end if;
-- Disable buffering.
Glib.IOChannel.Set_Buffered (PTY_Channel, False);
end Setup_PTY;
Success : Boolean := True;
use all type Spawn.Common.Pipe_Kinds;
use type Spawn.Common.Pipe_Flags;
begin
if Use_PTY /= [Use_PTY'Range => False] then
Setup_PTY (Success);
Child := [Child'Range => Self.PTY_Slave];
end if;
if Use_PTY (Stdin) then
Self.Stdin_Parent := Glib.IOChannel.Ref (PTY_Channel);
else
Setup_Pipe
(Spawn.Posix.Write_End,
Self.Stdin_Parent,
Self.Stdin_Child,
Success);
Child (Stdin) := Self.Stdin_Child;
end if;
if Use_PTY (Stdout) then
Self.Stdout_Parent := Glib.IOChannel.Ref (PTY_Channel);
else
Setup_Pipe
(Spawn.Posix.Read_End,
Self.Stdout_Parent,
Self.Stdout_Child,
Success);
Child (Stdout) := Self.Stdout_Child;
end if;
if Use_PTY (Stderr) then
Self.Stderr_Parent := Glib.IOChannel.Ref (PTY_Channel);
else
Setup_Pipe
(Spawn.Posix.Read_End,
Self.Stderr_Parent,
Self.Stderr_Child,
Success);
Child (Stderr) := Self.Stderr_Child;
end if;
if PTY_Channel /= null then
Glib.IOChannel.Unref (PTY_Channel);
end if;
end Setup_Channels;
--------------
-- Shutdown --
--------------
procedure Shutdown
(Parent : in out Glib.IOChannel.Giochannel;
Event : in out Glib.Main.G_Source_Id;
Lock : in out Glib.Gboolean) is
begin
if Event /= Glib.Main.No_Source_Id then
Glib.Main.Remove (Event);
Event := Glib.Main.No_Source_Id;
Lock := 0;
end if;
if Parent /= null then
Glib.IOChannel.Unref (Parent);
Parent := null;
end if;
end Shutdown;
-----------------------
-- Shutdown_Channels --
-----------------------
procedure Shutdown_Channels (Self : in out Channels) is
begin
Close_Child_Descriptors (Self);
Shutdown_Stdin (Self);
Shutdown_Stdout (Self);
Shutdown_Stderr (Self);
end Shutdown_Channels;
---------------------
-- Shutdown_Stderr --
---------------------
procedure Shutdown_Stderr (Self : in out Channels) is
begin
Shutdown (Self.Stderr_Parent, Self.Stderr_Event, Self.Stderr_Lock);
end Shutdown_Stderr;
--------------------
-- Shutdown_Stdin --
--------------------
procedure Shutdown_Stdin (Self : in out Channels) is
begin
Shutdown (Self.Stdin_Parent, Self.Stdin_Event, Self.Stdin_Lock);
end Shutdown_Stdin;
---------------------
-- Shutdown_Stdout --
---------------------
procedure Shutdown_Stdout (Self : in out Channels) is
begin
Shutdown (Self.Stdout_Parent, Self.Stdout_Event, Self.Stdout_Lock);
end Shutdown_Stdout;
------------------------
-- Start_Stderr_Watch --
------------------------
procedure Start_Stderr_Watch (Self : in out Channels) is
begin
if Self.Stderr_Parent /= Self.Stdout_Parent then
Start_Watch
(Self.Stderr_Parent,
Self.Stderr_Event,
Self.Stderr_Lock,
Glib.IOChannel.G_Io_In
+ Glib.IOChannel.G_Io_Hup
+ Glib.IOChannel.G_Io_Err,
On_Stderr_Event'Access,
Self.Process.Reference'Unchecked_Access);
end if;
end Start_Stderr_Watch;
-----------------------
-- Start_Stdin_Watch --
-----------------------
procedure Start_Stdin_Watch (Self : in out Channels) is
begin
Start_Watch
(Self.Stdin_Parent,
Self.Stdin_Event,
Self.Stdin_Lock,
Glib.IOChannel.G_Io_Out
+ Glib.IOChannel.G_Io_Hup
+ Glib.IOChannel.G_Io_Err,
On_Stdin_Event'Access,
Self.Process.Reference'Unchecked_Access);
end Start_Stdin_Watch;
------------------------
-- Start_Stdout_Watch --
------------------------
procedure Start_Stdout_Watch (Self : in out Channels) is
begin
Start_Watch
(Self.Stdout_Parent,
Self.Stdout_Event,
Self.Stdout_Lock,
Glib.IOChannel.G_Io_In
+ Glib.IOChannel.G_Io_Hup
+ Glib.IOChannel.G_Io_Err,
On_Stdout_Event'Access,
Self.Process.Reference'Unchecked_Access);
end Start_Stdout_Watch;
-----------------
-- Start_Watch --
-----------------
procedure Start_Watch
(Parent : Glib.IOChannel.Giochannel;
Event : in out Glib.Main.G_Source_Id;
Lock : in out Glib.Gboolean;
Condition : Glib.IOChannel.GIOCondition;
Callback : access function
(Source : Glib.IOChannel.Giochannel;
Condition : Glib.IOChannel.GIOCondition;
Data : access Spawn.Internal.Process_Reference)
return Glib.Gboolean;
Data : access Spawn.Internal.Process_Reference) is
begin
if Event = Glib.Main.No_Source_Id then
pragma Assert (Lock = 0);
Event := Add_Watch (Parent, Condition, Callback, Data);
Lock := 1;
else
Lock := @ + 1;
end if;
end Start_Watch;
-----------------
-- Start_Watch --
-----------------
procedure Start_Watch (Self : in out Channels) is
begin
Start_Stdin_Watch (Self);
Start_Stdout_Watch (Self);
Start_Stderr_Watch (Self);
end Start_Watch;
-----------------
-- Write_Stdin --
-----------------
procedure Write_Stdin
(Self : in out Channels;
Data : Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Success : in out Boolean)
is
Error : aliased Glib.Error.GError;
Count : aliased Glib.Gsize;
Status : Glib.IOChannel.GIOStatus;
begin
Last := Data'First - 1;
-- Mark operation as failed. On success of the opration corresponding
-- value is set.
if Self.Stdout_Parent = null then
return;
end if;
Status :=
Glib.IOChannel.Write_Chars
(Self => Self.Stdin_Parent,
Buf => Data,
Bytes_Written => Count'Access,
Error => Error'Access);
Last := Data'First + Ada.Streams.Stream_Element_Offset (Count) - 1;
case Status is
when Glib.IOChannel.G_Io_Status_Normal =>
null;
when Glib.IOChannel.G_Io_Status_Again =>
-- There is no enough space in the buffer to write, so start
-- watching again
Start_Stdin_Watch (Self);
when Glib.IOChannel.G_Io_Status_Error =>
Success := False;
when others =>
raise Program_Error;
end case;
end Write_Stdin;
end Spawn.Channels;
|
tum-ei-rcs/StratoX | Ada | 7,146 | ads | -- This spec has been automatically generated from STM32F429x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
with System;
-- STM32F429x
package STM32_SVD is
pragma Preelaborate;
--------------------
-- Base addresses --
--------------------
RNG_Base : constant System.Address :=
System'To_Address (16#50060800#);
DCMI_Base : constant System.Address :=
System'To_Address (16#50050000#);
FMC_Base : constant System.Address :=
System'To_Address (16#A0000000#);
DBG_Base : constant System.Address :=
System'To_Address (16#E0042000#);
DMA2_Base : constant System.Address :=
System'To_Address (16#40026400#);
DMA1_Base : constant System.Address :=
System'To_Address (16#40026000#);
RCC_Base : constant System.Address :=
System'To_Address (16#40023800#);
GPIOK_Base : constant System.Address :=
System'To_Address (16#40022800#);
GPIOJ_Base : constant System.Address :=
System'To_Address (16#40022400#);
GPIOI_Base : constant System.Address :=
System'To_Address (16#40022000#);
GPIOH_Base : constant System.Address :=
System'To_Address (16#40021C00#);
GPIOG_Base : constant System.Address :=
System'To_Address (16#40021800#);
GPIOF_Base : constant System.Address :=
System'To_Address (16#40021400#);
GPIOE_Base : constant System.Address :=
System'To_Address (16#40021000#);
GPIOD_Base : constant System.Address :=
System'To_Address (16#40020C00#);
GPIOC_Base : constant System.Address :=
System'To_Address (16#40020800#);
GPIOB_Base : constant System.Address :=
System'To_Address (16#40020400#);
GPIOA_Base : constant System.Address :=
System'To_Address (16#40020000#);
SYSCFG_Base : constant System.Address :=
System'To_Address (16#40013800#);
SPI1_Base : constant System.Address :=
System'To_Address (16#40013000#);
SPI2_Base : constant System.Address :=
System'To_Address (16#40003800#);
SPI3_Base : constant System.Address :=
System'To_Address (16#40003C00#);
I2S2ext_Base : constant System.Address :=
System'To_Address (16#40003400#);
I2S3ext_Base : constant System.Address :=
System'To_Address (16#40004000#);
SPI4_Base : constant System.Address :=
System'To_Address (16#40013400#);
SPI5_Base : constant System.Address :=
System'To_Address (16#40015000#);
SPI6_Base : constant System.Address :=
System'To_Address (16#40015400#);
SDIO_Base : constant System.Address :=
System'To_Address (16#40012C00#);
ADC1_Base : constant System.Address :=
System'To_Address (16#40012000#);
ADC2_Base : constant System.Address :=
System'To_Address (16#40012100#);
ADC3_Base : constant System.Address :=
System'To_Address (16#40012200#);
USART6_Base : constant System.Address :=
System'To_Address (16#40011400#);
USART1_Base : constant System.Address :=
System'To_Address (16#40011000#);
USART2_Base : constant System.Address :=
System'To_Address (16#40004400#);
USART3_Base : constant System.Address :=
System'To_Address (16#40004800#);
UART7_Base : constant System.Address :=
System'To_Address (16#40007800#);
UART8_Base : constant System.Address :=
System'To_Address (16#40007C00#);
DAC_Base : constant System.Address :=
System'To_Address (16#40007400#);
PWR_Base : constant System.Address :=
System'To_Address (16#40007000#);
I2C3_Base : constant System.Address :=
System'To_Address (16#40005C00#);
I2C2_Base : constant System.Address :=
System'To_Address (16#40005800#);
I2C1_Base : constant System.Address :=
System'To_Address (16#40005400#);
IWDG_Base : constant System.Address :=
System'To_Address (16#40003000#);
WWDG_Base : constant System.Address :=
System'To_Address (16#40002C00#);
RTC_Base : constant System.Address :=
System'To_Address (16#40002800#);
UART4_Base : constant System.Address :=
System'To_Address (16#40004C00#);
UART5_Base : constant System.Address :=
System'To_Address (16#40005000#);
C_ADC_Base : constant System.Address :=
System'To_Address (16#40012300#);
TIM1_Base : constant System.Address :=
System'To_Address (16#40010000#);
TIM8_Base : constant System.Address :=
System'To_Address (16#40010400#);
TIM2_Base : constant System.Address :=
System'To_Address (16#40000000#);
TIM3_Base : constant System.Address :=
System'To_Address (16#40000400#);
TIM4_Base : constant System.Address :=
System'To_Address (16#40000800#);
TIM5_Base : constant System.Address :=
System'To_Address (16#40000C00#);
TIM9_Base : constant System.Address :=
System'To_Address (16#40014000#);
TIM12_Base : constant System.Address :=
System'To_Address (16#40001800#);
TIM10_Base : constant System.Address :=
System'To_Address (16#40014400#);
TIM13_Base : constant System.Address :=
System'To_Address (16#40001C00#);
TIM14_Base : constant System.Address :=
System'To_Address (16#40002000#);
TIM11_Base : constant System.Address :=
System'To_Address (16#40014800#);
TIM6_Base : constant System.Address :=
System'To_Address (16#40001000#);
TIM7_Base : constant System.Address :=
System'To_Address (16#40001400#);
Ethernet_MAC_Base : constant System.Address :=
System'To_Address (16#40028000#);
Ethernet_MMC_Base : constant System.Address :=
System'To_Address (16#40028100#);
Ethernet_PTP_Base : constant System.Address :=
System'To_Address (16#40028700#);
Ethernet_DMA_Base : constant System.Address :=
System'To_Address (16#40029000#);
CRC_Base : constant System.Address :=
System'To_Address (16#40023000#);
OTG_FS_GLOBAL_Base : constant System.Address :=
System'To_Address (16#50000000#);
OTG_FS_HOST_Base : constant System.Address :=
System'To_Address (16#50000400#);
OTG_FS_DEVICE_Base : constant System.Address :=
System'To_Address (16#50000800#);
OTG_FS_PWRCLK_Base : constant System.Address :=
System'To_Address (16#50000E00#);
CAN1_Base : constant System.Address :=
System'To_Address (16#40006400#);
CAN2_Base : constant System.Address :=
System'To_Address (16#40006800#);
NVIC_Base : constant System.Address :=
System'To_Address (16#E000E000#);
FLASH_Base : constant System.Address :=
System'To_Address (16#40023C00#);
EXTI_Base : constant System.Address :=
System'To_Address (16#40013C00#);
OTG_HS_GLOBAL_Base : constant System.Address :=
System'To_Address (16#40040000#);
OTG_HS_HOST_Base : constant System.Address :=
System'To_Address (16#40040400#);
OTG_HS_DEVICE_Base : constant System.Address :=
System'To_Address (16#40040800#);
OTG_HS_PWRCLK_Base : constant System.Address :=
System'To_Address (16#40040E00#);
LTDC_Base : constant System.Address :=
System'To_Address (16#40016800#);
SAI_Base : constant System.Address :=
System'To_Address (16#40015800#);
DMA2D_Base : constant System.Address :=
System'To_Address (16#4002B000#);
end STM32_SVD;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 9,549 | adb | with System;
with Utils; use Utils;
package body Drivers.CC1101 is
type Register_Type is (
IOCFG2,
IOCFG1,
IOCFG0,
FIFOTHR,
SYNC1,
SYNC0,
PKTLEN,
PKTCTRL1,
PKTCTRL0,
ADDR,
CHANNR,
FSCTRL1,
FSCTRL0,
FREQ2,
FREQ1,
FREQ0,
MDMCFG4,
MDMCFG3,
MDMCFG2,
MDMCFG1,
MDMCFG0,
DEVIATN,
MCSM2,
MCSM1,
MCSM0,
FOCCFG,
BSCFG,
AGCCTRL2,
AGCCTRL1,
AGCCTRL0,
WOREVT1,
WOREVT0,
WORCTRL,
FREND1,
FREND0,
FSCAL3,
FSCAL2,
FSCAL1,
FSCAL0,
RCCTRL1,
RCCTRL0,
FSTEST,
PTEST,
AGCTEST,
TEST2,
TEST1,
TEST0,
PARTNUM,
VERSION,
FREQEST,
LQI,
RSSI,
MARCSTATE,
WORTIME1,
WORTIME0,
PKTSTATUS,
VCO_VC_DAC,
TXBYTES,
RXBYTES,
RCCTRL1_STATUS,
RCCTRL0_STATUS);
for Register_Type use (
IOCFG2 => 16#00#,
IOCFG1 => 16#01#,
IOCFG0 => 16#02#,
FIFOTHR => 16#03#,
SYNC1 => 16#04#,
SYNC0 => 16#05#,
PKTLEN => 16#06#,
PKTCTRL1 => 16#07#,
PKTCTRL0 => 16#08#,
ADDR => 16#09#,
CHANNR => 16#0A#,
FSCTRL1 => 16#0B#,
FSCTRL0 => 16#0C#,
FREQ2 => 16#0D#,
FREQ1 => 16#0E#,
FREQ0 => 16#0F#,
MDMCFG4 => 16#10#,
MDMCFG3 => 16#11#,
MDMCFG2 => 16#12#,
MDMCFG1 => 16#13#,
MDMCFG0 => 16#14#,
DEVIATN => 16#15#,
MCSM2 => 16#16#,
MCSM1 => 16#17#,
MCSM0 => 16#18#,
FOCCFG => 16#19#,
BSCFG => 16#1A#,
AGCCTRL2 => 16#1B#,
AGCCTRL1 => 16#1C#,
AGCCTRL0 => 16#1D#,
WOREVT1 => 16#1E#,
WOREVT0 => 16#1F#,
WORCTRL => 16#20#,
FREND1 => 16#21#,
FREND0 => 16#22#,
FSCAL3 => 16#23#,
FSCAL2 => 16#24#,
FSCAL1 => 16#25#,
FSCAL0 => 16#26#,
RCCTRL1 => 16#27#,
RCCTRL0 => 16#28#,
FSTEST => 16#29#,
PTEST => 16#2A#,
AGCTEST => 16#2B#,
TEST2 => 16#2C#,
TEST1 => 16#2D#,
TEST0 => 16#2E#,
PARTNUM => 16#30#,
VERSION => 16#31#,
FREQEST => 16#32#,
LQI => 16#33#,
RSSI => 16#34#,
MARCSTATE => 16#35#,
WORTIME1 => 16#36#,
WORTIME0 => 16#37#,
PKTSTATUS => 16#38#,
VCO_VC_DAC => 16#39#,
TXBYTES => 16#3A#,
RXBYTES => 16#3B#,
RCCTRL1_STATUS => 16#3C#,
RCCTRL0_STATUS => 16#3D#);
type Commands is (
SRES,
SFSTXON,
SXOFF,
SCAL,
SRX,
STX,
SIDLE,
SWOR,
SPWD,
SFRX,
SFTX,
SWORRST,
SNOP);
for Commands use (
SRES => 16#30#,
SFSTXON => 16#31#,
SXOFF => 16#32#,
SCAL => 16#33#,
SRX => 16#34#,
STX => 16#35#,
SIDLE => 16#36#,
SWOR => 16#38#,
SPWD => 16#39#,
SFRX => 16#3A#,
SFTX => 16#3B#,
SWORRST => 16#3C#,
SNOP => 16#3D#);
type Init_Value is
record
Register : Register_Type;
Value : Byte;
end record;
Init_Values : constant array (1 .. 29) of Init_Value := (
(IOCFG0, 16#41#), -- CHIP_RDYn
(IOCFG2, 16#07#), -- RX with CRC ok
(FIFOTHR, 16#47#), -- RX attenuation 6dB, 33/32 byte threshold
(PKTLEN, 16#3D#), -- 62 bytes max packet length
(PKTCTRL1, 16#0C#), -- CRC autoflush, status append
(PKTCTRL0, 16#05#), -- TX/RX CRC enabled, variable packet length
(FSCTRL1, 16#06#), -- 152kHz IF frequency
(FREQ2, 16#10#), -- 434 MHz carrier frequency
(FREQ1, 16#B1#),
(FREQ0, 16#3B#),
(MDMCFG4, 16#FA#), -- 135kHz channel bandwidth
(MDMCFG3, 16#83#), -- 38.4kbps symbol rate
(MDMCFG2, 16#31#), -- OOK, 16/16 sync word detection
-- (MDMCFG2, 16#06#), -- 2-FSK, 16/16 sync word detection, carrier sense
(MDMCFG1, 16#42#), -- 8 bytes preamble
(DEVIATN, 16#27#), -- 11.9kHz FSK deviation
(MCSM1, 16#3c#),
(MCSM0, 16#18#),
(FOCCFG, 16#16#),
(WORCTRL, 16#FB#),
(FSCAL3, 16#E9#),
(FSCAL2, 16#2A#),
(FSCAL1, 16#00#),
(FSCAL0, 16#1F#),
(AGCCTRL2, 16#04#),
(AGCCTRL1, 16#00#),
(AGCCTRL0, 16#91#),
(TEST2, 16#81#),
(TEST1, 16#35#),
(TEST0, 16#09#));
procedure Write_Register (Register : Register_Type; Value : Byte);
procedure Read_Register (Register : Register_Type; Value : out Byte);
function Read_Register (Register : Register_Type) return Byte;
procedure Write_Register (Register : Register_Type; Value : Byte) is
begin
Chip_Select.Clear;
SPI.Send (Register'Enum_Rep);
SPI.Send (Value);
Chip_Select.Set;
end Write_Register;
procedure Read_Register (Register : Register_Type; Value : out Byte) is
begin
Chip_Select.Clear;
SPI.Send (16#80# + Register'Enum_Rep);
SPI.Receive (Value);
Chip_Select.Set;
end Read_Register;
function Read_Register (Register : Register_Type) return Byte is
Value : Byte;
begin
Chip_Select.Clear;
SPI.Send (16#80# + Register'Enum_Rep);
SPI.Receive (Value);
Chip_Select.Set;
return Value;
end Read_Register;
procedure Read_Status (Register : Register_Type; Value : out Byte) is
begin
Chip_Select.Clear;
SPI.Send (16#C0# + Register'Enum_Rep);
SPI.Receive (Value);
Chip_Select.Set;
end Read_Status;
function Read_Status (Register : Register_Type) return Byte is
Value : Byte;
begin
Chip_Select.Clear;
SPI.Send (16#C0# + Register'Enum_Rep);
SPI.Receive (Value);
Chip_Select.Set;
return Value;
end Read_Status;
procedure Read_Registers (Registers : out Raw_Register_Array) is
begin
for R in Register_Type loop
if R'Enum_Rep < PARTNUM'Enum_Rep then
Read_Register (R, Registers (R'Enum_Rep));
else
Read_Status (R, Registers (R'Enum_Rep));
end if;
end loop;
end Read_Registers;
procedure Init is
begin
for I of Init_Values loop
Write_Register (I.Register, I.Value);
end loop;
end Init;
procedure Print_Registers is
begin
Put_Line (
"PARTNUM:" & To_Hex_String (Unsigned_8 (Read_Status (PARTNUM))) &
" VERSION:" & To_Hex_String (Unsigned_8 (Read_Status (VERSION))) &
" SYNC0:" & To_Hex_String (Unsigned_8 (Read_Register (SYNC0))) &
" SYNC1:" & To_Hex_String (Unsigned_8 (Read_Register (SYNC1))) &
" FREQ:" & To_Hex_String (Unsigned_8 (Read_Register (FREQ0))) &
To_Hex_String (Unsigned_8 (Read_Register (FREQ1))) &
To_Hex_String (Unsigned_8 (Read_Register (FREQ2))));
end Print_Registers;
procedure Set_Sync_Word (Word : Unsigned_16) is
begin
null;
end Set_Sync_Word;
function Get_Sync_Word return Unsigned_16 is
begin
return Unsigned_16 (Read_Register (SYNC1)) * 2 ** 8 +
Unsigned_16 (Read_Register (SYNC0));
end Get_Sync_Word;
procedure TX_Mode is
begin
null;
end TX_Mode;
procedure RX_Mode is
begin
Chip_Select.Clear;
SPI.Send (SIDLE'Enum_Rep);
SPI.Send (SFRX'Enum_Rep);
SPI.Send (SRX'Enum_Rep);
Chip_Select.Set;
end RX_Mode;
procedure TX (Packet: Packet_Type) is
begin
Chip_Select.Clear;
SPI.Send (SFTX'Enum_Rep);
Chip_Select.Clear;
SPI.Send (16#3F# + 16#40#);
for D of Packet loop
SPI.Send (D);
end loop;
Chip_Select.Set;
Chip_Select.Clear;
SPI.Send (STX'Enum_Rep);
Chip_Select.Set;
end TX;
function Wait_For_RX return Boolean is
begin
loop
exit when RX_Available;
end loop;
return True;
-- IRQ.Clear_Trigger;
-- IRQ.Wait_For_Trigger;
-- return IRQ.Triggered;
end Wait_For_RX;
function RX_Available return Boolean is
begin
return Read_Status (RXBYTES) > 0;
end RX_Available;
procedure Clear_IRQ is
begin
IRQ.Clear_Trigger;
end Clear_IRQ;
procedure RX (Packet : out Packet_Type; Length : out Natural) is
N : Natural;
begin
N := Natural (Read_Status (RXBYTES));
Chip_Select.Clear;
SPI.Send (16#3F# + 16#C0#);
for I in 1 .. N loop
SPI.Receive (Packet (I));
end loop;
Chip_Select.Set;
Length := N;
end RX;
procedure Power_Down is
begin
null;
end Power_Down;
procedure Cancel is
begin
null;
end Cancel;
end Drivers.CC1101;
|
VMika/DES_Ada | Ada | 2,558 | ads | with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;
package P_StructuralTypes is
subtype T_Key is String (1..8);
type T_Bit is mod 2
with Size => 1;
type T_BinaryUnit is array (Positive range <>) of T_Bit
with Default_Component_Value => 0;
pragma Pack (T_BinaryUnit);
subtype T_BinaryBlock is T_BinaryUnit (1..64);
subtype T_Byte is T_BinaryUnit (1..8);
subtype T_BinaryExpandedBlock is T_BinaryUnit (1..48);
subtype T_BinaryHalfBlock is T_BinaryUnit (1..32);
subtype T_BinaryKey is T_BinaryUnit (1..64);
subtype T_BinaryFormattedKey is T_BinaryUnit (1..56);
subtype T_BinaryHalfFormattedKey is T_BinaryUnit (1..28);
subtype T_BinarySubKey is T_BinaryUnit (1..48);
type T_BinaryContainer is array (Positive range <>) of T_BinaryBlock;
pragma Pack (T_BinaryContainer);
type T_BinarySubKeyArray is array (1..16) of T_BinarySubKey;
pragma Pack (T_BinarySubKeyArray);
-----------------------------------------------------------------------------
-------------------------------- ACCESS -------------------------------------
-----------------------------------------------------------------------------
type BinaryContainer_Access is access T_BinaryContainer;
type BinarySubKeyArray_Access is access T_BinarySubKeyArray;
type Key_Access is access T_Key;
-----------------------------------------------------------------------------
----------------------------- FUNCTIONS -------------------------------------
-----------------------------------------------------------------------------
function O_plus (b1 : in T_BinaryUnit ; b2 : in T_BinaryUnit) return T_BinaryUnit;
function TextBlock_To_Binary (Block : String) return T_BinaryBlock;
function Byte_To_CharacterCode (Byte : in T_Byte) return Integer;
function Integer_To_Binary (Number : Integer;
NbBits : Integer) return T_BinaryUnit;
procedure Replace_Block (Ptr_BinaryContainer : in BinaryContainer_Access;
Index : in Integer;
BinaryBlock : in T_BinaryBlock);
procedure Left_Shift (Unit : in out T_BinaryUnit;
Iteration : in Positive);
function Left (Block : T_BinaryUnit) return T_BinaryUnit;
function Right (Block : T_BinaryUnit) return T_BinaryUnit;
procedure Put_BinaryUnit (Unit : T_BinaryUnit);
end P_StructuralTypes;
|
Asier98/AdaCar | Ada | 2,252 | adb | with AdaCar.Parametros;
with AdaCar.Entrada_Salida;
package body AdaCar.Sensor_Proximidad is
--------------------------
-- Sensor_Proximidad_PO --
--------------------------
protected Sensor_Proximidad_PO
with Priority => Parametros.Techo_Sensor_Proximidad_PO
is
function Leer_Entrada_Sensor return Unidades_Distancia;
end Sensor_Proximidad_PO;
function Subida_Pulso(Canal_Entrada: in Canal_DI;
Canal_Salida: in Canal_DO) return Duration
is
Next: Real_Time.Time:= Real_Time.Clock;
Intervalo: constant Real_Time.Time_Span:= Real_Time.To_Time_Span(Duration(0.00001));
Tiempo_Inicial: Real_Time.Time;
Tiempo_Final: Real_Time.Time;
Valor_Senhal: Estado_Digital;
Dif: Duration;
begin
Next:= Real_Time.Clock;
Entrada_Salida.Salida_Digital(Canal_Salida,Estado_Digital'(1));
Tiempo_Inicial:= Real_Time.Clock;
Next:= Next+Intervalo;
delay until Next;
Entrada_Salida.Salida_Digital(Canal_Salida,Estado_Digital'(0));
loop
Valor_Senhal:= Entrada_Salida.Lectura_Digital(Canal_Entrada);
exit when Valor_Senhal=Estado_Digital'(1);
end loop;
Tiempo_Final:= Real_Time.Clock;
Dif:= Real_Time.To_Duration(Tiempo_Final-Tiempo_Inicial);
return Dif;
end Subida_Pulso;
-------------------------
-- Leer_Entrada_Sensor --
-------------------------
function Leer_Entrada_Sensor return Unidades_Distancia is
begin
return Sensor_Proximidad_PO.Leer_Entrada_Sensor;
end Leer_Entrada_Sensor;
--------------------------
-- Sensor_Proximidad_PO --
--------------------------
protected body Sensor_Proximidad_PO is
function Leer_Entrada_Sensor return Unidades_Distancia is
Duracion_Distancia: Duration;
Distancia: Unidades_Distancia;
begin
Duracion_Distancia:= Subida_Pulso(Canal_Entrada => Parametros.Canal_DI_Echo,
Canal_Salida => Parametros.Canal_DO_Trig);
Distancia:= Parametros.Factor_Distancia*Duracion_Distancia;
return Distancia;
end Leer_Entrada_Sensor;
end Sensor_Proximidad_PO;
end AdaCar.Sensor_Proximidad;
|
reznikmm/matreshka | Ada | 3,698 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Asis;
with Engines.Contexts;
with League.Strings;
package Properties.Expressions.Array_Component_Association is
function Code
(Engine : access Engines.Contexts.Context;
Element : Asis.Association;
Name : Engines.Text_Property) return League.Strings.Universal_String;
end Properties.Expressions.Array_Component_Association;
|
AdaCore/Ada_Drivers_Library | Ada | 3,018 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of AdaCore 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 is the version used when no Data-Cache exist on the MCU
package body Cortex_M.Cache is
procedure Enable_I_Cache is null;
procedure Enable_D_Cache is null;
procedure Disable_I_Cache is null;
procedure Disable_D_Cache is null;
function I_Cache_Enabled return Boolean
is (False);
function D_Cache_Enabled return Boolean
is (False);
procedure Clean_DCache
(Start : System.Address;
Len : Natural) is null;
procedure Invalidate_DCache
(Start : System.Address;
Len : Natural) is null;
procedure Clean_Invalidate_DCache
(Start : System.Address;
Len : Natural) is null;
end Cortex_M.Cache;
|
RREE/ada-util | Ada | 5,324 | adb | -----------------------------------------------------------------------
-- util-http-clients-curl -- HTTP Clients with CURL
-- Copyright (C) 2012 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body Util.Http.Mockups is
-----------------
-- Returns a boolean indicating whether the named response header has already
-- been set.
-- ------------------------------
function Contains_Header (Message : in Mockup_Message;
Name : in String) return Boolean is
begin
return Message.Headers.Contains (Name);
end Contains_Header;
-- ------------------------------
-- Returns the value of the specified response header as a String. If the response
-- did not include a header of the specified name, this method returns null.
-- If there are multiple headers with the same name, this method returns the
-- first head in the request. The header name is case insensitive. You can use
-- this method with any response header.
-- ------------------------------
function Get_Header (Message : in Mockup_Message;
Name : in String) return String is
Pos : constant Util.Strings.Maps.Cursor := Message.Headers.Find (Name);
begin
if Util.Strings.Maps.Has_Element (Pos) then
return Util.Strings.Maps.Element (Pos);
else
return "";
end if;
end Get_Header;
-- ------------------------------
-- Sets a message header with the given name and value. If the header had already
-- been set, the new value overwrites the previous one. The containsHeader
-- method can be used to test for the presence of a header before setting its value.
-- ------------------------------
overriding
procedure Set_Header (Message : in out Mockup_Message;
Name : in String;
Value : in String) is
begin
Message.Headers.Include (Name, Value);
end Set_Header;
-- ------------------------------
-- Adds a request header with the given name and value.
-- This method allows request headers to have multiple values.
-- ------------------------------
overriding
procedure Add_Header (Message : in out Mockup_Message;
Name : in String;
Value : in String) is
Pos : constant Util.Strings.Maps.Cursor := Message.Headers.Find (Name);
begin
if Util.Strings.Maps.Has_Element (Pos) then
declare
Header : constant String := Util.Strings.Maps.Element (Pos);
begin
Message.Headers.Replace_Element (Pos, Header & ASCII.CR & ASCII.LF & Value);
end;
else
Message.Headers.Include (Name, Value);
end if;
end Add_Header;
-- ------------------------------
-- Iterate over the response headers and executes the <b>Process</b> procedure.
-- ------------------------------
overriding
procedure Iterate_Headers (Message : in Mockup_Message;
Process : not null access
procedure (Name : in String;
Value : in String)) is
Iter : Util.Strings.Maps.Cursor := Message.Headers.First;
begin
while Util.Strings.Maps.Has_Element (Iter) loop
Util.Strings.Maps.Query_Element (Iter, Process);
Util.Strings.Maps.Next (Iter);
end loop;
end Iterate_Headers;
-- -------------
-- ------------------------------
-- Get the response body as a string.
-- ------------------------------
overriding
function Get_Body (Reply : in Mockup_Response) return String is
begin
return Ada.Strings.Unbounded.To_String (Reply.Content);
end Get_Body;
-- ------------------------------
-- Get the response status code.
-- ------------------------------
overriding
function Get_Status (Reply : in Mockup_Response) return Natural is
begin
return Reply.Status;
end Get_Status;
-- ------------------------------
-- Set the response status code.
-- ------------------------------
procedure Set_Status (Reply : in out Mockup_Response;
Status : in Natural) is
begin
Reply.Status := Status;
end Set_Status;
-- ------------------------------
-- Set the response body.
-- ------------------------------
procedure Set_Body (Reply : in out Mockup_Response;
Content : in String) is
begin
Reply.Content := Ada.Strings.Unbounded.To_Unbounded_String (Content);
end Set_Body;
end Util.Http.Mockups;
|
Rodeo-McCabe/orka | Ada | 5,756 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Real_Time;
with Ada.Text_IO;
with GL.Barriers;
with GL.Types;
with Orka.Algorithms.FFT;
with Orka.Contexts;
with Orka.Debug;
with Orka.Logging;
with Orka.Rendering.Buffers;
with Orka.Rendering.Programs;
with Orka.Resources.Locations.Directories;
with Orka.Types;
with Orka.Timers;
with Orka.Windows.GLFW;
procedure Orka_Test.Test_6_FFT is
Library : constant Orka.Contexts.Library'Class
:= Orka.Windows.GLFW.Initialize (Major => 4, Minor => 2, Debug => True);
Window : aliased Orka.Windows.Window'Class
:= Library.Create_Window (1, 1, Visible => False);
Context : constant Orka.Contexts.Context'Class := Window.Context;
pragma Unreferenced (Context);
----------------------------------------------------------------------
Count : constant := 2;
-- Number of times to repeat the complex numbers
In_Vertical_Direction : constant Boolean := True;
-- Apply FFT in vertical direction instead of horizontal
----------------------------------------------------------------------
use GL.Types;
use Orka.Rendering.Buffers;
use Orka.Rendering.Programs;
use Orka.Resources;
use all type Orka.Types.Element_Type;
Numbers_Small : constant Single_Array (1 .. 16) :=
(-1.1594, -2.2122,
0.6257, -0.4115,
0.8245, 0.0956,
0.1711, -0.8238,
-0.6876, 0.0567,
-2.4961, 0.7631,
1.1099, -1.3213,
-1.2707, 0.7561);
Output_Numbers_Small : constant Single_Array (1 .. 16) :=
(-2.882600, -3.097300,
0.185311, -4.923875,
-3.362100, -0.159000,
-5.024379, -6.067858,
3.057400, -3.665100,
1.704890, 0.956875,
-4.200700, -1.700600,
1.246979, 0.959258);
procedure Print_Array (Data : Single_Array) is
function Image (Value : GL.Types.Single) return String is
package Single_IO is new Ada.Text_IO.Float_IO (GL.Types.Single);
Value_String : String := "123456789012.123456";
begin
Single_IO.Put (Value_String, Value, Aft => 6, Exp => 0);
return Value_String;
end Image;
begin
for Index in 1 .. Int (Data'Length / 2) loop
Ada.Text_IO.Put_Line (Image (Data (Index * 2 - 1)) & " " & Image (Data (Index * 2)));
end loop;
end Print_Array;
BO_1 : constant Buffer := Create_Buffer
((Dynamic_Storage => True, others => False), Single_Type, Numbers_Small'Length * Count);
Timer_1 : Orka.Timers.Timer := Orka.Timers.Create_Timer;
procedure Print_Numbers (Title : String) is
Data : Single_Array (1 .. Size (BO_1.Length)) := (others => 0.0);
begin
BO_1.Get_Data (Data);
Ada.Text_IO.Put_Line (Title &
" (" & Orka.Logging.Trim (Integer'Image (Data'Length / 2)) & "):");
Print_Array (Data);
Timer_1.Wait_For_Result;
Ada.Text_IO.Put_Line ("Duration " & Title & ": " & Orka.Logging.Image
(Ada.Real_Time.To_Time_Span (Timer_1.GPU_Duration)));
end Print_Numbers;
package Fourier_Transforms renames Orka.Algorithms.FFT;
Location_Shaders : constant Locations.Location_Ptr
:= Locations.Directories.Create_Location ("../data/shaders");
FFT_CS : Fourier_Transforms.FFT := Fourier_Transforms.Create_FFT (Location_Shaders);
FFT_W : Positive;
FFT_H : Positive;
begin
Orka.Debug.Set_Log_Messages (Enable => True);
declare
Local_Size_X : constant Size := Size (BO_1.Length / Count) / 2;
begin
if In_Vertical_Direction then
FFT_W := Count;
FFT_H := Positive (Local_Size_X);
else
FFT_W := Positive (Local_Size_X);
FFT_H := Count;
end if;
end;
if In_Vertical_Direction then
-- Upload the data to the buffer in a transposed way in order to
-- test the ability to apply the FFT in the vertical direction
for I in 0 .. 7 loop
for J in 0 .. Count - 1 loop
BO_1.Set_Data (Numbers_Small (Size (I * 2 + 1) .. Size (I * 2 + 2)),
Offset => (Count * I + J) * 2);
end loop;
end loop;
else
for Index in 0 .. Count - 1 loop
BO_1.Set_Data (Numbers_Small, Offset => Numbers_Small'Length * Index);
end loop;
end if;
----------------------------------------------------------------------
Ada.Text_IO.Put_Line ("Input:");
Print_Array (Numbers_Small);
Ada.Text_IO.Put_Line ("Output:");
Print_Array (Output_Numbers_Small);
Ada.Text_IO.Put_Line ("Vertical direction: " & In_Vertical_Direction'Image);
Ada.Text_IO.Put_Line ("Rows:" & Integer'Image (Count));
Timer_1.Start;
FFT_CS.Compute_FFT (BO_1, FFT_W, FFT_H, In_Vertical_Direction, Inverse => False);
Timer_1.Stop;
GL.Barriers.Memory_Barrier
((By_Region => False, Shader_Storage | Buffer_Update => True, others => False));
Print_Numbers ("FFT");
Timer_1.Start;
FFT_CS.Compute_FFT (BO_1, FFT_W, FFT_H, In_Vertical_Direction, Inverse => True);
Timer_1.Stop;
GL.Barriers.Memory_Barrier
((By_Region => False, Buffer_Update => True, others => False));
Print_Numbers ("Inverse FFT");
end Orka_Test.Test_6_FFT;
|
reznikmm/matreshka | Ada | 3,726 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with League.Strings;
package XML.Schema.Namespace_Items is
pragma Preelaborate;
type XS_Namespace_Item is limited interface;
not overriding function Get_Schema_Namespace
(Self : not null access XS_Namespace_Item)
return League.Strings.Universal_String is abstract;
-- [schema namespace]: A namespace name or null if absent.
end XML.Schema.Namespace_Items;
|
alvaromb/Compilemon | Ada | 1,674 | ads | -- Copyright (c) 1990 Regents of the University of California.
-- All rights reserved.
--
-- This software was developed by John Self of the Arcadia project
-- at the University of California, Irvine.
--
-- Redistribution and use in source and binary forms are permitted
-- provided that the above copyright notice and this paragraph are
-- duplicated in all such forms and that any documentation,
-- advertising materials, and other materials related to such
-- distribution and use acknowledge that the software was developed
-- by the University of California, Irvine. The name of the
-- University may not be used to endorse or promote products derived
-- from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-- TITLE template manager
-- AUTHOR: John Self (UCI)
-- DESCRIPTION supports output of internalized templates for the IO and DFA
-- packages.
-- NOTES This package is quite a memory hog, and is really only useful on
-- virtual memory systems. It could use an external file to store the
-- templates like the skeleton manager. This would save memory at the
-- cost of a slight reduction in speed and the necessity of keeping
-- copies of the template files in a known place.
-- $Header: /co/ua/self/arcadia/aflex/ada/src/RCS/template_managerS.a,v 1.3 90/01/12 15:20:49 self Exp Locker: self $
package template_manager is
procedure GENERATE_DFA_FILE;
procedure GENERATE_IO_FILE;
end template_manager;
|
stcarrez/dynamo | Ada | 31,642 | adb | ------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . A _ S I N P U T --
-- --
-- B o d y --
-- --
-- Copyright (C) 1995-2010, Free Software Foundation, Inc. --
-- --
-- ASIS-for-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 --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY 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 ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adacore.com). --
-- --
------------------------------------------------------------------------------
with Ada.Characters.Handling; use Ada.Characters.Handling;
with System.WCh_Con; use System.WCh_Con;
with Asis.Set_Get; use Asis.Set_Get;
with Atree; use Atree;
with Opt; use Opt;
with Sinfo; use Sinfo;
with Sinput; use Sinput;
with Widechar; use Widechar;
package body A4G.A_Sinput is
use ASCII;
-- Make control characters visible
-----------------------
-- Local subprograms --
-----------------------
procedure Skip_Comment (P : in out Source_Ptr);
-- When P is set on the first '-' of a comment, this procedure resets
-- the value of P to the first character of the group of control
-- characters signifying the end of line containing the comment
-- initially indicated by P.
--
-- This procedure should not be used for the last comment in the
-- group of comments following a compilation unit in a compilation.
procedure Skip_String (P : in out Source_Ptr);
-- When P set on the first quoter of a string literal (it may be '"' or
-- '%', this procedure resets the value of P to the first character
-- after the literal.
-------------------------
-- A_Get_Column_Number --
-------------------------
function A_Get_Column_Number (P : Source_Ptr) return Source_Ptr is
Sindex : constant Source_File_Index := Get_Source_File_Index (P);
Src : constant Source_Buffer_Ptr := Source_Text (Sindex);
S : Source_Ptr;
Result : Source_Ptr := 0;
begin
S := Line_Start (P);
while S <= P loop
if Is_Start_Of_Wide_Char_For_ASIS (Src, S) then
Skip_Wide_For_ASIS (Src, S);
else
S := S + 1;
end if;
Result := Result + 1;
end loop;
return Result;
end A_Get_Column_Number;
-----------------------
-- Comment_Beginning --
-----------------------
function Comment_Beginning (Line_Image : Text_Buffer) return Source_Ptr is
Line_Image_Start : constant Source_Ptr := Line_Image'First;
Line_Image_End : constant Source_Ptr := Line_Image'Last;
Scanner_Pos : Source_Ptr;
String_Delimiter : Standard.Character;
begin
Scanner_Pos := Line_Image_Start - 1;
Scan_The_Line : while Scanner_Pos < Line_Image_End loop
Scanner_Pos := Scanner_Pos + 1;
case Line_Image (Scanner_Pos) is
when '"' | '%' =>
if not ((Scanner_Pos - 1) >= Line_Image_Start and then
Line_Image (Scanner_Pos - 1) = '''
and then
(Scanner_Pos + 1) <= Line_Image_End and then
Line_Image (Scanner_Pos + 1) = ''')
then
-- We have to awoid considering character literals '"'
-- '%' as string brackets
String_Delimiter := Line_Image (Scanner_Pos);
Skip_String_Literal : loop
Scanner_Pos := Scanner_Pos + 1;
if Line_Image (Scanner_Pos) = String_Delimiter then
-- we are in a legal Ada source, therefore:
if Scanner_Pos < Line_Image'Last and then
Line_Image (Scanner_Pos + 1) = String_Delimiter
then
-- Delimiter as character inside the literal.
Scanner_Pos := Scanner_Pos + 1;
else
-- End of the literal.
exit Skip_String_Literal;
end if;
end if;
end loop Skip_String_Literal;
end if;
when '-' =>
if (Scanner_Pos < Line_Image'Last) and then
(Line_Image (Scanner_Pos + 1) = '-')
then
return Scanner_Pos;
end if;
when others =>
null;
end case;
end loop Scan_The_Line;
-- There wasn't any comment if we reach this point.
return No_Location;
end Comment_Beginning;
--------------------
-- Exp_Name_Image --
--------------------
function Exp_Name_Image (Name : Node_Id) return String is
Prefix_Node : Node_Id;
Selector_Node : Node_Id;
begin
if Nkind (Name) = N_Identifier or else
Nkind (Name) = N_Defining_Identifier
then
-- ????? See E729-A04!
return Identifier_Image (Name);
end if;
if Nkind (Name) = N_Defining_Program_Unit_Name then
Prefix_Node := Sinfo.Name (Name);
Selector_Node := Defining_Identifier (Name);
else
-- Nkind (Name) = N_Expanded_Name
Prefix_Node := Prefix (Name);
Selector_Node := Selector_Name (Name);
end if;
return Exp_Name_Image (Prefix_Node)
& '.'
& Identifier_Image (Selector_Node); -- ???
end Exp_Name_Image;
-------------------
-- Get_Character --
-------------------
function Get_Character (P : Source_Ptr) return Character is
Sindex : constant Source_File_Index := Get_Source_File_Index (P);
Src : constant Source_Buffer_Ptr := Source_Text (Sindex);
begin
return Src (P);
end Get_Character;
------------------
-- Get_Location --
------------------
function Get_Location (E : Asis.Element) return Source_Ptr is
begin
return Sloc (Node (E));
end Get_Location;
-------------------------
-- Get_Num_Literal_End --
-------------------------
function Get_Num_Literal_End (P : Source_Ptr) return Source_Ptr is
Sindex : constant Source_File_Index := Get_Source_File_Index (P);
Src : constant Source_Buffer_Ptr := Source_Text (Sindex);
S : Source_Ptr;
B_Char : Character;
begin
-- Src (P) is the leading digit of a numeric literal
S := P + 1;
loop
if Is_Hexadecimal_Digit (Src (S)) or else Src (S) = '_' then
S := S + 1;
elsif Src (S) = '#' or else Src (S) = ':' then
-- based literal: 16#E#E1 or 016#offf#
-- J.2 (3): "The number sign characters (#) of a based_literal
-- can be replaced by colons (:) provided that the replacement
-- is done for both occurrences. But in case of a colon, we
-- have to make sure that we indeed have a based literal, but not
-- a decimal literal immediatelly followed by an assignment sign,
-- see G119-012:
--
-- SPLIT_INDEX:INTEGER RANGE 1..80:=1;
if Src (S) = ':' and then Src (S + 1) = '=' then
S := S - 1;
exit;
end if;
B_Char := Src (S);
-- and now - looking for trailing '#' or ':':
S := S + 1;
while Src (S) /= B_Char loop
S := S + 1;
end loop;
if Src (S + 1) = 'E' or else
Src (S + 1) = 'e'
then
-- this means something like 5#1234.1234#E2
S := S + 2;
else
exit;
end if;
elsif Src (S) = '+'
or else
Src (S) = '-'
then -- 12E+34 or 12+34?
if Src (S - 1) = 'E'
or else
Src (S - 1) = 'e'
then
-- it is the sign of the exponent
S := S + 1;
else
S := S - 1; -- to go back in the literal
exit;
end if;
elsif Src (S) = '.' then -- 3.14 or 3..14?
if Is_Hexadecimal_Digit (Src (S + 1)) then
S := S + 1;
else
S := S - 1; -- to go back in the literal
exit;
end if;
else -- for sure, we already are outside the literal
S := S - 1; -- to go back in the literal
exit;
end if;
end loop;
return S;
end Get_Num_Literal_End;
--------------------
-- Get_String_End --
--------------------
function Get_String_End (P : Source_Ptr) return Source_Ptr is
Sindex : constant Source_File_Index := Get_Source_File_Index (P);
Src : constant Source_Buffer_Ptr := Source_Text (Sindex);
S : Source_Ptr;
Quote : Character;
begin
-- Src (P) is the leading quotation of the non-nul string constant
-- which can be either '"' OR '%' (J.2 (2)).
Quote := Src (P);
S := P + 1;
loop
if Src (S) = Quote and then Src (S + 1) = Quote then
S := S + 2;
elsif Src (S) /= Quote then
if Is_Start_Of_Wide_Char_For_ASIS (Src, S) then
Skip_Wide_For_ASIS (Src, S);
else
S := S + 1;
end if;
else
-- S points to the trailing quotation of the constant
exit;
end if;
end loop;
return S;
end Get_String_End;
-------------------
-- Get_Wide_Word --
-------------------
function Get_Wide_Word
(P_Start : Source_Ptr;
P_End : Source_Ptr)
return Wide_String
is
Sindex : constant Source_File_Index := Get_Source_File_Index (P_Start);
Src : constant Source_Buffer_Ptr := Source_Text (Sindex);
Result : Wide_String (1 .. Positive (P_End - P_Start + 1));
Last_Idx : Natural := 0;
Next_Ch : Char_Code;
S : Source_Ptr;
Success : Boolean;
pragma Unreferenced (Success);
begin
S := P_Start;
while S <= P_End loop
Last_Idx := Last_Idx + 1;
if Is_Start_Of_Wide_Char_For_ASIS (Src, S) then
Scan_Wide (Src, S, Next_Ch, Success);
Result (Last_Idx) := Wide_Character'Val (Next_Ch);
else
Result (Last_Idx) := To_Wide_Character (Src (S));
S := S + 1;
end if;
end loop;
return Result (1 .. Last_Idx);
end Get_Wide_Word;
-----------------
-- Get_Wide_Ch --
-----------------
function Get_Wide_Ch (S : Source_Ptr) return Wide_Character is
Sindex : constant Source_File_Index := Get_Source_File_Index (S);
Src : constant Source_Buffer_Ptr := Source_Text (Sindex);
S1 : Source_Ptr := S;
Ch : Char_Code;
Result : Wide_Character;
Success : Boolean;
pragma Unreferenced (Success);
begin
if Is_Start_Of_Wide_Char_For_ASIS (Src, S1) then
Scan_Wide (Src, S1, Ch, Success);
Result := Wide_Character'Val (Ch);
else
Result := To_Wide_Character (Src (S1));
end if;
return Result;
end Get_Wide_Ch;
------------------
-- Get_Word_End --
------------------
function Get_Word_End
(P : Source_Ptr;
In_Word : In_Word_Condition)
return Source_Ptr
is
S : Source_Ptr;
begin
S := P;
while In_Word (S + 1) loop
S := S + 1;
end loop;
return S;
end Get_Word_End;
----------------------
-- Identifier_Image --
----------------------
function Identifier_Image (Ident : Node_Id) return String is
Image_Start : Source_Ptr;
Image_End : Source_Ptr;
begin
Image_Start := Sloc (Ident);
Image_End := Get_Word_End (P => Image_Start,
In_Word => In_Identifier'Access);
-- See E729-A04!!!
return To_String (Get_Wide_Word (Image_Start, Image_End));
end Identifier_Image;
-------------------
-- In_Identifier --
-------------------
function In_Identifier (P : Source_Ptr) return Boolean is
Sindex : constant Source_File_Index := Get_Source_File_Index (P);
Src : constant Source_Buffer_Ptr := Source_Text (Sindex);
Char : Character;
Result : Boolean := True;
begin
Char := Src (P);
if Char = ' ' or else
Char = '&' or else
Char = ''' or else
Char = '(' or else
Char = ')' or else
Char = '*' or else
Char = '+' or else
Char = ',' or else
Char = '-' or else
Char = '.' or else
Char = '/' or else
Char = ':' or else
Char = ';' or else
Char = '<' or else
Char = '=' or else
Char = '>' or else
Char = '|' or else
Char = '!' or else
Char = ASCII.LF or else
Char = ASCII.FF or else
Char = ASCII.HT or else
Char = ASCII.VT or else
Char = ASCII.CR
then
Result := False;
end if;
return Result;
end In_Identifier;
-----------------
-- Is_EOL_Char --
-----------------
function Is_EOL_Char (Ch : Character) return Boolean is
Result : Boolean := False;
begin
Result :=
Ch = ASCII.CR
or else
Ch = ASCII.LF
or else
Ch = ASCII.FF
or else
Ch = ASCII.VT;
return Result;
end Is_EOL_Char;
------------------------------------
-- Is_Start_Of_Wide_Char_For_ASIS --
------------------------------------
function Is_Start_Of_Wide_Char_For_ASIS
(S : Source_Buffer_Ptr;
P : Source_Ptr;
C : Source_Ptr := No_Location)
return Boolean
is
Result : Boolean := False;
begin
if C /= No_Location and then P > C then
-- We are in comment, so we can not have bracket encoding
if Wide_Character_Encoding_Method /= WCEM_Brackets then
Result := Is_Start_Of_Wide_Char (S, P);
end if;
else
Result := Is_Start_Of_Wide_Char (S, P);
if not Result then
Result := P <= S'Last - 2
and then S (P) = '['
and then S (P + 1) = '"'
and then (S (P + 2) in '0' .. '9'
or else
S (P + 2) in 'a' .. 'f'
or else
S (P + 2) in 'A' .. 'F');
end if;
end if;
return Result;
end Is_Start_Of_Wide_Char_For_ASIS;
---------------------
-- Next_Identifier --
---------------------
function Next_Identifier (P : Source_Ptr) return Source_Ptr is
Sindex : constant Source_File_Index := Get_Source_File_Index (P);
Src : constant Source_Buffer_Ptr := Source_Text (Sindex);
S : Source_Ptr;
begin
S := P + 1;
while not Is_Letter (Src (S)) loop
if Src (S) = '-' and then Src (S + 1) = '-' then
Skip_Comment (S);
else
S := S + 1;
end if;
end loop;
return S;
end Next_Identifier;
---------------------
-- Number_Of_Lines --
---------------------
function Number_Of_Lines (E : Asis.Element) return Integer is
SFI : constant Source_File_Index :=
Get_Source_File_Index (Get_Location (E));
begin
-- return Integer (Num_Source_Lines (SFI) + Line_Offset (SFI));
return Integer (Num_Source_Lines (SFI));
end Number_Of_Lines;
--------------------
-- Operator_Image --
--------------------
function Operator_Image (Node : Node_Id) return String is
S_Start : constant Source_Ptr := Sloc (Node);
-- S_Start points to the leading character of a given operator symbol.
Sindex : constant Source_File_Index :=
Get_Source_File_Index (S_Start);
Src : constant Source_Buffer_Ptr := Source_Text (Sindex);
S_End : Source_Ptr := S_Start;
-- should be set as pointing to the last character of a given
-- operator symbol.
Ch : Character;
begin
Ch := Src (S_Start);
if Ch = 'A' or else Ch = 'a' -- "abs" or "and"
or else Ch = 'M' or else Ch = 'm' -- "mod"
or else Ch = 'N' or else Ch = 'n' -- "not"
or else Ch = 'R' or else Ch = 'r' -- "rem"
or else Ch = 'X' or else Ch = 'x' -- "xor"
then
S_End := S_Start + 2;
elsif Ch = 'O' or else Ch = 'o' then -- "or"
S_End := S_Start + 1;
elsif Ch = '=' -- "="
or else Ch = '+' -- "+"
or else Ch = '-' -- "-"
or else Ch = '&' -- "&"
then
S_End := S_Start;
elsif Ch = '/' -- "/=" or "/"?
or else Ch = '<' -- "<=" or "<"?
or else Ch = '>' -- ">=" or ">"?
or else Ch = '*' -- "**" or "*"?
then
Ch := Src (S_Start + 1);
if Ch = '=' or else -- "/=", "<=" or ">="
Ch = '*' -- "**"
then
S_End := S_Start + 1;
else
S_End := S_Start;
-- "<", ">", "*" or "/"
end if;
end if;
return (1 => '"') & String (Src (S_Start .. S_End)) & (1 => '"');
end Operator_Image;
-------------------------
-- Rightmost_Non_Blank --
-------------------------
function Rightmost_Non_Blank (P : Source_Ptr) return Source_Ptr is
S : Source_Ptr := P;
Sindex : constant Source_File_Index := Get_Source_File_Index (P);
Src : constant Source_Buffer_Ptr := Source_Text (Sindex);
begin
loop
if Src (S) = '-' and then Src (S + 1) = '-' then
Skip_Comment (S);
elsif Is_Graphic (Src (S)) and then Src (S) /= ' ' then
exit;
else
S := S + 1;
end if;
end loop;
return S;
end Rightmost_Non_Blank;
------------------------------
-- Search_Beginning_Of_Word --
------------------------------
function Search_Beginning_Of_Word (S : Source_Ptr) return Source_Ptr is
SFI : constant Source_File_Index := Get_Source_File_Index (S);
Src : constant Source_Buffer_Ptr := Source_Text (SFI);
S_P : Source_Ptr;
begin
S_P := S;
while S_P >= Source_First (SFI)
and then (Src (S_P) in 'A' .. 'Z' or else
Src (S_P) in 'a' .. 'z' or else
Src (S_P) in '0' .. '9' or else
Src (S_P) = '_')
loop
S_P := S_P - 1;
end loop;
return S_P + 1;
end Search_Beginning_Of_Word;
------------------------
-- Search_End_Of_Word --
------------------------
function Search_End_Of_Word (S : Source_Ptr) return Source_Ptr is
S_P : Source_Ptr := S;
SFI : constant Source_File_Index := Get_Source_File_Index (S);
Src : constant Source_Buffer_Ptr := Source_Text (SFI);
Char : Character;
begin
Char := Src (S_P);
while not (Char = ' ' or else
Char = '&' or else
Char = ''' or else
Char = '(' or else
Char = ')' or else
Char = '*' or else
Char = '+' or else
Char = ',' or else
Char = '-' or else
Char = '.' or else
Char = '/' or else
Char = ':' or else
Char = ';' or else
Char = '<' or else
Char = '=' or else
Char = '>' or else
Char = '|' or else
Char = '!' or else
Char = ASCII.LF or else
Char = ASCII.FF or else
Char = ASCII.HT or else
Char = ASCII.VT or else
Char = ASCII.CR)
loop
S_P := S_P + 1;
Char := Src (S_P);
end loop;
S_P := S_P - 1;
return S_P;
end Search_End_Of_Word;
-----------------------------
-- Search_Left_Parenthesis --
-----------------------------
function Search_Left_Parenthesis (S : Source_Ptr) return Source_Ptr is
S_P : Source_Ptr := S - 1;
SFI : constant Source_File_Index := Get_Source_File_Index (S);
Src : constant Source_Buffer_Ptr := Source_Text (SFI);
begin
loop
case Src (S_P) is
when '(' =>
return S_P;
when CR | LF =>
declare
TempS : Source_Ptr := Line_Start (S_P);
begin
while (Src (TempS) /= '-' or else
Src (TempS + 1) /= '-')
and then
TempS < S_P
loop
TempS := TempS + 1;
end loop;
S_P := TempS - 1;
end;
when others =>
S_P := S_P - 1;
end case;
end loop;
end Search_Left_Parenthesis;
----------------------
-- Search_Next_Word --
----------------------
function Search_Next_Word (S : Source_Ptr) return Source_Ptr is
S_P : Source_Ptr := S + 1;
SFI : constant Source_File_Index := Get_Source_File_Index (S);
Src : constant Source_Buffer_Ptr := Source_Text (SFI);
begin
loop
case Src (S_P) is
when ' ' | HT | CR | LF =>
S_P := S_P + 1;
when '-' =>
if Src (S_P + 1) = '-' then
Skip_Comment (S_P);
else
return S_P;
end if;
when others =>
return S_P;
end case;
end loop;
end Search_Next_Word;
----------------------
-- Search_Prev_Word --
----------------------
function Search_Prev_Word (S : Source_Ptr) return Source_Ptr is
S_P : Source_Ptr := S - 1;
SFI : constant Source_File_Index := Get_Source_File_Index (S);
Src : constant Source_Buffer_Ptr := Source_Text (SFI);
begin
loop
case Src (S_P) is
when ' ' | HT =>
S_P := S_P - 1;
when CR | LF =>
declare
TempS : Source_Ptr := Line_Start (S_P);
begin
while (Src (TempS) /= '-' or else
Src (TempS + 1) /= '-')
and then
TempS < S_P
loop
TempS := TempS + 1;
end loop;
S_P := TempS - 1;
end;
when others =>
return S_P;
end case;
end loop;
end Search_Prev_Word;
----------------------------
-- Search_Prev_Word_Start --
----------------------------
function Search_Prev_Word_Start (S : Source_Ptr) return Source_Ptr is
begin
return Search_Beginning_Of_Word (Search_Prev_Word (S));
end Search_Prev_Word_Start;
-----------------------------
-- Search_Rightmost_Symbol --
-----------------------------
function Search_Rightmost_Symbol
(P : Source_Ptr;
Char : Character := ';')
return Source_Ptr
is
S : Source_Ptr := P;
-- the location to be returned, the search is started from P
Sindex : constant Source_File_Index := Get_Source_File_Index (P);
Src : constant Source_Buffer_Ptr := Source_Text (Sindex);
begin
while Src (S) /= Char loop
if Src (S) = '-' and then Src (S + 1) = '-' then
Skip_Comment (S);
elsif (Src (S) = '"' or else Src (S) = '%')
and then
not (Src (S - 1) = ''' and then Src (S + 1) = ''')
then
Skip_String (S);
else
S := S + 1;
end if;
end loop;
return S;
end Search_Rightmost_Symbol;
-----------------
-- Skip_String --
-----------------
procedure Skip_String (P : in out Source_Ptr) is
Sindex : constant Source_File_Index := Get_Source_File_Index (P);
Src : constant Source_Buffer_Ptr := Source_Text (Sindex);
Quoter : constant Character := Src (P);
begin
-- we are in the beginning of a legal string literal in a legal
-- Ada program. So we do not have to be careful with all
-- the checks:
while not (Src (P) = Quoter and then Src (P + 1) /= Quoter) loop
P := P + 1;
end loop;
P := P + 1;
end Skip_String;
------------------
-- Skip_Comment --
------------------
procedure Skip_Comment (P : in out Source_Ptr) is
Sindex : constant Source_File_Index := Get_Source_File_Index (P);
Src : constant Source_Buffer_Ptr := Source_Text (Sindex);
begin
if Src (P) = '-' and then Src (P + 1) = '-' then
P := P + 2;
while not (Src (P) = VT or else
Src (P) = CR or else
Src (P) = LF or else
Src (P) = FF)
loop
P := P + 1;
end loop;
end if;
end Skip_Comment;
------------------------
-- Skip_Wide_For_ASIS --
------------------------
procedure Skip_Wide_For_ASIS
(S : Source_Buffer_Ptr;
P : in out Source_Ptr)
is
Old_P : constant Source_Ptr := P;
Old_Wide_Character_Encoding_Method : WC_Encoding_Method;
begin
Skip_Wide (S, P);
if P = Old_P + 1 then
-- We have a bracket encoding, but the encoding method is different
-- from WCEM_Brackets
P := P - 1;
Old_Wide_Character_Encoding_Method := Wide_Character_Encoding_Method;
Wide_Character_Encoding_Method := WCEM_Brackets;
Skip_Wide (S, P);
Wide_Character_Encoding_Method := Old_Wide_Character_Encoding_Method;
end if;
end Skip_Wide_For_ASIS;
------------------------------
-- Source_Locations_To_Span --
------------------------------
function Source_Locations_To_Span
(Span_Beg : Source_Ptr;
Span_End : Source_Ptr)
return Span
is
Sp : Span;
begin
Sp.First_Line := Line_Number (Get_Physical_Line_Number (Span_Beg));
Sp.First_Column := Character_Position (A_Get_Column_Number (Span_Beg));
Sp.Last_Line := Line_Number (Get_Physical_Line_Number (Span_End));
Sp.Last_Column := Character_Position (A_Get_Column_Number (Span_End));
return Sp;
end Source_Locations_To_Span;
-----------------------
-- Wide_String_Image --
-----------------------
function Wide_String_Image (Node : Node_Id) return Wide_String is
S_Start : constant Source_Ptr := Sloc (Node);
-- S_Start points to the leading quote of a given string literal.
Sindex : constant Source_File_Index :=
Get_Source_File_Index (S_Start);
Src : constant Source_Buffer_Ptr := Source_Text (Sindex);
S_End : Source_Ptr := S_Start + 1;
-- should be set as pointing to the last character of a
-- string literal; empty and non-empty literals are processed
-- in the same way - we simply take a literal as it is from the
-- Source Buffer
Quote : constant Character := Src (S_Start);
-- Quoter may be '"' or '%'!
begin
loop
if Src (S_End) = Quote and then
Src (S_End + 1) = Quote
then
-- doubled string quote as an element of a given string
S_End := S_End + 2;
elsif Src (S_End) /= Quote then
-- "usial" string element
S_End := S_End + 1;
else
-- S_End points to the trailing quote of a given string
exit;
end if;
end loop;
declare
Result : Wide_String (1 .. Positive (S_End - S_Start + 1));
Last_Idx : Natural := 0;
Next_Ch : Char_Code;
S : Source_Ptr;
Success : Boolean;
pragma Unreferenced (Success);
begin
S := S_Start;
while S <= S_End loop
Last_Idx := Last_Idx + 1;
if Is_Start_Of_Wide_Char_For_ASIS (Src, S) then
Scan_Wide (Src, S, Next_Ch, Success);
Result (Last_Idx) := Wide_Character'Val (Next_Ch);
else
Result (Last_Idx) := To_Wide_Character (Src (S));
S := S + 1;
end if;
end loop;
return Result (1 .. Last_Idx);
end;
end Wide_String_Image;
end A4G.A_Sinput;
|
zhmu/ananas | Ada | 81 | ads | package Elab7_Pkg2 is
pragma Elaborate_Body;
procedure A;
end Elab7_Pkg2;
|
zhmu/ananas | Ada | 354 | ads |
package Inline17_Pkg3 is
type SQL_Field is tagged null record;
function "+" (Field : SQL_Field'Class) return Integer;
type Ref is record
Data : Integer;
end record;
function Unchecked_Get (Self : Ref) return Integer with Inline_Always;
function Get (Self : Ref) return Integer is (Unchecked_Get (Self));
end Inline17_Pkg3;
|
AdaCore/Ada_Drivers_Library | Ada | 6,485 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
package body MMA8653 is
function To_Axis_Data is new Ada.Unchecked_Conversion (UInt10, Axis_Data);
function Read_Register (This : MMA8653_Accelerometer'Class;
Addr : Register_Addresss) return UInt8;
procedure Write_Register (This : MMA8653_Accelerometer'Class;
Addr : Register_Addresss;
Val : UInt8);
-------------------
-- Read_Register --
-------------------
function Read_Register (This : MMA8653_Accelerometer'Class;
Addr : Register_Addresss) return UInt8
is
Data : I2C_Data (1 .. 1);
Status : I2C_Status;
begin
This.Port.Mem_Read (Addr => Device_Address,
Mem_Addr => UInt16 (Addr),
Mem_Addr_Size => Memory_Size_8b,
Data => Data,
Status => Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
return Data (Data'First);
end Read_Register;
--------------------
-- Write_Register --
--------------------
procedure Write_Register (This : MMA8653_Accelerometer'Class;
Addr : Register_Addresss;
Val : UInt8)
is
Status : I2C_Status;
begin
This.Port.Mem_Write (Addr => Device_Address,
Mem_Addr => UInt16 (Addr),
Mem_Addr_Size => Memory_Size_8b,
Data => (1 => Val),
Status => Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
end Write_Register;
---------------
-- Configure --
---------------
procedure Configure (This : in out MMA8653_Accelerometer;
Dyna_Range : Dynamic_Range;
Sleep_Oversampling : Oversampling_Mode;
Active_Oversampling : Oversampling_Mode)
is
CTRL1 : CTRL_REG1_Register;
CTRL2 : CTRL_REG2_Register;
begin
-- Enter standby mode to be able to set configuration
CTRL1.Active := False;
This.Write_Register (CTRL_REG1, To_UInt8 (CTRL1));
CTRL2.MODS := Active_Oversampling'Enum_Rep;
CTRL2.SMODS := Sleep_Oversampling'Enum_Rep;
This.Write_Register (CTRL_REG2, To_UInt8 (CTRL2));
This.Write_Register (XYZ_DATA_CFG, Dyna_Range'Enum_Rep);
CTRL1.Active := True;
This.Write_Register (CTRL_REG1, To_UInt8 (CTRL1));
end Configure;
---------------------
-- Check_Device_Id --
---------------------
function Check_Device_Id (This : MMA8653_Accelerometer) return Boolean is
begin
return Read_Register (This, Who_Am_I) = Device_Id;
end Check_Device_Id;
---------------
-- Read_Data --
---------------
function Read_Data (This : MMA8653_Accelerometer) return All_Axes_Data is
function Convert (MSB, LSB : UInt8) return Axis_Data;
-------------
-- Convert --
-------------
function Convert (MSB, LSB : UInt8) return Axis_Data is
Tmp : UInt10;
begin
Tmp := UInt10 (Shift_Right (LSB, 6));
Tmp := Tmp or UInt10 (MSB) * 2**2;
return To_Axis_Data (Tmp);
end Convert;
Status : I2C_Status;
Data : I2C_Data (1 .. 7);
Ret : All_Axes_Data;
begin
This.Port.Mem_Read (Addr => Device_Address,
Mem_Addr => UInt16 (DATA_STATUS),
Mem_Addr_Size => Memory_Size_8b,
Data => Data,
Status => Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
Ret.X := Convert (Data (2), Data (3));
Ret.Y := Convert (Data (4), Data (5));
Ret.Z := Convert (Data (6), Data (7));
return Ret;
end Read_Data;
end MMA8653;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.