repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
stcarrez/ada-util | Ada | 3,630 | adb | -----------------------------------------------------------------------
-- util-commands-consoles -- Console interface
-- Copyright (C) 2014, 2015, 2017, 2018, 2023 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body Util.Commands.Consoles is
-- ------------------------------
-- Print the title for the given field and setup the associated field size.
-- ------------------------------
procedure Print_Title (Console : in out Console_Type;
Field : in Field_Type;
Title : in Input_Type;
Length : in Positive;
Justify : in Justify_Type := J_LEFT) is
begin
Console.Sizes (Field) := Length;
if Console.Field_Count >= 1 then
Console.Cols (Field) := Console.Cols (Console.Fields (Console.Field_Count))
+ Console.Sizes (Console.Fields (Console.Field_Count));
else
Console.Cols (Field) := 1;
end if;
Console.Field_Count := Console.Field_Count + 1;
Console.Fields (Console.Field_Count) := Field;
Console_Type'Class (Console).Print_Title (Field, Title, Justify);
end Print_Title;
-- ------------------------------
-- Set the length of a field.
-- ------------------------------
procedure Set_Field_Length (Console : in out Console_Type;
Field : in Field_Type;
Length : in Positive) is
begin
Console.Sizes (Field) := Length;
if Console.Field_Count >= 1 then
Console.Cols (Field) := Console.Cols (Console.Fields (Console.Field_Count))
+ Console.Sizes (Console.Fields (Console.Field_Count));
else
Console.Cols (Field) := 1;
end if;
Console.Field_Count := Console.Field_Count + 1;
Console.Fields (Console.Field_Count) := Field;
end Set_Field_Length;
-- ------------------------------
-- Format the integer and print it for the given field.
-- ------------------------------
procedure Print_Field (Console : in out Console_Type;
Field : in Field_Type;
Value : in Integer;
Justify : in Justify_Type := J_LEFT) is
Val : constant Input_Type := To_Input (Value);
begin
Console_Type'Class (Console).Print_Field (Field, Val, Justify);
end Print_Field;
-- ------------------------------
-- Get the field count that was setup through the Print_Title calls.
-- ------------------------------
function Get_Field_Count (Console : in Console_Type) return Natural is
begin
return Console.Field_Count;
end Get_Field_Count;
-- ------------------------------
-- Reset the field count.
-- ------------------------------
procedure Clear_Fields (Console : in out Console_Type) is
begin
Console.Field_Count := 0;
end Clear_Fields;
end Util.Commands.Consoles;
|
zhmu/ananas | Ada | 2,615 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . D I M . M K S _ I O --
-- --
-- S p e c --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
-- Provides output facilities for the MKS dimension system (see System.Dim.Mks
-- and System.Dim.Float_IO).
with System.Dim.Mks; use System.Dim.Mks;
with System.Dim.Float_IO;
package System.Dim.Mks_IO is new System.Dim.Float_IO (Mks_Type);
|
sungyeon/drake | Ada | 235 | adb | package body System.Shared_Locking is
pragma Suppress (All_Checks);
procedure Enter is
begin
Enter_Hook.all;
end Enter;
procedure Leave is
begin
Leave_Hook.all;
end Leave;
end System.Shared_Locking;
|
reznikmm/matreshka | Ada | 3,579 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-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 AMF.URI_Stores;
with League.Strings;
package XMI.Reader is
function Read_URI
(URI : League.Strings.Universal_String)
return AMF.URI_Stores.URI_Store_Access;
-- Loads model from the specified URI.
end XMI.Reader;
|
dan76/Amass | Ada | 3,829 | ads | -- Copyright © by Jeff Foley 2017-2023. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
-- SPDX-License-Identifier: Apache-2.0
local json = require("json")
name = "IntelX"
type = "api"
useragent = "OWASP Amass"
host = "https://2.intelx.io/"
max = 1000
function start()
set_rate_limit(2)
end
function check()
local c
local cfg = datasrc_config()
if (cfg ~= nil) then
c = cfg.credentials
end
if (c ~= nil and c.key ~= nil and c.key ~= "") then
return true
end
return false
end
function vertical(ctx, domain)
local c
local cfg = datasrc_config()
if (cfg ~= nil) then
c = cfg.credentials
end
if (c == nil or c.key == nil or c.key == "") then
return
end
phonebook(ctx, domain, c.key)
end
function phonebook(ctx, domain, key)
local id = search(ctx, "", domain, key)
if (id == "") then
return
end
local status = 3
local limit = 1000
while status == 0 or status == 3 do
local resp = results(ctx, id, limit, key)
if (resp == nil) then
break
end
status = resp.status
if ((status == 0 or status == 1) and resp.selectors ~= nil and #(resp.selectors) > 0) then
if (#(resp.selectors) < limit) then
limit = limit - #(resp.selectors)
end
for _, s in pairs(resp.selectors) do
local t = s.selectortype
if (t == 2 or t == 3 or t == 23) then
print(s.selectorvalue)
send_names(ctx, s.selectorvalue)
end
end
end
if (limit <= 0) then
break
end
end
end
function search(ctx, domain, key)
local body, resp, err
body, err = json.encode({
['term']=domain,
['lookuplevel']=0,
['timeout']=0,
['maxresults']=max,
['datefrom']="",
['dateto']="",
['sort']=0,
['media']=0,
})
if (err ~= nil and err ~= "") then
return ""
end
resp, err = request(ctx, {
['url']=host .. "phonebook/search",
['method']="POST",
['header']={
['x-key']=key,
['Content-Type']="application/json",
['User-Agent']=useragent,
['Connection']="keep-alive",
},
['body']=body,
})
if (err ~= nil and err ~= "") then
log(ctx, "search request to service failed: " .. err)
return ""
elseif (resp.status_code < 200 or resp.status_code >= 400) then
log(ctx, "search request to service returned with status: " .. resp.status)
return ""
end
local d = json.decode(resp.body)
if (d == nil) then
log(ctx, "failed to decode the JSON response")
return ""
elseif (d.status == nil or d.id == nil or d.status ~= 0) then
return ""
end
return d.id
end
function results(ctx, id, limit, key)
local resp, err = request(ctx, {
['url']=host .. "phonebook/search/result?id=" .. id .. "&limit=" .. limit,
['header']={
['x-key']=key,
['User-Agent']=useragent,
['Connection']="keep-alive",
},
})
if (err ~= nil and err ~= "") then
log(ctx, "result request to service failed: " .. err)
return nil
elseif (resp.status_code < 200 or resp.status_code >= 400) then
log(ctx, "result request to service returned with status: " .. resp.status)
return nil
end
local d = json.decode(resp.body)
if (d == nil) then
log(ctx, "failed to decode the JSON response")
return nil
elseif (d.status == nil) then
return nil
end
return d
end
|
zhmu/ananas | Ada | 3,456 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY COMPONENTS --
-- --
-- S Y S T E M . S T R I N G _ C O M P A R E --
-- --
-- S p e c --
-- --
-- Copyright (C) 2002-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. --
-- --
------------------------------------------------------------------------------
-- This package contains functions for runtime comparisons on strings
package System.String_Compare is
function Str_Compare
(Left : System.Address;
Right : System.Address;
Left_Len : Natural;
Right_Len : Natural) return Integer;
-- Compare the string starting at address Left of length Left_Len
-- with the string starting at address Right of length Right_Len.
-- The comparison is in the normal Ada semantic sense of string
-- comparison. The result is -1,0,+1 for Left<Right, Left=Right,
-- Left>Right respectively. This function works with 4 byte words
-- if the operands are aligned on 4-byte boundaries and long enough.
function Str_Compare_Bytes
(Left : System.Address;
Right : System.Address;
Left_Len : Natural;
Right_Len : Natural) return Integer;
-- Same functionality as Str_Compare but always proceeds by bytes.
-- Used when the caller knows that the operands are unaligned, or
-- short enough that it makes no sense to go by words.
end System.String_Compare;
|
Componolit/libsparkcrypto | Ada | 2,463 | ads | -------------------------------------------------------------------------------
-- 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.
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- AES Debug package
--
-- Debug is done through Debug pragmas. As the compiler has to with the debug
-- package to make it available to this pragma, this is an empty package which
-- makes the SPARK Examiner accept the respective with clause. Debug functions,
-- however, cannot (and should not) be use from within SPARK.
-------------------------------------------------------------------------------
private package LSC.Internal.AES.Print
is
pragma Pure;
end LSC.Internal.AES.Print;
|
ZinebZaad/ENSEEIHT | Ada | 826 | adb | with Ada.Text_IO; use Ada.Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
with Vecteurs_Creux; use Vecteurs_Creux;
-- Exemple d'utilisation des vecteurs creux.
procedure Exemple_Vecteurs_Creux is
V : T_Vecteur_Creux;
Epsilon: constant Float := 1.0e-5;
begin
Put_Line ("Début du scénario");
-- Initialiser V ne marchera pas car on n'a encore modifié Est_Nul.
Initialiser(V);
Afficher(V);
New_Line;
pragma Assert(Est_Nul(V) = True);
Detruire(V);
pragma Assert(Composante_Recursif(V, 18) = 0.0);
pragma Assert(Composante_Iteratif(V, 18) = 0.0);
Modifier(V, 18, 1.0);
Modifier(V, 2, 3.0);
Modifier(V, 5, 11.0);
Afficher(V);
pragma Assert(Composante_Recursif(V, 18) = 1.0);
pragma Assert(Composante_Iteratif(V, 2) = 3.0);
Put_Line ("Fin du scénario");
end Exemple_Vecteurs_Creux;
|
wooky/aoc | Ada | 262 | ads | with AOC; use AOC;
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings; use Interfaces.C.Strings;
function Run (File_C : chars_ptr; Year, Day : Positive) return Solution
with
Export => True,
Convention => C,
External_Name => "run_ada";
|
stcarrez/dynamo | Ada | 17,683 | ads | ------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A S I S . S E T _ G E T --
-- --
-- S p e c --
-- --
-- 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.Calendar; use Ada.Calendar;
with Asis.Extensions; use Asis.Extensions;
package Asis.Set_Get is
pragma Elaborate_Body (Asis.Set_Get);
-- This package contains the interface routines for setting and getting
-- the values of the internal components of the main ASIS abstractions -
-- Context, Compilation_Unit and Element. All the operations for getting
-- components are defined as functions, but the operations for obtaining
-- the tree nodes from an Element value may change the tree being accessed,
-- which should be considered as the side effect.
-- THE DOCUMENTATION IS INCOMPLETE!!!!!
---------------------------------------
-- String -> Program_Text conversion --
---------------------------------------
function To_Program_Text (S : String) return Program_Text;
-- This function takes the string which is a part of the source code
-- representation and converts it into ASIS Program_Text type. It tries
-- to recognize the wide character encoding and to convert it back into
-- Wide_Character
-------------
-- CONTEXT --
-------------
-------------------------------------
-- Id <-> ASIS Context conversions --
-------------------------------------
function Get_Cont_Id (C : Context) return Context_Id;
function Get_Cont (Id : Context_Id) return Context;
procedure Set_Cont (C : out Context; Id : Context_Id);
-- Assigns the value of Id to the Id fields of a given variable C
-- of the Asis Context type
pragma Inline (Get_Cont_Id);
pragma Inline (Get_Cont);
--------------------------------
-- Getting Context Attributes --
--------------------------------
function Valid (C : Context) return Boolean;
-- checks if its argument is an opened (=valid) Context
-- DO WE REALLY NEED THIS FUNCTION??
----------------------
-- COMPILATION_UNIT --
----------------------
----------------------------------------------
-- Id <-> ASIS Compilation Unit conversions --
----------------------------------------------
function Get_Unit_Id (C_U : Compilation_Unit) return Unit_Id;
function Get_Comp_Unit
(U : Unit_Id;
C : Context_Id)
return Compilation_Unit;
-- this function creates the new value of the Compilation_Unit
-- type; note, that it also sets the field Obtained as equal to
-- the current OS time
function Get_Comp_Unit_List
(U_List : Unit_Id_List;
C : Context_Id)
return Compilation_Unit_List;
-- Creates the ASIS Compilation Unit List from the list of unit Ids
pragma Inline (Get_Unit_Id);
pragma Inline (Get_Comp_Unit);
-----------------------------------------
-- Getting Compilation Unit Attributes --
-----------------------------------------
function Not_Nil (C_U : Compilation_Unit) return Boolean;
-- Check if C_U /= Nil_Compilation_Unit (the name "Exists" is already
-- busy in ASIS
function Nil (C_U : Compilation_Unit) return Boolean;
-- Check if C_U = Nil_Compilation_Unit
function Is_Standard (C_U : Compilation_Unit) return Boolean;
-- Check if C_U represents the predefined package Standard
function Kind (C_U : Compilation_Unit) return Asis.Unit_Kinds;
function Class (C_U : Compilation_Unit) return Unit_Classes;
function Origin (C_U : Compilation_Unit) return Unit_Origins;
function Is_Main_Unit (C_U : Compilation_Unit) return Boolean;
function Top (C_U : Compilation_Unit) return Node_Id;
function Is_Body_Required (C_U : Compilation_Unit) return Boolean;
function Unit_Name (C_U : Compilation_Unit) return String;
function Encl_Cont (C_U : Compilation_Unit) return Context;
function Encl_Cont_Id (C_U : Compilation_Unit) return Context_Id;
function Source_File (C_U : Compilation_Unit) return String;
function Ref_File (C_U : Compilation_Unit) return String;
function Context_Info (C_U : Compilation_Unit) return String;
function Time_Stamp (C_U : Compilation_Unit) return Time;
function Source_Status (C_U : Compilation_Unit)
return Source_File_Statuses;
function Main_Tree (C_U : Compilation_Unit) return Tree_Id;
-------------------
-- Miscellaneous --
-------------------
function "=" (Left, Right : Compilation_Unit) return Boolean;
-- This function "re-implements" the equivalent-to-predefined
-- compare operation for Compilation_Unit. It should never be used in
-- any ASIS application code.
function Valid (C_U : Compilation_Unit) return Boolean;
-- checks, if the argument is valid, that is, if its enclosing
-- Context is opened
procedure Reset_Main_Tree (C_U : Compilation_Unit);
-- If C_U is a main unit in some tree, this procedure resets
-- this tree, otherwise it does nothing. This procedure does not
-- reset the context, it should be done by a caller.
function Get_Configuration_CU
(C_U : Compilation_Unit)
return Compilation_Unit;
-- Returns the ASIS COmpilation unit which represents
-- A_Configuration_Compilation in the enclosing context of C_U
pragma Inline (Not_Nil);
pragma Inline (Nil);
pragma Inline (Is_Standard);
pragma Inline (Kind);
pragma Inline (Class);
pragma Inline (Origin);
pragma Inline (Is_Main_Unit);
pragma Inline (Top);
pragma Inline (Is_Body_Required);
pragma Inline (Unit_Name);
pragma Inline (Encl_Cont);
pragma Inline (Encl_Cont_Id);
pragma Inline (Valid);
-- THIS "INLINE" LIST IS INCOMPLETE!!!
-------------
-- ELEMENT --
-------------
function "=" (Left, Right : Element) return Boolean;
-- This function "re-implements" the equivalent-to-predefined
-- compare operation for Elements. It should never be used in
-- any ASIS application code.
---------
-- Get --
---------
function Node (E : Element) return Node_Id;
function R_Node (E : Element) return Node_Id;
function Node_Field_1 (E : Element) return Node_Id;
function Node_Field_2 (E : Element) return Node_Id;
function Node_Value (E : Element) return Node_Id;
function R_Node_Value (E : Element) return Node_Id;
function Node_Field_1_Value (E : Element) return Node_Id;
function Node_Field_2_Value (E : Element) return Node_Id;
-- Node, R_Node and Node_Field_1 reset the tree when returning
-- the node value in a way that the returned node will be the
-- proper node value for the tree being accessed by ASIS,
-- whereas Node_Value, R_Node_Value and Node_Field_1_Value
-- just return the node value without changing the currently
-- accessed tree
function Encl_Unit (E : Element) return Compilation_Unit;
function Encl_Unit_Id (E : Element) return Unit_Id;
function Encl_Cont (E : Element) return Context;
function Encl_Cont_Id (E : Element) return Context_Id;
function Kind (E : Element) return Asis.Element_Kinds;
function Int_Kind (E : Element) return Internal_Element_Kinds;
function Is_From_Implicit (E : Element) return Boolean;
function Is_From_Inherited (E : Element) return Boolean;
function Is_From_Instance (E : Element) return Boolean;
function Special_Case (E : Element) return Special_Cases;
function Normalization_Case (E : Element) return Normalization_Cases;
function Parenth_Count (E : Element) return Nat;
function Encl_Tree (E : Element) return Tree_Id;
function Rel_Sloc (E : Element) return Source_Ptr;
function Character_Code (E : Element) return Char_Code;
function Obtained (E : Element) return ASIS_OS_Time;
function Location (E : Asis.Element) return Source_Ptr;
-- this function returns not relative (as Rel_Sloc does), but
-- "absolute" location of the source position corresponding
-- to the Node on which E is based. This function is
-- "tree-swapping-safe"
function Valid (E : Element) return Boolean;
-- checks, if the argument is valid, that is, if the enclosing
-- Context of its enclosing Unit is opened
pragma Inline (Node);
pragma Inline (R_Node);
pragma Inline (Encl_Unit);
pragma Inline (Encl_Unit_Id);
pragma Inline (Encl_Cont);
pragma Inline (Encl_Cont_Id);
pragma Inline (Kind);
pragma Inline (Int_Kind);
pragma Inline (Is_From_Implicit);
pragma Inline (Is_From_Inherited);
pragma Inline (Is_From_Instance);
pragma Inline (Special_Case);
pragma Inline (Encl_Tree);
pragma Inline (Rel_Sloc);
pragma Inline (Valid);
---------
-- Set --
---------
procedure Set_Node (E : in out Element; N : Node_Id);
procedure Set_R_Node (E : in out Element; N : Node_Id);
procedure Set_Node_Field_1 (E : in out Element; N : Node_Id);
procedure Set_Node_Field_2 (E : in out Element; N : Node_Id);
procedure Set_Encl_Unit_Id (E : in out Element; U : Unit_Id);
procedure Set_Enclosing_Context (E : in out Element; C : Context_Id);
procedure Set_Obtained (E : in out Element; T : ASIS_OS_Time);
procedure Set_Int_Kind (E : in out Element;
K : Internal_Element_Kinds);
procedure Set_From_Implicit (E : in out Element; I : Boolean := True);
procedure Set_From_Inherited (E : in out Element; I : Boolean := True);
procedure Set_From_Instance (E : in out Element; I : Boolean := True);
procedure Set_Special_Case (E : in out Element; S : Special_Cases);
procedure Set_Rel_Sloc (E : in out Element; S : Source_Ptr);
procedure Set_Character_Code (E : in out Element; C : Char_Code);
procedure Set_Encl_Tree (E : in out Element; T : Tree_Id);
procedure Set_Normalization_Case (E : in out Element;
N : Normalization_Cases);
procedure Set_Parenth_Count (E : in out Element; Val : Nat);
function Set_Element
(Node : Node_Id;
R_Node : Node_Id;
Node_Field_1 : Node_Id;
Node_Field_2 : Node_Id;
Encl_Unit : Compilation_Unit;
-- contains Ids for both Enclosing Compilation Unit and Enclosing
-- Context
Int_Kind : Internal_Element_Kinds;
Implicit : Boolean;
Inherited : Boolean;
Instance : Boolean;
Spec_Case : Special_Cases;
Norm_Case : Normalization_Cases;
Par_Count : Nat;
Character_Code : Char_Code)
return Element;
-- Constructs and returns the ASIS Element value on the base of
-- Element attributes
-- Note, that it should not be any parameter passed for the
-- Enclosing_Tree field, because this field should be set equal
-- to the Id of the tree being currently accessed!
-- Note also, that it should not be any parameter passed for the
-- Rel_Scr field, because this field should be computed as the
-- difference between the source location of the node upon
-- the given element is to be built (that is, passed as the
-- actual for the Node parameter, and the top node of the
-- Element's enclosing Unit.
--
-- It is supposed, that this function is called as the part of the
-- constructing of the new element during processing some ASIS
-- query, so the actuals for Node, R_Node and the current setting of
-- the top node for the Unit pointed by Encl_Unit are consistent.
-- See also A4G.Mapping (body).
function Set_In_List
(EL : Element_List;
Node_Field_1 : Node_Id := Empty;
Implicit : Boolean := False;
Inherited : Boolean := False)
return Element_List;
-- For all the Elements in EL sets their fields Node_Field_1,
-- Is_Part_Of_Implicit, Is_Part_Of_Inherited to the values passed as
-- actuals accordingly for Node_Field_1, Implicit and Inherited.
procedure Convert_To_Limited_View (El : in out Asis.Element);
-- Provided that A4G.A_Sem.Belongs_To_Limited_View (El), changes its
-- internal representation in such a way that El represents the limited
-- view of the corresponding type or package. This includes changing of the
-- Element kind for type elements.
Char_Literal_Spec_Template : Element;
-- Used as a template for creating lists of
-- An_Enumeration_Literal_Specification representing defining
-- character literals of types Standard.Character and
-- Standard.Wide_Character. This variable is initialized in package body
Numeric_Error_Template : Element;
-- Used as a template for the artificial elements representing the obsolete
-- renaming of Numeric_Error exception in package Standard and components
-- thereof.
-----------------------------------------------------------
-- Special processing for Elements representing root and --
-- universal numeric types in ASIS --
-----------------------------------------------------------
function Set_Root_Type_Declaration
(Int_Kind : Internal_Element_Kinds;
Cont : Context_Id)
return Element;
-- Constructs and returns the ASIS Element representing the declaration
-- of a root or universal numeric type. If an actual for Int_Kind does
-- not belong to Internal_Root_Type_Kinds, Nil_Element is returned.
-- Otherwise the child element of the result returned by the
-- Type_Declaration_View function should be of Int_Kind kind.
-- Every opened Context contains exactly one Element representing
-- the declaration of a given root or universal numeric type.
-- These elements (as well as their child elements) have no Node to
-- be based upon (they simply do not need such a Node), they are
-- implicit declarations located in the predefined Standard package.
function Is_Root_Num_Type (Declaration : Asis.Declaration) return Boolean;
-- Checks if Declaration is A_Type_Declaration Element representing
-- the declaration of a root or universal numeric type.
function Root_Type_Definition
(Declaration : Asis.Declaration)
return Asis.Definition;
-- Transforms A_Type_Declaration Element representing the declaration
-- of a root or universal numeric type into the corresponding type
-- definition (being of Root_Type_Kinds). This function does not
-- check if its argument really represents the declaration of a root
-- or universal numeric type
end Asis.Set_Get;
|
msrLi/portingSources | Ada | 2,962 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Tour --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- 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, 1996
-- Version Control
-- $Revision: 1.9 $
-- Binding Version 01.00
------------------------------------------------------------------------------
procedure Tour;
|
reznikmm/matreshka | Ada | 4,664 | 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_Chart.Error_Percentage_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Chart_Error_Percentage_Attribute_Node is
begin
return Self : Chart_Error_Percentage_Attribute_Node do
Matreshka.ODF_Chart.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Chart_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Chart_Error_Percentage_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Error_Percentage_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Chart_URI,
Matreshka.ODF_String_Constants.Error_Percentage_Attribute,
Chart_Error_Percentage_Attribute_Node'Tag);
end Matreshka.ODF_Chart.Error_Percentage_Attributes;
|
laurentzh/CHIP-8 | Ada | 89,446 | ads | with Types; use Types;
package Roms is
VERS : constant ROM := (16#12#, 16#1a#, 16#4a#, 16#4d#, 16#4e#, 16#20#, 16#31#, 16#39#, 16#39#, 16#31#, 16#20#, 16#53#, 16#4f#, 16#46#, 16#54#, 16#57#, 16#41#, 16#52#, 16#45#, 16#53#, 16#20#, 16#80#, 16#80#, 16#ff#, 16#00#, 16#00#, 16#63#, 16#00#, 16#67#, 16#00#, 16#00#, 16#e0#, 16#a2#, 16#17#, 16#60#, 16#00#, 16#61#, 16#00#, 16#d0#, 16#11#, 16#71#, 16#ff#, 16#d0#, 16#11#, 16#71#, 16#01#, 16#70#, 16#08#, 16#30#, 16#40#, 16#12#, 16#26#, 16#71#, 16#01#, 16#a2#, 16#15#, 16#d0#, 16#12#, 16#70#, 16#ff#, 16#d0#, 16#12#, 16#70#, 16#01#, 16#71#, 16#02#, 16#31#, 16#1f#, 16#12#, 16#38#, 16#60#, 16#08#, 16#61#, 16#10#, 16#62#, 16#04#, 16#64#, 16#37#, 16#65#, 16#0f#, 16#66#, 16#02#, 16#d0#, 16#11#, 16#d4#, 16#51#, 16#68#, 16#01#, 16#e8#, 16#a1#, 16#62#, 16#02#, 16#68#, 16#02#, 16#e8#, 16#a1#, 16#62#, 16#04#, 16#68#, 16#07#, 16#e8#, 16#a1#, 16#62#, 16#01#, 16#68#, 16#0a#, 16#e8#, 16#a1#, 16#62#, 16#03#, 16#68#, 16#0b#, 16#e8#, 16#a1#, 16#66#, 16#02#, 16#68#, 16#0f#, 16#e8#, 16#a1#, 16#66#, 16#04#, 16#68#, 16#0c#, 16#e8#, 16#a1#, 16#66#, 16#01#, 16#68#, 16#0d#, 16#e8#, 16#a1#, 16#66#, 16#03#, 16#42#, 16#01#, 16#71#, 16#ff#, 16#42#, 16#02#, 16#70#, 16#ff#, 16#42#, 16#03#, 16#71#, 16#01#, 16#42#, 16#04#, 16#70#, 16#01#, 16#46#, 16#01#, 16#75#, 16#ff#, 16#46#, 16#02#, 16#74#, 16#ff#, 16#46#, 16#03#, 16#75#, 16#01#, 16#46#, 16#04#, 16#74#, 16#01#, 16#d0#, 16#11#, 16#3f#, 16#00#, 16#12#, 16#b4#, 16#d4#, 16#51#, 16#3f#, 16#00#, 16#12#, 16#b8#, 16#12#, 16#56#, 16#77#, 16#01#, 16#12#, 16#ba#, 16#73#, 16#01#, 16#68#, 16#00#, 16#78#, 16#01#, 16#38#, 16#00#, 16#12#, 16#bc#, 16#00#, 16#e0#, 16#60#, 16#08#, 16#61#, 16#04#, 16#f3#, 16#29#, 16#d0#, 16#15#, 16#60#, 16#34#, 16#f7#, 16#29#, 16#d0#, 16#15#, 16#68#, 16#00#, 16#78#, 16#01#, 16#38#, 16#00#, 16#12#, 16#d4#, 16#43#, 16#08#, 16#12#, 16#e4#, 16#47#, 16#08#, 16#12#, 16#e4#, 16#12#, 16#1e#, 16#12#, 16#e4#, others => 0);
BLITZ : constant ROM := (16#12#, 16#17#, 16#42#, 16#4c#, 16#49#, 16#54#, 16#5a#, 16#20#, 16#42#, 16#79#, 16#20#, 16#44#, 16#61#, 16#76#, 16#69#, 16#64#, 16#20#, 16#57#, 16#49#, 16#4e#, 16#54#, 16#45#, 16#52#, 16#a3#, 16#41#, 16#60#, 16#04#, 16#61#, 16#09#, 16#62#, 16#0e#, 16#67#, 16#04#, 16#d0#, 16#1e#, 16#f2#, 16#1e#, 16#70#, 16#0c#, 16#30#, 16#40#, 16#12#, 16#21#, 16#f0#, 16#0a#, 16#00#, 16#e0#, 16#22#, 16#d9#, 16#f0#, 16#0a#, 16#00#, 16#e0#, 16#8e#, 16#70#, 16#a3#, 16#1e#, 16#6b#, 16#1f#, 16#cc#, 16#1f#, 16#8c#, 16#c4#, 16#dc#, 16#b2#, 16#3f#, 16#01#, 16#12#, 16#49#, 16#dc#, 16#b2#, 16#12#, 16#39#, 16#ca#, 16#07#, 16#7a#, 16#01#, 16#7b#, 16#fe#, 16#dc#, 16#b2#, 16#7a#, 16#ff#, 16#3a#, 16#00#, 16#12#, 16#4d#, 16#7e#, 16#ff#, 16#3e#, 16#00#, 16#12#, 16#39#, 16#6b#, 16#00#, 16#8c#, 16#70#, 16#6d#, 16#00#, 16#6e#, 16#00#, 16#a3#, 16#1b#, 16#dd#, 16#e3#, 16#3f#, 16#00#, 16#12#, 16#c1#, 16#3b#, 16#00#, 16#12#, 16#81#, 16#60#, 16#05#, 16#e0#, 16#9e#, 16#12#, 16#87#, 16#6b#, 16#01#, 16#88#, 16#d0#, 16#78#, 16#02#, 16#89#, 16#e0#, 16#79#, 16#03#, 16#a3#, 16#1e#, 16#d8#, 16#91#, 16#81#, 16#f0#, 16#60#, 16#05#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#8b#, 16#3b#, 16#01#, 16#12#, 16#ab#, 16#a3#, 16#1e#, 16#31#, 16#01#, 16#d8#, 16#91#, 16#79#, 16#01#, 16#39#, 16#20#, 16#12#, 16#ab#, 16#6b#, 16#00#, 16#31#, 16#00#, 16#7c#, 16#ff#, 16#4c#, 16#00#, 16#12#, 16#bb#, 16#a3#, 16#1b#, 16#dd#, 16#e3#, 16#7d#, 16#02#, 16#3d#, 16#40#, 16#12#, 16#b9#, 16#6d#, 16#00#, 16#7e#, 16#01#, 16#12#, 16#65#, 16#00#, 16#e0#, 16#77#, 16#02#, 16#12#, 16#2d#, 16#a3#, 16#1b#, 16#dd#, 16#e3#, 16#60#, 16#14#, 16#61#, 16#02#, 16#62#, 16#0b#, 16#a3#, 16#20#, 16#d0#, 16#1b#, 16#f2#, 16#1e#, 16#70#, 16#08#, 16#30#, 16#2c#, 16#12#, 16#cd#, 16#12#, 16#d7#, 16#60#, 16#0a#, 16#61#, 16#0d#, 16#62#, 16#05#, 16#a3#, 16#07#, 16#d0#, 16#15#, 16#f2#, 16#1e#, 16#70#, 16#08#, 16#30#, 16#2a#, 16#12#, 16#e1#, 16#80#, 16#70#, 16#70#, 16#fe#, 16#80#, 16#06#, 16#a3#, 16#87#, 16#f0#, 16#33#, 16#f2#, 16#65#, 16#60#, 16#2d#, 16#f1#, 16#29#, 16#61#, 16#0d#, 16#d0#, 16#15#, 16#70#, 16#05#, 16#f2#, 16#29#, 16#d0#, 16#15#, 16#00#, 16#ee#, 16#83#, 16#82#, 16#83#, 16#82#, 16#fb#, 16#e8#, 16#08#, 16#88#, 16#05#, 16#e2#, 16#be#, 16#a0#, 16#b8#, 16#20#, 16#3e#, 16#80#, 16#80#, 16#80#, 16#80#, 16#f8#, 16#80#, 16#f8#, 16#fc#, 16#c0#, 16#c0#, 16#f9#, 16#81#, 16#db#, 16#cb#, 16#fb#, 16#00#, 16#fa#, 16#8a#, 16#9a#, 16#99#, 16#f8#, 16#ef#, 16#2a#, 16#e8#, 16#29#, 16#29#, 16#00#, 16#6f#, 16#68#, 16#2e#, 16#4c#, 16#8f#, 16#be#, 16#a0#, 16#b8#, 16#b0#, 16#be#, 16#00#, 16#be#, 16#22#, 16#3e#, 16#34#, 16#b2#, 16#d8#, 16#d8#, 16#00#, 16#c3#, 16#c3#, 16#00#, 16#d8#, 16#d8#, 16#00#, 16#c3#, 16#c3#, 16#00#, 16#d8#, 16#d8#, 16#c0#, 16#c0#, 16#00#, 16#c0#, 16#c0#, 16#00#, 16#c0#, 16#c0#, 16#00#, 16#c0#, 16#c0#, 16#00#, 16#db#, 16#db#, 16#db#, 16#db#, 16#00#, 16#18#, 16#18#, 16#00#, 16#18#, 16#18#, 16#00#, 16#18#, 16#18#, 16#00#, 16#db#, 16#db#, 16#db#, 16#db#, 16#00#, 16#18#, 16#18#, 16#00#, 16#18#, 16#18#, 16#00#, 16#18#, 16#18#, 16#00#, 16#18#, 16#18#, 16#db#, 16#db#, 16#00#, 16#03#, 16#03#, 16#00#, 16#18#, 16#18#, 16#00#, 16#c0#, 16#c0#, 16#00#, 16#db#, 16#db#, others => 0);
MAZE : constant ROM := (16#a2#, 16#1e#, 16#c2#, 16#01#, 16#32#, 16#01#, 16#a2#, 16#1a#, 16#d0#, 16#14#, 16#70#, 16#04#, 16#30#, 16#40#, 16#12#, 16#00#, 16#60#, 16#00#, 16#71#, 16#04#, 16#31#, 16#20#, 16#12#, 16#00#, 16#12#, 16#18#, 16#80#, 16#40#, 16#20#, 16#10#, 16#20#, 16#40#, 16#80#, 16#10#, others => 0);
SYZYGY : constant ROM := (16#12#, 16#12#, 16#8d#, 16#8d#, 16#20#, 16#a9#, 16#31#, 16#39#, 16#39#, 16#30#, 16#20#, 16#52#, 16#54#, 16#54#, 16#20#, 16#8e#, 16#8e#, 16#00#, 16#24#, 16#b6#, 16#24#, 16#da#, 16#60#, 16#0f#, 16#e0#, 16#a1#, 16#12#, 16#24#, 16#60#, 16#0e#, 16#e0#, 16#a1#, 16#12#, 16#28#, 16#12#, 16#16#, 16#24#, 16#da#, 16#12#, 16#2c#, 16#00#, 16#e0#, 16#12#, 16#2c#, 16#c1#, 16#1f#, 16#71#, 16#10#, 16#c2#, 16#0f#, 16#72#, 16#08#, 16#c3#, 16#03#, 16#85#, 16#30#, 16#86#, 16#10#, 16#87#, 16#20#, 16#88#, 16#30#, 16#48#, 16#00#, 16#77#, 16#01#, 16#48#, 16#01#, 16#77#, 16#ff#, 16#48#, 16#02#, 16#76#, 16#01#, 16#48#, 16#03#, 16#76#, 16#ff#, 16#a5#, 16#4c#, 16#d1#, 16#21#, 16#d6#, 16#71#, 16#64#, 16#f0#, 16#69#, 16#f1#, 16#a8#, 16#00#, 16#f4#, 16#1e#, 16#80#, 16#30#, 16#f0#, 16#55#, 16#74#, 16#01#, 16#a8#, 16#00#, 16#f4#, 16#1e#, 16#60#, 16#01#, 16#f0#, 16#55#, 16#25#, 16#22#, 16#6a#, 16#00#, 16#7a#, 16#00#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#9c#, 16#3d#, 16#00#, 16#12#, 16#94#, 16#60#, 16#00#, 16#f0#, 16#29#, 16#db#, 16#c5#, 16#3f#, 16#01#, 16#12#, 16#8c#, 16#db#, 16#c5#, 16#25#, 16#22#, 16#f0#, 16#15#, 16#12#, 16#9c#, 16#fe#, 16#15#, 16#6d#, 16#01#, 16#6e#, 16#00#, 16#12#, 16#9c#, 16#80#, 16#e0#, 16#f0#, 16#29#, 16#db#, 16#c5#, 16#25#, 16#22#, 16#60#, 16#03#, 16#e0#, 16#a1#, 16#63#, 16#00#, 16#60#, 16#06#, 16#e0#, 16#a1#, 16#63#, 16#01#, 16#60#, 16#07#, 16#e0#, 16#a1#, 16#63#, 16#02#, 16#60#, 16#08#, 16#e0#, 16#a1#, 16#63#, 16#03#, 16#43#, 16#00#, 16#72#, 16#ff#, 16#43#, 16#01#, 16#72#, 16#01#, 16#43#, 16#02#, 16#71#, 16#ff#, 16#43#, 16#03#, 16#71#, 16#01#, 16#a5#, 16#4c#, 16#d1#, 16#21#, 16#3f#, 16#01#, 16#13#, 16#24#, 16#3d#, 16#01#, 16#13#, 16#88#, 16#60#, 16#3f#, 16#81#, 16#02#, 16#60#, 16#1f#, 16#82#, 16#02#, 16#80#, 16#b0#, 16#80#, 16#17#, 16#3f#, 16#01#, 16#13#, 16#88#, 16#80#, 16#b0#, 16#70#, 16#03#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#13#, 16#88#, 16#80#, 16#c0#, 16#80#, 16#27#, 16#3f#, 16#01#, 16#13#, 16#88#, 16#80#, 16#c0#, 16#70#, 16#04#, 16#80#, 16#25#, 16#3f#, 16#01#, 16#13#, 16#88#, 16#60#, 16#04#, 16#f0#, 16#18#, 16#ce#, 16#07#, 16#7e#, 16#02#, 16#8a#, 16#e4#, 16#a5#, 16#4c#, 16#d1#, 16#21#, 16#60#, 16#00#, 16#f0#, 16#29#, 16#db#, 16#c5#, 16#80#, 16#e0#, 16#f0#, 16#29#, 16#db#, 16#c5#, 16#60#, 16#30#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#13#, 16#1a#, 16#a5#, 16#4c#, 16#d1#, 16#21#, 16#93#, 16#50#, 16#13#, 16#3e#, 16#74#, 16#01#, 16#a8#, 16#00#, 16#f4#, 16#1e#, 16#80#, 16#30#, 16#f0#, 16#55#, 16#74#, 16#01#, 16#a8#, 16#00#, 16#f4#, 16#1e#, 16#60#, 16#00#, 16#f0#, 16#55#, 16#85#, 16#30#, 16#a8#, 16#00#, 16#f4#, 16#1e#, 16#f0#, 16#65#, 16#70#, 16#01#, 16#f0#, 16#55#, 16#4a#, 16#00#, 16#13#, 16#58#, 16#60#, 16#0c#, 16#70#, 16#ff#, 16#30#, 16#00#, 16#13#, 16#4e#, 16#7a#, 16#ff#, 16#12#, 16#70#, 16#a5#, 16#4c#, 16#d6#, 16#71#, 16#48#, 16#00#, 16#77#, 16#ff#, 16#48#, 16#01#, 16#77#, 16#01#, 16#48#, 16#02#, 16#76#, 16#ff#, 16#48#, 16#03#, 16#76#, 16#01#, 16#a8#, 16#00#, 16#f9#, 16#1e#, 16#f0#, 16#65#, 16#70#, 16#ff#, 16#f0#, 16#55#, 16#30#, 16#00#, 16#12#, 16#70#, 16#79#, 16#01#, 16#a8#, 16#00#, 16#f9#, 16#1e#, 16#f0#, 16#65#, 16#88#, 16#00#, 16#79#, 16#01#, 16#12#, 16#70#, 16#60#, 16#0d#, 16#f0#, 16#18#, 16#60#, 16#0b#, 16#e0#, 16#9e#, 16#13#, 16#8e#, 16#6b#, 16#01#, 16#6c#, 16#00#, 16#6d#, 16#00#, 16#7b#, 16#01#, 16#3b#, 16#0a#, 16#13#, 16#aa#, 16#6b#, 16#00#, 16#7c#, 16#01#, 16#3c#, 16#0a#, 16#13#, 16#aa#, 16#6c#, 16#00#, 16#7d#, 16#01#, 16#a5#, 16#4c#, 16#d6#, 16#71#, 16#48#, 16#00#, 16#77#, 16#ff#, 16#48#, 16#01#, 16#77#, 16#01#, 16#48#, 16#02#, 16#76#, 16#ff#, 16#48#, 16#03#, 16#76#, 16#01#, 16#a8#, 16#00#, 16#f9#, 16#1e#, 16#f0#, 16#65#, 16#70#, 16#ff#, 16#f0#, 16#55#, 16#30#, 16#00#, 16#13#, 16#98#, 16#99#, 16#40#, 16#13#, 16#de#, 16#79#, 16#01#, 16#a8#, 16#00#, 16#f9#, 16#1e#, 16#f0#, 16#65#, 16#88#, 16#00#, 16#79#, 16#01#, 16#13#, 16#98#, 16#00#, 16#e0#, 16#66#, 16#11#, 16#67#, 16#09#, 16#68#, 16#2f#, 16#69#, 16#17#, 16#a5#, 16#52#, 16#d6#, 16#7e#, 16#d8#, 16#7e#, 16#77#, 16#ff#, 16#a5#, 16#4e#, 16#d6#, 16#71#, 16#d6#, 16#91#, 16#76#, 16#08#, 16#d6#, 16#71#, 16#d6#, 16#91#, 16#76#, 16#08#, 16#d6#, 16#71#, 16#d6#, 16#91#, 16#76#, 16#08#, 16#a5#, 16#50#, 16#d6#, 16#71#, 16#d6#, 16#91#, 16#a5#, 16#9e#, 16#66#, 16#13#, 16#67#, 16#11#, 16#24#, 16#9a#, 16#a5#, 16#ae#, 16#f3#, 16#65#, 16#93#, 16#d0#, 16#14#, 16#24#, 16#80#, 16#30#, 16#80#, 16#d5#, 16#3f#, 16#01#, 16#14#, 16#3a#, 16#14#, 16#44#, 16#92#, 16#c0#, 16#14#, 16#32#, 16#80#, 16#20#, 16#80#, 16#c5#, 16#3f#, 16#01#, 16#14#, 16#3a#, 16#14#, 16#44#, 16#80#, 16#10#, 16#80#, 16#b5#, 16#3f#, 16#00#, 16#14#, 16#44#, 16#a5#, 16#ae#, 16#83#, 16#d0#, 16#82#, 16#c0#, 16#81#, 16#b0#, 16#f3#, 16#55#, 16#a5#, 16#ae#, 16#f3#, 16#65#, 16#66#, 16#13#, 16#77#, 16#f9#, 16#8d#, 16#30#, 16#8c#, 16#20#, 16#8b#, 16#10#, 16#a5#, 16#a4#, 16#24#, 16#9a#, 16#c1#, 16#3f#, 16#c2#, 16#1f#, 16#60#, 16#0d#, 16#80#, 16#15#, 16#3f#, 16#00#, 16#14#, 16#7c#, 16#60#, 16#30#, 16#80#, 16#17#, 16#3f#, 16#00#, 16#14#, 16#7c#, 16#60#, 16#03#, 16#80#, 16#25#, 16#3f#, 16#00#, 16#14#, 16#7c#, 16#60#, 16#18#, 16#80#, 16#27#, 16#3f#, 16#00#, 16#14#, 16#7c#, 16#14#, 16#82#, 16#c3#, 16#0f#, 16#f3#, 16#29#, 16#d1#, 16#25#, 16#60#, 16#0f#, 16#e0#, 16#a1#, 16#14#, 16#90#, 16#60#, 16#0e#, 16#e0#, 16#a1#, 16#14#, 16#96#, 16#14#, 16#56#, 16#00#, 16#e0#, 16#24#, 16#b6#, 16#12#, 16#2c#, 16#00#, 16#e0#, 16#12#, 16#2c#, 16#d6#, 16#75#, 16#a5#, 16#aa#, 16#76#, 16#02#, 16#d6#, 16#74#, 16#fd#, 16#29#, 16#76#, 16#0a#, 16#d6#, 16#75#, 16#fc#, 16#29#, 16#76#, 16#05#, 16#d6#, 16#75#, 16#fb#, 16#29#, 16#76#, 16#05#, 16#d6#, 16#75#, 16#00#, 16#ee#, 16#a5#, 16#4e#, 16#61#, 16#00#, 16#62#, 16#00#, 16#66#, 16#1f#, 16#d1#, 16#21#, 16#d1#, 16#61#, 16#71#, 16#08#, 16#31#, 16#40#, 16#14#, 16#be#, 16#a5#, 16#52#, 16#62#, 16#01#, 16#65#, 16#3f#, 16#d1#, 16#2f#, 16#d5#, 16#2f#, 16#72#, 16#0f#, 16#d1#, 16#2f#, 16#d5#, 16#2f#, 16#00#, 16#ee#, 16#61#, 16#0c#, 16#62#, 16#07#, 16#a5#, 16#62#, 16#d1#, 16#2a#, 16#a5#, 16#6c#, 16#71#, 16#06#, 16#d1#, 16#2a#, 16#a5#, 16#76#, 16#71#, 16#06#, 16#d1#, 16#2a#, 16#a5#, 16#6c#, 16#71#, 16#06#, 16#d1#, 16#2a#, 16#a5#, 16#80#, 16#71#, 16#06#, 16#d1#, 16#2a#, 16#a5#, 16#6c#, 16#71#, 16#06#, 16#d1#, 16#2a#, 16#61#, 16#0e#, 16#62#, 16#18#, 16#a5#, 16#8a#, 16#d1#, 16#23#, 16#a5#, 16#8e#, 16#71#, 16#08#, 16#72#, 16#ff#, 16#d1#, 16#24#, 16#71#, 16#09#, 16#72#, 16#fe#, 16#a5#, 16#92#, 16#d1#, 16#26#, 16#71#, 16#06#, 16#72#, 16#01#, 16#a5#, 16#98#, 16#d1#, 16#25#, 16#00#, 16#ee#, 16#6d#, 16#c5#, 16#cb#, 16#3f#, 16#8e#, 16#b0#, 16#8e#, 16#d4#, 16#4f#, 16#01#, 16#15#, 16#24#, 16#7b#, 16#01#, 16#6d#, 16#e6#, 16#cc#, 16#1f#, 16#8e#, 16#c0#, 16#8e#, 16#d4#, 16#4f#, 16#01#, 16#15#, 16#32#, 16#7c#, 16#01#, 16#6d#, 16#00#, 16#ce#, 16#3f#, 16#7e#, 16#40#, 16#fe#, 16#15#, 16#ce#, 16#3f#, 16#7e#, 16#40#, 16#00#, 16#ee#, 16#80#, 16#00#, 16#ff#, 16#00#, 16#fe#, 16#00#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#1f#, 16#10#, 16#10#, 16#10#, 16#1f#, 16#01#, 16#01#, 16#01#, 16#01#, 16#1f#, 16#11#, 16#11#, 16#11#, 16#11#, 16#1f#, 16#04#, 16#04#, 16#04#, 16#04#, 16#04#, 16#1f#, 16#01#, 16#02#, 16#02#, 16#04#, 16#04#, 16#08#, 16#08#, 16#10#, 16#1f#, 16#1f#, 16#11#, 16#10#, 16#10#, 16#10#, 16#13#, 16#11#, 16#11#, 16#11#, 16#1f#, 16#05#, 16#05#, 16#02#, 16#00#, 16#71#, 16#51#, 16#51#, 16#75#, 16#0c#, 16#12#, 16#1e#, 16#14#, 16#12#, 16#09#, 16#14#, 16#3e#, 16#15#, 16#15#, 16#2a#, 16#00#, 16#77#, 16#44#, 16#24#, 16#14#, 16#77#, 16#00#, 16#57#, 16#52#, 16#72#, 16#52#, 16#57#, 16#00#, 16#00#, 16#01#, 16#00#, 16#01#, 16#00#, 16#00#, 16#00#, 16#00#, others => 0);
KALEID : constant ROM := (16#60#, 16#00#, 16#63#, 16#80#, 16#61#, 16#1f#, 16#62#, 16#0f#, 16#22#, 16#32#, 16#a2#, 16#00#, 16#f3#, 16#1e#, 16#f0#, 16#0a#, 16#f0#, 16#55#, 16#40#, 16#00#, 16#12#, 16#1c#, 16#73#, 16#01#, 16#33#, 16#00#, 16#12#, 16#08#, 16#63#, 16#80#, 16#a2#, 16#00#, 16#f3#, 16#1e#, 16#f0#, 16#65#, 16#40#, 16#00#, 16#12#, 16#1c#, 16#73#, 16#01#, 16#43#, 16#00#, 16#12#, 16#1c#, 16#22#, 16#32#, 16#12#, 16#1e#, 16#40#, 16#02#, 16#72#, 16#ff#, 16#40#, 16#04#, 16#71#, 16#ff#, 16#40#, 16#06#, 16#71#, 16#01#, 16#40#, 16#08#, 16#72#, 16#01#, 16#a2#, 16#77#, 16#6a#, 16#e0#, 16#8a#, 16#12#, 16#6b#, 16#1f#, 16#81#, 16#b2#, 16#3a#, 16#00#, 16#72#, 16#01#, 16#6a#, 16#f0#, 16#8a#, 16#22#, 16#6b#, 16#0f#, 16#82#, 16#b2#, 16#3a#, 16#00#, 16#71#, 16#01#, 16#6b#, 16#1f#, 16#81#, 16#b2#, 16#d1#, 16#21#, 16#8a#, 16#10#, 16#6b#, 16#1f#, 16#8b#, 16#25#, 16#da#, 16#b1#, 16#6a#, 16#3f#, 16#8a#, 16#15#, 16#da#, 16#b1#, 16#8b#, 16#20#, 16#da#, 16#b1#, 16#00#, 16#ee#, 16#01#, 16#80#, others => 0);
CONNECT4 : constant ROM := (16#12#, 16#1a#, 16#43#, 16#4f#, 16#4e#, 16#4e#, 16#45#, 16#43#, 16#54#, 16#34#, 16#20#, 16#62#, 16#79#, 16#20#, 16#44#, 16#61#, 16#76#, 16#69#, 16#64#, 16#20#, 16#57#, 16#49#, 16#4e#, 16#54#, 16#45#, 16#52#, 16#a2#, 16#bb#, 16#f6#, 16#65#, 16#a2#, 16#b4#, 16#f6#, 16#55#, 16#69#, 16#00#, 16#68#, 16#01#, 16#6b#, 16#00#, 16#6d#, 16#0f#, 16#6e#, 16#1f#, 16#a2#, 16#a5#, 16#60#, 16#0d#, 16#61#, 16#32#, 16#62#, 16#00#, 16#d0#, 16#2f#, 16#d1#, 16#2f#, 16#72#, 16#0f#, 16#32#, 16#1e#, 16#12#, 16#34#, 16#d0#, 16#21#, 16#d1#, 16#21#, 16#72#, 16#01#, 16#60#, 16#0a#, 16#a2#, 16#9f#, 16#d0#, 16#21#, 16#d1#, 16#21#, 16#a2#, 16#9f#, 16#dd#, 16#e1#, 16#fc#, 16#0a#, 16#dd#, 16#e1#, 16#4c#, 16#05#, 16#12#, 16#7e#, 16#3c#, 16#04#, 16#12#, 16#6a#, 16#7b#, 16#ff#, 16#7d#, 16#fb#, 16#3d#, 16#0a#, 16#12#, 16#7a#, 16#6b#, 16#06#, 16#6d#, 16#2d#, 16#12#, 16#7a#, 16#3c#, 16#06#, 16#12#, 16#98#, 16#7b#, 16#01#, 16#7d#, 16#05#, 16#3d#, 16#32#, 16#12#, 16#7a#, 16#6b#, 16#00#, 16#6d#, 16#0f#, 16#dd#, 16#e1#, 16#12#, 16#50#, 16#a2#, 16#b4#, 16#fb#, 16#1e#, 16#f0#, 16#65#, 16#40#, 16#fc#, 16#12#, 16#98#, 16#8a#, 16#00#, 16#70#, 16#fb#, 16#f0#, 16#55#, 16#89#, 16#83#, 16#a2#, 16#9e#, 16#39#, 16#00#, 16#a2#, 16#a1#, 16#dd#, 16#a4#, 16#a2#, 16#9f#, 16#dd#, 16#e1#, 16#12#, 16#50#, 16#60#, 16#f0#, 16#f0#, 16#60#, 16#90#, 16#90#, 16#60#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, others => 0);
PUZZLE15 : constant ROM := (16#00#, 16#e0#, 16#6c#, 16#00#, 16#4c#, 16#00#, 16#6e#, 16#0f#, 16#a2#, 16#03#, 16#60#, 16#20#, 16#f0#, 16#55#, 16#00#, 16#e0#, 16#22#, 16#be#, 16#22#, 16#76#, 16#22#, 16#8e#, 16#22#, 16#5e#, 16#22#, 16#46#, 16#12#, 16#10#, 16#61#, 16#00#, 16#62#, 16#17#, 16#63#, 16#04#, 16#41#, 16#10#, 16#00#, 16#ee#, 16#a2#, 16#e8#, 16#f1#, 16#1e#, 16#f0#, 16#65#, 16#40#, 16#00#, 16#12#, 16#34#, 16#f0#, 16#29#, 16#d2#, 16#35#, 16#71#, 16#01#, 16#72#, 16#05#, 16#64#, 16#03#, 16#84#, 16#12#, 16#34#, 16#00#, 16#12#, 16#22#, 16#62#, 16#17#, 16#73#, 16#06#, 16#12#, 16#22#, 16#64#, 16#03#, 16#84#, 16#e2#, 16#65#, 16#03#, 16#85#, 16#d2#, 16#94#, 16#50#, 16#00#, 16#ee#, 16#44#, 16#03#, 16#00#, 16#ee#, 16#64#, 16#01#, 16#84#, 16#e4#, 16#22#, 16#a6#, 16#12#, 16#46#, 16#64#, 16#03#, 16#84#, 16#e2#, 16#65#, 16#03#, 16#85#, 16#d2#, 16#94#, 16#50#, 16#00#, 16#ee#, 16#44#, 16#00#, 16#00#, 16#ee#, 16#64#, 16#ff#, 16#84#, 16#e4#, 16#22#, 16#a6#, 16#12#, 16#5e#, 16#64#, 16#0c#, 16#84#, 16#e2#, 16#65#, 16#0c#, 16#85#, 16#d2#, 16#94#, 16#50#, 16#00#, 16#ee#, 16#44#, 16#00#, 16#00#, 16#ee#, 16#64#, 16#fc#, 16#84#, 16#e4#, 16#22#, 16#a6#, 16#12#, 16#76#, 16#64#, 16#0c#, 16#84#, 16#e2#, 16#65#, 16#0c#, 16#85#, 16#d2#, 16#94#, 16#50#, 16#00#, 16#ee#, 16#44#, 16#0c#, 16#00#, 16#ee#, 16#64#, 16#04#, 16#84#, 16#e4#, 16#22#, 16#a6#, 16#12#, 16#8e#, 16#a2#, 16#e8#, 16#f4#, 16#1e#, 16#f0#, 16#65#, 16#a2#, 16#e8#, 16#fe#, 16#1e#, 16#f0#, 16#55#, 16#60#, 16#00#, 16#a2#, 16#e8#, 16#f4#, 16#1e#, 16#f0#, 16#55#, 16#8e#, 16#40#, 16#00#, 16#ee#, 16#3c#, 16#00#, 16#12#, 16#d2#, 16#22#, 16#1c#, 16#22#, 16#d8#, 16#22#, 16#1c#, 16#a2#, 16#f8#, 16#fd#, 16#1e#, 16#f0#, 16#65#, 16#8d#, 16#00#, 16#00#, 16#ee#, 16#7c#, 16#ff#, 16#cd#, 16#0f#, 16#00#, 16#ee#, 16#7d#, 16#01#, 16#60#, 16#0f#, 16#8d#, 16#02#, 16#ed#, 16#9e#, 16#12#, 16#d8#, 16#ed#, 16#a1#, 16#12#, 16#e2#, 16#00#, 16#ee#, 16#01#, 16#02#, 16#03#, 16#04#, 16#05#, 16#06#, 16#07#, 16#08#, 16#09#, 16#0a#, 16#0b#, 16#0c#, 16#0d#, 16#0e#, 16#0f#, 16#00#, 16#0d#, 16#00#, 16#01#, 16#02#, 16#04#, 16#05#, 16#06#, 16#08#, 16#09#, 16#0a#, 16#0c#, 16#0e#, 16#03#, 16#07#, 16#0b#, 16#0f#, 16#84#, 16#e4#, 16#22#, 16#a6#, 16#12#, 16#76#, 16#64#, 16#0c#, 16#84#, 16#e2#, 16#65#, 16#0c#, 16#85#, 16#d2#, 16#94#, 16#50#, 16#00#, 16#ee#, 16#44#, 16#0c#, 16#00#, 16#ee#, 16#64#, 16#04#, 16#84#, 16#e4#, 16#22#, 16#a6#, 16#12#, 16#8e#, 16#a2#, 16#e8#, 16#f4#, 16#1e#, 16#f0#, 16#65#, 16#a2#, 16#e8#, 16#fe#, 16#1e#, 16#f0#, 16#55#, 16#60#, 16#00#, 16#a2#, 16#e8#, 16#f4#, 16#1e#, 16#f0#, 16#55#, 16#8e#, 16#40#, 16#00#, 16#ee#, 16#3c#, 16#00#, 16#12#, 16#d2#, 16#22#, 16#1c#, 16#22#, 16#d8#, 16#22#, 16#1c#, 16#a2#, 16#f8#, 16#fd#, 16#1e#, 16#f0#, 16#65#, 16#8d#, 16#00#, 16#00#, 16#ee#, 16#7c#, 16#ff#, 16#cd#, 16#0f#, 16#00#, 16#ee#, 16#7d#, 16#01#, 16#60#, 16#0f#, 16#8d#, 16#02#, 16#ed#, 16#9e#, 16#12#, 16#d8#, 16#ed#, 16#a1#, 16#12#, 16#e2#, 16#00#, 16#ee#, 16#01#, 16#02#, 16#03#, 16#04#, 16#05#, 16#06#, 16#07#, 16#08#, 16#09#, 16#0a#, 16#0b#, 16#0c#, 16#0d#, 16#0e#, 16#0f#, 16#00#, 16#0d#, 16#00#, 16#01#, 16#02#, 16#04#, 16#05#, 16#06#, 16#08#, others => 0);
TICTAC : constant ROM := (16#12#, 16#18#, 16#54#, 16#49#, 16#43#, 16#54#, 16#41#, 16#43#, 16#20#, 16#62#, 16#79#, 16#20#, 16#44#, 16#61#, 16#76#, 16#69#, 16#64#, 16#20#, 16#57#, 16#49#, 16#4e#, 16#54#, 16#45#, 16#52#, 16#6b#, 16#00#, 16#6c#, 16#00#, 16#80#, 16#b0#, 16#81#, 16#c0#, 16#a3#, 16#e6#, 16#f1#, 16#55#, 16#a3#, 16#c4#, 16#ff#, 16#65#, 16#a3#, 16#b4#, 16#ff#, 16#55#, 16#a3#, 16#e6#, 16#f1#, 16#65#, 16#8b#, 16#00#, 16#8c#, 16#10#, 16#00#, 16#e0#, 16#6e#, 16#01#, 16#60#, 16#13#, 16#61#, 16#03#, 16#a3#, 16#9a#, 16#d0#, 16#11#, 16#70#, 16#08#, 16#30#, 16#2b#, 16#12#, 16#3e#, 16#60#, 16#13#, 16#71#, 16#08#, 16#31#, 16#23#, 16#12#, 16#3e#, 16#60#, 16#13#, 16#61#, 16#03#, 16#a3#, 16#9b#, 16#d0#, 16#1f#, 16#70#, 16#08#, 16#30#, 16#33#, 16#12#, 16#54#, 16#60#, 16#13#, 16#71#, 16#0f#, 16#d0#, 16#1a#, 16#70#, 16#08#, 16#30#, 16#33#, 16#12#, 16#60#, 16#23#, 16#66#, 16#f0#, 16#0a#, 16#81#, 16#00#, 16#a3#, 16#b4#, 16#f0#, 16#1e#, 16#f0#, 16#65#, 16#40#, 16#00#, 16#12#, 16#8a#, 16#22#, 16#7c#, 16#12#, 16#6a#, 16#60#, 16#10#, 16#f0#, 16#18#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#82#, 16#00#, 16#ee#, 16#60#, 16#02#, 16#8e#, 16#03#, 16#80#, 16#e0#, 16#f0#, 16#55#, 16#a3#, 16#d4#, 16#80#, 16#10#, 16#70#, 16#ff#, 16#80#, 16#04#, 16#f0#, 16#1e#, 16#f1#, 16#65#, 16#a3#, 16#aa#, 16#3e#, 16#03#, 16#a3#, 16#af#, 16#d0#, 16#15#, 16#22#, 16#c8#, 16#3a#, 16#00#, 16#12#, 16#1c#, 16#a3#, 16#b4#, 16#61#, 16#00#, 16#62#, 16#00#, 16#63#, 16#01#, 16#f0#, 16#65#, 16#30#, 16#00#, 16#71#, 16#01#, 16#f3#, 16#1e#, 16#72#, 16#01#, 16#32#, 16#10#, 16#12#, 16#b4#, 16#31#, 16#10#, 16#12#, 16#6a#, 16#12#, 16#1c#, 16#6a#, 16#00#, 16#a3#, 16#b4#, 16#60#, 16#01#, 16#f0#, 16#1e#, 16#f8#, 16#65#, 16#69#, 16#00#, 16#89#, 16#04#, 16#23#, 16#44#, 16#89#, 16#14#, 16#23#, 16#44#, 16#89#, 16#24#, 16#23#, 16#4a#, 16#69#, 16#00#, 16#89#, 16#34#, 16#23#, 16#44#, 16#89#, 16#44#, 16#23#, 16#44#, 16#89#, 16#54#, 16#23#, 16#4a#, 16#69#, 16#00#, 16#89#, 16#64#, 16#23#, 16#44#, 16#89#, 16#74#, 16#23#, 16#44#, 16#89#, 16#84#, 16#23#, 16#4a#, 16#69#, 16#00#, 16#89#, 16#64#, 16#23#, 16#44#, 16#89#, 16#34#, 16#23#, 16#44#, 16#89#, 16#04#, 16#23#, 16#4a#, 16#69#, 16#00#, 16#89#, 16#74#, 16#23#, 16#44#, 16#89#, 16#44#, 16#23#, 16#44#, 16#89#, 16#14#, 16#23#, 16#4a#, 16#69#, 16#00#, 16#89#, 16#84#, 16#23#, 16#44#, 16#89#, 16#54#, 16#23#, 16#44#, 16#89#, 16#24#, 16#23#, 16#4a#, 16#69#, 16#00#, 16#89#, 16#84#, 16#23#, 16#44#, 16#89#, 16#44#, 16#23#, 16#44#, 16#89#, 16#04#, 16#23#, 16#4a#, 16#69#, 16#00#, 16#89#, 16#64#, 16#23#, 16#44#, 16#89#, 16#44#, 16#23#, 16#44#, 16#89#, 16#24#, 16#23#, 16#4a#, 16#00#, 16#ee#, 16#89#, 16#0e#, 16#89#, 16#0e#, 16#00#, 16#ee#, 16#49#, 16#15#, 16#13#, 16#54#, 16#49#, 16#3f#, 16#13#, 16#5a#, 16#00#, 16#ee#, 16#23#, 16#66#, 16#7b#, 16#01#, 16#13#, 16#5e#, 16#23#, 16#66#, 16#7c#, 16#01#, 16#23#, 16#66#, 16#6a#, 16#01#, 16#f0#, 16#0a#, 16#00#, 16#ee#, 16#63#, 16#05#, 16#64#, 16#0a#, 16#a3#, 16#af#, 16#d3#, 16#45#, 16#63#, 16#02#, 16#74#, 16#06#, 16#a3#, 16#e6#, 16#fb#, 16#33#, 16#23#, 16#88#, 16#63#, 16#32#, 16#64#, 16#0a#, 16#a3#, 16#aa#, 16#d3#, 16#45#, 16#63#, 16#2f#, 16#74#, 16#06#, 16#a3#, 16#e6#, 16#fc#, 16#33#, 16#f2#, 16#65#, 16#f0#, 16#29#, 16#23#, 16#94#, 16#f1#, 16#29#, 16#23#, 16#94#, 16#f2#, 16#29#, 16#d3#, 16#45#, 16#73#, 16#05#, 16#00#, 16#ee#, 16#7f#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#1c#, 16#22#, 16#22#, 16#22#, 16#1c#, 16#22#, 16#14#, 16#08#, 16#14#, 16#22#, 16#01#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#13#, 16#05#, 16#1b#, 16#05#, 16#23#, 16#05#, 16#13#, 16#0d#, 16#1b#, 16#0d#, 16#23#, 16#0d#, 16#13#, 16#15#, 16#1b#, 16#15#, 16#23#, 16#15#, others => 0);
VBRIX : constant ROM := (16#00#, 16#e0#, 16#23#, 16#b6#, 16#60#, 16#07#, 16#e0#, 16#9e#, 16#12#, 16#04#, 16#68#, 16#00#, 16#67#, 16#03#, 16#23#, 16#46#, 16#22#, 16#4a#, 16#22#, 16#c0#, 16#23#, 16#66#, 16#23#, 16#8a#, 16#23#, 16#ac#, 16#f0#, 16#0a#, 16#22#, 16#5a#, 16#22#, 16#5a#, 16#22#, 16#d0#, 16#22#, 16#88#, 16#3a#, 16#00#, 16#12#, 16#1c#, 16#6c#, 16#01#, 16#23#, 16#ac#, 16#77#, 16#ff#, 16#23#, 16#ac#, 16#60#, 16#78#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#34#, 16#37#, 16#00#, 16#12#, 16#1c#, 16#23#, 16#ac#, 16#60#, 16#07#, 16#e0#, 16#9e#, 16#12#, 16#42#, 16#12#, 16#0a#, 16#00#, 16#fd#, 16#69#, 16#10#, 16#60#, 16#02#, 16#a2#, 16#54#, 16#d0#, 16#95#, 16#00#, 16#ee#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#00#, 16#60#, 16#01#, 16#e0#, 16#a1#, 16#12#, 16#68#, 16#60#, 16#04#, 16#e0#, 16#a1#, 16#12#, 16#72#, 16#00#, 16#ee#, 16#80#, 16#90#, 16#70#, 16#ff#, 16#40#, 16#00#, 16#00#, 16#ee#, 16#12#, 16#7c#, 16#80#, 16#90#, 16#70#, 16#01#, 16#40#, 16#1b#, 16#00#, 16#ee#, 16#12#, 16#7c#, 16#61#, 16#02#, 16#a2#, 16#54#, 16#d1#, 16#95#, 16#d1#, 16#05#, 16#89#, 16#00#, 16#00#, 16#ee#, 16#80#, 16#a0#, 16#70#, 16#fe#, 16#30#, 16#00#, 16#00#, 16#ee#, 16#80#, 16#b0#, 16#80#, 16#95#, 16#4f#, 16#00#, 16#00#, 16#ee#, 16#81#, 16#00#, 16#62#, 16#05#, 16#81#, 16#25#, 16#3f#, 16#00#, 16#00#, 16#ee#, 16#a2#, 16#ba#, 16#f0#, 16#1e#, 16#f0#, 16#65#, 16#8d#, 16#00#, 16#4b#, 16#01#, 16#6d#, 16#01#, 16#4b#, 16#1e#, 16#6d#, 16#ff#, 16#6c#, 16#01#, 16#60#, 16#0a#, 16#f0#, 16#18#, 16#00#, 16#ee#, 16#ff#, 16#ff#, 16#00#, 16#01#, 16#01#, 16#00#, 16#cb#, 16#20#, 16#7b#, 16#01#, 16#6a#, 16#04#, 16#6c#, 16#01#, 16#6d#, 16#01#, 16#a3#, 16#64#, 16#da#, 16#b1#, 16#00#, 16#ee#, 16#80#, 16#a0#, 16#81#, 16#b0#, 16#8a#, 16#c4#, 16#8b#, 16#d4#, 16#a3#, 16#64#, 16#4b#, 16#01#, 16#6d#, 16#01#, 16#4b#, 16#1e#, 16#6d#, 16#ff#, 16#4a#, 16#3e#, 16#6c#, 16#ff#, 16#4a#, 16#00#, 16#6c#, 16#01#, 16#d0#, 16#11#, 16#da#, 16#b1#, 16#4f#, 16#00#, 16#00#, 16#ee#, 16#80#, 16#a0#, 16#61#, 16#21#, 16#80#, 16#15#, 16#4f#, 16#00#, 16#00#, 16#ee#, 16#80#, 16#a0#, 16#81#, 16#b0#, 16#70#, 16#de#, 16#71#, 16#ff#, 16#62#, 16#ff#, 16#63#, 16#ff#, 16#64#, 16#03#, 16#72#, 16#01#, 16#80#, 16#45#, 16#3f#, 16#00#, 16#13#, 16#0a#, 16#73#, 16#01#, 16#81#, 16#45#, 16#3f#, 16#00#, 16#13#, 16#12#, 16#80#, 16#20#, 16#81#, 16#30#, 16#80#, 16#24#, 16#80#, 16#24#, 16#81#, 16#34#, 16#81#, 16#34#, 16#70#, 16#22#, 16#71#, 16#01#, 16#a3#, 16#86#, 16#d0#, 16#13#, 16#7e#, 16#ff#, 16#60#, 16#00#, 16#8c#, 16#07#, 16#60#, 16#02#, 16#f0#, 16#18#, 16#23#, 16#8a#, 16#78#, 16#01#, 16#23#, 16#8a#, 16#3e#, 16#00#, 16#00#, 16#ee#, 16#23#, 16#66#, 16#00#, 16#ee#, 16#00#, 16#e0#, 16#60#, 16#00#, 16#61#, 16#00#, 16#62#, 16#1f#, 16#a3#, 16#64#, 16#d0#, 16#11#, 16#d0#, 16#21#, 16#70#, 16#01#, 16#30#, 16#3f#, 16#13#, 16#50#, 16#d0#, 16#11#, 16#71#, 16#01#, 16#31#, 16#20#, 16#13#, 16#5a#, 16#00#, 16#ee#, 16#80#, 16#00#, 16#61#, 16#01#, 16#63#, 16#0a#, 16#a3#, 16#86#, 16#60#, 16#22#, 16#62#, 16#07#, 16#d0#, 16#13#, 16#70#, 16#03#, 16#72#, 16#ff#, 16#32#, 16#00#, 16#13#, 16#70#, 16#71#, 16#03#, 16#73#, 16#ff#, 16#33#, 16#00#, 16#13#, 16#6c#, 16#6e#, 16#46#, 16#00#, 16#ee#, 16#e0#, 16#a0#, 16#e0#, 16#00#, 16#a3#, 16#a6#, 16#f8#, 16#33#, 16#f2#, 16#65#, 16#63#, 16#03#, 16#64#, 16#02#, 16#f0#, 16#29#, 16#d3#, 16#45#, 16#73#, 16#05#, 16#f1#, 16#29#, 16#d3#, 16#45#, 16#73#, 16#05#, 16#f2#, 16#29#, 16#d3#, 16#45#, 16#00#, 16#ee#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#60#, 16#14#, 16#61#, 16#02#, 16#f7#, 16#29#, 16#d0#, 16#15#, 16#00#, 16#ee#, 16#60#, 16#0a#, 16#61#, 16#0c#, 16#62#, 16#09#, 16#63#, 16#05#, 16#a3#, 16#ce#, 16#d0#, 16#15#, 16#f3#, 16#1e#, 16#70#, 16#05#, 16#72#, 16#ff#, 16#32#, 16#00#, 16#13#, 16#c0#, 16#00#, 16#ee#, 16#90#, 16#90#, 16#90#, 16#90#, 16#60#, 16#e0#, 16#90#, 16#e0#, 16#90#, 16#e0#, 16#e0#, 16#90#, 16#e0#, 16#90#, 16#90#, 16#20#, 16#20#, 16#20#, 16#20#, 16#20#, 16#90#, 16#90#, 16#60#, 16#90#, 16#90#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#f0#, 16#90#, 16#f0#, 16#80#, 16#80#, 16#f0#, 16#80#, 16#f0#, 16#10#, 16#f0#, 16#e0#, 16#90#, 16#e0#, 16#90#, 16#90#, others => 0);
PONG : constant ROM := (16#6a#, 16#02#, 16#6b#, 16#0c#, 16#6c#, 16#3f#, 16#6d#, 16#0c#, 16#a2#, 16#ea#, 16#da#, 16#b6#, 16#dc#, 16#d6#, 16#6e#, 16#00#, 16#22#, 16#d4#, 16#66#, 16#03#, 16#68#, 16#02#, 16#60#, 16#60#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#1a#, 16#c7#, 16#17#, 16#77#, 16#08#, 16#69#, 16#ff#, 16#a2#, 16#f0#, 16#d6#, 16#71#, 16#a2#, 16#ea#, 16#da#, 16#b6#, 16#dc#, 16#d6#, 16#60#, 16#01#, 16#e0#, 16#a1#, 16#7b#, 16#fe#, 16#60#, 16#04#, 16#e0#, 16#a1#, 16#7b#, 16#02#, 16#60#, 16#1f#, 16#8b#, 16#02#, 16#da#, 16#b6#, 16#60#, 16#0c#, 16#e0#, 16#a1#, 16#7d#, 16#fe#, 16#60#, 16#0d#, 16#e0#, 16#a1#, 16#7d#, 16#02#, 16#60#, 16#1f#, 16#8d#, 16#02#, 16#dc#, 16#d6#, 16#a2#, 16#f0#, 16#d6#, 16#71#, 16#86#, 16#84#, 16#87#, 16#94#, 16#60#, 16#3f#, 16#86#, 16#02#, 16#61#, 16#1f#, 16#87#, 16#12#, 16#46#, 16#02#, 16#12#, 16#78#, 16#46#, 16#3f#, 16#12#, 16#82#, 16#47#, 16#1f#, 16#69#, 16#ff#, 16#47#, 16#00#, 16#69#, 16#01#, 16#d6#, 16#71#, 16#12#, 16#2a#, 16#68#, 16#02#, 16#63#, 16#01#, 16#80#, 16#70#, 16#80#, 16#b5#, 16#12#, 16#8a#, 16#68#, 16#fe#, 16#63#, 16#0a#, 16#80#, 16#70#, 16#80#, 16#d5#, 16#3f#, 16#01#, 16#12#, 16#a2#, 16#61#, 16#02#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#ba#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#c8#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#c2#, 16#60#, 16#20#, 16#f0#, 16#18#, 16#22#, 16#d4#, 16#8e#, 16#34#, 16#22#, 16#d4#, 16#66#, 16#3e#, 16#33#, 16#01#, 16#66#, 16#03#, 16#68#, 16#fe#, 16#33#, 16#01#, 16#68#, 16#02#, 16#12#, 16#16#, 16#79#, 16#ff#, 16#49#, 16#fe#, 16#69#, 16#ff#, 16#12#, 16#c8#, 16#79#, 16#01#, 16#49#, 16#02#, 16#69#, 16#01#, 16#60#, 16#04#, 16#f0#, 16#18#, 16#76#, 16#01#, 16#46#, 16#40#, 16#76#, 16#fe#, 16#12#, 16#6c#, 16#a2#, 16#f2#, 16#fe#, 16#33#, 16#f2#, 16#65#, 16#f1#, 16#29#, 16#64#, 16#14#, 16#65#, 16#00#, 16#d4#, 16#55#, 16#74#, 16#15#, 16#f2#, 16#29#, 16#d4#, 16#55#, 16#00#, 16#ee#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, others => 0);
IBM : constant ROM := (16#00#, 16#e0#, 16#a2#, 16#2a#, 16#60#, 16#0c#, 16#61#, 16#08#, 16#d0#, 16#1f#, 16#70#, 16#09#, 16#a2#, 16#39#, 16#d0#, 16#1f#, 16#a2#, 16#48#, 16#70#, 16#08#, 16#d0#, 16#1f#, 16#70#, 16#04#, 16#a2#, 16#57#, 16#d0#, 16#1f#, 16#70#, 16#08#, 16#a2#, 16#66#, 16#d0#, 16#1f#, 16#70#, 16#08#, 16#a2#, 16#75#, 16#d0#, 16#1f#, 16#12#, 16#28#, 16#ff#, 16#00#, 16#ff#, 16#00#, 16#3c#, 16#00#, 16#3c#, 16#00#, 16#3c#, 16#00#, 16#3c#, 16#00#, 16#ff#, 16#00#, 16#ff#, 16#ff#, 16#00#, 16#ff#, 16#00#, 16#38#, 16#00#, 16#3f#, 16#00#, 16#3f#, 16#00#, 16#38#, 16#00#, 16#ff#, 16#00#, 16#ff#, 16#80#, 16#00#, 16#e0#, 16#00#, 16#e0#, 16#00#, 16#80#, 16#00#, 16#80#, 16#00#, 16#e0#, 16#00#, 16#e0#, 16#00#, 16#80#, 16#f8#, 16#00#, 16#fc#, 16#00#, 16#3e#, 16#00#, 16#3f#, 16#00#, 16#3b#, 16#00#, 16#39#, 16#00#, 16#f8#, 16#00#, 16#f8#, 16#03#, 16#00#, 16#07#, 16#00#, 16#0f#, 16#00#, 16#bf#, 16#00#, 16#fb#, 16#00#, 16#f3#, 16#00#, 16#e3#, 16#00#, 16#43#, 16#e0#, 16#00#, 16#e0#, 16#00#, 16#80#, 16#00#, 16#80#, 16#00#, 16#80#, 16#00#, 16#80#, 16#00#, 16#e0#, 16#00#, 16#e0#, others => 0);
BRIX : constant ROM := (16#6e#, 16#05#, 16#65#, 16#00#, 16#6b#, 16#06#, 16#6a#, 16#00#, 16#a3#, 16#0c#, 16#da#, 16#b1#, 16#7a#, 16#04#, 16#3a#, 16#40#, 16#12#, 16#08#, 16#7b#, 16#02#, 16#3b#, 16#12#, 16#12#, 16#06#, 16#6c#, 16#20#, 16#6d#, 16#1f#, 16#a3#, 16#10#, 16#dc#, 16#d1#, 16#22#, 16#f6#, 16#60#, 16#00#, 16#61#, 16#00#, 16#a3#, 16#12#, 16#d0#, 16#11#, 16#70#, 16#08#, 16#a3#, 16#0e#, 16#d0#, 16#11#, 16#60#, 16#40#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#34#, 16#c6#, 16#0f#, 16#67#, 16#1e#, 16#68#, 16#01#, 16#69#, 16#ff#, 16#a3#, 16#0e#, 16#d6#, 16#71#, 16#a3#, 16#10#, 16#dc#, 16#d1#, 16#60#, 16#04#, 16#e0#, 16#a1#, 16#7c#, 16#fe#, 16#60#, 16#06#, 16#e0#, 16#a1#, 16#7c#, 16#02#, 16#60#, 16#3f#, 16#8c#, 16#02#, 16#dc#, 16#d1#, 16#a3#, 16#0e#, 16#d6#, 16#71#, 16#86#, 16#84#, 16#87#, 16#94#, 16#60#, 16#3f#, 16#86#, 16#02#, 16#61#, 16#1f#, 16#87#, 16#12#, 16#47#, 16#1f#, 16#12#, 16#ac#, 16#46#, 16#00#, 16#68#, 16#01#, 16#46#, 16#3f#, 16#68#, 16#ff#, 16#47#, 16#00#, 16#69#, 16#01#, 16#d6#, 16#71#, 16#3f#, 16#01#, 16#12#, 16#aa#, 16#47#, 16#1f#, 16#12#, 16#aa#, 16#60#, 16#05#, 16#80#, 16#75#, 16#3f#, 16#00#, 16#12#, 16#aa#, 16#60#, 16#01#, 16#f0#, 16#18#, 16#80#, 16#60#, 16#61#, 16#fc#, 16#80#, 16#12#, 16#a3#, 16#0c#, 16#d0#, 16#71#, 16#60#, 16#fe#, 16#89#, 16#03#, 16#22#, 16#f6#, 16#75#, 16#01#, 16#22#, 16#f6#, 16#45#, 16#60#, 16#12#, 16#de#, 16#12#, 16#46#, 16#69#, 16#ff#, 16#80#, 16#60#, 16#80#, 16#c5#, 16#3f#, 16#01#, 16#12#, 16#ca#, 16#61#, 16#02#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#e0#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#ee#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#e8#, 16#60#, 16#20#, 16#f0#, 16#18#, 16#a3#, 16#0e#, 16#7e#, 16#ff#, 16#80#, 16#e0#, 16#80#, 16#04#, 16#61#, 16#00#, 16#d0#, 16#11#, 16#3e#, 16#00#, 16#12#, 16#30#, 16#12#, 16#de#, 16#78#, 16#ff#, 16#48#, 16#fe#, 16#68#, 16#ff#, 16#12#, 16#ee#, 16#78#, 16#01#, 16#48#, 16#02#, 16#68#, 16#01#, 16#60#, 16#04#, 16#f0#, 16#18#, 16#69#, 16#ff#, 16#12#, 16#70#, 16#a3#, 16#14#, 16#f5#, 16#33#, 16#f2#, 16#65#, 16#f1#, 16#29#, 16#63#, 16#37#, 16#64#, 16#00#, 16#d3#, 16#45#, 16#73#, 16#05#, 16#f2#, 16#29#, 16#d3#, 16#45#, 16#00#, 16#ee#, 16#e0#, 16#00#, 16#80#, 16#00#, 16#fc#, 16#00#, 16#aa#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, others => 0);
PONG2 : constant ROM := (16#22#, 16#f6#, 16#6b#, 16#0c#, 16#6c#, 16#3f#, 16#6d#, 16#0c#, 16#a2#, 16#ea#, 16#da#, 16#b6#, 16#dc#, 16#d6#, 16#6e#, 16#00#, 16#22#, 16#d4#, 16#66#, 16#03#, 16#68#, 16#02#, 16#60#, 16#60#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#1a#, 16#c7#, 16#17#, 16#77#, 16#08#, 16#69#, 16#ff#, 16#a2#, 16#f0#, 16#d6#, 16#71#, 16#a2#, 16#ea#, 16#da#, 16#b6#, 16#dc#, 16#d6#, 16#60#, 16#01#, 16#e0#, 16#a1#, 16#7b#, 16#fe#, 16#60#, 16#04#, 16#e0#, 16#a1#, 16#7b#, 16#02#, 16#60#, 16#1f#, 16#8b#, 16#02#, 16#da#, 16#b6#, 16#60#, 16#0c#, 16#e0#, 16#a1#, 16#7d#, 16#fe#, 16#60#, 16#0d#, 16#e0#, 16#a1#, 16#7d#, 16#02#, 16#60#, 16#1f#, 16#8d#, 16#02#, 16#dc#, 16#d6#, 16#a2#, 16#f0#, 16#d6#, 16#71#, 16#86#, 16#84#, 16#87#, 16#94#, 16#60#, 16#3f#, 16#86#, 16#02#, 16#61#, 16#1f#, 16#87#, 16#12#, 16#46#, 16#00#, 16#12#, 16#78#, 16#46#, 16#3f#, 16#12#, 16#82#, 16#47#, 16#1f#, 16#69#, 16#ff#, 16#47#, 16#00#, 16#69#, 16#01#, 16#d6#, 16#71#, 16#12#, 16#2a#, 16#68#, 16#02#, 16#63#, 16#01#, 16#80#, 16#70#, 16#80#, 16#b5#, 16#12#, 16#8a#, 16#68#, 16#fe#, 16#63#, 16#0a#, 16#80#, 16#70#, 16#80#, 16#d5#, 16#3f#, 16#01#, 16#12#, 16#a2#, 16#61#, 16#02#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#ba#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#c8#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#c2#, 16#60#, 16#20#, 16#f0#, 16#18#, 16#22#, 16#d4#, 16#8e#, 16#34#, 16#22#, 16#d4#, 16#66#, 16#3e#, 16#33#, 16#01#, 16#66#, 16#03#, 16#68#, 16#fe#, 16#33#, 16#01#, 16#68#, 16#02#, 16#12#, 16#16#, 16#79#, 16#ff#, 16#49#, 16#fe#, 16#69#, 16#ff#, 16#12#, 16#c8#, 16#79#, 16#01#, 16#49#, 16#02#, 16#69#, 16#01#, 16#60#, 16#04#, 16#f0#, 16#18#, 16#76#, 16#01#, 16#46#, 16#40#, 16#76#, 16#fe#, 16#12#, 16#6c#, 16#a2#, 16#f2#, 16#fe#, 16#33#, 16#f2#, 16#65#, 16#f1#, 16#29#, 16#64#, 16#14#, 16#65#, 16#00#, 16#d4#, 16#55#, 16#74#, 16#15#, 16#f2#, 16#29#, 16#d4#, 16#55#, 16#00#, 16#ee#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#6b#, 16#20#, 16#6c#, 16#00#, 16#a2#, 16#ea#, 16#db#, 16#c1#, 16#7c#, 16#01#, 16#3c#, 16#20#, 16#12#, 16#fc#, 16#6a#, 16#00#, 16#00#, 16#ee#, others => 0);
MERLIN : constant ROM := (16#12#, 16#19#, 16#20#, 16#4d#, 16#45#, 16#52#, 16#4c#, 16#49#, 16#4e#, 16#20#, 16#42#, 16#79#, 16#20#, 16#44#, 16#61#, 16#76#, 16#69#, 16#64#, 16#20#, 16#57#, 16#49#, 16#4e#, 16#54#, 16#45#, 16#52#, 16#22#, 16#f9#, 16#a3#, 16#1d#, 16#60#, 16#10#, 16#61#, 16#00#, 16#22#, 16#cb#, 16#a3#, 16#31#, 16#60#, 16#0b#, 16#61#, 16#1b#, 16#22#, 16#cb#, 16#64#, 16#04#, 16#22#, 16#df#, 16#65#, 16#00#, 16#62#, 16#28#, 16#22#, 16#c1#, 16#c2#, 16#03#, 16#80#, 16#20#, 16#a3#, 16#59#, 16#f5#, 16#1e#, 16#f0#, 16#55#, 16#60#, 16#17#, 16#61#, 16#08#, 16#63#, 16#01#, 16#83#, 16#22#, 16#33#, 16#00#, 16#70#, 16#0a#, 16#63#, 16#02#, 16#83#, 16#22#, 16#33#, 16#00#, 16#71#, 16#0a#, 16#a3#, 16#17#, 16#d0#, 16#16#, 16#62#, 16#14#, 16#22#, 16#c1#, 16#d0#, 16#16#, 16#62#, 16#05#, 16#22#, 16#c1#, 16#75#, 16#01#, 16#54#, 16#50#, 16#12#, 16#35#, 16#65#, 16#00#, 16#60#, 16#17#, 16#61#, 16#08#, 16#a3#, 16#17#, 16#f3#, 16#0a#, 16#33#, 16#04#, 16#12#, 16#79#, 16#63#, 16#00#, 16#12#, 16#97#, 16#33#, 16#05#, 16#12#, 16#83#, 16#70#, 16#0a#, 16#63#, 16#01#, 16#12#, 16#97#, 16#33#, 16#07#, 16#12#, 16#8d#, 16#71#, 16#0a#, 16#63#, 16#02#, 16#12#, 16#97#, 16#33#, 16#08#, 16#12#, 16#69#, 16#70#, 16#0a#, 16#71#, 16#0a#, 16#63#, 16#03#, 16#d0#, 16#16#, 16#62#, 16#14#, 16#22#, 16#c1#, 16#d0#, 16#16#, 16#a3#, 16#59#, 16#f5#, 16#1e#, 16#f0#, 16#65#, 16#75#, 16#01#, 16#50#, 16#30#, 16#12#, 16#b5#, 16#55#, 16#40#, 16#12#, 16#69#, 16#22#, 16#df#, 16#74#, 16#01#, 16#12#, 16#2d#, 16#22#, 16#f9#, 16#a3#, 16#45#, 16#60#, 16#10#, 16#61#, 16#0e#, 16#22#, 16#cb#, 16#12#, 16#bf#, 16#f2#, 16#15#, 16#f2#, 16#07#, 16#32#, 16#00#, 16#12#, 16#c3#, 16#00#, 16#ee#, 16#83#, 16#00#, 16#62#, 16#05#, 16#d0#, 16#15#, 16#f2#, 16#1e#, 16#70#, 16#08#, 16#85#, 16#30#, 16#75#, 16#20#, 16#50#, 16#50#, 16#12#, 16#cf#, 16#00#, 16#ee#, 16#a3#, 16#59#, 16#83#, 16#40#, 16#73#, 16#fd#, 16#f3#, 16#33#, 16#f2#, 16#65#, 16#f1#, 16#29#, 16#60#, 16#2b#, 16#63#, 16#1b#, 16#d0#, 16#35#, 16#70#, 16#05#, 16#f2#, 16#29#, 16#d0#, 16#35#, 16#00#, 16#ee#, 16#a3#, 16#0f#, 16#60#, 16#17#, 16#61#, 16#07#, 16#d0#, 16#18#, 16#70#, 16#0a#, 16#d0#, 16#18#, 16#71#, 16#0a#, 16#d0#, 16#18#, 16#70#, 16#f6#, 16#d0#, 16#18#, 16#00#, 16#ee#, 16#ff#, 16#81#, 16#81#, 16#81#, 16#81#, 16#81#, 16#81#, 16#ff#, 16#7e#, 16#7e#, 16#7e#, 16#7e#, 16#7e#, 16#7e#, 16#db#, 16#aa#, 16#8b#, 16#cb#, 16#cb#, 16#ef#, 16#08#, 16#8f#, 16#0d#, 16#ec#, 16#a0#, 16#a0#, 16#b0#, 16#30#, 16#be#, 16#5f#, 16#51#, 16#51#, 16#d9#, 16#d9#, 16#83#, 16#82#, 16#83#, 16#82#, 16#fb#, 16#e8#, 16#08#, 16#88#, 16#05#, 16#e2#, 16#be#, 16#a0#, 16#b8#, 16#20#, 16#3e#, 16#80#, 16#80#, 16#80#, 16#80#, 16#f8#, 16#f7#, 16#85#, 16#b7#, 16#95#, 16#f5#, 16#76#, 16#54#, 16#56#, 16#54#, 16#56#, 16#3a#, 16#2a#, 16#2a#, 16#2a#, 16#39#, 16#b6#, 16#a5#, 16#b6#, 16#a5#, 16#35#, others => 0);
TANK : constant ROM := (16#12#, 16#30#, 16#76#, 16#fb#, 16#60#, 16#20#, 16#80#, 16#65#, 16#4f#, 16#00#, 16#66#, 16#00#, 16#13#, 16#84#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#00#, 16#01#, 16#00#, 16#0c#, 16#0a#, 16#00#, 16#19#, 16#02#, 16#04#, 16#06#, 16#08#, 16#02#, 16#02#, 16#03#, 16#2c#, 16#00#, 16#0f#, 16#00#, 16#02#, 16#05#, 16#2e#, 16#08#, 16#00#, 16#00#, 16#02#, 16#05#, 16#00#, 16#00#, 16#00#, 16#00#, 16#6e#, 16#00#, 16#6d#, 16#a0#, 16#6a#, 16#08#, 16#69#, 16#06#, 16#68#, 16#04#, 16#67#, 16#02#, 16#66#, 16#19#, 16#64#, 16#10#, 16#63#, 16#0c#, 16#62#, 16#00#, 16#61#, 16#06#, 16#a2#, 16#12#, 16#fa#, 16#55#, 16#23#, 16#d4#, 16#60#, 16#40#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#50#, 16#23#, 16#d4#, 16#23#, 16#0a#, 16#23#, 16#62#, 16#a2#, 16#12#, 16#f5#, 16#65#, 16#22#, 16#ae#, 16#22#, 16#c6#, 16#22#, 16#ec#, 16#3f#, 16#01#, 16#23#, 16#14#, 16#3f#, 16#01#, 16#22#, 16#ec#, 16#3f#, 16#01#, 16#22#, 16#ec#, 16#3f#, 16#01#, 16#22#, 16#7c#, 16#4f#, 16#01#, 16#13#, 16#66#, 16#12#, 16#62#, 16#a2#, 16#12#, 16#f5#, 16#65#, 16#46#, 16#00#, 16#35#, 16#00#, 16#12#, 16#88#, 16#13#, 16#8c#, 16#e7#, 16#a1#, 16#62#, 16#09#, 16#e8#, 16#a1#, 16#62#, 16#04#, 16#e9#, 16#a1#, 16#62#, 16#06#, 16#ea#, 16#a1#, 16#62#, 16#01#, 16#42#, 16#00#, 16#00#, 16#ee#, 16#22#, 16#ae#, 16#81#, 16#20#, 16#23#, 16#9a#, 16#23#, 16#ac#, 16#6c#, 16#01#, 16#62#, 16#00#, 16#6f#, 16#00#, 16#a2#, 16#12#, 16#f5#, 16#55#, 16#a3#, 16#ff#, 16#41#, 16#01#, 16#60#, 16#00#, 16#41#, 16#04#, 16#60#, 16#13#, 16#41#, 16#06#, 16#60#, 16#0d#, 16#41#, 16#09#, 16#60#, 16#06#, 16#f0#, 16#1e#, 16#d3#, 16#47#, 16#00#, 16#ee#, 16#60#, 16#05#, 16#e0#, 16#9e#, 16#00#, 16#ee#, 16#45#, 16#0f#, 16#00#, 16#ee#, 16#65#, 16#0f#, 16#76#, 16#ff#, 16#a2#, 16#12#, 16#f5#, 16#55#, 16#74#, 16#03#, 16#73#, 16#03#, 16#23#, 16#9a#, 16#23#, 16#9a#, 16#23#, 16#9a#, 16#a2#, 16#23#, 16#f5#, 16#55#, 16#a4#, 16#19#, 16#d3#, 16#41#, 16#00#, 16#ee#, 16#a2#, 16#23#, 16#f5#, 16#65#, 16#45#, 16#00#, 16#00#, 16#ee#, 16#a4#, 16#19#, 16#d3#, 16#41#, 16#23#, 16#9a#, 16#6c#, 16#02#, 16#23#, 16#be#, 16#4b#, 16#bb#, 16#13#, 16#0a#, 16#d3#, 16#41#, 16#a2#, 16#23#, 16#f5#, 16#55#, 16#00#, 16#ee#, 16#65#, 16#00#, 16#60#, 16#00#, 16#a2#, 16#17#, 16#f0#, 16#55#, 16#13#, 16#04#, 16#a2#, 16#1d#, 16#f5#, 16#65#, 16#35#, 16#0f#, 16#13#, 16#44#, 16#a4#, 16#1a#, 16#d3#, 16#45#, 16#32#, 16#00#, 16#13#, 16#32#, 16#c1#, 16#03#, 16#a2#, 16#19#, 16#f1#, 16#1e#, 16#f0#, 16#65#, 16#81#, 16#00#, 16#c2#, 16#0f#, 16#72#, 16#01#, 16#23#, 16#9a#, 16#a4#, 16#1a#, 16#6c#, 16#03#, 16#72#, 16#ff#, 16#6f#, 16#00#, 16#d3#, 16#45#, 16#a2#, 16#1d#, 16#f5#, 16#55#, 16#00#, 16#ee#, 16#c4#, 16#07#, 16#a4#, 16#1f#, 16#f4#, 16#1e#, 16#f0#, 16#65#, 16#83#, 16#00#, 16#a4#, 16#27#, 16#f4#, 16#1e#, 16#f0#, 16#65#, 16#84#, 16#00#, 16#a4#, 16#1a#, 16#d3#, 16#45#, 16#60#, 16#20#, 16#f0#, 16#18#, 16#65#, 16#0f#, 16#13#, 16#3e#, 16#65#, 16#00#, 16#13#, 16#3e#, 16#4c#, 16#01#, 16#12#, 16#02#, 16#4c#, 16#02#, 16#13#, 16#82#, 16#a2#, 16#23#, 16#f5#, 16#65#, 16#45#, 16#00#, 16#12#, 16#02#, 16#a4#, 16#19#, 16#d3#, 16#41#, 16#6f#, 16#00#, 16#d3#, 16#41#, 16#3f#, 16#01#, 16#12#, 16#02#, 16#7e#, 16#0a#, 16#60#, 16#40#, 16#f0#, 16#18#, 16#00#, 16#e0#, 16#12#, 16#4a#, 16#00#, 16#e0#, 16#23#, 16#d4#, 16#60#, 16#60#, 16#f0#, 16#18#, 16#13#, 16#94#, 16#6e#, 16#00#, 16#13#, 16#84#, 16#41#, 16#01#, 16#74#, 16#ff#, 16#41#, 16#04#, 16#73#, 16#ff#, 16#41#, 16#06#, 16#73#, 16#01#, 16#41#, 16#09#, 16#74#, 16#01#, 16#00#, 16#ee#, 16#44#, 16#00#, 16#74#, 16#01#, 16#43#, 16#00#, 16#73#, 16#01#, 16#43#, 16#38#, 16#73#, 16#ff#, 16#44#, 16#18#, 16#74#, 16#ff#, 16#00#, 16#ee#, 16#6b#, 16#00#, 16#44#, 16#00#, 16#13#, 16#ce#, 16#43#, 16#00#, 16#13#, 16#ce#, 16#43#, 16#3f#, 16#13#, 16#ce#, 16#44#, 16#1f#, 16#6b#, 16#bb#, 16#6f#, 16#00#, 16#00#, 16#ee#, 16#63#, 16#08#, 16#64#, 16#08#, 16#a2#, 16#29#, 16#fe#, 16#33#, 16#f2#, 16#65#, 16#23#, 16#ec#, 16#63#, 16#28#, 16#a2#, 16#29#, 16#f6#, 16#33#, 16#f2#, 16#65#, 16#23#, 16#f2#, 16#00#, 16#ee#, 16#f0#, 16#29#, 16#d3#, 16#45#, 16#73#, 16#06#, 16#f1#, 16#29#, 16#d3#, 16#45#, 16#73#, 16#06#, 16#f2#, 16#29#, 16#d3#, 16#45#, 16#00#, 16#ee#, 16#01#, 16#10#, 16#54#, 16#7c#, 16#6c#, 16#7c#, 16#7c#, 16#44#, 16#7c#, 16#7c#, 16#6c#, 16#7c#, 16#54#, 16#10#, 16#00#, 16#fc#, 16#78#, 16#6e#, 16#78#, 16#fc#, 16#00#, 16#3f#, 16#1e#, 16#76#, 16#1e#, 16#3f#, 16#00#, 16#80#, 16#a8#, 16#70#, 16#f8#, 16#70#, 16#a8#, 16#0b#, 16#1b#, 16#28#, 16#38#, 16#30#, 16#20#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#, 16#08#, 16#1b#, 16#1b#, 16#1b#, 16#18#, 16#04#, others => 0);
MISSILE : constant ROM := (16#12#, 16#19#, 16#4d#, 16#49#, 16#53#, 16#53#, 16#49#, 16#4c#, 16#45#, 16#20#, 16#62#, 16#79#, 16#20#, 16#44#, 16#61#, 16#76#, 16#69#, 16#64#, 16#20#, 16#57#, 16#49#, 16#4e#, 16#54#, 16#45#, 16#52#, 16#6c#, 16#0c#, 16#60#, 16#00#, 16#61#, 16#00#, 16#65#, 16#08#, 16#66#, 16#0a#, 16#67#, 16#00#, 16#6e#, 16#01#, 16#a2#, 16#ad#, 16#d0#, 16#14#, 16#70#, 16#08#, 16#30#, 16#40#, 16#12#, 16#29#, 16#60#, 16#00#, 16#61#, 16#1c#, 16#a2#, 16#b0#, 16#d0#, 16#14#, 16#a2#, 16#b0#, 16#d0#, 16#14#, 16#3e#, 16#01#, 16#12#, 16#49#, 16#70#, 16#04#, 16#40#, 16#38#, 16#6e#, 16#00#, 16#12#, 16#4f#, 16#70#, 16#fc#, 16#40#, 16#00#, 16#6e#, 16#01#, 16#d0#, 16#14#, 16#fc#, 16#15#, 16#fb#, 16#07#, 16#3b#, 16#00#, 16#12#, 16#53#, 16#62#, 16#08#, 16#e2#, 16#9e#, 16#12#, 16#95#, 16#3c#, 16#00#, 16#7c#, 16#fe#, 16#63#, 16#1b#, 16#82#, 16#00#, 16#a2#, 16#b0#, 16#d2#, 16#31#, 16#64#, 16#00#, 16#d2#, 16#31#, 16#73#, 16#ff#, 16#d2#, 16#31#, 16#3f#, 16#00#, 16#64#, 16#01#, 16#33#, 16#03#, 16#12#, 16#6d#, 16#d2#, 16#31#, 16#34#, 16#01#, 16#12#, 16#91#, 16#77#, 16#05#, 16#75#, 16#ff#, 16#82#, 16#00#, 16#63#, 16#00#, 16#a2#, 16#ad#, 16#d2#, 16#34#, 16#45#, 16#00#, 16#12#, 16#97#, 16#76#, 16#ff#, 16#36#, 16#00#, 16#12#, 16#39#, 16#a2#, 16#b4#, 16#f7#, 16#33#, 16#f2#, 16#65#, 16#63#, 16#1b#, 16#64#, 16#0d#, 16#f1#, 16#29#, 16#d3#, 16#45#, 16#73#, 16#05#, 16#f2#, 16#29#, 16#d3#, 16#45#, 16#12#, 16#ab#, 16#10#, 16#38#, 16#38#, 16#10#, 16#38#, 16#7c#, 16#fe#, others => 0);
UFO : constant ROM := (16#a2#, 16#cd#, 16#69#, 16#38#, 16#6a#, 16#08#, 16#d9#, 16#a3#, 16#a2#, 16#d0#, 16#6b#, 16#00#, 16#6c#, 16#03#, 16#db#, 16#c3#, 16#a2#, 16#d6#, 16#64#, 16#1d#, 16#65#, 16#1f#, 16#d4#, 16#51#, 16#67#, 16#00#, 16#68#, 16#0f#, 16#22#, 16#a2#, 16#22#, 16#ac#, 16#48#, 16#00#, 16#12#, 16#22#, 16#64#, 16#1e#, 16#65#, 16#1c#, 16#a2#, 16#d3#, 16#d4#, 16#53#, 16#6e#, 16#00#, 16#66#, 16#80#, 16#6d#, 16#04#, 16#ed#, 16#a1#, 16#66#, 16#ff#, 16#6d#, 16#05#, 16#ed#, 16#a1#, 16#66#, 16#00#, 16#6d#, 16#06#, 16#ed#, 16#a1#, 16#66#, 16#01#, 16#36#, 16#80#, 16#22#, 16#d8#, 16#a2#, 16#d0#, 16#db#, 16#c3#, 16#cd#, 16#01#, 16#8b#, 16#d4#, 16#db#, 16#c3#, 16#3f#, 16#00#, 16#12#, 16#92#, 16#a2#, 16#cd#, 16#d9#, 16#a3#, 16#cd#, 16#01#, 16#3d#, 16#00#, 16#6d#, 16#ff#, 16#79#, 16#fe#, 16#d9#, 16#a3#, 16#3f#, 16#00#, 16#12#, 16#8c#, 16#4e#, 16#00#, 16#12#, 16#2e#, 16#a2#, 16#d3#, 16#d4#, 16#53#, 16#45#, 16#00#, 16#12#, 16#86#, 16#75#, 16#ff#, 16#84#, 16#64#, 16#d4#, 16#53#, 16#3f#, 16#01#, 16#12#, 16#46#, 16#6d#, 16#08#, 16#8d#, 16#52#, 16#4d#, 16#08#, 16#12#, 16#8c#, 16#12#, 16#92#, 16#22#, 16#ac#, 16#78#, 16#ff#, 16#12#, 16#1e#, 16#22#, 16#a2#, 16#77#, 16#05#, 16#12#, 16#96#, 16#22#, 16#a2#, 16#77#, 16#0f#, 16#22#, 16#a2#, 16#6d#, 16#03#, 16#fd#, 16#18#, 16#a2#, 16#d3#, 16#d4#, 16#53#, 16#12#, 16#86#, 16#a2#, 16#f8#, 16#f7#, 16#33#, 16#63#, 16#00#, 16#22#, 16#b6#, 16#00#, 16#ee#, 16#a2#, 16#f8#, 16#f8#, 16#33#, 16#63#, 16#32#, 16#22#, 16#b6#, 16#00#, 16#ee#, 16#6d#, 16#1b#, 16#f2#, 16#65#, 16#f0#, 16#29#, 16#d3#, 16#d5#, 16#73#, 16#05#, 16#f1#, 16#29#, 16#d3#, 16#d5#, 16#73#, 16#05#, 16#f2#, 16#29#, 16#d3#, 16#d5#, 16#00#, 16#ee#, 16#01#, 16#7c#, 16#fe#, 16#7c#, 16#60#, 16#f0#, 16#60#, 16#40#, 16#e0#, 16#a0#, 16#f8#, 16#d4#, 16#6e#, 16#01#, 16#6d#, 16#10#, 16#fd#, 16#18#, 16#00#, 16#ee#, others => 0);
WIPEOFF : constant ROM := (16#a2#, 16#cc#, 16#6a#, 16#07#, 16#61#, 16#00#, 16#6b#, 16#08#, 16#60#, 16#00#, 16#d0#, 16#11#, 16#70#, 16#08#, 16#7b#, 16#ff#, 16#3b#, 16#00#, 16#12#, 16#0a#, 16#71#, 16#04#, 16#7a#, 16#ff#, 16#3a#, 16#00#, 16#12#, 16#06#, 16#66#, 16#00#, 16#67#, 16#10#, 16#a2#, 16#cd#, 16#60#, 16#20#, 16#61#, 16#1e#, 16#d0#, 16#11#, 16#63#, 16#1d#, 16#62#, 16#3f#, 16#82#, 16#02#, 16#77#, 16#ff#, 16#47#, 16#00#, 16#12#, 16#aa#, 16#ff#, 16#0a#, 16#a2#, 16#cb#, 16#d2#, 16#31#, 16#65#, 16#ff#, 16#c4#, 16#01#, 16#34#, 16#01#, 16#64#, 16#ff#, 16#a2#, 16#cd#, 16#6c#, 16#00#, 16#6e#, 16#04#, 16#ee#, 16#a1#, 16#6c#, 16#ff#, 16#6e#, 16#06#, 16#ee#, 16#a1#, 16#6c#, 16#01#, 16#d0#, 16#11#, 16#80#, 16#c4#, 16#d0#, 16#11#, 16#4f#, 16#01#, 16#12#, 16#98#, 16#42#, 16#00#, 16#64#, 16#01#, 16#42#, 16#3f#, 16#64#, 16#ff#, 16#43#, 16#00#, 16#65#, 16#01#, 16#43#, 16#1f#, 16#12#, 16#a4#, 16#a2#, 16#cb#, 16#d2#, 16#31#, 16#82#, 16#44#, 16#83#, 16#54#, 16#d2#, 16#31#, 16#3f#, 16#01#, 16#12#, 16#42#, 16#43#, 16#1e#, 16#12#, 16#98#, 16#6a#, 16#02#, 16#fa#, 16#18#, 16#76#, 16#01#, 16#46#, 16#70#, 16#12#, 16#aa#, 16#d2#, 16#31#, 16#c4#, 16#01#, 16#34#, 16#01#, 16#64#, 16#ff#, 16#c5#, 16#01#, 16#35#, 16#01#, 16#65#, 16#ff#, 16#12#, 16#42#, 16#6a#, 16#03#, 16#fa#, 16#18#, 16#a2#, 16#cb#, 16#d2#, 16#31#, 16#73#, 16#ff#, 16#12#, 16#36#, 16#a2#, 16#cb#, 16#d2#, 16#31#, 16#12#, 16#28#, 16#a2#, 16#cd#, 16#d0#, 16#11#, 16#a2#, 16#f0#, 16#f6#, 16#33#, 16#f2#, 16#65#, 16#63#, 16#18#, 16#64#, 16#1b#, 16#f0#, 16#29#, 16#d3#, 16#45#, 16#73#, 16#05#, 16#f1#, 16#29#, 16#d3#, 16#45#, 16#73#, 16#05#, 16#f2#, 16#29#, 16#d3#, 16#45#, 16#12#, 16#c8#, 16#01#, 16#80#, 16#44#, 16#ff#, others => 0);
INVADERS : constant ROM := (16#12#, 16#25#, 16#53#, 16#50#, 16#41#, 16#43#, 16#45#, 16#20#, 16#49#, 16#4e#, 16#56#, 16#41#, 16#44#, 16#45#, 16#52#, 16#53#, 16#20#, 16#76#, 16#30#, 16#2e#, 16#39#, 16#20#, 16#42#, 16#79#, 16#20#, 16#44#, 16#61#, 16#76#, 16#69#, 16#64#, 16#20#, 16#57#, 16#49#, 16#4e#, 16#54#, 16#45#, 16#52#, 16#60#, 16#00#, 16#61#, 16#00#, 16#62#, 16#08#, 16#a3#, 16#d3#, 16#d0#, 16#18#, 16#71#, 16#08#, 16#f2#, 16#1e#, 16#31#, 16#20#, 16#12#, 16#2d#, 16#70#, 16#08#, 16#61#, 16#00#, 16#30#, 16#40#, 16#12#, 16#2d#, 16#69#, 16#05#, 16#6c#, 16#15#, 16#6e#, 16#00#, 16#23#, 16#87#, 16#60#, 16#0a#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#4b#, 16#23#, 16#87#, 16#7e#, 16#01#, 16#12#, 16#45#, 16#66#, 16#00#, 16#68#, 16#1c#, 16#69#, 16#00#, 16#6a#, 16#04#, 16#6b#, 16#0a#, 16#6c#, 16#04#, 16#6d#, 16#3c#, 16#6e#, 16#0f#, 16#00#, 16#e0#, 16#23#, 16#6b#, 16#23#, 16#47#, 16#fd#, 16#15#, 16#60#, 16#04#, 16#e0#, 16#9e#, 16#12#, 16#7d#, 16#23#, 16#6b#, 16#38#, 16#00#, 16#78#, 16#ff#, 16#23#, 16#6b#, 16#60#, 16#06#, 16#e0#, 16#9e#, 16#12#, 16#8b#, 16#23#, 16#6b#, 16#38#, 16#39#, 16#78#, 16#01#, 16#23#, 16#6b#, 16#36#, 16#00#, 16#12#, 16#9f#, 16#60#, 16#05#, 16#e0#, 16#9e#, 16#12#, 16#e9#, 16#66#, 16#01#, 16#65#, 16#1b#, 16#84#, 16#80#, 16#a3#, 16#cf#, 16#d4#, 16#51#, 16#a3#, 16#cf#, 16#d4#, 16#51#, 16#75#, 16#ff#, 16#35#, 16#ff#, 16#12#, 16#ad#, 16#66#, 16#00#, 16#12#, 16#e9#, 16#d4#, 16#51#, 16#3f#, 16#01#, 16#12#, 16#e9#, 16#d4#, 16#51#, 16#66#, 16#00#, 16#83#, 16#40#, 16#73#, 16#03#, 16#83#, 16#b5#, 16#62#, 16#f8#, 16#83#, 16#22#, 16#62#, 16#08#, 16#33#, 16#00#, 16#12#, 16#c9#, 16#23#, 16#73#, 16#82#, 16#06#, 16#43#, 16#08#, 16#12#, 16#d3#, 16#33#, 16#10#, 16#12#, 16#d5#, 16#23#, 16#73#, 16#82#, 16#06#, 16#33#, 16#18#, 16#12#, 16#dd#, 16#23#, 16#73#, 16#82#, 16#06#, 16#43#, 16#20#, 16#12#, 16#e7#, 16#33#, 16#28#, 16#12#, 16#e9#, 16#23#, 16#73#, 16#3e#, 16#00#, 16#13#, 16#07#, 16#79#, 16#06#, 16#49#, 16#18#, 16#69#, 16#00#, 16#6a#, 16#04#, 16#6b#, 16#0a#, 16#6c#, 16#04#, 16#7d#, 16#f4#, 16#6e#, 16#0f#, 16#00#, 16#e0#, 16#23#, 16#47#, 16#23#, 16#6b#, 16#fd#, 16#15#, 16#12#, 16#6f#, 16#f7#, 16#07#, 16#37#, 16#00#, 16#12#, 16#6f#, 16#fd#, 16#15#, 16#23#, 16#47#, 16#8b#, 16#a4#, 16#3b#, 16#12#, 16#13#, 16#1b#, 16#7c#, 16#02#, 16#6a#, 16#fc#, 16#3b#, 16#02#, 16#13#, 16#23#, 16#7c#, 16#02#, 16#6a#, 16#04#, 16#23#, 16#47#, 16#3c#, 16#18#, 16#12#, 16#6f#, 16#00#, 16#e0#, 16#a4#, 16#d3#, 16#60#, 16#14#, 16#61#, 16#08#, 16#62#, 16#0f#, 16#d0#, 16#1f#, 16#70#, 16#08#, 16#f2#, 16#1e#, 16#30#, 16#2c#, 16#13#, 16#33#, 16#f0#, 16#0a#, 16#00#, 16#e0#, 16#a6#, 16#f4#, 16#fe#, 16#65#, 16#12#, 16#25#, 16#a3#, 16#b7#, 16#f9#, 16#1e#, 16#61#, 16#08#, 16#23#, 16#5f#, 16#81#, 16#06#, 16#23#, 16#5f#, 16#81#, 16#06#, 16#23#, 16#5f#, 16#81#, 16#06#, 16#23#, 16#5f#, 16#7b#, 16#d0#, 16#00#, 16#ee#, 16#80#, 16#e0#, 16#80#, 16#12#, 16#30#, 16#00#, 16#db#, 16#c6#, 16#7b#, 16#0c#, 16#00#, 16#ee#, 16#a3#, 16#cf#, 16#60#, 16#1c#, 16#d8#, 16#04#, 16#00#, 16#ee#, 16#23#, 16#47#, 16#8e#, 16#23#, 16#23#, 16#47#, 16#60#, 16#05#, 16#f0#, 16#18#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#13#, 16#7f#, 16#00#, 16#ee#, 16#6a#, 16#00#, 16#8d#, 16#e0#, 16#6b#, 16#04#, 16#e9#, 16#a1#, 16#12#, 16#57#, 16#a6#, 16#02#, 16#fd#, 16#1e#, 16#f0#, 16#65#, 16#30#, 16#ff#, 16#13#, 16#a5#, 16#6a#, 16#00#, 16#6b#, 16#04#, 16#6d#, 16#01#, 16#6e#, 16#01#, 16#13#, 16#8d#, 16#a5#, 16#00#, 16#f0#, 16#1e#, 16#db#, 16#c6#, 16#7b#, 16#08#, 16#7d#, 16#01#, 16#7a#, 16#01#, 16#3a#, 16#07#, 16#13#, 16#8d#, 16#00#, 16#ee#, 16#3c#, 16#7e#, 16#ff#, 16#ff#, 16#99#, 16#99#, 16#7e#, 16#ff#, 16#ff#, 16#24#, 16#24#, 16#e7#, 16#7e#, 16#ff#, 16#3c#, 16#3c#, 16#7e#, 16#db#, 16#81#, 16#42#, 16#3c#, 16#7e#, 16#ff#, 16#db#, 16#10#, 16#38#, 16#7c#, 16#fe#, 16#00#, 16#00#, 16#7f#, 16#00#, 16#3f#, 16#00#, 16#7f#, 16#00#, 16#00#, 16#00#, 16#01#, 16#01#, 16#01#, 16#03#, 16#03#, 16#03#, 16#03#, 16#00#, 16#00#, 16#3f#, 16#20#, 16#20#, 16#20#, 16#20#, 16#20#, 16#20#, 16#20#, 16#20#, 16#3f#, 16#08#, 16#08#, 16#ff#, 16#00#, 16#00#, 16#fe#, 16#00#, 16#fc#, 16#00#, 16#fe#, 16#00#, 16#00#, 16#00#, 16#7e#, 16#42#, 16#42#, 16#62#, 16#62#, 16#62#, 16#62#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#7d#, 16#00#, 16#41#, 16#7d#, 16#05#, 16#7d#, 16#7d#, 16#00#, 16#00#, 16#c2#, 16#c2#, 16#c6#, 16#44#, 16#6c#, 16#28#, 16#38#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#f7#, 16#10#, 16#14#, 16#f7#, 16#f7#, 16#04#, 16#04#, 16#00#, 16#00#, 16#7c#, 16#44#, 16#fe#, 16#c2#, 16#c2#, 16#c2#, 16#c2#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#ef#, 16#20#, 16#28#, 16#e8#, 16#e8#, 16#2f#, 16#2f#, 16#00#, 16#00#, 16#f9#, 16#85#, 16#c5#, 16#c5#, 16#c5#, 16#c5#, 16#f9#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#be#, 16#00#, 16#20#, 16#30#, 16#20#, 16#be#, 16#be#, 16#00#, 16#00#, 16#f7#, 16#04#, 16#e7#, 16#85#, 16#85#, 16#84#, 16#f4#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#7f#, 16#00#, 16#3f#, 16#00#, 16#7f#, 16#00#, 16#00#, 16#00#, 16#ef#, 16#28#, 16#ef#, 16#00#, 16#e0#, 16#60#, 16#6f#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#fe#, 16#00#, 16#fc#, 16#00#, 16#fe#, 16#00#, 16#00#, 16#00#, 16#c0#, 16#00#, 16#c0#, 16#c0#, 16#c0#, 16#c0#, 16#c0#, 16#00#, 16#00#, 16#fc#, 16#04#, 16#04#, 16#04#, 16#04#, 16#04#, 16#04#, 16#04#, 16#04#, 16#fc#, 16#10#, 16#10#, 16#ff#, 16#f9#, 16#81#, 16#b9#, 16#8b#, 16#9a#, 16#9a#, 16#fa#, 16#00#, 16#fa#, 16#8a#, 16#9a#, 16#9a#, 16#9b#, 16#99#, 16#f8#, 16#e6#, 16#25#, 16#25#, 16#f4#, 16#34#, 16#34#, 16#34#, 16#00#, 16#17#, 16#14#, 16#34#, 16#37#, 16#36#, 16#26#, 16#c7#, 16#df#, 16#50#, 16#50#, 16#5c#, 16#d8#, 16#d8#, 16#df#, 16#00#, 16#df#, 16#11#, 16#1f#, 16#12#, 16#1b#, 16#19#, 16#d9#, 16#7c#, 16#44#, 16#fe#, 16#86#, 16#86#, 16#86#, 16#fc#, 16#84#, 16#fe#, 16#82#, 16#82#, 16#fe#, 16#fe#, 16#80#, 16#c0#, 16#c0#, 16#c0#, 16#fe#, 16#fc#, 16#82#, 16#c2#, 16#c2#, 16#c2#, 16#fc#, 16#fe#, 16#80#, 16#f8#, 16#c0#, 16#c0#, 16#fe#, 16#fe#, 16#80#, 16#f0#, 16#c0#, 16#c0#, 16#c0#, 16#fe#, 16#80#, 16#be#, 16#86#, 16#86#, 16#fe#, 16#86#, 16#86#, 16#fe#, 16#86#, 16#86#, 16#86#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#18#, 16#18#, 16#18#, 16#48#, 16#48#, 16#78#, 16#9c#, 16#90#, 16#b0#, 16#c0#, 16#b0#, 16#9c#, 16#80#, 16#80#, 16#c0#, 16#c0#, 16#c0#, 16#fe#, 16#ee#, 16#92#, 16#92#, 16#86#, 16#86#, 16#86#, 16#fe#, 16#82#, 16#86#, 16#86#, 16#86#, 16#86#, 16#7c#, 16#82#, 16#86#, 16#86#, 16#86#, 16#7c#, 16#fe#, 16#82#, 16#fe#, 16#c0#, 16#c0#, 16#c0#, 16#7c#, 16#82#, 16#c2#, 16#ca#, 16#c4#, 16#7a#, 16#fe#, 16#86#, 16#fe#, 16#90#, 16#9c#, 16#84#, 16#fe#, 16#c0#, 16#fe#, 16#02#, 16#02#, 16#fe#, 16#fe#, 16#10#, 16#30#, 16#30#, 16#30#, 16#30#, 16#82#, 16#82#, 16#c2#, 16#c2#, 16#c2#, 16#fe#, 16#82#, 16#82#, 16#82#, 16#ee#, 16#38#, 16#10#, 16#86#, 16#86#, 16#96#, 16#92#, 16#92#, 16#ee#, 16#82#, 16#44#, 16#38#, 16#38#, 16#44#, 16#82#, 16#82#, 16#82#, 16#fe#, 16#30#, 16#30#, 16#30#, 16#fe#, 16#02#, 16#1e#, 16#f0#, 16#80#, 16#fe#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#06#, 16#00#, 16#00#, 16#00#, 16#60#, 16#60#, 16#c0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#18#, 16#18#, 16#18#, 16#00#, 16#18#, 16#7c#, 16#c6#, 16#0c#, 16#18#, 16#00#, 16#18#, 16#00#, 16#00#, 16#fe#, 16#fe#, 16#00#, 16#00#, 16#fe#, 16#82#, 16#86#, 16#86#, 16#86#, 16#fe#, 16#08#, 16#08#, 16#08#, 16#18#, 16#18#, 16#18#, 16#fe#, 16#02#, 16#fe#, 16#c0#, 16#c0#, 16#fe#, 16#fe#, 16#02#, 16#1e#, 16#06#, 16#06#, 16#fe#, 16#84#, 16#c4#, 16#c4#, 16#fe#, 16#04#, 16#04#, 16#fe#, 16#80#, 16#fe#, 16#06#, 16#06#, 16#fe#, 16#c0#, 16#c0#, 16#c0#, 16#fe#, 16#82#, 16#fe#, 16#fe#, 16#02#, 16#02#, 16#06#, 16#06#, 16#06#, 16#7c#, 16#44#, 16#fe#, 16#86#, 16#86#, 16#fe#, 16#fe#, 16#82#, 16#fe#, 16#06#, 16#06#, 16#06#, 16#44#, 16#fe#, 16#44#, 16#44#, 16#fe#, 16#44#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#6c#, 16#5a#, 16#00#, 16#0c#, 16#18#, 16#a8#, 16#30#, 16#4e#, 16#7e#, 16#00#, 16#12#, 16#18#, 16#66#, 16#6c#, 16#a8#, 16#5a#, 16#66#, 16#54#, 16#24#, 16#66#, 16#00#, 16#48#, 16#48#, 16#18#, 16#12#, 16#a8#, 16#06#, 16#90#, 16#a8#, 16#12#, 16#00#, 16#7e#, 16#30#, 16#12#, 16#a8#, 16#84#, 16#30#, 16#4e#, 16#72#, 16#18#, 16#66#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#90#, 16#54#, 16#78#, 16#a8#, 16#48#, 16#78#, 16#6c#, 16#72#, 16#a8#, 16#12#, 16#18#, 16#6c#, 16#72#, 16#66#, 16#54#, 16#90#, 16#a8#, 16#72#, 16#2a#, 16#18#, 16#a8#, 16#30#, 16#4e#, 16#7e#, 16#00#, 16#12#, 16#18#, 16#66#, 16#6c#, 16#a8#, 16#72#, 16#54#, 16#a8#, 16#5a#, 16#66#, 16#18#, 16#7e#, 16#18#, 16#4e#, 16#72#, 16#a8#, 16#72#, 16#2a#, 16#18#, 16#30#, 16#66#, 16#a8#, 16#30#, 16#4e#, 16#7e#, 16#00#, 16#6c#, 16#30#, 16#54#, 16#4e#, 16#9c#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#48#, 16#54#, 16#7e#, 16#18#, 16#a8#, 16#90#, 16#54#, 16#78#, 16#66#, 16#a8#, 16#6c#, 16#2a#, 16#30#, 16#5a#, 16#a8#, 16#84#, 16#30#, 16#72#, 16#2a#, 16#a8#, 16#d8#, 16#a8#, 16#00#, 16#4e#, 16#12#, 16#a8#, 16#e4#, 16#a2#, 16#a8#, 16#00#, 16#4e#, 16#12#, 16#a8#, 16#6c#, 16#2a#, 16#54#, 16#54#, 16#72#, 16#a8#, 16#84#, 16#30#, 16#72#, 16#2a#, 16#a8#, 16#de#, 16#9c#, 16#a8#, 16#72#, 16#2a#, 16#18#, 16#a8#, 16#0c#, 16#54#, 16#48#, 16#5a#, 16#78#, 16#72#, 16#18#, 16#66#, 16#a8#, 16#72#, 16#18#, 16#42#, 16#42#, 16#6c#, 16#a8#, 16#72#, 16#2a#, 16#00#, 16#72#, 16#a8#, 16#72#, 16#2a#, 16#18#, 16#a8#, 16#30#, 16#4e#, 16#7e#, 16#00#, 16#12#, 16#18#, 16#66#, 16#6c#, 16#a8#, 16#30#, 16#4e#, 16#0c#, 16#66#, 16#18#, 16#00#, 16#6c#, 16#18#, 16#a8#, 16#72#, 16#2a#, 16#18#, 16#30#, 16#66#, 16#a8#, 16#1e#, 16#54#, 16#66#, 16#0c#, 16#18#, 16#9c#, 16#a8#, 16#24#, 16#54#, 16#54#, 16#12#, 16#a8#, 16#42#, 16#78#, 16#0c#, 16#3c#, 16#a8#, 16#ae#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#ff#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, others => 0);
HIDDEN : constant ROM := (16#12#, 16#1d#, 16#48#, 16#49#, 16#44#, 16#44#, 16#45#, 16#4e#, 16#21#, 16#20#, 16#31#, 16#2e#, 16#30#, 16#20#, 16#42#, 16#79#, 16#20#, 16#44#, 16#61#, 16#76#, 16#69#, 16#64#, 16#20#, 16#57#, 16#49#, 16#4e#, 16#54#, 16#45#, 16#52#, 16#a4#, 16#3f#, 16#60#, 16#00#, 16#61#, 16#40#, 16#f1#, 16#55#, 16#a4#, 16#3f#, 16#60#, 16#00#, 16#f0#, 16#55#, 16#00#, 16#e0#, 16#a4#, 16#7e#, 16#60#, 16#0c#, 16#61#, 16#08#, 16#62#, 16#0f#, 16#d0#, 16#1f#, 16#70#, 16#08#, 16#f2#, 16#1e#, 16#30#, 16#34#, 16#12#, 16#35#, 16#f0#, 16#0a#, 16#00#, 16#e0#, 16#a4#, 16#c9#, 16#60#, 16#13#, 16#61#, 16#0d#, 16#62#, 16#04#, 16#d0#, 16#14#, 16#70#, 16#08#, 16#f2#, 16#1e#, 16#30#, 16#2b#, 16#12#, 16#4b#, 16#a4#, 16#1f#, 16#ff#, 16#65#, 16#a4#, 16#2f#, 16#ff#, 16#55#, 16#63#, 16#40#, 16#66#, 16#08#, 16#c1#, 16#0f#, 16#c2#, 16#0f#, 16#a4#, 16#2f#, 16#f1#, 16#1e#, 16#f0#, 16#65#, 16#84#, 16#00#, 16#a4#, 16#2f#, 16#f2#, 16#1e#, 16#f0#, 16#65#, 16#85#, 16#00#, 16#80#, 16#40#, 16#f0#, 16#55#, 16#a4#, 16#2f#, 16#f1#, 16#1e#, 16#80#, 16#50#, 16#f0#, 16#55#, 16#73#, 16#ff#, 16#33#, 16#00#, 16#12#, 16#61#, 16#00#, 16#e0#, 16#60#, 16#00#, 16#61#, 16#00#, 16#a4#, 16#77#, 16#d0#, 16#17#, 16#70#, 16#08#, 16#30#, 16#20#, 16#12#, 16#8f#, 16#60#, 16#00#, 16#71#, 16#08#, 16#31#, 16#20#, 16#12#, 16#8f#, 16#6c#, 16#00#, 16#6d#, 16#00#, 16#6e#, 16#00#, 16#a4#, 16#3f#, 16#f0#, 16#65#, 16#70#, 16#01#, 16#f0#, 16#55#, 16#23#, 16#b9#, 16#6a#, 16#10#, 16#23#, 16#5d#, 16#23#, 16#cd#, 16#8a#, 16#90#, 16#87#, 16#d0#, 16#88#, 16#e0#, 16#23#, 16#5d#, 16#23#, 16#cd#, 16#23#, 16#b9#, 16#a4#, 16#2f#, 16#f9#, 16#1e#, 16#f0#, 16#65#, 16#81#, 16#00#, 16#a4#, 16#2f#, 16#fa#, 16#1e#, 16#f0#, 16#65#, 16#50#, 16#10#, 16#13#, 16#2b#, 16#23#, 16#df#, 16#60#, 16#20#, 16#24#, 16#01#, 16#23#, 16#df#, 16#60#, 16#00#, 16#a4#, 16#2f#, 16#f9#, 16#1e#, 16#f0#, 16#55#, 16#a4#, 16#2f#, 16#fa#, 16#1e#, 16#f0#, 16#55#, 16#76#, 16#ff#, 16#36#, 16#00#, 16#12#, 16#a5#, 16#a4#, 16#3f#, 16#f1#, 16#65#, 16#82#, 16#00#, 16#80#, 16#15#, 16#3f#, 16#00#, 16#13#, 16#01#, 16#80#, 16#20#, 16#81#, 16#20#, 16#f1#, 16#55#, 16#00#, 16#e0#, 16#a5#, 16#19#, 16#60#, 16#10#, 16#61#, 16#07#, 16#62#, 16#0e#, 16#d0#, 16#1f#, 16#70#, 16#08#, 16#f2#, 16#1e#, 16#30#, 16#30#, 16#13#, 16#0b#, 16#a4#, 16#3f#, 16#f1#, 16#65#, 16#84#, 16#10#, 16#83#, 16#00#, 16#66#, 16#09#, 16#24#, 16#0b#, 16#66#, 16#0f#, 16#83#, 16#40#, 16#24#, 16#0b#, 16#f0#, 16#0a#, 16#12#, 16#25#, 16#23#, 16#db#, 16#60#, 16#80#, 16#24#, 16#01#, 16#23#, 16#db#, 16#a4#, 16#2f#, 16#fa#, 16#1e#, 16#f0#, 16#65#, 16#70#, 16#ff#, 16#23#, 16#f3#, 16#a4#, 16#41#, 16#f0#, 16#1e#, 16#d7#, 16#87#, 16#a4#, 16#77#, 16#d7#, 16#87#, 16#a4#, 16#2f#, 16#f9#, 16#1e#, 16#f0#, 16#65#, 16#70#, 16#ff#, 16#23#, 16#f3#, 16#a4#, 16#41#, 16#f0#, 16#1e#, 16#dd#, 16#e7#, 16#a4#, 16#77#, 16#dd#, 16#e7#, 16#12#, 16#a5#, 16#a4#, 16#71#, 16#dd#, 16#e7#, 16#fb#, 16#0a#, 16#dd#, 16#e7#, 16#3b#, 16#04#, 16#13#, 16#71#, 16#4d#, 16#00#, 16#13#, 16#5d#, 16#7d#, 16#f8#, 16#7c#, 16#ff#, 16#3b#, 16#06#, 16#13#, 16#7d#, 16#4d#, 16#18#, 16#13#, 16#5d#, 16#7d#, 16#08#, 16#7c#, 16#01#, 16#3b#, 16#02#, 16#13#, 16#89#, 16#4e#, 16#00#, 16#13#, 16#5d#, 16#7e#, 16#f8#, 16#7c#, 16#fc#, 16#3b#, 16#08#, 16#13#, 16#95#, 16#4e#, 16#18#, 16#13#, 16#5d#, 16#7e#, 16#08#, 16#7c#, 16#04#, 16#3b#, 16#05#, 16#13#, 16#5d#, 16#a4#, 16#2f#, 16#fc#, 16#1e#, 16#f0#, 16#65#, 16#40#, 16#00#, 16#13#, 16#5d#, 16#89#, 16#c0#, 16#99#, 16#a0#, 16#13#, 16#5d#, 16#70#, 16#ff#, 16#a4#, 16#77#, 16#dd#, 16#e7#, 16#a4#, 16#41#, 16#23#, 16#f3#, 16#f0#, 16#1e#, 16#dd#, 16#e7#, 16#00#, 16#ee#, 16#a4#, 16#d5#, 16#60#, 16#24#, 16#61#, 16#0a#, 16#62#, 16#0b#, 16#d0#, 16#1b#, 16#70#, 16#08#, 16#f2#, 16#1e#, 16#30#, 16#3c#, 16#13#, 16#c1#, 16#00#, 16#ee#, 16#60#, 16#34#, 16#61#, 16#10#, 16#a4#, 16#f1#, 16#d0#, 16#15#, 16#a4#, 16#f6#, 16#d0#, 16#15#, 16#00#, 16#ee#, 16#a4#, 16#fb#, 16#13#, 16#e1#, 16#a5#, 16#0a#, 16#60#, 16#24#, 16#61#, 16#0d#, 16#62#, 16#05#, 16#d0#, 16#15#, 16#70#, 16#08#, 16#f2#, 16#1e#, 16#30#, 16#3c#, 16#13#, 16#e7#, 16#00#, 16#ee#, 16#81#, 16#00#, 16#81#, 16#14#, 16#80#, 16#04#, 16#80#, 16#04#, 16#80#, 16#04#, 16#80#, 16#15#, 16#00#, 16#ee#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#14#, 16#03#, 16#00#, 16#ee#, 16#a4#, 16#2f#, 16#f3#, 16#33#, 16#f2#, 16#65#, 16#65#, 16#23#, 16#f1#, 16#29#, 16#d5#, 16#65#, 16#65#, 16#28#, 16#f2#, 16#29#, 16#d5#, 16#65#, 16#00#, 16#ee#, 16#01#, 16#02#, 16#03#, 16#04#, 16#08#, 16#07#, 16#06#, 16#05#, 16#05#, 16#06#, 16#07#, 16#08#, 16#04#, 16#03#, 16#02#, 16#01#, 16#01#, 16#02#, 16#03#, 16#04#, 16#08#, 16#07#, 16#06#, 16#05#, 16#05#, 16#06#, 16#07#, 16#08#, 16#04#, 16#03#, 16#02#, 16#01#, 16#00#, 16#00#, 16#fe#, 16#ee#, 16#c6#, 16#82#, 16#c6#, 16#ee#, 16#fe#, 16#fe#, 16#c6#, 16#c6#, 16#c6#, 16#fe#, 16#fe#, 16#c6#, 16#aa#, 16#82#, 16#aa#, 16#c6#, 16#fe#, 16#c6#, 16#82#, 16#82#, 16#82#, 16#c6#, 16#fe#, 16#ba#, 16#d6#, 16#ee#, 16#d6#, 16#ba#, 16#fe#, 16#ee#, 16#ee#, 16#82#, 16#ee#, 16#ee#, 16#fe#, 16#82#, 16#fe#, 16#82#, 16#fe#, 16#82#, 16#fe#, 16#aa#, 16#aa#, 16#aa#, 16#aa#, 16#aa#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, 16#aa#, 16#d6#, 16#aa#, 16#d6#, 16#aa#, 16#fe#, 16#8b#, 16#88#, 16#f8#, 16#88#, 16#8b#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#f0#, 16#48#, 16#48#, 16#48#, 16#f2#, 16#ef#, 16#84#, 16#84#, 16#84#, 16#ef#, 16#00#, 16#08#, 16#08#, 16#0a#, 16#00#, 16#8a#, 16#8a#, 16#aa#, 16#aa#, 16#52#, 16#3c#, 16#92#, 16#92#, 16#92#, 16#3c#, 16#00#, 16#e2#, 16#a3#, 16#e3#, 16#00#, 16#8b#, 16#c8#, 16#a8#, 16#98#, 16#88#, 16#fa#, 16#83#, 16#e2#, 16#82#, 16#fa#, 16#00#, 16#28#, 16#b8#, 16#90#, 16#00#, 16#ef#, 16#88#, 16#8e#, 16#88#, 16#8f#, 16#21#, 16#21#, 16#a1#, 16#60#, 16#21#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#bc#, 16#22#, 16#3c#, 16#28#, 16#a4#, 16#89#, 16#8a#, 16#ab#, 16#52#, 16#97#, 16#51#, 16#d1#, 16#51#, 16#c0#, 16#00#, 16#00#, 16#15#, 16#6a#, 16#8a#, 16#8e#, 16#8a#, 16#6a#, 16#00#, 16#64#, 16#8a#, 16#8e#, 16#8a#, 16#6a#, 16#44#, 16#aa#, 16#aa#, 16#aa#, 16#44#, 16#00#, 16#cc#, 16#aa#, 16#ca#, 16#aa#, 16#ac#, 16#6e#, 16#88#, 16#4c#, 16#28#, 16#ce#, 16#00#, 16#04#, 16#0c#, 16#04#, 16#04#, 16#0e#, 16#0c#, 16#12#, 16#04#, 16#08#, 16#1e#, 16#63#, 16#94#, 16#94#, 16#94#, 16#63#, 16#38#, 16#a5#, 16#b8#, 16#a0#, 16#21#, 16#e1#, 16#01#, 16#c1#, 16#20#, 16#c1#, 16#89#, 16#8a#, 16#52#, 16#22#, 16#21#, 16#cf#, 16#28#, 16#2f#, 16#28#, 16#c8#, 16#02#, 16#82#, 16#02#, 16#00#, 16#02#, 16#ff#, 16#80#, 16#8f#, 16#90#, 16#8e#, 16#81#, 16#9e#, 16#80#, 16#91#, 16#91#, 16#9f#, 16#91#, 16#91#, 16#80#, 16#ff#, 16#00#, 16#3c#, 16#40#, 16#40#, 16#40#, 16#3c#, 16#00#, 16#7c#, 16#10#, 16#10#, 16#10#, 16#7c#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#80#, 16#00#, 16#80#, 16#00#, 16#00#, 16#00#, 16#80#, 16#00#, 16#80#, 16#00#, 16#00#, 16#ff#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#ff#, others => 0);
PUZZLE : constant ROM := (16#6a#, 16#12#, 16#6b#, 16#01#, 16#61#, 16#10#, 16#62#, 16#00#, 16#60#, 16#00#, 16#a2#, 16#b0#, 16#d1#, 16#27#, 16#f0#, 16#29#, 16#30#, 16#00#, 16#da#, 16#b5#, 16#71#, 16#08#, 16#7a#, 16#08#, 16#31#, 16#30#, 16#12#, 16#24#, 16#61#, 16#10#, 16#72#, 16#08#, 16#6a#, 16#12#, 16#7b#, 16#08#, 16#a3#, 16#00#, 16#f0#, 16#1e#, 16#f0#, 16#55#, 16#70#, 16#01#, 16#30#, 16#10#, 16#12#, 16#0a#, 16#6a#, 16#12#, 16#6b#, 16#01#, 16#6c#, 16#00#, 16#62#, 16#ff#, 16#c0#, 16#06#, 16#70#, 16#02#, 16#22#, 16#52#, 16#72#, 16#ff#, 16#32#, 16#00#, 16#12#, 16#38#, 16#6e#, 16#00#, 16#6e#, 16#00#, 16#f0#, 16#0a#, 16#22#, 16#52#, 16#7e#, 16#01#, 16#7e#, 16#01#, 16#12#, 16#48#, 16#84#, 16#a0#, 16#85#, 16#b0#, 16#86#, 16#c0#, 16#30#, 16#02#, 16#12#, 16#64#, 16#45#, 16#01#, 16#12#, 16#64#, 16#75#, 16#f8#, 16#76#, 16#fc#, 16#30#, 16#08#, 16#12#, 16#70#, 16#45#, 16#19#, 16#12#, 16#70#, 16#75#, 16#08#, 16#76#, 16#04#, 16#30#, 16#06#, 16#12#, 16#7c#, 16#44#, 16#12#, 16#12#, 16#7c#, 16#74#, 16#f8#, 16#76#, 16#ff#, 16#30#, 16#04#, 16#12#, 16#88#, 16#44#, 16#2a#, 16#12#, 16#88#, 16#74#, 16#08#, 16#76#, 16#01#, 16#a3#, 16#00#, 16#f6#, 16#1e#, 16#f0#, 16#65#, 16#81#, 16#00#, 16#60#, 16#00#, 16#a3#, 16#00#, 16#f6#, 16#1e#, 16#f0#, 16#55#, 16#a3#, 16#00#, 16#fc#, 16#1e#, 16#80#, 16#10#, 16#f0#, 16#55#, 16#f1#, 16#29#, 16#d4#, 16#55#, 16#da#, 16#b5#, 16#8a#, 16#40#, 16#8b#, 16#50#, 16#8c#, 16#60#, 16#00#, 16#ee#, 16#ee#, 16#5e#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, others => 0);
GUESS : constant ROM := (16#6e#, 16#01#, 16#00#, 16#e0#, 16#6d#, 16#01#, 16#6a#, 16#01#, 16#6b#, 16#01#, 16#8c#, 16#d0#, 16#8c#, 16#e2#, 16#4c#, 16#00#, 16#12#, 16#20#, 16#88#, 16#d0#, 16#22#, 16#3e#, 16#3a#, 16#40#, 16#12#, 16#20#, 16#6a#, 16#01#, 16#7b#, 16#06#, 16#3c#, 16#3f#, 16#7d#, 16#01#, 16#3d#, 16#3f#, 16#12#, 16#0a#, 16#f0#, 16#0a#, 16#40#, 16#05#, 16#89#, 16#e4#, 16#8e#, 16#e4#, 16#3e#, 16#40#, 16#12#, 16#02#, 16#6a#, 16#1c#, 16#6b#, 16#0d#, 16#88#, 16#90#, 16#00#, 16#e0#, 16#22#, 16#3e#, 16#12#, 16#3c#, 16#a2#, 16#94#, 16#f8#, 16#33#, 16#f2#, 16#65#, 16#22#, 16#54#, 16#da#, 16#b5#, 16#7a#, 16#04#, 16#81#, 16#20#, 16#22#, 16#54#, 16#da#, 16#b5#, 16#7a#, 16#05#, 16#00#, 16#ee#, 16#83#, 16#10#, 16#83#, 16#34#, 16#83#, 16#34#, 16#83#, 16#14#, 16#a2#, 16#62#, 16#f3#, 16#1e#, 16#00#, 16#ee#, 16#e0#, 16#a0#, 16#a0#, 16#a0#, 16#e0#, 16#40#, 16#40#, 16#40#, 16#40#, 16#40#, 16#e0#, 16#20#, 16#e0#, 16#80#, 16#e0#, 16#e0#, 16#20#, 16#e0#, 16#20#, 16#e0#, 16#a0#, 16#a0#, 16#e0#, 16#20#, 16#20#, 16#e0#, 16#80#, 16#e0#, 16#20#, 16#e0#, 16#e0#, 16#80#, 16#e0#, 16#a0#, 16#e0#, 16#e0#, 16#20#, 16#20#, 16#20#, 16#20#, 16#e0#, 16#a0#, 16#e0#, 16#a0#, 16#e0#, 16#e0#, 16#a0#, 16#e0#, 16#20#, 16#e0#, others => 0);
TETRIS : constant ROM := (16#a2#, 16#b4#, 16#23#, 16#e6#, 16#22#, 16#b6#, 16#70#, 16#01#, 16#d0#, 16#11#, 16#30#, 16#25#, 16#12#, 16#06#, 16#71#, 16#ff#, 16#d0#, 16#11#, 16#60#, 16#1a#, 16#d0#, 16#11#, 16#60#, 16#25#, 16#31#, 16#00#, 16#12#, 16#0e#, 16#c4#, 16#70#, 16#44#, 16#70#, 16#12#, 16#1c#, 16#c3#, 16#03#, 16#60#, 16#1e#, 16#61#, 16#03#, 16#22#, 16#5c#, 16#f5#, 16#15#, 16#d0#, 16#14#, 16#3f#, 16#01#, 16#12#, 16#3c#, 16#d0#, 16#14#, 16#71#, 16#ff#, 16#d0#, 16#14#, 16#23#, 16#40#, 16#12#, 16#1c#, 16#e7#, 16#a1#, 16#22#, 16#72#, 16#e8#, 16#a1#, 16#22#, 16#84#, 16#e9#, 16#a1#, 16#22#, 16#96#, 16#e2#, 16#9e#, 16#12#, 16#50#, 16#66#, 16#00#, 16#f6#, 16#15#, 16#f6#, 16#07#, 16#36#, 16#00#, 16#12#, 16#3c#, 16#d0#, 16#14#, 16#71#, 16#01#, 16#12#, 16#2a#, 16#a2#, 16#c4#, 16#f4#, 16#1e#, 16#66#, 16#00#, 16#43#, 16#01#, 16#66#, 16#04#, 16#43#, 16#02#, 16#66#, 16#08#, 16#43#, 16#03#, 16#66#, 16#0c#, 16#f6#, 16#1e#, 16#00#, 16#ee#, 16#d0#, 16#14#, 16#70#, 16#ff#, 16#23#, 16#34#, 16#3f#, 16#01#, 16#00#, 16#ee#, 16#d0#, 16#14#, 16#70#, 16#01#, 16#23#, 16#34#, 16#00#, 16#ee#, 16#d0#, 16#14#, 16#70#, 16#01#, 16#23#, 16#34#, 16#3f#, 16#01#, 16#00#, 16#ee#, 16#d0#, 16#14#, 16#70#, 16#ff#, 16#23#, 16#34#, 16#00#, 16#ee#, 16#d0#, 16#14#, 16#73#, 16#01#, 16#43#, 16#04#, 16#63#, 16#00#, 16#22#, 16#5c#, 16#23#, 16#34#, 16#3f#, 16#01#, 16#00#, 16#ee#, 16#d0#, 16#14#, 16#73#, 16#ff#, 16#43#, 16#ff#, 16#63#, 16#03#, 16#22#, 16#5c#, 16#23#, 16#34#, 16#00#, 16#ee#, 16#80#, 16#00#, 16#67#, 16#05#, 16#68#, 16#06#, 16#69#, 16#04#, 16#61#, 16#1f#, 16#65#, 16#10#, 16#62#, 16#07#, 16#00#, 16#ee#, 16#40#, 16#e0#, 16#00#, 16#00#, 16#40#, 16#c0#, 16#40#, 16#00#, 16#00#, 16#e0#, 16#40#, 16#00#, 16#40#, 16#60#, 16#40#, 16#00#, 16#40#, 16#40#, 16#60#, 16#00#, 16#20#, 16#e0#, 16#00#, 16#00#, 16#c0#, 16#40#, 16#40#, 16#00#, 16#00#, 16#e0#, 16#80#, 16#00#, 16#40#, 16#40#, 16#c0#, 16#00#, 16#00#, 16#e0#, 16#20#, 16#00#, 16#60#, 16#40#, 16#40#, 16#00#, 16#80#, 16#e0#, 16#00#, 16#00#, 16#40#, 16#c0#, 16#80#, 16#00#, 16#c0#, 16#60#, 16#00#, 16#00#, 16#40#, 16#c0#, 16#80#, 16#00#, 16#c0#, 16#60#, 16#00#, 16#00#, 16#80#, 16#c0#, 16#40#, 16#00#, 16#00#, 16#60#, 16#c0#, 16#00#, 16#80#, 16#c0#, 16#40#, 16#00#, 16#00#, 16#60#, 16#c0#, 16#00#, 16#c0#, 16#c0#, 16#00#, 16#00#, 16#c0#, 16#c0#, 16#00#, 16#00#, 16#c0#, 16#c0#, 16#00#, 16#00#, 16#c0#, 16#c0#, 16#00#, 16#00#, 16#40#, 16#40#, 16#40#, 16#40#, 16#00#, 16#f0#, 16#00#, 16#00#, 16#40#, 16#40#, 16#40#, 16#40#, 16#00#, 16#f0#, 16#00#, 16#00#, 16#d0#, 16#14#, 16#66#, 16#35#, 16#76#, 16#ff#, 16#36#, 16#00#, 16#13#, 16#38#, 16#00#, 16#ee#, 16#a2#, 16#b4#, 16#8c#, 16#10#, 16#3c#, 16#1e#, 16#7c#, 16#01#, 16#3c#, 16#1e#, 16#7c#, 16#01#, 16#3c#, 16#1e#, 16#7c#, 16#01#, 16#23#, 16#5e#, 16#4b#, 16#0a#, 16#23#, 16#72#, 16#91#, 16#c0#, 16#00#, 16#ee#, 16#71#, 16#01#, 16#13#, 16#50#, 16#60#, 16#1b#, 16#6b#, 16#00#, 16#d0#, 16#11#, 16#3f#, 16#00#, 16#7b#, 16#01#, 16#d0#, 16#11#, 16#70#, 16#01#, 16#30#, 16#25#, 16#13#, 16#62#, 16#00#, 16#ee#, 16#60#, 16#1b#, 16#d0#, 16#11#, 16#70#, 16#01#, 16#30#, 16#25#, 16#13#, 16#74#, 16#8e#, 16#10#, 16#8d#, 16#e0#, 16#7e#, 16#ff#, 16#60#, 16#1b#, 16#6b#, 16#00#, 16#d0#, 16#e1#, 16#3f#, 16#00#, 16#13#, 16#90#, 16#d0#, 16#e1#, 16#13#, 16#94#, 16#d0#, 16#d1#, 16#7b#, 16#01#, 16#70#, 16#01#, 16#30#, 16#25#, 16#13#, 16#86#, 16#4b#, 16#00#, 16#13#, 16#a6#, 16#7d#, 16#ff#, 16#7e#, 16#ff#, 16#3d#, 16#01#, 16#13#, 16#82#, 16#23#, 16#c0#, 16#3f#, 16#01#, 16#23#, 16#c0#, 16#7a#, 16#01#, 16#23#, 16#c0#, 16#80#, 16#a0#, 16#6d#, 16#07#, 16#80#, 16#d2#, 16#40#, 16#04#, 16#75#, 16#fe#, 16#45#, 16#02#, 16#65#, 16#04#, 16#00#, 16#ee#, 16#a7#, 16#00#, 16#f2#, 16#55#, 16#a8#, 16#04#, 16#fa#, 16#33#, 16#f2#, 16#65#, 16#f0#, 16#29#, 16#6d#, 16#32#, 16#6e#, 16#00#, 16#dd#, 16#e5#, 16#7d#, 16#05#, 16#f1#, 16#29#, 16#dd#, 16#e5#, 16#7d#, 16#05#, 16#f2#, 16#29#, 16#dd#, 16#e5#, 16#a7#, 16#00#, 16#f2#, 16#65#, 16#a2#, 16#b4#, 16#00#, 16#ee#, 16#6a#, 16#00#, 16#60#, 16#19#, 16#00#, 16#ee#, 16#37#, 16#23#, others => 0);
BLINKY : constant ROM := (16#12#, 16#1a#, 16#32#, 16#2e#, 16#30#, 16#30#, 16#20#, 16#43#, 16#2e#, 16#20#, 16#45#, 16#67#, 16#65#, 16#62#, 16#65#, 16#72#, 16#67#, 16#20#, 16#31#, 16#38#, 16#2f#, 16#38#, 16#2d#, 16#27#, 16#39#, 16#31#, 16#80#, 16#03#, 16#81#, 16#13#, 16#a8#, 16#c8#, 16#f1#, 16#55#, 16#60#, 16#05#, 16#a8#, 16#cc#, 16#f0#, 16#55#, 16#87#, 16#73#, 16#86#, 16#63#, 16#27#, 16#72#, 16#00#, 16#e0#, 16#27#, 16#94#, 16#6e#, 16#40#, 16#87#, 16#e2#, 16#6e#, 16#27#, 16#87#, 16#e1#, 16#68#, 16#1a#, 16#69#, 16#0c#, 16#6a#, 16#38#, 16#6b#, 16#00#, 16#6c#, 16#02#, 16#6d#, 16#1a#, 16#27#, 16#50#, 16#a8#, 16#ed#, 16#da#, 16#b4#, 16#dc#, 16#d4#, 16#23#, 16#d0#, 16#3e#, 16#00#, 16#12#, 16#7c#, 16#a8#, 16#cc#, 16#f0#, 16#65#, 16#85#, 16#00#, 16#c4#, 16#ff#, 16#84#, 16#52#, 16#24#, 16#f6#, 16#c4#, 16#ff#, 16#84#, 16#52#, 16#26#, 16#1e#, 16#60#, 16#01#, 16#e0#, 16#a1#, 16#27#, 16#d6#, 16#36#, 16#f7#, 16#12#, 16#4e#, 16#8e#, 16#60#, 16#28#, 16#7a#, 16#6e#, 16#64#, 16#28#, 16#7a#, 16#27#, 16#d6#, 16#12#, 16#2a#, 16#f0#, 16#07#, 16#40#, 16#00#, 16#13#, 16#10#, 16#80#, 16#80#, 16#80#, 16#06#, 16#81#, 16#a0#, 16#81#, 16#06#, 16#80#, 16#15#, 16#40#, 16#00#, 16#12#, 16#9a#, 16#40#, 16#01#, 16#12#, 16#9a#, 16#40#, 16#ff#, 16#12#, 16#9a#, 16#12#, 16#c8#, 16#80#, 16#90#, 16#80#, 16#06#, 16#81#, 16#b0#, 16#81#, 16#06#, 16#80#, 16#15#, 16#40#, 16#00#, 16#12#, 16#b2#, 16#40#, 16#01#, 16#12#, 16#b2#, 16#40#, 16#ff#, 16#12#, 16#b2#, 16#12#, 16#c8#, 16#a8#, 16#ed#, 16#da#, 16#b4#, 16#6a#, 16#38#, 16#6b#, 16#00#, 16#da#, 16#b4#, 16#6e#, 16#f3#, 16#87#, 16#e2#, 16#6e#, 16#04#, 16#87#, 16#e1#, 16#6e#, 16#32#, 16#28#, 16#7a#, 16#80#, 16#80#, 16#80#, 16#06#, 16#81#, 16#c0#, 16#81#, 16#06#, 16#80#, 16#15#, 16#40#, 16#00#, 16#12#, 16#e0#, 16#40#, 16#01#, 16#12#, 16#e0#, 16#40#, 16#ff#, 16#12#, 16#e0#, 16#12#, 16#54#, 16#80#, 16#90#, 16#80#, 16#06#, 16#81#, 16#d0#, 16#81#, 16#06#, 16#80#, 16#15#, 16#40#, 16#00#, 16#12#, 16#f8#, 16#40#, 16#01#, 16#12#, 16#f8#, 16#40#, 16#ff#, 16#12#, 16#f8#, 16#12#, 16#54#, 16#a8#, 16#ed#, 16#dc#, 16#d4#, 16#6c#, 16#02#, 16#6d#, 16#1a#, 16#dc#, 16#d4#, 16#6e#, 16#cf#, 16#87#, 16#e2#, 16#6e#, 16#20#, 16#87#, 16#e1#, 16#6e#, 16#19#, 16#28#, 16#7a#, 16#12#, 16#54#, 16#60#, 16#3f#, 16#28#, 16#a8#, 16#27#, 16#50#, 16#a8#, 16#ed#, 16#da#, 16#b4#, 16#dc#, 16#d4#, 16#6e#, 16#40#, 16#87#, 16#e3#, 16#80#, 16#70#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#12#, 16#32#, 16#8e#, 16#60#, 16#28#, 16#7a#, 16#28#, 16#8a#, 16#00#, 16#e0#, 16#66#, 16#11#, 16#67#, 16#0a#, 16#a8#, 16#ca#, 16#27#, 16#e6#, 16#66#, 16#11#, 16#67#, 16#10#, 16#a8#, 16#c8#, 16#27#, 16#e6#, 16#64#, 16#00#, 16#65#, 16#08#, 16#66#, 16#00#, 16#67#, 16#0f#, 16#ab#, 16#19#, 16#d4#, 16#69#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#60#, 16#03#, 16#28#, 16#a8#, 16#3e#, 16#00#, 16#13#, 16#c6#, 16#ab#, 16#19#, 16#d4#, 16#69#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#74#, 16#02#, 16#75#, 16#02#, 16#34#, 16#30#, 16#13#, 16#48#, 16#ab#, 16#19#, 16#d4#, 16#69#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#60#, 16#03#, 16#28#, 16#a8#, 16#3e#, 16#00#, 16#13#, 16#c6#, 16#ab#, 16#19#, 16#d4#, 16#69#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#76#, 16#02#, 16#36#, 16#16#, 16#13#, 16#68#, 16#ab#, 16#19#, 16#d4#, 16#69#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#60#, 16#03#, 16#28#, 16#a8#, 16#3e#, 16#00#, 16#13#, 16#c6#, 16#ab#, 16#19#, 16#d4#, 16#69#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#74#, 16#fe#, 16#75#, 16#fe#, 16#34#, 16#00#, 16#13#, 16#86#, 16#ab#, 16#19#, 16#d4#, 16#69#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#60#, 16#03#, 16#28#, 16#a8#, 16#3e#, 16#00#, 16#13#, 16#c6#, 16#ab#, 16#19#, 16#d4#, 16#69#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#76#, 16#fe#, 16#36#, 16#00#, 16#13#, 16#a6#, 16#13#, 16#48#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#ab#, 16#2b#, 16#d5#, 16#69#, 16#12#, 16#1a#, 16#83#, 16#70#, 16#6e#, 16#03#, 16#83#, 16#e2#, 16#84#, 16#80#, 16#85#, 16#90#, 16#6e#, 16#06#, 16#ee#, 16#a1#, 16#14#, 16#32#, 16#6e#, 16#03#, 16#ee#, 16#a1#, 16#14#, 16#4a#, 16#6e#, 16#08#, 16#ee#, 16#a1#, 16#14#, 16#62#, 16#6e#, 16#07#, 16#ee#, 16#a1#, 16#14#, 16#7a#, 16#43#, 16#03#, 16#75#, 16#02#, 16#43#, 16#00#, 16#75#, 16#fe#, 16#43#, 16#02#, 16#74#, 16#02#, 16#43#, 16#01#, 16#74#, 16#fe#, 16#80#, 16#40#, 16#81#, 16#50#, 16#27#, 16#ba#, 16#82#, 16#00#, 16#6e#, 16#08#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#14#, 16#92#, 16#6e#, 16#07#, 16#80#, 16#20#, 16#82#, 16#e2#, 16#42#, 16#05#, 16#14#, 16#9a#, 16#42#, 16#06#, 16#14#, 16#b2#, 16#42#, 16#07#, 16#14#, 16#ec#, 16#27#, 16#50#, 16#6e#, 16#fc#, 16#87#, 16#e2#, 16#87#, 16#31#, 16#88#, 16#40#, 16#89#, 16#50#, 16#17#, 16#50#, 16#80#, 16#40#, 16#81#, 16#50#, 16#71#, 16#02#, 16#27#, 16#ba#, 16#82#, 16#00#, 16#6e#, 16#08#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#13#, 16#f2#, 16#63#, 16#03#, 16#75#, 16#02#, 16#14#, 16#0e#, 16#80#, 16#40#, 16#81#, 16#50#, 16#71#, 16#fe#, 16#27#, 16#ba#, 16#82#, 16#00#, 16#6e#, 16#08#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#13#, 16#f2#, 16#63#, 16#00#, 16#75#, 16#fe#, 16#14#, 16#0e#, 16#80#, 16#40#, 16#81#, 16#50#, 16#70#, 16#02#, 16#27#, 16#ba#, 16#82#, 16#00#, 16#6e#, 16#08#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#13#, 16#f2#, 16#63#, 16#02#, 16#74#, 16#02#, 16#14#, 16#0e#, 16#80#, 16#40#, 16#81#, 16#50#, 16#70#, 16#fe#, 16#27#, 16#ba#, 16#82#, 16#00#, 16#6e#, 16#08#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#13#, 16#f2#, 16#63#, 16#01#, 16#74#, 16#fe#, 16#14#, 16#0e#, 16#27#, 16#50#, 16#d8#, 16#94#, 16#8e#, 16#f0#, 16#00#, 16#ee#, 16#6e#, 16#f0#, 16#80#, 16#e2#, 16#80#, 16#31#, 16#f0#, 16#55#, 16#a8#, 16#f1#, 16#d4#, 16#54#, 16#76#, 16#01#, 16#61#, 16#05#, 16#f0#, 16#07#, 16#40#, 16#00#, 16#f1#, 16#18#, 16#14#, 16#24#, 16#6e#, 16#f0#, 16#80#, 16#e2#, 16#80#, 16#31#, 16#f0#, 16#55#, 16#a8#, 16#f5#, 16#d4#, 16#54#, 16#76#, 16#04#, 16#80#, 16#a0#, 16#81#, 16#b0#, 16#27#, 16#ba#, 16#6e#, 16#f0#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#14#, 16#d2#, 16#6e#, 16#0c#, 16#87#, 16#e3#, 16#80#, 16#c0#, 16#81#, 16#d0#, 16#27#, 16#ba#, 16#6e#, 16#f0#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#14#, 16#e4#, 16#6e#, 16#30#, 16#87#, 16#e3#, 16#60#, 16#ff#, 16#f0#, 16#18#, 16#f0#, 16#15#, 16#14#, 16#24#, 16#43#, 16#01#, 16#64#, 16#3a#, 16#43#, 16#02#, 16#64#, 16#00#, 16#14#, 16#24#, 16#82#, 16#70#, 16#83#, 16#70#, 16#6e#, 16#0c#, 16#82#, 16#e2#, 16#80#, 16#a0#, 16#81#, 16#b0#, 16#27#, 16#ba#, 16#a8#, 16#ed#, 16#6e#, 16#f0#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#15#, 16#24#, 16#da#, 16#b4#, 16#42#, 16#0c#, 16#7b#, 16#02#, 16#42#, 16#00#, 16#7b#, 16#fe#, 16#42#, 16#08#, 16#7a#, 16#02#, 16#42#, 16#04#, 16#7a#, 16#fe#, 16#da#, 16#b4#, 16#00#, 16#ee#, 16#6e#, 16#80#, 16#f1#, 16#07#, 16#31#, 16#00#, 16#15#, 16#d4#, 16#34#, 16#00#, 16#15#, 16#d4#, 16#81#, 16#00#, 16#83#, 16#0e#, 16#3f#, 16#00#, 16#15#, 16#56#, 16#83#, 16#90#, 16#83#, 16#b5#, 16#4f#, 16#00#, 16#15#, 16#8c#, 16#33#, 16#00#, 16#15#, 16#74#, 16#87#, 16#e3#, 16#83#, 16#80#, 16#83#, 16#a5#, 16#4f#, 16#00#, 16#15#, 16#bc#, 16#33#, 16#00#, 16#15#, 16#a4#, 16#87#, 16#e3#, 16#15#, 16#d4#, 16#83#, 16#80#, 16#83#, 16#a5#, 16#4f#, 16#00#, 16#15#, 16#bc#, 16#33#, 16#00#, 16#15#, 16#a4#, 16#87#, 16#e3#, 16#83#, 16#90#, 16#83#, 16#b5#, 16#4f#, 16#00#, 16#15#, 16#8c#, 16#33#, 16#00#, 16#15#, 16#74#, 16#87#, 16#e3#, 16#15#, 16#d4#, 16#63#, 16#40#, 16#81#, 16#32#, 16#41#, 16#00#, 16#15#, 16#d4#, 16#da#, 16#b4#, 16#7b#, 16#02#, 16#da#, 16#b4#, 16#6e#, 16#f3#, 16#87#, 16#e2#, 16#62#, 16#0c#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#63#, 16#10#, 16#81#, 16#32#, 16#41#, 16#00#, 16#15#, 16#d4#, 16#da#, 16#b4#, 16#7b#, 16#fe#, 16#da#, 16#b4#, 16#6e#, 16#f3#, 16#87#, 16#e2#, 16#62#, 16#00#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#63#, 16#20#, 16#81#, 16#32#, 16#41#, 16#00#, 16#15#, 16#d4#, 16#da#, 16#b4#, 16#7a#, 16#02#, 16#da#, 16#b4#, 16#6e#, 16#f3#, 16#87#, 16#e2#, 16#62#, 16#08#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#63#, 16#80#, 16#81#, 16#32#, 16#41#, 16#00#, 16#15#, 16#d4#, 16#da#, 16#b4#, 16#7a#, 16#fe#, 16#da#, 16#b4#, 16#6e#, 16#f3#, 16#87#, 16#e2#, 16#62#, 16#04#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#c1#, 16#f0#, 16#80#, 16#12#, 16#30#, 16#00#, 16#15#, 16#e4#, 16#6e#, 16#0c#, 16#87#, 16#e3#, 16#82#, 16#e3#, 16#15#, 16#0e#, 16#da#, 16#b4#, 16#80#, 16#0e#, 16#4f#, 16#00#, 16#15#, 16#f2#, 16#62#, 16#04#, 16#7a#, 16#fe#, 16#16#, 16#14#, 16#80#, 16#0e#, 16#4f#, 16#00#, 16#15#, 16#fe#, 16#62#, 16#0c#, 16#7b#, 16#02#, 16#16#, 16#14#, 16#80#, 16#0e#, 16#4f#, 16#00#, 16#16#, 16#0a#, 16#62#, 16#08#, 16#7a#, 16#02#, 16#16#, 16#14#, 16#80#, 16#0e#, 16#4f#, 16#00#, 16#15#, 16#dc#, 16#62#, 16#00#, 16#7b#, 16#fe#, 16#da#, 16#b4#, 16#6e#, 16#f3#, 16#87#, 16#e2#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#82#, 16#70#, 16#83#, 16#70#, 16#6e#, 16#30#, 16#82#, 16#e2#, 16#80#, 16#c0#, 16#81#, 16#d0#, 16#27#, 16#ba#, 16#a8#, 16#ed#, 16#6e#, 16#f0#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#16#, 16#4c#, 16#dc#, 16#d4#, 16#42#, 16#30#, 16#7d#, 16#02#, 16#42#, 16#00#, 16#7d#, 16#fe#, 16#42#, 16#20#, 16#7c#, 16#02#, 16#42#, 16#10#, 16#7c#, 16#fe#, 16#dc#, 16#d4#, 16#00#, 16#ee#, 16#6e#, 16#80#, 16#f1#, 16#07#, 16#31#, 16#00#, 16#17#, 16#04#, 16#34#, 16#00#, 16#17#, 16#04#, 16#81#, 16#00#, 16#83#, 16#0e#, 16#4f#, 16#00#, 16#16#, 16#7e#, 16#83#, 16#90#, 16#83#, 16#d5#, 16#4f#, 16#00#, 16#16#, 16#b6#, 16#33#, 16#00#, 16#16#, 16#9c#, 16#87#, 16#e3#, 16#83#, 16#80#, 16#83#, 16#c5#, 16#4f#, 16#00#, 16#16#, 16#ea#, 16#33#, 16#00#, 16#16#, 16#d0#, 16#87#, 16#e3#, 16#17#, 16#04#, 16#83#, 16#80#, 16#83#, 16#c5#, 16#4f#, 16#00#, 16#16#, 16#ea#, 16#33#, 16#00#, 16#16#, 16#d0#, 16#87#, 16#e3#, 16#83#, 16#90#, 16#83#, 16#d5#, 16#4f#, 16#00#, 16#16#, 16#b6#, 16#33#, 16#00#, 16#16#, 16#9c#, 16#87#, 16#e3#, 16#17#, 16#04#, 16#63#, 16#40#, 16#81#, 16#32#, 16#41#, 16#00#, 16#17#, 16#04#, 16#dc#, 16#d4#, 16#7d#, 16#02#, 16#dc#, 16#d4#, 16#87#, 16#e3#, 16#6e#, 16#cf#, 16#87#, 16#e2#, 16#62#, 16#30#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#63#, 16#10#, 16#81#, 16#32#, 16#41#, 16#00#, 16#17#, 16#04#, 16#dc#, 16#d4#, 16#7d#, 16#fe#, 16#dc#, 16#d4#, 16#87#, 16#e3#, 16#6e#, 16#cf#, 16#87#, 16#e2#, 16#62#, 16#00#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#63#, 16#20#, 16#81#, 16#32#, 16#41#, 16#00#, 16#17#, 16#04#, 16#dc#, 16#d4#, 16#7c#, 16#02#, 16#dc#, 16#d4#, 16#87#, 16#e3#, 16#6e#, 16#cf#, 16#87#, 16#e2#, 16#62#, 16#20#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#63#, 16#80#, 16#81#, 16#32#, 16#41#, 16#00#, 16#17#, 16#04#, 16#dc#, 16#d4#, 16#7c#, 16#fe#, 16#dc#, 16#d4#, 16#87#, 16#e3#, 16#6e#, 16#cf#, 16#87#, 16#e2#, 16#62#, 16#10#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#c1#, 16#f0#, 16#80#, 16#12#, 16#30#, 16#00#, 16#17#, 16#16#, 16#87#, 16#e3#, 16#6e#, 16#30#, 16#87#, 16#e3#, 16#82#, 16#e3#, 16#16#, 16#36#, 16#dc#, 16#d4#, 16#80#, 16#0e#, 16#4f#, 16#00#, 16#17#, 16#24#, 16#62#, 16#90#, 16#7c#, 16#fe#, 16#17#, 16#46#, 16#80#, 16#0e#, 16#4f#, 16#00#, 16#17#, 16#30#, 16#62#, 16#30#, 16#7d#, 16#02#, 16#17#, 16#46#, 16#80#, 16#0e#, 16#4f#, 16#00#, 16#17#, 16#3c#, 16#62#, 16#a0#, 16#7c#, 16#02#, 16#17#, 16#46#, 16#80#, 16#0e#, 16#4f#, 16#00#, 16#17#, 16#0c#, 16#62#, 16#00#, 16#7d#, 16#fe#, 16#dc#, 16#d4#, 16#6e#, 16#4f#, 16#87#, 16#e2#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#80#, 16#70#, 16#6e#, 16#03#, 16#80#, 16#e2#, 16#80#, 16#0e#, 16#81#, 16#80#, 16#81#, 16#94#, 16#6e#, 16#02#, 16#81#, 16#e2#, 16#41#, 16#00#, 16#70#, 16#01#, 16#80#, 16#0e#, 16#80#, 16#0e#, 16#a8#, 16#cd#, 16#f0#, 16#1e#, 16#d8#, 16#94#, 16#8e#, 16#f0#, 16#00#, 16#ee#, 16#6e#, 16#00#, 16#a9#, 16#19#, 16#fe#, 16#1e#, 16#fe#, 16#1e#, 16#fe#, 16#1e#, 16#fe#, 16#1e#, 16#f3#, 16#65#, 16#ab#, 16#34#, 16#fe#, 16#1e#, 16#fe#, 16#1e#, 16#fe#, 16#1e#, 16#fe#, 16#1e#, 16#f3#, 16#55#, 16#7e#, 16#01#, 16#3e#, 16#80#, 16#17#, 16#74#, 16#00#, 16#ee#, 16#82#, 16#23#, 16#83#, 16#33#, 16#6e#, 16#0f#, 16#80#, 16#20#, 16#81#, 16#30#, 16#27#, 16#be#, 16#80#, 16#e2#, 16#80#, 16#0e#, 16#a8#, 16#f9#, 16#f0#, 16#1e#, 16#d2#, 16#32#, 16#72#, 16#02#, 16#32#, 16#40#, 16#17#, 16#9a#, 16#82#, 16#23#, 16#73#, 16#02#, 16#43#, 16#20#, 16#00#, 16#ee#, 16#17#, 16#9a#, 16#70#, 16#02#, 16#71#, 16#02#, 16#80#, 16#06#, 16#81#, 16#06#, 16#81#, 16#0e#, 16#81#, 16#0e#, 16#81#, 16#0e#, 16#81#, 16#0e#, 16#ab#, 16#34#, 16#f1#, 16#1e#, 16#f1#, 16#1e#, 16#f0#, 16#1e#, 16#f0#, 16#65#, 16#00#, 16#ee#, 16#a8#, 16#cc#, 16#f0#, 16#65#, 16#80#, 16#06#, 16#f0#, 16#55#, 16#60#, 16#01#, 16#e0#, 16#a1#, 16#17#, 16#e0#, 16#00#, 16#ee#, 16#f1#, 16#65#, 16#6e#, 16#01#, 16#84#, 16#43#, 16#82#, 16#00#, 16#83#, 16#10#, 16#65#, 16#10#, 16#83#, 16#55#, 16#4f#, 16#00#, 16#82#, 16#e5#, 16#4f#, 16#00#, 16#18#, 16#0c#, 16#65#, 16#27#, 16#82#, 16#55#, 16#4f#, 16#00#, 16#18#, 16#0c#, 16#80#, 16#20#, 16#81#, 16#30#, 16#84#, 16#e4#, 16#17#, 16#f0#, 16#f4#, 16#29#, 16#d6#, 16#75#, 16#76#, 16#06#, 16#84#, 16#43#, 16#82#, 16#00#, 16#83#, 16#10#, 16#65#, 16#e8#, 16#83#, 16#55#, 16#4f#, 16#00#, 16#82#, 16#e5#, 16#4f#, 16#00#, 16#18#, 16#34#, 16#65#, 16#03#, 16#82#, 16#55#, 16#4f#, 16#00#, 16#18#, 16#34#, 16#80#, 16#20#, 16#81#, 16#30#, 16#84#, 16#e4#, 16#18#, 16#18#, 16#f4#, 16#29#, 16#d6#, 16#75#, 16#76#, 16#06#, 16#84#, 16#43#, 16#82#, 16#00#, 16#83#, 16#10#, 16#65#, 16#64#, 16#83#, 16#55#, 16#4f#, 16#00#, 16#82#, 16#e5#, 16#4f#, 16#00#, 16#18#, 16#54#, 16#80#, 16#20#, 16#81#, 16#30#, 16#84#, 16#e4#, 16#18#, 16#40#, 16#f4#, 16#29#, 16#d6#, 16#75#, 16#76#, 16#06#, 16#84#, 16#43#, 16#82#, 16#00#, 16#83#, 16#10#, 16#65#, 16#0a#, 16#83#, 16#55#, 16#4f#, 16#00#, 16#18#, 16#6e#, 16#81#, 16#30#, 16#84#, 16#e4#, 16#18#, 16#60#, 16#f4#, 16#29#, 16#d6#, 16#75#, 16#76#, 16#06#, 16#f1#, 16#29#, 16#d6#, 16#75#, 16#00#, 16#ee#, 16#a8#, 16#c8#, 16#f1#, 16#65#, 16#81#, 16#e4#, 16#3f#, 16#00#, 16#70#, 16#01#, 16#a8#, 16#c8#, 16#f1#, 16#55#, 16#00#, 16#ee#, 16#a8#, 16#c8#, 16#f3#, 16#65#, 16#8e#, 16#00#, 16#8e#, 16#25#, 16#4f#, 16#00#, 16#00#, 16#ee#, 16#3e#, 16#00#, 16#18#, 16#a2#, 16#8e#, 16#10#, 16#8e#, 16#35#, 16#4f#, 16#00#, 16#00#, 16#ee#, 16#a8#, 16#ca#, 16#f1#, 16#55#, 16#00#, 16#ee#, 16#8e#, 16#e3#, 16#62#, 16#0f#, 16#63#, 16#ff#, 16#61#, 16#10#, 16#e2#, 16#a1#, 16#18#, 16#c4#, 16#81#, 16#34#, 16#31#, 16#00#, 16#18#, 16#b0#, 16#61#, 16#10#, 16#80#, 16#34#, 16#30#, 16#00#, 16#18#, 16#b0#, 16#00#, 16#ee#, 16#6e#, 16#01#, 16#00#, 16#ee#, 16#00#, 16#00#, 16#00#, 16#00#, 16#05#, 16#00#, 16#50#, 16#70#, 16#20#, 16#00#, 16#50#, 16#70#, 16#20#, 16#00#, 16#60#, 16#30#, 16#60#, 16#00#, 16#60#, 16#30#, 16#60#, 16#00#, 16#30#, 16#60#, 16#30#, 16#00#, 16#30#, 16#60#, 16#30#, 16#00#, 16#20#, 16#70#, 16#50#, 16#00#, 16#20#, 16#70#, 16#50#, 16#00#, 16#20#, 16#70#, 16#70#, 16#00#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#c0#, 16#00#, 16#00#, 16#00#, 16#80#, 16#80#, 16#00#, 16#00#, 16#c0#, 16#80#, 16#80#, 16#80#, 16#c0#, 16#00#, 16#80#, 16#00#, 16#0c#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#0c#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#0a#, 16#65#, 16#05#, 16#05#, 16#05#, 16#05#, 16#e5#, 16#05#, 16#05#, 16#e5#, 16#05#, 16#05#, 16#05#, 16#05#, 16#c5#, 16#0a#, 16#0a#, 16#65#, 16#05#, 16#05#, 16#05#, 16#05#, 16#e5#, 16#05#, 16#05#, 16#e5#, 16#05#, 16#05#, 16#05#, 16#05#, 16#c5#, 16#0a#, 16#0a#, 16#05#, 16#0c#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#0c#, 16#0d#, 16#05#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#05#, 16#0e#, 16#0f#, 16#05#, 16#0c#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#0c#, 16#0d#, 16#05#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#05#, 16#0a#, 16#0a#, 16#05#, 16#0a#, 16#65#, 16#06#, 16#05#, 16#95#, 16#0a#, 16#0a#, 16#35#, 16#05#, 16#05#, 16#c5#, 16#0a#, 16#35#, 16#05#, 16#05#, 16#95#, 16#0a#, 16#65#, 16#05#, 16#05#, 16#95#, 16#0a#, 16#0a#, 16#35#, 16#05#, 16#06#, 16#c5#, 16#0a#, 16#05#, 16#0a#, 16#0a#, 16#05#, 16#0f#, 16#05#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0c#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#08#, 16#0c#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#0f#, 16#05#, 16#0a#, 16#0a#, 16#75#, 16#05#, 16#b5#, 16#05#, 16#05#, 16#05#, 16#05#, 16#c5#, 16#0a#, 16#65#, 16#05#, 16#b5#, 16#05#, 16#e5#, 16#05#, 16#05#, 16#e5#, 16#05#, 16#b5#, 16#05#, 16#c5#, 16#0a#, 16#65#, 16#05#, 16#05#, 16#05#, 16#05#, 16#b5#, 16#05#, 16#d5#, 16#0a#, 16#0a#, 16#05#, 16#0c#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#05#, 16#0f#, 16#05#, 16#0c#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#08#, 16#0d#, 16#05#, 16#0f#, 16#05#, 16#0c#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#05#, 16#0a#, 16#0f#, 16#05#, 16#0f#, 16#65#, 16#05#, 16#05#, 16#c5#, 16#0a#, 16#35#, 16#e5#, 16#95#, 16#0a#, 16#65#, 16#05#, 16#b0#, 16#05#, 16#05#, 16#b5#, 16#05#, 16#c5#, 16#0a#, 16#35#, 16#e5#, 16#95#, 16#0a#, 16#65#, 16#05#, 16#05#, 16#c5#, 16#0f#, 16#05#, 16#0f#, 16#07#, 16#74#, 16#05#, 16#d5#, 16#08#, 16#0f#, 16#05#, 16#0e#, 16#0f#, 16#05#, 16#08#, 16#0f#, 16#05#, 16#0c#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#05#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#0f#, 16#75#, 16#05#, 16#d4#, 16#07#, 16#0a#, 16#05#, 16#0a#, 16#35#, 16#05#, 16#05#, 16#f5#, 16#05#, 16#05#, 16#b5#, 16#05#, 16#05#, 16#d5#, 16#08#, 16#08#, 16#0d#, 16#0c#, 16#08#, 16#0f#, 16#75#, 16#05#, 16#05#, 16#b5#, 16#05#, 16#05#, 16#f5#, 16#05#, 16#05#, 16#95#, 16#0a#, 16#05#, 16#0a#, 16#0a#, 16#05#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#05#, 16#0c#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#35#, 16#05#, 16#c5#, 16#0a#, 16#0a#, 16#65#, 16#05#, 16#95#, 16#0c#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#05#, 16#0c#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#0a#, 16#0a#, 16#75#, 16#05#, 16#06#, 16#c5#, 16#0a#, 16#05#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#0a#, 16#65#, 16#06#, 16#05#, 16#d5#, 16#0a#, 16#0a#, 16#05#, 16#0c#, 16#0d#, 16#05#, 16#0a#, 16#35#, 16#05#, 16#05#, 16#05#, 16#05#, 16#e5#, 16#05#, 16#05#, 16#f5#, 16#05#, 16#05#, 16#f5#, 16#05#, 16#05#, 16#e5#, 16#05#, 16#05#, 16#05#, 16#05#, 16#95#, 16#0a#, 16#05#, 16#0c#, 16#0d#, 16#05#, 16#0a#, 16#0a#, 16#05#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#0c#, 16#0d#, 16#05#, 16#08#, 16#0f#, 16#05#, 16#0c#, 16#0d#, 16#05#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#0f#, 16#05#, 16#0a#, 16#0a#, 16#35#, 16#05#, 16#05#, 16#b5#, 16#05#, 16#05#, 16#05#, 16#05#, 16#05#, 16#05#, 16#95#, 16#0a#, 16#0a#, 16#35#, 16#05#, 16#05#, 16#95#, 16#0a#, 16#0a#, 16#35#, 16#05#, 16#05#, 16#05#, 16#05#, 16#05#, 16#05#, 16#b5#, 16#05#, 16#05#, 16#95#, 16#0a#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#3c#, 16#42#, 16#99#, 16#99#, 16#42#, 16#3c#, 16#01#, 16#10#, 16#0f#, 16#78#, 16#84#, 16#32#, 16#32#, 16#84#, 16#78#, 16#00#, 16#10#, 16#e0#, 16#78#, 16#fc#, 16#fe#, 16#fe#, 16#84#, 16#78#, 16#00#, 16#10#, 16#e0#, others => 0);
end Roms; |
stcarrez/dynamo | Ada | 2,242 | ads | -----------------------------------------------------------------------
-- gen-artifacts-distribs-concat -- Concatenate based distribution artifact
-- 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.
-----------------------------------------------------------------------
-- The <b>Gen.Artifacts.Distribs.Concat</b> package provides distribution rules
-- to concatenate a list of files to the distribution area. The rule is
-- created by using the following XML definition:
--
-- <install mode='copy' file='NOTICE.txt'>
-- <include name="NOTICE.txt"/>
-- </install>
--
private package Gen.Artifacts.Distribs.Concat is
-- Create a distribution rule to concatenate a set of files.
function Create_Rule (Node : in DOM.Core.Node) return Distrib_Rule_Access;
-- ------------------------------
-- Distribution artifact
-- ------------------------------
type Concat_Rule is new Distrib_Rule with private;
type Concat_Rule_Access is access all Concat_Rule'Class;
-- Get a name to qualify the installation rule (used for logs).
overriding
function Get_Install_Name (Rule : in Concat_Rule) return String;
-- Install the file <b>File</b> according to the distribution rule.
-- Concatenate the files listed in <b>Files</b> in the target path specified by <b>Path</b>.
overriding
procedure Install (Rule : in Concat_Rule;
Path : in String;
Files : in File_Vector;
Context : in out Generator'Class);
private
type Concat_Rule is new Distrib_Rule with null record;
end Gen.Artifacts.Distribs.Concat;
|
stcarrez/dynamo | Ada | 136,336 | adb | ------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . E X P R _ S E M --
-- --
-- B o d y --
-- --
-- Copyright (C) 1995-2012, 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.Wide_Characters.Unicode;
with Asis.Clauses; use Asis.Clauses;
with Asis.Compilation_Units; use Asis.Compilation_Units;
with Asis.Declarations; use Asis.Declarations;
with Asis.Elements; use Asis.Elements;
with Asis.Expressions; use Asis.Expressions;
with Asis.Extensions; use Asis.Extensions;
with Asis.Iterator; use Asis.Iterator;
with Asis.Statements; use Asis.Statements;
with Asis.Set_Get; use Asis.Set_Get;
with A4G.A_Debug; use A4G.A_Debug;
with A4G.A_Output; use A4G.A_Output;
with A4G.A_Sem; use A4G.A_Sem;
with A4G.A_Stand; use A4G.A_Stand;
with A4G.A_Types; use A4G.A_Types;
with A4G.Asis_Tables; use A4G.Asis_Tables;
with A4G.Contt.UT; use A4G.Contt.UT;
with A4G.Int_Knds; use A4G.Int_Knds;
with A4G.Knd_Conv; use A4G.Knd_Conv;
with A4G.Mapping; use A4G.Mapping;
with Atree; use Atree;
with Einfo; use Einfo;
with Namet; use Namet;
with Nlists; use Nlists;
with Output; use Output;
with Sem_Aux; use Sem_Aux;
with Sinfo; use Sinfo;
with Snames; use Snames;
with Stand; use Stand;
with Types; use Types;
package body A4G.Expr_Sem is
-----------------------
-- Local subprograms --
-----------------------
function Explicit_Type_Declaration (Entity_Node : Node_Id) return Node_Id;
-- Taking the Entity node obtained as a result of some call to Etype
-- function, this function yields the node for corresponding explicit
-- type or subtype declaration. This means that this function traverses all
-- the internal types generated by the compiler.
--
-- In case of an anonymous access type, this function returns the entity
-- node which is created by the compiler for this type (there is no tree
-- type structure for the type declaration in this case), and a caller is
-- responsible for further analysis
--
-- SHOULD WE MOVE THIS FUNCTION IN THE SPEC???
function Explicit_Type_Declaration_Unwound
(Entity_Node : Node_Id;
Reference_Node : Node_Id := Empty)
return Node_Id;
-- Does the same as Explicit_Type_Declaration and unwinds all the
-- subtypings (if any), resulting in a root type declaration.
-- Reference_Node is a node representing a "place" from which this function
-- is called. If the result type is private, but from the "place" of the
-- call the full view is visible, the full view is returned. If
-- Reference_Node is Empty, no private/full view check is made
function Explicit_Type_Declaration_Unwound_Unaccess
(Entity_Node : Node_Id;
Reference_Node : Node_Id := Empty)
return Node_Id;
-- Does the same as Explicit_Type_Declaration_Unwound and in case of access
-- types goes from the access to the designated type. --???
--
-- In case of an anonymous access type returns directly designated type.
function Rewritten_Image (Selector_Name : Node_Id) return Node_Id;
pragma Unreferenced (Rewritten_Image);
-- this is an example of the tricky programming needed because of the
-- tree rewriting. The problem is, that in the original tree structure
-- for a record aggregate a N_Identifier node for a component selector
-- name does not have an Entity field set. So we have to go to the
-- corresponding (that is, to representing the same component selector
-- name) node in the rewritten structure.
--
-- It is an error to use this function for a node which is does not
-- represent a component selector name in the original tree structure
-- for a record aggregate
--
-- This function is not used now, it is replaced by Search_Record_Comp
function Search_Record_Comp (Selector_Name : Node_Id) return Entity_Id;
-- This function looks for the entity node corresponding to a name from a
-- choices list from a record or extension aggregate. The problem here is
-- that an aggregate node is rewritten, and in the original tree structure
-- the nodes corresponding to component names do not have the Entity
-- field set. This function locates the corresponding entity node by
-- detecting the aggregate type and searching the component defining
-- identifier with the same name in the record definition.
-- It might be the case (because of the absence of some semantic
-- information in the tree or because of the ASIS bug) that Selector_Name
-- actually does not represent a name from the aggregate choice list, in
-- this case this function raises Assert_Failure or (if assertions are off)
-- returns the Empty node.
function Get_Statement_Identifier (Def_Id : Node_Id) return Node_Id;
-- For Int_Node which should represent the defining identifier from an
-- implicit declaration of a label (or a statement name?) (otherwise it
-- is an error to use this function), this function returns the "defining"
-- name representing the definition of this statement identifier in the
-- ASIS sense.
function GFP_Declaration (Par_Id : Node_Id) return Node_Id;
-- this is (I hope, temporary) fix for the problem 14: the Entity
-- field is not set for N_Identifier node representing the parameter
-- name in a named generic association, so we need this function to
-- compute the Entity for such an N_Identifier node.
-- ??? what about formal parameters in associations like
-- ??? "*" => Some_Function
--
-- This function is supposed to be called for an actual representing
-- the name of a generic formal parameter in a named formal parameter
-- association (it's an error to call it for any other actual)
function Is_Explicit_Type_Component
(Comp_Def_Name : Node_Id;
Type_Decl : Node_Id)
return Boolean;
-- Expects Comp_Def_Name to be a defining identifier of a record component
-- and Type_Decl to be a type declaration. Checks if Comp_Def_Name denotes
-- a component explicitly declared by this type declaration. (This function
-- is useful for discriminants and components explicitly declared in
-- derived type declarations.
function Is_Type_Discriminant
(Discr_Node : Node_Id;
Type_Node : Node_Id)
return Boolean;
-- Assuming that Discr_Node is N_Defining_Identifier node and Type_Node
-- represents a type declaration, this function checks if Discr_Node is
-- a discriminant of this type (we cannot just use Parent to check this
-- because of tree rewriting for discriminant types.
function Full_View_Visible
(Priv_Type : Node_Id;
Ref : Node_Id)
return Boolean;
-- Assuming that Priv_Type is a node representing a private type
-- declaration, checks, that in place of Ref the full view of the type is
-- visible
function Reset_To_Full_View
(Full_View : Node_Id;
Discr : Node_Id)
return Node_Id;
-- Assuming that Full_View is the full type declaration for some private
-- type and Discr is a defining name of a discriminant of the type
-- (probably, from its private view), this function returns the defining
-- name of this discriminant in the full view
function Is_Part_Of_Defining_Unit_Name (Name_Node : Node_Id) return Boolean;
-- Assuming that Name_Node is of N_Identifier kind, this function checks,
-- if it is a part of a defining program unit name
function Reset_To_Spec (Name_Node : Node_Id) return Node_Id;
-- Assuming that Name_Node is a part of a defining unit name which in turn
-- is a part of a compilation unit body (for such nodes Entity field is not
-- set), this function resets it to the node pointing to the same part of
-- the defining unit name, but in the spec of the corresponding library
-- unit
function Reference_Kind
(Name : Asis.Element)
return Internal_Element_Kinds;
-- If Name is of A_Defining_Name kind then this function returns the kind
-- of An_Expression elements which may be simple-name-form references to
-- the given name (that is, A_Defining_Identifier -> An_Identifier,
-- A_Defining_And_Operator -> An_And_Operator), otherwise returns
-- Not_An_Element. Note, that the result can never be
-- A_Selected_Component, because only references which are simple names
-- are considered.
function Get_Specificed_Component
(Comp : Node_Id;
Rec_Type : Entity_Id)
return Entity_Id;
-- Provided that Comp is the reference to a record component from the
-- component clause being a component of a record representation clause
-- for the record type Rec_Type, this function computes the corresponding
-- component entity
function Get_Entity_From_Long_Name (N : Node_Id) return Entity_Id;
-- Supposing that N denotes some component of a long expanded name
-- and for N and for its prefix the Entity fields are not set, this
-- function computes the corresponding entity node by traversing
-- the "chain" of definitions corresponding to this expanded name
function Get_Rewritten_Discr_Ref (N : Node_Id) return Node_Id;
pragma Unreferenced (Get_Rewritten_Discr_Ref);
-- This function is supposed to be called for a discriminant reference
-- from the discriminant constraint from derived type, in case if the
-- parent type is a task or protected type. In this case
-- N_Subtype_Indication node from the derived type definition is rewritten
-- in a subtype mark pointing to the internal subtype. The original
-- structure is not decorated, so we have to go to the corresponding
-- node in the definition of this internal subtype to get the semantic
-- information. See F407-011
-- Do we need this after fixing the regression caused by K120-031
function Get_Discriminant_From_Type (N : Node_Id) return Entity_Id;
-- Starting from the reference to discriminant in a discriminant
-- constraint, tries to compute the corresponding discriminant entity by
-- getting to the declaration of the corresponding type and traversing
-- its discriminant part.
function Is_Limited_Withed
(E : Entity_Id;
Reference : Asis.Element)
return Boolean;
-- Assuming that Reference is an_Identifier Element and E is the entity
-- node for the entity denoted by Reference, checks if this entity is
-- defined in a compilation unit that is limited withed by the unit
-- containing Reference
function To_Upper_Case (S : Wide_String) return Wide_String;
-- Folds the argument to upper case, may be used for string normalization
-- before comparing strings if the casing is not important for comparing
-- (Copied from ASIS_UL.Misc to avoid dependencies on ASIS UL in "pure"
-- ASIS.
---------------------------------------
-- Character_Literal_Name_Definition --
---------------------------------------
function Character_Literal_Name_Definition
(Reference_Ch : Element)
return Asis.Defining_Name
is
-- for now, the code is very similar to the code
-- for Identifier_Name_Definition. Any aggregation has been
-- put off till everything will work
Arg_Node : Node_Id;
Special_Case : Special_Cases := Not_A_Special_Case;
Result_Element : Asis.Defining_Name := Nil_Element;
Is_Inherited : Boolean := False;
Association_Type : Node_Id := Empty;
Set_Char_Code : Boolean := False;
Result_Node : Node_Id;
Result_Unit : Compilation_Unit;
Result_Kind : constant Internal_Element_Kinds :=
A_Defining_Character_Literal;
begin
-- We have to distinguish and to treat separately four (???)
-- different situations:
--
-- 1. a literal from user-defined character type (fully implemented
-- for now);
--
-- 2. a literal from a type derived from some user-defined character
-- type (not implemented for now as related to Implicit Elements);
--
-- 3. a literal from a character type defined in Standard (not
-- implemented for now);
--
-- 4. a literal from a type derived a character type defined in
-- Standard (not implemented for now as related to Implicit
-- Elements);
Arg_Node := Node (Reference_Ch);
-- if Reference_Ch is a Selector_Name in some N_Expanded_Name,
-- the corresponding Entity field is set not for the Node on which
-- this Reference_En is based, but for the whole expanded name.
-- (The same for Etype) So:
if Nkind (Parent (Arg_Node)) = N_Expanded_Name or else
Nkind (Parent (Arg_Node)) = N_Character_Literal
then
-- the last alternative of the condition corresponds to an expanded
-- name of a predefined character literal or to an expanded name
-- of a literal of a type derived from a predefined character type -
-- such an expanded name is rewritten into (another) "instance"
-- of the same literal
Arg_Node := Parent (Arg_Node);
end if;
Result_Node := Entity (Arg_Node);
-- will be Empty for any character literal belonging to
-- Standard.Character, Standard.Whide_Character or any type
-- derived (directly or indirectly) from any of these types
Association_Type := Etype (Arg_Node);
if No (Result_Node) and then
No (Association_Type) and then
Is_From_Unknown_Pragma (R_Node (Reference_Ch))
then
return Nil_Element;
end if;
if No (Association_Type) then
-- this may be the case if some character literals are
-- rewritten into a string constant
Association_Type := Arg_Node;
while Present (Association_Type) loop
exit when Nkind (Association_Type) = N_String_Literal;
Association_Type := Parent (Association_Type);
end loop;
pragma Assert (Present (Association_Type));
Association_Type := Etype (Association_Type);
Association_Type := Component_Type (Association_Type);
end if;
Association_Type := Explicit_Type_Declaration_Unwound (Association_Type);
if No (Result_Node) then
Set_Char_Code := True;
Result_Node := Association_Type;
Result_Node := Sinfo.Type_Definition (Result_Node);
if Char_Defined_In_Standard (Arg_Node) then
Special_Case := Stand_Char_Literal;
else
Is_Inherited := True;
end if;
elsif not Comes_From_Source (Result_Node) then
Is_Inherited := True;
end if;
if Char_Defined_In_Standard (Arg_Node) then
Result_Unit := Get_Comp_Unit
(Standard_Id, Encl_Cont_Id (Reference_Ch));
else
Result_Unit := Enclosing_Unit
(Encl_Cont_Id (Reference_Ch), Result_Node);
end if;
Result_Element := Node_To_Element_New
(Node => Result_Node,
Node_Field_1 => Association_Type,
Internal_Kind => Result_Kind,
Spec_Case => Special_Case,
Inherited => Is_Inherited,
In_Unit => Result_Unit);
if Set_Char_Code then
Set_Character_Code (Result_Element, Character_Code (Reference_Ch));
end if;
return Result_Element;
end Character_Literal_Name_Definition;
---------------------------------
-- Collect_Overloaded_Entities --
---------------------------------
procedure Collect_Overloaded_Entities (Reference : Asis.Element) is
Arg_Node : Node_Id;
Arg_Pragma_Chars : Name_Id;
Next_Entity : Entity_Id;
Result_Unit : Asis.Compilation_Unit;
Result_Context : constant Context_Id := Encl_Cont_Id (Reference);
Res_Node : Node_Id;
Res_NF_1 : Node_Id;
Res_Ekind : Entity_Kind;
Res_Inherited : Boolean;
Is_Program_Unit_Pragma : Boolean := False;
Enclosing_Scope_Entity : Entity_Id;
Enclosing_List : List_Id;
function Should_Be_Collected (Ent : Entity_Id) return Boolean;
-- When traversing the chain of homonyms potentially referred by
-- Reference, it checks if Ent should be used to create the next
-- Element in the Result list
function Should_Be_Collected (Ent : Entity_Id) return Boolean is
Result : Boolean := False;
N : Node_Id;
begin
if not (Ekind (Ent) = E_Operator and then
Is_Predefined (Ent))
then
if Is_Program_Unit_Pragma then
Result := Scope (Ent) = Enclosing_Scope_Entity;
else
N := Parent (Ent);
while Present (N) and then
not (Is_List_Member (N))
loop
N := Parent (N);
end loop;
if Present (N) and then Is_List_Member (N) then
Result := List_Containing (N) = Enclosing_List;
end if;
end if;
end if;
return Result;
end Should_Be_Collected;
begin
-- First, we decide what kind of pragma we have, because the search
-- depends on this:
Arg_Node := Node (Reference);
Arg_Pragma_Chars := Pragma_Name (Parent (Parent (Arg_Node)));
if Arg_Pragma_Chars = Name_Inline then
Is_Program_Unit_Pragma := True;
-- ??? is it enough? what about GNAT-specific pragmas?
-- In this case we have to search in the same declarative region
-- (in the same scope):
Enclosing_Scope_Entity := Scope (Entity (Arg_Node));
-- This is no more than a trick: actually, we have to compute
-- the scope node for the declarative region which encloses
-- Arg_Node, but entry bodies makes a serious problem (at the
-- moment of writing this code there is no semantic links between
-- protected entry declarations and bodies). So we just assume
-- that Arg_Node has the Entity field set, and this field
-- points to some correct (from the point of view of
-- Corresponding_Name_Definition_List query) entity, so we
-- just take the Scope of this entity...
else
Enclosing_List := List_Containing (Parent (Parent (Arg_Node)));
end if;
Next_Entity := Entity (Arg_Node);
while Present (Next_Entity) and then
Should_Be_Collected (Next_Entity)
loop
Result_Unit := Enclosing_Unit (Result_Context, Next_Entity);
Res_Ekind := Ekind (Next_Entity);
if Res_Ekind in Subprogram_Kind then
if Comes_From_Source (Next_Entity) then
Res_Node := Next_Entity;
Res_NF_1 := Empty;
Res_Inherited := False;
else
Res_Node := Alias (Next_Entity);
while Present (Alias (Res_Node)) loop
Res_Node := Alias (Res_Node);
end loop;
Res_NF_1 := Next_Entity;
Res_Inherited := True;
end if;
Asis_Element_Table.Append
(Node_To_Element_New (Node => Res_Node,
Node_Field_1 => Res_NF_1,
Inherited => Res_Inherited,
In_Unit => Result_Unit));
end if;
Next_Entity := Homonym (Next_Entity);
end loop;
end Collect_Overloaded_Entities;
---------------------------
-- Correct_Impl_Form_Par --
---------------------------
procedure Correct_Impl_Form_Par
(Result : in out Element;
Reference : Element)
is
Res_Node : Node_Id := Node (Result);
Subprogram_Name : Element;
Subprogram_Node : Node_Id := Node (Result);
Res_Sloc : Source_Ptr;
Top_Node : Node_Id;
Result_Unit : Compilation_Unit;
begin
Res_Node := Defining_Identifier (Parent (Res_Node));
Subprogram_Name := Enclosing_Element (Enclosing_Element (Reference));
case Int_Kind (Subprogram_Name) is
when A_Function_Call =>
Subprogram_Name := Prefix (Subprogram_Name);
when A_Procedure_Call_Statement |
An_Entry_Call_Statement =>
Subprogram_Name := Called_Name (Subprogram_Name);
when others =>
null;
pragma Assert (False);
end case;
Subprogram_Node := Node (Subprogram_Name);
Subprogram_Node := Associated_Node (Subprogram_Node);
Top_Node := Parent (Subprogram_Node);
while Nkind (Top_Node) /= N_Compilation_Unit loop
Top_Node := Parent (Top_Node);
end loop;
Res_Sloc := Sloc (Res_Node) - Sloc (Top_Node);
Result_Unit :=
Enclosing_Unit (Encl_Cont_Id (Reference), Subprogram_Node);
Set_Node (Result, Res_Node);
Set_R_Node (Result, Res_Node);
Set_From_Implicit (Result, True);
Set_From_Inherited (Result, True);
Set_From_Instance (Result, Is_From_Instance (Subprogram_Node));
Set_Node_Field_1 (Result, Subprogram_Node);
Set_Rel_Sloc (Result, Res_Sloc);
Set_Encl_Unit_Id (Result, Get_Unit_Id (Result_Unit));
end Correct_Impl_Form_Par;
--------------------
-- Correct_Result --
--------------------
procedure Correct_Result
(Result : in out Element;
Reference : Element)
is
Enclosing_Generic : Element := Nil_Element;
Tmp : Element;
Tmp_Generic : Element;
Is_From_Body : Boolean := False;
Instance : Element := Nil_Element;
procedure Check_Number_Name
(Element : Asis.Element;
Control : in out Traverse_Control;
State : in out No_State);
-- Check if the argument is the defining name of the named number
-- defining the same named number as Result, but in the template.
-- As soon as the check is successful, replace Result with this
-- defining name and terminates the traversal
Control : Traverse_Control := Continue;
State : No_State := Not_Used;
procedure Traverse_Instance is new Traverse_Element
(State_Information => No_State,
Pre_Operation => Check_Number_Name,
Post_Operation => No_Op);
procedure Check_Number_Name
(Element : Asis.Element;
Control : in out Traverse_Control;
State : in out No_State)
is
pragma Unreferenced (State);
El_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
begin
case El_Kind is
when A_Defining_Identifier =>
if Int_Kind (Enclosing_Element (Element)) in
An_Integer_Number_Declaration .. A_Real_Number_Declaration
and then
Chars (Node (Result)) = Chars (Node (Element))
then
Result := Element;
Control := Terminate_Immediately;
end if;
when An_Integer_Number_Declaration |
A_Real_Number_Declaration |
A_Procedure_Body_Declaration |
A_Function_Body_Declaration |
A_Package_Declaration |
A_Package_Body_Declaration |
A_Task_Body_Declaration |
A_Protected_Body_Declaration |
An_Entry_Body_Declaration |
A_Generic_Package_Declaration |
A_Block_Statement =>
null;
when others =>
Control := Abandon_Children;
end case;
end Check_Number_Name;
begin
-- First, check if Result is declared in a template
Tmp := Enclosing_Element (Result);
while not Is_Nil (Tmp) loop
if Int_Kind (Tmp) in An_Internal_Generic_Declaration
or else
(Int_Kind (Tmp) in A_Procedure_Body_Declaration ..
A_Package_Body_Declaration
and then
Int_Kind (Corresponding_Declaration (Tmp)) in
An_Internal_Generic_Declaration)
then
if Int_Kind (Tmp) in A_Procedure_Body_Declaration ..
A_Package_Body_Declaration
then
Enclosing_Generic := Corresponding_Declaration (Tmp);
Is_From_Body := True;
else
Enclosing_Generic := Tmp;
end if;
exit;
end if;
Tmp := Enclosing_Element (Tmp);
end loop;
if Is_Nil (Enclosing_Generic) then
-- No need to correct anything!
return;
end if;
-- Now, traversing the instantiation chain from the Reference, looking
-- for the instantiation of Enlosing_Generic:
Tmp := Enclosing_Element (Reference);
while not Is_Nil (Tmp) loop
if Int_Kind (Tmp) in An_Internal_Generic_Instantiation then
Tmp_Generic := Generic_Unit_Name (Tmp);
if Int_Kind (Tmp_Generic) = A_Selected_Component then
Tmp_Generic := Selector (Tmp_Generic);
end if;
Tmp_Generic := Corresponding_Name_Declaration (Tmp_Generic);
if Is_Equal (Enclosing_Generic, Tmp_Generic) then
Instance := Tmp;
exit;
end if;
end if;
Tmp := Enclosing_Element (Tmp);
end loop;
if Is_Nil (Instance) then
-- No need to correct anything - we do not have a nested generics!
return;
end if;
-- And now we have to find the "image' of Result in expanded Instance
if Is_From_Body then
Instance := Corresponding_Body (Instance);
else
Instance := Corresponding_Declaration (Instance);
end if;
Traverse_Instance (Instance, Control, State);
end Correct_Result;
-------------------------------
-- Explicit_Type_Declaration --
-------------------------------
function Explicit_Type_Declaration (Entity_Node : Node_Id) return Node_Id is
Next_Node : Node_Id;
Result_Node : Node_Id;
Res_Ekind : Entity_Kind;
function Is_Explicit_Type_Declaration
(Type_Entity_Node : Node_Id)
return Boolean;
-- checks if Type_Entity_Node corresponds to the explicit type
-- declaration which is looked for (that is, the needed type declaration
-- node is Parent (Type_Entity_Node) )
function Is_Explicit_Type_Declaration
(Type_Entity_Node : Node_Id)
return Boolean
is
Type_Decl_Node : constant Node_Id := Parent (Type_Entity_Node);
Type_Decl_Nkind : Node_Kind;
Is_Full_Type_Decl : Boolean := False;
Is_Derived_Type_Decl : Boolean := False;
Is_Formal_Type_Decl : Boolean := False;
begin
if not Is_Itype (Entity_Node)
and then
Present (Type_Decl_Node)
then
Is_Full_Type_Decl :=
Comes_From_Source (Type_Decl_Node) and then
(not Is_Rewrite_Substitution (Type_Decl_Node));
if not Is_Full_Type_Decl and then
Is_Rewrite_Substitution (Type_Decl_Node)
then
-- The second part of the condition is common for all the cases
-- which require special analysis
Type_Decl_Nkind := Nkind (Type_Decl_Node);
Is_Derived_Type_Decl :=
(Type_Decl_Nkind = N_Subtype_Declaration or else
Type_Decl_Nkind = N_Full_Type_Declaration or else
Type_Decl_Nkind = N_Formal_Type_Declaration)
and then
(Nkind (Original_Node (Type_Decl_Node)) =
N_Full_Type_Declaration and then
Nkind (Sinfo.Type_Definition (Original_Node (Type_Decl_Node)))
= N_Derived_Type_Definition);
if not Is_Derived_Type_Decl then
Is_Formal_Type_Decl :=
(Type_Decl_Nkind = N_Private_Extension_Declaration
or else
Type_Decl_Nkind = N_Full_Type_Declaration)
and then
Nkind (Original_Node (Type_Decl_Node)) =
N_Formal_Type_Declaration;
end if;
end if;
end if;
return Is_Full_Type_Decl or else
Is_Derived_Type_Decl or else
Is_Formal_Type_Decl;
end Is_Explicit_Type_Declaration;
begin
-- well, here we have a (sub)type entity node passed as an actual...
-- the aim is to return the _explicit_ type declaration corresponding
-- to this (sub)type entity. It should be such a declaration, if this
-- function is called...
--
-- We try to organize the processing in a recursive way - may be,
-- not the most effective one, but easy-to maintain
if Is_Explicit_Type_Declaration (Entity_Node) then
-- the first part of the condition is the protection from
-- non-accurate settings of Comes_From_Source flag :((
Result_Node := Parent (Entity_Node);
elsif Sloc (Entity_Node) <= Standard_Location then
-- here we have a predefined type declared in Standard.
-- it may be the type entity or the entity for its 'Base
-- type. In the latter case we have to go to the type
-- entity
if Present (Parent (Entity_Node)) then
-- type entity, therefore simply
Result_Node := Parent (Entity_Node);
else
-- 'Base type, so we have to compute the first named
-- type. The code which does it looks tricky, but for now we
-- do not know any better solution:
Result_Node := Parent (Parent (Scalar_Range (Entity_Node)));
end if;
elsif Etype (Entity_Node) = Entity_Node and then
Present (Associated_Node_For_Itype (Entity_Node)) and then
Nkind (Associated_Node_For_Itype (Entity_Node)) =
N_Object_Declaration
then
-- this corresponds to an anonymous array subtype created by an
-- object declaration with array_type_definition
Result_Node := Empty;
else
-- Entity_Node corresponds to some internal or implicit type created
-- by the compiler. Here we have to traverse the tree till the
-- explicit type declaration being the cause for generating this
-- implicit type will be found
Res_Ekind := Ekind (Entity_Node);
if Res_Ekind = E_Anonymous_Access_Type then
-- There is no type declaration node in this case at all,
-- so we just return this N_Defining_Identifier node for
-- further analysis in the calling context:
return Entity_Node;
-- ??? Why do not we return Empty in this case???
elsif Res_Ekind = E_Anonymous_Access_Subprogram_Type then
-- No explicit type declaration, so
return Empty;
elsif Res_Ekind = E_String_Literal_Subtype
or else
(Res_Ekind = E_Array_Subtype
and then
Present (Parent (Entity_Node)))
then
-- The first part of the condition corresponds to a special case
-- E_String_Literal_Subtype is created for, see Einfo (spec) for
-- the details. The second part corresponds to the access to
-- string type, see E626-002
Result_Node := Parent (Etype (Entity_Node));
if No (Result_Node) then
Result_Node := Associated_Node_For_Itype (Etype (Entity_Node));
end if;
elsif Ekind (Entity_Node) = E_Enumeration_Type then
if Present (Associated_Node_For_Itype (Entity_Node)) then
Result_Node := Associated_Node_For_Itype (Entity_Node);
else
-- Entity_Node represents an implicit type created for
-- a derived enumeration type. we have to go down to this
-- derived type
Result_Node := Parent (Entity_Node);
while Present (Result_Node) loop
Result_Node := Next (Result_Node);
exit when Nkind (Result_Node) = N_Subtype_Declaration
and then
Is_Rewrite_Substitution (Result_Node);
end loop;
end if;
pragma Assert (Present (Result_Node));
elsif (No (Parent (Entity_Node)) or else
not Comes_From_Source (Parent (Entity_Node)))
and then
Etype (Entity_Node) /= Entity_Node
and then
not (Ekind (Entity_Node) = E_Floating_Point_Type or else
Ekind (Entity_Node) = E_Signed_Integer_Type or else
Ekind (Entity_Node) = E_Array_Type or else
Ekind (Entity_Node) = E_Private_Type or else
Ekind (Entity_Node) = E_Limited_Private_Type)
then
if Is_Itype (Entity_Node)
and then
Nkind (Associated_Node_For_Itype (Entity_Node)) =
N_Subtype_Declaration
then
Next_Node :=
Defining_Identifier (Associated_Node_For_Itype (Entity_Node));
if Next_Node = Entity_Node then
Next_Node := Etype (Entity_Node);
end if;
else
-- subtypes created for objects when an explicit constraint
-- presents in the object declaration ???
Next_Node := Etype (Entity_Node);
end if;
Result_Node := Explicit_Type_Declaration (Next_Node);
else
Next_Node := Associated_Node_For_Itype (Entity_Node);
pragma Assert (Present (Next_Node));
if Nkind (Original_Node (Next_Node)) = N_Full_Type_Declaration
or else
Nkind (Original_Node (Next_Node)) = N_Formal_Type_Declaration
then
Result_Node := Next_Node;
elsif Nkind (Next_Node) = N_Loop_Parameter_Specification then
-- here we have to traverse the loop parameter specification,
-- because otherwise we may get the base type instead of
-- the actually needed named subtype.
Result_Node := Next_Node;
Result_Node := Sinfo.Discrete_Subtype_Definition (Result_Node);
case Nkind (Result_Node) is
when N_Subtype_Indication =>
Result_Node := Sinfo.Subtype_Mark (Result_Node);
Result_Node := Parent (Entity (Result_Node));
when N_Identifier | N_Expanded_Name =>
Result_Node := Parent (Entity (Result_Node));
when N_Range =>
-- and here we have to use the Etype field of
-- the implicit type itself, because we do not have
-- any type mark to start from in the loop parameter
-- specification:
Result_Node := Explicit_Type_Declaration
(Etype (Entity_Node));
when others =>
null;
pragma Assert (False);
-- this is definitely wrong! Should be corrected
-- during debugging!!!
end case;
else
if Etype (Entity_Node) /= Entity_Node then
-- otherwise we will be in dead circle
Result_Node := Etype (Entity_Node);
Result_Node := Explicit_Type_Declaration (Result_Node);
else
-- for now, the only guess is that we have an object
-- defined by an object declaration with constrained
-- array definition, or an initialization expression
-- from such a declaration
pragma Assert (
Nkind (Next_Node) = N_Object_Declaration and then
Nkind (Object_Definition (Next_Node)) =
N_Constrained_Array_Definition);
return Empty;
-- what else could we return here?
end if;
end if;
end if;
end if;
return Result_Node;
end Explicit_Type_Declaration;
---------------------------------------
-- Explicit_Type_Declaration_Unwound --
---------------------------------------
function Explicit_Type_Declaration_Unwound
(Entity_Node : Node_Id;
Reference_Node : Node_Id := Empty)
return Node_Id
is
Result_Node : Node_Id;
Subtype_Mark_Node : Node_Id;
begin
Result_Node := Explicit_Type_Declaration (Entity_Node);
while Nkind (Original_Node (Result_Node)) = N_Subtype_Declaration loop
Subtype_Mark_Node :=
Sinfo.Subtype_Indication (Original_Node (Result_Node));
if Nkind (Subtype_Mark_Node) = N_Subtype_Indication then
Subtype_Mark_Node := Sinfo.Subtype_Mark (Subtype_Mark_Node);
end if;
Result_Node := Explicit_Type_Declaration (Entity (Subtype_Mark_Node));
end loop;
if Present (Reference_Node) and then
(Nkind (Original_Node (Result_Node)) = N_Private_Type_Declaration
or else
Nkind (Original_Node (Result_Node)) =
N_Private_Extension_Declaration)
and then
Full_View_Visible (Result_Node, Reference_Node)
then
Result_Node := Parent (Full_View (Defining_Identifier (Result_Node)));
end if;
return Result_Node;
end Explicit_Type_Declaration_Unwound;
------------------------------------------------
-- Explicit_Type_Declaration_Unwound_Unaccess --
------------------------------------------------
function Explicit_Type_Declaration_Unwound_Unaccess
(Entity_Node : Node_Id;
Reference_Node : Node_Id := Empty)
return Node_Id
is
Result_Node : Node_Id;
Subtype_Mark_Node : Node_Id;
Tmp : Node_Id;
begin
Result_Node := Explicit_Type_Declaration_Unwound (
Entity_Node, Reference_Node);
if Nkind (Result_Node) = N_Defining_Identifier and then
Ekind (Result_Node) = E_Anonymous_Access_Type
then
Result_Node := Explicit_Type_Declaration_Unwound (
Directly_Designated_Type (Result_Node), Reference_Node);
end if;
-- This loop unwinds accessing^
while (Nkind (Original_Node (Result_Node)) = N_Full_Type_Declaration
and then
Nkind (Sinfo.Type_Definition (Original_Node (Result_Node))) =
N_Access_To_Object_Definition)
or else
(Nkind (Original_Node (Result_Node)) = N_Formal_Type_Declaration
and then
Nkind (Sinfo.Formal_Type_Definition (Original_Node (
Result_Node))) = N_Access_To_Object_Definition)
loop
Subtype_Mark_Node := Original_Node (Result_Node);
if Nkind (Subtype_Mark_Node) = N_Full_Type_Declaration then
Subtype_Mark_Node := Sinfo.Subtype_Indication (
Sinfo.Type_Definition (Subtype_Mark_Node));
else
Subtype_Mark_Node := Sinfo.Subtype_Indication (
Sinfo.Formal_Type_Definition (Subtype_Mark_Node));
end if;
if Nkind (Subtype_Mark_Node) = N_Subtype_Indication then
Subtype_Mark_Node := Sinfo.Subtype_Mark (Subtype_Mark_Node);
end if;
Result_Node := Explicit_Type_Declaration_Unwound (
Entity (Subtype_Mark_Node), Reference_Node);
if Nkind (Result_Node) = N_Incomplete_Type_Declaration then
-- To be 100% honest, we have to check that at place of
-- Reference_Node the full view is visible. But we could hardly
-- call this routine (for a legal code) if we do not see the full
-- view from Reference_Node.
Tmp := Full_View (Defining_Identifier (Result_Node));
if Present (Tmp) then
Result_Node := Parent (Tmp);
end if;
end if;
end loop;
-- If we have a type derived from an access type, we have to go through
-- this derivation and unwind accessing
if Nkind (Result_Node) = N_Full_Type_Declaration
and then
Nkind (Sinfo.Type_Definition (Result_Node)) =
N_Derived_Type_Definition
then
Tmp := Defining_Identifier (Result_Node);
if Ekind (Tmp) in Access_Kind then
Result_Node :=
Explicit_Type_Declaration_Unwound_Unaccess
(Directly_Designated_Type (Tmp),
Reference_Node);
end if;
end if;
return Result_Node;
end Explicit_Type_Declaration_Unwound_Unaccess;
---------------
-- Expr_Type --
---------------
function Expr_Type (Expression : Asis.Expression) return Asis.Declaration is
Arg_Node : Node_Id;
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Expression);
Result_Entity : Node_Id;
Result_Node : Node_Id;
Result_Unit : Compilation_Unit;
Res_Spec_Case : Special_Cases := Not_A_Special_Case;
Encl_Cont : constant Context_Id := Encl_Cont_Id (Expression);
begin
-- first, we should check whether Expression has a universal
-- numeric type and return the corresponding ASIS universal type.
-- For now, this check includes numeric literals and some of the
-- attribute references is:
if Arg_Kind = An_Integer_Literal or else
Arg_Kind = An_Alignment_Attribute or else
Arg_Kind = A_Component_Size_Attribute or else
Arg_Kind = A_Digits_Attribute or else
Arg_Kind = A_Count_Attribute or else
Arg_Kind = An_Exponent_Attribute or else
Arg_Kind = A_First_Bit_Attribute or else
Arg_Kind = A_Fore_Attribute or else
Arg_Kind = A_Last_Bit_Attribute or else
Arg_Kind = A_Length_Attribute or else
Arg_Kind = A_Machine_Emax_Attribute or else
Arg_Kind = A_Machine_Emin_Attribute or else
Arg_Kind = A_Machine_Mantissa_Attribute or else
Arg_Kind = A_Machine_Radix_Attribute or else
Arg_Kind = A_Max_Size_In_Storage_Elements_Attribute or else
Arg_Kind = A_Model_Emin_Attribute or else
Arg_Kind = A_Model_Mantissa_Attribute or else
Arg_Kind = A_Modulus_Attribute or else
Arg_Kind = A_Partition_ID_Attribute or else
Arg_Kind = A_Pos_Attribute or else
Arg_Kind = A_Position_Attribute or else
Arg_Kind = A_Scale_Attribute or else
Arg_Kind = A_Size_Attribute or else
Arg_Kind = A_Storage_Size_Attribute or else
Arg_Kind = A_Wide_Width_Attribute or else
Arg_Kind = A_Width_Attribute or else
(Special_Case (Expression) = Rewritten_Named_Number
and then Nkind (R_Node (Expression)) = N_Integer_Literal)
then
return Set_Root_Type_Declaration
(A_Universal_Integer_Definition,
Encl_Cont);
elsif Arg_Kind = A_Real_Literal or else
Arg_Kind = A_Delta_Attribute or else
Arg_Kind = A_Model_Epsilon_Attribute or else
Arg_Kind = A_Model_Small_Attribute or else
Arg_Kind = A_Safe_First_Attribute or else
Arg_Kind = A_Safe_Last_Attribute or else
Arg_Kind = A_Small_Attribute or else
(Special_Case (Expression) = Rewritten_Named_Number
and then Nkind (R_Node (Expression)) = N_Real_Literal)
then
return Set_Root_Type_Declaration
(A_Universal_Real_Definition,
Encl_Cont);
end if;
Arg_Node := Node (Expression);
-- In some cases we have to use the rewritten node
if Is_Rewrite_Substitution (R_Node (Expression)) and then
(Nkind (Arg_Node) = N_Aggregate and then
Nkind (R_Node (Expression)) = N_String_Literal)
then
Arg_Node := R_Node (Expression);
end if;
while Nkind (Arg_Node) = N_String_Literal
and then
Nkind (Parent (Arg_Node)) = N_String_Literal
loop
-- Trick for F109-A24: for string literals in a static expression,
-- Etype points to some dummy subtype node (the tree structure is
-- rewritten for the whole expression, and the original subtree is
-- not fully decorated), so we take the type information from the
-- rewritten result of the expression
Arg_Node := Parent (Arg_Node);
end loop;
-- if the expression node is rewritten, all the semantic
-- information can be found only through the rewritten node
if Nkind (Parent (Arg_Node)) = N_Expanded_Name and then
Arg_Node = Selector_Name (Parent (Arg_Node))
then
-- selector in an expanded name - all the semantic fields
-- are set for the whole name, but not for this selector.
-- So:
Arg_Node := Parent (Arg_Node);
end if;
-- ??? <tree problem 1>
-- this fragment should be revised when the problem is fixed (as it should)
if Nkind (Arg_Node) = N_Selected_Component then
if Etype (Arg_Node) = Any_Type then
-- for now (GNAT 3.05) this means, that Expression is an expanded
-- name of the character literal of ether a predefined character
-- type or of the type derived from a predefined character type
Arg_Node := R_Node (Expression);
-- resetting Arg_Node pointing to the rewritten node for the
-- expanded name
--
-- ???
-- This looks strange... Should be revised
else
Arg_Node := Selector_Name (Arg_Node);
-- here the actual type is!
end if;
elsif Nkind (Arg_Node) = N_Character_Literal and then
No (Etype (Arg_Node))
-- for now (GNAT 3.05) this means, that Expression is the
-- selector in an expanded name of the character literal of
-- ether a predefined character type or of the type derived
-- from a predefined character type
then
Arg_Node := Parent (Arg_Node);
-- resetting Arg_Node pointing to the rewritten node for the whole
-- expanded name
end if;
-- ??? <tree problem 1> - end
-- now the idea is to take the Etype attribute of the expression
-- and to go to the corresponding type declaration. But
-- special processing for computing the right Etype is
-- required for some cases
if Nkind (Parent (Arg_Node)) = N_Qualified_Expression and then
Arg_Node = Sinfo.Expression (Parent (Arg_Node))
then
Result_Entity := Etype (Sinfo.Subtype_Mark (Parent (Arg_Node)));
-- we'll keep the commented code below for a while...
-- elsif (Arg_Kind = A_First_Attribute or else
-- Arg_Kind = A_Last_Attribute)
-- and then not Comes_From_Source (Etype (Arg_Node))
-- and then Sloc (Etype (Arg_Node)) > Standard_Location
-- and then Etype (Etype (Arg_Node)) = Etype (Arg_Node)
-- then
-- -- this tricky condition corresponds to the situation, when
-- -- 'First or 'Last attribute is applied to a formal discrete
-- -- type @:-(
-- -- In this case we simply use the attribute prefix to define
-- -- the result type
-- Result_Entity := Etype (Prefix (Arg_Node));
else
-- how nice it would be if *everything* would be so simple
Result_Entity := Etype (Arg_Node);
end if;
if Result_Entity = Any_Composite then
-- Here we have an aggregate in some original tree structure that has
-- not been properly decorated. All the semantic decorations are in
-- the corresponding rewritten structure, so we have to find the
-- corresponding node there.
declare
Tmp : Node_Id;
New_Arg_Node : Node_Id := Empty;
Arg_Kind : constant Node_Kind := Nkind (Arg_Node);
Arg_Sloc : constant Source_Ptr := Sloc (Arg_Node);
function Find (Node : Node_Id) return Traverse_Result;
-- Check if its argument represents the same construct as
-- Arg_Node, and if it does, stores Node in New_Arg_Node and
-- returns Abandon, otherwise returns OK.
procedure Find_Rewr_Aggr is new Traverse_Proc (Find);
function Find (Node : Node_Id) return Traverse_Result is
begin
if Nkind (Node) = Arg_Kind
and then
Sloc (Node) = Arg_Sloc
then
New_Arg_Node := Node;
return Abandon;
else
return OK;
end if;
end Find;
begin
Tmp := Parent (Arg_Node);
while not Is_Rewrite_Substitution (Tmp) loop
Tmp := Parent (Tmp);
end loop;
Find_Rewr_Aggr (Tmp);
pragma Assert (Present (New_Arg_Node));
Result_Entity := Etype (New_Arg_Node);
end;
end if;
Result_Node := Explicit_Type_Declaration (Result_Entity);
if No (Result_Node) then
return Nil_Element;
-- we cannot represent the type declaration in ASIS;
-- for example, an object defined by an object declaration
-- with constrained array definition
end if;
if Sloc (Result_Entity) <= Standard_Location then
Result_Unit := Get_Comp_Unit
(Standard_Id, Encl_Cont_Id (Expression));
Res_Spec_Case := Explicit_From_Standard;
else
Result_Unit := Enclosing_Unit
(Encl_Cont_Id (Expression), Result_Node);
end if;
return Node_To_Element_New (Node => Result_Node,
Spec_Case => Res_Spec_Case,
In_Unit => Result_Unit);
end Expr_Type;
-----------------------
-- Full_View_Visible --
-----------------------
function Full_View_Visible
(Priv_Type : Node_Id;
Ref : Node_Id)
return Boolean
is
Type_Scope : constant Node_Id :=
Scope (Defining_Identifier (Priv_Type));
Type_Scope_Body : Node_Id;
Type_Full_View : Node_Id;
Scope_Node : Node_Id := Empty;
Next_Node : Node_Id := Parent (Ref);
Next_Node_Inner : Node_Id := Ref;
Result : Boolean := False;
begin
Type_Scope_Body := Parent (Type_Scope);
if Nkind (Type_Scope_Body) = N_Defining_Program_Unit_Name then
Type_Scope_Body := Parent (Type_Scope_Body);
end if;
Type_Scope_Body := Corresponding_Body (Parent (Type_Scope_Body));
if Nkind (Parent (Type_Scope_Body)) = N_Defining_Program_Unit_Name then
Type_Scope_Body := Parent (Type_Scope_Body);
end if;
while Present (Next_Node) loop
if (Nkind (Next_Node) = N_Package_Specification and then
Defining_Unit_Name (Next_Node) = Type_Scope)
or else
(Nkind (Next_Node) = N_Package_Body and then
Defining_Unit_Name (Next_Node) = Type_Scope_Body)
then
Scope_Node := Next_Node;
exit;
end if;
Next_Node_Inner := Next_Node;
Next_Node := Parent (Next_Node);
end loop;
if Present (Scope_Node) then
if Nkind (Scope_Node) = N_Package_Body then
Result := True;
elsif List_Containing (Next_Node_Inner) =
Private_Declarations (Scope_Node)
then
-- That is, Ref is in the private part of the package where
-- Priv_Type is declared, and we have to check what goes first:
-- Ref (or a construct it is enclosed into - it is pointed by
-- Next_Node_Inner) or the full view of the private type:
Type_Full_View := Parent (Full_View
(Defining_Identifier (Priv_Type)));
Next_Node := First_Non_Pragma (Private_Declarations (Scope_Node));
while Present (Next_Node) loop
if Next_Node = Type_Full_View then
Result := True;
exit;
elsif Next_Node = Next_Node_Inner then
exit;
else
Next_Node := Next_Non_Pragma (Next_Node);
end if;
end loop;
end if;
end if;
return Result;
end Full_View_Visible;
--------------------------------
-- Get_Discriminant_From_Type --
--------------------------------
function Get_Discriminant_From_Type (N : Node_Id) return Entity_Id is
Type_Entity : Entity_Id := Parent (N);
Res_Chars : constant Name_Id := Chars (N);
Result : Entity_Id;
begin
while not (Nkind (Type_Entity) = N_Subtype_Declaration
or else
Nkind (Type_Entity) = N_Subtype_Indication)
loop
Type_Entity := Parent (Type_Entity);
if Nkind (Type_Entity) = N_Allocator then
Type_Entity := Etype (Type_Entity);
while Ekind (Type_Entity) in Access_Kind loop
Type_Entity := Directly_Designated_Type (Type_Entity);
end loop;
exit;
end if;
end loop;
if Nkind (Type_Entity) = N_Subtype_Indication and then
Nkind (Parent (Type_Entity)) = N_Subtype_Declaration
then
Type_Entity := Parent (Type_Entity);
end if;
if Nkind (Type_Entity) = N_Subtype_Declaration then
Type_Entity := Defining_Identifier (Type_Entity);
else
Type_Entity := Entity (Sinfo.Subtype_Mark (Type_Entity));
end if;
while
Type_Entity /= Etype (Type_Entity)
loop
exit when Comes_From_Source (Type_Entity)
and then
Comes_From_Source (Original_Node (Parent (Type_Entity)))
and then
Nkind (Parent (Type_Entity)) /= N_Subtype_Declaration;
Type_Entity := Etype (Type_Entity);
if Ekind (Type_Entity) = E_Access_Type then
Type_Entity := Directly_Designated_Type (Type_Entity);
elsif (Ekind (Type_Entity) = E_Private_Type
or else
Ekind (Type_Entity) = E_Limited_Private_Type)
and then
Present (Full_View (Type_Entity))
then
Type_Entity := Full_View (Type_Entity);
end if;
end loop;
-- Take care of a private type with unknown discriminant part:
if Nkind (Parent (Type_Entity)) in
N_Private_Extension_Declaration .. N_Private_Type_Declaration
and then
Unknown_Discriminants_Present (Parent (Type_Entity))
then
Type_Entity := Full_View (Type_Entity);
end if;
-- In case of a derived types, we may have discriminants declared for an
-- ansector type and then redefined for some child type
Search_Discriminant : loop
Result := Original_Node (Parent (Type_Entity));
Result := First (Discriminant_Specifications (Result));
while Present (Result) loop
if Chars (Defining_Identifier (Result)) = Res_Chars then
Result := Defining_Identifier (Result);
exit Search_Discriminant;
else
Result := Next (Result);
end if;
end loop;
exit Search_Discriminant when Type_Entity = Etype (Type_Entity);
Type_Entity := Etype (Type_Entity);
end loop Search_Discriminant;
pragma Assert (Present (Result));
return Result;
end Get_Discriminant_From_Type;
-------------------------------
-- Get_Entity_From_Long_Name --
-------------------------------
function Get_Entity_From_Long_Name (N : Node_Id) return Entity_Id is
Result : Entity_Id := Empty;
Arg_Chars : constant Name_Id := Chars (N);
Res_Chars : Name_Id;
P : Node_Id;
Next_Entity : Entity_Id;
begin
P := Parent (N);
while No (Entity (P)) loop
P := Parent (P);
end loop;
Next_Entity := Entity (P);
Res_Chars := Chars (Next_Entity);
loop
if Res_Chars = Arg_Chars then
Result := Next_Entity;
exit;
end if;
if Nkind (Parent (Next_Entity)) = N_Defining_Program_Unit_Name then
P := Sinfo.Name (Parent (Next_Entity));
Next_Entity := Entity (P);
Res_Chars := Chars (Next_Entity);
else
exit;
end if;
end loop;
pragma Assert (Present (Result));
return Result;
end Get_Entity_From_Long_Name;
-----------------------------
-- Get_Rewritten_Discr_Ref --
-----------------------------
function Get_Rewritten_Discr_Ref (N : Node_Id) return Node_Id is
Res_Chars : constant Name_Id := Chars (N);
Result : Node_Id := Parent (N);
begin
while not (Nkind (Result) = N_Identifier
and then
Is_Rewrite_Substitution (Result)
and then
Nkind (Original_Node (Result)) = N_Subtype_Indication)
loop
Result := Parent (Result);
end loop;
-- Go to the declaration of this internal subtype
Result := Parent (Entity (Result));
-- Now - no the constraint
Result := Sinfo.Constraint (Sinfo.Subtype_Indication (Result));
-- And iterating through discriminant names
Result := First (Constraints (Result));
Result := First (Selector_Names (Result));
while Present (Result) loop
if Chars (Result) = Res_Chars then
exit;
end if;
-- Get to the next discriminant
if Present (Next (Result)) then
Result := Next (Result);
else
Result := Next (Parent (Result));
if Present (Result) then
Result := First (Selector_Names (Result));
end if;
end if;
end loop;
pragma Assert (Present (Result));
return Result;
end Get_Rewritten_Discr_Ref;
------------------------------
-- Get_Specificed_Component --
------------------------------
function Get_Specificed_Component
(Comp : Node_Id;
Rec_Type : Entity_Id)
return Entity_Id
is
Rec_Type_Entity : Entity_Id;
Result : Entity_Id := Empty;
Res_Chars : constant Name_Id := Chars (Comp);
Next_Comp : Node_Id;
begin
if Ekind (Rec_Type) = E_Private_Type or else
Ekind (Rec_Type) = E_Limited_Private_Type
then
Rec_Type_Entity := Full_View (Rec_Type);
else
Rec_Type_Entity := Rec_Type;
end if;
Next_Comp := First_Entity (Rec_Type_Entity);
while Present (Next_Comp) loop
if Chars (Next_Comp) = Res_Chars then
Result := Next_Comp;
exit;
end if;
Next_Comp := Next_Entity (Next_Comp);
end loop;
pragma Assert (Present (Result));
return Result;
end Get_Specificed_Component;
------------------------------
-- Get_Statement_Identifier --
------------------------------
function Get_Statement_Identifier (Def_Id : Node_Id) return Node_Id is
Result_Node : Node_Id := Empty;
-- List_Elem : Node_Id;
begin
Result_Node := Label_Construct (Parent (Def_Id));
if not (Nkind (Result_Node) = N_Label) then
-- this means, that Result_Node is of N_Block_Statement or
-- of N_Loop_Statement kind, therefore
Result_Node := Sinfo.Identifier (Result_Node);
end if;
return Result_Node;
end Get_Statement_Identifier;
---------------------
-- GFP_Declaration --
---------------------
function GFP_Declaration (Par_Id : Node_Id) return Node_Id is
Par_Chars : constant Name_Id := Chars (Par_Id);
Result_Node : Node_Id;
Gen_Par_Decl : Node_Id;
begin
-- First, going up to the generic instantiation itself:
Result_Node := Parent (Parent (Par_Id));
-- then taking the name of the generic unit being instantiated
-- and going to its definition - and declaration:
Result_Node := Parent (Parent (Entity (Sinfo.Name (Result_Node))));
-- and now - searching the declaration of the corresponding
-- generic parameter:
Gen_Par_Decl :=
First_Non_Pragma (Generic_Formal_Declarations (Result_Node));
while Present (Gen_Par_Decl) loop
if Nkind (Gen_Par_Decl) in N_Formal_Subprogram_Declaration then
Result_Node := Defining_Unit_Name (Specification (Gen_Par_Decl));
else
Result_Node := Defining_Identifier (Gen_Par_Decl);
end if;
if Chars (Result_Node) = Par_Chars then
exit;
else
Gen_Par_Decl := Next_Non_Pragma (Gen_Par_Decl);
end if;
end loop;
return Result_Node;
end GFP_Declaration;
--------------------------------
-- Identifier_Name_Definition --
--------------------------------
function Identifier_Name_Definition
(Reference_I : Element)
return Asis.Defining_Name
is
Arg_Node : Node_Id;
Arg_Node_Kind : Node_Kind;
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Reference_I);
Result_Node : Node_Id := Empty;
Result_Unit : Compilation_Unit;
Spec_Case : Special_Cases := Not_A_Special_Case;
Result_Kind : Internal_Element_Kinds := Not_An_Element;
Is_Inherited : Boolean := False;
Association_Type : Node_Id := Empty;
-- ??? Is it a good name for a parameter?
Componnet_Name : Node_Id := Empty;
Tmp_Node : Node_Id;
Result : Asis.Element;
function Ekind (N : Node_Id) return Entity_Kind;
-- This function differs from Atree.Ekind in that it can operate
-- with N_Defining_Program_Unit_Name (in this case it returns
-- Atree.Ekind for the corresponding Defining_Identifier node.
function Ekind (N : Node_Id) return Entity_Kind is
Arg_Node : Node_Id := N;
begin
if Nkind (Arg_Node) = N_Defining_Program_Unit_Name then
Arg_Node := Defining_Identifier (Arg_Node);
end if;
return Atree.Ekind (Arg_Node);
end Ekind;
begin
-- this function is currently integrated with
-- Enumeration_Literal_Name_Definition and
-- Operator_Symbol_Name_Definition
-- The implementation approach is very similar to that one of
-- A4G.A_Sem.Get_Corr_Called_Entity. Now the implicit *predefined*
-- operations are turned off for a while
------------------------------------------------------------------
-- 1. Defining Result_Node (and adjusting Arg_Node, if needed) --
------------------------------------------------------------------
if Arg_Kind = An_Identifier then
Result_Kind := A_Defining_Identifier;
-- may be changed to A_Defining_Expanded_Name later
elsif Arg_Kind = An_Enumeration_Literal then
Result_Kind := A_Defining_Enumeration_Literal;
elsif Arg_Kind in Internal_Operator_Symbol_Kinds then
Result_Kind := Def_Operator_Kind (Int_Kind (Reference_I));
end if;
if Special_Case (Reference_I) = Rewritten_Named_Number then
Arg_Node := R_Node (Reference_I);
else
-- Arg_Node := Get_Actual_Type_Name (Node (Reference_I));
Arg_Node := Node (Reference_I);
end if;
-- the code below is really awful! In some future we'll have
-- to revise this "patch on patch" approach!!!
if Is_Part_Of_Defining_Unit_Name (Arg_Node) and then
Kind (Encl_Unit (Reference_I)) in A_Library_Unit_Body
then
-- this means, that we have a part of a prefix of a defining
-- unit name which is a part of a body. These components do not
-- have Entity field set, so we have to go to the spec:
Arg_Node := Reset_To_Spec (Arg_Node);
end if;
if Nkind (Arg_Node) in N_Entity then
-- This is the case of the reference to a formal type inside
-- the expanded code when the actual type is a derived type
-- In this case Get_Actual_Type_Name returns the entity node
-- (see 8924-006)
Result_Node := Arg_Node;
Arg_Node := Node (Reference_I);
-- For the rest of the processing we need Arg_Node properly set as
-- the reference, but not as an entity node
elsif Special_Case (Reference_I) = Rewritten_Named_Number then
-- See BB10-002
Result_Node := Original_Entity (Arg_Node);
elsif No (Entity (Arg_Node)) then
Arg_Node_Kind := Nkind (Original_Node (Parent (Arg_Node)));
-- in some cases we can try to "repair" the situation:
if Arg_Node_Kind = N_Expanded_Name then
-- the Entity field is set for the whole expanded name:
if Entity_Present (Original_Node (Parent (Arg_Node))) or else
Entity_Present (Parent (Arg_Node))
then
Arg_Node := Parent (Arg_Node);
-- In case of renamings, here we may have the expanded name
-- rewritten, and the Entity field for the new name pointing
-- to the renamed entity, but not to the entity defined by
-- the renamed declaration, see B924-A13
if Is_Rewrite_Substitution (Arg_Node) and then
Entity_Present (Original_Node (Arg_Node))
then
Arg_Node := Original_Node (Arg_Node);
end if;
else
-- Trying to "traverse a "long" defining program unit
-- name (see 7917-005)
Result_Node := Get_Entity_From_Long_Name (Arg_Node);
end if;
elsif Arg_Node_Kind = N_Component_Definition and then
Sloc (Arg_Node) = Standard_Location
then
-- Special case of Subtype_Indication for predefined String
-- and Wide_String types:
Result_Node := Parent (Parent (Parent (Arg_Node)));
-- Here we are in N_Full_Type_Declaration node
Result_Node := Defining_Identifier (Result_Node);
Result_Node := Component_Type (Result_Node);
Spec_Case := Explicit_From_Standard;
elsif Arg_Node_Kind = N_Function_Call then
-- this is a special case of a parameterless function call
-- of the form P.F
Arg_Node := Sinfo.Name (Original_Node (Parent (Arg_Node)));
elsif Arg_Node_Kind = N_Integer_Literal or else
Arg_Node_Kind = N_Real_Literal or else
Arg_Node_Kind = N_Character_Literal or else
Arg_Node_Kind = N_String_Literal or else
Arg_Node_Kind = N_Identifier
then
-- All but last conditions are a result of some compile-time
-- optimization. The last one is a kind of
-- semantically-transparent transformation which loses some
-- semantic information for replaced structures (see the test
-- for 9429-006).
--
-- The last condition may need some more attention in case if new
-- Corresponding_Name_Definition problems are detected
Arg_Node := Original_Node (Parent (Arg_Node));
elsif Arg_Node_Kind = N_Component_Association and then
Nkind (Parent (Parent (Arg_Node))) = N_Raise_Constraint_Error
then
-- A whole aggregate is rewritten into N_Raise_Constraint_Error
-- node, see G628-026
Tmp_Node := Parent (Parent (Arg_Node));
Tmp_Node := Etype (Tmp_Node);
Tmp_Node := First_Entity (Tmp_Node);
while Present (Tmp_Node) loop
if Chars (Tmp_Node) = Chars (Arg_Node) then
Result_Node := Tmp_Node;
exit;
end if;
Tmp_Node := Next_Entity (Tmp_Node);
end loop;
pragma Assert (Present (Result_Node));
if not (Comes_From_Source (Result_Node))
and then
Comes_From_Source (Parent (Result_Node))
then
Result_Node := Defining_Identifier (Parent (Result_Node));
end if;
elsif Arg_Node_Kind = N_Component_Association and then
Nkind (Sinfo.Expression (Parent (Arg_Node))) =
N_Raise_Constraint_Error
then
-- here we are guessing for the situation when a compiler
-- optimization take place. We can probably be non-accurate
-- for inherited record components, but what can we do....
--
-- first, defining the corresponding Entity Node, we assume
-- it to be a record component definition
Result_Node := Parent (Parent (Arg_Node)); -- aggregate
Association_Type := Etype (Result_Node);
if Ekind (Association_Type) in Private_Kind then
Association_Type := Full_View (Association_Type);
end if;
Result_Node := First_Entity (Association_Type);
while Chars (Result_Node) /= Chars (Arg_Node) loop
Result_Node := Next_Entity (Result_Node);
end loop;
elsif Arg_Node_Kind = N_Parameter_Association and then
Arg_Node = Selector_Name (Parent (Arg_Node))
then
-- Currently we assume, that this corresponds to the case of
-- formal parameters of predefined operations
return Nil_Element;
elsif Arg_Node_Kind = N_Component_Clause then
-- Component clause in record representation clause - Entity
-- field is not set, we have to traverse the list of components
-- of the record type
Association_Type :=
Entity (Sinfo.Identifier (Parent (Parent (Arg_Node))));
if Ekind (Association_Type) = E_Record_Subtype then
-- In case of a subtype it may be the case that some components
-- depending on discriminant are skipped in case of a static
-- discriminnat constraint, see also
-- A4G.Mapping.Set_Inherited_Components
Association_Type := Etype (Association_Type);
end if;
Result_Node :=
Get_Specificed_Component (Arg_Node, Association_Type);
Association_Type := Empty;
-- Association_Type is set back to Empty to make it possible
-- to use the general approach for computing Association_Type
-- later
elsif Nkind (Arg_Node) = N_Identifier and then
Sloc (Parent (Arg_Node)) = Standard_ASCII_Location
then
-- reference to Character in a constant definition in the
-- ASCII package, see 8303-011
Result_Node := Standard_Character;
elsif not (Arg_Node_Kind = N_Discriminant_Association or else
Arg_Node_Kind = N_Generic_Association)
and then
not Is_From_Unknown_Pragma (R_Node (Reference_I))
then
-- now we are considering all the other cases as component simple
-- names in a (rewritten!) record aggregate, and we go from the
-- original to the rewritten structure (because the original
-- structure is not decorated). If this is not the case, we should
-- get the Assert_Failure raised in Rewritten_Image
-- Arg_Node := Rewritten_Image (Arg_Node);
Result_Node := Search_Record_Comp (Arg_Node);
end if;
end if;
if No (Result_Node) and then
No (Entity (Arg_Node)) and then
not (Nkind (Parent (Arg_Node)) = N_Discriminant_Association or else
Nkind (Parent (Arg_Node)) = N_Generic_Association or else
Is_From_Unknown_Pragma (R_Node (Reference_I)))
then
if Debug_Flag_S then
Write_Str ("A4G.Expr_Sem.Identifier_Name_Definition:");
Write_Eol;
Write_Str ("no Entity field is set for Node ");
Write_Int (Int (Arg_Node));
Write_Eol;
Write_Str (" the debug image of the query argument is:");
Write_Eol;
Debug_String (Reference_I);
Write_Str (Debug_Buffer (1 .. Debug_Buffer_Len));
Write_Eol;
end if;
raise Internal_Implementation_Error;
end if;
if Present (Result_Node) then
null;
elsif Is_From_Unknown_Pragma (R_Node (Reference_I)) then
return Nil_Element;
elsif Nkind (Parent (Arg_Node)) = N_Discriminant_Association and then
Arg_Node /= Original_Node (Sinfo.Expression (Parent (Arg_Node)))
then
-- We use Original_Node (Sinfo.Expression (Parent (Arg_Node)))
-- because of C730-016 (named numbers rewritten into their values)
if No (Original_Discriminant (Arg_Node)) then
Result_Node := Get_Discriminant_From_Type (Arg_Node);
else
Result_Node := Original_Discriminant (Arg_Node);
if Present (Corresponding_Discriminant (Result_Node)) then
Result_Node := Corresponding_Discriminant (Result_Node);
end if;
end if;
elsif No (Entity (Arg_Node)) and then
Nkind (Parent (Arg_Node)) = N_Generic_Association
then
-- this is the problem up to 3.10p. We have to compute
-- N_Defining_Identifier_Node for this generic formal
-- parameter "by hands"
-- ??? should be rechecked for 3.11w!!!
Result_Node := GFP_Declaration (Arg_Node);
else
Result_Node := Entity (Arg_Node);
end if;
-- Here we have Result_Node set. And now we have a whole bunch of
-- situations when we have to correct Result_Node because of different
-- reasons
-- If Result_Node is the type reference, and the type has both private
-- and full view, Result_Node will point to the private view. In some
-- situations we have to replace it with the full view.
if Ekind (Result_Node) in Einfo.Type_Kind
and then
Nkind (Original_Node (Parent (Result_Node))) in
N_Private_Extension_Declaration .. N_Private_Type_Declaration
and then
Full_View_Visible
(Priv_Type => Parent (Result_Node),
Ref => Arg_Node)
then
Result_Node := Full_View (Result_Node);
end if;
-- FB02-015: Ada 2005 - reference to a record type with self-referencing
-- components, The front-end creates an incomplete type
-- declaration, and the Entity field may point to this
-- incomplete type.
if Ekind (Result_Node) = E_Incomplete_Type
and then
not Comes_From_Source (Result_Node)
and then
Nkind (Parent (Result_Node)) = N_Incomplete_Type_Declaration
then
Tmp_Node := Full_View (Result_Node);
if Present (Tmp_Node) then
Result_Node := Full_View (Result_Node);
end if;
end if;
-- F818-A05: reference to a formal parameter of a child subprogram in
-- case when the subprogram does not have a separate spec.
-- The front-end creates some artificial data structures to
-- represent this separate spec, so the entity field of a
-- parameter reference points to some artificial node
if Nkind (Parent (Result_Node)) = N_Parameter_Specification
and then
not (Comes_From_Source (Result_Node))
then
-- Check if we are in the artificial spec created for child
-- subprogram body:
Tmp_Node := Scope (Result_Node);
Tmp_Node := Parent (Parent (Parent (Tmp_Node)));
if Nkind (Tmp_Node) = N_Subprogram_Declaration
and then
not Comes_From_Source (Tmp_Node)
and then
Present (Parent_Spec (Tmp_Node))
and then
Present (Corresponding_Body (Tmp_Node))
then
-- Go to the defining identifier of this parameter in subprogram
-- body:
Tmp_Node := Corresponding_Body (Tmp_Node);
Tmp_Node := Parent (Parent (Tmp_Node));
Tmp_Node := First_Non_Pragma (Parameter_Specifications (Tmp_Node));
while Present (Tmp_Node) loop
if Chars (Defining_Identifier (Tmp_Node)) =
Chars (Result_Node)
then
Result_Node := Defining_Identifier (Tmp_Node);
exit;
end if;
Tmp_Node := Next_Non_Pragma (Tmp_Node);
end loop;
pragma Assert (Present (Tmp_Node));
end if;
end if;
-- E802-015: for a protected operation items that do not have separate
-- specs the front-end creates these specs and sets all the Entity
-- fields pointing to the entities from these artificial specs.
if Is_Artificial_Protected_Op_Item_Spec (Result_Node) then
if Ekind (Result_Node) in Formal_Kind then
Tmp_Node := Parent (Parent (Parent (Result_Node)));
Tmp_Node := Parent (Corresponding_Body (Tmp_Node));
Tmp_Node := First_Non_Pragma (Parameter_Specifications (Tmp_Node));
while Present (Tmp_Node) loop
if Chars (Defining_Identifier (Tmp_Node)) =
Chars (Result_Node)
then
Result_Node := Defining_Identifier (Tmp_Node);
exit;
else
Tmp_Node := Next_Non_Pragma (Tmp_Node);
end if;
end loop;
else
-- The only possibility - the protected operation entity
Result_Node := Corresponding_Body (Parent (Parent (Result_Node)));
end if;
end if;
-- See E421-006: problem with reference to a formal type in an expanded
-- code.
if Present (Result_Node)
and then
Is_Itype (Result_Node)
-- and then Present (Cloned_Subtype (Result_Node))
then
if Special_Case (Reference_I) = Dummy_Base_Attribute_Prefix then
Result_Node := Associated_Node_For_Itype (Result_Node);
else
Result_Node := Etype (Result_Node);
end if;
-- This is for E912-013
if No (Parent (Result_Node))
and then
Present (Associated_Node_For_Itype (Result_Node))
then
Result_Node :=
Defining_Identifier (Associated_Node_For_Itype (Result_Node));
elsif Special_Case (Reference_I) = Dummy_Base_Attribute_Prefix then
Result_Node := Defining_Identifier (Result_Node);
end if;
end if;
-- Problem with System redefined with Extend_System pragma (E315-001)
if Nkind (Arg_Node) in N_Has_Chars
and then
Chars (Arg_Node) = Name_System
and then
Chars (Result_Node) /= Name_System
and then
Nkind (Parent (Result_Node)) = N_Defining_Program_Unit_Name
then
Result_Node := Entity (Sinfo.Name (Parent (Result_Node)));
pragma Assert (Chars (Result_Node) = Name_System);
end if;
-- Problem with tasks defined by a single task definition: for such a
-- definition the front-end creates an artificial variable declaration
-- node, and for the references to such task, the Entity field points to
-- the entity node from this artificial variable declaration (E224-024).
-- The same problem exists for a single protected declaration
-- (E418-015)
Tmp_Node := Parent (Result_Node);
if Comes_From_Source (Result_Node)
and then
not Comes_From_Source (Tmp_Node)
and then
Nkind (Tmp_Node) = N_Object_Declaration
and then
not Constant_Present (Tmp_Node)
and then
No (Corresponding_Generic_Association (Tmp_Node))
then
Tmp_Node := Etype (Result_Node);
if Ekind (Tmp_Node) in Concurrent_Kind then
Result_Node := Parent (Result_Node);
while not (Nkind (Result_Node) = N_Task_Type_Declaration
or else
Nkind (Result_Node) = N_Protected_Type_Declaration)
loop
Result_Node := Prev (Result_Node);
end loop;
end if;
Result_Node := Defining_Identifier (Original_Node (Result_Node));
end if;
-- F703-020: see the comment marked by this TN in the body of
-- A4G.A_Sem.Get_Corr_Called_Entity
if not Comes_From_Source (Result_Node)
and then
Is_Overloadable (Result_Node)
and then
Present (Alias (Result_Node))
and then
not (Is_Intrinsic_Subprogram (Result_Node))
and then
Pass_Generic_Actual (Parent (Result_Node))
then
-- ???
Result_Node := Alias (Result_Node);
end if;
-- and here we have to solve the problem with generic instances:
-- for them Result_Node as it has been obtained above points not
-- to the defining identifier from the corresponding instantiation,
-- but to an entity defined in a "implicit" package created by the
-- compiler
if Is_Generic_Instance (Result_Node) then
Result_Node := Get_Instance_Name (Result_Node);
end if;
-- If the argument is Is_Part_Of_Implicit reference to a type, we
-- have to check if it is the reference to a type mark in parameter
-- or parameter and result profile of inherited subprogram and if it
-- should be substituted by the reference to the corresponding
-- derived type
Tmp_Node := Node_Field_1 (Reference_I);
if Ekind (Result_Node) in Einfo.Type_Kind
and then
Is_From_Inherited (Reference_I)
and then
Nkind (Tmp_Node) in Sinfo.N_Entity
and then
(Ekind (Tmp_Node) = E_Procedure or else
Ekind (Tmp_Node) = E_Function)
then
Result_Node := Get_Derived_Type (Type_Entity => Result_Node,
Inherited_Subpr => Tmp_Node);
end if;
-- labels (and, probably, statement names!!) makes another problem:
-- we have to return not the implicit label (statement identifier??)
-- declaration, but the label (statement name) attached to the
-- corresponding statement
if Nkind (Parent (Result_Node)) = N_Implicit_Label_Declaration then
Result_Node := Get_Statement_Identifier (Result_Node);
end if;
Tmp_Node := Original_Node (Parent (Parent (Result_Node)));
while Nkind (Tmp_Node) = N_Subprogram_Renaming_Declaration
and then
not (Comes_From_Source (Tmp_Node))
and then
not Pass_Generic_Actual (Tmp_Node)
loop
-- Result_Node is a defining name from the artificial renaming
-- declarations created by the compiler in the for wrapper
-- package for expanded subprogram instantiation. We
-- have to go to expanded subprogram spec which is renamed.
--
-- We have to do this in a loop in case of nested instantiations
Result_Node := Sinfo.Name (Tmp_Node);
if Nkind (Result_Node) = N_Selected_Component then
Result_Node := Selector_Name (Result_Node);
end if;
Result_Node := Entity (Result_Node);
Tmp_Node := Parent (Parent (Result_Node));
end loop;
-- -- ???
-- if Ekind (Result_Node) = E_Operator then
-- Result_Kind := N_Defining_Identifier_Mapping (Result_Node);
-- end if;
if Nkind (Parent (Result_Node)) = N_Defining_Program_Unit_Name or else
Nkind (Result_Node) = N_Defining_Program_Unit_Name
then
-- if we are processing the reference to a child unit, we have to
-- go from a defining identifier to the corresponding defining
-- unit name (the first part of the condition).
-- If this is a reference to a child subprogram, for which
-- the separate subprogram specification does not exist,
-- GNAT generates the tree structure corresponding to such a
-- separate subprogram specification, and it set the Entity
-- field for all references to this subprogram pointing
-- to the defining identifier in this inserted subprogram
-- specification. This case may be distinguished by the fact,
-- that Comes_From_Source field for this defining identifier
-- is set OFF. And in this case we have to go to the defining
-- identifier in the subprogram body:
if not Comes_From_Source (Result_Node) then
-- we have to go to the defining identifier in the
-- corresponding body:
while not (Nkind (Result_Node) = N_Subprogram_Declaration) loop
Result_Node := Parent (Result_Node);
end loop;
Result_Node := Corresponding_Body (Result_Node);
end if;
if Nkind (Result_Node) /= N_Defining_Program_Unit_Name then
Result_Node := Parent (Result_Node);
end if;
Result_Kind := A_Defining_Expanded_Name;
if not Comes_From_Source (Result_Node) then
-- now it means that we have a library level instantiation
-- of a generic child package
Result_Node := Parent (Parent (Result_Node));
Result_Node := Original_Node (Result_Node);
if Nkind (Result_Node) = N_Package_Declaration then
Result_Node := Sinfo.Corresponding_Body (Result_Node);
while Nkind (Result_Node) /= N_Package_Body loop
Result_Node := Parent (Result_Node);
end loop;
Result_Node := Original_Node (Result_Node);
end if;
Result_Node := Defining_Unit_Name (Result_Node);
end if;
end if;
if Nkind (Result_Node) = N_Defining_Identifier and then
(Ekind (Result_Node) = E_In_Parameter or else
Ekind (Result_Node) = E_Constant) and then
Present (Discriminal_Link (Result_Node))
then
-- here we have to go to an original discriminant
Result_Node := Discriminal_Link (Result_Node);
end if;
-- FA13-008: subtype mark in parameter specification in implicit "/="
-- declaration in case if in the corresponding "=" the parameter is
-- specified by 'Class attribute:
if Nkind (Arg_Node) = N_Identifier
and then
not Comes_From_Source (Arg_Node)
and then
Ekind (Result_Node) = E_Class_Wide_Type
and then
Result_Node /= Defining_Identifier (Parent (Result_Node))
then
Result_Node := Defining_Identifier (Parent (Result_Node));
end if;
-- Now we have Result_Node pointing to some defining name. There are
-- some kinds of entities which require special processing. For
-- implicitly declared entities we have to set Association_Type
-- pointing to a type which "generates" the corresponding implicit
-- declaration (there is no harm to set Association_Type for explicitly
-- declared entities, but for them it is of no use). For predefined
-- entities the special case attribute should be set.
----------------------------------------
-- temporary solution for 5522-003 ???--
----------------------------------------
-- The problem for record components:
--
-- 1. The Entity field for references to record components and
-- disciminants may point to field of some implicit types created
-- by the compiler
--
-- 2. The Entity field for the references to the (implicitly declared!)
-- components of a derived record type point to the explicit
-- declarations of the component of the ancestor record type
--
-- 3. Probably, all this stuff should be incapsulated in a separate
-- subprogram???
-- Here we already have Result_Node:
if Nkind (Result_Node) = N_Defining_Identifier and then
(Ekind (Result_Node) = E_Component or else
Ekind (Result_Node) = E_Discriminant or else
Ekind (Result_Node) = E_Entry or else
Ekind (Result_Node) = E_Procedure or else
Ekind (Result_Node) = E_Function)
then
-- first, we compute Association_Type as pointed to a type
-- declaration for which Agr_Node is a component:
if No (Association_Type) then
Association_Type := Parent (Arg_Node);
if Nkind (Association_Type) = N_Function_Call then
Association_Type := Sinfo.Name (Association_Type);
end if;
case Nkind (Association_Type) is
when N_Component_Clause =>
Association_Type :=
Sinfo.Identifier (Parent (Association_Type));
when N_Selected_Component =>
Association_Type := Prefix (Association_Type);
if Nkind (Association_Type) = N_Attribute_Reference
and then
(Attribute_Name (Association_Type) =
Name_Unrestricted_Access
or else
Attribute_Name (Association_Type) = Name_Access)
then
-- See G222-012
Association_Type := Prefix (Association_Type);
end if;
if Nkind (Association_Type) = N_Selected_Component then
Association_Type := Selector_Name (Association_Type);
end if;
when N_Component_Association =>
Association_Type := Parent (Association_Type);
when N_Discriminant_Association =>
if Arg_Node = Sinfo.Expression (Association_Type) then
-- using a discriminant in initialization expression
Association_Type := Empty;
else
Association_Type := Scope (Result_Node);
end if;
when others =>
-- We set Association_Type as Empty to indicate the case of
-- a definitely explicit result
Association_Type := Empty;
end case;
end if;
if Present (Association_Type) then
if not (Comes_From_Source (Association_Type)
and then
Nkind (Association_Type) in N_Entity
and then
Ekind (Association_Type) in Einfo.Type_Kind)
then
Association_Type := Etype (Association_Type);
end if;
if Nkind (Original_Node (Parent (Association_Type))) =
N_Single_Task_Declaration
or else
Nkind (Original_Node (Parent (Association_Type))) =
N_Single_Protected_Declaration
then
Association_Type := Empty;
else
if Ekind (Result_Node) = E_Component
and then
not Comes_From_Source (Parent (Result_Node))
and then
Ekind (Association_Type) in Private_Kind
then
Association_Type := Full_View (Association_Type);
end if;
Association_Type :=
Explicit_Type_Declaration_Unwound_Unaccess
(Association_Type, Arg_Node);
if Nkind (Original_Node (Association_Type)) in
N_Protected_Type_Declaration ..
N_Private_Extension_Declaration
then
Association_Type :=
Parent
(Full_View (Defining_Identifier (Original_Node
(Association_Type))));
end if;
end if;
end if;
-- then, we have to adjust result Node:
if Ekind (Result_Node) = E_Discriminant and then
Chars (Discriminal (Result_Node)) /=
Chars (Original_Record_Component (Result_Node))
then
-- This condition is the clue for discriminants explicitly
-- declared in declarations of derived types.
-- These assignments below resets Result_Node to
-- N_Defining_Identifier node which denotes the same discriminant
-- but has a properly set bottom-up chain of Parent nodes
Result_Node := Discriminal (Result_Node);
Result_Node := Discriminal_Link (Result_Node);
else
-- There we have to come from an implicit type to a explicitly
-- declared type:
Tmp_Node := Scope (Result_Node);
if Ekind (Tmp_Node) = E_Record_Subtype then
Tmp_Node := Etype (Tmp_Node);
end if;
if (Ekind (Result_Node) = E_Component
or else
Ekind (Result_Node) = E_Discriminant)
and then
not (Comes_From_Source (Result_Node)
and then
not Comes_From_Source (Parent (Result_Node)))
then
-- This condition leaves unchanged inherited discriminants
-- of derived record types
Tmp_Node := First_Entity (Tmp_Node);
while Present (Tmp_Node) loop
if Chars (Tmp_Node) = Chars (Result_Node) then
Result_Node := Tmp_Node;
exit;
end if;
Tmp_Node := Next_Entity (Tmp_Node);
end loop;
end if;
end if;
-- A private type may require some special adjustment in case if
-- full view is visible: if Result_Node is a discriminant:
-- it points to a discriminant in a private view, and we have
-- to reset it to point to the discriminant in the full view
if Present (Association_Type)
and then
Has_Private_Declaration (Defining_Identifier (Association_Type))
and then
Ekind (Result_Node) = E_Discriminant
and then
Nkind (Association_Type) /= N_Private_Type_Declaration
and then
Nkind (Association_Type) /= N_Private_Extension_Declaration
and then
Is_Type_Discriminant (Result_Node,
Original_Node (Association_Type))
then
Result_Node := Reset_To_Full_View (Association_Type, Result_Node);
end if;
-- Now, we have to define if we have an implicit component here.
-- Result_Context_Node is finally supposed to be set to the
-- declaration of the type to which the argument component belongs
if No (Association_Type) then
-- definitely explicit result:
Is_Inherited := False;
elsif Is_Rewrite_Substitution (Association_Type) then
-- here we have a derived type with no record extension part
-- but it can have an explicitly declared discriminant
if Ekind (Result_Node) = E_Discriminant then
Is_Inherited := not (Is_Type_Discriminant (
Result_Node, Original_Node (Association_Type)));
else
Is_Inherited := True;
end if;
elsif Nkind (Association_Type) = N_Incomplete_Type_Declaration
or else
Nkind (Association_Type) = N_Private_Extension_Declaration
or else
Nkind (Association_Type) = N_Private_Type_Declaration
or else
Nkind (Association_Type) = N_Task_Type_Declaration
or else
Nkind (Association_Type) = N_Protected_Type_Declaration
or else
(Nkind (Association_Type) = N_Formal_Type_Declaration and then
Nkind (Sinfo.Formal_Type_Definition (Association_Type)) =
N_Formal_Private_Type_Definition)
or else
Nkind (Sinfo.Type_Definition (Association_Type)) =
N_Record_Definition
then
-- should be an explicit component
Is_Inherited := False;
-- Patch for E407-A08
if Ekind (Result_Node) = E_Component then
Result_Node := Original_Record_Component (Result_Node);
end if;
elsif Nkind (Sinfo.Type_Definition (Association_Type)) =
N_Derived_Type_Definition
then
-- it may be an inherited component or an explicitly declared
-- discriminant or a component from a record extension part
if Is_Explicit_Type_Component (Result_Node, Association_Type) then
Is_Inherited := False;
else
Is_Inherited := True;
end if;
else
-- ??? this Assert pragma - only for development/debug period
-- ??? what else except N_Selected_Component could be here
null;
pragma Assert (False);
end if;
end if;
-------------------------------------------------
-- end for the temporary solution for 5522-003 --
-------------------------------------------------
--------------------------
-- Enumeration literals --
--------------------------
if not (Defined_In_Standard (Arg_Node))
and then
Nkind (Result_Node) = N_Defining_Identifier
-- or else
-- Nkind (Result_Node) = N_Defining_Character_Literal)
and then
Ekind (Result_Node) = E_Enumeration_Literal
and then (not Comes_From_Source (Result_Node))
then
-- an enumeration literal inherited by a derived type definition
-- (character literals are still processed by a separate function
-- Character_Literal_Name_Definition, that's why the corresponding
-- part of the condition is commented out)
-- ???Needs revising for the new model of implicit Elements
Is_Inherited := True;
Association_Type := Etype (Arg_Node);
Association_Type :=
Explicit_Type_Declaration_Unwound (Association_Type);
end if;
---------------------------------------
-- The rest of special processing: --
-- somewhat messy and needs revising --
---------------------------------------
-- We have to turn off for a while the full processing of the
-- implicit elements (Hope to fix this soon).
if Defined_In_Standard (Arg_Node)
or else
Sloc (Arg_Node) <= Standard_Location
or else
Sloc (Result_Node) <= Standard_Location
then
-- We need the second part of the condition for references to
-- Standard.Characters which are parts of the definitions in
-- the ASCII package
if Ekind (Result_Node) = E_Operator then
return Nil_Element;
else
-- I hope, that I'm right, that all the *identifiers* declared
-- in standard are declared explicitly, and all the rest
-- (which are defined in Standard) are implicit
-- Root and universal types can make a problem, but let's
-- see it before...
Spec_Case := Explicit_From_Standard;
end if;
else
if Result_Kind in Internal_Defining_Operator_Kinds then
if Is_Predefined (Result_Node) then
Spec_Case := Predefined_Operation;
-- -- note, that Predefined_Operation corresponds to an
-- -- implicitly declared operation of a type, which is defined
-- -- not in the Standard package
-- Association_Type := Enclosed_Type (Result_Node);
-- -- we have to use namely Association_Type, but not Result_Node
-- -- to define Result_Unit, because sometimes Result_Node
-- -- does not have the Parent field set
return Nil_Element;
-- ???!!! this turns off all the predefined operations
-- !!!??? defined not in Standard
elsif Is_Impl_Neq (Result_Node) then
Spec_Case := Is_From_Imp_Neq_Declaration;
end if;
end if;
end if;
-------------------
-- Limited views --
-------------------
if Spec_Case = Not_A_Special_Case then
Tmp_Node := Result_Node;
if Nkind (Tmp_Node) = N_Defining_Program_Unit_Name then
Tmp_Node := Defining_Identifier (Tmp_Node);
end if;
if Nkind (Tmp_Node) in N_Entity then
case Ekind (Tmp_Node) is
when Einfo.Type_Kind =>
if not Comes_From_Source (Tmp_Node)
and then
Ekind (Tmp_Node) in Incomplete_Kind
and then
Present (Non_Limited_View (Tmp_Node))
then
Spec_Case := From_Limited_View;
Result_Node := Non_Limited_View (Result_Node);
end if;
when E_Package =>
if not Is_Generic_Instance (Tmp_Node) then
if not Analyzed (Parent (Result_Node)) then
Spec_Case := From_Limited_View;
elsif Is_Limited_Withed (Result_Node, Reference_I) then
Spec_Case := From_Limited_View;
end if;
end if;
when others =>
null;
end case;
end if;
end if;
if Spec_Case not in Predefined
and then
Spec_Case /= Is_From_Imp_Neq_Declaration
and then
Spec_Case /= From_Limited_View
and then
not Comes_From_Source (Result_Node)
and then
No (Association_Type)
and then
not Part_Of_Pass_Generic_Actual (Result_Node)
then
-- Here we may have the following possibilities:
-- - library-level subprogram instantiation;
-- - artificial entity created for an inner package from a package
-- "withed" by a limited with clause;
-- - defining name from the artificial spec created for subprogram
-- body which acts as a spec;
-- - prefix of the artificial 'Class attribute reference (ASIS has
-- to emulate such an attribute reference in case if a class-wide
-- type is use as an actual type in the instantiation);
-- - index (sub)type in case if the corresponding type is declared as
-- private (F424-A01);
-- - F619-024;
-- - F627-001
-- - inherited subprogram;
if Nkind (Parent (Result_Node)) in N_Subprogram_Specification then
if Is_Generic_Instance (Result_Node) then
-- Library-level subprogram instantiation
-- Here we have to go from the rewritten to the original
-- tree structure
-- This code appeared at some point, but it seems that it is
-- of no real need. Will be for a while - just in case.
-- It does not allow to fix G312-006
-- ???
-- Result_Node := Parent (Parent (Parent (Parent (Result_Node))));
-- Result_Node := Original_Node (Result_Node);
-- Result_Node := Sinfo.Defining_Unit_Name (Result_Node);
null;
else
-- Artificial subprogram spec created for the body acting
-- as spec
Result_Node := Parent (Parent (Result_Node));
Result_Node := Corresponding_Body (Result_Node);
end if;
elsif Nkind (Parent (Result_Node)) = N_Package_Specification
and then
Comes_From_Source (Parent (Result_Node))
then
-- An artificial internal entity created for a local package
-- from a package that is "withed" by limited with clause
-- We go to the entity node the package spec points to.
-- See F310-025 and F311-003.
Result_Node := Defining_Unit_Name (Parent (Result_Node));
elsif Special_Case (Reference_I) = Dummy_Class_Attribute_Prefix
and then
Ekind (Result_Node) = E_Class_Wide_Type
then
Result_Node := Defining_Identifier (Parent (Result_Node));
elsif Ekind (Result_Node) in Discrete_Kind
and then
Nkind (Parent (Result_Node)) = N_Subtype_Declaration
then
-- Go to the full view of the corresponding private type:
Result_Node := Sinfo.Subtype_Indication (Parent (Result_Node));
Result_Node := Entity (Result_Node);
pragma Assert (Ekind (Result_Node) in Private_Kind);
Result_Node := Full_View (Result_Node);
elsif Ekind (Result_Node) = E_Package
and then
Is_Hidden (Result_Node)
and then
Is_Rewrite_Substitution (R_Node (Reference_I))
then
-- This is the case when we have a reference to the instantiation
-- of generic parent in the instantiation of generic child,
-- see F619-024
Result_Node := Entity (R_Node (Reference_I));
if Nkind (Parent (Result_Node)) = N_Defining_Program_Unit_Name then
Result_Node := Parent (Result_Node);
Result_Kind := A_Defining_Expanded_Name;
end if;
elsif Ekind (Result_Node) = E_Package
and then
Nkind (Parent (Result_Node)) = N_Package_Renaming_Declaration
and then
not Comes_From_Source (Parent (Result_Node))
then
-- Reference_I is the reference to the name of the instantiation
-- inside an expanded template, but the name of the template is
-- the defining expanded name. In this case we have to use the
-- entity of the rewritten node (F627-001)
Result_Node := Entity (R_Node (Reference_I));
else
-- It should be inherited!
-- The last condition is needed to filter out already processed
-- cases. This case corresponds to inherited user-defined
-- subprograms
Is_Inherited := True;
if Ekind (Result_Node) = E_Function or else
Ekind (Result_Node) = E_Procedure
then
Association_Type := Result_Node;
-- Points to the defining identifier of implicit inherited
-- subprogram
Result_Node := Explicit_Parent_Subprogram (Result_Node);
-- Now Result_Node points to the defining identifier of
-- explicit subprogram which is inherited
else
-- ??? Probably will need revising when inherited record
-- components and enumeration literals are fully
-- implemented
Association_Type := Defining_Identifier (Parent (Result_Node));
Association_Type := First_Subtype (Association_Type);
end if;
end if;
end if;
if Defined_In_Standard (Arg_Node) then
-- Here we may need to adjust the result node in case if it is an
-- entity representing an unconstrained base type for a signed
-- integer type (see Cstand.Create_Unconstrained_Base_Type)
if No (Parent (Result_Node))
and then
Ekind (Result_Node) = E_Signed_Integer_Type
then
Result_Node := Parent (Scalar_Range (Result_Node));
end if;
Result_Unit := Get_Comp_Unit
(Standard_Id, Encl_Cont_Id (Reference_I));
else
if Result_Kind in Internal_Defining_Operator_Kinds and then
Is_Predefined (Result_Node)
then
null;
-- -- note, that Predefined_Operation corresponds to an
-- -- implicitly declared operation of a type, which is defined
-- -- not in the Standard package
-- Association_Type := Enclosed_Type (Result_Node);
-- -- we have to use namely Association_Type, but not Result_Node
-- -- to define Result_Unit, because sometimes Result_Node
-- -- does not have the Parent field set
-- Result_Unit :=
-- Enclosing_Unit (Encl_Cont_Id (Reference_I), Association_Type);
return Nil_Element;
-- ???!!! this turns off all the predefined operations
-- !!!??? defined not in Standard
elsif Is_Inherited then
Result_Unit :=
Enclosing_Unit (Encl_Cont_Id (Reference_I), Association_Type);
else
Result_Unit :=
Enclosing_Unit (Encl_Cont_Id (Reference_I), Result_Node);
end if;
end if;
if Is_Inherited
and then
(Ekind (Result_Node) = E_Component or else
Ekind (Result_Node) = E_Discriminant)
then
Componnet_Name := Result_Node;
end if;
-- A special case of fake Numeric_Error renaming is handled
-- separately (see B712-0050)
if Result_Node = Standard_Constraint_Error and then
Chars (Result_Node) /= Chars (Arg_Node)
then
Result := Get_Numeric_Error_Renaming;
Set_Int_Kind (Result, A_Defining_Identifier);
else
Result :=
Node_To_Element_New (Node => Result_Node,
Node_Field_1 => Association_Type,
Node_Field_2 => Componnet_Name,
Internal_Kind => Result_Kind,
Spec_Case => Spec_Case,
Inherited => Is_Inherited,
In_Unit => Result_Unit);
end if;
-- See the comment in the body of A4G.A_Sem.Get_Corr_Called_Entity
if Present (Association_Type) then
if Is_From_Instance (Association_Type) then
Set_From_Instance (Result, True);
else
Set_From_Instance (Result, False);
end if;
end if;
if Spec_Case = From_Limited_View then
Set_From_Implicit (Result, True);
end if;
return Result;
end Identifier_Name_Definition;
--------------------------------
-- Is_Explicit_Type_Component --
--------------------------------
function Is_Explicit_Type_Component
(Comp_Def_Name : Node_Id;
Type_Decl : Node_Id)
return Boolean
is
Result : Boolean := False;
Cont_Node : Node_Id;
begin
Cont_Node := Parent (Comp_Def_Name);
while Present (Cont_Node) loop
if Cont_Node = Type_Decl then
Result := True;
exit;
end if;
Cont_Node := Parent (Cont_Node);
end loop;
return Result;
end Is_Explicit_Type_Component;
------------------------------
-- Is_From_Dispatching_Call --
------------------------------
function Is_From_Dispatching_Call (Reference : Element) return Boolean is
Can_Be_Dynamically_Identified : Boolean := False;
Ref_Node : Node_Id;
Parent_Ref_Node : Node_Id;
Ref_Entity : Entity_Id;
Parent_Call : Node_Id := Empty;
Result : Boolean := False;
begin
Ref_Node := R_Node (Reference);
if not (Nkind (Ref_Node) = N_Identifier
or else
Nkind (Ref_Node) = N_Operator_Symbol)
then
return False;
end if;
Parent_Ref_Node := Parent (Ref_Node);
if Nkind (Parent_Ref_Node) = N_Expanded_Name
and then
Ref_Node = Selector_Name (Parent_Ref_Node)
then
Ref_Node := Parent (Ref_Node);
Parent_Ref_Node := Parent (Ref_Node);
end if;
-- First, detect if Reference indeed can be dynamically identified, that
-- is, it is either a subprogram name in a call or a formal parameter
-- name in a parameter association. Because of the performance reasons,
-- we do this on the tree structures, but not using ASIS queries
case Nkind (Parent_Ref_Node) is
when N_Parameter_Association =>
if Selector_Name (Parent_Ref_Node) = Ref_Node then
Can_Be_Dynamically_Identified := True;
end if;
when N_Procedure_Call_Statement |
N_Function_Call =>
if Sinfo.Name (Parent_Ref_Node) = Ref_Node then
Can_Be_Dynamically_Identified := True;
end if;
when others =>
null;
end case;
if Can_Be_Dynamically_Identified then
Ref_Entity := Entity (Ref_Node);
if No (Ref_Entity)
and then
Nkind (Parent (Ref_Node)) = N_Expanded_Name
and then
Ref_Node = Selector_Name (Parent (Ref_Node))
then
Ref_Node := Parent (Ref_Node);
Ref_Entity := Entity (Ref_Node);
end if;
if Present (Ref_Entity) then
case Ekind (Ref_Entity) is
when Formal_Kind =>
Parent_Call := Parent (Parent (Ref_Node));
when Subprogram_Kind =>
Parent_Call := Parent (Ref_Node);
when others =>
null;
end case;
end if;
if Present (Parent_Call)
and then
(Nkind (Parent_Call) = N_Procedure_Call_Statement
or else
Nkind (Parent_Call) = N_Function_Call)
and then
Present (Controlling_Argument (Parent_Call))
then
Result := True;
end if;
end if;
return Result;
end Is_From_Dispatching_Call;
----------------------------
-- Is_Implicit_Formal_Par --
----------------------------
function Is_Implicit_Formal_Par (Result_El : Element) return Boolean is
Result : Boolean := False;
Res_Node : constant Node_Id := Node (Result_El);
Parent_Node : Node_Id;
begin
if Nkind (Res_Node) in N_Entity
and then
Ekind (Res_Node) in Formal_Kind
then
Parent_Node := Parent (Res_Node);
if Present (Parent_Node)
and then
Nkind (Parent_Node) = N_Parameter_Specification
and then
Res_Node /= Defining_Identifier (Parent_Node)
then
-- The condition is no more than just a clue...
Result := True;
end if;
end if;
return Result;
end Is_Implicit_Formal_Par;
-----------------------
-- Is_Limited_Withed --
-----------------------
function Is_Limited_Withed
(E : Entity_Id;
Reference : Asis.Element)
return Boolean
is
Result : Boolean := False;
CU_E : Asis.Compilation_Unit;
CU_R : Asis.Compilation_Unit;
begin
CU_E := Enclosing_Unit (Encl_Cont_Id (Reference), E);
if Unit_Kind (CU_E) = A_Package then
CU_R := Enclosing_Compilation_Unit (Reference);
if not Is_Equal (CU_R, CU_E) then
declare
CU_E_Name : constant Program_Text :=
To_Upper_Case (Unit_Full_Name (CU_E));
Comp_Clauses : constant Asis.Element_List :=
Context_Clause_Elements (CU_R);
Name_List : Element_List_Access;
begin
for C in Comp_Clauses'Range loop
if Trait_Kind (Comp_Clauses (C)) in
A_Limited_Trait .. A_Limited_Private_Trait
then
Name_List :=
new Asis.Element_List'(Clause_Names (Comp_Clauses (C)));
for N in Name_List'Range loop
if To_Upper_Case (Full_Name_Image (Name_List (N))) =
CU_E_Name
then
Free (Name_List);
Result := True;
exit;
end if;
end loop;
Free (Name_List);
end if;
end loop;
end;
end if;
end if;
return Result;
end Is_Limited_Withed;
-----------------------------------
-- Is_Part_Of_Defining_Unit_Name --
-----------------------------------
function Is_Part_Of_Defining_Unit_Name
(Name_Node : Node_Id)
return Boolean
is
Result : Boolean := False;
Next_Node : Node_Id := Parent (Name_Node);
begin
while Present (Next_Node) loop
if Nkind (Next_Node) = N_Defining_Program_Unit_Name then
Result := True;
exit;
elsif not (Nkind (Next_Node) = N_Expanded_Name or else
Nkind (Next_Node) = N_Selected_Component)
then
-- theoretically, we need only the first part of the condition,
-- but the unit name in the body is not fully decorated and,
-- therefore, has the wrong syntax structure, so we need the
-- second part. We are keeping both in order to have the correct
-- code if it is changed in the tree.
exit;
else
Next_Node := Parent (Next_Node);
end if;
end loop;
return Result;
end Is_Part_Of_Defining_Unit_Name;
------------------
-- Is_Reference --
------------------
function Is_Reference
(Name : Asis.Element;
Ref : Asis.Element)
return Boolean
is
Ref_Kind : constant Internal_Element_Kinds := Reference_Kind (Name);
Result : Boolean := False;
begin
if Int_Kind (Ref) = Ref_Kind then
begin
if Is_Equal (Corresponding_Name_Definition (Ref), Name) then
Result := True;
end if;
exception
-- Corresponding_Name_Definition may raise Asis_Failed with
-- Value_Error status when applied to identifiers which
-- cannot have definitions (see section 17.6). Here we
-- have to skip such Elements paying no attention to
-- exception raising
when others => null;
end;
end if;
return Result;
end Is_Reference;
--------------------------
-- Is_Type_Discriminant --
--------------------------
function Is_Type_Discriminant
(Discr_Node : Node_Id;
Type_Node : Node_Id)
return Boolean
is
Discr_Chars : constant Name_Id := Chars (Discr_Node);
Discr_List : List_Id;
Next_Discr_Spec : Node_Id;
Result : Boolean := False;
begin
Discr_List := Discriminant_Specifications (Type_Node);
if Present (Discr_List) then
Next_Discr_Spec := First (Discr_List);
while Present (Next_Discr_Spec) loop
if Chars (Defining_Identifier (Next_Discr_Spec)) = Discr_Chars then
Result := True;
exit;
end if;
Next_Discr_Spec := Next (Next_Discr_Spec);
end loop;
end if;
return Result;
end Is_Type_Discriminant;
----------------
-- Needs_List --
----------------
function Needs_List (Reference : Asis.Element) return Boolean is
Result : Boolean := False;
N : Node_Id := R_Node (Reference);
Entity_N : Entity_Id;
Pragma_Name_Id : Name_Id;
begin
if Nkind (Parent (N)) = N_Pragma_Argument_Association then
Pragma_Name_Id := Pragma_Name (Parent (Parent (N)));
if Pragma_Name_Id = Name_Asynchronous or else
Pragma_Name_Id = Name_Convention or else
Pragma_Name_Id = Name_Export or else
Pragma_Name_Id = Name_Import or else
Pragma_Name_Id = Name_Inline
then
Entity_N := Entity (N);
if Present (Entity_N) and then
Is_Overloadable (Entity_N) and then
Has_Homonym (Entity_N)
then
-- ??? Is this the right condition???
-- ??? At the moment we do not consider any GNAT-specific
-- pragma
N := Homonym (Entity_N);
if Present (N)
and then
(not (Sloc (N) <= Standard_Location
-- !!! Note, that this check filters out the predefined
-- implicitly declared operations!!!
or else
Part_Of_Pass_Generic_Actual (N)
or else
(Ekind (N) in Subprogram_Kind and then
Is_Formal_Subprogram (N))))
then
Result := True;
end if;
end if;
end if;
end if;
return Result;
end Needs_List;
--------------------
-- Reference_Kind --
--------------------
function Reference_Kind
(Name : Asis.Element)
return Internal_Element_Kinds
is
Arg_Kind : Internal_Element_Kinds := Int_Kind (Name);
Result : Internal_Element_Kinds := Not_An_Element;
begin
if Arg_Kind in Internal_Defining_Name_Kinds then
if Arg_Kind = A_Defining_Expanded_Name then
Arg_Kind := Int_Kind (Defining_Selector (Name));
end if;
end if;
case Arg_Kind is
when A_Defining_Identifier =>
Result := An_Identifier;
when A_Defining_Character_Literal =>
Result := A_Character_Literal;
when A_Defining_Enumeration_Literal =>
Result := An_Enumeration_Literal;
when A_Defining_And_Operator =>
Result := An_And_Operator;
when A_Defining_Or_Operator =>
Result := An_Or_Operator;
when A_Defining_Xor_Operator =>
Result := An_Xor_Operator;
when A_Defining_Equal_Operator =>
Result := An_Equal_Operator;
when A_Defining_Not_Equal_Operator =>
Result := A_Not_Equal_Operator;
when A_Defining_Less_Than_Operator =>
Result := A_Less_Than_Operator;
when A_Defining_Less_Than_Or_Equal_Operator =>
Result := A_Less_Than_Or_Equal_Operator;
when A_Defining_Greater_Than_Operator =>
Result := A_Greater_Than_Operator;
when A_Defining_Greater_Than_Or_Equal_Operator =>
Result := A_Greater_Than_Or_Equal_Operator;
when A_Defining_Plus_Operator =>
Result := A_Plus_Operator;
when A_Defining_Minus_Operator =>
Result := A_Minus_Operator;
when A_Defining_Concatenate_Operator =>
Result := A_Concatenate_Operator;
when A_Defining_Unary_Plus_Operator =>
Result := A_Unary_Plus_Operator;
when A_Defining_Unary_Minus_Operator =>
Result := A_Unary_Minus_Operator;
when A_Defining_Multiply_Operator =>
Result := A_Multiply_Operator;
when A_Defining_Divide_Operator =>
Result := A_Divide_Operator;
when A_Defining_Mod_Operator =>
Result := A_Mod_Operator;
when A_Defining_Rem_Operator =>
Result := A_Rem_Operator;
when A_Defining_Exponentiate_Operator =>
Result := An_Exponentiate_Operator;
when A_Defining_Abs_Operator =>
Result := An_Abs_Operator;
when A_Defining_Not_Operator =>
Result := A_Not_Operator;
when others =>
null;
end case;
return Result;
end Reference_Kind;
------------------------
-- Reset_To_Full_View --
------------------------
function Reset_To_Full_View
(Full_View : Node_Id;
Discr : Node_Id)
return Node_Id
is
Result : Node_Id;
Discr_Chars : constant Name_Id := Chars (Discr);
begin
Result := First (Discriminant_Specifications (Full_View));
while Present (Result) loop
exit when Chars (Defining_Identifier (Result)) = Discr_Chars;
Result := Next (Result);
end loop;
pragma Assert (Present (Result));
Result := Defining_Identifier (Result);
return Result;
end Reset_To_Full_View;
-------------------
-- Reset_To_Spec --
-------------------
function Reset_To_Spec (Name_Node : Node_Id) return Node_Id is
Result : Node_Id := Empty;
Next_Node : Node_Id := Parent (Name_Node);
Name_Chars : constant Name_Id := Chars (Name_Node);
begin
while Nkind (Next_Node) /= N_Defining_Program_Unit_Name loop
Next_Node := Parent (Next_Node);
end loop;
if Nkind (Parent (Next_Node)) in N_Subprogram_Specification then
Next_Node := Parent (Next_Node);
end if;
Next_Node := Corresponding_Spec (Parent (Next_Node));
while Nkind (Next_Node) /= N_Defining_Program_Unit_Name loop
Next_Node := Parent (Next_Node);
end loop;
Next_Node := Parent (Next_Node);
Next_Node := Defining_Unit_Name (Next_Node);
-- Now Next_Node should point to the defining program unit name in the
-- spec:
Next_Node := Sinfo.Name (Next_Node);
while Present (Next_Node) loop
if Nkind (Next_Node) = N_Expanded_Name then
Next_Node := Selector_Name (Next_Node);
end if;
if Name_Chars = Chars (Next_Node) then
Result := Next_Node;
exit;
end if;
Next_Node := Parent (Next_Node);
if Nkind (Next_Node) = N_Expanded_Name then
Next_Node := Prefix (Next_Node);
else
exit;
end if;
end loop;
pragma Assert (Present (Result));
return Result;
end Reset_To_Spec;
---------------------
-- Rewritten_Image --
---------------------
function Rewritten_Image (Selector_Name : Node_Id) return Node_Id is
Name_Chars : constant Name_Id := Chars (Selector_Name);
Aggr_Node : Node_Id;
Result_Node : Node_Id := Empty;
Association_Node : Node_Id;
Choice_Node : Node_Id;
begin
-- may be, we have to be more smart for aggregates in aggregates...
Aggr_Node := Parent (Selector_Name);
-- we are in N_Component_Association node, and its Parent points not
-- to the original, but to the rewritten structure for aggregate
Aggr_Node := Parent (Aggr_Node);
-- we are in the rewritten node for the aggregate
pragma Assert (
(Nkind (Aggr_Node) = N_Aggregate or else
Nkind (Aggr_Node) = N_Extension_Aggregate)
and then
Is_Rewrite_Substitution (Aggr_Node));
-- and now - traversing the rewritten structure
Association_Node :=
First_Non_Pragma (Component_Associations (Aggr_Node));
Associations : while Present (Association_Node) loop
Choice_Node := First_Non_Pragma (Choices (Association_Node));
-- in the rewritten aggregate it is exactly one choice in any
-- component association
if Chars (Choice_Node) = Name_Chars then
Result_Node := Choice_Node;
exit Associations;
end if;
Association_Node := Next_Non_Pragma (Association_Node);
end loop Associations;
pragma Assert (Present (Result_Node));
return Result_Node;
end Rewritten_Image;
------------------------
-- Search_Record_Comp --
------------------------
function Search_Record_Comp (Selector_Name : Node_Id) return Entity_Id is
Result : Entity_Id := Empty;
Res_Chars : constant Name_Id := Chars (Selector_Name);
Aggr_Type : Entity_Id;
begin
Aggr_Type := Parent (Selector_Name);
while not (Nkind (Aggr_Type) = N_Extension_Aggregate
or else
Nkind (Aggr_Type) = N_Aggregate
or else
No (Aggr_Type))
loop
Aggr_Type := Parent (Aggr_Type);
end loop;
if No (Aggr_Type) then
-- This definitely means that something went wrong...
pragma Assert (False);
return Empty;
end if;
Aggr_Type := Etype (Aggr_Type);
while Ekind (Aggr_Type) /= E_Record_Type loop
if Ekind (Aggr_Type) = E_Private_Type
or else
Ekind (Aggr_Type) = E_Limited_Private_Type
or else
Ekind (Aggr_Type) = E_Record_Type_With_Private
then
Aggr_Type := Full_View (Aggr_Type);
else
Aggr_Type := Etype (Aggr_Type);
end if;
end loop;
Result := First_Entity (Aggr_Type);
while Chars (Result) /= Res_Chars loop
Result := Next_Entity (Result);
end loop;
pragma Assert (Present (Result));
return Result;
end Search_Record_Comp;
-------------------
-- To_Upper_Case --
-------------------
function To_Upper_Case (S : Wide_String) return Wide_String is
Result : Wide_String (S'Range);
begin
for J in Result'Range loop
Result (J) := Ada.Wide_Characters.Unicode.To_Upper_Case (S (J));
end loop;
return Result;
end To_Upper_Case;
end A4G.Expr_Sem;
|
stcarrez/ada-awa | Ada | 1,898 | ads | -----------------------------------------------------------------------
-- awa-sysadmin-modules -- Module sysadmin
-- 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 ASF.Applications;
with AWA.Modules;
private with Servlet.Core.Rest;
private with AWA.Sysadmin.Filters;
package AWA.Sysadmin.Modules is
-- The name under which the module is registered.
NAME : constant String := "sysadmin";
-- ------------------------------
-- Module sysadmin
-- ------------------------------
type Sysadmin_Module is new AWA.Modules.Module with private;
type Sysadmin_Module_Access is access all Sysadmin_Module'Class;
-- Initialize the sysadmin module.
overriding
procedure Initialize (Plugin : in out Sysadmin_Module;
App : in AWA.Modules.Application_Access;
Props : in ASF.Applications.Config);
-- Get the sysadmin module.
function Get_Sysadmin_Module return Sysadmin_Module_Access;
private
type Sysadmin_Module is new AWA.Modules.Module with record
API_Servlet : aliased Servlet.Core.Rest.Rest_Servlet;
API_Filter : aliased AWA.Sysadmin.Filters.Auth_Filter;
end record;
end AWA.Sysadmin.Modules;
|
onox/orka | Ada | 14,404 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2012 Felix Krause <[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 System;
with Interfaces.C.Pointers;
with Ada.Unchecked_Deallocation;
with GL.Low_Level.Enums;
with GL.Objects.Buffers;
with GL.Objects.Shaders;
with GL.Pixels.Extensions;
with GL.Types.Pointers;
package GL.Objects.Textures is
pragma Preelaborate;
package LE renames Low_Level.Enums;
package PE renames Pixels.Extensions;
use all type LE.Texture_Kind;
type Dimension_Count is (One, Two, Three);
function Get_Dimensions (Kind : LE.Texture_Kind) return Dimension_Count;
function Maximum_Anisotropy return Single
with Post => Maximum_Anisotropy'Result >= 16.0;
-----------------------------------------------------------------------------
-- Basic Types --
-----------------------------------------------------------------------------
-- Actual range is implementation-defined
--
-- - OpenGL 2.x: At least 2
-- - OpenGL 3.x: At least 48
-- - OpenGL 4.x: At least 80
subtype Texture_Unit is UInt;
subtype Image_Unit is UInt;
subtype Mipmap_Level is Size;
-----------------------------------------------------------------------------
-- Texture Objects --
-----------------------------------------------------------------------------
type Texture_Base (Kind : LE.Texture_Kind)
is abstract new GL_Object with private;
function Has_Levels (Object : Texture_Base) return Boolean is
(Object.Kind not in Texture_Buffer | Texture_Rectangle |
Texture_2D_Multisample | Texture_2D_Multisample_Array)
with Inline;
function Layered (Object : Texture_Base) return Boolean is
(Object.Kind in Texture_1D_Array | Texture_2D_Array | Texture_3D |
Texture_Cube_Map | Texture_Cube_Map_Array | Texture_2D_Multisample_Array)
with Inline;
overriding
procedure Initialize_Id (Object : in out Texture_Base);
overriding
procedure Delete_Id (Object : in out Texture_Base);
overriding
function Identifier (Object : Texture_Base) return Types.Debug.Identifier is
(Types.Debug.Texture);
procedure Invalidate_Image (Object : Texture_Base; Level : Mipmap_Level)
with Pre => (if not Object.Has_Levels then Level = 0);
procedure Invalidate_Sub_Image (Object : Texture_Base; Level : Mipmap_Level;
X, Y, Z : Int; Width, Height, Depth : Size)
with Pre => (if not Object.Has_Levels then Level = 0);
procedure Bind_Texture_Unit (Object : Texture_Base; Unit : Texture_Unit);
procedure Bind_Image_Texture (Object : Texture_Base; Unit : Image_Unit);
-----------------------------------------------------------------------------
type Texture is new Texture_Base with private;
function Dimensions (Object : Texture) return Dimension_Count;
function Allocated (Object : Texture) return Boolean;
procedure Clear_Using_Data
(Object : Texture; Level : Mipmap_Level;
Source_Format : Pixels.Format;
Source_Type : Pixels.Data_Type;
Source : System.Address)
with Pre => not Object.Compressed;
procedure Clear_Using_Zeros
(Object : Texture; Level : Mipmap_Level)
with Pre => not Object.Compressed;
procedure Generate_Mipmap (Object : Texture)
with Pre => Object.Has_Levels;
-----------------------------------------------------------------------------
generic
Kind : LE.Texture_Kind;
package Texture_Bindings is
type Texture_Array is array (Texture_Unit range <>) of Texture (Kind);
type Image_Array is array (Image_Unit range <>) of Texture (Kind);
procedure Bind_Textures (Textures : Texture_Array);
procedure Bind_Images (Images : Image_Array);
end Texture_Bindings;
-----------------------------------------------------------------------------
-- Texture Parameters --
-----------------------------------------------------------------------------
procedure Set_Lowest_Mipmap_Level (Object : Texture; Level : Mipmap_Level);
procedure Set_Highest_Mipmap_Level (Object : Texture; Level : Mipmap_Level);
function Lowest_Mipmap_Level (Object : Texture) return Mipmap_Level;
function Highest_Mipmap_Level (Object : Texture) return Mipmap_Level;
function Mipmap_Levels (Object : Texture) return Mipmap_Level
with Pre => Object.Allocated,
Post => Mipmap_Levels'Result >= 1;
-- TODO Add procedure Set_Texture_Mode (Mode : Depth (default) | Stencil)
-- (for Depth_Stencil textures)
-----------------------------------------------------------------------------
function Internal_Format (Object : Texture) return Pixels.Internal_Format
with Pre => Object.Allocated and not Object.Compressed;
function Compressed_Format (Object : Texture) return Pixels.Compressed_Format
with Pre => Object.Allocated and Object.Compressed;
function Compressed (Object : Texture) return Boolean;
function Samples (Object : Texture) return Size;
function Fixed_Sample_Locations (Object : Texture) return Boolean
with Pre => Object.Kind in Texture_2D_Multisample | Texture_2D_Multisample_Array;
-----------------------------------------------------------------------------
-- Texture Level Parameters --
-----------------------------------------------------------------------------
function Width (Object : Texture; Level : Mipmap_Level) return Size;
function Height (Object : Texture; Level : Mipmap_Level) return Size;
function Depth (Object : Texture; Level : Mipmap_Level) return Size;
function Compressed_Image_Size (Object : Texture; Level : Mipmap_Level) return Size
with Pre => Object.Compressed;
-----------------------------------------------------------------------------
-- Texture Units --
-----------------------------------------------------------------------------
function Texture_Unit_Count return Natural;
-- Return the maximum combined number of texture image units available
-- to all shaders
--
-- If a texture image unit is used by multiple shaders, each shader stage
-- is counted separately.
function Texture_Unit_Count (Shader : Shaders.Shader_Type) return Natural;
-- Return the maximum number of texture image units available for
-- the specified shader
-----------------------------------------------------------------------------
-- Buffer Texture Loading --
-----------------------------------------------------------------------------
type Buffer_Texture is new Texture_Base (Kind => Texture_Buffer) with private;
procedure Attach_Buffer (Object : Buffer_Texture;
Internal_Format : Pixels.Internal_Format_Buffer_Texture;
Buffer : Objects.Buffers.Buffer);
procedure Attach_Buffer (Object : Buffer_Texture;
Internal_Format : Pixels.Internal_Format_Buffer_Texture;
Buffer : Objects.Buffers.Buffer;
Offset, Size : Types.Size);
function Buffer_Offset (Object : Buffer_Texture) return Size;
function Buffer_Size (Object : Buffer_Texture) return Size;
-----------------------------------------------------------------------------
-- Texture Loading --
-----------------------------------------------------------------------------
procedure Allocate_Storage
(Object : in out Texture;
Levels, Samples : Types.Size;
Format : Pixels.Internal_Format;
Width, Height, Depth : Types.Size;
Fixed_Locations : Boolean := True)
with Pre => not Object.Allocated,
Post => Object.Allocated;
procedure Allocate_Storage
(Object : in out Texture;
Levels, Samples : Types.Size;
Format : Pixels.Compressed_Format;
Width, Height, Depth : Types.Size;
Fixed_Locations : Boolean := True)
with Pre => not Object.Allocated and Object.Kind /= Texture_Rectangle,
Post => Object.Allocated;
procedure Allocate_Storage
(Object : in out Texture;
Subject : Texture;
Fixed_Locations : Boolean := True)
with Pre => not Object.Allocated and Subject.Allocated,
Post => Object.Allocated;
-- Allocate storage using the same format, mipmap levels, samples, and
-- dimensions of the given texture
procedure Load_From_Data
(Object : Texture;
Level : Mipmap_Level;
X, Y, Z : Types.Size := 0;
Width, Height, Depth : Types.Positive_Size;
Source_Format : Pixels.Format;
Source_Type : Pixels.Data_Type;
Source : System.Address)
with Pre => Object.Allocated and not Object.Compressed;
-- Load data to allocated texture
--
-- Data is considered to be packed. When loading it to a texture,
-- it will be unpacked. Therefore, each row in bytes must be a multiple
-- of the current unpack alignment. Call Set_Unpack_Alignment if necessary.
procedure Load_From_Data
(Object : Texture;
Level : Mipmap_Level;
X, Y, Z : Types.Size := 0;
Width, Height, Depth : Types.Positive_Size;
Source_Format : Pixels.Compressed_Format;
Image_Size : Types.Size;
Source : System.Address)
with Pre => Object.Dimensions /= One and Object.Allocated and Object.Compressed;
procedure Copy_Data
(Object : Texture;
Subject : Texture;
Source_Level, Target_Level : Mipmap_Level)
with Pre => Object.Allocated and Subject.Allocated;
procedure Copy_Sub_Data
(Object : Texture;
Subject : Texture;
Source_Level, Target_Level : Mipmap_Level;
Source_X, Source_Y, Source_Z : Types.Size := 0;
Target_X, Target_Y, Target_Z : Types.Size := 0;
Width, Height, Depth : Types.Size)
with Pre => Object.Allocated and Subject.Allocated;
procedure Clear_Using_Data
(Object : Texture;
Level : Mipmap_Level;
X, Y, Z : Types.Size := 0;
Width, Height, Depth : Types.Positive_Size;
Source_Format : Pixels.Format;
Source_Type : Pixels.Data_Type;
Source : System.Address)
with Pre => not Object.Compressed;
procedure Clear_Using_Zeros
(Object : Texture;
Level : Mipmap_Level;
X, Y, Z : Types.Size := 0;
Width, Height, Depth : Types.Positive_Size)
with Pre => not Object.Compressed;
-----------------------------------------------------------------------------
function Get_Compressed_Data
(Object : Texture;
Level : Mipmap_Level;
X, Y, Z : Types.Size := 0;
Width, Height, Depth : Types.Positive_Size;
Format : Pixels.Compressed_Format) return not null Types.Pointers.UByte_Array_Access
with Pre => Object.Dimensions /= One and Object.Allocated and Object.Compressed
and Object.Kind not in Texture_2D_Multisample | Texture_2D_Multisample_Array;
generic
with package Pointers is new Interfaces.C.Pointers (<>);
package Texture_Pointers is
type Element_Array_Access is access Pointers.Element_Array;
procedure Free is new Ada.Unchecked_Deallocation
(Object => Pointers.Element_Array, Name => Element_Array_Access);
function Get_Data
(Object : Texture;
Level : Mipmap_Level;
X, Y, Z : Types.Size := 0;
Width, Height, Depth : Types.Positive_Size;
Format : Pixels.Format;
Data_Type : PE.Non_Packed_Data_Type) return not null Element_Array_Access
with Pre => Object.Allocated and
not Object.Compressed and PE.Compatible (Format, Data_Type);
end Texture_Pointers;
-----------------------------------------------------------------------------
-- Texture Views --
-----------------------------------------------------------------------------
function Create_View
(Object : Texture;
Kind : LE.Texture_Kind;
Format : Pixels.Internal_Format;
Min_Level, Levels : Mipmap_Level;
Min_Layer, Layers : Size) return Texture
with Pre => Object.Allocated;
-- Create a Texture object that shares some of the original texture's data
--
-- The format and kind must be compatible with the original texture. See
-- the OpenGL documentation.
function Create_View
(Object : Texture;
Kind : LE.Texture_Kind;
Format : Pixels.Compressed_Format;
Min_Level, Levels : Mipmap_Level;
Min_Layer, Layers : Size) return Texture
with Pre => Object.Allocated;
-- Create a Texture object that shares some of the original texture's data
--
-- The format and kind must be compatible with the original texture. See
-- the OpenGL documentation.
function Create_View
(Object : Texture;
Kind : LE.Texture_Kind;
Layer : Size) return Texture
with Pre => Object.Allocated and Object.Layered;
-- Create a Texture object that shares one layer or six layer-faces
-- of the original texture's data
private
type Texture_Base (Kind : LE.Texture_Kind)
is new GL_Object with null record;
type Texture is new Texture_Base with record
Allocated : Boolean := False;
Dimensions : Dimension_Count := Get_Dimensions (Texture.Kind);
end record;
type Buffer_Texture is new Texture_Base (Kind => Texture_Buffer) with null record;
end GL.Objects.Textures;
|
jhumphry/PRNG_Zoo | Ada | 1,481 | adb | --
-- PRNG Zoo
-- Copyright (c) 2014 - 2015, James Humphry
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-- PERFORMANCE OF THIS SOFTWARE.
package body PRNG_Zoo.xorshift_plus is
-----------
-- Reset --
-----------
procedure Reset (G: in out xorshift128_plus; S: in U64) is
begin
-- This is an ad-hoc expedient for now.
G.s0 := S;
G.s1 := (not S) xor Shift_Left(S, 17) xor Shift_Right(S, 23);
end Reset;
--------------
-- Generate --
--------------
function Generate (G: in out xorshift128_plus) return U64 is
t0: constant U64 := G.s1;
t1: U64 := G.s0;
begin
G.s0 := t0;
t1 := t1 xor Shift_Left(t1, 23);
G.s1 := (t1 xor t0 xor Shift_Right(t1, 17) xor Shift_Right(t0, 23));
return G.s1 + t0;
end Generate;
end PRNG_Zoo.xorshift_plus;
|
rveenker/sdlada | Ada | 8,440 | ads | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
-- SDL.Video.Windows
--
-- Operating system window access and control.
--------------------------------------------------------------------------------------------------------------------
with Ada.Finalization;
with Ada.Strings.UTF_Encoding;
private with SDL.C_Pointers;
with SDL.Video.Displays;
with SDL.Video.Pixel_Formats;
with SDL.Video.Rectangles;
with SDL.Video.Surfaces;
with System;
package SDL.Video.Windows is
Window_Error : exception;
-- Return a special coordinate value to indicate that you don't care what
-- the window position is. Note that you can still specify a target
-- display.
function Undefined_Window_Position
(Display : Natural := 0) return SDL.Natural_Coordinate;
-- Return a special coordinate value to indicate that the window position
-- should be centered.
function Centered_Window_Position
(Display : Natural := 0) return SDL.Natural_Coordinate;
type Window_Flags is mod 2 ** 32 with
Convention => C;
Windowed : constant Window_Flags := 16#0000_0000#;
Full_Screen : constant Window_Flags := 16#0000_0001#;
OpenGL : constant Window_Flags := 16#0000_0002#;
Shown : constant Window_Flags := 16#0000_0004#;
Hidden : constant Window_Flags := 16#0000_0008#;
Borderless : constant Window_Flags := 16#0000_0010#;
Resizable : constant Window_Flags := 16#0000_0020#;
Minimised : constant Window_Flags := 16#0000_0040#;
Maximised : constant Window_Flags := 16#0000_0080#;
Input_Grabbed : constant Window_Flags := 16#0000_0100#;
Input_Focus : constant Window_Flags := 16#0000_0200#;
Mouse_Focus : constant Window_Flags := 16#0000_0400#;
Full_Screen_Desktop : constant Window_Flags := Full_Screen or 16#0000_1000#;
Foreign : constant Window_Flags := 16#0000_0800#; -- TODO: Not implemented yet.
-- TODO: This isn't raising any exception when I pass a different value for some reason.
subtype Full_Screen_Flags is Window_Flags with
Static_Predicate => Full_Screen_Flags in Windowed | Full_Screen | Full_Screen_Desktop;
type ID is mod 2 ** 32 with
Convention => C;
type Native_Window is private;
-- Allow users to derive new types from this.
type User_Data is tagged private;
type User_Data_Access is access all User_Data'Class;
pragma No_Strict_Aliasing (User_Data_Access);
-- TODO: Check this type!
type Brightness is digits 3 range 0.0 .. 1.0;
-- type Window is tagged limited Private;
type Window is new Ada.Finalization.Limited_Controlled with private;
Null_Window : constant Window;
-- TODO: Normalise the API by adding a destroy sub program and making this one call destroy,
-- see textures for more info.
overriding
procedure Finalize (Self : in out Window);
function Get_Brightness (Self : in Window) return Brightness with
Inline => True;
procedure Set_Brightness (Self : in out Window; How_Bright : in Brightness);
function Get_Data (Self : in Window; Name : in String) return User_Data_Access;
function Set_Data (Self : in out Window; Name : in String; Item : in User_Data_Access) return User_Data_Access;
function Display_Index (Self : in Window) return SDL.Video.Displays.Display_Indices;
procedure Get_Display_Mode (Self : in Window; Mode : out SDL.Video.Displays.Mode);
procedure Set_Display_Mode (Self : in out Window; Mode : in SDL.Video.Displays.Mode);
function Get_Flags (Self : in Window) return Window_Flags;
function From_ID (Window_ID : in ID) return Window;
-- Support for MS Windows handles
function From_Hwnd (Hwnd : Long_Integer) return Native_Window;
procedure Get_Gamma_Ramp (Self : in Window; Red, Green, Blue : out SDL.Video.Pixel_Formats.Gamma_Ramp);
procedure Set_Gamma_Ramp (Self : in out Window; Red, Green, Blue : in SDL.Video.Pixel_Formats.Gamma_Ramp);
function Is_Grabbed (Self : in Window) return Boolean with
Inline => True;
procedure Set_Grabbed (Self : in out Window; Grabbed : in Boolean := True) with
Inline => True;
function Get_ID (Self : in Window) return ID with
Inline => True;
function Get_Maximum_Size (Self : in Window) return SDL.Sizes;
procedure Set_Maximum_Size (Self : in out Window; Size : in SDL.Sizes) with
Inline => True;
function Get_Minimum_Size (Self : in Window) return SDL.Sizes;
procedure Set_Minimum_Size (Self : in out Window; Size : in SDL.Sizes) with
Inline => True;
function Pixel_Format (Self : in Window) return SDL.Video.Pixel_Formats.Pixel_Format with
Inline => True;
function Get_Position (Self : in Window) return SDL.Natural_Coordinates;
procedure Set_Position (Self : in out Window; Position : SDL.Natural_Coordinates) with
Inline => True;
function Get_Size (Self : in Window) return SDL.Sizes;
procedure Set_Size (Self : in out Window; Size : in SDL.Sizes) with
Inline => True;
function Get_Surface (Self : in Window) return SDL.Video.Surfaces.Surface;
function Get_Title (Self : in Window) return Ada.Strings.UTF_Encoding.UTF_8_String;
procedure Set_Title (Self : in Window; Title : in Ada.Strings.UTF_Encoding.UTF_8_String);
-- SDL_GetWindowWMInfo
procedure Hide (Self : in Window) with
Inline => True;
procedure Show (Self : in Window) with
Inline => True;
procedure Maximise (Self : in Window) with
Inline => True;
procedure Minimise (Self : in Window) with
Inline => True;
procedure Raise_And_Focus (Self : in Window) with
Inline => True;
procedure Restore (Self : in Window) with
Inline => True;
procedure Set_Mode (Self : in out Window; Flags : in Full_Screen_Flags);
procedure Set_Icon (Self : in out Window; Icon : in SDL.Video.Surfaces.Surface) with
Inline => True;
procedure Update_Surface (Self : in Window);
procedure Update_Surface_Rectangle (Self : in Window; Rectangle : in SDL.Video.Rectangles.Rectangle);
procedure Update_Surface_Rectangles (Self : in Window; Rectangles : in SDL.Video.Rectangles.Rectangle_Arrays);
-- Determine whether any windows have been created.
function Exist return Boolean with
Inline => True;
private
-- TODO: Make this a proper type.
type Native_Window is new System.Address;
type User_Data is new Ada.Finalization.Controlled with null record;
type Window is new Ada.Finalization.Limited_Controlled with
record
Internal : SDL.C_Pointers.Windows_Pointer := null; -- System.Address := System.Null_Address;
Owns : Boolean := True; -- Does this Window type own the Internal data?
end record;
function Get_Internal_Window (Self : in Window) return SDL.C_Pointers.Windows_Pointer with
Export => True,
Convention => Ada;
Null_Window : constant Window := (Ada.Finalization.Limited_Controlled with
Internal => null, -- System.Null_Address,
Owns => True);
Total_Windows_Created : Natural := Natural'First;
procedure Increment_Windows;
procedure Decrement_Windows;
end SDL.Video.Windows;
|
wiremoons/AdbT | Ada | 7,144 | adb | -------------------------------------------------------------------------------
-- Package : Show_Version --
-- Description : Display current program version and build info. --
-- Author : Simon Rowe <[email protected]> --
-- License : MIT Open Source. --
-------------------------------------------------------------------------------
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Strings.Maps; use Ada.Strings.Maps;
with Ada.Text_IO.Unbounded_IO; use Ada.Text_IO.Unbounded_IO;
with Ada.Directories;
with Ada.IO_Exceptions;
with Ada.Strings.Fixed;
with Ada.Command_Line;
with GNAT.Source_Info;
with GNAT.Compiler_Version;
with System.Multiprocessors;
package body Show_Version is
package CVer is new GNAT.Compiler_Version;
-- Linux distros using 'systemd' are required to have the file:
OS_Release_File : constant String := "/etc/os-release";
F : File_Type;
-- SET APPLICATION VERSION TO DISPLAY BELOW --
AppVersion : constant String := "0.1.2";
procedure Set_Debug (Is_Debug : in out Boolean) is
--------------------------------------
-- Set if in debug build
--------------------------------------
begin
-- Only gets called if program is compiled as a 'debug' build
-- so variable only set 'true' if this is the case
Is_Debug := True;
end Set_Debug;
function Is_Linux return Boolean is
---------------------------------------
-- Check if the OS is a Linux distro
---------------------------------------
begin
if Ada.Directories.Exists (OS_Release_File) then
return True;
else
return False;
end if;
end Is_Linux;
function Is_Windows return Boolean is
---------------------------------------
-- Check if the OS is Windows
---------------------------------------
begin
if Ada.Directories.Exists ("c:\windows") then
return True;
else
return False;
end if;
end Is_Windows;
procedure Clean_Pretty_Name (OS_Name : in out Unbounded_String) is
-----------------------------------------------
-- Clean up the 'PRETTY_NAME' and extract text
-----------------------------------------------
-- Expects the line of text in the format:
-- PRETTY_NAME="Ubuntu 20.04.1 LTS"
--
-- Delete all leading text up to and including '=' leaving:
-- "Ubuntu 20.04.1 LTS"
--
-- This is then further cleaned up to remove both '"' characters which
-- are defined in the 'Quote_Char' Character_Set. The cleaned up text is
-- modified in place using the provided Unbounded.String resulting in a
-- final string of (or equivalent for other PRETTY_NAME entries):
-- Ubuntu 20.04.1 LTS
Quote_Char : constant Character_Set := To_Set ('"'); --\""
begin
if Length (OS_Name) > 0 then
-- delete up to (and including) character '=' in string
Delete (OS_Name, 1, Index (OS_Name, "="));
-- trim off quotes
Trim (OS_Name, Quote_Char, Quote_Char);
end if;
end Clean_Pretty_Name;
function Get_Linux_OS return String is
----------------------------------------
-- Get the OS Linux distro 'PRETTY_NAME'
----------------------------------------
-- Linux systems running 'systemd' should include a file:
-- /etc/os-release
--
-- This file includes many entries but should have the line:
-- PRETTY_NAME="Ubuntu 20.04.1 LTS"
-- The file is opened and read until the above line is located. The
-- line is then cleaned up in the procedure 'Clean_Pretty_Name'. The
-- remaining text should jus be:
-- Ubuntu 20.04.1 LTS
-- that is returned as a String.
OS_Name : Unbounded_String := Null_Unbounded_String;
begin
if Ada.Directories.Exists (OS_Release_File) then
Open (F, In_File, OS_Release_File);
while not End_Of_File (F) loop
declare
Line : constant String := Get_Line (F);
begin
if Ada.Strings.Fixed.Count (Line, "PRETTY_NAME") > 0 then
-- get the identified line from the file
OS_Name := To_Unbounded_String (Line);
pragma Debug (New_Line (Standard_Error, 1));
pragma Debug (Put_Line (Standard_Error, "DEBUG: Unmodified: " & OS_Name));
-- extract the part required
Clean_Pretty_Name (OS_Name);
pragma Debug (Put_Line (Standard_Error, "DEBUG: Cleaned up: " & OS_Name));
end if;
end;
end loop;
-- return the extracted distro text
return To_String (OS_Name);
else
New_Line (2);
Put_Line (Standard_Error, "ERROR: unable to locate file:");
Put_Line (Standard_Error, " - " & OS_Release_File);
New_Line (1);
return "UNKNOWN LINUX OS";
end if;
exception
when Ada.IO_Exceptions.Name_Error =>
New_Line (2);
Put_Line (Standard_Error, "ERROR: file not found exception!");
return "UNKNOWN LINUX OS";
when others =>
New_Line (2);
Put_Line (Standard_Error, "ERROR: unknown exception!");
return "UNKNOWN LINUX OS";
end Get_Linux_OS;
procedure Show is
-------------------------------------------
-- Collect and display version information
-------------------------------------------
Is_Debug : Boolean := False;
begin
-- only gets called if complied with: '-gnata'
pragma Debug (Set_Debug (Is_Debug));
pragma Debug (Put_Line (Standard_Error, "DEBUG: 'Show_Version' is running in debug mode."));
-- start output of version information
New_Line (1);
Put ("'");
Put (Ada.Directories.Simple_Name (Ada.Command_Line.Command_Name));
Put ("' is version: '");
Put (AppVersion);
Put ("' running on: '");
if Is_Linux then
Put (Get_Linux_OS);
elsif Is_Windows then
Put ("Windows");
else
Put ("UNKNOWN OS");
end if;
Put ("' with");
Put (System.Multiprocessors.Number_Of_CPUs'Image);
Put_Line (" CPU cores.");
Put ("Compiled on: ");
Put (GNAT.Source_Info.Compilation_ISO_Date);
Put (" @ ");
Put (GNAT.Source_Info.Compilation_Time);
Put_Line (".");
Put_Line ("Copyright (c) 2021 Simon Rowe.");
New_Line (1);
Put ("Ada source built as '");
if Is_Debug then
Put ("debug");
else
Put ("release");
end if;
Put ("' using GNAT complier version: '");
Put (CVer.Version);
Put_Line ("'.");
New_Line (1);
Put_Line ("For licenses and further information visit:");
Put_Line (" - https://github.com/wiremoons/AdbT/");
New_Line (1);
end Show;
end Show_Version;
|
AdaCore/libadalang | Ada | 265 | adb | procedure Testcase is
function Foo return Integer is (12);
function Foo return Boolean is (True);
A : Integer := 15;
B : Float;
begin
A := (case A is
when 12 | 13 => A,
when 15 | 17 => Foo);
pragma Test_Statement;
end Testcase;
|
reznikmm/matreshka | Ada | 4,211 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
limited with AMF.UML.Messages;
package AMF.Utp.Time_Out_Messages is
pragma Preelaborate;
type Utp_Time_Out_Message is limited interface;
type Utp_Time_Out_Message_Access is
access all Utp_Time_Out_Message'Class;
for Utp_Time_Out_Message_Access'Storage_Size use 0;
not overriding function Get_Base_Message
(Self : not null access constant Utp_Time_Out_Message)
return AMF.UML.Messages.UML_Message_Access is abstract;
-- Getter of TimeOutMessage::base_Message.
--
not overriding procedure Set_Base_Message
(Self : not null access Utp_Time_Out_Message;
To : AMF.UML.Messages.UML_Message_Access) is abstract;
-- Setter of TimeOutMessage::base_Message.
--
end AMF.Utp.Time_Out_Messages;
|
zhmu/ananas | Ada | 9,051 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 3 0 --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- 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_Elements;
with System.Unsigned_Types;
package body System.Pack_30 is
subtype Bit_Order is System.Bit_Order;
Reverse_Bit_Order : constant Bit_Order :=
Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
subtype Ofs is System.Storage_Elements.Storage_Offset;
subtype Uns is System.Unsigned_Types.Unsigned;
subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
use type System.Storage_Elements.Storage_Offset;
use type System.Unsigned_Types.Unsigned;
type Cluster is record
E0, E1, E2, E3, E4, E5, E6, E7 : Bits_30;
end record;
for Cluster use record
E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
end record;
for Cluster'Size use Bits * 8;
for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
1 +
1 * Boolean'Pos (Bits mod 2 = 0) +
2 * Boolean'Pos (Bits mod 4 = 0));
-- Use maximum possible alignment, given the bit field size, since this
-- will result in the most efficient code possible for the field.
type Cluster_Ref is access Cluster;
type Rev_Cluster is new Cluster
with Bit_Order => Reverse_Bit_Order,
Scalar_Storage_Order => Reverse_Bit_Order;
type Rev_Cluster_Ref is access Rev_Cluster;
-- The following declarations are for the case where the address
-- passed to GetU_30 or SetU_30 is not guaranteed to be aligned.
-- These routines are used when the packed array is itself a
-- component of a packed record, and therefore may not be aligned.
type ClusterU is new Cluster;
for ClusterU'Alignment use 1;
type ClusterU_Ref is access ClusterU;
type Rev_ClusterU is new ClusterU
with Bit_Order => Reverse_Bit_Order,
Scalar_Storage_Order => Reverse_Bit_Order;
type Rev_ClusterU_Ref is access Rev_ClusterU;
------------
-- Get_30 --
------------
function Get_30
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_30
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => return RC.E0;
when 1 => return RC.E1;
when 2 => return RC.E2;
when 3 => return RC.E3;
when 4 => return RC.E4;
when 5 => return RC.E5;
when 6 => return RC.E6;
when 7 => return RC.E7;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end if;
end Get_30;
-------------
-- GetU_30 --
-------------
function GetU_30
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_30
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : ClusterU_Ref with Address => A'Address, Import;
RC : Rev_ClusterU_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => return RC.E0;
when 1 => return RC.E1;
when 2 => return RC.E2;
when 3 => return RC.E3;
when 4 => return RC.E4;
when 5 => return RC.E5;
when 6 => return RC.E6;
when 7 => return RC.E7;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end if;
end GetU_30;
------------
-- Set_30 --
------------
procedure Set_30
(Arr : System.Address;
N : Natural;
E : Bits_30;
Rev_SSO : Boolean)
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => RC.E0 := E;
when 1 => RC.E1 := E;
when 2 => RC.E2 := E;
when 3 => RC.E3 := E;
when 4 => RC.E4 := E;
when 5 => RC.E5 := E;
when 6 => RC.E6 := E;
when 7 => RC.E7 := E;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end if;
end Set_30;
-------------
-- SetU_30 --
-------------
procedure SetU_30
(Arr : System.Address;
N : Natural;
E : Bits_30;
Rev_SSO : Boolean)
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : ClusterU_Ref with Address => A'Address, Import;
RC : Rev_ClusterU_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => RC.E0 := E;
when 1 => RC.E1 := E;
when 2 => RC.E2 := E;
when 3 => RC.E3 := E;
when 4 => RC.E4 := E;
when 5 => RC.E5 := E;
when 6 => RC.E6 := E;
when 7 => RC.E7 := E;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end if;
end SetU_30;
end System.Pack_30;
|
reznikmm/matreshka | Ada | 2,833 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010 Vadim Godunko <[email protected]> --
-- --
-- Matreshka 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. Matreshka is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received a copy of the --
-- GNU General Public License distributed with Matreshka; see file COPYING. --
-- If not, write to the Free Software Foundation, 51 Franklin Street, --
-- Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
package Matreshka.Internals.Regexps.Engine.Backtrack is
function Execute
(Program : Instruction_Array;
String : not null Matreshka.Internals.Strings.Shared_String_Access)
return not null Shared_Match_Access;
end Matreshka.Internals.Regexps.Engine.Backtrack;
|
reznikmm/matreshka | Ada | 1,310 | ads | with Types.Conventions;
with Types.Parameter_Specifications;
package Types.Profiles is
pragma Preelaborate;
type Profile is limited interface;
type Profile_Access is access all Profile'Class
with Storage_Size => 0;
not overriding function Parameters
(Self : Profile)
return Parameter_Specifications.Parameter_Specification_Access_Array
is abstract;
not overriding function Return_Type
(Self : Profile) return Types.Type_Access is abstract;
not overriding function Calling_Convention
(Self : Profile) return Types.Conventions.Convention_Access is abstract;
not overriding function Are_Type_Conformant
(Self : Profile;
Value : access Profile'Class) return Boolean is abstract;
not overriding function Are_Mode_Conformant
(Self : Profile;
Value : access Profile'Class) return Boolean is abstract;
-- not overriding function Are_Subtype_Conformant
-- (Self : Profile;
-- Value : Profile'Class) return Boolean is abstract;
-- XXX We will use this when subtype information is implemented
-- not overriding function Are_Fully_Conformant
-- (Self : Profile;
-- Value : Profile'Class) return Boolean is abstract;
-- XXX We will use this when subtype information is implemented
end Types.Profiles;
|
sungyeon/drake | Ada | 5,136 | adb | with Ada.Text_IO.Formatting;
with System.Formatting.Float;
with System.Formatting.Literals.Float;
package body Ada.Text_IO.Float_IO is
procedure Put_To_Field (
To : out String;
Fore_Last, Last : out Natural;
Item : Num;
Aft : Field;
Exp : Field);
procedure Put_To_Field (
To : out String;
Fore_Last, Last : out Natural;
Item : Num;
Aft : Field;
Exp : Field)
is
Triming_Sign_Marks : constant System.Formatting.Sign_Marks :=
('-', System.Formatting.No_Sign, System.Formatting.No_Sign);
Aft_Width : constant Field := Field'Max (1, Aft);
begin
if Exp /= 0 then
System.Formatting.Float.Image (
Long_Long_Float (Item),
To,
Fore_Last,
Last,
Signs => Triming_Sign_Marks,
Aft_Width => Aft_Width,
Exponent_Digits_Width => Exp - 1); -- excluding '.'
else
System.Formatting.Float.Image_No_Exponent (
Long_Long_Float (Item),
To,
Fore_Last,
Last,
Signs => Triming_Sign_Marks,
Aft_Width => Aft_Width);
end if;
end Put_To_Field;
procedure Get_From_Field (
From : String;
Item : out Num;
Last : out Positive);
procedure Get_From_Field (
From : String;
Item : out Num;
Last : out Positive)
is
Base_Item : Long_Long_Float;
Error : Boolean;
begin
System.Formatting.Literals.Float.Get_Literal (
From,
Last,
Base_Item,
Error => Error);
if Error
or else Base_Item not in
Long_Long_Float (Num'First) .. Long_Long_Float (Num'Last)
then
raise Data_Error;
end if;
Item := Num (Base_Item);
end Get_From_Field;
-- implementation
procedure Get (
File : File_Type;
Item : out Num;
Width : Field := 0) is
begin
if Width /= 0 then
declare
S : String (1 .. Width);
Last_1 : Natural;
Last_2 : Natural;
begin
Formatting.Get_Field (File, S, Last_1); -- checking the predicate
Get_From_Field (S (1 .. Last_1), Item, Last_2);
if Last_2 /= Last_1 then
raise Data_Error;
end if;
end;
else
declare
S : constant String :=
Formatting.Get_Numeric_Literal (
File, -- checking the predicate
Real => True);
Last : Natural;
begin
Get_From_Field (S, Item, Last);
if Last /= S'Last then
raise Data_Error;
end if;
end;
end if;
end Get;
procedure Get (
Item : out Num;
Width : Field := 0) is
begin
Get (Current_Input.all, Item, Width);
end Get;
procedure Get (
File : not null File_Access;
Item : out Num;
Width : Field := 0) is
begin
Get (File.all, Item, Width);
end Get;
procedure Put (
File : File_Type;
Item : Num;
Fore : Field := Default_Fore;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp)
is
S : String (1 .. Long_Long_Float'Width + Fore + Aft + Exp);
Fore_Last, Last : Natural;
Width : Field;
begin
Put_To_Field (S, Fore_Last, Last, Item, Aft, Exp);
if Fore_Last = Last then
-- infinity or NaN, reserve a minimum width
Width := Fore + 1 + Aft;
if Exp /= 0 then
Width := Width + 1 + Exp;
end if;
else
Width := Last - Fore_Last + Fore;
end if;
Formatting.Tail (
File, -- checking the predicate
S (1 .. Last),
Width);
end Put;
procedure Put (
Item : Num;
Fore : Field := Default_Fore;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp) is
begin
Put (Current_Output.all, Item, Fore, Aft, Exp);
end Put;
procedure Put (
File : not null File_Access;
Item : Num;
Fore : Field := Default_Fore;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp) is
begin
Put (File.all, Item, Fore, Aft, Exp);
end Put;
procedure Get (
From : String;
Item : out Num;
Last : out Positive) is
begin
Formatting.Get_Tail (From, First => Last);
Get_From_Field (From (Last .. From'Last), Item, Last);
end Get;
procedure Put (
To : out String;
Item : Num;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp)
is
S : String (1 .. Long_Long_Float'Width + Aft + Exp);
Fore_Last, Last : Natural;
begin
Put_To_Field (S, Fore_Last, Last, Item, Aft, Exp);
Formatting.Tail (To, S (1 .. Last));
end Put;
procedure Put (
To : out String;
Last : out Natural;
Item : Num;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp)
is
Fore_Last : Natural;
begin
Put_To_Field (To, Fore_Last, Last, Item, Aft, Exp);
end Put;
end Ada.Text_IO.Float_IO;
|
annexi-strayline/AURA | Ada | 8,379 | ads | ------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- ANNEXI-STRAYLINE Reference Implementation --
-- --
-- Core --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2019-2023, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- The Registration package provides the interfaces for the submission of
-- requests that modify or add to the Registry (All_Subsystems or
-- All_Library_Units)
with Ada.Directories;
with Progress;
with Unit_Names;
with Registrar.Subsystems;
with Registrar.Library_Units;
package Registrar.Registration is
----------------
-- Unit Entry --
----------------
-- Unit entry takes the Directory_Entry of a source file (library unit),
-- or and takes the one of following actions:
--
-- A. If the unit's file name ends in .ads or .adb, it is processed as
-- follows:
-- 1. All "with" statments are analyzed and the relevent units are
-- requested (including subsystems)
-- 2. All "pragma External_With" statements are analyzed, and the
-- relevant non-ada source file is requested
-- 3. The unit's unit name and subsystem is extracted and registered
--
-- B. If the unit's file name has any other extention, it is registered as
-- a non-ada unit, to be potentially included by an External_With pragma
-- Unit entries are processed asynchronously by the Worker tasks.
procedure Enter_Unit (File: in Ada.Directories.Directory_Entry_Type);
-- Enter a project (non-AURA) source file.
procedure Enter_Unit
(File : in Ada.Directories.Directory_Entry_Type;
AURA_Subsystem: in Subsystems.Subsystem);
-- Enters an unit that is expected to be part of an AURA subsystem,
-- typically through aquisition.
--
-- The AURA Subsystem must be first registered with Enter_AURA_Subsystem
-- below, and the unit must then be a member of that Subsystem.
--
-- For External_With pragmas, the withed external unit is taken to be
-- part of AURA_Subsystem, and thus is requested as Subsystem.Name%file.ext
--
-- All non-ada units are registered as part of AURA_Subsystem, and thus
-- are registered as Subsystem.Name%file.ext
procedure Enter_Root;
-- Iterates through the root (current) directory, and dispatches to
-- Enter_Unit for each recognized source file type
procedure Enter_All_AURA;
-- Iterates through the "aura" subdirectory of the root directory, and
-- dispatches to Enter_Unit for each recognized source file type.
--
-- This behaves similar to Root, as it is not explicitly registered as
-- an "aura" subsystem like is requred for Enter_Directory.
--
-- The 'aura' subdirectory is expected to exist. This is normally handled
-- by the Scheduling subsystem.
use type Ada.Directories.File_Kind;
procedure Enter_Directory
(Directory : in Ada.Directories.Directory_Entry_Type;
AURA_Subsystem: in Subsystems.Subsystem)
with Pre => Ada.Directories.Kind (Directory) = Ada.Directories.Directory;
-- Iterates through a directory (not including subdirectories), and invokes
-- Enter_Unit on each recognized source file type
-- Progress Trackers --
-----------------------
Entry_Progress: aliased Progress.Progress_Tracker;
-- Tracks the total amount of work orders handled by the entire entry
-- process. This tracker is not reset by the registrar. Waiting on
-- completion of this tracker after making an entry submission indicates
-- that the work associated with that entry is complete
------------------------
-- Non-entry Services --
------------------------
procedure Request_AURA_Subsystem (Name: in Unit_Names.Unit_Name;
OK : out Boolean);
-- Specifically requests a particular AURA subsystem (derrived from the
-- subsystem name of Name)
--
-- If that subsystem is already registered a check is made that the existing
-- subsystem is also an AURA subsystem. If that check fails, OK is set to
-- False.
--
-- If the subsystem is succuessfully requested, or it is already entered and
-- also an AURA subsystem, then OK is True
--
-- This subprogram is primarily used by the CLI driver to allow the user to
-- explicitly checkout subsystems
procedure Update_Subsystem (Update: in Subsystems.Subsystem);
-- Updates (replaces) an existing Subsystem in the Registry
procedure Update_Library_Unit (Update: in Library_Units.Library_Unit);
-- Updates (replaces) an existing Library_Unit in the Registry
procedure Update_Library_Unit_Subset
(Update: in Library_Units.Library_Unit_Sets.Set);
-- Updates (replaces) all existing Library_Units in the Registry that
-- are also in the Update set. If any units in the Subset are not also in
-- the Registry, Constraint_Error is raised
procedure Exclude_Manifests;
-- Removes all Configuration Manifest units from all Subsystems.
-- This should be invoked after checkout, and before compilation
end Registrar.Registration;
|
ohenley/awt | Ada | 1,314 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2021 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.
private with Ada.Real_Time;
package AWT.Wayland.Windows.Cursors is
type Animated_Cursor_Window is abstract limited new Wayland_Window with private;
private
type Animated_Cursor_Window is abstract limited new Wayland_Window with record
Start_Time, Next_Time : Ada.Real_Time.Time := Ada.Real_Time.Clock;
end record;
overriding
function On_Change_Cursor
(Object : in out Animated_Cursor_Window;
Name : AWT.Inputs.Cursors.Pointer_Cursor;
Cursor : WC.Cursor'Class) return WC.Cursor_Image'Class;
overriding
procedure Update_Cursor (Object : in out Animated_Cursor_Window);
end AWT.Wayland.Windows.Cursors;
|
strenkml/EE368 | Ada | 500 | adb |
with Memory.Transform.EOR; use Memory.Transform.EOR;
with Parser.Transform_Parser;
separate (Parser)
procedure Parse_EOR(parser : in out Parser_Type;
result : out Memory_Pointer) is
package EOR_Parser is new Transform_Parser(
T_Type => Memory.Transform.EOR.EOR_Type,
T_Pointer => Memory.Transform.EOR.EOR_Pointer,
Create_Transform => Memory.Transform.EOR.Create_EOR
);
begin
EOR_Parser.Parse(parser, result);
end Parse_EOR;
|
reznikmm/matreshka | Ada | 3,719 | 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.Chart_Pie_Offset_Attributes is
pragma Preelaborate;
type ODF_Chart_Pie_Offset_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Chart_Pie_Offset_Attribute_Access is
access all ODF_Chart_Pie_Offset_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Chart_Pie_Offset_Attributes;
|
micahwelf/FLTK-Ada | Ada | 3,283 | adb |
with
Interfaces.C.Strings,
System;
use type
System.Address;
package body FLTK.Widgets.Valuators.Sliders.Hor_Fill is
procedure hor_fill_slider_set_draw_hook
(W, D : in System.Address);
pragma Import (C, hor_fill_slider_set_draw_hook, "hor_fill_slider_set_draw_hook");
pragma Inline (hor_fill_slider_set_draw_hook);
procedure hor_fill_slider_set_handle_hook
(W, H : in System.Address);
pragma Import (C, hor_fill_slider_set_handle_hook, "hor_fill_slider_set_handle_hook");
pragma Inline (hor_fill_slider_set_handle_hook);
function new_fl_hor_fill_slider
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
return System.Address;
pragma Import (C, new_fl_hor_fill_slider, "new_fl_hor_fill_slider");
pragma Inline (new_fl_hor_fill_slider);
procedure free_fl_hor_fill_slider
(D : in System.Address);
pragma Import (C, free_fl_hor_fill_slider, "free_fl_hor_fill_slider");
pragma Inline (free_fl_hor_fill_slider);
procedure fl_hor_fill_slider_draw
(W : in System.Address);
pragma Import (C, fl_hor_fill_slider_draw, "fl_hor_fill_slider_draw");
pragma Inline (fl_hor_fill_slider_draw);
function fl_hor_fill_slider_handle
(W : in System.Address;
E : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_hor_fill_slider_handle, "fl_hor_fill_slider_handle");
pragma Inline (fl_hor_fill_slider_handle);
procedure Finalize
(This : in out Hor_Fill_Slider) is
begin
if This.Void_Ptr /= System.Null_Address and then
This in Hor_Fill_Slider'Class
then
free_fl_hor_fill_slider (This.Void_Ptr);
This.Void_Ptr := System.Null_Address;
end if;
Finalize (Slider (This));
end Finalize;
package body Forge is
function Create
(X, Y, W, H : in Integer;
Text : in String)
return Hor_Fill_Slider is
begin
return This : Hor_Fill_Slider do
This.Void_Ptr := new_fl_hor_fill_slider
(Interfaces.C.int (X),
Interfaces.C.int (Y),
Interfaces.C.int (W),
Interfaces.C.int (H),
Interfaces.C.To_C (Text));
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
hor_fill_slider_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
hor_fill_slider_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
end return;
end Create;
end Forge;
procedure Draw
(This : in out Hor_Fill_Slider) is
begin
fl_hor_fill_slider_draw (This.Void_Ptr);
end Draw;
function Handle
(This : in out Hor_Fill_Slider;
Event : in Event_Kind)
return Event_Outcome is
begin
return Event_Outcome'Val
(fl_hor_fill_slider_handle (This.Void_Ptr, Event_Kind'Pos (Event)));
end Handle;
end FLTK.Widgets.Valuators.Sliders.Hor_Fill;
|
reznikmm/matreshka | Ada | 3,719 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Table_Cell_Range_Attributes is
pragma Preelaborate;
type ODF_Table_Cell_Range_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Table_Cell_Range_Attribute_Access is
access all ODF_Table_Cell_Range_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Table_Cell_Range_Attributes;
|
reznikmm/matreshka | Ada | 19,838 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Tools 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: 4452 $ $Date: 2014-02-06 11:19:08 +0200 (Чт., 06 февр. 2014) $
------------------------------------------------------------------------------
with Ada.Characters.Wide_Wide_Latin_1;
with XML.Schema.Complex_Type_Definitions;
with XML.Schema.Object_Lists;
with XML.Schema.Particles;
with XML.Schema.Type_Definitions;
with XML.Schema.Terms;
with XSD_To_Ada.Utils; use XSD_To_Ada.Utils;
with XSD_To_Ada.Mappings.XML;
package body XSD_To_Ada.Payloads is
use XML.Schema.Complex_Type_Definitions;
use XSD_To_Ada.Writers;
use all type League.Strings.Universal_String;
LF : constant Wide_Wide_Character := Ada.Characters.Wide_Wide_Latin_1.LF;
-----------------
-- Print_Model --
-----------------
procedure Print_Model
(Model_Group : XML.Schema.Model_Groups.XS_Model_Group;
Writer : in out Writers.Writer;
Writer_types : in out Writers.Writer;
Name : League.Strings.Universal_String;
Choice : Boolean := False)
is
use type XML.Schema.Model_Groups.Compositor_Kinds;
XS_List : constant XML.Schema.Object_Lists.XS_Object_List
:= Model_Group.Get_Particles;
XS_Particle : XML.Schema.Particles.XS_Particle;
Case_Type : League.Strings.Universal_String;
Max_Occurs : Boolean := False;
Min_Occurs : Boolean := False;
begin
if Choice then
Case_Type.Append
(" type " & Add_Separator (Name) & "_Kind is" & LF
& " (");
end if;
for J in 1 .. XS_List.Get_Length loop
XS_Particle := XS_List.Item (J).To_Particle;
Min_Occurs := False;
Max_Occurs := False;
if XS_Particle.Get_Max_Occurs.Unbounded then
Max_Occurs := True;
else
if XS_Particle.Get_Max_Occurs.Value > 1 then
Max_Occurs := True;
end if;
end if;
if XS_Particle.Get_Min_Occurs = 0
and then not Max_Occurs
then
Min_Occurs := True;
end if;
if XS_Particle.Get_Term.Is_Element_Declaration then
if Choice then
Case_Type.Append (XSD_To_Ada.Utils.Add_Separator
(XS_Particle.Get_Term.To_Element_Declaration
.Get_Name) & "_Case");
Writers.N (Writer,
" when "
& XSD_To_Ada.Utils.Add_Separator
(XS_Particle.Get_Term
.To_Element_Declaration.Get_Name)
& "_Case =>" & LF
& " "
& XSD_To_Ada.Utils.Add_Separator (XS_Particle
.Get_Term.To_Element_Declaration.Get_Name));
else
Writer.N
(" " & XSD_To_Ada.Utils.Add_Separator
(XS_Particle.Get_Term.To_Element_Declaration.Get_Name));
end if;
Writer.P (" : "
& XSD2Ada.Analyzer.Get_Type_Name
(XSD2Ada.Analyzer.Find_Object
(Node_Vector => Payloads_Node_Vector,
Object => XS_Particle.Get_Term
.To_Element_Declaration.Get_Type_Definition,
Min_Occurs => Min_Occurs,
Max_Occurs => Max_Occurs)) & ";");
elsif XS_Particle.Get_Term.Is_Model_Group then
declare
Full_Anonym_Name : League.Strings.Universal_String
:= Name & "_Case_Anonym";
begin
if Max_Occurs then
Full_Anonym_Name.Append ("_Vector");
end if;
Writers.P (Writer, " " & Name & "_Anonym" & LF
& " : " & Full_Anonym_Name & ";");
end;
end if;
if J /= XS_List.Get_Length and Choice then
Case_Type.Append ("," & LF & " ");
end if;
end loop;
if Choice then
Case_Type.Append (");" & LF);
Writer_types.P (Case_Type);
end if;
end Print_Model;
procedure Print_Type_Definition
(Type_D : XML.Schema.Type_Definitions.XS_Type_Definition;
Payload : in out Writers.Writer;
Writer : in out Writers.Writer;
Writer_types : in out Writers.Writer;
Name : League.Strings.Universal_String;
Element_Name : League.Strings.Universal_String;
Choice : Boolean := False;
Is_Min_Occur : Boolean := False;
Is_Max_Occur : Boolean := False);
--------------------
-- Print_Payloads --
--------------------
procedure Print_Payloads
(Node_Vector : XSD2Ada.Analyzer.Items;
Payloads : in out XSD_To_Ada.Writers.Writer;
Types : in out XSD_To_Ada.Writers.Writer)
is
Types_Writer : XSD_To_Ada.Writers.Writer;
Types_Type_Writer : XSD_To_Ada.Writers.Writer;
Model_Group : XML.Schema.Model_Groups.XS_Model_Group;
Type_Name : League.Strings.Universal_String;
begin
Payloads_Node_Vector := Node_Vector;
XSD_To_Ada.Utils.Put_Header (Payloads);
Writers.P (Payloads, "with IATS_Types;");
Writers.P (Payloads, "with Web_Services.SOAP.Payloads;");
Writers.P (Payloads, "package Payloads is" & LF);
for Current of Node_Vector loop
if Current.Object.Is_Type_Definition then
Print_Type_Definition
(Type_D => Current.Object.To_Type_Definition,
Payload => Payloads,
Writer => Types_Writer,
Writer_types => Types_Type_Writer,
Name => Current.Short_Ada_Type_Name,
Element_Name => Current.Element_Name,
Choice => Current.Choice,
Is_Min_Occur => Current.Min,
Is_Max_Occur => Current.Max);
elsif Current.Object.Is_Model_Group then
Type_Name := XSD_To_Ada.Utils.Add_Separator
(Current.Short_Ada_Type_Name);
Model_Group := Current.Object.To_Model_Group;
if not Current.Max
and then not Current.Min
then
if Current.Choice then
Types_Writer.P
(" type "
& Type_Name & LF
& " (Kind : " & Type_Name & "_Kind" & LF
& " := " & Type_Name
& "_Kind'First) is record" & LF
& " case Kind is");
else
Types_Writer.P (" type " & Type_Name & " is record");
end if;
Print_Model
(Model_Group => Model_Group,
Writer => Types_Writer,
Writer_types => Types_Type_Writer,
Name => Current.Short_Ada_Type_Name,
Choice => Current.Choice);
if Current.Choice then
Types_Writer.P (" end case;");
end if;
Types_Writer.P (" end record;" & LF);
elsif Current.Max then
Writers.P
(Types_Writer,
" package "
& Add_Separator (Current.Short_Ada_Type_Name) & "s is" & LF
& " new Ada.Containers.Vectors" & LF
& " (Positive, "
& Add_Separator
(XSD2Ada.Analyzer.Type_Name (Current.Short_Ada_Type_Name))
& ");" & LF & LF
& XSD_To_Ada.Utils.Split_Line
("subtype "
& Add_Separator (Current.Short_Ada_Type_Name) & " is "
& Add_Separator (Current.Short_Ada_Type_Name)
& "s.Vector;", 3) & LF);
else
raise Constraint_Error;
end if;
end if;
Types.N (Types_Type_Writer.Text);
Types.N (Types_Writer.Text);
Types_Type_Writer.Text.Clear;
Types_Writer.Text.Clear;
end loop;
end Print_Payloads;
---------------------------
-- Print_Type_Definition --
---------------------------
procedure Print_Type_Definition
(Type_D : XML.Schema.Type_Definitions.XS_Type_Definition;
Payload : in out Writers.Writer;
Writer : in out Writers.Writer;
Writer_types : in out Writers.Writer;
Name : League.Strings.Universal_String;
Element_Name : League.Strings.Universal_String;
Choice : Boolean := False;
Is_Min_Occur : Boolean := False;
Is_Max_Occur : Boolean := False)
is
use type XML.Schema.Type_Definitions.XS_Type_Definition;
XS_Particle : XML.Schema.Particles.XS_Particle;
XS_Term : XML.Schema.Terms.XS_Term;
XS_Base : constant XML.Schema.Type_Definitions.XS_Type_Definition
:= Type_D.Get_Base_Type;
Model_Group : XML.Schema.Model_Groups.XS_Model_Group;
CTD : constant
XML.Schema.Complex_Type_Definitions.XS_Complex_Type_Definition
:= Type_D.To_Complex_Type_Definition;
Base_Type : League.Strings.Universal_String;
begin
if XS_Base.Get_Type_Category in XML.Schema.Complex_Type
and XS_Base /= Type_D
then
if XS_Base.Get_Name.To_Wide_Wide_String = "anyType" then
Payload.P
(" type " & Add_Separator (Name) & " is" & LF
& " new Web_Services.SOAP.Payloads.Abstract_SOAP_Payload"
& LF
& " with null record;" & LF);
XSD_To_Ada.Utils.Gen_Access_Type
(Payload, Add_Separator (Name));
return;
else
Base_Type := League.Strings.To_Universal_String
(XSD_To_Ada.Utils.Split_Line
(XSD_To_Ada.Utils.Add_Separator (XS_Base.Get_Name)
& " : IATS_Types."
& XSD_To_Ada.Utils.Add_Separator (XS_Base.Get_Name)
& ";" & LF, 5));
end if;
end if;
case Type_D.Get_Type_Category is
when XML.Schema.Complex_Type =>
if CTD.Get_Content_Type in Element_Only | Mixed then
XS_Particle := CTD.Get_Particle;
XS_Term := XS_Particle.Get_Term;
if XS_Term.Is_Model_Group then
Model_Group := XS_Term.To_Model_Group;
end if;
elsif CTD.Get_Content_Type in Simple then
if Name = Type_D.Get_Name then
Writer.P (" " & Add_Separator (Name) & " : " &
XSD2Ada.Analyzer.Get_Type_Name
(XSD2Ada.Analyzer.Find_Object
(Node_Vector => Payloads_Node_Vector,
Object => XS_Base,
Min_Occurs => False,
Max_Occurs => False))& ";");
end if;
else
raise Constraint_Error;
end if;
if not Is_Min_Occur
and then not Is_Max_Occur
then
if Choice then
Writer.P
(" type " & XSD_To_Ada.Utils.Add_Separator (Name) & LF
& " (Kind : " & Add_Separator (Name) & "_Kind" & LF
& " := " & Add_Separator (Name)
& "_Kind'First) is record" & LF
& " case Kind is");
elsif XSD_To_Ada.Mappings.XML.Payload_Types.Index (Name)
/= 0 then
Payload.P
(" type " & XSD_To_Ada.Utils.Add_Separator (Name)
& " is" & LF
& " new Web_Services.SOAP.Payloads."
& "Abstract_SOAP_Payload"
& LF
& " with record" & LF
& " Item : IATS_Types."
& XSD_To_Ada.Utils.Add_Separator (Name) & ";" & LF
& " end record;" & LF);
Writer_types.P
(" type " & XSD_To_Ada.Utils.Add_Separator (Name)
& " is record");
else
Writer_types.P
(" type " & XSD_To_Ada.Utils.Add_Separator (Name)
& " is record");
end if;
Writer.N (Base_Type);
if not Element_Name.Is_Empty then
Writer_types.P
(XSD_To_Ada.Utils.Split_Line
(XSD_To_Ada.Utils.Add_Separator (Type_D.Get_Name)
& " : IATS_Types."
& XSD_To_Ada.Utils.Add_Separator (Type_D.Get_Name)
& ";", 5));
else
Print_Model
(Model_Group => Model_Group,
Writer => Writer,
Writer_types => Writer_types,
Name => XSD_To_Ada.Utils.Add_Separator (Name),
Choice => Choice);
end if;
if Choice then
Writer.P (" end case;");
end if;
Writer.P (" end record;" & LF);
if XSD_To_Ada.Mappings.XML.Payload_Types.Index (Name) /= 0 then
XSD_To_Ada.Utils.Gen_Access_Type
(Payload, XSD_To_Ada.Utils.Add_Separator (Name));
end if;
elsif Is_Min_Occur then
Writers.P
(Writer_types,
(XSD_To_Ada.Utils.Split_Line
("type " & XSD_To_Ada.Utils.Add_Separator (Name)
& " is record", 3)) & LF
& " Is_Set : Boolean := False;" & LF
& " Value : "
& XSD_To_Ada.Utils.Add_Separator
(XSD2Ada.Analyzer.Type_Name (Name)) & ";" & LF
& " end record;" & LF);
elsif Is_Max_Occur then
Writers.P
(Writer_types,
" package " & XSD_To_Ada.Utils.Add_Separator (Name)
& "s is" & LF
& " new Ada.Containers.Vectors" & LF
& " (Positive, "
& XSD_To_Ada.Utils.Add_Separator
(XSD2Ada.Analyzer.Type_Name (Name))
& ");" & LF & LF
& XSD_To_Ada.Utils.Split_Line
("subtype " & XSD_To_Ada.Utils.Add_Separator (Name)
& " is " & XSD_To_Ada.Utils.Add_Separator (Name)
& "s.Vector;", 3) & LF);
end if;
when XML.Schema.Simple_Type =>
if Is_Min_Occur then
Writers.P
(Writer_types,
" type " & XSD_To_Ada.Utils.Add_Separator (Name)
& " is record" & LF
& " Is_Set : Boolean := False;" & LF
& " Value : "
& XSD2Ada.Analyzer.Get_Type_Name
(XSD2Ada.Analyzer.Find_Object
(Node_Vector => Payloads_Node_Vector,
Object => Type_D,
Min_Occurs => False,
Max_Occurs => False))
& ";" & LF
& " end record;" & LF);
elsif Is_Max_Occur then
Writers.P
(Writer_types,
" package "
& XSD_To_Ada.Utils.Add_Separator (Type_D.Get_Name)
& "_Vector is" & LF
& " new Ada.Containers.Vectors" & LF
& " (Positive, "
& XSD2Ada.Analyzer.Get_Type_Name
(XSD2Ada.Analyzer.Find_Object
(Node_Vector => Payloads_Node_Vector,
Object => Type_D,
Min_Occurs => False,
Max_Occurs => False)) & "," & LF
& " ""="" => ICTS.Types.""="");" & LF);
end if;
when XML.Schema.None =>
raise Constraint_Error;
end case;
end Print_Type_Definition;
end XSD_To_Ada.Payloads;
|
reznikmm/matreshka | Ada | 6,861 | 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.Filter_Or_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Table_Filter_Or_Element_Node is
begin
return Self : Table_Filter_Or_Element_Node do
Matreshka.ODF_Table.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Table_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Table_Filter_Or_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Table_Filter_Or
(ODF.DOM.Table_Filter_Or_Elements.ODF_Table_Filter_Or_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Table_Filter_Or_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Filter_Or_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Table_Filter_Or_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Table_Filter_Or
(ODF.DOM.Table_Filter_Or_Elements.ODF_Table_Filter_Or_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Table_Filter_Or_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Table_Filter_Or
(Visitor,
ODF.DOM.Table_Filter_Or_Elements.ODF_Table_Filter_Or_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Table_URI,
Matreshka.ODF_String_Constants.Filter_Or_Element,
Table_Filter_Or_Element_Node'Tag);
end Matreshka.ODF_Table.Filter_Or_Elements;
|
pchapin/acrypto | Ada | 1,178 | ads | ---------------------------------------------------------------------------
-- FILE : aco-crypto-hash-none.ads
-- SUBJECT : Specification of a null hash function.
-- AUTHOR : (C) Copyright 2008 by Peter Chapin
--
-- Please send comments or bug reports to
--
-- Peter Chapin <[email protected]>
---------------------------------------------------------------------------
package ACO.Crypto.Hash.None is
type Null_Hasher is new ACO.Crypto.Hash.Hasher with private;
-- Puts hasher object in a state where it can accept data.
overriding
procedure Start_Hashing(Hash_Object : in out Null_Hasher) is null;
-- Finalize the hash computation.
overriding
procedure Finish_Hashing(Hash_Object : in out Null_Hasher) is null;
-- Return the resulting hash value.
overriding
function Retrieve_Hash(Hash_Object : Null_Hasher) return Hash_Value;
-- Compute hash of data provided in blocks.
overriding
procedure Compute_Hash(Hash_Object : in out Null_Hasher;
Data_Block : in Octet_Array) is null;
private
type Null_Hasher is new ACO.Crypto.Hash.Hasher with null record;
end ACO.Crypto.Hash.None;
|
AdaCore/Ada_Drivers_Library | Ada | 2,225 | ads | -- This package was generated by the Ada_Drivers_Library project wizard script
package ADL_Config is
Architecture : constant String := "RISC-V"; -- From board definition
Board : constant String := "HiFive1"; -- From command line
Boot_Memory : constant String := "board_flash"; -- From default value
CPU_Core : constant String := "RISC-V32"; -- From mcu definition
Device_Family : constant String := "FE3"; -- From board definition
Device_Name : constant String := "FE310"; -- From board definition
Has_Custom_Memory_Area_1 : constant Boolean := False; -- From default value
Has_Ravenscar_Full_Runtime : constant String := "False"; -- From board definition
Has_Ravenscar_SFP_Runtime : constant String := "False"; -- From board definition
Has_ZFP_Runtime : constant String := "True"; -- From board definition
Max_Mount_Name_Length : constant := 128; -- From default value
Max_Mount_Points : constant := 2; -- From default value
Max_Path_Length : constant := 1024; -- From default value
Number_Of_Interrupts : constant := 0; -- From default value
Runtime_Name : constant String := "light-rv32imac"; -- From default value
Runtime_Name_Suffix : constant String := "rv32imac"; -- From board definition
Runtime_Profile : constant String := "light"; -- From command line
Use_Startup_Gen : constant Boolean := True; -- From command line
Vendor : constant String := "SiFive"; -- From board definition
hifive1_uart_root : constant := 268513280; -- From board definition
qemu_sifive_test_exit : constant Boolean := True; -- From board definition
end ADL_Config;
|
zhmu/ananas | Ada | 1,297 | adb | -- { dg-do run }
-- { dg-options "-gnatws" }
with System;
with Ada.Unchecked_Conversion;
procedure SSO14 is
type Arr is array (1 .. Integer'Size) of Boolean;
pragma Pack (Arr);
for Arr'Scalar_Storage_Order use System.High_Order_First;
function From_Float is new Ada.Unchecked_Conversion (Float, Arr);
function From_Int is new Ada.Unchecked_Conversion (Integer, Arr);
type R_Float is record
F : Float;
end record;
for R_Float'Bit_Order use System.High_Order_First;
for R_Float'Scalar_Storage_Order use System.High_Order_First;
type R_Int is record
I : Integer;
end record;
for R_Int'Bit_Order use System.High_Order_First;
for R_Int'Scalar_Storage_Order use System.High_Order_First;
F1 : Float := 1.234567;
FA : Arr;
F2 : R_Float;
for F2'Address use FA'Address;
pragma Import (Ada, F2);
I1 : Integer := 1234567;
IA : Arr;
I2 : R_Int;
for I2'Address use IA'Address;
pragma Import (Ada, I2);
begin
-- Check that converting a FP value yields a big-endian array
FA := From_Float (F1);
if F2.F /= F1 then
raise Program_Error;
end if;
-- Check that converting an integer value yields a big-endian array.
IA := From_Int (I1);
if I2.I /= I1 then
raise Program_Error;
end if;
end;
|
stcarrez/dynamo | Ada | 8,612 | ads | ------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . G E T _ U N I T --
-- --
-- S p e c --
-- --
-- Copyright (c) 1995-2005, 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, 59 Temple Place --
-- - Suite 330, Boston, MA 02111-1307, 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 Ada Core Technologies Inc --
-- (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
with A4G.A_Types; use A4G.A_Types;
package A4G.Get_Unit is
-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- !! !!
-- !! This package should be completely revised (and very likely - !!
-- !! removed), when migration to using pre-created trees as to the !!
-- !! *ONLY* ASIS operation mode is completed !!
-- !! !!
-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- This paskage contains routines for obtaining ASIS Compilation Units
-- according to the requests arosen during processing the queries from
-- Asis.Compilation_Units package which get Units and Unit Lists from an
-- ASIS Context. As the first step, these routines try to find the
-- reqiested unit(s) by making the corresponding search among Units
-- which are already known to ASIS by looking for the Units in the internal
-- tables implementing the ASIS Context Model. If this first step does not
-- give the required resuil, the attempt to fing the Unit(s) by processing
-- the Ada sources or pre-created tree output files is undertaken. To obtain
-- information about the Unit which has never been known to ASIS, ASIS has,
-- depending on the options set for a context, either to compile it "on the
-- fly" in order to check its correctness and to produce the tree output
-- file, if the Unit is correct, or to try to locate the pre-created tree
-- output file; then the tree output file has to be read in and analysed.
-- If the tree contains the subtrees for other Ada units which have not
-- been known to ASIS so far, ASIS stores the information about these units
-- in its internal tables (even the ASIS query being processed has no
-- relation to these units).
-----------------
-- Subprograms --
-----------------
function Get_One_Unit
(Name : Wide_String;
Context : Context_Id;
Spec : Boolean)
return Unit_Id;
-- This function defines the top-level control flow for the two
-- functions from the Asis_Compilation_Unit package which yields
-- one ASIS Compilation Unit: Library_Unit_Declaration and
-- Compilation_Unit_Body. Spec is used to make the diffference
-- between these two functions: it is set True for
-- Library_Unit_Declaration and False for Compilation_Unit_Body.
function Fetch_Unit_By_Ada_Name
(Name : String;
Norm_Name : String;
Context : Context_Id;
Spec : Boolean)
return Unit_Id;
-- This function is supposed to be called in the following situation:
--
-- - Name is non-empty string which can be interpreted as an Ada unit
-- name;
--
-- - Norm_Name is non-empty string representing the normalised version
-- of the Ada unit name passed as the actual for Name. This means
-- that Norm_Name'Legth = Name'Length + 2, and Norm_name ends with
-- "%s" or "%b" DEPENDING ON THE VALUE OF SPEC;
--
-- The Context parameter indicates the ASIS Context to look for a Unit
-- indicated by Name and Norm_Name. Spec indicates whether the library
-- unit declaration or the compilation unit body should be fetched
-- (See the documentation for the functions Library_Unit_Declaration
-- and Compilation_Unit_Body from the Asis_Compilation_Units package
-- for the definition of the ASIS meaning of "library unit declaration"
-- and "compilation unit body").
--
-- This function returns the Unit_Id value indicating the desired
-- Unit. Nil_Unit is returned if Context does not contain the -- ##
-- Unit having Name as its unit name.
--
-- If ASIS already knows this Unit, the returned Unit_Id value
-- points to some pre-existing entry in the Unit Table for the given
-- Context. Otherwise ASIS tries to compile Unit from its cource.
-- If the compilation is successful, ASIS retrieves the newly
-- created tree and it obtains and stores in the Unit Table
-- information about the Unit AND ABOUT ALL IS SUPPORTERS, WHICH
-- ARE NOT KNOWN TO ASIS!
--
-- !!! THIS FUNCTION SHOULD ANALYZE EXISTING TREES BEFORE TRYING
-- !!! TO CREATE THE NEW TREE, THIS IS NOT IMPLEMENTED YET
--
-- IMPLEMENTATION LIMITATION : if the file name of an Ada unit is
-- defined by the Source_File_Name pragma, ASIS cannot call GNAT
-- to compile this unit!
function Get_Main_Unit_Tree_On_The_Fly
(Start_Unit : Unit_Id;
Cont : Context_Id;
Spec : Boolean)
return Unit_Id;
-- This function is supposed to be used for the Incremental Context mode
-- only. It purpose is to try to create the main tree for Start_Unit
-- (if Spec is set ON) or for the body of Start_Unit (if Spec is set OFF).
-- If the tree is successfully created, this function returns either
-- Start_From or the Id of the body of Start_From respectively, otherwise
-- Nil_Unit is returned.
--
-- If this function creates the new tree, this tree is added to the set
-- of trees making up the current incremental context, and this tree
-- becomes the tree currently accessed by ASIS.
--
-- This function is supposed to be called with Start_Unit representing
-- some spec unit in the Cont. It is also supposed that the tree which
-- should be created by the call does not exist in Cont. The caller is
-- responsible to insure these conditions.
-- condition
end A4G.Get_Unit;
|
persan/AdaYaml | Ada | 1,616 | ads | -- part of AdaYaml, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "copying.txt"
with Yaml.Dom.Vectors;
with Yaml.Source;
with Yaml.Stream_Concept;
package Yaml.Dom.Loading is
-- equivalent to the composition of the "Parse" and "Compose" steps in the
-- YAML spec
function From_Source (Input : Source.Pointer) return Document_Reference;
function From_Source (Input : Source.Pointer) return Vectors.Vector;
-- as above, but does not read from an external source but from a String
function From_String (Input : String) return Document_Reference;
function From_String (Input : String) return Vectors.Vector;
generic
with package Stream is new Stream_Concept (<>);
package Stream_Loading is
-- equivalent to the "Compose" step in the YAML spec. Expects the input
-- to contain exactly one document, will raise a Compose_Error if the
-- stream contains multiple documents.
function Load_One (Input : in out Stream.Instance;
Pool : Text.Pool.Reference :=
Text.Pool.With_Capacity (Text.Pool.Default_Size))
return Document_Reference;
-- as above, but allows for multiple documents in a stream
function Load_All (Input : in out Stream.Instance;
Pool : Text.Pool.Reference :=
Text.Pool.With_Capacity (Text.Pool.Default_Size))
return Vectors.Vector
with Post => Integer (Load_All'Result.Length) > 0;
end Stream_Loading;
end Yaml.Dom.Loading;
|
sungyeon/drake | Ada | 11,642 | ads | pragma License (Unrestricted);
-- implementation unit specialized for Darwin (or Linux, or Windows)
with System.Long_Long_Complex_Types;
package System.Long_Long_Complex_Elementary_Functions is
pragma Pure;
-- Complex
subtype Imaginary is Long_Long_Complex_Types.Imaginary;
subtype Complex is Long_Long_Complex_Types.Complex;
function clogf (x : Complex) return Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_clogf";
function Fast_Log (X : Complex) return Complex
renames clogf;
function cexpf (x : Complex) return Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_cexpf";
function Fast_Exp (X : Complex) return Complex
renames cexpf;
function cexpif (x : Imaginary) return Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_cexpif";
function Fast_Exp (X : Imaginary) return Complex
renames cexpif;
function cpowf (x, y : Complex) return Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_cpowf";
function Fast_Pow (Left, Right : Complex) return Complex
renames cpowf;
function csinf (x : Complex) return Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_csinf";
function Fast_Sin (X : Complex) return Complex
renames csinf;
function ccosf (x : Complex) return Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_ccosf";
function Fast_Cos (X : Complex) return Complex
renames ccosf;
function ctanf (x : Complex) return Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_ctanf";
function Fast_Tan (X : Complex) return Complex
renames ctanf;
function casinf (x : Complex) return Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_casinf";
function Fast_Arcsin (X : Complex) return Complex
renames casinf;
function cacosf (x : Complex) return Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_cacosf";
function Fast_Arccos (X : Complex) return Complex
renames cacosf;
function catanf (x : Complex) return Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_catanf";
function Fast_Arctan (X : Complex) return Complex
renames catanf;
function csinhf (x : Complex) return Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_csinhf";
function Fast_Sinh (X : Complex) return Complex
renames csinhf;
function ccoshf (x : Complex) return Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_ccoshf";
function Fast_Cosh (X : Complex) return Complex
renames ccoshf;
function ctanhf (x : Complex) return Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_ctanhf";
function Fast_Tanh (X : Complex) return Complex
renames ctanhf;
function casinhf (x : Complex) return Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_casinhf";
function Fast_Arcsinh (X : Complex) return Complex
renames casinhf;
function cacoshf (x : Complex) return Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_cacoshf";
function Fast_Arccosh (X : Complex) return Complex
renames cacoshf;
function catanhf (x : Complex) return Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_catanhf";
function Fast_Arctanh (X : Complex) return Complex
renames catanhf;
-- Long_Complex
subtype Long_Imaginary is Long_Long_Complex_Types.Long_Imaginary;
subtype Long_Complex is Long_Long_Complex_Types.Long_Complex;
function clog (x : Long_Complex) return Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_clog";
function Fast_Log (X : Long_Complex) return Long_Complex
renames clog;
function cexp (x : Long_Complex) return Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_cexp";
function Fast_Exp (X : Long_Complex) return Long_Complex
renames cexp;
function cexpi (x : Long_Imaginary) return Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_cexpi";
function Fast_Exp (X : Long_Imaginary) return Long_Complex
renames cexpi;
function cpow (x, y : Long_Complex) return Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_cpow";
function Fast_Pow (Left, Right : Long_Complex) return Long_Complex
renames cpow;
function csin (x : Long_Complex) return Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_csin";
function Fast_Sin (X : Long_Complex) return Long_Complex
renames csin;
function ccos (x : Long_Complex) return Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_ccos";
function Fast_Cos (X : Long_Complex) return Long_Complex
renames ccos;
function ctan (x : Long_Complex) return Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_ctan";
function Fast_Tan (X : Long_Complex) return Long_Complex
renames ctan;
function casin (x : Long_Complex) return Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_casin";
function Fast_Arcsin (X : Long_Complex) return Long_Complex
renames casin;
function cacos (x : Long_Complex) return Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_cacos";
function Fast_Arccos (X : Long_Complex) return Long_Complex
renames cacos;
function catan (x : Long_Complex) return Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_catan";
function Fast_Arctan (X : Long_Complex) return Long_Complex
renames catan;
function csinh (x : Long_Complex) return Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_csinh";
function Fast_Sinh (X : Long_Complex) return Long_Complex
renames csinh;
function ccosh (x : Long_Complex) return Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_ccosh";
function Fast_Cosh (X : Long_Complex) return Long_Complex
renames ccosh;
function ctanh (x : Long_Complex) return Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_ctanh";
function Fast_Tanh (X : Long_Complex) return Long_Complex
renames ctanh;
function casinh (x : Long_Complex) return Long_Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_casinh";
function Fast_Arcsinh (X : Long_Complex) return Long_Complex
renames casinh;
function cacosh (x : Long_Complex) return Long_Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_cacosh";
function Fast_Arccosh (X : Long_Complex) return Long_Complex
renames cacosh;
function catanh (x : Long_Complex) return Long_Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_catanh";
function Fast_Arctanh (X : Long_Complex) return Long_Complex
renames catanh;
-- Long_Long_Complex
subtype Long_Long_Imaginary is Long_Long_Complex_Types.Long_Long_Imaginary;
subtype Long_Long_Complex is Long_Long_Complex_Types.Long_Long_Complex;
function clogl (x : Long_Long_Complex) return Long_Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_clogl";
function Fast_Log (X : Long_Long_Complex) return Long_Long_Complex
renames clogl;
function cexpl (x : Long_Long_Complex) return Long_Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_cexpl";
function Fast_Exp (X : Long_Long_Complex) return Long_Long_Complex
renames cexpl;
function cexpil (x : Long_Long_Imaginary) return Long_Long_Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_cexpil";
function Fast_Exp (X : Long_Long_Imaginary) return Long_Long_Complex
renames cexpil;
function cpowl (x, y : Long_Long_Complex) return Long_Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_cpowl";
function Fast_Pow (Left, Right : Long_Long_Complex) return Long_Long_Complex
renames cpowl;
function csinl (x : Long_Long_Complex) return Long_Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_csinl";
function Fast_Sin (X : Long_Long_Complex) return Long_Long_Complex
renames csinl;
function ccosl (x : Long_Long_Complex) return Long_Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_ccosl";
function Fast_Cos (X : Long_Long_Complex) return Long_Long_Complex
renames ccosl;
function ctanl (x : Long_Long_Complex) return Long_Long_Complex
with Import, Convention => Intrinsic, External_Name => "__builtin_ctanl";
function Fast_Tan (X : Long_Long_Complex) return Long_Long_Complex
renames ctanl;
function casinl (x : Long_Long_Complex) return Long_Long_Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_casinl";
function Fast_Arcsin (X : Long_Long_Complex) return Long_Long_Complex
renames casinl;
function cacosl (x : Long_Long_Complex) return Long_Long_Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_cacosl";
function Fast_Arccos (X : Long_Long_Complex) return Long_Long_Complex
renames cacosl;
function catanl (x : Long_Long_Complex) return Long_Long_Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_catanl";
function Fast_Arctan (X : Long_Long_Complex) return Long_Long_Complex
renames catanl;
function csinhl (x : Long_Long_Complex) return Long_Long_Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_csinhl";
function Fast_Sinh (X : Long_Long_Complex) return Long_Long_Complex
renames csinhl;
function ccoshl (x : Long_Long_Complex) return Long_Long_Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_ccoshl";
function Fast_Cosh (X : Long_Long_Complex) return Long_Long_Complex
renames ccoshl;
function ctanhl (x : Long_Long_Complex) return Long_Long_Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_ctanhl";
function Fast_Tanh (X : Long_Long_Complex) return Long_Long_Complex
renames ctanhl;
function casinhl (x : Long_Long_Complex) return Long_Long_Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_casinhl";
function Fast_Arcsinh (X : Long_Long_Complex) return Long_Long_Complex
renames casinhl;
function cacoshl (x : Long_Long_Complex) return Long_Long_Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_cacoshl";
function Fast_Arccosh (X : Long_Long_Complex) return Long_Long_Complex
renames cacoshl;
function catanhl (x : Long_Long_Complex) return Long_Long_Complex
with Import,
Convention => Intrinsic, External_Name => "__builtin_catanhl";
function Fast_Arctanh (X : Long_Long_Complex) return Long_Long_Complex
renames catanhl;
end System.Long_Long_Complex_Elementary_Functions;
|
zhmu/ananas | Ada | 177 | ads | package Assertion_Policy1_Pkg is
pragma Assertion_Policy (Ignore);
procedure Proc (Low : Integer; High : Integer)
with Pre => Low < High;
end Assertion_Policy1_Pkg;
|
zhmu/ananas | Ada | 1,233 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S H O R T _ F L O A T _ W I D E _ W I D E _ T E X T _ I O --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
with Ada.Wide_Wide_Text_IO;
package Ada.Short_Float_Wide_Wide_Text_IO is
new Ada.Wide_Wide_Text_IO.Float_IO (Short_Float);
|
ytomino/gnat4drake | Ada | 519 | ads | pragma License (Unrestricted);
with System.WCh_Con;
generic
Encoding_Method : System.WCh_Con.WC_Encoding_Method;
package GNAT.Decode_String is
pragma Pure;
procedure Decode_Wide_Character (
Input : String;
Ptr : in out Natural;
Result : out Wide_Character);
procedure Decode_Wide_Wide_Character (
Input : String;
Ptr : in out Natural;
Result : out Wide_Wide_Character);
procedure Next_Wide_Character (Input : String; Ptr : in out Natural);
end GNAT.Decode_String;
|
stcarrez/ada-util | Ada | 17,893 | adb | -----------------------------------------------------------------------
-- util-http-cookies -- HTTP Cookies
-- Copyright (C) 2011, 2012, 2015, 2022 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Calendar;
with Ada.Strings.Maps;
with Util.Strings;
with Util.Strings.Builders;
with Util.Strings.Builders.Transforms;
with Util.Dates.RFC7231;
package body Util.Http.Cookies is
use Ada.Strings.Unbounded;
use Ada.Strings;
use type Maps.Character_Set;
-- Get number of cookies present in the header value
function Get_Cookie_Count (Header : in String) return Natural;
-- Check that the value contains valid character
-- Raises Invalid_Value if an invalid character is found
procedure Check_Value (S : in String);
-- Check that the value contains valid character
-- Raises Invalid_Value if an invalid character is found
procedure Check_Token (S : in String);
Forbidden : constant Maps.Character_Set
:= Maps.To_Set (Span => (Low => Character'Val (0),
High => Character'Val (31)))
or Maps.To_Set (";")
or Maps.To_Set (Span => (Low => Character'Val (127),
High => Character'Val (Character'Pos (Character'Last))));
-- Reserved characters (See draft-ietf-httpstate-cookie-21 and RFC2616], Section 2.2)
Reserved : constant Maps.Character_Set
:= Maps.To_Set ("()<>@,;:\""/[]?={} ") or Forbidden;
-- ------------------------------
-- Check that the value contains valid character
-- Raises Invalid_Value if an invalid character is found
-- ------------------------------
procedure Check_Value (S : in String) is
begin
for I in S'Range loop
if Maps.Is_In (Element => S (I), Set => Forbidden) then
raise Invalid_Value with "Invalid character used: '" & S (I) & "'";
end if;
end loop;
end Check_Value;
-- ------------------------------
-- Check that the value contains valid character
-- Raises Invalid_Value if an invalid character is found
-- ------------------------------
procedure Check_Token (S : in String) is
begin
for I in S'Range loop
if Maps.Is_In (Element => S (I), Set => Reserved) then
raise Invalid_Value with "Reserved character used: '" & S (I) & "'";
end if;
end loop;
end Check_Token;
-- ------------------------------
-- Constructs a cookie with a specified name and value.
--
-- The name must conform to RFC 2109. That means it can contain only ASCII alphanumeric
-- characters and cannot contain commas, semicolons, or white space or begin with
-- a $ character. The cookie's name cannot be changed after creation.
--
-- The value can be anything the server chooses to send. Its value is probably
-- of interest only to the server. The cookie's value can be changed after creation
-- with the setValue method.
--
-- By default, cookies are created according to the Netscape cookie specification.
-- The version can be changed with the setVersion method.
-- ------------------------------
function Create (Name : in String;
Value : in String) return Cookie is
Result : Cookie;
begin
Check_Value (Value);
Check_Token (Name);
Result.Name := To_Unbounded_String (Name);
Result.Value := To_Unbounded_String (Value);
return Result;
end Create;
-- ------------------------------
-- Returns the name of the cookie. The name cannot be changed after creation.
-- ------------------------------
function Get_Name (Object : in Cookie) return String is
begin
return To_String (Object.Name);
end Get_Name;
-- ------------------------------
-- Returns the value of the cookie.
-- ------------------------------
function Get_Value (Object : in Cookie) return String is
begin
return To_String (Object.Value);
end Get_Value;
-- ------------------------------
-- Assigns a new value to a cookie after the cookie is created.
-- If you use a binary value, you may want to use BASE64 encoding.
--
-- With Version 0 cookies, values should not contain white space, brackets,
-- parentheses, equals signs, commas, double quotes, slashes, question marks,
-- at signs, colons, and semicolons. Empty values may not behave
-- the same way on all browsers.
-- ------------------------------
procedure Set_Value (Object : in out Cookie;
Value : in String) is
begin
Check_Value (Value);
Object.Value := To_Unbounded_String (Value);
end Set_Value;
-- ------------------------------
-- Returns the comment describing the purpose of this cookie,
-- or null if the cookie has no comment.
-- ------------------------------
function Get_Comment (Object : in Cookie) return String is
begin
return To_String (Object.Comment);
end Get_Comment;
-- ------------------------------
-- Specifies a comment that describes a cookie's purpose. The comment is useful if
-- the browser presents the cookie to the user. Comments are not supported by
-- Netscape Version 0 cookies.
-- ------------------------------
procedure Set_Comment (Object : in out Cookie;
Comment : in String) is
begin
Check_Value (Comment);
Object.Comment := To_Unbounded_String (Comment);
end Set_Comment;
-- ------------------------------
-- Returns the domain name set for this cookie. The form of the domain name
-- is set by RFC 2109.
-- ------------------------------
function Get_Domain (Object : in Cookie) return String is
begin
return To_String (Object.Domain);
end Get_Domain;
-- ------------------------------
-- Specifies the domain within which this cookie should be presented.
--
-- The form of the domain name is specified by RFC 2109. A domain name begins with
-- a dot (.foo.com) and means that the cookie is visible to servers in a specified
-- Domain Name System (DNS) zone (for example, www.foo.com, but not a.b.foo.com).
-- By default, cookies are only returned to the server that sent them.
-- ------------------------------
procedure Set_Domain (Object : in out Cookie;
Domain : in String) is
begin
Check_Value (Domain);
Object.Domain := To_Unbounded_String (Domain);
end Set_Domain;
-- ------------------------------
-- Returns the maximum age of the cookie, specified in seconds.
-- By default, -1 indicating the cookie will persist until browser shutdown.
-- ------------------------------
function Get_Max_Age (Object : in Cookie) return Integer is
begin
return Object.Max_Age;
end Get_Max_Age;
-- ------------------------------
-- Sets the maximum age of the cookie in seconds.
--
-- A positive value indicates that the cookie will expire after that many seconds
-- have passed. Note that the value is the maximum age when the cookie will expire,
-- not the cookie's current age.
--
-- A negative value means that the cookie is not stored persistently and will be
-- deleted when the Web browser exits. A zero value causes the cookie to be deleted.
-- ------------------------------
procedure Set_Max_Age (Object : in out Cookie;
Max_Age : in Integer) is
begin
Object.Max_Age := Max_Age;
end Set_Max_Age;
-- ------------------------------
-- Returns the path on the server to which the browser returns this cookie.
-- The cookie is visible to all subpaths on the server.
-- ------------------------------
function Get_Path (Object : in Cookie) return String is
begin
return To_String (Object.Path);
end Get_Path;
-- ------------------------------
-- Specifies a path for the cookie to which the client should return the cookie.
--
-- The cookie is visible to all the pages in the directory you specify,
-- and all the pages in that directory's subdirectories. A cookie's path
-- must include the servlet that set the cookie, for example, /catalog,
-- which makes the cookie visible to all directories on the server under /catalog.
--
-- Consult RFC 2109 (available on the Internet) for more information on setting
-- path names for cookies.
-- ------------------------------
procedure Set_Path (Object : in out Cookie;
Path : in String) is
begin
Check_Value (Path);
Object.Path := To_Unbounded_String (Path);
end Set_Path;
-- ------------------------------
-- Returns true if the browser is sending cookies only over a secure protocol,
-- or false if the browser can send cookies using any protocol.
-- ------------------------------
function Is_Secure (Object : in Cookie) return Boolean is
begin
return Object.Secure;
end Is_Secure;
-- ------------------------------
-- Indicates to the browser whether the cookie should only be sent using
-- a secure protocol, such as HTTPS or SSL.
-- ------------------------------
procedure Set_Secure (Object : in out Cookie;
Secure : in Boolean) is
begin
Object.Secure := Secure;
end Set_Secure;
-- ------------------------------
-- Returns the version of the protocol this cookie complies with.
-- Version 1 complies with RFC 2109, and version 0 complies with the original
-- cookie specification drafted by Netscape. Cookies provided by a browser use
-- and identify the browser's cookie version.
-- ------------------------------
function Get_Version (Object : in Cookie) return Natural is
begin
return Object.Version;
end Get_Version;
-- ------------------------------
-- Sets the version of the cookie protocol this cookie complies with.
-- Version 0 complies with the original Netscape cookie specification.
-- Version 1 complies with RFC 2109.
-- ------------------------------
procedure Set_Version (Object : in out Cookie;
Version : in Natural) is
begin
Object.Version := Version;
end Set_Version;
-- ------------------------------
-- Returns True if the cookie has the http-only-flag.
-- ------------------------------
function Is_Http_Only (Object : in Cookie) return Boolean is
begin
return Object.Http_Only;
end Is_Http_Only;
-- ------------------------------
-- Sets the http-only-flag associated with the cookie. When the http-only-flag is
-- set, the cookie is only for http protocols and not exposed to Javascript API.
-- ------------------------------
procedure Set_Http_Only (Object : in out Cookie;
Http_Only : in Boolean) is
begin
Object.Http_Only := Http_Only;
end Set_Http_Only;
-- ------------------------------
-- Get the cookie definition
-- ------------------------------
function To_Http_Header (Object : in Cookie) return String is
use Util.Strings.Builders;
use Ada.Calendar;
V : Natural := Object.Version;
procedure Append_Value (Into : in out Util.Strings.Builders.Builder;
Name : in String;
Value : in Unbounded_String);
procedure Append_Value (Into : in out Util.Strings.Builders.Builder;
Name : in String;
Value : in Unbounded_String) is
Item : constant String := To_String (Value);
begin
if Name'Length > 0 then
if Item'Length = 0 then
return;
end if;
Append (Into, Name);
end if;
if Item'Length > 2 and then Item (Item'First) = '"' and then Item (Item'Last) = '"' then
V := 1;
Append (Into, '"');
Util.Strings.Builders.Transforms.Escape_Java_Script (Content => Item,
Into => Into);
Append (Into, '"');
else
Append (Into, Item);
end if;
end Append_Value;
Result : Util.Strings.Builders.Builder (Len => 256);
Buf : Util.Strings.Builders.Builder (Len => 256);
begin
Append (Result, To_String (Object.Name));
Append (Result, '=');
Append_Value (Result, "", Object.Value);
Append_Value (Buf, "; Domain=", Object.Domain);
Append_Value (Buf, "; Path=", Object.Path);
if Length (Object.Comment) > 0 then
V := 1;
end if;
if V = 1 then
Append (Result, "; Version=1");
Append_Value (Result, "; Comment=", Object.Comment);
Append (Result, "; Max-Age=");
Append (Result, Util.Strings.Image (Object.Max_Age));
elsif Object.Max_Age >= 0 then
Append (Result, "; Expires=");
if Object.Max_Age = 0 then
Append (Result, "Thu, 01-Jan-1970 00:00:01 GMT");
else
Util.Dates.RFC7231.Append_Date (Result,
Ada.Calendar.Clock + Duration (Object.Max_Age));
end if;
end if;
Append_Value (Result, "; Domain=", Object.Domain);
Append_Value (Result, "; Path=", Object.Path);
if Object.Secure then
Append (Result, "; Secure");
end if;
if Object.Http_Only then
Append (Result, "; HttpOnly");
end if;
return Util.Strings.Builders.To_Array (Result);
end To_Http_Header;
-- ------------------------------
-- Get number of cookies present in the header value
-- ------------------------------
function Get_Cookie_Count (Header : in String) return Natural is
Pos : Natural := Header'First;
Cnt : Natural := 0;
In_Value : Boolean := False;
begin
while Pos <= Header'Last loop
declare
C : constant Character := Header (Pos);
begin
if In_Value then
if C = ';' or else C = ',' then
In_Value := False;
end if;
else
if C = '=' then
Cnt := Cnt + 1;
In_Value := True;
end if;
end if;
end;
Pos := Pos + 1;
end loop;
return Cnt;
end Get_Cookie_Count;
-- ------------------------------
-- Parse the header and return an array of cookies.
-- ------------------------------
function Get_Cookies (Header : in String) return Cookie_Array_Access is
Cnt : constant Natural := Get_Cookie_Count (Header);
Result : constant Cookie_Array_Access := new Cookie_Array (1 .. Cnt);
Pos : Natural := Header'First;
Idx : Positive := 1;
Start_Pos : Natural;
End_Pos : Natural;
Is_Special : Boolean;
C : Character;
begin
while Pos < Header'Last loop
-- Skip spaces
while Pos < Header'Last loop
C := Header (Pos);
exit when C /= ' ' and then C /= ASCII.HT;
Pos := Pos + 1;
end loop;
Start_Pos := Pos;
Is_Special := C = '$';
if Is_Special then
Pos := Pos + 1;
end if;
-- Find the token end position
while Pos < Header'Last loop
C := Header (Pos);
exit when Maps.Is_In (Element => C, Set => Reserved);
Pos := Pos + 1;
end loop;
End_Pos := Pos - 1;
exit when Start_Pos > End_Pos;
Result (Idx).Name := To_Unbounded_String (Header (Start_Pos .. End_Pos));
-- Skip spaces
while Pos < Header'Last loop
C := Header (Pos);
exit when C /= ' ' and then C /= ASCII.HT;
Pos := Pos + 1;
end loop;
if C = '=' then
Pos := Pos + 1;
-- Skip spaces
while Pos <= Header'Last loop
C := Header (Pos);
exit when C /= ' ' and then C /= ASCII.HT;
Pos := Pos + 1;
end loop;
Start_Pos := Pos;
if C = ';' then
null;
elsif C = '"' then
Pos := Pos + 1;
else
Start_Pos := Pos;
while Pos <= Header'Last loop
C := Header (Pos);
exit when Maps.Is_In (Element => C, Set => Forbidden);
Pos := Pos + 1;
end loop;
end if;
if Start_Pos < Pos then
Result (Idx).Value := To_Unbounded_String (Header (Start_Pos .. Pos - 1));
end if;
end if;
Idx := Idx + 1;
exit when Idx > Cnt;
while Pos <= Header'Last loop
C := Header (Pos);
exit when C /= ' ' and then C /= ASCII.HT;
Pos := Pos + 1;
end loop;
if C = ';' then
Pos := Pos + 1;
end if;
end loop;
return Result;
end Get_Cookies;
end Util.Http.Cookies;
|
persan/protobuf-ada | Ada | 57 | ads | package jspb.filenametest is
end jspb.filenametest; |
reznikmm/matreshka | Ada | 5,040 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-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$
------------------------------------------------------------------------------
-- This package is for internal use only.
------------------------------------------------------------------------------
package body XML.SAX.Attributes.Internals is
----------------------
-- Unchecked_Append --
----------------------
procedure Unchecked_Append
(Self : in out SAX_Attributes'Class;
Namespace_URI :
not null Matreshka.Internals.Strings.Shared_String_Access;
Local_Name :
not null Matreshka.Internals.Strings.Shared_String_Access;
Qualified_Name :
not null Matreshka.Internals.Strings.Shared_String_Access;
Value :
not null Matreshka.Internals.Strings.Shared_String_Access;
Value_Type :
not null Matreshka.Internals.Strings.Shared_String_Access;
Is_Declared : Boolean;
Is_Specified : Boolean) is
begin
-- Detach and reallocate shared object when necessary.
Detach (Self.Data, Self.Data.Length + 1);
-- Add attribute.
Matreshka.Internals.Strings.Reference (Namespace_URI);
Matreshka.Internals.Strings.Reference (Local_Name);
Matreshka.Internals.Strings.Reference (Qualified_Name);
Matreshka.Internals.Strings.Reference (Value);
Matreshka.Internals.Strings.Reference (Value_Type);
Self.Data.Length := Self.Data.Length + 1;
Self.Data.Values (Self.Data.Length) :=
(Namespace_URI => Namespace_URI,
Local_Name => Local_Name,
Qualified_Name => Qualified_Name,
Value => Value,
Value_Type => Value_Type,
Is_Declared => Is_Declared,
Is_Specified => Is_Specified);
end Unchecked_Append;
end XML.SAX.Attributes.Internals;
|
alexcamposruiz/dds-requestreply | Ada | 30 | ads | package Primes is
end Primes;
|
python36/0xfa | Ada | 173 | adb | package body env is
function validate_variable (s : string) return boolean is
begin
return gnat.regexp.match(s, variable_regexp);
end validate_variable;
end env; |
charlie5/aIDE | Ada | 10,201 | adb | with
aIDE.GUI,
aIDE.Style,
AdaM.Assist;
with Ada.Text_IO; use Ada.Text_IO;
with Glib; use Glib;
with Glib.Error; use Glib.Error;
with Glib.Object; use Glib.Object;
with Gtk.Box; use Gtk.Box;
with Gtk.Builder; use Gtk.Builder;
with Gtk.GEntry; use Gtk.GEntry;
with Gtk.Handlers;
with Gtk.Text_View; use Gtk.Text_View;
with Common_Gtk; use Common_Gtk;
with Gtk.Alignment; use Gtk.Alignment;
package body aIDE.Editor.of_package
is
use Gtk.Widget;
function on_name_Entry_leave (the_Entry : access Gtk_Entry_Record'Class;
Self : in aIDE.Editor.of_package.view) return Boolean
is
the_Text : constant String := the_Entry.Get_Text;
begin
Self.my_Package.Name_is (AdaM.Identifier (the_Text));
aIDE.GUI.update_selected_package_Name (String (Self.my_Package.full_Name));
return False;
end on_name_Entry_leave;
package Entry_return_Callbacks is new Gtk.Handlers.User_Return_Callback (Gtk_Entry_Record,
Boolean,
aIDE.Editor.of_package.view);
function on_declarations_Label_clicked (the_Label : access Gtk_Label_Record'Class;
Self : in aIDE.Editor.of_package.view) return Boolean
is
-- the_Entity : adam.Source.Entity_View := adam.Declaration.new_Declaration ("new").all'Access;
begin
put_Line ("on_declarations_Label_clicked");
aIDE.GUI.show_source_entities_Palette (Invoked_by => Self.all'Access,
Target => Self.my_Package.Children); -- .public_Entities);
-- the_Declaration.Type_is (adam.Applet.fetch_Type ("Standard.Integer"));
-- Self.my_Package.add (the_Entity);
-- Self.freshen;
return False;
end on_declarations_Label_clicked;
package Label_return_Callbacks is new Gtk.Handlers.User_Return_Callback (Gtk_Label_Record,
Boolean,
aIDE.Editor.of_package.view);
package body Forge
is
function to_package_Editor (the_Package : in adam.a_Package.view) return View
is
Self : constant Editor.of_package.view := new Editor.of_package.item;
the_Builder : Gtk_Builder;
Error : aliased GError;
Result : Guint;
begin
Self.my_Package := the_Package;
-- Self.public_Part := public_Part;
Gtk_New (the_Builder);
Result := the_Builder.Add_From_File ("glade/editor/package_editor.glade", Error'Access);
if Error /= null then
Put_Line ("Error: adam.Editor.block ~ " & Get_Message (Error));
Error_Free (Error);
end if;
Self.Notebook := gtk_Notebook (the_Builder.get_Object ("top_Notebook"));
Self.top_Box := gtk_Box (the_Builder.get_Object ("top_Box"));
Self. public_entities_Box := gtk_Box (the_Builder.get_Object ("public_entities_Box"));
Self.private_entities_Box := gtk_Box (the_Builder.get_Object ("private_entities_Box"));
Self. public_context_Alignment := gtk_Alignment (the_Builder.get_Object ("public_context_Alignment"));
Self.private_context_Alignment := gtk_Alignment (the_Builder.get_Object ("private_context_Alignment"));
Self.name_Entry := gtk_Entry (the_Builder.get_Object ("name_Entry"));
Self.package_Label := gtk_Label (the_Builder.get_Object ("package_Label"));
Self.declarations_Label := gtk_Label (the_Builder.get_Object ("declarations_Label"));
Self.public_context_Editor := aIDE.Editor.of_context.Forge.to_context_Editor (Self.my_Package.Context);
Self.public_context_Editor.top_Widget.Reparent (new_Parent => Self.public_context_Alignment);
Self.private_context_Editor := aIDE.Editor.of_context.Forge.to_context_Editor (Self.my_Package.Context);
Self.private_context_Editor.top_Widget.Reparent (new_Parent => Self.private_context_Alignment);
Self. declare_Text := Gtk_Text_View (the_Builder.get_Object ( "declare_Textview"));
Self. begin_Text := Gtk_Text_View (the_Builder.get_Object ( "begin_Textview"));
Self.exception_Text := Gtk_Text_View (the_Builder.get_Object ("exception_Textview"));
Entry_return_Callbacks.Connect (Self.name_Entry,
"focus-out-event",
on_name_Entry_leave'Access,
Self);
Label_return_Callbacks.Connect (Self.declarations_Label,
"button-release-event",
on_declarations_Label_clicked'Access,
Self);
Self.freshen;
enable_bold_Tabs_for (Self.Notebook);
return Self;
end to_package_Editor;
end Forge;
procedure destroy_Widget (Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class)
is
begin
Widget.destroy;
end destroy_Widget;
overriding
procedure freshen (Self : in out Item)
is
use AdaM.Assist;
begin
put_Line ("KKKKK " & (String (Self.my_Package.full_Name)));
declare
use AdaM;
parent_Prefix : constant Identifier := strip_standard_Prefix (parent_Name (Self.my_Package.full_Name));
begin
put_Line ("Self.my_Package.full_Name = " & String (Self.my_Package.full_Name));
put_Line ("parent_Name (Self.my_Package.full_Name) = " & String (parent_Name (Self.my_Package.full_Name)));
put_Line ("parent_Prefix = " & String (parent_Prefix));
if parent_Prefix = ""
then
Self.package_Label.set_Text ("package ");
else
Self.package_Label.set_Text ("package " & String (parent_Prefix) & ".");
end if;
Self.name_Entry.set_Text (String (Self.my_Package.Name));
end;
-- Destroy all prior entity widgets.
--
loop
declare
the_Child : constant gtk_Widget := Self.public_entities_Box.get_Child (0);
begin
exit when the_Child = null;
the_Child.destroy;
end;
end loop;
loop
declare
the_Child : constant gtk_Widget := Self.private_entities_Box.get_Child (0);
begin
exit when the_Child = null;
the_Child.destroy;
end;
end loop;
-- Create all entity widgets.
--
declare
-- the_Entities : constant access adam.Source.Entity_Vector := Self.my_Package.public_Entities;
the_Entities : constant adam.Entity.Entities_view := Self.my_Package.Children;
the_Entity : adam.Entity.view;
begin
for i in 1 .. Integer (the_Entities.Length)
loop
the_Entity := the_Entities.Element (i);
declare
the_Editor : constant aIDE.Editor.view := aIDE.Editor.to_Editor (the_Entity);
begin
if the_Editor /= null
then
if the_Entity.is_Public
then
if the_Editor.top_Widget.Get_Parent = null
then
Self.public_entities_Box.pack_Start (the_Editor.top_Widget);
else
the_Editor.top_Widget.reparent (Self.public_entities_Box);
end if;
else
if the_Editor.top_Widget.Get_Parent = null
then
Self.private_entities_Box.pack_Start (the_Editor.top_Widget);
else
the_Editor.top_Widget.reparent (Self.private_entities_Box);
end if;
end if;
end if;
end;
end loop;
end;
-- aIDE.Style.apply_Css (Self.top_Widget); -- TODO: This causes a truckload of gtk warnings.
-- Operations
--
-- declare
-- the_Operations : adam.Operation.Vector := Self.Class.Operations;
-- begin
-- loop
-- declare
-- the_Child : gtk_Widget := Self.operations_Box.Get_Child (0);
-- begin
-- exit when the_Child = null;
-- the_Child.destroy;
-- end;
-- end loop;
--
-- for i in 1 .. Integer (the_Operations.Length)
-- loop
-- declare
-- the_Operation : adam.Operation .view renames the_Operations.Element (i);
-- the_operation_Editor : adam.Editor.operation.view := adam.Editor.operation.Forge.to_operation_Editor (the_Operation,
-- Self.of_package);
-- begin
-- the_operation_Editor.top_Widget.reparent (Self.operations_Box);
-- end;
-- end loop;
-- end;
end freshen;
function my_Package (Self : in Item) return adam.a_Package.view
is
begin
return Self.my_Package;
end my_Package;
procedure Package_is (Self : in out Item; Now : in adam.a_Package.view)
is
begin
Self.my_Package := Now;
Self. public_context_Editor.Context_is (Self.my_Package.Context);
Self.private_context_Editor.Context_is (Self.my_Package.Context);
Self.freshen;
end Package_is;
overriding function top_Widget (Self : in Item) return gtk.Widget.Gtk_Widget
is
begin
return gtk.Widget.Gtk_Widget (Self.Notebook);
end top_Widget;
end aIDE.Editor.of_package;
|
reznikmm/matreshka | Ada | 6,800 | 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_Draw.Measure_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Draw_Measure_Element_Node is
begin
return Self : Draw_Measure_Element_Node do
Matreshka.ODF_Draw.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Draw_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Draw_Measure_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Draw_Measure
(ODF.DOM.Draw_Measure_Elements.ODF_Draw_Measure_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Draw_Measure_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Measure_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Draw_Measure_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Draw_Measure
(ODF.DOM.Draw_Measure_Elements.ODF_Draw_Measure_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Draw_Measure_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Draw_Measure
(Visitor,
ODF.DOM.Draw_Measure_Elements.ODF_Draw_Measure_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Draw_URI,
Matreshka.ODF_String_Constants.Measure_Element,
Draw_Measure_Element_Node'Tag);
end Matreshka.ODF_Draw.Measure_Elements;
|
reznikmm/matreshka | Ada | 3,749 | 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.Form_Apply_Design_Mode_Attributes is
pragma Preelaborate;
type ODF_Form_Apply_Design_Mode_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Form_Apply_Design_Mode_Attribute_Access is
access all ODF_Form_Apply_Design_Mode_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Form_Apply_Design_Mode_Attributes;
|
byllgrim/iictl | Ada | 3,927 | adb | -- See LICENSE file for cc0 license details
with Ada.Command_Line;
with Ada.Directories;
with Ada.Exceptions; use Ada.Exceptions; -- TODO remove
with Ada.Strings.Unbounded;
with Ada.Text_Io;
with Ch_Conn;
with Posix.Io;
with Posix.Process_Identification;
with Posix.User_Database;
with Srv_Conn;
with Srv_Quit;
with Util;
-- TODO check unused withs
package body Iictl is
package ACL renames Ada.Command_Line;
package ASU renames Ada.Strings.Unbounded;
package ATIO renames Ada.Text_Io;
package PIO renames Posix.Io;
package PPI renames Posix.Process_Identification;
package PUD renames Posix.User_Database;
-- TODO remove unused renames
Irc_Dir : ASU.Unbounded_String;
-- TODO different directories for different servers?
Nick : ASU.Unbounded_String;
-- TODO package globals in .ads?
procedure Iictl is
begin
Parse_Options;
-- TODO set file offset to end of channel outs?
if ASU.Length (Nick) = 0 then
ATIO.Put_Line ("No nick given");
-- TODO Print_Usage;
return;
end if;
Util.Verbose_Print ("Iictl: started");
Util.Verbose_Print ("Nick = " & ASU.To_String (Nick));
Util.Verbose_Print ("Irc_Dir = " & ASU.To_String (Irc_Dir));
loop
Srv_Conn.Reconnect_Servers (ASU.To_String (Irc_Dir),
ASU.To_String (Nick));
-- TODO rename Server_Reconnection, Connection_Ctrl, ...
Ch_Conn.Rejoin_Channels (ASU.To_String (Irc_Dir));
-- TODO rename Rejoin_Ctl or something
Srv_Quit.Detect_Quits (ASU.To_String (Irc_Dir));
-- TODO make Irc_Dir accessible from e.g. Iictl?
-- TODO Ch_Conn.Detect_Parts;
Delay 1.0; -- TODO remove? speed up? ravenclaw!
end loop;
end Iictl;
procedure Parse_Options is
I : Integer := 1;
begin
Irc_Dir := Default_Irc_Dir;
-- TODO same opts as ii?
-- [-i <irc dir>] [-s <host>] [-p <port>]
-- [-n <nick>] [-k <password>] [-f <fullname>]
-- TODO move to Util
-- TODO refactor to separate subprogram TODO move to Main
-- TODO initialize I more locally
while I <= ACL.Argument_Count loop
begin
if ACL.Argument (I) = "-n" then
I := I + 1;
Nick := ASU.To_Unbounded_String (ACL.Argument (I));
elsif ACL.Argument (I) = "-v" then -- TODO use case
Util.Verbose := True;
Util.Verbose_Print ("Iictl: Verbose printing on");
elsif ACL.Argument (I) = "-i" then
I := I + 1;
Irc_Dir := ASU.To_Unbounded_String (ACL.Argument (I));
else
raise CONSTRAINT_ERROR; -- TODO different exception
end if;
I := I + 1;
exception
when CONSTRAINT_ERROR =>
ATIO.Put_Line ("usage: " & ACL.Command_Name
& " [-v]" & " <-n nick>");
return;
end;
end loop;
end Parse_Options;
function Default_Irc_Dir return ASU.Unbounded_String is
use type Ada.Strings.Unbounded.Unbounded_String;
Uid : PPI.User_Id;
Db_Item : PUD.User_Database_Item;
-- TODO Home_Dir : Posix.Posix_String
Home_Dir : ASU.Unbounded_String;
begin
Uid := PPI.Get_Effective_User_ID;
Db_Item := PUD.Get_User_Database_Item (Uid);
--Home_Dir := PUD.Initial_Directory_Of (Db_Item);
Home_Dir := ASU.To_Unbounded_String (
Posix.To_String (
PUD.Initial_Directory_Of (Db_Item)));
--return ASU.To_Unbounded_String (Posix.To_String (Home_Dir) & "/irc");
return Home_Dir & ASU.To_Unbounded_String ("/irc");
end Default_Irc_Dir;
end Iictl;
|
Fabien-Chouteau/GESTE | Ada | 29,836 | ads | package GESTE_Fonts.FreeSansBoldOblique8pt7b is
Font : constant Bitmap_Font_Ref;
private
FreeSansBoldOblique8pt7bBitmaps : aliased constant Font_Bitmap := (
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#0E#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#,
16#1C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#10#,
16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#19#, 16#80#, 16#19#, 16#80#, 16#19#, 16#80#,
16#11#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#C0#,
16#0C#, 16#80#, 16#3F#, 16#C0#, 16#3F#, 16#C0#, 16#19#, 16#00#, 16#13#,
16#00#, 16#7F#, 16#80#, 16#7F#, 16#80#, 16#26#, 16#00#, 16#6C#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#02#, 16#00#,
16#0F#, 16#80#, 16#1A#, 16#C0#, 16#32#, 16#C0#, 16#36#, 16#00#, 16#3C#,
16#00#, 16#1F#, 16#00#, 16#07#, 16#80#, 16#05#, 16#80#, 16#6D#, 16#80#,
16#7B#, 16#00#, 16#3E#, 16#00#, 16#08#, 16#00#, 16#08#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#0E#, 16#08#, 16#1F#, 16#10#, 16#33#, 16#30#, 16#33#, 16#20#, 16#33#,
16#40#, 16#3E#, 16#80#, 16#1D#, 16#80#, 16#01#, 16#3C#, 16#02#, 16#7C#,
16#04#, 16#C4#, 16#0C#, 16#7C#, 16#08#, 16#78#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#03#, 16#80#, 16#07#, 16#C0#, 16#0C#, 16#C0#, 16#0C#,
16#C0#, 16#0F#, 16#80#, 16#0E#, 16#00#, 16#1F#, 16#60#, 16#33#, 16#E0#,
16#71#, 16#C0#, 16#73#, 16#C0#, 16#3F#, 16#C0#, 16#1E#, 16#E0#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#,
16#00#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#0C#,
16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#,
16#30#, 16#00#, 16#20#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#60#,
16#00#, 16#20#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#08#, 16#00#,
16#0C#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#08#, 16#00#, 16#18#,
16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#04#, 16#00#, 16#17#, 16#00#, 16#1E#, 16#00#, 16#1C#, 16#00#,
16#14#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#, 16#3F#,
16#80#, 16#7F#, 16#80#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#,
16#70#, 16#00#, 16#20#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#70#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#02#, 16#00#, 16#04#, 16#00#, 16#04#, 16#00#, 16#08#,
16#00#, 16#08#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#, 16#20#, 16#00#,
16#20#, 16#00#, 16#40#, 16#00#, 16#40#, 16#00#, 16#80#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#80#, 16#0F#, 16#80#, 16#19#,
16#C0#, 16#38#, 16#C0#, 16#31#, 16#C0#, 16#31#, 16#C0#, 16#31#, 16#80#,
16#71#, 16#80#, 16#71#, 16#80#, 16#73#, 16#00#, 16#3F#, 16#00#, 16#1C#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#,
16#00#, 16#1F#, 16#00#, 16#1F#, 16#00#, 16#07#, 16#00#, 16#06#, 16#00#,
16#06#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#, 16#0E#, 16#00#, 16#0C#,
16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#,
16#80#, 16#1F#, 16#C0#, 16#18#, 16#C0#, 16#30#, 16#C0#, 16#00#, 16#C0#,
16#01#, 16#80#, 16#03#, 16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#, 16#30#,
16#00#, 16#7F#, 16#80#, 16#7F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#0F#, 16#80#, 16#1F#, 16#C0#, 16#39#, 16#C0#, 16#01#, 16#C0#,
16#01#, 16#80#, 16#07#, 16#00#, 16#07#, 16#80#, 16#01#, 16#80#, 16#01#,
16#80#, 16#63#, 16#80#, 16#7F#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#03#, 16#80#,
16#05#, 16#80#, 16#0B#, 16#80#, 16#13#, 16#00#, 16#23#, 16#00#, 16#7F#,
16#80#, 16#7F#, 16#80#, 16#07#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#C0#,
16#0F#, 16#C0#, 16#18#, 16#00#, 16#17#, 16#00#, 16#3F#, 16#80#, 16#31#,
16#80#, 16#01#, 16#80#, 16#01#, 16#80#, 16#63#, 16#00#, 16#7F#, 16#00#,
16#3C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#80#,
16#0F#, 16#C0#, 16#18#, 16#C0#, 16#18#, 16#00#, 16#37#, 16#00#, 16#3F#,
16#80#, 16#31#, 16#80#, 16#71#, 16#80#, 16#61#, 16#80#, 16#73#, 16#80#,
16#3F#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#1F#, 16#E0#, 16#1F#, 16#E0#, 16#00#, 16#C0#, 16#01#,
16#80#, 16#03#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#,
16#18#, 16#00#, 16#18#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#0F#, 16#80#, 16#1F#, 16#C0#, 16#18#, 16#C0#, 16#19#,
16#C0#, 16#1F#, 16#00#, 16#1F#, 16#80#, 16#31#, 16#80#, 16#61#, 16#80#,
16#61#, 16#80#, 16#73#, 16#80#, 16#7F#, 16#00#, 16#3E#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#1F#, 16#80#, 16#19#,
16#C0#, 16#30#, 16#C0#, 16#31#, 16#C0#, 16#31#, 16#C0#, 16#3F#, 16#80#,
16#1D#, 16#80#, 16#03#, 16#80#, 16#63#, 16#00#, 16#7E#, 16#00#, 16#3C#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#1C#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#38#,
16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#1C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#38#, 16#00#, 16#38#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#40#, 16#03#, 16#C0#, 16#0F#, 16#80#, 16#3C#, 16#00#, 16#78#,
16#00#, 16#3F#, 16#00#, 16#07#, 16#80#, 16#01#, 16#80#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#C0#, 16#3F#, 16#C0#, 16#00#,
16#00#, 16#00#, 16#00#, 16#7F#, 16#80#, 16#7F#, 16#80#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#3C#,
16#00#, 16#1F#, 16#80#, 16#03#, 16#C0#, 16#07#, 16#80#, 16#3E#, 16#00#,
16#78#, 16#00#, 16#40#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#80#,
16#0F#, 16#C0#, 16#1C#, 16#E0#, 16#18#, 16#E0#, 16#00#, 16#C0#, 16#01#,
16#C0#, 16#03#, 16#80#, 16#06#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#,
16#0E#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F8#,
16#03#, 16#FE#, 16#07#, 16#07#, 16#0C#, 16#03#, 16#18#, 16#01#, 16#30#,
16#E9#, 16#33#, 16#19#, 16#62#, 16#11#, 16#66#, 16#23#, 16#66#, 16#66#,
16#67#, 16#BE#, 16#23#, 16#38#, 16#30#, 16#00#, 16#18#, 16#20#, 16#0F#,
16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#01#, 16#C0#, 16#03#, 16#C0#, 16#03#, 16#C0#, 16#07#,
16#C0#, 16#0E#, 16#C0#, 16#0E#, 16#C0#, 16#1C#, 16#E0#, 16#1C#, 16#E0#,
16#3F#, 16#E0#, 16#3F#, 16#E0#, 16#70#, 16#60#, 16#60#, 16#60#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#E0#, 16#1F#, 16#F0#, 16#1C#,
16#30#, 16#18#, 16#30#, 16#18#, 16#70#, 16#1F#, 16#E0#, 16#3F#, 16#E0#,
16#38#, 16#60#, 16#30#, 16#60#, 16#30#, 16#60#, 16#3F#, 16#C0#, 16#7F#,
16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E0#, 16#0F#,
16#F0#, 16#0C#, 16#38#, 16#18#, 16#38#, 16#38#, 16#00#, 16#30#, 16#00#,
16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#70#, 16#38#, 16#E0#, 16#1F#,
16#C0#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#,
16#E0#, 16#1F#, 16#F0#, 16#1C#, 16#70#, 16#18#, 16#30#, 16#18#, 16#30#,
16#18#, 16#30#, 16#38#, 16#30#, 16#38#, 16#70#, 16#30#, 16#60#, 16#30#,
16#E0#, 16#3F#, 16#C0#, 16#7F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#0F#, 16#F0#, 16#1F#, 16#F0#, 16#1C#, 16#00#, 16#18#, 16#00#,
16#18#, 16#00#, 16#1F#, 16#E0#, 16#3F#, 16#C0#, 16#38#, 16#00#, 16#30#,
16#00#, 16#30#, 16#00#, 16#3F#, 16#C0#, 16#7F#, 16#C0#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#0F#, 16#F0#, 16#1F#, 16#F0#, 16#1C#, 16#00#,
16#18#, 16#00#, 16#18#, 16#00#, 16#1F#, 16#C0#, 16#3F#, 16#C0#, 16#38#,
16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#70#, 16#00#, 16#70#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E0#, 16#0F#, 16#F8#,
16#1C#, 16#18#, 16#18#, 16#00#, 16#38#, 16#00#, 16#30#, 16#F8#, 16#30#,
16#F0#, 16#30#, 16#30#, 16#30#, 16#30#, 16#38#, 16#70#, 16#1F#, 16#F0#,
16#0F#, 16#A0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#38#,
16#1C#, 16#38#, 16#1C#, 16#30#, 16#18#, 16#30#, 16#18#, 16#30#, 16#3F#,
16#F0#, 16#3F#, 16#F0#, 16#30#, 16#60#, 16#30#, 16#60#, 16#30#, 16#60#,
16#70#, 16#E0#, 16#70#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#1C#, 16#00#, 16#1C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#,
16#00#, 16#38#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#,
16#30#, 16#00#, 16#70#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#C0#, 16#01#, 16#C0#, 16#01#,
16#C0#, 16#01#, 16#80#, 16#01#, 16#80#, 16#01#, 16#80#, 16#73#, 16#80#,
16#63#, 16#80#, 16#63#, 16#00#, 16#7F#, 16#00#, 16#3C#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#38#, 16#1C#, 16#70#, 16#1C#,
16#E0#, 16#19#, 16#C0#, 16#1B#, 16#80#, 16#1F#, 16#00#, 16#3F#, 16#00#,
16#3B#, 16#80#, 16#31#, 16#C0#, 16#31#, 16#C0#, 16#70#, 16#E0#, 16#70#,
16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#1C#,
16#00#, 16#1C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#,
16#38#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#3F#,
16#C0#, 16#7F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1E#,
16#1E#, 16#1E#, 16#1E#, 16#1E#, 16#3C#, 16#1E#, 16#3C#, 16#1E#, 16#6C#,
16#3E#, 16#6C#, 16#36#, 16#5C#, 16#36#, 16#D8#, 16#32#, 16#98#, 16#33#,
16#98#, 16#73#, 16#B8#, 16#63#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#1C#, 16#18#, 16#1E#, 16#38#, 16#1E#, 16#38#, 16#1E#, 16#30#,
16#1F#, 16#30#, 16#3B#, 16#30#, 16#3B#, 16#70#, 16#31#, 16#F0#, 16#31#,
16#E0#, 16#31#, 16#E0#, 16#70#, 16#E0#, 16#60#, 16#E0#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#03#, 16#E0#, 16#0F#, 16#F0#, 16#0C#, 16#38#,
16#18#, 16#18#, 16#38#, 16#18#, 16#30#, 16#18#, 16#30#, 16#18#, 16#30#,
16#38#, 16#30#, 16#30#, 16#38#, 16#60#, 16#1F#, 16#E0#, 16#0F#, 16#80#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#E0#, 16#1F#, 16#F0#,
16#1C#, 16#70#, 16#18#, 16#30#, 16#18#, 16#70#, 16#18#, 16#60#, 16#3F#,
16#E0#, 16#3F#, 16#80#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#,
16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E0#,
16#0F#, 16#F0#, 16#0C#, 16#38#, 16#18#, 16#18#, 16#38#, 16#18#, 16#30#,
16#18#, 16#30#, 16#18#, 16#30#, 16#B8#, 16#31#, 16#F0#, 16#38#, 16#E0#,
16#1F#, 16#E0#, 16#0F#, 16#B0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#0F#, 16#F0#, 16#1F#, 16#F0#, 16#1C#, 16#38#, 16#18#, 16#30#, 16#18#,
16#30#, 16#1F#, 16#E0#, 16#3F#, 16#E0#, 16#38#, 16#60#, 16#30#, 16#60#,
16#30#, 16#E0#, 16#30#, 16#E0#, 16#70#, 16#E0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#07#, 16#C0#, 16#0F#, 16#E0#, 16#18#, 16#70#, 16#38#,
16#70#, 16#38#, 16#00#, 16#1F#, 16#80#, 16#0F#, 16#E0#, 16#00#, 16#E0#,
16#70#, 16#60#, 16#70#, 16#C0#, 16#3F#, 16#C0#, 16#1F#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#F0#, 16#3F#, 16#F0#, 16#03#,
16#00#, 16#03#, 16#00#, 16#07#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#,
16#06#, 16#00#, 16#0E#, 16#00#, 16#0E#, 16#00#, 16#0C#, 16#00#, 16#0C#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#38#, 16#1C#,
16#38#, 16#1C#, 16#30#, 16#18#, 16#30#, 16#18#, 16#30#, 16#18#, 16#70#,
16#38#, 16#70#, 16#38#, 16#60#, 16#30#, 16#60#, 16#38#, 16#E0#, 16#3F#,
16#C0#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#,
16#38#, 16#18#, 16#30#, 16#18#, 16#60#, 16#1C#, 16#60#, 16#1C#, 16#C0#,
16#0C#, 16#C0#, 16#0D#, 16#80#, 16#0D#, 16#80#, 16#0F#, 16#00#, 16#0F#,
16#00#, 16#0E#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#18#, 16#61#, 16#18#, 16#E3#, 16#18#, 16#E3#, 16#19#, 16#E7#,
16#19#, 16#E6#, 16#19#, 16#66#, 16#1B#, 16#6C#, 16#1B#, 16#6C#, 16#1E#,
16#78#, 16#1E#, 16#78#, 16#1C#, 16#30#, 16#1C#, 16#30#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#1C#, 16#30#, 16#0C#, 16#70#, 16#0E#, 16#E0#,
16#0F#, 16#C0#, 16#07#, 16#80#, 16#07#, 16#00#, 16#07#, 16#00#, 16#0F#,
16#80#, 16#1F#, 16#80#, 16#39#, 16#80#, 16#31#, 16#C0#, 16#71#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#38#, 16#1C#, 16#70#,
16#0C#, 16#60#, 16#0C#, 16#C0#, 16#0F#, 16#C0#, 16#07#, 16#80#, 16#07#,
16#00#, 16#07#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#,
16#0E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#F0#,
16#1F#, 16#E0#, 16#00#, 16#E0#, 16#01#, 16#C0#, 16#03#, 16#80#, 16#07#,
16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#, 16#38#, 16#00#, 16#70#, 16#00#,
16#7F#, 16#C0#, 16#7F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#1E#, 16#00#, 16#1E#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#,
16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#,
16#30#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#78#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#20#, 16#00#, 16#20#, 16#00#, 16#30#, 16#00#, 16#10#,
16#00#, 16#10#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#,
16#10#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#, 16#18#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#3C#,
16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#18#, 16#00#,
16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#30#,
16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#,
16#00#, 16#07#, 16#00#, 16#0D#, 16#00#, 16#0D#, 16#80#, 16#19#, 16#80#,
16#11#, 16#80#, 16#31#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#18#, 16#00#, 16#08#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#0F#, 16#00#, 16#1F#, 16#80#, 16#31#, 16#80#, 16#01#, 16#80#, 16#3F#,
16#80#, 16#73#, 16#80#, 16#63#, 16#00#, 16#7F#, 16#00#, 16#3B#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#18#, 16#00#,
16#18#, 16#00#, 16#1B#, 16#80#, 16#3F#, 16#C0#, 16#38#, 16#C0#, 16#30#,
16#C0#, 16#30#, 16#C0#, 16#30#, 16#C0#, 16#71#, 16#80#, 16#7F#, 16#80#,
16#6E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#1F#, 16#80#, 16#39#,
16#C0#, 16#30#, 16#00#, 16#70#, 16#00#, 16#70#, 16#00#, 16#73#, 16#80#,
16#3F#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#E0#, 16#0F#, 16#C0#, 16#1F#,
16#C0#, 16#39#, 16#C0#, 16#31#, 16#C0#, 16#71#, 16#C0#, 16#71#, 16#80#,
16#73#, 16#80#, 16#3F#, 16#80#, 16#3D#, 16#80#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#,
16#00#, 16#1F#, 16#80#, 16#31#, 16#80#, 16#7F#, 16#80#, 16#7F#, 16#80#,
16#60#, 16#00#, 16#73#, 16#80#, 16#3F#, 16#00#, 16#1E#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#0E#, 16#00#, 16#1C#,
16#00#, 16#3E#, 16#00#, 16#3E#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#,
16#38#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#0E#, 16#C0#, 16#1F#, 16#C0#, 16#39#, 16#C0#,
16#30#, 16#C0#, 16#71#, 16#C0#, 16#71#, 16#80#, 16#73#, 16#80#, 16#3F#,
16#80#, 16#3D#, 16#80#, 16#03#, 16#80#, 16#E3#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#,
16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#1B#, 16#80#, 16#1F#, 16#C0#,
16#38#, 16#C0#, 16#38#, 16#C0#, 16#31#, 16#C0#, 16#31#, 16#80#, 16#31#,
16#80#, 16#71#, 16#80#, 16#61#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#1C#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#,
16#18#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#,
16#00#, 16#30#, 16#00#, 16#70#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#,
16#18#, 16#00#, 16#18#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#30#,
16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#70#, 16#00#, 16#60#, 16#00#,
16#60#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#18#, 16#00#,
16#18#, 16#00#, 16#19#, 16#C0#, 16#3B#, 16#80#, 16#3F#, 16#00#, 16#3E#,
16#00#, 16#3E#, 16#00#, 16#36#, 16#00#, 16#77#, 16#00#, 16#73#, 16#00#,
16#63#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#38#,
16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#,
16#70#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1B#, 16#9C#, 16#3F#,
16#FC#, 16#39#, 16#CE#, 16#31#, 16#8C#, 16#31#, 16#8C#, 16#31#, 16#8C#,
16#71#, 16#9C#, 16#73#, 16#9C#, 16#63#, 16#18#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1B#,
16#80#, 16#1F#, 16#C0#, 16#38#, 16#C0#, 16#30#, 16#C0#, 16#31#, 16#C0#,
16#31#, 16#80#, 16#31#, 16#80#, 16#71#, 16#80#, 16#61#, 16#80#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#0F#, 16#80#, 16#1F#, 16#C0#, 16#39#, 16#C0#, 16#30#, 16#C0#,
16#70#, 16#C0#, 16#71#, 16#C0#, 16#71#, 16#80#, 16#3F#, 16#80#, 16#1E#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#1B#, 16#80#, 16#3F#, 16#C0#, 16#38#, 16#C0#,
16#30#, 16#C0#, 16#30#, 16#C0#, 16#31#, 16#C0#, 16#71#, 16#80#, 16#7F#,
16#80#, 16#6E#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#C0#, 16#1F#, 16#C0#,
16#39#, 16#C0#, 16#31#, 16#C0#, 16#71#, 16#C0#, 16#61#, 16#80#, 16#73#,
16#80#, 16#3F#, 16#80#, 16#3D#, 16#80#, 16#03#, 16#80#, 16#03#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1B#, 16#00#,
16#1E#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#,
16#00#, 16#30#, 16#00#, 16#70#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#0F#, 16#00#, 16#1F#, 16#80#, 16#39#, 16#80#, 16#38#, 16#00#, 16#3F#,
16#00#, 16#0F#, 16#80#, 16#61#, 16#80#, 16#7F#, 16#00#, 16#3E#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#1C#, 16#00#, 16#3E#, 16#00#, 16#3C#, 16#00#, 16#18#, 16#00#, 16#18#,
16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#38#, 16#00#,
16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#C0#, 16#38#, 16#C0#, 16#38#,
16#C0#, 16#30#, 16#C0#, 16#31#, 16#C0#, 16#31#, 16#80#, 16#73#, 16#80#,
16#3F#, 16#80#, 16#3D#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#30#, 16#C0#, 16#39#,
16#C0#, 16#39#, 16#80#, 16#1B#, 16#80#, 16#1B#, 16#00#, 16#1E#, 16#00#,
16#1E#, 16#00#, 16#1C#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#31#,
16#8C#, 16#33#, 16#98#, 16#33#, 16#98#, 16#37#, 16#B0#, 16#37#, 16#B0#,
16#34#, 16#B0#, 16#3C#, 16#E0#, 16#38#, 16#E0#, 16#38#, 16#C0#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#39#, 16#C0#, 16#19#, 16#80#, 16#1F#, 16#00#, 16#0E#, 16#00#,
16#0E#, 16#00#, 16#1E#, 16#00#, 16#3E#, 16#00#, 16#77#, 16#00#, 16#63#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#30#, 16#C0#, 16#39#, 16#C0#, 16#39#, 16#80#,
16#39#, 16#80#, 16#1B#, 16#00#, 16#1B#, 16#00#, 16#1E#, 16#00#, 16#1E#,
16#00#, 16#1C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#80#, 16#3F#, 16#80#,
16#03#, 16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#, 16#38#, 16#00#, 16#70#,
16#00#, 16#7F#, 16#00#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#06#, 16#00#, 16#0E#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#,
16#18#, 16#00#, 16#18#, 16#00#, 16#38#, 16#00#, 16#70#, 16#00#, 16#30#,
16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#,
16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#08#, 16#00#, 16#08#, 16#00#, 16#08#, 16#00#,
16#18#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#, 16#10#, 16#00#, 16#30#,
16#00#, 16#30#, 16#00#, 16#20#, 16#00#, 16#20#, 16#00#, 16#20#, 16#00#,
16#60#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#,
16#1C#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#0C#, 16#00#, 16#0C#,
16#00#, 16#0C#, 16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#, 16#18#, 16#00#,
16#18#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#2C#, 16#80#, 16#07#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#);
Font_D : aliased constant Bitmap_Font :=
(
Bytes_Per_Glyph => 38,
Glyph_Width => 16,
Glyph_Height => 19,
Data => FreeSansBoldOblique8pt7bBitmaps'Access);
Font : constant Bitmap_Font_Ref := Font_D'Access;
end GESTE_Fonts.FreeSansBoldOblique8pt7b;
|
reznikmm/matreshka | Ada | 4,647 | 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_Draw.Extrusion_Metal_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Extrusion_Metal_Attribute_Node is
begin
return Self : Draw_Extrusion_Metal_Attribute_Node do
Matreshka.ODF_Draw.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Draw_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Draw_Extrusion_Metal_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Extrusion_Metal_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Draw_URI,
Matreshka.ODF_String_Constants.Extrusion_Metal_Attribute,
Draw_Extrusion_Metal_Attribute_Node'Tag);
end Matreshka.ODF_Draw.Extrusion_Metal_Attributes;
|
reznikmm/matreshka | Ada | 6,920 | 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_Text.Variable_Decl_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Text_Variable_Decl_Element_Node is
begin
return Self : Text_Variable_Decl_Element_Node do
Matreshka.ODF_Text.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Text_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Text_Variable_Decl_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Text_Variable_Decl
(ODF.DOM.Text_Variable_Decl_Elements.ODF_Text_Variable_Decl_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Text_Variable_Decl_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Variable_Decl_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Text_Variable_Decl_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Text_Variable_Decl
(ODF.DOM.Text_Variable_Decl_Elements.ODF_Text_Variable_Decl_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Text_Variable_Decl_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Text_Variable_Decl
(Visitor,
ODF.DOM.Text_Variable_Decl_Elements.ODF_Text_Variable_Decl_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.Variable_Decl_Element,
Text_Variable_Decl_Element_Node'Tag);
end Matreshka.ODF_Text.Variable_Decl_Elements;
|
jrcarter/Ada_GUI | Ada | 7,138 | ads | -- --
-- package Copyright (c) Dmitry A. Kazakov --
-- Parsers.Multiline_Source Luebeck --
-- Interface Winter, 2004 --
-- --
-- Last revision : 12:54 06 Jun 2009 --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public License as --
-- published by the Free Software Foundation; either version 2 of --
-- the License, or (at your option) any later version. This library --
-- is distributed in the hope that it will be useful, but WITHOUT --
-- ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. You should have --
-- received a copy of the GNU General Public License along with --
-- this library; if not, write to the Free Software Foundation, --
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
--____________________________________________________________________--
--
-- This package provides an implementation of code sources consisting
-- of several lines. The package defines an abstract base type Source.
--
with Ada.Finalization;
with Ada.Unchecked_Deallocation;
with Parsers.Generic_Source;
package Parsers.Multiline_Source is
type Line_Number is new Natural;
--
-- Position -- File postion
--
type Position is record
Line : Line_Number;
Column : Integer;
end record;
function "<" (Left, Right : Position) return Boolean;
--
-- Location -- File slice from First to previous to Next
--
type Location is record
First : Position;
Next : Position;
end record;
type String_Ptr is access all String;
--
-- Source -- The source containing a file
--
-- Buffer - The source line buffer
-- Line - The current source line number
-- Length - The current line length
-- Pointer - The second cursor
-- Last - The first (backup) cursor
--
-- The field Buffer points to a string, which is used to keep the
-- current source line. The constructor allocates the buffer of some
-- reasonable size. When a new line is requested the buffer can be
-- replaced by a greater one if necessary. The destructor deallocates
-- the buffer.
--
type Source is
abstract new Ada.Finalization.Limited_Controlled with
record
Buffer : String_Ptr;
Line : Line_Number := 0;
Length : Natural;
Pointer : Integer;
Last : Integer;
end record;
type Line_Ptr is access constant String;
--
-- Finalize -- Destruction
--
-- Code - The source code
--
procedure Finalize (Code : in out Source);
--
-- Initialize -- Construction
--
-- Code - The source code
--
procedure Initialize (Code : in out Source);
--
-- Get_Line -- Read the next line into the buffer
--
-- Code - The source code
--
-- An implementation should read a complete next line into
-- Code.Buffer.all. It may reallocate the buffer if necessary. After
-- successful completion Code.Buffer should point to a buffer containing
-- the line and Code.Length should be the line length. The rest of the
-- buffer is ignored.
--
-- Exceptions :
--
-- End_Error - No more lines available
-- Any other - I/O error etc
--
procedure Get_Line (Code : in out Source) is abstract;
--
-- Get_Location -- Of an error from an error message string
--
-- Message - An error message
-- Prefix - Introducing error location image
--
-- This function searches for a location image in an error message
-- string. The image is searched backwards for an appearance of Prefix.
-- If an image does not follow Prefix search continues. The result is
-- the location decoded according to the format used by Image. If no
-- image found the result is ((0,0), (0,0).
--
-- Returns :
--
-- The rightmost location
--
function Get_Location
( Message : String;
Prefix : String := "at "
) return Location;
--
-- Skip -- Advance source to the specified location
--
-- Code - The source code
-- Link - Location
--
-- This procedure advances the source Code to the location Link, so that
-- the result of Link (Code) would equal to the value of the parameter
-- Link. Layout_Error is propagated when the source is beyond the first
-- position of Link. It is also propagated when some parts of Link do
-- not belong to the source Code.
--
-- Exceptions :
--
-- Layout_Error - Link is beyond the actual position
-- Any other - I/O error etc
--
procedure Skip (Code : in out Source'Class; Link : Location);
--
-- Implementations of the Parsers.Generic_Source interface
--
function "&" (Left, Right : Location) return Location;
function End_Of (Code : Source'Class) return Boolean;
function Get_Backup_Pointer (Code : Source'Class) return Integer;
function Get_Line (Code : Source'Class) return String;
procedure Get_Line
( Code : Source'Class;
Line : out Line_Ptr;
Pointer : out Integer;
Last : out Integer
);
function Get_Pointer (Code : Source'Class) return Integer;
function Image (Link : Location) return String;
function Link (Code : Source'Class) return Location;
procedure Next_Line (Code : in out Source'Class);
procedure Reset_Pointer (Code : in out Source'Class);
procedure Set_Pointer
( Code : in out Source'Class;
Pointer : Integer
);
--
-- Code -- The implementation
--
package Code is new
Parsers.Generic_Source
( Location_Type => Location,
Source_Type => Source'Class,
Line_Ptr_Type => Line_Ptr
);
private
pragma Inline ("<");
pragma Inline (End_Of);
pragma Inline (Get_Backup_Pointer);
pragma Inline (Get_Line);
pragma Inline (Get_Pointer);
pragma Inline (Link);
pragma Inline (Reset_Pointer);
procedure Free is
new Ada.Unchecked_Deallocation (String, String_Ptr);
end Parsers.Multiline_Source;
|
stcarrez/ada-util | Ada | 993 | adb | --
-- Copyright (c) 2008 Tero Koskinen <[email protected]>
--
-- Permission to use, copy, modify, and distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--
-- Windows version of OS compatibility package
package body Ahven_Compat is
function Directory_Separator return String is
begin
return "\";
end Directory_Separator;
end Ahven_Compat;
|
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.Draw_Custom_Shape_Elements is
pragma Preelaborate;
type ODF_Draw_Custom_Shape is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Draw_Custom_Shape_Access is
access all ODF_Draw_Custom_Shape'Class
with Storage_Size => 0;
end ODF.DOM.Draw_Custom_Shape_Elements;
|
vikasbidhuri1995/DW1000 | Ada | 2,230 | ads | -------------------------------------------------------------------------------
-- Copyright (c) 2016 Daniel King
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------------
with DW1000.BSP;
with DW1000.Types;
-- This package provides a generic API for typed write-only registers.
--
-- Register_Type is the typed representation of the register (e.g. a record
-- with a representation clause matching the layout of the register according
-- to the DW1000 User Manual).
--
-- Register_ID is the numerical ID of the register file according to the
-- DW1000 User Manual.
--
-- Sub_Register is the offset of the sub-register within the register file.
-- If the register file has no sub-registers then this should be set to 0.
generic
type Register_Type is private;
Register_ID : DW1000.Types.Bits_6;
Sub_Register : DW1000.Types.Bits_15 := 0;
package DW1000.Generic_WO_Register_Driver
is
procedure Write (Reg : in Register_Type)
with Global => (In_Out => DW1000.BSP.Device_State),
Depends => (DW1000.BSP.Device_State =>+ Reg),
SPARK_Mode => On;
end DW1000.Generic_WO_Register_Driver;
|
reznikmm/matreshka | Ada | 4,051 | 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.Style_Font_Style_Name_Attributes;
package Matreshka.ODF_Style.Font_Style_Name_Attributes is
type Style_Font_Style_Name_Attribute_Node is
new Matreshka.ODF_Style.Abstract_Style_Attribute_Node
and ODF.DOM.Style_Font_Style_Name_Attributes.ODF_Style_Font_Style_Name_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Font_Style_Name_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Style_Font_Style_Name_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Style.Font_Style_Name_Attributes;
|
stcarrez/dynamo | Ada | 3,521 | adb | -----------------------------------------------------------------------
-- gen-model-stypes -- Simple data type definitions
-- Copyright (C) 2021, 2022 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body Gen.Model.Stypes is
-- ------------------------------
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
-- ------------------------------
overriding
function Get_Value (From : Stype_Definition;
Name : String) return UBO.Object is
begin
if Name = "parent" then
return UBO.To_Object (From.Parent_Type);
elsif Name = "name" then
return UBO.To_Object (From.Type_Name);
elsif Name = "isEnum" then
return UBO.To_Object (False);
elsif Name = "isDiscrete" or else Name = "isNewDiscrete" then
return UBO.To_Object (True);
elsif Name = "sqlType" then
if Length (From.Sql_Type) > 0 then
return UBO.To_Object (Mappings.Get_Type_Name (From.Sql_Type));
else
return UBO.To_Object (Mappings.Get_Type_Name (From.Parent_Type));
end if;
else
return Mappings.Mapping_Definition (From).Get_Value (Name);
end if;
end Get_Value;
-- ------------------------------
-- Prepare the generation of the model.
-- ------------------------------
overriding
procedure Prepare (O : in out Stype_Definition) is
begin
O.Target := O.Type_Name;
end Prepare;
-- ------------------------------
-- Initialize the table definition instance.
-- ------------------------------
overriding
procedure Initialize (O : in out Stype_Definition) is
begin
null;
end Initialize;
-- ------------------------------
-- Create an simple type with its parent type.
-- ------------------------------
function Create_Stype (Name : in UString;
Parent : in UString) return Stype_Definition_Access is
use Ada.Strings.Unbounded;
Stype : constant Stype_Definition_Access := new Stype_Definition;
begin
Stype.Set_Name (Name);
declare
Pos : constant Natural := Index (Stype.Name, ".", Ada.Strings.Backward);
begin
Stype.Parent_Type := Parent;
if Pos > 0 then
Stype.Pkg_Name := Unbounded_Slice (Stype.Name, 1, Pos - 1);
Stype.Type_Name := Unbounded_Slice (Stype.Name, Pos + 1, Length (Stype.Name));
Stype.Nullable_Type := "Nullable_" & Stype.Type_Name;
-- Stype.Target := Stype.Name;
else
Stype.Pkg_Name := To_Unbounded_String ("ADO");
Stype.Type_Name := Stype.Name;
-- Stype.Target := Stype.Name;
end if;
end;
return Stype;
end Create_Stype;
end Gen.Model.Stypes;
|
PThierry/ewok-kernel | Ada | 1,127 | ads | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
pragma Restrictions (No_Elaboration_Code);
pragma warnings (Off, "use clause for package");
-- distribute interfaces and types to child packages
with interfaces; use interfaces;
pragma unreferenced (interfaces);
with types; use types;
pragma unreferenced (types);
pragma warnings (On, "use clause for package");
package soc is
end soc;
|
zhmu/ananas | Ada | 30,951 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S I N P U T . L --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Alloc;
with Atree; use Atree;
with Debug; use Debug;
with Einfo; use Einfo;
with Einfo.Entities; use Einfo.Entities;
with Einfo.Utils; use Einfo.Utils;
with Errout; use Errout;
with Fname; use Fname;
with Lib; use Lib;
with Opt; use Opt;
with Osint; use Osint;
with Output; use Output;
with Prep; use Prep;
with Prepcomp; use Prepcomp;
with Scans; use Scans;
with Scn; use Scn;
with Sem_Aux; use Sem_Aux;
with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Sinfo.Nodes; use Sinfo.Nodes;
with Snames; use Snames;
with System; use System;
with System.OS_Lib; use System.OS_Lib;
package body Sinput.L is
Prep_Buffer : Text_Buffer_Ptr := null;
-- A buffer to temporarily stored the result of preprocessing a source.
-- It is only allocated if there is at least one source to preprocess.
Prep_Buffer_Last : Text_Ptr := 0;
-- Index of the last significant character in Prep_Buffer
Initial_Size_Of_Prep_Buffer : constant := 10_000;
-- Size of Prep_Buffer when it is first allocated
-- When a file is to be preprocessed and the options to list symbols
-- has been selected (switch -s), Prep.List_Symbols is called with a
-- "foreword", a single line indicating what source the symbols apply to.
-- The following two constant String are the start and the end of this
-- foreword.
Foreword_Start : constant String :=
"Preprocessing Symbols for source """;
Foreword_End : constant String := """";
-----------------
-- Subprograms --
-----------------
procedure Put_Char_In_Prep_Buffer (C : Character);
-- Add one character in Prep_Buffer, extending Prep_Buffer if need be.
-- Used to initialize the preprocessor.
procedure New_EOL_In_Prep_Buffer;
-- Add an LF to Prep_Buffer (used to initialize the preprocessor)
function Load_File
(N : File_Name_Type;
T : Osint.File_Type) return Source_File_Index;
-- Load a source file, a configuration pragmas file or a definition file
-- Coding also allows preprocessing file, but not a library file ???
-------------------------------
-- Adjust_Instantiation_Sloc --
-------------------------------
procedure Adjust_Instantiation_Sloc
(N : Node_Id;
Factor : Sloc_Adjustment)
is
Loc : constant Source_Ptr := Sloc (N);
begin
-- We only do the adjustment if the value is between the appropriate low
-- and high values. It is not clear that this should ever not be the
-- case, but in practice there seem to be some nodes that get copied
-- twice, and this is a defence against that happening.
if Loc in Factor.Lo .. Factor.Hi then
Set_Sloc (N, Loc + Factor.Adjust);
end if;
end Adjust_Instantiation_Sloc;
--------------------------------
-- Complete_Source_File_Entry --
--------------------------------
procedure Complete_Source_File_Entry is
CSF : constant Source_File_Index := Current_Source_File;
begin
Trim_Lines_Table (CSF);
Source_File.Table (CSF).Source_Checksum := Checksum;
end Complete_Source_File_Entry;
---------------------------------
-- Create_Instantiation_Source --
---------------------------------
procedure Create_Instantiation_Source
(Inst_Node : Entity_Id;
Template_Id : Entity_Id;
Factor : out Sloc_Adjustment;
Inlined_Body : Boolean := False;
Inherited_Pragma : Boolean := False)
is
Dnod : constant Node_Id := Declaration_Node (Template_Id);
Xold : Source_File_Index;
Xnew : Source_File_Index;
begin
Xold := Get_Source_File_Index (Sloc (Template_Id));
Factor.Lo := Source_File.Table (Xold).Source_First;
Factor.Hi := Source_File.Table (Xold).Source_Last;
Source_File.Append (Source_File.Table (Xold));
Xnew := Source_File.Last;
if Debug_Flag_L then
Write_Eol;
Write_Str ("*** Create_Instantiation_Source: created source ");
Write_Int (Int (Xnew));
Write_Line ("");
end if;
declare
Sold : Source_File_Record renames Source_File.Table (Xold);
Snew : Source_File_Record renames Source_File.Table (Xnew);
Inst_Spec : Node_Id;
begin
Snew.Index := Xnew;
Snew.Inlined_Body := Inlined_Body;
Snew.Inherited_Pragma := Inherited_Pragma;
Snew.Template := Xold;
-- For a genuine generic instantiation, assign new instance id. For
-- inlined bodies or inherited pragmas, we retain that of the
-- template, but we save the call location.
if Inlined_Body or Inherited_Pragma then
Snew.Inlined_Call := Sloc (Inst_Node);
else
-- If the spec has been instantiated already, and we are now
-- creating the instance source for the corresponding body now,
-- retrieve the instance id that was assigned to the spec, which
-- corresponds to the same instantiation sloc.
Inst_Spec := Instance_Spec (Inst_Node);
if Present (Inst_Spec) then
declare
Inst_Spec_Ent : Entity_Id;
-- Instance spec entity
Inst_Spec_Sloc : Source_Ptr;
-- Virtual sloc of the spec instance source
Inst_Spec_Inst_Id : Instance_Id;
-- Instance id assigned to the instance spec
begin
Inst_Spec_Ent := Defining_Entity (Inst_Spec);
-- For a subprogram instantiation, we want the subprogram
-- instance, not the wrapper package.
if Present (Related_Instance (Inst_Spec_Ent)) then
Inst_Spec_Ent := Related_Instance (Inst_Spec_Ent);
end if;
-- The specification of the instance entity has a virtual
-- sloc within the instance sloc range.
-- ??? But the Unit_Declaration_Node has the sloc of the
-- instantiation, which is somewhat of an oddity.
Inst_Spec_Sloc :=
Sloc
(Specification (Unit_Declaration_Node (Inst_Spec_Ent)));
Inst_Spec_Inst_Id :=
Source_File.Table
(Get_Source_File_Index (Inst_Spec_Sloc)).Instance;
pragma Assert
(Sloc (Inst_Node) = Instances.Table (Inst_Spec_Inst_Id));
Snew.Instance := Inst_Spec_Inst_Id;
end;
else
Instances.Append (Sloc (Inst_Node));
Snew.Instance := Instances.Last;
end if;
end if;
-- Now compute the new values of Source_First and Source_Last and
-- adjust the source file pointer to have the correct bounds for the
-- new range of values.
-- Source_First must be greater than the last Source_Last value and
-- also must be a multiple of Source_Align.
Snew.Source_First :=
((Source_File.Table (Xnew - 1).Source_Last + Source_Align) /
Source_Align) * Source_Align;
Factor.Adjust := Snew.Source_First - Factor.Lo;
Snew.Source_Last := Factor.Hi + Factor.Adjust;
Set_Source_File_Index_Table (Xnew);
Snew.Sloc_Adjust := Sold.Sloc_Adjust - Factor.Adjust;
-- Modify the Dope of the instance Source_Text to use the
-- above-computed bounds.
declare
Dope : constant Dope_Ptr :=
new Dope_Rec'(Snew.Source_First, Snew.Source_Last);
begin
Snew.Source_Text := Sold.Source_Text;
Set_Dope (Snew.Source_Text'Address, Dope);
pragma Assert (Snew.Source_Text'First = Snew.Source_First);
pragma Assert (Snew.Source_Text'Last = Snew.Source_Last);
end;
if Debug_Flag_L then
Write_Str (" for ");
if Nkind (Dnod) in N_Proper_Body
and then Was_Originally_Stub (Dnod)
then
Write_Str ("subunit ");
elsif Ekind (Template_Id) = E_Generic_Package then
if Nkind (Dnod) = N_Package_Body then
Write_Str ("body of package ");
else
Write_Str ("spec of package ");
end if;
elsif Ekind (Template_Id) = E_Function then
Write_Str ("body of function ");
elsif Ekind (Template_Id) = E_Procedure then
Write_Str ("body of procedure ");
elsif Ekind (Template_Id) = E_Generic_Function then
Write_Str ("spec of function ");
elsif Ekind (Template_Id) = E_Generic_Procedure then
Write_Str ("spec of procedure ");
elsif Ekind (Template_Id) = E_Package_Body then
Write_Str ("body of package ");
else pragma Assert (Ekind (Template_Id) = E_Subprogram_Body);
if Nkind (Dnod) = N_Procedure_Specification then
Write_Str ("body of procedure ");
else
Write_Str ("body of function ");
end if;
end if;
Write_Name (Chars (Template_Id));
Write_Eol;
Write_Str (" copying from file name = ");
Write_Name (File_Name (Xold));
Write_Eol;
Write_Str (" old source index = ");
Write_Int (Int (Xold));
Write_Eol;
Write_Str (" old lo = ");
Write_Int (Int (Factor.Lo));
Write_Eol;
Write_Str (" old hi = ");
Write_Int (Int (Factor.Hi));
Write_Eol;
Write_Str (" new lo = ");
Write_Int (Int (Snew.Source_First));
Write_Eol;
Write_Str (" new hi = ");
Write_Int (Int (Snew.Source_Last));
Write_Eol;
Write_Str (" adjustment factor = ");
Write_Int (Int (Factor.Adjust));
Write_Eol;
Write_Str (" instantiation location: ");
Write_Location (Sloc (Inst_Node));
Write_Eol;
end if;
end;
end Create_Instantiation_Source;
----------------------
-- Load_Config_File --
----------------------
function Load_Config_File
(N : File_Name_Type) return Source_File_Index
is
begin
return Load_File (N, Osint.Config);
end Load_Config_File;
--------------------------
-- Load_Definition_File --
--------------------------
function Load_Definition_File
(N : File_Name_Type) return Source_File_Index
is
begin
return Load_File (N, Osint.Definition);
end Load_Definition_File;
---------------
-- Load_File --
---------------
function Load_File
(N : File_Name_Type;
T : Osint.File_Type) return Source_File_Index
is
FD : File_Descriptor;
Hi : Source_Ptr;
Lo : Source_Ptr;
Src : Source_Buffer_Ptr;
X : Source_File_Index;
Preprocessing_Needed : Boolean := False;
begin
-- If already there, don't need to reload file. An exception occurs
-- in multiple unit per file mode. It would be nice in this case to
-- share the same source file for each unit, but this leads to many
-- difficulties with assumptions (e.g. in the body of lib), that a
-- unit can be found by locating its source file index. Since we do
-- not expect much use of this mode, it's no big deal to waste a bit
-- of space and time by reading and storing the source multiple times.
if Multiple_Unit_Index = 0 then
for J in 1 .. Source_File.Last loop
if Source_File.Table (J).File_Name = N then
return J;
end if;
end loop;
end if;
-- Here we must build a new entry in the file table
-- But first, we must check if a source needs to be preprocessed,
-- because we may have to load and parse a definition file, and we want
-- to do that before we load the source, so that the buffer of the
-- source will be the last created, and we will be able to replace it
-- and modify Hi without stepping on another buffer.
if T = Osint.Source and then not Is_Internal_File_Name (N) then
Prepare_To_Preprocess
(Source => N, Preprocessing_Needed => Preprocessing_Needed);
end if;
Source_File.Increment_Last;
X := Source_File.Last;
if Debug_Flag_L then
Write_Eol;
Write_Str ("Sinput.L.Load_File: created source ");
Write_Int (Int (X));
Write_Str (" for ");
Write_Str (Get_Name_String (N));
end if;
-- Compute starting index, respecting alignment requirement
if X = Source_File.First then
Lo := First_Source_Ptr;
else
Lo := ((Source_File.Table (X - 1).Source_Last + Source_Align) /
Source_Align) * Source_Align;
end if;
Osint.Read_Source_File (N, Lo, Hi, Src, FD, T);
if Null_Source_Buffer_Ptr (Src) then
Source_File.Decrement_Last;
if FD = Osint.Null_FD then
return No_Source_File;
else
return No_Access_To_Source_File;
end if;
else
if Debug_Flag_L then
Write_Eol;
Write_Str ("*** Build source file table entry, Index = ");
Write_Int (Int (X));
Write_Str (", file name = ");
Write_Name (N);
Write_Eol;
Write_Str (" lo = ");
Write_Int (Int (Lo));
Write_Eol;
Write_Str (" hi = ");
Write_Int (Int (Hi));
Write_Eol;
Write_Str (" first 10 chars -->");
declare
procedure Wchar (C : Character);
-- Writes character or ? for control character
-----------
-- Wchar --
-----------
procedure Wchar (C : Character) is
begin
if C < ' '
or else C in ASCII.DEL .. Character'Val (16#9F#)
then
Write_Char ('?');
else
Write_Char (C);
end if;
end Wchar;
begin
for J in Lo .. Lo + 9 loop
Wchar (Src (J));
end loop;
Write_Str ("<--");
Write_Eol;
Write_Str (" last 10 chars -->");
for J in Hi - 10 .. Hi - 1 loop
Wchar (Src (J));
end loop;
Write_Str ("<--");
Write_Eol;
if Src (Hi) /= EOF then
Write_Str (" error: no EOF at end");
Write_Eol;
end if;
end;
end if;
declare
S : Source_File_Record renames Source_File.Table (X);
File_Type : Type_Of_File;
begin
case T is
when Osint.Source =>
File_Type := Sinput.Src;
when Osint.Library =>
raise Program_Error;
when Osint.Config =>
File_Type := Sinput.Config;
when Osint.Definition =>
File_Type := Def;
when Osint.Preprocessing_Data =>
File_Type := Preproc;
end case;
S := (Debug_Source_Name => N,
File_Name => N,
File_Type => File_Type,
First_Mapped_Line => No_Line_Number,
Full_Debug_Name => Osint.Full_Source_Name,
Full_File_Name => Osint.Full_Source_Name,
Full_Ref_Name => Osint.Full_Source_Name,
Instance => No_Instance_Id,
Identifier_Casing => Unknown,
Inlined_Call => No_Location,
Inlined_Body => False,
Inherited_Pragma => False,
Keyword_Casing => Unknown,
Last_Source_Line => 1,
License => Unknown,
Lines_Table => null,
Lines_Table_Max => 1,
Logical_Lines_Table => null,
Num_SRef_Pragmas => 0,
Reference_Name => N,
Sloc_Adjust => 0,
Source_Checksum => 0,
Source_First => Lo,
Source_Last => Hi,
Source_Text => Src,
Template => No_Source_File,
Unit => No_Unit,
Time_Stamp => Osint.Current_Source_File_Stamp,
Index => X);
Alloc_Line_Tables (S, Opt.Table_Factor * Alloc.Lines_Initial);
S.Lines_Table (1) := Lo;
end;
-- Preprocess the source if it needs to be preprocessed
if Preprocessing_Needed then
-- Temporarily set the Source_File_Index_Table entries for the
-- source, to avoid crash when reporting an error.
Set_Source_File_Index_Table (X);
if Opt.List_Preprocessing_Symbols then
declare
Foreword : constant String :=
Foreword_Start & Get_Name_String (N) & Foreword_End;
begin
Prep.List_Symbols (Foreword);
end;
end if;
declare
T : constant Nat := Total_Errors_Detected;
-- Used to check if there were errors during preprocessing
Save_Style_Check : Boolean;
-- Saved state of the Style_Check flag (which needs to be
-- temporarily set to False during preprocessing, see below).
Modified : Boolean;
begin
-- If this is the first time we preprocess a source, allocate
-- the preprocessing buffer.
if Prep_Buffer = null then
Prep_Buffer :=
new Text_Buffer (1 .. Initial_Size_Of_Prep_Buffer);
end if;
-- Make sure the preprocessing buffer is empty
Prep_Buffer_Last := 0;
-- Initialize the preprocessor hooks
Prep.Setup_Hooks
(Error_Msg => Errout.Error_Msg'Access,
Scan => Scn.Scanner.Scan'Access,
Set_Ignore_Errors => Errout.Set_Ignore_Errors'Access,
Put_Char => Put_Char_In_Prep_Buffer'Access,
New_EOL => New_EOL_In_Prep_Buffer'Access);
-- Initialize scanner and set its behavior for preprocessing,
-- then preprocess. Also disable style checks, since some of
-- them are done in the scanner (specifically, those dealing
-- with line length and line termination), and cannot be done
-- during preprocessing (because the source file index table
-- has not been set yet).
Scn.Scanner.Initialize_Scanner (X);
Scn.Scanner.Set_Special_Character ('#');
Scn.Scanner.Set_Special_Character ('$');
Scn.Scanner.Set_End_Of_Line_As_Token (True);
Save_Style_Check := Opt.Style_Check;
Opt.Style_Check := False;
-- The actual preprocessing step
Preprocess (Modified);
-- Reset the scanner to its standard behavior, and restore the
-- Style_Checks flag.
Scn.Scanner.Reset_Special_Characters;
Scn.Scanner.Set_End_Of_Line_As_Token (False);
Opt.Style_Check := Save_Style_Check;
-- If there were errors during preprocessing, record an error
-- at the start of the file, and do not change the source
-- buffer.
if T /= Total_Errors_Detected then
Errout.Error_Msg
("file could not be successfully preprocessed", Lo);
return No_Source_File;
else
-- Output the result of the preprocessing, if requested and
-- the source has been modified by the preprocessing. Only
-- do that for the main unit (spec, body and subunits).
if Generate_Processed_File
and then Modified
and then
((Compiler_State = Parsing
and then Parsing_Main_Extended_Source)
or else
(Compiler_State = Analyzing
and then Analysing_Subunit_Of_Main))
then
declare
FD : File_Descriptor;
NB : Integer;
Status : Boolean;
Prep_Filename : constant String :=
Get_Name_String (N) & Prep_Suffix;
begin
Delete_File (Prep_Filename, Status);
FD := Create_New_File (Prep_Filename, Text);
Status := FD /= Invalid_FD;
if Status then
NB :=
Write
(FD,
Prep_Buffer (1)'Address,
Integer (Prep_Buffer_Last));
Status := NB = Integer (Prep_Buffer_Last);
end if;
if Status then
Close (FD, Status);
end if;
if not Status then
Errout.Error_Msg
("??could not write processed file """ &
Name_Buffer (1 .. Name_Len) & '"',
Lo);
end if;
end;
end if;
-- Set the new value of Hi
Hi := Lo + Source_Ptr (Prep_Buffer_Last);
-- Create the new source buffer
declare
Var_Ptr : constant Source_Buffer_Ptr_Var :=
new Source_Buffer (Lo .. Hi);
-- Allocate source buffer, allowing extra character at
-- end for EOF.
begin
Var_Ptr (Lo .. Hi - 1) :=
Prep_Buffer (1 .. Prep_Buffer_Last);
Var_Ptr (Hi) := EOF;
Src := Var_Ptr.all'Access;
end;
-- Record in the table the new source buffer and the
-- new value of Hi.
Source_File.Table (X).Source_Text := Src;
Source_File.Table (X).Source_Last := Hi;
-- Reset Last_Line to 1, because the lines do not
-- have necessarily the same starts and lengths.
Source_File.Table (X).Last_Source_Line := 1;
end if;
end;
end if;
Set_Source_File_Index_Table (X);
return X;
end if;
end Load_File;
----------------------------------
-- Load_Preprocessing_Data_File --
----------------------------------
function Load_Preprocessing_Data_File
(N : File_Name_Type) return Source_File_Index
is
begin
return Load_File (N, Osint.Preprocessing_Data);
end Load_Preprocessing_Data_File;
----------------------
-- Load_Source_File --
----------------------
function Load_Source_File
(N : File_Name_Type) return Source_File_Index
is
begin
return Load_File (N, Osint.Source);
end Load_Source_File;
----------------------------
-- New_EOL_In_Prep_Buffer --
----------------------------
procedure New_EOL_In_Prep_Buffer is
begin
Put_Char_In_Prep_Buffer (ASCII.LF);
end New_EOL_In_Prep_Buffer;
-----------------------------
-- Put_Char_In_Prep_Buffer --
-----------------------------
procedure Put_Char_In_Prep_Buffer (C : Character) is
begin
-- If preprocessing buffer is not large enough, double it
if Prep_Buffer_Last = Prep_Buffer'Last then
declare
New_Prep_Buffer : constant Text_Buffer_Ptr :=
new Text_Buffer (1 .. 2 * Prep_Buffer_Last);
begin
New_Prep_Buffer (Prep_Buffer'Range) := Prep_Buffer.all;
Free (Prep_Buffer);
Prep_Buffer := New_Prep_Buffer;
end;
end if;
Prep_Buffer_Last := Prep_Buffer_Last + 1;
Prep_Buffer (Prep_Buffer_Last) := C;
end Put_Char_In_Prep_Buffer;
-------------------------
-- Source_File_Is_Body --
-------------------------
function Source_File_Is_Body (X : Source_File_Index) return Boolean is
Pcount : Natural;
begin
Initialize_Scanner (No_Unit, X);
-- Loop to look for subprogram or package body
loop
case Token is
-- PRAGMA, WITH, USE (which can appear before a body)
when Tok_Pragma
| Tok_Use
| Tok_With
=>
-- We just want to skip any of these, do it by skipping to a
-- semicolon, but check for EOF, in case we have bad syntax.
loop
if Token = Tok_Semicolon then
Scan;
exit;
elsif Token = Tok_EOF then
return False;
else
Scan;
end if;
end loop;
-- PACKAGE
when Tok_Package =>
Scan; -- Past PACKAGE
-- We have a body if and only if BODY follows
return Token = Tok_Body;
-- FUNCTION or PROCEDURE
when Tok_Function
| Tok_Procedure
=>
Pcount := 0;
-- Loop through tokens following PROCEDURE or FUNCTION
loop
Scan;
case Token is
-- For parens, count paren level (note that paren level
-- can get greater than 1 if we have default parameters).
when Tok_Left_Paren =>
Pcount := Pcount + 1;
when Tok_Right_Paren =>
Pcount := Pcount - 1;
-- EOF means something weird, probably no body
when Tok_EOF =>
return False;
-- BEGIN or IS or END definitely means body is present
when Tok_Begin
| Tok_End
| Tok_Is
=>
return True;
-- Semicolon means no body present if at outside any
-- parens. If within parens, ignore, since it could be
-- a parameter separator.
when Tok_Semicolon =>
if Pcount = 0 then
return False;
end if;
-- Skip anything else
when others =>
null;
end case;
end loop;
-- Anything else in main scan means we don't have a body
when others =>
return False;
end case;
end loop;
end Source_File_Is_Body;
----------------------------
-- Source_File_Is_No_Body --
----------------------------
function Source_File_Is_No_Body (X : Source_File_Index) return Boolean is
begin
Initialize_Scanner (No_Unit, X);
if Token /= Tok_Pragma then
return False;
end if;
Scan; -- past pragma
if Token /= Tok_Identifier
or else Chars (Token_Node) /= Name_No_Body
then
return False;
end if;
Scan; -- past No_Body
if Token /= Tok_Semicolon then
return False;
end if;
Scan; -- past semicolon
return Token = Tok_EOF;
end Source_File_Is_No_Body;
end Sinput.L;
|
AdaCore/libadalang | Ada | 79 | ads | package pKg . BAR is
--% node.p_defining_name.p_canonical_text
end Pkg.Bar;
|
reznikmm/matreshka | Ada | 5,634 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- SQL Database Access --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-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$
------------------------------------------------------------------------------
-- This package provides implementation of Query abstraction for PostgreSQL.
------------------------------------------------------------------------------
with Matreshka.Internals.SQL_Drivers.PostgreSQL.Databases;
private with Matreshka.Internals.SQL_Parameter_Sets;
package Matreshka.Internals.SQL_Drivers.PostgreSQL.Queries is
type PostgreSQL_Query is new Abstract_Query with private;
procedure Initialize
(Self : not null access PostgreSQL_Query'Class;
Database : not null access Databases.PostgreSQL_Database'Class);
private
type PostgreSQL_Query is new Abstract_Query with record
Name : Interfaces.C.Strings.chars_ptr
:= Interfaces.C.Strings.Null_Ptr;
Error : League.Strings.Universal_String;
Parameters : Matreshka.Internals.SQL_Parameter_Sets.Parameter_Set;
Result : PGresult_Access;
Row : Interfaces.C.int;
end record;
overriding procedure Bind_Value
(Self : not null access PostgreSQL_Query;
Name : League.Strings.Universal_String;
Value : League.Holders.Holder;
Direction : SQL.Parameter_Directions);
overriding function Bound_Value
(Self : not null access PostgreSQL_Query;
Name : League.Strings.Universal_String)
return League.Holders.Holder;
overriding function Error_Message
(Self : not null access PostgreSQL_Query)
return League.Strings.Universal_String;
overriding function Execute
(Self : not null access PostgreSQL_Query) return Boolean;
overriding procedure Finish (Self : not null access PostgreSQL_Query);
overriding procedure Invalidate (Self : not null access PostgreSQL_Query);
overriding function Is_Active
(Self : not null access PostgreSQL_Query) return Boolean;
overriding function Is_Valid
(Self : not null access PostgreSQL_Query) return Boolean;
overriding function Next
(Self : not null access PostgreSQL_Query) return Boolean;
overriding function Prepare
(Self : not null access PostgreSQL_Query;
Query : League.Strings.Universal_String) return Boolean;
overriding function Value
(Self : not null access PostgreSQL_Query;
Index : Positive) return League.Holders.Holder;
end Matreshka.Internals.SQL_Drivers.PostgreSQL.Queries;
|
optikos/oasis | Ada | 4,228 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Formal_Floating_Point_Definitions;
with Program.Element_Visitors;
package Program.Nodes.Formal_Floating_Point_Definitions is
pragma Preelaborate;
type Formal_Floating_Point_Definition is
new Program.Nodes.Node
and Program.Elements.Formal_Floating_Point_Definitions
.Formal_Floating_Point_Definition
and Program.Elements.Formal_Floating_Point_Definitions
.Formal_Floating_Point_Definition_Text
with private;
function Create
(Digits_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Box_Token : not null Program.Lexical_Elements.Lexical_Element_Access)
return Formal_Floating_Point_Definition;
type Implicit_Formal_Floating_Point_Definition is
new Program.Nodes.Node
and Program.Elements.Formal_Floating_Point_Definitions
.Formal_Floating_Point_Definition
with private;
function Create
(Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Formal_Floating_Point_Definition
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Formal_Floating_Point_Definition is
abstract new Program.Nodes.Node
and Program.Elements.Formal_Floating_Point_Definitions
.Formal_Floating_Point_Definition
with null record;
procedure Initialize
(Self : aliased in out Base_Formal_Floating_Point_Definition'Class);
overriding procedure Visit
(Self : not null access Base_Formal_Floating_Point_Definition;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Is_Formal_Floating_Point_Definition_Element
(Self : Base_Formal_Floating_Point_Definition)
return Boolean;
overriding function Is_Formal_Type_Definition_Element
(Self : Base_Formal_Floating_Point_Definition)
return Boolean;
overriding function Is_Definition_Element
(Self : Base_Formal_Floating_Point_Definition)
return Boolean;
type Formal_Floating_Point_Definition is
new Base_Formal_Floating_Point_Definition
and Program.Elements.Formal_Floating_Point_Definitions
.Formal_Floating_Point_Definition_Text
with record
Digits_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Box_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Formal_Floating_Point_Definition_Text
(Self : aliased in out Formal_Floating_Point_Definition)
return Program.Elements.Formal_Floating_Point_Definitions
.Formal_Floating_Point_Definition_Text_Access;
overriding function Digits_Token
(Self : Formal_Floating_Point_Definition)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Box_Token
(Self : Formal_Floating_Point_Definition)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Formal_Floating_Point_Definition is
new Base_Formal_Floating_Point_Definition
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Formal_Floating_Point_Definition_Text
(Self : aliased in out Implicit_Formal_Floating_Point_Definition)
return Program.Elements.Formal_Floating_Point_Definitions
.Formal_Floating_Point_Definition_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Formal_Floating_Point_Definition)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Formal_Floating_Point_Definition)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Formal_Floating_Point_Definition)
return Boolean;
end Program.Nodes.Formal_Floating_Point_Definitions;
|
kontena/ruby-packer | Ada | 5,322 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998-2011,2014 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, 1996
-- Version Control:
-- $Revision: 1.12 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings; use Interfaces.C.Strings;
with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
package body Terminal_Interface.Curses.Forms.Field_Types.Enumeration is
function Create (Info : Enumeration_Info;
Auto_Release_Names : Boolean := False)
return Enumeration_Field
is
procedure Release_String is
new Ada.Unchecked_Deallocation (String,
String_Access);
E : Enumeration_Field;
L : constant size_t := 1 + size_t (Info.C);
S : String_Access;
begin
E.Case_Sensitive := Info.Case_Sensitive;
E.Match_Must_Be_Unique := Info.Match_Must_Be_Unique;
E.Arr := new chars_ptr_array (size_t (1) .. L);
for I in 1 .. Positive (L - 1) loop
if Info.Names (I) = null then
raise Form_Exception;
end if;
E.Arr.all (size_t (I)) := New_String (Info.Names (I).all);
if Auto_Release_Names then
S := Info.Names (I);
Release_String (S);
end if;
end loop;
E.Arr.all (L) := Null_Ptr;
return E;
end Create;
procedure Release (Enum : in out Enumeration_Field)
is
I : size_t := 0;
P : chars_ptr;
begin
loop
P := Enum.Arr.all (I);
exit when P = Null_Ptr;
Free (P);
Enum.Arr.all (I) := Null_Ptr;
I := I + 1;
end loop;
Enum.Arr := null;
end Release;
procedure Set_Field_Type (Fld : Field;
Typ : Enumeration_Field)
is
function Set_Fld_Type (F : Field := Fld;
Arg1 : chars_ptr_array;
Arg2 : C_Int;
Arg3 : C_Int) return Eti_Error;
pragma Import (C, Set_Fld_Type, "set_field_type_enum");
begin
if Typ.Arr = null then
raise Form_Exception;
end if;
Eti_Exception
(Set_Fld_Type
(Arg1 => Typ.Arr.all,
Arg2 => C_Int (Boolean'Pos (Typ.Case_Sensitive)),
Arg3 => C_Int (Boolean'Pos (Typ.Match_Must_Be_Unique))));
Wrap_Builtin (Fld, Typ, C_Choice_Router);
end Set_Field_Type;
end Terminal_Interface.Curses.Forms.Field_Types.Enumeration;
|
persan/protobuf-ada | Ada | 2,264 | ads | with AUnit.Assertions;
with Google.Protobuf.Wire_Format;
package Google.Protobuf.Generic_Assertions.Assertions is
use type Google.Protobuf.Wire_Format.PB_String;
use type Google.Protobuf.Wire_Format.PB_Byte;
use type Google.Protobuf.Wire_Format.PB_UInt32;
use type Google.Protobuf.Wire_Format.PB_UInt64;
use type Google.Protobuf.Wire_Format.PB_Double;
use type Google.Protobuf.Wire_Format.PB_Float;
use type Google.Protobuf.Wire_Format.PB_Bool;
use type Google.Protobuf.Wire_Format.PB_Int32;
use type Google.Protobuf.Wire_Format.PB_Int64;
use type Google.Protobuf.Wire_Format.PB_Field_Type;
use type Google.Protobuf.Wire_Format.PB_Wire_Type;
use type Google.Protobuf.Wire_Format.PB_Object_Size;
use type Google.Protobuf.Wire_Format.PB_String_Access;
procedure Assert
(Condition : in Boolean;
Message : in String;
Source_Info : in String := GNAT.Source_Info.File;
File_Info : in Natural := GNAT.Source_Info.Line) renames AUnit.Assertions.Assert;
procedure Assert_Equal is new Generic_Equal (Google.Protobuf.Wire_Format.PB_Int32);
procedure Assert_Equal is new Generic_Equal (Google.Protobuf.Wire_Format.PB_UInt32);
procedure Assert_Equal is new Generic_Equal (Google.Protobuf.Wire_Format.PB_UInt64);
procedure Assert_Equal is new Generic_Equal (Google.Protobuf.Wire_Format.PB_Double);
procedure Assert_Equal is new Generic_Equal (Google.Protobuf.Wire_Format.PB_Float);
procedure Assert_Equal is new Generic_Equal (Google.Protobuf.Wire_Format.PB_Int64);
procedure Assert_Equal is new Generic_Equal (Google.Protobuf.Wire_Format.PB_Object_Size);
procedure Assert_Equal
(Expected : in Google.Protobuf.Wire_Format.PB_String;
Actual : in Google.Protobuf.Wire_Format.PB_String;
Source_Info : in String := GNAT.Source_Info.File;
File_Info : in Natural := GNAT.Source_Info.Line);
procedure Assert_True
(Actual : in Boolean;
Source_Info : in String := GNAT.Source_Info.File;
File_Info : in Natural := GNAT.Source_Info.Line);
procedure Assert_False
(Actual : in Boolean;
Source_Info : in String := GNAT.Source_Info.File;
File_Info : in Natural := GNAT.Source_Info.Line);
end Google.Protobuf.Generic_Assertions.Assertions;
|
OneWingedShark/Byron | Ada | 3,312 | adb | Pragma Ada_2012;
Pragma Assertion_Policy( Check );
With
Byron.Debugging.Functions,
Ada.Text_IO,
Ada.Containers,
Ada.Characters.Latin_1,
Ada.Strings.Wide_Wide_Unbounded;
-- Handle comments starting a TEXT token.
Procedure Lexington.Aux.P3(Data : in out Token_Vector_Pkg.Vector) is
use Ada.Strings.Wide_Wide_Unbounded, Lexington.Aux.Token_Pkg;
-- Returns True when the item is a textual-token that conforms to a comment.
Function Is_Comment( Item : Token ) return Boolean is
Value : Wide_Wide_String renames Lexeme(Item);
Textual : constant Boolean := ID(Item) = TEXT;
Big_Enough : constant Boolean := Value'Length >= 2;
First : constant Positive:= Value'First;
Second : constant Positive:= Positive'Succ(First);
Begin
Return Textual and then Big_Enough and then
(Value(First) = '-' and Value(Second) = '-');
End Is_Comment;
-- Returns the text of an item, startinf at the third character.
Function Non_Comment( Item : Token ) return Wide_Wide_String is
Value : Wide_Wide_String renames Lexeme(Item);
Third : constant Positive := Value'First+1;
--renames Positive'Succ(Positive'Succ(Value'First));
Last : constant Natural:= Value'Last;
Begin
Return Result : Constant Wide_Wide_String:= Value(Third..Last);
End Non_Comment;
Clear : Boolean:= True;
Procedure Alter_Type(Position : Token_Vector_Pkg.Cursor) is
Item : Token renames Token_Vector_Pkg.Element( Position );
Index : Positive renames Token_Vector_Pkg.To_Index( Position );
ID : Token_ID renames Token_Pkg.ID(Item);
Begin
if Is_Comment(Item) and then Clear then
Clear := False;
Token_Vector_Pkg.Replace_Element(
Container => Data,
Position => Position,
New_Item => Make_Token(Comment, Non_Comment(Item))
);
elsif (not clear) and then (ID = End_of_Line or else Index = Data.Last_Index) then
Clear:= True;
end if;
End Alter_Type;
Result : Token_Vector_Pkg.Vector;
Working : Unbounded_Wide_Wide_String;
Marked : Boolean:= False;
Procedure Collect_Comment(Position : Token_Vector_Pkg.Cursor) is
Item : Token renames Token_Vector_Pkg.Element( Position );
Index : Positive renames Token_Vector_Pkg.To_Index( Position );
ID : Token_ID renames Token_Pkg.ID(Item);
Begin
If not Marked and ID /= Comment then
Result.Append( Item );
elsif not Marked and ID = Comment then
Marked:= True;
Working:= To_Unbounded_Wide_Wide_String( Non_Comment( Item ) );
elsif Marked and ID = Comment then
raise Program_Error with "New comment started before old comment closed.";
elsif Marked and ID = End_of_Line then
Marked:= False;
Result.Append( Make_Token(Comment, To_Wide_Wide_String(Working)) );
elsif Marked and Index = Data.Last_Index then
Marked:= False;
Append(Working, Lexeme(Item));
Result.Append( Make_Token(Comment, To_Wide_Wide_String(Working)) );
else
Append(Working, Lexeme(Item));
end if;
End Collect_Comment;
Begin
Data.Iterate( Alter_Type'Access );
Data.Iterate( Collect_Comment'Access );
Data:= Result;
End Lexington.Aux.P3;
|
reznikmm/matreshka | Ada | 6,758 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Db.Columns_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Db_Columns_Element_Node is
begin
return Self : Db_Columns_Element_Node do
Matreshka.ODF_Db.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Db_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Db_Columns_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Db_Columns
(ODF.DOM.Db_Columns_Elements.ODF_Db_Columns_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Db_Columns_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Columns_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Db_Columns_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Db_Columns
(ODF.DOM.Db_Columns_Elements.ODF_Db_Columns_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Db_Columns_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Db_Columns
(Visitor,
ODF.DOM.Db_Columns_Elements.ODF_Db_Columns_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Db_URI,
Matreshka.ODF_String_Constants.Columns_Element,
Db_Columns_Element_Node'Tag);
end Matreshka.ODF_Db.Columns_Elements;
|
stcarrez/ada-awa | Ada | 3,168 | adb | -----------------------------------------------------------------------
-- awa-jobs-beans -- AWA Jobs Ada Beans
-- Copyright (C) 2012, 2013, 2015 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 AWA.Events.Action_Method;
package body AWA.Jobs.Beans is
package Execute_Binding is
new AWA.Events.Action_Method.Bind (Bean => Process_Bean,
Method => Execute,
Name => "execute");
Process_Binding : aliased constant Util.Beans.Methods.Method_Binding_Array
:= (1 => Execute_Binding.Proxy'Access);
-- ------------------------------
-- Get the value identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Process_Bean;
Name : in String) return Util.Beans.Objects.Object is
begin
return AWA.Jobs.Services.Get_Parameter (From.Job, Name);
end Get_Value;
-- ------------------------------
-- Set the value identified by the name.
-- ------------------------------
overriding
procedure Set_Value (From : in out Process_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object) is
begin
null;
end Set_Value;
-- ------------------------------
-- This bean provides some methods that can be used in a Method_Expression
-- ------------------------------
overriding
function Get_Method_Bindings (From : in Process_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access is
pragma Unreferenced (From);
begin
return Process_Binding'Access;
end Get_Method_Bindings;
-- ------------------------------
-- Execute the job described by the event.
-- ------------------------------
procedure Execute (Bean : in out Process_Bean;
Event : in AWA.Events.Module_Event'Class) is
begin
AWA.Jobs.Services.Execute (Event, Bean.Job);
end Execute;
-- ------------------------------
-- Create the job process bean instance.
-- ------------------------------
function Create_Process_Bean (Module : in AWA.Jobs.Modules.Job_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access is
Result : constant Process_Bean_Access := new Process_Bean;
begin
Result.Module := Module;
return Result.all'Access;
end Create_Process_Bean;
end AWA.Jobs.Beans;
|
TheRenegadeCoder/sample-programs | Ada | 100 | adb | with Text_IO;
procedure Hello_World is
begin
Text_IO.Put_Line("Hello, World!");
end Hello_World;
|
reznikmm/matreshka | Ada | 4,049 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Presentation_Action_Attributes;
package Matreshka.ODF_Presentation.Action_Attributes is
type Presentation_Action_Attribute_Node is
new Matreshka.ODF_Presentation.Abstract_Presentation_Attribute_Node
and ODF.DOM.Presentation_Action_Attributes.ODF_Presentation_Action_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Presentation_Action_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Presentation_Action_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Presentation.Action_Attributes;
|
pombredanne/ravenadm | Ada | 204,002 | adb | -- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
with Definitions; use Definitions;
with Utilities;
with Ada.Text_IO;
with Ada.Characters.Latin_1;
with Ada.Calendar.Formatting;
package body Port_Specification is
package UTL renames Utilities;
package TIO renames Ada.Text_IO;
package LAT renames Ada.Characters.Latin_1;
package CAL renames Ada.Calendar;
--------------------------------------------------------------------------------------------
-- initialize
--------------------------------------------------------------------------------------------
procedure initialize (specs : out Portspecs) is
begin
specs.namebase := HT.blank;
specs.version := HT.blank;
specs.revision := 0;
specs.epoch := 0;
specs.job_limit := 0;
specs.keywords.Clear;
specs.variants.Clear;
specs.taglines.Clear;
specs.homepage := HT.blank;
specs.contacts.Clear;
specs.dl_sites.Clear;
specs.distfiles.Clear;
specs.dist_subdir := HT.blank;
specs.df_index.Clear;
specs.patchfiles.Clear;
specs.subpackages.Clear;
specs.ops_avail.Clear;
specs.ops_standard.Clear;
specs.ops_helpers.Clear;
specs.optgroups.Clear;
specs.optgroup_desc.Clear;
specs.opt_radio.Clear;
specs.opt_restrict.Clear;
specs.opt_unlimited.Clear;
specs.variantopts.Clear;
specs.options_on.Clear;
specs.broken.Clear;
specs.exc_opsys.Clear;
specs.inc_opsys.Clear;
specs.exc_arch.Clear;
specs.uses.Clear;
specs.uses_base.Clear;
specs.sub_list.Clear;
specs.sub_files.Clear;
specs.extract_only.Clear;
specs.extract_zip.Clear;
specs.extract_lha.Clear;
specs.extract_7z.Clear;
specs.extract_deb.Clear;
specs.extract_dirty.Clear;
specs.extract_head.Clear;
specs.extract_tail.Clear;
specs.distname := HT.blank;
specs.config_args.Clear;
specs.config_env.Clear;
specs.skip_build := False;
specs.skip_install := False;
specs.skip_ccache := False;
specs.destdir_env := False;
specs.single_job := False;
specs.shift_install := False;
specs.debugging_on := False;
specs.generated := False;
specs.opt_df_index := False;
specs.skip_opsys_dep := False;
specs.build_wrksrc := HT.blank;
specs.makefile := HT.blank;
specs.destdirname := HT.blank;
specs.make_env.Clear;
specs.make_args.Clear;
specs.build_target.Clear;
specs.build_deps.Clear;
specs.buildrun_deps.Clear;
specs.run_deps.Clear;
specs.opsys_b_deps.Clear;
specs.opsys_r_deps.Clear;
specs.opsys_br_deps.Clear;
specs.cflags.Clear;
specs.cxxflags.Clear;
specs.cppflags.Clear;
specs.ldflags.Clear;
specs.optimizer_lvl := 2;
specs.cmake_args.Clear;
specs.qmake_args.Clear;
specs.info.Clear;
specs.install_tgt.Clear;
specs.plist_sub.Clear;
specs.make_targets.Clear;
specs.extra_patches.Clear;
specs.patch_strip.Clear;
specs.pfiles_strip.Clear;
specs.config_outsrc := False;
specs.patch_wrksrc := HT.blank;
specs.install_wrksrc := HT.blank;
specs.config_prefix := HT.blank;
specs.config_script := HT.blank;
specs.config_target := HT.blank;
specs.config_wrksrc := HT.blank;
specs.config_must := HT.blank;
specs.expire_date := HT.blank;
specs.deprecated := HT.blank;
specs.prefix := HT.blank;
specs.last_catchkey := HT.blank;
specs.usergroup_pkg := HT.blank;
specs.licenses.Clear;
specs.users.Clear;
specs.groups.Clear;
specs.catch_all.Clear;
specs.pkg_notes.Clear;
specs.var_opsys.Clear;
specs.var_arch.Clear;
specs.test_tgt.Clear;
specs.test_args.Clear;
specs.test_env.Clear;
specs.extra_rundeps.Clear;
specs.mandirs.Clear;
specs.mk_verbatim.Clear;
specs.broken_ssl.Clear;
specs.gnome_comps.Clear;
specs.xorg_comps.Clear;
specs.sdl_comps.Clear;
specs.php_extensions.Clear;
specs.subr_scripts.Clear;
specs.broken_mysql.Clear;
specs.broken_pgsql.Clear;
specs.fatal_rpath := True;
specs.last_set := so_initialized;
end initialize;
--------------------------------------------------------------------------------------------
-- do_not_apply_opsys_dependencies
--------------------------------------------------------------------------------------------
procedure do_not_apply_opsys_dependencies (specs : in out Portspecs) is
begin
specs.skip_opsys_dep := True;
end do_not_apply_opsys_dependencies;
--------------------------------------------------------------------------------------------
-- set_single_string
--------------------------------------------------------------------------------------------
procedure set_single_string
(specs : in out Portspecs;
field : spec_field;
value : String)
is
procedure verify_entry_is_post_options;
text_value : HT.Text := HT.SUS (value);
procedure verify_entry_is_post_options is
begin
if spec_order'Pos (specs.last_set) < spec_order'Pos (so_opts_std) then
raise misordered with field'Img;
end if;
end verify_entry_is_post_options;
begin
case field is
when sp_deprecated => null;
when others =>
if contains_nonquoted_spaces (value) then
raise contains_spaces;
end if;
end case;
case field is
when sp_namebase =>
if specs.last_set /= so_initialized then
raise misordered with field'Img;
end if;
if invalid_namebase (value, False) then
raise wrong_value with "illegal characters detected in NAMEBASE";
end if;
specs.namebase := text_value;
specs.last_set := so_namebase;
when sp_version =>
if specs.last_set /= so_namebase then
raise misordered with field'Img;
end if;
if invalid_namebase (value, True) then
raise wrong_value with "illegal characters detected in VERSION";
end if;
specs.version := text_value;
specs.last_set := so_version;
when sp_homepage =>
if specs.last_set /= so_taglines then
raise misordered with field'Img;
end if;
if value /= homepage_none and then
not HT.leads (value, "http://") and then
not HT.leads (value, "https://")
then
raise wrong_value with "Must be '" & homepage_none
& "' or valid URL starting with http:// or https://";
end if;
specs.homepage := text_value;
specs.last_set := so_homepage;
when sp_distsubdir =>
if specs.last_set /= so_distfiles and then
specs.last_set /= so_contacts
then
raise misordered with field'Img;
end if;
specs.dist_subdir := text_value;
specs.last_set := so_distsubdir;
when sp_distname =>
verify_entry_is_post_options;
specs.distname := text_value;
when sp_build_wrksrc =>
verify_entry_is_post_options;
specs.build_wrksrc := text_value;
when sp_makefile =>
verify_entry_is_post_options;
specs.makefile := text_value;
when sp_destdirname =>
verify_entry_is_post_options;
specs.destdirname := text_value;
when sp_patch_wrksrc =>
verify_entry_is_post_options;
specs.patch_wrksrc := text_value;
when sp_gnu_cfg_prefix =>
verify_entry_is_post_options;
specs.config_prefix := text_value;
when sp_config_script =>
verify_entry_is_post_options;
specs.config_script := text_value;
when sp_config_target =>
verify_entry_is_post_options;
specs.config_target := text_value;
when sp_config_wrksrc =>
verify_entry_is_post_options;
specs.config_wrksrc := text_value;
when sp_must_config =>
verify_entry_is_post_options;
if value /= boolean_yes and then
value /= "gnu"
then
raise wrong_value with "MUST_CONFIGURE may only be 'yes' or 'gnu'";
end if;
specs.config_must := text_value;
when sp_deprecated =>
verify_entry_is_post_options;
specs.deprecated := text_value;
when sp_expiration =>
verify_entry_is_post_options;
if not ISO8601_format (value) then
raise wrong_value with "Not valid ISO 8601 date for EXPIRATION_DATE";
end if;
specs.expire_date := text_value;
when sp_install_wrksrc =>
verify_entry_is_post_options;
specs.install_wrksrc := text_value;
when sp_prefix =>
verify_entry_is_post_options;
specs.prefix := text_value;
when sp_lic_scheme =>
verify_entry_is_post_options;
if value = "solo" or else
value = "dual" or else
value = "multi"
then
specs.lic_scheme := text_value;
else
raise wrong_value with "Not valid license scheme: " & value;
end if;
when sp_ug_pkg =>
verify_entry_is_post_options;
if not specs.subpackage_exists (value) then
raise wrong_value with "USERGROUP_SPKG must match a valid subpackage";
end if;
if value = spkg_complete then
raise wrong_value with "USERGROUP_SPKG must not be set to meta-package";
end if;
specs.usergroup_pkg := text_value;
when others =>
raise wrong_type with field'Img;
end case;
end set_single_string;
--------------------------------------------------------------------------------------------
-- append_list
--------------------------------------------------------------------------------------------
procedure append_list
(specs : in out Portspecs;
field : spec_field;
value : String)
is
procedure verify_entry_is_post_options;
procedure verify_df_index;
procedure verify_special_exraction;
procedure set_as_standard_option (Key : HT.Text; Element : in out Option_Helper);
text_value : HT.Text := HT.SUS (value);
procedure verify_entry_is_post_options is
begin
if spec_order'Pos (specs.last_set) < spec_order'Pos (so_opts_std) then
raise misordered with field'Img;
end if;
end verify_entry_is_post_options;
procedure verify_df_index is
begin
if not specs.dist_index_is_valid (value) then
raise wrong_value with "distfile index '" & value & "' is not valid";
end if;
end verify_df_index;
procedure verify_special_exraction is
begin
if specs.extract_zip.Contains (text_value) or else
specs.extract_7z.Contains (text_value) or else
specs.extract_lha.Contains (text_value)
then
raise dupe_list_value with value;
end if;
end verify_special_exraction;
procedure set_as_standard_option (Key : HT.Text; Element : in out Option_Helper) is
begin
Element.standard_option := True;
end set_as_standard_option;
begin
if contains_nonquoted_spaces (value) then
raise contains_spaces;
end if;
case field is
when sp_keywords =>
if specs.last_set /= so_keywords and then
specs.last_set /= so_epoch and then
specs.last_set /= so_revision and then
specs.last_set /= so_version
then
raise misordered with field'Img;
end if;
if not keyword_is_valid (value) then
raise wrong_value with "Keyword '" & value & "' is not recognized";
end if;
if specs.keywords.Contains (text_value) then
raise dupe_list_value with value;
end if;
specs.keywords.Append (text_value);
specs.last_set := so_keywords;
when sp_variants =>
if specs.last_set /= so_variants and then
specs.last_set /= so_keywords
then
raise misordered with field'Img;
end if;
if value'Length > 15 then
raise wrong_value with "'" & value & "' value is too long (15-char limit)";
end if;
if specs.variants.Contains (text_value) then
raise dupe_list_value with value;
end if;
if HT.contains (value, "-") then
raise wrong_value with "hyphens are not allowed in variant names (" & value & ")";
end if;
specs.variants.Append (text_value);
specs.last_set := so_variants;
when sp_contacts =>
if specs.last_set /= so_contacts and then
specs.last_set /= so_homepage
then
raise misordered with field'Img;
end if;
if not specs.all_taglines_defined then
raise wrong_value with "Every variant must have SDESC definition.";
end if;
if not specs.contacts.Is_Empty then
if specs.contacts.Contains (HT.SUS (contact_nobody)) then
raise wrong_value with "contact '" & contact_nobody & "' must be solitary";
end if;
if specs.contacts.Contains (HT.SUS (contact_automaton)) then
raise wrong_value with "contact '" & contact_automaton & "' must be solitary";
end if;
if value = contact_nobody or else value = contact_automaton then
raise wrong_value with "contact '" & value & "' must be solitary";
end if;
end if;
if value /= contact_nobody and then
value /= contact_automaton and then
not (HT.contains (value, "_") and then
HT.contains (value, "[") and then
HT.contains (value, "@") and then
HT.contains (value, "]") and then
value (value'Last) = LAT.Right_Square_Bracket)
then
raise wrong_value with "incorrect contact format of '" & value & "'";
end if;
if specs.contacts.Contains (text_value) then
raise dupe_list_value with value;
end if;
specs.contacts.Append (text_value);
specs.last_set := so_contacts;
when sp_distfiles =>
if specs.last_set /= so_distfiles and then
specs.last_set /= so_dl_sites
then
raise misordered with field'Img;
end if;
if specs.distfiles.Contains (text_value) then
raise dupe_list_value with value;
end if;
if not HT.contains (value, ":") then
raise wrong_value with "No download group prefix present in distfile";
end if;
specs.distfiles.Append (text_value);
specs.last_set := so_distfiles;
declare
group_index : String := HT.int2str (Integer (specs.distfiles.Length));
begin
specs.establish_group (sp_ext_head, group_index);
specs.establish_group (sp_ext_tail, group_index);
end;
when sp_df_index =>
if specs.last_set /= so_df_index and then
specs.last_set /= so_distsubdir and then
specs.last_set /= so_distfiles
then
raise misordered with field'Img;
end if;
if specs.df_index.Contains (text_value) then
raise dupe_list_value with value;
end if;
verify_df_index;
specs.df_index.Append (text_value);
specs.last_set := so_df_index;
when sp_opts_avail =>
if specs.last_set /= so_opts_avail and then
specs.last_set /= so_subpackages
then
raise misordered with field'Img;
end if;
if specs.ops_avail.Contains (text_value) then
raise dupe_list_value with value;
end if;
if value = options_none then
if not specs.ops_avail.Is_Empty then
raise wrong_value with "'" & options_none & "' must be set first and alone";
end if;
else
if HT.uppercase (value) /= value then
raise wrong_value with "option value '" & value & "' is not capitalized";
end if;
end if;
if value'Length > 14 then
raise wrong_value with "'" & value & "' name is too long (14-char limit)";
end if;
if HT.contains (value, ":") then
raise wrong_value with "'" & value & "' cannot contain colons";
end if;
if HT.contains (value, ",") then
raise wrong_value with "'" & value & "' cannot contain commas";
end if;
specs.ops_avail.Append (text_value);
specs.last_set := so_opts_avail;
declare
initial_rec : Option_Helper;
begin
initial_rec.option_name := text_value;
specs.ops_helpers.Insert (text_value, initial_rec);
end;
when sp_opts_standard =>
if specs.last_set /= so_opts_std and then
specs.last_set /= so_opts_avail
then
raise misordered with field'Img;
end if;
if specs.ops_standard.Contains (text_value) then
raise dupe_list_value with value;
end if;
if value = options_none then
if not specs.ops_standard.Is_Empty then
raise wrong_value with "'" & options_none & "' must be set first and alone";
end if;
else
if not specs.ops_avail.Contains (text_value) then
raise wrong_value with "'" & value & "' must be present in OPTIONS_AVAILABLE";
end if;
specs.ops_helpers.Update_Element
(Position => specs.ops_helpers.Find (text_value),
Process => set_as_standard_option'Access);
end if;
specs.ops_standard.Append (text_value);
specs.last_set := so_opts_std;
when sp_og_radio | sp_og_restrict | sp_og_unlimited =>
verify_entry_is_post_options;
if value'Length > 12 then
raise wrong_value with "'" & value & "' name is too long (12-char limit)";
end if;
if HT.uppercase (value) /= value then
raise wrong_value with "group name '" & value & "' is not capitalized";
end if;
if specs.opt_radio.Contains (text_value) or else
specs.opt_restrict.Contains (text_value) or else
specs.opt_unlimited.Contains (text_value)
then
raise dupe_list_value with "'" & value & "' has already been used in a group name";
end if;
case field is
when sp_og_radio => specs.opt_radio.Append (text_value);
when sp_og_restrict => specs.opt_restrict.Append (text_value);
when sp_og_unlimited => specs.opt_unlimited.Append (text_value);
when others => null;
end case;
when sp_exc_opsys =>
verify_entry_is_post_options;
if not specs.inc_opsys.Is_Empty then
raise wrong_value with "NOT_FOR_OPSYS can't be used after ONLY_FOR_OPSYS";
end if;
if specs.exc_opsys.Contains (text_value) then
raise dupe_list_value with value;
end if;
if not UTL.valid_lower_opsys (value) then
raise wrong_value with "opsys '" & value & "' is not valid.";
end if;
specs.exc_opsys.Append (text_value);
when sp_inc_opsys =>
verify_entry_is_post_options;
if not specs.exc_opsys.Is_Empty then
raise wrong_value with "ONLY_FOR_OPSYS can't be used after NOT_FOR_OPSYS";
end if;
if specs.inc_opsys.Contains (text_value) then
raise dupe_list_value with value;
end if;
if not UTL.valid_lower_opsys (value) then
raise wrong_value with "opsys '" & value & "' is not valid.";
end if;
specs.inc_opsys.Append (text_value);
when sp_exc_arch =>
verify_entry_is_post_options;
if specs.exc_arch.Contains (text_value) then
raise dupe_list_value with value;
end if;
if not UTL.valid_cpu_arch (value) then
raise wrong_value with "'" & value & "' is not a valid architecture.";
end if;
specs.exc_arch.Append (text_value);
when sp_ext_only =>
verify_entry_is_post_options;
verify_df_index;
if specs.extract_only.Contains (text_value) then
raise dupe_list_value with value;
end if;
specs.extract_only.Append (text_value);
when sp_ext_7z =>
verify_entry_is_post_options;
verify_df_index;
verify_special_exraction;
specs.extract_7z.Append (text_value);
when sp_ext_lha =>
verify_entry_is_post_options;
verify_df_index;
verify_special_exraction;
specs.extract_lha.Append (text_value);
when sp_ext_zip =>
verify_entry_is_post_options;
verify_df_index;
verify_special_exraction;
specs.extract_zip.Append (text_value);
when sp_ext_deb =>
verify_entry_is_post_options;
verify_df_index;
verify_special_exraction;
specs.extract_deb.Append (text_value);
when sp_ext_dirty =>
verify_entry_is_post_options;
verify_df_index;
if specs.extract_dirty.Contains (text_value) then
raise dupe_list_value with value;
end if;
specs.extract_dirty.Append (text_value);
when sp_make_args =>
verify_entry_is_post_options;
specs.make_args.Append (text_value);
when sp_make_env =>
verify_entry_is_post_options;
specs.make_env.Append (text_value);
when sp_build_target =>
verify_entry_is_post_options;
specs.build_target.Append (text_value);
when sp_install_tgt =>
verify_entry_is_post_options;
specs.install_tgt.Append (text_value);
when sp_test_tgt =>
verify_entry_is_post_options;
specs.test_tgt.Append (text_value);
when sp_test_env =>
verify_entry_is_post_options;
specs.test_env.Append (text_value);
when sp_cflags =>
verify_entry_is_post_options;
specs.cflags.Append (text_value);
when sp_cxxflags =>
verify_entry_is_post_options;
specs.cxxflags.Append (text_value);
when sp_cppflags =>
verify_entry_is_post_options;
specs.cppflags.Append (text_value);
when sp_ldflags =>
verify_entry_is_post_options;
specs.ldflags.Append (text_value);
when sp_config_args =>
verify_entry_is_post_options;
specs.config_args.Append (text_value);
when sp_config_env =>
verify_entry_is_post_options;
specs.config_env.Append (text_value);
when sp_patchfiles =>
verify_entry_is_post_options;
specs.patchfiles.Append (text_value);
when sp_pfiles_strip =>
verify_entry_is_post_options;
specs.pfiles_strip.Append (text_value);
when sp_patch_strip =>
verify_entry_is_post_options;
specs.patch_strip.Append (text_value);
when sp_extra_patches =>
verify_entry_is_post_options;
specs.extra_patches.Append (text_value);
when sp_plist_sub =>
verify_entry_is_post_options;
specs.plist_sub.Append (text_value);
when sp_users =>
verify_entry_is_post_options;
specs.users.Append (text_value);
when sp_groups =>
verify_entry_is_post_options;
specs.groups.Append (text_value);
when sp_sub_list =>
verify_entry_is_post_options;
specs.sub_list.Append (text_value);
when sp_sub_files =>
verify_entry_is_post_options;
specs.sub_files.Append (text_value);
when sp_mandirs =>
verify_entry_is_post_options;
specs.mandirs.Append (text_value);
when sp_test_args =>
verify_entry_is_post_options;
specs.test_args.Append (text_value);
when sp_cmake_args =>
verify_entry_is_post_options;
specs.cmake_args.Append (text_value);
when sp_build_deps | sp_buildrun_deps | sp_run_deps =>
verify_entry_is_post_options;
if not valid_dependency_format (value) then
raise wrong_value with "invalid dependency format '" & value & "'";
end if;
if specs.build_deps.Contains (text_value) or else
specs.buildrun_deps.Contains (text_value) or else
specs.run_deps.Contains (text_value)
then
raise dupe_list_value with "Duplicate dependency '" & value & "'";
end if;
case field is
when sp_build_deps => specs.build_deps.Append (text_value);
when sp_buildrun_deps => specs.buildrun_deps.Append (text_value);
when sp_run_deps => specs.run_deps.Append (text_value);
when others => null;
end case;
when sp_uses =>
verify_entry_is_post_options;
if not valid_uses_module (value) then
raise wrong_value with "invalid USES module '" & value & "'";
end if;
if specs.uses.Contains (text_value) then
raise dupe_list_value with "Duplicate USES module '" & value & "'";
end if;
declare
stripped : String := HT.part_1 (value, ":");
text_stripped : HT.Text := HT.SUS (stripped);
begin
specs.uses.Append (text_value);
if not specs.uses_base.Contains (text_stripped) then
specs.uses_base.Append (text_stripped);
end if;
end;
if HT.leads (value, "terminfo") and then
specs.terminfo_failed (value)
then
raise wrong_value with "Terminfo USES module doesn't have a subpackage argument";
end if;
when sp_info =>
verify_entry_is_post_options;
if specs.info.Contains (text_value) then
raise dupe_list_value with "Duplicate INFO entry '" & value & "'";
end if;
declare
msg : String := specs.info_page_check_message (value);
begin
if not HT.IsBlank (msg) then
raise wrong_type with msg;
end if;
end;
if not specs.valid_info_page (value) then
raise wrong_value with "INFO subdirectories must match on every entry";
end if;
specs.info.Append (text_value);
when sp_gnome =>
verify_entry_is_post_options;
declare
comp : gnome_type := determine_gnome_component (value);
begin
if comp = invalid_component then
raise wrong_value with "GNOME_COMPONENTS component not recognized: " & value;
end if;
end;
specs.gnome_comps.Append (text_value);
when sp_xorg =>
verify_entry_is_post_options;
declare
comp : xorg_type := determine_xorg_component (value);
begin
if comp = invalid_component then
raise wrong_value with "XORG_COMPONENTS component not recognized: " & value;
end if;
end;
specs.xorg_comps.Append (text_value);
when sp_sdl =>
verify_entry_is_post_options;
declare
comp : sdl_type := determine_sdl_component (value);
begin
if comp = invalid_component then
raise wrong_value with "SDL_COMPONENTS component not recognized: " & value;
end if;
end;
specs.sdl_comps.Append (text_value);
when sp_phpext =>
verify_entry_is_post_options;
declare
phpext : phpext_type := determine_php_extension (value);
begin
if phpext = invalid_extension then
raise wrong_value with "PHP_EXTENSIONS extension not recognized: " & value;
end if;
end;
specs.php_extensions.Append (text_value);
when sp_rcscript =>
verify_entry_is_post_options;
if not HT.contains (value, ":") then
raise wrong_value with "Invalid RC_SUBR format, must be filename:subpackage";
end if;
declare
filename : String := HT.part_1 (value, ":");
testpkg : String := HT.part_2 (value, ":");
begin
if not specs.subpackage_exists (testpkg) then
raise wrong_type with "RC_SUBR subpackage unrecognized: " & testpkg;
end if;
end;
specs.subr_scripts.Append (text_value);
when sp_licenses =>
verify_entry_is_post_options;
if not HT.contains (value, ":") then
raise wrong_value with "Invalid LICENSE format, must be name:subpackage";
end if;
declare
testlic : String := HT.part_1 (value, ":");
testpkg : String := HT.part_2 (value, ":");
lic : license_type := determine_license (testlic);
begin
if lic = INVALID then
raise wrong_value with "LICENSE not recognized: " & testlic;
end if;
if not specs.subpackage_exists (testpkg) then
raise wrong_type with "LICENSE subpackage unrecognized: " & testpkg;
end if;
end;
specs.licenses.Append (text_value);
when sp_lic_name =>
verify_entry_is_post_options;
if not HT.contains (value, ":") then
raise wrong_value with "Invalid LICENSE_NAME format, must be CUSTOMx:" &
LAT.Quotation & "name" & LAT.Quotation;
end if;
declare
procedure scan (position : string_crate.Cursor);
testlic : String := HT.part_1 (value, ":");
name : String := HT.part_2 (value, ":");
lic : license_type := determine_license (testlic);
found : Boolean := False;
procedure scan (position : string_crate.Cursor)
is
license_val : String := HT.USS (string_crate.Element (position));
name_part : String := HT.part_1 (license_val, ":");
begin
if not found then
if testlic = name_part then
found := True;
end if;
end if;
end scan;
begin
case lic is
when CUSTOM1 | CUSTOM2 | CUSTOM3 | CUSTOM4 => null;
when others =>
raise wrong_value with "LICENSE_NAME only definable with CUSTOMx license";
end case;
if name (name'First) /= LAT.Quotation or else
name (name'Last) /= LAT.Quotation
then
raise wrong_value with "LICENSE_NAME value must be quoted: " & name;
end if;
specs.licenses.Iterate (scan'Access);
if not found then
raise wrong_value with "LICENSE " & testlic & " not previously defined " &
"for " & value;
end if;
end;
specs.lic_names.Append (text_value);
when sp_lic_file =>
verify_entry_is_post_options;
if not HT.contains (value, ":") then
raise wrong_value with "Invalid LICENSE_FILE format, must be LICENSE:path";
end if;
declare
procedure scan (position : string_crate.Cursor);
testlic : String := HT.part_1 (value, ":");
path : String := HT.part_2 (value, ":");
lic : license_type := determine_license (testlic);
found : Boolean := False;
procedure scan (position : string_crate.Cursor)
is
license_val : String := HT.USS (string_crate.Element (position));
name_part : String := HT.part_1 (license_val, ":");
begin
if not found then
if testlic = name_part then
found := True;
end if;
end if;
end scan;
begin
if lic = INVALID then
raise wrong_value with "LICENSE not recognized: " & testlic;
end if;
if not HT.contains (path, "/") then
raise wrong_value with "LICENSE_FILE path component missing directory " &
"separator: " & path;
end if;
specs.licenses.Iterate (scan'Access);
if not found then
raise wrong_value with "LICENSE " & testlic & " not previously defined " &
" for " & value;
end if;
end;
specs.lic_files.Append (text_value);
when sp_broken_ssl =>
verify_entry_is_post_options;
if specs.broken_ssl.Contains (text_value) then
raise dupe_list_value with "Duplicate item '" & value & "'";
end if;
if value = "openssl" or else
value = "openssl-devel" or else
value = "libressl" or else
value = "libressl-devel"
then
specs.broken_ssl.Append (text_value);
else
raise wrong_value with "invalid BROKEN_SSL setting '" & value & "'";
end if;
when sp_broken_mysql =>
verify_entry_is_post_options;
if specs.broken_mysql.Contains (text_value) then
raise dupe_list_value with "Duplicate item '" & value & "'";
end if;
if valid_broken_mysql_value (value) then
specs.broken_mysql.Append (text_value);
else
raise wrong_value with "invalid BROKEN_MYSQL setting '" & value & "'";
end if;
when sp_broken_pgsql =>
verify_entry_is_post_options;
if specs.broken_pgsql.Contains (text_value) then
raise dupe_list_value with "Duplicate item '" & value & "'";
end if;
if valid_broken_pgsql_value (value) then
specs.broken_pgsql.Append (text_value);
else
raise wrong_value with "invalid BROKEN_PGSQL setting '" & value & "'";
end if;
when others =>
raise wrong_type with field'Img;
end case;
end append_list;
--------------------------------------------------------------------------------------------
-- append_array
--------------------------------------------------------------------------------------------
procedure establish_group
(specs : in out Portspecs;
field : spec_field;
group : String)
is
text_group : HT.Text := HT.SUS (group);
initial_rec : group_list;
begin
if HT.contains (S => group, fragment => " ") then
raise contains_spaces;
end if;
initial_rec.group := text_group;
case field is
when sp_dl_groups =>
if specs.last_set /= so_dl_groups and then
specs.last_set /= so_contacts
then
raise misordered with field'Img;
end if;
if specs.dl_sites.Is_Empty then
if group /= dlgroup_main and then
group /= dlgroup_none
then
raise wrong_value with "First download group must be '" & dlgroup_main &
"' or '" & dlgroup_none & "'";
end if;
else
if group = dlgroup_none then
raise wrong_value with "download group '" & group &
"' follows group definition";
end if;
if group = dlgroup_main then
raise wrong_value with "'" & group & "' download group must be " &
"defined earlier";
end if;
end if;
if group'Length > 15 then
raise wrong_value with "'" & group & "' value is too long (15-char limit)";
end if;
if HT.contains (group, "+") then
raise wrong_type with "'" & group & "' contains illegal character '+'";
end if;
if specs.dl_sites.Contains (text_group) then
raise dupe_list_value with group;
end if;
specs.dl_sites.Insert (text_group, initial_rec);
specs.last_set := so_dl_groups;
when sp_subpackages =>
-- variant, order, length and uniqueness already checked
-- don't update last_set either
specs.subpackages.Insert (text_group, initial_rec);
when sp_vopts =>
-- variant, order, length and uniqueness already checked
-- don't update last_set either
specs.variantopts.Insert (text_group, initial_rec);
when sp_ext_head =>
specs.extract_head.Insert (text_group, initial_rec);
when sp_ext_tail =>
specs.extract_tail.Insert (text_group, initial_rec);
when sp_makefile_targets =>
specs.make_targets.Insert (text_group, initial_rec);
when sp_options_on =>
specs.options_on.Insert (text_group, initial_rec);
when sp_broken =>
specs.broken.Insert (text_group, initial_rec);
when sp_var_opsys =>
specs.var_opsys.Insert (text_group, initial_rec);
when sp_var_arch =>
specs.var_arch.Insert (text_group, initial_rec);
when sp_exrun =>
specs.extra_rundeps.Insert (text_group, initial_rec);
when sp_catchall =>
specs.catch_all.Insert (text_group, initial_rec);
when sp_opt_descr =>
specs.optgroup_desc.Insert (text_group, initial_rec);
when sp_opt_group =>
specs.optgroups.Insert (text_group, initial_rec);
when sp_os_bdep =>
specs.opsys_b_deps.Insert (text_group, initial_rec);
when sp_os_rdep =>
specs.opsys_r_deps.Insert (text_group, initial_rec);
when sp_os_brdep =>
specs.opsys_br_deps.Insert (text_group, initial_rec);
when others =>
raise wrong_type with field'Img;
end case;
end establish_group;
--------------------------------------------------------------------------------------------
-- append_array
--------------------------------------------------------------------------------------------
procedure append_array
(specs : in out Portspecs;
field : spec_field;
key : String;
value : String;
allow_spaces : Boolean)
is
procedure grow (Key : HT.Text; Element : in out group_list);
procedure verify_entry_is_post_options;
text_key : HT.Text := HT.SUS (key);
text_value : HT.Text := HT.SUS (value);
procedure grow (Key : HT.Text; Element : in out group_list) is
begin
Element.list.Append (text_value);
end grow;
procedure verify_entry_is_post_options is
begin
if spec_order'Pos (specs.last_set) < spec_order'Pos (so_opts_std) then
raise misordered with field'Img;
end if;
end verify_entry_is_post_options;
begin
if not allow_spaces and then
HT.contains (S => value, fragment => " ")
then
raise contains_spaces;
end if;
case field is
when sp_taglines =>
if specs.last_set /= so_taglines and then
specs.last_set /= so_variants
then
raise misordered with field'Img;
end if;
if specs.taglines.Contains (text_key) then
raise dupe_spec_key with key & " (SDESC)";
end if;
-- SDESC requirements checked by caller. Assume string is legal.
specs.taglines.Insert (Key => text_key,
New_Item => text_value);
specs.last_set := so_taglines;
when sp_dl_sites =>
if specs.last_set /= so_dl_sites and then
specs.last_set /= so_dl_groups
then
raise misordered with field'Img;
end if;
if not specs.dl_sites.Contains (text_key) then
raise missing_group with key;
end if;
if specs.dl_sites.Element (text_key).list.Contains (text_value) then
raise dupe_list_value with value;
end if;
specs.dl_sites.Update_Element (Position => specs.dl_sites.Find (text_key),
Process => grow'Access);
specs.last_set := so_dl_sites;
when sp_subpackages =>
if spec_order'Pos (specs.last_set) > spec_order'Pos (so_subpackages) or else
spec_order'Pos (specs.last_set) < spec_order'Pos (so_dl_groups)
then
raise misordered with field'Img;
end if;
if not specs.subpackages.Contains (text_key) then
raise missing_group with key;
end if;
if specs.subpackages.Element (text_key).list.Contains (text_value) then
raise dupe_list_value with value;
end if;
if value = spkg_complete and then
not specs.subpackages.Element (text_key).list.Is_Empty
then
raise wrong_value with "The '" & value & "' subpackage must be set first";
end if;
if key'Length > 15 then
raise wrong_value with "'" & value & "' value is too long (15-char limit)";
end if;
if HT.contains (value, "-") then
raise wrong_value with "subpackage names cannot contain hyphens (" & value & ")";
end if;
specs.subpackages.Update_Element (Position => specs.subpackages.Find (text_key),
Process => grow'Access);
specs.last_set := so_subpackages;
when sp_vopts =>
if specs.last_set /= so_vopts and then
specs.last_set /= so_opts_std
then
raise misordered with field'Img;
end if;
if not specs.variantopts.Contains (text_key) then
raise missing_group with key;
end if;
declare
strlast : Natural;
WON : HT.Text;
WOFF : HT.Text;
begin
if HT.trails (value, "=ON") then
strlast := value'Last - 3;
WON := text_value;
WOFF := HT.SUS (value (value'First .. strlast) & "=OFF");
elsif HT.trails (value, "=OFF") then
strlast := value'Last - 4;
WOFF := text_value;
WON := HT.SUS (value (value'First .. strlast) & "=ON");
else
raise wrong_value with "'" & value & "' doesn't end in '=ON' or '=OFF'";
end if;
if specs.variantopts.Element (text_key).list.Contains (WON) or else
specs.variantopts.Element (text_key).list.Contains (WOFF)
then
raise dupe_list_value with value;
end if;
if not specs.ops_avail.Contains (HT.SUS (value (value'First .. strlast))) then
raise wrong_value with "'" & value (value'First .. strlast)
& "' was not present in OPTIONS_AVAILABLE";
end if;
end;
specs.variantopts.Update_Element (Position => specs.variantopts.Find (text_key),
Process => grow'Access);
specs.last_set := so_vopts;
when sp_ext_head =>
verify_entry_is_post_options;
if not specs.extract_head.Contains (text_key) then
raise missing_group with key;
end if;
if not specs.extract_head.Element (text_key).list.Is_Empty then
raise wrong_value with "Only 1 entry is allowed";
end if;
specs.extract_head.Update_Element (Position => specs.extract_head.Find (text_key),
Process => grow'Access);
when sp_ext_tail =>
verify_entry_is_post_options;
if not specs.extract_tail.Contains (text_key) then
raise missing_group with key;
end if;
if not specs.extract_tail.Element (text_key).list.Is_Empty then
raise wrong_value with "Only 1 entry is allowed";
end if;
specs.extract_tail.Update_Element (Position => specs.extract_tail.Find (text_key),
Process => grow'Access);
when sp_makefile_targets =>
verify_entry_is_post_options;
if not specs.make_targets.Contains (text_key) then
raise missing_group with key;
end if;
specs.make_targets.Update_Element (Position => specs.make_targets.Find (text_key),
Process => grow'Access);
when sp_options_on =>
verify_entry_is_post_options;
if not specs.options_on.Contains (text_key) then
-- Group already validated, so create if it dosn't exist
specs.establish_group (sp_options_on, key);
-- "all" must exist if non-"all" keys are used though
if not specs.options_on.Contains (HT.SUS (options_all)) then
specs.establish_group (sp_options_on, options_all);
end if;
end if;
if not specs.valid_OPT_ON_value (key, value) then
raise wrong_value with "OPT_ON value '" & value &
"' either doesn't match option list, is present in 'all' section, " &
"or it is misformatted";
end if;
specs.options_on.Update_Element (Position => specs.options_on.Find (text_key),
Process => grow'Access);
when sp_broken =>
verify_entry_is_post_options;
if not specs.broken.Contains (text_key) then
-- Group already validated, so create if it dosn't exist
specs.establish_group (sp_broken, key);
end if;
specs.broken.Update_Element (Position => specs.broken.Find (text_key),
Process => grow'Access);
when sp_catchall =>
verify_entry_is_post_options;
if not specs.catch_all.Contains (text_key) then
specs.establish_group (sp_catchall, key);
end if;
specs.catch_all.Update_Element (Position => specs.catch_all.Find (text_key),
Process => grow'Access);
specs.last_catchkey := text_key;
when sp_var_opsys =>
verify_entry_is_post_options;
if specs.var_opsys.Contains (text_key) and then
specs.var_opsys.Element (text_key).list.Contains (text_value)
then
raise wrong_value with "duplicate definition: " & key & "=" & value;
end if;
if not specs.var_opsys.Contains (text_key) then
specs.establish_group (sp_var_opsys, key);
end if;
specs.var_opsys.Update_Element (Position => specs.var_opsys.Find (text_key),
Process => grow'Access);
when sp_var_arch =>
verify_entry_is_post_options;
if specs.var_arch.Contains (text_key) and then
specs.var_arch.Element (text_key).list.Contains (text_value)
then
raise wrong_value with "duplicate definition: " & key & "=" & value;
end if;
if not specs.var_arch.Contains (text_key) then
specs.establish_group (sp_var_arch, key);
end if;
specs.var_arch.Update_Element (Position => specs.var_arch.Find (text_key),
Process => grow'Access);
when sp_exrun =>
verify_entry_is_post_options;
if not specs.subpackage_exists (key) then
raise wrong_type with "subpackage key '" & key & "' has not been defined.";
end if;
if not valid_dependency_format (value) then
if value /= "ssl" and then value /= "python" and then value /= "tcl"
and then value /= "perl"
then
raise wrong_value with "invalid dependency format '" & value & "'";
end if;
end if;
if specs.extra_rundeps.Contains (text_key) and then
specs.extra_rundeps.Element (text_key).list.Contains (text_value)
then
raise wrong_value with "duplicate definition: " & key & "=" & value;
end if;
if not specs.extra_rundeps.Contains (text_key) then
specs.establish_group (sp_exrun, key);
end if;
specs.extra_rundeps.Update_Element (Position => specs.extra_rundeps.Find (text_key),
Process => grow'Access);
when sp_opt_descr =>
verify_entry_is_post_options;
if not specs.opt_radio.Contains (text_key) and then
not specs.opt_restrict.Contains (text_key) and then
not specs.opt_unlimited.Contains (text_key)
then
raise missing_group with key;
end if;
if not specs.optgroup_desc.Contains (text_key) then
specs.establish_group (sp_opt_descr, key);
end if;
if not specs.optgroup_desc.Element (text_key).list.Is_Empty then
raise wrong_value with "Group " & key & " description already defined";
end if;
if HT.contains (value, ":") then
raise wrong_value with "Group description cannot contain colon characters";
end if;
specs.optgroup_desc.Update_Element (Position => specs.optgroup_desc.Find (text_key),
Process => grow'Access);
when sp_opt_group =>
verify_entry_is_post_options;
if not specs.opt_radio.Contains (text_key) and then
not specs.opt_restrict.Contains (text_key) and then
not specs.opt_unlimited.Contains (text_key)
then
raise missing_group with key;
end if;
if not specs.ops_standard.Contains (text_value) then
raise wrong_value with "Option '" & value & "' is not a member of OPTIONS_STANDARD";
end if;
if not specs.optgroups.Contains (text_key) then
specs.establish_group (sp_opt_group, key);
end if;
if specs.option_already_in_group (value) then
raise wrong_value with "Option '" & value & "' already belongs to an option group";
end if;
specs.optgroups.Update_Element (Position => specs.optgroups.Find (text_key),
Process => grow'Access);
when sp_os_bdep | sp_os_rdep | sp_os_brdep =>
verify_entry_is_post_options;
if not valid_dependency_format (value) then
raise wrong_value with "invalid dependency format '" & value & "'";
end if;
declare
good : Boolean := True;
begin
case field is
when sp_os_bdep =>
good := not specs.opsys_b_deps.Contains (text_key) or else
not specs.opsys_b_deps.Element (text_key).list.Contains (text_value);
when sp_os_brdep =>
good := not specs.opsys_br_deps.Contains (text_key) or else
not specs.opsys_br_deps.Element (text_key).list.Contains (text_value);
when sp_os_rdep =>
good := not specs.opsys_r_deps.Contains (text_key) or else
not specs.opsys_r_deps.Element (text_key).list.Contains (text_value);
when others => null;
end case;
if not good then
raise wrong_value with "duplicate definition: " & key & "=" & value;
end if;
end;
case field is
when sp_os_bdep =>
if not specs.opsys_b_deps.Contains (text_key) then
specs.establish_group (sp_os_bdep, key);
end if;
specs.opsys_b_deps.Update_Element
(Position => specs.opsys_b_deps.Find (text_key),
Process => grow'Access);
when sp_os_brdep =>
if not specs.opsys_br_deps.Contains (text_key) then
specs.establish_group (sp_os_brdep, key);
end if;
specs.opsys_br_deps.Update_Element
(Position => specs.opsys_br_deps.Find (text_key),
Process => grow'Access);
when sp_os_rdep =>
if not specs.opsys_r_deps.Contains (text_key) then
specs.establish_group (sp_os_rdep, key);
end if;
specs.opsys_r_deps.Update_Element
(Position => specs.opsys_r_deps.Find (text_key),
Process => grow'Access);
when others => null;
end case;
when others =>
raise wrong_type with field'Img;
end case;
end append_array;
--------------------------------------------------------------------------------------------
-- set_natural_integer
--------------------------------------------------------------------------------------------
procedure set_natural_integer
(specs : in out Portspecs;
field : spec_field;
value : Natural) is
procedure verify_entry_is_post_options;
procedure verify_entry_is_post_options is
begin
if spec_order'Pos (specs.last_set) < spec_order'Pos (so_opts_std) then
raise misordered with field'Img;
end if;
end verify_entry_is_post_options;
begin
case field is
when sp_revision =>
if specs.last_set /= so_version then
raise misordered with field'Img;
end if;
specs.revision := value;
specs.last_set := so_revision;
when sp_epoch =>
if specs.last_set /= so_revision and then
specs.last_set /= so_version
then
raise misordered with field'Img;
end if;
specs.epoch := value;
specs.last_set := so_epoch;
when sp_opt_level =>
verify_entry_is_post_options;
if value > 3 then
raise wrong_value with "OPTIMIZER_LEVEL is limited to 3";
end if;
specs.optimizer_lvl := value;
when sp_job_limit =>
verify_entry_is_post_options;
if value < 1 then
raise wrong_value with "MAKE_JOBS_NUMBER_LIMIT must be at least 1";
end if;
if value > Natural (cpu_range'Last) then
raise wrong_value with "MAKE_JOBS_NUMBER_LIMIT is limited to " & cpu_range'Last'Img;
end if;
specs.job_limit := value;
when others =>
raise wrong_type with field'Img;
end case;
end set_natural_integer;
--------------------------------------------------------------------------------------------
-- set_boolean
--------------------------------------------------------------------------------------------
procedure set_boolean
(specs : in out Portspecs;
field : spec_field;
value : Boolean) is
begin
case field is
when sp_skip_build =>
specs.skip_build := value;
when sp_destdir_env =>
specs.destdir_env := value;
when sp_single_job =>
specs.single_job := value;
when sp_skip_install =>
specs.skip_install := value;
when sp_cfg_outsrc =>
specs.config_outsrc := value;
when sp_inst_tchain =>
specs.shift_install := value;
when sp_skip_ccache =>
specs.skip_ccache := value;
when sp_rpath_warning =>
specs.fatal_rpath := False;
when sp_debugging =>
specs.debugging_on := value;
when sp_generated =>
specs.generated := value;
when others =>
raise wrong_type with field'Img;
end case;
end set_boolean;
--------------------------------------------------------------------------------------------
-- build_option_helper
--------------------------------------------------------------------------------------------
procedure build_option_helper
(specs : in out Portspecs;
field : spec_option;
option : String;
value : String)
is
procedure Change (Key : HT.Text; Element : in out Option_Helper);
option_text : HT.Text := HT.SUS (option);
value_text : HT.Text := HT.SUS (value);
mycursor : option_crate.Cursor;
allow_spaces : Boolean;
procedure Change (Key : HT.Text; Element : in out Option_Helper) is
begin
case field is
when broken_on =>
Element.BROKEN_ON := value_text;
when buildrun_depends_off =>
Element.BUILDRUN_DEPENDS_OFF.Append (value_text);
when buildrun_depends_on =>
Element.BUILDRUN_DEPENDS_ON.Append (value_text);
when build_depends_off =>
Element.BUILD_DEPENDS_OFF.Append (value_text);
when build_depends_on =>
Element.BUILD_DEPENDS_ON.Append (value_text);
when build_target_on =>
Element.BUILD_TARGET_ON.Append (value_text);
when cflags_off =>
Element.CFLAGS_OFF.Append (value_text);
when cflags_on =>
Element.CFLAGS_ON.Append (value_text);
when cmake_args_off =>
Element.CMAKE_ARGS_OFF.Append (value_text);
when cmake_args_on =>
Element.CMAKE_ARGS_ON.Append (value_text);
when cmake_bool_f_both =>
Element.CMAKE_BOOL_F_BOTH.Append (value_text);
when cmake_bool_t_both =>
Element.CMAKE_BOOL_T_BOTH.Append (value_text);
when configure_args_off =>
Element.CONFIGURE_ARGS_OFF.Append (value_text);
when configure_args_on =>
Element.CONFIGURE_ARGS_ON.Append (value_text);
when configure_enable_both =>
Element.CONFIGURE_ENABLE_BOTH.Append (value_text);
when configure_env_on =>
Element.CONFIGURE_ENV_ON.Append (value_text);
when configure_with_both =>
Element.CONFIGURE_WITH_BOTH.Append (value_text);
when cppflags_on =>
Element.CPPFLAGS_ON.Append (value_text);
when cxxflags_on =>
Element.CXXFLAGS_ON.Append (value_text);
when description =>
Element.option_description := value_text;
when df_index_off =>
Element.DF_INDEX_OFF.Append (value_text);
when df_index_on =>
Element.DF_INDEX_ON.Append (value_text);
when extra_patches_on =>
Element.EXTRA_PATCHES_ON.Append (value_text);
when extract_only_on =>
Element.EXTRACT_ONLY_ON.Append (value_text);
when gnome_comp_off =>
Element.GNOME_COMPONENTS_OFF.Append (value_text);
when gnome_comp_on =>
Element.GNOME_COMPONENTS_ON.Append (value_text);
when implies_on =>
Element.IMPLIES_ON.Append (value_text);
when info_off =>
Element.INFO_OFF.Append (value_text);
when info_on =>
Element.INFO_ON.Append (value_text);
when install_target_on =>
Element.INSTALL_TARGET_ON.Append (value_text);
when keywords_on =>
Element.KEYWORDS_ON.Append (value_text);
when ldflags_on =>
Element.LDFLAGS_ON.Append (value_text);
when makefile_off =>
Element.MAKEFILE_OFF.Append (value_text);
when makefile_on =>
Element.MAKEFILE_ON.Append (value_text);
when make_args_off =>
Element.MAKE_ARGS_OFF.Append (value_text);
when make_args_on =>
Element.MAKE_ARGS_ON.Append (value_text);
when make_env_on =>
Element.MAKE_ENV_ON.Append (value_text);
when only_for_opsys_on =>
Element.ONLY_FOR_OPSYS_ON.Append (value_text);
when patchfiles_on =>
Element.PATCHFILES_ON.Append (value_text);
when plist_sub_on =>
Element.PLIST_SUB_ON.Append (value_text);
when prevents_on =>
Element.PREVENTS_ON.Append (value_text);
when qmake_off =>
Element.QMAKE_OFF.Append (value_text);
when qmake_on =>
Element.QMAKE_ON.Append (value_text);
when run_depends_off =>
Element.RUN_DEPENDS_OFF.Append (value_text);
when run_depends_on =>
Element.RUN_DEPENDS_ON.Append (value_text);
when sub_list_off =>
Element.SUB_LIST_OFF.Append (value_text);
when sub_files_off =>
Element.SUB_FILES_OFF.Append (value_text);
when sub_files_on =>
Element.SUB_FILES_ON.Append (value_text);
when sub_list_on =>
Element.SUB_LIST_ON.Append (value_text);
when test_target_on =>
Element.TEST_TARGET_ON.Append (value_text);
when uses_off =>
Element.USES_OFF.Append (value_text);
when uses_on =>
Element.USES_ON.Append (value_text);
when xorg_comp_off =>
Element.XORG_COMPONENTS_OFF.Append (value_text);
when xorg_comp_on =>
Element.XORG_COMPONENTS_ON.Append (value_text);
when not_helper_format | not_supported_helper =>
null;
end case;
end Change;
begin
if spec_order'Pos (specs.last_set) < spec_order'Pos (so_opts_std) then
raise misordered with field'Img;
end if;
case field is
when build_target_on | cmake_bool_f_both | cmake_bool_t_both | configure_enable_both |
configure_with_both | df_index_on | extra_patches_on | extract_only_on |
implies_on | info_on | install_target_on | keywords_on | buildrun_depends_on |
patchfiles_on | prevents_on | run_depends_on | sub_files_on | test_target_on |
uses_on | uses_off | buildrun_depends_off | run_depends_off | build_depends_on |
gnome_comp_on | xorg_comp_on | info_off | df_index_off | sub_files_off =>
allow_spaces := False;
when others =>
allow_spaces := True;
end case;
if not allow_spaces and then
HT.contains (S => value, fragment => " ")
then
raise contains_spaces;
end if;
if not specs.ops_helpers.Contains (option_text) then
raise wrong_value with "option '" & option & "' is not defined.";
end if;
mycursor := specs.ops_helpers.Find (Key => option_text);
-- validate first
case field is
when broken_on | build_target_on | cflags_on | cmake_args_off | cmake_args_on |
cmake_bool_f_both | cmake_bool_t_both | configure_args_off | configure_args_on |
configure_enable_both | configure_env_on | configure_with_both | cflags_off |
cppflags_on | cxxflags_on | extra_patches_on | install_target_on |
ldflags_on | make_args_off | make_args_on | make_env_on | patchfiles_on |
plist_sub_on | qmake_on | qmake_off | sub_files_off | sub_files_on |
sub_list_off | sub_list_on | test_target_on | makefile_on | makefile_off =>
-- No validation required
null;
when build_depends_on | buildrun_depends_on | run_depends_on |
build_depends_off | buildrun_depends_off | run_depends_off =>
if not valid_dependency_format (value) then
raise wrong_value with "invalid dependency format '" & value & "'";
end if;
when xorg_comp_on | xorg_comp_off =>
if determine_xorg_component (value) = invalid_component then
raise wrong_value with "xorg component '" & value & "' is not valid";
end if;
when gnome_comp_on | gnome_comp_off =>
if determine_gnome_component (value) = invalid_component then
raise wrong_value with "gnome component '" & value & "' is not valid";
end if;
when df_index_off =>
if not specs.dist_index_is_valid (value) then
raise wrong_value with "distfile index '" & value & "' is not valid";
end if;
if specs.ops_helpers.Element (option_text).DF_INDEX_OFF.Contains (value_text) or else
specs.df_index.Contains (value_text)
then
raise dupe_list_value with value;
end if;
specs.opt_df_index := True;
when df_index_on =>
if not specs.dist_index_is_valid (value) then
raise wrong_value with "distfile index '" & value & "' is not valid";
end if;
if specs.ops_helpers.Element (option_text).DF_INDEX_ON.Contains (value_text) or else
specs.df_index.Contains (value_text)
then
raise dupe_list_value with value;
end if;
specs.opt_df_index := True;
when extract_only_on =>
if not specs.dist_index_is_valid (value) then
raise wrong_value with "distfile index '" & value & "' is not valid";
end if;
if specs.ops_helpers.Element (option_text).EXTRACT_ONLY_ON.Contains (value_text) then
raise dupe_list_value with value;
end if;
when implies_on =>
if not specs.ops_avail.Contains (value_text) then
raise wrong_value with "Not a defined option: '" & value & "'";
end if;
if specs.ops_helpers.Element (option_text).IMPLIES_ON.Contains (value_text) then
raise dupe_list_value with value;
end if;
when prevents_on =>
if not specs.ops_avail.Contains (value_text) then
raise wrong_value with "Not a defined option: '" & value & "'";
end if;
if specs.ops_helpers.Element (option_text).PREVENTS_ON.Contains (value_text) then
raise dupe_list_value with value;
end if;
when keywords_on =>
if not keyword_is_valid (value) then
raise wrong_value with "Keyword '" & value & "' is not recognized";
end if;
if option_crate.Element (mycursor).KEYWORDS_ON.Contains (value_text) then
raise dupe_list_value with value;
end if;
when uses_on | uses_off =>
if not valid_uses_module (value) then
raise wrong_value with "USES '" & value & "' is not recognized";
end if;
when info_on | info_off =>
declare
msg : String := specs.info_page_check_message (value);
begin
if not HT.IsBlank (msg) then
raise wrong_type with msg;
end if;
end;
if not specs.valid_info_page (value) then
raise wrong_value with "INFO subdirectories must match on every entry";
end if;
when description =>
if value'Length > 50 then
raise wrong_value with "option descriptions are limited to 50 characters";
end if;
if HT.contains (value, ":") then
raise wrong_value with "option descriptions cannot contain colon characters";
end if;
when only_for_opsys_on =>
if not UTL.valid_lower_opsys (value) then
raise wrong_value with "opsys '" & value & "' is not valid.";
end if;
when not_supported_helper | not_helper_format =>
null;
end case;
specs.ops_helpers.Update_Element (Position => mycursor, Process => Change'Access);
end build_option_helper;
--------------------------------------------------------------------------------------------
-- option_helper_unset
--------------------------------------------------------------------------------------------
function option_helper_unset
(specs : Portspecs;
field : spec_option;
option : String) return Boolean
is
option_text : HT.Text := HT.SUS (option);
begin
if not specs.ops_helpers.Contains (option_text) then
return False;
end if;
declare
rec : Option_Helper renames specs.ops_helpers.Element (option_text);
begin
case field is
when broken_on => return HT.IsBlank (rec.BROKEN_ON);
when buildrun_depends_off => return rec.BUILDRUN_DEPENDS_OFF.Is_Empty;
when buildrun_depends_on => return rec.BUILDRUN_DEPENDS_ON.Is_Empty;
when build_depends_off => return rec.BUILD_DEPENDS_OFF.Is_Empty;
when build_depends_on => return rec.BUILD_DEPENDS_ON.Is_Empty;
when build_target_on => return rec.BUILD_TARGET_ON.Is_Empty;
when cflags_off => return rec.CFLAGS_OFF.Is_Empty;
when cflags_on => return rec.CFLAGS_ON.Is_Empty;
when cmake_args_off => return rec.CMAKE_ARGS_OFF.Is_Empty;
when cmake_args_on => return rec.CMAKE_ARGS_ON.Is_Empty;
when cmake_bool_f_both => return rec.CMAKE_BOOL_F_BOTH.Is_Empty;
when cmake_bool_t_both => return rec.CMAKE_BOOL_T_BOTH.Is_Empty;
when configure_args_off => return rec.CONFIGURE_ARGS_OFF.Is_Empty;
when configure_args_on => return rec.CONFIGURE_ARGS_ON.Is_Empty;
when configure_enable_both => return rec.CONFIGURE_ENABLE_BOTH.Is_Empty;
when configure_env_on => return rec.CONFIGURE_ENV_ON.Is_Empty;
when configure_with_both => return rec.CONFIGURE_WITH_BOTH.Is_Empty;
when cppflags_on => return rec.CPPFLAGS_ON.Is_Empty;
when cxxflags_on => return rec.CXXFLAGS_ON.Is_Empty;
when df_index_off => return rec.DF_INDEX_OFF.Is_Empty;
when df_index_on => return rec.DF_INDEX_ON.Is_Empty;
when description => return HT.IsBlank (rec.option_description);
when extra_patches_on => return rec.EXTRA_PATCHES_ON.Is_Empty;
when extract_only_on => return rec.EXTRACT_ONLY_ON.Is_Empty;
when gnome_comp_off => return rec.GNOME_COMPONENTS_OFF.Is_Empty;
when gnome_comp_on => return rec.GNOME_COMPONENTS_ON.Is_Empty;
when implies_on => return rec.IMPLIES_ON.Is_Empty;
when info_off => return rec.INFO_OFF.Is_Empty;
when info_on => return rec.INFO_ON.Is_Empty;
when install_target_on => return rec.INSTALL_TARGET_ON.Is_Empty;
when keywords_on => return rec.KEYWORDS_ON.Is_Empty;
when ldflags_on => return rec.LDFLAGS_ON.Is_Empty;
when makefile_off => return rec.MAKEFILE_OFF.Is_Empty;
when makefile_on => return rec.MAKEFILE_ON.Is_Empty;
when make_args_off => return rec.MAKE_ARGS_OFF.Is_Empty;
when make_args_on => return rec.MAKE_ARGS_ON.Is_Empty;
when make_env_on => return rec.MAKE_ENV_ON.Is_Empty;
when only_for_opsys_on => return rec.ONLY_FOR_OPSYS_ON.Is_Empty;
when patchfiles_on => return rec.PATCHFILES_ON.Is_Empty;
when plist_sub_on => return rec.PLIST_SUB_ON.Is_Empty;
when prevents_on => return rec.PREVENTS_ON.Is_Empty;
when qmake_off => return rec.QMAKE_OFF.Is_Empty;
when qmake_on => return rec.QMAKE_ON.Is_Empty;
when run_depends_off => return rec.RUN_DEPENDS_OFF.Is_Empty;
when run_depends_on => return rec.RUN_DEPENDS_ON.Is_Empty;
when sub_files_off => return rec.SUB_FILES_OFF.Is_Empty;
when sub_files_on => return rec.SUB_FILES_ON.Is_Empty;
when sub_list_off => return rec.SUB_LIST_OFF.Is_Empty;
when sub_list_on => return rec.SUB_LIST_ON.Is_Empty;
when test_target_on => return rec.TEST_TARGET_ON.Is_Empty;
when uses_off => return rec.USES_OFF.Is_Empty;
when uses_on => return rec.USES_ON.Is_Empty;
when xorg_comp_off => return rec.XORG_COMPONENTS_OFF.Is_Empty;
when xorg_comp_on => return rec.XORG_COMPONENTS_ON.Is_Empty;
when not_helper_format => return False;
when not_supported_helper => return False;
end case;
end;
end option_helper_unset;
--------------------------------------------------------------------------------------------
-- variant_exists
--------------------------------------------------------------------------------------------
function variant_exists (specs : Portspecs; variant : String) return Boolean is
begin
return specs.variants.Contains (Item => HT.SUS (variant));
end variant_exists;
--------------------------------------------------------------------------------------------
-- option_exists
--------------------------------------------------------------------------------------------
function option_exists (specs : Portspecs; option : String) return Boolean
is
option_text : HT.Text := HT.SUS (option);
begin
if option = "" then
return False;
end if;
return specs.ops_avail.Contains (option_text);
end option_exists;
--------------------------------------------------------------------------------------------
-- group_exists
--------------------------------------------------------------------------------------------
function group_exists
(specs : Portspecs;
field : spec_field;
group : String) return Boolean
is
text_group : HT.Text := HT.SUS (group);
begin
case field is
when sp_dl_sites =>
return specs.dl_sites.Contains (text_group);
when sp_subpackages =>
return specs.subpackages.Contains (text_group);
when sp_vopts =>
return specs.variantopts.Contains (text_group);
when sp_ext_head =>
return specs.extract_head.Contains (text_group);
when sp_ext_tail =>
return specs.extract_tail.Contains (text_group);
when sp_makefile_targets =>
return specs.make_targets.Contains (text_group);
when sp_options_on =>
return specs.options_on.Contains (text_group);
when sp_broken =>
return specs.broken.Contains (text_group);
when sp_var_opsys =>
return specs.var_opsys.Contains (text_group);
when sp_var_arch =>
return specs.var_arch.Contains (text_group);
when sp_exrun =>
return specs.extra_rundeps.Contains (text_group);
when sp_catchall =>
return specs.catch_all.Contains (text_group);
when sp_opt_descr =>
return specs.optgroup_desc.Contains (text_group);
when sp_opt_group =>
return specs.optgroups.Contains (text_group);
when sp_os_bdep =>
return specs.opsys_b_deps.Contains (text_group);
when sp_os_rdep =>
return specs.opsys_r_deps.Contains (text_group);
when sp_os_brdep =>
return specs.opsys_br_deps.Contains (text_group);
when others =>
return False;
end case;
end group_exists;
--------------------------------------------------------------------------------------------
-- option_current_setting
--------------------------------------------------------------------------------------------
function option_current_setting (specs : Portspecs; option : String) return Boolean
is
option_text : HT.Text := HT.SUS (option);
begin
if not specs.option_exists (option) then
raise invalid_option with option;
end if;
if specs.ops_helpers.Contains (option_text) then
return specs.ops_helpers.Element (option_text).currently_set_ON;
end if;
return False;
end option_current_setting;
--------------------------------------------------------------------------------------------
-- all_taglines_defined
--------------------------------------------------------------------------------------------
function all_taglines_defined (specs : Portspecs) return Boolean
is
procedure check (position : string_crate.Cursor);
all_present : Boolean := True;
procedure check (position : string_crate.Cursor)
is
variant : HT.Text := string_crate.Element (position);
begin
if not specs.taglines.Contains (variant) then
all_present := False;
end if;
end check;
begin
specs.variants.Iterate (Process => check'Access);
return all_present;
end all_taglines_defined;
--------------------------------------------------------------------------------------------
-- check_variants
--------------------------------------------------------------------------------------------
function check_variants (specs : Portspecs) return String
is
procedure check (position : string_crate.Cursor);
procedure check_option (position : string_crate.Cursor);
result : HT.Text := HT.blank;
variant : HT.Text;
-- OPTIONS_AVAILABLE process
procedure check_option (position : string_crate.Cursor)
is
option : HT.Text := string_crate.Element (position);
begin
if HT.IsBlank (result) then
declare
step : String := HT.USS (option);
WON : HT.Text := HT.SUS (step & "=ON");
WOFF : HT.Text := HT.SUS (step & "=OFF");
begin
if not specs.variantopts.Element (variant).list.Contains (WON) and then
not specs.variantopts.Element (variant).list.Contains (WOFF)
then
result := HT.SUS (HT.USS (variant) & ":" & step);
end if;
end;
end if;
end check_option;
-- variant process
procedure check (position : string_crate.Cursor) is
begin
variant := string_crate.Element (position);
if HT.IsBlank (result) then
if HT.USS (variant) /= variant_standard then
-- It's impossible that variantopts doesn't have variant, so don't test
specs.ops_avail.Iterate (Process => check_option'Access);
end if;
end if;
end check;
begin
specs.variants.Iterate (Process => check'Access);
return HT.USS (result);
end check_variants;
--------------------------------------------------------------------------------------------
-- contains_nonquoted_spaces
--------------------------------------------------------------------------------------------
function contains_nonquoted_spaces (word : String) return Boolean
is
mask : String := UTL.mask_quoted_string (word);
begin
return HT.contains (S => mask, fragment => " ");
end contains_nonquoted_spaces;
--------------------------------------------------------------------------------------------
-- adjust_defaults_port_parse
--------------------------------------------------------------------------------------------
procedure adjust_defaults_port_parse (specs : in out Portspecs)
is
procedure grow (Key : HT.Text; Element : in out group_list);
empty_comment : HT.Text := HT.SUS ("# empty");
procedure grow (Key : HT.Text; Element : in out group_list) is
begin
Element.list.Append (empty_comment);
end grow;
begin
for X in Integer range 1 .. Integer (specs.extract_head.Length) loop
declare
N : HT.Text := HT.SUS (HT.int2str (X));
begin
if not specs.extract_head.Element (N).list.Is_Empty and then
specs.extract_tail.Element (N).list.Is_Empty
then
specs.extract_tail.Update_Element (Position => specs.extract_tail.Find (N),
Process => grow'Access);
else
if not specs.extract_tail.Element (N).list.Is_Empty and then
specs.extract_head.Element (N).list.Is_Empty
then
specs.extract_head.Update_Element (Position => specs.extract_head.Find (N),
Process => grow'Access);
end if;
end if;
end;
end loop;
if specs.df_index.Is_Empty and then
not specs.opt_df_index and then
not specs.distfiles.Is_Empty
then
specs.df_index.Append (HT.SUS ("1"));
end if;
end adjust_defaults_port_parse;
--------------------------------------------------------------------------------------------
-- dist_index_is_valid
--------------------------------------------------------------------------------------------
function dist_index_is_valid (specs : Portspecs; test_index : String) return Boolean
is
mynum : Integer := Integer'Value (test_index);
begin
return (mynum >= 1 and then mynum <= Integer (specs.distfiles.Length));
exception
when Constraint_Error =>
return False;
end dist_index_is_valid;
--------------------------------------------------------------------------------------------
-- valid_OPT_ON_value
--------------------------------------------------------------------------------------------
function valid_OPT_ON_value (specs : Portspecs;
key : String;
word : String) return Boolean
is
function looks_like_release (wrkstr : String) return Boolean;
function looks_like_release (wrkstr : String) return Boolean is
begin
for X in wrkstr'Range loop
case wrkstr (X) is
when '0' .. '9' | '.' => null;
when others => return False;
end case;
end loop;
return True;
end looks_like_release;
begin
if key = options_all or else
UTL.valid_cpu_arch (key)
then
-- "all" and arch types Limited to existing options
return specs.option_exists (word);
end if;
-- Note: "all" must come first and nothing following can define options that are
-- already defined in "all".
if specs.option_exists (word) then
return not specs.option_present_in_OPT_ON_all (word);
end if;
declare
P2_1 : String := HT.part_1 (word, "/");
P2_2 : String := HT.part_2 (word, "/");
begin
if P2_2'Length = 0 then
return False;
end if;
if specs.option_exists (P2_1) then
if specs.option_present_in_OPT_ON_all (P2_1) then
return False;
end if;
else
return False;
end if;
if HT.contains (P2_2, "/") then
-- This is a triplet
declare
P3_1 : String := HT.part_1 (P2_2, "/");
P3_2 : String := HT.part_2 (P2_2, "/");
begin
if P3_1 /= "" and then
not looks_like_release (P3_1)
then
return False;
end if;
-- Here: P2_2 matches an option
-- P3_1 is empty string or a release
declare
num_bars : Natural := HT.count_char (P3_2, LAT.Vertical_Line);
bck_marker : Natural := P3_2'First;
vrt_marker : Natural := bck_marker;
begin
if num_bars = 0 then
return UTL.valid_cpu_arch (P3_2);
end if;
if num_bars = 1 then
return UTL.valid_cpu_arch (HT.part_1 (P3_2, "|")) and then
UTL.valid_cpu_arch (HT.part_2 (P3_2, "|"));
end if;
for V in Positive range 1 .. num_bars loop
loop
exit when P3_2 (vrt_marker) = LAT.Vertical_Line;
vrt_marker := vrt_marker + 1;
end loop;
if not UTL.valid_cpu_arch (P3_2 (bck_marker .. vrt_marker - 1)) then
return False;
end if;
bck_marker := vrt_marker + 1;
vrt_marker := bck_marker;
end loop;
return UTL.valid_cpu_arch (P3_2 (bck_marker .. P3_2'Last));
end;
end;
else
-- Only [0-9.] allowed
return looks_like_release (P2_2);
end if;
end;
end valid_OPT_ON_value;
--------------------------------------------------------------------------------------------
-- option_present_in_OPT_ON_all
--------------------------------------------------------------------------------------------
function option_present_in_OPT_ON_all (specs : Portspecs;
option_name : String) return Boolean is
begin
return specs.options_on.Element (HT.SUS (options_all)).list.Contains (HT.SUS (option_name));
end option_present_in_OPT_ON_all;
--------------------------------------------------------------------------------------------
-- ISO8601_format
--------------------------------------------------------------------------------------------
function ISO8601_format (value : String) return Boolean
is
-- Requires YYYY-MM-DD, YYYY >= 2017, MM 01..12, DD 01..31, converts
begin
if value'Length /= 10 then
return False;
end if;
declare
year : Integer;
month : Integer;
day : Integer;
wrkstr : String (1 .. 10) := value;
dummy : CAL.Time;
begin
if not (wrkstr (5) = LAT.Hyphen) or else
not (wrkstr (8) = LAT.Hyphen)
then
return False;
end if;
year := Integer'Value (wrkstr (1 .. 4));
month := Integer'Value (wrkstr (6 .. 7));
day := Integer'Value (wrkstr (9 .. 10));
if year < 2017 or else
month < 1 or else
month > 12 or else
day < 1 or else
day > 31
then
return False;
end if;
dummy := CAL.Formatting.Value (wrkstr & " 00:00:00");
return True;
end;
exception
when others =>
return False;
end ISO8601_format;
--------------------------------------------------------------------------------------------
-- check_deprecation
--------------------------------------------------------------------------------------------
function deprecation_valid (specs : Portspecs) return Boolean
is
DEP : Boolean := not HT.IsBlank (specs.deprecated);
EXP : Boolean := not HT.IsBlank (specs.expire_date);
begin
return (DEP and EXP) or else (not DEP and not EXP);
end deprecation_valid;
--------------------------------------------------------------------------------------------
-- get_namebase
--------------------------------------------------------------------------------------------
function get_namebase (specs : Portspecs) return String is
begin
return HT.USS (specs.namebase);
end get_namebase;
--------------------------------------------------------------------------------------------
-- get_options_list
--------------------------------------------------------------------------------------------
function get_options_list (specs : Portspecs; variant : String) return String
is
procedure dump_option (position : option_crate.Cursor);
joined : HT.Text;
is_standard : constant Boolean := (variant = variant_standard);
procedure dump_option (position : option_crate.Cursor)
is
rec : Option_Helper renames option_crate.Element (position);
optname : String := HT.USS (rec.option_name);
begin
if optname = "none" then
return;
end if;
if is_standard and then not rec.standard_option then
return;
end if;
if rec.currently_set_ON then
HT.SU.Append (joined, " " & optname & ": on,");
else
HT.SU.Append (joined, " " & optname & ": off,");
end if;
end dump_option;
begin
specs.ops_helpers.Iterate (dump_option'Access);
return HT.USS (joined);
end get_options_list;
--------------------------------------------------------------------------------------------
-- option_block_for_dialog
--------------------------------------------------------------------------------------------
function option_block_for_dialog (specs : Portspecs) return String
is
-- block format is
-- GROUP:GROUP-TYPE:GROUP-DESC:OPT-NAME:DEFAULT-VAL:CURRENT-VAL:OPT-DESC
type group_type is (radio, restrict, sinlimit);
procedure scan1 (position : string_crate.Cursor);
procedure group_scan (position : string_crate.Cursor);
procedure group_option_scan (position : string_crate.Cursor);
procedure nogroup (position : string_crate.Cursor);
function bool2str (b : Boolean) return String;
function description (option_name, opt_description : HT.Text) return String;
tmpstore : string_crate.Vector;
group : group_type;
answer : HT.Text;
group_index : HT.Text;
function bool2str (b : Boolean) return String is
begin
if b then
return "1";
else
return "0";
end if;
end bool2str;
procedure scan1 (position : string_crate.Cursor) is
begin
tmpstore.Append (string_crate.Element (position));
end scan1;
procedure group_scan (position : string_crate.Cursor)
is
begin
group_index := string_crate.Element (position);
specs.optgroups.Element (group_index).list.Iterate (group_option_scan'Access);
end group_scan;
procedure group_option_scan (position : string_crate.Cursor)
is
function group_type return String;
option_name : HT.Text renames string_crate.Element (position);
helper : Option_Helper renames specs.ops_helpers.Element (option_name);
gdesc : HT.Text renames specs.optgroup_desc.Element (group_index).list.First_Element;
function group_type return String is
begin
case group is
when radio => return "RADIO";
when restrict => return "RESTR";
when sinlimit => return "UNLIM";
end case;
end group_type;
begin
if specs.ops_helpers.Contains (option_name) then
if tmpstore.Contains (option_name) then
tmpstore.Delete (tmpstore.Find_Index (option_name));
end if;
HT.SU.Append (answer,
HT.USS (group_index) &
LAT.Colon & group_type &
LAT.Colon & HT.USS (gdesc) &
LAT.Colon & HT.USS (option_name) &
LAT.Colon & bool2str (helper.set_ON_by_default) &
LAT.Colon & bool2str (helper.currently_set_ON) &
LAT.Colon & description (option_name, helper.option_description) &
LAT.LF);
end if;
end group_option_scan;
procedure nogroup (position : string_crate.Cursor)
is
option_name : HT.Text renames string_crate.Element (position);
helper : Option_Helper renames specs.ops_helpers.Element (option_name);
begin
if specs.ops_helpers.Contains (option_name) then
answer := HT.SUS (
LAT.Colon & LAT.Colon &
LAT.Colon & HT.USS (option_name) &
LAT.Colon & bool2str (helper.set_ON_by_default) &
LAT.Colon & bool2str (helper.currently_set_ON) &
LAT.Colon & description (option_name, helper.option_description) &
LAT.LF & HT.USS (answer));
end if;
end nogroup;
function description (option_name, opt_description : HT.Text) return String is
begin
if HT.IsBlank (opt_description) then
declare
dos : described_option_set := described_option (HT.USS (option_name));
begin
if dos = OPT_NOT_DEFINED then
return "error-missing option description";
else
return default_description (dos);
end if;
end;
else
return HT.USS (opt_description);
end if;
end description;
begin
specs.ops_standard.Iterate (scan1'Access);
group := radio;
specs.opt_radio.Iterate (group_scan'Access);
group := restrict;
specs.opt_restrict.Iterate (group_scan'Access);
group := sinlimit;
specs.opt_unlimited.Iterate (group_scan'Access);
tmpstore.Iterate (nogroup'Access);
return HT.USS (answer);
end option_block_for_dialog;
--------------------------------------------------------------------------------------------
-- get_field_value
--------------------------------------------------------------------------------------------
function get_field_value (specs : Portspecs; field : spec_field) return String
is
procedure concat (position : string_crate.Cursor);
procedure scan_contact (position : string_crate.Cursor);
procedure dump_license (position : string_crate.Cursor);
joined : HT.Text;
procedure concat (position : string_crate.Cursor) is
begin
if not HT.IsBlank (joined) then
HT.SU.Append (joined, ", ");
end if;
HT.SU.Append (joined, string_crate.Element (position));
end concat;
procedure dump_license (position : string_crate.Cursor)
is
lic_desc : HT.Text;
begin
if not HT.IsBlank (joined) then
HT.SU.Append (joined, ", ");
end if;
declare
procedure scan_lic_names (position : string_crate.Cursor);
lic : String := HT.part_1 (HT.USS (string_crate.Element (position)), ":");
lictype : license_type := determine_license (lic);
procedure scan_lic_names (position : string_crate.Cursor)
is
raw : String := HT.USS (string_crate.Element (position));
begin
if HT.leads (raw, lic) then
lic_desc := HT.SUS (HT.part_2 (raw, ":"));
end if;
end scan_lic_names;
begin
case lictype is
when CUSTOM1 | CUSTOM2 | CUSTOM3 | CUSTOM4 =>
specs.lic_names.Iterate (scan_lic_names'Access);
HT.SU.Append (joined, lic_desc);
when others =>
HT.SU.Append (joined, LAT.Quotation & lic & LAT.Quotation);
end case;
end;
end dump_license;
procedure scan_contact (position : string_crate.Cursor)
is
contact : String := HT.USS (string_crate.Element (position));
email : String := HT.part_2 (contact, "[");
guy : String := HT.replace_all (S => HT.part_1 (contact, "["),
reject => LAT.Low_Line,
shiny => LAT.Space);
begin
if not HT.IsBlank (joined) then
HT.SU.Append (joined, ", ");
end if;
if contact = contact_nobody then
HT.SU.Append (joined, contact);
else
HT.SU.Append (joined, guy & " [" & email);
end if;
end scan_contact;
begin
case field is
when sp_namebase => return HT.USS (specs.namebase);
when sp_version => return HT.USS (specs.version);
when sp_revision => return HT.int2str (specs.revision);
when sp_epoch => return HT.int2str (specs.epoch);
when sp_homepage => return HT.USS (specs.homepage);
when sp_distsubdir => return HT.USS (specs.dist_subdir);
when sp_prefix => return HT.USS (specs.prefix);
when sp_deprecated => return HT.USS (specs.deprecated);
when sp_expiration => return HT.USS (specs.expire_date);
when sp_ug_pkg => return HT.USS (specs.usergroup_pkg);
when sp_contacts =>
specs.contacts.Iterate (scan_contact'Access);
return HT.USS (joined);
when sp_keywords =>
specs.keywords.Iterate (concat'Access);
return HT.USS (joined);
when sp_licenses =>
specs.licenses.Iterate (dump_license'Access);
return HT.USS (joined);
when sp_users =>
specs.users.Iterate (concat'Access);
return HT.USS (joined);
when sp_groups =>
specs.groups.Iterate (concat'Access);
return HT.USS (joined);
when sp_variants =>
specs.variants.Iterate (concat'Access);
return HT.USS (joined);
when others =>
raise wrong_type with field'Img;
end case;
end get_field_value;
--------------------------------------------------------------------------------------------
-- get_web_contacts
--------------------------------------------------------------------------------------------
function get_web_contacts (specs : Portspecs; subject : String) return String
is
procedure scan_contact (position : string_crate.Cursor);
joined : HT.Text;
procedure scan_contact (position : string_crate.Cursor)
is
contact : String := HT.USS (string_crate.Element (position));
email : String := HT.part_1 (HT.part_2 (contact, "["), "]");
guy : String := HT.replace_all (S => HT.part_1 (contact, "["),
reject => LAT.Low_Line,
shiny => LAT.Space);
begin
if not HT.IsBlank (joined) then
HT.SU.Append (joined, ", ");
end if;
if contact = contact_nobody then
HT.SU.Append (joined, contact);
else
HT.SU.Append (joined, "<a class=" & LAT.Quotation & "contact" & LAT.Quotation &
" href=" & LAT.Quotation & "mailto:" & email & "?subject=" &
subject & LAT.Quotation & ">" & guy & "</a>");
end if;
end scan_contact;
begin
specs.contacts.Iterate (scan_contact'Access);
return HT.USS (joined);
end get_web_contacts;
--------------------------------------------------------------------------------------------
-- get_tagline
--------------------------------------------------------------------------------------------
function get_tagline (specs : Portspecs; variant : String) return String
is
key : HT.Text := HT.SUS (variant);
begin
if specs.taglines.Contains (key) then
return HT.USS (specs.taglines.Element (key));
else
return "";
end if;
end get_tagline;
--------------------------------------------------------------------------------------------
-- valid_dependency_format
--------------------------------------------------------------------------------------------
function valid_dependency_format (value : String) return Boolean is
begin
if HT.count_char (value, LAT.Colon) /= 2 then
return False;
end if;
declare
P1 : String := HT.part_1 (value, ":");
P2 : String := HT.part_2 (value, ":");
begin
if P1'Length = 0 then
return False;
end if;
declare
dos : String := HT.part_1 (P2, ":");
tres : String := HT.part_2 (P2, ":");
begin
if dos'Length = 0 or else tres'Length = 0 then
return False;
end if;
end;
end;
return True;
end valid_dependency_format;
--------------------------------------------------------------------------------------------
-- calculate_pkgversion
--------------------------------------------------------------------------------------------
function calculate_pkgversion (specs : Portspecs) return String
is
function suf1 return String;
function suf2 return String;
VERA : String := HT.USS (specs.version);
VERB : String := HT.replace_all (VERA, LAT.Hyphen, LAT.Full_Stop);
VERC : String := HT.replace_all (VERB, LAT.Comma, LAT.Full_Stop);
VERD : String := HT.replace_all (VERC, LAT.Low_Line, LAT.Full_Stop);
function suf1 return String is
begin
if specs.revision = 0 then
return "";
else
return "_" & HT.int2str (specs.revision);
end if;
end suf1;
function suf2 return String is
begin
if specs.epoch = 0 then
return "";
else
return "," & HT.int2str (specs.epoch);
end if;
end suf2;
begin
return VERD & suf1 & suf2;
end calculate_pkgversion;
--------------------------------------------------------------------------------------------
-- get_number_of_variants
--------------------------------------------------------------------------------------------
function get_number_of_variants (specs : Portspecs) return Natural is
begin
return Natural (specs.variants.Length);
end get_number_of_variants;
--------------------------------------------------------------------------------------------
-- get_list_length
--------------------------------------------------------------------------------------------
function get_list_length (specs : Portspecs; field : spec_field) return Natural is
begin
case field is
when sp_build_deps => return Natural (specs.build_deps.Length);
when sp_buildrun_deps => return Natural (specs.buildrun_deps.Length);
when sp_run_deps => return Natural (specs.run_deps.Length);
when sp_opts_standard => return Natural (specs.ops_standard.Length);
when sp_opts_avail => return Natural (specs.ops_avail.Length);
when sp_notes => return Natural (specs.pkg_notes.Length);
when sp_extra_patches => return Natural (specs.extra_patches.Length);
when sp_distfiles => return Natural (specs.distfiles.Length);
when others =>
raise wrong_type with field'Img;
end case;
end get_list_length;
--------------------------------------------------------------------------------------------
-- get_list_item
--------------------------------------------------------------------------------------------
function get_list_item (specs : Portspecs; field : spec_field; item : Natural) return String
is
procedure scan (position : string_crate.Cursor);
procedure scan_note (position : def_crate.Cursor);
procedure scan_distfile (position : string_crate.Cursor);
counter : Natural := 0;
result : HT.Text;
procedure scan (position : string_crate.Cursor) is
begin
if HT.IsBlank (result) then
counter := counter + 1;
if counter = item then
result := string_crate.Element (position);
end if;
end if;
end scan;
procedure scan_note (position : def_crate.Cursor) is
begin
if HT.IsBlank (result) then
counter := counter + 1;
if counter = item then
result := HT.SUS (HT.USS (def_crate.Key (position)) & LAT.Equals_Sign &
HT.USS (def_crate.Element (position)));
end if;
end if;
end scan_note;
procedure scan_distfile (position : string_crate.Cursor) is
begin
if HT.IsBlank (result) then
counter := counter + 1;
if counter = item then
result := HT.SUS (translate_distfile
(specs, HT.USS (string_crate.Element (position))));
end if;
end if;
end scan_distfile;
begin
case field is
when sp_build_deps => specs.build_deps.Iterate (scan'Access);
when sp_buildrun_deps => specs.buildrun_deps.Iterate (scan'Access);
when sp_run_deps => specs.run_deps.Iterate (scan'Access);
when sp_opts_standard => specs.ops_standard.Iterate (scan'Access);
when sp_opts_avail => specs.ops_avail.Iterate (scan'Access);
when sp_variants => specs.variants.Iterate (scan'Access);
when sp_notes => specs.pkg_notes.Iterate (scan_note'Access);
when sp_extra_patches => specs.extra_patches.Iterate (scan'Access);
when sp_distfiles => specs.distfiles.Iterate (scan_distfile'Access);
when others =>
raise wrong_type with field'Img;
end case;
return HT.USS (result);
end get_list_item;
--------------------------------------------------------------------------------------------
-- translate_distfile
--------------------------------------------------------------------------------------------
function translate_distfile (specs : Portspecs; distfile : String) return String
is
tarball : String := HT.part_1 (distfile, ":");
begin
if tarball = "generated" then
declare
group : String := HT.part_2 (distfile, ":");
dlsite : String :=
HT.USS (specs.dl_sites.Element (HT.SUS (group)).list.First_Element);
begin
if HT.leads (dlsite, "GITHUB/") or else
HT.leads (dlsite, "GH/")
then
return generate_github_distfile (dlsite);
else
-- future generations
return "implement me: " & distfile;
end if;
end;
else
return tarball;
end if;
end translate_distfile;
--------------------------------------------------------------------------------------------
-- repology_distfile
--------------------------------------------------------------------------------------------
function repology_distfile (specs : Portspecs; distfile : String) return String
is
tarball : constant String := translate_distfile (specs, distfile);
group : constant String := HT.part_2 (distfile, ":");
dlsite : String := HT.USS (specs.dl_sites.Element (HT.SUS (group)).list.First_Element);
begin
if HT.contains (dlsite, "://") then
return dlsite & tarball;
else
return "mirror://" & dlsite & "/" & tarball;
end if;
end repology_distfile;
--------------------------------------------------------------------------------------------
-- get_repology_distfile
--------------------------------------------------------------------------------------------
function get_repology_distfile (specs : Portspecs; item : Natural) return String
is
procedure scan_distfile (position : string_crate.Cursor);
counter : Natural := 0;
result : HT.Text;
procedure scan_distfile (position : string_crate.Cursor) is
begin
if HT.IsBlank (result) then
counter := counter + 1;
if counter = item then
result := HT.SUS (repology_distfile
(specs, HT.USS (string_crate.Element (position))));
end if;
end if;
end scan_distfile;
begin
specs.distfiles.Iterate (scan_distfile'Access);
return HT.USS (result);
end get_repology_distfile;
--------------------------------------------------------------------------------------------
-- get_subpackage_length
--------------------------------------------------------------------------------------------
function get_subpackage_length (specs : Portspecs; variant : String) return Natural
is
variant_text : HT.Text := HT.SUS (variant);
begin
if specs.subpackages.Contains (variant_text) then
return Natural (specs.subpackages.Element (variant_text).list.Length);
else
return 0;
end if;
end get_subpackage_length;
--------------------------------------------------------------------------------------------
-- get_subpackage_item
--------------------------------------------------------------------------------------------
function get_subpackage_item
(specs : Portspecs;
variant : String;
item : Natural) return String
is
procedure scan (position : string_crate.Cursor);
variant_text : HT.Text := HT.SUS (variant);
counter : Natural := 0;
result : HT.Text;
procedure scan (position : string_crate.Cursor) is
begin
if HT.IsBlank (result) then
counter := counter + 1;
if counter = item then
result := string_crate.Element (position);
end if;
end if;
end scan;
begin
if specs.subpackages.Contains (variant_text) then
specs.subpackages.Element (variant_text).list.Iterate (scan'Access);
end if;
return HT.USS (result);
end get_subpackage_item;
--------------------------------------------------------------------------------------------
-- get_number_extra_run
--------------------------------------------------------------------------------------------
function get_number_extra_run (specs : Portspecs; subpackage : String) return Natural
is
spkg_text : HT.Text := HT.SUS (subpackage);
begin
if specs.extra_rundeps.Contains (spkg_text) then
return Natural (specs.extra_rundeps.Element (spkg_text).list.Length);
else
return 0;
end if;
end get_number_extra_run;
--------------------------------------------------------------------------------------------
-- get_extra_runtime
--------------------------------------------------------------------------------------------
function get_extra_runtime
(specs : Portspecs;
subpackage : String;
item : Natural) return String
is
procedure scan (position : string_crate.Cursor);
spkg_text : HT.Text := HT.SUS (subpackage);
counter : Natural := 0;
result : HT.Text;
procedure scan (position : string_crate.Cursor) is
begin
if HT.IsBlank (result) then
counter := counter + 1;
if counter = item then
result := string_crate.Element (position);
end if;
end if;
end scan;
begin
if specs.extra_rundeps.Contains (spkg_text) then
specs.extra_rundeps.Element (spkg_text).list.Iterate (scan'Access);
end if;
return HT.USS (result);
end get_extra_runtime;
--------------------------------------------------------------------------------------------
-- aggregated_ignore_reason
--------------------------------------------------------------------------------------------
function aggregated_ignore_reason (specs : Portspecs) return String
is
procedure precheck (position : list_crate.Cursor);
procedure scribe (position : list_crate.Cursor);
result : HT.Text;
num_reasons : Natural := 0;
curnum : Natural := 1;
procedure precheck (position : list_crate.Cursor)
is
procedure precheck_list (position : string_crate.Cursor);
broken_Key : String := HT.USS (list_crate.Element (position).group);
procedure precheck_list (position : string_crate.Cursor) is
begin
if broken_Key = broken_all then
num_reasons := num_reasons + 1;
end if;
end precheck_list;
begin
list_crate.Element (position).list.Iterate (Process => precheck_list'Access);
end precheck;
procedure scribe (position : list_crate.Cursor)
is
procedure check_list (position : string_crate.Cursor);
broken_Key : String := HT.USS (list_crate.Element (position).group);
procedure check_list (position : string_crate.Cursor)
is
reason : String := HT.USS (string_crate.Element (position));
used : Boolean := False;
begin
if broken_Key = broken_all then
if num_reasons > 1 then
HT.SU.Append (result, "[Reason " & HT.int2str (curnum) & "] ");
end if;
HT.SU.Append (result, reason);
curnum := curnum + 1;
end if;
end check_list;
begin
list_crate.Element (position).list.Iterate (Process => check_list'Access);
end scribe;
begin
specs.broken.Iterate (Process => precheck'Access);
if num_reasons > 0 then
specs.broken.Iterate (Process => scribe'Access);
end if;
return HT.USS (result);
end aggregated_ignore_reason;
--------------------------------------------------------------------------------------------
-- keyword_is_valid
--------------------------------------------------------------------------------------------
function invalid_namebase (value : String; allow_comma : Boolean) return Boolean is
begin
for x in value'Range loop
case value (x) is
when '0' .. '9' => null;
when 'A' .. 'Z' => null;
when 'a' .. 'z' => null;
when '_' | '-' | '.' => null;
when ',' =>
if not allow_comma then
return True;
end if;
when others => return True;
end case;
end loop;
return False;
end invalid_namebase;
--------------------------------------------------------------------------------------------
-- valid_uses_module
--------------------------------------------------------------------------------------------
function options_summary (specs : Portspecs; variant : String) return String
is
procedure scan (position : option_crate.Cursor);
procedure format (position : string_crate.Cursor);
function obtain_description (optname : String; optname_text : HT.Text) return String;
tempstore : string_crate.Vector;
block : HT.Text;
procedure scan (position : option_crate.Cursor)
is
rec : Option_Helper renames option_crate.Element (position);
begin
tempstore.Append (rec.option_name);
end scan;
function obtain_description (optname : String; optname_text : HT.Text) return String
is
given_desc : constant String :=
HT.USS (specs.ops_helpers.Element (optname_text).option_description);
desc_opt : described_option_set;
begin
if HT.IsBlank (given_desc) then
-- It should never happen that desc_opt = OPT_NOT_DEFINED
desc_opt := described_option (optname);
if desc_opt /= OPT_NOT_DEFINED then
return default_description (desc_opt);
end if;
end if;
return given_desc;
end obtain_description;
procedure format (position : string_crate.Cursor)
is
optname_text : HT.Text renames string_crate.Element (position);
optname : String := HT.USS (optname_text);
curval : Boolean := specs.ops_helpers.Element (optname_text).currently_set_ON;
desc : String := obtain_description (optname, optname_text);
-- The option name is limited to 14 characters. Format:
-- 123456789-12345678-1234
-- OPTION_NAMEXXX OFF Description ...
-- OPTION_2 ON Description ...
part1 : String (1 .. 16) := (others => ' ');
part2 : String (1 .. 5);
begin
if variant = variant_standard then
if not specs.ops_standard.Contains (optname_text) then
-- Don't display non-standard options for standard variant
return;
end if;
end if;
part1 (1 .. optname'Length) := optname;
if curval then
part2 := "ON ";
else
part2 := "OFF ";
end if;
HT.SU.Append (block, part1 & part2 & desc & LAT.LF);
end format;
begin
if specs.ops_avail.Contains (HT.SUS (options_none)) then
return "This port has no build options.";
end if;
specs.ops_helpers.Iterate (scan'Access);
sorter.Sort (Container => tempstore);
tempstore.Iterate (format'Access);
return HT.USS (block);
end options_summary;
--------------------------------------------------------------------------------------------
-- missing_subpackage_definition
--------------------------------------------------------------------------------------------
function missing_subpackage_definition (specs : Portspecs) return Boolean
is
procedure check (position : list_crate.Cursor);
triggered : Boolean := False;
procedure check (position : list_crate.Cursor)
is
rec : group_list renames list_crate.Element (position);
begin
if rec.list.Is_Empty then
triggered := True;
end if;
end check;
begin
specs.subpackages.Iterate (check'Access);
return triggered;
end missing_subpackage_definition;
--------------------------------------------------------------------------------------------
-- combined_dependency_origins
--------------------------------------------------------------------------------------------
function combined_dependency_origins
(specs : Portspecs;
include_run : Boolean;
limit_to_run : Boolean) return String
is
procedure scan (position : string_crate.Cursor);
procedure print (position : string_crate.Cursor);
procedure scan_package (position : list_crate.Cursor);
combined : string_crate.Vector;
result : HT.Text;
procedure scan (position : string_crate.Cursor)
is
-- One exception:
-- When a port has a dependency on itself (possible with EXRUN[]), skip
text_value : HT.Text renames string_crate.Element (position);
dep_namebase : constant String := HT.specific_field (HT.USS (text_value), 1, ":");
begin
if not HT.equivalent (specs.namebase, dep_namebase) then
if not combined.Contains (text_value) then
combined.Append (text_value);
end if;
end if;
end scan;
procedure print (position : string_crate.Cursor)
is
text_value : HT.Text renames string_crate.Element (position);
begin
HT.SU.Append (result, HT.USS (text_value) & LAT.LF);
end print;
procedure scan_package (position : list_crate.Cursor)
is
rec : group_list renames list_crate.Element (position);
begin
rec.list.Iterate (scan'Access);
end scan_package;
begin
if not limit_to_run then
specs.build_deps.Iterate (scan'Access);
end if;
specs.buildrun_deps.Iterate (scan'Access);
if limit_to_run or else include_run then
specs.run_deps.Iterate (scan'Access);
specs.extra_rundeps.Iterate (scan_package'Access);
end if;
combined.Iterate (print'Access);
return HT.USS (result);
end combined_dependency_origins;
--------------------------------------------------------------------------------------------
-- valid_uses_module
--------------------------------------------------------------------------------------------
function valid_uses_module (value : String) return Boolean
is
total_modules : constant Positive := 51;
subtype uses_string is String (1 .. 15);
-- Keep in alphabetical order for future conversion to binary search
all_keywords : constant array (1 .. total_modules) of uses_string :=
(
"ada ",
"autoreconf ",
"bdb ",
"bison ",
"c++ ",
"cclibs ",
"charsetfix ",
"cmake ",
"compiler ",
"cpe ",
"destdirfix ",
"display ",
"dos2unix ",
"execinfo ",
"fbsd10fix ",
"firebird ",
"fonts ",
"fortran ",
"gettext-runtime",
"gettext-tools ",
"gmake ",
"gnome-icons ",
"gprbuild ",
"iconv ",
"intltoolfix ",
"jpeg ",
"libtool ",
"lua ",
"makeinfo ",
"mesa ",
"meson ",
"mysql ",
"ncurses ",
"ninja ",
"pgsql ",
"perl ",
"perl-interp ",
"php ",
"pkgconfig ",
"png ",
"python ",
"readline ",
"ruby ",
"shebangfix ",
"schemas ",
"scons ",
"sqlite ",
"ssl ",
"tcl ",
"terminfo ",
"zlib "
);
bandolier : uses_string := (others => ' ');
begin
declare
module : String := HT.part_1 (value, ":");
begin
if module'Length > uses_string'Length then
return False;
end if;
bandolier (1 .. module'Length) := module;
end;
for index in all_keywords'Range loop
if all_keywords (index) = bandolier then
return True;
end if;
end loop;
return False;
end valid_uses_module;
--------------------------------------------------------------------------------------------
-- valid_info_page
--------------------------------------------------------------------------------------------
function valid_info_page (specs : in out Portspecs; value : String) return Boolean
is
procedure grow (Key : HT.Text; Element : in out group_list);
-- duplicity has already been checked when we get to this routine
-- INFO_SUBDIR is defined in catchall as a result.
num_sep : Natural := HT.count_char (value, LAT.Solidus);
INFO_SUBDIR : constant String := "INFO_SUBDIR";
first_one : Boolean := not specs.catch_all.Contains (HT.SUS (INFO_SUBDIR));
NO_SUBDIR : constant String := ".";
saved_value : HT.Text;
procedure grow (Key : HT.Text; Element : in out group_list) is
begin
Element.list.Append (saved_value);
end grow;
begin
if first_one then
specs.establish_group (sp_catchall, INFO_SUBDIR);
if num_sep = 0 then
saved_value := HT.SUS (NO_SUBDIR);
else
saved_value := HT.SUS (HT.head (value, "/"));
end if;
specs.catch_all.Update_Element (Position => specs.catch_all.Find (HT.SUS (INFO_SUBDIR)),
Process => grow'Access);
return True;
else
saved_value := specs.catch_all.Element (HT.SUS (INFO_SUBDIR)).list.First_Element;
if num_sep = 0 then
return HT.equivalent (saved_value, NO_SUBDIR);
else
return HT.equivalent (saved_value, HT.head (value, "/"));
end if;
end if;
end valid_info_page;
--------------------------------------------------------------------------------------------
-- valid_broken_mysql_value
--------------------------------------------------------------------------------------------
function valid_broken_mysql_value (value : String) return Boolean is
begin
return
(
HT.leads (value, "oracle-") and then
(value = "oracle-5.5" or else
value = "oracle-5.6" or else
value = "oracle-5.7")
)
or else
(
HT.leads (value, "percona-") and then
(value = "percona-5.5" or else
value = "percona-5.6" or else
value = "percona-5.7")
)
or else
(
HT.leads (value, "galera-") and then
(value = "galera-5.5" or else
value = "galera-5.6" or else
value = "galera-5.7")
)
or else
(HT.leads (value, "mariadb-") and then
(value = "mariadb-10.1" or else
value = "mariadb-10.2")
);
end valid_broken_mysql_value;
--------------------------------------------------------------------------------------------
-- valid_broken_pgsql_value
--------------------------------------------------------------------------------------------
function valid_broken_pgsql_value (value : String) return Boolean is
begin
return value = "9.6" or else
value = "9.5" or else
value = "9.4" or else
value = "9.3" or else
value = "9.2";
end valid_broken_pgsql_value;
--------------------------------------------------------------------------------------------
-- rpath_check_errors_are_fatal
--------------------------------------------------------------------------------------------
function rpath_check_errors_are_fatal (specs : Portspecs) return Boolean is
begin
return specs.fatal_rpath;
end rpath_check_errors_are_fatal;
--------------------------------------------------------------------------------------------
-- debugging_is_on
--------------------------------------------------------------------------------------------
function debugging_is_on (specs : Portspecs) return Boolean is
begin
return specs.debugging_on;
end debugging_is_on;
--------------------------------------------------------------------------------------------
-- determine_gnome_component
--------------------------------------------------------------------------------------------
function determine_gnome_component (component : String) return gnome_type
is
total_keywords : constant Positive := gnome_type'Pos (gnome_type'Last) + 1;
subtype keyword_string is String (1 .. 18);
type keyword_pair is
record
keyword : keyword_string;
keytype : gnome_type;
end record;
-- It is critical that this list be alphabetized correctly.
all_keywords : constant array (1 .. total_keywords) of keyword_pair :=
(
("INVALID ", invalid_component),
("atk ", atk),
("cairo ", cairo),
("gdkpixbuf ", gdkpixbuf),
("glib ", glib),
("gtk2 ", gtk2),
("gtk3 ", gtk3),
("intltool ", intltool),
("introspection ", introspection),
("libcroco ", libcroco),
("libgsf ", libgsf),
("librsvg ", librsvg),
("libxml2 ", libxml2),
("libxslt ", libxslt),
("pango ", pango),
("pygobject ", pygobject)
);
-- atkmm
-- atspi
-- cairomm
-- dconf
-- esound
-- evolutionserver
-- gconf2
-- gconfmm26
-- gdkpixbuf2
-- glibmm
-- gnomecontrolcenter
-- gnomedesktop
-- gnomedocutils
-- gnomemenus
-- gnomemimedata
-- gnomeprefix
-- gnomesharp20
-- gnomespeech
-- gnomevfs2
-- gsound
-- gtkiconcache
-- gtkhtml3
-- gtkhtml4
-- gtkmm20
-- gtkmm24
-- gtkmm30
-- gtksharp20
-- gtksourceview
-- gtksourceviewmm
-- gvfs
-- libartlgpl2
-- libbonobo
-- libbonoboui
-- libgda-ui
-- libgdamm
-- libglade2
-- libgnome
-- libgnomecanvas
-- libgnomekbd
-- libgnomeprint
-- libgnomeprintui
-- libgnomeui
-- libgtkhtml
-- libgtksourceviewmm
-- libidl
-- libsigc++12
-- libsigc++20
-- libwnck
-- libxml++26
-- metacity
-- nautilus3
-- orbit2
-- pangomm
-- pangox-compat
-- pygnome2
-- pygtk2
-- pygtksourceview
-- referencehack
-- vte
bandolier : keyword_string := (others => LAT.Space);
Low : Natural := all_keywords'First;
High : Natural := all_keywords'Last;
Mid : Natural;
begin
if component'Length > keyword_string'Length or else
component'Length < 3
then
return invalid_component;
end if;
bandolier (1 .. component'Length) := component;
loop
Mid := (Low + High) / 2;
if bandolier = all_keywords (Mid).keyword then
return all_keywords (Mid).keytype;
elsif bandolier < all_keywords (Mid).keyword then
exit when Low = Mid;
High := Mid - 1;
else
exit when High = Mid;
Low := Mid + 1;
end if;
end loop;
return invalid_component;
end determine_gnome_component;
--------------------------------------------------------------------------------------------
-- determine_xorg_component
--------------------------------------------------------------------------------------------
function determine_xorg_component (component : String) return xorg_type
is
total_keywords : constant Positive := xorg_type'Pos (xorg_type'Last) + 1;
subtype keyword_string is String (1 .. 18);
type keyword_pair is
record
keyword : keyword_string;
keytype : xorg_type;
end record;
-- It is critical that this list be alphabetized correctly.
all_keywords : constant array (1 .. total_keywords) of keyword_pair :=
(
("INVALID ", invalid_component),
("bigreqsproto ", bigreqsproto),
("compositeproto ", compositeproto),
("damageproto ", damageproto),
("dmx ", dmx),
("dmxproto ", dmxproto),
("dri2proto ", dri2proto),
("dri3proto ", dri3proto),
("evieproto ", evieproto),
("fixesproto ", fixesproto),
("fontcacheproto ", fontcacheproto),
("fontenc ", fontenc),
("fontsproto ", fontsproto),
("fontutil ", fontutil),
("glproto ", glproto),
("ice ", ice),
("inputproto ", inputproto),
("kbproto ", kbproto),
("pciaccess ", pciaccess),
("pixman ", pixman),
("presentproto ", presentproto),
("printproto ", printproto),
("randrproto ", randrproto),
("recordproto ", recordproto),
("renderproto ", renderproto),
("resourceproto ", resourceproto),
("scrnsaverproto ", scrnsaverproto),
("sm ", sm),
("trapproto ", trapproto),
("videoproto ", videoproto),
("x11 ", x11),
("xau ", xau),
("xaw ", xaw),
("xcb ", xcb),
("xcb-render-util ", xcb_render_util),
("xcb-util ", xcb_util),
("xcb-util-image ", xcb_util_image),
("xcb-util-keysyms ", xcb_util_keysyms),
("xcb-util-wm ", xcb_util_wm),
("xcmiscproto ", xcmiscproto),
("xcomposite ", xcomposite),
("xcursor ", xcursor),
("xdamage ", xdamage),
("xdmcp ", xdmcp),
("xext ", xext),
("xextproto ", xextproto),
("xf86bigfontproto ", xf86bigfontproto),
("xf86dgaproto ", xf86dgaproto),
("xf86driproto ", xf86driproto),
("xf86miscproto ", xf86miscproto),
("xf86rushproto ", xf86rushproto),
("xf86vidmodeproto ", xf86vidmodeproto),
("xfixes ", xfixes),
("xfont ", xfont),
("xfont2 ", xfont2),
("xft ", xft),
("xi ", xi),
("xinerama ", xinerama),
("xineramaproto ", xineramaproto),
("xkbfile ", xkbfile),
("xmu ", xmu),
("xp ", xp),
("xpm ", xpm),
("xproto ", xproto),
("xproxymngproto ", xproxymngproto),
("xrandr ", xrandr),
("xrender ", xrender),
("xres ", xres),
("xscrnsaver ", xscrnsaver),
("xshmfence ", xshmfence),
("xt ", xt),
("xtransproto ", xtransproto),
("xtst ", xtst),
("xv ", xv),
("xvmc ", xvmc),
("xxf86vm ", xxf86vm)
);
bandolier : keyword_string := (others => LAT.Space);
Low : Natural := all_keywords'First;
High : Natural := all_keywords'Last;
Mid : Natural;
begin
if component'Length > keyword_string'Length or else
component'Length < 2
then
return invalid_component;
end if;
bandolier (1 .. component'Length) := component;
loop
Mid := (Low + High) / 2;
if bandolier = all_keywords (Mid).keyword then
return all_keywords (Mid).keytype;
elsif bandolier < all_keywords (Mid).keyword then
exit when Low = Mid;
High := Mid - 1;
else
exit when High = Mid;
Low := Mid + 1;
end if;
end loop;
return invalid_component;
end determine_xorg_component;
--------------------------------------------------------------------------------------------
-- determine_sdl_component
--------------------------------------------------------------------------------------------
function determine_sdl_component (component : String) return sdl_type
is
total_keywords : constant Positive := sdl_type'Pos (sdl_type'Last) + 1;
subtype keyword_string is String (1 .. 8);
type keyword_pair is
record
keyword : keyword_string;
keytype : sdl_type;
end record;
-- It is critical that this list be alphabetized correctly.
all_keywords : constant array (1 .. total_keywords) of keyword_pair :=
(
("INVALID ", invalid_component),
("gfx1 ", gfx1),
("gfx2 ", gfx2),
("image1 ", image1),
("image2 ", image2),
("mixer1 ", mixer1),
("mixer2 ", mixer2),
("net1 ", net1),
("net2 ", net2),
("sdl1 ", sdl1),
("sdl2 ", sdl2),
("ttf1 ", ttf1),
("ttf2 ", ttf2)
);
bandolier : keyword_string := (others => LAT.Space);
Low : Natural := all_keywords'First;
High : Natural := all_keywords'Last;
Mid : Natural;
begin
if component'Length > keyword_string'Length or else
component'Length < 2
then
return invalid_component;
end if;
bandolier (1 .. component'Length) := component;
loop
Mid := (Low + High) / 2;
if bandolier = all_keywords (Mid).keyword then
return all_keywords (Mid).keytype;
elsif bandolier < all_keywords (Mid).keyword then
exit when Low = Mid;
High := Mid - 1;
else
exit when High = Mid;
Low := Mid + 1;
end if;
end loop;
return invalid_component;
end determine_sdl_component;
--------------------------------------------------------------------------------------------
-- determine_php_extension
--------------------------------------------------------------------------------------------
function determine_php_extension (component : String) return phpext_type
is
total_keywords : constant Positive := phpext_type'Pos (phpext_type'Last) + 1;
subtype keyword_string is String (1 .. 12);
type keyword_pair is
record
keyword : keyword_string;
keytype : phpext_type;
end record;
-- It is critical that this list be alphabetized correctly.
all_keywords : constant array (1 .. total_keywords) of keyword_pair :=
(
("INVALID ", invalid_extension),
("bcmath ", bcmath),
("bitset ", bitset),
("bz2 ", bz2),
("calendar ", calendar),
("ctype ", ctype),
("curl ", curl),
("dba ", dba),
("dom ", dom),
("enchant ", enchant),
("exif ", exif),
("fileinfo ", fileinfo),
("filter ", filter),
("ftp ", ftp),
("gd ", gd),
("gettext ", gettext),
("gmp ", gmp),
("hash ", hash),
("iconv ", iconv),
("igbinary ", igbinary),
("imap ", imap),
("interbase ", interbase),
("intl ", intl),
("json ", jsonext),
("ldap ", ldap),
("mbstring ", mbstring),
("mcrypt ", mcrypt),
("memcache ", memcache),
("memcached ", memcached),
("mysqli ", mysqli),
("odbc ", odbc),
("opcache ", opcache),
("openssl ", openssl),
("pcntl ", pcntl),
("pdf ", pdf),
("pdo ", pdo),
("pdo_dblib ", pdo_dblib),
("pdo_firebird", pdo_firebird),
("pdo_mysql ", pdo_mysql),
("pdo_odbc ", pdo_odbc),
("pdo_pgsql ", pdo_pgsql),
("pdo_sqlite ", pdo_sqlite),
("pgsql ", pgsql),
("phar ", phar),
("posix ", posix),
("pspell ", pspell),
("radius ", radius),
("readline ", readline),
("recode ", recode),
("redis ", redis),
("session ", session),
("shmop ", shmop),
("simplexml ", simplexml),
("snmp ", snmp),
("soap ", soap),
("sockets ", sockets),
("sqlite3 ", sqlite3),
("sysvmsg ", sysvmsg),
("sysvsem ", sysvsem),
("sysvshm ", sysvshm),
("tidy ", tidy),
("tokenizer ", tokenizer),
("wddx ", wddx),
("xml ", xml),
("xmlreader ", xmlreader),
("xmlrpc ", xmlrpc),
("xmlwriter ", xmlwriter),
("xsl ", xsl),
("zip ", zip),
("zlib ", zlib)
);
bandolier : keyword_string := (others => LAT.Space);
Low : Natural := all_keywords'First;
High : Natural := all_keywords'Last;
Mid : Natural;
begin
if component'Length > keyword_string'Length or else
component'Length < 2
then
return invalid_extension;
end if;
bandolier (1 .. component'Length) := component;
loop
Mid := (Low + High) / 2;
if bandolier = all_keywords (Mid).keyword then
return all_keywords (Mid).keytype;
elsif bandolier < all_keywords (Mid).keyword then
exit when Low = Mid;
High := Mid - 1;
else
exit when High = Mid;
Low := Mid + 1;
end if;
end loop;
return invalid_extension;
end determine_php_extension;
--------------------------------------------------------------------------------------------
-- keyword_is_valid
--------------------------------------------------------------------------------------------
function keyword_is_valid (keyword : String) return Boolean
is
total_keywords : constant Positive := 69;
subtype keyword_string is String (1 .. 13);
-- It is critical that this list be alphabetized correctly.
all_keywords : constant array (1 .. total_keywords) of keyword_string :=
(
"accessibility",
"ada ",
"arabic ",
"archivers ",
"astro ",
"audio ",
"benchmarks ",
"biology ",
"c++ ",
"cad ",
"chinese ",
"comms ",
"converters ",
"csharp ",
"databases ",
"deskutils ",
"devel ",
"dns ",
"editors ",
"emulators ",
"finance ",
"french ",
"ftp ",
"games ",
"german ",
"graphics ",
"irc ",
"italian ",
"japanese ",
"java ",
"javascript ",
"korean ",
"lang ",
"lisp ",
"mail ",
"math ",
"misc ",
"multimedia ",
"net ",
"net_im ",
"net_mgmt ",
"net_p2p ",
"news ",
"perl ",
"php ",
"print ",
"python ",
"raven ",
"ruby ",
"russian ",
"scheme ",
"science ",
"security ",
"shells ",
"spanish ",
"sysutils ",
"textproc ",
"vietnamese ",
"wayland ",
"www ",
"x11 ",
"x11_clocks ",
"x11_drivers ",
"x11_fm ",
"x11_fonts ",
"x11_servers ",
"x11_themes ",
"x11_toolkits ",
"x11_wm "
);
testword_len : constant Natural := keyword'Length;
bandolier : keyword_string := (others => LAT.Space);
Low : Natural := all_keywords'First;
High : Natural := all_keywords'Last;
Mid : Natural;
begin
if testword_len < 3 or else testword_len > keyword_string'Length then
return False;
end if;
bandolier (1 .. testword_len) := keyword;
loop
Mid := (Low + High) / 2;
if bandolier = all_keywords (Mid) then
return True;
elsif bandolier < all_keywords (Mid) then
exit when Low = Mid;
High := Mid - 1;
else
exit when High = Mid;
Low := Mid + 1;
end if;
end loop;
return False;
end keyword_is_valid;
--------------------------------------------------------------------------------------------
-- determine_license
--------------------------------------------------------------------------------------------
function determine_license (value : String) return license_type
is
total_keywords : constant Positive := license_type'Pos (license_type'Last) + 1;
subtype keyword_string is String (1 .. 10);
type keyword_pair is
record
keyword : keyword_string;
keytype : license_type;
end record;
-- It is critical that this list be alphabetized correctly.
all_keywords : constant array (1 .. total_keywords) of keyword_pair :=
(
("AGPLv3 ", AGPLv3),
("AGPLv3+ ", AGPLv3x),
("APACHE10 ", APACHE10),
("APACHE11 ", APACHE11),
("APACHE20 ", APACHE20),
("ART10 ", ART10),
("ART20 ", ART20),
("ARTPERL10 ", ARTPERL10),
("BSD2CLAUSE", BSD2CLAUSE),
("BSD3CLAUSE", BSD3CLAUSE),
("BSD4CLAUSE", BSD4CLAUSE),
("BSDGROUP ", BSDGROUP),
("CUSTOM1 ", CUSTOM1),
("CUSTOM2 ", CUSTOM2),
("CUSTOM3 ", CUSTOM3),
("CUSTOM4 ", CUSTOM4),
("GMGPL ", GMGPL),
("GPLv1 ", GPLv1),
("GPLv1+ ", GPLv1x),
("GPLv2 ", GPLv2),
("GPLv2+ ", GPLv2x),
("GPLv3 ", GPLv3),
("GPLv3+ ", GPLv3x),
("GPLv3RLE ", GPLv3RLE),
("GPLv3RLE+ ", GPLv3RLEx),
("INVALID ", INVALID),
("ISCL ", ISCL),
("LGPL20 ", LGPL20),
("LGPL20+ ", LGPL20x),
("LGPL21 ", LGPL21),
("LGPL21+ ", LGPL21x),
("LGPL3 ", LGPL3),
("LGPL3+ ", LGPL3x),
("MIT ", MIT),
("MPL ", MPL),
("OpenSSL ", OPENSSL),
("PSFL ", PSFL),
("PUBDOM ", PUBDOM),
("PostgreSQL", POSTGRESQL), -- lowercase "o" after all capitals
("RUBY ", RUBY),
("ZLIB ", ZLIB)
);
bandolier : keyword_string := (others => LAT.Space);
Low : Natural := all_keywords'First;
High : Natural := all_keywords'Last;
Mid : Natural;
begin
if value'Length > keyword_string'Length or else
value'Length < 3
then
return INVALID;
end if;
bandolier (1 .. value'Length) := value;
loop
Mid := (Low + High) / 2;
if bandolier = all_keywords (Mid).keyword then
return all_keywords (Mid).keytype;
elsif bandolier < all_keywords (Mid).keyword then
exit when Low = Mid;
High := Mid - 1;
else
exit when High = Mid;
Low := Mid + 1;
end if;
end loop;
return INVALID;
end determine_license;
--------------------------------------------------------------------------------------------
-- described_option
--------------------------------------------------------------------------------------------
function described_option (value : String) return described_option_set
is
total_keywords : constant Positive :=
described_option_set'Pos (described_option_set'Last);
subtype keyword_string is String (1 .. 14);
type keyword_pair is
record
keyword : keyword_string;
keytype : described_option_set;
end record;
-- It is critical that this list be alphabetized correctly.
all_keywords : constant array (1 .. total_keywords) of keyword_pair :=
(
("AALIB ", AALIB),
("ALSA ", ALSA),
("ASM ", ASM),
("COLORD ", COLORD),
("CUPS ", CUPS),
("DBUS ", DBUS),
("DEBUG ", DEBUG),
("DOCS ", DOCS),
("FIREBIRD ", FIREBIRD),
("ICONV ", ICONV),
("IDN ", IDN),
("IPV4 ", IPV4),
("IPV6 ", IPV6),
("JAVA ", JAVA),
("LANG_CN ", LANG_CN),
("LANG_KO ", LANG_KO),
("LANG_RU ", LANG_RU),
("LDAP ", LDAP),
("LDAPS ", LDAPS),
("MYSQL ", MYSQL),
("NAS ", NAS),
("NLS ", NLS),
("OPENGL ", OPENGL),
("OSS ", OSS),
("PERL_524 ", PERL524),
("PERL_526 ", PERL526),
("PGSQL ", PGSQL),
("PNG ", PNG),
("PULSEAUDIO ", PULSEAUDIO),
("PY27 ", PY27),
("PY35 ", PY35),
("PY36 ", PY36),
("READLINE ", READLINE),
("SNDIO ", SNDIO),
("SOUND ", SOUND),
("SQLITE ", SQLITE),
("STATIC ", STATIC),
("SYSLOG ", SYSLOG),
("TCL ", TCL),
("TCLTK ", TCLTK),
("THREADS ", THREADS),
("X11 ", X11),
("ZLIB ", ZLIB)
);
bandolier : keyword_string := (others => LAT.Space);
Low : Natural := all_keywords'First;
High : Natural := all_keywords'Last;
Mid : Natural;
begin
if value'Length > keyword_string'Length or else
value'Length < 3
then
return OPT_NOT_DEFINED;
end if;
bandolier (1 .. value'Length) := value;
loop
Mid := (Low + High) / 2;
if bandolier = all_keywords (Mid).keyword then
return all_keywords (Mid).keytype;
elsif bandolier < all_keywords (Mid).keyword then
exit when Low = Mid;
High := Mid - 1;
else
exit when High = Mid;
Low := Mid + 1;
end if;
end loop;
return OPT_NOT_DEFINED;
end described_option;
--------------------------------------------------------------------------------------------
-- default_description
--------------------------------------------------------------------------------------------
function default_description (option : described_option_set) return String is
begin
case option is
when AALIB => return "AAlib graphics library support";
when ALSA => return "ALSA audio architecture support";
when ASM => return "Use optimized assembly code";
when COLORD => return "Color management via colord";
when CUPS => return "CUPS printing system support";
when DBUS => return "D-Bus IPC system support";
when DEBUG => return "Build with debugging support";
when DOCS => return "Build and install documentation";
when FIREBIRD => return "Firebird (Interbase) database support";
when ICONV => return "Encoding conversion support via iconv";
when IDN => return "International Domain Names support";
when IPV4 => return "IPv4 protocol support";
when IPV6 => return "IPv6 protocol support";
when JAVA => return "Java platform support";
when LANG_CN => return "Chinese language support";
when LANG_KO => return "Korean language support";
when LANG_RU => return "Russian language support";
when LDAP => return "LDAP protocol support";
when LDAPS => return "LDAP protocol over SSL support";
when MYSQL => return "MySQL database support";
when NAS => return "Network Audio System support";
when NLS => return "Native Language Support";
when OPENGL => return "2D/3D rendering support via OpenGL";
when OSS => return "Open Sound System support";
when PERL524 => return "Build using Perl 5.24";
when PERL526 => return "Build using Perl 5.26";
when PGSQL => return "PostgreSQL database support";
when PNG => return "PNG image format support";
when PULSEAUDIO => return "PulseAudio sound server support";
when PY27 => return "Build using Python 2.7";
when PY35 => return "Build using Python 3.5";
when PY36 => return "Build using Python 3.6";
when READLINE => return "Command line editing via libreadline";
when SNDIO => return "Sndio audio support";
when SOUND => return "Sound (audio) support";
when SQLITE => return "SQLite database support";
when STATIC => return "Build static executables and/or libraries";
when SYSLOG => return "Syslog logging support";
when TCL => return "Tcl scripting language support";
when TCLTK => return "Tcl/Tk GUI toolkit support";
when THREADS => return "Threading support";
when X11 => return "X11 (graphics) support";
when ZLIB => return "zlib compression support";
when OPT_NOT_DEFINED => return "dev error, OPT_NOT_DEFINED";
end case;
end default_description;
--------------------------------------------------------------------------------------------
-- post_parse_usergroup_check_passes
--------------------------------------------------------------------------------------------
function post_parse_usergroup_check_passes (specs : Portspecs) return Boolean
is
ugspkg_defined : constant Boolean := not HT.IsBlank (specs.usergroup_pkg);
begin
if specs.users.Is_Empty and then specs.groups.Is_Empty then
if ugspkg_defined then
TIO.Put_Line ("Warning: USERGROUP_SPKG is set, but GROUPS and USERS are not");
end if;
return True;
end if;
if not ugspkg_defined then
-- Fatal error provided by specification_parser
return False;
end if;
return True;
end post_parse_usergroup_check_passes;
--------------------------------------------------------------------------------------------
-- post_parse_license_check_passes
--------------------------------------------------------------------------------------------
function post_parse_license_check_passes (specs : Portspecs) return Boolean
is
procedure dump_name (position : string_crate.Cursor);
procedure check_for_custom_name (position : string_crate.Cursor);
still_good : Boolean := True;
found_custom : Boolean := False;
lic_count : Natural;
solo_scheme : constant Boolean := HT.equivalent (specs.lic_scheme, "solo");
tempstorage : string_crate.Vector;
report_card, card2 : array (1 .. 4) of Boolean := (others => False);
procedure dump_name (position : string_crate.Cursor)
is
lic_part : HT.Text := HT.SUS (HT.part_1 (HT.USS (string_crate.Element (position)), ":"));
lpstr : String := HT.USS (lic_part);
lic_type : license_type := determine_license (lpstr);
begin
if still_good then
if tempstorage.Contains (lic_part) then
TIO.Put_Line ("Duplicate LICENSE found on multiple subpackage: " & lpstr);
still_good := False;
else
tempstorage.Append (lic_part);
case lic_type is
when CUSTOM1 | CUSTOM2 | CUSTOM3 | CUSTOM4 =>
found_custom := True;
when others => null;
end case;
case lic_type is
when CUSTOM1 => report_card (1) := True;
when CUSTOM2 => report_card (2) := True;
when CUSTOM3 => report_card (3) := True;
when CUSTOM4 => report_card (4) := True;
when others => null;
end case;
end if;
end if;
end dump_name;
procedure check_for_custom_name (position : string_crate.Cursor)
is
lic_part : HT.Text := HT.SUS (HT.part_1 (HT.USS (string_crate.Element (position)), ":"));
lpstr : String := HT.USS (lic_part);
lic_type : license_type := determine_license (lpstr);
err_msg : String := "Duplicate entries for LICENSE_NAME, CUSTOM";
begin
-- due to previous check, we already know lic_type is CUSTOM1 .. CUSTOM4
-- We also know that all entries have matched against LICENSES
if still_good then
case lic_type is
when CUSTOM1 =>
if card2 (1) then
TIO.Put_Line (err_msg & "1");
still_good := False;
end if;
card2 (1) := True;
report_card (1) := False;
when CUSTOM2 =>
if card2 (2) then
TIO.Put_Line (err_msg & "2");
still_good := False;
end if;
card2 (2) := True;
report_card (2) := False;
when CUSTOM3 =>
if card2 (3) then
TIO.Put_Line (err_msg & "3");
still_good := False;
end if;
card2 (3) := True;
report_card (3) := False;
when CUSTOM4 =>
if card2 (4) then
TIO.Put_Line (err_msg & "4");
still_good := False;
end if;
card2 (4) := True;
report_card (4) := False;
when others => null;
end case;
end if;
end check_for_custom_name;
begin
if specs.licenses.Is_Empty then
-- no license case, but make sure everything else is blank too
if not specs.lic_names.Is_Empty or else
not specs.lic_files.Is_Empty
then
TIO.Put_Line ("LICENSE is empty but LICENSE_NAMES or LICENSE_FILES is not");
return False;
end if;
if HT.IsBlank (specs.lic_scheme) or else solo_scheme then
return True;
else
TIO.Put_Line ("LICENSE is empty but LICENSE_SCHEME = " & HT.USS (specs.lic_scheme));
return False;
end if;
end if;
-- Finish checking LICENSE_SCHEME
lic_count := Natural (specs.licenses.Length);
if HT.IsBlank (specs.lic_scheme) then
TIO.Put_Line ("LICENSE_SCHEME must also be defined when LICENSE is defined.");
return False;
else
if lic_count = 1 then
if not solo_scheme then
TIO.Put_Line ("LICENSE_SCHEME must be 'solo' when there is only one license.");
return False;
end if;
else
if solo_scheme then
TIO.Put_Line ("LICENSE_SCHEME cannot be 'solo' with multiple licenses.");
return False;
end if;
end if;
end if;
-- We don't need to check the values of LICENSE_FILE because we
-- already validated those when the data was input. What didn't didn't do was check that
-- all entries were present, so all we have to do is compare totals.
if Natural (specs.lic_files.Length) /= lic_count then
TIO.Put_Line ("There are less LICENSE_FILES than LICENSES");
return False;
end if;
-- LICENSE_NAME only has to be defined for CUSTOM1--4
specs.licenses.Iterate (dump_name'Access);
if found_custom then
specs.lic_names.Iterate (check_for_custom_name'Access);
if still_good then
if report_card (1) or else
report_card (2) or else
report_card (3) or else
report_card (4)
then
TIO.Put_Line ("There is at least one CUSTOMx LICENSE that doesn't have a " &
"defined LICENSE_NAME");
return False;
end if;
end if;
end if;
return still_good;
end post_parse_license_check_passes;
--------------------------------------------------------------------------------------------
-- post_parse_option_group_size_passes
--------------------------------------------------------------------------------------------
function post_parse_option_group_size_passes (specs : Portspecs) return Boolean
is
procedure group_scan (position : list_crate.Cursor);
all_good : Boolean := True;
procedure group_scan (position : list_crate.Cursor) is
begin
if Natural (list_crate.Element (position).list.Length) < 2 then
TIO.Put_Line ("The " & HT.USS (list_crate.Element (position).group) &
" group has less than 2 members");
all_good := False;
end if;
end group_scan;
begin
specs.optgroups.Iterate (group_scan'Access);
return all_good;
end post_parse_option_group_size_passes;
--------------------------------------------------------------------------------------------
-- post_transform_option_group_defaults_passes
--------------------------------------------------------------------------------------------
function post_transform_option_group_defaults_passes (specs : Portspecs) return Boolean
is
procedure radio_scan (pos_radio : string_crate.Cursor);
procedure restrict_scan (pos_radio : string_crate.Cursor);
procedure group_scan (position : string_crate.Cursor);
function display_opt_count (number : Natural) return String;
all_good : Boolean := True;
on_count : Natural;
function display_opt_count (number : Natural) return String is
begin
if number = 1 then
return "1 option";
else
return HT.int2str (number) & " options";
end if;
end display_opt_count;
procedure group_scan (position : string_crate.Cursor)
is
option : HT.Text renames string_crate.Element (position);
begin
if specs.ops_helpers.Contains (option) then
if specs.ops_helpers.Element (option).set_ON_by_default then
on_count := on_count + 1;
end if;
else
all_good := False;
TIO.Put_Line ("option" & HT.USS (option) & " is not defined. bug?");
return;
end if;
end group_scan;
procedure radio_scan (pos_radio : string_crate.Cursor)
is
group : HT.Text renames string_crate.Element (pos_radio);
begin
on_count := 0;
if specs.optgroups.Contains (group) then
specs.optgroups.Element (group).list.Iterate (group_scan'Access);
else
all_good := False;
TIO.Put_Line ("radio group " & HT.USS (group) & " does not exist. bug?");
return;
end if;
if on_count /= 1 then
all_good := False;
TIO.Put_Line ("radio group " & HT.USS (group) & " has " & display_opt_count (on_count)
& " set by default, but radio groups require exactly 1");
end if;
end radio_scan;
procedure restrict_scan (pos_radio : string_crate.Cursor)
is
group : HT.Text renames string_crate.Element (pos_radio);
begin
on_count := 0;
if specs.optgroups.Contains (group) then
specs.optgroups.Element (group).list.Iterate (group_scan'Access);
else
all_good := False;
TIO.Put_Line ("restricted group " & HT.USS (group) & " does not exist. bug?");
return;
end if;
if on_count < 1 then
all_good := False;
TIO.Put_Line ("restricted group " & HT.USS (group) & " has no options set by " &
"default, but at least one is required");
end if;
end restrict_scan;
begin
specs.opt_radio.Iterate (radio_scan'Access);
specs.opt_restrict.Iterate (restrict_scan'Access);
return all_good;
end post_transform_option_group_defaults_passes;
--------------------------------------------------------------------------------------------
-- subpackage_exists
--------------------------------------------------------------------------------------------
function subpackage_exists (specs : Portspecs; subpackage : String) return Boolean
is
procedure scan_variant (pos_variant : string_crate.Cursor);
procedure scan_subpackage (pos_subpkg : string_crate.Cursor);
found : Boolean := False;
procedure scan_variant (pos_variant : string_crate.Cursor) is
variant : HT.Text renames string_crate.Element (pos_variant);
begin
if not found then
if specs.subpackages.Contains (variant) then
specs.subpackages.Element (variant).list.Iterate (scan_subpackage'Access);
end if;
end if;
end scan_variant;
procedure scan_subpackage (pos_subpkg : string_crate.Cursor)
is
subpkg : HT.Text renames string_crate.Element (pos_subpkg);
begin
if not found then
if subpackage = HT.USS (subpkg) then
found := True;
end if;
end if;
end scan_subpackage;
begin
specs.variants.Iterate (scan_variant'Access);
return found;
end subpackage_exists;
--------------------------------------------------------------------------------------------
-- get_license_scheme
--------------------------------------------------------------------------------------------
function get_license_scheme (specs : Portspecs) return String
is
actual : String := HT.USS (specs.lic_scheme);
begin
if actual = "dual" or else actual = "multi" then
return actual;
end if;
return "single";
end get_license_scheme;
--------------------------------------------------------------------------------------------
-- global_options_present
--------------------------------------------------------------------------------------------
function global_options_present (specs : Portspecs) return Boolean is
begin
return not specs.ops_avail.Contains (HT.SUS (options_none));
end global_options_present;
--------------------------------------------------------------------------------------------
-- standard_options_present
--------------------------------------------------------------------------------------------
function standard_options_present (specs : Portspecs) return Boolean is
begin
return not specs.ops_standard.Contains (HT.SUS (options_none));
end standard_options_present;
--------------------------------------------------------------------------------------------
-- terminfo_failed
--------------------------------------------------------------------------------------------
function terminfo_failed (specs : Portspecs; module : String) return Boolean
is
procedure check_variant (position : string_crate.Cursor);
procedure check_subpackage (position : string_crate.Cursor);
-- Assume module starts with "terminfo" for sure.
-- If we match any known subpackage, we pass
candidate : HT.Text;
matched : Boolean := False;
procedure check_variant (position : string_crate.Cursor)
is
variant : HT.Text renames string_crate.Element (position);
begin
if not matched then
specs.subpackages.Element (variant).list.Iterate (check_subpackage'Access);
end if;
end check_variant;
procedure check_subpackage (position : string_crate.Cursor) is
spkg : HT.Text renames string_crate.Element (position);
begin
if not matched then
if HT.equivalent (spkg, candidate) then
matched := True;
end if;
end if;
end check_subpackage;
begin
if not HT.leads (module, "terminfo:") then
return True;
end if;
candidate := HT.SUS (HT.part_2 (module, ":"));
specs.variants.Iterate (check_variant'Access);
return not matched;
end terminfo_failed;
--------------------------------------------------------------------------------------------
-- generate_github_distfile
--------------------------------------------------------------------------------------------
function generate_github_distfile (download_site : String) return String
is
gh_args : constant String := HT.part_2 (download_site, "/");
num_colons : constant Natural := HT.count_char (gh_args, LAT.Colon);
gh_ext : constant String := ".tar.gz";
begin
if num_colons < 2 then
-- NOT EXPECTED!!! give garbage so maintainer notices and fixes it
return gh_args & gh_ext;
end if;
declare
acct : constant String := HT.specific_field (gh_args, 1, ":");
proj : constant String := HT.specific_field (gh_args, 2, ":");
vers : constant String := HT.replace_all (S => HT.specific_field (gh_args, 3, ":"),
reject => LAT.Plus_Sign,
shiny => LAT.Hyphen);
begin
if vers (vers'First) = 'v' then
return acct & LAT.Hyphen & proj & LAT.Hyphen &
vers (vers'First + 1 .. vers'Last) & gh_ext;
else
return acct & LAT.Hyphen & proj & LAT.Hyphen & vers & gh_ext;
end if;
end;
end generate_github_distfile;
--------------------------------------------------------------------------------------------
-- post_parse_opt_desc_check_passes
--------------------------------------------------------------------------------------------
function post_parse_opt_desc_check_passes (specs : Portspecs) return Boolean
is
procedure scan (position : string_crate.Cursor);
all_good : Boolean := True;
procedure scan (position : string_crate.Cursor) is
begin
declare
-- we only care if *any* description is defined, so check defaults first
option : HT.Text renames string_crate.Element (position);
opt_name : String := HT.USS (option);
desc_opt : described_option_set := described_option (opt_name);
errormsg : constant String := "Option '" & opt_name & "' has no description.";
begin
if opt_name = options_none then
return;
end if;
if desc_opt = OPT_NOT_DEFINED then
-- No default description, so check for defined version
if specs.ops_helpers.Contains (option) then
if HT.IsBlank (specs.ops_helpers.Element (option).option_description) then
all_good := False;
TIO.Put_Line (errormsg);
end if;
else
all_good := False;
TIO.Put_Line (errormsg);
end if;
end if;
end;
end scan;
begin
specs.ops_avail.Iterate (scan'Access);
return all_good;
end post_parse_opt_desc_check_passes;
--------------------------------------------------------------------------------------------
-- info_page_check_message
--------------------------------------------------------------------------------------------
function info_page_check_message (specs : Portspecs; value : String) return String
is
nfo : constant String := "INFO entry '" & value & "' ";
begin
if HT.count_char (value, LAT.Colon) /= 1 then
return nfo & "is not prefixed by a subpackage";
end if;
declare
canspkg : String := HT.part_1 (value, ":");
begin
if not specs.subpackage_exists (canspkg) then
declare
otherside : String := HT.part_2 (value, ":");
begin
if specs.subpackage_exists (otherside) then
return nfo & "is reversed; the subpackage must be listed first";
else
return nfo & "is not prefixed by a recognized subpackage";
end if;
end;
end if;
end;
return "";
end info_page_check_message;
--------------------------------------------------------------------------------------------
-- port_is_generated
--------------------------------------------------------------------------------------------
function port_is_generated (specs : Portspecs) return Boolean is
begin
return specs.generated;
end port_is_generated;
--------------------------------------------------------------------------------------------
-- equivalent_fpc_port
--------------------------------------------------------------------------------------------
function equivalent_fpc_port (specs : Portspecs) return String
is
result : HT.Text := HT.SUS ("N/A");
key : HT.Text := HT.SUS ("FPC_EQUIVALENT");
begin
if specs.catch_all.Contains (key) then
result := specs.catch_all.Element (key).list.First_Element;
end if;
return HT.USS (result);
end equivalent_fpc_port;
--------------------------------------------------------------------------------------------
-- run_dependency
--------------------------------------------------------------------------------------------
function run_dependency (specs : Portspecs; dependency : String) return Boolean
is
procedure scan1 (position1 : list_crate.Cursor);
key : HT.Text := HT.SUS (dependency);
found : Boolean := False;
procedure scan1 (position1 : list_crate.Cursor) is
begin
if not found then
found := list_crate.Element (position1).list.Contains (key);
end if;
end scan1;
begin
if specs.buildrun_deps.Contains (key) or else specs.run_deps.Contains (key) then
return True;
end if;
specs.extra_rundeps.Iterate (scan1'Access);
return found;
end run_dependency;
--------------------------------------------------------------------------------------------
-- last_catchall_key
--------------------------------------------------------------------------------------------
function option_already_in_group (specs : Portspecs; option_name : String) return Boolean
is
procedure scan1 (position1 : list_crate.Cursor);
procedure scan2 (position2 : string_crate.Cursor);
found : Boolean := False;
procedure scan2 (position2 : string_crate.Cursor) is
begin
if not found then
found := HT.equivalent (string_crate.Element (position2), option_name);
end if;
end scan2;
procedure scan1 (position1 : list_crate.Cursor) is
begin
list_crate.Element (position1).list.Iterate (scan2'Access);
end scan1;
begin
specs.optgroups.Iterate (scan1'Access);
return found;
end option_already_in_group;
--------------------------------------------------------------------------------------------
-- last_catchall_key
--------------------------------------------------------------------------------------------
function last_catchall_key (specs : Portspecs) return String is
begin
return HT.USS (specs.last_catchkey);
end last_catchall_key;
--------------------------------------------------------------------------------------------
-- dump_specification
--------------------------------------------------------------------------------------------
procedure dump_specification (specs : Portspecs)
is
procedure print_item (position : string_crate.Cursor);
procedure print_tagline (position : def_crate.Cursor);
procedure print_catchall (position : def_crate.Cursor);
procedure print_line_item (position : string_crate.Cursor);
procedure dump (position : list_crate.Cursor);
procedure dump_target (position : list_crate.Cursor);
procedure dump_option (position : option_crate.Cursor);
procedure print_vector_list (thelabel : String; thelist : spec_field);
procedure print_group_list (thelabel : String; thelist : spec_field);
procedure print_single (thelabel : String; thelist : spec_field);
procedure print_boolean (thelabel : String; thelist : spec_field);
procedure print_opt_vector (vec : string_crate.Vector; thelabel : String);
procedure print_define (flavor : Positive);
procedure print_item (position : string_crate.Cursor)
is
index : Natural := string_crate.To_Index (position);
begin
if index > 1 then
TIO.Put (" ");
end if;
TIO.Put (HT.USS (string_crate.Element (position)));
end print_item;
procedure print_tagline (position : def_crate.Cursor) is
begin
TIO.Put_Line ("SDESC[" & HT.USS (def_crate.Key (position)) & LAT.Right_Square_Bracket &
LAT.HT & LAT.HT & HT.USS (def_crate.Element (position)));
end print_tagline;
procedure print_catchall (position : def_crate.Cursor)
is
varname : String := HT.USS (def_crate.Key (position));
value : String := HT.USS (def_crate.Element (position));
vnlen : Natural := varname'Length + 1;
tritab : String (1 .. 3) := LAT.HT & LAT.HT & LAT.HT;
frtmark : Natural := 1;
begin
if vnlen < 8 then
frtmark := 3;
elsif vnlen < 16 then
frtmark := 2;
end if;
TIO.Put_Line (varname & LAT.Equals_Sign & tritab (1 .. frtmark) & value);
end print_catchall;
procedure print_line_item (position : string_crate.Cursor)
is
index : Natural := string_crate.To_Index (position);
begin
TIO.Put_Line (HT.USS (string_crate.Element (position)));
end print_line_item;
procedure dump (position : list_crate.Cursor)
is
NDX : String := HT.USS (list_crate.Element (position).group);
begin
TIO.Put (" " & NDX);
if NDX'Length < 5 then
TIO.Put (LAT.HT & LAT.HT & LAT.HT);
elsif NDX'Length < 13 then
TIO.Put (LAT.HT & LAT.HT);
else
TIO.Put (LAT.HT);
end if;
list_crate.Element (position).list.Iterate (Process => print_item'Access);
TIO.Put (LAT.LF);
end dump;
procedure dump_target (position : list_crate.Cursor)
is
NDX : String := HT.USS (list_crate.Element (position).group);
begin
TIO.Put_Line (" " & NDX & LAT.Colon);
list_crate.Element (position).list.Iterate (Process => print_line_item'Access);
end dump_target;
procedure dump_option (position : option_crate.Cursor)
is
rec : Option_Helper renames option_crate.Element (position);
NDX : String := HT.USS (rec.option_name);
begin
TIO.Put_Line (" " & NDX & LAT.Colon);
TIO.Put_Line (" BROKEN_ON=" & LAT.HT & LAT.HT & HT.USS (rec.BROKEN_ON));
TIO.Put_Line (" DESCRIPTION=" & LAT.HT & LAT.HT & HT.USS (rec.option_description));
print_opt_vector (rec.BUILDRUN_DEPENDS_OFF, "BUILDRUN_DEPENDS_OFF");
print_opt_vector (rec.BUILDRUN_DEPENDS_ON, "BUILDRUN_DEPENDS_ON");
print_opt_vector (rec.BUILD_DEPENDS_OFF, "BUILD_DEPENDS_OFF");
print_opt_vector (rec.BUILD_DEPENDS_ON, "BUILD_DEPENDS_ON");
print_opt_vector (rec.BUILD_TARGET_ON, "BUILD_TARGET_ON");
print_opt_vector (rec.CFLAGS_OFF, "CFLAGS_OFF");
print_opt_vector (rec.CFLAGS_ON, "CFLAGS_ON");
print_opt_vector (rec.CMAKE_ARGS_OFF, "CMAKE_ARGS_OFF");
print_opt_vector (rec.CMAKE_ARGS_ON, "CMAKE_ARGS_ON");
print_opt_vector (rec.CMAKE_BOOL_T_BOTH, "CMAKE_BOOL_T_BOTH");
print_opt_vector (rec.CMAKE_BOOL_F_BOTH, "CMAKE_BOOL_F_BOTH");
print_opt_vector (rec.CONFIGURE_ARGS_ON, "CONFIGURE_ARGS_ON");
print_opt_vector (rec.CONFIGURE_ARGS_OFF, "CONFIGURE_ARGS_OFF");
print_opt_vector (rec.CONFIGURE_ENABLE_BOTH, "CONFIGURE_ENABLE_BOTH");
print_opt_vector (rec.CONFIGURE_ENV_ON, "CONFIGURE_ENV_ON");
print_opt_vector (rec.CONFIGURE_WITH_BOTH, "CONFIGURE_WITH_BOTH");
print_opt_vector (rec.CPPFLAGS_ON, "CPPFLAGS_ON");
print_opt_vector (rec.CXXFLAGS_ON, "CXXFLAGS_ON");
print_opt_vector (rec.DF_INDEX_OFF, "DF_INDEX_OFF");
print_opt_vector (rec.DF_INDEX_ON, "DF_INDEX_ON");
print_opt_vector (rec.EXTRA_PATCHES_ON, "EXTRA_PATCHES_ON");
print_opt_vector (rec.EXTRACT_ONLY_ON, "EXTRACT_ONLY_ON");
print_opt_vector (rec.GNOME_COMPONENTS_OFF, "GNOME_COMPONENTS_OFF");
print_opt_vector (rec.GNOME_COMPONENTS_ON, "GNOME_COMPONENTS_ON");
print_opt_vector (rec.IMPLIES_ON, "IMPLIES_ON");
print_opt_vector (rec.INFO_OFF, "INFO_OFF");
print_opt_vector (rec.INFO_ON, "INFO_ON");
print_opt_vector (rec.INSTALL_TARGET_ON, "INSTALL_TARGET_ON");
print_opt_vector (rec.KEYWORDS_ON, "KEYWORDS_ON");
print_opt_vector (rec.LDFLAGS_ON, "LDFLAGS_ON");
print_opt_vector (rec.MAKEFILE_OFF, "MAKEFILE_OFF");
print_opt_vector (rec.MAKEFILE_ON, "MAKEFILE_ON");
print_opt_vector (rec.MAKE_ARGS_OFF, "MAKE_ARGS_OFF");
print_opt_vector (rec.MAKE_ARGS_ON, "MAKE_ARGS_ON");
print_opt_vector (rec.MAKE_ENV_ON, "MAKE_ENV_ON");
print_opt_vector (rec.ONLY_FOR_OPSYS_ON, "ONLY_FOR_OPSYS_ON");
print_opt_vector (rec.PATCHFILES_ON, "PATCHFILES_ON");
print_opt_vector (rec.PLIST_SUB_ON, "PLIST_SUB_ON");
print_opt_vector (rec.PREVENTS_ON, "PREVENTS_ON");
print_opt_vector (rec.QMAKE_OFF, "QMAKE_OFF");
print_opt_vector (rec.QMAKE_ON, "QMAKE_ON");
print_opt_vector (rec.RUN_DEPENDS_OFF, "RUN_DEPENDS_OFF");
print_opt_vector (rec.RUN_DEPENDS_ON, "RUN_DEPENDS_ON");
print_opt_vector (rec.SUB_FILES_OFF, "SUB_FILES_OFF");
print_opt_vector (rec.SUB_FILES_ON, "SUB_FILES_ON");
print_opt_vector (rec.SUB_LIST_ON, "SUB_LIST_ON");
print_opt_vector (rec.TEST_TARGET_ON, "TEST_TARGET_ON");
print_opt_vector (rec.USES_OFF, "USES_OFF");
print_opt_vector (rec.USES_ON, "USES_ON");
print_opt_vector (rec.XORG_COMPONENTS_OFF, "XORG_COMPONENTS_OFF");
print_opt_vector (rec.XORG_COMPONENTS_ON, "XORG_COMPONENTS_ON");
end dump_option;
procedure print_opt_vector (vec : string_crate.Vector; thelabel : String)
is
-- Align at column-40
labellen : Natural := thelabel'Length;
num_tabs : Natural := (32 - labellen) / 8;
extratab : String (1 .. num_tabs) := (others => LAT.HT);
begin
TIO.Put (" " & thelabel & LAT.Equals_Sign & extratab);
vec.Iterate (Process => print_item'Access);
TIO.Put (LAT.LF);
end print_opt_vector;
procedure print_vector_list (thelabel : String; thelist : spec_field)
is
labellen : Natural := thelabel'Length;
begin
TIO.Put (thelabel & LAT.Equals_Sign & LAT.HT);
if labellen < 7 then
TIO.Put (LAT.HT & LAT.HT);
elsif labellen < 15 then
TIO.Put (LAT.HT);
end if;
case thelist is
when sp_exc_opsys => specs.exc_opsys.Iterate (print_item'Access);
when sp_inc_opsys => specs.inc_opsys.Iterate (print_item'Access);
when sp_exc_arch => specs.exc_arch.Iterate (print_item'Access);
when sp_opts_avail => specs.ops_avail.Iterate (print_item'Access);
when sp_opts_standard => specs.ops_standard.Iterate (print_item'Access);
when sp_df_index => specs.df_index.Iterate (print_item'Access);
when sp_distfiles => specs.distfiles.Iterate (print_item'Access);
when sp_contacts => specs.contacts.Iterate (print_item'Access);
when sp_variants => specs.variants.Iterate (print_item'Access);
when sp_keywords => specs.keywords.Iterate (print_item'Access);
when sp_ext_only => specs.extract_only.Iterate (print_item'Access);
when sp_ext_zip => specs.extract_zip.Iterate (print_item'Access);
when sp_ext_7z => specs.extract_7z.Iterate (print_item'Access);
when sp_ext_lha => specs.extract_lha.Iterate (print_item'Access);
when sp_ext_deb => specs.extract_deb.Iterate (print_item'Access);
when sp_ext_dirty => specs.extract_dirty.Iterate (print_item'Access);
when sp_make_args => specs.make_args.Iterate (print_item'Access);
when sp_make_env => specs.make_env.Iterate (print_item'Access);
when sp_build_target => specs.build_target.Iterate (print_item'Access);
when sp_cflags => specs.cflags.Iterate (print_item'Access);
when sp_cxxflags => specs.cxxflags.Iterate (print_item'Access);
when sp_cppflags => specs.cppflags.Iterate (print_item'Access);
when sp_ldflags => specs.ldflags.Iterate (print_item'Access);
when sp_patchfiles => specs.patchfiles.Iterate (print_item'Access);
when sp_uses => specs.uses.Iterate (print_item'Access);
when sp_sub_list => specs.sub_list.Iterate (print_item'Access);
when sp_sub_files => specs.sub_files.Iterate (print_item'Access);
when sp_config_args => specs.config_args.Iterate (print_item'Access);
when sp_config_env => specs.config_env.Iterate (print_item'Access);
when sp_build_deps => specs.build_deps.Iterate (print_item'Access);
when sp_buildrun_deps => specs.buildrun_deps.Iterate (print_item'Access);
when sp_run_deps => specs.run_deps.Iterate (print_item'Access);
when sp_cmake_args => specs.cmake_args.Iterate (print_item'Access);
when sp_qmake_args => specs.qmake_args.Iterate (print_item'Access);
when sp_info => specs.info.Iterate (print_item'Access);
when sp_install_tgt => specs.install_tgt.Iterate (print_item'Access);
when sp_patch_strip => specs.patch_strip.Iterate (print_item'Access);
when sp_pfiles_strip => specs.pfiles_strip.Iterate (print_item'Access);
when sp_extra_patches => specs.extra_patches.Iterate (print_item'Access);
when sp_plist_sub => specs.plist_sub.Iterate (print_item'Access);
when sp_licenses => specs.licenses.Iterate (print_item'Access);
when sp_users => specs.users.Iterate (print_item'Access);
when sp_groups => specs.groups.Iterate (print_item'Access);
when sp_test_tgt => specs.test_tgt.Iterate (print_item'Access);
when sp_test_args => specs.test_args.Iterate (print_item'Access);
when sp_test_env => specs.test_env.Iterate (print_item'Access);
when sp_mandirs => specs.mandirs.Iterate (print_item'Access);
when sp_broken_ssl => specs.broken_ssl.Iterate (print_item'Access);
when sp_broken_mysql => specs.broken_mysql.Iterate (print_item'Access);
when sp_broken_pgsql => specs.broken_pgsql.Iterate (print_item'Access);
when sp_gnome => specs.gnome_comps.Iterate (print_item'Access);
when sp_xorg => specs.xorg_comps.Iterate (print_item'Access);
when sp_sdl => specs.sdl_comps.Iterate (print_item'Access);
when sp_phpext => specs.php_extensions.Iterate (print_item'Access);
when sp_rcscript => specs.subr_scripts.Iterate (print_item'Access);
when sp_og_radio => specs.opt_radio.Iterate (print_item'Access);
when sp_og_restrict => specs.opt_restrict.Iterate (print_item'Access);
when sp_og_unlimited => specs.opt_unlimited.Iterate (print_item'Access);
when others => null;
end case;
TIO.Put (LAT.LF);
end print_vector_list;
procedure print_group_list (thelabel : String; thelist : spec_field) is
begin
TIO.Put_Line (thelabel & LAT.Colon);
case thelist is
when sp_vopts => specs.variantopts.Iterate (dump'Access);
when sp_options_on => specs.options_on.Iterate (dump'Access);
when sp_broken => specs.broken.Iterate (dump'Access);
when sp_subpackages => specs.subpackages.Iterate (dump'Access);
when sp_dl_sites => specs.dl_sites.Iterate (dump'Access);
when sp_ext_head => specs.extract_head.Iterate (dump'Access);
when sp_ext_tail => specs.extract_tail.Iterate (dump'Access);
when sp_makefile_targets => specs.make_targets.Iterate (dump_target'Access);
when sp_opt_helper => specs.ops_helpers.Iterate (dump_option'Access);
when sp_var_opsys => specs.var_opsys.Iterate (dump'Access);
when sp_var_arch => specs.var_arch.Iterate (dump'Access);
when sp_exrun => specs.extra_rundeps.Iterate (dump'Access);
when sp_catchall => specs.catch_all.Iterate (dump'Access);
when sp_opt_descr => specs.optgroup_desc.Iterate (dump'Access);
when sp_opt_group => specs.optgroups.Iterate (dump'Access);
when sp_os_bdep => specs.opsys_b_deps.Iterate (dump'Access);
when sp_os_rdep => specs.opsys_r_deps.Iterate (dump'Access);
when sp_os_brdep => specs.opsys_br_deps.Iterate (dump'Access);
when others => null;
end case;
end print_group_list;
procedure print_single (thelabel : String; thelist : spec_field)
is
labellen : Natural := thelabel'Length;
begin
TIO.Put (thelabel & LAT.Equals_Sign & LAT.HT);
if labellen < 7 then
TIO.Put (LAT.HT & LAT.HT);
elsif labellen < 15 then
TIO.Put (LAT.HT);
end if;
case thelist is
when sp_namebase => TIO.Put_Line (HT.USS (specs.namebase));
when sp_version => TIO.Put_Line (HT.USS (specs.version));
when sp_revision => TIO.Put_Line (HT.int2str (specs.revision));
when sp_epoch => TIO.Put_Line (HT.int2str (specs.epoch));
when sp_opt_level => TIO.Put_Line (HT.int2str (specs.optimizer_lvl));
when sp_job_limit => TIO.Put_Line (HT.int2str (specs.job_limit));
when sp_distsubdir => TIO.Put_Line (HT.USS (specs.dist_subdir));
when sp_distname => TIO.Put_Line (HT.USS (specs.distname));
when sp_build_wrksrc => TIO.Put_Line (HT.USS (specs.build_wrksrc));
when sp_makefile => TIO.Put_Line (HT.USS (specs.makefile));
when sp_destdirname => TIO.Put_Line (HT.USS (specs.destdirname));
when sp_homepage => TIO.Put_Line (HT.USS (specs.homepage));
when sp_gnu_cfg_prefix => TIO.Put_Line (HT.USS (specs.config_prefix));
when sp_config_script => TIO.Put_Line (HT.USS (specs.config_script));
when sp_config_target => TIO.Put_Line (HT.USS (specs.config_target));
when sp_config_wrksrc => TIO.Put_Line (HT.USS (specs.config_wrksrc));
when sp_patch_wrksrc => TIO.Put_Line (HT.USS (specs.patch_wrksrc));
when sp_must_config => TIO.Put_Line (HT.USS (specs.config_must));
when sp_expiration => TIO.Put_Line (HT.USS (specs.expire_date));
when sp_deprecated => TIO.Put_Line (HT.USS (specs.deprecated));
when sp_install_wrksrc => TIO.Put_Line (HT.USS (specs.install_wrksrc));
when sp_prefix => TIO.Put_Line (HT.USS (specs.prefix));
when sp_ug_pkg => TIO.Put_Line (HT.USS (specs.usergroup_pkg));
when others => null;
end case;
end print_single;
procedure print_boolean (thelabel : String; thelist : spec_field)
is
labellen : Natural := thelabel'Length;
begin
TIO.Put (thelabel & LAT.Equals_Sign & LAT.HT);
if labellen < 7 then
TIO.Put (LAT.HT & LAT.HT);
elsif labellen < 15 then
TIO.Put (LAT.HT);
end if;
case thelist is
when sp_skip_build => TIO.Put_Line (specs.skip_build'Img);
when sp_skip_install => TIO.Put_Line (specs.skip_install'Img);
when sp_destdir_env => TIO.Put_Line (specs.destdir_env'Img);
when sp_single_job => TIO.Put_Line (specs.single_job'Img);
when sp_cfg_outsrc => TIO.Put_Line (specs.config_outsrc'Img);
when sp_inst_tchain => TIO.Put_Line (specs.shift_install'Img);
when sp_skip_ccache => TIO.Put_Line (specs.skip_ccache'Img);
when sp_rpath_warning => TIO.Put_Line (specs.fatal_rpath'Img);
when sp_debugging => TIO.Put_Line (specs.debugging_on'Img);
when sp_generated => TIO.Put_Line (specs.generated'Img);
when others => null;
end case;
end print_boolean;
procedure print_define (flavor : Positive) is
begin
case flavor is
when 1 => specs.taglines.Iterate (print_tagline'Access);
when others => null;
end case;
end print_define;
begin
print_single ("NAMEBASE", sp_namebase);
print_single ("VERSION", sp_version);
print_single ("REVISION", sp_revision);
print_single ("EPOCH", sp_epoch);
print_vector_list ("KEYWORDS", sp_keywords);
print_vector_list ("VARIANTS", sp_variants);
print_define (1); -- SDESC
print_single ("HOMEPAGE", sp_homepage);
print_vector_list ("CONTACTS", sp_contacts);
print_group_list ("SITES", sp_dl_sites);
print_vector_list ("DISTFILE", sp_distfiles);
print_single ("DIST_SUBDIR", sp_distsubdir);
print_vector_list ("DF_INDEX", sp_df_index);
print_vector_list ("PATCHFILES", sp_patchfiles);
print_group_list ("SPKGS", sp_subpackages);
print_vector_list ("OPTIONS_AVAILABLE", sp_opts_avail);
print_vector_list ("OPTIONS_STANDARD", sp_opts_standard);
print_vector_list ("OPTGROUP_RADIO", sp_og_radio);
print_vector_list ("OPTGROUP_RESTRICTED", sp_og_restrict);
print_vector_list ("OPTGROUP_UNLIMITED", sp_og_unlimited);
print_group_list ("OPTDESCR", sp_opt_descr);
print_group_list ("OPTGROUP", sp_opt_group);
print_group_list ("VOPTS", sp_vopts);
print_group_list ("OPT_ON", sp_options_on);
print_group_list ("BROKEN", sp_broken);
print_vector_list ("BROKEN_SSL", sp_broken_ssl);
print_vector_list ("BROKEN_MYSQL", sp_broken_mysql);
print_vector_list ("BROKEN_PGSQL", sp_broken_pgsql);
print_vector_list ("ONLY_FOR_OPSYS", sp_inc_opsys);
print_vector_list ("NOT_FOR_OPSYS", sp_exc_opsys);
print_vector_list ("NOT_FOR_ARCH", sp_exc_arch);
print_single ("DEPRECATED", sp_deprecated);
print_single ("EXPIRATION_DATE", sp_expiration);
print_vector_list ("BUILD_DEPENDS", sp_build_deps);
print_vector_list ("BUILDRUN_DEPENDS", sp_buildrun_deps);
print_vector_list ("RUN_DEPENDS", sp_run_deps);
print_group_list ("EXRUN", sp_exrun);
print_group_list ("B_DEPS", sp_os_bdep);
print_group_list ("BR_DEPS", sp_os_brdep);
print_group_list ("R_DEPS", sp_os_rdep);
print_vector_list ("USES", sp_uses);
print_vector_list ("GNOME_COMPONENTS", sp_gnome);
print_vector_list ("XORG_COMPONENTS", sp_xorg);
print_vector_list ("SDL_COMPONENTS", sp_sdl);
print_vector_list ("PHP_EXTENSIONS", sp_phpext);
print_vector_list ("SUB_LIST", sp_sub_list);
print_vector_list ("SUB_FILES", sp_sub_files);
print_group_list ("OPTION HELPERS", sp_opt_helper);
print_single ("DISTNAME", sp_distname);
print_vector_list ("EXTRACT_ONLY", sp_ext_only);
print_vector_list ("EXTRACT_WITH_UNZIP", sp_ext_zip);
print_vector_list ("EXTRACT_WITH_7Z", sp_ext_7z);
print_vector_list ("EXTRACT_WITH_LHA", sp_ext_lha);
print_vector_list ("EXTRACT_DEB_PACKAGE", sp_ext_deb);
print_vector_list ("EXTRACT_DIRTY", sp_ext_dirty);
print_group_list ("EXTRACT_HEAD", sp_ext_head);
print_group_list ("EXTRACT_TAIL", sp_ext_tail);
print_single ("PREFIX", sp_prefix);
print_single ("PATCH_WRKSRC", sp_patch_wrksrc);
print_vector_list ("EXTRA_PATCHES", sp_extra_patches);
print_vector_list ("PATCH_STRIP", sp_patch_strip);
print_vector_list ("PATCHFILES_STRIP", sp_pfiles_strip);
print_single ("MUST_CONFIGURE", sp_must_config);
print_single ("CONFIGURE_WRKSRC", sp_config_wrksrc);
print_single ("CONFIGURE_TARGET", sp_config_target);
print_single ("CONFIGURE_SCRIPT", sp_config_script);
print_boolean ("CONFIGURE_OUTSOURCE", sp_cfg_outsrc);
print_vector_list ("CONFIGURE_ARGS", sp_config_args);
print_vector_list ("CONFIGURE_ENV", sp_config_env);
print_single ("GNU_CONFIGURE_PREFIX", sp_gnu_cfg_prefix);
print_boolean ("RPATH_CHECK_FATAL", sp_rpath_warning);
print_boolean ("SKIP_BUILD", sp_skip_build);
print_boolean ("SKIP_INSTALL", sp_skip_install);
print_boolean ("SKIP_CCACHE", sp_skip_ccache);
print_boolean ("INSTALL_REQ_TOOLCHAIN", sp_inst_tchain);
print_boolean ("SINGLE_JOB", sp_single_job);
print_boolean ("SET_DEBUGGING_ON", sp_debugging);
print_boolean ("DESTDIR_VIA_ENV", sp_destdir_env);
print_single ("BUILD_WRKSRC", sp_build_wrksrc);
print_single ("MAKEFILE", sp_makefile);
print_single ("DESTDIRNAME", sp_destdirname);
print_vector_list ("MAKE_ARGS", sp_make_args);
print_vector_list ("MAKE_ENV", sp_make_env);
print_vector_list ("BUILD_TARGET", sp_build_target);
print_single ("OPTIMIZER_LEVEL", sp_opt_level);
print_vector_list ("CFLAGS", sp_cflags);
print_vector_list ("CXXFLAGS", sp_cxxflags);
print_vector_list ("CPPFLAGS", sp_cppflags);
print_vector_list ("LDFLAGS", sp_ldflags);
print_vector_list ("CMAKE_ARGS", sp_cmake_args);
print_vector_list ("QMAKE_ARGS", sp_qmake_args);
print_vector_list ("INFO", sp_info);
print_vector_list ("INSTALL_TARGET", sp_install_tgt);
print_single ("INSTALL_WRKSRC", sp_install_wrksrc);
print_vector_list ("PLIST_SUB", sp_plist_sub);
print_vector_list ("LICENSES", sp_licenses);
print_vector_list ("USERS", sp_users);
print_vector_list ("GROUPS", sp_groups);
print_single ("USERGROUP_SPKG", sp_ug_pkg);
print_vector_list ("MANDIRS", sp_mandirs);
print_group_list ("CATCHALL", sp_catchall);
print_group_list ("VAR_OPSYS", sp_var_opsys);
print_group_list ("VAR_ARCH", sp_var_arch);
print_vector_list ("TEST_TARGET", sp_test_tgt);
print_vector_list ("TEST_ARGS", sp_test_args);
print_vector_list ("TEST_ENV", sp_test_env);
print_vector_list ("RC_SUBR", sp_rcscript);
print_boolean ("GENERATED", sp_generated);
print_single ("MAKE_JOBS_NUMBER_LIMIT", sp_job_limit);
print_group_list ("Makefile Targets", sp_makefile_targets);
end dump_specification;
end Port_Specification;
|
AaronC98/PlaneSystem | Ada | 2,952 | adb | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2000-2012, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
package body AWS.Dispatchers.Callback is
-----------
-- Clone --
-----------
overriding function Clone (Dispatcher : Handler) return Handler is
begin
return (AWS.Dispatchers.Handler with Callback => Dispatcher.Callback);
end Clone;
------------
-- Create --
------------
function Create (Callback : Response.Callback) return Handler is
begin
return (AWS.Dispatchers.Handler with Callback => Callback);
end Create;
--------------
-- Dispatch --
--------------
overriding function Dispatch
(Dispatcher : Handler;
Request : Status.Data) return Response.Data is
begin
return Dispatcher.Callback (Request);
end Dispatch;
end AWS.Dispatchers.Callback;
|
gerr135/ada_composition | Ada | 546 | adb | with Ada.Text_IO; use Ada.Text_IO;
package body oop_mixin is
overriding
procedure simple(Self : Derived) is
begin
Put_Line(" oop:simple");
end;
overriding
procedure compound(Self : Derived) is
begin
Put_Line(" oop:compound, calling Derived.simple");
Self.simple;
end;
overriding
procedure redispatching(Self : Derived) is
begin
Put_Line(" oop:redispatching, calling Derived'Class.simple");
Derived'Class(Self).simple;
end;
end oop_mixin;
|
JeremyGrosser/clock3 | Ada | 15,916 | ads | pragma Style_Checks (Off);
-- Copyright (c) 2018 Microchip Technology Inc.
--
-- SPDX-License-Identifier: Apache-2.0
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- This spec has been automatically generated from ATSAMD21G18A.svd
pragma Restrictions (No_Elaboration_Code);
with HAL;
with System;
package SAMD21_SVD.DSU is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Control
type DSU_CTRL_Register is record
-- Write-only. Software Reset
SWRST : Boolean := False;
-- unspecified
Reserved_1_1 : HAL.Bit := 16#0#;
-- Write-only. 32-bit Cyclic Redundancy Check
CRC : Boolean := False;
-- Write-only. Memory Built-In Self-Test
MBIST : Boolean := False;
-- Write-only. Chip Erase
CE : Boolean := False;
-- unspecified
Reserved_5_7 : HAL.UInt3 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for DSU_CTRL_Register use record
SWRST at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
CRC at 0 range 2 .. 2;
MBIST at 0 range 3 .. 3;
CE at 0 range 4 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
end record;
-- Status A
type DSU_STATUSA_Register is record
-- Done
DONE : Boolean := False;
-- CPU Reset Phase Extension
CRSTEXT : Boolean := False;
-- Bus Error
BERR : Boolean := False;
-- Failure
FAIL : Boolean := False;
-- Protection Error
PERR : Boolean := False;
-- unspecified
Reserved_5_7 : HAL.UInt3 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for DSU_STATUSA_Register use record
DONE at 0 range 0 .. 0;
CRSTEXT at 0 range 1 .. 1;
BERR at 0 range 2 .. 2;
FAIL at 0 range 3 .. 3;
PERR at 0 range 4 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
end record;
-- DSU_STATUSB_DCCD array
type DSU_STATUSB_DCCD_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for DSU_STATUSB_DCCD
type DSU_STATUSB_DCCD_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- DCCD as a value
Val : HAL.UInt2;
when True =>
-- DCCD as an array
Arr : DSU_STATUSB_DCCD_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for DSU_STATUSB_DCCD_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Status B
type DSU_STATUSB_Register is record
-- Read-only. Protected
PROT : Boolean;
-- Read-only. Debugger Present
DBGPRES : Boolean;
-- Read-only. Debug Communication Channel 0 Dirty
DCCD : DSU_STATUSB_DCCD_Field;
-- Read-only. Hot-Plugging Enable
HPE : Boolean;
-- unspecified
Reserved_5_7 : HAL.UInt3;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for DSU_STATUSB_Register use record
PROT at 0 range 0 .. 0;
DBGPRES at 0 range 1 .. 1;
DCCD at 0 range 2 .. 3;
HPE at 0 range 4 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
end record;
subtype DSU_ADDR_ADDR_Field is HAL.UInt30;
-- Address
type DSU_ADDR_Register is record
-- unspecified
Reserved_0_1 : HAL.UInt2 := 16#0#;
-- Address
ADDR : DSU_ADDR_ADDR_Field := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DSU_ADDR_Register use record
Reserved_0_1 at 0 range 0 .. 1;
ADDR at 0 range 2 .. 31;
end record;
subtype DSU_LENGTH_LENGTH_Field is HAL.UInt30;
-- Length
type DSU_LENGTH_Register is record
-- unspecified
Reserved_0_1 : HAL.UInt2 := 16#0#;
-- Length
LENGTH : DSU_LENGTH_LENGTH_Field := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DSU_LENGTH_Register use record
Reserved_0_1 at 0 range 0 .. 1;
LENGTH at 0 range 2 .. 31;
end record;
-- Debug Communication Channel n
-- Debug Communication Channel n
type DSU_DCC_Registers is array (0 .. 1) of HAL.UInt32;
subtype DSU_DID_DEVSEL_Field is HAL.UInt8;
subtype DSU_DID_REVISION_Field is HAL.UInt4;
subtype DSU_DID_DIE_Field is HAL.UInt4;
subtype DSU_DID_SERIES_Field is HAL.UInt6;
subtype DSU_DID_FAMILY_Field is HAL.UInt5;
subtype DSU_DID_PROCESSOR_Field is HAL.UInt4;
-- Device Identification
type DSU_DID_Register is record
-- Read-only. Device Select
DEVSEL : DSU_DID_DEVSEL_Field;
-- Read-only. Revision
REVISION : DSU_DID_REVISION_Field;
-- Read-only. Die Identification
DIE : DSU_DID_DIE_Field;
-- Read-only. Product Series
SERIES : DSU_DID_SERIES_Field;
-- unspecified
Reserved_22_22 : HAL.Bit;
-- Read-only. Product Family
FAMILY : DSU_DID_FAMILY_Field;
-- Read-only. Processor
PROCESSOR : DSU_DID_PROCESSOR_Field;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DSU_DID_Register use record
DEVSEL at 0 range 0 .. 7;
REVISION at 0 range 8 .. 11;
DIE at 0 range 12 .. 15;
SERIES at 0 range 16 .. 21;
Reserved_22_22 at 0 range 22 .. 22;
FAMILY at 0 range 23 .. 27;
PROCESSOR at 0 range 28 .. 31;
end record;
subtype DSU_ENTRY_ADDOFF_Field is HAL.UInt20;
-- CoreSight ROM Table Entry 0
type DSU_ENTRY_Register is record
-- Read-only. Entry Present
EPRES : Boolean;
-- Read-only. Format
FMT : Boolean;
-- unspecified
Reserved_2_11 : HAL.UInt10;
-- Read-only. Address Offset
ADDOFF : DSU_ENTRY_ADDOFF_Field;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DSU_ENTRY_Register use record
EPRES at 0 range 0 .. 0;
FMT at 0 range 1 .. 1;
Reserved_2_11 at 0 range 2 .. 11;
ADDOFF at 0 range 12 .. 31;
end record;
-- CoreSight ROM Table Memory Type
type DSU_MEMTYPE_Register is record
-- Read-only. System Memory Present
SMEMP : Boolean;
-- unspecified
Reserved_1_31 : HAL.UInt31;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DSU_MEMTYPE_Register use record
SMEMP at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
subtype DSU_PID4_JEPCC_Field is HAL.UInt4;
subtype DSU_PID4_FKBC_Field is HAL.UInt4;
-- Peripheral Identification 4
type DSU_PID4_Register is record
-- Read-only. JEP-106 Continuation Code
JEPCC : DSU_PID4_JEPCC_Field;
-- Read-only. 4KB Count
FKBC : DSU_PID4_FKBC_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DSU_PID4_Register use record
JEPCC at 0 range 0 .. 3;
FKBC at 0 range 4 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype DSU_PID0_PARTNBL_Field is HAL.UInt8;
-- Peripheral Identification 0
type DSU_PID0_Register is record
-- Read-only. Part Number Low
PARTNBL : DSU_PID0_PARTNBL_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DSU_PID0_Register use record
PARTNBL at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype DSU_PID1_PARTNBH_Field is HAL.UInt4;
subtype DSU_PID1_JEPIDCL_Field is HAL.UInt4;
-- Peripheral Identification 1
type DSU_PID1_Register is record
-- Read-only. Part Number High
PARTNBH : DSU_PID1_PARTNBH_Field;
-- Read-only. Low part of the JEP-106 Identity Code
JEPIDCL : DSU_PID1_JEPIDCL_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DSU_PID1_Register use record
PARTNBH at 0 range 0 .. 3;
JEPIDCL at 0 range 4 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype DSU_PID2_JEPIDCH_Field is HAL.UInt3;
subtype DSU_PID2_REVISION_Field is HAL.UInt4;
-- Peripheral Identification 2
type DSU_PID2_Register is record
-- Read-only. JEP-106 Identity Code High
JEPIDCH : DSU_PID2_JEPIDCH_Field;
-- Read-only. JEP-106 Identity Code is used
JEPU : Boolean;
-- Read-only. Revision Number
REVISION : DSU_PID2_REVISION_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DSU_PID2_Register use record
JEPIDCH at 0 range 0 .. 2;
JEPU at 0 range 3 .. 3;
REVISION at 0 range 4 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype DSU_PID3_CUSMOD_Field is HAL.UInt4;
subtype DSU_PID3_REVAND_Field is HAL.UInt4;
-- Peripheral Identification 3
type DSU_PID3_Register is record
-- Read-only. ARM CUSMOD
CUSMOD : DSU_PID3_CUSMOD_Field;
-- Read-only. Revision Number
REVAND : DSU_PID3_REVAND_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DSU_PID3_Register use record
CUSMOD at 0 range 0 .. 3;
REVAND at 0 range 4 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype DSU_CID0_PREAMBLEB0_Field is HAL.UInt8;
-- Component Identification 0
type DSU_CID0_Register is record
-- Read-only. Preamble Byte 0
PREAMBLEB0 : DSU_CID0_PREAMBLEB0_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DSU_CID0_Register use record
PREAMBLEB0 at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype DSU_CID1_PREAMBLE_Field is HAL.UInt4;
subtype DSU_CID1_CCLASS_Field is HAL.UInt4;
-- Component Identification 1
type DSU_CID1_Register is record
-- Read-only. Preamble
PREAMBLE : DSU_CID1_PREAMBLE_Field;
-- Read-only. Component Class
CCLASS : DSU_CID1_CCLASS_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DSU_CID1_Register use record
PREAMBLE at 0 range 0 .. 3;
CCLASS at 0 range 4 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype DSU_CID2_PREAMBLEB2_Field is HAL.UInt8;
-- Component Identification 2
type DSU_CID2_Register is record
-- Read-only. Preamble Byte 2
PREAMBLEB2 : DSU_CID2_PREAMBLEB2_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DSU_CID2_Register use record
PREAMBLEB2 at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype DSU_CID3_PREAMBLEB3_Field is HAL.UInt8;
-- Component Identification 3
type DSU_CID3_Register is record
-- Read-only. Preamble Byte 3
PREAMBLEB3 : DSU_CID3_PREAMBLEB3_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DSU_CID3_Register use record
PREAMBLEB3 at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Device Service Unit
type DSU_Peripheral is record
-- Control
CTRL : aliased DSU_CTRL_Register;
-- Status A
STATUSA : aliased DSU_STATUSA_Register;
-- Status B
STATUSB : aliased DSU_STATUSB_Register;
-- Address
ADDR : aliased DSU_ADDR_Register;
-- Length
LENGTH : aliased DSU_LENGTH_Register;
-- Data
DATA : aliased HAL.UInt32;
-- Debug Communication Channel n
DCC : aliased DSU_DCC_Registers;
-- Device Identification
DID : aliased DSU_DID_Register;
-- CoreSight ROM Table Entry 0
ENTRY_k : aliased DSU_ENTRY_Register;
-- CoreSight ROM Table Entry 1
ENTRY1 : aliased HAL.UInt32;
-- CoreSight ROM Table End
END_k : aliased HAL.UInt32;
-- CoreSight ROM Table Memory Type
MEMTYPE : aliased DSU_MEMTYPE_Register;
-- Peripheral Identification 4
PID4 : aliased DSU_PID4_Register;
-- Peripheral Identification 0
PID0 : aliased DSU_PID0_Register;
-- Peripheral Identification 1
PID1 : aliased DSU_PID1_Register;
-- Peripheral Identification 2
PID2 : aliased DSU_PID2_Register;
-- Peripheral Identification 3
PID3 : aliased DSU_PID3_Register;
-- Component Identification 0
CID0 : aliased DSU_CID0_Register;
-- Component Identification 1
CID1 : aliased DSU_CID1_Register;
-- Component Identification 2
CID2 : aliased DSU_CID2_Register;
-- Component Identification 3
CID3 : aliased DSU_CID3_Register;
end record
with Volatile;
for DSU_Peripheral use record
CTRL at 16#0# range 0 .. 7;
STATUSA at 16#1# range 0 .. 7;
STATUSB at 16#2# range 0 .. 7;
ADDR at 16#4# range 0 .. 31;
LENGTH at 16#8# range 0 .. 31;
DATA at 16#C# range 0 .. 31;
DCC at 16#10# range 0 .. 63;
DID at 16#18# range 0 .. 31;
ENTRY_k at 16#1000# range 0 .. 31;
ENTRY1 at 16#1004# range 0 .. 31;
END_k at 16#1008# range 0 .. 31;
MEMTYPE at 16#1FCC# range 0 .. 31;
PID4 at 16#1FD0# range 0 .. 31;
PID0 at 16#1FE0# range 0 .. 31;
PID1 at 16#1FE4# range 0 .. 31;
PID2 at 16#1FE8# range 0 .. 31;
PID3 at 16#1FEC# range 0 .. 31;
CID0 at 16#1FF0# range 0 .. 31;
CID1 at 16#1FF4# range 0 .. 31;
CID2 at 16#1FF8# range 0 .. 31;
CID3 at 16#1FFC# range 0 .. 31;
end record;
-- Device Service Unit
DSU_Periph : aliased DSU_Peripheral
with Import, Address => DSU_Base;
end SAMD21_SVD.DSU;
|
zhmu/ananas | Ada | 57 | ads | package Addr12_A is
procedure Do_Stuff;
end Addr12_A;
|
zhmu/ananas | Ada | 7,771 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M --
-- --
-- S p e c --
-- (VxWorks 6 Kernel Version PPC) --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package System is
pragma Pure;
-- Note that we take advantage of the implementation permission to make
-- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada
-- 2005, this is Pure in any case (AI-362).
pragma No_Elaboration_Code_All;
-- Allow the use of that restriction in units that WITH this unit
type Name is (SYSTEM_NAME_GNAT);
System_Name : constant Name := SYSTEM_NAME_GNAT;
-- System-Dependent Named Numbers
Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
Max_Digits : constant := Long_Long_Float'Digits;
Max_Mantissa : constant := Standard'Max_Integer_Size - 1;
Fine_Delta : constant := 2.0 ** (-Max_Mantissa);
Tick : constant := 1.0 / 60.0;
-- Storage-related Declarations
type Address is private;
pragma Preelaborable_Initialization (Address);
Null_Address : constant Address;
Storage_Unit : constant := 8;
Word_Size : constant := 32;
Memory_Size : constant := 2 ** 32;
-- Address comparison
function "<" (Left, Right : Address) return Boolean;
function "<=" (Left, Right : Address) return Boolean;
function ">" (Left, Right : Address) return Boolean;
function ">=" (Left, Right : Address) return Boolean;
function "=" (Left, Right : Address) return Boolean;
pragma Import (Intrinsic, "<");
pragma Import (Intrinsic, "<=");
pragma Import (Intrinsic, ">");
pragma Import (Intrinsic, ">=");
pragma Import (Intrinsic, "=");
-- Other System-Dependent Declarations
type Bit_Order is (High_Order_First, Low_Order_First);
Default_Bit_Order : constant Bit_Order := High_Order_First;
pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning
-- Priority-related Declarations (RM D.1)
-- Ada priorities are mapped to VxWorks priorities using the following
-- transformation: 255 - Ada Priority
-- Ada priorities are used as follows:
-- 256 is reserved for the VxWorks kernel
-- 248 - 255 correspond to hardware interrupt levels 0 .. 7
-- 247 is a catchall default "interrupt" priority for signals,
-- allowing higher priority than normal tasks, but lower than
-- hardware priority levels. Protected Object ceilings can
-- override these values.
-- 246 is used by the Interrupt_Manager task
Max_Priority : constant Positive := 245;
Max_Interrupt_Priority : constant Positive := 255;
subtype Any_Priority is Integer range 0 .. 255;
subtype Priority is Any_Priority range 0 .. 245;
subtype Interrupt_Priority is Any_Priority range 246 .. 255;
Default_Priority : constant Priority := 122;
private
type Address is mod Memory_Size;
Null_Address : constant Address := 0;
--------------------------------------
-- System Implementation Parameters --
--------------------------------------
-- These parameters provide information about the target that is used
-- by the compiler. They are in the private part of System, where they
-- can be accessed using the special circuitry in the Targparm unit
-- whose source should be consulted for more detailed descriptions
-- of the individual switch values.
Backend_Divide_Checks : constant Boolean := False;
Backend_Overflow_Checks : constant Boolean := True;
Command_Line_Args : constant Boolean := False;
Configurable_Run_Time : constant Boolean := False;
Denorm : constant Boolean := True;
Duration_32_Bits : constant Boolean := False;
Exit_Status_Supported : constant Boolean := True;
Machine_Overflows : constant Boolean := False;
Machine_Rounds : constant Boolean := True;
Preallocated_Stacks : constant Boolean := False;
Signed_Zeros : constant Boolean := True;
Stack_Check_Default : constant Boolean := False;
Stack_Check_Probes : constant Boolean := True;
Stack_Check_Limits : constant Boolean := False;
Support_Aggregates : constant Boolean := True;
Support_Composite_Assign : constant Boolean := True;
Support_Composite_Compare : constant Boolean := True;
Support_Long_Shifts : constant Boolean := True;
Always_Compatible_Rep : constant Boolean := False;
Suppress_Standard_Library : constant Boolean := False;
Use_Ada_Main_Program_Name : constant Boolean := True;
Frontend_Exceptions : constant Boolean := False;
ZCX_By_Default : constant Boolean := True;
Executable_Extension : constant String := ".out";
end System;
|
zhmu/ananas | Ada | 208 | adb | package body prefix1 is
Counter : Integer := 2;
Table : Arr := (2, 4, 8, 16, 32, 64, 128, 256, 512, 1024);
function Func (Object : T) return Arr is
begin
return Table;
end;
end prefix1;
|
TTK4145-students-2020/exercise-8-gruppe-1 | Ada | 3,622 | adb | with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Numerics.Float_Random;
use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Numerics.Float_Random;
procedure exercise8 is
Count_Failed : exception; -- Exception to be raised when counting fails
Gen : Generator; -- Random number generator
protected type Transaction_Manager (N : Positive) is
entry Finished;
procedure Signal_Abort;
entry Wait_Until_Aborted;
private
Finished_Gate_Open : Boolean := False;
Aborted : Boolean := False;
end Transaction_Manager;
protected body Transaction_Manager is
entry Finished when Finished_Gate_Open or Finished'Count = N is
begin
------------------------------------------
-- PART 3: Modify the Finished entry
if Finished'Count = N-1 then
Finished_Gate_Open := True;
end if;
if Finished'Count = 0 then
Finished_Gate_Open := False;
Aborted := False;
end if;
end Finished;
------------------------------------------
procedure Signal_Abort is
begin
Aborted := True;
end Signal_Abort;
------------------------------------------
-- PART 2: Create the Wait_Until_Aborted entry
entry Wait_Until_Aborted when Aborted is -- run this if Aborted == True
begin
if Wait_Until_Aborted'Count = 0 then -- if all participants are here
Aborted := False;
end if;
end Wait_Until_Aborted;
------------------------------------------
end Transaction_Manager;
function Unreliable_Slow_Add (x : Integer) return Integer is
Error_Rate : Constant := 0.15; -- (between 0 and 1)
begin
if Random(Gen) > Error_Rate then
delay Duration(5.0);
return X + 10;
else
delay Duration(1.0);
raise Count_Failed;
end if;
end Unreliable_Slow_Add;
task type Transaction_Worker (Initial : Integer; Manager : access Transaction_Manager);
task body Transaction_Worker is
Num : Integer := Initial;
Prev : Integer := Num;
Round_Num : Integer := 0;
begin
Put_Line ("Worker" & Integer'Image(Initial) & " started");
loop
------------------------------------------
-- PART 1: Select-Then-Abort statement
select -- if another node has fucked up
Manager.Wait_Until_Aborted;
Num := Prev + 5;
Put_Line ("Worker" & Integer'Image(Initial) & " is doing forward recovery ");
then abort -- main code
Put_Line ("Worker" & Integer'Image(Initial) & " started round" & Integer'Image(Round_Num));
Round_Num := Round_Num + 1;
begin
Num := Unreliable_Slow_Add(Num);
exception
when Count_Failed => --if this node fucks up
Put_Line ("Worker" & Integer'Image(Initial) & " failed! ");
Manager.Signal_Abort; -- Karen notifies the manager
end;
end select;
------------------------------------------
Manager.Finished;
Put_Line (" Worker" & Integer'Image(Initial) & " comitting" & Integer'Image(Num));
Prev := Num;
delay 0.5;
end loop;
end Transaction_Worker;
Manager : aliased Transaction_Manager (3);
Worker_1 : Transaction_Worker (0, Manager'Access);
Worker_2 : Transaction_Worker (1, Manager'Access);
Worker_3 : Transaction_Worker (2, Manager'Access);
begin
Reset(Gen); -- Seed the random number generator
end exercise8;
|
AdaCore/libadalang | Ada | 392 | ads | -- Check the handling of record variant parts in basic cases
package Pkg is
generic
type T is private;
package G is
type R is record
Value : T;
end record;
end G;
package Boolean_G is new G (Boolean);
B : Boolean_G.R;
pragma Test_Object_Type;
package Integer_G is new G (Integer);
I : Integer_G.R;
pragma Test_Object_Type;
end Pkg;
|
onox/orka | Ada | 7,009 | 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.Unchecked_Conversion;
with EGL.API;
with EGL.Errors;
package body EGL.Objects.Contexts is
Major_Version : constant Int := 16#3098#;
Minor_Version : constant Int := 16#30FB#;
Context_Flags_Bits : constant Int := 16#30FC#;
OpenGL_Profile_Mask : constant Int := 16#30FD#;
-- EGL 1.5
-- OpenGL_Debug : constant Int := 16#31B0#;
-- OpenGL_Forward_Compatible : constant Int := 16#31B1#;
-- OpenGL_Robust : constant Int := 16#31B2#;
OpenGL_No_Error : constant Int := 16#31B3#;
OpenGL_Reset_Notification_Strategy : constant Int := 16#31BD#;
Context_Release_Behavior : constant Int := 16#2097#;
Context_Release_Behavior_None : constant Int := 0;
-- Context_Release_Behavior_Flush : constant Int := 16#2098#;
No_Reset_Notification : constant Int := 16#31BE#;
Lose_Context_On_Reset : constant Int := 16#31BF#;
OpenGL_Core_Profile : constant Int := 16#0000_0001#;
type Flag_Bits is record
Debug : Boolean := False;
Forward : Boolean := True;
Robust : Boolean := False;
end record;
for Flag_Bits use record
Debug at 0 range 0 .. 0;
Forward at 0 range 1 .. 1;
Robust at 0 range 2 .. 2;
end record;
for Flag_Bits'Size use Int'Size;
function Create_Context
(Display : Displays.Display;
Version : Context_Version;
Flags : Context_Flags) return Context
is
No_Config : constant ID_Type := ID_Type (System.Null_Address);
No_Context : constant ID_Type := ID_Type (System.Null_Address);
function Convert is new Ada.Unchecked_Conversion (Flag_Bits, Int);
Flags_Mask : constant Flag_Bits :=
(Debug => Flags.Debug,
Forward => True,
Robust => Flags.Robust);
Attributes : constant Int_Array :=
(Major_Version, Int (Version.Major),
Minor_Version, Int (Version.Minor),
Context_Flags_Bits, Convert (Flags_Mask),
OpenGL_Profile_Mask, OpenGL_Core_Profile,
-- EGL 1.5
-- OpenGL_Debug, (if Flags.Debug then 1 else 0),
-- OpenGL_Forward_Compatible, 1,
-- OpenGL_Robust, (if Flags.Robust then 1 else 0),
OpenGL_Reset_Notification_Strategy,
(if Flags.Robust then Lose_Context_On_Reset else No_Reset_Notification));
-- Requires EGL_KHR_create_context or EGL 1.5
No_Error : constant Int_Array := (OpenGL_No_Error, 1);
No_Flush : constant Int_Array := (Context_Release_Behavior, Context_Release_Behavior_None);
Extensions : constant String_List := Display.Extensions;
begin
if not Boolean (API.Bind_API (OpenGL_API)) then
Errors.Raise_Exception_On_EGL_Error;
end if;
Check_Extension (Extensions, "EGL_KHR_create_context");
Check_Extension (Extensions, "EGL_KHR_no_config_context");
Check_Extension (Extensions, "EGL_KHR_surfaceless_context");
declare
Can_Have_No_Error : constant Boolean :=
Flags.No_Error and then Has_Extension (Extensions, "EGL_KHR_create_context_no_error");
Can_Have_Release_Context : constant Boolean :=
Has_Extension (Extensions, "EGL_KHR_context_flush_control");
ID : constant ID_Type :=
API.Create_Context (Display.ID, No_Config, No_Context,
Attributes &
(if Can_Have_No_Error then No_Error else (1 .. 0 => <>)) &
(if Can_Have_Release_Context then No_Flush else (1 .. 0 => <>)) &
None);
-- TODO Support shared context (replace No_Context with Shared_Context.ID)
begin
if ID = No_Context then
Errors.Raise_Exception_On_EGL_Error;
end if;
return Result : Context (Display.Platform) do
Result.Reference.ID := ID;
Result.Display := Display;
end return;
end;
end Create_Context;
function Buffer (Object : Context) return Buffer_Kind is
Result : Buffer_Kind;
begin
if not Boolean (API.Query_Context (Object.Display.ID, Object.ID, Render_Buffer, Result)) then
Errors.Raise_Exception_On_EGL_Error;
end if;
return Result;
end Buffer;
function Is_Current (Object : Context; Kind : Task_Kind) return Boolean is
begin
case Kind is
when Current_Task =>
return API.Get_Current_Context = Object.ID;
when Any_Task =>
return Object.Reference.Active;
end case;
end Is_Current;
procedure Make_Current (Object : Context) is
No_Surface : constant ID_Type := ID_Type (System.Null_Address);
begin
if not API.Make_Current (Object.Display.ID, No_Surface, No_Surface, Object.ID) then
Errors.Raise_Exception_On_EGL_Error;
end if;
Object.Reference.Active := True;
end Make_Current;
procedure Make_Current (Object : Context; Surface : Surfaces.Surface) is
begin
if not API.Make_Current (Object.Display.ID, Surface.ID, Surface.ID, Object.ID) then
Errors.Raise_Exception_On_EGL_Error;
end if;
Object.Reference.Active := True;
end Make_Current;
procedure Make_Not_Current (Object : Context) is
No_Context : constant ID_Type := ID_Type (System.Null_Address);
No_Surface : constant ID_Type := ID_Type (System.Null_Address);
begin
if not API.Make_Current (Object.Display.ID, No_Surface, No_Surface, No_Context) then
Errors.Raise_Exception_On_EGL_Error;
end if;
Object.Reference.Active := False;
end Make_Not_Current;
procedure Set_Swap_Interval (Object : Context; Value : Natural) is
begin
if not Boolean (API.Swap_Interval (Object.Display.ID, Int (Value))) then
Errors.Raise_Exception_On_EGL_Error;
end if;
end Set_Swap_Interval;
overriding procedure Pre_Finalize (Object : in out Context) is
No_Context : constant ID_Type := ID_Type (System.Null_Address);
begin
pragma Assert (Object.ID /= No_Context);
if Object.Is_Current (Current_Task) then
Object.Make_Not_Current;
end if;
if not Boolean (API.Destroy_Context (Object.Display.ID, Object.ID)) then
Errors.Raise_Exception_On_EGL_Error;
end if;
Object.Reference.ID := No_Context;
end Pre_Finalize;
end EGL.Objects.Contexts;
|
twinbee/lamportsBakery | Ada | 7,889 | adb | ----------------------------csc410/prog5/as5.adb----------------------------
-- Author: Matthew Bennett
-- Class: CSC410 Burgess
-- Date: 11-01-04 Modified: 11-01-04
-- Due: 11-7-04
-- Desc: Assignment 5: LAMPORT'S ALGORITHM FOR VIRTUAL TOPOLOGY NETWORKS
--
-- a nonproduction implementation of
-- LAMPORT's "bakery" algorithm which utilizes clocks (a 'ticketing' system
-- like in the bakery or at the dept of motor vehicles) to determine which
-- process may go into the critical section next.
--
-- LAMPORT implemented as described in
-- "Algorithms FOR Mutual Exclusion", M. Raynal
-- MIT PRESS Cambridge, 1986 ISBN: 0-262-18119-3
-- with additional revisions due to message passing across a virtual topology
----------------------------------------------------------------------------
-- Refactorings 10-05-04: (deNOTed @FIX@)
-- (4) linked list of processes instread of array
----------------------------------------------------------------
-- dependencies
WITH ADA.TEXT_IO; USE ADA.TEXT_IO;
WITH ADA.INTEGER_TEXT_IO; USE ADA.INTEGER_TEXT_IO;
WITH ADA.NUMERICS.FLOAT_RANDOM; USE ADA.NUMERICS.FLOAT_RANDOM;
WITH ADA.CALENDAR; -- (provides cast: natural -> time FOR input into delay)
WITH ADA.STRINGS; USE ADA.STRINGS;
PROCEDURE Main IS
G : Generator;
MAX_NEIGHBORS : Constant := 25;
TYPE RX_TASK;
TYPE RX_Ptr IS ACCESS RX_TASK;
TYPE Myarray IS ARRAY (0..MAX_NEIGHBORS) of Integer;
--this is needed bc anonymous types are not allowed in declarations
TYPE Node;
TYPE Node_Ptr IS ACCESS Node;
TYPE Node IS RECORD
m_Value : Integer;
Next : Node_Ptr := NULL;
Prev : Node_Ptr := NULL;
END RECORD;
TASKarray : ARRAY (0..MAX_NEIGHBORS) of RX_Ptr;
--keep up with tasks thrown off
PROCEDURE Enqueue (Head : IN OUT Node_Ptr;
Value : IN Integer) IS
Item : Node_Ptr;
BEGIN
Item := new Node;
Item.m_Value := Value;
IF (Head = NULL) THEN Head := Item;
ELSE -- Insert at the beginning
Item.Next := Head;
Head.Prev := Item;
Head := Item;
END IF;
END Enqueue;
PROCEDURE Dequeue(Head : IN out Node_Ptr; Value : out Integer) IS Curr : Node_Ptr;
BEGIN
Curr := Head;
IF (Head = NULL) THEN -- We have an empty queue
put ("Error : Empty Queue Encountered");
ELSE
WHILE (Curr.Next /= NULL) --iterate to end of list
LOOP
Curr := Curr.Next;
END LOOP;
IF (Curr.Prev = NULL) THEN Head := NULL;
ELSE Curr.Prev.Next := NULL; END IF;
Value := Curr.m_Value;
END IF;
END Dequeue;
FUNCTION IsEmpty (Head : Node_Ptr) RETURN Boolean IS
BEGIN
IF (Head = NULL) THEN RETURN TRUE;
ELSE RETURN FALSE; END IF;
END IsEmpty;
-- BEGIN Receive TASK Declaration --
TASK TYPE RX_TASK IS
ENTRY Start( myid : Integer; hold : Integer; Neighbor : Myarray);
ENTRY Send (mesgTYPE : Character; FromId : Integer; ToId : Integer);
END RX_TASK;
-- BEGIN Receive TASK Definition --
TASK BODY RX_TASK IS
Neighborarray : ARRAY (0..MAX_NEIGHBORS) of Integer;
HOLDER : Integer;
USING : Boolean := FALSE;
REQUEST_Q : Node_Ptr := NULL;
ASKED : Boolean := FALSE;
SELF : Integer;
TYPE Message;
TYPE Message_Ptr IS ACCESS Message;
TYPE Message IS RECORD
m_mesgTYPE : Character;
m_fromId : Integer;
m_toId : Integer;
Next,Prev : Message_Ptr := NULL;
END RECORD;
MESG_Q : Message_Ptr := NULL;
-- FUNCTIONs FOR Enqueuing AND Dequeuing a Message Queue --------------
PROCEDURE Message_Enqueue(
Head : IN OUT Message_Ptr;
mesgTYPE : Character;
fromId : Integer;
toId : Integer) IS
Item : Message_Ptr;
BEGIN
Item := new Message;
Item.m_mesgTYPE := mesgTYPE;
Item.m_fromId := fromId;
Item.m_toId := toId;
IF (Head = NULL) THEN -- We have an empty queue
Head := Item;
ELSE -- Insert at the beginning
Item.Next := Head;
Head.Prev := Item;
Head := Item;
END IF;
END Message_Enqueue;
PROCEDURE Message_Dequeue(
Head : IN out Message_Ptr;
tempMesg : out Message)
IS Curr : Message_Ptr;
BEGIN
Curr := Head;
IF (Head = NULL) THEN -- We have an empty queue
put ("Error : Empty Message Queue Encountered");
ELSE
WHILE (Curr.Next /= NULL) LOOP Curr := Curr.Next; END LOOP;
-- Curr should now point to the last element IN the list --
IF (Curr.Prev = NULL)
THEN Head := NULL;
ELSE Curr.Prev.Next := NULL;
END IF;
tempMesg.m_mesgTYPE := Curr.m_mesgTYPE;
tempMesg.m_fromId := Curr.m_fromId;
tempMesg.m_toId := Curr.m_toId;
END IF;
END Message_Dequeue;
FUNCTION Message_IsEmpty (Head : Message_Ptr) RETURN Boolean IS
BEGIN
IF (Head = NULL) THEN RETURN TRUE;
ELSE RETURN FALSE;
END IF;
END Message_IsEmpty;
-- FUNCTIONs FOR ASSIGN_PRIVILEGE AND MAKE REQUEST ---------
PROCEDURE ASSIGN_PRIVILEGE IS
BEGIN
IF (HOLDER = SELF) AND (NOT USING) AND (NOT IsEmpty(REQUEST_Q)) THEN
Dequeue(REQUEST_Q, HOLDER);
ASKED := FALSE;
IF HOLDER = SELF THEN
USING := TRUE;
-- Critical Section
Put (SELF, (1+(4*SELF))); Put (" IN CS"); New_Line;
delay (Standard.Duration(Random(G) * 4.0));
Put (SELF, (1+(4*SELF))); Put (" out CS"); New_Line;
ELSE
TASKarray(HOLDER).Send('P', SELF, HOLDER);
END IF;
END IF;
END ASSIGN_PRIVILEGE;
PROCEDURE MAKE_REQUEST IS
BEGIN
IF (HOLDER /= SELF) AND (NOT IsEmpty(REQUEST_Q)) AND (NOT ASKED) THEN
TASKarray(HOLDER).Send('R', SELF, HOLDER);
ASKED := TRUE;
END IF;
END MAKE_REQUEST;
TASK TYPE AL_TASK IS END AL_TASK;
TASK BODY AL_TASK IS
currMessage : Message;
BEGIN
LOOP
-- Only attempt to enter the critical section 35% of time
IF ((Random(g) * 10.0) > 7.0) THEN
Delay (Standard.Duration(Random(G) * 3.0));
-- Node wishes to enter the critical Section --
Enqueue(REQUEST_Q, SELF);
ASSIGN_PRIVILEGE;
MAKE_REQUEST;
-- Node exits the critical section --
USING := FALSE;
ASSIGN_PRIVILEGE;
MAKE_REQUEST;
END IF;
-- Process any messages IN the message queue --
IF (NOT Message_IsEmpty(MESG_Q)) THEN
Message_Dequeue(MESG_Q, currMessage);
case currMessage.m_mesgTYPE IS
WHEN 'P' =>
BEGIN
HOLDER := SELF;
ASSIGN_PRIVILEGE;
MAKE_REQUEST;
END;
WHEN 'R' =>
BEGIN
Enqueue(REQUEST_Q, currMessage.m_FromId);
ASSIGN_PRIVILEGE;
MAKE_REQUEST;
END;
WHEN Others => NULL; --make ada happy
END Case;
ELSE -- We delay a bit longer, as to let others through
Delay (Standard.Duration(Random(G) * 6.0));
END IF;
END LOOP;
END AL_TASK;
TYPE AL_Ptr IS ACCESS AL_TASK;
aPtr : AL_Ptr;
--------------------------------------------------------------
-- BEGIN THE RECEIEVE TASK DEFINITION --
BEGIN
-- ACCEPT creation messages --
ACCEPT Start(
myid : Integer;
hold : Integer;
Neighbor : Myarray)
DO
FOR I IN Neighbor'First..Neighbor'Last
LOOP
Neighborarray(I) := Neighbor(I);
END LOOP;
HOLDER := hold;
SELF := myid;
END Start;
aPtr := new AL_TASK; -- Start Algorithm LOOP
-- Start Message Receiving LOOP --
LOOP
ACCEPT Send (mesgTYPE : Character; FromId : Integer; ToId : Integer)
DO
Message_Enqueue (MESG_Q,mesgTYPE, fromId, ToId);
put (SELF, (1+(4*SELF)));
IF (MesgTYPE = 'P') THEN put (" Priv ");
ELSE put (" Request "); END IF;
Put (FromId, 0);
Put (","); Put (ToId,0); New_Line;
END Send;
END LOOP; -- RX LOOP
END RX_TASK;
PROCEDURE Driver IS
infile : FILE_TYPE; --ada.standard.textIO type for reading ascii and iso-8XXX
taskId : Integer;
holder : Integer;
neighArray : myArray;
neighCount : Integer := 0;
BEGIN
Open (inFile, IN_FILE, "input.txt");
--open as read only ascii and use reference infile
--file format is: nodeID neighbor neighbor neighbor ...neighbor[MAX_NEIGHBORS]
WHILE NOT END_OF_FILE(infile)
LOOP
Get(infile, TASKId);
Get(infile, Holder);
WHILE NOT END_OF_LINE(infile) --there are neighbors coming on the line
LOOP
Get( infile, neighArray(neighCount) );
neighCount := neighCount + 1;
END LOOP;
TASKarray(TASKId) := new RX_TASK;
TASKarray(TASKId).Start(taskId, holder, neighArray);
END LOOP;
END Driver;
BEGIN Driver; END Main;
|
Asier98/AdaCar | Ada | 1,730 | adb | --------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----------- Programa que prueba el paquete Organizador_Movimiento --------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Se simulan lecturas de distancias pequeñas y grandes. Para comprobar el
-- correcto funcionaminto del paquete se revisan, en base a esas distancias,
-- las señales de salida generadas en los canales relacionados con los motores.
with AdaCar; use AdaCar;
with Ada.Real_Time; use type Ada.Real_Time.Time; use Ada;
with AdaCar.Entrada_Salida;
with AdaCar.Organizador_Movimiento;
with AdaCar.Parametros;
procedure Prueba_Organizador_Movimiento is
Pines_Inicializados: Boolean:= False;
Distancia_Muy_Pequenha: constant Unidades_Distancia:=
Parametros.Distancia_Minima - Unidades_Distancia(5.0);
Distancia_Grande: constant Unidades_Distancia:=
Parametros.Distancia_Minima + Unidades_Distancia(10.0);
Tiempo: constant Duration:= Duration(3.0);
Periodo: constant Real_Time.Time_Span:= Real_Time.To_Time_Span(Tiempo);
Next: Real_Time.Time:= Real_Time.Clock;
begin
Pines_Inicializados:= Entrada_Salida.Init_System;
if Pines_Inicializados then
loop
Organizador_Movimiento.Nueva_Distancia_Sensor(Distancia_Muy_Pequenha);
Next:= Next+Periodo;
delay until Next;
Organizador_Movimiento.Nueva_Distancia_Sensor(Distancia_Grande);
Next:= Next+Periodo;
delay until Next;
end loop;
end if;
end Prueba_Organizador_Movimiento;
|
gerr135/kdevelop_templates | Ada | 203 | adb | {% load kdev_filters %}
{% block license_header %}
{% if license %}
--
{{ license|lines_prepend:"-- " }}
--
{% endif %}
{% endblock license_header %}
procedure {{ name }} is
begin
end {{ name }};
|
reznikmm/matreshka | Ada | 3,987 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Chart_Minimum_Attributes;
package Matreshka.ODF_Chart.Minimum_Attributes is
type Chart_Minimum_Attribute_Node is
new Matreshka.ODF_Chart.Abstract_Chart_Attribute_Node
and ODF.DOM.Chart_Minimum_Attributes.ODF_Chart_Minimum_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Chart_Minimum_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Chart_Minimum_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Chart.Minimum_Attributes;
|
tj800x/SPARKNaCl | Ada | 456 | adb | with Ada.Numerics.Discrete_Random;
package body Random
with SPARK_Mode => Off
is
pragma Compile_Time_Warning
(True, "This PRNG is not cryptographically secure.");
package PRNG is new Ada.Numerics.Discrete_Random (Interfaces.Unsigned_8);
Gen : PRNG.Generator;
function Random_Byte return Interfaces.Unsigned_8
is
begin
return PRNG.Random (Gen);
end Random_Byte;
begin
PRNG.Reset (Gen); -- time dependent
end Random;
|
AdaCore/Ada_Drivers_Library | Ada | 9,171 | ads | -- This spec has been automatically generated from STM32F7x9.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.PWR is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR1_PLS_Field is HAL.UInt3;
subtype CR1_VOS_Field is HAL.UInt2;
subtype CR1_UDEN_Field is HAL.UInt2;
-- power control register
type CR1_Register is record
-- Low-power deep sleep
LPDS : Boolean := False;
-- Power down deepsleep
PDDS : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- Clear standby flag
CSBF : Boolean := False;
-- Power voltage detector enable
PVDE : Boolean := False;
-- PVD level selection
PLS : CR1_PLS_Field := 16#0#;
-- Disable backup domain write protection
DBP : Boolean := False;
-- Flash power down in Stop mode
FPDS : Boolean := False;
-- Low-power regulator in deepsleep under-drive mode
LPUDS : Boolean := False;
-- Main regulator in deepsleep under-drive mode
MRUDS : Boolean := False;
-- unspecified
Reserved_12_12 : HAL.Bit := 16#0#;
-- ADCDC1
ADCDC1 : Boolean := False;
-- Regulator voltage scaling output selection
VOS : CR1_VOS_Field := 16#3#;
-- Over-drive enable
ODEN : Boolean := False;
-- Over-drive switching enabled
ODSWEN : Boolean := False;
-- Under-drive enable in stop mode
UDEN : CR1_UDEN_Field := 16#0#;
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR1_Register use record
LPDS at 0 range 0 .. 0;
PDDS at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
CSBF at 0 range 3 .. 3;
PVDE at 0 range 4 .. 4;
PLS at 0 range 5 .. 7;
DBP at 0 range 8 .. 8;
FPDS at 0 range 9 .. 9;
LPUDS at 0 range 10 .. 10;
MRUDS at 0 range 11 .. 11;
Reserved_12_12 at 0 range 12 .. 12;
ADCDC1 at 0 range 13 .. 13;
VOS at 0 range 14 .. 15;
ODEN at 0 range 16 .. 16;
ODSWEN at 0 range 17 .. 17;
UDEN at 0 range 18 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
subtype CSR1_UDRDY_Field is HAL.UInt2;
-- power control/status register
type CSR1_Register is record
-- Read-only. Wakeup internal flag
WUIF : Boolean := False;
-- Read-only. Standby flag
SBF : Boolean := False;
-- Read-only. PVD output
PVDO : Boolean := False;
-- Read-only. Backup regulator ready
BRR : Boolean := False;
-- unspecified
Reserved_4_8 : HAL.UInt5 := 16#0#;
-- Backup regulator enable
BRE : Boolean := False;
-- unspecified
Reserved_10_13 : HAL.UInt4 := 16#0#;
-- Regulator voltage scaling output selection ready bit
VOSRDY : Boolean := False;
-- unspecified
Reserved_15_15 : HAL.Bit := 16#0#;
-- Over-drive mode ready
ODRDY : Boolean := False;
-- Over-drive mode switching ready
ODSWRDY : Boolean := False;
-- Under-drive ready flag
UDRDY : CSR1_UDRDY_Field := 16#0#;
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CSR1_Register use record
WUIF at 0 range 0 .. 0;
SBF at 0 range 1 .. 1;
PVDO at 0 range 2 .. 2;
BRR at 0 range 3 .. 3;
Reserved_4_8 at 0 range 4 .. 8;
BRE at 0 range 9 .. 9;
Reserved_10_13 at 0 range 10 .. 13;
VOSRDY at 0 range 14 .. 14;
Reserved_15_15 at 0 range 15 .. 15;
ODRDY at 0 range 16 .. 16;
ODSWRDY at 0 range 17 .. 17;
UDRDY at 0 range 18 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- CR2_CWUPF array
type CR2_CWUPF_Field_Array is array (1 .. 6) of Boolean
with Component_Size => 1, Size => 6;
-- Type definition for CR2_CWUPF
type CR2_CWUPF_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- CWUPF as a value
Val : HAL.UInt6;
when True =>
-- CWUPF as an array
Arr : CR2_CWUPF_Field_Array;
end case;
end record
with Unchecked_Union, Size => 6;
for CR2_CWUPF_Field use record
Val at 0 range 0 .. 5;
Arr at 0 range 0 .. 5;
end record;
-- CR2_WUPP array
type CR2_WUPP_Field_Array is array (1 .. 6) of Boolean
with Component_Size => 1, Size => 6;
-- Type definition for CR2_WUPP
type CR2_WUPP_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- WUPP as a value
Val : HAL.UInt6;
when True =>
-- WUPP as an array
Arr : CR2_WUPP_Field_Array;
end case;
end record
with Unchecked_Union, Size => 6;
for CR2_WUPP_Field use record
Val at 0 range 0 .. 5;
Arr at 0 range 0 .. 5;
end record;
-- power control register
type CR2_Register is record
-- Read-only. Clear Wakeup Pin flag for PA0
CWUPF : CR2_CWUPF_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
-- Wakeup pin polarity bit for PA0
WUPP : CR2_WUPP_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_14_31 : HAL.UInt18 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register use record
CWUPF at 0 range 0 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
WUPP at 0 range 8 .. 13;
Reserved_14_31 at 0 range 14 .. 31;
end record;
-- CSR2_WUPF array
type CSR2_WUPF_Field_Array is array (1 .. 6) of Boolean
with Component_Size => 1, Size => 6;
-- Type definition for CSR2_WUPF
type CSR2_WUPF_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- WUPF as a value
Val : HAL.UInt6;
when True =>
-- WUPF as an array
Arr : CSR2_WUPF_Field_Array;
end case;
end record
with Unchecked_Union, Size => 6;
for CSR2_WUPF_Field use record
Val at 0 range 0 .. 5;
Arr at 0 range 0 .. 5;
end record;
-- CSR2_EWUP array
type CSR2_EWUP_Field_Array is array (1 .. 6) of Boolean
with Component_Size => 1, Size => 6;
-- Type definition for CSR2_EWUP
type CSR2_EWUP_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- EWUP as a value
Val : HAL.UInt6;
when True =>
-- EWUP as an array
Arr : CSR2_EWUP_Field_Array;
end case;
end record
with Unchecked_Union, Size => 6;
for CSR2_EWUP_Field use record
Val at 0 range 0 .. 5;
Arr at 0 range 0 .. 5;
end record;
-- power control/status register
type CSR2_Register is record
-- Read-only. Wakeup Pin flag for PA0
WUPF : CSR2_WUPF_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
-- Enable Wakeup pin for PA0
EWUP : CSR2_EWUP_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_14_31 : HAL.UInt18 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CSR2_Register use record
WUPF at 0 range 0 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
EWUP at 0 range 8 .. 13;
Reserved_14_31 at 0 range 14 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Power control
type PWR_Peripheral is record
-- power control register
CR1 : aliased CR1_Register;
-- power control/status register
CSR1 : aliased CSR1_Register;
-- power control register
CR2 : aliased CR2_Register;
-- power control/status register
CSR2 : aliased CSR2_Register;
end record
with Volatile;
for PWR_Peripheral use record
CR1 at 16#0# range 0 .. 31;
CSR1 at 16#4# range 0 .. 31;
CR2 at 16#8# range 0 .. 31;
CSR2 at 16#C# range 0 .. 31;
end record;
-- Power control
PWR_Periph : aliased PWR_Peripheral
with Import, Address => System'To_Address (16#40007000#);
end STM32_SVD.PWR;
|
reznikmm/gela | Ada | 14,396 | adb | ------------------------------------------------------------------------------
-- G E L A G R A M M A R S --
-- Library for dealing with grammars for Gela project, --
-- a portable Ada compiler --
-- http://gela.ada-ru.org/ --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license in gela.ads file --
------------------------------------------------------------------------------
with AG_Tools.Writers;
with Anagram.Grammars.Ordered;
package body AG_Tools.Part_Generators is
Tail : constant League.Strings.Universal_String :=
League.Strings.To_Universal_String ("tail");
This : constant League.Strings.Universal_String :=
League.Strings.To_Universal_String ("This");
function Origin
(G : Anagram.Grammars.Grammar;
Attribute : Anagram.Grammars.Attribute)
return League.Strings.Universal_String;
------------------
-- Make_Descent --
------------------
overriding procedure Make_Descent
(Self : access Generator;
Part : Anagram.Grammars.Part_Index;
Pass : Positive)
is
P : Anagram.Grammars.Part renames Self.Context.Grammar.Part (Part);
NT : Anagram.Grammars.Non_Terminal renames
Self.Context.Grammar.Non_Terminal (P.Denote);
Code : AG_Tools.Writers.Writer renames Self.Context.Code;
begin
Generator'Class (Self.all).Make_Local_Variable (Part);
Code.N (" ");
Code.N (To_Ada (NT.Name));
Code.N ("_");
Code.N (Pass);
Code.P;
Code.N (" (Self, ");
Code.N (To_Ada (P.Name));
Code.P (");");
end Make_Descent;
------------------
-- Make_Descent --
------------------
overriding procedure Make_Descent
(Self : access Option_Generator;
Part : Anagram.Grammars.Part_Index;
Pass : Positive)
is
P : Anagram.Grammars.Part renames Self.Context.Grammar.Part (Part);
Code : AG_Tools.Writers.Writer renames Self.Context.Code;
begin
Self.Make_Local_Variable (Part);
Code.N (" if Assigned (");
Code.N (To_Ada (P.Name));
Code.P (") then");
Generator (Self.all).Make_Descent (Part, Pass);
Code.P (" end if;");
end Make_Descent;
------------------
-- Make_Descent --
------------------
overriding procedure Make_Descent
(Self : access List_Generator;
Part : Anagram.Grammars.Part_Index;
Pass : Positive)
is
G : Anagram.Grammars.Grammar renames Self.Context.Grammar.all;
P : Anagram.Grammars.Part renames Self.Context.Grammar.Part (Part);
Code : AG_Tools.Writers.Writer renames Self.Context.Code;
NT : Anagram.Grammars.Non_Terminal renames G.Non_Terminal (P.Denote);
Parts : Anagram.Grammars.Ordered.Partition_Array renames
Self.Context.Partition.all (NT.First_Attribute .. NT.Last_Attribute);
begin
Self.Make_Local_Variable (Part);
Code.N (" -- Make_Descent LIST ");
Code.N (Pass);
Code.P;
Code.N (" ");
Code.N (To_Ada (P.Name));
Code.N ("_");
Code.N (Pass);
Code.N (" (Self, ");
Code.N (To_Ada (P.Name));
for J in NT.First_Attribute .. NT.Last_Attribute loop
if Anagram.Grammars.Ordered.To_Pass (Parts, J) = Pass then
Self.Make_Local_Variable
(P.Name, G.Declaration (J));
Code.N (", ");
Code.N (To_Ada (P.Name));
Code.N ("_");
Code.N (To_Ada (G.Declaration (J).Name));
end if;
end loop;
Code.P (");");
end Make_Descent;
------------------
-- Make_Descent --
------------------
overriding procedure Make_Descent
(Self : access Head_Generator;
Part : Anagram.Grammars.Part_Index;
Pass : Positive)
is
G : Anagram.Grammars.Grammar renames Self.Context.Grammar.all;
P : Anagram.Grammars.Part renames Self.Context.Grammar.Part (Part);
Code : AG_Tools.Writers.Writer renames Self.Context.Code;
NT : Anagram.Grammars.Non_Terminal renames G.Non_Terminal (P.Denote);
Parts : Anagram.Grammars.Ordered.Partition_Array renames
Self.Context.Partition.all (NT.First_Attribute .. NT.Last_Attribute);
begin
-- Self.Make_Local_Variable (Part);
Code.N (" -- Make_Descent HEAD ");
Code.N (Pass);
Code.P;
Code.N (" Descent");
Code.N (" (This");
for J in NT.First_Attribute .. NT.Last_Attribute loop
if Anagram.Grammars.Ordered.To_Pass (Parts, J) = Pass then
Self.Make_Local_Variable
(P.Name, G.Declaration (J));
Code.N (", ");
Code.N (To_Ada (P.Name));
Code.N ("_");
Code.N (To_Ada (G.Declaration (J).Name));
end if;
end loop;
Code.P (");");
end Make_Descent;
--------------
-- Make_Get --
--------------
overriding procedure Make_Get
(Self : access Generator;
Attribute : Anagram.Grammars.Attribute;
Template : Anagram.Grammars.Rule_Templates.Rule_Template)
is
pragma Unreferenced (Template);
G : Anagram.Grammars.Grammar renames Self.Context.Grammar.all;
Origin : League.Strings.Universal_String;
Code : AG_Tools.Writers.Writer renames Self.Context.Code;
D : Anagram.Grammars.Attribute_Declaration renames
G.Declaration (Attribute.Declaration);
begin
Generator'Class (Self.all).Make_Local_Variable (Attribute.Origin);
Origin := To_Ada (G.Part (Attribute.Origin).Name);
Code.N (" ");
Code.N (Origin);
Code.N ("_");
Code.N (To_Ada (D.Name));
Code.P (" :=");
Code.N (" ");
Code.N (Origin);
if G.Part (Attribute.Origin).Is_Non_Terminal_Reference then
Code.N (".");
Code.N (To_Ada (D.Name));
end if;
Code.P (";");
Generator'Class (Self.all).Make_Local_Variable (Origin, D);
end Make_Get;
--------------
-- Make_Get --
--------------
overriding procedure Make_Get
(Self : access Head_Generator;
Attribute : Anagram.Grammars.Attribute;
Template : Anagram.Grammars.Rule_Templates.Rule_Template)
is
pragma Unreferenced (Template);
G : Anagram.Grammars.Grammar renames Self.Context.Grammar.all;
Code : AG_Tools.Writers.Writer renames Self.Context.Code;
D : Anagram.Grammars.Attribute_Declaration renames
G.Declaration (Attribute.Declaration);
begin
Self.Make_Local_Variable (Tail, D);
Code.P (" -- Make_Get tail");
end Make_Get;
--------------
-- Make_Get --
--------------
overriding procedure Make_Get
(Self : access List_Generator;
Attribute : Anagram.Grammars.Attribute;
Template : Anagram.Grammars.Rule_Templates.Rule_Template)
is
pragma Unreferenced (Template);
G : Anagram.Grammars.Grammar renames Self.Context.Grammar.all;
Code : AG_Tools.Writers.Writer renames Self.Context.Code;
begin
Code.P (" -- Make_Get LIST");
Self.Make_Local_Variable
(Origin (G, Attribute),
G.Declaration (Attribute.Declaration));
end Make_Get;
--------------
-- Make_Get --
--------------
overriding procedure Make_Get
(Self : access Option_Generator;
Attribute : Anagram.Grammars.Attribute;
Template : Anagram.Grammars.Rule_Templates.Rule_Template)
is
use type League.Strings.Universal_String;
G : Anagram.Grammars.Grammar renames Self.Context.Grammar.all;
Code : AG_Tools.Writers.Writer renames Self.Context.Code;
Part : constant League.Strings.Universal_String :=
G.Part (Attribute.Origin).Name;
Origin : constant League.Strings.Universal_String := To_Ada (Part);
Attr : constant League.Strings.Universal_String :=
G.Declaration (Attribute.Declaration).Name;
begin
Code.N (" if Assigned (");
Code.N (Origin);
Code.P (") then");
Generator (Self.all).Make_Get (Attribute, Template);
for J in 1 .. Template.Count loop
if Template.Part_Name (J) = Part and then
Template.Attribute_Name (J) = Attr and then
Template.Has_Default (J)
then
Code.P (" else");
Code.N (" ");
Code.N (Origin);
Code.N ("_");
Code.N (To_Ada (Attr));
Code.N (" := ");
Code.N (Template.Default (J));
Code.P (";");
end if;
end loop;
Code.P (" end if;");
end Make_Get;
-------------------------
-- Make_Local_Variable --
-------------------------
overriding procedure Make_Local_Variable
(Self : access Generator;
Origin : League.Strings.Universal_String;
Attribute : Anagram.Grammars.Attribute_Declaration)
is
Impl : AG_Tools.Writers.Writer renames Self.Context.Impl;
Attr : constant AG_Tools.Contexts.Attr := (Origin, Attribute.Index);
begin
if Self.Context.Attr_Map.Contains (Attr) then
return;
else
Self.Context.Attr_Map.Insert (Attr);
end if;
Impl.N (" ");
Impl.N (To_Ada (Origin));
Impl.N ("_");
Impl.N (To_Ada (Attribute.Name));
Impl.N (" : ");
Impl.N (To_Ada (Attribute.Type_Name));
Impl.P (";");
Self.Context.Add_With (Package_Name (To_Ada (Attribute.Type_Name)));
end Make_Local_Variable;
-------------------------
-- Make_Local_Variable --
-------------------------
overriding procedure Make_Local_Variable
(Self : access Generator;
Part : Anagram.Grammars.Part_Index)
is
G : Anagram.Grammars.Grammar renames Self.Context.Grammar.all;
P : Anagram.Grammars.Part renames G.Part (Part);
Impl : AG_Tools.Writers.Writer renames Self.Context.Impl;
Prod : Anagram.Grammars.Production renames G.Production (P.Parent);
NT : Anagram.Grammars.Non_Terminal renames
G.Non_Terminal (Prod.Parent);
RT : constant League.Strings.Universal_String := Return_Type (G, P);
begin
if not Self.Context.Part_Map (Part) then
Self.Context.Part_Map (Part) := True;
Self.Context.Add_With (Package_Name (RT));
Impl.N (" ");
Impl.N (To_Ada (P.Name));
if Is_Converted_List (G, NT) then
Impl.N (" : ");
Impl.N (Return_Type (G, P));
Impl.P ("_Access;");
else
Impl.N (" : constant ");
Impl.N (RT);
if not P.Is_Terminal_Reference then
Impl.N ("_Access");
end if;
Impl.P (" :=");
Impl.N (" ");
Impl.N (This);
Impl.N (".");
Impl.N (To_Ada (P.Name));
Impl.P (";");
end if;
end if;
end Make_Local_Variable;
--------------
-- Make_Set --
--------------
overriding procedure Make_Set
(Self : access Generator;
Attribute : Anagram.Grammars.Attribute)
is
G : Anagram.Grammars.Grammar renames Self.Context.Grammar.all;
Origin : League.Strings.Universal_String;
Code : AG_Tools.Writers.Writer renames Self.Context.Code;
D : Anagram.Grammars.Attribute_Declaration renames
G.Declaration (Attribute.Declaration);
begin
Generator'Class (Self.all).Make_Local_Variable (Attribute.Origin);
Code.N (" ");
Origin := To_Ada (G.Part (Attribute.Origin).Name);
Code.N (Origin);
Code.N (".Set_");
Code.P (To_Ada (D.Name));
Code.N (" (");
Code.N (Origin);
Code.N ("_");
Code.N (To_Ada (D.Name));
Code.P (");");
Generator'Class (Self.all).Make_Local_Variable (Origin, D);
end Make_Set;
--------------
-- Make_Set --
--------------
overriding procedure Make_Set
(Self : access Head_Generator;
Attribute : Anagram.Grammars.Attribute)
is
G : Anagram.Grammars.Grammar renames Self.Context.Grammar.all;
Code : AG_Tools.Writers.Writer renames Self.Context.Code;
D : Anagram.Grammars.Attribute_Declaration renames
G.Declaration (Attribute.Declaration);
begin
Self.Make_Local_Variable (Tail, D);
Code.P (" -- Make_Set tail");
end Make_Set;
--------------
-- Make_Set --
--------------
overriding procedure Make_Set
(Self : access List_Generator;
Attribute : Anagram.Grammars.Attribute)
is
G : Anagram.Grammars.Grammar renames Self.Context.Grammar.all;
Code : AG_Tools.Writers.Writer renames Self.Context.Code;
begin
Code.P (" -- Make_Set LIST");
Self.Make_Local_Variable
(Origin (G, Attribute),
G.Declaration (Attribute.Declaration));
end Make_Set;
--------------
-- Make_Set --
--------------
overriding procedure Make_Set
(Self : access Option_Generator;
Attribute : Anagram.Grammars.Attribute)
is
G : Anagram.Grammars.Grammar renames Self.Context.Grammar.all;
Origin : League.Strings.Universal_String;
Code : AG_Tools.Writers.Writer renames Self.Context.Code;
begin
Origin := To_Ada (G.Part (Attribute.Origin).Name);
Code.N (" if Assigned (");
Code.N (Origin);
Code.P (") then");
Generator (Self.all).Make_Set (Attribute);
Code.P (" end if;");
end Make_Set;
------------
-- Origin --
------------
function Origin
(G : Anagram.Grammars.Grammar;
Attribute : Anagram.Grammars.Attribute)
return League.Strings.Universal_String
is
Rule : Anagram.Grammars.Rule renames G.Rule (Attribute.Parent);
Prod : Anagram.Grammars.Production renames G.Production (Rule.Parent);
NT : Anagram.Grammars.Non_Terminal renames
G.Non_Terminal (Prod.Parent);
begin
if Attribute.Is_Left_Hand_Side then
return NT.Name;
else
return G.Part (Attribute.Origin).Name;
end if;
end Origin;
end AG_Tools.Part_Generators;
|
stcarrez/ada-asf | Ada | 1,106 | ads | -----------------------------------------------------------------------
-- core-factory -- Factory for UI Core Components
-- Copyright (C) 2009, 2010, 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 ASF.Factory;
package ASF.Components.Core.Factory is
-- Register the Core component factory.
procedure Register (Factory : in out ASF.Factory.Component_Factory);
end ASF.Components.Core.Factory;
|
stcarrez/helios | Ada | 5,459 | adb | -----------------------------------------------------------------------
-- helios-monitor -- Helios monitor
-- Copyright (C) 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Properties.Basic;
with Util.Log.Loggers;
package body Helios.Monitor is
use type Helios.Schemas.Value_Index;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Helios.Monitor");
List : Agent_Type_Access;
-- ------------------------------
-- The timer handler executed when the timer deadline has passed.
-- ------------------------------
overriding
procedure Time_Handler (Agent : in out Agent_Type;
Event : in out Util.Events.Timers.Timer_Ref'Class) is
Data : Helios.Datas.Snapshot_Type_Access;
begin
Log.Debug ("Running agent {0}", Agent.Node.Name);
Helios.Datas.Prepare (Agent.Data, Data);
Agent_Type'Class (Agent).Collect (Data.all);
Event.Repeat (Agent.Period);
Helios.Datas.Finish (Data.all);
end Time_Handler;
-- ------------------------------
-- Create a new definition with the given name. The filter parameter allows to control
-- which definition values are really needed. The "*" indicates that all values are required.
-- Otherwise, it is a comma separated list of strings. A null definition is returned if
-- the filter does not contain the definition name.
-- ------------------------------
function Create_Definition (Agent : in Agent_Type;
Name : in String;
Filter : in String := "*") return Schemas.Definition_Type_Access is
begin
return Schemas.Create_Definition (Agent.Node, Name, Filter);
end Create_Definition;
-- ------------------------------
-- Add a definition to the agent.
-- ------------------------------
procedure Add_Definition (Agent : in out Agent_Type;
Def : in Schemas.Definition_Type_Access) is
begin
Schemas.Add_Definition (Agent.Node, Def);
end Add_Definition;
-- ------------------------------
-- Find a child definition with the given name.
-- Returns null if there is no such definition.
-- ------------------------------
function Find_Definition (Agent : in Agent_Type;
Name : in String) return Schemas.Definition_Type_Access is
use type Schemas.Definition_Type_Access;
begin
if Agent.Node = null or else Agent.Node.Child = null then
return null;
else
return Schemas.Find_Definition (Agent.Node.Child, Name);
end if;
end Find_Definition;
-- ------------------------------
-- Register the agent.
-- ------------------------------
procedure Register (Agent : in Agent_Type_Access;
Name : in String;
Config : in Util.Properties.Manager) is
begin
Log.Info ("Register agent {0}", Name);
Agent.Period := Get_Period (Config, "period", 1);
Agent.Node := Schemas.Create_Definition (null, Name, "*", Schemas.V_NONE);
Agent.Start (Config);
if Agent.Node.Index > 0 then
Agent.Next := List;
List := Agent;
end if;
end Register;
-- ------------------------------
-- Get the current report and prepare the plugin agents for a new snapshot.
-- ------------------------------
function Get_Report return Helios.Datas.Report_Queue_Type is
procedure Flush (Agent : in out Agent_Type'Class);
procedure Flush (Agent : in out Agent_Type'Class) is
begin
Helios.Datas.Flush (Agent.Data);
end Flush;
begin
Iterate (Flush'Access);
return Helios.Datas.Get_Report;
end Get_Report;
-- ------------------------------
-- Iterate over the plugin agents that are registered and execute
-- the <tt>Process</tt> procedure.
-- ------------------------------
procedure Iterate (Process : not null access procedure (Agent : in out Agent_Type'Class)) is
Agent : Agent_Type_Access := List;
begin
while Agent /= null loop
Process (Agent.all);
Agent := Agent.Next;
end loop;
end Iterate;
-- ------------------------------
-- Get a period configuration parameter.
-- ------------------------------
function Get_Period (Config : in Util.Properties.Manager;
Name : in String;
Default : in Natural) return Ada.Real_Time.Time_Span is
Period : Integer
:= Util.Properties.Basic.Integer_Property.Get (Config, Name, Default);
begin
if Period <= 0 then
Period := Default;
end if;
return Ada.Real_Time.Seconds (Period);
end Get_Period;
end Helios.Monitor;
|
reznikmm/matreshka | Ada | 4,768 | 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_Style.Register_Truth_Ref_Style_Name_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Register_Truth_Ref_Style_Name_Attribute_Node is
begin
return Self : Style_Register_Truth_Ref_Style_Name_Attribute_Node do
Matreshka.ODF_Style.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Style_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Style_Register_Truth_Ref_Style_Name_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Register_Truth_Ref_Style_Name_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Style_URI,
Matreshka.ODF_String_Constants.Register_Truth_Ref_Style_Name_Attribute,
Style_Register_Truth_Ref_Style_Name_Attribute_Node'Tag);
end Matreshka.ODF_Style.Register_Truth_Ref_Style_Name_Attributes;
|
AaronC98/PlaneSystem | Ada | 2,526 | ads | ------------------------------------------------------------------------------
-- Templates Parser --
-- --
-- Copyright (C) 2004-2012, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
package Templates_Parser.Debug is
procedure Print (T : Tag);
-- Print tag representation
procedure Print_Tree (Filename : String; Expand_Macro : Boolean := False);
-- Print tree for template Filename
procedure Print_Defined_Macros;
-- Print all defined macros
end Templates_Parser.Debug;
|
mitchelhaan/ncurses | Ada | 3,885 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms.Field_Types.Alpha --
-- --
-- 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.3 $
-- Binding Version 00.93
------------------------------------------------------------------------------
with Interfaces.C;
with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
package body Terminal_Interface.Curses.Forms.Field_Types.Alpha is
use type Interfaces.C.Int;
procedure Set_Field_Type (Fld : in Field;
Typ : in Alpha_Field)
is
C_Alpha_Field_Type : C_Field_Type;
pragma Import (C, C_Alpha_Field_Type, "TYPE_ALPHA");
function Set_Fld_Type (F : Field := Fld;
Cft : C_Field_Type := C_Alpha_Field_Type;
Arg1 : C_Int) return C_Int;
pragma Import (C, Set_Fld_Type, "set_field_type");
Res : Eti_Error;
begin
Res := Set_Fld_Type (Arg1 => C_Int (Typ.Minimum_Field_Width));
if Res /= E_Ok then
Eti_Exception (Res);
end if;
Wrap_Builtin (Fld, Typ);
end Set_Field_Type;
end Terminal_Interface.Curses.Forms.Field_Types.Alpha;
|
Heziode/lsystem-editor | Ada | 8,648 | adb | -------------------------------------------------------------------------------
-- LSE -- L-System Editor
-- Author: Heziode
--
-- License:
-- MIT License
--
-- Copyright (c) 2018 Quentin Dauprat (Heziode) <[email protected]>
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------------
with Ada.Command_Line;
with Ada.Text_IO;
with GNAT.Command_Line;
with GNAT.Directory_Operations;
with GNAT.Strings;
with LSE.Model.IO.Drawing_Area.Drawing_Area_Ptr;
with LSE.Model.IO.Drawing_Area_Factory;
with LSE.Model.IO.Text_File;
with LSE.Model.IO.Turtle;
with LSE.Model.IO.Turtle_Utils;
with LSE.Model.L_System.Concrete_Builder;
with LSE.Model.L_System.L_System;
with LSE.Presenter.Presenter;
with LSE.View.View;
use Ada.Command_Line;
use Ada.Text_IO;
use GNAT.Command_Line;
use GNAT.Directory_Operations;
use GNAT.Strings;
use LSE.Model.IO.Drawing_Area.Drawing_Area_Ptr;
use LSE.Model.IO.Drawing_Area_Factory;
use LSE.Model.IO.Text_File;
use LSE.Model.IO.Turtle;
use LSE.Model.IO.Turtle_Utils;
use LSE.Model.L_System.Concrete_Builder;
use LSE.Model.L_System.L_System;
use LSE.Presenter.Presenter;
use LSE.View.View;
-- @description
-- Entry point of the app
--
procedure Main is
Main_UI : constant String := "ressources/view.glade";
pragma Unreferenced (Main_UI);
Exec_Dir : constant String := Dir_Name (Command_Name);
pragma Unreferenced (Exec_Dir);
No_Input_File : exception;
No_Export_File : exception;
No_Export : exception;
No_Develop : exception;
LS_Creation : exception;
Config : Command_Line_Configuration;
No_GUI : aliased Boolean := False;
Input_File : aliased String_Access;
Output_File : aliased String_Access;
Export : aliased String_Access;
Export_File : aliased String_Access;
Develop : aliased Integer := 0;
Width : aliased Integer := 0;
Height : aliased Integer := 0;
Background_Color : aliased String_Access;
Foreground_Color : aliased String_Access;
Margin_Top : aliased Integer := 0;
Margin_Right : aliased Integer := 0;
Margin_Bottom : aliased Integer := 0;
Margin_Left : aliased Integer := 0;
T : LSE.Model.IO.Turtle_Utils.Holder;
B : LSE.Model.L_System.Concrete_Builder.Instance;
L : LSE.Model.L_System.L_System.Instance;
F : File_Type;
Medium : LSE.Model.IO.Drawing_Area.Drawing_Area_Ptr.Holder;
View : LSE.View.View.Instance;
Presenter : LSE.Presenter.Presenter.Instance;
begin
Define_Switch (Config, No_GUI'Access,
Long_Switch => "--no-gui",
Help => "True for no-gui, False otherwise [default False]");
Define_Switch (Config, Input_File'Access, "-i:",
Long_Switch => "--input=",
Help => "Input file that contains a L-System");
Define_Switch (Config, Output_File'Access, "-o:",
Long_Switch => "--output=",
Help => "Output file that will contains a L-System");
Define_Switch (Config, Export'Access, "-e:",
Long_Switch => "--export=",
Help => "Export format");
Define_Switch (Config, Export_File'Access, "-p:",
Long_Switch => "--export-file=",
Help => "Output file that will contains the " &
"representation of the L-System");
Define_Switch (Config, Develop'Access, "-d:",
Long_Switch => "--develop=",
Help => "number of step to develop");
Define_Switch (Config, Width'Access, "-w:",
Long_Switch => "--width=",
Help => "Width of the output representation " &
"(must be greater than 0 else is ignored)");
Define_Switch (Config, Height'Access, "-h:",
Long_Switch => "--height=",
Help => "Height of the output representation " &
"(must be greater than 0 else is ignored)");
Define_Switch (Config, Background_Color'Access, "-b:",
Long_Switch => "--background-color=",
Help => "background color of the output representation " &
"(in Hex, like #AABBCC or AABBCC)");
Define_Switch (Config, Foreground_Color'Access, "-f:",
Long_Switch => "--foreground-color=",
Help => "foreground color of the output representation " &
"(in Hex, like #AABBCC or AABBCC)");
Define_Switch (Config, Margin_Top'Access, "-mt:",
Long_Switch => "--margin-top=",
Help => "Enable margin top of the output representation " &
"(must be greater than 0 else is ignored)");
Define_Switch (Config, Margin_Right'Access, "-mr:",
Long_Switch => "--margin-right=",
Help => "Enable margin right of the output representation " &
"(must be greater than 0 else is ignored)");
Define_Switch (Config, Margin_Bottom'Access, "-mb:",
Long_Switch => "--margin-bottom=",
Help => "Enable margin bottom of the output representation" &
" (must be greater than 0 else is ignored)");
Define_Switch (Config, Margin_Left'Access, "-ml:",
Long_Switch => "--margin-left=",
Help => "Enable margin left of the output representation " &
"(must be greater than 0 else is ignored)");
Getopt (Config);
if No_GUI then
if Input_File.all = "" then
raise No_Input_File;
elsif Export.all = "" then
raise No_Export;
elsif Export_File.all = "" then
raise No_Export_File;
elsif Develop < 0 then
raise No_Develop;
end if;
T := To_Holder (Initialize);
Make (Medium, Export.all, Export_File.all);
T.Reference.Set_Medium (Medium);
if Width > 0 then
Set_Width (T.Reference, Width);
end if;
if Height > 0 then
Set_Height (T.Reference, Height);
end if;
if Background_Color.all /= "" then
Set_Background_Color (T.Reference, Background_Color.all);
end if;
if Foreground_Color.all /= "" then
Set_Foreground_Color (T.Reference, Foreground_Color.all);
end if;
if Margin_Top > 0 then
Set_Margin_Top (T.Reference, Natural (Margin_Top));
end if;
if Margin_Right > 0 then
Set_Margin_Right (T.Reference, Margin_Right);
end if;
if Margin_Bottom > 0 then
Set_Margin_Bottom (T.Reference, Margin_Bottom);
end if;
if Margin_Left > 0 then
Set_Margin_Left (T.Reference, Margin_Left);
end if;
Initialize (B);
Open_File (F, In_File, Input_File.all, False);
if Read_LSystem (F, B, T, L) then
Put_Line ("L-System:");
Put_Line (L.Get_LSystem);
L.Set_State (Develop);
L.Develop;
L.Interpret (T);
Close_File (F);
Put_Line ("L-System rendered for level" & Integer'Image (Develop));
else
Put_Line ("L-System creation error:");
Put_Line (B.Get_Error);
Close_File (F);
raise LS_Creation;
end if;
else
-- GUI Mode
Presenter.Initialize;
View := Presenter.Get_View;
View.Set_Presenter (Presenter);
Presenter.Start;
end if;
exception
when GNAT.Command_Line.Exit_From_Command_Line =>
return;
end Main;
|
reznikmm/matreshka | Ada | 4,097 | 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.Draw_Handle_Range_X_Maximum_Attributes;
package Matreshka.ODF_Draw.Handle_Range_X_Maximum_Attributes is
type Draw_Handle_Range_X_Maximum_Attribute_Node is
new Matreshka.ODF_Draw.Abstract_Draw_Attribute_Node
and ODF.DOM.Draw_Handle_Range_X_Maximum_Attributes.ODF_Draw_Handle_Range_X_Maximum_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Handle_Range_X_Maximum_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Draw_Handle_Range_X_Maximum_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Draw.Handle_Range_X_Maximum_Attributes;
|
reznikmm/matreshka | Ada | 3,935 | 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.Paragraph_Properties;
package ODF.DOM.Elements.Style.Paragraph_Properties.Internals is
function Create
(Node : Matreshka.ODF_Elements.Style.Paragraph_Properties.Style_Paragraph_Properties_Access)
return ODF.DOM.Elements.Style.Paragraph_Properties.ODF_Style_Paragraph_Properties;
function Wrap
(Node : Matreshka.ODF_Elements.Style.Paragraph_Properties.Style_Paragraph_Properties_Access)
return ODF.DOM.Elements.Style.Paragraph_Properties.ODF_Style_Paragraph_Properties;
end ODF.DOM.Elements.Style.Paragraph_Properties.Internals;
|
adamnemecek/GA_Ada | Ada | 383 | ads |
with Multivector;
with Multivector_Analyze; use Multivector_Analyze;
package Multivector_Analyze_E2GA is
procedure Analyze (theAnalysis : in out MV_Analysis;
MV : Multivector.Multivector;
Flags : Flag_Type := (Flag_Invalid, false);
Epsilon : float := Default_Epsilon);
end Multivector_Analyze_E2GA;
|
charlie5/lace | Ada | 35,143 | adb | -- Steps for decoding a JPEG image
--
-- 1. Huffman decompression
-- 2. Inverse quantization
-- 3. Inverse cosine transform
-- 4. Upsampling
-- 5. Color transformation
-- 6. Image reconstruction
--
-- The JPEG decoder is largely inspired
-- by the NanoJPEG code by Martin J. Fiedler
-- http://keyj.s2000.ws/?p=137
-- With the author's permission. Many thanks!
--
-- Other informations:
-- http://en.wikipedia.org/wiki/JPEG
-- !! ** Some optimizations to consider **
-- !! ssx, ssy ,ssxmax, ssymax
-- as generic parameters + specialized instances
-- !! consider only power-of-two upsampling factors ?
-- !! simplify upsampling loops in case of power-of-two upsampling factors
-- using Shift_Right
-- !! Col_IDCT output direct to "flat", or something similar to NanoJPEG
with GID.Buffering;
with Ada.Text_IO, Ada.Exceptions, Ada.IO_Exceptions;
package body GID.Decoding_JPG is
use GID.Buffering;
use Ada.Text_IO, Ada.Exceptions;
generic
type Number is mod <>;
procedure Big_endian_number(
from : in out Input_buffer;
n : out Number
);
pragma Inline(Big_endian_number);
procedure Big_endian_number(
from : in out Input_buffer;
n : out Number
)
is
b: U8;
begin
n:= 0;
for i in 1..Number'Size/8 loop
Get_Byte(from, b);
n:= n * 256 + Number(b);
end loop;
end Big_endian_number;
procedure Big_endian is new Big_endian_number( U16 );
procedure Read( image: in out image_descriptor; sh: out Segment_head) is
b: U8;
id: constant array(JPEG_marker) of U8:=
( SOI => 16#D8#,
--
SOF_0 => 16#C0#, SOF_1 => 16#C1#, SOF_2 => 16#C2#, SOF_3 => 16#C3#,
SOF_5 => 16#C5#, SOF_6 => 16#C6#, SOF_7 => 16#C7#, SOF_8 => 16#C8#,
SOF_9 => 16#C9#, SOF_10 => 16#CA#, SOF_11 => 16#CB#, SOF_13 => 16#CD#,
SOF_14 => 16#CE#, SOF_15 => 16#CF#,
--
DHT => 16#C4#,
DAC => 16#CC#,
DQT => 16#DB#,
DRI => 16#DD#,
--
APP_0 => 16#E0#, APP_1 => 16#E1#, APP_2 => 16#E2#, APP_3 => 16#E3#,
APP_4 => 16#E4#, APP_5 => 16#E5#, APP_6 => 16#E6#, APP_7 => 16#E7#,
APP_8 => 16#E8#, APP_9 => 16#E9#, APP_10 => 16#EA#, APP_11 => 16#EB#,
APP_12 => 16#EC#, APP_13 => 16#ED#, APP_14 => 16#EE#,
--
COM => 16#FE#,
SOS => 16#DA#,
EOI => 16#D9#
);
begin
Get_Byte(image.buffer, b);
if b /= 16#FF# then
Raise_exception(
error_in_image_data'Identity,
"JPEG: expected marker here"
);
end if;
Get_Byte(image.buffer, b);
for m in id'Range loop
if id(m)= b then
sh.kind:= m;
Big_endian(image.buffer, sh.length);
sh.length:= sh.length - 2;
-- We consider length of contents, without the FFxx marker.
if some_trace then
Put_Line(
"Segment [" & JPEG_marker'Image(sh.kind) &
"], length:" & U16'Image(sh.length));
end if;
return;
end if;
end loop;
Raise_exception(
error_in_image_data'Identity,
"JPEG: unknown marker here: FF, " & U8'Image(b)
);
end Read;
shift_arg: constant array(0..15) of Integer:=
(1 => 0, 2 => 1, 4 => 2, 8 => 3, others => -1);
-- SOF - Start Of Frame (the real header)
procedure Read_SOF(image: in out Image_descriptor; sh: Segment_head) is
use Bounded_255;
b, bits_pp_primary: U8;
w, h: U16;
compo: JPEG_defs.Component;
begin
case sh.kind is
when SOF_0 =>
image.detailed_format:= To_Bounded_String("JPEG, Baseline DCT (SOF_0)");
when SOF_2 =>
image.detailed_format:= To_Bounded_String("JPEG, Progressive DCT (SOF_2)");
image.interlaced:= True;
when others =>
Raise_exception(
unsupported_image_subformat'Identity,
"JPEG: image type not yet supported: " & JPEG_marker'Image(sh.kind)
);
end case;
Get_Byte(image.buffer, bits_pp_primary);
if bits_pp_primary /= 8 then
Raise_exception(
unsupported_image_subformat'Identity,
"Bits per primary color=" & U8'Image(bits_pp_primary)
);
end if;
image.bits_per_pixel:= 3 * Positive(bits_pp_primary);
Big_endian(image.buffer, h);
Big_endian(image.buffer, w);
image.width:= Natural(w);
image.height:= Natural(h);
-- number of components:
Get_Byte(image.buffer, b);
image.subformat_id:= Integer(b);
--
image.JPEG_stuff.max_samples_hor:= 0;
image.JPEG_stuff.max_samples_ver:= 0;
-- for each component: 3 bytes
for i in 1..image.subformat_id loop
-- component id (1 = Y, 2 = Cb, 3 = Cr, 4 = I, 5 = Q)
Get_Byte(image.buffer, b);
compo:= JPEG_defs.Component'Val(b - 1);
image.JPEG_stuff.components(compo):= True;
declare
stuff: JPEG_stuff_type renames image.JPEG_stuff;
info: JPEG_defs.info_per_component_A renames stuff.info(compo);
begin
-- sampling factors (bit 0-3 vert., 4-7 hor.)
Get_Byte(image.buffer, b);
info.samples_ver:= Natural(b mod 16);
info.samples_hor:= Natural(b / 16);
stuff.max_samples_hor:=
Integer'Max(stuff.max_samples_hor, info.samples_hor);
stuff.max_samples_ver:=
Integer'Max(stuff.max_samples_ver, info.samples_ver);
-- quantization table number
Get_Byte(image.buffer, b);
info.qt_assoc:= Natural(b);
end;
end loop;
for c in Component loop
if image.JPEG_stuff.components(c) then
declare
stuff: JPEG_stuff_type renames image.JPEG_stuff;
info: JPEG_defs.info_per_component_A renames stuff.info(c);
begin
info.up_factor_x:= stuff.max_samples_hor / info.samples_hor;
info.up_factor_y:= stuff.max_samples_ver / info.samples_ver;
info.shift_x:= shift_arg(info.up_factor_x);
info.shift_y:= shift_arg(info.up_factor_y);
end;
end if;
end loop;
if Natural(sh.length) < 6 + 3 * image.subformat_id then
Raise_exception(
error_in_image_data'Identity,
"JPEG: SOF segment too short"
);
end if;
if some_trace then
Put_Line("Frame has following components:");
for c in JPEG_defs.component loop
Put_Line(
JPEG_defs.Component'Image(c) & " -> " &
Boolean'Image(image.JPEG_stuff.components(c))
);
end loop;
end if;
if image.JPEG_stuff.components = YCbCr_set then
image.JPEG_stuff.color_space:= YCbCr;
elsif image.JPEG_stuff.components = Y_Grey_set then
image.JPEG_stuff.color_space:= Y_Grey;
image.greyscale:= True;
elsif image.JPEG_stuff.components = CMYK_set then
image.JPEG_stuff.color_space:= CMYK;
else
Raise_exception(
unsupported_image_subformat'Identity,
"JPEG: only YCbCr, Y_Grey and CMYK color spaces are currently supported"
);
end if;
image.detailed_format:= image.detailed_format & ", " &
JPEG_defs.Supported_color_space'Image(image.JPEG_stuff.color_space);
if some_trace then
Put_Line(
"Color space: " &
JPEG_defs.Supported_color_space'Image(image.JPEG_stuff.color_space)
);
end if;
if image.JPEG_stuff.color_space = CMYK then
Raise_exception(
unsupported_image_subformat'Identity,
"JPEG: CMYK color space is currently not properly decoded"
);
end if;
end Read_SOF;
procedure Read_DHT(image: in out Image_descriptor; data_length: Natural) is
remaining: Integer:= data_length; -- data remaining in segment
b: U8;
ht_idx: Natural;
kind: AC_DC;
counts: array(1..16) of Natural;
spread, currcnt, idx: Natural;
remain_vlc: Integer;
begin
multi_tables:
loop
Get_Byte(image.buffer, b);
remaining:= remaining - 1;
if b >= 8 then
kind:= AC;
else
kind:= DC;
end if;
ht_idx:= Natural(b and 7);
if some_trace then
Put_Line(
"Huffman Table (HT) #" &
Natural'Image(ht_idx) & ", " & AC_DC'Image(kind)
);
end if;
if image.JPEG_stuff.vlc_defs(kind, ht_idx) = null then
image.JPEG_stuff.vlc_defs(kind, ht_idx):= new VLC_table;
end if;
for i in counts'range loop
Get_Byte(image.buffer, b);
remaining:= remaining - 1;
counts(i):= Natural(b);
end loop;
remain_vlc:= 65_536;
spread:= 65_536;
idx:= 0;
for codelen in counts'Range loop
spread:= spread / 2;
currcnt:= counts(codelen);
if currcnt > 0 then
if remaining < currcnt then
Raise_exception(
error_in_image_data'Identity,
"JPEG: DHT data too short"
);
end if;
remain_vlc:= remain_vlc - currcnt * spread;
if remain_vlc < 0 then
Raise_exception(
error_in_image_data'Identity,
"JPEG: DHT table too short for data"
);
end if;
for i in reverse 1..currcnt loop
Get_Byte(image.buffer, b);
for j in reverse 1..spread loop
image.JPEG_stuff.vlc_defs(kind, ht_idx)(idx):=
(bits => U8(codelen), code => b);
idx:= idx + 1;
end loop;
end loop;
remaining:= remaining - currcnt;
end if;
end loop;
while remain_vlc > 0 loop
remain_vlc:= remain_vlc - 1;
image.JPEG_stuff.vlc_defs(kind, ht_idx)(idx).bits:= 0;
idx:= idx + 1;
end loop;
exit when remaining <= 0;
end loop multi_tables;
end Read_DHT;
procedure Read_DQT(image: in out Image_descriptor; data_length: Natural) is
remaining: Integer:= data_length; -- data remaining in segment
b, q8: U8; q16: U16;
qt_idx: Natural;
high_prec: Boolean;
begin
multi_tables:
loop
Get_Byte(image.buffer, b);
remaining:= remaining - 1;
high_prec:= b >= 8;
qt_idx:= Natural(b and 7);
if some_trace then
Put_Line("Quantization Table (QT) #" & U8'Image(b));
end if;
for i in QT'Range loop
if high_prec then
Big_endian(image.buffer, q16);
remaining:= remaining - 2;
image.JPEG_stuff.qt_list(qt_idx)(i):= Natural(q16);
else
Get_Byte(image.buffer, q8);
remaining:= remaining - 1;
image.JPEG_stuff.qt_list(qt_idx)(i):= Natural(q8);
end if;
end loop;
exit when remaining <= 0;
end loop multi_tables;
end Read_DQT;
procedure Read_DRI(image: in out Image_descriptor) is
ri: U16;
begin
Big_endian(image.buffer, ri);
if some_trace then
Put_Line(" Restart interval set to:" & U16'Image(ri));
end if;
image.JPEG_stuff.restart_interval:= Natural(ri);
end Read_DRI;
procedure Read_EXIF(image: in out Image_descriptor; data_length: Natural) is
b, orientation_value: U8;
x: Natural;
Exif_signature: constant String:= "Exif" & ASCII.NUL & ASCII.NUL;
signature: String(1..6);
IFD_tag: U16;
begin
if some_trace then
Put_Line("APP1");
end if;
if data_length < 6 then
-- Skip segment data
for i in 1..data_length loop
Get_Byte(image.buffer, b);
end loop;
else
for i in 1..6 loop
Get_Byte(image.buffer, b);
signature(i):= Character'Val(b);
end loop;
if signature /= Exif_signature then
for i in 7..data_length loop
Get_Byte(image.buffer, b);
end loop;
if some_trace then
Put_Line("APP1 is not Exif");
end if;
return;
end if;
if some_trace then
Put_Line("APP1 is Exif");
end if;
for i in 7..16 loop -- TIFF 6.0 header + IFD0 entries
Get_Byte(image.buffer, b);
end loop;
x:= 17;
while x <= data_length - 12 loop
Get_Byte(image.buffer, b);
IFD_tag:= U16(b);
Get_Byte(image.buffer, b);
IFD_tag:= IFD_tag + 16#100# * U16(b);
for i in 3..8 loop
Get_Byte(image.buffer, b);
end loop;
Get_Byte(image.buffer, orientation_value);
for i in 10..12 loop
Get_Byte(image.buffer, b);
end loop;
x:= x + 12;
if IFD_tag = 16#112# then
case orientation_value is
when 1 =>
image.display_orientation:= Unchanged;
when 8 =>
image.display_orientation:= Rotation_90;
when 3 =>
image.display_orientation:= Rotation_180;
when 6 =>
image.display_orientation:= Rotation_270;
when others =>
image.display_orientation:= Unchanged;
end case;
if some_trace then
Put_Line(
"IFD tag: Orientation set to: " &
Orientation'Image(image.display_orientation)
);
end if;
exit;
end if;
end loop;
-- Skip rest of data
for i in x..data_length loop
Get_Byte(image.buffer, b);
end loop;
end if;
end Read_EXIF;
--------------------
-- Image decoding --
--------------------
procedure Load (
image : in out Image_descriptor;
next_frame: out Ada.Calendar.Day_Duration
)
is
--
-- Bit buffer
--
buf: U32:= 0;
bufbits: Natural:= 0;
function Show_bits(bits: Natural) return Natural is
newbyte, marker: U8;
begin
if bits=0 then
return 0;
end if;
while bufbits < bits loop
begin
Get_Byte(image.buffer, newbyte);
bufbits:= bufbits + 8;
buf:= buf * 256 + U32(newbyte);
if newbyte = 16#FF# then
Get_Byte(image.buffer, marker);
case marker is
when 0 =>
null;
when 16#D9# =>
null; -- !! signal end
when 16#D0# .. 16#D7# =>
bufbits:= bufbits + 8;
buf:= buf * 256 + U32(marker);
when others =>
Raise_exception(
error_in_image_data'Identity,
"JPEG: Invalid code (bit buffer)"
);
end case;
end if;
exception
when Ada.IO_Exceptions.End_Error =>
newbyte:= 16#FF#;
bufbits:= bufbits + 8;
buf:= buf * 256 + U32(newbyte);
end;
end loop;
return Natural(
Shift_Right(buf, bufbits - bits)
and
(Shift_Left(1, bits)-1)
);
end Show_bits;
procedure Skip_bits(bits: Natural) is
pragma Inline(Skip_bits);
dummy: Integer;
pragma Warnings(off, dummy);
begin
if bufbits < bits then
dummy:= Show_bits(bits);
end if;
bufbits:= bufbits - bits;
end Skip_bits;
function Get_bits(bits: Natural) return Integer is
pragma Inline(Get_bits);
res: constant Integer:= Show_bits(bits);
begin
Skip_bits(bits);
return res;
end Get_bits;
--
type Info_per_component_B is record
ht_idx_AC : Natural;
ht_idx_DC : Natural;
width, height, stride: Natural;
dcpred: Integer:= 0;
end record;
info_A: Component_info_A renames image.JPEG_stuff.info;
info_B: array(Component) of Info_per_component_B;
procedure Get_VLC(
vlc: VLC_table;
code: out U8;
value_ret: out Integer
)
is
-- Step 1 happens here: Huffman decompression
value: Integer:= Show_bits(16);
bits : Natural:= Natural(vlc(value).bits);
begin
if bits = 0 then
Raise_exception(
error_in_image_data'Identity,
"JPEG: VLC table: bits = 0"
);
end if;
Skip_bits(bits);
value:= Integer(vlc(value).code);
code:= U8(value);
bits:= Natural(U32(value) and 15);
value_ret:= 0;
if bits /= 0 then
value:= Get_bits(bits);
if value < Integer(Shift_Left(U32'(1), bits - 1)) then
value:= value + 1 - Integer(Shift_Left(U32'(1), bits));
end if;
value_ret:= value;
end if;
end Get_VLC;
function Clip(x: Integer) return Integer is
pragma Inline(Clip);
begin
if x < 0 then
return 0;
elsif x > 255 then
return 255;
else
return x;
end if;
end Clip;
type Block_8x8 is array(0..63) of Integer;
-- Ordering within a 8x8 block, in zig-zag
zig_zag: constant Block_8x8:=
( 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18,
11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20,
13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43,
36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45,
38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63 );
procedure Decode_Block(c: Component; block: in out Block_8x8) is
value, coef: Integer;
code: U8;
qt: JPEG_defs.QT renames image.JPEG_stuff.qt_list(info_A(c).qt_assoc);
--
W1: constant:= 2841;
W2: constant:= 2676;
W3: constant:= 2408;
W5: constant:= 1609;
W6: constant:= 1108;
W7: constant:= 565;
--
procedure Row_IDCT(start: Integer) is
pragma Inline(Row_IDCT);
x0, x1, x2, x3, x4, x5, x6, x7, x8, val: Integer;
begin
x1:= block(start + 4) * 2**11;
x2:= block(start + 6);
x3:= block(start + 2);
x4:= block(start + 1);
x5:= block(start + 7);
x6:= block(start + 5);
x7:= block(start + 3);
if x1=0 and x2=0 and x3=0 and x4=0 and x5=0 and x6=0 and x7=0 then
val:= block(start + 0) * 8;
block(start + 0 .. start + 7):= (others => val);
else
x0:= (block(start + 0) * 2**11) + 128;
x8:= W7 * (x4 + x5);
x4:= x8 + (W1 - W7) * x4;
x5:= x8 - (W1 + W7) * x5;
x8:= W3 * (x6 + x7);
x6:= x8 - (W3 - W5) * x6;
x7:= x8 - (W3 + W5) * x7;
x8:= x0 + x1;
x0:= x0 - x1;
x1:= W6 * (x3 + x2);
x2:= x1 - (W2 + W6) * x2;
x3:= x1 + (W2 - W6) * x3;
x1:= x4 + x6;
x4:= x4 - x6;
x6:= x5 + x7;
x5:= x5 - x7;
x7:= x8 + x3;
x8:= x8 - x3;
x3:= x0 + x2;
x0:= x0 - x2;
x2:= (181 * (x4 + x5) + 128) / 256;
x4:= (181 * (x4 - x5) + 128) / 256;
block(start + 0):= (x7 + x1) / 256;
block(start + 1):= (x3 + x2) / 256;
block(start + 2):= (x0 + x4) / 256;
block(start + 3):= (x8 + x6) / 256;
block(start + 4):= (x8 - x6) / 256;
block(start + 5):= (x0 - x4) / 256;
block(start + 6):= (x3 - x2) / 256;
block(start + 7):= (x7 - x1) / 256;
end if;
end Row_IDCT;
procedure Col_IDCT(start: Integer) is
pragma Inline(Col_IDCT);
x0, x1, x2, x3, x4, x5, x6, x7, x8, val: Integer;
begin
x1:= block(start + 8*4) * 256;
x2:= block(start + 8*6);
x3:= block(start + 8*2);
x4:= block(start + 8*1);
x5:= block(start + 8*7);
x6:= block(start + 8*5);
x7:= block(start + 8*3);
if x1=0 and x2=0 and x3=0 and x4=0 and x5=0 and x6=0 and x7=0 then
val:= Clip(((block(start) + 32) / 2**6) + 128);
for row in reverse 0..7 loop
block(start + row * 8):= val;
end loop;
else
x0:= (block(start) * 256) + 8192;
x8:= W7 * (x4 + x5) + 4;
x4:= (x8 + (W1 - W7) * x4) / 8;
x5:= (x8 - (W1 + W7) * x5) / 8;
x8:= W3 * (x6 + x7) + 4;
x6:= (x8 - (W3 - W5) * x6) / 8;
x7:= (x8 - (W3 + W5) * x7) / 8;
x8:= x0 + x1;
x0:= x0 - x1;
x1:= W6 * (x3 + x2) + 4;
x2:= (x1 - (W2 + W6) * x2) / 8;
x3:= (x1 + (W2 - W6) * x3) / 8;
x1:= x4 + x6;
x4:= x4 - x6;
x6:= x5 + x7;
x5:= x5 - x7;
x7:= x8 + x3;
x8:= x8 - x3;
x3:= x0 + x2;
x0:= x0 - x2;
x2:= (181 * (x4 + x5) + 128) / 256;
x4:= (181 * (x4 - x5) + 128) / 256;
block(start + 8*0):= Clip(((x7 + x1) / 2**14) + 128);
block(start + 8*1):= Clip(((x3 + x2) / 2**14) + 128);
block(start + 8*2):= Clip(((x0 + x4) / 2**14) + 128);
block(start + 8*3):= Clip(((x8 + x6) / 2**14) + 128);
block(start + 8*4):= Clip(((x8 - x6) / 2**14) + 128);
block(start + 8*5):= Clip(((x0 - x4) / 2**14) + 128);
block(start + 8*6):= Clip(((x3 - x2) / 2**14) + 128);
block(start + 8*7):= Clip(((x7 - x1) / 2**14) + 128);
end if;
end Col_IDCT;
begin -- Decode_Block
--
-- Step 2 happens here: Inverse quantization
Get_VLC(image.JPEG_stuff.vlc_defs(DC, info_B(c).ht_idx_DC).all, code, value);
-- First value in block (0: top left) uses a predictor.
info_B(c).dcpred:= info_B(c).dcpred + value;
block:= (0 => info_B(c).dcpred * qt(0), others => 0);
coef:= 0;
loop
Get_VLC(image.JPEG_stuff.vlc_defs(AC, info_B(c).ht_idx_AC).all, code, value);
exit when code = 0; -- EOB
if (code and 16#0F#) = 0 and code /= 16#F0# then
Raise_exception(
error_in_image_data'Identity,
"JPEG: error in VLC AC code for de-quantization"
);
end if;
coef:= coef + Integer(Shift_Right(code, 4)) + 1;
if coef > 63 then
Raise_exception(
error_in_image_data'Identity,
"JPEG: coefficient for de-quantization is > 63"
);
end if;
block(zig_zag(coef)):= value * qt(coef);
exit when coef = 63;
end loop;
-- Step 3 happens here: Inverse cosine transform
for row in 0..7 loop
Row_IDCT(row * 8);
end loop;
for col in 0..7 loop
Col_IDCT(col);
end loop;
end Decode_Block;
type Macro_block is array(
Component range <>, -- component
Positive range <>, -- x sample range
Positive range <> -- y sample range
) of Block_8x8;
procedure Out_Pixel_8(br, bg, bb: U8) is
pragma Inline(Out_Pixel_8);
ba: constant:= 255;
begin
case Primary_color_range'Modulus is
when 256 =>
Put_Pixel(
Primary_color_range(br),
Primary_color_range(bg),
Primary_color_range(bb),
Primary_color_range(ba)
);
when 65_536 =>
Put_Pixel(
16#101# * Primary_color_range(br),
16#101# * Primary_color_range(bg),
16#101# * Primary_color_range(bb),
16#101# * Primary_color_range(ba)
-- 16#101# because max intensity FF goes to FFFF
);
when others =>
raise invalid_primary_color_range;
end case;
end Out_Pixel_8;
-- !! might be generic parameters
ssxmax: constant Natural:= image.JPEG_stuff.max_samples_hor;
ssymax: constant Natural:= image.JPEG_stuff.max_samples_ver;
procedure Upsampling_and_output(
m: Macro_block;
x0, y0: Natural
)
is
flat: array(Component, 0..8*ssxmax-1, 0..8*ssymax-1) of Integer;
generic
color_space: Supported_color_space;
procedure Color_transformation_and_output;
--
procedure Color_transformation_and_output is
y_val, cb_val, cr_val, c_val, m_val, w_val: Integer;
y_val_8: U8;
begin
for ymb in flat'Range(3) loop
exit when y0+ymb >= image.height;
Set_X_Y(x0, image.height-1-(y0+ymb));
for xmb in flat'Range(2) loop
exit when x0+xmb >= image.width;
case color_space is
when YCbCR =>
y_val := flat(Y, xmb, ymb) * 256;
cb_val:= flat(Cb, xmb, ymb) - 128;
cr_val:= flat(Cr, xmb, ymb) - 128;
Out_pixel_8(
br => U8(Clip((y_val + 359 * cr_val + 128) / 256)),
bg => U8(Clip((y_val - 88 * cb_val - 183 * cr_val + 128) / 256)),
bb => U8(Clip((y_val + 454 * cb_val + 128) / 256))
);
when Y_Grey =>
y_val_8:= U8(flat(Y, xmb, ymb));
Out_pixel_8(y_val_8, y_val_8, y_val_8);
when CMYK =>
-- !! find a working conversion formula.
-- perhaps it is more complicated (APP_2
-- color profile must be used ?)
c_val:= flat(Y, xmb, ymb);
m_val:= flat(Cb, xmb, ymb);
y_val:= flat(Cr, xmb, ymb);
w_val:= flat(I, xmb, ymb)-255;
Out_pixel_8(
br => U8(255-Clip(c_val+w_val)),
bg => U8(255-Clip(m_val+w_val)),
bb => U8(255-Clip(y_val+w_val))
);
end case;
end loop;
end loop;
end Color_transformation_and_output;
--
procedure Ct_YCbCr is new Color_transformation_and_output(YCbCr);
procedure Ct_Y_Grey is new Color_transformation_and_output(Y_Grey);
procedure Ct_CMYK is new Color_transformation_and_output(CMYK);
blk_idx: Integer;
upsx, upsy: Natural;
begin
-- Step 4 happens here: Upsampling
for c in Component loop
if image.JPEG_stuff.components(c) then
upsx:= info_A(c).up_factor_x;
upsy:= info_A(c).up_factor_y;
for x in reverse 1..info_A(c).samples_hor loop
for y in reverse 1..info_A(c).samples_ver loop
-- We are at the 8x8 block level
blk_idx:= 63;
for y8 in reverse 0..7 loop
for x8 in reverse 0..7 loop
declare
val: constant Integer:= m(c,x,y)(blk_idx);
big_pixel_x: constant Natural:= upsx * (x8 + 8*(x-1));
big_pixel_y: constant Natural:= upsy * (y8 + 8*(y-1));
begin
-- Repeat pixels for component c, sample (x,y),
-- position (x8,y8).
for rx in reverse 0..upsx-1 loop
for ry in reverse 0..upsy-1 loop
flat(c, rx + big_pixel_x, ry + big_pixel_y):= val;
end loop;
end loop;
end;
blk_idx:= blk_idx - 1;
end loop;
end loop;
end loop;
end loop;
end if;
end loop;
-- Step 5 and 6 happen here: Color transformation and output
case image.JPEG_stuff.color_space is
when YCbCr =>
Ct_YCbCr;
when Y_Grey =>
Ct_Y_Grey;
when CMYK =>
Ct_CMYK;
end case;
end Upsampling_and_output;
-- Start Of Scan (and image data which follow)
--
procedure Read_SOS is
components, b: U8;
compo: Component;
mbx, mby: Natural:= 0;
mbsizex, mbsizey, mbwidth, mbheight: Natural;
rstcount: Natural:= image.JPEG_stuff.restart_interval;
nextrst: U16:= 0;
w: U16;
start_spectral_selection,
end_spectral_selection,
successive_approximation: U8;
begin
Get_Byte(image.buffer, components);
if some_trace then
Put_Line(
"Start of Scan (SOS), with" & U8'Image(components) & " components"
);
end if;
if image.subformat_id /= Natural(components) then
Raise_exception(
error_in_image_data'Identity,
"JPEG: components mismatch in Scan segment"
);
end if;
for i in 1..components loop
Get_Byte(image.buffer, b);
compo:= Component'Val(b - 1);
if not image.JPEG_stuff.components(compo) then
Raise_exception(
error_in_image_data'Identity,
"JPEG: component " & Component'Image(compo) &
" has not been defined in the header (SOF) segment"
);
end if;
-- Huffman table selection
Get_Byte(image.buffer, b);
info_B(compo).ht_idx_AC:= Natural(b mod 16);
info_B(compo).ht_idx_DC:= Natural(b / 16);
end loop;
-- Parameters for progressive display format (SOF_2)
Get_Byte(image.buffer, start_spectral_selection);
Get_Byte(image.buffer, end_spectral_selection);
Get_Byte(image.buffer, successive_approximation);
--
-- End of SOS segment, image data follow.
--
mbsizex:= ssxmax * 8; -- pixels in a row of a macro-block
mbsizey:= ssymax * 8; -- pixels in a column of a macro-block
mbwidth := (image.width + mbsizex - 1) / mbsizex;
-- width in macro-blocks
mbheight:= (image.height + mbsizey - 1) / mbsizey;
-- height in macro-blocks
if some_trace then
Put_Line(" mbsizex = " & Integer'Image(mbsizex));
Put_Line(" mbsizey = " & Integer'Image(mbsizey));
Put_Line(" mbwidth = " & Integer'Image(mbwidth));
Put_Line(" mbheight = " & Integer'Image(mbheight));
end if;
for c in Component loop
if image.JPEG_stuff.components(c) then
info_B(c).width := (image.width * info_A(c).samples_hor + ssxmax - 1) / ssxmax;
info_B(c).height:= (image.height * info_A(c).samples_ver + ssymax - 1) / ssymax;
info_B(c).stride:= (mbwidth * mbsizex * info_A(c).samples_hor) / ssxmax;
if some_trace then
Put_Line(" Details for component " & Component'Image(c));
Put_Line(" samples in x " & Integer'Image(info_A(c).samples_hor));
Put_Line(" samples in y " & Integer'Image(info_A(c).samples_ver));
Put_Line(" width " & Integer'Image(info_B(c).width));
Put_Line(" height " & Integer'Image(info_B(c).height));
Put_Line(" stride " & Integer'Image(info_B(c).stride));
Put_Line(
" AC/DC table index " &
Integer'Image(info_B(compo).ht_idx_AC) & ", " &
Integer'Image(info_B(compo).ht_idx_DC)
);
end if;
if (info_B(c).width < 3 and info_A(c).samples_hor /= ssxmax) or
(info_B(c).height < 3 and info_A(c).samples_ver /= ssymax)
then
Raise_exception(
error_in_image_data'Identity,
"JPEG: component " & Component'Image(c) &
": sample dimension mismatch"
);
end if;
end if;
end loop;
--
if image.interlaced then
Raise_exception(
unsupported_image_subformat'Identity,
"JPEG: progressive format not yet functional"
);
end if;
declare
mb: Macro_block(Component, 1..ssxmax, 1..ssymax);
x0, y0: Integer:= 0;
begin
macro_blocks_loop:
loop
components_loop:
for c in Component loop
if image.JPEG_stuff.components(c) then
samples_y_loop:
for sby in 1..info_A(c).samples_ver loop
samples_x_loop:
for sbx in 1..info_A(c).samples_hor loop
Decode_Block(c, mb(c, sbx, sby));
end loop samples_x_loop;
end loop samples_y_loop;
end if;
end loop components_loop;
-- All components of the current macro-block are decoded.
-- Step 4, 5, 6 happen here: Upsampling, color transformation, output
Upsampling_and_output(mb, x0, y0);
--
mbx:= mbx + 1;
x0:= x0 + ssxmax * 8;
if mbx >= mbwidth then
mbx:= 0;
x0:= 0;
mby:= mby + 1;
y0:= y0 + ssymax * 8;
Feedback((100*mby)/mbheight);
exit macro_blocks_loop when mby >= mbheight;
end if;
if image.JPEG_stuff.restart_interval > 0 then
rstcount:= rstcount - 1;
if rstcount = 0 then
-- Here begins the restart.
bufbits:= Natural(U32(bufbits) and 16#F8#); -- byte alignment
-- Now the restart marker. We expect a
w:= U16(Get_bits(16));
if some_trace then
Put_Line(
" Restart #" & U16'Image(nextrst) &
" Code " & U16'Image(w) &
" after" & Natural'Image(image.JPEG_stuff.restart_interval) &
" macro blocks"
);
end if;
if w not in 16#FFD0# .. 16#FFD7# or (w and 7) /= nextrst then
Raise_exception(
error_in_image_data'Identity,
"JPEG: expected RST (restart) marker Nb " & U16'Image(nextrst)
);
end if;
nextrst:= (nextrst + 1) and 7;
rstcount:= image.JPEG_stuff.restart_interval;
-- Block-to-block predictor variables are reset.
for c in Component loop
info_B(c).dcpred:= 0;
end loop;
end if;
end if;
end loop macro_blocks_loop;
end;
end Read_SOS;
--
sh: Segment_head;
b: U8;
begin -- Load
loop
Read(image, sh);
case sh.kind is
when DQT => -- Quantization Table
Read_DQT(image, Natural(sh.length));
when DHT => -- Huffman Table
Read_DHT(image, Natural(sh.length));
when DRI => -- Restart Interval
Read_DRI(image);
when EOI => -- End Of Input
exit;
when SOS => -- Start Of Scan
Read_SOS;
exit;
when others =>
-- Skip segment data
for i in 1..sh.length loop
Get_Byte(image.buffer, b);
end loop;
end case;
end loop;
next_frame:= 0.0; -- still picture
end Load;
end GID.Decoding_JPG;
|
Subsets and Splits