repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
docandrew/troodon | Ada | 545 | ads | private package GID.Decoding_GIF is
--------------------
-- Image decoding --
--------------------
generic
type Primary_color_range is mod <>;
with procedure Set_X_Y (x, y: Natural);
with procedure Put_Pixel (
red, green, blue : Primary_color_range;
alpha : Primary_color_range
);
with procedure Feedback (percents: Natural);
mode: Display_mode;
--
procedure Load (
image : in out Image_descriptor;
next_frame: out Ada.Calendar.Day_Duration
);
end GID.Decoding_GIF;
|
reznikmm/matreshka | Ada | 4,767 | 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_Meta.Non_Whitespace_Character_Count_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Meta_Non_Whitespace_Character_Count_Attribute_Node is
begin
return Self : Meta_Non_Whitespace_Character_Count_Attribute_Node do
Matreshka.ODF_Meta.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Meta_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Meta_Non_Whitespace_Character_Count_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Non_Whitespace_Character_Count_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Meta_URI,
Matreshka.ODF_String_Constants.Non_Whitespace_Character_Count_Attribute,
Meta_Non_Whitespace_Character_Count_Attribute_Node'Tag);
end Matreshka.ODF_Meta.Non_Whitespace_Character_Count_Attributes;
|
twdroeger/ada-awa | Ada | 5,814 | adb | -----------------------------------------------------------------------
-- awa-mail-components-factory -- Mail UI Component Factory
-- Copyright (C) 2012 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Views.Nodes;
with ASF.Components.Base;
with AWA.Mail.Modules;
with AWA.Mail.Components.Messages;
with AWA.Mail.Components.Recipients;
package body AWA.Mail.Components.Factory is
use ASF.Components.Base;
use ASF.Views.Nodes;
function Create_Bcc return UIComponent_Access;
function Create_Body return UIComponent_Access;
function Create_Cc return UIComponent_Access;
function Create_From return UIComponent_Access;
function Create_Message return UIComponent_Access;
function Create_To return UIComponent_Access;
function Create_Subject return UIComponent_Access;
URI : aliased constant String := "http://code.google.com/p/ada-awa/mail";
BCC_TAG : aliased constant String := "bcc";
BODY_TAG : aliased constant String := "body";
CC_TAG : aliased constant String := "cc";
FROM_TAG : aliased constant String := "from";
MESSAGE_TAG : aliased constant String := "message";
SUBJECT_TAG : aliased constant String := "subject";
TO_TAG : aliased constant String := "to";
-- ------------------------------
-- Create an UIMailRecipient component
-- ------------------------------
function Create_Bcc return UIComponent_Access is
Result : constant Recipients.UIMailRecipient_Access := new Recipients.UIMailRecipient;
begin
Result.Set_Recipient (AWA.Mail.Clients.BCC);
return Result.all'Access;
end Create_Bcc;
-- ------------------------------
-- Create an UIMailBody component
-- ------------------------------
function Create_Body return UIComponent_Access is
begin
return new Messages.UIMailBody;
end Create_Body;
-- ------------------------------
-- Create an UIMailRecipient component
-- ------------------------------
function Create_Cc return UIComponent_Access is
Result : constant Recipients.UIMailRecipient_Access := new Recipients.UIMailRecipient;
begin
Result.Set_Recipient (AWA.Mail.Clients.CC);
return Result.all'Access;
end Create_Cc;
-- ------------------------------
-- Create an UISender component
-- ------------------------------
function Create_From return UIComponent_Access is
begin
return new Recipients.UISender;
end Create_From;
-- ------------------------------
-- Create an UIMailMessage component
-- ------------------------------
function Create_Message return UIComponent_Access is
use type AWA.Mail.Modules.Mail_Module_Access;
Result : constant Messages.UIMailMessage_Access := new Messages.UIMailMessage;
Module : constant AWA.Mail.Modules.Mail_Module_Access := AWA.Mail.Modules.Get_Mail_Module;
begin
if Module = null then
return null;
end if;
Result.Set_Message (Module.Create_Message);
return Result.all'Access;
end Create_Message;
-- ------------------------------
-- Create an UIMailSubject component
-- ------------------------------
function Create_Subject return UIComponent_Access is
begin
return new Messages.UIMailSubject;
end Create_Subject;
-- ------------------------------
-- Create an UIMailRecipient component
-- ------------------------------
function Create_To return UIComponent_Access is
begin
return new Recipients.UIMailRecipient;
end Create_To;
Bindings : aliased constant ASF.Factory.Binding_Array
:= (1 => (Name => BCC_TAG'Access,
Component => Create_Bcc'Access,
Tag => Create_Component_Node'Access),
2 => (Name => BODY_TAG'Access,
Component => Create_Body'Access,
Tag => Create_Component_Node'Access),
3 => (Name => CC_TAG'Access,
Component => Create_Cc'Access,
Tag => Create_Component_Node'Access),
4 => (Name => FROM_TAG'Access,
Component => Create_From'Access,
Tag => Create_Component_Node'Access),
5 => (Name => MESSAGE_TAG'Access,
Component => Create_Message'Access,
Tag => Create_Component_Node'Access),
6 => (Name => SUBJECT_TAG'Access,
Component => Create_Subject'Access,
Tag => Create_Component_Node'Access),
7 => (Name => TO_TAG'Access,
Component => Create_To'Access,
Tag => Create_Component_Node'Access)
);
Mail_Factory : aliased constant ASF.Factory.Factory_Bindings
:= (URI => URI'Access, Bindings => Bindings'Access);
-- ------------------------------
-- Get the AWA Mail component factory.
-- ------------------------------
function Definition return ASF.Factory.Factory_Bindings_Access is
begin
return Mail_Factory'Access;
end Definition;
end AWA.Mail.Components.Factory;
|
RREE/ada-util | Ada | 5,520 | ads | -----------------------------------------------------------------------
-- util-serialize-io-form -- x-www-form-urlencoded streams
-- Copyright (C) 2018 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Streams;
with Util.Streams.Texts;
with Util.Serialize.IO;
package Util.Serialize.IO.Form is
type Output_Stream is limited new Util.Serialize.IO.Output_Stream with private;
procedure Initialize (Stream : in out Output_Stream;
Output : in Util.Streams.Texts.Print_Stream_Access);
-- Flush the buffer (if any) to the sink.
overriding
procedure Flush (Stream : in out Output_Stream);
-- Close the sink.
overriding
procedure Close (Stream : in out Output_Stream);
-- Write the buffer array to the output stream.
overriding
procedure Write (Stream : in out Output_Stream;
Buffer : in Ada.Streams.Stream_Element_Array);
-- Write the attribute name/value pair.
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in String);
overriding
procedure Write_Wide_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Wide_Wide_String);
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Integer);
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Boolean);
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Write the attribute with a null value.
overriding
procedure Write_Null_Attribute (Stream : in out Output_Stream;
Name : in String);
-- Write the entity value.
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in String);
overriding
procedure Write_Wide_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Wide_Wide_String);
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Boolean);
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Integer);
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Ada.Calendar.Time);
overriding
procedure Write_Long_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Long_Long_Integer);
overriding
procedure Write_Enum_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in String);
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Write an entity with a null value.
overriding
procedure Write_Null_Entity (Stream : in out Output_Stream;
Name : in String);
type Parser is new Serialize.IO.Parser with private;
-- Parse the stream using the form parser.
procedure Parse (Handler : in out Parser;
Stream : in out Util.Streams.Buffered.Input_Buffer_Stream'Class;
Sink : in out Reader'Class);
-- Get the current location (file and line) to report an error message.
function Get_Location (Handler : in Parser) return String;
-- Read a form file and return an object.
function Read (Path : in String) return Util.Beans.Objects.Object;
private
procedure Write_Escape (Stream : in out Output_Stream;
Value : in String);
type Output_Stream is limited new Util.Serialize.IO.Output_Stream with record
Stream : Util.Streams.Texts.Print_Stream_Access;
Has_Param : Boolean := False;
end record;
type Parser is new Util.Serialize.IO.Parser with record
Token : Ada.Strings.Unbounded.Unbounded_String;
Line_Number : Natural := 1;
Has_Pending_Char : Boolean := False;
Pending_Char : Character;
end record;
end Util.Serialize.IO.Form;
|
tum-ei-rcs/StratoX | Ada | 2,805 | adb | -- Description: PIXRACER PROTOTYPING MAIN FILE
-- Main System File
-- todo: better unit name
with Ada.Real_Time; use Ada.Real_Time;
with Config; use Config;
with Interfaces; use Interfaces;
with CPU;
with HIL.Devices;
with NVRAM;
with Logger;
with LED_Manager;
--with Buzzer_Manager;
--with SDLog;
with ULog;
package body Main is
ENDL : constant String := (Character'Val (13), Character'Val (10));
procedure Initialize is
success : Boolean := False;
t_next : Ada.Real_Time.Time;
logret : Logger.Init_Error_Code;
begin
CPU.initialize;
Logger.init (logret);
Logger.log_console (Logger.INFO, "---------------");
Logger.log_console (Logger.INFO, "CPU initialized");
--Buzzer_Manager.Initialize;
LED_Manager.LED_switchOff;
LED_Manager.Set_Color ((HIL.Devices.RED_LED => True, HIL.Devices.GRN_LED => False, HIL.Devices.BLU_LED => False));
LED_Manager.LED_switchOn;
Logger.log_console (Logger.INFO, "Initializing NVRAM...");
NVRAM.Init;
Logger.log_console (Logger.INFO, "Start SD Logging...");
--Logger.Start_SDLog;
-- self checks
Logger.log_console (Logger.INFO, "Self-Check NVRAM...");
NVRAM.Self_Check (Status => success);
-- hang here if self-checks failed
if not success then
LED_Manager.LED_blink (LED_Manager.FAST);
Logger.log_console (Logger.ERROR, "Self checks failed");
t_next := Clock;
loop
LED_Manager.LED_tick (Config.MAIN_TICK_RATE_MS);
LED_Manager.LED_sync;
delay until t_next;
t_next := t_next + Milliseconds (Config.MAIN_TICK_RATE_MS);
end loop;
else
Logger.log_console (Logger.INFO, "Self checks passed");
delay until Clock + Milliseconds (50);
end if;
LED_Manager.Set_Color ((HIL.Devices.RED_LED => True, HIL.Devices.GRN_LED => True, HIL.Devices.BLU_LED => False));
LED_Manager.LED_switchOn;
-- SDLog.Perf_Test (10);
Logger.log_console (Logger.INFO, "SD Card check done");
end Initialize;
procedure Run_Loop is
loop_time_start : Time := Clock;
type prescaler is mod 100;
p : prescaler := 0;
type prescaler_gps is mod 20;
pg : prescaler_gps := 0;
begin
LED_Manager.Set_Color ((HIL.Devices.RED_LED => False, HIL.Devices.GRN_LED => True, HIL.Devices.BLU_LED => False));
LED_Manager.LED_blink (LED_Manager.SLOW);
loop
loop_time_start := Clock;
-- LED heartbeat
LED_Manager.LED_tick (MAIN_TICK_RATE_MS);
LED_Manager.LED_sync;
-- wait remaining loop time
delay until loop_time_start + Milliseconds (MAIN_TICK_RATE_MS);
end loop;
end Run_Loop;
end Main;
|
BrickBot/Bound-T-H8-300 | Ada | 2,789 | ads | -- Flow.Origins.Overall_Invariants (decl)
--
-- Using the value-origin analysis to find cells which are invariant
-- from entry to return of a subprogram (although they may be saved,
-- changed, and restored).
--
-- A component of the Bound-T Worst-Case Execution Time Tool.
--
-------------------------------------------------------------------------------
-- Copyright (c) 1999 .. 2015 Tidorum Ltd
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice, this
-- list of conditions and the following disclaimer.
-- 2. Redistributions in binary form must reproduce the above copyright notice,
-- this list of conditions and the following disclaimer in the documentation
-- and/or other materials provided with the distribution.
--
-- 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.
--
-- Other modules (files) of this software composition should contain their
-- own copyright statements, which may have different copyright and usage
-- conditions. The above conditions apply to this file.
-------------------------------------------------------------------------------
--
-- $Revision: 1.2 $
-- $Date: 2015/10/24 19:36:49 $
--
-- $Log: flow-origins-overall_invariants.ads,v $
-- Revision 1.2 2015/10/24 19:36:49 niklas
-- Moved to free licence.
--
-- Revision 1.1 2013/12/08 22:05:57 niklas
-- BT-CH-0259: Storing value-origin analysis results in execution bounds.
--
with Storage;
function Flow.Origins.Overall_Invariants (Map : Map_Ref)
return Storage.Cell_List_T;
--
-- Checks the cell-value origins at all return steps to find cells that
-- are invariant over any execution of the flow-graph under the given
-- value-origin map.
--
-- A cell is invariant if the origin of its value, after every return step,
-- is the Initial value for this cell.
--
-- If there are no return steps, all cells in the map are considered
-- invariant.
|
ohenley/ada-util | Ada | 17,772 | adb | -----------------------------------------------------------------------
-- util-dates-formats -- Date Format ala strftime
-- Copyright (C) 2011 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.Calendar.Formatting;
with GNAT.Calendar;
with Util.Strings.Transforms;
package body Util.Dates.Formats is
use Ada.Strings.Unbounded;
function Get_Label (Bundle : in Util.Properties.Manager'Class;
Prefix : in String;
Index : in Natural;
Short : in Boolean) return String;
function Get_Label (Bundle : in Util.Properties.Manager'Class;
Prefix : in String;
Index : in Natural;
Short : in Boolean) return String is
Num : constant String := Natural'Image (Index);
Name : constant String := Prefix & Num (Num'First + 1 .. Num'Last);
begin
if Short then
return Bundle.Get (Name & SHORT_SUFFIX, "");
else
return Bundle.Get (Name & LONG_SUFFIX, "");
end if;
end Get_Label;
-- ------------------------------
-- Append the localized month string in the <b>Into</b> string.
-- The month string is found in the resource bundle under the name:
-- util.month<month number>.short
-- util.month<month number>.long
-- If the month string is not found, the month is displayed as a number.
-- ------------------------------
procedure Append_Month (Into : in out Ada.Strings.Unbounded.Unbounded_String;
Month : in Ada.Calendar.Month_Number;
Bundle : in Util.Properties.Manager'Class;
Short : in Boolean := True) is
Value : constant String := Get_Label (Bundle, MONTH_NAME_PREFIX, Natural (Month), Short);
begin
if Value'Length > 0 then
Append (Into, Value);
else
-- If the resource bundle is empty, fallback to hard-coded English values.
case Month is
when 1 =>
Append (Into, "January");
when 2 =>
Append (Into, "February");
when 3 =>
Append (Into, "March");
when 4 =>
Append (Into, "April");
when 5 =>
Append (Into, "May");
when 6 =>
Append (Into, "June");
when 7 =>
Append (Into, "July");
when 8 =>
Append (Into, "August");
when 9 =>
Append (Into, "September");
when 10 =>
Append (Into, "October");
when 11 =>
Append (Into, "November");
when 12 =>
Append (Into, "December");
end case;
end if;
end Append_Month;
-- ------------------------------
-- Append the localized month string in the <b>Into</b> string.
-- The month string is found in the resource bundle under the name:
-- util.month<month number>.short
-- util.month<month number>.long
-- If the month string is not found, the month is displayed as a number.
-- ------------------------------
procedure Append_Day (Into : in out Ada.Strings.Unbounded.Unbounded_String;
Day : in Ada.Calendar.Formatting.Day_Name;
Bundle : in Util.Properties.Manager'Class;
Short : in Boolean := True) is
use Ada.Calendar.Formatting;
Value : constant String := Get_Label (Bundle, DAY_NAME_PREFIX, Day_Name'Pos (Day), Short);
begin
if Value'Length > 0 then
Append (Into, Value);
else
-- If the resource bundle is empty, fallback to hard-coded English values.
case Day is
when Monday =>
Append (Into, "Monday");
when Tuesday =>
Append (Into, "Tuesday");
when Wednesday =>
Append (Into, "Wednesday");
when Thursday =>
Append (Into, "Thursday");
when Friday =>
Append (Into, "Friday");
when Saturday =>
Append (Into, "Saturday");
when Sunday =>
Append (Into, "Sunday");
end case;
end if;
end Append_Day;
-- ------------------------------
-- Append a number with padding if necessary
-- ------------------------------
procedure Append_Number (Into : in out Ada.Strings.Unbounded.Unbounded_String;
Value : in Natural;
Padding : in Character;
Length : in Natural := 2) is
N : constant String := Natural'Image (Value);
begin
if Length = 0 or (Padding /= ' ' and Padding /= '0') then
Append (Into, N (N'First + 1 .. N'Last));
elsif N'Length <= Length then
Append (Into, Padding);
Append (Into, N (N'First + 1 .. N'Last));
else
Append (Into, N (N'Last - Length + 1 .. N'Last));
end if;
end Append_Number;
-- ------------------------------
-- Append the timezone offset
-- ------------------------------
procedure Append_Time_Offset (Into : in out Ada.Strings.Unbounded.Unbounded_String;
Offset : in Ada.Calendar.Time_Zones.Time_Offset) is
use type Ada.Calendar.Time_Zones.Time_Offset;
Value : Natural;
begin
if Offset < 0 then
Append (Into, '-');
Value := Natural (-Offset);
else
Value := Natural (Offset);
end if;
Append_Number (Into, Value / 60, '0');
Append (Into, ':');
Append_Number (Into, Value mod 60, '0');
end Append_Time_Offset;
-- ------------------------------
-- Format the date passed in <b>Date</b> using the date pattern specified in <b>Pattern</b>.
-- For month and day of week strings, use the resource bundle passed in <b>Bundle</b>.
-- Returns the formatted date in the stream.
-- ------------------------------
procedure Format (Into : in out Ada.Strings.Unbounded.Unbounded_String;
Pattern : in String;
Date : in Ada.Calendar.Time;
Bundle : in Util.Properties.Manager'Class) is
TM : Date_Record;
begin
Split (TM, Date);
Format (Into, Pattern, TM, Bundle);
end Format;
-- ------------------------------
-- Format the date passed in <b>Date</b> using the date pattern specified in <b>Pattern</b>.
-- For month and day of week strings, use the resource bundle passed in <b>Bundle</b>.
-- Returns the formatted date in the stream.
-- ------------------------------
procedure Format (Into : in out Ada.Strings.Unbounded.Unbounded_String;
Pattern : in String;
Date : in Date_Record;
Bundle : in Util.Properties.Manager'Class) is
use Ada.Calendar;
use Ada.Calendar.Formatting;
use Util.Strings.Transforms;
use type Ada.Calendar.Time_Zones.Time_Offset;
Pos : Positive := Pattern'First;
Pad : Character := '0';
C : Character;
begin
while Pos <= Pattern'Last loop
C := Pattern (Pos);
if C /= '%' then
Append (Into, C);
Pos := Pos + 1;
else
Pos := Pos + 1;
exit when Pos > Pattern'Last;
C := Pattern (Pos);
Pad := '0';
if C = '_' or C = '-' or C = 'E' or C = 'O' or C = '^' then
exit when Pos = Pattern'Last;
if C = '-' then
Pad := '-';
elsif C = '_' then
Pad := ' ';
end if;
Pos := Pos + 1;
C := Pattern (Pos);
end if;
case C is
when '%' =>
Append (Into, '%');
-- %a The abbreviated weekday name according to the current locale.
when 'a' =>
Append_Day (Into, Date.Day, Bundle, True);
-- %A The full weekday name according to the current locale.
when 'A' =>
Append_Day (Into, Date.Day, Bundle, False);
-- %b The abbreviated month name according to the current locale.
-- %h Equivalent to %b. (SU)
when 'b' | 'h' =>
Append_Month (Into, Date.Month, Bundle, True);
-- %B The full month name according to the current locale.
when 'B' =>
Append_Month (Into, Date.Month, Bundle, False);
-- %c The preferred date and time representation for the current locale.
when 'c' =>
Format (Into, Bundle.Get (DATE_TIME_LOCALE_NAME, DATE_TIME_DEFAULT_PATTERN),
Date, Bundle);
-- %C The century number (year/100) as a 2-digit integer. (SU)
when 'C' =>
Append_Number (Into, Natural (Date.Year / 100), Pad);
-- %d The day of the month as a decimal number (range 01 to 31).
when 'd' =>
Append_Number (Into, Natural (Date.Month_Day), Pad);
-- %D Equivalent to %m/%d/%y
when 'D' =>
Format (Into, "%m/%d/%y", Date, Bundle);
-- %e Like %d, the day of the month as a decimal number,
-- but a leading zero is replaced by a space. (SU)
when 'e' =>
Append_Number (Into, Natural (Date.Month), ' ');
-- %F Equivalent to %Y-%m-%d (the ISO 8601 date format). (C99)
when 'F' =>
Format (Into, "%Y-%m-%d", Date, Bundle);
-- %G The ISO 8601 week-based year
when 'G' =>
Append_Number (Into, Natural (Date.Year), Pad, 4);
Append (Into, 'W');
Append_Number (Into, Natural (GNAT.Calendar.Week_In_Year (Date.Date)), Pad);
-- %g Like %G, but without century, that is,
-- with a 2-digit year (00-99). (TZ)
when 'g' =>
Append_Number (Into, Natural (Date.Year mod 100), Pad, 2);
Append (Into, 'W');
Append_Number (Into, Natural (GNAT.Calendar.Week_In_Year (Date.Date)), Pad);
-- %H The hour as a decimal number using a 24-hour clock (range 00 to 23).
when 'H' =>
Append_Number (Into, Natural (Date.Hour), Pad);
-- %I The hour as a decimal number using a 12-hour clock (range 01 to 12).
when 'I' =>
Append_Number (Into, Natural (Date.Hour mod 12), Pad);
-- %j The day of the year as a decimal number (range 001 to 366).
when 'j' =>
Append_Number (Into, Natural (GNAT.Calendar.Day_In_Year (Date.Date)), Pad, 3);
-- %k The hour (24-hour clock) as a decimal number (range 0 to 23);
when 'k' =>
Append_Number (Into, Natural (Date.Hour), ' ');
-- %l The hour (12-hour clock) as a decimal number (range 1 to 12);
when 'l' =>
Append_Number (Into, Natural (Date.Hour mod 12), ' ');
-- %m The month as a decimal number (range 01 to 12).
when 'm' =>
Append_Number (Into, Natural (Date.Month), Pad);
-- %M The minute as a decimal number (range 00 to 59).
when 'M' =>
Append_Number (Into, Natural (Date.Minute), Pad);
-- %n A newline character. (SU)
when 'n' =>
Append (Into, ASCII.LF);
-- %p Either "AM" or "PM"
when 'p' =>
if Date.Hour >= 12 then
Append (Into, Bundle.Get (PM_NAME, PM_DEFAULT));
else
Append (Into, Bundle.Get (AM_NAME, AM_DEFAULT));
end if;
-- %P Like %p but in lowercase: "am" or "pm"
when 'P' =>
-- SCz 2011-10-01: the To_Lower_Case will not work for UTF-8 strings.
if Date.Hour >= 12 then
Append (Into, To_Lower_Case (Bundle.Get (PM_NAME, PM_DEFAULT)));
else
Append (Into, To_Lower_Case (Bundle.Get (AM_NAME, AM_DEFAULT)));
end if;
-- %r The time in a.m. or p.m. notation.
-- In the POSIX locale this is equivalent to %I:%M:%S %p. (SU)
when 'r' =>
Format (Into, "%I:%M:%S %p", Date, Bundle);
-- %R The time in 24-hour notation (%H:%M).
when 'R' =>
Format (Into, "%H:%M", Date, Bundle);
-- %s The number of seconds since the Epoch, that is,
-- since 1970-01-01 00:00:00 UTC. (TZ)
when 's' =>
null;
-- %S The second as a decimal number (range 00 to 60).
when 'S' =>
Append_Number (Into, Natural (Date.Second), Pad);
-- %t A tab character. (SU)
when 't' =>
Append (Into, ASCII.HT);
-- %T The time in 24-hour notation (%H:%M:%S). (SU)
when 'T' =>
Format (Into, "%H:%M:%S", Date, Bundle);
-- %u The day of the week as a decimal, range 1 to 7,
-- Monday being 1. See also %w. (SU)
when 'u' =>
Append_Number (Into, Day_Name'Pos (Date.Day), Pad);
-- %U The week number of the current year as a decimal number,
-- range 00 to 53
when 'U' =>
Append_Number (Into, Natural (GNAT.Calendar.Week_In_Year (Date.Date)), Pad);
-- %V The ISO 8601 week number
when 'V' =>
Append_Number (Into, Natural (GNAT.Calendar.Week_In_Year (Date.Date)), Pad);
-- %w The day of the week as a decimal, range 0 to 6, Sunday being 0.
-- See also %u.
when 'w' =>
if Date.Day = Sunday then
Append_Number (Into, 0, Pad);
else
Append_Number (Into, Day_Name'Pos (Date.Day) + 1, Pad);
end if;
-- %W The week number of the current year as a decimal number,
-- range 00 to 53
when 'W' =>
Append_Number (Into, Natural (GNAT.Calendar.Week_In_Year (Date.Date)), Pad);
-- %x The preferred date representation for the current locale without
-- the time.
when 'x' =>
Format (Into, Bundle.Get (DATE_LOCALE_NAME, DATE_DEFAULT_PATTERN),
Date, Bundle);
-- %X The preferred time representation for the current locale without
-- the date.
when 'X' =>
Format (Into, Bundle.Get (TIME_LOCALE_NAME, TIME_DEFAULT_PATTERN),
Date, Bundle);
-- %y The year as a decimal number without a century (range 00 to 99).
when 'y' =>
Append_Number (Into, Natural (Date.Year mod 100), Pad);
-- %Y The year as a decimal number including the century.
when 'Y' =>
Append_Number (Into, Natural (Date.Year), Pad, 4);
-- %z The time-zone as hour offset from GMT.
when 'z' =>
Append_Time_Offset (Into, Date.Time_Zone);
-- %Z The timezone or name or abbreviation.
when 'Z' =>
Append (Into, "UTC");
if Date.Time_Zone > 0 then
Append (Into, '+');
Append_Time_Offset (Into, Date.Time_Zone);
elsif Date.Time_Zone < 0 then
Append_Time_Offset (Into, Date.Time_Zone);
end if;
when others =>
Append (Into, '%');
Append (Into, Pattern (Pos));
end case;
Pos := Pos + 1;
end if;
end loop;
end Format;
function Format (Pattern : in String;
Date : in Ada.Calendar.Time;
Bundle : in Util.Properties.Manager'Class) return String is
Result : Unbounded_String;
begin
Format (Result, Pattern, Date, Bundle);
return To_String (Result);
end Format;
end Util.Dates.Formats;
|
reznikmm/matreshka | Ada | 3,734 | 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.Table_Cell_Content_Deletion_Elements is
pragma Preelaborate;
type ODF_Table_Cell_Content_Deletion is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Table_Cell_Content_Deletion_Access is
access all ODF_Table_Cell_Content_Deletion'Class
with Storage_Size => 0;
end ODF.DOM.Table_Cell_Content_Deletion_Elements;
|
sungyeon/drake | Ada | 291 | ads | pragma License (Unrestricted);
-- extended unit
with Ada.Strings.Functions;
with Ada.Strings.Generic_Unbounded.Generic_Functions;
package Ada.Strings.Unbounded_Strings.Functions is
new Generic_Functions (Strings.Functions);
pragma Preelaborate (Ada.Strings.Unbounded_Strings.Functions);
|
zhmu/ananas | Ada | 189 | ads | package Warn28 is
procedure TheProcedure1 (TheParameter : in Integer);
procedure Junk (It : Integer);
generic
procedure TheProcedure (TheParameter : in Integer);
end Warn28;
|
reznikmm/matreshka | Ada | 6,780 | 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_Dr3d.Sphere_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Dr3d_Sphere_Element_Node is
begin
return Self : Dr3d_Sphere_Element_Node do
Matreshka.ODF_Dr3d.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Dr3d_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Dr3d_Sphere_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_Dr3d_Sphere
(ODF.DOM.Dr3d_Sphere_Elements.ODF_Dr3d_Sphere_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 Dr3d_Sphere_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Sphere_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Dr3d_Sphere_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_Dr3d_Sphere
(ODF.DOM.Dr3d_Sphere_Elements.ODF_Dr3d_Sphere_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 Dr3d_Sphere_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_Dr3d_Sphere
(Visitor,
ODF.DOM.Dr3d_Sphere_Elements.ODF_Dr3d_Sphere_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.Dr3d_URI,
Matreshka.ODF_String_Constants.Sphere_Element,
Dr3d_Sphere_Element_Node'Tag);
end Matreshka.ODF_Dr3d.Sphere_Elements;
|
zhmu/ananas | Ada | 213 | ads | package Global2 is
type Int_Acc is access Integer;
X : constant Int_Acc := new Integer'(34);
procedure Change_X with Global => (In_Out => X);
procedure Change2_X with Depends => (X => X);
end Global2;
|
AdaCore/gpr | Ada | 49 | ads | package Pkg2 is
procedure Execute;
end Pkg2;
|
gitter-badger/libAnne | Ada | 6,871 | ads | with Ada.Iterator_Interfaces;
generic
type Value_Type is private;
package Containers.Lists.Doubly_Linked with Preelaborate is
--@description Provides Doubly-Linked Lists, a list easily traversable in both directions
--@version 1.0.0
----------
-- Node --
----------
type Node is private;
type Node_Access is access all Node;
function Value(Self : Node) return Value_Type with Inline, Pure_Function;
function Value(Self : Node_Access) return Value_Type with Inline, Pure_Function;
function Afore(Self : Node_Access) return Node_Access with Inline, Pure_Function;
function Previous(Self : Node_Access) return Node_Access renames Afore;
function Ahind(Self : Node_Access) return Node_Access with Inline, Pure_Function;
function Next(Self : Node_Access) return Node_Access renames Ahind;
----------
-- List --
----------
type List is new Container with private;
overriding function Is_Empty(Self : in List) return Boolean with Inline, Pure_Function;
--Is the List empty?
function Foremost(Self : in List) return Node_Access with Inline, Pure_Function;
function Foremost(Self : in List) return Value_Type with Inline, Pure_Function;
function Hindmost(Self : in List) return Node_Access with Inline, Pure_Function;
function Hindmost(Self : in List) return Value_Type with Inline, Pure_Function;
procedure Forebind(Self : in out List; Value : in Value_Type);
--Bind the value to the fore of the list
procedure Prepend(Self : in out List; Value : in Value_Type) renames Forebind;
--Prepend the value to the list
procedure Hindbind(Self : in out List; Value : in Value_Type);
--Bind the value to the hind of the list
procedure Append(Self : in out List; Value : in Value_Type) renames Hindbind;
--Append the value to the list
procedure Forefree(Self : in out List);
--Free the foremost value
procedure Hindfree(Self : in out List);
--Free the hindmost value
procedure Free(Self : in out List; Index : in Positive);
--Free the value at index
procedure Apply(Self : in out List; Call : access Procedure(Value : in out Value_Type));
--Apply the procedure to each value of the list
procedure Apply(Self : in out List; Call : access Function(Value : Value_Type) return Value_Type);
--Apply the function to each value of the list, replacing the value with the result
function Contains(Self : in List; Value : in Value_Type) return Boolean with Pure_Function;
--Does the list contain the specified value?
function Former(Self : in List; Amount : in Positive := 1) return List with Pre => Amount <= Self.Length, Pure_Function;
--Get the former amount from the list as a new list
function Top(Self : in List; Amount : in Positive := 1) return List renames Former;
--Get the top amount from the list as a new list
function Hinder(Self : in List; Amount : in Positive := 1) return List with Pre => Amount <= Self.Length, Pure_Function;
--Get the hinder amount from the list as a new list
function Bottom(Self : in List; Amount : in Positive := 1) return List renames Hinder;
--Get the bottom amount from the list as a new list
function Where(Self : in List; Query : access Function(Self : in Node) return Boolean) return List with Pure_Function;
--Get all values for which Query returns true
--Query is a function which checks each node for a condition
function Where(Self : in List; Query : access Function(Self : in Value_Type) return Boolean) return List with Pure_Function;
--Get all values for which Query returns true
--Query is a function which checks each value for a condition
function Flip(Self : in List) return List with Pure_Function;
--Flip the order of the list
overriding procedure Clear(Self : in out List);
--Clear the list of all values
function Copy(Self : List) return List with Pure_Function;
--Make a copy of the list
overriding function Length(Self : List) return Natural with Pure_Function;
--The length of the list, or total number of values
overriding function Size(Self : List) return Natural with Pure_Function;
--The size of the list, or total memory use
-----------
-- Array --
-----------
type Value_Array is array(Positive range <>) of Value_Type;
--Array of values produced from a list for quicker iteration (generally)
function Each(Self : in List) return Value_Array with Pure_Function;
--Convert the list to an array for iteration over each value
procedure Forebind(Self : in out List; Values : in Value_Array);
--Bind the values to the fore of the list
procedure Prepend(Self : in out List; Values : in Value_Array) renames Forebind;
--Prepend the values to the list
procedure Hindbind(Self : in out List; Values : in Value_Array);
--Bind the values to the hind of the list
procedure Postpend(Self : in out List; Values : in Value_Array) renames Hindbind;
--Postpend the values to the list
private
type Node is record
Value : Value_Type;
Fore : Node_Access;
Hind : Node_Access;
end record;
type List is new Container with record
Length : Natural := 0;
Foremost : Node_Access;
Hindmost : Node_Access;
end record with
Constant_Indexing => Constant_Indexer,
Default_Iterator => Iterate,
Iterator_Element => Value_Type,
Variable_Indexing => Variable_Indexer;
type List_Access is access all List;
type Cursor is record
List : List_Access;
Node : Node_Access;
end record;
function Has_Element(Self : Cursor) return Boolean with Inline, Pure_Function;
package Iterator_Interfaces is new Ada.Iterator_Interfaces(Cursor, Has_Element);
type Iterator is new Iterator_Interfaces.Reversible_Iterator with record
List : List_Access;
end record;
overriding function First(Self : Iterator) return Cursor with Pure_Function;
overriding function Next(Self : Iterator; Position : Cursor) return Cursor with Pure_Function;
overriding function Last(Self : Iterator) return Cursor with Pure_Function;
overriding function Previous(Self : Iterator; Position : Cursor) return Cursor with Pure_Function;
function Iterate(Self : in List) return Iterator_Interfaces.Reversible_Iterator'Class with Pure_Function;
type Constant_Reference(Value : not null access constant Value_Type) is limited null record with Implicit_Dereference => Value;
function Constant_Indexer(Self : in List; Index : in Positive) return Constant_Reference with Pre => Index <= Self.Length, Pure_Function;
function Constant_Indexer(Self : in List; Index : in Cursor) return Constant_Reference with Pure_Function;
type Variable_Reference(Value : not null access Value_Type) is limited null record with Implicit_Dereference => Value;
function Variable_Indexer(Self : in List; Index : in Positive) return Variable_Reference with Pre => Index <= Self.Length, Pure_Function;
function Variable_Indexer(Self : in List; Index : in Cursor) return Variable_Reference with Pure_Function;
end Containers.Lists.Doubly_Linked;
|
pombredanne/ravenadm | Ada | 2,641 | ads | -- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
package Definitions is
pragma Pure;
raven_version_major : constant String := "0";
raven_version_minor : constant String := "71";
copyright_years : constant String := "2015-2017";
raven_tool : constant String := "ravenadm";
variant_standard : constant String := "standard";
contact_nobody : constant String := "nobody";
contact_automaton : constant String := "automaton";
dlgroup_main : constant String := "main";
dlgroup_none : constant String := "none";
options_none : constant String := "none";
options_all : constant String := "all";
broken_all : constant String := "all";
boolean_yes : constant String := "yes";
homepage_none : constant String := "none";
spkg_complete : constant String := "complete";
spkg_docs : constant String := "docs";
spkg_examples : constant String := "examples";
ports_default : constant String := "floating";
default_ssl : constant String := "libressl";
default_mysql : constant String := "oracle-5.7";
default_lua : constant String := "5.3";
default_perl : constant String := "5.26";
default_pgsql : constant String := "9.6";
default_php : constant String := "7.1";
default_python3 : constant String := "3.6";
default_ruby : constant String := "2.4";
default_tcltk : constant String := "8.6";
default_firebird : constant String := "2.5";
default_compiler : constant String := "gcc7";
compiler_version : constant String := "7.2.0";
previous_compiler : constant String := "7.1.0";
binutils_version : constant String := "2.29";
previous_binutils : constant String := "2.28";
arc_ext : constant String := ".txz";
jobs_per_cpu : constant := 2;
type supported_opsys is (dragonfly, freebsd, netbsd, openbsd, sunos, linux, macos);
type supported_arch is (x86_64, i386, aarch64);
type cpu_range is range 1 .. 32;
type scanners is range cpu_range'First .. cpu_range'Last;
type builders is range cpu_range'First .. cpu_range'Last * jobs_per_cpu;
type count_type is (total, success, failure, ignored, skipped);
-- Modify following with post-patch sed accordingly
platform_type : constant supported_opsys := dragonfly;
host_localbase : constant String := "/raven";
host_pkg8 : constant String := host_localbase & "/sbin/pkg-static";
ravenexec : constant String := host_localbase & "/libexec/ravenexec";
end Definitions;
|
Gabriel-Degret/adalib | Ada | 608 | ads | -- Standard Ada library specification
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
with Ada.Containers;
function Ada.Strings.Unbounded.Hash_Case_Insensitive
(Key : Unbounded_String) return Containers.Hash_Type;
pragma Preelaborate(Ada.Strings.Unbounded.Hash_Case_Insensitive);
|
reznikmm/matreshka | Ada | 3,629 | 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.Db_Key_Elements is
pragma Preelaborate;
type ODF_Db_Key is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Db_Key_Access is
access all ODF_Db_Key'Class
with Storage_Size => 0;
end ODF.DOM.Db_Key_Elements;
|
BenjaminMWargo/ADABlackjack | Ada | 16,229 | adb | with ada.text_io; use ada.text_io;
With ada.integer_text_io; use ada.integer_text_io;
with Ada,Ada.Numerics.Discrete_Random;
use Ada,Ada.Numerics;
with Ada.Unchecked_Deallocation;
package body tools is
procedure Free is new ada.Unchecked_Deallocation (Object => card, Name => cardPTR);
function makeEmptyDeck (d:deck ) return deck is
temp: deck;
begin -- Make deck with no cards
temp.first := new card;
temp.first := NULL;
return temp;
end makeEmptyDeck;
-- -------------------------------------------
function makeDeck (d:deck ) return deck is
temp : deck;
begin -- Nested loops to load deck with each combo of value/suits
temp.first := NULL;
for i in cardValue'Range loop
for j in cardSuit'Range loop
temp.first := new card'(val => i, suit => j, next =>temp.first);
end loop;
end loop;
return temp;
end makeDeck;
-- -------------------------------------------
procedure showDeck ( d: in deck ) is
temp: deck;
begin
temp.first := d.first;
-- Traverses deck, printing val and suit for eachg
while ( temp.first /= NULL ) loop
put( " |");
put(cardValue'Image(temp.first.Val ));
Put ( "|");
suit_IO.put(temp.first.Suit);
Put ( "| ");
new_line;
temp.first := temp.first.next;
end loop;
new_line;
end showDeck;
-- -----------------------------------------
procedure drawToHand (hand : in out deck; drawDeck: in out deck; discardDeck: in out deck) is
-- Takes top card of drawDeck and puts it on the top of hand
temp:cardPTR;
begin
--Check for empty deck, if empty, shuffle in discard into deck
if (drawDeck.first = NULL) then
shuffle(drawDeck,discardDeck);
end if;
temp := hand.first;
-- if hand was empty
if temp = NULL then
hand.first := drawDeck.first;
drawDeck.first := drawDeck.first.next;
hand.first.next := NULL;
else
while not (temp.next = NULL) loop
temp := temp.next;
end loop;
temp.next := drawDeck.first;
drawDeck.first := drawDeck.first.next;
temp.next.next := NULL;
end if; -- Put card at end of hand
end drawToHand;
-- ------------------------------------------------------
procedure shuffle( draw: in out deck; discard: in out deck) is
Temp1: cardPTR;
Temp2: cardPTR;
Temp3: CardValue;
Temp4: CardSuit;
counter, num1, num2: Integer;
count : Integer := 0;
outercount : Integer := 0;
cardTotal : integer :=0;
SUBTYPE RandomRange IS Positive RANGE 1..52;
PACKAGE Random_52 IS NEW Ada.Numerics.Discrete_Random
(Result_Subtype => RandomRange);
G: Random_52.Generator;
BEGIN
-- ada.text_io.put("ShuffleCalled");
-- if draw.first /= NULL then -- makes sure draw is not null
-- temp1 := draw.first;
-- loop
-- exit when Temp1.next =NULL; -- traverses the list to get to the last node
-- Temp1 := Temp1.next;
-- end loop;
-- end if;
-- temp1 is last card of drawDeck
temp1 := discard.first;
while temp1 /= NULL loop
temp1 := temp1.next;
end loop;
-- ada.text_io.put("Loop 1");
-- temp1 points to last card of discard
if (draw.first /= NULL) then
Temp1.next := draw.first;
draw.first := NULL;
-- puts all cards in the discard deck
end if;
-- ada.text_io.put("if 1");
-- draw.first := NULL;
-- ============================
temp1 := discard.first;
while temp1 /= NULL loop
cardTotal := cardTotal +1;
temp1 := temp1.next;
end loop;
-- ada.text_io.put("Loop 2");
-- ============================
Temp1 := discard.first;
Temp2 := discard.first;
counter := 0;
-- loop -- outer loop
Random_52.Reset (Gen => G);
loop
num1 := Random_52.Random(Gen => G); -- gets two random numbers
num2 := Random_52.Random(Gen => G);
num1 := (num1+1) rem (cardTotal+1);
num2 := (num2+1) rem (cardTotal+1);
-- ada.integer_text_io.put(num1);
-- new_line;
-- ada.integer_text_io.put(num2);
-- new_line;
delay Duration(0.00001);
-- Random_52.Reset (Gen => G);
-- if (num1 <= cardTotal) and (num2 <= cardTotal) then
-- exit;
-- end if;
-- end loop;
if (num1 /= num2) then -- compare the numbers to make sure they are not the same
if (Temp1 /= NULL) then -- checks to make sure Temp1 is not null
if (count/= num1) then
Temp1 := Temp1.next;
end if;
end if;
If (Temp2 /= NULL) then -- checks to make sure Temp2 is not null
If (count /= num2) then
Temp2 := Temp2.next;
end if;
end if;
count := count +1;
If (Temp1 /= NULL) then -- If Temp1 does not equal NULL Temp3 holds Temp1's value and Temp4 holds Temp1's suit
Temp3 := Temp1.val;
Temp4 := Temp1.suit;
end if;
if (Temp2 /= NULL and Temp1 /= NULL) then -- if Temp1 and Temp2 are not null then
Temp1.val := Temp2.val; -- the values and suits from Temp1 and Temp2 are switched
Temp1.suit := Temp2.suit;
Temp2.val := Temp3;
Temp2.suit := Temp4;
end if;
end if;
exit when counter = 52;
counter := counter+1; -- increments counter to insure loop will be exited from
end loop;
draw.first := discard.first;
discard.first := NULL;
end shuffle;
----------------------------------------------
--
function getScore(hand : in deck ) return integer is
temp : deck := hand;
Num : Integer:=0;
Total : Integer := 0;
aCount : Integer:= 0;
begin
loop
exit when temp.first = NULL;
if temp.first.val = '1' then
Num := 10;
end if;
if temp.first.val = '2' then
Num := 2;
end if;
if temp.first.val = '3' then
Num := 3;
end if;
if temp.first.val = '4' then
Num := 4;
end if;
if temp.first.val = '5' then
Num := 5;
end if;
if temp.first.val = '6' then
Num := 6;
end if;
if temp.first.val = '7' then
Num := 7;
end if;
if temp.first.val = '8' then
Num := 8;
end if;
if temp.first.val = '9' then
Num := 9;
end if;
if temp.first.val = 'J' then
Num := 10;
end if;
if temp.first.val = 'Q' then
Num := 10;
end if;
if temp.first.val = 'K' then
Num := 10;
end if;
if temp.first.val = 'A' then
num :=11;
aCount := aCount + 1; -- Add up all the A's and put them in at the end;
end if;
Total := Total +Num;
temp.first := temp.first.next;
end loop;
-- add in A's at the end
loop
exit when aCount = 0;
if ((total >21) and (aCount>0)) then
total := total - 10;
-- aCount := aCount - 1;
end if;
-- if (total > 10) and (aCount>0) then
-- total := total + 1;
aCount := aCount - 1;
end loop;
return Total;
end GetScore;
-- ---------------------------
function checkBust(total : in integer) return boolean is
begin
if (total > 21) then
return True;
else
return False;
end if;
end checkBust;
-- --------------------------------
procedure discardHand(Hand: in out deck;discard: in out deck) is
temp: cardPTR;
begin
temp := hand.first;
Loop
exit when temp = NULL;
hand.first := hand.first.next;
temp.next := discard.first;
discard.first := temp;
temp:= hand.first;
-- drawToHand(discard,hand,discard); -- Draws cards from the hand, into the discard;
end loop;
end discardHand;
-- ---------------------------------
procedure display (Hand : in deck) is
temp : deck;
Value : Character;
-- count : Integer;
begin
-- ===========================
-- TOP OF EACH CARD
-- ===========================
temp := Hand;
loop
exit when temp.first = NULL;
if temp.first.val = '1' then
Value := 'T';
end if;
if temp.first.val = '2' then
Value := '2';
end if;
if temp.first.val = '3' then
Value := '3';
end if;
if temp.first.val = '4' then
Value := '4';
end if;
if temp.first.val = '5' then
Value := '5';
end if;
if temp.first.val = '6' then
Value := '6';
end if;
if temp.first.val = '7' then
Value := '7';
end if;
if temp.first.val = '8' then
Value := '8';
end if;
if temp.first.val = '9' then
Value := '9';
end if;
if temp.first.val = 'J' then
Value := 'J';
end if;
if temp.first.val = 'Q' then
Value := 'Q';
end if;
if temp.first.val = 'K' then
Value := 'K';
end if;
if temp.first.val = 'A' then
Value := 'A';
end if;
Put(".------.");
temp.first := temp.first.next;
end loop;
temp := Hand;
-- ==========================
-- LINE 2 OF EACH CARD
-- ==========================
new_line;
loop
exit when temp.first = NULL;
if temp.first.val = '1' then
Value := 'T';
end if;
if temp.first.val = '2' then
Value := '2';
end if;
if temp.first.val = '3' then
Value := '3';
end if;
if temp.first.val = '4' then
Value := '4';
end if;
if temp.first.val = '5' then
Value := '5';
end if;
if temp.first.val = '6' then
Value := '6';
end if;
if temp.first.val = '7' then
Value := '7';
end if;
if temp.first.val = '8' then
Value := '8';
end if;
if temp.first.val = '9' then
Value := '9';
end if;
if temp.first.val = 'J' then
Value := 'J';
end if;
if temp.first.val = 'Q' then
Value := 'Q';
end if;
if temp.first.val = 'K' then
Value := 'K';
end if;
if temp.first.val = 'A' then
Value := 'A';
end if;
if temp.first.suit = C then
Put("|");
Put(Value);
Put(" _ ");
Put("|");
elsif temp.first.suit = H then
Put("|");
Put(Value);
Put("_ _ ");
Put("|");
elsif temp.first.suit = D then
Put("|");
Put(Value);
Put(" /\ ");
Put("|");
elsif temp.first.suit = S then
Put("|");
Put(Value);
Put(" . ");
Put("|");
end if;
temp.first := temp.first.next;
end loop;
temp := Hand;
new_line;
-- =================================
-- LINE 3 OF EACH CARD
-- ================================
loop
exit when temp.first = NULL;
if temp.first.val = '1' then
Value := 'T';
end if;
if temp.first.val = '2' then
Value := '2';
end if;
if temp.first.val = '3' then
Value := '3';
end if;
if temp.first.val = '4' then
Value := '4';
end if;
if temp.first.val = '5' then
Value := '5';
end if;
if temp.first.val = '6' then
Value := '6';
end if;
if temp.first.val = '7' then
Value := '7';
end if;
if temp.first.val = '8' then
Value := '8';
end if;
if temp.first.val = '9' then
Value := '9';
end if;
if temp.first.val = 'J' then
Value := 'J';
end if;
if temp.first.val = 'Q' then
Value := 'Q';
end if;
if temp.first.val = 'K' then
Value := 'K';
end if;
if temp.first.val = 'A' then
Value := 'A';
end if;
if temp.first.suit = C then
Put("|");
Put(" (");
Put(" ");
Put(")");
Put(" ");
Put("|");
elsif temp.first.suit = H then
Put("|");
Put("(");
Put(" ");
Put("\");
Put("/");
Put(" )");
Put("|");
elsif temp.first.suit = D then
Put("| / \ |");
elsif temp.first.suit = S then
Put("| / \ |");
end if;
temp.first := temp.first.next;
end loop;
temp := Hand;
new_line;
-- ===================================
-- LINE 4
-- ===================================
loop
exit when temp.first = NULL;
if temp.first.val = '1' then
Value := 'T';
end if;
if temp.first.val = '2' then
Value := '2';
end if;
if temp.first.val = '3' then
Value := '3';
end if;
if temp.first.val = '4' then
Value := '4';
end if;
if temp.first.val = '5' then
Value := '5';
end if;
if temp.first.val = '6' then
Value := '6';
end if;
if temp.first.val = '7' then
Value := '7';
end if;
if temp.first.val = '8' then
Value := '8';
end if;
if temp.first.val = '9' then
Value := '9';
end if;
if temp.first.val = 'J' then
Value := 'J';
end if;
if temp.first.val = 'Q' then
Value := 'Q';
end if;
if temp.first.val = 'K' then
Value := 'K';
end if;
if temp.first.val = 'A' then
Value := 'A';
end if;
if temp.first.suit = C then
Put("|");
Put("(");
Put("_");
Put("x");
Put("_");
Put(") ");
Put("|");
elsif temp.first.suit = H then
Put("| \ / |");
elsif temp.first.suit = D then
Put("| \ / |");
elsif temp.first.suit = S then
Put("|(_,_) |");
end if;
temp.first := temp.first.next;
end loop;
temp := Hand;
new_line;
-- ==================================
-- LINE 5
-- ==================================
loop
exit when temp.first = NULL;
if temp.first.val = '1' then
Value := 'T';
end if;
if temp.first.val = '2' then
Value := '2';
end if;
if temp.first.val = '3' then
Value := '3';
end if;
if temp.first.val = '4' then
Value := '4';
end if;
if temp.first.val = '5' then
Value := '5';
end if;
if temp.first.val = '6' then
Value := '6';
end if;
if temp.first.val = '7' then
Value := '7';
end if;
if temp.first.val = '8' then
Value := '8';
end if;
if temp.first.val = '9' then
Value := '9';
end if;
if temp.first.val = 'J' then
Value := 'J';
end if;
if temp.first.val = 'Q' then
Value := 'Q';
end if;
if temp.first.val = 'K' then
Value := 'K';
end if;
if temp.first.val = 'A' then
Value := 'A';
end if;
if temp.first.suit = C then
Put("| ");
Put("Y");
Put(" ");
Put(Value);
Put("|");
elsif temp.first.suit = H then
Put("| \/ ");
Put(Value);
Put("|");
elsif temp.first.suit = D then
Put("| \/ ");
Put(Value);
Put("|");
elsif temp.first.suit = S then
Put("| I ");
Put(Value);
Put("|");
end if;
temp.first := temp.first.next;
end loop;
temp := Hand;
-- ================================
-- Bottom of card
-- ================================
new_line;
loop
exit when temp.first = NULL;
Put(".------.");
temp.first := temp.first.next;
end loop;
-- ==================================
--
-- ==================================
new_line;
end display;
-- ----------------------------------
end tools;
|
damaki/SPARKNaCl | Ada | 2,132 | adb | with Hash;
with Hash1;
with Box;
with Box7;
with Box8;
with Core1;
with Core3;
with ECDH;
with Onetimeauth;
with Onetimeauth2;
with Onetimeauth7;
with HMAC;
with HKDF1;
with Scalarmult;
with Scalarmult2;
with Scalarmult5;
with Scalarmult6;
with Secretbox;
with Secretbox2;
with Secretbox3;
with Secretbox7;
with Secretbox8;
with Secretbox9;
with Secretbox10;
with Sign;
with Stream;
with Stream2;
with Stream3;
with Stream4;
with Stream5;
with Stream6;
with Stream7;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Exceptions; use Ada.Exceptions;
with GNAT.Traceback.Symbolic; use GNAT.Traceback.Symbolic;
procedure Testall
is
begin
Put_Line ("Hash");
Hash;
Put_Line ("Hash1");
Hash1;
Put_Line ("Box");
Box;
Put_Line ("Box7");
Box7;
Put_Line ("Box8");
Box8;
Put_Line ("Core1");
Core1;
Put_Line ("Core3");
Core3;
Put_Line ("Onetimeauth");
Onetimeauth;
Put_Line ("Onetimeauth2");
Onetimeauth2;
Put_Line ("Onetimeauth7");
Onetimeauth7;
Put_Line ("HMAC");
HMAC;
Put_Line ("Scalarmult");
Scalarmult;
Put_Line ("Scalarmult2");
Scalarmult2;
Put_Line ("Scalarmult5");
Scalarmult5;
Put_Line ("Scalarmult6");
Scalarmult6;
Put_Line ("Secretbox");
Secretbox;
Put_Line ("Secretbox2");
Secretbox2;
Put_Line ("Secretbox3");
Secretbox3;
Put_Line ("Secretbox7");
Secretbox7;
Put_Line ("Secretbox8");
Secretbox8;
Put_Line ("Secretbox9");
Secretbox9;
Put_Line ("Secretbox10");
Secretbox10;
Put_Line ("Sign");
Sign;
Put_Line ("Stream");
Stream;
Put_Line ("Stream2");
Stream2;
Put_Line ("Stream3");
Stream3;
Put_Line ("Stream4");
Stream4;
Put_Line ("Stream5");
Stream5;
Put_Line ("Stream6");
Stream6;
Put_Line ("Stream7");
Stream7;
Put_Line ("ECDH");
ECDH;
Put_Line ("HKDF");
HKDF1;
exception
when E : others =>
Put_Line (Exception_Message (E));
Put_Line (Exception_Information (E));
Put_Line (Symbolic_Traceback (E));
end Testall;
|
reznikmm/matreshka | Ada | 3,600 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-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 file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements.Generic_Hash;
function AMF.OCL.Call_Exps.Hash is
new AMF.Elements.Generic_Hash (OCL_Call_Exp, OCL_Call_Exp_Access);
|
AdaCore/gpr | Ada | 1,664 | adb | --
-- Copyright (C) 2020-2023, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-Exception
--
with GPR2.C.JSON;
with GPR2.C.Tree;
with GPR2.C.View;
with GPR2.C.Source;
package body GPR2.C is
type Binding_Map is array (C_Function range <>) of GPR2.C.JSON.Bind_Handler;
Binding : constant Binding_Map :=
(TREE_LOAD => Tree.Load'Access,
TREE_UNLOAD => Tree.Unload'Access,
TREE_LOG_MESSAGES => Tree.Log_Messages'Access,
TREE_INVALIDATE_SOURCE_LIST => Tree.Invalidate_Source_List'Access,
TREE_UPDATE_SOURCE_LIST => Tree.Update_Source_List'Access,
TREE_UPDATE_SOURCE_INFOS => Tree.Update_Source_Infos'Access,
VIEW_LOAD => View.Load'Access,
VIEW_ATTRIBUTE => View.Attribute'Access,
VIEW_SOURCES => View.Sources'Access,
VIEW_UNITS => View.Units'Access,
SOURCE_DEPENDENCIES => Source.Dependencies'Access,
SOURCE_UPDATE_SOURCE_INFOS => Source.Update_Source_Infos'Access);
----------------------
-- GPR2_Free_Answer --
----------------------
procedure GPR2_Free_Answer (Answer : C_Answer) is
use Interfaces.C.Strings;
Tmp : chars_ptr := chars_ptr (Answer);
begin
Free (Tmp);
end GPR2_Free_Answer;
------------------
-- GPR2_Request --
------------------
function GPR2_Request
(Fun : C_Function; Request : C_Request; Answer : out C_Answer)
return C_Status
is
begin
return GPR2.C.JSON.Bind (Request, Answer, Binding (Fun));
end GPR2_Request;
end GPR2.C;
|
reznikmm/matreshka | Ada | 3,809 | 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.Anim_Color_Interpolation_Direction_Attributes is
pragma Preelaborate;
type ODF_Anim_Color_Interpolation_Direction_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Anim_Color_Interpolation_Direction_Attribute_Access is
access all ODF_Anim_Color_Interpolation_Direction_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Anim_Color_Interpolation_Direction_Attributes;
|
msrLi/portingSources | Ada | 1,202 | adb | -- Copyright 2009-2014 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo is
type Octal is new Integer range 0 .. 7;
type Octal_Array is array (Positive range <>) of Octal;
pragma Pack (Octal_Array);
type Octal_Buffer (Size : Positive) is record
Buffer : Octal_Array (1 .. Size);
Length : Integer;
end record;
My_Buffer : Octal_Buffer (Size => 8);
begin
My_Buffer.Buffer := (1, 2, 3, 4, 5, 6, 7, 0);
My_Buffer.Length := My_Buffer.Size;
Do_Nothing (My_Buffer'Address); -- START
end Foo;
|
reznikmm/matreshka | Ada | 4,182 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Qt4.Graphics_Views;
private with Qt4.Graphics_Views.Directors;
private with Qt4.Painters;
private with Qt4.Rect_Fs;
with Qt4.Widgets;
package Modeler.Diagram_Views is
type Diagram_View is
limited new Qt4.Graphics_Views.Q_Graphics_View with private;
type Diagram_View_Access is access all Diagram_View'Class;
package Constructors is
function Create
(Parent : access Qt4.Widgets.Q_Widget'Class := null)
return not null Diagram_View_Access;
end Constructors;
private
type Diagram_View is
limited new Qt4.Graphics_Views.Directors.Q_Graphics_View_Director
with null record;
overriding procedure Draw_Background
(Self : not null access Diagram_View;
Painter : in out Qt4.Painters.Q_Painter'Class;
Rect : Qt4.Rect_Fs.Q_Rect_F);
end Modeler.Diagram_Views;
|
Heziode/lsystem-editor | Ada | 1,560 | ads | -------------------------------------------------------------------------------
-- 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.
-------------------------------------------------------------------------------
-- @description
-- This package encompass all packages related to L-System.
--
package LSE.Model.L_System is
pragma Pure;
end LSE.Model.L_System;
|
stcarrez/dynamo | Ada | 151,972 | adb | ------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . E N C L _ E L --
-- --
-- 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 Asis; use Asis;
with Asis.Declarations; use Asis.Declarations;
with Asis.Elements; use Asis.Elements;
with Asis.Extensions;
with Asis.Set_Get; use Asis.Set_Get;
with A4G.A_Sem; use A4G.A_Sem;
with A4G.A_Types; use A4G.A_Types;
with A4G.Int_Knds; use A4G.Int_Knds;
with A4G.Mapping; use A4G.Mapping;
with A4G.Queries; use A4G.Queries;
with A4G.Vcheck; use A4G.Vcheck;
with Atree; use Atree;
with Einfo; use Einfo;
with Namet; use Namet;
with Nlists; use Nlists;
with Sinfo; use Sinfo;
with Sinput; use Sinput;
with Snames;
with Stand; use Stand;
with Types; use Types;
package body A4G.Encl_El is
------------------------------------------------
-- The general approach to the implementation --
-- of the Enclosing_Element query --
------------------------------------------------
-- There are important differences in the ways how an Enclosing_Element
-- is retrieved for explicit and implicit Elements, and for the elements
-- from expanded generics. For explicit Elements, the general way to get
-- the enclosing Element is to do the necessary bottom-up tree traversing,
-- for most of the cases all what we need if one step up the front-end
-- tree, but sometimes the differences between front-end and ASIS trees
-- require some non-trivial traversing.
--
-- For implicit Elements, there is a semantic link between a top Element
-- of an ASIS implicit sub-hierarchy and some explicit Element that
-- "generates" this subhierarchy. For example, an implicit declaration of
-- an inherited supprogram is "generated" by some derived type definition,
-- so inside the implicit subhierarchy we use the same approach for
-- retrieving the enclosing Element as for explicit Elements, but the
-- enclosing Element for subhierarchy is the construct that "generates" the
-- subhierarchy, and to get to this construct, the link stored as a part
-- of implicit elements structure is used.
--
-- For Elements from generic instantiations, we do bottom-up traversing of
-- the ASIS/front-end tree structure corresponding to the expanded code
-- in the same way as for explicit Elements, but when we are at the top of
-- an expanded spec or body, the next Enclosing_Element step should go
-- to the corresponding instantiation, so here we also do something
-- different that bottom-up tree traversing
--
-- But for most of the cases the way to get the enclosing Element is to
-- map the bottom-up traversing of the compiler tree onto the ASIS Elements
-- hierarchy. This is performed by Enclosing_Element_For_Explicit function,
-- and all the other routines defined in this package detect and process
-- various special cases. For implicit Elements and for Elements that are
-- components of expanded generic structure the first thing is to check if
-- this Element can be processed as if it is a usual explicit Element, and
-- then correct result, if needed.
---------------------------------------------------------------------
-- Mapping the bottom-up traversing of the compiler tree onto ASIS --
---------------------------------------------------------------------
-- Each ASIS Element contains the reference to the tree node it has been
-- built from. In many cases the enclosing Element should be built on
-- the parent node. In some cases the enclosing Element may be built on the
-- same node. And there are some cases when we have to do some traversing
-- that is specific to this particular Element to get to the compiler tree
-- node corresponding to its enclosing Element.
-- The way of getting the enclosing Element is implemented on the base of
-- two look-up tables (switches). The first table defines if for the given
-- element (that is, for the given Element kind, and the internal flat
-- Element classification is used here) some regular way of constructing
-- enclosing Element should be used, or some non-trivial traversing is
-- needed. This non-trivial traversing is specific to the Element kind, and
-- the corresponding routine is defined by the second look-up table.
-------------------------------------------------
-- The general structure of this package body --
-------------------------------------------------
-- The rest of this package body has the following structure:
--
-- Section 1 - definition of the first Enclosing_Element switch (makes
-- the difference between trivial and non-trivial cases of
-- mapping the bottom up compiler tree traversing onto ASIS
--
-- Section 2 - declarations of routines implementing various cases of
-- non-trivial bottom up compiler tree traversing
--
-- Section 3 - definition of the second Enclosing_Element switch (maps
-- Element kind requiring non-trivial actions onto
-- corresponding routines
--
-- Section 4 - (general-purpose) local subprograms
--
-- Section 5 - bodies of the routines declared in Section 2
--
-- Section 6 - bodies of the routines declared in the package spec
---------------------------------------------------------------------
-- Section 1 - Enclosing_Element first switch, separating trivial --
-- and non-trivial cases --
---------------------------------------------------------------------
-- This switch maps each value of the Internal_Element_Kinds onto one
-- of the following values of the same type, and this mapping has the
-- following meaning:
-- Not_An_Element => Asis.Nil_Element should be returned as
-- Enclosed Element;
--
-- Trivial_Mapping => A standard Enclosing_Element constructor should
-- be used, it is implemented by General_Encl_Elem
-- function
--
-- No_Mapping => is set for the special values added to the
-- Internal_Element_Kinds literals to organize the
-- Node_to_Element and Enclosing Element switches.
--
-- Non_Trivial_Mapping => a special function is needed for this Element
-- kind to get the Enclosing Element. This function
-- is selected by second switch,
--
-- Not_Implemented_Mapping => it means what is sounds
--
-- any the other value => the Enclosing Element for the Element of the
-- corresponding kind is based on the same node, but
-- is of the specified kind
Enclosing_Element_For_Explicits_First_Switch : constant
array (Internal_Element_Kinds) of Internal_Element_Kinds :=
(
-- type Internal_Element_Kinds is (
--
Not_An_Element => Not_An_Element,
-- Asis.Nil_Element should be returned as the
-- Enclosing for the Asis.Nil_Element, should not it???
--
------------------------------------------------------------------------------
--
-- -- A_Pragma, -- Asis.Elements
--
------------------------------------------------------------------------------
--
An_All_Calls_Remote_Pragma ..
-- An_Asynchronous_Pragma,
-- An_Atomic_Pragma,
-- An_Atomic_Components_Pragma,
-- An_Attach_Handler_Pragma,
-- A_Controlled_Pragma,
-- A_Convention_Pragma,
-- A_Discard_Names_Pragma,
-- An_Elaborate_Pragma,
-- An_Elaborate_All_Pragma,
-- An_Elaborate_Body_Pragma,
-- An_Export_Pragma,
-- An_Import_Pragma,
-- An_Inline_Pragma,
-- An_Inspection_Point_Pragma,
-- An_Interrupt_Handler_Pragma,
-- An_Interrupt_Priority_Pragma,
-- A_Linker_Options_Pragma
-- A_List_Pragma,
-- A_Locking_Policy_Pragma,
-- A_Normalize_Scalars_Pragma,
-- An_Optimize_Pragma,
-- A_Pack_Pragma,
-- A_Page_Pragma,
-- A_Preelaborate_Pragma,
-- A_Priority_Pragma,
-- A_Pure_Pragma,
-- A_Queuing_Policy_Pragma,
-- A_Remote_Call_Interface_Pragma,
-- A_Remote_Types_Pragma,
-- A_Restrictions_Pragma,
-- A_Reviewable_Pragma,
-- A_Shared_Passive_Pragma,
-- A_Storage_Size_Pragma,
-- A_Suppress_Pragma,
-- A_Task_Dispatching_Policy_Pragma,
-- A_Volatile_Pragma,
-- A_Volatile_Components_Pragma,
--
-- An_Implementation_Defined_Pragma,
--
An_Unknown_Pragma => Non_Trivial_Mapping,
--
------------------------------------------------------------------------------
--
-- -- A_Defining_Name, -- Asis.Declarations
--
------------------------------------------------------------------------------
--
A_Defining_Identifier => Non_Trivial_Mapping,
A_Defining_Character_Literal => An_Enumeration_Literal_Specification,
A_Defining_Enumeration_Literal => An_Enumeration_Literal_Specification,
--
-- -- A_Defining_Operator_Symbol => Non_Trivial_Mapping
--
A_Defining_And_Operator ..
-- A_Defining_Or_Operator,
-- A_Defining_Xor_Operator,
-- A_Defining_Equal_Operator,
-- A_Defining_Not_Equal_Operator,
-- A_Defining_Less_Than_Operator,
-- A_Defining_Less_Than_Or_Equal_Operator,
-- A_Defining_Greater_Than_Operator,
-- A_Defining_Greater_Than_Or_Equal_Operator,
-- A_Defining_Plus_Operator,
-- A_Defining_Minus_Operator,
-- A_Defining_Concatenate_Operator,
-- A_Defining_Unary_Plus_Operator,
-- A_Defining_Unary_Minus_Operator,
-- A_Defining_Multiply_Operator,
-- A_Defining_Divide_Operator,
-- A_Defining_Mod_Operator,
-- A_Defining_Rem_Operator,
-- A_Defining_Exponentiate_Operator,
-- A_Defining_Abs_Operator,
A_Defining_Not_Operator => Non_Trivial_Mapping,
A_Defining_Expanded_Name => Non_Trivial_Mapping,
--
------------------------------------------------------------------------------
--
-- -- A_Declaration, -- Asis.Declarations
--
------------------------------------------------------------------------------
--
An_Ordinary_Type_Declaration ..
-- A_Task_Type_Declaration,
-- A_Protected_Type_Declaration,
-- An_Incomplete_Type_Declaration,
-- A_Private_Type_Declaration,
-- A_Private_Extension_Declaration,
-- A_Subtype_Declaration,
A_Variable_Declaration => Trivial_Mapping,
A_Constant_Declaration => Trivial_Mapping,
A_Deferred_Constant_Declaration ..
-- A_Single_Task_Declaration,
-- A_Single_Protected_Declaration,
--
-- An_Integer_Number_Declaration,
A_Real_Number_Declaration => Trivial_Mapping,
--
An_Enumeration_Literal_Specification => Non_Trivial_Mapping,
-- is it really so?
--
A_Discriminant_Specification => Non_Trivial_Mapping,
A_Component_Declaration => Non_Trivial_Mapping,
A_Loop_Parameter_Specification ..
-- A_Generalized_Iterator_Specification,
An_Element_Iterator_Specification => Non_Trivial_Mapping,
A_Procedure_Declaration => Non_Trivial_Mapping,
A_Function_Declaration => Non_Trivial_Mapping,
--
A_Parameter_Specification => Non_Trivial_Mapping,
--
A_Procedure_Body_Declaration => Non_Trivial_Mapping,
A_Function_Body_Declaration => Non_Trivial_Mapping,
A_Return_Variable_Specification => Trivial_Mapping,
A_Return_Constant_Specification => Trivial_Mapping,
A_Null_Procedure_Declaration => Trivial_Mapping,
An_Expression_Function_Declaration => Trivial_Mapping,
A_Package_Declaration => Non_Trivial_Mapping,
A_Package_Body_Declaration => Non_Trivial_Mapping,
An_Object_Renaming_Declaration => Trivial_Mapping,
An_Exception_Renaming_Declaration => Trivial_Mapping,
A_Package_Renaming_Declaration => Non_Trivial_Mapping,
A_Procedure_Renaming_Declaration => Non_Trivial_Mapping,
A_Function_Renaming_Declaration => Non_Trivial_Mapping,
A_Generic_Package_Renaming_Declaration => Non_Trivial_Mapping,
A_Generic_Procedure_Renaming_Declaration => Non_Trivial_Mapping,
A_Generic_Function_Renaming_Declaration => Non_Trivial_Mapping,
A_Task_Body_Declaration => Non_Trivial_Mapping,
A_Protected_Body_Declaration => Non_Trivial_Mapping,
An_Entry_Declaration => Non_Trivial_Mapping,
An_Entry_Body_Declaration => Trivial_Mapping,
An_Entry_Index_Specification => Trivial_Mapping,
A_Procedure_Body_Stub => Trivial_Mapping,
A_Function_Body_Stub => Trivial_Mapping,
A_Package_Body_Stub => Trivial_Mapping,
A_Task_Body_Stub => Trivial_Mapping,
A_Protected_Body_Stub => Trivial_Mapping,
An_Exception_Declaration => Trivial_Mapping,
A_Choice_Parameter_Specification => Trivial_Mapping,
--
A_Generic_Procedure_Declaration => Non_Trivial_Mapping,
A_Generic_Function_Declaration => Non_Trivial_Mapping,
A_Generic_Package_Declaration => Non_Trivial_Mapping,
A_Package_Instantiation => Non_Trivial_Mapping,
A_Procedure_Instantiation => Non_Trivial_Mapping,
A_Function_Instantiation => Non_Trivial_Mapping,
A_Formal_Object_Declaration => Trivial_Mapping,
A_Formal_Type_Declaration => Trivial_Mapping,
A_Formal_Incomplete_Type_Declaration => Trivial_Mapping,
A_Formal_Procedure_Declaration => Trivial_Mapping,
A_Formal_Function_Declaration => Trivial_Mapping,
A_Formal_Package_Declaration => Trivial_Mapping,
A_Formal_Package_Declaration_With_Box => Trivial_Mapping,
------------------------------------------------------------------------------
--
-- -- A_Definition, -- Asis.Definitions
--
------------------------------------------------------------------------------
--
-- -- A_Type_Definition,
--
A_Derived_Type_Definition => Trivial_Mapping,
A_Derived_Record_Extension_Definition => Trivial_Mapping,
--
An_Enumeration_Type_Definition => Non_Trivial_Mapping,
--
A_Signed_Integer_Type_Definition => Trivial_Mapping,
A_Modular_Type_Definition => Trivial_Mapping,
--
-- -- A_Root_Type_Definition, ----- #########
--
-- A_Root_Integer_Definition, ----- #########
-- A_Root_Real_Definition, ----- #########
-- A_Root_Fixed_Definition, ----- #########
--
-- A_Universal_Integer_Definition, ----- #########
-- A_Universal_Real_Definition, ----- #########
-- A_Universal_Fixed_Definition, ----- #########
--
--
A_Floating_Point_Definition => Trivial_Mapping,
--
An_Ordinary_Fixed_Point_Definition => Trivial_Mapping,
A_Decimal_Fixed_Point_Definition => Trivial_Mapping,
--
An_Unconstrained_Array_Definition => Trivial_Mapping,
A_Constrained_Array_Definition => Trivial_Mapping,
--
A_Record_Type_Definition => Trivial_Mapping, -- ???
A_Tagged_Record_Type_Definition => Trivial_Mapping, -- ???
-- --|A2005 start
-- An_Interface_Type_Definition,
An_Ordinary_Interface ..
-- A_Limited_Interface,
-- A_Task_Interface,
-- A_Protected_Interface,
A_Synchronized_Interface => Trivial_Mapping,
-- --|A2005 end
-- -- An_Access_Type_Definition,
--
A_Pool_Specific_Access_To_Variable => Trivial_Mapping,
An_Access_To_Variable => Trivial_Mapping,
An_Access_To_Constant => Trivial_Mapping,
--
An_Access_To_Procedure => Trivial_Mapping,
An_Access_To_Protected_Procedure => Trivial_Mapping,
An_Access_To_Function => Trivial_Mapping,
An_Access_To_Protected_Function => Trivial_Mapping,
--
--
A_Subtype_Indication => Non_Trivial_Mapping,
--
-- -- A_Constraint,
--
A_Range_Attribute_Reference => Non_Trivial_Mapping, -- ???
A_Simple_Expression_Range => Non_Trivial_Mapping,
A_Digits_Constraint => Trivial_Mapping,
A_Delta_Constraint => Trivial_Mapping,
An_Index_Constraint => Non_Trivial_Mapping,
A_Discriminant_Constraint => Non_Trivial_Mapping,
--
A_Component_Definition => Trivial_Mapping,
--
-- -- A_Discrete_Subtype_Definition,
--
A_Discrete_Subtype_Indication_As_Subtype_Definition => Trivial_Mapping,
A_Discrete_Range_Attribute_Reference_As_Subtype_Definition => Trivial_Mapping,
A_Discrete_Simple_Expression_Range_As_Subtype_Definition => Trivial_Mapping,
--
-- -- A_Discrete_Range,
--
A_Discrete_Subtype_Indication => Non_Trivial_Mapping,
A_Discrete_Range_Attribute_Reference => Non_Trivial_Mapping,
A_Discrete_Simple_Expression_Range => Non_Trivial_Mapping,
--
--
An_Unknown_Discriminant_Part => Non_Trivial_Mapping,
A_Known_Discriminant_Part => Non_Trivial_Mapping,
--
A_Record_Definition => Non_Trivial_Mapping,
A_Null_Record_Definition => Non_Trivial_Mapping,
--
A_Null_Component => Non_Trivial_Mapping,
A_Variant_Part => Non_Trivial_Mapping,
A_Variant => Trivial_Mapping,
An_Others_Choice => Non_Trivial_Mapping,
-- --|A2005 start
An_Anonymous_Access_To_Variable ..
-- An_Anonymous_Access_To_Constant
-- An_Anonymous_Access_To_Procedure
-- An_Anonymous_Access_To_Protected_Procedure
-- An_Anonymous_Access_To_Function
An_Anonymous_Access_To_Protected_Function => Trivial_Mapping,
-- --|A2005 end
A_Private_Type_Definition => A_Private_Type_Declaration,
A_Tagged_Private_Type_Definition => A_Private_Type_Declaration,
A_Private_Extension_Definition => A_Private_Extension_Declaration,
--
A_Task_Definition => Trivial_Mapping,
A_Protected_Definition => Non_Trivial_Mapping,
--
-- -- A_Formal_Type_Definition,
--
A_Formal_Private_Type_Definition ..
-- A_Formal_Tagged_Private_Type_Definition,
--
-- A_Formal_Derived_Type_Definition,
--
-- A_Formal_Discrete_Type_Definition,
--
-- A_Formal_Signed_Integer_Type_Definition,
-- A_Formal_Modular_Type_Definition,
--
-- A_Formal_Floating_Point_Definition,
--
-- A_Formal_Ordinary_Fixed_Point_Definition,
-- A_Formal_Decimal_Fixed_Point_Definition,
--
-- A_Formal_Unconstrained_Array_Definition,
-- A_Formal_Constrained_Array_Definition,
--
-- -- A_Formal_Access_Type_Definition,
--
-- A_Formal_Pool_Specific_Access_To_Variable,
-- A_Formal_Access_To_Variable,
-- A_Formal_Access_To_Constant,
--
-- A_Formal_Access_To_Procedure,
-- A_Formal_Access_To_Protected_Procedure,
-- A_Formal_Access_To_Function,
-- A_Formal_Access_To_Protected_Function
An_Aspect_Specification => Trivial_Mapping,
--
------------------------------------------------------------------------------
--
-- -- An_Expression, -- Asis.Expressions --##########
--
------------------------------------------------------------------------------
--
An_Integer_Literal => Non_Trivial_Mapping,
A_Real_Literal => Non_Trivial_Mapping,
A_String_Literal => Non_Trivial_Mapping,
An_Identifier => Non_Trivial_Mapping,
--
-- -- An_Operator_Symbol,
--
An_And_Operator ..
-- An_Or_Operator,
-- An_Xor_Operator,
-- An_Equal_Operator,
-- A_Not_Equal_Operator,
-- A_Less_Than_Operator,
-- A_Less_Than_Or_Equal_Operator,
-- A_Greater_Than_Operator,
-- A_Greater_Than_Or_Equal_Operator,
-- A_Plus_Operator,
-- A_Minus_Operator,
-- A_Concatenate_Operator,
-- A_Unary_Plus_Operator,
-- A_Unary_Minus_Operator,
-- A_Multiply_Operator,
-- A_Divide_Operator,
-- A_Mod_Operator,
-- A_Rem_Operator,
-- An_Exponentiate_Operator,
-- An_Abs_Operator,
-- A_Not_Operator => A_Function_Call,
A_Not_Operator => Non_Trivial_Mapping,
--
-- A_Character_Literal ..
-- -- An_Enumeration_Literal,
-- An_Explicit_Dereference => Trivial_Mapping,
--
-- A_Function_Call => Non_Trivial_Mapping,
-- --
-- An_Indexed_Component ..
-- A_Slice => Trivial_Mapping,
-- A_Selected_Component => Non_Trivial_Mapping,
-- --
-- -- -- ??? Not_An_Attribute,
-- -- -- An_Attribute_Reference => Non_Trivial_Mapping,
-- --
-- An_Access_Attribute ..
-- -- An_Address_Attribute,
-- -- An_Adjacent_Attribute,
-- -- An_Aft_Attribute,
-- -- An_Alignment_Attribute,
-- -- A_Base_Attribute,
-- -- A_Bit_Order_Attribute,
-- -- A_Body_Version_Attribute,
-- -- A_Callable_Attribute,
-- -- A_Caller_Attribute,
-- -- A_Ceiling_Attribute,
-- -- A_Class_Attribute,
-- -- A_Component_Size_Attribute,
-- -- A_Compose_Attribute,
-- -- A_Constrained_Attribute,
-- -- A_Copy_Sign_Attribute,
-- -- A_Count_Attribute,
-- -- A_Definite_Attribute,
-- -- A_Delta_Attribute,
-- -- A_Denorm_Attribute,
-- -- A_Digits_Attribute,
-- -- An_Exponent_Attribute,
-- -- An_External_Tag_Attribute,
-- -- A_First_Attribute,
-- -- A_First_Bit_Attribute,
-- -- A_Floor_Attribute,
-- -- A_Fore_Attribute,
-- -- A_Fraction_Attribute,
-- -- An_Identity_Attribute,
-- -- An_Image_Attribute,
-- -- An_Input_Attribute,
-- -- A_Last_Attribute,
-- -- A_Last_Bit_Attribute,
-- -- A_Leading_Part_Attribute,
-- -- A_Length_Attribute,
-- -- A_Machine_Attribute,
-- -- A_Machine_Emax_Attribute,
-- -- A_Machine_Emin_Attribute,
-- -- A_Machine_Mantissa_Attribute,
-- -- A_Machine_Overflows_Attribute,
-- -- A_Machine_Radix_Attribute,
-- -- A_Machine_Rounds_Attribute,
-- -- A_Max_Attribute,
-- -- A_Max_Size_In_Storage_Elements_Attribute,
-- -- A_Min_Attribute,
-- -- A_Model_Attribute,
-- -- A_Model_Emin_Attribute,
-- -- A_Model_Epsilon_Attribute,
-- -- A_Model_Mantissa_Attribute,
-- -- A_Model_Small_Attribute,
-- -- A_Modulus_Attribute,
-- -- An_Output_Attribute,
-- -- A_Partition_ID_Attribute,
-- -- A_Pos_Attribute,
-- -- A_Position_Attribute,
-- -- A_Pred_Attribute,
-- -- A_Range_Attribute,
-- -- A_Read_Attribute,
-- -- A_Remainder_Attribute,
-- -- A_Round_Attribute,
-- -- A_Rounding_Attribute,
-- -- A_Safe_First_Attribute,
-- -- A_Safe_Last_Attribute,
-- -- A_Scale_Attribute,
-- -- A_Scaling_Attribute,
-- -- A_Signed_Zeros_Attribute,
-- -- A_Size_Attribute,
-- -- A_Small_Attribute,
-- -- A_Storage_Pool_Attribute,
-- -- A_Storage_Size_Attribute,
-- --
-- -- A_Succ_Attribute,
-- -- A_Tag_Attribute,
-- -- A_Terminated_Attribute,
-- -- A_Truncation_Attribute,
-- -- An_Unbiased_Rounding_Attribute,
-- -- An_Unchecked_Access_Attribute,
-- -- A_Val_Attribute,
-- -- A_Valid_Attribute,
-- -- A_Value_Attribute,
-- -- A_Version_Attribute,
-- -- A_Wide_Image_Attribute,
-- -- A_Wide_Value_Attribute,
-- -- A_Wide_Width_Attribute,
-- -- A_Width_Attribute,
-- -- A_Write_Attribute,
-- --
-- -- An_Implementation_Defined_Attribute, -- Vendor Annex M
-- An_Unknown_Attribute => Non_Trivial_Mapping,
--
-- -- A_Record_Aggregate,
-- -- An_Extension_Aggregate,
-- -- A_Positional_Array_Aggregate,
-- -- A_Named_Array_Aggregate,
-- --
-- -- An_And_Then_Short_Circuit,
-- -- An_Or_Else_Short_Circuit,
-- --
-- -- An_In_Range_Membership_Test,
-- -- A_Not_In_Range_Membership_Test,
-- -- An_In_Type_Membership_Test,
-- -- A_Not_In_Type_Membership_Test,
-- --
-- -- A_Null_Literal,
-- -- A_Parenthesized_Expression,
-- --
-- -- A_Type_Conversion,
-- -- A_Qualified_Expression,
-- --
-- -- An_Allocation_From_Subtype,
-- An_Allocation_From_Qualified_Expression,
-- A_Case_Expression, -- Ada 2012
-- An_If_Expression, -- Ada 2012
-- A_For_All_Quantified_Expression, -- Ada 2012
-- A_For_Some_Quantified_Expression); -- Ada 2012
A_Character_Literal ..
A_For_Some_Quantified_Expression => Non_Trivial_Mapping,
--
------------------------------------------------------------------------------
--
-- -- An_Association, -- Asis.Expressions
--
------------------------------------------------------------------------------
--
A_Pragma_Argument_Association => Trivial_Mapping,
A_Discriminant_Association => Non_Trivial_Mapping,
A_Record_Component_Association => Trivial_Mapping,
An_Array_Component_Association => Non_Trivial_Mapping,
A_Parameter_Association => Non_Trivial_Mapping,
A_Generic_Association => Non_Trivial_Mapping,
--
------------------------------------------------------------------------------
--
-- -- A_Statement, -- Asis.Statements
--
-- All subordinates of A_Statement kind require non trivial processing,
-- this processing is the same for all of them except
-- A_Terminate_Alternative_Statement
------------------------------------------------------------------------------
--
A_Null_Statement ..
-- An_Assignment_Statement,
-- An_If_Statement,
-- A_Case_Statement,
--
-- A_Loop_Statement,
-- A_While_Loop_Statement,
-- A_For_Loop_Statement,
--
-- A_Block_Statement,
-- An_Exit_Statement,
-- A_Goto_Statement,
--
-- A_Procedure_Call_Statement,
-- A_Return_Statement,
--
-- An_Accept_Statement,
-- An_Entry_Call_Statement,
--
-- A_Requeue_Statement,
-- A_Requeue_Statement_With_Abort,
--
-- A_Delay_Until_Statement,
-- A_Delay_Relative_Statement,
--
-- A_Terminate_Alternative_Statement,
-- A_Selective_Accept_Statement,
-- A_Timed_Entry_Call_Statement,
-- A_Conditional_Entry_Call_Statement,
-- An_Asynchronous_Select_Statement,
--
-- An_Abort_Statement,
-- A_Raise_Statement,
A_Code_Statement => Non_Trivial_Mapping,
--
------------------------------------------------------------------------------
-- Path_Kinds
-- Literals -- Ada RM 95
--
-- Detailed classification for
-- ASIS_Element_Kinds.Element_Kinds(A_Path) literal
-- corresponds to subtype Internal_Path_Kinds
------------------------------------------------------------------------------
An_If_Path => An_If_Statement,
An_Elsif_Path => Trivial_Mapping,
An_Else_Path => Non_Trivial_Mapping,
A_Case_Path => Trivial_Mapping,
A_Select_Path => Trivial_Mapping,
An_Or_Path => Trivial_Mapping,
A_Then_Abort_Path => Trivial_Mapping,
--
------------------------------------------------------------
-- An_Expression_Path, -- Asis.Expressions Ada 2015
-- Detailed classification for Asis.Element_Kinds (An_Expression_Path)
-- literal corresponds to subtype Internal_Expression_Path_Kinds
------------------------------------------------------------
An_If_Expression_Path ..
-- An_Elsif_Expression_Path,
An_Else_Expression_Path => Non_Trivial_Mapping,
------------------------------------------------------------------------
--
-- -- A_Clause, -- Asis.Clauses
--
------------------------------------------------------------------------------
--
A_Use_Package_Clause => Non_Trivial_Mapping,
A_Use_Type_Clause => Non_Trivial_Mapping,
A_Use_All_Type_Clause => Non_Trivial_Mapping,
A_With_Clause => Not_An_Element,
--
-- -- A_Representation_Clause,
--
An_Attribute_Definition_Clause => Non_Trivial_Mapping,
An_Enumeration_Representation_Clause => Trivial_Mapping,
A_Record_Representation_Clause => Trivial_Mapping,
An_At_Clause => Trivial_Mapping,
--
--
A_Component_Clause => Trivial_Mapping,
--
------------------------------------------------------------------------------
--
An_Exception_Handler => Non_Trivial_Mapping,
--
------------------------------------------------------------------------------
-- Special values added for Node -> Element and
-- Element -> Enclosing Element switching,
------------------------------------------------------------------------------
Non_Trivial_Mapping => No_Mapping,
Not_Implemented_Mapping => No_Mapping,
Trivial_Mapping => No_Mapping,
No_Mapping => No_Mapping,
others => Not_Implemented_Mapping
);
-------------------------------------------------------------------------
-- Section 2 - declarations of routines implementing various cases of --
-- non-trivial bottom up compiler tree traversing and --
-- accessed though the second switch --
-------------------------------------------------------------------------
function Not_Implemented_Enclosing_Element_Construction
(Element : Asis.Element) return Asis.Element;
-- Placeholders for "others" choice
-- The functions below computes Enclosing_Elememnt for specific Element
-- kinds; the corresponding situations cannot be covered by
-- General_Encl_Elem
function A_Pragma_Enclosing (Element : Asis.Element) return Asis.Element;
function A_Defining_Expanded_Name_Enclosing
(Element : Asis.Element)
return Asis.Element;
function A_Defining_Identifier_Enclosing
(Element : Asis.Element)
return Asis.Element;
function A_Defining_Operator_Symbol_Enclosing
(Element : Asis.Element)
return Asis.Element;
function A_Constant_Declaration_Enclosing
(Element : Asis.Element)
return Asis.Element;
function An_Enumeration_Literal_Specification_Enclosing
(Element : Asis.Element)
return Asis.Element;
function A_Discriminant_Specification_Enclosing
(Element : Asis.Element)
return Asis.Element;
function A_Loop_Parameter_Specification_Enclosing
(Element : Asis.Element)
return Asis.Element;
function A_Parameter_Specification_Enclosing
(Element : Asis.Element)
return Asis.Element;
function An_Enumeration_Type_Definition_Enclosing
(Element : Asis.Element)
return Asis.Element;
function A_Subtype_Indication_Enclosing
(Element : Asis.Element)
return Asis.Element;
function A_Range_Attribute_Reference_Enclosing
(Element : Asis.Element)
return Asis.Element;
function A_Simple_Expression_Range_Enclosing
(Element : Asis.Element)
return Asis.Element;
function A_Discrete_Range_Enclosing
(Element : Asis.Element)
return Asis.Element;
function A_Discriminant_Part_Enclosing
(Element : Asis.Element)
return Asis.Element;
function A_Record_Definition_Enclosing
(Element : Asis.Element)
return Asis.Element;
function A_Null_Component_Enclosing
(Element : Asis.Element)
return Asis.Element;
function A_Variant_Part_Enclosing
(Element : Asis.Element)
return Asis.Element;
function An_Others_Choice_Enclosing
(Element : Asis.Element)
return Asis.Element;
function A_Statement_Enclosing
(Element : Asis.Element)
return Asis.Element;
function A_Terminate_Alternative_Statement_Enclosing
(Element : Asis.Element)
return Asis.Element;
function An_Else_Path_Enclosing
(Element : Asis.Element)
return Asis.Element;
function An_Attribute_Definition_Clause_Enclosing
(Element : Asis.Element)
return Asis.Element;
function An_Exception_Handler_Enclosing
(Element : Asis.Element)
return Asis.Element;
function Possible_C_U_Enclosing
(Element : Asis.Element)
return Asis.Element;
-- Called in a situation when Enclosing_Element may have to be Nil_Element,
-- because we may reach the very top of the Element hierarchy of an ASIS
-- Compilation_Unit, so logically the next step up should be from Elements
-- into enclosing unit.
function An_Association_Enclosing
(Element : Asis.Element)
return Asis.Element;
-- Computes the Enclosing Element for parameter associations. The main
-- difference with An_Expression_Enclosing is that here we may have to deal
-- with normalized associations
function An_Expression_Enclosing
(Element : Asis.Element)
return Asis.Element;
-- This function implements the part of the semantic of the
-- Asis.Elements.Enclosing_Element function corresponding to the
-- enclosing element retrieving for elements representing Ada explicit
-- constructs. It deals only with expressions - the hardest part
-- for Enclosing_Element.
--------------------------------------------------------------------
-- Section 3 - definition of the second Enclosing_Element switch --
-- (maps Element kind requiring non-trivial actions --
-- onto corresponding routines --
--------------------------------------------------------------------
type Enclosing_Element_Construction_For_Explicits_Items is access
function (Element : Asis.Element) return Asis.Element;
-- access to the local items of the constructing the Enclosing Elements
-- for Explicit constructs
Enclosing_Element_For_Explicits_Second_Switch : constant
array (Internal_Element_Kinds)
of Enclosing_Element_Construction_For_Explicits_Items :=
(
-- type Internal_Element_Kinds is (
--
-- Not_An_Element, -- Asis.Nil_Element
--
------------------------------------------------------------------------------
-- A_Pragma, -- Asis.Elements
------------------------------------------------------------------------------
An_All_Calls_Remote_Pragma ..
-- An_Asynchronous_Pragma,
-- An_Atomic_Pragma,
-- An_Atomic_Components_Pragma,
-- An_Attach_Handler_Pragma,
-- A_Controlled_Pragma,
-- A_Convention_Pragma,
-- A_Discard_Names_Pragma,
-- An_Elaborate_Pragma,
-- An_Elaborate_All_Pragma,
-- An_Elaborate_Body_Pragma,
-- An_Export_Pragma,
-- An_Import_Pragma,
-- An_Inline_Pragma,
-- An_Inspection_Point_Pragma,
-- An_Interrupt_Handler_Pragma,
-- An_Interrupt_Priority_Pragma,
-- A_Linker_Options_Pragma
-- A_List_Pragma,
-- A_Locking_Policy_Pragma,
-- A_Normalize_Scalars_Pragma,
-- An_Optimize_Pragma,
-- A_Pack_Pragma,
-- A_Page_Pragma,
-- A_Preelaborate_Pragma,
-- A_Priority_Pragma,
-- A_Pure_Pragma,
-- A_Queuing_Policy_Pragma,
-- A_Remote_Call_Interface_Pragma,
-- A_Remote_Types_Pragma,
-- A_Restrictions_Pragma,
-- A_Reviewable_Pragma,
-- A_Shared_Passive_Pragma,
-- A_Storage_Size_Pragma,
-- A_Suppress_Pragma,
-- A_Task_Dispatching_Policy_Pragma,
-- A_Volatile_Pragma,
-- A_Volatile_Components_Pragma,
--
-- An_Implementation_Defined_Pragma,
--
An_Unknown_Pragma => A_Pragma_Enclosing'Access,
------------------------------------------------------------------------------
-- A_Defining_Name, -- Asis.Declarations
------------------------------------------------------------------------------
A_Defining_Identifier => A_Defining_Identifier_Enclosing'Access,
-- A_Defining_Character_Literal, -- an Enclosing Element is based
-- A_Defining_Enumeration_Literal, -- on the same Node
--
-- -- A_Defining_Operator_Symbol
--
A_Defining_And_Operator ..
-- A_Defining_Or_Operator,
-- A_Defining_Xor_Operator,
-- A_Defining_Equal_Operator,
-- A_Defining_Not_Equal_Operator,
-- A_Defining_Less_Than_Operator,
-- A_Defining_Less_Than_Or_Equal_Operator,
-- A_Defining_Greater_Than_Operator,
-- A_Defining_Greater_Than_Or_Equal_Operator,
-- A_Defining_Plus_Operator,
-- A_Defining_Minus_Operator,
-- A_Defining_Concatenate_Operator,
-- A_Defining_Unary_Plus_Operator,
-- A_Defining_Unary_Minus_Operator,
-- A_Defining_Multiply_Operator,
-- A_Defining_Divide_Operator,
-- A_Defining_Mod_Operator,
-- A_Defining_Rem_Operator,
-- A_Defining_Exponentiate_Operator,
-- A_Defining_Abs_Operator,
A_Defining_Not_Operator => A_Defining_Operator_Symbol_Enclosing'Access,
A_Defining_Expanded_Name => A_Defining_Expanded_Name_Enclosing'Access,
--
-------------------------------------------------------------------------------
--
-- -- A_Declaration, -- Asis.Declarations
--
-------------------------------------------------------------------------------
--
-- An_Ordinary_Type_Declaration, -- 3.2.1
-- A_Task_Type_Declaration, -- 3.2.1
-- A_Protected_Type_Declaration, -- 3.2.1
-- An_Incomplete_Type_Declaration, -- 3.2.1
-- A_Private_Type_Declaration, -- 3.2.1
-- A_Private_Extension_Declaration, -- 3.2.1
--
-- A_Subtype_Declaration, -- 3.2.2
--
-- A_Variable_Declaration, -- 3.3.1 -> Trait_Kinds
A_Constant_Declaration => A_Constant_Declaration_Enclosing'Access,
-- This is turned off, see G416-009
-- A_Deferred_Constant_Declaration, -- 3.3.1 -> Trait_Kinds
-- A_Single_Task_Declaration, -- 3.3.1
-- A_Single_Protected_Declaration, -- 3.3.1
--
-- An_Integer_Number_Declaration, -- 3.3.2
-- A_Real_Number_Declaration, -- 3.3.2
--
An_Enumeration_Literal_Specification =>
An_Enumeration_Literal_Specification_Enclosing'Access,
--
A_Discriminant_Specification => A_Discriminant_Specification_Enclosing'Access,
--
-- A_Component_Declaration => A_Component_Declaration_Enclosing'Access,
A_Component_Declaration => An_Expression_Enclosing'Access,
--
A_Loop_Parameter_Specification =>
A_Loop_Parameter_Specification_Enclosing'Access,
A_Generalized_Iterator_Specification ..
An_Element_Iterator_Specification =>
A_Loop_Parameter_Specification_Enclosing'Access,
--
A_Procedure_Declaration => Possible_C_U_Enclosing'Access,
A_Function_Declaration => Possible_C_U_Enclosing'Access,
--
A_Parameter_Specification => A_Parameter_Specification_Enclosing'Access,
A_Procedure_Body_Declaration => Possible_C_U_Enclosing'Access,
A_Function_Body_Declaration => Possible_C_U_Enclosing'Access,
--
A_Package_Declaration => Possible_C_U_Enclosing'Access,
A_Package_Body_Declaration => Possible_C_U_Enclosing'Access,
--
-- An_Object_Renaming_Declaration, -- 8.5.1
-- An_Exception_Renaming_Declaration, -- 8.5.2
A_Package_Renaming_Declaration => Possible_C_U_Enclosing'Access,
A_Procedure_Renaming_Declaration => Possible_C_U_Enclosing'Access,
A_Function_Renaming_Declaration => Possible_C_U_Enclosing'Access,
A_Generic_Package_Renaming_Declaration => Possible_C_U_Enclosing'Access,
A_Generic_Procedure_Renaming_Declaration => Possible_C_U_Enclosing'Access,
A_Generic_Function_Renaming_Declaration => Possible_C_U_Enclosing'Access,
A_Task_Body_Declaration => Possible_C_U_Enclosing'Access,
A_Protected_Body_Declaration => Possible_C_U_Enclosing'Access,
--
An_Entry_Declaration => An_Expression_Enclosing'Access,
-- for entry declarations, the problem is for single task declarations
-- rewritten as anonymous task type declaration and task object declaration,
-- that's why we have to use An_Expression_Enclosing
-- An_Entry_Body_Declaration, -- 9.5.2
-- An_Entry_Index_Specification, -- 9.5.2
--
-- A_Procedure_Body_Stub, -- 10.1.3
-- A_Function_Body_Stub, -- 10.1.3
-- A_Package_Body_Stub, -- 10.1.3
-- A_Task_Body_Stub, -- 10.1.3
-- A_Protected_Body_Stub, -- 10.1.3
--
-- An_Exception_Declaration, -- 11.1
-- A_Choice_Parameter_Specification, -- 11.2
--
A_Generic_Procedure_Declaration => Possible_C_U_Enclosing'Access,
A_Generic_Function_Declaration => Possible_C_U_Enclosing'Access,
A_Generic_Package_Declaration => Possible_C_U_Enclosing'Access,
A_Package_Instantiation => Possible_C_U_Enclosing'Access,
A_Procedure_Instantiation => Possible_C_U_Enclosing'Access,
A_Function_Instantiation => Possible_C_U_Enclosing'Access,
--
-- A_Formal_Object_Declaration, -- 12.4 -> Mode_Kinds
--
-- A_Formal_Type_Declaration, -- 12.5
-- A_Formal_Procedure_Declaration, -- 12.6 -> Default_Kinds
--
-- A_Formal_Function_Declaration, -- 12.6 -> Default_Kinds
--
-- A_Formal_Package_Declaration, -- 12.7
-- A_Formal_Package_Declaration_With_Box, -- 12.7
--
-------------------------------------------------------------------------------
--
-- -- A_Definition, -- Asis.Definitions
--
-------------------------------------------------------------------------------
--
-- -- A_Type_Definition, -- 3.2.1 -> Type_Kinds
--
-- A_Derived_Type_Definition, -- 3.4 -> Trait_Kinds
-- A_Derived_Record_Extension_Definition, -- 3.4 -> Trait_Kinds
--
An_Enumeration_Type_Definition =>
An_Enumeration_Type_Definition_Enclosing'Access,
--
-- A_Signed_Integer_Type_Definition, -- 3.5.4
-- A_Modular_Type_Definition, -- 3.5.4
--
-- -- A_Root_Type_Definition, -- 3.5.4(10), 3.5.6(4)
-- -- -> Root_Type_Kinds
-- A_Root_Integer_Definition, -- 3.5.4(9)
-- A_Root_Real_Definition, -- 3.5.6(2)
-- A_Root_Fixed_Definition, -- 3.5.6(2)
--
-- A_Universal_Integer_Definition, -- 3.5.4(10)
-- A_Universal_Real_Definition, -- 3.5.6(4)
-- A_Universal_Fixed_Definition, -- 3.5.6(4)
--
--
-- A_Floating_Point_Definition, -- 3.5.7
--
-- An_Ordinary_Fixed_Point_Definition, -- 3.5.9
-- A_Decimal_Fixed_Point_Definition, -- 3.5.9
--
-- An_Unconstrained_Array_Definition, -- 3.6
-- A_Constrained_Array_Definition, -- 3.6
--
-- A_Record_Type_Definition, -- 3.8 -> Trait_Kinds
-- A_Tagged_Record_Type_Definition, -- 3.8 -> Trait_Kinds
--
-- -- An_Access_Type_Definition, -- 3.10 -> Access_Type_Kinds
--
-- A_Pool_Specific_Access_To_Variable,
-- An_Access_To_Variable,
-- An_Access_To_Constant,
--
-- An_Access_To_Procedure,
-- An_Access_To_Protected_Procedure,
-- An_Access_To_Function,
-- An_Access_To_Protected_Function,
--
--
A_Subtype_Indication => A_Subtype_Indication_Enclosing'Access,
--
-- -- A_Constraint, -- 3.2.2 -> Constraint_Kinds
--
A_Range_Attribute_Reference => A_Range_Attribute_Reference_Enclosing'Access,
A_Simple_Expression_Range => A_Simple_Expression_Range_Enclosing'Access,
-- A_Digits_Constraint, -- 3.2.2, 3.5.9
-- A_Delta_Constraint, -- 3.2.2, N.3
-- An_Index_Constraint => An_Index_Constraint_Enclosing'Access,
An_Index_Constraint => An_Expression_Enclosing'Access,
A_Discriminant_Constraint => An_Expression_Enclosing'Access,
--
-- A_Component_Definition, -- 3.6
--
-- -- A_Discrete_Subtype_Definition, -- 3.6 -> Discrete_Range_Kinds
--
-- A_Discrete_Subtype_Indication_As_Subtype_Definition,
-- A_Discrete_Range_Attribute_Reference_As_Subtype_Definition,
-- A_Discrete_Simple_Expression_Range_As_Subtype_Definition,
--
-- -- A_Discrete_Range, -- 3.6.1 -> Discrete_Range_Kinds
--
A_Discrete_Subtype_Indication => A_Discrete_Range_Enclosing'Access,
A_Discrete_Range_Attribute_Reference => A_Discrete_Range_Enclosing'Access,
A_Discrete_Simple_Expression_Range => A_Discrete_Range_Enclosing'Access,
--
--
An_Unknown_Discriminant_Part => A_Discriminant_Part_Enclosing'Access,
A_Known_Discriminant_Part => A_Discriminant_Part_Enclosing'Access,
--
A_Record_Definition => A_Record_Definition_Enclosing'Access,
A_Null_Record_Definition => A_Record_Definition_Enclosing'Access,
--
A_Null_Component => A_Null_Component_Enclosing'Access,
A_Variant_Part => A_Variant_Part_Enclosing'Access,
-- A_Variant, -- 3.8
--
An_Others_Choice => An_Others_Choice_Enclosing'Access,
-- A_Private_Type_Definition, -- 7.3 -> Trait_Kinds
-- A_Tagged_Private_Type_Definition, -- 7.3 -> Trait_Kinds
-- A_Private_Extension_Definition, -- 7.3 -> Trait_Kinds
--
-- A_Task_Definition, -- 9.1
A_Protected_Definition => An_Expression_Enclosing'Access,
--
-- -- A_Formal_Type_Definition, -- 12.5 -> Formal_Type_Kinds
--
-- A_Formal_Private_Type_Definition, -- 12.5.1 -> Trait_Kinds
-- A_Formal_Tagged_Private_Type_Definition, -- 12.5.1 -> Trait_Kinds
--
-- A_Formal_Derived_Type_Definition, -- 12.5.1 -> Trait_Kinds
--
-- A_Formal_Discrete_Type_Definition, -- 12.5.2
--
-- A_Formal_Signed_Integer_Type_Definition, -- 12.5.2
-- A_Formal_Modular_Type_Definition, -- 12.5.2
--
-- A_Formal_Floating_Point_Definition, -- 12.5.2
--
-- A_Formal_Ordinary_Fixed_Point_Definition, -- 12.5.2
-- A_Formal_Decimal_Fixed_Point_Definition, -- 12.5.2
--
-- A_Formal_Unconstrained_Array_Definition, -- 12.5.3
-- A_Formal_Constrained_Array_Definition, -- 12.5.3
--
-- -- A_Formal_Access_Type_Definition,
--
-- A_Formal_Pool_Specific_Access_To_Variable,
-- A_Formal_Access_To_Variable,
-- A_Formal_Access_To_Constant,
--
-- A_Formal_Access_To_Procedure,
-- A_Formal_Access_To_Protected_Procedure,
-- A_Formal_Access_To_Function,
-- A_Formal_Access_To_Protected_Function,
--
-------------------------------------------------------------------------------
--
-- -- An_Expression, -- Asis.Expressions
--
-------------------------------------------------------------------------------
-- --
An_Integer_Literal ..
-- -- A_Real_Literal, -- 2.4.1
-- A_String_Literal => A_Literal_Enclosing'Access,
-- --
An_Identifier => An_Expression_Enclosing'Access,
-- An_Identifier => An_Identifier_Enclosing'Access,
-- --
-- ---- An_Operator_Symbol, -- 4.1
-- --
An_And_Operator ..
-- -- An_Or_Operator, -- or
-- -- An_Xor_Operator, -- xor
-- -- An_Equal_Operator, -- =
-- -- A_Not_Equal_Operator, -- /=
-- -- A_Less_Than_Operator, -- <
-- -- A_Less_Than_Or_Equal_Operator, -- <=
-- -- A_Greater_Than_Operator, -- >
-- -- A_Greater_Than_Or_Equal_Operator, -- >=
-- -- A_Plus_Operator, -- +
-- -- A_Minus_Operator, -- -
-- -- A_Concatenate_Operator, -- &
-- -- A_Unary_Plus_Operator, -- +
-- -- A_Unary_Minus_Operator, -- -
-- -- A_Multiply_Operator, -- *
-- -- A_Divide_Operator, -- /
-- -- A_Mod_Operator, -- mod
-- -- A_Rem_Operator, -- rem
-- -- An_Exponentiate_Operator, -- **
-- -- An_Abs_Operator, -- abs
-- A_Not_Operator => An_Operator_Symbol_Enclosing'Access,
-- ??? Do we need An_Operator_Symbol_Enclosing???
A_Not_Operator => An_Expression_Enclosing'Access,
-- --
A_Character_Literal ..
-- -- An_Enumeration_Literal, -- 4.1
-- -- An_Explicit_Dereference, -- 4.1
--
-- A_Function_Call => A_Function_Call_Enclosing'Access,
-- --
-- -- An_Indexed_Component, -- 4.1.1
-- -- A_Slice, -- 4.1.2
-- A_Selected_Component => An_Identifier_Enclosing'Access,
-- --
-- -- An_Attribute_Reference, -- 4.1.4 -> Attribute_Kinds
-- --
-- An_Access_Attribute ..
-- -- An_Address_Attribute,
-- -- An_Adjacent_Attribute,
-- -- An_Aft_Attribute,
-- -- An_Alignment_Attribute,
-- -- A_Base_Attribute,
-- -- A_Bit_Order_Attribute,
-- -- A_Body_Version_Attribute,
-- -- A_Callable_Attribute,
-- -- A_Caller_Attribute,
-- -- A_Ceiling_Attribute,
-- -- A_Class_Attribute,
-- -- A_Component_Size_Attribute,
-- -- A_Compose_Attribute,
-- -- A_Constrained_Attribute,
-- -- A_Copy_Sign_Attribute,
-- -- A_Count_Attribute,
-- -- A_Definite_Attribute,
-- -- A_Delta_Attribute,
-- -- A_Denorm_Attribute,
-- -- A_Digits_Attribute,
-- -- An_Exponent_Attribute,
-- -- An_External_Tag_Attribute,
-- -- A_First_Attribute,
-- -- A_First_Bit_Attribute,
-- -- A_Floor_Attribute,
-- -- A_Fore_Attribute,
-- -- A_Fraction_Attribute,
-- -- An_Identity_Attribute,
-- -- An_Image_Attribute,
-- -- An_Input_Attribute,
-- -- A_Last_Attribute,
-- -- A_Last_Bit_Attribute,
-- -- A_Leading_Part_Attribute,
-- -- A_Length_Attribute,
-- -- A_Machine_Attribute,
-- -- A_Machine_Emax_Attribute,
-- -- A_Machine_Emin_Attribute,
-- -- A_Machine_Mantissa_Attribute,
-- -- A_Machine_Overflows_Attribute,
-- -- A_Machine_Radix_Attribute,
-- -- A_Machine_Rounds_Attribute,
-- -- A_Max_Attribute,
-- -- A_Max_Size_In_Storage_Elements_Attribute,
-- -- A_Min_Attribute,
-- -- A_Model_Attribute,
-- -- A_Model_Emin_Attribute,
-- -- A_Model_Epsilon_Attribute,
-- -- A_Model_Mantissa_Attribute,
-- -- A_Model_Small_Attribute,
-- -- A_Modulus_Attribute,
-- -- An_Output_Attribute,
-- -- A_Partition_ID_Attribute,
-- -- A_Pos_Attribute,
-- -- A_Position_Attribute,
-- A_Pred_Attribute => An_Attribute_Reference_Enclosing'Access,
--
-- A_Range_Attribute => A_Range_Attribute_Enclosing'Access,
--
-- A_Read_Attribute ..
-- -- A_Remainder_Attribute,
-- -- A_Round_Attribute,
-- -- A_Rounding_Attribute,
-- -- A_Safe_First_Attribute,
-- -- A_Safe_Last_Attribute,
-- -- A_Scale_Attribute,
-- -- A_Scaling_Attribute,
-- -- A_Signed_Zeros_Attribute,
-- -- A_Size_Attribute,
-- -- A_Small_Attribute,
-- -- A_Storage_Pool_Attribute,
-- -- A_Storage_Size_Attribute,
-- --
-- -- A_Succ_Attribute,
-- -- A_Tag_Attribute,
-- -- A_Terminated_Attribute,
-- -- A_Truncation_Attribute,
-- -- An_Unbiased_Rounding_Attribute,
-- -- An_Unchecked_Access_Attribute,
-- -- A_Val_Attribute,
-- -- A_Valid_Attribute,
-- -- A_Value_Attribute,
-- -- A_Version_Attribute,
-- -- A_Wide_Image_Attribute,
-- -- A_Wide_Value_Attribute,
-- -- A_Wide_Width_Attribute,
-- -- A_Width_Attribute,
-- -- A_Write_Attribute,
-- --
-- -- An_Implementation_Defined_Attribute, -- Vendor Annex M
-- An_Unknown_Attribute => An_Attribute_Reference_Enclosing'Access,
-- --
-- -- A_Record_Aggregate, -- 4.3
-- -- An_Extension_Aggregate, -- 4.3
-- -- A_Positional_Array_Aggregate, -- 4.3
-- -- A_Named_Array_Aggregate, -- 4.3
-- --
-- -- An_And_Then_Short_Circuit, -- 4.4
-- -- An_Or_Else_Short_Circuit, -- 4.4
-- --
-- -- An_In_Range_Membership_Test, -- 4.4
-- -- A_Not_In_Range_Membership_Test, -- 4.4
-- -- An_In_Type_Membership_Test, -- 4.4
-- -- A_Not_In_Type_Membership_Test, -- 4.4
-- --
-- -- A_Null_Literal, -- 4.4
-- -- A_Parenthesized_Expression, -- 4.4
-- --
-- -- A_Type_Conversion, -- 4.6
-- -- A_Qualified_Expression, -- 4.7
-- --
-- -- An_Allocation_From_Subtype, -- 4.8
-- -- An_Allocation_From_Qualified_Expression, -- 4.8
-- A_Case_Expression, -- Ada 2012
-- An_If_Expression, -- Ada 2012
-- A_For_All_Quantified_Expression, -- Ada 2012
-- A_For_Some_Quantified_Expression); -- Ada 2012
A_For_Some_Quantified_Expression => An_Expression_Enclosing'Access,
-------------------------------------------------------------------------------
--
-- -- An_Association, -- Asis.Expressions
--
-------------------------------------------------------------------------------
--
-- A_Pragma_Argument_Association, -- 2.8
A_Discriminant_Association => An_Expression_Enclosing'Access,
-- A_Record_Component_Association, -- 4.3.1
An_Array_Component_Association => An_Expression_Enclosing'Access,
A_Parameter_Association .. A_Generic_Association =>
An_Association_Enclosing'Access,
--
-------------------------------------------------------------------------------
--
-- -- A_Statement, -- Asis.Statements
--
-------------------------------------------------------------------------------
--
A_Null_Statement ..
-- An_Assignment_Statement, -- 5.2
-- An_If_Statement, -- 5.3
-- A_Case_Statement, -- 5.4
--
-- A_Loop_Statement, -- 5.5
-- A_While_Loop_Statement, -- 5.5
-- A_For_Loop_Statement, -- 5.5
--
-- A_Block_Statement, -- 5.6
-- An_Exit_Statement, -- 5.7
-- A_Goto_Statement, -- 5.8
--
-- A_Procedure_Call_Statement, -- 6.4
-- A_Return_Statement, -- 6.5
--
-- An_Accept_Statement, -- 9.5.2
-- An_Entry_Call_Statement, -- 9.5.3
--
-- A_Requeue_Statement, -- 9.5.4
-- A_Requeue_Statement_With_Abort, -- 9.5.4
--
-- A_Delay_Until_Statement, -- 9.6
A_Delay_Relative_Statement => A_Statement_Enclosing'Access,
--
A_Terminate_Alternative_Statement =>
A_Terminate_Alternative_Statement_Enclosing'Access,
--
A_Selective_Accept_Statement ..
-- A_Timed_Entry_Call_Statement, -- 9.7.3
-- A_Conditional_Entry_Call_Statement, -- 9.7.3
-- An_Asynchronous_Select_Statement, -- 9.7.4
--
-- An_Abort_Statement, -- 9.8
-- A_Raise_Statement, -- 11.3
A_Code_Statement => A_Statement_Enclosing'Access,
--
-------------------------------------------------------------------------------
-- Path_Kinds
-- Literals -- RM 95
------------------------------------------------------------------------------
--
-- An_If_Path,
-- An_Elsif_Path,
--
An_Else_Path => An_Else_Path_Enclosing'Access,
--
-- A_Case_Path,
-- -- when discrete_choice_list =>
-- -- sequence_of_statements
--
-- A_Select_Path,
-- -- select [guard] select_alternative
-- -- 9.7.2, 9.7.3:
-- -- select entry_call_alternative
-- -- 9.7.4:
-- -- select triggering_alternative
--
-- An_Or_Path,
-- -- or [guard] select_alternative 9.7.2:
-- -- or delay_alternative
--
-- A_Then_Abort_Path, -- 9.7.4
-- -- then abort sequence_of_statements
--
--
------------------------------------------------------------
-- An_Expression_Path, -- Asis.Expressions Ada 2015
------------------------------------------------------------
An_If_Expression_Path ..
-- An_Elsif_Expression_Path,
An_Else_Expression_Path => An_Expression_Enclosing'Access,
-------------------------------------------------------------------------------
--
-- -- A_Clause, -- Asis.Clauses
--
-------------------------------------------------------------------------------
--
A_Use_Package_Clause => Possible_C_U_Enclosing'Access, -- 8.4
A_Use_Type_Clause => Possible_C_U_Enclosing'Access, -- 8.4
A_Use_All_Type_Clause => Possible_C_U_Enclosing'Access, -- 8.4 Ada 2012
--
-- A_With_Clause, -- 10.1.2
--
-- -- A_Representation_Clause, -- 13.1 -> Representation_Clause_Kinds
--
An_Attribute_Definition_Clause =>
An_Attribute_Definition_Clause_Enclosing'Access,
-- An_Enumeration_Representation_Clause, -- 13.4
-- A_Record_Representation_Clause, -- 13.5.3
-- An_At_Clause, -- N.7
--
--
-- A_Component_Clause, -- 13.5.3
--
-------------------------------------------------------------------------------
--
An_Exception_Handler => An_Exception_Handler_Enclosing'Access,
--
-------------------------------------------------------------------------------
-- -- Special values added for Node -> Element switching,
-- -- see Asis_Vendor_Primitives.GNAT_to_Asis_Mapping body for
-- -- more details
-------------------------------------------------------------------------------
--
-- Non_Trivial_Mapping,
-- Not_Implemented_Mapping,
-- No_Mapping
--
others => Not_Implemented_Enclosing_Element_Construction'Access);
------------------------------------------------------
-- Section 4 - (general-purpose) local subprograms --
------------------------------------------------------
procedure Skip_Implicit_Subtype (Constr : in out Node_Id);
-- Supposing that Constr is a constraint, this procedure checks if the
-- parent node for it points to implicit subtype created in case if
-- this constraint is used directly in object declaration, and if
-- so, resets Constr to point to the constraint from the object
-- declaration
function Parent (Node : Node_Id) return Node_Id;
-- this function is the modification of Atree.Parent. It is able
-- to deal in the "ASIS mode" with the sequences of one-identifier
-- declarations/with clauses resulting from the normalization of
-- multi-name declarations/with clauses which is done by the
-- compiler
function General_Encl_Elem (Element : Asis.Element) return Asis.Element;
-- Computes Enclosing_Element for most common cases
procedure No_Enclosing_Element (Element_Kind : Internal_Element_Kinds);
-- Should be called only in erroneous situations, when no Enclosing_Element
-- can correspond to a given Element. Raises ASIS_Failed with the
-- corresponding Diagnosis
procedure Not_Implemented_Enclosing_Element_Construction
(Element : Asis.Element);
-- Generates Element-specific diagnosis about non-implemented case
function Is_Top_Of_Expanded_Generic (N : Node_Id) return Boolean;
-- Checks if N is the top node of the tree structure corresponding to
-- expanded generic spec or body
function Get_Rough_Enclosing_Node (Element : Asis.Element) return Node_Id;
-- This function finds the node, which is the base for a "rough"
-- enclosing element for the argument Element. Starting from the
-- argument R_Node, we go up through the chain of Parent nodes
-- till the first node, which is a member of some Node_List or to the node
-- representing the unit declaration in a compilation unit
function Get_Enclosing
(Approximation : Asis.Element;
Element : Asis.Element)
return Asis.Element;
-- This function finds the Enclosing Element for Element by traversing
-- Approximation which is considered as a rough estimation for
-- enclosing element.
procedure Skip_Normalized_Declarations_Back (Node : in out Node_Id);
-- this procedure is applied in case when the compiler may normalize a
-- multi-identifier declaration (or multi-name with clause) in a set of
-- equivalent one-identifier (one-name) declarations (clauses). It is
-- intended to be called for Node representing any declaration
-- (clause) in this normalized sequence, and it resets its parameter
-- to point to the first declaration (clause) in this sequence
--
-- There is no harm to call this procedure for Node which does not
-- represent a normalized declaration (or even which does not represent
-- any declaration at all), or for Node which represents the first
-- declaration in a normalized chain - the procedure simply leaves
-- its parameter intact.
--
-- (In some sense this procedure may be considered as an "inversion
-- of the local procedure Skip_Normalized_Declarations defined in
-- the body of the A4G.Mapping package)
---------------------------------------------------------------
-- Section 5 - bodies of the routines declared in Section 2 --
---------------------------------------------------------------
--------------------------------------
-- A_Constant_Declaration_Enclosing --
--------------------------------------
function A_Constant_Declaration_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Result : Asis.Element := General_Encl_Elem (Element);
Res_Node : Node_Id;
begin
-- The problem with constant declarations exists for a declarations
-- created by the front-end to pass the actual expressions for generic
-- IN parameters, see EC16-004 and EC22-007
Res_Node := Node (Element);
if Present (Corresponding_Generic_Association (Res_Node)) then
Res_Node := Parent (Res_Node);
if No (Generic_Parent (Res_Node)) then
-- This IF statement prevents us from doing this special
-- processing for expanded package declarations, we have to do it
-- only for wrapper packages created for subprogram instantiation
Res_Node := Parent (Res_Node);
Res_Node := Corresponding_Body (Res_Node);
Res_Node := Parent (Res_Node);
Res_Node := First (Sinfo.Declarations (Res_Node));
while Nkind (Res_Node) /= N_Subprogram_Body loop
Res_Node := Next (Res_Node);
end loop;
Result := Node_To_Element_New (Node => Res_Node,
Starting_Element => Element);
end if;
end if;
return Result;
end A_Constant_Declaration_Enclosing;
----------------------------------------
-- A_Defining_Expanded_Name_Enclosing --
---------------------------------------
function A_Defining_Expanded_Name_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Parent_Node : Node_Id := Parent (R_Node (Element));
Parent_Node_Kind : constant Node_Kind := Nkind (Parent_Node);
begin
if Parent_Node_Kind = N_Function_Specification or else
Parent_Node_Kind = N_Procedure_Specification or else
Parent_Node_Kind = N_Package_Specification
then -- one more step up required
Parent_Node := Parent (Parent_Node);
end if;
return Node_To_Element_New (Node => Parent_Node,
Starting_Element => Element);
end A_Defining_Expanded_Name_Enclosing;
-------------------------------------
-- A_Defining_Identifier_Enclosing --
-------------------------------------
function A_Defining_Identifier_Enclosing
(Element : Asis.Element)
return Asis.Element
is
-- A_Defining_Identifier may be processed just in the same way as
-- A_Defining_Expanded_Name, except the following cases:
-- - A_Defining_Identifier obtained as the child of
-- A_Choice_Parameter_Specification element (by means of Names
-- query) - both these elements are based on the same
-- N_Defining_Identifier node
--
-- - A_Defining_Identifier representing a statement label, it is
-- obtained by means of Label_Names query, and it is based on
-- N_Label node which is the member of the node list representing
-- the corresponding statement sequence (or it can be based on
-- N_Identifier node in case if the front-end rewrites a sequence of
-- statement implementing the infinite loop by goto into
-- N_Loop_Statement node. The Enclosing_Element of such
-- A_Defining_Name element will be the statement labeled by it, see
-- Asis_Statements.Label_Names.
--
-- - A_Defining_Identifier representing a statement identifier, it is
-- obtained by means of Statement_Identifier query, and it is based
-- on N_Identifier node. The Enclosing_Element of the name is the
-- named statement, see Asis_Statements.Statement_Identifier. But
-- there is no difference in computing the Enclosing Element
-- (compared to A_Defining_Expanded_Name) in this case.
--
-- - A special processing is needed for a formal package defining name
--
-- - A_Defining_Identifier is from a single task/protected declaration
Parent_Node : Node_Id := Parent (R_Node (Element));
Parent_Node_Kind : constant Node_Kind := Nkind (Parent_Node);
Result_Kind : Internal_Element_Kinds := Not_An_Element;
begin
if Nkind (Node (Element)) = N_Label then
Parent_Node := Next (R_Node (Element));
-- R_Node (Element) definitely is a list member
while not Is_Statement (Parent_Node) loop
Parent_Node := Next (Parent_Node);
end loop;
elsif Nkind (Node (Element)) = N_Identifier
and then
Parent_Node_Kind = N_Loop_Statement
and then
Is_Rewrite_Substitution (Parent_Node)
and then
Nkind (Original_Node (Parent_Node)) = N_Goto_Statement
then
if Is_Empty_List (Sinfo.Statements (Parent_Node)) then
-- Pathological case of
--
-- <<Target>> goto target;
Result_Kind := A_Goto_Statement;
else
Parent_Node := First (Sinfo.Statements (Parent_Node));
end if;
elsif Parent_Node_Kind = N_Exception_Handler then
Parent_Node := R_Node (Element);
Result_Kind := A_Choice_Parameter_Specification;
elsif Nkind (Parent_Node) = N_Generic_Package_Declaration
and then
Nkind (Original_Node (Parent_Node)) = N_Formal_Package_Declaration
and then
R_Node (Element) =
Defining_Identifier (Original_Node (Parent_Node))
then
-- A formal package with a box (but not its expanded spec!)
Result_Kind := A_Formal_Package_Declaration_With_Box;
elsif not Comes_From_Source (Parent_Node)
and then
Nkind (Parent_Node) = N_Object_Declaration
and then
Present (Etype (R_Node (Element)))
and then
Ekind (Etype (R_Node (Element))) in
E_Task_Type .. E_Protected_Type
then
-- The case of a single task/protected definition - the problem here
-- is that Parent field of the argument node points into artificial
-- object declaration, see G214-005
Parent_Node := Etype (R_Node (Element));
if Ekind (Parent_Node) = E_Protected_Type then
Result_Kind := A_Single_Protected_Declaration;
else
Result_Kind := A_Single_Task_Declaration;
end if;
Parent_Node := Parent (Parent_Node);
else
return A_Defining_Expanded_Name_Enclosing (Element);
end if;
return Node_To_Element_New (Node => Parent_Node,
Internal_Kind => Result_Kind,
Starting_Element => Element);
end A_Defining_Identifier_Enclosing;
------------------------------------------
-- A_Defining_Operator_Symbol_Enclosing --
------------------------------------------
function A_Defining_Operator_Symbol_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Parent_Node : Node_Id := Parent (R_Node (Element));
Parent_Node_Kind : constant Node_Kind := Nkind (Parent_Node);
begin
if Parent_Node_Kind = N_Function_Specification
then -- one more step up required
Parent_Node := Parent (Parent_Node);
end if;
return Node_To_Element_New (Node => Parent_Node,
Starting_Element => Element);
end A_Defining_Operator_Symbol_Enclosing;
--------------------------------
-- A_Discrete_Range_Enclosing --
--------------------------------
function A_Discrete_Range_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Result_Node : Node_Id := Parent (R_Node (Element));
Result_Node_Kind : constant Node_Kind := Nkind (Result_Node);
Result_Elem_Kind : Internal_Element_Kinds := Not_An_Element;
begin
if not Comes_From_Source (Result_Node) or else
not Comes_From_Source (Parent (Result_Node))
then
return An_Expression_Enclosing (Element);
end if;
if Nkind (Node (Element)) = N_Component_Clause then
Result_Node := R_Node (Element);
Result_Elem_Kind := A_Component_Clause;
elsif Result_Node_Kind = N_Component_Association then
Result_Elem_Kind := An_Array_Component_Association;
end if;
return Node_To_Element_New
(Starting_Element => Element,
Node => Result_Node,
Internal_Kind => Result_Elem_Kind,
Considering_Parent_Count => False);
end A_Discrete_Range_Enclosing;
-----------------------------------
-- A_Discriminant_Part_Enclosing --
-----------------------------------
function A_Discriminant_Part_Enclosing
(Element : Asis.Element)
return Asis.Element
is
begin
return Node_To_Element_New (Node => R_Node (Element),
Starting_Element => Element);
end A_Discriminant_Part_Enclosing;
--------------------------------------------
-- A_Discriminant_Specification_Enclosing --
--------------------------------------------
function A_Discriminant_Specification_Enclosing
(Element : Asis.Element)
return Asis.Element
is
begin
return Node_To_Element_New (
Node => Parent (R_Node (Element)),
Internal_Kind => A_Known_Discriminant_Part,
Starting_Element => Element);
end A_Discriminant_Specification_Enclosing;
----------------------------------------------
-- A_Loop_Parameter_Specification_Enclosing --
----------------------------------------------
function A_Loop_Parameter_Specification_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Result_Node : Node_Id;
Tmp : Node_Id;
Result : Asis.Element;
begin
Result_Node := Parent (R_Node (Element));
if Nkind (Result_Node) /= N_Quantified_Expression then
-- We have got to N_Ineration_Sceme node only
Result_Node := Parent (Result_Node);
end if;
if Declaration_Kind (Element) in
A_Generalized_Iterator_Specification ..
An_Element_Iterator_Specification
then
-- Here we may have to get to an artificial block statement the
-- needed loop node is rewritten into
Tmp := Parent (Parent (Result_Node));
if Nkind (Tmp) = N_Block_Statement
and then
Is_Rewrite_Substitution (Tmp)
and then
Nkind (Original_Node (Tmp)) = N_Loop_Statement
then
Result_Node := Tmp;
end if;
end if;
Result := Node_To_Element_New (Node => Result_Node,
Starting_Element => Element);
if Int_Kind (Result) = A_Parenthesized_Expression then
-- This is the case when an iteration scheme is used in a
-- conditional or quantified expression. We go in bottom-up
-- direction, so we can have A_Parenthesized_Expression only as the
-- next enclosing Element
Result := An_Expression_Enclosing (Element);
end if;
return Result;
end A_Loop_Parameter_Specification_Enclosing;
--------------------------------
-- A_Null_Component_Enclosing --
--------------------------------
function A_Null_Component_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Parent_Node : constant Node_Id := Node (Element);
Parent_Internal_Kind : Internal_Element_Kinds;
begin
if Nkind (Parent_Node) = N_Record_Definition then
Parent_Internal_Kind := A_Record_Definition;
else
Parent_Internal_Kind := A_Variant;
end if;
return Node_To_Element_New (Node => Parent_Node,
Internal_Kind => Parent_Internal_Kind,
Starting_Element => Element);
end A_Null_Component_Enclosing;
-----------------------------------------
-- A_Parameter_Specification_Enclosing --
-----------------------------------------
function A_Parameter_Specification_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Result_Node : Node_Id := Parent (R_Node (Element));
Result_Node_Kind : constant Node_Kind := Nkind (Result_Node);
begin
if not (Result_Node_Kind = N_Entry_Declaration or else
Result_Node_Kind = N_Access_Function_Definition or else
Result_Node_Kind = N_Access_Procedure_Definition or else
Result_Node_Kind = N_Accept_Statement)
-- --|A2005 start
or else
(Nkind (Parent (Result_Node)) = N_Identifier
and then
Is_Rewrite_Substitution (Parent (Result_Node))
and then
Nkind (Original_Node (Parent (Result_Node))) = N_Access_Definition)
or else
Nkind (Parent (Result_Node)) = N_Access_Definition
-- --|A2005 end
then
Result_Node := Parent (Result_Node);
-- the first Parent gives N_Function/Procedure_Specification only
end if;
return Node_To_Element_New
(Starting_Element => Element,
Node => Result_Node,
Considering_Parent_Count => False);
end A_Parameter_Specification_Enclosing;
------------------------
-- A_Pragma_Enclosing --
------------------------
function A_Pragma_Enclosing (Element : Asis.Element) return Asis.Element is
Parent_Node : Node_Id := Atree.Parent (R_Node (Element));
Parent_Node_Kind : Node_Kind := Nkind (Parent_Node);
Parent_Internal_Kind : Internal_Element_Kinds;
begin
if Parent_Node_Kind = N_Loop_Statement
and then
Is_Rewrite_Substitution (Parent_Node)
and then
Nkind (Original_Node (Parent_Node)) = N_Goto_Statement
then
-- This is the case when infinite loop implemented as
--
-- <<Target>> ...
-- ...
-- goto Target;
--
-- is rewritten into N_Loop_Statement
Parent_Node := Parent (Parent_Node);
Parent_Node_Kind := Nkind (Parent_Node);
end if;
-- filtering out compilation pragmas and correcting Parent_Node,
-- if necessary
case Parent_Node_Kind is
when N_Handled_Sequence_Of_Statements
| N_Package_Specification
| N_Component_List =>
Parent_Node := Atree.Parent (Parent_Node);
Parent_Node_Kind := Nkind (Parent_Node);
when N_Compilation_Unit =>
return Asis.Nil_Element;
when others =>
null;
end case;
-- special processing for Nodes requiring by-hand Enclosing Element
-- kind determination and returning the result for all other Nodes
case Parent_Node_Kind is
when N_If_Statement =>
if List_Containing (R_Node (Element)) =
Then_Statements (Parent_Node)
then
Parent_Internal_Kind := An_If_Path;
else
Parent_Internal_Kind := An_Else_Path;
end if;
-- ??? List_Containing (Node (Element)) ??
-- ??? or List_Containing (R_Node (Element)) ??
when N_Conditional_Entry_Call
| N_Selective_Accept =>
Parent_Internal_Kind := An_Else_Path;
when N_Record_Definition =>
Parent_Internal_Kind := An_Else_Path;
when others => -- auto determination of the Enclosing Element kind:
return Node_To_Element_New (Node => Parent_Node,
Starting_Element => Element);
end case;
-- returning the Enclosing Element with the by-hand-defined kind:
return Node_To_Element_New (Node => Parent_Node,
Internal_Kind => Parent_Internal_Kind,
Starting_Element => Element);
end A_Pragma_Enclosing;
-------------------------------------------
-- A_Range_Attribute_Reference_Enclosing --
-------------------------------------------
function A_Range_Attribute_Reference_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Result_Node : Node_Id := Parent (R_Node (Element));
Tmp : Node_Id := Parent (Result_Node);
begin
if Nkind (Result_Node) = N_Subtype_Indication and then
Nkind (Tmp) = N_Subtype_Declaration and then
not Comes_From_Source (Tmp)
then
-- This N_Subtype_Declaration is from the tree structure created
-- for an artificial subtype declaration, see C208-003
Tmp := Next (Tmp);
Result_Node := Object_Definition (Tmp);
end if;
return Node_To_Element_New
(Starting_Element => Element,
Node => Result_Node,
Considering_Parent_Count => False);
end A_Range_Attribute_Reference_Enclosing;
-----------------------------------
-- A_Record_Definition_Enclosing --
-----------------------------------
function A_Record_Definition_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Parent_Node : Node_Id;
Parent_Internal_Kind : Internal_Element_Kinds;
begin
if Nkind (Parent (R_Node (Element))) = N_Derived_Type_Definition then
Parent_Node := Parent (R_Node (Element));
Parent_Internal_Kind := A_Derived_Record_Extension_Definition;
else
Parent_Node := Node (Element);
if Tagged_Present (Parent_Node) then
Parent_Internal_Kind := A_Tagged_Record_Type_Definition;
else
Parent_Internal_Kind := A_Record_Type_Definition;
end if;
end if;
return Node_To_Element_New (Node => Parent_Node,
Internal_Kind => Parent_Internal_Kind,
Starting_Element => Element);
end A_Record_Definition_Enclosing;
-----------------------------------------
-- A_Simple_Expression_Range_Enclosing --
----------------------------------------
function A_Simple_Expression_Range_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Enclosing_Node : Node_Id := Node (Element);
Enclosing_Node_Kind : Node_Kind := Nkind (Enclosing_Node);
Context : Node_Id;
Context_Kind : Node_Kind;
Enclosing_Element_Kind : Internal_Element_Kinds;
begin
if Enclosing_Node_Kind = N_Signed_Integer_Type_Definition then
-- back from Integer_Constraint
return Node_To_Element_New
(Starting_Element => Element,
Node => R_Node (Element),
Internal_Kind => A_Signed_Integer_Type_Definition,
Considering_Parent_Count => False);
else -- one step up
Enclosing_Node := Parent (R_Node (Element));
Enclosing_Node_Kind := Nkind (Enclosing_Node);
-- possible values of corresponding kinds of
-- Enclosing_Node_Kind: Enclosing Element:
--
-- N_Floating_Point_Definition A_Floating_Point_Definition (*)
-- N_Ordinary_Fixed_Point_Definition An_Ordinary_Fixed_Point_Definition (*)
-- N_Decimal_Fixed_Point_Definition A_Decimal_Fixed_Point_Definition (*)
--
-- A_Constraint
-- N_Digits_Constraint A_Digits_Constraint (*)
-- N_Delta_Constraint A_Delta_Constraint (*)
--
--
-- A_Subtype_Indication
-- N_Subtype_Indication A_Discrete_Subtype_Indication
-- (_As_Subtype_Definition)
-- A_Subtype_Indication
--
-- A_Discrete_Range
-- N_Subtype_Indication A_Discrete_Subtype_Indication
--
--
--
-- N_In An_In_Range_Membership_Test (*)
-- N_Not_In A_Not_In_Range_Membership_Test (*)
--
-- (*) means that the Enclosing Element can be obtained by Node_To_Elemen
-- constructor with auto determination of the Element kind
if Enclosing_Node_Kind /= N_Subtype_Indication then
return Node_To_Element_New
(Starting_Element => Element,
Node => Enclosing_Node,
Considering_Parent_Count => False);
else
-- A_Discrete_Subtype_Indication or
-- A_Discrete_Subtype_Indication_As_Subtype_Definition
-- or A_Subtype_Indication?
-- First, we have to skip implicit subtype created for
-- constraint directly included in object declaration,
-- if any
Skip_Implicit_Subtype (Enclosing_Node);
Context := Parent (Enclosing_Node);
Context_Kind := Nkind (Context);
if Context_Kind = N_Subtype_Indication then
-- it's impossible to make a decision on the base
-- of this node, we shall go one more step up
Context := Parent (Context);
Context_Kind := Nkind (Context);
end if;
if Context_Kind = N_Subtype_Declaration or else
((Context_Kind = N_Constrained_Array_Definition or else
Context_Kind = N_Unconstrained_Array_Definition)
and then
Enclosing_Node = Sinfo.Component_Definition (Context))
or else
-- is it enough or should we add:
-- and then Enclosing_Node = Subtype_Indication (Context)?
Context_Kind = N_Derived_Type_Definition or else
Context_Kind = N_Access_To_Object_Definition
then
Enclosing_Element_Kind := A_Subtype_Indication;
elsif Context_Kind = N_Constrained_Array_Definition or else
Context_Kind = N_Entry_Declaration or else
Context_Kind = N_Entry_Index_Specification or else
Context_Kind = N_Loop_Parameter_Specification
then
Enclosing_Element_Kind :=
A_Discrete_Subtype_Indication_As_Subtype_Definition;
elsif Context_Kind = N_Component_Declaration or else
Context_Kind = N_Object_Declaration or else
Context_Kind = N_Component_Definition
then
Enclosing_Element_Kind := A_Subtype_Indication;
else
Enclosing_Element_Kind :=
A_Discrete_Subtype_Indication;
end if;
return Node_To_Element_New
(Starting_Element => Element,
Node => Enclosing_Node,
Internal_Kind => Enclosing_Element_Kind,
Considering_Parent_Count => False);
end if;
end if;
end A_Simple_Expression_Range_Enclosing;
---------------------------
-- A_Statement_Enclosing --
---------------------------
function A_Statement_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Parent_Node : Node_Id := Parent (R_Node (Element));
Parent_Node_Kind : Node_Kind := Nkind (Parent_Node);
Parent_Internal_Kind : Internal_Element_Kinds;
begin
if Parent_Node_Kind = N_Loop_Statement
and then
Is_Rewrite_Substitution (Parent_Node)
and then
Nkind (Original_Node (Parent_Node)) = N_Goto_Statement
then
-- This is the case when infinite loop implemented as
--
-- <<Target>> ...
-- ...
-- goto Target;
--
-- is rewritten into N_Loop_Statement
Parent_Node := Parent (Parent_Node);
Parent_Node_Kind := Nkind (Parent_Node);
end if;
if Parent_Node_Kind = N_If_Statement then
if List_Containing (R_Node (Element)) =
Then_Statements (Parent_Node)
then
Parent_Internal_Kind := An_If_Path;
else
Parent_Internal_Kind := An_Else_Path;
end if;
-- ??? List_Containing (Node (Element)) ??
-- ?? or List_Containing (R_Node (Element)) ??
elsif Parent_Node_Kind = N_Conditional_Entry_Call or else
Parent_Node_Kind = N_Selective_Accept
then
Parent_Internal_Kind := An_Else_Path;
else
if Parent_Node_Kind = N_Handled_Sequence_Of_Statements then
-- to go to N_Block_Statement, N_Accept_Statement,
-- N_Subprogram_Body, N_Package_Body, N_Task_Body or
-- N_Entry_Body node
Parent_Node := Parent (Parent_Node);
end if;
return Node_To_Element_New (Node => Parent_Node,
Starting_Element => Element);
end if;
return Node_To_Element_New (Node => Parent_Node,
Internal_Kind => Parent_Internal_Kind,
Starting_Element => Element);
end A_Statement_Enclosing;
------------------------------------
-- A_Subtype_Indication_Enclosing --
------------------------------------
function A_Subtype_Indication_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Parent_Node : Node_Id := Parent (R_Node (Element));
Result_Node : Node_Id := R_Node (Element);
Parent_Node_Kind : constant Node_Kind := Nkind (Parent_Node);
Result_Kind : Internal_Element_Kinds;
begin
if Parent_Node_Kind = N_Component_Definition then
Parent_Node := Parent (Parent_Node);
-- This skips the normalized component declarations back!
Parent_Node := Sinfo.Component_Definition (Parent_Node);
end if;
if Parent_Node_Kind = N_Allocator and then
Nkind (Parent (Parent_Node)) = N_Component_Association and then
not Comes_From_Source (Parent (Parent_Node))
then
return An_Expression_Enclosing (Element);
end if;
if Parent_Node_Kind = N_Unconstrained_Array_Definition or else
Parent_Node_Kind = N_Constrained_Array_Definition or else
Parent_Node_Kind = N_Component_Declaration
then
Result_Kind := A_Component_Definition;
elsif Parent_Node_Kind = N_Private_Extension_Declaration then
Result_Kind := A_Private_Extension_Definition;
Result_Node := Parent_Node;
else
return Node_To_Element_New
(Starting_Element => Element,
Node => Parent_Node,
Considering_Parent_Count => False);
end if;
return Node_To_Element_New
(Starting_Element => Element,
Node => Result_Node,
Internal_Kind => Result_Kind,
Considering_Parent_Count => False);
end A_Subtype_Indication_Enclosing;
-------------------------------------------------
-- A_Terminate_Alternative_Statement_Enclosing --
-------------------------------------------------
function A_Terminate_Alternative_Statement_Enclosing
(Element : Asis.Element)
return Asis.Element
is
begin
return Node_To_Element_New (Node => R_Node (Element),
Starting_Element => Element);
end A_Terminate_Alternative_Statement_Enclosing;
------------------------------
-- A_Variant_Part_Enclosing --
------------------------------
function A_Variant_Part_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Result_Node : constant Node_Id := Parent (Parent (R_Node (Element)));
Result_Kind : Internal_Element_Kinds;
begin
if Nkind (Result_Node) = N_Record_Definition then
Result_Kind := A_Record_Definition;
else
Result_Kind := A_Variant;
end if;
return Node_To_Element_New
(Starting_Element => Element,
Node => Result_Node,
Internal_Kind => Result_Kind,
Considering_Parent_Count => False);
end A_Variant_Part_Enclosing;
------------------------------
-- An_Association_Enclosing --
------------------------------
function An_Association_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Result : Asis.Element;
begin
if Normalization_Case (Element) = Is_Not_Normalized then
Result := An_Expression_Enclosing (Element);
else
Result := Node_To_Element_New
(Node => R_Node (Element),
Starting_Element => Element);
Set_From_Implicit (Result, False);
end if;
return Result;
end An_Association_Enclosing;
----------------------------------------------
-- An_Attribute_Definition_Clause_Enclosing --
----------------------------------------------
function An_Attribute_Definition_Clause_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Result_Node : Node_Id := Parent (R_Node (Element));
Result_Node_Kind : Node_Kind := Nkind (Result_Node);
Result_Kind : Internal_Element_Kinds := Not_An_Element;
begin
if Result_Node_Kind = N_Component_List or else
Result_Node_Kind = N_Package_Specification
then
Result_Node := Parent (Result_Node);
Result_Node_Kind := Nkind (Result_Node);
end if;
if Result_Node_Kind = N_Record_Definition then
Result_Kind := A_Record_Definition;
elsif Result_Node_Kind = N_Variant then
Result_Kind := A_Variant;
end if;
return Node_To_Element_New
(Starting_Element => Element,
Node => Result_Node,
Internal_Kind => Result_Kind,
Considering_Parent_Count => False);
end An_Attribute_Definition_Clause_Enclosing;
----------------------------
-- An_Else_Path_Enclosing --
----------------------------
function An_Else_Path_Enclosing
(Element : Asis.Element)
return Asis.Element
is
begin
return Node_To_Element_New (Node => R_Node (Element),
Starting_Element => Element);
end An_Else_Path_Enclosing;
----------------------------------------------------
-- An_Enumeration_Literal_Specification_Enclosing --
----------------------------------------------------
function An_Enumeration_Literal_Specification_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Result_Node : Node_Id;
Start_Elem : Asis.Element := Element;
begin
if Special_Case (Element) = Stand_Char_Literal then
Result_Node := R_Node (Element);
Set_Character_Code (Start_Elem, 0);
Set_Special_Case (Start_Elem, Explicit_From_Standard);
else
Result_Node := Parent (R_Node (Element));
end if;
return Node_To_Element_New
(Starting_Element => Start_Elem,
Node => Result_Node,
Internal_Kind => An_Enumeration_Type_Definition);
end An_Enumeration_Literal_Specification_Enclosing;
----------------------------------------------
-- An_Enumeration_Type_Definition_Enclosing --
----------------------------------------------
function An_Enumeration_Type_Definition_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Result_Node : Node_Id;
begin
if Special_Case (Element) = Stand_Char_Literal then
Result_Node := R_Node (Element);
if Nkind (Result_Node) = N_Defining_Identifier then
-- we are in the definition of Standard.Boolean:
Result_Node := Parent (Etype (Result_Node));
end if;
else
Result_Node := Parent (R_Node (Element));
end if;
return Node_To_Element_New
(Starting_Element => Element,
Node => Result_Node,
Internal_Kind => An_Ordinary_Type_Declaration);
end An_Enumeration_Type_Definition_Enclosing;
------------------------------------
-- An_Exception_Handler_Enclosing --
------------------------------------
function An_Exception_Handler_Enclosing
(Element : Asis.Element)
return Asis.Element
is
begin
return Node_To_Element_New
(Node => Parent (Parent (R_Node (Element))),
Starting_Element => Element);
end An_Exception_Handler_Enclosing;
-----------------------------
-- An_Expression_Enclosing --
-----------------------------
function An_Expression_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Start_Elem : Asis.Element := Element;
Rough_Result_Node : Node_Id;
Res_Entity : Entity_Id;
Rough_Result_Element : Asis.Element;
Rough_Res_Spec_Case : Special_Cases;
Result_Element : Asis.Element;
begin
Rough_Result_Node := Get_Rough_Enclosing_Node (Element);
if not (Sloc (Node (Start_Elem)) <= Standard_Location or else
Special_Case (Start_Elem) = Configuration_File_Pragma)
then
Set_Special_Case (Start_Elem, Not_A_Special_Case);
end if;
Rough_Result_Element := Node_To_Element_New
(Node => Rough_Result_Node,
Starting_Element => Start_Elem);
if Is_Top_Of_Expanded_Generic (Rough_Result_Node)
and then
Is_From_Instance (Element)
and then
(Nkind (Original_Node (Rough_Result_Node)) /=
N_Formal_Package_Declaration
or else
Instantiation_Depth (Sloc (R_Node (Element))) >
Instantiation_Depth (Sloc (Rough_Result_Node)))
then
-- ??? The content of this if statement is just a slightly edited
-- ??? fragment of Enclosing_For_Explicit_Instance_Component
if Nkind (Rough_Result_Node) = N_Package_Declaration or else
Nkind (Rough_Result_Node) = N_Package_Body
then
Rough_Res_Spec_Case := Expanded_Package_Instantiation;
-- and here we have to correct the result:
Set_Node (Rough_Result_Element, R_Node (Rough_Result_Element));
if Nkind (Rough_Result_Node) = N_Package_Declaration then
Set_Int_Kind (Rough_Result_Element, A_Package_Declaration);
else
Set_Int_Kind (Rough_Result_Element, A_Package_Body_Declaration);
end if;
else
Rough_Res_Spec_Case := Expanded_Subprogram_Instantiation;
end if;
Set_Special_Case (Rough_Result_Element, Rough_Res_Spec_Case);
end if;
if Special_Case (Element) = Is_From_Gen_Association
and then
Is_Top_Of_Expanded_Generic (Node (Rough_Result_Element))
and then
Instantiation_Depth (Sloc (Node (Rough_Result_Element))) =
Instantiation_Depth (Sloc (Node (Element)))
then
Rough_Result_Element := Enclosing_Element (Rough_Result_Element);
end if;
if Nkind (Rough_Result_Node) = N_Subprogram_Declaration
and then
not Comes_From_Source (Rough_Result_Node)
then
Res_Entity := Defining_Unit_Name (Specification (Rough_Result_Node));
if (Ekind (Res_Entity) = E_Function
and then not Comes_From_Source (Res_Entity)
and then Chars (Res_Entity) = Snames.Name_Op_Ne)
and then Present (Corresponding_Equality (Res_Entity))
then
Set_Special_Case
(Rough_Result_Element, Is_From_Imp_Neq_Declaration);
end if;
end if;
Result_Element := Get_Enclosing
(Approximation => Rough_Result_Element,
Element => Element);
return Result_Element;
end An_Expression_Enclosing;
--------------------------------
-- An_Others_Choice_Enclosing --
--------------------------------
function An_Others_Choice_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Parent_Node : constant Node_Id := Parent (Parent (R_Node (Element)));
Result_Node : Node_Id := Parent (R_Node (Element));
Result_Kind : Internal_Element_Kinds := Not_An_Element;
begin
if Nkind (Result_Node) = N_Component_Association then
-- we have to find out, is it record or array component
-- association. Parent_Node points to the enclosing aggregate
if No (Etype (Parent_Node)) or else
Is_Array_Type (Etype (Parent_Node))
then
-- the first condition in 'or else' is true for multi-dimensional
-- array aggregates
Result_Kind := An_Array_Component_Association;
else
Result_Kind := A_Record_Component_Association;
end if;
elsif Nkind (Result_Node) = N_Package_Declaration
and then
Nkind (Original_Node (Result_Node)) = N_Formal_Package_Declaration
then
Result_Node :=
Last_Non_Pragma
(Generic_Associations (Original_Node (Result_Node)));
Result_Kind := A_Generic_Association;
end if;
return Node_To_Element_New
(Starting_Element => Element,
Node => Result_Node,
Internal_Kind => Result_Kind,
Considering_Parent_Count => False);
end An_Others_Choice_Enclosing;
----------------------------------------------------
-- Not_Implemented_Enclosing_Element_Construction --
----------------------------------------------------
function Not_Implemented_Enclosing_Element_Construction
(Element : Asis.Element) return Asis.Element is
begin
Not_Implemented_Yet (Diagnosis =>
"Enclosing Element retrieval for the explicit Element "
& "of the " & Internal_Element_Kinds'Image
(Int_Kind (Element)) & " kind "
& "has not been implemented yet");
return Asis.Nil_Element; -- to make the code syntactically correct;
end Not_Implemented_Enclosing_Element_Construction;
----------------------------
-- Possible_C_U_Enclosing --
----------------------------
function Possible_C_U_Enclosing
(Element : Asis.Element)
return Asis.Element
is
Parent_Node : Node_Id := Parent (R_Node (Element));
Parent_Node_Kind : constant Node_Kind := Nkind (Parent_Node);
begin
if Parent_Node_Kind = N_Compilation_Unit or else
Parent_Node_Kind = N_Subunit
then
return Asis.Nil_Element;
elsif Parent_Node_Kind = N_Package_Specification then
Parent_Node := Parent (Parent_Node);
elsif Parent_Node_Kind = N_Protected_Definition then
Parent_Node := Parent (Parent_Node);
Parent_Node := Protected_Definition (Original_Node (Parent_Node));
end if;
return Node_To_Element_New
(Starting_Element => Element,
Node => Parent_Node);
end Possible_C_U_Enclosing;
-----------------------------------------------------------------
-- Section 6 - bodies for the routines defined in the package --
-- spec and local subprograms --
-----------------------------------------------------------------
---------------------------------
-- Corresponding_Instantiation --
---------------------------------
function Corresponding_Instantiation
(Element : Asis.Element)
return Asis.Element
is
Argument_Node : Node_Id := R_Node (Element);
Argument_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
Result_Node : Node_Id := Argument_Node;
Result_Kind : Internal_Element_Kinds;
Result_Unit : constant Asis.Compilation_Unit := Encl_Unit (Element);
begin
if Argument_Kind = A_Package_Declaration or else
Argument_Kind = A_Package_Body_Declaration
then
-- A formal package with box needs a special processing - it is
-- based on the same node as the argument
if Nkind (Original_Node (Argument_Node)) =
N_Formal_Package_Declaration
and then
Box_Present (Original_Node (Argument_Node))
then
Result_Kind := A_Formal_Package_Declaration_With_Box;
else
Argument_Node := Parent (Argument_Node);
if Nkind (Argument_Node) in N_Generic_Declaration and then
Is_List_Member (Result_Node) and then
List_Containing (Result_Node) =
Generic_Formal_Declarations (Argument_Node)
then
Result_Kind := A_Formal_Package_Declaration;
else
Result_Kind := A_Package_Instantiation;
end if;
end if;
else
if Argument_Kind = A_Procedure_Declaration or else
Argument_Kind = A_Procedure_Body_Declaration
then
Result_Kind := A_Procedure_Instantiation;
else
Result_Kind := A_Function_Instantiation;
end if;
-- we have to go the N_Package_Decalaration node of an
-- artificial package created by the compiler for a subprogram
-- instantiation - two steps up the tree are needed:
Result_Node := Parent (Result_Node);
if Argument_Kind = A_Procedure_Declaration or else
Argument_Kind = A_Function_Declaration
then
Result_Node := Parent (Result_Node);
end if;
end if;
if Nkind (Parent (Result_Node)) = N_Compilation_Unit then
-- For library-level subprogram instantiations we may have a
-- problem in the tree created for the instantiation itself.
if Nkind (Result_Node) = N_Package_Declaration and then
not Is_Rewrite_Substitution (Result_Node)
then
Result_Node := Parent (Corresponding_Body (Result_Node));
if Nkind (Result_Node) = N_Defining_Program_Unit_Name then
Result_Node := Parent (Result_Node);
end if;
end if;
elsif Nkind (Original_Node (Result_Node)) /=
N_Formal_Package_Declaration
then
-- "local" instantiation, therefore - one or two steps down the
-- declaration list to get in the instantiation node, a formal
-- package with a box is an exception:
Result_Node := Next_Non_Pragma (Result_Node);
if Nkind (Result_Node) = N_Package_Body then
-- This is an expanded generic body
Result_Node := Next_Non_Pragma (Result_Node);
end if;
end if;
if Is_Rewrite_Substitution (Result_Node) and then
Is_Rewrite_Substitution (Original_Node (Result_Node))
then
Result_Node := Original_Node (Result_Node);
end if;
return Node_To_Element_New
(Node => Result_Node,
Internal_Kind => Result_Kind,
In_Unit => Result_Unit);
end Corresponding_Instantiation;
------------------------------------
-- Enclosing_Element_For_Explicit --
------------------------------------
function Enclosing_Element_For_Explicit
(Element : Asis.Element)
return Asis.Element
is
Enclosing_Construction_Case : Internal_Element_Kinds;
Element_Internal_Kind : Internal_Element_Kinds;
Result_Element : Asis.Element;
Res_Node : constant Node_Id := Standard_Package_Node;
Res_Kind : Internal_Element_Kinds := Not_An_Element;
Res_Spec_Case : Special_Cases;
begin
Element_Internal_Kind := Int_Kind (Element);
-- A special case of fake Numeric_Error renaming is handled
-- separately (see B712-0050)
if Special_Case (Element) = Numeric_Error_Renaming then
case Element_Internal_Kind is
when An_Exception_Renaming_Declaration =>
Res_Kind := A_Package_Declaration;
Res_Spec_Case := Explicit_From_Standard;
when A_Defining_Identifier |
An_Identifier =>
Res_Kind := An_Exception_Renaming_Declaration;
Res_Spec_Case := Numeric_Error_Renaming;
when others =>
null;
end case;
Result_Element := Node_To_Element_New
(Starting_Element => Element,
Node => Res_Node,
Internal_Kind => Res_Kind,
Spec_Case => Res_Spec_Case);
return Result_Element;
end if;
-- A special case of a configuration pragma is handled separately
-- (BA07-013)
if Element_Internal_Kind in Internal_Pragma_Kinds and then
Special_Case (Element) = Configuration_File_Pragma
then
return Asis.Nil_Element;
end if;
Enclosing_Construction_Case :=
Enclosing_Element_For_Explicits_First_Switch (Element_Internal_Kind);
case Enclosing_Construction_Case is
when Not_An_Element =>
return Asis.Nil_Element;
when Trivial_Mapping =>
Result_Element := General_Encl_Elem (Element);
when Non_Trivial_Mapping =>
Result_Element :=
Enclosing_Element_For_Explicits_Second_Switch
(Element_Internal_Kind) (Element);
when No_Mapping =>
No_Enclosing_Element (Element_Kind => Element_Internal_Kind);
return Asis.Nil_Element; -- to avoid GNAT warning
when Not_Implemented_Mapping =>
Not_Implemented_Enclosing_Element_Construction
(Element => Element);
when others =>
-- others means here that the Enclosing Element should
-- based on the same node.
Result_Element := Node_To_Element_New
(Starting_Element => Element,
Node => R_Node (Element),
Internal_Kind => Enclosing_Construction_Case,
Considering_Parent_Count => False);
if Element_Internal_Kind = A_Defining_Character_Literal then
Set_Character_Code (Result_Element, Character_Code (Element));
end if;
end case;
if Is_From_Implicit (Element)
and then
Statement_Kind (Element) = A_Null_Statement
then
-- Case of an implicit NULL statement needed for 'floating' labels,
-- Ada 2012
Set_From_Implicit (Result_Element, False);
end if;
return Result_Element;
end Enclosing_Element_For_Explicit;
-----------------------------------------------
-- Enclosing_For_Explicit_Instance_Component --
-----------------------------------------------
function Enclosing_For_Explicit_Instance_Component
(Element : Asis.Element)
return Asis.Element
is
Result_Element : Asis.Element;
Result_Node : Node_Id;
Tmp_Node : Node_Id;
Res_Spec_Case : Special_Cases;
function Is_Top_Exp_Form_Pack_With_Box
(Potential_Enclosing_Element : Asis.Element;
Arg_Element : Asis.Element)
return Boolean;
-- Checks if Potential_Enclosing_Element is the top expanded spec
-- (??? what about body???) for a formal package declaration with box.
-- The problem here is that when going up the tree, we can get into this
-- argument both from components of the formal package declaration with
-- box and from the corresponding expanded spec. So we have to check
-- if Potential_Enclosing_Element and Arg_Element are the same level
-- of instantiating (nested instances may be a pain! The function needs
-- more testing ???)
-- See the discussion in E425-007
function Is_Top_Exp_Form_Pack_With_Box
(Potential_Enclosing_Element : Asis.Element;
Arg_Element : Asis.Element)
return Boolean
is
EE_Inst_Level : Natural := 0;
Arg_Inst_Level : Natural := 0;
Src : Source_Ptr :=
Instantiation
(Get_Source_File_Index
(Sloc (R_Node (Potential_Enclosing_Element))));
function May_Be_Exp_Pack_Def_Name
(N_Pack : Node_Id;
N_Name : Node_Id)
return Boolean;
-- In case of the defining name of an expanded package created for a
-- formal package with the box, we have the instantiation chain one
-- link shorter then the rest of the expanded package, so we have
-- to detect this situation.
function May_Be_Nested_FP_Instantiation
(N_Pack : Node_Id;
N_Name : Node_Id)
return Boolean;
-- See E430-A01. We try to detect the situation when we go out of
-- a chain of nested instantiations created by formal packages with
-- the box
function May_Be_Exp_Pack_Def_Name
(N_Pack : Node_Id;
N_Name : Node_Id)
return Boolean
is
Result : Boolean := False;
begin
if Nkind (N_Name) = N_Defining_Identifier
and then
Nkind (Original_Node (N_Pack)) = N_Formal_Package_Declaration
and then
Box_Present (Original_Node (N_Pack))
then
Result := N_Name = Defining_Unit_Name (Specification (N_Pack));
end if;
return Result;
end May_Be_Exp_Pack_Def_Name;
function May_Be_Nested_FP_Instantiation
(N_Pack : Node_Id;
N_Name : Node_Id)
return Boolean
is
Result : Boolean := False;
begin
if Nkind (N_Pack) = N_Generic_Package_Declaration
and then
Nkind (Original_Node (N_Pack)) = N_Formal_Package_Declaration
and then
Box_Present (Original_Node (N_Pack))
and then
Nkind (N_Name) = N_Generic_Package_Declaration
and then
Nkind (Original_Node (N_Name)) = N_Formal_Package_Declaration
and then
Box_Present (Original_Node (N_Name))
then
Result := True;
end if;
return Result;
end May_Be_Nested_FP_Instantiation;
begin
if not (Nkind (Node (Potential_Enclosing_Element)) =
N_Formal_Package_Declaration
and then
Nkind (R_Node (Potential_Enclosing_Element)) =
N_Generic_Package_Declaration)
or else
(Int_Kind (Potential_Enclosing_Element) =
A_Formal_Package_Declaration_With_Box
and then
Node (Arg_Element) =
Defining_Identifier (Node (Potential_Enclosing_Element)))
then
return False;
end if;
while Src /= No_Location loop
EE_Inst_Level := EE_Inst_Level + 1;
Src := Instantiation (Get_Source_File_Index (Src));
end loop;
Src :=
Instantiation (Get_Source_File_Index (Sloc (R_Node (Arg_Element))));
while Src /= No_Location loop
Arg_Inst_Level := Arg_Inst_Level + 1;
Src := Instantiation (Get_Source_File_Index (Src));
end loop;
return (May_Be_Exp_Pack_Def_Name
(R_Node (Potential_Enclosing_Element),
R_Node (Arg_Element))
and then
EE_Inst_Level = Arg_Inst_Level + 1)
or else
(May_Be_Nested_FP_Instantiation
(R_Node (Potential_Enclosing_Element),
R_Node (Arg_Element))
and then
EE_Inst_Level + 1 = Arg_Inst_Level)
or else
EE_Inst_Level = Arg_Inst_Level;
end Is_Top_Exp_Form_Pack_With_Box;
begin
Result_Element := Enclosing_Element_For_Explicit (Element);
if Is_Nil (Result_Element) then
-- There is a special case corresponding to the defining name in an
-- artificial subtype declaration that is a means to pass an actual
-- type in the expanded instantiation (see K811-006). Under some
-- conditions the corresponding node in the tree is an Itype node,
-- and it does not have a Parent reference set.
Tmp_Node := Node (Element);
if Nkind (Tmp_Node) = N_Defining_Identifier and then
Is_Itype (Tmp_Node)
then
Tmp_Node := Associated_Node_For_Itype (Tmp_Node);
Result_Element :=
Node_To_Element_New
(Node => Tmp_Node,
Starting_Element => Element,
Internal_Kind => A_Subtype_Declaration);
end if;
end if;
-- In case if the result argument is an artificial declaration
-- used to pass an actual into expanded subprogram, we are
-- in the spec of the artificial wrapper package. So we have to get
-- to the expanded subprogram declaration (see G416-009)
if Is_Top_Of_Expanded_Generic (R_Node (Result_Element)) then
Tmp_Node := (R_Node (Result_Element));
if Nkind (Tmp_Node) = N_Package_Declaration
and then
No (Generic_Parent (Specification (Tmp_Node))) then
-- This IF statement prevents us from doing this special
-- processing for expanded package declarations, we have to do
-- it only for wrapper packages created for subprogram
-- instantiation
Tmp_Node :=
Last (Visible_Declarations (Specification (Tmp_Node)));
Result_Element :=
Node_To_Element_New
(Node => Tmp_Node,
Spec_Case => Expanded_Subprogram_Instantiation,
Starting_Element => Element);
end if;
end if;
-- and now we have to check if we are in the whole expanded
-- declaration
Result_Node := R_Node (Result_Element);
if not (Is_Rewrite_Substitution (Result_Node)
and then
Nkind (Original_Node (Result_Node)) =
N_Formal_Package_Declaration
and then
(Node (Element) =
Defining_Identifier (Original_Node (Result_Node))
or else
(Node (Element) /=
Defining_Unit_Name (Specification (Result_Node))
and then
Instantiation_Depth (Sloc (R_Node (Element))) =
Instantiation_Depth (Sloc (Result_Node)))))
and then
Is_Top_Of_Expanded_Generic (Result_Node)
then
-- this is an artificial package or subprogram declaration
-- created by the compiler as an expanded generic declaration
if Nkind (Result_Node) = N_Package_Declaration or else
Nkind (Result_Node) = N_Package_Body
then
Res_Spec_Case := Expanded_Package_Instantiation;
-- and here we have to correct the result:
Set_Node (Result_Element, R_Node (Result_Element));
if Nkind (Result_Node) = N_Package_Declaration then
Set_Int_Kind (Result_Element, A_Package_Declaration);
else
Set_Int_Kind (Result_Element, A_Package_Body_Declaration);
end if;
else
Res_Spec_Case := Expanded_Subprogram_Instantiation;
end if;
Set_Special_Case (Result_Element, Res_Spec_Case);
elsif Is_Top_Exp_Form_Pack_With_Box (Result_Element, Element) then
-- This case is somewhat special - we have not a package, but a
-- generic package declaration as expanded code here
Set_Int_Kind (Result_Element, A_Package_Declaration);
Set_Special_Case (Result_Element, Expanded_Package_Instantiation);
-- ??? What about expanded bodies for formal packages with a box?
end if;
-- and we have to correct Is_Part_Of_Instance field of the result -
-- just in case. May be, it will not be necessary, if (and when)
-- Enclosing_Element_For_Explicit takes the corresponding fields
-- from its argument
if not Is_Nil (Result_Element) then
Set_From_Instance (Result_Element, True);
end if;
return Result_Element;
end Enclosing_For_Explicit_Instance_Component;
------------------------------------
-- Enclosing_Element_For_Implicit --
------------------------------------
function Enclosing_Element_For_Implicit
(Element : Asis.Element)
return Asis.Element
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
Result_Node : Node_Id := Empty;
Result_Element : Asis.Element;
Result_Kind : Internal_Element_Kinds := Not_An_Element;
Res_Spec_Case : Special_Cases := Not_A_Special_Case;
begin
-- Special treatment for the declaration of implicit "/=", see F903-002:
if Asis.Extensions.Is_Implicit_Neq_Declaration (Element) then
Result_Element :=
Enclosing_Element
(Asis.Declarations.Corresponding_Equality_Operator (Element));
else
case Arg_Kind is
when A_Procedure_Declaration |
A_Function_Declaration |
A_Procedure_Body_Declaration |
A_Function_Body_Declaration |
A_Procedure_Renaming_Declaration |
A_Function_Renaming_Declaration |
A_Discriminant_Specification |
A_Component_Declaration =>
Result_Node := Original_Node (Node_Field_1 (Element));
if Nkind (Result_Node) in N_Entity
and then
(Arg_Kind in A_Procedure_Declaration ..
A_Function_Declaration
or else
Arg_Kind in A_Procedure_Body_Declaration ..
A_Function_Body_Declaration
or else
Arg_Kind in A_Procedure_Renaming_Declaration ..
A_Function_Renaming_Declaration)
then
Result_Node :=
Original_Node (Parent (Node_Field_1 (Element)));
end if;
case Nkind (Result_Node) is
when N_Private_Extension_Declaration =>
Result_Kind := A_Private_Extension_Definition;
when N_Formal_Type_Declaration =>
Result_Node := Sinfo.Formal_Type_Definition (Result_Node);
when others =>
Result_Node := Sinfo.Type_Definition (Result_Node);
end case;
Result_Element := Node_To_Element_New (
Node => Result_Node,
Starting_Element => Element,
Internal_Kind => Result_Kind);
Set_From_Implicit (Result_Element, False);
Set_From_Inherited (Result_Element, False);
Set_Node_Field_1 (Result_Element, Empty);
when Internal_Root_Type_Kinds =>
Result_Element := Element;
Set_Int_Kind (Result_Element, An_Ordinary_Type_Declaration);
when An_Ordinary_Type_Declaration =>
-- The only possible case is the declaration of a root or
-- universal numeric type
Result_Node := Standard_Package_Node;
Res_Spec_Case := Explicit_From_Standard;
Result_Kind := A_Package_Declaration;
Result_Element :=
Node_To_Element_New (Node => Result_Node,
Spec_Case => Res_Spec_Case,
In_Unit => Encl_Unit (Element));
when An_Enumeration_Literal_Specification |
An_Entry_Declaration =>
Result_Node :=
Sinfo.Type_Definition
(Original_Node (Node_Field_1 (Element)));
Result_Kind := A_Derived_Type_Definition;
Result_Element := Node_To_Element_New (
Node => Result_Node,
Starting_Element => Element,
Internal_Kind => Result_Kind);
Set_From_Implicit (Result_Element, False);
Set_From_Inherited (Result_Element, False);
Set_Node_Field_1 (Result_Element, Empty);
when A_Generic_Association =>
Result_Element :=
Node_To_Element_New (Node => R_Node (Element),
In_Unit => Encl_Unit (Element));
when others =>
if Normalization_Case (Element) =
Is_Normalized_Defaulted_For_Box
then
Result_Node := Parent (Parent (Parent (Node (Element))));
while not (Nkind (Result_Node) in N_Generic_Instantiation
or else
Nkind (Original_Node (Result_Node)) =
N_Formal_Package_Declaration)
loop
if Nkind (Parent (Result_Node)) = N_Compilation_Unit then
-- Library level instantiation
if Is_Rewrite_Substitution (Result_Node) then
-- Package instantiation, the package does not have
-- a body
exit;
else
Result_Node := Corresponding_Body (Result_Node);
while Nkind (Result_Node) /= N_Package_Body loop
Result_Node := Parent (Result_Node);
end loop;
end if;
exit;
else
Result_Node := Next (Result_Node);
end if;
end loop;
Result_Element := Node_To_Element_New
(Node => Result_Node,
In_Unit => Encl_Unit (Element));
else
Result_Element := Enclosing_Element_For_Explicit (Element);
end if;
end case;
end if;
if Int_Kind (Result_Element) = A_Function_Renaming_Declaration then
-- See C125-002
Set_Int_Kind (Result_Element, A_Function_Declaration);
elsif Int_Kind (Result_Element) = A_Procedure_Renaming_Declaration then
Set_Int_Kind (Result_Element, A_Procedure_Declaration);
end if;
return Result_Element;
end Enclosing_Element_For_Implicit;
----------------------------------------
-- Enclosing_Element_For_Limited_View --
----------------------------------------
function Enclosing_Element_For_Limited_View
(Element : Asis.Element)
return Asis.Element
is
Result : Asis.Element := Enclosing_Element_For_Explicit (Element);
begin
if not Is_Nil (Result) then
Set_Special_Case (Result, From_Limited_View);
Set_From_Implicit (Result, True);
Set_Int_Kind (Result, Limited_View_Kind (Result));
end if;
return Result;
end Enclosing_Element_For_Limited_View;
-----------------------
-- General_Encl_Elem --
-----------------------
function General_Encl_Elem (Element : Asis.Element) return Asis.Element is
Result_Node : Node_Id;
Result_Nkind : Node_Kind;
begin
Result_Node := Parent (R_Node (Element));
Result_Nkind := Nkind (Result_Node);
-- and now - special processing for some node kinds to skip nodes which
-- are of no use in ASIS
if Result_Nkind = N_Package_Specification or else
Result_Nkind = N_Function_Specification or else
Result_Nkind = N_Procedure_Specification or else
Result_Nkind = N_Entry_Body_Formal_Part
then
Result_Node := Parent (Result_Node);
end if;
return Node_To_Element_New
(Starting_Element => Element,
Node => Result_Node,
Considering_Parent_Count => False);
end General_Encl_Elem;
-------------------
-- Get_Enclosing --
-------------------
function Get_Enclosing
(Approximation : Asis.Element;
Element : Asis.Element)
return Asis.Element
is
-- we need two-level traversing for searching for Enclosing Element:
-- first, we go through the direct children of an approximate
-- result, and none of them Is_Identical to Element, we repeat
-- the search process for each direct child. We may implement
-- this on top of Traverse_Element, but we prefer to code
-- it manually on top of A4G.Queries
Result_Element : Asis.Element;
Result_Found : Boolean := False;
-- needed to simulate the effect of Terminate_Immediatelly
procedure Check_Possible_Enclosing (Appr_Enclosing : Asis.Element);
-- implements the first level of the search. Appr_Enclosing is
-- the "approximate" Enclosing Element, and this procedure
-- checks if some of its components Is_Identical to Element
-- (Element here is the parameter of Get_Enclosing function,
-- as a global constant value inside Get_Enclosing, it is the
-- same for all the (recursive) calls of Check_Possible_Enclosing
------------------------------
-- Check_Possible_Enclosing --
-------------------------------
procedure Check_Possible_Enclosing (Appr_Enclosing : Asis.Element) is
Child_Access : constant Query_Array :=
Appropriate_Queries (Appr_Enclosing);
-- this is the way to traverse the direct children
Next_Child : Asis.Element;
procedure Check_List (L : Asis.Element_List);
-- checks if L contains a component which Is_Identical
-- to (global) Element. Sets Result_Found ON if such a
-- component is found
procedure Check_List_Down (L : Asis.Element_List);
-- calls Get_Enclosing for every component of L, by
-- this the recursion and the second level of the search
-- is implemented
procedure Check_List (L : Asis.Element_List) is
begin
for L_El_Index in L'Range loop
if Is_Identical (Element, L (L_El_Index)) then
Result_Found := True;
return;
end if;
end loop;
end Check_List;
procedure Check_List_Down (L : Asis.Element_List) is
begin
if Result_Found then
return;
-- it seems that we do not need this if... ???
end if;
for L_El_Index in L'Range loop
Check_Possible_Enclosing (L (L_El_Index));
if Result_Found then
return;
end if;
end loop;
end Check_List_Down;
begin -- Check_Possible_Enclosing
if Result_Found then
return;
-- now the only goal is to not disturb the setting of the
-- global variable Result_Element to be returned as a result
end if;
-- first, setting the (global for this procedure) Result_Element:
Result_Element := Appr_Enclosing;
-- the first level of the search - checking all the direct
-- children:
for Each_Query in Child_Access'Range loop
case Child_Access (Each_Query).Query_Kind is
when Bug =>
null;
when Single_Element_Query =>
Next_Child :=
Child_Access (Each_Query).Func_Simple (Appr_Enclosing);
if Is_Identical (Element, Next_Child) then
Result_Found := True;
return;
end if;
when Element_List_Query =>
declare
Child_List : constant Asis.Element_List :=
Child_Access (Each_Query).Func_List (Appr_Enclosing);
begin
Check_List (Child_List);
if Result_Found then
return;
end if;
end;
when Element_List_Query_With_Boolean =>
declare
Child_List : constant Asis.Element_List :=
Child_Access (Each_Query).Func_List_Boolean
(Appr_Enclosing, Child_Access (Each_Query).Bool);
begin
Check_List (Child_List);
if Result_Found then
return;
end if;
end;
end case;
end loop;
-- if we are here, we have hot found Element among the direct
-- children of Appr_Enclosing. So we have to traverse the direct
-- children again, but this time we have to go one step down,
-- so here we have the second level of the search:
for Each_Query in Child_Access'Range loop
case Child_Access (Each_Query).Query_Kind is
when Bug =>
null;
when Single_Element_Query =>
Next_Child :=
Child_Access (Each_Query).Func_Simple (Appr_Enclosing);
-- and here - recursively one step down
if not Is_Nil (Next_Child) then
Check_Possible_Enclosing (Next_Child);
if Result_Found then
return;
end if;
end if;
when Element_List_Query =>
declare
Child_List : constant Asis.Element_List :=
Child_Access (Each_Query).Func_List (Appr_Enclosing);
begin
-- and here - recursively one step down
Check_List_Down (Child_List);
if Result_Found then
return;
end if;
end;
when Element_List_Query_With_Boolean =>
declare
Child_List : constant Asis.Element_List :=
Child_Access (Each_Query).Func_List_Boolean
(Appr_Enclosing, Child_Access (Each_Query).Bool);
begin
-- and here - recursively one step down
Check_List_Down (Child_List);
if Result_Found then
return;
end if;
end;
end case;
end loop;
end Check_Possible_Enclosing;
begin -- Get_Enclosing
Check_Possible_Enclosing (Approximation);
pragma Assert (Result_Found);
return Result_Element;
end Get_Enclosing;
------------------------------
-- Get_Rough_Enclosing_Node --
------------------------------
function Get_Rough_Enclosing_Node (Element : Asis.Element) return Node_Id
is
Arg_Node : constant Node_Id := R_Node (Element);
Result_Node : Node_Id;
Res_Nkind : Node_Kind;
function Is_Acceptable_As_Rough_Enclosing_Node
(N : Node_Id)
return Boolean;
-- this function encapsulates the condition for choosing
-- the rough enclosing node
function Is_Acceptable_Impl_Neq_Decl (N : Node_Id) return Boolean;
-- Implements a special check for Is_Acceptable_As_Rough_Enclosing_Node:
-- in case if Element is a subcomponenet of an implicit declaration of
-- "/=", checks that N represents the whole declaration of this "/="
-------------------------------------------
-- Is_Acceptable_As_Rough_Enclosing_Node --
-------------------------------------------
function Is_Acceptable_As_Rough_Enclosing_Node
(N : Node_Id)
return Boolean
is
N_K : constant Node_Kind := Nkind (N);
Result : Boolean := True;
begin
if not (Is_Acceptable_Impl_Neq_Decl (N)
or else
Is_List_Member (N)
or else
(Nkind (Parent (N)) = N_Compilation_Unit or else
Nkind (Parent (N)) = N_Subunit))
or else
(Nkind (N) in N_Subexpr
and then Nkind (N) /=
N_Procedure_Call_Statement)
or else
Nkind (N) = N_Parameter_Association
then
Result := False;
elsif N_K = N_Range or else
-- N_K = N_Component_Association or else
N_K = N_Subtype_Indication
then
Result := False;
elsif N_K = N_Component_Association then
if Special_Case (Element) = Is_From_Gen_Association
or else
Is_From_Rewritten_Aggregate (N)
then
Result := False;
end if;
elsif N_K = N_Procedure_Call_Statement and then
Nkind (Parent (N)) = N_Pragma
then
Result := False;
elsif not Comes_From_Source (N)
and then
Sloc (N) > Standard_Location
and then
not Is_Acceptable_Impl_Neq_Decl (N)
then
if not (Is_From_Instance (Element)
and then
Is_Top_Of_Expanded_Generic (N))
then
Result := False;
end if;
end if;
return Result;
end Is_Acceptable_As_Rough_Enclosing_Node;
---------------------------------
-- Is_Acceptable_Impl_Neq_Decl --
---------------------------------
function Is_Acceptable_Impl_Neq_Decl (N : Node_Id) return Boolean is
Result : Boolean := False;
begin
if Special_Case (Element) = Is_From_Imp_Neq_Declaration
and then
Nkind (N) = N_Subprogram_Declaration
and then
not Comes_From_Source (N)
and then
Present (Corresponding_Equality
(Defining_Unit_Name (Specification (N))))
then
Result := True;
end if;
return Result;
end Is_Acceptable_Impl_Neq_Decl;
begin -- Get_Rough_Enclosing_Node
Result_Node := Parent (Arg_Node);
if Nkind (Result_Node) = N_Object_Renaming_Declaration
and then
Special_Case (Element) = Is_From_Gen_Association
and then
Present (Corresponding_Generic_Association (Result_Node))
then
Result_Node := Corresponding_Generic_Association (Result_Node);
elsif (Nkind (Result_Node) = N_Attribute_Definition_Clause
or else
Nkind (Result_Node) = N_Pragma)
and then
From_Aspect_Specification (Result_Node)
then
-- Result_Node := Corresponding_Aspect (Result_Node);
null; -- SCz
end if;
while Present (Result_Node) and then
not Is_Acceptable_As_Rough_Enclosing_Node (Result_Node)
loop
Result_Node := Parent (Result_Node);
if Nkind (Result_Node) = N_Object_Renaming_Declaration
and then
Special_Case (Element) = Is_From_Gen_Association
and then
Present (Corresponding_Generic_Association (Result_Node))
then
Result_Node := Corresponding_Generic_Association (Result_Node);
elsif (Nkind (Result_Node) = N_Attribute_Definition_Clause
or else
Nkind (Result_Node) = N_Pragma)
and then
From_Aspect_Specification (Result_Node)
then
-- Result_Node := Corresponding_Aspect (Result_Node);
null; -- SCz
end if;
if Nkind (Result_Node) = N_Compilation_Unit then
-- this means that there is no node list on the way up
-- the tree, and we have to go back to the node
-- for the unit declaration:
if Is_Standard (Encl_Unit (Element)) then
Result_Node := Standard_Package_Node;
else
Result_Node := Unit (Result_Node);
end if;
if Nkind (Result_Node) = N_Subunit then
Result_Node := Proper_Body (Result_Node);
end if;
exit;
end if;
end loop;
-- and here we have to take into account possible normalization
-- of multi-identifier declarations:
Res_Nkind := Nkind (Result_Node);
if Res_Nkind = N_Object_Declaration or else
Res_Nkind = N_Number_Declaration or else
Res_Nkind = N_Discriminant_Specification or else
Res_Nkind = N_Component_Declaration or else
Res_Nkind = N_Parameter_Specification or else
Res_Nkind = N_Exception_Declaration or else
Res_Nkind = N_Formal_Object_Declaration or else
Res_Nkind = N_With_Clause
then
Skip_Normalized_Declarations_Back (Result_Node);
end if;
-- If we've got Result_Node pointing to the artificial package
-- declaration created for library-level generic instantiation,
-- we have to the body for which we have this instantiation as
-- the original node
if Nkind (Result_Node) = N_Package_Declaration and then
not Comes_From_Source (Result_Node) and then
Nkind (Parent (Result_Node)) = N_Compilation_Unit and then
not Is_From_Instance (Element) and then
not Is_Rewrite_Substitution (Result_Node)
then
Result_Node := Corresponding_Body (Result_Node);
while Nkind (Result_Node) /= N_Package_Body loop
Result_Node := Parent (Result_Node);
end loop;
end if;
-- Below is the patch for 8706-003. It is needed when we are looking
-- for the enclosing element for actual parameter in subprogram
-- instantiation. In this case Result_Node points to the spec of a
-- wrapper package, so we have to go to the instantiation.
if Special_Case (Element) = Is_From_Gen_Association
and then
Nkind (Result_Node) = N_Package_Declaration
and then
not (Nkind (Original_Node (Result_Node)) = N_Package_Instantiation
or else
Nkind (Original_Node (Result_Node)) = N_Package_Body
or else
(Present (Generic_Parent (Specification (Result_Node)))
and then
Ekind (Generic_Parent (Specification (Result_Node))) =
E_Generic_Package))
and then
not Comes_From_Source (Result_Node)
and then
(Nkind (Parent (Arg_Node)) = N_Subprogram_Renaming_Declaration
and then
not Comes_From_Source (Parent (Arg_Node)))
and then
Instantiation_Depth (Sloc (Result_Node)) =
Instantiation_Depth (Sloc (Arg_Node))
then
if Is_Rewrite_Substitution (Result_Node)
and then
Nkind (Original_Node (Result_Node)) in N_Generic_Instantiation
then
Result_Node := Original_Node (Result_Node);
else
while not Comes_From_Source (Result_Node) loop
Result_Node := Next_Non_Pragma (Result_Node);
end loop;
end if;
end if;
return Result_Node;
end Get_Rough_Enclosing_Node;
--------------------------------
-- Is_Top_Of_Expanded_Generic --
--------------------------------
function Is_Top_Of_Expanded_Generic (N : Node_Id) return Boolean is
N_Kind : constant Node_Kind := Nkind (N);
Result : Boolean := False;
begin
Result :=
((not Comes_From_Source (N) or else
Is_Rewrite_Insertion (N))
and then
(N_Kind = N_Package_Declaration or else
N_Kind = N_Package_Body or else
N_Kind = N_Subprogram_Declaration or else
N_Kind = N_Subprogram_Body)
and then
Nkind (Original_Node (N)) not in N_Renaming_Declaration)
or else
(Nkind (Parent (N)) = N_Package_Body and then
not Comes_From_Source (Parent (N)))
or else
(Is_Rewrite_Substitution (N) and then
Nkind (Original_Node (N)) = N_Package_Instantiation);
-- Library-level package instantiation
return Result;
end Is_Top_Of_Expanded_Generic;
--------------------------
-- No_Enclosing_Element --
--------------------------
procedure No_Enclosing_Element (Element_Kind : Internal_Element_Kinds) is
begin
Raise_ASIS_Failed
("No Enclosing Element can correspond " &
"to the Element with Internal_Element_Kinds value of " &
Internal_Element_Kinds'Image (Element_Kind));
end No_Enclosing_Element;
----------------------------------------------------
-- Not_Implemented_Enclosing_Element_Construction --
----------------------------------------------------
procedure Not_Implemented_Enclosing_Element_Construction
(Element : Asis.Element)
is
begin
Not_Implemented_Yet (Diagnosis =>
"Enclosing Element retrieval for the explicit Element "
& "of the " & Internal_Element_Kinds'Image
(Int_Kind (Element)) & " kind "
& "has not been implemented yet");
end Not_Implemented_Enclosing_Element_Construction;
------------
-- Parent --
------------
function Parent (Node : Node_Id) return Node_Id is
Result_Node : Node_Id;
begin
Result_Node := Atree.Parent (Node);
Skip_Normalized_Declarations_Back (Result_Node);
return Result_Node;
end Parent;
---------------------------
-- Skip_Implicit_Subtype --
---------------------------
procedure Skip_Implicit_Subtype (Constr : in out Node_Id) is
begin
if not Comes_From_Source (Parent (Constr)) then
Constr := Parent (Constr);
while Nkind (Constr) /= N_Object_Declaration loop
Constr := Next_Non_Pragma (Constr);
end loop;
Constr := Object_Definition (Constr);
end if;
end Skip_Implicit_Subtype;
---------------------------------------
-- Skip_Normalized_Declarations_Back --
---------------------------------------
procedure Skip_Normalized_Declarations_Back (Node : in out Node_Id) is
Arg_Kind : constant Node_Kind := Nkind (Node);
begin
loop
if Arg_Kind = N_Object_Declaration or else
Arg_Kind = N_Number_Declaration or else
Arg_Kind = N_Discriminant_Specification or else
Arg_Kind = N_Component_Declaration or else
Arg_Kind = N_Parameter_Specification or else
Arg_Kind = N_Exception_Declaration or else
Arg_Kind = N_Formal_Object_Declaration
then
if Prev_Ids (Node) then
Node := Prev (Node);
while Nkind (Node) /= Arg_Kind loop
-- some implicit subtype declarations may be inserted by
-- the compiler in between the normalized declarations, so:
Node := Prev (Node);
end loop;
else
return;
end if;
elsif Arg_Kind = N_With_Clause then
if First_Name (Node) then
return;
else
Node := Prev (Node);
end if;
else
return;
-- nothing to do!
end if;
end loop;
end Skip_Normalized_Declarations_Back;
end A4G.Encl_El;
|
jweese/Ada_Vent_19 | Ada | 921 | adb | with Ada.Command_Line;
with Ada.Text_IO;
use Ada.Text_IO;
with Intcode;
with Memory;
procedure Day_05 is
package IO is new Ada.Text_IO.Integer_IO(Memory.Value);
Program_Name: constant String := Ada.Command_Line.Argument(1);
F: File_Type;
begin
Open(F, In_File, Program_Name);
declare
Mem: constant Memory.Block := Memory.Read_Comma_Separated(F);
M: aliased Intcode.Machine :=
(Hi_Mem => Mem'Last,
Mem => Mem,
Aux_Mem => Intcode.Aux_Memory.Empty_Map,
Input => new Intcode.Port,
Output => new Intcode.Port);
Exec: Intcode.Executor(M'Access);
I: Memory.Value;
O: Intcode.Maybe_Memory_Value;
begin
Ada.Text_IO.Put("? ");
IO.Get(I);
M.Input.Put(I);
loop
M.Output.Get(O);
exit when not O.Present;
IO.Put(O.Value);
Ada.Text_IO.New_Line;
end loop;
end;
end Day_05;
|
reznikmm/matreshka | Ada | 4,761 | 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.Visitors;
with ODF.DOM.Text_Sequence_Decls_Elements;
package Matreshka.ODF_Text.Sequence_Decls_Elements is
type Text_Sequence_Decls_Element_Node is
new Matreshka.ODF_Text.Abstract_Text_Element_Node
and ODF.DOM.Text_Sequence_Decls_Elements.ODF_Text_Sequence_Decls
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Text_Sequence_Decls_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Text_Sequence_Decls_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Text_Sequence_Decls_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Leave_Node
(Self : not null access Text_Sequence_Decls_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Visit_Node
(Self : not null access Text_Sequence_Decls_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);
end Matreshka.ODF_Text.Sequence_Decls_Elements;
|
tum-ei-rcs/StratoX | Ada | 59 | adb | with Wrap;
procedure main is
begin
Wrap.foo;
end main;
|
reznikmm/matreshka | Ada | 3,633 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-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 file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements.Generic_Hash;
function AMF.OCL.Integer_Literal_Exps.Hash is
new AMF.Elements.Generic_Hash (OCL_Integer_Literal_Exp, OCL_Integer_Literal_Exp_Access);
|
reznikmm/matreshka | Ada | 4,689 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014-2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
package body Servlet.Servlet_Registrations is
-----------------
-- Add_Mapping --
-----------------
function Add_Mapping
(Self : not null access Servlet_Registration'Class;
URL_Pattern : League.Strings.Universal_String)
return League.String_Vectors.Universal_String_Vector
is
URL_Patterns : League.String_Vectors.Universal_String_Vector;
begin
URL_Patterns.Append (URL_Pattern);
return Self.Add_Mapping (URL_Patterns);
end Add_Mapping;
-----------------
-- Add_Mapping --
-----------------
procedure Add_Mapping
(Self : not null access Servlet_Registration'Class;
URL_Patterns : League.String_Vectors.Universal_String_Vector)
is
Aux : constant League.String_Vectors.Universal_String_Vector
:= Self.Add_Mapping (URL_Patterns);
pragma Unreferenced (Aux);
begin
null;
end Add_Mapping;
-----------------
-- Add_Mapping --
-----------------
procedure Add_Mapping
(Self : not null access Servlet_Registration'Class;
URL_Pattern : League.Strings.Universal_String)
is
Aux : constant League.String_Vectors.Universal_String_Vector
:= Self.Add_Mapping (URL_Pattern);
pragma Unreferenced (Aux);
begin
null;
end Add_Mapping;
end Servlet.Servlet_Registrations;
|
hfegran/efx32_ada_examples | Ada | 248 | ads | with Leds; use Leds;
with Ada.Real_Time; use Ada.Real_Time;
package Morse is
procedure Blink_Morse(LED: Led_No; Led_Color : Color; Duration : Time_Span);
procedure Dot;
procedure Dash;
procedure Morse_Display (S : String);
end Morse;
|
sungyeon/drake | Ada | 308 | adb | with System.Native_Directories.File_Names;
function Ada.Directories.Equal_File_Names (
FS : Volumes.File_System;
Left, Right : String)
return Boolean is
begin
return System.Native_Directories.File_Names.Equal_File_Names (
FS,
Left,
Right);
end Ada.Directories.Equal_File_Names;
|
burratoo/Acton | Ada | 3,204 | ads | ------------------------------------------------------------------------------------------
-- --
-- ACTON PROCESSOR SUPPORT PACKAGE --
-- --
-- ATMEL.AT91SAM7S.PIT --
-- --
-- Copyright (C) 2014-2021, Patrick Bernardi --
-- --
------------------------------------------------------------------------------------------
with System; use System;
package Atmel.AT91SAM7S.PIT with Preelaborate is
--------------------------
-- PIT Memory Addresses --
--------------------------
PIT_Base_Address : constant := 16#FFFF_FD30#;
MR_Offset_Address : constant := 16#0#;
SR_Offset_Address : constant := 16#4#;
PIVR_Offset_Address : constant := 16#8#;
PIIR_Offset_Address : constant := 16#C#;
-----------------------
-- Hardware Features --
-----------------------
type Periodic_Interval is mod 2 ** 20;
type Periodic_Interval_Overflow is mod 2 ** 12;
---------------
-- PIT Types --
---------------
type Mode_Type is record
Periodic_Interval_Value : Periodic_Interval;
Period_Interval_Timer : Enable_Type;
Periodic_Interval_Timer_Interrupt : Enable_Type;
end record with Size => 32;
type Status_Type is record
Periodic_Interval_Timer_Event : Occured_Type;
end record with Size => 32;
type Timer_Value_Type is record
Current_Periodic_Interval_Value : Periodic_Interval;
Periodic_Interval_Counter : Periodic_Interval_Overflow;
end record with Size => 32;
------------------------------
-- Hardware Representations --
------------------------------
for Mode_Type use record
Periodic_Interval_Value at 0 range 0 .. 19;
Period_Interval_Timer at 0 range 24 .. 24;
Periodic_Interval_Timer_Interrupt at 0 range 25 .. 25;
end record;
for Status_Type use record
Periodic_Interval_Timer_Event at 0 range 0 .. 0;
end record;
for Timer_Value_Type use record
Current_Periodic_Interval_Value at 0 range 0 .. 19;
Periodic_Interval_Counter at 0 range 20 .. 31;
end record;
-------------------
-- AIC Registers --
-------------------
Mode_Register : Mode_Type
with Address => System'To_Address (PIT_Base_Address + MR_Offset_Address);
Status_Register : Status_Type
with Address => System'To_Address (PIT_Base_Address + SR_Offset_Address);
Periodic_Interval_Timer_Value_Register : Timer_Value_Type
with Address => System'To_Address
(PIT_Base_Address + PIVR_Offset_Address);
Periodic_Interval_Timer_Image_Register : Timer_Value_Type
with Address => System'To_Address
(PIT_Base_Address + PIIR_Offset_Address);
end Atmel.AT91SAM7S.PIT;
|
AaronC98/PlaneSystem | Ada | 24,839 | adb | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2007-2015, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
pragma Ada_2012;
with Ada.Containers.Indefinite_Hashed_Maps;
with Ada.Containers.Vectors;
with Ada.Strings.Hash;
with AWS.Parameters;
with GNAT.Regpat;
package body AWS.Services.Web_Block.Registry is
use GNAT;
Context_Var : constant String := "CTX_WB";
type Lazy_Handler is new Templates.Dynamic.Lazy_Tag with record
Request : aliased Status.Data;
-- Current request made to the server
Translations : Templates.Translate_Set;
-- Global translations table
Ctx : aliased Context.Object;
-- Current context
end record;
overriding procedure Value
(Lazy_Tag : not null access Lazy_Handler;
Var_Name : String;
Translations : in out Templates.Translate_Set);
-- Handle lazy tags
type Web_Object_Data_Callback (With_Params : Boolean := False) is record
case With_Params is
when False =>
Callback : Data_Callback;
when True =>
Callback_With_Parameters : Data_With_Param_Callback;
end case;
end record;
type Web_Object (Callback_Template : Boolean := False) is record
Content_Type : Unbounded_String;
Context_Required : Boolean;
Data_CB : Web_Object_Data_Callback;
case Callback_Template is
when False =>
Template : Unbounded_String;
when True =>
Template_CB : Template_Callback;
end case;
end record;
package Web_Object_Maps is new Ada.Containers.Indefinite_Hashed_Maps
(String, Web_Object, Strings.Hash, "=");
use Web_Object_Maps;
-- Wrap access to the shared map with a protected object for safe
-- concurrent access.
protected WO_Store is
procedure Include (Key : String; WO : Web_Object);
-- Include an element in the map
procedure Find (Key : String; Position : out Web_Object_Maps.Cursor);
-- Returns a cursor pointing to element Key (or No_Element)
procedure Element
(Position : Web_Object_Maps.Cursor;
WO : out Web_Object);
-- Returns element pointed to by Position
private
WO_Map : Map;
end WO_Store;
type Pattern_Matcher_Access is access all GNAT.Regpat.Pattern_Matcher;
type URL_Pattern (With_Matcher : Boolean := False) is record
Prefix : Unbounded_String;
case With_Matcher is
when True =>
Matcher : Pattern_Matcher_Access;
Key : Unbounded_String;
when False =>
null;
end case;
end record;
package Pattern_URL_Container is new Ada.Containers.Vectors
(Positive, URL_Pattern);
Pattern_URL_Vector : Pattern_URL_Container.Vector;
-----------
-- Build --
-----------
function Build
(Key : String;
Request : Status.Data;
Translations : Templates.Translate_Set;
Status_Code : Messages.Status_Code := Messages.S200;
Cache_Control : Messages.Cache_Option := Messages.Unspecified;
Context : access Web_Block.Context.Object := null;
Context_Error : String := "") return Response.Data
is
function Get_Context return Web_Block.Context.Object;
-- Returns the context object
-----------------
-- Get_Context --
-----------------
function Get_Context return Web_Block.Context.Object is
begin
if Context = null then
return Web_Block.Context.Empty;
else
return Context.all;
end if;
end Get_Context;
P : constant Page :=
Parse (Key, Request, Translations, Get_Context, Context_Error);
Data : Response.Data;
begin
if P = No_Page then
Data := Response.Build
(MIME.Text_HTML, "", Status_Code => Messages.S404);
else
Data := Response.Build
(To_String (P.Content_Type),
To_String (P.Content),
Status_Code => Status_Code,
Cache_Control => Cache_Control);
end if;
-- Return the new context
if Context /= null then
Context.all := Web_Block.Context.Get (P.Ctx_Id);
end if;
return Data;
end Build;
------------------
-- Content_Type --
------------------
function Content_Type (Key : String) return String is
Position : Web_Object_Maps.Cursor;
begin
WO_Store.Find (Key, Position);
if Position = No_Element then
return "";
else
declare
WO : Web_Object;
begin
WO_Store.Element (Position, WO);
return To_String (WO.Content_Type);
end;
end if;
end Content_Type;
-----------------
-- Get_Context --
------------------
function Get_Context
(Request : Status.Data) return Web_Block.Context.Object
is
Ctx : constant String :=
Parameters.Get (Status.Parameters (Request), Context_Var);
begin
if Ctx = "" then
return Context.Empty;
else
return Context.Get (Context.Value (Ctx));
end if;
end Get_Context;
-----------
-- Parse --
-----------
function Parse
(Key : String;
Request : Status.Data;
Translations : Templates.Translate_Set;
Context : Web_Block.Context.Object := Web_Block.Context.Empty;
Context_Error : String := "") return Page
is
use type Web_Block.Context.Object;
function Get_Context return Web_Block.Context.Object;
-- Returns the context as passed to Parse routine if not empty, or the
-- one retrieved from the Web page.
-----------------
-- Get_Context --
-----------------
function Get_Context return Web_Block.Context.Object is
begin
if Context = Web_Block.Context.Empty then
return Get_Context (Request);
else
return Context;
end if;
end Get_Context;
Tag_Context_Var : constant String :=
Templates.Tag_From_Name (Context_Var);
Ctx : constant String :=
Parameters.Get
(Status.Parameters (Request), Context_Var);
LT : aliased Lazy_Handler :=
Lazy_Handler'(Templates.Dynamic.Lazy_Tag
with Request => Request,
Translations => Translations,
Ctx => Get_Context);
Position : Web_Object_Maps.Cursor;
function Get_Matching_Web_Object return Callback_Parameters;
-- Get the Web_Object matching Search_Key in Pattern_URL_Vector
-- Returns the Parameters extracted from the URL patterns.
-----------------------------
-- Get_Matching_Web_Object --
-----------------------------
function Get_Matching_Web_Object return Callback_Parameters is
begin
WO_Store.Find (Key, Position);
if Position /= No_Element then
return Empty_Callback_Parameters;
end if;
for Vector_Cursor in Pattern_URL_Vector.Iterate loop
declare
use GNAT.Regpat;
use Pattern_URL_Container;
P_URI : constant URL_Pattern := Element (Vector_Cursor);
K : constant String := To_String (P_URI.Prefix);
begin
if K'Length <= Key'Length
and then Key (Key'First .. Key'First + K'Length - 1) = K
then
-- If a regexp is defined, check whether it matched
if P_URI.With_Matcher then
declare
Count : constant Natural :=
Paren_Count (P_URI.Matcher.all);
Matched : Match_Array (0 .. Count);
begin
Match (Self => P_URI.Matcher.all,
Data => Key,
Matches => Matched);
if Matched (0) /= No_Match then
-- Returns the registered web object
-- Registered with a key = Prefix + Regexp
WO_Store.Find (To_String (P_URI.Key), Position);
declare
Params : Callback_Parameters (1 .. Count);
begin
for J in 1 .. Count loop
Params (J) :=
To_Unbounded_String
(Key (Matched (J).First
.. Matched (J).Last));
end loop;
return Params;
end;
end if;
end;
else
-- Only a prefix is defined.
-- No need to search for other candidates
WO_Store.Find (K, Position);
return Empty_Callback_Parameters;
end if;
end if;
end;
end loop;
return Empty_Callback_Parameters;
end Get_Matching_Web_Object;
Parsed_Page : Page := No_Page;
Parameters : constant Callback_Parameters := Get_Matching_Web_Object;
begin
-- Use provided context if a user's defined one
if Position /= No_Element then
declare
T : Templates.Translate_Set;
Template_Name : Unbounded_String;
Content : Unbounded_String;
C_Index : Natural;
CID : Web_Block.Context.Id;
Element : Web_Object;
begin
WO_Store.Element (Position, Element);
-- Get translation set for this tag
if Ctx = "" and then Element.Context_Required then
-- No context but it is required
return Parse (Context_Error, Request, Translations);
else
Templates.Insert (T, Translations);
-- Call the Data_CB
if not Element.Data_CB.With_Params then
if Element.Data_CB.Callback /= null then
Element.Data_CB.Callback (LT.Request, LT.Ctx'Access, T);
end if;
else
if Element.Data_CB.Callback_With_Parameters /= null then
Element.Data_CB.Callback_With_Parameters
(LT.Request, LT.Ctx'Access, Parameters, T);
end if;
end if;
if Element.Callback_Template then
Template_Name := To_Unbounded_String
(Element.Template_CB (Request));
else
Template_Name := Element.Template;
end if;
-- Page is now parsed, we need to create the context id for
-- this page.
LT.Translations := T;
Content := Templates.Parse
(To_String (Template_Name), T,
Lazy_Tag => LT'Unchecked_Access);
CID := Web_Block.Context.Register (LT.Ctx);
-- Finaly inject the context Id into the result
-- Note that any change in the format of the context below
-- will affect the Web Block Javascript runtime. So a
-- corresponding change must be done into aws_kernel.tjs.
-- Check if we have an explicite context in the template. In
-- this case we inject the context into this variable. If not
-- we inject the context into HTML and XML document as follow.
C_Index := Index (Content, Tag_Context_Var);
if Element.Content_Type = MIME.Text_HTML
and then C_Index = 0
then
-- A web page, we insert the context just after the
-- <body> tag, format:
--
-- <div id="CTX_WB" style="display:none">CID</div>
--
C_Index := Index (Content, "<body>");
if C_Index = 0 then
-- If not found, look for a body with some attributes
C_Index := Index (Content, "<body ");
end if;
if C_Index /= 0 then
-- Look for the end of the body tag
C_Index := Index (Content, ">", From => C_Index);
if C_Index /= 0 then
Insert
(Content, C_Index + 1,
"<div id=""CTX_WB"" style=""display:none"">"
& Web_Block.Context.Image (CID) & "</div>");
end if;
end if;
elsif Element.Content_Type = MIME.Text_XML
and then C_Index = 0
then
-- Inject context into the XML response, format:
--
-- <ctx id="CID"/>
--
C_Index := Index (Content, "</response>");
if C_Index /= 0 then
Insert
(Content, C_Index,
"<ctx id="""
& Web_Block.Context.Image (CID) & """/>");
end if;
elsif C_Index /= 0 then
-- Replace all context variables
Replace_Contexts : loop
Replace_Slice
(Content,
Low => C_Index,
High => C_Index + Tag_Context_Var'Length - 1,
By => Web_Block.Context.Image (CID));
C_Index := Index
(Content, Tag_Context_Var, From => C_Index + 1);
exit Replace_Contexts when C_Index = 0;
end loop Replace_Contexts;
end if;
Parsed_Page :=
Page'(Content_Type => Element.Content_Type,
Content => Content,
Set => Templates.Null_Set,
Ctx_Id => CID);
end if;
end;
end if;
return Parsed_Page;
end Parse;
--------------
-- Register --
--------------
procedure Register
(Key : String;
Template : String;
Data_CB : Data_Callback;
Content_Type : String := MIME.Text_HTML;
Prefix : Boolean := False;
Context_Required : Boolean := False)
is
WO : constant Web_Object :=
(Callback_Template => False,
Content_Type => To_Unbounded_String (Content_Type),
Template => To_Unbounded_String (Template),
Data_CB => Web_Object_Data_Callback'
(With_Params => False,
Callback => Data_CB),
Context_Required => Context_Required);
begin
-- Register Tag
WO_Store.Include (Key, WO);
if Prefix then
Pattern_URL_Container.Append
(Pattern_URL_Vector,
URL_Pattern'(Prefix => To_Unbounded_String (Key),
With_Matcher => False));
end if;
end Register;
--------------
-- Register --
--------------
procedure Register
(Key : String;
Template_CB : Template_Callback;
Data_CB : Data_Callback;
Content_Type : String := MIME.Text_HTML;
Context_Required : Boolean := False)
is
WO : constant Web_Object :=
(Callback_Template => True,
Content_Type => To_Unbounded_String (Content_Type),
Template_CB => Template_CB,
Data_CB => Web_Object_Data_Callback'
(With_Params => False,
Callback => Data_CB),
Context_Required => Context_Required);
begin
-- Register Tag
WO_Store.Include (Key, WO);
end Register;
--------------------------
-- Register_Pattern_URL --
--------------------------
procedure Register_Pattern_URL
(Prefix : String;
Regexp : String;
Template : String;
Data_CB : Data_With_Param_Callback;
Content_Type : String := MIME.Text_HTML;
Context_Required : Boolean := False)
is
WO : constant Web_Object :=
(Callback_Template => False,
Content_Type => To_Unbounded_String (Content_Type),
Template => To_Unbounded_String (Template),
Data_CB => Web_Object_Data_Callback'
(With_Params => True,
Callback_With_Parameters => Data_CB),
Context_Required => Context_Required);
Key : constant String := Prefix & Regexp;
Matcher : constant Pattern_Matcher_Access :=
new Regpat.Pattern_Matcher'
(Regpat.Compile (Key, Regpat.Case_Insensitive));
begin
-- Register Tag
WO_Store.Include (Key, WO);
Pattern_URL_Container.Append
(Pattern_URL_Vector,
URL_Pattern'(Prefix => To_Unbounded_String (Prefix),
With_Matcher => True,
Key => To_Unbounded_String (Key),
Matcher => Matcher));
end Register_Pattern_URL;
procedure Register_Pattern_URL
(Prefix : String;
Regexp : String;
Template_CB : Template_Callback;
Data_CB : Data_With_Param_Callback;
Content_Type : String := MIME.Text_HTML;
Context_Required : Boolean := False)
is
WO : constant Web_Object :=
(Callback_Template => True,
Content_Type => To_Unbounded_String (Content_Type),
Template_CB => Template_CB,
Data_CB => Web_Object_Data_Callback'
(With_Params => True,
Callback_With_Parameters => Data_CB),
Context_Required => Context_Required);
Key : constant String := Prefix & Regexp;
Matcher : constant Pattern_Matcher_Access :=
new Regpat.Pattern_Matcher'
(Regpat.Compile (Key, Regpat.Case_Insensitive));
begin
-- Register Tag
WO_Store.Include (Key, WO);
Pattern_URL_Container.Append
(Pattern_URL_Vector,
URL_Pattern'(Prefix => To_Unbounded_String (Prefix),
With_Matcher => True,
Key => To_Unbounded_String (Key),
Matcher => Matcher));
end Register_Pattern_URL;
-----------
-- Value --
-----------
overriding procedure Value
(Lazy_Tag : not null access Lazy_Handler;
Var_Name : String;
Translations : in out Templates.Translate_Set)
is
Position : Web_Object_Maps.Cursor;
begin
-- Specific case for the contextual var
if Var_Name = Context_Var then
-- We do not want to remove the context var now, just replace it by
-- the corresponding context var name. The proper context will be
-- injected into the Web page later.
Templates.Insert
(Translations,
Templates.Assoc
(Context_Var, Templates.Tag_From_Name (Context_Var)));
else
-- Get Web Object
WO_Store.Find (Var_Name, Position);
if Position /= No_Element then
declare
Keep : constant Templates.Translate_Set :=
Lazy_Tag.Translations;
T : Templates.Translate_Set;
Template_Name : Unbounded_String;
Element : Web_Object;
begin
-- Get translation set for this tag
Templates.Insert (T, Translations);
Templates.Insert (T, Lazy_Tag.Translations);
WO_Store.Element (Position, Element);
if not Element.Data_CB.With_Params
and then Element.Data_CB.Callback /= null
then
Element.Data_CB.Callback
(Lazy_Tag.Request, Lazy_Tag.Ctx'Access, T);
end if;
if Element.Callback_Template then
Template_Name := To_Unbounded_String
(Element.Template_CB (Lazy_Tag.Request));
else
Template_Name := Element.Template;
end if;
Lazy_Tag.Translations := T;
Templates.Insert
(Translations,
Templates.Assoc
(Var_Name,
Unbounded_String'(Templates.Parse
(To_String (Template_Name), T,
Lazy_Tag =>
Templates.Dynamic.Lazy_Tag_Access (Lazy_Tag)))));
-- We restore the lazy tag state as we do not want to
-- propagate changes to siblings.
Lazy_Tag.Translations := Keep;
end;
end if;
end if;
end Value;
--------------
-- WO_Store --
--------------
protected body WO_Store is
-------------
-- Element --
-------------
procedure Element
(Position : Web_Object_Maps.Cursor;
WO : out Web_Object) is
begin
WO := Web_Object_Maps.Element (Position);
end Element;
----------
-- Find --
----------
procedure Find (Key : String; Position : out Web_Object_Maps.Cursor) is
begin
Position := WO_Map.Find (Key);
end Find;
-------------
-- Include --
-------------
procedure Include (Key : String; WO : Web_Object) is
begin
WO_Map.Include (Key, WO);
end Include;
end WO_Store;
end AWS.Services.Web_Block.Registry;
|
AaronC98/PlaneSystem | Ada | 9,560 | ads | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2004-2016, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
pragma Ada_2012;
-- Waiting on group of sockets for input/output availability
private with Ada.Finalization;
generic
type Data_Type is private;
package AWS.Net.Generic_Sets is
subtype Waiting_Mode is Wait_Event_Set;
Input : constant Wait_Event_Set :=
(Net.Input => True, Net.Output => False);
-- Would wait for data available for read from socket
Output : constant Wait_Event_Set :=
(Net.Input => False, Net.Output => True);
-- Would wait output buffer availability for write
Both : constant Wait_Event_Set :=
(Net.Input => True, Net.Output => True);
-- Would wait for both Input and Output
None : constant Wait_Event_Set :=
(Net.Input => False, Net.Output => False);
-- Would wait only for error state in socket.
-- Note that all waiting modes would be waiting for error state.
type Socket_Set_Type is limited private;
type Socket_Count is new Natural;
subtype Socket_Index is Socket_Count range 1 .. Socket_Count'Last;
procedure Add
(Set : in out Socket_Set_Type;
Socket : Socket_Type'Class;
Mode : Waiting_Mode)
with Inline;
-- Add socket to the set. Socket can be retreived from the set using
-- Get_Socket.
procedure Add
(Set : in out Socket_Set_Type;
Socket : Socket_Access;
Mode : Waiting_Mode)
with Inline, Pre => Socket /= null;
-- Add socket to the set
procedure Add
(Set : in out Socket_Set_Type;
Socket : Socket_Type'Class;
Data : Data_Type;
Mode : Waiting_Mode)
with Inline;
-- Add socket and associated data to the set
procedure Add
(Set : in out Socket_Set_Type;
Socket : Socket_Access;
Data : Data_Type;
Mode : Waiting_Mode)
with Inline, Pre => Socket /= null;
-- Add socket and associated data to the set
procedure Set_Mode
(Set : in out Socket_Set_Type;
Index : Socket_Index;
Mode : Waiting_Mode)
with Inline, Pre => In_Range (Set, Index);
-- Change waiting mode for the socket in the set
procedure Set_Event
(Set : in out Socket_Set_Type;
Index : Socket_Index;
Event : Wait_Event_Type;
Value : Boolean)
with Inline, Pre => In_Range (Set, Index);
-- Set or reset waiting event for the socket in the set
function Count (Set : Socket_Set_Type) return Socket_Count with Inline;
-- Returns the number of sockets in the Set
procedure Wait
(Set : in out Socket_Set_Type;
Timeout : Duration)
with Inline;
-- Wait for a socket in the set to be ready for input or output operation.
-- Raises Socket_Error if an error occurs.
procedure Wait
(Set : in out Socket_Set_Type;
Timeout : Duration;
Count : out Socket_Count);
-- Wait for a socket in the set to be ready for input or output operation.
-- Raises Socket_Error if an error occurs. Count is set with the number of
-- activated sockets.
function Is_Read_Ready
(Set : Socket_Set_Type;
Index : Socket_Index) return Boolean
with
Inline,
Pre => In_Range (Set, Index);
-- Return True if data could be read from socket and socket was in Input
-- or Both waiting mode.
procedure Is_Read_Ready
(Set : Socket_Set_Type;
Index : Socket_Index;
Ready : out Boolean;
Error : out Boolean)
with
Inline,
Pre => In_Range (Set, Index);
-- Return True in Ready out parameter if data could be read from socket and
-- socket was in Input or Both waiting mode. Return True in Error out
-- parameter if socket is in error state.
function Is_Write_Ready
(Set : Socket_Set_Type;
Index : Socket_Index) return Boolean
with
Inline,
Pre => In_Range (Set, Index);
-- Return True if data could be written to socket and socket was in Output
-- or Both waiting mode.
function Is_Error
(Set : Socket_Set_Type;
Index : Socket_Index) return Boolean
with
Inline,
Pre => In_Range (Set, Index);
-- Return True if any error occured with socket while waiting
function In_Range
(Set : Socket_Set_Type;
Index : Socket_Index) return Boolean with Inline;
-- Return True if Index is in socket set range
function Get_Socket
(Set : Socket_Set_Type;
Index : Socket_Index) return Socket_Type'Class
with
Inline,
Pre => In_Range (Set, Index);
-- Return socket from the Index position or raise Constraint_Error
-- if index is more than the number of sockets in set.
function Get_Data
(Set : Socket_Set_Type;
Index : Socket_Index) return Data_Type
with
Inline,
Pre => In_Range (Set, Index);
procedure Set_Data
(Set : in out Socket_Set_Type;
Index : Socket_Index;
Data : Data_Type)
with
Inline,
Pre => In_Range (Set, Index);
procedure Remove_Socket
(Set : in out Socket_Set_Type;
Index : Socket_Index)
with Pre => In_Range (Set, Index);
-- Delete socket from Index position from the Set. If the Index is not
-- last position in the set, last socket would be placed instead of
-- deleted one.
procedure Remove_Socket
(Set : in out Socket_Set_Type;
Index : Socket_Index;
Socket : out Socket_Access)
with Pre => In_Range (Set, Index);
-- Delete socket from Index position from the Set and return delete socket
-- access. If the Index is not last position in the set, last socket would
-- be placed instead of deleted one.
procedure Update_Socket
(Set : in out Socket_Set_Type;
Index : Socket_Index;
Process : not null access procedure
(Socket : in out Socket_Type'Class;
Data : in out Data_Type))
with Pre => In_Range (Set, Index);
procedure Next (Set : Socket_Set_Type; Index : in out Socket_Index) with
Pre => Index = Count (Set) + 1 -- either past of last item
or else In_Range (Set, Index), -- or in the range of the set
Post => not In_Range (Set, Index)
or else Is_Write_Ready (Set, Index)
or else Is_Read_Ready (Set, Index)
or else Is_Error (Set, Index);
-- Looking for active socket starting from Index and return Index of the
-- found active socket. After search use functions In_Range,
-- Is_Write_Ready, Is_Read_Ready and Is_Error to be sure that active
-- socket is found in the Set.
procedure Reset (Set : in out Socket_Set_Type);
-- Clear the set for another use
private
type Socket_Record is record
Socket : Socket_Access;
Allocated : Boolean;
-- Set to True if socket was allocated internally in the set (it is the
-- case when using the Add with Socket_Type'Class parameter).
-- Needed to control free on delete.
Data : Data_Type;
end record;
type Socket_Array is array (Socket_Index range <>) of Socket_Record;
type Socket_Array_Access is access all Socket_Array;
type Socket_Set_Type is new Ada.Finalization.Limited_Controlled with record
Poll : FD_Set_Access;
Set : Socket_Array_Access;
end record;
overriding procedure Finalize (Set : in out Socket_Set_Type);
end AWS.Net.Generic_Sets;
|
persan/protobuf-ada | Ada | 5,862 | ads | pragma Ada_2012;
with Google.Protobuf.Wire_Format;
with Ada.Streams;
with System;
limited with Google.Protobuf.Message;
-- limited with Google.Protobuf.Message; is a trick to avoid a circular unit
-- dependency caused by with-ing Google.Protobuf.IO.Coded_Input_Stream from
-- Google.Protobuf.Message. with Google.Protobuf.Message is used in body
-- since the incomplete view provided by limited with is not sufficient.
package Google.Protobuf.IO.Coded_Input_Stream is
type Root_Stream_Access is access all Ada.Streams.Root_Stream_Type'Class;
type Instance (Input_Stream : Root_Stream_Access) is tagged private;
-- Consider replacing this use clause???
use Google.Protobuf.Wire_Format;
function Decode_Zig_Zag_32 (Value : in PB_UInt32) return PB_UInt32;
function Decode_Zig_Zag_64 (Value : in PB_UInt64) return PB_UInt64;
function Read_Boolean (This : in out Coded_Input_Stream.Instance) return PB_Bool;
function Read_Double (This : in out Coded_Input_Stream.Instance) return PB_Double;
function Read_Enumeration (This : in out Coded_Input_Stream.Instance) return PB_Int32;
function Read_Fixed_32 (This : in out Coded_Input_Stream.Instance) return PB_UInt32;
function Read_Fixed_64 (This : in out Coded_Input_Stream.Instance) return PB_UInt64;
function Read_Float (This : in out Coded_Input_Stream.Instance) return PB_Float;
function Read_Integer_32 (This : in out Coded_Input_Stream.Instance) return PB_Int32;
function Read_Integer_64 (This : in out Coded_Input_Stream.Instance) return PB_Int64;
function Read_Raw_Little_Endian_32 (This : in out Coded_Input_Stream.Instance) return PB_UInt32;
function Read_Raw_Little_Endian_64 (This : in out Coded_Input_Stream.Instance) return PB_UInt64;
function Read_Raw_Varint_32 (This : in out Coded_Input_Stream.Instance) return PB_UInt32;
function Read_Raw_Varint_64 (This : in out Coded_Input_Stream.Instance) return PB_UInt64;
function Read_Signed_Fixed_32 (This : in out Coded_Input_Stream.Instance) return PB_Int32;
function Read_Signed_Fixed_64 (This : in out Coded_Input_Stream.Instance) return PB_Int64;
function Read_Signed_Integer_32 (This : in out Coded_Input_Stream.Instance)return PB_Int32;
function Read_Signed_Integer_64 (This : in out Coded_Input_Stream.Instance) return PB_Int64;
function Read_String (This : in out Coded_Input_Stream.Instance) return PB_String_Access;
function Read_Tag (This : in out Coded_Input_Stream.Instance) return PB_UInt32;
function Read_Unsigned_Integer_32 (This : in out Coded_Input_Stream.Instance) return PB_UInt32;
function Read_Unsigned_Integer_64 (This : in out Coded_Input_Stream.Instance) return PB_UInt64;
function Skip_Field (This : in out Coded_Input_Stream.Instance; Tag : in PB_UInt32) return Boolean;
procedure Check_Last_Tag_Was (This : in Coded_Input_Stream.Instance; Tag : in PB_UInt32);
procedure Skip_Message (This : in out Coded_Input_Stream.Instance);
procedure Read_Message (This : in out Coded_Input_Stream.Instance; Value : in out Google.Protobuf.Message.Instance'Class);
-- ==========================================================================
-- Consider replacing this use clause???
use Ada.Streams;
function Set_Size_Limit (This : in out Coded_Input_Stream.Instance; Limit : in Stream_Element_Count) return Stream_Element_Count;
procedure Reset_Size_Counter (This : in out Coded_Input_Stream.Instance);
function Push_Limit (This : in out Coded_Input_Stream.Instance; Byte_Limit : in Stream_Element_Count) return Stream_Element_Count;
procedure Pop_Limit (This : in out Coded_Input_Stream.Instance; Old_Limit : in Stream_Element_Count);
function Get_Bytes_Until_Limit (This : in Coded_Input_Stream.Instance) return Stream_Element_Offset;
function Is_At_End (This : in out Coded_Input_Stream.Instance) return Boolean;
function Get_Total_Bytes_Read (This : in Coded_Input_Stream.Instance) return Stream_Element_Count;
function Read_Raw_Byte (This : in out Coded_Input_Stream.Instance) return PB_Byte;
-- Consider changing type of Size to Stream_Element_Offset instead???
function Read_Raw_Bytes (This : in out Coded_Input_Stream.Instance; Size : in Stream_Element_Count) return Stream_Element_Array;
-- Consider changing type of Size to Stream_Element_Offset instead???
procedure Skip_Raw_Bytes (This : in out Coded_Input_Stream.Instance; Size : in Stream_Element_Count);
private
BUFFER_SIZE : constant := 4096;
DEFAULT_RECURSION_LIMIT : constant := 64;
DEFAULT_SIZE_LIMIT : constant := 2 ** 26; -- 64 MB
Big_Endian : constant Boolean := System. "=" (System.Default_Bit_Order, System.High_Order_First);
--Big_Endian_Not_Implemented : exception;
-- Temporary types. Consider changing types??? Allow user to change defaults ...
type Instance (Input_Stream : Root_Stream_Access) is tagged
record
Buffer : Stream_Element_Array (0 .. BUFFER_SIZE - 1);
Buffer_Size : Stream_Element_Count := 0;
Buffer_Position : Stream_Element_Offset := 0;
Buffer_Size_After_Limit : Stream_Element_Count := 0;
Total_Bytes_Retired : Stream_Element_Offset := 0;
Current_Limit : Stream_Element_Count := Ada.Streams.Stream_Element_Count'Last;
Recursion_Limit : PB_UInt32 := DEFAULT_RECURSION_LIMIT;
Recursion_Depth : PB_UInt32 := 0;
Size_Limit : Stream_Element_Count := DEFAULT_SIZE_LIMIT;
Last_Tag : PB_UInt32;
end record;
function Refill_Buffer (This : in out Coded_Input_Stream.Instance; Must_Succeed : in Boolean) return Boolean;
procedure Recompute_Buffer_Size_After_Limit (This : in out Coded_Input_Stream.Instance);
end Google.Protobuf.IO.Coded_Input_Stream;
|
reznikmm/matreshka | Ada | 4,624 | 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.Row_Mapping_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Chart_Row_Mapping_Attribute_Node is
begin
return Self : Chart_Row_Mapping_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_Row_Mapping_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Row_Mapping_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Chart_URI,
Matreshka.ODF_String_Constants.Row_Mapping_Attribute,
Chart_Row_Mapping_Attribute_Node'Tag);
end Matreshka.ODF_Chart.Row_Mapping_Attributes;
|
charlie5/lace | Ada | 960 | ads | package openGL.Geometry.textured
--
-- Supports per-vertex site and texture.
--
is
type Item is new openGL.Geometry.item with private;
type View is access all Item'Class;
function new_Geometry return View;
----------
-- Vertex
--
type Vertex is
record
Site : Vector_3;
Coords : Coordinate_2D;
end record;
type Vertex_array is array (Index_t range <>) of aliased Vertex;
--------------
-- Attributes
--
overriding
function is_Transparent (Self : in Item) return Boolean;
procedure Vertices_are (Self : in out Item; Now : in Vertex_array);
overriding
procedure Indices_are (Self : in out Item; Now : in Indices;
for_Facia : in Positive);
private
type Item is new Geometry.item with null record;
overriding
procedure enable_Texture (Self : in Item);
end openGL.Geometry.textured;
|
reznikmm/matreshka | Ada | 13,158 | 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.
------------------------------------------------------------------------------
package AMF.Internals.Tables.DG_Metamodel.Properties is
procedure Initialize;
private
procedure Initialize_1;
procedure Initialize_2;
procedure Initialize_3;
procedure Initialize_4;
procedure Initialize_5;
procedure Initialize_6;
procedure Initialize_7;
procedure Initialize_8;
procedure Initialize_9;
procedure Initialize_10;
procedure Initialize_11;
procedure Initialize_12;
procedure Initialize_13;
procedure Initialize_14;
procedure Initialize_15;
procedure Initialize_16;
procedure Initialize_17;
procedure Initialize_18;
procedure Initialize_19;
procedure Initialize_20;
procedure Initialize_21;
procedure Initialize_22;
procedure Initialize_23;
procedure Initialize_24;
procedure Initialize_25;
procedure Initialize_26;
procedure Initialize_27;
procedure Initialize_28;
procedure Initialize_29;
procedure Initialize_30;
procedure Initialize_31;
procedure Initialize_32;
procedure Initialize_33;
procedure Initialize_34;
procedure Initialize_35;
procedure Initialize_36;
procedure Initialize_37;
procedure Initialize_38;
procedure Initialize_39;
procedure Initialize_40;
procedure Initialize_41;
procedure Initialize_42;
procedure Initialize_43;
procedure Initialize_44;
procedure Initialize_45;
procedure Initialize_46;
procedure Initialize_47;
procedure Initialize_48;
procedure Initialize_49;
procedure Initialize_50;
procedure Initialize_51;
procedure Initialize_52;
procedure Initialize_53;
procedure Initialize_54;
procedure Initialize_55;
procedure Initialize_56;
procedure Initialize_57;
procedure Initialize_58;
procedure Initialize_59;
procedure Initialize_60;
procedure Initialize_61;
procedure Initialize_62;
procedure Initialize_63;
procedure Initialize_64;
procedure Initialize_65;
procedure Initialize_66;
procedure Initialize_67;
procedure Initialize_68;
procedure Initialize_69;
procedure Initialize_70;
procedure Initialize_71;
procedure Initialize_72;
procedure Initialize_73;
procedure Initialize_74;
procedure Initialize_75;
procedure Initialize_76;
procedure Initialize_77;
procedure Initialize_78;
procedure Initialize_79;
procedure Initialize_80;
procedure Initialize_81;
procedure Initialize_82;
procedure Initialize_83;
procedure Initialize_84;
procedure Initialize_85;
procedure Initialize_86;
procedure Initialize_87;
procedure Initialize_88;
procedure Initialize_89;
procedure Initialize_90;
procedure Initialize_91;
procedure Initialize_92;
procedure Initialize_93;
procedure Initialize_94;
procedure Initialize_95;
procedure Initialize_96;
procedure Initialize_97;
procedure Initialize_98;
procedure Initialize_99;
procedure Initialize_100;
procedure Initialize_101;
procedure Initialize_102;
procedure Initialize_103;
procedure Initialize_104;
procedure Initialize_105;
procedure Initialize_106;
procedure Initialize_107;
procedure Initialize_108;
procedure Initialize_109;
procedure Initialize_110;
procedure Initialize_111;
procedure Initialize_112;
procedure Initialize_113;
procedure Initialize_114;
procedure Initialize_115;
procedure Initialize_116;
procedure Initialize_117;
procedure Initialize_118;
procedure Initialize_119;
procedure Initialize_120;
procedure Initialize_121;
procedure Initialize_122;
procedure Initialize_123;
procedure Initialize_124;
procedure Initialize_125;
procedure Initialize_126;
procedure Initialize_127;
procedure Initialize_128;
procedure Initialize_129;
procedure Initialize_130;
procedure Initialize_131;
procedure Initialize_132;
procedure Initialize_133;
procedure Initialize_134;
procedure Initialize_135;
procedure Initialize_136;
procedure Initialize_137;
procedure Initialize_138;
procedure Initialize_139;
procedure Initialize_140;
procedure Initialize_141;
procedure Initialize_142;
procedure Initialize_143;
procedure Initialize_144;
procedure Initialize_145;
procedure Initialize_146;
procedure Initialize_147;
procedure Initialize_148;
procedure Initialize_149;
procedure Initialize_150;
procedure Initialize_151;
procedure Initialize_152;
procedure Initialize_153;
procedure Initialize_154;
procedure Initialize_155;
procedure Initialize_156;
procedure Initialize_157;
procedure Initialize_158;
procedure Initialize_159;
procedure Initialize_160;
procedure Initialize_161;
procedure Initialize_162;
procedure Initialize_163;
procedure Initialize_164;
procedure Initialize_165;
procedure Initialize_166;
procedure Initialize_167;
procedure Initialize_168;
procedure Initialize_169;
procedure Initialize_170;
procedure Initialize_171;
procedure Initialize_172;
procedure Initialize_173;
procedure Initialize_174;
procedure Initialize_175;
procedure Initialize_176;
procedure Initialize_177;
procedure Initialize_178;
procedure Initialize_179;
procedure Initialize_180;
procedure Initialize_181;
procedure Initialize_182;
procedure Initialize_183;
procedure Initialize_184;
procedure Initialize_185;
procedure Initialize_186;
procedure Initialize_187;
procedure Initialize_188;
procedure Initialize_189;
procedure Initialize_190;
procedure Initialize_191;
procedure Initialize_192;
procedure Initialize_193;
procedure Initialize_194;
procedure Initialize_195;
procedure Initialize_196;
procedure Initialize_197;
procedure Initialize_198;
procedure Initialize_199;
procedure Initialize_200;
procedure Initialize_201;
procedure Initialize_202;
procedure Initialize_203;
procedure Initialize_204;
procedure Initialize_205;
procedure Initialize_206;
procedure Initialize_207;
procedure Initialize_208;
procedure Initialize_209;
procedure Initialize_210;
procedure Initialize_211;
procedure Initialize_212;
procedure Initialize_213;
procedure Initialize_214;
procedure Initialize_215;
procedure Initialize_216;
procedure Initialize_217;
procedure Initialize_218;
procedure Initialize_219;
procedure Initialize_220;
procedure Initialize_221;
procedure Initialize_222;
procedure Initialize_223;
procedure Initialize_224;
procedure Initialize_225;
procedure Initialize_226;
procedure Initialize_227;
procedure Initialize_228;
procedure Initialize_229;
procedure Initialize_230;
procedure Initialize_231;
procedure Initialize_232;
procedure Initialize_233;
procedure Initialize_234;
procedure Initialize_235;
procedure Initialize_236;
procedure Initialize_237;
procedure Initialize_238;
procedure Initialize_239;
procedure Initialize_240;
procedure Initialize_241;
procedure Initialize_242;
procedure Initialize_243;
procedure Initialize_244;
procedure Initialize_245;
procedure Initialize_246;
procedure Initialize_247;
procedure Initialize_248;
procedure Initialize_249;
procedure Initialize_250;
procedure Initialize_251;
procedure Initialize_252;
procedure Initialize_253;
procedure Initialize_254;
procedure Initialize_255;
procedure Initialize_256;
procedure Initialize_257;
procedure Initialize_258;
procedure Initialize_259;
procedure Initialize_260;
procedure Initialize_261;
procedure Initialize_262;
procedure Initialize_263;
procedure Initialize_264;
procedure Initialize_265;
procedure Initialize_266;
procedure Initialize_267;
procedure Initialize_268;
procedure Initialize_269;
procedure Initialize_270;
procedure Initialize_271;
procedure Initialize_272;
procedure Initialize_273;
procedure Initialize_274;
procedure Initialize_275;
procedure Initialize_276;
procedure Initialize_277;
procedure Initialize_278;
procedure Initialize_279;
procedure Initialize_280;
procedure Initialize_281;
procedure Initialize_282;
procedure Initialize_283;
procedure Initialize_284;
procedure Initialize_285;
procedure Initialize_286;
procedure Initialize_287;
procedure Initialize_288;
procedure Initialize_289;
procedure Initialize_290;
procedure Initialize_291;
procedure Initialize_292;
procedure Initialize_293;
procedure Initialize_294;
procedure Initialize_295;
procedure Initialize_296;
procedure Initialize_297;
procedure Initialize_298;
procedure Initialize_299;
procedure Initialize_300;
procedure Initialize_301;
procedure Initialize_302;
procedure Initialize_303;
procedure Initialize_304;
procedure Initialize_305;
procedure Initialize_306;
procedure Initialize_307;
procedure Initialize_308;
procedure Initialize_309;
procedure Initialize_310;
procedure Initialize_311;
procedure Initialize_312;
procedure Initialize_313;
procedure Initialize_314;
procedure Initialize_315;
procedure Initialize_316;
procedure Initialize_317;
procedure Initialize_318;
procedure Initialize_319;
procedure Initialize_320;
procedure Initialize_321;
procedure Initialize_322;
end AMF.Internals.Tables.DG_Metamodel.Properties;
|
reznikmm/matreshka | Ada | 3,639 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements.Generic_Hash;
function AMF.UML.Parameterable_Elements.Hash is
new AMF.Elements.Generic_Hash (UML_Parameterable_Element, UML_Parameterable_Element_Access);
|
reznikmm/matreshka | Ada | 1,391 | ads |
package Unicode is
pragma Pure;
subtype Unicode_Character is Wide_Wide_Character
range Wide_Wide_Character'Val (16#00_0000#)
.. Wide_Wide_Character'Val (16#10_FFFF#);
BEL : constant Unicode_Character
:= Wide_Wide_Character'Val (Character'Pos (ASCII.BEL));
BS : constant Unicode_Character
:= Wide_Wide_Character'Val (Character'Pos (ASCII.BS));
CR : constant Unicode_Character
:= Wide_Wide_Character'Val (Character'Pos (ASCII.CR));
FF : constant Unicode_Character
:= Wide_Wide_Character'Val (Character'Pos (ASCII.FF));
HT : constant Unicode_Character
:= Wide_Wide_Character'Val (Character'Pos (ASCII.HT));
LF : constant Unicode_Character
:= Wide_Wide_Character'Val (Character'Pos (ASCII.LF));
NUL : constant Unicode_Character
:= Wide_Wide_Character'Val (Character'Pos (ASCII.NUL));
SOH : constant Unicode_Character
:= Wide_Wide_Character'Val (Character'Pos (ASCII.SOH));
VT : constant Unicode_Character
:= Wide_Wide_Character'Val (Character'Pos (ASCII.VT));
DEL : constant Unicode_Character
:= Wide_Wide_Character'Val (Character'Pos (ASCII.DEL));
type Secondary_Stage_Index is range 16#00# .. 16#FF#;
type Primary_Stage_Index is range 16#0000# .. 16#10FF#;
type Code_Unit_32 is mod 2 ** 32;
subtype Code_Point is Code_Unit_32 range 0 .. 16#10_FFFF#;
end Unicode;
|
egustafson/sandbox | Ada | 1,868 | ads | -- generic_list.ads -*- Ada -*-
--
-- This package defines a generic list and list iterator.
--
-- Author: Eric Gustafson
-- Date: 11 August 1998
--
-- ------------------------------------------------------------
--
-- $Revision$
--
-- $Log$
-- ------------------------------------------------------------
generic
type Element_Type is private;
package Generic_List is
-- ----- Fundamental Object Types --------------------------
type List_Type is private;
type List_Iterator_Type is private;
-- Raised by Iterator methods
Iterator_Bound_Error : exception;
-- ----- List_Type Methods ---------------------------------
procedure List_Add( List : in out List_Type;
Element : in Element_Type );
function List_New_Iterator( List : in List_Type )
return List_Iterator_Type;
-- ----- List_Iterator_Type Methods ------------------------
function Is_Next( List_Iterator : in List_Iterator_Type )
return Boolean;
procedure Get_Next( List_Iterator : in out List_Iterator_Type;
Next_Element : out Element_Type );
-- ------------------------------------------------------------
-- ---------- Private Section ----------
-- ------------------------------------------------------------
private
type Element_Array is array (Positive range <>) of Element_Type;
type Element_Array_Access is access Element_Array;
type List_Type is
record
List : aliased Element_Array_Access := new Element_Array(1..3);
Num_Elements : Natural := 0;
end record;
type List_Iterator_Type is
record
List : Element_Array_Access;
Num_Elements : Natural;
Index : Positive := 1;
end record;
end Generic_List;
|
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.Attributes;
package ODF.DOM.Draw_Fill_Attributes is
pragma Preelaborate;
type ODF_Draw_Fill_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Draw_Fill_Attribute_Access is
access all ODF_Draw_Fill_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Draw_Fill_Attributes;
|
iyan22/AprendeAda | Ada | 250 | adb | with Datos;
use Datos;
procedure Eliminar_Todas_Las_Apariciones (
L : in out Lista;
Num : in Integer ) is
-- Pre:
-- Post: se han eliminado de L todas las apariciones de Num
begin
end Eliminar_Todas_Las_Apariciones;
|
ZinebZaad/ENSEEIHT | Ada | 2,303 | ads | with SDA_Exceptions; use SDA_Exceptions;
-- Définition de structures de données associatives sous forme d'une liste
-- chaînée associative (LCA).
generic
type T_Cle is private;
type T_Donnee is private;
package LCA is
type T_LCA is limited private;
-- Initialiser une Sda. La Sda est vide.
procedure Initialiser(Sda: out T_LCA) with
Post => Est_Vide (Sda);
-- Est-ce qu'une Sda est vide ?
function Est_Vide (Sda : T_LCA) return Boolean;
-- Obtenir le nombre d'éléments d'une Sda.
function Taille (Sda : in T_LCA) return Integer with
Post => Taille'Result >= 0
and (Taille'Result = 0) = Est_Vide (Sda);
-- Enregistrer une Donnée associée à une Clé dans une Sda.
-- Si la clé est déjà présente dans la Sda, sa donnée est changée.
procedure Enregistrer (Sda : in out T_LCA ; Cle : in T_Cle ; Donnee : in T_Donnee) with
Post => Cle_Presente (Sda, Cle)
and then (La_Donnee (Sda, Cle) = Donnee) -- donnée insérée
-- and then (if not (Cle_Presente (Sda, Cle)'Old) then Taille (Sda) = Taille (Sda)'Old)
-- and then (if Cle_Presente (Sda, Cle)'Old then Taille (Sda) = Taille (Sda)'Old + 1)
;
-- Supprimer la Donnée associée à une Clé dans une Sda.
-- Exception : Cle_Absente_Exception si Clé n'est pas utilisée dans la Sda
procedure Supprimer (Sda : in out T_LCA ; Cle : in T_Cle) with
Post => Taille (Sda) = Taille (Sda)'Old - 1 -- un élément de moins
and not Cle_Presente (Sda, Cle); -- la clé a été supprimée
-- Savoir si une Clé est présente dans une Sda.
function Cle_Presente (Sda : in T_LCA ; Cle : in T_Cle) return Boolean;
-- Obtenir la donnée associée à une Cle dans la Sda.
-- Exception : Cle_Absente_Exception si Clé n'est pas utilisée dans l'Sda
function La_Donnee (Sda : in T_LCA ; Cle : in T_Cle) return T_Donnee;
-- Supprimer tous les éléments d'une Sda.
procedure Vider (Sda : in out T_LCA) with
Post => Est_Vide (Sda);
-- Appliquer un traitement (Traiter) pour chaque couple d'une Sda.
generic
with procedure Traiter (Cle : in T_Cle; Donnee: in T_Donnee);
procedure Pour_Chaque (Sda : in T_LCA);
private
type T_Cellule;
type T_LCA is access T_Cellule;
type T_Cellule is record
Cle : T_Cle;
Donnee : T_Donnee;
Suivant : T_LCA;
end record;
end LCA;
|
reznikmm/matreshka | Ada | 3,699 | 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.Table_Database_Range_Elements is
pragma Preelaborate;
type ODF_Table_Database_Range is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Table_Database_Range_Access is
access all ODF_Table_Database_Range'Class
with Storage_Size => 0;
end ODF.DOM.Table_Database_Range_Elements;
|
sf17k/sdlada | Ada | 2,172 | ads | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2014-2015 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.Surfaces
--
-- Render surface abstraction.
--------------------------------------------------------------------------------------------------------------------
with Ada.Finalization;
private with SDL.C_Pointers;
package SDL.Video.Surfaces is
type Surface is new Ada.Finalization.Limited_Controlled with private;
Null_Surface : constant Surface;
overriding
procedure Finalize (Self : in out Surface);
private
type Surface is new Ada.Finalization.Limited_Controlled with
record
Internal : SDL.C_Pointers.Surface_Pointer := null;
Owns : Boolean := True;
end record;
function Get_Internal_Surface (Self : in Surface) return SDL.C_Pointers.Surface_Pointer with
Export => True,
Convention => Ada;
Null_Surface : constant Surface := (Ada.Finalization.Limited_Controlled with
Internal => null,
Owns => True);
end SDL.Video.Surfaces;
|
PThierry/ewok-kernel | Ada | 24 | adb | ../stm32f439/soc-dwt.adb |
annexi-strayline/ASAP-CLI | Ada | 5,078 | adb | ------------------------------------------------------------------------------
-- --
-- Command Line Interface Toolkit --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2019-2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Ensi Martini (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. --
-- --
------------------------------------------------------------------------------
package body CLI.Widgets.Progress_Bars is
------------------
-- Render_Inner --
------------------
-- Render the bar except for the delimiters. Column must be set appropriatly
-- first
procedure Render_Inner (Bar: in Progress_Bar) is
Progress_Length: constant Natural := Natural
(Float'Rounding ((Float (Bar.Percent) / 100.0) * Float (Bar.Width)));
Fill_String: constant Wide_Wide_String (1 .. Progress_Length)
:= (others => Bar.Fill_Char);
Empty_String: constant Wide_Wide_String
(1 .. (Bar.Width - Progress_Length))
:= (others => Bar.Empty_Char);
begin
Wide_Wide_Put (Message => Fill_String, Style => Bar.Fill_Style );
Wide_Wide_Put (Message => Empty_String, Style => Bar.Empty_Style);
end Render_Inner;
------------
-- Render --
------------
procedure Render (Bar : in out Progress_Bar;
Column: in Positive := Current_Column)
is begin
Bar.Column := Column;
Set_Column (Bar.Column);
if Bar.Delimited then
-- Left delimiter
Wide_Wide_Put (Char => Bar.Left_Delimiter,
Style => Bar.Left_Delimiter_Style);
end if;
Render_Inner (Bar);
if Bar.Delimited then
Wide_Wide_Put (Char => Bar.Right_Delimiter,
Style => Bar.Right_Delimiter_Style);
end if;
end Render;
------------
-- Update --
------------
procedure Update (Bar: in out Progress_Bar) is
Saved_Column: constant Positive := Current_Column;
begin
Set_Column (Bar.Column + (if Bar.Delimited then 1 else 0));
Render_Inner (Bar);
Set_Column (Saved_Column);
end Update;
end CLI.Widgets.Progress_Bars;
|
anthony-arnold/AdaID | Ada | 640 | adb | -- File: test.adb
-- Description: Test suite for AdaID
-- Author: Anthony Arnold
-- License: http://www.gnu.org/licenses/gpl.txt
with AUnit.Test_Suites; use AUnit.Test_Suites;
with AUnit.Run;
with AUnit.Reporter.Text;
with AdaID_Tests;
procedure Test is
function Suite return Access_Test_Suite is
Result : constant Access_Test_Suite := new Test_Suite;
Test : constant AdaID_Tests.Access_UUID_Test := new AdaID_Tests.UUID_Test;
begin
Add_Test(Result, Test);
return Result;
end Suite;
procedure Run is new AUnit.Run.Test_Runner(Suite);
Reporter : AUnit.Reporter.Text.Text_Reporter;
begin
Run(Reporter);
end;
|
reznikmm/matreshka | Ada | 4,606 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with SQL.Databases;
with OPM.Stores;
limited with Forum.Categories.References;
package Forum.Categories.Objects.Stores is
type Category_Access is access all Category_Object'Class;
type Category_Store is new OPM.Stores.Abstract_Store with private;
not overriding function Get
(Self : in out Category_Store;
Identifier : Category_Identifier) return Category_Access;
function Get_Topic_Count
(Self : in out Category_Store;
Identifier : Category_Identifier) return Natural;
function Get_Topics
(Self : in out Category_Store;
Identifier : Category_Identifier;
From : Positive;
To : Positive) return Forum.Topics.References.Topic_Vector;
not overriding procedure Release
(Self : in out Category_Store;
Object : not null Category_Access);
not overriding function Create
(Self : in out Category_Store;
Title : League.Strings.Universal_String;
Description : League.Strings.Universal_String)
return Forum.Categories.References.Category;
overriding procedure Initialize (Self : in out Category_Store);
private
type Category_Store is new OPM.Stores.Abstract_Store with null record;
end Forum.Categories.Objects.Stores;
|
AdaCore/libadalang | Ada | 69 | ads | generic
package Pkg_G is
Foo : constant Integer := 42;
end Pkg_G;
|
tum-ei-rcs/StratoX | Ada | 57,551 | ads | -- This spec has been automatically generated from STM32F429x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
with HAL;
with System;
package STM32_SVD.RCC is
pragma Preelaborate;
---------------
-- Registers --
---------------
-----------------
-- CR_Register --
-----------------
subtype CR_HSITRIM_Field is HAL.UInt5;
subtype CR_HSICAL_Field is HAL.Byte;
-- clock control register
type CR_Register is record
-- Internal high-speed clock enable
HSION : Boolean := True;
-- Read-only. Internal high-speed clock ready flag
HSIRDY : Boolean := True;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- Internal high-speed clock trimming
HSITRIM : CR_HSITRIM_Field := 16#10#;
-- Read-only. Internal high-speed clock calibration
HSICAL : CR_HSICAL_Field := 16#0#;
-- HSE clock enable
HSEON : Boolean := False;
-- Read-only. HSE clock ready flag
HSERDY : Boolean := False;
-- HSE clock bypass
HSEBYP : Boolean := False;
-- Clock security system enable
CSSON : Boolean := False;
-- unspecified
Reserved_20_23 : HAL.UInt4 := 16#0#;
-- Main PLL (PLL) enable
PLLON : Boolean := False;
-- Read-only. Main PLL (PLL) clock ready flag
PLLRDY : Boolean := False;
-- PLLI2S enable
PLLI2SON : Boolean := False;
-- Read-only. PLLI2S clock ready flag
PLLI2SRDY : Boolean := False;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
HSION at 0 range 0 .. 0;
HSIRDY at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
HSITRIM at 0 range 3 .. 7;
HSICAL at 0 range 8 .. 15;
HSEON at 0 range 16 .. 16;
HSERDY at 0 range 17 .. 17;
HSEBYP at 0 range 18 .. 18;
CSSON at 0 range 19 .. 19;
Reserved_20_23 at 0 range 20 .. 23;
PLLON at 0 range 24 .. 24;
PLLRDY at 0 range 25 .. 25;
PLLI2SON at 0 range 26 .. 26;
PLLI2SRDY at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
----------------------
-- PLLCFGR_Register --
----------------------
subtype PLLCFGR_PLLM_Field is HAL.UInt6;
subtype PLLCFGR_PLLN_Field is HAL.UInt9;
subtype PLLCFGR_PLLP_Field is HAL.UInt2;
subtype PLLCFGR_PLLQ_Field is HAL.UInt4;
-- PLL configuration register
type PLLCFGR_Register is record
-- Division factor for the main PLL (PLL) and audio PLL (PLLI2S) input
-- clock
PLLM : PLLCFGR_PLLM_Field := 16#10#;
-- Main PLL (PLL) multiplication factor for VCO
PLLN : PLLCFGR_PLLN_Field := 16#C0#;
-- unspecified
Reserved_15_15 : HAL.Bit := 16#0#;
-- Main PLL (PLL) division factor for main system clock
PLLP : PLLCFGR_PLLP_Field := 16#0#;
-- unspecified
Reserved_18_21 : HAL.UInt4 := 16#0#;
-- Main PLL(PLL) and audio PLL (PLLI2S) entry clock source
PLLSRC : Boolean := False;
-- unspecified
Reserved_23_23 : HAL.Bit := 16#0#;
-- Main PLL (PLL) division factor for USB OTG FS, SDIO and random number
-- generator clocks
PLLQ : PLLCFGR_PLLQ_Field := 16#4#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#2#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PLLCFGR_Register use record
PLLM at 0 range 0 .. 5;
PLLN at 0 range 6 .. 14;
Reserved_15_15 at 0 range 15 .. 15;
PLLP at 0 range 16 .. 17;
Reserved_18_21 at 0 range 18 .. 21;
PLLSRC at 0 range 22 .. 22;
Reserved_23_23 at 0 range 23 .. 23;
PLLQ at 0 range 24 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-------------------
-- CFGR_Register --
-------------------
subtype CFGR_SW_Field is HAL.UInt2;
subtype CFGR_SWS_Field is HAL.UInt2;
subtype CFGR_HPRE_Field is HAL.UInt4;
---------------
-- CFGR.PPRE --
---------------
-- CFGR_PPRE array element
subtype CFGR_PPRE_Element is HAL.UInt3;
-- CFGR_PPRE array
type CFGR_PPRE_Field_Array is array (1 .. 2) of CFGR_PPRE_Element
with Component_Size => 3, Size => 6;
-- Type definition for CFGR_PPRE
type CFGR_PPRE_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PPRE as a value
Val : HAL.UInt6;
when True =>
-- PPRE as an array
Arr : CFGR_PPRE_Field_Array;
end case;
end record
with Unchecked_Union, Size => 6;
for CFGR_PPRE_Field use record
Val at 0 range 0 .. 5;
Arr at 0 range 0 .. 5;
end record;
subtype CFGR_RTCPRE_Field is HAL.UInt5;
subtype CFGR_MCO1_Field is HAL.UInt2;
subtype CFGR_MCO1PRE_Field is HAL.UInt3;
subtype CFGR_MCO2PRE_Field is HAL.UInt3;
subtype CFGR_MCO2_Field is HAL.UInt2;
-- clock configuration register
type CFGR_Register is record
-- System clock switch
SW : CFGR_SW_Field := 16#0#;
-- Read-only. System clock switch status
SWS : CFGR_SWS_Field := 16#0#;
-- AHB prescaler
HPRE : CFGR_HPRE_Field := 16#0#;
-- unspecified
Reserved_8_9 : HAL.UInt2 := 16#0#;
-- APB Low speed prescaler (APB1)
PPRE : CFGR_PPRE_Field := (As_Array => False, Val => 16#0#);
-- HSE division factor for RTC clock
RTCPRE : CFGR_RTCPRE_Field := 16#0#;
-- Microcontroller clock output 1
MCO1 : CFGR_MCO1_Field := 16#0#;
-- I2S clock selection
I2SSRC : Boolean := False;
-- MCO1 prescaler
MCO1PRE : CFGR_MCO1PRE_Field := 16#0#;
-- MCO2 prescaler
MCO2PRE : CFGR_MCO2PRE_Field := 16#0#;
-- Microcontroller clock output 2
MCO2 : CFGR_MCO2_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CFGR_Register use record
SW at 0 range 0 .. 1;
SWS at 0 range 2 .. 3;
HPRE at 0 range 4 .. 7;
Reserved_8_9 at 0 range 8 .. 9;
PPRE at 0 range 10 .. 15;
RTCPRE at 0 range 16 .. 20;
MCO1 at 0 range 21 .. 22;
I2SSRC at 0 range 23 .. 23;
MCO1PRE at 0 range 24 .. 26;
MCO2PRE at 0 range 27 .. 29;
MCO2 at 0 range 30 .. 31;
end record;
------------------
-- CIR_Register --
------------------
-- clock interrupt register
type CIR_Register is record
-- Read-only. LSI ready interrupt flag
LSIRDYF : Boolean := False;
-- Read-only. LSE ready interrupt flag
LSERDYF : Boolean := False;
-- Read-only. HSI ready interrupt flag
HSIRDYF : Boolean := False;
-- Read-only. HSE ready interrupt flag
HSERDYF : Boolean := False;
-- Read-only. Main PLL (PLL) ready interrupt flag
PLLRDYF : Boolean := False;
-- Read-only. PLLI2S ready interrupt flag
PLLI2SRDYF : Boolean := False;
-- Read-only. PLLSAI ready interrupt flag
PLLSAIRDYF : Boolean := False;
-- Read-only. Clock security system interrupt flag
CSSF : Boolean := False;
-- LSI ready interrupt enable
LSIRDYIE : Boolean := False;
-- LSE ready interrupt enable
LSERDYIE : Boolean := False;
-- HSI ready interrupt enable
HSIRDYIE : Boolean := False;
-- HSE ready interrupt enable
HSERDYIE : Boolean := False;
-- Main PLL (PLL) ready interrupt enable
PLLRDYIE : Boolean := False;
-- PLLI2S ready interrupt enable
PLLI2SRDYIE : Boolean := False;
-- PLLSAI Ready Interrupt Enable
PLLSAIRDYIE : Boolean := False;
-- unspecified
Reserved_15_15 : HAL.Bit := 16#0#;
-- Write-only. LSI ready interrupt clear
LSIRDYC : Boolean := False;
-- Write-only. LSE ready interrupt clear
LSERDYC : Boolean := False;
-- Write-only. HSI ready interrupt clear
HSIRDYC : Boolean := False;
-- Write-only. HSE ready interrupt clear
HSERDYC : Boolean := False;
-- Write-only. Main PLL(PLL) ready interrupt clear
PLLRDYC : Boolean := False;
-- Write-only. PLLI2S ready interrupt clear
PLLI2SRDYC : Boolean := False;
-- Write-only. PLLSAI Ready Interrupt Clear
PLLSAIRDYC : Boolean := False;
-- Write-only. Clock security system interrupt clear
CSSC : Boolean := False;
-- unspecified
Reserved_24_31 : HAL.Byte := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CIR_Register use record
LSIRDYF at 0 range 0 .. 0;
LSERDYF at 0 range 1 .. 1;
HSIRDYF at 0 range 2 .. 2;
HSERDYF at 0 range 3 .. 3;
PLLRDYF at 0 range 4 .. 4;
PLLI2SRDYF at 0 range 5 .. 5;
PLLSAIRDYF at 0 range 6 .. 6;
CSSF at 0 range 7 .. 7;
LSIRDYIE at 0 range 8 .. 8;
LSERDYIE at 0 range 9 .. 9;
HSIRDYIE at 0 range 10 .. 10;
HSERDYIE at 0 range 11 .. 11;
PLLRDYIE at 0 range 12 .. 12;
PLLI2SRDYIE at 0 range 13 .. 13;
PLLSAIRDYIE at 0 range 14 .. 14;
Reserved_15_15 at 0 range 15 .. 15;
LSIRDYC at 0 range 16 .. 16;
LSERDYC at 0 range 17 .. 17;
HSIRDYC at 0 range 18 .. 18;
HSERDYC at 0 range 19 .. 19;
PLLRDYC at 0 range 20 .. 20;
PLLI2SRDYC at 0 range 21 .. 21;
PLLSAIRDYC at 0 range 22 .. 22;
CSSC at 0 range 23 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
-----------------------
-- AHB1RSTR_Register --
-----------------------
-- AHB1 peripheral reset register
type AHB1RSTR_Register is record
-- IO port A reset
GPIOARST : Boolean := False;
-- IO port B reset
GPIOBRST : Boolean := False;
-- IO port C reset
GPIOCRST : Boolean := False;
-- IO port D reset
GPIODRST : Boolean := False;
-- IO port E reset
GPIOERST : Boolean := False;
-- IO port F reset
GPIOFRST : Boolean := False;
-- IO port G reset
GPIOGRST : Boolean := False;
-- IO port H reset
GPIOHRST : Boolean := False;
-- IO port I reset
GPIOIRST : Boolean := False;
-- IO port J reset
GPIOJRST : Boolean := False;
-- IO port K reset
GPIOKRST : Boolean := False;
-- unspecified
Reserved_11_11 : HAL.Bit := 16#0#;
-- CRC reset
CRCRST : Boolean := False;
-- unspecified
Reserved_13_20 : HAL.Byte := 16#0#;
-- DMA2 reset
DMA1RST : Boolean := False;
-- DMA2 reset
DMA2RST : Boolean := False;
-- DMA2D reset
DMA2DRST : Boolean := False;
-- unspecified
Reserved_24_24 : HAL.Bit := 16#0#;
-- Ethernet MAC reset
ETHMACRST : Boolean := False;
-- unspecified
Reserved_26_28 : HAL.UInt3 := 16#0#;
-- USB OTG HS module reset
OTGHSRST : Boolean := False;
-- unspecified
Reserved_30_31 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for AHB1RSTR_Register use record
GPIOARST at 0 range 0 .. 0;
GPIOBRST at 0 range 1 .. 1;
GPIOCRST at 0 range 2 .. 2;
GPIODRST at 0 range 3 .. 3;
GPIOERST at 0 range 4 .. 4;
GPIOFRST at 0 range 5 .. 5;
GPIOGRST at 0 range 6 .. 6;
GPIOHRST at 0 range 7 .. 7;
GPIOIRST at 0 range 8 .. 8;
GPIOJRST at 0 range 9 .. 9;
GPIOKRST at 0 range 10 .. 10;
Reserved_11_11 at 0 range 11 .. 11;
CRCRST at 0 range 12 .. 12;
Reserved_13_20 at 0 range 13 .. 20;
DMA1RST at 0 range 21 .. 21;
DMA2RST at 0 range 22 .. 22;
DMA2DRST at 0 range 23 .. 23;
Reserved_24_24 at 0 range 24 .. 24;
ETHMACRST at 0 range 25 .. 25;
Reserved_26_28 at 0 range 26 .. 28;
OTGHSRST at 0 range 29 .. 29;
Reserved_30_31 at 0 range 30 .. 31;
end record;
-----------------------
-- AHB2RSTR_Register --
-----------------------
-- AHB2 peripheral reset register
type AHB2RSTR_Register is record
-- Camera interface reset
DCMIRST : Boolean := False;
-- unspecified
Reserved_1_5 : HAL.UInt5 := 16#0#;
-- Random number generator module reset
RNGRST : Boolean := False;
-- USB OTG FS module reset
OTGFSRST : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for AHB2RSTR_Register use record
DCMIRST at 0 range 0 .. 0;
Reserved_1_5 at 0 range 1 .. 5;
RNGRST at 0 range 6 .. 6;
OTGFSRST at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-----------------------
-- AHB3RSTR_Register --
-----------------------
-- AHB3 peripheral reset register
type AHB3RSTR_Register is record
-- Flexible memory controller module reset
FMCRST : Boolean := False;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for AHB3RSTR_Register use record
FMCRST at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-----------------------
-- APB1RSTR_Register --
-----------------------
-- APB1 peripheral reset register
type APB1RSTR_Register is record
-- TIM2 reset
TIM2RST : Boolean := False;
-- TIM3 reset
TIM3RST : Boolean := False;
-- TIM4 reset
TIM4RST : Boolean := False;
-- TIM5 reset
TIM5RST : Boolean := False;
-- TIM6 reset
TIM6RST : Boolean := False;
-- TIM7 reset
TIM7RST : Boolean := False;
-- TIM12 reset
TIM12RST : Boolean := False;
-- TIM13 reset
TIM13RST : Boolean := False;
-- TIM14 reset
TIM14RST : Boolean := False;
-- unspecified
Reserved_9_10 : HAL.UInt2 := 16#0#;
-- Window watchdog reset
WWDGRST : Boolean := False;
-- unspecified
Reserved_12_13 : HAL.UInt2 := 16#0#;
-- SPI 2 reset
SPI2RST : Boolean := False;
-- SPI 3 reset
SPI3RST : Boolean := False;
-- unspecified
Reserved_16_16 : HAL.Bit := 16#0#;
-- USART 2 reset
UART2RST : Boolean := False;
-- USART 3 reset
UART3RST : Boolean := False;
-- USART 4 reset
UART4RST : Boolean := False;
-- USART 5 reset
UART5RST : Boolean := False;
-- I2C 1 reset
I2C1RST : Boolean := False;
-- I2C 2 reset
I2C2RST : Boolean := False;
-- I2C3 reset
I2C3RST : Boolean := False;
-- unspecified
Reserved_24_24 : HAL.Bit := 16#0#;
-- CAN1 reset
CAN1RST : Boolean := False;
-- CAN2 reset
CAN2RST : Boolean := False;
-- unspecified
Reserved_27_27 : HAL.Bit := 16#0#;
-- Power interface reset
PWRRST : Boolean := False;
-- DAC reset
DACRST : Boolean := False;
-- UART7 reset
UART7RST : Boolean := False;
-- UART8 reset
UART8RST : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for APB1RSTR_Register use record
TIM2RST at 0 range 0 .. 0;
TIM3RST at 0 range 1 .. 1;
TIM4RST at 0 range 2 .. 2;
TIM5RST at 0 range 3 .. 3;
TIM6RST at 0 range 4 .. 4;
TIM7RST at 0 range 5 .. 5;
TIM12RST at 0 range 6 .. 6;
TIM13RST at 0 range 7 .. 7;
TIM14RST at 0 range 8 .. 8;
Reserved_9_10 at 0 range 9 .. 10;
WWDGRST at 0 range 11 .. 11;
Reserved_12_13 at 0 range 12 .. 13;
SPI2RST at 0 range 14 .. 14;
SPI3RST at 0 range 15 .. 15;
Reserved_16_16 at 0 range 16 .. 16;
UART2RST at 0 range 17 .. 17;
UART3RST at 0 range 18 .. 18;
UART4RST at 0 range 19 .. 19;
UART5RST at 0 range 20 .. 20;
I2C1RST at 0 range 21 .. 21;
I2C2RST at 0 range 22 .. 22;
I2C3RST at 0 range 23 .. 23;
Reserved_24_24 at 0 range 24 .. 24;
CAN1RST at 0 range 25 .. 25;
CAN2RST at 0 range 26 .. 26;
Reserved_27_27 at 0 range 27 .. 27;
PWRRST at 0 range 28 .. 28;
DACRST at 0 range 29 .. 29;
UART7RST at 0 range 30 .. 30;
UART8RST at 0 range 31 .. 31;
end record;
-----------------------
-- APB2RSTR_Register --
-----------------------
-- APB2 peripheral reset register
type APB2RSTR_Register is record
-- TIM1 reset
TIM1RST : Boolean := False;
-- TIM8 reset
TIM8RST : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- USART1 reset
USART1RST : Boolean := False;
-- USART6 reset
USART6RST : Boolean := False;
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
-- ADC interface reset (common to all ADCs)
ADCRST : Boolean := False;
-- unspecified
Reserved_9_10 : HAL.UInt2 := 16#0#;
-- SDIO reset
SDIORST : Boolean := False;
-- SPI 1 reset
SPI1RST : Boolean := False;
-- SPI4 reset
SPI4RST : Boolean := False;
-- System configuration controller reset
SYSCFGRST : Boolean := False;
-- unspecified
Reserved_15_15 : HAL.Bit := 16#0#;
-- TIM9 reset
TIM9RST : Boolean := False;
-- TIM10 reset
TIM10RST : Boolean := False;
-- TIM11 reset
TIM11RST : Boolean := False;
-- unspecified
Reserved_19_19 : HAL.Bit := 16#0#;
-- SPI5 reset
SPI5RST : Boolean := False;
-- SPI6 reset
SPI6RST : Boolean := False;
-- SAI1 reset
SAI1RST : Boolean := False;
-- unspecified
Reserved_23_25 : HAL.UInt3 := 16#0#;
-- LTDC reset
LTDCRST : Boolean := False;
-- unspecified
Reserved_27_31 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for APB2RSTR_Register use record
TIM1RST at 0 range 0 .. 0;
TIM8RST at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
USART1RST at 0 range 4 .. 4;
USART6RST at 0 range 5 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
ADCRST at 0 range 8 .. 8;
Reserved_9_10 at 0 range 9 .. 10;
SDIORST at 0 range 11 .. 11;
SPI1RST at 0 range 12 .. 12;
SPI4RST at 0 range 13 .. 13;
SYSCFGRST at 0 range 14 .. 14;
Reserved_15_15 at 0 range 15 .. 15;
TIM9RST at 0 range 16 .. 16;
TIM10RST at 0 range 17 .. 17;
TIM11RST at 0 range 18 .. 18;
Reserved_19_19 at 0 range 19 .. 19;
SPI5RST at 0 range 20 .. 20;
SPI6RST at 0 range 21 .. 21;
SAI1RST at 0 range 22 .. 22;
Reserved_23_25 at 0 range 23 .. 25;
LTDCRST at 0 range 26 .. 26;
Reserved_27_31 at 0 range 27 .. 31;
end record;
----------------------
-- AHB1ENR_Register --
----------------------
-- AHB1 peripheral clock register
type AHB1ENR_Register is record
-- IO port A clock enable
GPIOAEN : Boolean := False;
-- IO port B clock enable
GPIOBEN : Boolean := False;
-- IO port C clock enable
GPIOCEN : Boolean := False;
-- IO port D clock enable
GPIODEN : Boolean := False;
-- IO port E clock enable
GPIOEEN : Boolean := False;
-- IO port F clock enable
GPIOFEN : Boolean := False;
-- IO port G clock enable
GPIOGEN : Boolean := False;
-- IO port H clock enable
GPIOHEN : Boolean := False;
-- IO port I clock enable
GPIOIEN : Boolean := False;
-- IO port J clock enable
GPIOJEN : Boolean := False;
-- IO port K clock enable
GPIOKEN : Boolean := False;
-- unspecified
Reserved_11_11 : HAL.Bit := 16#0#;
-- CRC clock enable
CRCEN : Boolean := False;
-- unspecified
Reserved_13_17 : HAL.UInt5 := 16#0#;
-- Backup SRAM interface clock enable
BKPSRAMEN : Boolean := False;
-- unspecified
Reserved_19_19 : HAL.Bit := 16#0#;
-- CCM data RAM clock enable
CCMDATARAMEN : Boolean := True;
-- DMA1 clock enable
DMA1EN : Boolean := False;
-- DMA2 clock enable
DMA2EN : Boolean := False;
-- DMA2D clock enable
DMA2DEN : Boolean := False;
-- unspecified
Reserved_24_24 : HAL.Bit := 16#0#;
-- Ethernet MAC clock enable
ETHMACEN : Boolean := False;
-- Ethernet Transmission clock enable
ETHMACTXEN : Boolean := False;
-- Ethernet Reception clock enable
ETHMACRXEN : Boolean := False;
-- Ethernet PTP clock enable
ETHMACPTPEN : Boolean := False;
-- USB OTG HS clock enable
OTGHSEN : Boolean := False;
-- USB OTG HSULPI clock enable
OTGHSULPIEN : Boolean := False;
-- unspecified
Reserved_31_31 : HAL.Bit := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for AHB1ENR_Register use record
GPIOAEN at 0 range 0 .. 0;
GPIOBEN at 0 range 1 .. 1;
GPIOCEN at 0 range 2 .. 2;
GPIODEN at 0 range 3 .. 3;
GPIOEEN at 0 range 4 .. 4;
GPIOFEN at 0 range 5 .. 5;
GPIOGEN at 0 range 6 .. 6;
GPIOHEN at 0 range 7 .. 7;
GPIOIEN at 0 range 8 .. 8;
GPIOJEN at 0 range 9 .. 9;
GPIOKEN at 0 range 10 .. 10;
Reserved_11_11 at 0 range 11 .. 11;
CRCEN at 0 range 12 .. 12;
Reserved_13_17 at 0 range 13 .. 17;
BKPSRAMEN at 0 range 18 .. 18;
Reserved_19_19 at 0 range 19 .. 19;
CCMDATARAMEN at 0 range 20 .. 20;
DMA1EN at 0 range 21 .. 21;
DMA2EN at 0 range 22 .. 22;
DMA2DEN at 0 range 23 .. 23;
Reserved_24_24 at 0 range 24 .. 24;
ETHMACEN at 0 range 25 .. 25;
ETHMACTXEN at 0 range 26 .. 26;
ETHMACRXEN at 0 range 27 .. 27;
ETHMACPTPEN at 0 range 28 .. 28;
OTGHSEN at 0 range 29 .. 29;
OTGHSULPIEN at 0 range 30 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
----------------------
-- AHB2ENR_Register --
----------------------
-- AHB2 peripheral clock enable register
type AHB2ENR_Register is record
-- Camera interface enable
DCMIEN : Boolean := False;
-- unspecified
Reserved_1_5 : HAL.UInt5 := 16#0#;
-- Random number generator clock enable
RNGEN : Boolean := False;
-- USB OTG FS clock enable
OTGFSEN : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for AHB2ENR_Register use record
DCMIEN at 0 range 0 .. 0;
Reserved_1_5 at 0 range 1 .. 5;
RNGEN at 0 range 6 .. 6;
OTGFSEN at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
----------------------
-- AHB3ENR_Register --
----------------------
-- AHB3 peripheral clock enable register
type AHB3ENR_Register is record
-- Flexible memory controller module clock enable
FMCEN : Boolean := False;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for AHB3ENR_Register use record
FMCEN at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
----------------------
-- APB1ENR_Register --
----------------------
-- APB1 peripheral clock enable register
type APB1ENR_Register is record
-- TIM2 clock enable
TIM2EN : Boolean := False;
-- TIM3 clock enable
TIM3EN : Boolean := False;
-- TIM4 clock enable
TIM4EN : Boolean := False;
-- TIM5 clock enable
TIM5EN : Boolean := False;
-- TIM6 clock enable
TIM6EN : Boolean := False;
-- TIM7 clock enable
TIM7EN : Boolean := False;
-- TIM12 clock enable
TIM12EN : Boolean := False;
-- TIM13 clock enable
TIM13EN : Boolean := False;
-- TIM14 clock enable
TIM14EN : Boolean := False;
-- unspecified
Reserved_9_10 : HAL.UInt2 := 16#0#;
-- Window watchdog clock enable
WWDGEN : Boolean := False;
-- unspecified
Reserved_12_13 : HAL.UInt2 := 16#0#;
-- SPI2 clock enable
SPI2EN : Boolean := False;
-- SPI3 clock enable
SPI3EN : Boolean := False;
-- unspecified
Reserved_16_16 : HAL.Bit := 16#0#;
-- USART 2 clock enable
USART2EN : Boolean := False;
-- USART3 clock enable
USART3EN : Boolean := False;
-- UART4 clock enable
UART4EN : Boolean := False;
-- UART5 clock enable
UART5EN : Boolean := False;
-- I2C1 clock enable
I2C1EN : Boolean := False;
-- I2C2 clock enable
I2C2EN : Boolean := False;
-- I2C3 clock enable
I2C3EN : Boolean := False;
-- unspecified
Reserved_24_24 : HAL.Bit := 16#0#;
-- CAN 1 clock enable
CAN1EN : Boolean := False;
-- CAN 2 clock enable
CAN2EN : Boolean := False;
-- unspecified
Reserved_27_27 : HAL.Bit := 16#0#;
-- Power interface clock enable
PWREN : Boolean := False;
-- DAC interface clock enable
DACEN : Boolean := False;
-- UART7 clock enable
UART7ENR : Boolean := False;
-- UART8 clock enable
UART8ENR : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for APB1ENR_Register use record
TIM2EN at 0 range 0 .. 0;
TIM3EN at 0 range 1 .. 1;
TIM4EN at 0 range 2 .. 2;
TIM5EN at 0 range 3 .. 3;
TIM6EN at 0 range 4 .. 4;
TIM7EN at 0 range 5 .. 5;
TIM12EN at 0 range 6 .. 6;
TIM13EN at 0 range 7 .. 7;
TIM14EN at 0 range 8 .. 8;
Reserved_9_10 at 0 range 9 .. 10;
WWDGEN at 0 range 11 .. 11;
Reserved_12_13 at 0 range 12 .. 13;
SPI2EN at 0 range 14 .. 14;
SPI3EN at 0 range 15 .. 15;
Reserved_16_16 at 0 range 16 .. 16;
USART2EN at 0 range 17 .. 17;
USART3EN at 0 range 18 .. 18;
UART4EN at 0 range 19 .. 19;
UART5EN at 0 range 20 .. 20;
I2C1EN at 0 range 21 .. 21;
I2C2EN at 0 range 22 .. 22;
I2C3EN at 0 range 23 .. 23;
Reserved_24_24 at 0 range 24 .. 24;
CAN1EN at 0 range 25 .. 25;
CAN2EN at 0 range 26 .. 26;
Reserved_27_27 at 0 range 27 .. 27;
PWREN at 0 range 28 .. 28;
DACEN at 0 range 29 .. 29;
UART7ENR at 0 range 30 .. 30;
UART8ENR at 0 range 31 .. 31;
end record;
----------------------
-- APB2ENR_Register --
----------------------
-- APB2 peripheral clock enable register
type APB2ENR_Register is record
-- TIM1 clock enable
TIM1EN : Boolean := False;
-- TIM8 clock enable
TIM8EN : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- USART1 clock enable
USART1EN : Boolean := False;
-- USART6 clock enable
USART6EN : Boolean := False;
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
-- ADC1 clock enable
ADC1EN : Boolean := False;
-- ADC2 clock enable
ADC2EN : Boolean := False;
-- ADC3 clock enable
ADC3EN : Boolean := False;
-- SDIO clock enable
SDIOEN : Boolean := False;
-- SPI1 clock enable
SPI1EN : Boolean := False;
-- SPI4 clock enable
SPI4ENR : Boolean := False;
-- System configuration controller clock enable
SYSCFGEN : Boolean := False;
-- unspecified
Reserved_15_15 : HAL.Bit := 16#0#;
-- TIM9 clock enable
TIM9EN : Boolean := False;
-- TIM10 clock enable
TIM10EN : Boolean := False;
-- TIM11 clock enable
TIM11EN : Boolean := False;
-- unspecified
Reserved_19_19 : HAL.Bit := 16#0#;
-- SPI5 clock enable
SPI5ENR : Boolean := False;
-- SPI6 clock enable
SPI6ENR : Boolean := False;
-- SAI1 clock enable
SAI1EN : Boolean := False;
-- unspecified
Reserved_23_25 : HAL.UInt3 := 16#0#;
-- LTDC clock enable
LTDCEN : Boolean := False;
-- unspecified
Reserved_27_31 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for APB2ENR_Register use record
TIM1EN at 0 range 0 .. 0;
TIM8EN at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
USART1EN at 0 range 4 .. 4;
USART6EN at 0 range 5 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
ADC1EN at 0 range 8 .. 8;
ADC2EN at 0 range 9 .. 9;
ADC3EN at 0 range 10 .. 10;
SDIOEN at 0 range 11 .. 11;
SPI1EN at 0 range 12 .. 12;
SPI4ENR at 0 range 13 .. 13;
SYSCFGEN at 0 range 14 .. 14;
Reserved_15_15 at 0 range 15 .. 15;
TIM9EN at 0 range 16 .. 16;
TIM10EN at 0 range 17 .. 17;
TIM11EN at 0 range 18 .. 18;
Reserved_19_19 at 0 range 19 .. 19;
SPI5ENR at 0 range 20 .. 20;
SPI6ENR at 0 range 21 .. 21;
SAI1EN at 0 range 22 .. 22;
Reserved_23_25 at 0 range 23 .. 25;
LTDCEN at 0 range 26 .. 26;
Reserved_27_31 at 0 range 27 .. 31;
end record;
------------------------
-- AHB1LPENR_Register --
------------------------
-- AHB1 peripheral clock enable in low power mode register
type AHB1LPENR_Register is record
-- IO port A clock enable during sleep mode
GPIOALPEN : Boolean := True;
-- IO port B clock enable during Sleep mode
GPIOBLPEN : Boolean := True;
-- IO port C clock enable during Sleep mode
GPIOCLPEN : Boolean := True;
-- IO port D clock enable during Sleep mode
GPIODLPEN : Boolean := True;
-- IO port E clock enable during Sleep mode
GPIOELPEN : Boolean := True;
-- IO port F clock enable during Sleep mode
GPIOFLPEN : Boolean := True;
-- IO port G clock enable during Sleep mode
GPIOGLPEN : Boolean := True;
-- IO port H clock enable during Sleep mode
GPIOHLPEN : Boolean := True;
-- IO port I clock enable during Sleep mode
GPIOILPEN : Boolean := True;
-- IO port J clock enable during Sleep mode
GPIOJLPEN : Boolean := False;
-- IO port K clock enable during Sleep mode
GPIOKLPEN : Boolean := False;
-- unspecified
Reserved_11_11 : HAL.Bit := 16#0#;
-- CRC clock enable during Sleep mode
CRCLPEN : Boolean := True;
-- unspecified
Reserved_13_14 : HAL.UInt2 := 16#0#;
-- Flash interface clock enable during Sleep mode
FLITFLPEN : Boolean := True;
-- SRAM 1interface clock enable during Sleep mode
SRAM1LPEN : Boolean := True;
-- SRAM 2 interface clock enable during Sleep mode
SRAM2LPEN : Boolean := True;
-- Backup SRAM interface clock enable during Sleep mode
BKPSRAMLPEN : Boolean := True;
-- SRAM 3 interface clock enable during Sleep mode
SRAM3LPEN : Boolean := False;
-- unspecified
Reserved_20_20 : HAL.Bit := 16#0#;
-- DMA1 clock enable during Sleep mode
DMA1LPEN : Boolean := True;
-- DMA2 clock enable during Sleep mode
DMA2LPEN : Boolean := True;
-- DMA2D clock enable during Sleep mode
DMA2DLPEN : Boolean := False;
-- unspecified
Reserved_24_24 : HAL.Bit := 16#0#;
-- Ethernet MAC clock enable during Sleep mode
ETHMACLPEN : Boolean := True;
-- Ethernet transmission clock enable during Sleep mode
ETHMACTXLPEN : Boolean := True;
-- Ethernet reception clock enable during Sleep mode
ETHMACRXLPEN : Boolean := True;
-- Ethernet PTP clock enable during Sleep mode
ETHMACPTPLPEN : Boolean := True;
-- USB OTG HS clock enable during Sleep mode
OTGHSLPEN : Boolean := True;
-- USB OTG HS ULPI clock enable during Sleep mode
OTGHSULPILPEN : Boolean := True;
-- unspecified
Reserved_31_31 : HAL.Bit := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for AHB1LPENR_Register use record
GPIOALPEN at 0 range 0 .. 0;
GPIOBLPEN at 0 range 1 .. 1;
GPIOCLPEN at 0 range 2 .. 2;
GPIODLPEN at 0 range 3 .. 3;
GPIOELPEN at 0 range 4 .. 4;
GPIOFLPEN at 0 range 5 .. 5;
GPIOGLPEN at 0 range 6 .. 6;
GPIOHLPEN at 0 range 7 .. 7;
GPIOILPEN at 0 range 8 .. 8;
GPIOJLPEN at 0 range 9 .. 9;
GPIOKLPEN at 0 range 10 .. 10;
Reserved_11_11 at 0 range 11 .. 11;
CRCLPEN at 0 range 12 .. 12;
Reserved_13_14 at 0 range 13 .. 14;
FLITFLPEN at 0 range 15 .. 15;
SRAM1LPEN at 0 range 16 .. 16;
SRAM2LPEN at 0 range 17 .. 17;
BKPSRAMLPEN at 0 range 18 .. 18;
SRAM3LPEN at 0 range 19 .. 19;
Reserved_20_20 at 0 range 20 .. 20;
DMA1LPEN at 0 range 21 .. 21;
DMA2LPEN at 0 range 22 .. 22;
DMA2DLPEN at 0 range 23 .. 23;
Reserved_24_24 at 0 range 24 .. 24;
ETHMACLPEN at 0 range 25 .. 25;
ETHMACTXLPEN at 0 range 26 .. 26;
ETHMACRXLPEN at 0 range 27 .. 27;
ETHMACPTPLPEN at 0 range 28 .. 28;
OTGHSLPEN at 0 range 29 .. 29;
OTGHSULPILPEN at 0 range 30 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
------------------------
-- AHB2LPENR_Register --
------------------------
-- AHB2 peripheral clock enable in low power mode register
type AHB2LPENR_Register is record
-- Camera interface enable during Sleep mode
DCMILPEN : Boolean := True;
-- unspecified
Reserved_1_5 : HAL.UInt5 := 16#18#;
-- Random number generator clock enable during Sleep mode
RNGLPEN : Boolean := True;
-- USB OTG FS clock enable during Sleep mode
OTGFSLPEN : Boolean := True;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for AHB2LPENR_Register use record
DCMILPEN at 0 range 0 .. 0;
Reserved_1_5 at 0 range 1 .. 5;
RNGLPEN at 0 range 6 .. 6;
OTGFSLPEN at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
------------------------
-- AHB3LPENR_Register --
------------------------
-- AHB3 peripheral clock enable in low power mode register
type AHB3LPENR_Register is record
-- Flexible memory controller module clock enable during Sleep mode
FMCLPEN : Boolean := True;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for AHB3LPENR_Register use record
FMCLPEN at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
------------------------
-- APB1LPENR_Register --
------------------------
-- APB1 peripheral clock enable in low power mode register
type APB1LPENR_Register is record
-- TIM2 clock enable during Sleep mode
TIM2LPEN : Boolean := True;
-- TIM3 clock enable during Sleep mode
TIM3LPEN : Boolean := True;
-- TIM4 clock enable during Sleep mode
TIM4LPEN : Boolean := True;
-- TIM5 clock enable during Sleep mode
TIM5LPEN : Boolean := True;
-- TIM6 clock enable during Sleep mode
TIM6LPEN : Boolean := True;
-- TIM7 clock enable during Sleep mode
TIM7LPEN : Boolean := True;
-- TIM12 clock enable during Sleep mode
TIM12LPEN : Boolean := True;
-- TIM13 clock enable during Sleep mode
TIM13LPEN : Boolean := True;
-- TIM14 clock enable during Sleep mode
TIM14LPEN : Boolean := True;
-- unspecified
Reserved_9_10 : HAL.UInt2 := 16#0#;
-- Window watchdog clock enable during Sleep mode
WWDGLPEN : Boolean := True;
-- unspecified
Reserved_12_13 : HAL.UInt2 := 16#0#;
-- SPI2 clock enable during Sleep mode
SPI2LPEN : Boolean := True;
-- SPI3 clock enable during Sleep mode
SPI3LPEN : Boolean := True;
-- unspecified
Reserved_16_16 : HAL.Bit := 16#0#;
-- USART2 clock enable during Sleep mode
USART2LPEN : Boolean := True;
-- USART3 clock enable during Sleep mode
USART3LPEN : Boolean := True;
-- UART4 clock enable during Sleep mode
UART4LPEN : Boolean := True;
-- UART5 clock enable during Sleep mode
UART5LPEN : Boolean := True;
-- I2C1 clock enable during Sleep mode
I2C1LPEN : Boolean := True;
-- I2C2 clock enable during Sleep mode
I2C2LPEN : Boolean := True;
-- I2C3 clock enable during Sleep mode
I2C3LPEN : Boolean := True;
-- unspecified
Reserved_24_24 : HAL.Bit := 16#0#;
-- CAN 1 clock enable during Sleep mode
CAN1LPEN : Boolean := True;
-- CAN 2 clock enable during Sleep mode
CAN2LPEN : Boolean := True;
-- unspecified
Reserved_27_27 : HAL.Bit := 16#0#;
-- Power interface clock enable during Sleep mode
PWRLPEN : Boolean := True;
-- DAC interface clock enable during Sleep mode
DACLPEN : Boolean := True;
-- UART7 clock enable during Sleep mode
UART7LPEN : Boolean := False;
-- UART8 clock enable during Sleep mode
UART8LPEN : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for APB1LPENR_Register use record
TIM2LPEN at 0 range 0 .. 0;
TIM3LPEN at 0 range 1 .. 1;
TIM4LPEN at 0 range 2 .. 2;
TIM5LPEN at 0 range 3 .. 3;
TIM6LPEN at 0 range 4 .. 4;
TIM7LPEN at 0 range 5 .. 5;
TIM12LPEN at 0 range 6 .. 6;
TIM13LPEN at 0 range 7 .. 7;
TIM14LPEN at 0 range 8 .. 8;
Reserved_9_10 at 0 range 9 .. 10;
WWDGLPEN at 0 range 11 .. 11;
Reserved_12_13 at 0 range 12 .. 13;
SPI2LPEN at 0 range 14 .. 14;
SPI3LPEN at 0 range 15 .. 15;
Reserved_16_16 at 0 range 16 .. 16;
USART2LPEN at 0 range 17 .. 17;
USART3LPEN at 0 range 18 .. 18;
UART4LPEN at 0 range 19 .. 19;
UART5LPEN at 0 range 20 .. 20;
I2C1LPEN at 0 range 21 .. 21;
I2C2LPEN at 0 range 22 .. 22;
I2C3LPEN at 0 range 23 .. 23;
Reserved_24_24 at 0 range 24 .. 24;
CAN1LPEN at 0 range 25 .. 25;
CAN2LPEN at 0 range 26 .. 26;
Reserved_27_27 at 0 range 27 .. 27;
PWRLPEN at 0 range 28 .. 28;
DACLPEN at 0 range 29 .. 29;
UART7LPEN at 0 range 30 .. 30;
UART8LPEN at 0 range 31 .. 31;
end record;
------------------------
-- APB2LPENR_Register --
------------------------
-- APB2 peripheral clock enabled in low power mode register
type APB2LPENR_Register is record
-- TIM1 clock enable during Sleep mode
TIM1LPEN : Boolean := True;
-- TIM8 clock enable during Sleep mode
TIM8LPEN : Boolean := True;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- USART1 clock enable during Sleep mode
USART1LPEN : Boolean := True;
-- USART6 clock enable during Sleep mode
USART6LPEN : Boolean := True;
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
-- ADC1 clock enable during Sleep mode
ADC1LPEN : Boolean := True;
-- ADC2 clock enable during Sleep mode
ADC2LPEN : Boolean := True;
-- ADC 3 clock enable during Sleep mode
ADC3LPEN : Boolean := True;
-- SDIO clock enable during Sleep mode
SDIOLPEN : Boolean := True;
-- SPI 1 clock enable during Sleep mode
SPI1LPEN : Boolean := True;
-- SPI 4 clock enable during Sleep mode
SPI4LPEN : Boolean := False;
-- System configuration controller clock enable during Sleep mode
SYSCFGLPEN : Boolean := True;
-- unspecified
Reserved_15_15 : HAL.Bit := 16#0#;
-- TIM9 clock enable during sleep mode
TIM9LPEN : Boolean := True;
-- TIM10 clock enable during Sleep mode
TIM10LPEN : Boolean := True;
-- TIM11 clock enable during Sleep mode
TIM11LPEN : Boolean := True;
-- unspecified
Reserved_19_19 : HAL.Bit := 16#0#;
-- SPI 5 clock enable during Sleep mode
SPI5LPEN : Boolean := False;
-- SPI 6 clock enable during Sleep mode
SPI6LPEN : Boolean := False;
-- SAI1 clock enable
SAI1LPEN : Boolean := False;
-- unspecified
Reserved_23_25 : HAL.UInt3 := 16#0#;
-- LTDC clock enable
LTDCLPEN : Boolean := False;
-- unspecified
Reserved_27_31 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for APB2LPENR_Register use record
TIM1LPEN at 0 range 0 .. 0;
TIM8LPEN at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
USART1LPEN at 0 range 4 .. 4;
USART6LPEN at 0 range 5 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
ADC1LPEN at 0 range 8 .. 8;
ADC2LPEN at 0 range 9 .. 9;
ADC3LPEN at 0 range 10 .. 10;
SDIOLPEN at 0 range 11 .. 11;
SPI1LPEN at 0 range 12 .. 12;
SPI4LPEN at 0 range 13 .. 13;
SYSCFGLPEN at 0 range 14 .. 14;
Reserved_15_15 at 0 range 15 .. 15;
TIM9LPEN at 0 range 16 .. 16;
TIM10LPEN at 0 range 17 .. 17;
TIM11LPEN at 0 range 18 .. 18;
Reserved_19_19 at 0 range 19 .. 19;
SPI5LPEN at 0 range 20 .. 20;
SPI6LPEN at 0 range 21 .. 21;
SAI1LPEN at 0 range 22 .. 22;
Reserved_23_25 at 0 range 23 .. 25;
LTDCLPEN at 0 range 26 .. 26;
Reserved_27_31 at 0 range 27 .. 31;
end record;
-------------------
-- BDCR_Register --
-------------------
-----------------
-- BDCR.RTCSEL --
-----------------
-- BDCR_RTCSEL array
type BDCR_RTCSEL_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for BDCR_RTCSEL
type BDCR_RTCSEL_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- RTCSEL as a value
Val : HAL.UInt2;
when True =>
-- RTCSEL as an array
Arr : BDCR_RTCSEL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for BDCR_RTCSEL_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Backup domain control register
type BDCR_Register is record
-- External low-speed oscillator enable
LSEON : Boolean := False;
-- Read-only. External low-speed oscillator ready
LSERDY : Boolean := False;
-- External low-speed oscillator bypass
LSEBYP : Boolean := False;
-- unspecified
Reserved_3_7 : HAL.UInt5 := 16#0#;
-- RTC clock source selection
RTCSEL : BDCR_RTCSEL_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_10_14 : HAL.UInt5 := 16#0#;
-- RTC clock enable
RTCEN : Boolean := False;
-- Backup domain software reset
BDRST : Boolean := False;
-- unspecified
Reserved_17_31 : HAL.UInt15 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BDCR_Register use record
LSEON at 0 range 0 .. 0;
LSERDY at 0 range 1 .. 1;
LSEBYP at 0 range 2 .. 2;
Reserved_3_7 at 0 range 3 .. 7;
RTCSEL at 0 range 8 .. 9;
Reserved_10_14 at 0 range 10 .. 14;
RTCEN at 0 range 15 .. 15;
BDRST at 0 range 16 .. 16;
Reserved_17_31 at 0 range 17 .. 31;
end record;
------------------
-- CSR_Register --
------------------
-- clock control & status register
type CSR_Register is record
-- Internal low-speed oscillator enable
LSION : Boolean := False;
-- Read-only. Internal low-speed oscillator ready
LSIRDY : Boolean := False;
-- unspecified
Reserved_2_23 : HAL.UInt22 := 16#0#;
-- Remove reset flag
RMVF : Boolean := False;
-- BOR reset flag
BORRSTF : Boolean := True;
-- PIN reset flag
PADRSTF : Boolean := True;
-- POR/PDR reset flag
PORRSTF : Boolean := True;
-- Software reset flag
SFTRSTF : Boolean := False;
-- Independent watchdog reset flag
WDGRSTF : Boolean := False;
-- Window watchdog reset flag
WWDGRSTF : Boolean := False;
-- Low-power reset flag
LPWRRSTF : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CSR_Register use record
LSION at 0 range 0 .. 0;
LSIRDY at 0 range 1 .. 1;
Reserved_2_23 at 0 range 2 .. 23;
RMVF at 0 range 24 .. 24;
BORRSTF at 0 range 25 .. 25;
PADRSTF at 0 range 26 .. 26;
PORRSTF at 0 range 27 .. 27;
SFTRSTF at 0 range 28 .. 28;
WDGRSTF at 0 range 29 .. 29;
WWDGRSTF at 0 range 30 .. 30;
LPWRRSTF at 0 range 31 .. 31;
end record;
--------------------
-- SSCGR_Register --
--------------------
subtype SSCGR_MODPER_Field is HAL.UInt13;
subtype SSCGR_INCSTEP_Field is HAL.UInt15;
-- spread spectrum clock generation register
type SSCGR_Register is record
-- Modulation period
MODPER : SSCGR_MODPER_Field := 16#0#;
-- Incrementation step
INCSTEP : SSCGR_INCSTEP_Field := 16#0#;
-- unspecified
Reserved_28_29 : HAL.UInt2 := 16#0#;
-- Spread Select
SPREADSEL : Boolean := False;
-- Spread spectrum modulation enable
SSCGEN : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SSCGR_Register use record
MODPER at 0 range 0 .. 12;
INCSTEP at 0 range 13 .. 27;
Reserved_28_29 at 0 range 28 .. 29;
SPREADSEL at 0 range 30 .. 30;
SSCGEN at 0 range 31 .. 31;
end record;
-------------------------
-- PLLI2SCFGR_Register --
-------------------------
subtype PLLI2SCFGR_PLLI2SN_Field is HAL.UInt9;
subtype PLLI2SCFGR_PLLI2SQ_Field is HAL.UInt4;
subtype PLLI2SCFGR_PLLI2SR_Field is HAL.UInt3;
-- PLLI2S configuration register
type PLLI2SCFGR_Register is record
-- unspecified
Reserved_0_5 : HAL.UInt6 := 16#0#;
-- PLLI2S multiplication factor for VCO
PLLI2SN : PLLI2SCFGR_PLLI2SN_Field := 16#C0#;
-- unspecified
Reserved_15_23 : HAL.UInt9 := 16#0#;
-- PLLI2S division factor for SAI1 clock
PLLI2SQ : PLLI2SCFGR_PLLI2SQ_Field := 16#0#;
-- PLLI2S division factor for I2S clocks
PLLI2SR : PLLI2SCFGR_PLLI2SR_Field := 16#2#;
-- unspecified
Reserved_31_31 : HAL.Bit := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PLLI2SCFGR_Register use record
Reserved_0_5 at 0 range 0 .. 5;
PLLI2SN at 0 range 6 .. 14;
Reserved_15_23 at 0 range 15 .. 23;
PLLI2SQ at 0 range 24 .. 27;
PLLI2SR at 0 range 28 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
-------------------------
-- PLLSAICFGR_Register --
-------------------------
subtype PLLSAICFGR_PLLSAIN_Field is HAL.UInt9;
subtype PLLSAICFGR_PLLSAIQ_Field is HAL.UInt4;
subtype PLLSAICFGR_PLLSAIR_Field is HAL.UInt3;
-- PLLSAICFGR
type PLLSAICFGR_Register is record
-- unspecified
Reserved_0_5 : HAL.UInt6 := 16#0#;
-- PLLSAIN
PLLSAIN : PLLSAICFGR_PLLSAIN_Field := 16#C0#;
-- unspecified
Reserved_15_23 : HAL.UInt9 := 16#0#;
-- PLLSAIN
PLLSAIQ : PLLSAICFGR_PLLSAIQ_Field := 16#4#;
-- PLLSAIN
PLLSAIR : PLLSAICFGR_PLLSAIR_Field := 16#2#;
-- unspecified
Reserved_31_31 : HAL.Bit := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PLLSAICFGR_Register use record
Reserved_0_5 at 0 range 0 .. 5;
PLLSAIN at 0 range 6 .. 14;
Reserved_15_23 at 0 range 15 .. 23;
PLLSAIQ at 0 range 24 .. 27;
PLLSAIR at 0 range 28 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
----------------------
-- DCKCFGR_Register --
----------------------
subtype DCKCFGR_PLLI2SDIVQ_Field is HAL.UInt5;
subtype DCKCFGR_PLLSAIDIVQ_Field is HAL.UInt5;
subtype DCKCFGR_PLLSAIDIVR_Field is HAL.UInt2;
subtype DCKCFGR_SAI1ASRC_Field is HAL.UInt2;
subtype DCKCFGR_SAI1BSRC_Field is HAL.UInt2;
-- DCKCFGR
type DCKCFGR_Register is record
-- PLLI2SDIVQ
PLLI2SDIVQ : DCKCFGR_PLLI2SDIVQ_Field := 16#0#;
-- unspecified
Reserved_5_7 : HAL.UInt3 := 16#0#;
-- PLLSAIDIVQ
PLLSAIDIVQ : DCKCFGR_PLLSAIDIVQ_Field := 16#0#;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
-- PLLSAIDIVR
PLLSAIDIVR : DCKCFGR_PLLSAIDIVR_Field := 16#0#;
-- unspecified
Reserved_18_19 : HAL.UInt2 := 16#0#;
-- SAI1ASRC
SAI1ASRC : DCKCFGR_SAI1ASRC_Field := 16#0#;
-- SAI1BSRC
SAI1BSRC : DCKCFGR_SAI1BSRC_Field := 16#0#;
-- TIMPRE
TIMPRE : Boolean := False;
-- unspecified
Reserved_25_31 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DCKCFGR_Register use record
PLLI2SDIVQ at 0 range 0 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
PLLSAIDIVQ at 0 range 8 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
PLLSAIDIVR at 0 range 16 .. 17;
Reserved_18_19 at 0 range 18 .. 19;
SAI1ASRC at 0 range 20 .. 21;
SAI1BSRC at 0 range 22 .. 23;
TIMPRE at 0 range 24 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Reset and clock control
type RCC_Peripheral is record
-- clock control register
CR : CR_Register;
-- PLL configuration register
PLLCFGR : PLLCFGR_Register;
-- clock configuration register
CFGR : CFGR_Register;
-- clock interrupt register
CIR : CIR_Register;
-- AHB1 peripheral reset register
AHB1RSTR : AHB1RSTR_Register;
-- AHB2 peripheral reset register
AHB2RSTR : AHB2RSTR_Register;
-- AHB3 peripheral reset register
AHB3RSTR : AHB3RSTR_Register;
-- APB1 peripheral reset register
APB1RSTR : APB1RSTR_Register;
-- APB2 peripheral reset register
APB2RSTR : APB2RSTR_Register;
-- AHB1 peripheral clock register
AHB1ENR : AHB1ENR_Register;
-- AHB2 peripheral clock enable register
AHB2ENR : AHB2ENR_Register;
-- AHB3 peripheral clock enable register
AHB3ENR : AHB3ENR_Register;
-- APB1 peripheral clock enable register
APB1ENR : APB1ENR_Register;
-- APB2 peripheral clock enable register
APB2ENR : APB2ENR_Register;
-- AHB1 peripheral clock enable in low power mode register
AHB1LPENR : AHB1LPENR_Register;
-- AHB2 peripheral clock enable in low power mode register
AHB2LPENR : AHB2LPENR_Register;
-- AHB3 peripheral clock enable in low power mode register
AHB3LPENR : AHB3LPENR_Register;
-- APB1 peripheral clock enable in low power mode register
APB1LPENR : APB1LPENR_Register;
-- APB2 peripheral clock enabled in low power mode register
APB2LPENR : APB2LPENR_Register;
-- Backup domain control register
BDCR : BDCR_Register;
-- clock control & status register
CSR : CSR_Register;
-- spread spectrum clock generation register
SSCGR : SSCGR_Register;
-- PLLI2S configuration register
PLLI2SCFGR : PLLI2SCFGR_Register;
-- PLLSAICFGR
PLLSAICFGR : PLLSAICFGR_Register;
-- DCKCFGR
DCKCFGR : DCKCFGR_Register;
end record
with Volatile;
for RCC_Peripheral use record
CR at 0 range 0 .. 31;
PLLCFGR at 4 range 0 .. 31;
CFGR at 8 range 0 .. 31;
CIR at 12 range 0 .. 31;
AHB1RSTR at 16 range 0 .. 31;
AHB2RSTR at 20 range 0 .. 31;
AHB3RSTR at 24 range 0 .. 31;
APB1RSTR at 32 range 0 .. 31;
APB2RSTR at 36 range 0 .. 31;
AHB1ENR at 48 range 0 .. 31;
AHB2ENR at 52 range 0 .. 31;
AHB3ENR at 56 range 0 .. 31;
APB1ENR at 64 range 0 .. 31;
APB2ENR at 68 range 0 .. 31;
AHB1LPENR at 80 range 0 .. 31;
AHB2LPENR at 84 range 0 .. 31;
AHB3LPENR at 88 range 0 .. 31;
APB1LPENR at 96 range 0 .. 31;
APB2LPENR at 100 range 0 .. 31;
BDCR at 112 range 0 .. 31;
CSR at 116 range 0 .. 31;
SSCGR at 128 range 0 .. 31;
PLLI2SCFGR at 132 range 0 .. 31;
PLLSAICFGR at 136 range 0 .. 31;
DCKCFGR at 140 range 0 .. 31;
end record;
-- Reset and clock control
RCC_Periph : aliased RCC_Peripheral
with Import, Address => RCC_Base;
end STM32_SVD.RCC;
|
byllgrim/iictl | Ada | 1,168 | ads | with Ada.Directories;
with Ada.Strings.Unbounded;
with Iictl;
with Posix;
with Util;
package Srv_Conn is
-- TODO rename Server_Reconnection or something?
procedure Reconnect_Servers (Irc_Dir : in String; Nick : in String);
procedure Maintain_Connection
(Dir_Ent : in Ada.Directories.Directory_Entry_Type;
Nick : in String);
procedure Spawn_Client (Srv_Name : in String; Nick : in String);
procedure Respawn_Clients (Server_List : Util.Unbounded_String_Vector;
Process_List : Util.Unbounded_String_Vector);
procedure Reap_Defunct_Procs;
function Is_Srv_Dir
(Dir_Ent : in Ada.Directories.Directory_Entry_Type) return Boolean;
-- TODO use private?
function Scan_Server_Directory (Irc_Dir : in String)
return Util.Unbounded_String_Vector;
function Scan_Ii_Procs return Util.Unbounded_String_Vector;
-- TODO sort
function Is_Ii_Proc (Dir_Ent : in Ada.Directories.Directory_Entry_Type)
return Boolean;
function Get_Server_Name (Dir_Ent : in Ada.Directories.Directory_Entry_Type)
return Ada.Strings.Unbounded.Unbounded_String;
end Srv_Conn;
|
optikos/oasis | Ada | 1,667 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Statements;
with Program.Lexical_Elements;
with Program.Elements.Expressions;
package Program.Elements.Exit_Statements is
pragma Pure (Program.Elements.Exit_Statements);
type Exit_Statement is
limited interface and Program.Elements.Statements.Statement;
type Exit_Statement_Access is access all Exit_Statement'Class
with Storage_Size => 0;
not overriding function Exit_Loop_Name
(Self : Exit_Statement)
return Program.Elements.Expressions.Expression_Access is abstract;
not overriding function Condition
(Self : Exit_Statement)
return Program.Elements.Expressions.Expression_Access is abstract;
type Exit_Statement_Text is limited interface;
type Exit_Statement_Text_Access is access all Exit_Statement_Text'Class
with Storage_Size => 0;
not overriding function To_Exit_Statement_Text
(Self : aliased in out Exit_Statement)
return Exit_Statement_Text_Access is abstract;
not overriding function Exit_Token
(Self : Exit_Statement_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function When_Token
(Self : Exit_Statement_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Semicolon_Token
(Self : Exit_Statement_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Exit_Statements;
|
reznikmm/matreshka | Ada | 38,219 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Internals.UML_Associations;
with AMF.String_Collections;
with AMF.UML.Classes;
with AMF.UML.Classifier_Template_Parameters;
with AMF.UML.Classifiers.Collections;
with AMF.UML.Collaboration_Uses.Collections;
with AMF.UML.Constraints.Collections;
with AMF.UML.Dependencies.Collections;
with AMF.UML.Element_Imports.Collections;
with AMF.UML.Elements.Collections;
with AMF.UML.Extension_Ends;
with AMF.UML.Extensions;
with AMF.UML.Features.Collections;
with AMF.UML.Generalization_Sets.Collections;
with AMF.UML.Generalizations.Collections;
with AMF.UML.Named_Elements.Collections;
with AMF.UML.Namespaces;
with AMF.UML.Package_Imports.Collections;
with AMF.UML.Packageable_Elements.Collections;
with AMF.UML.Packages.Collections;
with AMF.UML.Parameterable_Elements.Collections;
with AMF.UML.Properties.Collections;
with AMF.UML.Redefinable_Elements.Collections;
with AMF.UML.Redefinable_Template_Signatures;
with AMF.UML.String_Expressions;
with AMF.UML.Substitutions.Collections;
with AMF.UML.Template_Bindings.Collections;
with AMF.UML.Template_Parameters;
with AMF.UML.Template_Signatures;
with AMF.UML.Types.Collections;
with AMF.UML.Use_Cases.Collections;
with AMF.Visitors;
package AMF.Internals.UML_Extensions is
type UML_Extension_Proxy is
limited new AMF.Internals.UML_Associations.UML_Association_Proxy
and AMF.UML.Extensions.UML_Extension with null record;
overriding function Get_Is_Required
(Self : not null access constant UML_Extension_Proxy)
return Boolean;
-- Getter of Extension::isRequired.
--
-- Indicates whether an instance of the extending stereotype must be
-- created when an instance of the extended class is created. The
-- attribute value is derived from the value of the lower property of the
-- ExtensionEnd referenced by Extension::ownedEnd; a lower value of 1
-- means that isRequired is true, but otherwise it is false. Since the
-- default value of ExtensionEnd::lower is 0, the default value of
-- isRequired is false.
overriding function Get_Metaclass
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Classes.UML_Class_Access;
-- Getter of Extension::metaclass.
--
-- References the Class that is extended through an Extension. The
-- property is derived from the type of the memberEnd that is not the
-- ownedEnd.
overriding function Get_Owned_End
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Extension_Ends.UML_Extension_End_Access;
-- Getter of Extension::ownedEnd.
--
-- References the end of the extension that is typed by a Stereotype.
overriding procedure Set_Owned_End
(Self : not null access UML_Extension_Proxy;
To : AMF.UML.Extension_Ends.UML_Extension_End_Access);
-- Setter of Extension::ownedEnd.
--
-- References the end of the extension that is typed by a Stereotype.
overriding function Get_End_Type
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Types.Collections.Ordered_Set_Of_UML_Type;
-- Getter of Association::endType.
--
-- References the classifiers that are used as types of the ends of the
-- association.
overriding function Get_Is_Derived
(Self : not null access constant UML_Extension_Proxy)
return Boolean;
-- Getter of Association::isDerived.
--
-- Specifies whether the association is derived from other model elements
-- such as other associations or constraints.
overriding procedure Set_Is_Derived
(Self : not null access UML_Extension_Proxy;
To : Boolean);
-- Setter of Association::isDerived.
--
-- Specifies whether the association is derived from other model elements
-- such as other associations or constraints.
overriding function Get_Member_End
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property;
-- Getter of Association::memberEnd.
--
-- Each end represents participation of instances of the classifier
-- connected to the end in links of the association.
overriding function Get_Navigable_Owned_End
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Properties.Collections.Set_Of_UML_Property;
-- Getter of Association::navigableOwnedEnd.
--
-- The navigable ends that are owned by the association itself.
overriding function Get_Owned_End
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property;
-- Getter of Association::ownedEnd.
--
-- The ends that are owned by the association itself.
overriding function Get_Related_Element
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element;
-- Getter of Relationship::relatedElement.
--
-- Specifies the elements related by the Relationship.
overriding function Get_Attribute
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Properties.Collections.Set_Of_UML_Property;
-- Getter of Classifier::attribute.
--
-- Refers to all of the Properties that are direct (i.e. not inherited or
-- imported) attributes of the classifier.
overriding function Get_Collaboration_Use
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Collaboration_Uses.Collections.Set_Of_UML_Collaboration_Use;
-- Getter of Classifier::collaborationUse.
--
-- References the collaboration uses owned by the classifier.
overriding function Get_Feature
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Features.Collections.Set_Of_UML_Feature;
-- Getter of Classifier::feature.
--
-- Specifies each feature defined in the classifier.
-- Note that there may be members of the Classifier that are of the type
-- Feature but are not included in this association, e.g. inherited
-- features.
overriding function Get_General
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Getter of Classifier::general.
--
-- Specifies the general Classifiers for this Classifier.
-- References the general classifier in the Generalization relationship.
overriding function Get_Generalization
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization;
-- Getter of Classifier::generalization.
--
-- Specifies the Generalization relationships for this Classifier. These
-- Generalizations navigaten to more general classifiers in the
-- generalization hierarchy.
overriding function Get_Inherited_Member
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Getter of Classifier::inheritedMember.
--
-- Specifies all elements inherited by this classifier from the general
-- classifiers.
overriding function Get_Is_Abstract
(Self : not null access constant UML_Extension_Proxy)
return Boolean;
-- Getter of Classifier::isAbstract.
--
-- If true, the Classifier does not provide a complete declaration and can
-- typically not be instantiated. An abstract classifier is intended to be
-- used by other classifiers e.g. as the target of general
-- metarelationships or generalization relationships.
overriding function Get_Is_Final_Specialization
(Self : not null access constant UML_Extension_Proxy)
return Boolean;
-- Getter of Classifier::isFinalSpecialization.
--
-- If true, the Classifier cannot be specialized by generalization. Note
-- that this property is preserved through package merge operations; that
-- is, the capability to specialize a Classifier (i.e.,
-- isFinalSpecialization =false) must be preserved in the resulting
-- Classifier of a package merge operation where a Classifier with
-- isFinalSpecialization =false is merged with a matching Classifier with
-- isFinalSpecialization =true: the resulting Classifier will have
-- isFinalSpecialization =false.
overriding procedure Set_Is_Final_Specialization
(Self : not null access UML_Extension_Proxy;
To : Boolean);
-- Setter of Classifier::isFinalSpecialization.
--
-- If true, the Classifier cannot be specialized by generalization. Note
-- that this property is preserved through package merge operations; that
-- is, the capability to specialize a Classifier (i.e.,
-- isFinalSpecialization =false) must be preserved in the resulting
-- Classifier of a package merge operation where a Classifier with
-- isFinalSpecialization =false is merged with a matching Classifier with
-- isFinalSpecialization =true: the resulting Classifier will have
-- isFinalSpecialization =false.
overriding function Get_Owned_Template_Signature
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access;
-- Getter of Classifier::ownedTemplateSignature.
--
-- The optional template signature specifying the formal template
-- parameters.
overriding procedure Set_Owned_Template_Signature
(Self : not null access UML_Extension_Proxy;
To : AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access);
-- Setter of Classifier::ownedTemplateSignature.
--
-- The optional template signature specifying the formal template
-- parameters.
overriding function Get_Owned_Use_Case
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case;
-- Getter of Classifier::ownedUseCase.
--
-- References the use cases owned by this classifier.
overriding function Get_Powertype_Extent
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Generalization_Sets.Collections.Set_Of_UML_Generalization_Set;
-- Getter of Classifier::powertypeExtent.
--
-- Designates the GeneralizationSet of which the associated Classifier is
-- a power type.
overriding function Get_Redefined_Classifier
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Getter of Classifier::redefinedClassifier.
--
-- References the Classifiers that are redefined by this Classifier.
overriding function Get_Representation
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access;
-- Getter of Classifier::representation.
--
-- References a collaboration use which indicates the collaboration that
-- represents this classifier.
overriding procedure Set_Representation
(Self : not null access UML_Extension_Proxy;
To : AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access);
-- Setter of Classifier::representation.
--
-- References a collaboration use which indicates the collaboration that
-- represents this classifier.
overriding function Get_Substitution
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Substitutions.Collections.Set_Of_UML_Substitution;
-- Getter of Classifier::substitution.
--
-- References the substitutions that are owned by this Classifier.
overriding function Get_Template_Parameter
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access;
-- Getter of Classifier::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding procedure Set_Template_Parameter
(Self : not null access UML_Extension_Proxy;
To : AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access);
-- Setter of Classifier::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding function Get_Use_Case
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case;
-- Getter of Classifier::useCase.
--
-- The set of use cases for which this Classifier is the subject.
overriding function Get_Element_Import
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import;
-- Getter of Namespace::elementImport.
--
-- References the ElementImports owned by the Namespace.
overriding function Get_Imported_Member
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Getter of Namespace::importedMember.
--
-- References the PackageableElements that are members of this Namespace
-- as a result of either PackageImports or ElementImports.
overriding function Get_Member
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Getter of Namespace::member.
--
-- A collection of NamedElements identifiable within the Namespace, either
-- by being owned or by being introduced by importing or inheritance.
overriding function Get_Owned_Member
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Getter of Namespace::ownedMember.
--
-- A collection of NamedElements owned by the Namespace.
overriding function Get_Owned_Rule
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint;
-- Getter of Namespace::ownedRule.
--
-- Specifies a set of Constraints owned by this Namespace.
overriding function Get_Package_Import
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import;
-- Getter of Namespace::packageImport.
--
-- References the PackageImports owned by the Namespace.
overriding function Get_Client_Dependency
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency;
-- Getter of NamedElement::clientDependency.
--
-- Indicates the dependencies that reference the client.
overriding function Get_Name_Expression
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access;
-- Getter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding procedure Set_Name_Expression
(Self : not null access UML_Extension_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access);
-- Setter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding function Get_Namespace
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Getter of NamedElement::namespace.
--
-- Specifies the namespace that owns the NamedElement.
overriding function Get_Qualified_Name
(Self : not null access constant UML_Extension_Proxy)
return AMF.Optional_String;
-- Getter of NamedElement::qualifiedName.
--
-- A name which allows the NamedElement to be identified within a
-- hierarchy of nested Namespaces. It is constructed from the names of the
-- containing namespaces starting at the root of the hierarchy and ending
-- with the name of the NamedElement itself.
overriding function Get_Package
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Packages.UML_Package_Access;
-- Getter of Type::package.
--
-- Specifies the owning package of this classifier, if any.
overriding procedure Set_Package
(Self : not null access UML_Extension_Proxy;
To : AMF.UML.Packages.UML_Package_Access);
-- Setter of Type::package.
--
-- Specifies the owning package of this classifier, if any.
overriding function Get_Owning_Template_Parameter
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
-- Getter of ParameterableElement::owningTemplateParameter.
--
-- The formal template parameter that owns this element.
overriding procedure Set_Owning_Template_Parameter
(Self : not null access UML_Extension_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
-- Setter of ParameterableElement::owningTemplateParameter.
--
-- The formal template parameter that owns this element.
overriding function Get_Template_Parameter
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
-- Getter of ParameterableElement::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding procedure Set_Template_Parameter
(Self : not null access UML_Extension_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
-- Setter of ParameterableElement::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding function Get_Owned_Template_Signature
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Template_Signatures.UML_Template_Signature_Access;
-- Getter of TemplateableElement::ownedTemplateSignature.
--
-- The optional template signature specifying the formal template
-- parameters.
overriding procedure Set_Owned_Template_Signature
(Self : not null access UML_Extension_Proxy;
To : AMF.UML.Template_Signatures.UML_Template_Signature_Access);
-- Setter of TemplateableElement::ownedTemplateSignature.
--
-- The optional template signature specifying the formal template
-- parameters.
overriding function Get_Template_Binding
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding;
-- Getter of TemplateableElement::templateBinding.
--
-- The optional bindings from this element to templates.
overriding function Get_Is_Leaf
(Self : not null access constant UML_Extension_Proxy)
return Boolean;
-- Getter of RedefinableElement::isLeaf.
--
-- Indicates whether it is possible to further redefine a
-- RedefinableElement. If the value is true, then it is not possible to
-- further redefine the RedefinableElement. Note that this property is
-- preserved through package merge operations; that is, the capability to
-- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in
-- the resulting RedefinableElement of a package merge operation where a
-- RedefinableElement with isLeaf=false is merged with a matching
-- RedefinableElement with isLeaf=true: the resulting RedefinableElement
-- will have isLeaf=false. Default value is false.
overriding procedure Set_Is_Leaf
(Self : not null access UML_Extension_Proxy;
To : Boolean);
-- Setter of RedefinableElement::isLeaf.
--
-- Indicates whether it is possible to further redefine a
-- RedefinableElement. If the value is true, then it is not possible to
-- further redefine the RedefinableElement. Note that this property is
-- preserved through package merge operations; that is, the capability to
-- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in
-- the resulting RedefinableElement of a package merge operation where a
-- RedefinableElement with isLeaf=false is merged with a matching
-- RedefinableElement with isLeaf=true: the resulting RedefinableElement
-- will have isLeaf=false. Default value is false.
overriding function Get_Redefined_Element
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element;
-- Getter of RedefinableElement::redefinedElement.
--
-- The redefinable element that is being redefined by this element.
overriding function Get_Redefinition_Context
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Getter of RedefinableElement::redefinitionContext.
--
-- References the contexts that this element may be redefined from.
overriding function Is_Required
(Self : not null access constant UML_Extension_Proxy)
return Boolean;
-- Operation Extension::isRequired.
--
-- The query isRequired() is true if the owned end has a multiplicity with
-- the lower bound of 1.
overriding function Metaclass
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Classes.UML_Class_Access;
-- Operation Extension::metaclass.
--
-- The query metaclass() returns the metaclass that is being extended (as
-- opposed to the extending stereotype).
overriding function Metaclass_End
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Properties.UML_Property_Access;
-- Operation Extension::metaclassEnd.
--
-- The query metaclassEnd() returns the Property that is typed by a
-- metaclass (as opposed to a stereotype).
overriding function End_Type
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Types.Collections.Ordered_Set_Of_UML_Type;
-- Operation Association::endType.
--
-- endType is derived from the types of the member ends.
overriding function All_Features
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Features.Collections.Set_Of_UML_Feature;
-- Operation Classifier::allFeatures.
--
-- The query allFeatures() gives all of the features in the namespace of
-- the classifier. In general, through mechanisms such as inheritance,
-- this will be a larger set than feature.
overriding function Conforms_To
(Self : not null access constant UML_Extension_Proxy;
Other : AMF.UML.Classifiers.UML_Classifier_Access)
return Boolean;
-- Operation Classifier::conformsTo.
--
-- The query conformsTo() gives true for a classifier that defines a type
-- that conforms to another. This is used, for example, in the
-- specification of signature conformance for operations.
overriding function General
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Operation Classifier::general.
--
-- The general classifiers are the classifiers referenced by the
-- generalization relationships.
overriding function Has_Visibility_Of
(Self : not null access constant UML_Extension_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access)
return Boolean;
-- Operation Classifier::hasVisibilityOf.
--
-- The query hasVisibilityOf() determines whether a named element is
-- visible in the classifier. By default all are visible. It is only
-- called when the argument is something owned by a parent.
overriding function Inherit
(Self : not null access constant UML_Extension_Proxy;
Inhs : AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Operation Classifier::inherit.
--
-- The query inherit() defines how to inherit a set of elements. Here the
-- operation is defined to inherit them all. It is intended to be
-- redefined in circumstances where inheritance is affected by
-- redefinition.
-- The inherit operation is overridden to exclude redefined properties.
overriding function Inheritable_Members
(Self : not null access constant UML_Extension_Proxy;
C : AMF.UML.Classifiers.UML_Classifier_Access)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Operation Classifier::inheritableMembers.
--
-- The query inheritableMembers() gives all of the members of a classifier
-- that may be inherited in one of its descendants, subject to whatever
-- visibility restrictions apply.
overriding function Inherited_Member
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Operation Classifier::inheritedMember.
--
-- The inheritedMember association is derived by inheriting the
-- inheritable members of the parents.
-- The inheritedMember association is derived by inheriting the
-- inheritable members of the parents.
overriding function Is_Template
(Self : not null access constant UML_Extension_Proxy)
return Boolean;
-- Operation Classifier::isTemplate.
--
-- The query isTemplate() returns whether this templateable element is
-- actually a template.
overriding function May_Specialize_Type
(Self : not null access constant UML_Extension_Proxy;
C : AMF.UML.Classifiers.UML_Classifier_Access)
return Boolean;
-- Operation Classifier::maySpecializeType.
--
-- The query maySpecializeType() determines whether this classifier may
-- have a generalization relationship to classifiers of the specified
-- type. By default a classifier may specialize classifiers of the same or
-- a more general type. It is intended to be redefined by classifiers that
-- have different specialization constraints.
overriding function Exclude_Collisions
(Self : not null access constant UML_Extension_Proxy;
Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Operation Namespace::excludeCollisions.
--
-- The query excludeCollisions() excludes from a set of
-- PackageableElements any that would not be distinguishable from each
-- other in this namespace.
overriding function Get_Names_Of_Member
(Self : not null access constant UML_Extension_Proxy;
Element : AMF.UML.Named_Elements.UML_Named_Element_Access)
return AMF.String_Collections.Set_Of_String;
-- Operation Namespace::getNamesOfMember.
--
-- The query getNamesOfMember() takes importing into account. It gives
-- back the set of names that an element would have in an importing
-- namespace, either because it is owned, or if not owned then imported
-- individually, or if not individually then from a package.
-- The query getNamesOfMember() gives a set of all of the names that a
-- member would have in a Namespace. In general a member can have multiple
-- names in a Namespace if it is imported more than once with different
-- aliases. The query takes account of importing. It gives back the set of
-- names that an element would have in an importing namespace, either
-- because it is owned, or if not owned then imported individually, or if
-- not individually then from a package.
overriding function Import_Members
(Self : not null access constant UML_Extension_Proxy;
Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Operation Namespace::importMembers.
--
-- The query importMembers() defines which of a set of PackageableElements
-- are actually imported into the namespace. This excludes hidden ones,
-- i.e., those which have names that conflict with names of owned members,
-- and also excludes elements which would have the same name when imported.
overriding function Imported_Member
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Operation Namespace::importedMember.
--
-- The importedMember property is derived from the ElementImports and the
-- PackageImports. References the PackageableElements that are members of
-- this Namespace as a result of either PackageImports or ElementImports.
overriding function Members_Are_Distinguishable
(Self : not null access constant UML_Extension_Proxy)
return Boolean;
-- Operation Namespace::membersAreDistinguishable.
--
-- The Boolean query membersAreDistinguishable() determines whether all of
-- the namespace's members are distinguishable within it.
overriding function Owned_Member
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Operation Namespace::ownedMember.
--
-- Missing derivation for Namespace::/ownedMember : NamedElement
overriding function All_Owning_Packages
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package;
-- Operation NamedElement::allOwningPackages.
--
-- The query allOwningPackages() returns all the directly or indirectly
-- owning packages.
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Extension_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean;
-- Operation NamedElement::isDistinguishableFrom.
--
-- The query isDistinguishableFrom() determines whether two NamedElements
-- may logically co-exist within a Namespace. By default, two named
-- elements are distinguishable if (a) they have unrelated types or (b)
-- they have related types but different names.
overriding function Namespace
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Operation NamedElement::namespace.
--
-- Missing derivation for NamedElement::/namespace : Namespace
overriding function Conforms_To
(Self : not null access constant UML_Extension_Proxy;
Other : AMF.UML.Types.UML_Type_Access)
return Boolean;
-- Operation Type::conformsTo.
--
-- The query conformsTo() gives true for a type that conforms to another.
-- By default, two types do not conform to each other. This query is
-- intended to be redefined for specific conformance situations.
overriding function Is_Compatible_With
(Self : not null access constant UML_Extension_Proxy;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean;
-- Operation ParameterableElement::isCompatibleWith.
--
-- The query isCompatibleWith() determines if this parameterable element
-- is compatible with the specified parameterable element. By default
-- parameterable element P is compatible with parameterable element Q if
-- the kind of P is the same or a subtype as the kind of Q. Subclasses
-- should override this operation to specify different compatibility
-- constraints.
overriding function Is_Template_Parameter
(Self : not null access constant UML_Extension_Proxy)
return Boolean;
-- Operation ParameterableElement::isTemplateParameter.
--
-- The query isTemplateParameter() determines if this parameterable
-- element is exposed as a formal template parameter.
overriding function Parameterable_Elements
(Self : not null access constant UML_Extension_Proxy)
return AMF.UML.Parameterable_Elements.Collections.Set_Of_UML_Parameterable_Element;
-- Operation TemplateableElement::parameterableElements.
--
-- The query parameterableElements() returns the set of elements that may
-- be used as the parametered elements for a template parameter of this
-- templateable element. By default, this set includes all the owned
-- elements. Subclasses may override this operation if they choose to
-- restrict the set of parameterable elements.
overriding function Is_Consistent_With
(Self : not null access constant UML_Extension_Proxy;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean;
-- Operation RedefinableElement::isConsistentWith.
--
-- The query isConsistentWith() specifies, for any two RedefinableElements
-- in a context in which redefinition is possible, whether redefinition
-- would be logically consistent. By default, this is false; this
-- operation must be overridden for subclasses of RedefinableElement to
-- define the consistency conditions.
overriding function Is_Redefinition_Context_Valid
(Self : not null access constant UML_Extension_Proxy;
Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean;
-- Operation RedefinableElement::isRedefinitionContextValid.
--
-- The query isRedefinitionContextValid() specifies whether the
-- redefinition contexts of this RedefinableElement are properly related
-- to the redefinition contexts of the specified RedefinableElement to
-- allow this element to redefine the other. By default at least one of
-- the redefinition contexts of this element must be a specialization of
-- at least one of the redefinition contexts of the specified element.
overriding procedure Enter_Element
(Self : not null access constant UML_Extension_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Leave_Element
(Self : not null access constant UML_Extension_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Visit_Element
(Self : not null access constant UML_Extension_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of iterator interface.
end AMF.Internals.UML_Extensions;
|
sebsgit/textproc | Ada | 2,486 | adb | with Ada.Text_IO;
with Ada.Streams.Stream_IO;
package body NeuralNet.IO is
file_magic_mark: constant Integer := 16#666DEAD#;
file_format_version: constant Integer := 1;
procedure save(nn: in NeuralNet.Net; path: in String) is
output_file: Ada.Streams.Stream_IO.File_Type;
output_stream: Ada.Streams.Stream_IO.Stream_Access;
begin
Ada.Streams.Stream_IO.Create(File => output_file,
Mode => Ada.Streams.Stream_IO.Out_File,
Name => path);
output_stream := Ada.Streams.Stream_IO.Stream(output_file);
Integer'Write(output_stream, file_magic_mark);
Integer'Write(output_stream, file_format_version);
Positive'Write(output_stream, nn.conf.size);
NeuralNet.Config'Write(output_stream, nn.conf);
NeuralNet.Net'Write(output_stream, nn);
Ada.Streams.Stream_IO.Close(output_file);
end save;
function load(path: in String; status: out Boolean) return NeuralNet.Net is
null_net_config: NeuralNet.Config(1);
input_file: Ada.Streams.Stream_IO.File_Type;
input_stream: Ada.Streams.Stream_IO.Stream_Access;
begin
ADa.Streams.Stream_IO.Open(File => input_file,
Mode => Ada.Streams.Stream_IO.In_File,
Name => path);
input_stream := Ada.Streams.Stream_IO.Stream(input_file);
status := not Ada.Streams.Stream_IO.End_Of_File(input_file);
if status then
declare
magic_mark: Integer;
format_ver: Integer;
conf_size: Positive;
begin
Integer'Read(input_stream, magic_mark);
Integer'Read(input_stream, format_ver);
Positive'Read(input_stream, conf_size);
if magic_mark = file_magic_mark and format_ver = file_format_version then
declare
conf: NeuralNet.Config(conf_size);
begin
NeuralNet.Config'Read(input_stream, conf);
return nn: NeuralNet.Net := NeuralNet.create(conf) do
NeuralNet.Net'Read(input_stream, nn);
Ada.Streams.Stream_IO.Close(input_file);
end return;
end;
end if;
end;
Ada.Streams.Stream_IO.Close(input_file);
end if;
null_net_config.sizes := (1 => 1);
return NeuralNet.create(null_net_config);
end load;
end NeuralNet.IO;
|
reznikmm/matreshka | Ada | 11,735 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with League.Holders.Booleans;
with League.Strings.Internals;
with AMF.CMOF.Properties;
with AMF.Holders.Reals;
with AMF.Internals.Helpers;
with AMF.Internals.Listener_Registry;
with AMF.DC.Holders.Alignment_Kinds;
with AMF.DC.Holders.Bounds;
with AMF.DC.Holders.Dimensions;
with AMF.DC.Holders.Points;
package body AMF.Internals.Tables.DC_Notification is
--------------------------
-- Notify_Attribute_Set --
--------------------------
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : Boolean;
New_Value : Boolean) is
begin
AMF.Internals.Listener_Registry.Notify_Attribute_Set
(AMF.Internals.Helpers.To_Element (Element),
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Property)),
(Is_Empty => True),
League.Holders.Booleans.To_Holder (Old_Value),
League.Holders.Booleans.To_Holder (New_Value));
end Notify_Attribute_Set;
--------------------------
-- Notify_Attribute_Set --
--------------------------
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.Optional_Boolean;
New_Value : AMF.Optional_Boolean) is
begin
AMF.Internals.Listener_Registry.Notify_Attribute_Set
(AMF.Internals.Helpers.To_Element (Element),
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Property)),
(Is_Empty => True),
AMF.Holders.To_Holder (Old_Value),
AMF.Holders.To_Holder (New_Value));
end Notify_Attribute_Set;
--------------------------
-- Notify_Attribute_Set --
--------------------------
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : Matreshka.Internals.Strings.Shared_String_Access;
New_Value : Matreshka.Internals.Strings.Shared_String_Access)
is
use type Matreshka.Internals.Strings.Shared_String_Access;
OV : League.Holders.Holder;
NV : League.Holders.Holder;
begin
League.Holders.Set_Tag (OV, League.Holders.Universal_String_Tag);
if Old_Value /= null then
League.Holders.Replace_Element
(OV, League.Strings.Internals.Create (Old_Value));
end if;
League.Holders.Set_Tag (NV, League.Holders.Universal_String_Tag);
if New_Value /= null then
League.Holders.Replace_Element
(NV, League.Strings.Internals.Create (New_Value));
end if;
AMF.Internals.Listener_Registry.Notify_Attribute_Set
(AMF.Internals.Helpers.To_Element (Element),
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Property)),
(Is_Empty => True),
OV,
NV);
end Notify_Attribute_Set;
--------------------------
-- Notify_Attribute_Set --
--------------------------
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.Real;
New_Value : AMF.Real) is
begin
AMF.Internals.Listener_Registry.Notify_Attribute_Set
(AMF.Internals.Helpers.To_Element (Element),
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Property)),
(Is_Empty => True),
AMF.Holders.Reals.To_Holder (Old_Value),
AMF.Holders.Reals.To_Holder (New_Value));
end Notify_Attribute_Set;
--------------------------
-- Notify_Attribute_Set --
--------------------------
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.Optional_Real;
New_Value : AMF.Optional_Real) is
begin
AMF.Internals.Listener_Registry.Notify_Attribute_Set
(AMF.Internals.Helpers.To_Element (Element),
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Property)),
(Is_Empty => True),
AMF.Holders.To_Holder (Old_Value),
AMF.Holders.To_Holder (New_Value));
end Notify_Attribute_Set;
--------------------------
-- Notify_Attribute_Set --
--------------------------
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.DC.DC_Alignment_Kind;
New_Value : AMF.DC.DC_Alignment_Kind) is
begin
AMF.Internals.Listener_Registry.Notify_Attribute_Set
(AMF.Internals.Helpers.To_Element (Element),
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Property)),
(Is_Empty => True),
AMF.DC.Holders.Alignment_Kinds.To_Holder (Old_Value),
AMF.DC.Holders.Alignment_Kinds.To_Holder (New_Value));
end Notify_Attribute_Set;
--------------------------
-- Notify_Attribute_Set --
--------------------------
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.DC.Optional_DC_Color;
New_Value : AMF.DC.Optional_DC_Color) is
begin
AMF.Internals.Listener_Registry.Notify_Attribute_Set
(AMF.Internals.Helpers.To_Element (Element),
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Property)),
(Is_Empty => True),
AMF.DC.Holders.To_Holder (Old_Value),
AMF.DC.Holders.To_Holder (New_Value));
end Notify_Attribute_Set;
--------------------------
-- Notify_Attribute_Set --
--------------------------
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.DC.DC_Bounds;
New_Value : AMF.DC.DC_Bounds) is
begin
AMF.Internals.Listener_Registry.Notify_Attribute_Set
(AMF.Internals.Helpers.To_Element (Element),
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Property)),
(Is_Empty => True),
AMF.DC.Holders.Bounds.To_Holder (Old_Value),
AMF.DC.Holders.Bounds.To_Holder (New_Value));
end Notify_Attribute_Set;
--------------------------
-- Notify_Attribute_Set --
--------------------------
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.DC.Optional_DC_Bounds;
New_Value : AMF.DC.Optional_DC_Bounds) is
begin
AMF.Internals.Listener_Registry.Notify_Attribute_Set
(AMF.Internals.Helpers.To_Element (Element),
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Property)),
(Is_Empty => True),
AMF.DC.Holders.To_Holder (Old_Value),
AMF.DC.Holders.To_Holder (New_Value));
end Notify_Attribute_Set;
--------------------------
-- Notify_Attribute_Set --
--------------------------
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.DC.DC_Point;
New_Value : AMF.DC.DC_Point) is
begin
AMF.Internals.Listener_Registry.Notify_Attribute_Set
(AMF.Internals.Helpers.To_Element (Element),
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Property)),
(Is_Empty => True),
AMF.DC.Holders.Points.To_Holder (Old_Value),
AMF.DC.Holders.Points.To_Holder (New_Value));
end Notify_Attribute_Set;
--------------------------
-- Notify_Attribute_Set --
--------------------------
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.DC.DC_Dimension;
New_Value : AMF.DC.DC_Dimension) is
begin
AMF.Internals.Listener_Registry.Notify_Attribute_Set
(AMF.Internals.Helpers.To_Element (Element),
AMF.CMOF.Properties.CMOF_Property_Access
(AMF.Internals.Helpers.To_Element (Property)),
(Is_Empty => True),
AMF.DC.Holders.Dimensions.To_Holder (Old_Value),
AMF.DC.Holders.Dimensions.To_Holder (New_Value));
end Notify_Attribute_Set;
end AMF.Internals.Tables.DC_Notification;
|
reznikmm/matreshka | Ada | 5,573 | 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$
------------------------------------------------------------------------------
package AMF.UMLDI is
pragma Preelaborate;
type UMLDI_UML_Association_Or_Connector_Or_Link_Shape_Kind is
(Diamond,
Triangle);
type Optional_UMLDI_UML_Association_Or_Connector_Or_Link_Shape_Kind (Is_Empty : Boolean := True) is record
case Is_Empty is
when True =>
null;
when False =>
Value : UMLDI_UML_Association_Or_Connector_Or_Link_Shape_Kind;
end case;
end record;
type UMLDI_UML_Inherited_State_Border_Kind is
(Dashed,
Gray);
type Optional_UMLDI_UML_Inherited_State_Border_Kind (Is_Empty : Boolean := True) is record
case Is_Empty is
when True =>
null;
when False =>
Value : UMLDI_UML_Inherited_State_Border_Kind;
end case;
end record;
type UMLDI_UML_Interaction_Diagram_Kind is
(Communication,
Overview,
Sequence,
Table,
Timing);
type Optional_UMLDI_UML_Interaction_Diagram_Kind (Is_Empty : Boolean := True) is record
case Is_Empty is
when True =>
null;
when False =>
Value : UMLDI_UML_Interaction_Diagram_Kind;
end case;
end record;
type UMLDI_UML_Interaction_Table_Label_Kind is
(Constraint,
Diagram_Identifier,
Generated_Instance_Name,
Lifeline_Class,
Lifeline_Instance,
Message_Name,
Message_Receiving_Class,
Message_Receiving_Instance,
Message_Sending_Class,
Message_Sending_Instance,
Other_End,
Parameter,
Return_Value,
Sequence_Number,
Weak_Order);
type Optional_UMLDI_UML_Interaction_Table_Label_Kind (Is_Empty : Boolean := True) is record
case Is_Empty is
when True =>
null;
when False =>
Value : UMLDI_UML_Interaction_Table_Label_Kind;
end case;
end record;
type UMLDI_UML_Navigability_Notation_Kind is
(Always,
Never,
One_Way);
type Optional_UMLDI_UML_Navigability_Notation_Kind (Is_Empty : Boolean := True) is record
case Is_Empty is
when True =>
null;
when False =>
Value : UMLDI_UML_Navigability_Notation_Kind;
end case;
end record;
end AMF.UMLDI;
|
zhmu/ananas | Ada | 13,636 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K I N G . A S Y N C _ D E L A Y S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1998-2022, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
with Ada.Task_Identification;
with System.Task_Primitives.Operations;
with System.Tasking.Utilities;
with System.Tasking.Initialization;
with System.Tasking.Debug;
with System.OS_Primitives;
with System.Interrupt_Management.Operations;
package body System.Tasking.Async_Delays is
package STPO renames System.Task_Primitives.Operations;
package ST renames System.Tasking;
package STU renames System.Tasking.Utilities;
package STI renames System.Tasking.Initialization;
package OSP renames System.OS_Primitives;
function To_System is new Ada.Unchecked_Conversion
(Ada.Task_Identification.Task_Id, Task_Id);
Timer_Attention : Boolean := False;
pragma Atomic (Timer_Attention);
task Timer_Server is
pragma Interrupt_Priority (System.Any_Priority'Last);
end Timer_Server;
Timer_Server_ID : constant ST.Task_Id := To_System (Timer_Server'Identity);
-- The timer queue is a circular doubly linked list, ordered by absolute
-- wakeup time. The first item in the queue is Timer_Queue.Succ.
-- It is given a Resume_Time that is larger than any legitimate wakeup
-- time, so that the ordered insertion will always stop searching when it
-- gets back to the queue header block.
Timer_Queue : aliased Delay_Block;
package Init_Timer_Queue is end Init_Timer_Queue;
pragma Unreferenced (Init_Timer_Queue);
-- Initialize the Timer_Queue. This is a package to work around the
-- fact that statements are syntactically illegal here. We want this
-- initialization to happen before the Timer_Server is activated. A
-- build-in-place function would also work, but that's not supported
-- on all platforms (e.g. cil).
package body Init_Timer_Queue is
begin
Timer_Queue.Succ := Timer_Queue'Unchecked_Access;
Timer_Queue.Pred := Timer_Queue'Unchecked_Access;
Timer_Queue.Resume_Time := Duration'Last;
end Init_Timer_Queue;
------------------------
-- Cancel_Async_Delay --
------------------------
-- This should (only) be called from the compiler-generated cleanup routine
-- for an async. select statement with delay statement as trigger. The
-- effect should be to remove the delay from the timer queue, and exit one
-- ATC nesting level.
-- The usage and logic are similar to Cancel_Protected_Entry_Call, but
-- simplified because this is not a true entry call.
procedure Cancel_Async_Delay (D : Delay_Block_Access) is
Dpred : Delay_Block_Access;
Dsucc : Delay_Block_Access;
begin
-- A delay block level of Level_No_Pending_Abort indicates the delay
-- has been canceled. If the delay has already been canceled, there is
-- nothing more to be done.
if D.Level = Level_No_Pending_Abort then
return;
end if;
D.Level := Level_No_Pending_Abort;
-- Remove self from timer queue
STI.Defer_Abort_Nestable (D.Self_Id);
STPO.Write_Lock (Timer_Server_ID);
Dpred := D.Pred;
Dsucc := D.Succ;
Dpred.Succ := Dsucc;
Dsucc.Pred := Dpred;
D.Succ := D;
D.Pred := D;
STPO.Unlock (Timer_Server_ID);
-- Note that the above deletion code is required to be
-- idempotent, since the block may have been dequeued
-- previously by the Timer_Server.
-- leave the asynchronous select
STPO.Write_Lock (D.Self_Id);
STU.Exit_One_ATC_Level (D.Self_Id);
STPO.Unlock (D.Self_Id);
STI.Undefer_Abort_Nestable (D.Self_Id);
end Cancel_Async_Delay;
----------------------
-- Enqueue_Duration --
----------------------
function Enqueue_Duration
(T : Duration;
D : Delay_Block_Access) return Boolean
is
begin
if T <= 0.0 then
D.Timed_Out := True;
STPO.Yield;
return False;
else
-- The corresponding call to Undefer_Abort is performed by the
-- expanded code (see exp_ch9).
STI.Defer_Abort (STPO.Self);
Time_Enqueue
(STPO.Monotonic_Clock
+ Duration'Min (T, OSP.Max_Sensible_Delay), D);
return True;
end if;
end Enqueue_Duration;
------------------
-- Time_Enqueue --
------------------
-- Allocate a queue element for the wakeup time T and put it in the
-- queue in wakeup time order. Assume we are on an asynchronous
-- select statement with delay trigger. Put the calling task to
-- sleep until either the delay expires or is canceled.
-- We use one entry call record for this delay, since we have
-- to increment the ATC nesting level, but since it is not a
-- real entry call we do not need to use any of the fields of
-- the call record. The following code implements a subset of
-- the actions for the asynchronous case of Protected_Entry_Call,
-- much simplified since we know this never blocks, and does not
-- have the full semantics of a protected entry call.
procedure Time_Enqueue
(T : Duration;
D : Delay_Block_Access)
is
Self_Id : constant Task_Id := STPO.Self;
Q : Delay_Block_Access;
begin
pragma Debug (Debug.Trace (Self_Id, "Async_Delay", 'P'));
pragma Assert (Self_Id.Deferral_Level = 1,
"async delay from within abort-deferred region");
if Self_Id.ATC_Nesting_Level = ATC_Level'Last then
raise Storage_Error with "not enough ATC nesting levels";
end if;
Self_Id.ATC_Nesting_Level := Self_Id.ATC_Nesting_Level + 1;
pragma Debug
(Debug.Trace (Self_Id, "ASD: entered ATC level: " &
ATC_Level'Image (Self_Id.ATC_Nesting_Level), 'A'));
D.Level := Self_Id.ATC_Nesting_Level;
D.Self_Id := Self_Id;
D.Resume_Time := T;
STPO.Write_Lock (Timer_Server_ID);
-- Previously, there was code here to dynamically create
-- the Timer_Server task, if one did not already exist.
-- That code had a timing window that could allow multiple
-- timer servers to be created. Luckily, the need for
-- postponing creation of the timer server should now be
-- gone, since this package will only be linked in if
-- there are calls to enqueue calls on the timer server.
-- Insert D in the timer queue, at the position determined
-- by the wakeup time T.
Q := Timer_Queue.Succ;
while Q.Resume_Time < T loop
Q := Q.Succ;
end loop;
-- Q is the block that has Resume_Time equal to or greater than
-- T. After the insertion we want Q to be the successor of D.
D.Succ := Q;
D.Pred := Q.Pred;
D.Pred.Succ := D;
Q.Pred := D;
-- If the new element became the head of the queue,
-- signal the Timer_Server to wake up.
if Timer_Queue.Succ = D then
Timer_Attention := True;
STPO.Wakeup (Timer_Server_ID, ST.Timer_Server_Sleep);
end if;
STPO.Unlock (Timer_Server_ID);
end Time_Enqueue;
---------------
-- Timed_Out --
---------------
function Timed_Out (D : Delay_Block_Access) return Boolean is
begin
return D.Timed_Out;
end Timed_Out;
------------------
-- Timer_Server --
------------------
task body Timer_Server is
Ignore : constant Boolean := STU.Make_Independent;
-- Local Declarations
Next_Wakeup_Time : Duration := Duration'Last;
Timedout : Boolean;
Yielded : Boolean;
Now : Duration;
Dequeued : Delay_Block_Access;
Dequeued_Task : Task_Id;
begin
pragma Assert (Timer_Server_ID = STPO.Self);
-- Since this package may be elaborated before System.Interrupt,
-- we need to call Setup_Interrupt_Mask explicitly to ensure that
-- this task has the proper signal mask.
Interrupt_Management.Operations.Setup_Interrupt_Mask;
-- Initialize the timer queue to empty, and make the wakeup time of the
-- header node be larger than any real wakeup time we will ever use.
loop
STI.Defer_Abort (Timer_Server_ID);
STPO.Write_Lock (Timer_Server_ID);
-- The timer server needs to catch pending aborts after finalization
-- of library packages. If it doesn't poll for it, the server will
-- sometimes hang.
if not Timer_Attention then
Timer_Server_ID.Common.State := ST.Timer_Server_Sleep;
if Next_Wakeup_Time = Duration'Last then
Timer_Server_ID.User_State := 1;
Next_Wakeup_Time :=
STPO.Monotonic_Clock + OSP.Max_Sensible_Delay;
else
Timer_Server_ID.User_State := 2;
end if;
STPO.Timed_Sleep
(Timer_Server_ID, Next_Wakeup_Time,
OSP.Absolute_RT, ST.Timer_Server_Sleep,
Timedout, Yielded);
Timer_Server_ID.Common.State := ST.Runnable;
end if;
-- Service all of the wakeup requests on the queue whose times have
-- been reached, and update Next_Wakeup_Time to next wakeup time
-- after that (the wakeup time of the head of the queue if any, else
-- a time far in the future).
Timer_Server_ID.User_State := 3;
Timer_Attention := False;
Now := STPO.Monotonic_Clock;
while Timer_Queue.Succ.Resume_Time <= Now loop
-- Dequeue the waiting task from the front of the queue
pragma Debug (System.Tasking.Debug.Trace
(Timer_Server_ID, "Timer service: waking up waiting task", 'E'));
Dequeued := Timer_Queue.Succ;
Timer_Queue.Succ := Dequeued.Succ;
Dequeued.Succ.Pred := Dequeued.Pred;
Dequeued.Succ := Dequeued;
Dequeued.Pred := Dequeued;
-- We want to abort the queued task to the level of the async.
-- select statement with the delay. To do that, we need to lock
-- the ATCB of that task, but to avoid deadlock we need to release
-- the lock of the Timer_Server. This leaves a window in which
-- another task might perform an enqueue or dequeue operation on
-- the timer queue, but that is OK because we always restart the
-- next iteration at the head of the queue.
STPO.Unlock (Timer_Server_ID);
STPO.Write_Lock (Dequeued.Self_Id);
Dequeued_Task := Dequeued.Self_Id;
Dequeued.Timed_Out := True;
STI.Locked_Abort_To_Level
(Timer_Server_ID, Dequeued_Task, Dequeued.Level - 1);
STPO.Unlock (Dequeued_Task);
STPO.Write_Lock (Timer_Server_ID);
end loop;
Next_Wakeup_Time := Timer_Queue.Succ.Resume_Time;
-- Service returns the Next_Wakeup_Time.
-- The Next_Wakeup_Time is either an infinity (no delay request)
-- or the wakeup time of the queue head. This value is used for
-- an actual delay in this server.
STPO.Unlock (Timer_Server_ID);
STI.Undefer_Abort (Timer_Server_ID);
end loop;
end Timer_Server;
end System.Tasking.Async_Delays;
|
zhmu/ananas | Ada | 519 | adb | -- { dg-do compile }
-- { dg-final { scan-assembler-not "elabs" } }
package body OCONST4 is
procedure check (arg : R) is
begin
if arg.u /= 1
or else arg.d.f1 /= 17
or else arg.d.b.f1 /= one
or else arg.d.b.f2 /= 2
or else arg.d.b.f3 /= 17
or else arg.d.b.f4 /= 42
or else arg.d.f2 /= one
or else arg.d.f3 /= 1
or else arg.d.f4 /= 111
or else arg.d.i1 /= 2
or else arg.d.i2 /= 3
then
raise Program_Error;
end if;
end;
end;
|
strenkml/EE368 | Ada | 1,917 | ads |
with GNAT.Source_Info;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Memory; use Memory;
with Memory.Container; use Memory.Container;
with Util; use Util;
-- Base package for unit tests.
package Test is
-- Run the unit tests.
procedure Run_Tests;
private
-- A memory for monitoring accesses.
type Monitor_Type is new Container_Type with record
last_addr : Address_Type := Address_Type'Last;
last_size : Positive := Positive'Last;
reads : Natural := 0;
writes : Natural := 0;
cycles : Time_Type := 0;
latency : Time_Type := 0;
end record;
type Monitor_Pointer is access all Monitor_Type;
function Create_Monitor(latency : Time_Type := 0;
ram : Boolean := True)
return Monitor_Pointer;
overriding
function Clone(mem : Monitor_Type) return Memory_Pointer;
overriding
procedure Read(mem : in out Monitor_Type;
address : in Address_Type;
size : in Positive);
overriding
procedure Write(mem : in out Monitor_Type;
address : in Address_Type;
size : in Positive);
overriding
procedure Idle(mem : in out Monitor_Type;
cycles : in Time_Type);
overriding
procedure Generate(mem : in Monitor_Type;
sigs : in out Unbounded_String;
code : in out Unbounded_String);
-- Assert a condition.
-- This function will report the file and line number for failures.
procedure Check(cond : in Boolean;
source : in String := GNAT.Source_Info.File;
line : in Natural := GNAT.Source_Info.Line);
count : Natural := 0;
failed : Natural := 0;
end Test;
|
reznikmm/matreshka | Ada | 4,712 | 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.Display_Filter_Buttons_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Table_Display_Filter_Buttons_Attribute_Node is
begin
return Self : Table_Display_Filter_Buttons_Attribute_Node do
Matreshka.ODF_Table.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Table_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Table_Display_Filter_Buttons_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Display_Filter_Buttons_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Table_URI,
Matreshka.ODF_String_Constants.Display_Filter_Buttons_Attribute,
Table_Display_Filter_Buttons_Attribute_Node'Tag);
end Matreshka.ODF_Table.Display_Filter_Buttons_Attributes;
|
ytomino/xml-ada | Ada | 2,354 | ads | with XML;
private with Ada.Finalization;
package Serialization.XML is
pragma Preelaborate;
type Reference_Type (
Serializer : not null access Serialization.Serializer) is limited private;
function Reading (Reader : not null access Standard.XML.Reader; Tag : String)
return Reference_Type;
function Writing (Writer : not null access Standard.XML.Writer; Tag : String)
return Reference_Type;
private
type Serializer_Access is access Serializer;
type XML_Reader;
type XML_Reader_Access is access XML_Reader;
type XML_Writer;
type XML_Writer_Access is access XML_Writer;
type Reference_Type (
Serializer : not null access Serializer) is
limited new Ada.Finalization.Limited_Controlled
with record
Serializer_Body : Serializer_Access;
Reader_Body : XML_Reader_Access;
Writer_Body : XML_Writer_Access;
end record;
overriding procedure Finalize (Object : in out Reference_Type);
-- reading
type XML_Reader is limited new Serialization.Reader
with record
Reader : not null access Standard.XML.Reader;
Next_Kind : Stream_Element_Kind;
Next_Name : Ada.Strings.Unbounded.String_Access;
Next_Value : Ada.Strings.Unbounded.String_Access;
Next_Next_Name : Ada.Strings.Unbounded.String_Access;
Level : Natural;
end record;
overriding function Next_Kind (Object : not null access XML_Reader)
return Stream_Element_Kind;
overriding function Next_Name (Object : not null access XML_Reader)
return not null access constant String;
overriding function Next_Value (Object : not null access XML_Reader)
return not null access constant String;
overriding procedure Advance (
Object : not null access XML_Reader;
Position : in State);
-- writing
type XML_Writer is limited new Serialization.Writer
with record
Writer : not null access Standard.XML.Writer;
Level : Natural;
end record;
overriding procedure Put (
Object : not null access XML_Writer;
Name : in String;
Item : in String);
overriding procedure Enter_Mapping (
Object : not null access XML_Writer;
Name : in String);
overriding procedure Leave_Mapping (Object : not null access XML_Writer);
overriding procedure Enter_Sequence (
Object : not null access XML_Writer;
Name : in String);
overriding procedure Leave_Sequence (Object : not null access XML_Writer);
end Serialization.XML;
|
BrickBot/Bound-T-H8-300 | Ada | 2,366 | adb | -- Storage.Data.Opt (body)
--
-- A component of the Bound-T Worst-Case Execution Time Tool.
--
-------------------------------------------------------------------------------
-- Copyright (c) 1999 .. 2015 Tidorum Ltd
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice, this
-- list of conditions and the following disclaimer.
-- 2. Redistributions in binary form must reproduce the above copyright notice,
-- this list of conditions and the following disclaimer in the documentation
-- and/or other materials provided with the distribution.
--
-- 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.
--
-- Other modules (files) of this software composition should contain their
-- own copyright statements, which may have different copyright and usage
-- conditions. The above conditions apply to this file.
-------------------------------------------------------------------------------
--
-- $Revision: 1.2 $
-- $Date: 2015/10/24 20:05:51 $
--
-- $Log: storage-data-opt.adb,v $
-- Revision 1.2 2015/10/24 20:05:51 niklas
-- Moved to free licence.
--
-- Revision 1.1 2011-08-31 04:17:14 niklas
-- Added for BT-CH-0222: Option registry. Option -dump. External help files.
--
with Options.Groups;
package body Storage.Data.Opt is
begin
Options.Register (
Option => Trace_Space_Ops_Opt'access,
Name => Options.Trace_Item ("data_space"),
Group => Options.Groups.Trace);
end Storage.Data.Opt;
|
reznikmm/matreshka | Ada | 3,466 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Testsuite Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-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.SAX.Simple_Readers;
procedure Test_99 is
X : XML.SAX.Simple_Readers.Simple_Reader;
begin
null;
end Test_99;
|
MayaPosch/NymphRPC | Ada | 150 | ads | -- nymph.ada - Package file for the NymphRPC package.
--
-- Revision 0
--
-- 2018/09/24, Maya Posch
package NymphClient is
--
end NymphClient;
|
reznikmm/matreshka | Ada | 5,075 | 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.ODF_String_Constants;
package body Matreshka.ODF_Text is
------------------
-- Constructors --
------------------
package body Constructors is
----------------
-- Initialize --
----------------
procedure Initialize
(Self : not null access Abstract_Text_Attribute_Node'Class;
Document : not null Matreshka.DOM_Nodes.Document_Access;
Prefix : League.Strings.Universal_String) is
begin
Matreshka.DOM_Attributes.Constructors.Initialize (Self, Document);
Self.Prefix := Prefix;
end Initialize;
----------------
-- Initialize --
----------------
procedure Initialize
(Self : not null access Abstract_Text_Element_Node'Class;
Document : not null Matreshka.DOM_Nodes.Document_Access;
Prefix : League.Strings.Universal_String) is
begin
Matreshka.DOM_Elements.Constructors.Initialize (Self, Document);
Self.Prefix := Prefix;
end Initialize;
end Constructors;
-----------------------
-- Get_Namespace_URI --
-----------------------
overriding function Get_Namespace_URI
(Self : not null access constant Abstract_Text_Attribute_Node)
return League.Strings.Universal_String is
begin
return Matreshka.ODF_String_Constants.Text_URI;
end Get_Namespace_URI;
-----------------------
-- Get_Namespace_URI --
-----------------------
overriding function Get_Namespace_URI
(Self : not null access constant Abstract_Text_Element_Node)
return League.Strings.Universal_String is
begin
return Matreshka.ODF_String_Constants.Text_URI;
end Get_Namespace_URI;
end Matreshka.ODF_Text;
|
AdaCore/gpr | Ada | 182 | ads | package p1_0 is
function p1_0_0 (Item : Integer) return Integer;
function p1_0_1 (Item : Integer) return Integer;
function p1_0_2 (Item : Integer) return Integer;
end p1_0;
|
osannolik/ada-canopen | Ada | 4,740 | adb | with ACO.Events;
package body ACO.Slave_Monitors is
function Is_Monitored
(This : Slave_Monitor;
Node_Id : ACO.Messages.Slave_Node_Nr)
return Boolean
is
use type ACO.Messages.Node_Nr;
begin
for Alarm of This.Slaves loop
if Alarm.Node_Id = Node_Id then
return True;
end if;
end loop;
return False;
end Is_Monitored;
function Get_State
(This : Slave_Monitor;
Node_Id : ACO.Messages.Slave_Node_Nr)
return ACO.States.State
is
use type ACO.Messages.Node_Nr;
begin
for Alarm of This.Slaves loop
if Alarm.Node_Id = Node_Id then
return Alarm.Slave_State.Current;
end if;
end loop;
return ACO.States.Unknown_State;
end Get_State;
overriding
procedure Signal
(This : access Slave_Alarm;
T_Now : in Ada.Real_Time.Time)
is
pragma Unreferenced (T_Now);
begin
This.Slave_State := (Previous => This.Slave_State.Current,
Current => ACO.States.Unknown_State);
if This.Ref /= null then
This.Ref.Od.Events.Node_Events.Put
((Event => ACO.Events.Slave_State_Transition,
Slave => (This.Slave_State, This.Node_Id)));
This.Ref.Od.Events.Node_Events.Put
((Event => ACO.Events.Heartbeat_Timed_Out,
Node_Id => This.Node_Id));
end if;
This.Node_Id := ACO.Messages.Not_A_Slave;
end Signal;
procedure Restart
(This : in out Slave_Monitor;
T_Now : in Ada.Real_Time.Time)
is
use type Ada.Real_Time.Time;
use type ACO.Messages.Node_Nr;
Period : Natural;
begin
for Alarm of This.Slaves loop
if Alarm.Node_Id /= ACO.Messages.Not_A_Slave then
This.Manager.Cancel (Alarm'Unchecked_Access);
Period := This.Od.Get_Heartbeat_Consumer_Period (Alarm.Node_Id);
if Period > 0 then
This.Manager.Set
(Alarm'Unchecked_Access,
T_Now + Ada.Real_Time.Milliseconds (Period));
else
Alarm.Node_Id := ACO.Messages.Not_A_Slave;
end if;
end if;
end loop;
end Restart;
procedure Start
(This : in out Slave_Monitor;
Node_Id : in ACO.Messages.Slave_Node_Nr;
Slave_State : in ACO.States.State;
T_Now : in Ada.Real_Time.Time)
is
use type Ada.Real_Time.Time;
use type ACO.Messages.Node_Nr;
Period : constant Natural := This.Od.Get_Heartbeat_Consumer_Period (Node_Id);
begin
if Period > 0 then
for Alarm of This.Slaves loop
if Alarm.Node_Id = ACO.Messages.Not_A_Slave then
Alarm.Node_Id := Node_Id;
Alarm.Slave_State := (Previous => ACO.States.Unknown_State,
Current => Slave_State);
This.Manager.Set
(Alarm'Unchecked_Access,
T_Now + Ada.Real_Time.Milliseconds (Period));
This.Od.Events.Node_Events.Put
((Event => ACO.Events.Slave_State_Transition,
Slave => (Alarm.Slave_State, Alarm.Node_Id)));
exit;
end if;
end loop;
end if;
end Start;
procedure Update_State
(This : in out Slave_Monitor;
Node_Id : in ACO.Messages.Slave_Node_Nr;
Slave_State : in ACO.States.State;
T_Now : in Ada.Real_Time.Time)
is
use type Ada.Real_Time.Time;
use type ACO.Messages.Node_Nr;
Period : constant Natural := This.Od.Get_Heartbeat_Consumer_Period (Node_Id);
begin
for Alarm of This.Slaves loop
if Alarm.Node_Id = Node_Id then
This.Manager.Cancel (Alarm'Unchecked_Access);
if Period > 0 then
Alarm.Slave_State := (Previous => Alarm.Slave_State.Current,
Current => Slave_State);
This.Manager.Set
(Alarm'Unchecked_Access,
T_Now + Ada.Real_Time.Milliseconds (Period));
This.Od.Events.Node_Events.Put
((Event => ACO.Events.Slave_State_Transition,
Slave => (Alarm.Slave_State, Alarm.Node_Id)));
else
Alarm.Node_Id := ACO.Messages.Not_A_Slave;
end if;
exit;
end if;
end loop;
end Update_State;
procedure Update_Alarms
(This : in out Slave_Monitor;
T_Now : in Ada.Real_Time.Time)
is
begin
This.Manager.Process (T_Now);
end Update_Alarms;
end ACO.Slave_Monitors;
|
stcarrez/dynamo | Ada | 5,761 | adb | -----------------------------------------------------------------------
-- gen-artifacts-mappings -- Type mapping artifact for Code Generator
-- Copyright (C) 2011, 2012, 2015, 2018, 2019, 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.
-----------------------------------------------------------------------
with Util.Log.Loggers;
with Gen.Utils;
with Gen.Model;
with Gen.Model.Mappings;
-- The <b>Gen.Artifacts.Mappings</b> package is an artifact to map XML-based types
-- into Ada types.
package body Gen.Artifacts.Mappings is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Gen.Artifacts.Query");
-- ------------------------------
-- After the configuration file is read, processes the node whose root
-- is passed in <b>Node</b> and initializes the <b>Model</b> with the information.
-- ------------------------------
overriding
procedure Initialize (Handler : in out Artifact;
Path : in String;
Node : in DOM.Core.Node;
Model : in out Gen.Model.Packages.Model_Definition'Class;
Context : in out Generator'Class) is
procedure Register_Mapping (O : in out Gen.Model.Packages.Model_Definition;
Node : in DOM.Core.Node);
procedure Register_Mappings (Model : in out Gen.Model.Packages.Model_Definition;
Node : in DOM.Core.Node);
-- ------------------------------
-- Register a new type mapping.
-- ------------------------------
procedure Register_Mapping (O : in out Gen.Model.Packages.Model_Definition;
Node : in DOM.Core.Node) is
procedure Register_Type (O : in out Gen.Model.Packages.Model_Definition;
Node : in DOM.Core.Node);
N : constant DOM.Core.Node := Gen.Utils.Get_Child (Node, "to");
To : constant String := Gen.Utils.Get_Data_Content (N);
Kind : constant String := To_String (Gen.Utils.Get_Attribute (Node, "type"));
Allow_Null : constant Boolean := Gen.Utils.Get_Attribute (Node, "allow-null", False);
Kind_Type : Gen.Model.Mappings.Basic_Type;
procedure Register_Type (O : in out Gen.Model.Packages.Model_Definition;
Node : in DOM.Core.Node) is
pragma Unreferenced (O);
From : constant String := Gen.Utils.Get_Data_Content (Node);
begin
Gen.Model.Mappings.Register_Type (Target => To,
From => From,
Kind => Kind_Type,
Allow_Null => Allow_Null);
end Register_Type;
procedure Iterate is
new Gen.Utils.Iterate_Nodes (T => Gen.Model.Packages.Model_Definition,
Process => Register_Type);
begin
if Kind = "date" or else To = "Ada.Calendar.Time" then
Kind_Type := Gen.Model.Mappings.T_DATE;
elsif Kind = "identifier" or else To = "ADO.Identifier" then
Kind_Type := Gen.Model.Mappings.T_IDENTIFIER;
elsif Kind = "boolean" then
Kind_Type := Gen.Model.Mappings.T_BOOLEAN;
elsif Kind = "float" then
Kind_Type := Gen.Model.Mappings.T_FLOAT;
elsif Kind = "string" or else To = "Ada.Strings.Unbounded.Unbounded_String" then
Kind_Type := Gen.Model.Mappings.T_STRING;
elsif Kind = "blob" or else To = "ADO.Blob_Ref" then
Kind_Type := Gen.Model.Mappings.T_BLOB;
elsif Kind = "entity_type" or else To = "ADO.Entity_Type" then
Kind_Type := Gen.Model.Mappings.T_ENTITY_TYPE;
else
Kind_Type := Gen.Model.Mappings.T_INTEGER;
end if;
Iterate (O, Node, "from");
end Register_Mapping;
-- ------------------------------
-- Register a model mapping
-- ------------------------------
procedure Register_Mappings (Model : in out Gen.Model.Packages.Model_Definition;
Node : in DOM.Core.Node) is
procedure Iterate is
new Gen.Utils.Iterate_Nodes (T => Gen.Model.Packages.Model_Definition,
Process => Register_Mapping);
Name : constant String := Gen.Utils.Get_Attribute (Node, "name");
begin
Gen.Model.Mappings.Set_Mapping_Name (Name);
Iterate (Model, Node, "mapping");
end Register_Mappings;
procedure Iterate is new Gen.Utils.Iterate_Nodes (T => Gen.Model.Packages.Model_Definition,
Process => Register_Mappings);
begin
Log.Debug ("Initializing mapping artifact for the configuration");
Gen.Artifacts.Artifact (Handler).Initialize (Path, Node, Model, Context);
Iterate (Gen.Model.Packages.Model_Definition (Model), Node, "mappings");
end Initialize;
end Gen.Artifacts.Mappings;
|
charlie5/cBound | Ada | 1,592 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with swig;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_get_image_reply_t is
-- Item
--
type Item is record
response_type : aliased Interfaces.Unsigned_8;
depth : aliased Interfaces.Unsigned_8;
sequence : aliased Interfaces.Unsigned_16;
length : aliased Interfaces.Unsigned_32;
visual : aliased xcb.xcb_visualid_t;
pad0 : aliased swig.int8_t_Array (0 .. 19);
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C.size_t range <>) of aliased xcb.xcb_get_image_reply_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_get_image_reply_t.Item,
Element_Array => xcb.xcb_get_image_reply_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C.size_t range <>) of aliased xcb.xcb_get_image_reply_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_get_image_reply_t.Pointer,
Element_Array => xcb.xcb_get_image_reply_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_get_image_reply_t;
|
cognitedata/unreal-openapi-generator | Ada | 11,632 | adb | -- OpenAPI Petstore
-- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters.
--
-- OpenAPI spec version: 1.0.0
--
--
-- NOTE: This package is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT.
-- https://openapi-generator.tech
-- Do not edit the class manually.
package body Samples.Petstore.Models is
use Swagger.Streams;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ApiResponseType) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("code", Value.Code);
Into.Write_Entity ("type", Value.P_Type);
Into.Write_Entity ("message", Value.Message);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ApiResponseType_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ApiResponseType) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "code", Value.Code);
Swagger.Streams.Deserialize (Object, "type", Value.P_Type);
Swagger.Streams.Deserialize (Object, "message", Value.Message);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ApiResponseType_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : ApiResponseType;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in TagType) is
begin
Into.Start_Entity (Name);
Serialize (Into, "id", Value.Id);
Into.Write_Entity ("name", Value.Name);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in TagType_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out TagType) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "id", Value.Id);
Swagger.Streams.Deserialize (Object, "name", Value.Name);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out TagType_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : TagType;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in CategoryType) is
begin
Into.Start_Entity (Name);
Serialize (Into, "id", Value.Id);
Into.Write_Entity ("name", Value.Name);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in CategoryType_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out CategoryType) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "id", Value.Id);
Swagger.Streams.Deserialize (Object, "name", Value.Name);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out CategoryType_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : CategoryType;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PetType) is
begin
Into.Start_Entity (Name);
Serialize (Into, "id", Value.Id);
Serialize (Into, "category", Value.Category);
Into.Write_Entity ("name", Value.Name);
Serialize (Into, "photoUrls", Value.Photo_Urls);
Serialize (Into, "tags", Value.Tags);
Into.Write_Entity ("status", Value.Status);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PetType_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PetType) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "id", Value.Id);
Swagger.Streams.Deserialize (Object, "category", Value.Category);
Swagger.Streams.Deserialize (Object, "name", Value.Name);
Swagger.Streams.Deserialize (Object, "photoUrls", Value.Photo_Urls);
Swagger.Streams.Deserialize (Object, "tags", Value.Tags);
Swagger.Streams.Deserialize (Object, "status", Value.Status);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PetType_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : PetType;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in UserType) is
begin
Into.Start_Entity (Name);
Serialize (Into, "id", Value.Id);
Into.Write_Entity ("username", Value.Username);
Into.Write_Entity ("firstName", Value.First_Name);
Into.Write_Entity ("lastName", Value.Last_Name);
Into.Write_Entity ("email", Value.Email);
Into.Write_Entity ("password", Value.Password);
Into.Write_Entity ("phone", Value.Phone);
Into.Write_Entity ("userStatus", Value.User_Status);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in UserType_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out UserType) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "id", Value.Id);
Swagger.Streams.Deserialize (Object, "username", Value.Username);
Swagger.Streams.Deserialize (Object, "firstName", Value.First_Name);
Swagger.Streams.Deserialize (Object, "lastName", Value.Last_Name);
Swagger.Streams.Deserialize (Object, "email", Value.Email);
Swagger.Streams.Deserialize (Object, "password", Value.Password);
Swagger.Streams.Deserialize (Object, "phone", Value.Phone);
Swagger.Streams.Deserialize (Object, "userStatus", Value.User_Status);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out UserType_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : UserType;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrderType) is
begin
Into.Start_Entity (Name);
Serialize (Into, "id", Value.Id);
Serialize (Into, "petId", Value.Pet_Id);
Into.Write_Entity ("quantity", Value.Quantity);
Into.Write_Entity ("shipDate", Value.Ship_Date);
Into.Write_Entity ("status", Value.Status);
Into.Write_Entity ("complete", Value.Complete);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrderType_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrderType) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "id", Value.Id);
Swagger.Streams.Deserialize (Object, "petId", Value.Pet_Id);
Swagger.Streams.Deserialize (Object, "quantity", Value.Quantity);
Swagger.Streams.Deserialize (Object, "shipDate", Value.Ship_Date);
Swagger.Streams.Deserialize (Object, "status", Value.Status);
Swagger.Streams.Deserialize (Object, "complete", Value.Complete);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrderType_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : OrderType;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
end Samples.Petstore.Models;
|
optikos/oasis | Ada | 2,555 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Access_Types;
with Program.Lexical_Elements;
with Program.Elements.Parameter_Specifications;
package Program.Elements.Procedure_Access_Types is
pragma Pure (Program.Elements.Procedure_Access_Types);
type Procedure_Access_Type is
limited interface and Program.Elements.Access_Types.Access_Type;
type Procedure_Access_Type_Access is access all Procedure_Access_Type'Class
with Storage_Size => 0;
not overriding function Parameters
(Self : Procedure_Access_Type)
return Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access is abstract;
not overriding function Has_Not_Null
(Self : Procedure_Access_Type)
return Boolean is abstract;
not overriding function Has_Protected
(Self : Procedure_Access_Type)
return Boolean is abstract;
type Procedure_Access_Type_Text is limited interface;
type Procedure_Access_Type_Text_Access is
access all Procedure_Access_Type_Text'Class with Storage_Size => 0;
not overriding function To_Procedure_Access_Type_Text
(Self : aliased in out Procedure_Access_Type)
return Procedure_Access_Type_Text_Access is abstract;
not overriding function Not_Token
(Self : Procedure_Access_Type_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Null_Token
(Self : Procedure_Access_Type_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Access_Token
(Self : Procedure_Access_Type_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Protected_Token
(Self : Procedure_Access_Type_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Procedure_Token
(Self : Procedure_Access_Type_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Left_Bracket_Token
(Self : Procedure_Access_Type_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Right_Bracket_Token
(Self : Procedure_Access_Type_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
end Program.Elements.Procedure_Access_Types;
|
zhmu/ananas | Ada | 7,321 | ads | package Rep_Clause5_Pkg is
type ID_Type is mod 65536;
type String_ID is new ID_Type;
type LNumber_Type is range 0..99999;
subtype Long_Type is Integer;
type Func_ID is (No_Func, FUN_SGN, FUN_EXP, FUN_LOG, FUN_LOG10);
type Token_Kind is (
No_Token,
LEX_BINARY,
LEX_SECTION,
LEX_003,
LEX_004,
LEX_005,
LEX_006,
LEX_007,
LEX_008,
LEX_009,
LEX_LF,
LEX_011,
LEX_012,
LEX_013,
LEX_014,
LEX_015,
LEX_016,
LEX_017,
LEX_018,
LEX_019,
LEX_020,
LEX_021,
LEX_022,
LEX_023,
LEX_024,
LEX_025,
LEX_026,
LEX_027,
LEX_028,
LEX_029,
LEX_030,
LEX_031,
LEX_032,
'!',
'"',
'#',
'$',
'%',
'&',
''',
'(',
')',
'*',
'+',
',',
'-',
'.',
'/',
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
':',
';',
'<',
'=',
'>',
'?',
'@',
'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
'I',
'J',
'K',
'L',
'M',
'N',
'O',
'P',
'Q',
'R',
'S',
'T',
'U',
'V',
'W',
'X',
'Y',
'Z',
'[',
'\',
']',
'^',
'_',
'`',
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
'i',
'j',
'k',
'l',
'm',
'n',
'o',
LEX_SFUN3,
LEX_SFUN2,
LEX_SFUN1,
LEX_SFUNN,
LEX_FUN3,
LEX_FUN2,
LEX_FUN1,
LEX_FUNN,
'x',
'y',
'z',
'{',
'|',
'}',
'~',
LEX_CRTA,
LEX_ISNULL,
LEX_USING,
LEX_HANDLE,
LEX_CALLX,
LEX_COMPLEX,
LEX_FIXED,
LEX_ENV,
LEX_SPARSE,
LEX_SUBROUTINE,
LEX_CALL,
LEX_BOX,
LEX_VLINE,
LEX_HLINE,
LEX_MAXLENGTH,
LEX_DLENGTH,
LEX_INPUT,
LEX_INITIALIZE,
LEX_OUTPUT,
LEX_UNLINK,
LEX_SEEK,
LEX_EXIT,
LEX_NOT,
LEX_COMMON,
LEX_CHAIN,
LEX_DEF,
LEX_ARITY,
LEX_RESUME,
LEX_PIC_S,
LEX_BG,
LEX_FG,
LEX_PC,
LEX_CRT,
LEX_ENUM,
LEX_DECLARE,
LEX_CURSOR,
LEX_DROP,
LEX_CURRENT,
LEX_ISOLATION,
LEX_SET,
LEX_TRANSACTION,
LEX_COMMIT,
LEX_ABORT,
LEX_BEGIN,
LEX_PREVIOUS,
LEX_LAST,
LEX_FIRST,
LEX_KEY,
LEX_START,
LEX_REWRITE,
LEX_INDEX,
LEX_SECONDARY,
LEX_PRIMARY,
LEX_COLUMN,
LEX_TEMP,
LEX_TABLE,
LEX_CREATE,
LEX_HASH,
LEX_BTREE,
LEX_UPDATE,
LEX_ERROR,
LEX_ACCEPT,
LEX_AVG,
LEX_MAX,
LEX_MIN,
LEX_FIELD,
LEX_RESTORE,
LEX_END,
LEX_STEP,
LEX_NEXT,
LEX_FOR,
LEX_RETURN,
LEX_GOSUB,
LEX_RANGE,
LEX_EXPON,
LEX_XOR,
LEX_OR,
LEX_AND,
LEX_SHIFTR,
LEX_GE,
LEX_NE,
LEX_SHIFTL,
LEX_LE,
LEX_VARYING,
LEX_LENGTH,
LEX_PRINT,
LEX_IF,
LEX_GOTO,
LEX_ON,
LEX_THEN,
LEX_DELETE,
LEX_TO,
LEX_SEQUENCE,
LEX_NONUNIQUE,
LEX_UNIQUE,
LEX_FILE,
LEX_CLOSE,
LEX_OPEN,
LEX_DATABASE,
LEX_RECORD,
LEX_DATA,
LEX_WRITE,
LEX_READ,
LEX_STOP,
LEX_LET,
LEX_MOD,
LEX_LONG,
LEX_DIM,
LEX_SHORT,
LEX_REM,
LEX_SHELL,
LEX_TOKEN,
LEX_FLOAT,
LEX_SIDENT,
LEX_INLREM,
LEX_ENDLIT,
LEX_STRLIT,
LEX_IDENT,
LEX_LNUMBER,
LEX_HEX,
LEX_NUMBER,
LEX_EOF,
LEX_QUIT,
LEX_LIST,
LEX_REMOVE,
LEX_RENUMBER,
LEX_CONTINUE,
LEX_RUN,
LEX_MERGE,
LEX_ENTER,
LEX_NEW,
LEX_RESET,
LEX_SYMTAB,
LEX_CLS,
LEX_EDIT,
LEX_SAVE,
LEX_RESAVE,
LEX_LOAD,
LEX_NAME,
LEX_LISTP,
LEX_SHOW,
LEX_STACK,
LEX_STATUS,
LEX_CACHE,
LEX_INSPECT,
LEX_STOW,
LEX_PKGRUN,
LEX_POP,
LEX_CHECK,
LEX_INSERT,
LEX_INTO,
LEX_VALUES,
LEX_NULL,
LEX_WHERE,
LEX_FROM,
LEX_EXEC,
LEX_SELECT,
LEX_AS,
LEX_ALL,
LEX_BY,
LEX_CROSS,
LEX_DESC,
LEX_FULL,
LEX_GROUP,
LEX_INNER,
LEX_JOIN,
LEX_LEFT,
LEX_LIMIT,
LEX_NATURAL,
LEX_OFFSET,
LEX_ORDER,
LEX_OUTER,
LEX_RIGHT,
LEX_FETCH,
LEX_DISTINCT,
LEX_DEFAULT,
LEX_RETURNING,
LEX_LEVEL,
LEX_COMMITTED,
LEX_SERIALIZABLE,
LEX_ONLY,
LEX_HOLD,
LEX_FORWARD,
LEX_WITH,
LEX_PRIOR,
LEX_RELATIVE,
LEX_BACKWARD,
LEX_OF,
LEX_SCROLL,
LEX_NOWAIT,
LEX_HAVING,
LEX_END_TOKENS
);
type Aux_Kind is (No_Aux, SID_Aux, FID_Aux, LNO_Aux);
type Token_Type(Aux : Aux_Kind := No_Aux) is
record
Token : Token_Kind := No_Token;
case Aux is
when SID_Aux =>
SID : String_ID;
when FID_Aux =>
FID : Func_ID;
when LNO_Aux =>
LNO : LNumber_Type;
when No_Aux =>
null;
end case;
end record;
for Token_Type use
record
Aux at 0 range 0..2;
Token at 0 range 3..12;
SID at 0 range 16..31;
FID at 0 range 16..31;
LNO at 0 range 13..31;
end record;
type Tokens_Index is range 0..999999;
type Token_Array is array(Tokens_Index range <>) of Token_Type;
type Token_Line is access all Token_Array;
type Line_Node is
record
Line : Token_Line;
LNO : LNumber_Type := 0;
Numbered : Boolean := False;
end record;
type Nodes_Index is range 0..999999;
type LNodes_Array is array(Nodes_Index range <>) of Line_Node;
type LNodes_Ptr is access all LNodes_Array;
type VString is
record
Max_Length : Natural := 0;
Fixed : Boolean := False;
end record;
function To_Long(Object : VString; Radix : Natural) return Long_Type;
function Element (V : String_ID) return String;
end Rep_Clause5_Pkg;
|
zhmu/ananas | Ada | 24,602 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S C A N S --
-- --
-- S p e c --
-- --
-- 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 Namet; use Namet;
with Types; use Types;
with Uintp; use Uintp;
with Urealp; use Urealp;
package Scans is
-- The scanner maintains a current state in the global variables defined
-- in this package. The call to the Scan routine advances this state to
-- the next token. The state is initialized by the call to one of the
-- initialization routines in Sinput.
-- The following type is used to identify token types returned by Scan.
-- The class column in this table indicates the token classes which
-- apply to the token, as defined by subsequent subtype declarations.
type Token_Type is (
-- Token name Token type Class(es)
Tok_Integer_Literal, -- numeric lit Literal, Lit_Or_Name
Tok_Real_Literal, -- numeric lit Literal, Lit_Or_Name
Tok_String_Literal, -- string lit Literal. Lit_Or_Name
Tok_Char_Literal, -- char lit Name, Literal. Lit_Or_Name
Tok_Operator_Symbol, -- op symbol Name, Literal, Lit_Or_Name, Desig
Tok_Identifier, -- identifier Name, Lit_Or_Name, Desig
Tok_At_Sign, -- @ AI12-0125-3 : target name
Tok_Double_Asterisk, -- **
Tok_Ampersand, -- & Binary_Addop
Tok_Minus, -- - Binary_Addop, Unary_Addop
Tok_Plus, -- + Binary_Addop, Unary_Addop
Tok_Asterisk, -- * Mulop
Tok_Mod, -- MOD Mulop
Tok_Rem, -- REM Mulop
Tok_Slash, -- / Mulop
Tok_New, -- NEW
Tok_Abs, -- ABS
Tok_Others, -- OTHERS
Tok_Null, -- NULL
-- Note: Tok_Raise is in no categories now, it used to be Cterm, Eterm,
-- After_SM, but now that Ada 2012 has added raise expressions, the
-- raise token can appear anywhere. Note in particular that Tok_Raise
-- being in Eterm stopped the parser from recognizing "return raise
-- exception-name". This degrades error recovery slightly, and perhaps
-- we could do better, but not worth the effort.
-- Ada 2022 introduces square brackets as delimiters for array and
-- container aggregates.
Tok_Raise, -- RAISE
Tok_Dot, -- . Namext
Tok_Apostrophe, -- ' Namext
Tok_Left_Bracket, -- [ Namest
Tok_Left_Paren, -- ( Namext, Consk
Tok_Delta, -- DELTA Atkwd, Sterm, Consk
Tok_Digits, -- DIGITS Atkwd, Sterm, Consk
Tok_Range, -- RANGE Atkwd, Sterm, Consk
Tok_Right_Paren, -- ) Sterm
Tok_Right_Bracket, -- ] Sterm
Tok_Comma, -- , Sterm
Tok_And, -- AND Logop, Sterm
Tok_Or, -- OR Logop, Sterm
Tok_Xor, -- XOR Logop, Sterm
Tok_Less, -- < Relop, Sterm
Tok_Equal, -- = Relop, Sterm
Tok_Greater, -- > Relop, Sterm
Tok_Not_Equal, -- /= Relop, Sterm
Tok_Greater_Equal, -- >= Relop, Sterm
Tok_Less_Equal, -- <= Relop, Sterm
Tok_In, -- IN Relop, Sterm
Tok_Not, -- NOT Relop, Sterm
Tok_Box, -- <> Relop, Eterm, Sterm
Tok_Colon_Equal, -- := Eterm, Sterm
Tok_Colon, -- : Eterm, Sterm
Tok_Greater_Greater, -- >> Eterm, Sterm
Tok_Abstract, -- ABSTRACT Eterm, Sterm
Tok_Access, -- ACCESS Eterm, Sterm
Tok_Aliased, -- ALIASED Eterm, Sterm
Tok_All, -- ALL Eterm, Sterm
Tok_Array, -- ARRAY Eterm, Sterm
Tok_At, -- AT Eterm, Sterm
Tok_Body, -- BODY Eterm, Sterm
Tok_Constant, -- CONSTANT Eterm, Sterm
Tok_Do, -- DO Eterm, Sterm
Tok_Is, -- IS Eterm, Sterm
Tok_Interface, -- INTERFACE Eterm, Sterm
Tok_Limited, -- LIMITED Eterm, Sterm
Tok_Of, -- OF Eterm, Sterm
Tok_Out, -- OUT Eterm, Sterm
Tok_Record, -- RECORD Eterm, Sterm
Tok_Renames, -- RENAMES Eterm, Sterm
Tok_Reverse, -- REVERSE Eterm, Sterm
Tok_Some, -- SOME Eterm, Sterm
Tok_Tagged, -- TAGGED Eterm, Sterm
Tok_Then, -- THEN Eterm, Sterm
Tok_Less_Less, -- << Eterm, Sterm, After_SM
Tok_Abort, -- ABORT Eterm, Sterm, After_SM
Tok_Accept, -- ACCEPT Eterm, Sterm, After_SM
Tok_Case, -- CASE Eterm, Sterm, After_SM
Tok_Delay, -- DELAY Eterm, Sterm, After_SM
Tok_Else, -- ELSE Eterm, Sterm, After_SM
Tok_Elsif, -- ELSIF Eterm, Sterm, After_SM
Tok_End, -- END Eterm, Sterm, After_SM
Tok_Exception, -- EXCEPTION Eterm, Sterm, After_SM
Tok_Exit, -- EXIT Eterm, Sterm, After_SM
Tok_Goto, -- GOTO Eterm, Sterm, After_SM
Tok_If, -- IF Eterm, Sterm, After_SM
Tok_Pragma, -- PRAGMA Eterm, Sterm, After_SM
Tok_Requeue, -- REQUEUE Eterm, Sterm, After_SM
Tok_Return, -- RETURN Eterm, Sterm, After_SM
Tok_Select, -- SELECT Eterm, Sterm, After_SM
Tok_Terminate, -- TERMINATE Eterm, Sterm, After_SM
Tok_Until, -- UNTIL Eterm, Sterm, After_SM
Tok_When, -- WHEN Eterm, Sterm, After_SM
Tok_Begin, -- BEGIN Eterm, Sterm, After_SM, Labeled_Stmt
Tok_Declare, -- DECLARE Eterm, Sterm, After_SM, Labeled_Stmt
Tok_For, -- FOR Eterm, Sterm, After_SM, Labeled_Stmt
Tok_Loop, -- LOOP Eterm, Sterm, After_SM, Labeled_Stmt
Tok_While, -- WHILE Eterm, Sterm, After_SM, Labeled_Stmt
Tok_Entry, -- ENTRY Eterm, Sterm, Declk, Deckn, After_SM
Tok_Protected, -- PROTECTED Eterm, Sterm, Declk, Deckn, After_SM
Tok_Task, -- TASK Eterm, Sterm, Declk, Deckn, After_SM
Tok_Type, -- TYPE Eterm, Sterm, Declk, Deckn, After_SM
Tok_Subtype, -- SUBTYPE Eterm, Sterm, Declk, Deckn, After_SM
Tok_Overriding, -- OVERRIDING Eterm, Sterm, Declk, Declk, After_SM
Tok_Synchronized, -- SYNCHRONIZED Eterm, Sterm, Declk, Deckn, After_SM
Tok_Use, -- USE Eterm, Sterm, Declk, Deckn, After_SM
Tok_Function, -- FUNCTION Eterm, Sterm, Cunit, Declk, After_SM
Tok_Generic, -- GENERIC Eterm, Sterm, Cunit, Declk, After_SM
Tok_Package, -- PACKAGE Eterm, Sterm, Cunit, Declk, After_SM
Tok_Procedure, -- PROCEDURE Eterm, Sterm, Cunit, Declk, After_SM
Tok_Private, -- PRIVATE Eterm, Sterm, Cunit, After_SM
Tok_With, -- WITH Eterm, Sterm, Cunit, After_SM
Tok_Separate, -- SEPARATE Eterm, Sterm, Cunit, After_SM
Tok_EOF, -- End of file Eterm, Sterm, Cterm, After_SM
Tok_Semicolon, -- ; Eterm, Sterm, Cterm
Tok_Arrow, -- => Sterm, Cterm, Chtok
Tok_Vertical_Bar, -- | Cterm, Sterm, Chtok
Tok_Dot_Dot, -- .. Sterm, Chtok
Tok_Project,
Tok_Extends,
Tok_External,
Tok_External_As_List,
-- These four entries represent keywords for the project file language
-- and can be returned only in the case of scanning project files.
Tok_Comment,
-- This entry is used when scanning project files (where it represents
-- an entire comment), and in preprocessing with the -C switch set
-- (where it represents just the "--" of a comment). For the project
-- file case, the text of the comment is stored in Comment_Id.
Tok_End_Of_Line,
-- Represents an end of line. Not used during normal compilation scans
-- where end of line is ignored. Active for preprocessor scanning and
-- also when scanning project files (where it is needed because of ???)
Tok_Special,
-- AI12-0125-03 : target name as abbreviation for LHS
-- Otherwise used only in preprocessor scanning (to represent one of
-- the characters '#', '$', '?', '@', '`', '\', '^', '~', or '_'. The
-- character value itself is stored in Scans.Special_Character.
No_Token);
-- No_Token is used for initializing Token values to indicate that
-- no value has been set yet.
function Keyword_Name (Token : Token_Type) return Name_Id;
-- Given a token that is a reserved word, return the corresponding Name_Id
-- in lower case. E.g. Keyword_Name (Tok_Begin) = Name_Find ("begin").
-- It is an error to pass any other kind of token.
-- Note: in the RM, operator symbol is a special case of string literal.
-- We distinguish at the lexical level in this compiler, since there are
-- many syntactic situations in which only an operator symbol is allowed.
-- The following subtype declarations group the token types into classes.
-- These are used for class tests in the parser.
subtype Token_Class_Numeric_Literal is
Token_Type range Tok_Integer_Literal .. Tok_Real_Literal;
-- Numeric literal
subtype Token_Class_Literal is
Token_Type range Tok_Integer_Literal .. Tok_Operator_Symbol;
-- Literal
subtype Token_Class_Lit_Or_Name is
Token_Type range Tok_Integer_Literal .. Tok_Identifier;
subtype Token_Class_Binary_Addop is
Token_Type range Tok_Ampersand .. Tok_Plus;
-- Binary adding operator (& + -)
subtype Token_Class_Unary_Addop is
Token_Type range Tok_Minus .. Tok_Plus;
-- Unary adding operator (+ -)
subtype Token_Class_Mulop is
Token_Type range Tok_Asterisk .. Tok_Slash;
-- Multiplying operator
subtype Token_Class_Logop is
Token_Type range Tok_And .. Tok_Xor;
-- Logical operator (and, or, xor)
subtype Token_Class_Relop is
Token_Type range Tok_Less .. Tok_Box;
-- Relational operator (= /= < <= > >= not, in plus <> to catch misuse
-- of Pascal style not equal operator).
subtype Token_Class_Name is
Token_Type range Tok_Char_Literal .. Tok_At_Sign;
-- First token of name (4.1),
-- (identifier, char literal, operator symbol)
-- Includes '@' after Ada2012 corrigendum.
subtype Token_Class_Desig is
Token_Type range Tok_Operator_Symbol .. Tok_At_Sign;
-- Token which can be a Designator (identifier, operator symbol)
subtype Token_Class_Namext is
Token_Type range Tok_Dot .. Tok_Left_Paren;
-- Name extension tokens. These are tokens which can appear immediately
-- after a name to extend it recursively (period, quote, left paren)
subtype Token_Class_Consk is
Token_Type range Tok_Left_Paren .. Tok_Range;
-- Keywords which can start constraint
-- (left paren, delta, digits, range)
subtype Token_Class_Eterm is
Token_Type range Tok_Colon_Equal .. Tok_Semicolon;
-- Expression terminators. These tokens can never appear within a simple
-- expression. This is used for error recovery purposes (if we encounter
-- an error in an expression, we simply scan to the next Eterm token).
subtype Token_Class_Sterm is
Token_Type range Tok_Delta .. Tok_Dot_Dot;
-- Simple_Expression terminators. A Simple_Expression must be followed
-- by a token in this class, or an error message is issued complaining
-- about a missing binary operator.
subtype Token_Class_Atkwd is
Token_Type range Tok_Delta .. Tok_Range;
-- Attribute keywords. This class includes keywords which can be used
-- as an Attribute_Designator, namely DELTA, DIGITS and RANGE
subtype Token_Class_Cterm is
Token_Type range Tok_EOF .. Tok_Vertical_Bar;
-- Choice terminators. These tokens terminate a choice. This is used for
-- error recovery purposes (if we encounter an error in a Choice, we
-- simply scan to the next Cterm token).
subtype Token_Class_Chtok is
Token_Type range Tok_Arrow .. Tok_Dot_Dot;
-- Choice tokens. These tokens signal a choice when used in an Aggregate
subtype Token_Class_Cunit is
Token_Type range Tok_Function .. Tok_Separate;
-- Tokens which can begin a compilation unit
subtype Token_Class_Declk is
Token_Type range Tok_Entry .. Tok_Procedure;
-- Keywords which start a declaration
subtype Token_Class_Deckn is
Token_Type range Tok_Entry .. Tok_Use;
-- Keywords which start a declaration but can't start a compilation unit
subtype Token_Class_After_SM is
Token_Type range Tok_Less_Less .. Tok_EOF;
-- Tokens which always, or almost always, appear after a semicolon. Used
-- in the Resync_Past_Semicolon routine to avoid gobbling up stuff when
-- a semicolon is missing. Of significance only for error recovery.
subtype Token_Class_Labeled_Stmt is
Token_Type range Tok_Begin .. Tok_While;
-- Tokens which start labeled statements
type Token_Flag_Array is array (Token_Type) of Boolean;
Is_Reserved_Keyword : constant Token_Flag_Array :=
Token_Flag_Array'
(Tok_Mod .. Tok_Rem => True,
Tok_New .. Tok_Null => True,
Tok_Delta .. Tok_Range => True,
Tok_And .. Tok_Xor => True,
Tok_In .. Tok_Not => True,
Tok_Abstract .. Tok_Then => True,
Tok_Abort .. Tok_Separate => True,
others => False);
-- Flag array used to test for reserved word
procedure Initialize_Ada_Keywords;
-- Set up Token_Type values in Names table entries for Ada reserved
-- words. This ignores Ada_Version; Ada_Version is taken into account in
-- Snames.Is_Keyword_Name.
--------------------------
-- Scan State Variables --
--------------------------
-- Note: these variables can only be referenced during the parsing of a
-- file. Reference to any of them from Sem or the expander is wrong.
-- These variables are initialized as required by Scn.Initialize_Scanner,
-- and should not be referenced before such a call. However, there are
-- situations in which these variables are saved and restored, and this
-- may happen before the first Initialize_Scanner call, resulting in the
-- assignment of invalid values. To avoid this, and allow building with
-- the -gnatVa switch, we initialize some variables to known valid values.
Scan_Ptr : Source_Ptr := No_Location; -- init for -gnatVa
-- Current scan pointer location. After a call to Scan, this points
-- just past the end of the token just scanned.
Token : Token_Type := No_Token; -- init for -gnatVa
-- Type of current token
Token_Ptr : Source_Ptr := No_Location; -- init for -gnatVa
-- Pointer to first character of current token
Current_Line_Start : Source_Ptr := No_Location; -- init for -gnatVa
-- Pointer to first character of line containing current token
Start_Column : Column_Number := No_Column_Number; -- init for -gnatVa
-- Starting column number (zero origin) of the first non-blank character
-- on the line containing the current token. This is used for error
-- recovery circuits which depend on looking at the column line up.
Type_Token_Location : Source_Ptr := No_Location; -- init for -gnatVa
-- Within a type declaration, gives the location of the TYPE keyword that
-- opened the type declaration. Used in checking the end column of a record
-- declaration, which can line up either with the TYPE keyword, or with the
-- start of the line containing the RECORD keyword.
Checksum : Word := 0; -- init for -gnatVa
-- Used to accumulate a CRC representing the tokens in the source
-- file being compiled. This CRC includes only program tokens, and
-- excludes comments.
Limited_Checksum : Word := 0;
-- Used to accumulate a CRC representing significant tokens in the
-- limited view of a package, i.e. visible type names and related
-- tagged indicators.
First_Non_Blank_Location : Source_Ptr := No_Location; -- init for -gnatVa
-- Location of first non-blank character on the line containing the
-- current token (i.e. the location of the character whose column number
-- is stored in Start_Column).
Token_Node : Node_Id := Empty;
-- Node table Id for the current token. This is set only if the current
-- token is one for which the scanner constructs a node (i.e. it is an
-- identifier, operator symbol, or literal). For other token types,
-- Token_Node is undefined.
Token_Name : Name_Id := No_Name;
-- For identifiers, this is set to the Name_Id of the identifier scanned.
-- For all other tokens, Token_Name is set to Error_Name. Note that it
-- would be possible for the caller to extract this information from
-- Token_Node. We set Token_Name separately for two reasons. First it
-- allows a quicker test for a specific identifier. Second, it allows
-- a version of the parser to be built that does not build tree nodes,
-- usable as a syntax checker.
Prev_Token : Token_Type := No_Token;
-- Type of previous token
Prev_Token_Ptr : Source_Ptr;
-- Pointer to first character of previous token
Version_To_Be_Found : Boolean;
-- This flag is True if the scanner is still looking for an RCS version
-- number in a comment. Normally it is initialized to False so that this
-- circuit is not activated. If the -dv switch is set, then this flag is
-- initialized to True, and then reset when the version number is found.
-- We do things this way to minimize the impact on comment scanning.
Character_Code : Char_Code;
-- Valid only when Token is Tok_Char_Literal. Contains the value of the
-- scanned literal.
Real_Literal_Value : Ureal;
-- Valid only when Token is Tok_Real_Literal. Contains the value of the
-- scanned literal.
Int_Literal_Value : Uint;
-- Valid only when Token = Tok_Integer_Literal, and we are not in
-- syntax-only mode. Contains the value of the scanned literal.
Based_Literal_Uses_Colon : Boolean;
-- Valid only when Token = Tok_Integer_Literal or Tok_Real_Literal. Set
-- True only for the case of a based literal using ':' instead of '#'.
String_Literal_Id : String_Id;
-- Valid only when Token = Tok_String_Literal or Tok_Operator_Symbol.
-- Contains the Id for currently scanned string value.
Wide_Character_Found : Boolean := False;
-- Valid only when Token = Tok_String_Literal. Set True if wide character
-- found (i.e. a character that does not fit in Character, but fits in
-- Wide_Wide_Character).
Wide_Wide_Character_Found : Boolean := False;
-- Valid only when Token = Tok_String_Literal. Set True if wide wide
-- character found (i.e. a character that does not fit in Character or
-- Wide_Character).
Special_Character : Character;
-- AI12-0125-03 : '@' as target name is handled elsewhere.
-- Valid only when Token = Tok_Special. Returns one of the characters
-- '#', '$', '?', '`', '\', '^', '~', or '_'.
--
-- Why only this set? What about wide characters???
Comment_Id : Name_Id := No_Name;
-- Valid only when Token = Tok_Comment. Store the string that follows
-- the "--" of a comment when scanning project files.
--
-- Is it really right for this to be a Name rather than a String, what
-- about the case of Wide_Wide_Characters???
Inside_Depends : Boolean := False;
-- True while parsing the argument of a Depends or Refined_Depends pragma
-- or aspect. Used to allow/require nonstandard style rules for =>+ with
-- -gnatyt.
Inside_If_Expression : Nat := 0;
-- This is a counter that is set non-zero while scanning out an if
-- expression (incremented on entry, decremented on exit). It is used to
-- disconnect format checks that normally apply to keywords THEN, ELSE etc.
Inside_Pragma : Boolean := False;
-- True within a pragma. Used to avoid complaining about reserved words
-- within pragmas (see Scan_Reserved_Identifier).
--------------------------------------------------------
-- Procedures for Saving and Restoring the Scan State --
--------------------------------------------------------
-- The following procedures can be used to save and restore the entire
-- scan state. They are used in cases where it is necessary to backup
-- the scan during the parse.
type Saved_Scan_State is private;
-- Used for saving and restoring the scan state
procedure Save_Scan_State (Saved_State : out Saved_Scan_State);
pragma Inline (Save_Scan_State);
-- Saves the current scan state for possible later restoration. Note that
-- there is no harm in saving the state and then never restoring it.
procedure Restore_Scan_State (Saved_State : Saved_Scan_State);
pragma Inline (Restore_Scan_State);
-- Restores a scan state saved by a call to Save_Scan_State.
-- The saved scan state must refer to the current source file.
private
type Saved_Scan_State is record
Save_Scan_Ptr : Source_Ptr;
Save_Token : Token_Type;
Save_Token_Ptr : Source_Ptr;
Save_Current_Line_Start : Source_Ptr;
Save_Start_Column : Column_Number;
Save_Checksum : Word;
Save_First_Non_Blank_Location : Source_Ptr;
Save_Token_Node : Node_Id;
Save_Token_Name : Name_Id;
Save_Prev_Token : Token_Type;
Save_Prev_Token_Ptr : Source_Ptr;
end record;
end Scans;
|
AdaCore/libadalang | Ada | 158 | adb | package body Pkg.Impl_G is
procedure Test is
X : Integer := Impl_G.X;
pragma Test_Statement;
begin
null;
end Test;
end Pkg.Impl_G;
|
reznikmm/matreshka | Ada | 4,997 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- A type is a named element that is used as the type for a typed element. A
-- type can be contained in a package.
--
-- A type constrains the values represented by a typed element.
------------------------------------------------------------------------------
with AMF.UML.Packageable_Elements;
limited with AMF.UML.Packages;
package AMF.UML.Types is
pragma Preelaborate;
type UML_Type is limited interface
and AMF.UML.Packageable_Elements.UML_Packageable_Element;
type UML_Type_Access is
access all UML_Type'Class;
for UML_Type_Access'Storage_Size use 0;
not overriding function Get_Package
(Self : not null access constant UML_Type)
return AMF.UML.Packages.UML_Package_Access is abstract;
-- Getter of Type::package.
--
-- Specifies the owning package of this classifier, if any.
not overriding procedure Set_Package
(Self : not null access UML_Type;
To : AMF.UML.Packages.UML_Package_Access) is abstract;
-- Setter of Type::package.
--
-- Specifies the owning package of this classifier, if any.
not overriding function Conforms_To
(Self : not null access constant UML_Type;
Other : AMF.UML.Types.UML_Type_Access)
return Boolean is abstract;
-- Operation Type::conformsTo.
--
-- The query conformsTo() gives true for a type that conforms to another.
-- By default, two types do not conform to each other. This query is
-- intended to be redefined for specific conformance situations.
end AMF.UML.Types;
|
dan76/Amass | Ada | 842 | 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
name = "HAW"
type = "archive"
function start()
set_rate_limit(4)
end
function vertical(ctx, domain)
local resp, err = request(ctx, {['url']=build_url(domain)})
if (err ~= nil and err ~= "") then
log(ctx, "vertical request to service failed: " .. err)
return
elseif (resp.status_code < 200 or resp.status_code >= 400) then
log(ctx, "vertical request to service returned with status code: " .. resp.status)
return
end
send_names(ctx, resp.body:gsub("<b>", ""))
end
function build_url(domain)
return "https://haw.nsk.hr/proxy.php?subject=keywords&start=undefined&q=" .. domain
end
|
zhmu/ananas | Ada | 18,668 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- T B U I L D --
-- --
-- S p e c --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
-- This package contains various utility procedures to assist in building
-- specific types of tree nodes.
with Namet; use Namet;
with Sinfo; use Sinfo;
with Sinfo.Nodes; use Sinfo.Nodes;
with Types; use Types;
with Uintp; use Uintp;
package Tbuild is
function Checks_Off (N : Node_Id) return Node_Id;
pragma Inline (Checks_Off);
-- Returns an N_Unchecked_Expression node whose expression is the given
-- argument. The results is a subexpression identical to the argument,
-- except that it will be analyzed and resolved with checks off.
function Convert_To (Typ : Entity_Id; Expr : Node_Id) return Node_Id;
-- Returns an expression that is a type conversion of expression Expr to
-- type Typ. If the type of Expr is Typ, then no conversion is required.
-- Otherwise an N_Type_Conversion node is constructed to convert the
-- expression. Relocate_Node is applied to Expr, so that it is safe to
-- replace a node by a Convert_To of itself to some other type.
procedure Convert_To_And_Rewrite (Typ : Entity_Id; Expr : Node_Id);
pragma Inline (Convert_To_And_Rewrite);
-- Like the function, except that there is an extra step of calling
-- Rewrite on the Expr node and replacing it with the converted result.
procedure Discard_Node (N : Node_Or_Entity_Id);
pragma Inline (Discard_Node);
-- This is a dummy procedure that simply returns and does nothing. It is
-- used when a function returning a Node_Id value is called for its side
-- effect (e.g. a call to Make to construct a node) but the Node_Id value
-- is not required.
procedure Discard_List (L : List_Id);
pragma Inline (Discard_List);
-- This is a dummy procedure that simply returns and does nothing. It is
-- used when a function returning a Node_Id value is called for its side
-- effect (e.g. a call to the parser to parse a list of compilation
-- units), but the List_Id value is not required.
function Make_Byte_Aligned_Attribute_Reference
(Sloc : Source_Ptr;
Prefix : Node_Id;
Attribute_Name : Name_Id) return Node_Id;
pragma Inline (Make_Byte_Aligned_Attribute_Reference);
-- Like the standard Make_Attribute_Reference but the special flag
-- Must_Be_Byte_Aligned is set in the attribute reference node. The
-- Attribute_Name must be Name_Address or Name_Unrestricted_Access.
function Make_Float_Literal
(Loc : Source_Ptr;
Radix : Uint;
Significand : Uint;
Exponent : Uint) return Node_Id;
-- Create a real literal for the floating point expression value
-- Significand * Radix ** Exponent. Radix must be greater than 1.
function Make_Implicit_Exception_Handler
(Sloc : Source_Ptr;
Choice_Parameter : Node_Id := Empty;
Exception_Choices : List_Id;
Statements : List_Id) return Node_Id;
pragma Inline (Make_Implicit_Exception_Handler);
-- This is just like Make_Exception_Handler, except that it also sets the
-- Local_Raise_Statements field to No_Elist, ensuring that it is properly
-- initialized. This should always be used when creating implicit exception
-- handlers during expansion (i.e. handlers that do not correspond to user
-- source program exception handlers).
function Make_Implicit_If_Statement
(Node : Node_Id;
Condition : Node_Id;
Then_Statements : List_Id;
Elsif_Parts : List_Id := No_List;
Else_Statements : List_Id := No_List) return Node_Id;
pragma Inline (Make_Implicit_If_Statement);
-- This function makes an N_If_Statement node whose fields are filled
-- in with the indicated values (see Sinfo), and whose Sloc field is
-- is set to Sloc (Node). The effect is identical to calling function
-- Nmake.Make_If_Statement except that there is a check for restriction
-- No_Implicit_Conditionals, and if this restriction is being violated,
-- an error message is posted on Node.
function Make_Implicit_Label_Declaration
(Loc : Source_Ptr;
Defining_Identifier : Node_Id;
Label_Construct : Node_Id) return Node_Id;
-- Used to construct an implicit label declaration node, including setting
-- the proper Label_Construct field (since Label_Construct is a semantic
-- field, the normal call to Make_Implicit_Label_Declaration does not
-- set this field).
function Make_Implicit_Loop_Statement
(Node : Node_Id;
Statements : List_Id;
Identifier : Node_Id := Empty;
Iteration_Scheme : Node_Id := Empty;
Has_Created_Identifier : Boolean := False;
End_Label : Node_Id := Empty) return Node_Id;
-- This function makes an N_Loop_Statement node whose fields are filled
-- in with the indicated values (see Sinfo), and whose Sloc field is
-- is set to Sloc (Node). The effect is identical to calling function
-- Nmake.Make_Loop_Statement except that there is a check for restrictions
-- No_Implicit_Loops and No_Implicit_Conditionals (the first applying in
-- all cases, and the second only for while loops), and if one of these
-- restrictions is being violated, an error message is posted on Node.
function Make_Increment
(Loc : Source_Ptr; Index : Entity_Id; Typ : Entity_Id) return Node_Id;
-- Return an assignment statement of the form "Index := Typ'Succ (Index);"
function Make_Integer_Literal
(Loc : Source_Ptr;
Intval : Int) return Node_Id;
pragma Inline (Make_Integer_Literal);
-- A convenient form of Make_Integer_Literal taking Int instead of Uint
function Make_Linker_Section_Pragma
(Ent : Entity_Id;
Loc : Source_Ptr;
Sec : String) return Node_Id;
-- Construct a Linker_Section pragma for entity Ent, using string Sec as
-- the section name. Loc is the Sloc value to use in building the pragma.
function Make_Pragma
(Sloc : Source_Ptr;
Chars : Name_Id;
Pragma_Argument_Associations : List_Id := No_List) return Node_Id;
-- A convenient form of Make_Pragma not requiring a Pragma_Identifier
-- argument (this argument is built from the value given for Chars).
function Make_Raise_Constraint_Error
(Sloc : Source_Ptr;
Condition : Node_Id := Empty;
Reason : RT_Exception_Code) return Node_Id;
pragma Inline (Make_Raise_Constraint_Error);
-- A convenient form of Make_Raise_Constraint_Error where the Reason
-- is given simply as an enumeration value, rather than a Uint code.
function Make_Raise_Program_Error
(Sloc : Source_Ptr;
Condition : Node_Id := Empty;
Reason : RT_Exception_Code) return Node_Id;
pragma Inline (Make_Raise_Program_Error);
-- A convenient form of Make_Raise_Program_Error where the Reason
-- is given simply as an enumeration value, rather than a Uint code.
function Make_Raise_Storage_Error
(Sloc : Source_Ptr;
Condition : Node_Id := Empty;
Reason : RT_Exception_Code) return Node_Id;
pragma Inline (Make_Raise_Storage_Error);
-- A convenient form of Make_Raise_Storage_Error where the Reason is given
-- simply as an enumeration value, rather than a Uint code.
function Make_String_Literal
(Sloc : Source_Ptr;
Strval : String) return Node_Id;
-- A convenient form of Make_String_Literal, where the string value is
-- given as a normal string instead of a String_Id value.
function Make_Temporary
(Loc : Source_Ptr;
Id : Character;
Related_Node : Node_Id := Empty) return Entity_Id;
-- This function should be used for all cases where a defining identifier
-- is to be built with a name to be obtained by New_Internal_Name (here Id
-- is the character passed as the argument to New_Internal_Name). Loc is
-- the location for the Sloc value of the resulting Entity. Note that this
-- can be used for all kinds of temporary defining identifiers used in
-- expansion (objects, subtypes, functions etc).
--
-- Related_Node is used when the defining identifier is for an object that
-- captures the value of an expression (e.g. an aggregate). It should be
-- set whenever possible to point to the expression that is being captured.
-- This is provided to get better error messages, e.g. from CodePeer.
function Make_Unsuppress_Block
(Loc : Source_Ptr;
Check : Name_Id;
Stmts : List_Id) return Node_Id;
-- Build a block with a pragma Suppress on 'Check'. Stmts is the statements
-- list that needs protection against the check
function New_Constraint_Error (Loc : Source_Ptr) return Node_Id;
-- This function builds a tree corresponding to the Ada statement
-- "raise Constraint_Error" and returns the root of this tree,
-- the N_Raise_Statement node.
function New_Op_Node
(New_Node_Kind : Node_Kind;
New_Sloc : Source_Ptr) return Node_Id;
-- Create node using New_Node and, if its kind is in N_Op, set its Chars
-- field accordingly.
function New_External_Name
(Related_Id : Name_Id;
Suffix : Character := ' ';
Suffix_Index : Int := 0;
Prefix : Character := ' ') return Name_Id;
function New_External_Name
(Related_Id : Name_Id;
Suffix : String;
Suffix_Index : Int := 0;
Prefix : Character := ' ') return Name_Id;
-- Builds a new entry in the names table of the form:
--
-- [Prefix &] Related_Id [& Suffix] [& Suffix_Index]
--
-- Prefix is prepended only if Prefix is non-blank (in which case it
-- must be an upper case letter other than O,Q,U,W (which are used for
-- identifier encoding, see Namet), or an underscore, and T is reserved for
-- use by implicit types, and X is reserved for use by debug type encoding
-- (see package Exp_Dbug). Note: the reason that Prefix is last is that it
-- is almost always omitted. The notable case of Prefix being non-null is
-- when it is 'T' for an implicit type.
-- Suffix_Index'Image is appended only if the value of Suffix_Index is
-- positive, or if Suffix_Index is negative 1, then a unique serialized
-- suffix is added. If Suffix_Index is zero, then no index is appended.
-- Suffix is also a single upper case letter other than O,Q,U,W,X (T is
-- allowed in this context), or a string of such upper case letters. In
-- the case of a string, an initial underscore may be given.
--
-- The constructed name is stored using Name_Find so that it can be located
-- using a subsequent Name_Find operation (i.e. it is properly hashed into
-- the names table). The upper case letter given as the Suffix argument
-- ensures that the name does not clash with any Ada identifier name. These
-- generated names are permitted, but not required, to be made public by
-- setting the flag Is_Public in the associated entity.
--
-- Note: it is dubious to make them public if they have serial numbers,
-- since we are counting on the serial numbers being the same for the
-- clients with'ing a package and the actual compilation of the package
-- with full expansion. This is a dubious assumption ???
function New_External_Name
(Suffix : Character;
Suffix_Index : Nat) return Name_Id;
-- Builds a new entry in the names table of the form
-- Suffix & Suffix_Index'Image
-- where Suffix is a single upper case letter other than O,Q,U,W,X and is
-- a required parameter (T is permitted). The constructed name is stored
-- using Name_Find so that it can be located using a subsequent Name_Find
-- operation (i.e. it is properly hashed into the names table). The upper
-- case letter given as the Suffix argument ensures that the name does
-- not clash with any Ada identifier name. These generated names are
-- permitted, but not required, to be made public by setting the flag
-- Is_Public in the associated entity.
--
-- Note: it is dubious to make these public since they have serial numbers,
-- which means we are counting on the serial numbers being the same for the
-- clients with'ing a package and the actual compilation of the package
-- with full expansion. This is a dubious assumption ???
function New_Internal_Name (Id_Char : Character) return Name_Id;
-- Id_Char is an upper case letter other than O,Q,U,W (which are reserved
-- for identifier encoding (see Namet package for details) and X which is
-- used for debug encoding (see Exp_Dbug). The letter T is permitted, but
-- is reserved by convention for the case of internally generated types.
-- The result of the call is a new generated unique name of the form XyyyU
-- where X is Id_Char, yyy is a unique serial number, and U is either a
-- lower case s or b indicating if the current unit is a spec or a body.
--
-- The name is entered into the names table using Name_Enter rather than
-- Name_Find, because there can never be a need to locate the entry using
-- the Name_Find procedure later on. Names created by New_Internal_Name
-- are guaranteed to be consistent from one compilation to another (i.e.
-- if the identical unit is compiled with a semantically consistent set
-- of sources, the numbers will be consistent). This means that it is fine
-- to use these as public symbols.
--
-- Note: Nearly all uses of this function are via calls to Make_Temporary,
-- but there are just a few cases where it is called directly.
--
-- Note: despite the guarantee of consistency stated above, it is dubious
-- to make these public since they have serial numbers, which means we are
-- counting on the serial numbers being the same for the clients with'ing
-- a package and the actual compilation of the package with full expansion.
-- This is a dubious assumption ???
function New_Occurrence_Of
(Def_Id : Entity_Id;
Loc : Source_Ptr) return Node_Id;
-- New_Occurrence_Of creates an N_Identifier node that is an occurrence of
-- the defining identifier Def_Id. The Entity of the result is Def_Id. The
-- Etype of the result is Def_Id for types, and Etype (Def_Id) otherwise.
-- Is_Static_Expression is set if this call creates an occurrence of an
-- enumeration literal.
function New_Suffixed_Name
(Related_Id : Name_Id;
Suffix : String) return Name_Id;
-- This function is used to create special suffixed names used by the
-- debugger. Suffix is a string of upper case letters, used to construct
-- the required name. For instance, the special type used to record the
-- fixed-point small is called typ_SMALL where typ is the name of the
-- fixed-point type (as passed in Related_Id), and Suffix is "SMALL".
function Sel_Comp (Pre, Sel : String; Loc : Source_Ptr) return Node_Id;
function Sel_Comp (Pre : Node_Id; Sel : String) return Node_Id;
-- Create a selected component of the form Pre.Sel; that is, Pre is the
-- prefix, and Sel is the selector name.
function OK_Convert_To (Typ : Entity_Id; Expr : Node_Id) return Node_Id;
-- Like Convert_To, except that a conversion node is always generated, and
-- the Conversion_OK flag is set on this conversion node.
function Unchecked_Convert_To
(Typ : Entity_Id;
Expr : Node_Id) return Node_Id;
-- Like Convert_To, but if a conversion is actually needed, constructs an
-- N_Unchecked_Type_Conversion node to do the required conversion. Unlike
-- Convert_To, a new node is not required if Expr is already of the correct
-- BASE type, and if a new node is created, the Parent of Expr is copied to
-- it.
-------------------------------------
-- Subprograms for Use by Gnat1drv --
-------------------------------------
function Make_Id (Str : Text_Buffer) return Node_Id;
function Make_SC (Pre, Sel : Node_Id) return Node_Id;
procedure Set_NOD (Unit : Node_Id);
procedure Set_NSA (Asp : Name_Id; OK : out Boolean);
procedure Set_NUA (Attr : Name_Id; OK : out Boolean);
procedure Set_NUP (Prag : Name_Id; OK : out Boolean);
-- Subprograms for call to Get_Target_Parameters in Gnat1drv, see spec
-- of package Targparm for full description of these four subprograms.
-- These have to be declared at the top level of a package (accessibility
-- issues), and Gnat1drv is a procedure, so they can't go there.
end Tbuild;
|
MinimSecure/unum-sdk | Ada | 831 | adb | -- Copyright 2017-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package body Pck is
procedure Inspect (Obj: access Top_T'Class) is
begin
null;
end Inspect;
end Pck;
|
zhmu/ananas | Ada | 28,553 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . S T R I N G S . S T R E A M _ O P S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2008-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.IO_Exceptions; use Ada.IO_Exceptions;
with Ada.Streams; use Ada.Streams;
with Ada.Unchecked_Conversion;
with System.Storage_Elements; use System.Storage_Elements;
with System.Stream_Attributes;
package body System.Strings.Stream_Ops is
-- The following type describes the low-level IO mechanism used in package
-- Stream_Ops_Internal.
type IO_Kind is (Byte_IO, Block_IO);
-- The following package provides an IO framework for strings. Depending
-- on the version of System.Stream_Attributes as well as the size of
-- formal parameter Element_Type, the package will either utilize block
-- IO or element-by-element IO.
generic
type Element_Type is private;
type Index_Type is range <>;
type Array_Type is array (Index_Type range <>) of Element_Type;
package Stream_Ops_Internal is
function Input
(Strm : access Root_Stream_Type'Class;
IO : IO_Kind;
Max_Length : Long_Integer := Long_Integer'Last) return Array_Type;
-- Raises an exception if you try to read a String that is longer than
-- Max_Length. See expansion of Attribute_Input in Exp_Attr for details.
procedure Output
(Strm : access Root_Stream_Type'Class;
Item : Array_Type;
IO : IO_Kind);
procedure Read
(Strm : access Root_Stream_Type'Class;
Item : out Array_Type;
IO : IO_Kind);
procedure Write
(Strm : access Root_Stream_Type'Class;
Item : Array_Type;
IO : IO_Kind);
end Stream_Ops_Internal;
-------------------------
-- Stream_Ops_Internal --
-------------------------
package body Stream_Ops_Internal is
-- The following value represents the number of BITS allocated for the
-- default block used in string IO. The sizes of all other types are
-- calculated relative to this value.
Default_Block_Size : constant := 512 * 8;
-- Shorthand notation for stream element and element type sizes
ET_Size : constant Integer := Element_Type'Size;
SE_Size : constant Integer := Stream_Element'Size;
-- The following constants describe the number of array elements or
-- stream elements that can fit into a default block.
AE_In_Default_Block : constant Index_Type :=
Index_Type (Default_Block_Size / ET_Size);
-- Number of array elements in a default block
SE_In_Default_Block : constant Integer := Default_Block_Size / SE_Size;
-- Number of storage elements in a default block
-- Buffer types
subtype Default_Block is Stream_Element_Array
(1 .. Stream_Element_Offset (SE_In_Default_Block));
subtype Array_Block is
Array_Type (Index_Type range 1 .. AE_In_Default_Block);
-- Conversions to and from Default_Block
function To_Default_Block is
new Ada.Unchecked_Conversion (Array_Block, Default_Block);
function To_Array_Block is
new Ada.Unchecked_Conversion (Default_Block, Array_Block);
-----------
-- Input --
-----------
function Input
(Strm : access Root_Stream_Type'Class;
IO : IO_Kind;
Max_Length : Long_Integer := Long_Integer'Last) return Array_Type
is
pragma Unsuppress (All_Checks);
-- The above makes T'Class'Input robust in the case of bad data. The
-- declaration of Item below could raise Storage_Error if the length
-- is too big.
begin
if Strm = null then
raise Constraint_Error;
end if;
declare
Low, High : Index_Type'Base;
begin
-- Read the bounds of the string. Note that they could be out of
-- range of Index_Type in the case of empty arrays.
Index_Type'Read (Strm, Low);
Index_Type'Read (Strm, High);
if Long_Integer (High) - Long_Integer (Low) > Max_Length then
raise Constraint_Error;
end if;
-- Read the character content of the string
declare
Item : Array_Type (Low .. High);
begin
Read (Strm, Item, IO);
return Item;
end;
end;
end Input;
------------
-- Output --
------------
procedure Output
(Strm : access Root_Stream_Type'Class;
Item : Array_Type;
IO : IO_Kind)
is
begin
if Strm = null then
raise Constraint_Error;
end if;
-- Write the bounds of the string
Index_Type'Write (Strm, Item'First);
Index_Type'Write (Strm, Item'Last);
-- Write the character content of the string
Write (Strm, Item, IO);
end Output;
----------
-- Read --
----------
procedure Read
(Strm : access Root_Stream_Type'Class;
Item : out Array_Type;
IO : IO_Kind)
is
begin
if Strm = null then
raise Constraint_Error;
end if;
-- Nothing to do if the desired string is empty
if Item'Length = 0 then
return;
end if;
-- Block IO
if IO = Block_IO and then Stream_Attributes.Block_IO_OK then
declare
-- Determine the size in BITS of the block necessary to contain
-- the whole string.
-- Since we are dealing with strings indexed by natural, there
-- is no risk of overflow when using a Long_Long_Integer.
Block_Size : constant Long_Long_Integer :=
Item'Length * Long_Long_Integer (ET_Size);
-- Item can be larger than what the default block can store,
-- determine the number of whole writes necessary to output the
-- string.
Blocks : constant Natural :=
Natural (Block_Size / Long_Long_Integer (Default_Block_Size));
-- The size of Item may not be a multiple of the default block
-- size, determine the size of the remaining chunk.
Rem_Size : constant Natural :=
Natural
(Block_Size mod Long_Long_Integer (Default_Block_Size));
-- String indexes
Low : Index_Type := Item'First;
High : Index_Type := Low + AE_In_Default_Block - 1;
-- End of stream error detection
Last : Stream_Element_Offset := 0;
Sum : Stream_Element_Offset := 0;
begin
-- Step 1: If the string is too large, read in individual
-- chunks the size of the default block.
if Blocks > 0 then
declare
Block : Default_Block;
begin
for Counter in 1 .. Blocks loop
Read (Strm.all, Block, Last);
Item (Low .. High) := To_Array_Block (Block);
Low := High + 1;
High := Low + AE_In_Default_Block - 1;
Sum := Sum + Last;
Last := 0;
end loop;
end;
end if;
-- Step 2: Read in any remaining elements
if Rem_Size > 0 then
declare
subtype Rem_Block is Stream_Element_Array
(1 .. Stream_Element_Offset (Rem_Size / SE_Size));
subtype Rem_Array_Block is
Array_Type (Index_Type range
1 .. Index_Type (Rem_Size / ET_Size));
function To_Rem_Array_Block is new
Ada.Unchecked_Conversion (Rem_Block, Rem_Array_Block);
Block : Rem_Block;
begin
Read (Strm.all, Block, Last);
Item (Low .. Item'Last) := To_Rem_Array_Block (Block);
Sum := Sum + Last;
end;
end if;
-- Step 3: Potential error detection. The sum of all the
-- chunks is less than we initially wanted to read. In other
-- words, the stream does not contain enough elements to fully
-- populate Item.
if (Integer (Sum) * SE_Size) / ET_Size < Item'Length then
raise End_Error;
end if;
end;
-- Byte IO
else
declare
E : Element_Type;
begin
for Index in Item'First .. Item'Last loop
Element_Type'Read (Strm, E);
Item (Index) := E;
end loop;
end;
end if;
end Read;
-----------
-- Write --
-----------
procedure Write
(Strm : access Root_Stream_Type'Class;
Item : Array_Type;
IO : IO_Kind)
is
begin
if Strm = null then
raise Constraint_Error;
end if;
-- Nothing to do if the input string is empty
if Item'Length = 0 then
return;
end if;
-- Block IO
if IO = Block_IO and then Stream_Attributes.Block_IO_OK then
declare
-- Determine the size in BITS of the block necessary to contain
-- the whole string.
-- Since we are dealing with strings indexed by natural, there
-- is no risk of overflow when using a Long_Long_Integer.
Block_Size : constant Long_Long_Integer :=
Item'Length * Long_Long_Integer (ET_Size);
-- Item can be larger than what the default block can store,
-- determine the number of whole writes necessary to output the
-- string.
Blocks : constant Natural :=
Natural (Block_Size / Long_Long_Integer (Default_Block_Size));
-- The size of Item may not be a multiple of the default block
-- size, determine the size of the remaining chunk.
Rem_Size : constant Natural :=
Natural
(Block_Size mod Long_Long_Integer (Default_Block_Size));
-- String indexes
Low : Index_Type := Item'First;
High : Index_Type := Low + AE_In_Default_Block - 1;
begin
-- Step 1: If the string is too large, write out individual
-- chunks the size of the default block.
for Counter in 1 .. Blocks loop
Write (Strm.all, To_Default_Block (Item (Low .. High)));
Low := High + 1;
High := Low + AE_In_Default_Block - 1;
end loop;
-- Step 2: Write out any remaining elements
if Rem_Size > 0 then
declare
subtype Rem_Block is Stream_Element_Array
(1 .. Stream_Element_Offset (Rem_Size / SE_Size));
subtype Rem_Array_Block is
Array_Type (Index_Type range
1 .. Index_Type (Rem_Size / ET_Size));
function To_Rem_Block is new
Ada.Unchecked_Conversion (Rem_Array_Block, Rem_Block);
begin
Write (Strm.all, To_Rem_Block (Item (Low .. Item'Last)));
end;
end if;
end;
-- Byte IO
else
for Index in Item'First .. Item'Last loop
Element_Type'Write (Strm, Item (Index));
end loop;
end if;
end Write;
end Stream_Ops_Internal;
-- Specific instantiations for all Ada array types handled
package Storage_Array_Ops is
new Stream_Ops_Internal
(Element_Type => Storage_Element,
Index_Type => Storage_Offset,
Array_Type => Storage_Array);
package Stream_Element_Array_Ops is
new Stream_Ops_Internal
(Element_Type => Stream_Element,
Index_Type => Stream_Element_Offset,
Array_Type => Stream_Element_Array);
package String_Ops is
new Stream_Ops_Internal
(Element_Type => Character,
Index_Type => Positive,
Array_Type => String);
package Wide_String_Ops is
new Stream_Ops_Internal
(Element_Type => Wide_Character,
Index_Type => Positive,
Array_Type => Wide_String);
package Wide_Wide_String_Ops is
new Stream_Ops_Internal
(Element_Type => Wide_Wide_Character,
Index_Type => Positive,
Array_Type => Wide_Wide_String);
-------------------------
-- Storage_Array_Input --
-------------------------
function Storage_Array_Input
(Strm : access Ada.Streams.Root_Stream_Type'Class) return Storage_Array
is
begin
return Storage_Array_Ops.Input (Strm, Byte_IO);
end Storage_Array_Input;
--------------------------------
-- Storage_Array_Input_Blk_IO --
--------------------------------
function Storage_Array_Input_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class) return Storage_Array
is
begin
return Storage_Array_Ops.Input (Strm, Block_IO);
end Storage_Array_Input_Blk_IO;
--------------------------
-- Storage_Array_Output --
--------------------------
procedure Storage_Array_Output
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Storage_Array)
is
begin
Storage_Array_Ops.Output (Strm, Item, Byte_IO);
end Storage_Array_Output;
---------------------------------
-- Storage_Array_Output_Blk_IO --
---------------------------------
procedure Storage_Array_Output_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Storage_Array)
is
begin
Storage_Array_Ops.Output (Strm, Item, Block_IO);
end Storage_Array_Output_Blk_IO;
------------------------
-- Storage_Array_Read --
------------------------
procedure Storage_Array_Read
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : out Storage_Array)
is
begin
Storage_Array_Ops.Read (Strm, Item, Byte_IO);
end Storage_Array_Read;
-------------------------------
-- Storage_Array_Read_Blk_IO --
-------------------------------
procedure Storage_Array_Read_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : out Storage_Array)
is
begin
Storage_Array_Ops.Read (Strm, Item, Block_IO);
end Storage_Array_Read_Blk_IO;
-------------------------
-- Storage_Array_Write --
-------------------------
procedure Storage_Array_Write
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Storage_Array)
is
begin
Storage_Array_Ops.Write (Strm, Item, Byte_IO);
end Storage_Array_Write;
--------------------------------
-- Storage_Array_Write_Blk_IO --
--------------------------------
procedure Storage_Array_Write_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Storage_Array)
is
begin
Storage_Array_Ops.Write (Strm, Item, Block_IO);
end Storage_Array_Write_Blk_IO;
--------------------------------
-- Stream_Element_Array_Input --
--------------------------------
function Stream_Element_Array_Input
(Strm : access Ada.Streams.Root_Stream_Type'Class)
return Stream_Element_Array
is
begin
return Stream_Element_Array_Ops.Input (Strm, Byte_IO);
end Stream_Element_Array_Input;
---------------------------------------
-- Stream_Element_Array_Input_Blk_IO --
---------------------------------------
function Stream_Element_Array_Input_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class)
return Stream_Element_Array
is
begin
return Stream_Element_Array_Ops.Input (Strm, Block_IO);
end Stream_Element_Array_Input_Blk_IO;
---------------------------------
-- Stream_Element_Array_Output --
---------------------------------
procedure Stream_Element_Array_Output
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Stream_Element_Array)
is
begin
Stream_Element_Array_Ops.Output (Strm, Item, Byte_IO);
end Stream_Element_Array_Output;
----------------------------------------
-- Stream_Element_Array_Output_Blk_IO --
----------------------------------------
procedure Stream_Element_Array_Output_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Stream_Element_Array)
is
begin
Stream_Element_Array_Ops.Output (Strm, Item, Block_IO);
end Stream_Element_Array_Output_Blk_IO;
-------------------------------
-- Stream_Element_Array_Read --
-------------------------------
procedure Stream_Element_Array_Read
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : out Stream_Element_Array)
is
begin
Stream_Element_Array_Ops.Read (Strm, Item, Byte_IO);
end Stream_Element_Array_Read;
--------------------------------------
-- Stream_Element_Array_Read_Blk_IO --
--------------------------------------
procedure Stream_Element_Array_Read_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : out Stream_Element_Array)
is
begin
Stream_Element_Array_Ops.Read (Strm, Item, Block_IO);
end Stream_Element_Array_Read_Blk_IO;
--------------------------------
-- Stream_Element_Array_Write --
--------------------------------
procedure Stream_Element_Array_Write
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Stream_Element_Array)
is
begin
Stream_Element_Array_Ops.Write (Strm, Item, Byte_IO);
end Stream_Element_Array_Write;
---------------------------------------
-- Stream_Element_Array_Write_Blk_IO --
---------------------------------------
procedure Stream_Element_Array_Write_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Stream_Element_Array)
is
begin
Stream_Element_Array_Ops.Write (Strm, Item, Block_IO);
end Stream_Element_Array_Write_Blk_IO;
------------------
-- String_Input --
------------------
function String_Input
(Strm : access Ada.Streams.Root_Stream_Type'Class) return String
is
begin
return String_Ops.Input (Strm, Byte_IO);
end String_Input;
-------------------------
-- String_Input_Blk_IO --
-------------------------
function String_Input_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class) return String
is
begin
return String_Ops.Input (Strm, Block_IO);
end String_Input_Blk_IO;
-------------------------
-- String_Input_Tag --
-------------------------
function String_Input_Tag
(Strm : access Ada.Streams.Root_Stream_Type'Class) return String
is
begin
return String_Ops.Input (Strm, Block_IO, Max_Length => 10_000);
end String_Input_Tag;
-------------------
-- String_Output --
-------------------
procedure String_Output
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : String)
is
begin
String_Ops.Output (Strm, Item, Byte_IO);
end String_Output;
--------------------------
-- String_Output_Blk_IO --
--------------------------
procedure String_Output_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : String)
is
begin
String_Ops.Output (Strm, Item, Block_IO);
end String_Output_Blk_IO;
-----------------
-- String_Read --
-----------------
procedure String_Read
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : out String)
is
begin
String_Ops.Read (Strm, Item, Byte_IO);
end String_Read;
------------------------
-- String_Read_Blk_IO --
------------------------
procedure String_Read_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : out String)
is
begin
String_Ops.Read (Strm, Item, Block_IO);
end String_Read_Blk_IO;
------------------
-- String_Write --
------------------
procedure String_Write
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : String)
is
begin
String_Ops.Write (Strm, Item, Byte_IO);
end String_Write;
-------------------------
-- String_Write_Blk_IO --
-------------------------
procedure String_Write_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : String)
is
begin
String_Ops.Write (Strm, Item, Block_IO);
end String_Write_Blk_IO;
-----------------------
-- Wide_String_Input --
-----------------------
function Wide_String_Input
(Strm : access Ada.Streams.Root_Stream_Type'Class) return Wide_String
is
begin
return Wide_String_Ops.Input (Strm, Byte_IO);
end Wide_String_Input;
------------------------------
-- Wide_String_Input_Blk_IO --
------------------------------
function Wide_String_Input_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class) return Wide_String
is
begin
return Wide_String_Ops.Input (Strm, Block_IO);
end Wide_String_Input_Blk_IO;
------------------------
-- Wide_String_Output --
------------------------
procedure Wide_String_Output
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Wide_String)
is
begin
Wide_String_Ops.Output (Strm, Item, Byte_IO);
end Wide_String_Output;
-------------------------------
-- Wide_String_Output_Blk_IO --
-------------------------------
procedure Wide_String_Output_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Wide_String)
is
begin
Wide_String_Ops.Output (Strm, Item, Block_IO);
end Wide_String_Output_Blk_IO;
----------------------
-- Wide_String_Read --
----------------------
procedure Wide_String_Read
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : out Wide_String)
is
begin
Wide_String_Ops.Read (Strm, Item, Byte_IO);
end Wide_String_Read;
-----------------------------
-- Wide_String_Read_Blk_IO --
-----------------------------
procedure Wide_String_Read_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : out Wide_String)
is
begin
Wide_String_Ops.Read (Strm, Item, Block_IO);
end Wide_String_Read_Blk_IO;
-----------------------
-- Wide_String_Write --
-----------------------
procedure Wide_String_Write
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Wide_String)
is
begin
Wide_String_Ops.Write (Strm, Item, Byte_IO);
end Wide_String_Write;
------------------------------
-- Wide_String_Write_Blk_IO --
------------------------------
procedure Wide_String_Write_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Wide_String)
is
begin
Wide_String_Ops.Write (Strm, Item, Block_IO);
end Wide_String_Write_Blk_IO;
----------------------------
-- Wide_Wide_String_Input --
----------------------------
function Wide_Wide_String_Input
(Strm : access Ada.Streams.Root_Stream_Type'Class) return Wide_Wide_String
is
begin
return Wide_Wide_String_Ops.Input (Strm, Byte_IO);
end Wide_Wide_String_Input;
-----------------------------------
-- Wide_Wide_String_Input_Blk_IO --
-----------------------------------
function Wide_Wide_String_Input_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class) return Wide_Wide_String
is
begin
return Wide_Wide_String_Ops.Input (Strm, Block_IO);
end Wide_Wide_String_Input_Blk_IO;
-----------------------------
-- Wide_Wide_String_Output --
-----------------------------
procedure Wide_Wide_String_Output
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Wide_Wide_String)
is
begin
Wide_Wide_String_Ops.Output (Strm, Item, Byte_IO);
end Wide_Wide_String_Output;
------------------------------------
-- Wide_Wide_String_Output_Blk_IO --
------------------------------------
procedure Wide_Wide_String_Output_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Wide_Wide_String)
is
begin
Wide_Wide_String_Ops.Output (Strm, Item, Block_IO);
end Wide_Wide_String_Output_Blk_IO;
---------------------------
-- Wide_Wide_String_Read --
---------------------------
procedure Wide_Wide_String_Read
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : out Wide_Wide_String)
is
begin
Wide_Wide_String_Ops.Read (Strm, Item, Byte_IO);
end Wide_Wide_String_Read;
----------------------------------
-- Wide_Wide_String_Read_Blk_IO --
----------------------------------
procedure Wide_Wide_String_Read_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : out Wide_Wide_String)
is
begin
Wide_Wide_String_Ops.Read (Strm, Item, Block_IO);
end Wide_Wide_String_Read_Blk_IO;
----------------------------
-- Wide_Wide_String_Write --
----------------------------
procedure Wide_Wide_String_Write
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Wide_Wide_String)
is
begin
Wide_Wide_String_Ops.Write (Strm, Item, Byte_IO);
end Wide_Wide_String_Write;
-----------------------------------
-- Wide_Wide_String_Write_Blk_IO --
-----------------------------------
procedure Wide_Wide_String_Write_Blk_IO
(Strm : access Ada.Streams.Root_Stream_Type'Class;
Item : Wide_Wide_String)
is
begin
Wide_Wide_String_Ops.Write (Strm, Item, Block_IO);
end Wide_Wide_String_Write_Blk_IO;
end System.Strings.Stream_Ops;
|
zhmu/ananas | Ada | 397 | adb | -- { dg-do run }
with Ada.Streams; use Ada.Streams;
procedure Array_Bounds_Test is
One : constant Stream_Element := 1;
Two : constant Stream_Element := 2;
Sample : constant Stream_Element_Array := (0 => One) & Two;
begin
if Sample'First /= 0 then
raise Program_Error;
end if;
if Sample'Last /= 1 then
raise Program_Error;
end if;
end Array_Bounds_Test;
|
zhmu/ananas | Ada | 7,414 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . W I D E _ W I D E _ C H A R A C T E R S . H A N D L I N G --
-- --
-- B o d y --
-- --
-- Copyright (C) 2010-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Wide_Wide_Characters.Unicode; use Ada.Wide_Wide_Characters.Unicode;
package body Ada.Wide_Wide_Characters.Handling is
---------------------------
-- Character_Set_Version --
---------------------------
function Character_Set_Version return String is
begin
return "Unicode 4.0";
end Character_Set_Version;
---------------------
-- Is_Alphanumeric --
---------------------
function Is_Alphanumeric (Item : Wide_Wide_Character) return Boolean is
begin
return Is_Letter (Item) or else Is_Digit (Item);
end Is_Alphanumeric;
--------------
-- Is_Basic --
--------------
function Is_Basic (Item : Wide_Wide_Character) return Boolean
renames Ada.Wide_Wide_Characters.Unicode.Is_Basic;
----------------
-- Is_Control --
----------------
function Is_Control (Item : Wide_Wide_Character) return Boolean is
begin
return Get_Category (Item) = Cc;
end Is_Control;
--------------
-- Is_Digit --
--------------
function Is_Digit (Item : Wide_Wide_Character) return Boolean
renames Ada.Wide_Wide_Characters.Unicode.Is_Digit;
----------------
-- Is_Graphic --
----------------
function Is_Graphic (Item : Wide_Wide_Character) return Boolean is
begin
return not Is_Non_Graphic (Item);
end Is_Graphic;
--------------------------
-- Is_Hexadecimal_Digit --
--------------------------
function Is_Hexadecimal_Digit (Item : Wide_Wide_Character) return Boolean is
begin
return Is_Digit (Item)
or else Item in 'A' .. 'F'
or else Item in 'a' .. 'f';
end Is_Hexadecimal_Digit;
---------------
-- Is_Letter --
---------------
function Is_Letter (Item : Wide_Wide_Character) return Boolean
renames Ada.Wide_Wide_Characters.Unicode.Is_Letter;
------------------------
-- Is_Line_Terminator --
------------------------
function Is_Line_Terminator (Item : Wide_Wide_Character) return Boolean
renames Ada.Wide_Wide_Characters.Unicode.Is_Line_Terminator;
--------------
-- Is_Lower --
--------------
function Is_Lower (Item : Wide_Wide_Character) return Boolean is
begin
return Get_Category (Item) = Ll;
end Is_Lower;
-------------
-- Is_Mark --
-------------
function Is_Mark (Item : Wide_Wide_Character) return Boolean
renames Ada.Wide_Wide_Characters.Unicode.Is_Mark;
-------------
-- Is_NFKC --
-------------
function Is_NFKC (Item : Wide_Wide_Character) return Boolean
renames Ada.Wide_Wide_Characters.Unicode.Is_NFKC;
---------------------
-- Is_Other_Format --
---------------------
function Is_Other_Format (Item : Wide_Wide_Character) return Boolean
renames Ada.Wide_Wide_Characters.Unicode.Is_Other;
------------------------------
-- Is_Punctuation_Connector --
------------------------------
function Is_Punctuation_Connector
(Item : Wide_Wide_Character) return Boolean
renames Ada.Wide_Wide_Characters.Unicode.Is_Punctuation;
--------------
-- Is_Space --
--------------
function Is_Space (Item : Wide_Wide_Character) return Boolean
renames Ada.Wide_Wide_Characters.Unicode.Is_Space;
----------------
-- Is_Special --
----------------
function Is_Special (Item : Wide_Wide_Character) return Boolean is
begin
return Is_Graphic (Item) and then not Is_Alphanumeric (Item);
end Is_Special;
--------------
-- Is_Upper --
--------------
function Is_Upper (Item : Wide_Wide_Character) return Boolean is
begin
return Get_Category (Item) = Lu;
end Is_Upper;
--------------
-- To_Lower --
--------------
function To_Lower (Item : Wide_Wide_Character) return Wide_Wide_Character
renames Ada.Wide_Wide_Characters.Unicode.To_Lower_Case;
function To_Lower (Item : Wide_Wide_String) return Wide_Wide_String is
Result : Wide_Wide_String (Item'Range);
begin
for J in Result'Range loop
Result (J) := To_Lower (Item (J));
end loop;
return Result;
end To_Lower;
--------------
-- To_Upper --
--------------
function To_Upper (Item : Wide_Wide_Character) return Wide_Wide_Character
renames Ada.Wide_Wide_Characters.Unicode.To_Upper_Case;
function To_Upper (Item : Wide_Wide_String) return Wide_Wide_String is
Result : Wide_Wide_String (Item'Range);
begin
for J in Result'Range loop
Result (J) := To_Upper (Item (J));
end loop;
return Result;
end To_Upper;
--------------
-- To_Basic --
--------------
function To_Basic (Item : Wide_Wide_Character) return Wide_Wide_Character
renames Ada.Wide_Wide_Characters.Unicode.To_Basic;
function To_Basic (Item : Wide_Wide_String) return Wide_Wide_String is
Result : Wide_Wide_String (Item'Range);
begin
for J in Result'Range loop
Result (J) := To_Basic (Item (J));
end loop;
return Result;
end To_Basic;
end Ada.Wide_Wide_Characters.Handling;
|
m-f-1998/university | Ada | 254 | ads | -- Filename: wtp.adb
--
-- Description: Models the Water Tank Protection System
--
pragma SPARK_Mode (On);
package WTP
with
Abstract_State => State
is
procedure Control
with
Global => (Output => State),
Depends => (State => null);
end WTP;
|
onox/orka | Ada | 963 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2022 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Orka.Transforms.Singles.Quaternions;
with Orka.Transforms.Singles.Vectors;
with Generic_Test_Transforms_Quaternions;
package Test_Transforms_Singles_Quaternions is new Generic_Test_Transforms_Quaternions
("Singles",
Orka.Transforms.Singles.Vectors,
Orka.Transforms.Singles.Quaternions);
|
reznikmm/matreshka | Ada | 3,503 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2018, 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 Core.Connectables.Slots_0.Slots_1.Slots_2.Generic_Emitters;
package WUI.Slots.Widgets.Widgets.Emitters is
new WUI.Slots.Widgets.Widgets.Generic_Emitters;
|
AdaCore/Ada_Drivers_Library | Ada | 8,323 | ads | -- Copyright (c) 2013, Nordic Semiconductor ASA
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice, this
-- list of conditions and the following disclaimer.
--
-- * Redistributions in binary form must reproduce the above copyright notice,
-- this list of conditions and the following disclaimer in the documentation
-- and/or other materials provided with the distribution.
--
-- * Neither the name of Nordic Semiconductor ASA nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--
-- This spec has been automatically generated from nrf51.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package NRF_SVD.RNG is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Shortcut between VALRDY event and STOP task.
type SHORTS_VALRDY_STOP_Field is
(-- Shortcut disabled.
Disabled,
-- Shortcut enabled.
Enabled)
with Size => 1;
for SHORTS_VALRDY_STOP_Field use
(Disabled => 0,
Enabled => 1);
-- Shortcuts for the RNG.
type SHORTS_Register is record
-- Shortcut between VALRDY event and STOP task.
VALRDY_STOP : SHORTS_VALRDY_STOP_Field := NRF_SVD.RNG.Disabled;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SHORTS_Register use record
VALRDY_STOP at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- Enable interrupt on VALRDY event.
type INTENSET_VALRDY_Field is
(-- Interrupt disabled.
Disabled,
-- Interrupt enabled.
Enabled)
with Size => 1;
for INTENSET_VALRDY_Field use
(Disabled => 0,
Enabled => 1);
-- Enable interrupt on VALRDY event.
type INTENSET_VALRDY_Field_1 is
(-- Reset value for the field
Intenset_Valrdy_Field_Reset,
-- Enable interrupt on write.
Set)
with Size => 1;
for INTENSET_VALRDY_Field_1 use
(Intenset_Valrdy_Field_Reset => 0,
Set => 1);
-- Interrupt enable set register
type INTENSET_Register is record
-- Enable interrupt on VALRDY event.
VALRDY : INTENSET_VALRDY_Field_1 := Intenset_Valrdy_Field_Reset;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for INTENSET_Register use record
VALRDY at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- Disable interrupt on VALRDY event.
type INTENCLR_VALRDY_Field is
(-- Interrupt disabled.
Disabled,
-- Interrupt enabled.
Enabled)
with Size => 1;
for INTENCLR_VALRDY_Field use
(Disabled => 0,
Enabled => 1);
-- Disable interrupt on VALRDY event.
type INTENCLR_VALRDY_Field_1 is
(-- Reset value for the field
Intenclr_Valrdy_Field_Reset,
-- Disable interrupt on write.
Clear)
with Size => 1;
for INTENCLR_VALRDY_Field_1 use
(Intenclr_Valrdy_Field_Reset => 0,
Clear => 1);
-- Interrupt enable clear register
type INTENCLR_Register is record
-- Disable interrupt on VALRDY event.
VALRDY : INTENCLR_VALRDY_Field_1 := Intenclr_Valrdy_Field_Reset;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for INTENCLR_Register use record
VALRDY at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- Digital error correction enable.
type CONFIG_DERCEN_Field is
(-- Digital error correction disabled.
Disabled,
-- Digital error correction enabled.
Enabled)
with Size => 1;
for CONFIG_DERCEN_Field use
(Disabled => 0,
Enabled => 1);
-- Configuration register.
type CONFIG_Register is record
-- Digital error correction enable.
DERCEN : CONFIG_DERCEN_Field := NRF_SVD.RNG.Disabled;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CONFIG_Register use record
DERCEN at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
subtype VALUE_VALUE_Field is HAL.UInt8;
-- RNG random number.
type VALUE_Register is record
-- Read-only. Generated random number.
VALUE : VALUE_VALUE_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for VALUE_Register use record
VALUE at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- Peripheral power control.
type POWER_POWER_Field is
(-- Module power disabled.
Disabled,
-- Module power enabled.
Enabled)
with Size => 1;
for POWER_POWER_Field use
(Disabled => 0,
Enabled => 1);
-- Peripheral power control.
type POWER_Register is record
-- Peripheral power control.
POWER : POWER_POWER_Field := NRF_SVD.RNG.Disabled;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for POWER_Register use record
POWER at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Random Number Generator.
type RNG_Peripheral is record
-- Start the random number generator.
TASKS_START : aliased HAL.UInt32;
-- Stop the random number generator.
TASKS_STOP : aliased HAL.UInt32;
-- New random number generated and written to VALUE register.
EVENTS_VALRDY : aliased HAL.UInt32;
-- Shortcuts for the RNG.
SHORTS : aliased SHORTS_Register;
-- Interrupt enable set register
INTENSET : aliased INTENSET_Register;
-- Interrupt enable clear register
INTENCLR : aliased INTENCLR_Register;
-- Configuration register.
CONFIG : aliased CONFIG_Register;
-- RNG random number.
VALUE : aliased VALUE_Register;
-- Peripheral power control.
POWER : aliased POWER_Register;
end record
with Volatile;
for RNG_Peripheral use record
TASKS_START at 16#0# range 0 .. 31;
TASKS_STOP at 16#4# range 0 .. 31;
EVENTS_VALRDY at 16#100# range 0 .. 31;
SHORTS at 16#200# range 0 .. 31;
INTENSET at 16#304# range 0 .. 31;
INTENCLR at 16#308# range 0 .. 31;
CONFIG at 16#504# range 0 .. 31;
VALUE at 16#508# range 0 .. 31;
POWER at 16#FFC# range 0 .. 31;
end record;
-- Random Number Generator.
RNG_Periph : aliased RNG_Peripheral
with Import, Address => RNG_Base;
end NRF_SVD.RNG;
|
persan/protobuf-ada | Ada | 1,868 | adb | with Ada.Streams.Stream_IO,
Message,
Ada.Text_IO,
Protocol_Buffers.Message;
with Protocol_Buffers.Wire_Format;
procedure Main is
Person : Message.Person.Instance;
begin
declare
Person : Message.Person.Instance;
Output_Stream : Ada.Streams.Stream_IO.Stream_Access;
Some_File : Ada.Streams.Stream_IO.File_Type;
begin
Person.Set_Name ("Joakim");
Person.Set_Id (2);
Ada.Text_IO.Put_Line ("Instance to save to file:");
Ada.Text_IO.Put_Line ("Age: " & String(Person.Name));
Ada.Text_IO.Put_Line ("Id: " & Person.Id'Img);
Ada.Streams.Stream_IO.Create (File => Some_File,
Name => "asdfk.dat");
Output_Stream := Ada.Streams.Stream_IO.Stream (Some_File);
Protocol_Buffers.Message.Serialize_Partial_To_Output_Stream (The_Message => Person,
Output_Stream => Output_Stream);
Ada.Streams.Stream_IO.Close (Some_File);
end;
declare
Person2 : Message.Person.Instance;
Input_Stream : Ada.Streams.Stream_IO.Stream_Access;
Input_File : Ada.Streams.Stream_IO.File_Type;
begin
Ada.Streams.Stream_IO.Open (File => Input_File,
Mode => Ada.Streams.Stream_IO.In_File,
Name => "asdfk.dat");
Input_Stream := Ada.Streams.Stream_IO.Stream (Input_File);
Protocol_Buffers.Message.Parse_From_Input_Stream (The_Message => Person2,
Input_Stream => Input_Stream);
Ada.Text_IO.Put_Line ("Instance to read from file:");
Ada.Text_IO.Put_Line ("Age: " & String (Person2.Name));
Ada.Text_IO.Put_Line ("Id: " & Person2.Id'Img);
Ada.Streams.Stream_IO.Close (Input_File);
end;
end Main;
|
reznikmm/matreshka | Ada | 3,858 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- 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$
------------------------------------------------------------------------------
package body League.Signals.Emitters is
----------
-- Emit --
----------
not overriding procedure Emit (Self : in out Emitter) is
Dummy : Matreshka.Internals.Signals.Holder_Array (1 .. 0);
begin
Self.Emit (Dummy);
end Emit;
------------
-- Signal --
------------
not overriding function Signal
(Self : in out Emitter) return League.Signals.Signal is
begin
return League.Signals.Signal'(Emitter => Self'Access);
end Signal;
end League.Signals.Emitters;
|
Vovanium/Encodings | Ada | 589 | ads | with Ada.Streams;
use Ada.Streams;
-- Several utilities to ease encoded string processing
package Encodings.Utility is
pragma Pure;
-- Generic array version of Stream.Read returning last element written
generic
type Element_Type is (<>);
type Index_Type is (<>);
type Array_Type is array(Index_Type range <>) of Element_Type;
procedure Read_Array(
Stream: in out Root_Stream_Type'Class;
Item: out Array_Type;
Last: out Index_Type'Base
);
procedure Read_String(Stream: in out Root_Stream_Type'Class; Item: out String; Last: out Positive'Base);
end Encodings.Utility;
|
reznikmm/matreshka | Ada | 7,038 | 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.Table_Representations_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Db_Table_Representations_Element_Node is
begin
return Self : Db_Table_Representations_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_Table_Representations_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_Table_Representations
(ODF.DOM.Db_Table_Representations_Elements.ODF_Db_Table_Representations_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_Table_Representations_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Table_Representations_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Db_Table_Representations_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_Table_Representations
(ODF.DOM.Db_Table_Representations_Elements.ODF_Db_Table_Representations_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_Table_Representations_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_Table_Representations
(Visitor,
ODF.DOM.Db_Table_Representations_Elements.ODF_Db_Table_Representations_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.Table_Representations_Element,
Db_Table_Representations_Element_Node'Tag);
end Matreshka.ODF_Db.Table_Representations_Elements;
|
sf17k/sdlada | Ada | 7,806 | ads | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2014-2015 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;
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 Positions is
record
X : Positive;
Y : Positive;
end record;
type Sizes is
record
Width : Positive;
Height : Positive;
end record;
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;
-- 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 Positive;
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;
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 Sizes;
procedure Set_Maximum_Size (Self : in out Window; Size : in Sizes) with
Inline => True;
function Get_Minimum_Size (Self : in Window) return Sizes;
procedure Set_Minimum_Size (Self : in out Window; Size : in 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 Positions;
procedure Set_Position (Self : in out Window; Position : Positions) with
Inline => True;
function Get_Size (Self : in Window) return Sizes;
procedure Set_Size (Self : in out Window; Size : in 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_Rectangles (Self : in Window; Rectangles : SDL.Video.Rectangles.Rectangle_Arrays);
-- Determine whether any windows have been created.
function Exist return Boolean;
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;
|
flyx/OpenGLAda | Ada | 813 | ads | -- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
with GL.Types;
private with GL.Low_Level;
package GL.Culling is
pragma Preelaborate;
type Face_Selector is (Front, Back, Front_And_Back);
use GL.Types;
procedure Set_Front_Face (Face : Orientation);
function Front_Face return Orientation;
procedure Set_Cull_Face (Selector : Face_Selector);
function Cull_Face return Face_Selector;
private
for Face_Selector use (Front => 16#0404#,
Back => 16#0405#,
Front_And_Back => 16#0408#);
for Face_Selector'Size use Low_Level.Enum'Size;
pragma Convention (StdCall, Set_Cull_Face);
pragma Convention (StdCall, Set_Front_Face);
end GL.Culling;
|
AdaCore/ada-traits-containers | Ada | 4,345 | adb | --
-- Copyright (C) 2016, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--
pragma Ada_2012;
with Asserts; use Asserts;
with Ada.Text_IO; use Ada.Text_IO;
with System.Assertions; use System.Assertions;
package body Support is
use Lists;
use Testsuite_Asserts;
use Asserts.Booleans;
use Asserts.Counts;
procedure Dump (L : Lists.List; Msg : String);
-- Display the contents of the list on stdout
----------
-- Dump --
----------
procedure Dump (L : Lists.List; Msg : String) is
begin
Put (Msg);
Put ("=[");
for E of L loop
Put (Image (E));
Put (',');
end loop;
Put_Line ("]");
end Dump;
----------
-- Test --
----------
procedure Test (L1, L2 : in out Lists.List) is
begin
-----------------
-- Empty lists --
-----------------
Assert (L1.Length, 0, "length of an empty list");
Assert (L1.Is_Empty, True, "empty list is empty ?");
L1.Clear; -- should be safe
for E of L1 loop
Put_Line ("Empty list, element loop");
end loop;
for C in L1 loop
Put_Line ("Empty list, cursor loop");
end loop;
-----------------
-- Large lists --
-----------------
for E in 1 .. 4 loop
L1.Append (E);
end loop;
Assert (L1.Length, 4, "length of list of 10 elements");
Assert (L1.Is_Empty, False, "list of 10 elements is empty ?");
Dump (L1, "element loop");
for C in L1 loop
Put_Line ("list, cursor loop =>" & Image (L1.Element (C)));
end loop;
------------
-- Assign --
------------
L2.Clear;
L2.Assign (Source => L1);
Assert (L2.Length, L1.Length, "lengths after assign");
Dump (L2, "assigned list, element loop");
------------
-- Insert --
------------
L2.Clear;
L2.Insert (No_Element, 1, Count => 3);
Assert (L2.Length, 3, "length after inserting 3 elements at tail");
Dump (L2, "after insert in empty");
L2.Insert (No_Element, 2, Count => 2);
Assert (L2.Length, 5, "length after inserting 2 elements at tail");
Dump (L2, "after insert");
L2.Insert (L2.First, 3);
Assert (L2.Length, 6, "length after inserting 1 elements at head");
Dump (L2, "after insert at head");
L2.Insert (L2.Next (L2.First), 4, Count => 2);
Assert (L2.Length, 8, "length after inserting 2 elements in middle");
Dump (L2, "after insert in middle");
-- ??? What happens if we pass a cursor in the wrong list ?
-- We currently get a contract case error, but we should be getting
-- a better error message.
-- L2.Insert (L1.First, 5);
---------------------
-- Replace_Element --
---------------------
L2.Replace_Element (L2.First, 10);
Dump (L2, "after replace_element");
begin
L2.Replace_Element (No_Element, 11);
Assert_Failed
("Expected precondition failure when replacing no_element");
exception
when Assert_Failure =>
null;
end;
------------
-- Delete --
------------
declare
C : Cursor := L2.First;
C2 : constant Cursor := L2.Next (C);
begin
L2.Delete (C, Count => 1);
Assert (L2.Length, 7, "length after delete head");
if C /= C2 then
Assert_Failed ("Cursor should have moved to second element");
end if;
Dump (L2, "after delete head");
end;
declare
C : Cursor := L2.First;
C2 : constant Cursor := L2.Next (L2.Next (C));
begin
L2.Delete (C, Count => 2);
Assert (L2.Length, 5, "length after delete 2 at head");
if C /= C2 then
Assert_Failed ("Cursor should have moved to third element");
end if;
Dump (L2, "after delete 2 at head");
end;
declare
C : Cursor := L2.Last;
begin
L2.Delete (C, Count => 20);
Assert (L2.Length, 4, "length after delete tail");
if C /= No_Element then
Assert_Failed ("Cursor should be no_element");
end if;
Dump (L2, "after delete at tail");
end;
end Test;
end Support;
|
AdaDoom3/wayland_ada_binding | Ada | 5,018 | ads | ------------------------------------------------------------------------------
-- Copyright (C) 2015-2016, 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 MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- 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/>. --
-- --
------------------------------------------------------------------------------
-- The implementation for bounded list of elements.
-- Such a list allocates its nodes in an array, so that no memory allocation
-- is needed. The implementation therefore looks like a vector, but since we
-- need to be able to insert in the middle of the list in constant time, the
-- nodes need to store extra information.
pragma Ada_2012;
with Conts.Elements;
generic
with package Elements is new Conts.Elements.Traits (<>);
type Container_Base_Type is abstract tagged limited private;
-- The base type for the container of nodes.
-- Since this type is eventually also used as the base type for the list
-- itself, this is a way to make lists either controlled or limited.
package Conts.Lists.Storage.Bounded with SPARK_Mode => Off is
pragma Assertion_Policy
(Pre => Suppressible, Ghost => Suppressible, Post => Ignore);
subtype Stored_Type is Elements.Stored_Type;
package Impl is
type Container (Capacity : Count_Type)
is abstract new Container_Base_Type with private;
type Node_Access is new Count_Type;
Null_Node_Access : constant Node_Access := 0;
procedure Allocate
(Self : in out Impl.Container'Class;
Element : Stored_Type;
N : out Impl.Node_Access);
function Get_Element
(Self : Impl.Container'Class;
N : Impl.Node_Access) return Stored_Type with Inline;
function Get_Next
(Self : Impl.Container'Class;
N : Impl.Node_Access) return Impl.Node_Access with Inline;
function Get_Previous
(Self : Impl.Container'Class;
N : Impl.Node_Access) return Impl.Node_Access with Inline;
procedure Set_Previous
(Self : in out Impl.Container'Class;
N, Prev : Impl.Node_Access) with Inline;
procedure Set_Next
(Self : in out Impl.Container'Class;
N, Next : Impl.Node_Access) with Inline;
procedure Set_Element
(Self : in out Impl.Container'Class;
N : Node_Access;
E : Stored_Type) with Inline;
function Capacity (Self : Impl.Container'Class) return Count_Type
is (Self.Capacity) with Inline;
procedure Assign
(Nodes : in out Impl.Container'Class;
Source : Impl.Container'Class;
New_Head : out Impl.Node_Access;
Old_Head : Impl.Node_Access;
New_Tail : out Impl.Node_Access;
Old_Tail : Impl.Node_Access)
with Pre => Nodes.Capacity >= Source.Capacity;
-- See description in Conts.Lists.Nodes
private
type Node is record
Element : Stored_Type;
Previous, Next : Node_Access := Null_Node_Access;
end record;
type Nodes_Array is array (Count_Type range <>) of Node;
type Container (Capacity : Count_Type) is
abstract new Container_Base_Type
with record
Free : Integer := 0; -- head of free nodes list
-- For a negative value, its absolute value points to the first free
-- element
Nodes : Nodes_Array (1 .. Capacity);
end record;
end Impl;
use Impl;
package Traits is new Conts.Lists.Storage.Traits
(Elements => Elements,
Container => Impl.Container,
Node_Access => Impl.Node_Access,
Null_Access => Impl.Null_Node_Access,
Allocate => Allocate);
end Conts.Lists.Storage.Bounded;
|
zhmu/ananas | Ada | 382 | adb | -- { dg-do compile { target *-*-linux* } }
-- { dg-options "-gnatws" }
procedure Trampoline3 is
A : Integer;
type FuncPtr is access function (I : Integer) return Integer;
function F (I : Integer) return Integer is
begin
return A + I;
end F;
P : FuncPtr := F'Access;
I : Integer;
begin
I := P(0);
end;
-- { dg-final { scan-assembler-not "GNU-stack.*x" } }
|
reznikmm/gela | Ada | 1,603 | ads | package Gela is
pragma Pure (Gela);
end Gela;
------------------------------------------------------------------------------
-- Copyright (c) 2006, Maxim Reznik
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- * this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- * notice, this list of conditions and the following disclaimer in the
-- * documentation and/or other materials provided with the distribution.
--
-- 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.
------------------------------------------------------------------------------
|
sungyeon/drake | Ada | 1,668 | ads | pragma License (Unrestricted);
private with System.Tasks;
package Ada.Task_Identification is
pragma Preelaborate;
type Task_Id is private;
pragma Preelaborable_Initialization (Task_Id);
Null_Task_Id : constant Task_Id;
-- function "=" (Left, Right : Task_Id) return Boolean;
-- predefined "=" is right
function Image (T : Task_Id) return String;
function Current_Task return Task_Id;
function Environment_Task return Task_Id;
procedure Abort_Task (T : Task_Id);
pragma Pure_Function (Environment_Task);
pragma Inline (Current_Task); -- renamed
pragma Inline (Environment_Task); -- renamed
pragma Inline (Abort_Task); -- renamed
function Is_Terminated (T : Task_Id) return Boolean;
function Is_Callable (T : Task_Id) return Boolean;
function Activation_Is_Complete (T : Task_Id) return Boolean;
pragma Inline (Is_Terminated); -- renamed
pragma Inline (Is_Callable); -- renamed
pragma Inline (Activation_Is_Complete); -- renamed
private
type Task_Id is new System.Tasks.Task_Id;
Null_Task_Id : constant Task_Id := null;
function Current_Task return Task_Id
renames Current_Task_Id; -- inherited
function Environment_Task return Task_Id
renames Environment_Task_Id; -- inherited
procedure Abort_Task (T : Task_Id)
renames Send_Abort; -- inherited
function Is_Terminated (T : Task_Id) return Boolean
renames Terminated; -- inherited
function Is_Callable (T : Task_Id) return Boolean
renames Callable; -- inherited
function Activation_Is_Complete (T : Task_Id) return Boolean
renames Activated; -- inherited
end Ada.Task_Identification;
|