content
stringlengths 23
1.05M
|
|---|
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired)
--
-- Copyright William A. Whitaker (1936–2010)
--
-- This is a free program, which means it is proper to copy it and pass
-- it on to your friends. Consider it a developmental item for which
-- there is no charge. However, just for form, it is Copyrighted
-- (c). Permission is hereby freely given for any and all use of program
-- and data. You can sell it as your own, but at least tell me.
--
-- This version is distributed without obligation, but the developer
-- would appreciate comments and suggestions.
--
-- All parts of the WORDS system, source code and data files, are made freely
-- available to anyone who wishes to use them, for whatever purpose.
separate (Latin_Utils.Inflections_Package)
package body Quality_Record_IO is
---------------------------------------------------------------------------
procedure Get (File : in File_Type; Item : out Quality_Record)
is
POFS : Part_Of_Speech_Type := X;
Spacer : Character := ' ';
pragma Unreferenced (Spacer);
Noun : Noun_Record;
Pronoun : Pronoun_Record;
Propack : Propack_Record;
Adjective : Adjective_Record;
Adverb : Adverb_Record;
Verb : Verb_Record;
Vparticiple : Vpar_Record;
Supin : Supine_Record;
Preposition : Preposition_Record;
Conjunction : Conjunction_Record;
Interjection : Interjection_Record;
Numeral : Numeral_Record;
Tackn : Tackon_Record;
Prefx : Prefix_Record;
Suffx : Suffix_Record;
begin
Part_Of_Speech_Type_IO.Get (File, POFS);
Get (File, Spacer);
case POFS is
when N =>
Noun_Record_IO.Get (File, Noun);
Item := (N, Noun);
when Pron =>
Pronoun_Record_IO.Get (File, Pronoun);
Item := (Pron, Pronoun);
when Pack =>
Propack_Record_IO.Get (File, Propack);
Item := (Pack, Propack);
when Adj =>
Adjective_Record_IO.Get (File, Adjective);
Item := (Adj, Adjective);
when Num =>
Numeral_Record_IO.Get (File, Numeral);
Item := (Num, Numeral);
when Adv =>
Adverb_Record_IO.Get (File, Adverb);
Item := (Adv, Adverb);
when V =>
Verb_Record_IO.Get (File, Verb);
Item := (V, Verb);
when Vpar =>
Vpar_Record_IO.Get (File, Vparticiple);
Item := (Vpar, Vparticiple);
when Supine =>
Supine_Record_IO.Get (File, Supin);
Item := (Supine, Supin);
when Prep =>
Preposition_Record_IO.Get (File, Preposition);
Item := (Prep, Preposition);
when Conj =>
Conjunction_Record_IO.Get (File, Conjunction);
Item := (Conj, Conjunction);
when Interj =>
Interjection_Record_IO.Get (File, Interjection);
Item := (Interj, Interjection);
when Tackon =>
Tackon_Record_IO.Get (File, Tackn);
Item := (Tackon, Tackn);
when Prefix =>
Prefix_Record_IO.Get (File, Prefx);
Item := (Prefix, Prefx);
when Suffix =>
Suffix_Record_IO.Get (File, Suffx);
Item := (Suffix, Suffx);
when X =>
Item := (Pofs => X);
end case;
end Get;
---------------------------------------------------------------------------
procedure Get (Item : out Quality_Record)
is
POFS : Part_Of_Speech_Type := X;
Spacer : Character := ' ';
pragma Unreferenced (Spacer);
Noun : Noun_Record;
Pronoun : Pronoun_Record;
Propack : Propack_Record;
Adjective : Adjective_Record;
Adverb : Adverb_Record;
Verb : Verb_Record;
Vparticiple : Vpar_Record;
Supin : Supine_Record;
Preposition : Preposition_Record;
Conjunction : Conjunction_Record;
Interjection : Interjection_Record;
Numeral : Numeral_Record;
Tackn : Tackon_Record;
Prefx : Prefix_Record;
Suffx : Suffix_Record;
begin
Part_Of_Speech_Type_IO.Get (POFS);
Get (Spacer);
case POFS is
when N =>
Noun_Record_IO.Get (Noun);
Item := (N, Noun);
when Pron =>
Pronoun_Record_IO.Get (Pronoun);
Item := (Pron, Pronoun);
when Pack =>
Propack_Record_IO.Get (Propack);
Item := (Pack, Propack);
when Adj =>
Adjective_Record_IO.Get (Adjective);
Item := (Adj, Adjective);
when Num =>
Numeral_Record_IO.Get (Numeral);
Item := (Num, Numeral);
when Adv =>
Adverb_Record_IO.Get (Adverb);
Item := (Adv, Adverb);
when V =>
Verb_Record_IO.Get (Verb);
Item := (V, Verb);
when Vpar =>
Vpar_Record_IO.Get (Vparticiple);
Item := (Vpar, Vparticiple);
when Supine =>
Supine_Record_IO.Get (Supin);
Item := (Supine, Supin);
when Prep =>
Preposition_Record_IO.Get (Preposition);
Item := (Prep, Preposition);
when Conj =>
Conjunction_Record_IO.Get (Conjunction);
Item := (Conj, Conjunction);
when Interj =>
Interjection_Record_IO.Get (Interjection);
Item := (Interj, Interjection);
when Tackon =>
Tackon_Record_IO.Get (Tackn);
Item := (Tackon, Tackn);
when Prefix =>
Prefix_Record_IO.Get (Prefx);
Item := (Prefix, Prefx);
when Suffix =>
Suffix_Record_IO.Get (Suffx);
Item := (Suffix, Suffx);
when X =>
Item := (Pofs => X);
end case;
end Get;
---------------------------------------------------------------------------
procedure Put (File : in File_Type; Item : in Quality_Record)
is
C : constant Positive := Positive (Col (File));
begin
Part_Of_Speech_Type_IO.Put (File, Item.Pofs);
Put (File, ' ');
case Item.Pofs is
when N =>
Noun_Record_IO.Put (File, Item.Noun);
when Pron =>
Pronoun_Record_IO.Put (File, Item.Pron);
when Pack =>
Propack_Record_IO.Put (File, Item.Pack);
when Adj =>
Adjective_Record_IO.Put (File, Item.Adj);
when Num =>
Numeral_Record_IO.Put (File, Item.Num);
when Adv =>
Adverb_Record_IO.Put (File, Item.Adv);
when V =>
Verb_Record_IO.Put (File, Item.Verb);
when Vpar =>
Vpar_Record_IO.Put (File, Item.Vpar);
when Supine =>
Supine_Record_IO.Put (File, Item.Supine);
when Prep =>
Preposition_Record_IO.Put (File, Item.Prep);
when Conj =>
Conjunction_Record_IO.Put (File, Item.Conj);
when Interj =>
Interjection_Record_IO.Put (File, Item.Interj);
when Tackon =>
Tackon_Record_IO.Put (File, Item.Tackon);
when Prefix =>
Prefix_Record_IO.Put (File, Item.Prefix);
when Suffix =>
Suffix_Record_IO.Put (File, Item.Suffix);
when others =>
null;
end case;
Put (File, String'(
Integer (Col (File)) .. Quality_Record_IO.Default_Width + C - 1
=> ' '));
end Put;
---------------------------------------------------------------------------
procedure Put (Item : in Quality_Record)
is
C : constant Positive := Positive (Col);
begin
Part_Of_Speech_Type_IO.Put (Item.Pofs);
Put (' ');
case Item.Pofs is
when N =>
Noun_Record_IO.Put (Item.Noun);
when Pron =>
Pronoun_Record_IO.Put (Item.Pron);
when Pack =>
Propack_Record_IO.Put (Item.Pack);
when Adj =>
Adjective_Record_IO.Put (Item.Adj);
when Num =>
Numeral_Record_IO.Put (Item.Num);
when Adv =>
Adverb_Record_IO.Put (Item.Adv);
when V =>
Verb_Record_IO.Put (Item.Verb);
when Vpar =>
Vpar_Record_IO.Put (Item.Vpar);
when Supine =>
Supine_Record_IO.Put (Item.Supine);
when Prep =>
Preposition_Record_IO.Put (Item.Prep);
when Conj =>
Conjunction_Record_IO.Put (Item.Conj);
when Interj =>
Interjection_Record_IO.Put (Item.Interj);
when Tackon =>
Tackon_Record_IO.Put (Item.Tackon);
when Prefix =>
Prefix_Record_IO.Put (Item.Prefix);
when Suffix =>
Suffix_Record_IO.Put (Item.Suffix);
when others =>
null;
end case;
Put (String'((
Integer (Col) .. Quality_Record_IO.Default_Width + C - 1 => ' ')));
end Put;
---------------------------------------------------------------------------
procedure Get
(Source : in String;
Target : out Quality_Record;
Last : out Integer
)
is
-- Used for computing lower bounds of substrings
Low : Integer := Source'First - 1;
POFS : Part_Of_Speech_Type := X;
Noun : Noun_Record;
Pronoun : Pronoun_Record;
Propack : Propack_Record;
Adjective : Adjective_Record;
Adverb : Adverb_Record;
Verb : Verb_Record;
Vparticiple : Vpar_Record;
Supin : Supine_Record;
Preposition : Preposition_Record;
Conjunction : Conjunction_Record;
Interjection : Interjection_Record;
Numeral : Numeral_Record;
Tackn : Tackon_Record;
Prefx : Prefix_Record;
Suffx : Suffix_Record;
begin
Part_Of_Speech_Type_IO.Get (Source, POFS, Low);
Last := Low; -- In case it is not set later
case POFS is
when N =>
Noun_Record_IO.Get (Source (Low + 1 .. Source'Last), Noun, Last);
Target := (N, Noun);
when Pron =>
Pronoun_Record_IO.Get
(Source (Low + 1 .. Source'Last), Pronoun, Last);
Target := (Pron, Pronoun);
when Pack =>
Propack_Record_IO.Get
(Source (Low + 1 .. Source'Last), Propack, Last);
Target := (Pack, Propack);
when Adj =>
Adjective_Record_IO.Get
(Source (Low + 1 .. Source'Last), Adjective, Last);
Target := (Adj, Adjective);
when Num =>
Numeral_Record_IO.Get
(Source (Low + 1 .. Source'Last), Numeral, Last);
Target := (Num, Numeral);
when Adv =>
Adverb_Record_IO.Get
(Source (Low + 1 .. Source'Last), Adverb, Last);
Target := (Adv, Adverb);
when V =>
Verb_Record_IO.Get (Source (Low + 1 .. Source'Last), Verb, Last);
Target := (V, Verb);
when Vpar =>
Vpar_Record_IO.Get
(Source (Low + 1 .. Source'Last), Vparticiple, Last);
Target := (Vpar, Vparticiple);
when Supine =>
Supine_Record_IO.Get (Source (Low + 1 .. Source'Last), Supin, Last);
Target := (Supine, Supin);
when Prep =>
Preposition_Record_IO.Get
(Source (Low + 1 .. Source'Last), Preposition, Last);
Target := (Prep, Preposition);
when Conj =>
Conjunction_Record_IO.Get
(Source (Low + 1 .. Source'Last), Conjunction, Last);
Target := (Conj, Conjunction);
when Interj =>
Interjection_Record_IO.Get
(Source (Low + 1 .. Source'Last), Interjection, Last);
Target := (Interj, Interjection);
when Tackon =>
Tackon_Record_IO.Get (Source (Low + 1 .. Source'Last), Tackn, Last);
Target := (Tackon, Tackn);
when Prefix =>
Prefix_Record_IO.Get (Source (Low + 1 .. Source'Last), Prefx, Last);
Target := (Prefix, Prefx);
when Suffix =>
Suffix_Record_IO.Get (Source (Low + 1 .. Source'Last), Suffx, Last);
Target := (Suffix, Suffx);
when X =>
Target := (Pofs => X);
end case;
end Get;
---------------------------------------------------------------------------
procedure Put (Target : out String; Item : in Quality_Record)
is
-- Note that this does not Put with a uniform width
-- which would require a constant QUALITY_RECORD_IO.DEFAULT_WIDTH
-- Rather we Put to minimal size with NOUN_RECORD_IO.DEFAULT_WIDTH,
-- PRONOUN_RECORD_IO,DEFAULT_WIDTH, . ..
-- Used for computing bounds of substrings
Low : Integer := Target'First - 1;
High : Integer := 0;
begin
High := Low + Part_Of_Speech_Type_IO.Default_Width;
Part_Of_Speech_Type_IO.Put (Target (Low + 1 .. High), Item.Pofs);
Low := High + 1;
Target (Low) := ' ';
case Item.Pofs is
when N =>
High := Low + Noun_Record_IO.Default_Width;
Noun_Record_IO.Put (Target (Low + 1 .. High), Item.Noun);
when Pron =>
High := Low + Pronoun_Record_IO.Default_Width;
Pronoun_Record_IO.Put (Target (Low + 1 .. High), Item.Pron);
when Pack =>
High := Low + Propack_Record_IO.Default_Width;
Propack_Record_IO.Put (Target (Low + 1 .. High), Item.Pack);
when Adj =>
High := Low + Adjective_Record_IO.Default_Width;
Adjective_Record_IO.Put (Target (Low + 1 .. High), Item.Adj);
when Num =>
High := Low + Numeral_Record_IO.Default_Width;
Numeral_Record_IO.Put (Target (Low + 1 .. High), Item.Num);
when Adv =>
High := Low + Adverb_Record_IO.Default_Width;
Adverb_Record_IO.Put (Target (Low + 1 .. High), Item.Adv);
when V =>
High := Low + Verb_Record_IO.Default_Width;
Verb_Record_IO.Put (Target (Low + 1 .. High), Item.Verb);
when Vpar =>
High := Low + Vpar_Record_IO.Default_Width;
Vpar_Record_IO.Put (Target (Low + 1 .. High), Item.Vpar);
when Supine =>
High := Low + Supine_Record_IO.Default_Width;
Supine_Record_IO.Put (Target (Low + 1 .. High), Item.Supine);
when Prep =>
High := Low + Preposition_Record_IO.Default_Width;
Preposition_Record_IO.Put (Target (Low + 1 .. High), Item.Prep);
when Conj =>
High := Low + Conjunction_Record_IO.Default_Width;
Conjunction_Record_IO.Put (Target (Low + 1 .. High), Item.Conj);
when Interj =>
High := Low + Interjection_Record_IO.Default_Width;
Interjection_Record_IO.Put (Target (Low + 1 .. High), Item.Interj);
when Tackon =>
High := Low + Tackon_Record_IO.Default_Width;
Tackon_Record_IO.Put (Target (Low + 1 .. High), Item.Tackon);
when Prefix =>
High := Low + Prefix_Record_IO.Default_Width;
Prefix_Record_IO.Put (Target (Low + 1 .. High), Item.Prefix);
when Suffix =>
High := Low + Suffix_Record_IO.Default_Width;
Suffix_Record_IO.Put (Target (Low + 1 .. High), Item.Suffix);
when others =>
null;
end case;
-- Fill remainder of String
Target (High + 1 .. Target'Last) := (others => ' ');
end Put;
---------------------------------------------------------------------------
end Quality_Record_IO;
|
------------------------------------------------------------------------------
-- Copyright (c) 2014, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
with Ada.Calendar.Arithmetic;
with Ada.Calendar.Formatting;
with Ada.Strings.Fixed;
with AWS.Attachments;
with AWS.Messages;
with AWS.MIME;
with AWS.Parameters;
with Templates_Parser;
with Natools.S_Expressions.File_Readers;
with Natools.Time_IO.Human;
package body Simple_Webapps.Upload_Servers is
package body Backend is separate;
function Dump_Form (Request : AWS.Status.Data) return AWS.Response.Data;
function Error_Page
(Code : AWS.Messages.Status_Code;
Template : String := "")
return AWS.Response.Data;
-- Create an error page
function File_List (DB : Backend.Database) return AWS.Response.Data;
-- Create a list of all files
function Report
(File : Backend.File;
Debug : Boolean;
Template : String := "")
return AWS.Response.Data;
-- Create a report page for the given file
function Upload_Form (DB : Backend.Database) return AWS.Response.Data;
-- Create the main upload form
------------------------
-- Request Dispatcher --
------------------------
overriding function Dispatch
(Dispatcher : Handler;
Request : AWS.Status.Data)
return AWS.Response.Data is
begin
case AWS.Status.Method (Request) is
when AWS.Status.POST =>
if AWS.Status.URI (Request) = "/purge" then
Dispatcher.DB.Update.Data.Purge_Expired;
return AWS.Response.URL ("/");
-- GNAT bugbox generator:
-- elsif Dispatcher.DB.Query.Data.Debug_Activated
-- and then AWS.Status.URI (Request) = "/dump-form"
-- then
-- using the almost equivalent variant:
elsif AWS.Status.URI (Request) = "/dump-form"
and then Dispatcher.DB.Query.Data.Debug_Activated
then
return Dump_Form (Request);
end if;
declare
function Compute_Expiration (Path : String)
return Ada.Calendar.Time;
Attachments : constant AWS.Attachments.List
:= AWS.Status.Attachments (Request);
Parameters : constant AWS.Parameters.List
:= AWS.Status.Parameters (Request);
function Compute_Expiration (Path : String)
return Ada.Calendar.Time is
begin
return Expiration
(Dispatcher.DB.Query.Data.all,
Natural'Value (AWS.Parameters.Get (Parameters, "expire")),
AWS.Parameters.Get (Parameters, "expire_unit"),
Ada.Directories.Size (Path));
exception
when Constraint_Error =>
return Ada.Calendar."+" (Ada.Calendar.Clock, 300.0);
end Compute_Expiration;
Report : URI_Key;
begin
if AWS.Attachments.Count (Attachments) = 1
and then AWS.Parameters.Get (Parameters, "file")
= AWS.Attachments.Local_Filename
(AWS.Attachments.Get (Attachments, 1))
and then AWS.Parameters.Get (Parameters, "file", 2)
= AWS.Attachments.Filename
(AWS.Attachments.Get (Attachments, 1))
then
-- Direct file upload through AWS
Dispatcher.DB.Update.Data.Add_File
(AWS.Parameters.Get (Parameters, "file"),
AWS.Parameters.Get (Parameters, "file", 2),
AWS.Parameters.Get (Parameters, "comment"),
AWS.Attachments.Content_Type
(AWS.Attachments.Get (Attachments, 1)),
Compute_Expiration
(AWS.Parameters.Get (Parameters, "file")),
Report);
return AWS.Response.URL ('/' & Report);
elsif AWS.Parameters.Exist (Parameters, "file.path")
and then Ada.Directories.Exists
(AWS.Parameters.Get (Parameters, "file.path"))
then
-- File upload through nginx upload module
Dispatcher.DB.Update.Data.Add_File
(AWS.Parameters.Get (Parameters, "file.path"),
AWS.Parameters.Get (Parameters, "file.name"),
AWS.Parameters.Get (Parameters, "comment"),
AWS.Parameters.Get (Parameters, "file.content_type"),
Compute_Expiration
(AWS.Parameters.Get (Parameters, "file.path")),
Report);
return AWS.Response.URL ('/' & Report);
else
return AWS.Response.Build
("text/html",
"<html><head><title>Bad Post</title></head>"
& "<body><h1>Bad Post</h1>"
& "<p>Unable to process form fields.</p>"
& "<p><a href=""/"">Back</a></p>"
& "</body></html>");
end if;
end;
when AWS.Status.GET =>
null; -- processed below
when others =>
begin -- explicit block needed to work around a GNAT parsing bug
return Error_Page
(AWS.Messages.S405,
Dispatcher.DB.Query.Data.Error_Template);
end;
end case;
declare
DB_Accessor : constant Database_Refs.Accessor := Dispatcher.DB.Query;
URI : constant String := AWS.Status.URI (Request);
function Fallback return AWS.Response.Data;
function Fallback return AWS.Response.Data is
Root : constant String := DB_Accessor.Data.Static_Resource_Dir;
Path : constant String := Root & URI;
begin
if Root /= ""
and then Ada.Strings.Fixed.Index (URI, "/.") = 0
and then Ada.Directories.Exists (Path)
then
return AWS.Response.File (AWS.MIME.Content_Type (Path), Path);
else
return Error_Page
(AWS.Messages.S404, DB_Accessor.Data.Error_Template);
end if;
end Fallback;
Key : URI_Key;
File : Backend.File;
begin
pragma Assert (URI (URI'First) = '/');
if URI = "/" then
return Upload_Form (DB_Accessor.Data.all);
elsif DB_Accessor.Data.Debug_Activated then
if URI = "/list" then
return File_List (DB_Accessor.Data.all);
end if;
end if;
if URI'Length < Key'Length + 1 then
return Fallback;
end if;
Key := URI (URI'First + 1 .. URI'First + Key'Length);
if URI'Length = Key'Length + 1 then
File := DB_Accessor.Data.Report (Key);
if not File.Is_Empty then
return Report
(File,
DB_Accessor.Data.Debug_Activated,
DB_Accessor.Data.Report_Template);
end if;
elsif URI (URI'First + Key'Length + 1) /= '/' then
return Fallback;
end if;
File := DB_Accessor.Data.Download (Key);
if not File.Is_Empty then
return AWS.Response.File (File.MIME_Type, File.Path);
else
return Fallback;
end if;
end;
end Dispatch;
overriding function Clone (Dispatcher : Handler) return Handler is
begin
return Dispatcher;
end Clone;
procedure Reset
(Dispatcher : in out Handler;
Config_File : in String;
Debug : in Boolean := False)
is
Reader : S_Expressions.File_Readers.S_Reader
:= S_Expressions.File_Readers.Reader (Config_File);
begin
Reset (Dispatcher, Reader, Debug);
end Reset;
procedure Reset
(Dispatcher : in out Handler;
Config : in out S_Expressions.Lockable.Descriptor'Class;
Debug : in Boolean := False)
is
function Create_DB return Backend.Database;
function Create_Timer return Natools.Cron.Cron_Entry;
function Create_DB return Backend.Database is
begin
return DB : Backend.Database do
DB.Reset (Config, Debug);
end return;
end Create_DB;
function Create_Timer return Natools.Cron.Cron_Entry is
begin
return Natools.Cron.Create
(900.0,
Purge_Callback'(DB => Dispatcher.DB));
end Create_Timer;
begin
Dispatcher.DB.Replace (Create_DB'Access);
Dispatcher.Timer.Replace (Create_Timer'Access);
end Reset;
function Expiration
(DB : Backend.Database;
Request_Number : Natural;
Request_Unit : String;
Size : Ada.Directories.File_Size)
return Ada.Calendar.Time
is
use type Ada.Calendar.Time;
Req_Delay, Max_Delay : Size_Time;
begin
Req_Delay := Size_Time (Request_Number);
if Request_Unit = "minutes" then
Req_Delay := Req_Delay * 60;
elsif Request_Unit = "hours" then
Req_Delay := Req_Delay * 3600;
elsif Request_Unit = "days" then
Req_Delay := Req_Delay * 86_400;
elsif Request_Unit = "weeks" then
Req_Delay := Req_Delay * 604_800;
end if;
Max_Delay := DB.Max_Expiration / Size_Time (Size);
if Req_Delay > Max_Delay then
Req_Delay := Max_Delay;
end if;
return Ada.Calendar.Arithmetic."+"
(Ada.Calendar.Clock,
Ada.Calendar.Arithmetic.Day_Count (Req_Delay / 86_400))
+ Duration (Req_Delay mod 86_400);
end Expiration;
overriding procedure Run (Self : in out Purge_Callback) is
begin
Self.DB.Update.Data.Purge_Expired;
end Run;
----------------------------
-- HTML Page Constructors --
----------------------------
function Dump_Form (Request : AWS.Status.Data) return AWS.Response.Data is
Page : Ada.Strings.Unbounded.Unbounded_String;
Attachments : constant AWS.Attachments.List
:= AWS.Status.Attachments (Request);
Attachment : AWS.Attachments.Element;
Parameters : constant AWS.Parameters.List
:= AWS.Status.Parameters (Request);
begin
Ada.Strings.Unbounded.Append (Page,
"<html><head><title>Form Dump</title></head>"
& "<body><h1>Form Dump</h1><h2>Parameters</h2><ol>");
for I in 1 .. AWS.Parameters.Count (Parameters) loop
Ada.Strings.Unbounded.Append (Page,
"<li>" & AWS.Parameters.Get_Name (Parameters, I)
& ": " & AWS.Parameters.Get_Value (Parameters, I) & "</li>");
end loop;
Ada.Strings.Unbounded.Append (Page, "</ol><h2>Attachments</h2><ol>");
for I in 1 .. AWS.Attachments.Count (Attachments) loop
Attachment := AWS.Attachments.Get (Attachments, I);
Ada.Strings.Unbounded.Append (Page,
"<li>" & AWS.Attachments.Filename (Attachment) & ": "
& AWS.Attachments.Content_Type (Attachment) & " at "
& AWS.Attachments.Local_Filename (Attachment) & "</li>");
end loop;
Ada.Strings.Unbounded.Append (Page, "</ol></body></html>");
return AWS.Response.Build ("test/html", To_String (Page));
end Dump_Form;
function Error_Page
(Code : AWS.Messages.Status_Code;
Template : String := "")
return AWS.Response.Data
is
Image : constant String := AWS.Messages.Image (Code);
Message : constant String := AWS.Messages.Reason_Phrase (Code);
begin
if Template = "" then
return AWS.Response.Acknowledge
(Code,
"<html><head><title>" & Image & ' ' & Message & "</title></head>"
& "<body><h1>" & Image & ' ' & Message & "</h1></body></html>");
else
return AWS.Response.Acknowledge
(Code,
String'(Templates_Parser.Parse (Template,
(Templates_Parser.Assoc ("CODE", Image),
Templates_Parser.Assoc ("MESSAGE", Message)))));
end if;
end Error_Page;
function File_List (DB : Backend.Database) return AWS.Response.Data is
Table : Ada.Strings.Unbounded.Unbounded_String;
procedure Process (File : in Backend.File);
procedure Process (File : in Backend.File) is
begin
Ada.Strings.Unbounded.Append
(Table,
"<tr>"
& "<td><a href=""/" & File.Report & """>"
& File.Report & "</a></td>"
& "<td>" & HTML_Escape (File.Name) & "</td>"
& "<td>" & Ada.Calendar.Formatting.Image
(File.Expiration) & "</td>"
& "</tr>");
end Process;
Result : Boolean;
pragma Unreferenced (Result);
begin
Result := DB.Iterate (Process'Access);
return AWS.Response.Build
("text/html",
"<html><head><title>File List</title></head>"
& "<body><h1>File List</h1>"
& "<table><tr>"
& "<th>Link</th>"
& "<th>File name</th>"
& "<th>Expiration</th>"
& "</tr>"
& Ada.Strings.Unbounded.To_String (Table)
& "</table>"
& "<p><a href=""/"">Back to upload page</a></p>"
& "</body></html>");
end File_List;
function Report
(File : Backend.File;
Debug : Boolean;
Template : String := "")
return AWS.Response.Data
is
DL : String_Holder;
begin
if Template = "" then
if Debug then
declare
DL_URI : constant String
:= '/' & File.Download & '/' & File.Name;
begin
DL := Hold ("<li>Download link: <a href=""" & DL_URI & """>"
& DL_URI & "</a></li>");
end;
end if;
return AWS.Response.Build
("text/html",
"<html><head><title>File Report</title></head>"
& "<body><h1>File Report</h1>"
& "<ul>"
& "<li>Uploaded as " & HTML_Escape (File.Name) & "</li>"
& "<li>File type: " & HTML_Escape (File.MIME_Type) & "</li>"
& "<li>" & File.Hash_Type & " digest: " & File.Hex_Digest & "</li>"
& "<li>Upload date: "
& Ada.Calendar.Formatting.Image (File.Upload) & "</li>"
& "<li>Expiration date: "
& Ada.Calendar.Formatting.Image (File.Expiration)
& " (in " & Natools.Time_IO.Human.Difference_Image
(File.Expiration, Ada.Calendar.Clock, True)
& ")</li>"
& To_String (DL)
& "<li>Comment: " & HTML_Escape (File.Comment) & "</li>"
& "</ul>"
& "<p><a href=""/"">Back to upload page</a></p>"
& "</body></html>");
else
declare
use Templates_Parser;
Debug_Assoc : constant Translate_Table
:= (Assoc ("DEBUG", True),
Assoc ("DOWNLOAD_KEY", File.Download),
Assoc ("DOWNLOAD_PATH",
'/' & File.Download & '/' & File.Name));
Core_Assoc : constant Translate_Table
:= (Assoc ("NAME", File.Name),
Assoc ("MIME_TYPE", File.MIME_Type),
Assoc ("DIGEST_TYPE", File.Hash_Type),
Assoc ("DIGEST", File.Hex_Digest),
Assoc ("UPLOAD",
Ada.Calendar.Formatting.Image (File.Upload)),
Assoc ("EXPIRATION",
Ada.Calendar.Formatting.Image (File.Expiration)),
Assoc ("EXPIRATION_DELAY",
Natools.Time_IO.Human.Difference_Image
(File.Expiration, Ada.Calendar.Clock, True)),
Assoc ("COMMENT", File.Comment));
begin
if Debug then
return AWS.Response.Build
("text/html",
String'(Parse (Template, Core_Assoc & Debug_Assoc)));
else
return AWS.Response.Build
("text/html",
String'(Parse (Template, Core_Assoc
& Assoc ("DEBUG", False))));
end if;
end;
end if;
end Report;
function Upload_Form (DB : Backend.Database) return AWS.Response.Data is
Template : constant String := DB.Index_Template;
Raw_Max_Exp : constant Size_Time := DB.Max_Expiration;
Max_Exp : Size_Time := Raw_Max_Exp;
Time_Suffix : Character := 's';
Size_Prefix : Character := ' ';
begin
if Max_Exp mod 60 = 0 then
Max_Exp := Max_Exp / 60;
Time_Suffix := 'm';
if Max_Exp mod 60 = 0 then
Max_Exp := Max_Exp / 60;
Time_Suffix := 'h';
if Max_Exp mod 24 = 0 then
Max_Exp := Max_Exp / 24;
Time_Suffix := 'd';
if Max_Exp mod 7 = 0 then
Max_Exp := Max_Exp / 7;
Time_Suffix := 'w';
end if;
end if;
end if;
end if;
if Max_Exp mod 1024 = 0 then
Max_Exp := Max_Exp / 1024;
Size_Prefix := 'k';
if Max_Exp mod 1024 = 0 then
Max_Exp := Max_Exp / 1024;
Size_Prefix := 'M';
if Max_Exp mod 1024 = 0 then
Max_Exp := Max_Exp / 1024;
Size_Prefix := 'G';
if Max_Exp mod 1024 = 0 then
Max_Exp := Max_Exp / 1024;
Size_Prefix := 'T';
end if;
end if;
end if;
end if;
if Template = "" then
return AWS.Response.Build
("text/html",
"<html><head><title>File Upload</title></head>"
& "<body><h1>File Upload</h1>"
& "<form enctype=""multipart/form-data"" action=""/post"""
& " method=""post"">"
& "<p><input name=""file"" type=""file""></p>"
& "<p><label>Expires in "
& "<input name=""expire"" value=""1""></label>"
& "<select name=""expire_unit"">"
& "<option>seconds</options>"
& "<option>minutes</options>"
& "<option selected>hours</options>"
& "<option>days</options>"
& "<option>weeks</options>"
& "</select></p>"
& "<p>Maximum expiration is" & Size_Time'Image (Max_Exp)
& ' ' & Size_Prefix & "B." & Time_Suffix & " / (file size)</p>"
& "<p><label>Comment:<br>"
& "<textarea name=""comment"" cols=""80"" rows=""10""></textarea>"
& "</label></p>"
& "<p><input name=""submit"" value=""Send"""
& " type=""submit""></p>"
& "</form>"
& "<h2>Maintenance</h2>"
& "<form action=""/purge"" method=""post"">"
& "<p><input name=""submit"" value=""Purge"" type=""submit""></p>"
& "</form></body></html>");
else
return AWS.Response.Build
("text/html",
String'(Templates_Parser.Parse (Template,
(Templates_Parser.Assoc ("MAX_EXPIRATION_BYTE_SECONDS",
Ada.Strings.Fixed.Trim
(Size_Time'Image (Raw_Max_Exp),
Ada.Strings.Left)),
Templates_Parser.Assoc ("MAX_EXPIRATION",
Ada.Strings.Fixed.Trim
(Size_Time'Image (Max_Exp),
Ada.Strings.Left)),
Templates_Parser.Assoc ("MAX_EXPIRATION_UNIT",
Ada.Strings.Fixed.Trim
(Size_Prefix & "B." & Time_Suffix,
Ada.Strings.Left)),
Templates_Parser.Assoc ("MAX_EXPIRATION_PREFIX",
(1 => Size_Prefix)),
Templates_Parser.Assoc ("MAX_EXPIRATION_SUFFIX",
(1 => Time_Suffix))))));
end if;
end Upload_Form;
end Simple_Webapps.Upload_Servers;
|
-- Generated at 2014-06-02 19:12:04 +0000 by Natools.Static_Hash_Maps
-- from ../src/natools-s_expressions-printers-pretty-config-commands.sx
with Natools.S_Expressions.Printers.Pretty.Config.Main_Cmd;
with Natools.S_Expressions.Printers.Pretty.Config.Newline_Cmd;
with Natools.S_Expressions.Printers.Pretty.Config.Quoted_Cmd;
with Natools.S_Expressions.Printers.Pretty.Config.Commands.SC;
with Natools.S_Expressions.Printers.Pretty.Config.Atom_Enc;
with Natools.S_Expressions.Printers.Pretty.Config.Commands.CE;
with Natools.S_Expressions.Printers.Pretty.Config.Hex_Casing;
with Natools.S_Expressions.Printers.Pretty.Config.Newline_Enc;
with Natools.S_Expressions.Printers.Pretty.Config.Quoted_Esc;
with Natools.S_Expressions.Printers.Pretty.Config.Quoted_Opt;
with Natools.S_Expressions.Printers.Pretty.Config.Token_Opt;
package body Natools.S_Expressions.Printers.Pretty.Config.Commands is
function Main (Key : String) return Main_Command is
N : constant Natural
:= Natools.S_Expressions.Printers.Pretty.Config.Main_Cmd.Hash (Key);
begin
if Map_1_Keys (N).all = Key then
return Map_1_Elements (N);
else
raise Constraint_Error with "Key """ & Key & """ not in map";
end if;
end Main;
function Newline (Key : String) return Newline_Command is
N : constant Natural
:= Natools.S_Expressions.Printers.Pretty.Config.Newline_Cmd.Hash (Key);
begin
if Map_2_Keys (N).all = Key then
return Map_2_Elements (N);
else
raise Constraint_Error with "Key """ & Key & """ not in map";
end if;
end Newline;
function Quoted_String (Key : String) return Quoted_String_Command is
N : constant Natural
:= Natools.S_Expressions.Printers.Pretty.Config.Quoted_Cmd.Hash (Key);
begin
if Map_3_Keys (N).all = Key then
return Map_3_Elements (N);
else
raise Constraint_Error with "Key """ & Key & """ not in map";
end if;
end Quoted_String;
function Separator (Key : String) return Separator_Command is
N : constant Natural
:= Natools.S_Expressions.Printers.Pretty.Config.Commands.SC.Hash (Key);
begin
if Map_4_Keys (N).all = Key then
return Map_4_Elements (N);
else
raise Constraint_Error with "Key """ & Key & """ not in map";
end if;
end Separator;
function To_Atom_Encoding (Key : String) return Atom_Encoding is
N : constant Natural
:= Natools.S_Expressions.Printers.Pretty.Config.Atom_Enc.Hash (Key);
begin
if Map_5_Keys (N).all = Key then
return Map_5_Elements (N);
else
raise Constraint_Error with "Key """ & Key & """ not in map";
end if;
end To_Atom_Encoding;
function To_Character_Encoding (Key : String) return Character_Encoding is
N : constant Natural
:= Natools.S_Expressions.Printers.Pretty.Config.Commands.CE.Hash (Key);
begin
if Map_6_Keys (N).all = Key then
return Map_6_Elements (N);
else
raise Constraint_Error with "Key """ & Key & """ not in map";
end if;
end To_Character_Encoding;
function To_Hex_Casing (Key : String) return Encodings.Hex_Casing is
N : constant Natural
:= Natools.S_Expressions.Printers.Pretty.Config.Hex_Casing.Hash (Key);
begin
if Map_7_Keys (N).all = Key then
return Map_7_Elements (N);
else
raise Constraint_Error with "Key """ & Key & """ not in map";
end if;
end To_Hex_Casing;
function To_Newline_Encoding (Key : String) return Newline_Encoding is
N : constant Natural
:= Natools.S_Expressions.Printers.Pretty.Config.Newline_Enc.Hash (Key);
begin
if Map_8_Keys (N).all = Key then
return Map_8_Elements (N);
else
raise Constraint_Error with "Key """ & Key & """ not in map";
end if;
end To_Newline_Encoding;
function To_Quoted_Escape (Key : String) return Quoted_Escape_Type is
N : constant Natural
:= Natools.S_Expressions.Printers.Pretty.Config.Quoted_Esc.Hash (Key);
begin
if Map_9_Keys (N).all = Key then
return Map_9_Elements (N);
else
raise Constraint_Error with "Key """ & Key & """ not in map";
end if;
end To_Quoted_Escape;
function To_Quoted_Option (Key : String) return Quoted_Option is
N : constant Natural
:= Natools.S_Expressions.Printers.Pretty.Config.Quoted_Opt.Hash (Key);
begin
if Map_10_Keys (N).all = Key then
return Map_10_Elements (N);
else
raise Constraint_Error with "Key """ & Key & """ not in map";
end if;
end To_Quoted_Option;
function To_Token_Option (Key : String) return Token_Option is
N : constant Natural
:= Natools.S_Expressions.Printers.Pretty.Config.Token_Opt.Hash (Key);
begin
if Map_11_Keys (N).all = Key then
return Map_11_Elements (N);
else
raise Constraint_Error with "Key """ & Key & """ not in map";
end if;
end To_Token_Option;
end Natools.S_Expressions.Printers.Pretty.Config.Commands;
|
with Program.Parsers.Nodes;
use Program.Parsers.Nodes;
pragma Style_Checks ("N");
procedure Program.Parsers.On_Reduce_1
(Self : access Parse_Context;
Prod : Anagram.Grammars.Production_Index;
Nodes : in out Program.Parsers.Nodes.Node_Array) is
begin
case Prod is
when 1 =>
declare
List : Node :=
Nodes (2);
begin
Self.Factory.Prepend_Compilation_Unit
(List, Nodes (1));
Nodes (1) := Self.Factory.Compilation
(List, Nodes (3));
end;
when 2 =>
declare
List : Node :=
Nodes (2);
begin
Self.Factory.Prepend_Compilation_Unit
(List, Nodes (1));
Nodes (1) := Self.Factory.Compilation
(List, (Self.Factory.Context_Item_Sequence));
end;
when 3 =>
declare
List : Node :=
Self.Factory.Compilation_Unit_Sequence;
begin
Self.Factory.Prepend_Compilation_Unit
(List, Nodes (1));
Nodes (1) := Self.Factory.Compilation
(List, Nodes (2));
end;
when 4 =>
declare
List : Node :=
Self.Factory.Compilation_Unit_Sequence;
begin
Self.Factory.Prepend_Compilation_Unit
(List, Nodes (1));
Nodes (1) := Self.Factory.Compilation
(List, (Self.Factory.Context_Item_Sequence));
end;
when 5 =>
declare
List : Node :=
Nodes (3);
begin
Self.Factory.Prepend_Name (List, Nodes (2));
Nodes (1) :=
Self.Factory.Abort_Statement
(Nodes (1), List, Nodes (4));
end;
when 6 =>
declare
List : Node :=
Self.Factory.Name_Sequence;
begin
Self.Factory.Prepend_Name (List, Nodes (2));
Nodes (1) :=
Self.Factory.Abort_Statement
(Nodes (1), List, Nodes (3));
end;
when 7 =>
declare
List : Node :=
Nodes (2);
begin
Self.Factory.Prepend_Statement
(List, Nodes (1));
Nodes (1) := List;
end;
when 8 =>
declare
List : Node :=
Self.Factory.Statement_Sequence;
begin
Self.Factory.Prepend_Statement
(List, Nodes (1));
Nodes (1) := List;
end;
when 9 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
Nodes (13),
Nodes (14),
Nodes (15));
when 10 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
Nodes (13),
No_Token,
Nodes (14));
when 11 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (11),
Nodes (12),
Nodes (13));
when 12 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (11),
No_Token,
Nodes (12));
when 13 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
No_Token,
(Self.Factory.Statement_Sequence),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
No_Token,
No_Token,
Nodes (9));
when 14 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12));
when 15 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
No_Token,
Nodes (11));
when 16 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
Nodes (7),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (8),
Nodes (9),
Nodes (10));
when 17 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
Nodes (7),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (8),
No_Token,
Nodes (9));
when 18 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
No_Token,
(Self.Factory.Statement_Sequence),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
No_Token,
No_Token,
Nodes (6));
when 19 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12));
when 20 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
No_Token,
Nodes (11));
when 21 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (8),
Nodes (9),
Nodes (10));
when 22 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (8),
No_Token,
Nodes (9));
when 23 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Statement_Sequence),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
No_Token,
No_Token,
Nodes (6));
when 24 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9));
when 25 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
Nodes (8));
when 26 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
Nodes (4),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (5),
Nodes (6),
Nodes (7));
when 27 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
Nodes (4),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (5),
No_Token,
Nodes (6));
when 28 =>
Nodes (1) :=
Self.Factory.Accept_Statement
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
No_Token,
(Self.Factory.Statement_Sequence),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
No_Token,
No_Token,
Nodes (3));
when 29 =>
Nodes (1) := Self.Factory.
Anonymous_Access_To_Object_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5));
when 30 =>
Nodes (1) := Self.Factory.
Anonymous_Access_To_Object_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4));
when 31 =>
Nodes (1) := Self.Factory.
Anonymous_Access_To_Object_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3));
when 32 =>
Nodes (1) := Self.Factory.
Anonymous_Access_To_Object_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2));
when 33 =>
Nodes (1) := Self.Factory.
Anonymous_Access_To_Procedure_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8));
when 34 =>
Nodes (1) := Self.Factory.
Anonymous_Access_To_Procedure_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token);
when 35 =>
Nodes (1) := Self.Factory.
Anonymous_Access_To_Procedure_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7));
when 36 =>
Nodes (1) := Self.Factory.
Anonymous_Access_To_Procedure_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token);
when 37 =>
Nodes (1) := Self.Factory.
Anonymous_Access_To_Procedure_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6));
when 38 =>
Nodes (1) := Self.Factory.
Anonymous_Access_To_Procedure_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token);
when 39 =>
Nodes (1) := Self.Factory.
Anonymous_Access_To_Procedure_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5));
when 40 =>
Nodes (1) := Self.Factory.
Anonymous_Access_To_Procedure_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token);
when 41 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12));
when 42 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
No_Token,
No_Token,
Nodes (10));
when 43 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9));
when 44 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
No_Token,
No_Token,
Nodes (7));
when 45 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11));
when 46 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
No_Token,
No_Token,
Nodes (9));
when 47 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8));
when 48 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (5),
No_Token,
No_Token,
Nodes (6));
when 49 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10));
when 50 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
No_Token,
Nodes (8));
when 51 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7));
when 52 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (4),
No_Token,
No_Token,
Nodes (5));
when 53 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9));
when 54 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
No_Token,
No_Token,
Nodes (7));
when 55 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6));
when 56 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
No_Token,
No_Token,
Nodes (4));
when 57 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
No_Token,
No_Token,
Nodes (1));
when 58 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
No_Token,
No_Token,
Nodes (1));
when 59 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
No_Token,
No_Token,
Nodes (1));
when 60 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (5),
No_Token,
No_Token,
Nodes (1));
when 61 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
No_Token,
Nodes (1));
when 62 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (4),
No_Token,
No_Token,
Nodes (1));
when 63 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
No_Token,
No_Token,
Nodes (1));
when 64 =>
Nodes (1) := Self.Factory.Anonymous_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
No_Token,
No_Token,
Nodes (1));
when 65 =>
Nodes (1) := Self.Factory.
Access_To_Object_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5));
when 66 =>
Nodes (1) := Self.Factory.
Access_To_Object_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4));
when 67 =>
Nodes (1) := Self.Factory.
Access_To_Object_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3));
when 68 =>
Nodes (1) := Self.Factory.
Access_To_Object_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2));
when 69 =>
Nodes (1) := Self.Factory.
Access_To_Procedure_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8));
when 70 =>
Nodes (1) := Self.Factory.
Access_To_Procedure_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token);
when 71 =>
Nodes (1) := Self.Factory.
Access_To_Procedure_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7));
when 72 =>
Nodes (1) := Self.Factory.
Access_To_Procedure_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token);
when 73 =>
Nodes (1) := Self.Factory.
Access_To_Procedure_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6));
when 74 =>
Nodes (1) := Self.Factory.
Access_To_Procedure_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token);
when 75 =>
Nodes (1) := Self.Factory.
Access_To_Procedure_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5));
when 76 =>
Nodes (1) := Self.Factory.
Access_To_Procedure_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token);
when 77 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12));
when 78 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
No_Token,
No_Token,
Nodes (10));
when 79 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9));
when 80 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
No_Token,
No_Token,
Nodes (7));
when 81 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11));
when 82 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
No_Token,
No_Token,
Nodes (9));
when 83 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8));
when 84 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (5),
No_Token,
No_Token,
Nodes (6));
when 85 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10));
when 86 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
No_Token,
Nodes (8));
when 87 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7));
when 88 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (4),
No_Token,
No_Token,
Nodes (5));
when 89 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9));
when 90 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
No_Token,
No_Token,
Nodes (7));
when 91 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6));
when 92 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
No_Token,
No_Token,
Nodes (4));
when 93 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
No_Token,
No_Token,
Nodes (10));
when 94 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
No_Token,
No_Token,
Nodes (7));
when 95 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
No_Token,
No_Token,
Nodes (9));
when 96 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (5),
No_Token,
No_Token,
Nodes (6));
when 97 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
No_Token,
Nodes (8));
when 98 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (4),
No_Token,
No_Token,
Nodes (5));
when 99 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
No_Token,
No_Token,
Nodes (7));
when 100 =>
Nodes (1) := Self.Factory.Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
No_Token,
No_Token,
Nodes (4));
when 101 =>
null;
when 102 =>
null;
when 103 =>
Nodes (1) := Self.Factory.Allocator
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5));
when 104 =>
Nodes (1) := Self.Factory.Allocator
(Nodes (1),
No_Token,
None,
No_Token,
Nodes (2));
when 105 =>
declare
List : Node := Nodes (1);
begin
Self.Factory.Append_Subtype_Mark
(List, Nodes (3));
Nodes (1) := List;
end;
when 106 =>
declare
List : Node := Self.
Factory.Subtype_Mark_Sequence;
begin
Self.Factory.Append_Subtype_Mark
(List, Nodes (2));
Nodes (1) := List;
end;
when 107 =>
null;
when 108 =>
null;
when 109 =>
null;
when 110 =>
null;
when 111 =>
declare
Comp : constant Node :=
Self.Factory.Aspect_Specification
(Nodes (3),
Nodes (4),
Nodes (5));
List : Node := Nodes (1);
begin
Self.Factory.Append_Aspect_Specification
(List, Comp);
Nodes (1) := List;
end;
when 112 =>
declare
Comp : constant Node :=
Self.Factory.Aspect_Specification
(Nodes (3),
No_Token,
None);
List : Node := Nodes (1);
begin
Self.Factory.Append_Aspect_Specification
(List, Comp);
Nodes (1) := List;
end;
when 113 =>
declare
Comp : constant Node :=
Self.Factory.Aspect_Specification
(Nodes (2),
Nodes (3),
Nodes (4));
List : Node := Self.
Factory.Aspect_Specification_Sequence;
begin
Self.Factory.Append_Aspect_Specification
(List, Comp);
Nodes (1) := List;
end;
when 114 =>
declare
Comp : constant Node :=
Self.Factory.Aspect_Specification
(Nodes (2),
No_Token,
None);
List : Node := Self.
Factory.Aspect_Specification_Sequence;
begin
Self.Factory.Append_Aspect_Specification
(List, Comp);
Nodes (1) := List;
end;
when 115 =>
declare
Comp : constant Node :=
Self.Factory.Aspect_Specification
(Nodes (2),
Nodes (3),
Nodes (4));
List : Node := Nodes (5);
begin
Self.Factory.Prepend_Aspect_Specification
(List, Comp);
Nodes (1) := List;
end;
when 116 =>
declare
Comp : constant Node :=
Self.Factory.Aspect_Specification
(Nodes (2),
Nodes (3),
Nodes (4));
List : Node := Self.
Factory.Aspect_Specification_Sequence;
begin
Self.Factory.Prepend_Aspect_Specification
(List, Comp);
Nodes (1) := List;
end;
when 117 =>
declare
Comp : constant Node :=
Self.Factory.Aspect_Specification
(Nodes (2),
No_Token,
None);
List : Node := Nodes (3);
begin
Self.Factory.Prepend_Aspect_Specification
(List, Comp);
Nodes (1) := List;
end;
when 118 =>
declare
Comp : constant Node :=
Self.Factory.Aspect_Specification
(Nodes (2),
No_Token,
None);
List : Node := Self.
Factory.Aspect_Specification_Sequence;
begin
Self.Factory.Prepend_Aspect_Specification
(List, Comp);
Nodes (1) := List;
end;
when 119 =>
Nodes (1) :=
Self.Factory.Assignment_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4));
when 120 =>
Nodes (1) :=
Self.Factory.Association_List
(Nodes (1),
Nodes (2),
Nodes (3));
when 121 =>
declare
Item : constant Node :=
Self.Factory.Select_Or_Path
(No_Token, No_Token, None, No_Token,
Nodes (2));
Then_Item : constant Node :=
Self.Factory.Then_Abort_Path
(Nodes (3),
Nodes (4),
Nodes (5));
List : Node :=
Self.Factory.Select_Then_Abort_Path_Sequence;
begin
Self.Factory.Append_Select_Then_Abort_Path
(List, Item);
Self.Factory.Append_Select_Then_Abort_Path
(List, Then_Item);
Nodes (1) := Self.Factory.Asynchronous_Select
(Nodes (1),
List,
Nodes (6),
Nodes (7),
Nodes (8));
end;
when 122 =>
Nodes (1) := Self.Factory.
At_Clause
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6));
when 123 =>
Nodes (1) := Self.Factory.
Attribute_Definition_Clause
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5));
when 124 =>
Nodes (1) := Self.Factory.Attribute_Reference
(Nodes (1), Nodes (2), Nodes (3), None);
when 125 =>
null;
when 126 =>
null;
when 127 =>
null;
when 128 =>
null;
when 129 =>
null;
when 130 =>
null;
when 131 =>
null;
when 132 =>
null;
when 133 =>
null;
when 134 =>
null;
when 135 =>
null;
when 136 =>
null;
when 137 =>
null;
when 138 =>
null;
when 139 =>
null;
when 140 =>
null;
when 141 =>
null;
when 142 =>
null;
when 143 =>
null;
when 144 =>
null;
when 145 =>
null;
when 146 =>
null;
when 147 =>
null;
when 148 =>
null;
when 149 =>
declare
List : Node := Nodes (1);
begin
Self.Factory.Append_Basic_Declarative_Item
(List, Nodes (2));
Nodes (1) := List;
end;
when 150 =>
declare
List : Node := Self.
Factory.Basic_Declarative_Item_Sequence;
begin
Self.Factory.Append_Basic_Declarative_Item
(List, Nodes (1));
Nodes (1) := List;
end;
when 151 =>
Nodes (1) :=
Self.Factory.Block_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11));
when 152 =>
Nodes (1) :=
Self.Factory.Block_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
No_Token,
Nodes (10));
when 153 =>
Nodes (1) :=
Self.Factory.Block_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (7),
Nodes (8),
Nodes (9));
when 154 =>
Nodes (1) :=
Self.Factory.Block_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (7),
No_Token,
Nodes (8));
when 155 =>
Nodes (1) :=
Self.Factory.Block_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
(Self.Factory.Declarative_Item_Sequence),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10));
when 156 =>
Nodes (1) :=
Self.Factory.Block_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
(Self.Factory.Declarative_Item_Sequence),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
No_Token,
Nodes (9));
when 157 =>
Nodes (1) :=
Self.Factory.Block_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
(Self.Factory.Declarative_Item_Sequence),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (6),
Nodes (7),
Nodes (8));
when 158 =>
Nodes (1) :=
Self.Factory.Block_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
(Self.Factory.Declarative_Item_Sequence),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (6),
No_Token,
Nodes (7));
when 159 =>
Nodes (1) :=
Self.Factory.Block_Statement
(Nodes (1),
Nodes (2),
No_Token,
(Self.Factory.Declarative_Item_Sequence),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9));
when 160 =>
Nodes (1) :=
Self.Factory.Block_Statement
(Nodes (1),
Nodes (2),
No_Token,
(Self.Factory.Declarative_Item_Sequence),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
Nodes (8));
when 161 =>
Nodes (1) :=
Self.Factory.Block_Statement
(Nodes (1),
Nodes (2),
No_Token,
(Self.Factory.Declarative_Item_Sequence),
Nodes (3),
Nodes (4),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (5),
Nodes (6),
Nodes (7));
when 162 =>
Nodes (1) :=
Self.Factory.Block_Statement
(Nodes (1),
Nodes (2),
No_Token,
(Self.Factory.Declarative_Item_Sequence),
Nodes (3),
Nodes (4),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (5),
No_Token,
Nodes (6));
when 163 =>
Nodes (1) :=
Self.Factory.Block_Statement
(None,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9));
when 164 =>
Nodes (1) :=
Self.Factory.Block_Statement
(None,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
Nodes (8));
when 165 =>
Nodes (1) :=
Self.Factory.Block_Statement
(None,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (5),
Nodes (6),
Nodes (7));
when 166 =>
Nodes (1) :=
Self.Factory.Block_Statement
(None,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (5),
No_Token,
Nodes (6));
when 167 =>
Nodes (1) :=
Self.Factory.Block_Statement
(None,
No_Token,
Nodes (1),
(Self.Factory.Declarative_Item_Sequence),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8));
when 168 =>
Nodes (1) :=
Self.Factory.Block_Statement
(None,
No_Token,
Nodes (1),
(Self.Factory.Declarative_Item_Sequence),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
No_Token,
Nodes (7));
when 169 =>
Nodes (1) :=
Self.Factory.Block_Statement
(None,
No_Token,
Nodes (1),
(Self.Factory.Declarative_Item_Sequence),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (4),
Nodes (5),
Nodes (6));
when 170 =>
Nodes (1) :=
Self.Factory.Block_Statement
(None,
No_Token,
Nodes (1),
(Self.Factory.Declarative_Item_Sequence),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (4),
No_Token,
Nodes (5));
when 171 =>
Nodes (1) :=
Self.Factory.Block_Statement
(None,
No_Token,
No_Token,
(Self.Factory.Declarative_Item_Sequence),
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7));
when 172 =>
Nodes (1) :=
Self.Factory.Block_Statement
(None,
No_Token,
No_Token,
(Self.Factory.Declarative_Item_Sequence),
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
Nodes (6));
when 173 =>
Nodes (1) :=
Self.Factory.Block_Statement
(None,
No_Token,
No_Token,
(Self.Factory.Declarative_Item_Sequence),
Nodes (1),
Nodes (2),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (3),
Nodes (4),
Nodes (5));
when 174 =>
Nodes (1) :=
Self.Factory.Block_Statement
(None,
No_Token,
No_Token,
(Self.Factory.Declarative_Item_Sequence),
Nodes (1),
Nodes (2),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (3),
No_Token,
Nodes (4));
when 175 =>
null;
when 176 =>
null;
when 177 =>
null;
when 178 =>
null;
when 179 =>
null;
when 180 =>
declare
List : Node :=
Nodes (1);
begin
Self.Factory.Append_Case_Expression_Path
(List, Nodes (3));
Nodes (1) := List;
end;
when 181 =>
declare
List : Node :=
Self.Factory.Case_Expression_Path_Sequence;
begin
Self.Factory.Append_Case_Expression_Path
(List, Nodes (2));
Nodes (1) := List;
end;
when 182 =>
declare
List : Node :=
Nodes (5);
begin
Self.Factory.Prepend_Case_Expression_Path
(List, Nodes (4));
Nodes (1) := Self.Factory.Case_Expression
(Nodes (1),
Nodes (2),
Nodes (3),
List);
end;
when 183 =>
declare
List : Node :=
Self.Factory.Case_Expression_Path_Sequence;
begin
Self.Factory.Prepend_Case_Expression_Path
(List, Nodes (4));
Nodes (1) := Self.Factory.Case_Expression
(Nodes (1),
Nodes (2),
Nodes (3),
List);
end;
when 184 =>
Nodes (1) := Self.Factory.Case_Expression_Path
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4));
when 185 =>
declare
List : Node :=
Nodes (5);
begin
Self.Factory.Prepend_Case_Path
(List, Nodes (4));
Nodes (1) := Self.Factory.Case_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
List,
Nodes (6),
Nodes (7),
Nodes (8));
end;
when 186 =>
declare
List : Node :=
Self.Factory.Case_Path_Sequence;
begin
Self.Factory.Prepend_Case_Path
(List, Nodes (4));
Nodes (1) := Self.Factory.Case_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
List,
Nodes (5),
Nodes (6),
Nodes (7));
end;
when 187 =>
Nodes (1) :=
Self.Factory.Case_Path
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4));
when 188 =>
declare
List : Node :=
Nodes (1);
begin
Self.Factory.Append_Case_Path
(List, Nodes (2));
Nodes (1) := List;
end;
when 189 =>
declare
List : Node :=
Self.Factory.Case_Path_Sequence;
begin
Self.Factory.Append_Case_Path
(List, Nodes (1));
Nodes (1) := List;
end;
when 190 =>
declare
List : Node :=
Nodes (1);
begin
Self.Factory.Append_Discrete_Choice
(List, Nodes (3));
Nodes (1) := List;
end;
when 191 =>
declare
List : Node :=
Self.Factory.Discrete_Choice_Sequence;
begin
Self.Factory.Append_Discrete_Choice
(List, Nodes (2));
Nodes (1) := List;
end;
when 192 =>
Nodes (1) :=
Self.Factory.Choice_Parameter_Specification
(Nodes (1));
when 193 =>
null;
when 194 =>
null;
when 195 =>
declare
List : Node := Nodes (1);
begin
Self.Factory.Append_Compilation_Unit
(List, Nodes (2));
Nodes (1) := List;
end;
when 196 =>
declare
List : Node := Self.
Factory.Compilation_Unit_Sequence;
begin
Self.Factory.Append_Compilation_Unit
(List, Nodes (1));
Nodes (1) := List;
end;
when 197 =>
declare
List : Node :=
Nodes (1);
begin
Self.Factory.Append_Association
(List, Nodes (3));
Nodes (1) := List;
end;
when 198 =>
declare
List : Node :=
Self.Factory.Association_Sequence;
begin
Self.Factory.Append_Association
(List, Nodes (2));
Nodes (1) := List;
end;
when 199 =>
Nodes (1) := Self.Factory.
Component_Clause
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6));
when 200 =>
null;
when 201 =>
declare
List : Node :=
Nodes (1);
begin
Self.Factory.Append_Clause_Or_Pragma
(List, Nodes (2));
Nodes (1) := List;
end;
when 202 =>
declare
List : Node :=
Self.Factory.Clause_Or_Pragma_Sequence;
begin
Self.Factory.Append_Clause_Or_Pragma
(List, Nodes (1));
Nodes (1) := List;
end;
when 203 =>
Nodes (1) := Self.Factory.
Component_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7));
when 204 =>
Nodes (1) := Self.Factory.
Component_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
(Self.Factory.Aspect_Specification_Sequence),
Nodes (6));
when 205 =>
Nodes (1) := Self.Factory.
Component_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
None,
Nodes (4),
Nodes (5));
when 206 =>
Nodes (1) := Self.Factory.
Component_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
None,
(Self.Factory.Aspect_Specification_Sequence),
Nodes (4));
when 207 =>
Nodes (1) := Self.Factory.Component_Definition
(Nodes (1),
Nodes (2));
when 208 =>
Nodes (1) := Self.Factory.Component_Definition
(No_Token,
Nodes (1));
when 209 =>
Nodes (1) := Self.Factory.Component_Definition
(Nodes (1),
Nodes (2));
when 210 =>
Nodes (1) := Self.Factory.Component_Definition
(No_Token,
Nodes (1));
when 211 =>
null;
when 212 =>
null;
when 213 =>
declare
List : Node :=
Nodes (1);
begin
Self.Factory.Append_Component_Item
(List, Nodes (2));
Nodes (1) := List;
end;
when 214 =>
declare
List : Node :=
Self.Factory.Component_Item_Sequence;
begin
Self.Factory.Append_Component_Item
(List, Nodes (1));
Nodes (1) := List;
end;
when 215 =>
declare
List : Node :=
Nodes (2);
begin
Self.Factory.Prepend_Component_Item
(List, Nodes (1));
Self.Factory.Append_Component_Item
(List, Nodes (3));
Nodes (1) := List;
end;
when 216 =>
declare
List : Node :=
Nodes (2);
begin
Self.Factory.Prepend_Component_Item
(List, Nodes (1));
Nodes (1) := List;
end;
when 217 =>
declare
List : Node :=
Self.Factory.
Component_Item_Sequence;
begin
Self.Factory.Prepend_Component_Item
(List, Nodes (1));
Self.Factory.Append_Component_Item
(List, Nodes (2));
Nodes (1) := List;
end;
when 218 =>
declare
List : Node :=
Self.Factory.
Component_Item_Sequence;
begin
Self.Factory.Prepend_Component_Item
(List, Nodes (1));
Nodes (1) := List;
end;
when 219 =>
declare
List : Node :=
Self.Factory.Component_Item_Sequence;
begin
Self.Factory.Prepend_Component_Item
(List, Nodes (1));
Nodes (1) := List;
end;
when 220 =>
declare
Comp : constant Node :=
Self.Factory.Null_Component
(Nodes (1), Nodes (2));
List : Node :=
Self.Factory.Component_Item_Sequence;
begin
Self.Factory.Prepend_Component_Item
(List, Comp);
Nodes (1) := List;
end;
when 221 =>
null;
when 222 =>
null;
when 223 =>
declare
List : Node :=
Nodes (4);
begin
Self.Factory.Prepend_Discrete_Subtype_Definition
(List, Nodes (3));
Nodes (1) := Self.Factory.
Constrained_Array_Definition
(Nodes (1),
Nodes (2),
List,
Nodes (5),
Nodes (6),
Nodes (7));
end;
when 224 =>
declare
List : Node :=
Self.Factory.
Discrete_Subtype_Definition_Sequence;
begin
Self.Factory.Prepend_Discrete_Subtype_Definition
(List, Nodes (3));
Nodes (1) := Self.Factory.
Constrained_Array_Definition
(Nodes (1),
Nodes (2),
List,
Nodes (4),
Nodes (5),
Nodes (6));
end;
when 225 =>
null;
when 226 =>
null;
when 227 =>
null;
when 228 =>
declare
List : Node := Nodes (1);
begin
Self.Factory.Append_Context_Item
(List, Nodes (2));
Nodes (1) := List;
end;
when 229 =>
declare
List : Node := Self.
Factory.Context_Item_Sequence;
begin
Self.Factory.Append_Context_Item
(List, Nodes (1));
Nodes (1) := List;
end;
when 230 =>
Nodes (1) :=
Self.Factory.Decimal_Fixed_Point_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5));
when 231 =>
Nodes (1) :=
Self.Factory.Decimal_Fixed_Point_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
None);
when 232 =>
null;
when 233 =>
null;
when 234 =>
declare
List : Node := Nodes (1);
begin
Self.Factory.Append_Declarative_Item
(List, Nodes (2));
Nodes (1) := List;
end;
when 235 =>
declare
List : Node := Self.
Factory.Declarative_Item_Sequence;
begin
Self.Factory.Append_Declarative_Item
(List, Nodes (1));
Nodes (1) := List;
end;
when 236 =>
declare
List : Node :=
Nodes (2);
begin
Self.Factory.Prepend_Declarative_Item
(List, Nodes (1));
Nodes (1) := List;
end;
when 237 =>
declare
List : Node :=
Self.
Factory.Declarative_Item_Sequence;
begin
Self.Factory.Prepend_Declarative_Item
(List, Nodes (1));
Nodes (1) := List;
end;
when 238 =>
Nodes (1) := Self.Factory.Defining_Character_Literal
(Nodes (1));
when 239 =>
null;
when 240 =>
Nodes (1) := Self.Factory.Defining_Operator_Symbol
(Nodes (1));
when 241 =>
Nodes (1) :=
Self.Factory.Defining_Enumeration_Literal (Nodes (1));
when 242 =>
declare
List : Node :=
Nodes (1);
begin
Self.Factory.Append_Defining_Identifier
(List, Nodes (3));
Nodes (1) := List;
end;
when 243 =>
declare
List : Node :=
Self.Factory.Defining_Identifier_Sequence;
begin
Self.Factory.Append_Defining_Identifier
(List, Nodes (2));
Nodes (1) := List;
end;
when 244 =>
Nodes (1) := Self.Factory.Defining_Identifier
(Nodes (1));
when 245 =>
declare
List : Node :=
Nodes (2);
begin
Self.Factory.Prepend_Defining_Identifier
(List, Nodes (1));
Nodes (1) := List;
end;
when 246 =>
declare
List : Node :=
Self.Factory.Defining_Identifier_Sequence;
begin
Self.Factory.Prepend_Defining_Identifier
(List, Nodes (1));
Nodes (1) := List;
end;
when 247 =>
Nodes (1) := Self.Factory.Defining_Identifier
(Nodes (1));
when 248 =>
Nodes (1) := Self.Factory.To_Defining_Program_Unit_Name
(Nodes (1));
when 249 =>
declare
List : Node :=
Nodes (2);
begin
Self.Factory.Prepend_Statement
(List, Nodes (1));
Nodes (1) := List;
end;
when 250 =>
declare
List : Node :=
Self.Factory.Statement_Sequence;
begin
Self.Factory.Prepend_Statement
(List, Nodes (1));
Nodes (1) := List;
end;
when 251 =>
Nodes (1) :=
Self.Factory.Delay_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4));
when 252 =>
Nodes (1) :=
Self.Factory.Delay_Statement
(Nodes (1),
No_Token,
Nodes (2),
Nodes (3));
when 253 =>
Nodes (1) := Self.Factory.Delta_Constraint
(Nodes (1), Nodes (2), Nodes (3));
when 254 =>
Nodes (1) := Self.Factory.Delta_Constraint
(Nodes (1), Nodes (2), None);
when 255 =>
null;
when 256 =>
null;
when 257 =>
Nodes (1) := Self.Factory.Digits_Constraint
(Nodes (1), Nodes (2), Nodes (3));
when 258 =>
Nodes (1) := Self.Factory.Digits_Constraint
(Nodes (1), Nodes (2), None);
when 259 =>
null;
when 260 =>
null;
when 261 =>
null;
when 262 =>
null;
when 263 =>
null;
when 264 =>
declare
List : Node :=
Nodes (2);
begin
Self.Factory.Prepend_Discrete_Choice
(List, Nodes (1));
Nodes (1) := List;
end;
when 265 =>
declare
List : Node :=
Self.Factory.Discrete_Choice_Sequence;
begin
Self.Factory.Prepend_Discrete_Choice
(List, Nodes (1));
Nodes (1) := List;
end;
when 266 =>
Nodes (1) := Self.Factory.Discrete_Subtype_Indication_Dr
(Nodes (1), Nodes (2));
when 267 =>
Nodes (1) := Self.Factory.Range_Attribute_Reference_Dr
(Nodes (1));
when 268 =>
Nodes (1) := Self.Factory.Simple_Expression_Range_Dr
(Nodes (1), Nodes (2), Nodes (3));
when 269 =>
Nodes (1) := Self.Factory.Discrete_Simple_Expression_Range
(Nodes (1), Nodes (2), Nodes (3));
when 270 =>
Nodes (1) := Self.Factory.Discrete_Subtype_Indication
(Nodes (1), Nodes (2));
when 271 =>
Nodes (1) := Self.Factory.Discrete_Subtype_Indication
(Nodes (1), None);
when 272 =>
Nodes (1) := Self.Factory.Discrete_Range_Attribute_Reference
(Nodes (1));
when 273 =>
null;
when 274 =>
declare
List : Node := Nodes (1);
begin
Self.Factory.Append_Discrete_Subtype_Definition
(List, Nodes (3));
Nodes (1) := List;
end;
when 275 =>
declare
List : Node := Self.
Factory.Discrete_Subtype_Definition_Sequence;
begin
Self.Factory.Append_Discrete_Subtype_Definition
(List, Nodes (2));
Nodes (1) := List;
end;
when 276 =>
null;
when 277 =>
null;
when 278 =>
declare
List : Node := Nodes (1);
begin
Self.Factory.Append_Discriminant_Specification
(List, Nodes (3));
Nodes (1) := List;
end;
when 279 =>
declare
List : Node := Self.
Factory.Discriminant_Specification_Sequence;
begin
Self.Factory.Append_Discriminant_Specification
(List, Nodes (2));
Nodes (1) := List;
end;
when 280 =>
Nodes (1) :=
Self.Factory.Discriminant_Specification
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7));
when 281 =>
Nodes (1) :=
Self.Factory.Discriminant_Specification
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
None);
when 282 =>
Nodes (1) :=
Self.Factory.Discriminant_Specification
(Nodes (1),
Nodes (2),
No_Token,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5));
when 283 =>
Nodes (1) :=
Self.Factory.Discriminant_Specification
(Nodes (1),
Nodes (2),
No_Token,
No_Token,
Nodes (3),
No_Token,
None);
when 284 =>
Nodes (1) :=
Self.Factory.Discriminant_Specification
(Nodes (1),
Nodes (2),
No_Token,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5));
when 285 =>
Nodes (1) :=
Self.Factory.Discriminant_Specification
(Nodes (1),
Nodes (2),
No_Token,
No_Token,
Nodes (3),
No_Token,
None);
when 286 =>
declare
Path : constant Node :=
Self.Factory.Elsif_Expression_Path
(Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5));
List : Node :=
Nodes (1);
begin
Self.Factory.Append_If_Else_Expression_Path
(List, Path);
Nodes (1) := List;
end;
when 287 =>
declare
Path : constant Node :=
Self.Factory.Elsif_Expression_Path
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4));
List : Node :=
Self.Factory.If_Else_Expression_Path_Sequence;
begin
Self.Factory.Append_If_Else_Expression_Path
(List, Path);
Nodes (1) := List;
end;
when 288 =>
declare
Item : constant Node :=
Self.Factory.Elsif_Path
(Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5));
List : Node :=
Nodes (1);
begin
Self.Factory.Append_If_Elsif_Else_Path
(List, Item);
Nodes (1) := List;
end;
when 289 =>
declare
Item : constant Node :=
Self.Factory.Elsif_Path
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4));
List : Node :=
Self.Factory.If_Elsif_Else_Path_Sequence;
begin
Self.Factory.Append_If_Elsif_Else_Path
(List, Item);
Nodes (1) := List;
end;
when 290 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
Nodes (13),
Nodes (14),
Nodes (15),
Nodes (16),
Nodes (17),
Nodes (18),
Nodes (19));
when 291 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
Nodes (13),
Nodes (14),
Nodes (15),
Nodes (16),
Nodes (17),
No_Token,
Nodes (18));
when 292 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
Nodes (13),
Nodes (14),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (15),
Nodes (16),
Nodes (17));
when 293 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
Nodes (13),
Nodes (14),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (15),
No_Token,
Nodes (16));
when 294 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
(Self.Factory.Declarative_Item_Sequence),
Nodes (12),
Nodes (13),
Nodes (14),
Nodes (15),
Nodes (16),
Nodes (17),
Nodes (18));
when 295 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
(Self.Factory.Declarative_Item_Sequence),
Nodes (12),
Nodes (13),
Nodes (14),
Nodes (15),
Nodes (16),
No_Token,
Nodes (17));
when 296 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
(Self.Factory.Declarative_Item_Sequence),
Nodes (12),
Nodes (13),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (14),
Nodes (15),
Nodes (16));
when 297 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
(Self.Factory.Declarative_Item_Sequence),
Nodes (12),
Nodes (13),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (14),
No_Token,
Nodes (15));
when 298 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
Nodes (13),
Nodes (14),
Nodes (15),
Nodes (16));
when 299 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
Nodes (13),
Nodes (14),
No_Token,
Nodes (15));
when 300 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (12),
Nodes (13),
Nodes (14));
when 301 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (12),
No_Token,
Nodes (13));
when 302 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
Nodes (7),
Nodes (8),
(Self.Factory.Declarative_Item_Sequence),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
Nodes (13),
Nodes (14),
Nodes (15));
when 303 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
Nodes (7),
Nodes (8),
(Self.Factory.Declarative_Item_Sequence),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
Nodes (13),
No_Token,
Nodes (14));
when 304 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
Nodes (7),
Nodes (8),
(Self.Factory.Declarative_Item_Sequence),
Nodes (9),
Nodes (10),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (11),
Nodes (12),
Nodes (13));
when 305 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
Nodes (7),
Nodes (8),
(Self.Factory.Declarative_Item_Sequence),
Nodes (9),
Nodes (10),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (11),
No_Token,
Nodes (12));
when 306 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
Nodes (13),
Nodes (14),
Nodes (15),
Nodes (16));
when 307 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
Nodes (13),
Nodes (14),
No_Token,
Nodes (15));
when 308 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (12),
Nodes (13),
Nodes (14));
when 309 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (12),
No_Token,
Nodes (13));
when 310 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
(Self.Factory.Declarative_Item_Sequence),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
Nodes (13),
Nodes (14),
Nodes (15));
when 311 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
(Self.Factory.Declarative_Item_Sequence),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
Nodes (13),
No_Token,
Nodes (14));
when 312 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
(Self.Factory.Declarative_Item_Sequence),
Nodes (9),
Nodes (10),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (11),
Nodes (12),
Nodes (13));
when 313 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
(Self.Factory.Declarative_Item_Sequence),
Nodes (9),
Nodes (10),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (11),
No_Token,
Nodes (12));
when 314 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
Nodes (13));
when 315 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
No_Token,
Nodes (12));
when 316 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (9),
Nodes (10),
Nodes (11));
when 317 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (9),
No_Token,
Nodes (10));
when 318 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
(Self.Factory.Declarative_Item_Sequence),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12));
when 319 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
(Self.Factory.Declarative_Item_Sequence),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
No_Token,
Nodes (11));
when 320 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
(Self.Factory.Declarative_Item_Sequence),
Nodes (6),
Nodes (7),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (8),
Nodes (9),
Nodes (10));
when 321 =>
Nodes (1) :=
Self.Factory.Entry_Body
(Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
(Self.Factory.Declarative_Item_Sequence),
Nodes (6),
Nodes (7),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (8),
No_Token,
Nodes (9));
when 322 =>
declare
List : Node :=
Nodes (2);
begin
Self.Factory.Prepend_Statement
(List, Nodes (1));
Nodes (1) := List;
end;
when 323 =>
declare
List : Node :=
Self.Factory.Statement_Sequence;
begin
Self.Factory.Prepend_Statement
(List, Nodes (1));
Nodes (1) := List;
end;
when 324 =>
Nodes (1) :=
Self.Factory.Procedure_Call_Statement
(Nodes (1), Nodes (2));
when 325 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12));
when 326 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
(Self.Factory.Aspect_Specification_Sequence),
Nodes (11));
when 327 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (8),
Nodes (9));
when 328 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
(Self.Factory.Aspect_Specification_Sequence),
Nodes (8));
when 329 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
No_Token,
None,
No_Token,
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9));
when 330 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
No_Token,
None,
No_Token,
Nodes (5),
Nodes (6),
Nodes (7),
(Self.Factory.Aspect_Specification_Sequence),
Nodes (8));
when 331 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (5),
Nodes (6));
when 332 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
(Self.Factory.Aspect_Specification_Sequence),
Nodes (5));
when 333 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11));
when 334 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
(Self.Factory.Aspect_Specification_Sequence),
Nodes (10));
when 335 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (7),
Nodes (8));
when 336 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
(Self.Factory.Aspect_Specification_Sequence),
Nodes (7));
when 337 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
None,
No_Token,
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8));
when 338 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
None,
No_Token,
Nodes (4),
Nodes (5),
Nodes (6),
(Self.Factory.Aspect_Specification_Sequence),
Nodes (7));
when 339 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (4),
Nodes (5));
when 340 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
(Self.Factory.Aspect_Specification_Sequence),
Nodes (4));
when 341 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10));
when 342 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
(Self.Factory.Aspect_Specification_Sequence),
Nodes (9));
when 343 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
Nodes (7));
when 344 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
(Self.Factory.Aspect_Specification_Sequence),
Nodes (6));
when 345 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7));
when 346 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
(Self.Factory.Aspect_Specification_Sequence),
Nodes (6));
when 347 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
Nodes (4));
when 348 =>
Nodes (1) :=
Self.Factory.Entry_Declaration
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
No_Token,
None,
No_Token,
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
(Self.Factory.Aspect_Specification_Sequence),
Nodes (3));
when 349 =>
Nodes (1) :=
Self.Factory.Entry_Index_Specification
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4));
when 350 =>
declare
List : Node := Nodes (1);
begin
Self.Factory.Append_Enumeration_Literal_Specification
(List, Nodes (3));
Nodes (1) := List;
end;
when 351 =>
declare
List : Node := Self.
Factory.Enumeration_Literal_Specification_Sequence;
begin
Self.Factory.Append_Enumeration_Literal_Specification
(List, Nodes (2));
Nodes (1) := List;
end;
when 352 =>
Nodes (1) := Self.Factory.Enumeration_Literal_Specification
(Nodes (1));
when 353 =>
Nodes (1) := Self.Factory.Enumeration_Literal_Specification
(Nodes (1));
when 354 =>
declare
List : Node :=
Nodes (3);
begin
Self.Factory.Prepend_Enumeration_Literal_Specification
(List, Nodes (2));
Nodes (1) := Self.Factory.
Enumeration_Type_Definition
(Nodes (1),
List,
Nodes (4));
end;
when 355 =>
declare
List : Node :=
Self.
Factory.Enumeration_Literal_Specification_Sequence;
begin
Self.Factory.Prepend_Enumeration_Literal_Specification
(List, Nodes (2));
Nodes (1) := Self.Factory.
Enumeration_Type_Definition
(Nodes (1),
List,
Nodes (3));
end;
when 356 =>
null;
when 357 =>
null;
when 358 =>
declare
List : Node := Nodes (1);
begin
Self.Factory.Append_Exception_Choice
(List, Nodes (3));
Nodes (1) := List;
end;
when 359 =>
declare
List : Node := Self.
Factory.Exception_Choice_Sequence;
begin
Self.Factory.Append_Exception_Choice
(List, Nodes (2));
Nodes (1) := List;
end;
when 360 =>
Nodes (1) :=
Self.Factory.Exception_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5));
when 361 =>
Nodes (1) :=
Self.Factory.Exception_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
(Self.Factory.Aspect_Specification_Sequence),
Nodes (4));
when 362 =>
declare
List : Node :=
Nodes (5);
begin
Self.Factory.Prepend_Exception_Choice
(List, Nodes (4));
Nodes (1) :=
Self.Factory.Exception_Handler
(Nodes (1),
Nodes (2),
Nodes (3),
List,
Nodes (6),
Nodes (7));
end;
when 363 =>
declare
List : Node :=
Self.
Factory.Exception_Choice_Sequence;
begin
Self.Factory.Prepend_Exception_Choice
(List, Nodes (4));
Nodes (1) :=
Self.Factory.Exception_Handler
(Nodes (1),
Nodes (2),
Nodes (3),
List,
Nodes (5),
Nodes (6));
end;
when 364 =>
declare
List : Node :=
Nodes (3);
begin
Self.Factory.Prepend_Exception_Choice
(List, Nodes (2));
Nodes (1) :=
Self.Factory.Exception_Handler
(Nodes (1),
None,
No_Token,
List,
Nodes (4),
Nodes (5));
end;
when 365 =>
declare
List : Node :=
Self.
Factory.Exception_Choice_Sequence;
begin
Self.Factory.Prepend_Exception_Choice
(List, Nodes (2));
Nodes (1) :=
Self.Factory.Exception_Handler
(Nodes (1),
None,
No_Token,
List,
Nodes (3),
Nodes (4));
end;
when 366 =>
declare
List : Node := Nodes (1);
begin
Self.Factory.Append_Exception_Handler
(List, Nodes (2));
Nodes (1) := List;
end;
when 367 =>
declare
List : Node := Self.
Factory.Exception_Handler_Sequence;
begin
Self.Factory.Append_Exception_Handler
(List, Nodes (1));
Nodes (1) := List;
end;
when 368 =>
Nodes (1) :=
Self.Factory.Exception_Renaming_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7));
when 369 =>
Nodes (1) :=
Self.Factory.Exception_Renaming_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
(Self.Factory.Aspect_Specification_Sequence),
Nodes (6));
when 370 =>
Nodes (1) :=
Self.Factory.Exit_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5));
when 371 =>
Nodes (1) :=
Self.Factory.Exit_Statement
(Nodes (1),
Nodes (2),
No_Token,
None,
Nodes (3));
when 372 =>
Nodes (1) :=
Self.Factory.Exit_Statement
(Nodes (1),
None,
Nodes (2),
Nodes (3),
Nodes (4));
when 373 =>
Nodes (1) :=
Self.Factory.Exit_Statement
(Nodes (1),
None,
No_Token,
None,
Nodes (2));
when 374 =>
Nodes (1) := Self.Factory.Explicit_Dereference
(Nodes (1), Nodes (2), Nodes (3));
when 375 =>
null;
when 376 =>
Nodes (1) := Self.Factory.Infix_Call
(Nodes (2), Nodes (1), Nodes (3));
when 377 =>
Nodes (1) := Self.Factory.Short_Circuit
(Nodes (1), Nodes (2), Nodes (3), Nodes (4));
when 378 =>
Nodes (1) := Self.Factory.Infix_Call
(Nodes (2), Nodes (1), Nodes (3));
when 379 =>
Nodes (1) := Self.Factory.Short_Circuit
(Nodes (1), Nodes (2), Nodes (3), Nodes (4));
when 380 =>
Nodes (1) := Self.Factory.Infix_Call
(Nodes (2), Nodes (1), Nodes (3));
when 381 =>
Nodes (1) :=
Self.Factory.Return_Object_Specification
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7));
when 382 =>
Nodes (1) :=
Self.Factory.Return_Object_Specification
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
None);
when 383 =>
Nodes (1) :=
Self.Factory.Return_Object_Specification
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
Nodes (5),
Nodes (6));
when 384 =>
Nodes (1) :=
Self.Factory.Return_Object_Specification
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
No_Token,
None);
when 385 =>
Nodes (1) :=
Self.Factory.Return_Object_Specification
(Nodes (1),
Nodes (2),
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6));
when 386 =>
Nodes (1) :=
Self.Factory.Return_Object_Specification
(Nodes (1),
Nodes (2),
No_Token,
Nodes (3),
Nodes (4),
No_Token,
None);
when 387 =>
Nodes (1) :=
Self.Factory.Return_Object_Specification
(Nodes (1),
Nodes (2),
No_Token,
No_Token,
Nodes (3),
Nodes (4),
Nodes (5));
when 388 =>
Nodes (1) :=
Self.Factory.Return_Object_Specification
(Nodes (1),
Nodes (2),
No_Token,
No_Token,
Nodes (3),
No_Token,
None);
when 389 =>
Nodes (1) :=
Self.Factory.Extended_Return_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9));
when 390 =>
Nodes (1) :=
Self.Factory.Extended_Return_Statement
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
Nodes (5),
Nodes (6),
Nodes (7));
when 391 =>
Nodes (1) :=
Self.Factory.Extended_Return_Statement
(Nodes (1),
Nodes (2),
No_Token,
(Self.Factory.Statement_Sequence),
No_Token,
(Self.Factory.Exception_Handler_Sequence),
No_Token,
No_Token,
Nodes (3));
when 392 =>
Nodes (1) :=
Self.Factory.Extension_Aggregate
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5));
when 393 =>
Nodes (1) := Self.Factory.Floating_Point_Definition
(Nodes (1),
Nodes (2),
Nodes (3));
when 394 =>
Nodes (1) := Self.Factory.Floating_Point_Definition
(Nodes (1),
Nodes (2),
None);
when 395 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Object_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5));
when 396 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Object_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4));
when 397 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Object_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3));
when 398 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Object_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2));
when 399 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Procedure_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8));
when 400 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Procedure_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token);
when 401 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Procedure_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7));
when 402 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Procedure_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token);
when 403 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Procedure_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6));
when 404 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Procedure_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token);
when 405 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Procedure_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5));
when 406 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Procedure_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token);
when 407 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12));
when 408 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
No_Token,
No_Token,
Nodes (10));
when 409 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9));
when 410 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
No_Token,
No_Token,
Nodes (7));
when 411 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11));
when 412 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
No_Token,
No_Token,
Nodes (9));
when 413 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8));
when 414 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (5),
No_Token,
No_Token,
Nodes (6));
when 415 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10));
when 416 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
No_Token,
Nodes (8));
when 417 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7));
when 418 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (4),
No_Token,
No_Token,
Nodes (5));
when 419 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9));
when 420 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
No_Token,
No_Token,
Nodes (7));
when 421 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6));
when 422 =>
Nodes (1) := Self.Factory.
Formal_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
No_Token,
No_Token,
Nodes (4));
when 423 =>
Nodes (1) := Self.Factory.Formal_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
No_Token,
No_Token,
Nodes (10));
when 424 =>
Nodes (1) := Self.Factory.Formal_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (6),
No_Token,
No_Token,
Nodes (7));
when 425 =>
Nodes (1) := Self.Factory.Formal_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
No_Token,
No_Token,
Nodes (9));
when 426 =>
Nodes (1) := Self.Factory.Formal_Access_To_Function_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
Nodes (4),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (5),
No_Token,
No_Token,
Nodes (6));
when 427 =>
Nodes (1) := Self.Factory.Formal_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
No_Token,
Nodes (8));
when 428 =>
Nodes (1) := Self.Factory.Formal_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (4),
No_Token,
No_Token,
Nodes (5));
when 429 =>
Nodes (1) := Self.Factory.Formal_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
No_Token,
No_Token,
Nodes (7));
when 430 =>
Nodes (1) := Self.Factory.Formal_Access_To_Function_Definition
(No_Token,
No_Token,
Nodes (1),
No_Token,
Nodes (2),
No_Token,
(Self.Factory.Parameter_Specification_Sequence),
No_Token,
Nodes (3),
No_Token,
No_Token,
Nodes (4));
when 431 =>
Nodes (1) :=
Self.Factory.Formal_Type_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7));
when 432 =>
Nodes (1) :=
Self.Factory.Formal_Type_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
(Self.Factory.Aspect_Specification_Sequence),
Nodes (6));
when 433 =>
Nodes (1) :=
Self.Factory.Formal_Type_Declaration
(Nodes (1),
Nodes (2),
None,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6));
when 434 =>
Nodes (1) :=
Self.Factory.Formal_Type_Declaration
(Nodes (1),
Nodes (2),
None,
Nodes (3),
Nodes (4),
(Self.Factory.Aspect_Specification_Sequence),
Nodes (5));
when 435 =>
Nodes (1) :=
Self.Factory.Formal_Type_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Self.Factory.Aspect_Specification_Sequence,
Nodes (6));
when 436 =>
Nodes (1) :=
Self.Factory.Formal_Type_Declaration
(Nodes (1),
Nodes (2),
None,
Nodes (3),
Nodes (4),
Self.Factory.Aspect_Specification_Sequence,
Nodes (5));
when 437 =>
declare
List : Node :=
Nodes (4);
begin
Self.Factory.Prepend_Discrete_Subtype_Definition
(List, Nodes (3));
Nodes (1) := Self.Factory.
Formal_Constrained_Array_Definition
(Nodes (1),
Nodes (2),
List,
Nodes (5),
Nodes (6),
Nodes (7));
end;
when 438 =>
declare
List : Node :=
Self.Factory.
Discrete_Subtype_Definition_Sequence;
begin
Self.Factory.Prepend_Discrete_Subtype_Definition
(List, Nodes (3));
Nodes (1) := Self.Factory.
Formal_Constrained_Array_Definition
(Nodes (1),
Nodes (2),
List,
Nodes (4),
Nodes (5),
Nodes (6));
end;
when 439 =>
Nodes (1) :=
Self.Factory.Formal_Decimal_Fixed_Point_Definition
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4));
when 440 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
Nodes (2),
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9));
when 441 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
Nodes (2),
No_Token,
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
(Self.Factory.Aspect_Specification_Sequence));
when 442 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
Nodes (2),
No_Token,
Nodes (3),
Nodes (4),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
Nodes (5),
Nodes (6),
Nodes (7));
when 443 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
Nodes (2),
No_Token,
Nodes (3),
Nodes (4),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
Nodes (5),
Nodes (6),
(Self.Factory.Aspect_Specification_Sequence));
when 444 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
Nodes (2),
No_Token,
Nodes (3),
Nodes (4),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
No_Token,
No_Token,
Nodes (5));
when 445 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
Nodes (2),
No_Token,
Nodes (3),
Nodes (4),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
No_Token,
No_Token,
(Self.Factory.Aspect_Specification_Sequence));
when 446 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9));
when 447 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
(Self.Factory.Aspect_Specification_Sequence));
when 448 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
Nodes (5),
Nodes (6),
Nodes (7));
when 449 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
Nodes (5),
Nodes (6),
(Self.Factory.Aspect_Specification_Sequence));
when 450 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
No_Token,
No_Token,
Nodes (5));
when 451 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
No_Token,
No_Token,
(Self.Factory.Aspect_Specification_Sequence));
when 452 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
No_Token,
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8));
when 453 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
No_Token,
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
(Self.Factory.Aspect_Specification_Sequence));
when 454 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
No_Token,
No_Token,
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
Nodes (4),
Nodes (5),
Nodes (6));
when 455 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
No_Token,
No_Token,
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
Nodes (4),
Nodes (5),
(Self.Factory.Aspect_Specification_Sequence));
when 456 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
No_Token,
No_Token,
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
No_Token,
No_Token,
Nodes (4));
when 457 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(Nodes (1),
No_Token,
No_Token,
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
No_Token,
No_Token,
(Self.Factory.Aspect_Specification_Sequence));
when 458 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8));
when 459 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
(Self.Factory.Aspect_Specification_Sequence));
when 460 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
Nodes (4),
Nodes (5),
Nodes (6));
when 461 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
Nodes (4),
Nodes (5),
(Self.Factory.Aspect_Specification_Sequence));
when 462 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
No_Token,
No_Token,
Nodes (4));
when 463 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
Nodes (1),
No_Token,
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
No_Token,
No_Token,
(Self.Factory.Aspect_Specification_Sequence));
when 464 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8));
when 465 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
(Self.Factory.Aspect_Specification_Sequence));
when 466 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
Nodes (4),
Nodes (5),
Nodes (6));
when 467 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
Nodes (4),
Nodes (5),
(Self.Factory.Aspect_Specification_Sequence));
when 468 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
No_Token,
No_Token,
Nodes (4));
when 469 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
No_Token,
No_Token,
(Self.Factory.Aspect_Specification_Sequence));
when 470 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7));
when 471 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
No_Token,
No_Token,
Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
(Self.Factory.Aspect_Specification_Sequence));
when 472 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
No_Token,
No_Token,
Nodes (1),
Nodes (2),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
Nodes (3),
Nodes (4),
Nodes (5));
when 473 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
No_Token,
No_Token,
Nodes (1),
Nodes (2),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
Nodes (3),
Nodes (4),
(Self.Factory.Aspect_Specification_Sequence));
when 474 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
No_Token,
No_Token,
Nodes (1),
Nodes (2),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
No_Token,
No_Token,
Nodes (3));
when 475 =>
Nodes (1) :=
Self.Factory.Formal_Derived_Type_Definition
(No_Token,
No_Token,
No_Token,
Nodes (1),
Nodes (2),
No_Token,
(Self.Factory.Subtype_Mark_Sequence),
No_Token,
No_Token,
(Self.Factory.Aspect_Specification_Sequence));
when 476 =>
Nodes (1) :=
Self.Factory.Formal_Discrete_Type_Definition
(Nodes (1),
Nodes (2),
Nodes (3));
when 477 =>
Nodes (1) :=
Self.Factory.Formal_Floating_Point_Definition
(Nodes (1),
Nodes (2));
when 478 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
Nodes (13),
No_Token,
Nodes (14),
Nodes (15));
when 479 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
Nodes (13),
No_Token,
(Self.Factory.Aspect_Specification_Sequence),
Nodes (14));
when 480 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
None,
Nodes (13),
Nodes (14),
Nodes (15));
when 481 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
None,
Nodes (13),
(Self.Factory.Aspect_Specification_Sequence),
Nodes (14));
when 482 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
None,
No_Token,
Nodes (13),
Nodes (14));
when 483 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
Nodes (12),
None,
No_Token,
(Self.Factory.Aspect_Specification_Sequence),
Nodes (13));
when 484 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
No_Token,
Nodes (12),
No_Token,
Nodes (13),
Nodes (14));
when 485 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
No_Token,
Nodes (12),
No_Token,
(Self.Factory.Aspect_Specification_Sequence),
Nodes (13));
when 486 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
No_Token,
None,
Nodes (12),
Nodes (13),
Nodes (14));
when 487 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
No_Token,
None,
Nodes (12),
(Self.Factory.Aspect_Specification_Sequence),
Nodes (13));
when 488 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
No_Token,
No_Token,
None,
No_Token,
Nodes (11),
Nodes (12));
when 489 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
Nodes (8),
Nodes (9),
Nodes (10),
No_Token,
No_Token,
None,
No_Token,
(Self.Factory.Aspect_Specification_Sequence),
Nodes (11));
when 490 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
No_Token,
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
No_Token,
Nodes (12),
Nodes (13));
when 491 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
No_Token,
Nodes (8),
Nodes (9),
Nodes (10),
Nodes (11),
No_Token,
(Self.Factory.Aspect_Specification_Sequence),
Nodes (12));
when 492 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
No_Token,
Nodes (8),
Nodes (9),
Nodes (10),
None,
Nodes (11),
Nodes (12),
Nodes (13));
when 493 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
No_Token,
Nodes (8),
Nodes (9),
Nodes (10),
None,
Nodes (11),
(Self.Factory.Aspect_Specification_Sequence),
Nodes (12));
when 494 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
No_Token,
Nodes (8),
Nodes (9),
Nodes (10),
None,
No_Token,
Nodes (11),
Nodes (12));
when 495 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
No_Token,
Nodes (8),
Nodes (9),
Nodes (10),
None,
No_Token,
(Self.Factory.Aspect_Specification_Sequence),
Nodes (11));
when 496 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
No_Token,
Nodes (8),
Nodes (9),
No_Token,
Nodes (10),
No_Token,
Nodes (11),
Nodes (12));
when 497 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
No_Token,
Nodes (8),
Nodes (9),
No_Token,
Nodes (10),
No_Token,
(Self.Factory.Aspect_Specification_Sequence),
Nodes (11));
when 498 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
No_Token,
Nodes (8),
Nodes (9),
No_Token,
None,
Nodes (10),
Nodes (11),
Nodes (12));
when 499 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
No_Token,
Nodes (8),
Nodes (9),
No_Token,
None,
Nodes (10),
(Self.Factory.Aspect_Specification_Sequence),
Nodes (11));
when 500 =>
Nodes (1) :=
Self.Factory.Formal_Function_Declaration
(Nodes (1),
Nodes (2),
Nodes (3),
Nodes (4),
Nodes (5),
Nodes (6),
Nodes (7),
No_Token,
No_Token,
Nodes (8),
No_Token,
No_Token,
None,
No_Token,
Nodes (9),
Nodes (10));
when others =>
raise Constraint_Error;
end case;
end Program.Parsers.On_Reduce_1;
|
-- -*- Mode: Ada -*-
-- Filename : ether-response.adb
-- Description : Body for the response objects.
-- Author : Luke A. Guest
-- Created On : Sun Jul 4 19:22:48 2010
with Ada.Characters.Latin_1;
--with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings.Unbounded;
package body Ether.Responses is
package L1 renames Ada.Characters.Latin_1;
package US renames Ada.Strings.Unbounded;
use type US.Unbounded_String;
CRLF : constant String := (L1.CR, L1.LF);
procedure Send
(Output : in GNAT.Sockets.Stream_Access;
Status : in AWS.Messages.Status_Code;
Mime_type : in String;
Content : in String;
Char_Set : in String := "UTF-8") is
Actual_Char_Set : US.Unbounded_String := US.To_Unbounded_String("; charset=");
begin
if Char_Set = "" then
Actual_Char_Set := US.Null_Unbounded_String;
else
Actual_Char_Set := Actual_Char_Set & Char_Set;
end if;
-- TODO: Check to make sure that there is no body for response codes:
-- 1xx, 204, 304, raise an exception if it does. See S.4.3 of
-- RFC2616.
-- Object := Request'(Status => Status, Mime => Mime, Content => Content);
String'Write
(Output,
"Status: " & AWS.Messages.Image(Status) & CRLF &
"Content-Type: " & Mime_Type & US.To_String(Actual_Char_Set) & CRLF &
CRLF &
Content);
-- Put_Line("Status: " & Status_Map(Status) & " " & Status_Type'Image(Status) & CRLF &
-- "Content-Type: " & US.To_String(Mime_Map(Mime)) & CRLF &
-- CRLF &
-- Content);
end Send;
end Ether.Responses;
|
pragma Profile (Ravenscar);
pragma Partition_Elaboration_Policy (Sequential);
with Ada.Real_Time; use Ada.Real_Time;
package Stopwatch is
Update_Rate : constant Time_Span := Milliseconds (100);
-- the type definition of the protected obect
-- controlling the stopwatch task
protected type Stopwatch_Ctrl_Type is
procedure Set_Frozen (indeed : Boolean);
procedure Do_Reset;
function Is_Frozen return Boolean;
procedure Get_Reset (indeed : out Boolean);
private
Stopped : Boolean := False;
Reset : Boolean := False;
Freeze_Display : Boolean := False;
end Stopwatch_Ctrl_Type;
-- instance of the protected object:
Control : Stopwatch_Ctrl_Type;
private
-- these things are not visible to main; internals of stopwatch.
procedure Print_Time (M : String; ts : Time_Span);
task type Clock_Task_Type;
Task_Clock : Clock_Task_Type; -- statically created task at package level.
-- Could also be moved to .adb
end Stopwatch;
|
-- { dg-excess-errors "no code generated" }
with Renaming2_Pkg2;
with Renaming2_Pkg3;
with Renaming2_Pkg4;
package Renaming2_Pkg1 is
package Impl is new
Renaming2_Pkg3 (Base_Index_T => Positive, Value_T => Renaming2_Pkg2.Root);
use Impl;
package GP is new
Renaming2_Pkg4 (Length_T => Impl.Length_T, Value_T => Renaming2_Pkg2.Root);
end Renaming2_Pkg1;
|
with Numerics;
use Numerics;
package body Forward_AD.Integrator is
function Bogack_Shampine (Hamiltonian : not null access
function (X : Real_Array; N : Nat) return AD_Type;
Var : in Variable;
Control : in out Control_Type)
return Real_Array is
X : Real_Array renames Var.X;
N : Nat renames Control.N;
Dt : Real renames Control.Dt;
Err : Real renames Control.Err;
J : constant Sparse_Matrix := -Omega (N);
K1, K2, K3, K4, Y, Z : Real_Array (X'Range);
begin
pragma Assert (2 * N = Var.N2);
K1 := To_Array (J * Grad (Hamiltonian (X, N)));
K2 := To_Array (J * Grad (Hamiltonian (X + (0.50 * Dt) * K1, N)));
K3 := To_Array (J * Grad (Hamiltonian (X + (0.75 * Dt) * K2, N)));
Y := X + (Dt / 9.0) * (2.0 * K1 + 3.0 * K2 + 4.0 * K3);
K4 := To_Array (J * Grad (Hamiltonian (Y, N)));
Z := X + (Dt / 24.0) * (7.0 * K1 + 6.0 * K2 + 8.0 * K3 + 3.0 * K4);
Err := Norm (Z - Y);
return (Z);
end Bogack_Shampine;
procedure Update (Hamiltonian : not null access
function (X : Real_Array; N : Nat) return AD_Type;
Var : in out Variable;
Control : in out Control_Type) is
use Real_Functions;
X : Real_Array renames Var.X;
T : Real renames Var.T;
N : Nat renames Control.N;
Dt : Real renames Control.Dt;
Err : Real renames Control.Err;
Eps : Real renames Control.Eps;
Y : Real_Array (X'Range);
begin
pragma Assert (2 * N = Var.N2);
Err := 1.0;
while Err > Eps loop
Y := Bogack_Shampine (Hamiltonian, Var, Control);
if (Err <= Eps) then
X := Y;
T := T + Dt;
end if;
Dt := 0.8 * Dt * (Eps / Err) ** 0.3;
end loop;
end Update;
end Forward_AD.Integrator;
|
------------------------------------------------------------------------
-- Copyright (C) 2010-2020 by Heisenbug Ltd. (github@heisenbug.eu)
--
-- This work is free. You can redistribute it and/or modify it under
-- the terms of the Do What The Fuck You Want To Public License,
-- Version 2, as published by Sam Hocevar. See the LICENSE file for
-- more details.
------------------------------------------------------------------------
pragma License (Unrestricted);
------------------------------------------------------------------------
-- A very simple program to show how the Local_Message_Passing works.
--
-- The actual implementation is in the Sender and Receiver packages.
------------------------------------------------------------------------
with Sender;
with Receiver;
-- Include the sender and receiver tasks.
procedure Simple_LMP is
begin
-- Sender and Receiver have their own tasks, we don't need to do
-- anything here.
-- In fact, this program never ends.
-- When running this program, you should see the text output
-- "Loud and clear." at regular intervals. This is the confirmation
-- that the receiver task actually received the expected message
-- "Do you hear me?" from the sender task.
null;
end Simple_LMP;
|
-- This spec has been automatically generated from STM32L4x2.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.RNG is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- control register
type CR_Register is record
-- unspecified
Reserved_0_1 : HAL.UInt2 := 16#0#;
-- Random number generator enable
RNGEN : Boolean := False;
-- Interrupt enable
IE : Boolean := False;
-- unspecified
Reserved_4_31 : HAL.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
Reserved_0_1 at 0 range 0 .. 1;
RNGEN at 0 range 2 .. 2;
IE at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-- status register
type SR_Register is record
-- Read-only. Data ready
DRDY : Boolean := False;
-- Read-only. Clock error current status
CECS : Boolean := False;
-- Read-only. Seed error current status
SECS : Boolean := False;
-- unspecified
Reserved_3_4 : HAL.UInt2 := 16#0#;
-- Clock error interrupt status
CEIS : Boolean := False;
-- Seed error interrupt status
SEIS : Boolean := False;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
DRDY at 0 range 0 .. 0;
CECS at 0 range 1 .. 1;
SECS at 0 range 2 .. 2;
Reserved_3_4 at 0 range 3 .. 4;
CEIS at 0 range 5 .. 5;
SEIS at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Random number generator
type RNG_Peripheral is record
-- control register
CR : aliased CR_Register;
-- status register
SR : aliased SR_Register;
-- data register
DR : aliased HAL.UInt32;
end record
with Volatile;
for RNG_Peripheral use record
CR at 16#0# range 0 .. 31;
SR at 16#4# range 0 .. 31;
DR at 16#8# range 0 .. 31;
end record;
-- Random number generator
RNG_Periph : aliased RNG_Peripheral
with Import, Address => System'To_Address (16#50060800#);
end STM32_SVD.RNG;
|
generic
type Element_Type is private;
package Generic_Queue is
type T is limited private;
procedure Enqueue( Queue: in out T; Element: in Element_Type );
procedure Dequeue( Queue: in out T; Element: out Element_Type );
procedure Peek ( Queue: in out T; Element: out Element_Type );
function Empty ( Queue: in T ) return Boolean;
procedure Reset ( Queue: in out T );
Underflow : exception;
private
type Queue_Node;
type Queue_Node_Ptr is access Queue_Node;
type Queue_Node is
record
Data : Element_Type;
Next : Queue_Node_Ptr;
end record;
type T is
record
Head : Queue_Node_Ptr := null;
Tail : Queue_Node_Ptr := null;
end record;
end Generic_Queue;
|
with Ada.Directories; use Ada.Directories;
with Ada.Text_IO; use Ada.Text_IO;
procedure Walk_Directory
(Directory : in String := ".";
Pattern : in String := "") -- empty pattern = all file names/subdirectory names
is
Search : Search_Type;
Dir_Ent : Directory_Entry_Type;
begin
Start_Search (Search, Directory, Pattern);
while More_Entries (Search) loop
Get_Next_Entry (Search, Dir_Ent);
Put_Line (Simple_Name (Dir_Ent));
end loop;
End_Search (Search);
end Walk_Directory;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2015, Vadim Godunko <vgodunko@gmail.com> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
-- GNAT: enforce generation of preinitialized data section instead of
-- generation of elaboration code.
package Matreshka.Internals.Unicode.Ucd.Core_000F is
pragma Preelaborate;
Group_000F : aliased constant Core_Second_Stage
:= (16#00# => -- 0F00
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#01# .. 16#03# => -- 0F01 .. 0F03
(Other_Symbol, Neutral,
Other, Other, Other, Break_Before,
(Grapheme_Base => True,
others => False)),
16#04# => -- 0F04
(Other_Punctuation, Neutral,
Other, Other, Other, Break_Before,
(Grapheme_Base => True,
others => False)),
16#05# => -- 0F05
(Other_Punctuation, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#06# .. 16#07# => -- 0F06 .. 0F07
(Other_Punctuation, Neutral,
Other, Other, Other, Break_Before,
(Grapheme_Base => True,
others => False)),
16#08# => -- 0F08
(Other_Punctuation, Neutral,
Other, Other, Other, Glue,
(Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#09# .. 16#0A# => -- 0F09 .. 0F0A
(Other_Punctuation, Neutral,
Other, Other, Other, Break_Before,
(Grapheme_Base => True,
others => False)),
16#0B# => -- 0F0B
(Other_Punctuation, Neutral,
Other, Other, Other, Break_After,
(Grapheme_Base => True,
others => False)),
16#0C# => -- 0F0C
(Other_Punctuation, Neutral,
Other, Other, Other, Glue,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#0D# .. 16#11# => -- 0F0D .. 0F11
(Other_Punctuation, Neutral,
Other, Other, Other, Exclamation,
(Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#12# => -- 0F12
(Other_Punctuation, Neutral,
Other, Other, Other, Glue,
(Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#13# => -- 0F13
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#14# => -- 0F14
(Other_Punctuation, Neutral,
Other, Other, Other, Exclamation,
(Grapheme_Base => True,
others => False)),
16#15# .. 16#17# => -- 0F15 .. 0F17
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#18# .. 16#19# => -- 0F18 .. 0F19
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#1A# .. 16#1F# => -- 0F1A .. 0F1F
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#20# .. 16#29# => -- 0F20 .. 0F29
(Decimal_Number, Neutral,
Other, Numeric, Numeric, Numeric,
(Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#2A# .. 16#33# => -- 0F2A .. 0F33
(Other_Number, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#34# => -- 0F34
(Other_Symbol, Neutral,
Other, Other, Other, Break_After,
(Grapheme_Base => True,
others => False)),
16#35# => -- 0F35
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#36# => -- 0F36
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#37# => -- 0F37
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#38# => -- 0F38
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#39# => -- 0F39
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#3A# => -- 0F3A
(Open_Punctuation, Neutral,
Other, Other, Close, Open_Punctuation,
(Grapheme_Base => True,
others => False)),
16#3B# => -- 0F3B
(Close_Punctuation, Neutral,
Other, Other, Close, Close_Punctuation,
(Grapheme_Base => True,
others => False)),
16#3C# => -- 0F3C
(Open_Punctuation, Neutral,
Other, Other, Close, Open_Punctuation,
(Grapheme_Base => True,
others => False)),
16#3D# => -- 0F3D
(Close_Punctuation, Neutral,
Other, Other, Close, Close_Punctuation,
(Grapheme_Base => True,
others => False)),
16#3E# .. 16#3F# => -- 0F3E .. 0F3F
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Diacritic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#40# .. 16#42# => -- 0F40 .. 0F42
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#43# => -- 0F43
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#44# .. 16#47# => -- 0F44 .. 0F47
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#48# => -- 0F48
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#49# .. 16#4C# => -- 0F49 .. 0F4C
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#4D# => -- 0F4D
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#4E# .. 16#51# => -- 0F4E .. 0F51
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#52# => -- 0F52
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#53# .. 16#56# => -- 0F53 .. 0F56
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#57# => -- 0F57
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#58# .. 16#5B# => -- 0F58 .. 0F5B
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#5C# => -- 0F5C
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#5D# .. 16#68# => -- 0F5D .. 0F68
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#69# => -- 0F69
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#6A# .. 16#6C# => -- 0F6A .. 0F6C
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#6D# .. 16#70# => -- 0F6D .. 0F70
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#73# => -- 0F73
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#75# .. 16#76# => -- 0F75 .. 0F76
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#77# => -- 0F77
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Deprecated
| Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#78# => -- 0F78
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#79# => -- 0F79
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Deprecated
| Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#7F# => -- 0F7F
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Break_After,
(Other_Alphabetic
| Alphabetic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#81# => -- 0F81
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#82# .. 16#83# => -- 0F82 .. 0F83
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#84# => -- 0F84
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| Grapheme_Link
| ID_Continue
| XID_Continue => True,
others => False)),
16#85# => -- 0F85
(Other_Punctuation, Neutral,
Other, Other, Other, Break_After,
(Grapheme_Base => True,
others => False)),
16#86# .. 16#87# => -- 0F86 .. 0F87
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#88# .. 16#8C# => -- 0F88 .. 0F8C
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#93# => -- 0F93
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#98# => -- 0F98
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#9D# => -- 0F9D
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#A2# => -- 0FA2
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#A7# => -- 0FA7
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#AC# => -- 0FAC
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#B9# => -- 0FB9
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#BD# => -- 0FBD
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#BE# .. 16#BF# => -- 0FBE .. 0FBF
(Other_Symbol, Neutral,
Other, Other, Other, Break_After,
(Grapheme_Base => True,
others => False)),
16#C0# .. 16#C5# => -- 0FC0 .. 0FC5
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#C6# => -- 0FC6
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#C7# .. 16#CC# => -- 0FC7 .. 0FCC
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#CD# => -- 0FCD
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#CE# .. 16#CF# => -- 0FCE .. 0FCF
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#D0# .. 16#D1# => -- 0FD0 .. 0FD1
(Other_Punctuation, Neutral,
Other, Other, Other, Break_Before,
(Grapheme_Base => True,
others => False)),
16#D2# => -- 0FD2
(Other_Punctuation, Neutral,
Other, Other, Other, Break_After,
(Grapheme_Base => True,
others => False)),
16#D3# => -- 0FD3
(Other_Punctuation, Neutral,
Other, Other, Other, Break_Before,
(Grapheme_Base => True,
others => False)),
16#D4# => -- 0FD4
(Other_Punctuation, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#D5# .. 16#D8# => -- 0FD5 .. 0FD8
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#D9# .. 16#DA# => -- 0FD9 .. 0FDA
(Other_Punctuation, Neutral,
Other, Other, Other, Glue,
(Grapheme_Base => True,
others => False)),
16#DB# .. 16#FF# => -- 0FDB .. 0FFF
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
others =>
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)));
end Matreshka.Internals.Unicode.Ucd.Core_000F;
|
with
AdaM.Declaration.of_package;
package AdaM.a_Package
renames AdaM.Declaration.of_package;
|
-- { dg-excess-errors "no code generated" }
package Varsize_Return2_Pkg is
type T (D: Positive) is record
Data: String (1 .. D);
end record;
function Len return Positive;
generic
I : Integer;
package G is
subtype Small_T is T(Len);
function Get return Small_T;
end G;
end Varsize_Return2_Pkg;
|
------------------------------------------------------------------------------
-- --
-- GNAT SYSTEM UTILITIES --
-- --
-- X S N A M E S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This utility is used to make a new version of the Snames package when new
-- names are added to the spec, the existing versions of snames.ads and
-- snames.adb and snames.h are read, and updated to match the set of names in
-- snames.ads. The updated versions are written to snames.ns, snames.nb (new
-- spec/body), and snames.nh (new header file).
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO;
with Ada.Strings.Maps; use Ada.Strings.Maps;
with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants;
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.Spitbol; use GNAT.Spitbol;
with GNAT.Spitbol.Patterns; use GNAT.Spitbol.Patterns;
procedure XSnames is
InB : File_Type;
InS : File_Type;
OutS : File_Type;
OutB : File_Type;
InH : File_Type;
OutH : File_Type;
A, B : VString := Nul;
Line : VString := Nul;
Name : VString := Nul;
Name1 : VString := Nul;
Oname : VString := Nul;
Oval : VString := Nul;
Restl : VString := Nul;
Tdigs : Pattern := Any (Decimal_Digit_Set) &
Any (Decimal_Digit_Set) &
Any (Decimal_Digit_Set);
Name_Ref : Pattern := Span (' ') * A & Break (' ') * Name
& Span (' ') * B
& ": constant Name_Id := N + " & Tdigs
& ';' & Rest * Restl;
Get_Name : Pattern := "Name_" & Rest * Name1;
Chk_Low : Pattern := Pos (0) & Any (Lower_Set) & Rest & Pos (1);
Findu : Pattern := Span ('u') * A;
Val : Natural;
Xlate_U_Und : Character_Mapping := To_Mapping ("u", "_");
M : Match_Result;
type Header_Symbol is (None, Attr, Conv, Prag);
-- A symbol in the header file
-- Prefixes used in the header file
Header_Attr : aliased String := "Attr";
Header_Conv : aliased String := "Convention";
Header_Prag : aliased String := "Pragma";
type String_Ptr is access all String;
Header_Prefix : constant array (Header_Symbol) of String_Ptr :=
(null,
Header_Attr'Access,
Header_Conv'Access,
Header_Prag'Access);
-- Patterns used in the spec file
Get_Attr : Pattern := Span (' ') & "Attribute_" & Break (",)") * Name1;
Get_Conv : Pattern := Span (' ') & "Convention_" & Break (",)") * Name1;
Get_Prag : Pattern := Span (' ') & "Pragma_" & Break (",)") * Name1;
type Header_Symbol_Counter is array (Header_Symbol) of Natural;
Header_Counter : Header_Symbol_Counter := (0, 0, 0, 0);
Header_Current_Symbol : Header_Symbol := None;
Header_Pending_Line : VString := Nul;
------------------------
-- Output_Header_Line --
------------------------
procedure Output_Header_Line (S : Header_Symbol) is
begin
-- Skip all the #define for S-prefixed symbols in the header.
-- Of course we are making implicit assumptions:
-- (1) No newline between symbols with the same prefix.
-- (2) Prefix order is the same as in snames.ads.
if Header_Current_Symbol /= S then
declare
Pat : String := "#define " & Header_Prefix (S).all;
In_Pat : Boolean := False;
begin
if Header_Current_Symbol /= None then
Put_Line (OutH, Header_Pending_Line);
end if;
loop
Line := Get_Line (InH);
if Match (Line, Pat) then
In_Pat := true;
elsif In_Pat then
Header_Pending_Line := Line;
exit;
else
Put_Line (OutH, Line);
end if;
end loop;
Header_Current_Symbol := S;
end;
end if;
-- Now output the line
Put_Line (OutH, "#define " & Header_Prefix (S).all
& "_" & Name1 & (30 - Length (Name1)) * ' '
& Header_Counter (S));
Header_Counter (S) := Header_Counter (S) + 1;
end Output_Header_Line;
-- Start of processing for XSnames
begin
Open (InB, In_File, "snames.adb");
Open (InS, In_File, "snames.ads");
Open (InH, In_File, "snames.h");
Create (OutS, Out_File, "snames.ns");
Create (OutB, Out_File, "snames.nb");
Create (OutH, Out_File, "snames.nh");
Anchored_Mode := True;
Oname := Nul;
Val := 0;
loop
Line := Get_Line (InB);
exit when Match (Line, " Preset_Names");
Put_Line (OutB, Line);
end loop;
Put_Line (OutB, Line);
LoopN : while not End_Of_File (InS) loop
Line := Get_Line (InS);
if not Match (Line, Name_Ref) then
Put_Line (OutS, Line);
if Match (Line, Get_Attr) then
Output_Header_Line (Attr);
elsif Match (Line, Get_Conv) then
Output_Header_Line (Conv);
elsif Match (Line, Get_Prag) then
Output_Header_Line (Prag);
end if;
else
Oval := Lpad (V (Val), 3, '0');
if Match (Name, "Last_") then
Oval := Lpad (V (Val - 1), 3, '0');
end if;
Put_Line
(OutS, A & Name & B & ": constant Name_Id := N + "
& Oval & ';' & Restl);
if Match (Name, Get_Name) then
Name := Name1;
Val := Val + 1;
if Match (Name, Findu, M) then
Replace (M, Translate (A, Xlate_U_Und));
Translate (Name, Lower_Case_Map);
elsif not Match (Name, "Op_", "") then
Translate (Name, Lower_Case_Map);
else
Name := 'O' & Translate (Name, Lower_Case_Map);
end if;
if Name = "error" then
Name := V ("<error>");
end if;
if not Match (Name, Chk_Low) then
Put_Line (OutB, " """ & Name & "#"" &");
end if;
end if;
end if;
end loop LoopN;
loop
Line := Get_Line (InB);
exit when Match (Line, " ""#"";");
end loop;
Put_Line (OutB, Line);
while not End_Of_File (InB) loop
Line := Get_Line (InB);
Put_Line (OutB, Line);
end loop;
Put_Line (OutH, Header_Pending_Line);
while not End_Of_File (InH) loop
Line := Get_Line (InH);
Put_Line (OutH, Line);
end loop;
end XSnames;
|
package CLI.Widgets is end;
-- I tried to make this a pure package, but it required me to also make the base
-- CLI package pure...
|
--
-- Copyright (C) 2016 secunet Security Networks AG
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
with HW.GFX.GMA.Registers;
package body HW.GFX.GMA.PLLs.DPLL_0 is
DPLL_CTRL1_DPLL0_LINK_RATE_MASK : constant := 7 * 2 ** 1;
DPLL_CTRL1_DPLL0_LINK_RATE_2700MHZ : constant := 0 * 2 ** 1;
DPLL_CTRL1_DPLL0_LINK_RATE_1350MHZ : constant := 1 * 2 ** 1;
DPLL_CTRL1_DPLL0_LINK_RATE_810MHZ : constant := 2 * 2 ** 1;
DPLL_CTRL1_DPLL0_LINK_RATE_1620MHZ : constant := 3 * 2 ** 1;
DPLL_CTRL1_DPLL0_LINK_RATE_1080MHZ : constant := 4 * 2 ** 1;
DPLL_CTRL1_DPLL0_LINK_RATE_2160MHZ : constant := 5 * 2 ** 1;
DPLL_CTRL1_DPLL0_OVERRIDE : constant := 1 * 2 ** 0;
procedure Check_Link_Rate
(Link_Rate : in DP_Bandwidth;
Success : out Boolean)
is
DPLL_Ctrl1 : Word32;
begin
Registers.Read (Registers.DPLL_CTRL1, DPLL_Ctrl1);
case DPLL_Ctrl1 and DPLL_CTRL1_DPLL0_LINK_RATE_MASK is
when DPLL_CTRL1_DPLL0_LINK_RATE_2700MHZ =>
Success := Link_Rate = DP_Bandwidth_5_4;
when DPLL_CTRL1_DPLL0_LINK_RATE_1350MHZ =>
Success := Link_Rate = DP_Bandwidth_2_7;
when DPLL_CTRL1_DPLL0_LINK_RATE_810MHZ =>
Success := Link_Rate = DP_Bandwidth_1_62;
when others =>
Success := False;
end case;
Success := Success and (DPLL_Ctrl1 and DPLL_CTRL1_DPLL0_OVERRIDE) /= 0;
end Check_Link_Rate;
end HW.GFX.GMA.PLLs.DPLL_0;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . S E C O N D A R Y _ S T A C K --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Version for use in HI-E mode
with System.Storage_Elements;
package System.Secondary_Stack
with SPARK_Mode => On is
package SSE renames System.Storage_Elements;
Default_Secondary_Stack_Size : constant := 10 * 1024;
-- Default size of a secondary stack
procedure SS_Init
(Stk : System.Address;
Size : Natural := Default_Secondary_Stack_Size);
-- Initialize the secondary stack with a main stack of the given Size.
--
-- Stk is an IN parameter that is already pointing to a memory area of
-- size Size and aligned to Standard'Maximum_Alignment.
--
-- The secondary stack is fixed, and any attempt to allocate more than the
-- initial size will result in a Storage_Error being raised.
procedure SS_Allocate
(Address : out System.Address;
Storage_Size : SSE.Storage_Count);
-- Allocate enough space for a 'Storage_Size' bytes object with Maximum
-- alignment. The address of the allocated space is returned in 'Address'
type Mark_Id is private;
-- Type used to mark the stack
function SS_Mark return Mark_Id;
-- Return the Mark corresponding to the current state of the stack
procedure SS_Release (M : Mark_Id);
-- Restore the state of the stack corresponding to the mark M. If an
-- additional chunk have been allocated, it will never be freed during a
private
pragma SPARK_Mode (Off);
SS_Pool : Integer;
-- Unused entity that is just present to ease the sharing of the pool
-- mechanism for specific allocation/deallocation in the compiler
type Mark_Id is new SSE.Integer_Address;
end System.Secondary_Stack;
|
with ARM_Output,
ARM_Contents,
Ada.Text_IO;
-- private
with Ada.Strings.Unbounded;
package ARM_HTML is
--
-- Ada reference manual formatter (ARM_Form).
--
-- This package defines the HTML output object.
-- Output objects are responsible for implementing the details of
-- a particular format.
--
-- ---------------------------------------
-- Copyright 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2011, 2012, 2013,
-- 2016
-- AXE Consultants. All rights reserved.
-- P.O. Box 1512, Madison WI 53701
-- E-Mail: randy@rrsoftware.com
--
-- ARM_Form is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License version 3
-- as published by the Free Software Foundation.
--
-- AXE CONSULTANTS MAKES THIS TOOL AND SOURCE CODE AVAILABLE ON AN "AS IS"
-- BASIS AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE ACCURACY,
-- CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR FUNCTIONING OF THIS TOOL.
-- IN NO EVENT WILL AXE CONSULTANTS BE LIABLE FOR ANY GENERAL,
-- CONSEQUENTIAL, INDIRECT, INCIDENTAL, EXEMPLARY, OR SPECIAL DAMAGES,
-- EVEN IF AXE CONSULTANTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-- DAMAGES.
--
-- A copy of the GNU General Public License is available in the file
-- gpl-3-0.txt in the standard distribution of the ARM_Form tool.
-- Otherwise, see <http://www.gnu.org/licenses/>.
--
-- If the GPLv3 license is not satisfactory for your needs, a commercial
-- use license is available for this tool. Contact Randy at AXE Consultants
-- for more information.
--
-- ---------------------------------------
--
-- Edit History:
--
-- 4/19/00 - RLB - Created base package.
-- 4/21/00 - RLB - Added line break and hard space routines.
-- 4/24/00 - RLB - Added DR references and Insert/Delete text formats.
-- 4/25/00 - RLB - Added size to format.
-- 5/10/00 - RLB - Added End_Hang_Item.
-- 5/12/00 - RLB - Added No_Prefix to Start_Paragraph.
-- 5/13/00 - RLB - Added Special_Character.
-- 5/17/00 - RLB - Added New_Page.
-- 5/22/00 - RLB - Added Includes_Changes to Create.
-- 5/23/00 - RLB - Added Set_Column and New_Column.
-- - Added Tab_Info and Tab_Stops.
-- 5/24/00 - RLB - Added Location to Text_Format.
-- - RLB - Added No_Breaks and Keep_with_Next to Start_Paragraph.
-- 5/25/00 - RLB - Added Big_Files to Create. Added Justification.
-- - RLB - Added Separator_Lines and TOC routines.
-- 5/26/00 - RLB - Added table operations.
-- 6/ 2/00 - RLB - Added Soft_Line_Break.
-- 8/ 2/00 - RLB - Added Soft_Hyphen_Break.
-- 8/ 7/00 - RLB - Added Leading flag to Start_Paragraph.
-- 8/17/00 - RLB - Replaced "Leading" by "Space_After".
-- 8/22/00 - RLB - Added Revised_Clause_Header.
-- 9/27/00 - RLB - Added tab emulation when in the fixed font.
-- - RLB - Added column emulation.
-- 9/29/00 - RLB - Added Any_Nonspace flag.
-- 7/18/01 - RLB - Added support for Big_Files.
-- 7/18/02 - RLB - Removed Document parameter from Create, replaced by
-- three strings and For_ISO boolean.
-- - RLB - Added AI_Reference.
-- - RLB - Added Change_Version_Type and uses.
-- 9/10/04 - RLB - Added "Both" to possible changes to handle
-- replacement of changed text.
-- 9/14/04 - RLB - Moved Change_Version_Type to ARM_Contents.
-- 5/27/05 - RLB - Added arbitrary Unicode characters.
-- 1/11/06 - RLB - Eliminated dispatching Create in favor of tailored
-- versions.
-- 1/12/06 - RLB - Added a number of parameters to Create.
-- 1/13/06 - RLB - Added new Link operations.
-- 1/16/06 - RLB - Added Index_URL to Create.
-- 1/27/06 - RLB - Added Tab_Emulation.
-- 2/ 8/06 - RLB - Added additional parameters to the table command.
-- 2/10/06 - RLB - Added even more additional parameters to the
-- table command.
-- - RLB - Added picture command.
-- 2/19/06 - RLB - Added Number_Paragraphs flag and large letter count.
-- 9/21/06 - RLB - Added Body_Font.
-- 9/25/06 - RLB - Added Last_Column_Width to Start_Table.
-- 10/13/06 - RLB - Added specifiable colors.
-- - RLB - Added Local_Link_Start and Local_Link_End to allow
-- formatting in the linked text.
-- 2/ 9/07 - RLB - Changed comments on AI_Reference.
-- 2/13/07 - RLB - Revised to separate style and indent information
-- for paragraphs.
-- 12/19/07 - RLB - Added DOS_Filename flag.
-- - RLB - Added limited colors to Text_Format.
-- 10/18/11 - RLB - Changed to GPLv3 license.
-- 10/25/11 - RLB - Added old insertion version to Revised_Clause_Header.
-- 8/31/12 - RLB - Added Output_Path.
-- 11/26/12 - RLB - Added subdivision names to Clause_Header and
-- Revised_Clause_Header.
-- 3/26/13 - RLB - Added HTML_Script to allow adding Google Analytics
-- code as needed.
-- 4/20/16 - RLB - Added Force_New_Revision_Colors.
-- 8/18/16 - RLB - Added a more column text to avoid overflow.
type HTML_Output_Type is new ARM_Output.Output_Type with private;
type HTML_Type is (HTML_3, -- Use only HTML 3 elements.
HTML_4_Compatible, -- Use HTML 4 when needed, but try to look good on old browsers.
HTML_4_Only); -- Use only HTML 4 elements (no attempt to look good on old browsers).
type Tab_Emulation_Type is
(Single_Space, -- Replace all tabs by a single space.
Quad_Space, -- Replace all tabs by four hard spaces.
Emulate_Fixed_Only, -- Emulate tabs in fixed font styles;
-- replace others by a single space.
Emulate_Fixed_Only_Quad,--Emulate tabs in fixed font styles;
-- replace others by four hard spaces.
Emulate_All); -- Replace tabs in all styles; note that
-- it is unlikely that they will line
-- up perfectly for non-fixed fonts.
subtype Color_String is String (1..7); -- "#hhhhhh" to specify a color.
procedure Create (Output_Object : in out HTML_Output_Type;
Big_Files : in Boolean;
File_Prefix : in String;
Output_Path : in String;
DOS_Filenames : in Boolean;
HTML_Kind : in HTML_Type;
Use_Unicode : in Boolean;
Number_Paragraphs : in Boolean;
Ref_URL : in String;
Srch_URL : in String;
Index_URL : in String;
Use_Buttons : Boolean;
Nav_On_Top : Boolean;
Nav_On_Bottom : Boolean;
Tab_Emulation : Tab_Emulation_Type;
Script_HTML : String;
Header_HTML : String;
Footer_HTML : String;
Title : in String := "";
Body_Font : ARM_Output.Font_Family_Type;
Force_New_Revision_Colors : Boolean;
Text_Color : Color_String;
Background_Color : Color_String;
Link_Color : Color_String;
VLink_Color : Color_String;
ALink_Color : Color_String);
-- Create an Output_Object for a document.
-- Generate a few large output files if
-- Big_Files is True; otherwise generate smaller output files.
-- The prefix of the output file names is File_Prefix - this
-- should be no more than 5 characters allowed in file names.
-- The files will be written into Output_Path.
-- If DOS_Filename is true, use 8.3 file names;
-- in that case, File_Prefix must be less than 4 characters in length;
-- and no clause or subclause number may exceed 35 if Big_Files is False.
-- The title of the document is Title.
-- HTML_Kind determines the kind of HTML generated; HTML_3 works on
-- every browser but has little control over formatting;
-- HTML_4_Compatible has better control, but tries to make the results
-- look good on older browsers; HTML_4_Only uses maximum formatting,
-- but makes no attempt to look good on browsers older than IE 5.0 and
-- Firefox 1.0.
-- If Use_Unicode is true, Unicode characters available on US versions
-- of Windows 2000 are used when appropriate; otherwise, Unicode
-- characters are only used when explicitly requested with
-- Unicode_Character (other characters are replaced with reasonable
-- equivalents). [Note: It's known that IE on Windows 95/98/ME cannot
-- display Unicode characters.] Use_Unicode has no effect if HTML_Kind
-- is set to HTML_3.
-- Number_Paragraphs means that paragraph numbers will be used;
-- otherwise, the Number parameter to Start_Paragraph must be "".
-- Ref_URL, Srch_URL, and Index_URL are the URLs (possibly relative)
-- for the "References", "Search", and "Index" buttons/labels,
-- respectively. If null, these buttons/labels link to sections named
-- "References", "Search", and "Index"; if these do not exist, the
-- buttons/labels are omitted.
-- If Use_Buttons is true, button images are used, otherwise text labels
-- are used for the navigation bar.
-- If Nav_On_Top is true, the navigation bar will appear in the header
-- of each page. If Nav_On_Bottom is true, the navigation bar will
-- appear in the footer of each page.
-- Tab_Emulation determines how tabs are emulated.
-- Script_HTML gives self-contained HTML that will appear immediately
-- before the </HEAD> of every page. This usually will contain
-- Javascript scripts or CSS styles. The original intent was to allow
-- adding the Google Analytics script to each page.
-- Header_HTML gives self-contained HTML that will appear before the
-- navigation bar in the header. Footer_HTML gives self-contained HTML
-- that will appear after the navigation bar in the footer.
-- Body_Font selects the default font for the document body.
-- Text_Color specifies the default text color; Background_Color
-- specifies the default background color; Link_Color specifies the
-- default color of normal links; VLink_Color specifies the
-- default color of visited links; and ALink_Color specifies the
-- default color of active (in the act of clinking) links.
procedure Close (Output_Object : in out HTML_Output_Type);
-- Close an Output_Object. No further output to the object is
-- allowed after this call.
procedure Section (Output_Object : in out HTML_Output_Type;
Section_Title : in String;
Section_Name : in String);
-- Start a new section. The title is Section_Title (this is
-- intended for humans). The name is Section_Name (this is
-- intended to be suitable to be a portion of a file name).
procedure Set_Columns (Output_Object : in out HTML_Output_Type;
Number_of_Columns : in ARM_Output.Column_Count);
-- Set the number of columns.
-- Raises Not_Valid_Error if in a paragraph.
procedure Start_Paragraph (Output_Object : in out HTML_Output_Type;
Style : in ARM_Output.Paragraph_Style_Type;
Indent : in ARM_Output.Paragraph_Indent_Type;
Number : in String;
No_Prefix : in Boolean := False;
Tab_Stops : in ARM_Output.Tab_Info := ARM_Output.NO_TABS;
No_Breaks : in Boolean := False;
Keep_with_Next : in Boolean := False;
Space_After : in ARM_Output.Space_After_Type
:= ARM_Output.Normal;
Justification : in ARM_Output.Justification_Type
:= ARM_Output.Default);
-- Start a new paragraph. The style and indent of the paragraph is as
-- specified. The (AA)RM paragraph number (which might include update
-- and version numbers as well: [12.1/1]) is Number. If the format is
-- a type with a prefix (bullets, hangining items), the prefix is
-- omitted if No_Prefix is true. Tab_Stops defines the tab stops for
-- the paragraph. If No_Breaks is True, we will try to avoid page breaks
-- in the paragraph. If Keep_with_Next is true, we will try to avoid
-- separating this paragraph and the next one. (These may have no
-- effect in formats that don't have page breaks). Space_After
-- specifies the amount of space following the paragraph. Justification
-- specifies the text justification for the paragraph. Not_Valid_Error
-- is raised if Tab_Stops /= NO_TABS for a hanging or bulleted format.
procedure End_Paragraph (Output_Object : in out HTML_Output_Type);
-- End a paragraph.
procedure Category_Header (Output_Object : in out HTML_Output_Type;
Header_Text : String);
-- Output a Category header (that is, "Legality Rules",
-- "Dynamic Semantics", etc.)
-- (Note: We did not use a enumeration here to insure that these
-- headers are spelled the same in all output versions).
-- Raises Not_Valid_Error if in a paragraph.
procedure Clause_Header (Output_Object : in out HTML_Output_Type;
Header_Text : in String;
Level : in ARM_Contents.Level_Type;
Clause_Number : in String;
Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind;
No_Page_Break : in Boolean := False);
-- Output a Clause header. The level of the header is specified
-- in Level. The Clause Number is as specified; the top-level (and
-- other) subdivision names are as specified. These should appear in
-- the table of contents.
-- For hyperlinked formats, this should generate a link target.
-- If No_Page_Break is True, suppress any page breaks.
-- Raises Not_Valid_Error if in a paragraph.
procedure Revised_Clause_Header
(Output_Object : in out HTML_Output_Type;
New_Header_Text : in String;
Old_Header_Text : in String;
Level : in ARM_Contents.Level_Type;
Clause_Number : in String;
Version : in ARM_Contents.Change_Version_Type;
Old_Version : in ARM_Contents.Change_Version_Type;
Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind;
No_Page_Break : in Boolean := False);
-- Output a revised clause header. Both the original and new text will
-- be output. The level of the header is specified in Level. The Clause
-- Number is as specified; the top-level (and other) subdivision names
-- are as specified. These should appear in the table of contents.
-- For hyperlinked formats, this should generate a link target.
-- Version is the insertion version of the new text; Old_Version is
-- the insertion version of the old text.
-- If No_Page_Break is True, suppress any page breaks.
-- Raises Not_Valid_Error if in a paragraph.
procedure TOC_Marker (Output_Object : in out HTML_Output_Type;
For_Start : in Boolean);
-- Mark the start (if For_Start is True) or end (if For_Start is
-- False) of the table of contents data. Output objects that
-- auto-generate the table of contents can use this to do needed
-- actions.
procedure New_Page (Output_Object : in out HTML_Output_Type;
Kind : ARM_Output.Page_Kind_Type := ARM_Output.Any_Page);
-- Output a page break.
-- Note that this has no effect on non-printing formats.
-- Any_Page breaks to the top of the next page (whatever it is);
-- Odd_Page_Only breaks to the top of the odd-numbered page;
-- Soft_Page allows a page break but does not force one (use in
-- "No_Breaks" paragraphs.)
-- Raises Not_Valid_Error if in a paragraph if Kind = Any_Page or
-- Odd_Page, and if not in a paragraph if Kind = Soft_Page.
procedure New_Column (Output_Object : in out HTML_Output_Type);
-- Output a column break.
-- Raises Not_Valid_Error if in a paragraph, or if the number of
-- columns is 1.
procedure Separator_Line (Output_Object : in out HTML_Output_Type;
Is_Thin : Boolean := True);
-- Output a separator line. It is thin if "Is_Thin" is true.
-- Raises Not_Valid_Error if in a paragraph.
procedure Start_Table (Output_Object : in out HTML_Output_Type;
Columns : in ARM_Output.Column_Count;
First_Column_Width : in ARM_Output.Column_Count;
Last_Column_Width : in ARM_Output.Column_Count;
Alignment : in ARM_Output.Column_Text_Alignment;
No_Page_Break : in Boolean;
Has_Border : in Boolean;
Small_Text_Size : in Boolean;
Header_Kind : in ARM_Output.Header_Kind_Type);
-- Starts a table. The number of columns is Columns; the first
-- column has First_Column_Width times the normal column width, and
-- the last column has Last_Column_Width times the normal column width.
-- Alignment is the horizontal text alignment within the columns.
-- No_Page_Break should be True to keep the table intact on a single
-- page; False to allow it to be split across pages.
-- Has_Border should be true if a border is desired, false otherwise.
-- Small_Text_Size means that the contents will have the AARM size;
-- otherwise it will have the normal size.
-- Header_Kind determines whether the table has headers.
-- This command starts a paragraph; the entire table is a single
-- paragraph. Text will be considered part of the caption until the
-- next table marker call.
-- Raises Not_Valid_Error if in a paragraph.
procedure Table_Marker (Output_Object : in out HTML_Output_Type;
Marker : in ARM_Output.Table_Marker_Type);
-- Marks the end of an entity in a table.
-- If Marker is End_Caption, the table caption ends and the
-- future text is part of the table header.
-- If Marker is End_Header, the table header ends and the
-- future text is part of the table body.
-- If Marker is End_Row, a row in the table is completed, and another
-- row started.
-- If Marker is End_Item, an item in the table header or body is ended,
-- and another started.
-- If Marker is End_Table, the entire table is finished.
-- Raises Not_Valid_Error if not in a table.
-- Text output: These are only allowed after a Start_Paragraph and
-- before any End_Paragraph. Raises Not_Valid_Error if not in a paragraph,
-- or another error.
procedure Ordinary_Text (Output_Object : in out HTML_Output_Type;
Text : in String);
-- Output ordinary text.
-- The text must end at a word break, never in the middle of a word.
procedure Ordinary_Character (Output_Object : in out HTML_Output_Type;
Char : in Character);
-- Output an ordinary character.
-- Spaces will be used to break lines as needed.
procedure Hard_Space (Output_Object : in out HTML_Output_Type);
-- Output a hard space. No line break should happen at a hard space.
procedure Line_Break (Output_Object : in out HTML_Output_Type);
-- Output a line break. This does not start a new paragraph.
-- This corresponds to a "<BR>" in HTML.
procedure Index_Line_Break (Output_Object : in out HTML_Output_Type;
Clear_Keep_with_Next : in Boolean);
-- Output a line break for the index. This does not start a new
-- paragraph in terms of spacing. This corresponds to a "<BR>"
-- in HTML. If Clear_Keep_with_Next is true, insure that the next
-- line does not require the following line to stay with it.
-- Raises Not_Valid_Error if the paragraph is not in the index format.
procedure Soft_Line_Break (Output_Object : in out HTML_Output_Type);
-- Output a soft line break. This is a place (in the middle of a
-- "word") that we allow a line break. It is usually used after
-- underscores in long non-terminals.
procedure Soft_Hyphen_Break (Output_Object : in out HTML_Output_Type);
-- Output a soft line break, with a hyphen. This is a place (in the middle of
-- a "word") that we allow a line break. If the line break is used,
-- a hyphen will be added to the text.
procedure Tab (Output_Object : in out HTML_Output_Type);
-- Output a tab, inserting space up to the next tab stop.
-- Raises Not_Valid_Error if the paragraph was created with
-- Tab_Stops = ARM_Output.NO_TABS.
procedure Special_Character (Output_Object : in out HTML_Output_Type;
Char : in ARM_Output.Special_Character_Type);
-- Output an special character.
procedure Unicode_Character (Output_Object : in out HTML_Output_Type;
Char : in ARM_Output.Unicode_Type);
-- Output a Unicode character, with code position Char.
procedure End_Hang_Item (Output_Object : in out HTML_Output_Type);
-- Marks the end of a hanging item. Call only once per paragraph.
-- Raises Not_Valid_Error if the paragraph style is not in
-- Text_Prefixed_Style_Subtype, or if this has already been
-- called for the current paragraph, or if the paragraph was started
-- with No_Prefix = True.
procedure Text_Format (Output_Object : in out HTML_Output_Type;
Format : in ARM_Output.Format_Type);
-- Change the text format so that all of the properties are as specified.
-- Note: Changes to these properties ought be stack-like; that is,
-- Bold on, Italic on, Italic off, Bold off is OK; Bold on, Italic on,
-- Bold off, Italic off should be avoided (as separate commands).
procedure Clause_Reference (Output_Object : in out HTML_Output_Type;
Text : in String;
Clause_Number : in String);
-- Generate a reference to a clause in the standard. The text of
-- the reference is "text", and the number of the clause is
-- Clause_Number. For hyperlinked formats, this should generate
-- a link; for other formats, the text alone is generated.
procedure Index_Target (Output_Object : in out HTML_Output_Type;
Index_Key : in Natural);
-- Generate a index target. This marks the location where an index
-- reference occurs. Index_Key names the index item involved.
-- For hyperlinked formats, this should generate a link target;
-- for other formats, nothing is generated.
procedure Index_Reference (Output_Object : in out HTML_Output_Type;
Text : in String;
Index_Key : in Natural;
Clause_Number : in String);
-- Generate a reference to an index target in the standard. The text
-- of the reference is "Text", and Index_Key and Clause_Number denotes
-- the target. For hyperlinked formats, this should generate
-- a link; for other formats, the text alone is generated.
procedure DR_Reference (Output_Object : in out HTML_Output_Type;
Text : in String;
DR_Number : in String);
-- Generate a reference to an DR from the standard. The text
-- of the reference is "Text", and DR_Number denotes
-- the target. For hyperlinked formats, this should generate
-- a link; for other formats, the text alone is generated.
procedure AI_Reference (Output_Object : in out HTML_Output_Type;
Text : in String;
AI_Number : in String);
-- Generate a reference to an AI from the standard. The text
-- of the reference is "Text", and AI_Number denotes
-- the target (in folded format). For hyperlinked formats, this should
-- generate a link; for other formats, the text alone is generated.
procedure Local_Target (Output_Object : in out HTML_Output_Type;
Text : in String;
Target : in String);
-- Generate a local target. This marks the potential target of local
-- links identified by "Target". Text is the text of the target.
-- For hyperlinked formats, this should generate a link target;
-- for other formats, only the text is generated.
procedure Local_Link (Output_Object : in out HTML_Output_Type;
Text : in String;
Target : in String;
Clause_Number : in String);
-- Generate a local link to the target and clause given.
-- Text is the text of the link.
-- For hyperlinked formats, this should generate a link;
-- for other formats, only the text is generated.
procedure Local_Link_Start (Output_Object : in out HTML_Output_Type;
Target : in String;
Clause_Number : in String);
-- Generate a local link to the target and clause given.
-- The link will surround text until Local_Link_End is called.
-- Local_Link_End must be called before this routine can be used again.
-- For hyperlinked formats, this should generate a link;
-- for other formats, only the text is generated.
procedure Local_Link_End (Output_Object : in out HTML_Output_Type;
Target : in String;
Clause_Number : in String);
-- End a local link for the target and clause given.
-- This must be in the same paragraph as the Local_Link_Start.
-- For hyperlinked formats, this should generate a link;
-- for other formats, only the text is generated.
procedure URL_Link (Output_Object : in out HTML_Output_Type;
Text : in String;
URL : in String);
-- Generate a link to the URL given.
-- Text is the text of the link.
-- For hyperlinked formats, this should generate a link;
-- for other formats, only the text is generated.
procedure Picture (Output_Object : in out HTML_Output_Type;
Name : in String;
Descr : in String;
Alignment : in ARM_Output.Picture_Alignment;
Height, Width : in Natural;
Border : in ARM_Output.Border_Kind);
-- Generate a picture.
-- Name is the (simple) file name of the picture; Descr is a
-- descriptive name for the picture (it will appear in some web
-- browsers).
-- We assume that it is a .PNG or .JPG and that it will be present
-- in the same directory as the output files.
-- Alignment specifies the picture alignment.
-- Height and Width specify the picture size in pixels.
-- Border specifies the kind of border.
private
type Column_Text_Item_Type;
type Column_Text_Ptr is access Column_Text_Item_Type;
type Column_Text_Item_Type is record
Text : String (1..240);
Length : Natural;
Item : Natural; -- Which item.
End_Para : Boolean; -- True if this item is an end paragraph.
Next : Column_Text_Ptr;
end record;
type Column_Text_Ptrs_Type is array (1..5) of Column_Text_Ptr;
subtype Prefix_String is String(1..5);
type HTML_Output_Type is new ARM_Output.Output_Type with record
Is_Valid : Boolean := False;
-- Global properties:
File_Prefix : Prefix_String; -- Blank padded.
Output_Path : Ada.Strings.Unbounded.Unbounded_String;
Big_Files : Boolean; -- For HTML, this means to generate a single monster file.
DOS_Filenames : Boolean; -- Generate 8.3 MS-DOS filenames.
Title : Ada.Strings.Unbounded.Unbounded_String;
HTML_Kind : HTML_Type;
Use_Unicode : Boolean;
Number_Paragraphs : Boolean;
Ref_URL : Ada.Strings.Unbounded.Unbounded_String;
Srch_URL : Ada.Strings.Unbounded.Unbounded_String;
Index_URL : Ada.Strings.Unbounded.Unbounded_String;
Use_Buttons : Boolean := True;
Nav_On_Top : Boolean := True;
Nav_On_Bottom : Boolean := True;
Tab_Emulation : Tab_Emulation_Type;
Script_HTML : Ada.Strings.Unbounded.Unbounded_String;
Header_HTML : Ada.Strings.Unbounded.Unbounded_String;
Footer_HTML : Ada.Strings.Unbounded.Unbounded_String;
Body_Font : ARM_Output.Font_Family_Type := ARM_Output.Roman;
Force_New_Revision_Colors : Boolean;
Text_Color : Color_String;
Background_Color : Color_String;
Link_Color : Color_String;
VLink_Color : Color_String;
ALink_Color : Color_String;
-- Current formatting properties:
Is_In_Paragraph : Boolean := False;
Paragraph_Style : ARM_Output.Paragraph_Style_Type;
Paragraph_Indent : ARM_Output.Paragraph_Indent_Type;
Had_Prefix : Boolean := False; -- If in paragraph, value of not No_Prefix.
Column_Count : ARM_Output.Column_Count := 1;
Output_File : Ada.Text_IO.File_Type;
Section_Name : String(1..3);
Char_Count : Natural := 0; -- Characters on current line.
Disp_Char_Count : Natural := 0; -- Displayed characters on current line.
Disp_Large_Char_Count : Natural := 0; -- Displayed large characters on current line (others are "small" characters).
-- Large characters are capitals, 'm', 'w', and numbers.
Any_Nonspace : Boolean := False; -- Have we output any non-space on this line?
Last_was_Space : Boolean := False; -- True if the last visible character
-- output was a space (any kind), or this is the
-- start of a line.
Conditional_Space : Boolean := False; -- If True, output a space if the
-- next *visible* character is not a space or
-- punctuation.
Saw_Hang_End : Boolean := False; -- If we are in a hanging paragraph,
-- have we seen the end of the hanging part yet?
Is_Bold : Boolean; -- Is the text currently bold?
Is_Italic : Boolean; -- Is the text current italics?
Font : ARM_Output.Font_Family_Type; -- What is the current font family?
Size : ARM_Output.Size_Type; -- What is the current relative size?
Color : ARM_Output.Color_Type := ARM_Output.Default;
Change : ARM_Output.Change_Type := ARM_Output.None;
Version : ARM_Contents.Change_Version_Type := '0';
Added_Version : ARM_Contents.Change_Version_Type := '0';
Location : ARM_Output.Location_Type := ARM_Output.Normal;
Tab_Stops : ARM_Output.Tab_Info := ARM_Output.NO_TABS;
Can_Emulate_Tabs : Boolean := False; -- Can we emulate tabs in the current style?
Is_In_Table : Boolean := False; -- Are we processing a table?
In_Header : Boolean := False; -- If Is_In_Table, are we processing the header?
Table_Column_Alignment : ARM_Output.Column_Text_Alignment; -- If Is_In_Table, specifies the column alignment.
Table_Has_Small_Text : Boolean := False; -- If Is_In_Table, specifies the text size.
Current_Column : Natural := 0; -- When processing 4-column+ text, the current column number.
Current_Item : Natural := 0; -- When processing 4-column+ text, the current item within the column.
Column_Text : Column_Text_Ptrs_Type := (others => null);
-- If we are processing 4-column+ text, the text for the columns.
In_Local_Link : Boolean := False;
Current_Clause : Ada.Strings.Unbounded.Unbounded_String;
-- The name of the clause of the currently open file (for
-- Big_Files = False); used to generate the navigation bar.
end record;
end ARM_HTML;
|
package Words is
type String_Ptr is access String;
type List is array (Positive range <>) of String_Ptr;
function Score(S: String) return Natural;
function Split(S: String; On: Character := ',') return List;
procedure Free(L: in out List);
end Words;
|
with Ada.Numerics.Discrete_Random, Ada.Assertions;
with Libtcod.Maps.BSP, Libtcod.Color;
package body Engines is
use Ada.Assertions;
use type Maps.X_Pos, Maps.Y_Pos;
Max_Monsters_Per_Room : constant := 3;
Max_Room_Size : constant := 12;
Min_Room_Size : constant := 6;
function get_actor(self : in out Engine; id : Actor_Id) return Actor_Ref is
(self.actor_list.Reference(id));
function player(self : in out Engine) return Actor_Ref is (self.get_actor(self.player_id));
type Random_Int is new Natural;
package Natural_Random is new Ada.Numerics.Discrete_Random(Random_Int);
use Natural_Random;
rand_nat_gen : Natural_Random.Generator;
function one_of_n_chance(n : Random_Int) return Boolean is
(Random(rand_nat_gen) mod n = 0);
function k_of_n_chance(k, n : Random_Int) return Boolean is
(Random(rand_nat_gen) mod n < k);
generic
type A is range <>;
type B is range <>;
function generic_rand_range(start_n : A; end_n : B) return Random_Int;
function generic_rand_range(start_n : A; end_n : B) return Random_Int is
(Random(rand_nat_gen) mod (Random_Int(end_n) - Random_Int(start_n)) + Random_Int(start_n));
function rand_range is new generic_rand_range(Random_Int, Random_Int);
function rand_range is new generic_rand_range(Maps.X_Pos, Maps.X_Pos);
function rand_range is new generic_rand_range(Maps.X_Pos, Width);
function rand_range is new generic_rand_range(Maps.Y_Pos, Maps.Y_Pos);
function rand_range is new generic_rand_range(Maps.Y_Pos, Height);
--------------
-- can_walk --
--------------
function can_walk(self : Engine; x : Maps.X_Pos; y : Maps.Y_Pos) return Boolean is
begin
if self.map.is_wall(x, y) then
return False;
end if;
for a of self.actor_list loop
if a.x = x and then a.y = y and then a.blocks then
-- Actor is present, cannot walk here
return False;
end if;
end loop;
return True;
end can_walk;
-----------------
-- add_monster --
-----------------
procedure add_monster(self : in out Engine; x : Maps.X_Pos; y : Maps.Y_Pos) is
begin
if k_of_n_chance(k => 80, n => 100) then
self.actor_list.Append(Actors.make_orc(x, y));
else
self.actor_list.Append(Actors.make_troll(x, y));
end if;
end add_monster;
-----------------
-- create_room --
-----------------
procedure create_room(self : in out Engine; first : Boolean;
x1 : Maps.X_Pos; y1 : Maps.Y_Pos;
x2 : Maps.X_Pos; y2 : Maps.Y_Pos) is
monster_count : Random_Int := rand_range(Random_Int'(0), Max_Monsters_Per_Room);
monster_x : Maps.X_Pos;
monster_y : Maps.Y_Pos;
begin
self.map.dig(x1, y1, x2, y2);
if first then
self.player.x := (x1+x2) / 2;
self.player.y := (y1+y2) / 2;
elsif one_of_n_chance(n => 4) then
for i in 1 .. monster_count loop
monster_x := Maps.X_Pos(rand_range(x1, x2));
monster_y := Maps.Y_Pos(rand_range(y1, y2));
if self.can_walk(monster_x, monster_y) then
self.add_monster(monster_x, monster_y);
end if;
end loop;
end if;
end create_room;
---------------
-- setup_map --
---------------
procedure setup_map(self : in out Engine) is
use Maps, Maps.BSP;
bsp_builder : BSP_Tree := make_BSP(0, 0, Width(self.map.width), Height(self.map.height));
room_num : Natural := 0;
last_x : Maps.X_Pos;
last_y : Maps.Y_Pos;
function visit(node : in out BSP_Node) return Boolean is
x : Maps.X_Pos;
y : Maps.Y_Pos;
w : Width;
h : Height;
begin
if node.is_leaf then
w := Width(rand_range(Min_Room_Size, node.w-2));
h := Height(rand_range(Min_Room_Size, node.h-2));
x := X_Pos(rand_range(node.x+X_Pos'(1), Width(node.x)+node.w-w-1));
y := Y_Pos(rand_range(node.y+Y_Pos'(1), Height(node.y)+node.h-h-1));
self.create_room(room_num = 0, x, y, x+X_Pos(w)-1, y+Y_Pos(h)-1);
if room_num /= 0 then
self.map.dig(last_x, last_y, x+X_Pos(w)/2, last_y);
self.map.dig(x+X_Pos(w)/2, last_y, x+X_Pos(w)/2, y+Y_Pos(h)/2);
end if;
last_x := x+X_Pos(w)/2;
last_y := y+Y_Pos(h)/2;
room_num := room_num + 1;
end if;
return True;
end visit;
not_exited_early : Boolean;
begin
bsp_builder.split_recursive(recursion_level => 8,
min_w => Max_Room_Size, min_h => Max_Room_Size,
min_wh_ratio => 1.5, min_hw_ratio => 1.5);
not_exited_early := bsp_builder.traverse_inverted_level_order(visit'Access);
Assert(not_exited_early);
-- Calcluate player's initial FOV
self.map.compute_fov(self.player.x, self.player.y, self.fov_radius);
end setup_map;
-----------------
-- make_engine --
-----------------
function make_engine(w : Libtcod.Width; h : Libtcod.Height) return Engine is
begin
return self : Engine := (width => Maps.X_Pos(w), height => Maps.Y_Pos(h),
map => make_game_map(w, h-GUIs.Panel_Height),
player_id => Actor_Id'First,
status => Status_Idle,
fov_radius => 10,
gui => GUIs.make_GUI(w),
others => <>) do
self.actor_list.Append(make_player(60, 13, "Player",
defense_stat => 2, power => 5,
hp => 30, max_hp => 30));
self.gui.log("Welcome stranger!" & ASCII.LF
& "Prepare to perish in the Tombs of the" & ASCII.LF
& "Ancient Kings", Libtcod.Color.red);
setup_map(self);
end return;
end make_engine;
------------
-- update --
------------
procedure update(self : in out Engine) is
use Input;
use type Input.Event_Type;
k : aliased Key;
event_kind : Event_Type := Input.check_for_event(Event_Key_Press, k);
last_key_type : Key_Type;
begin
if event_kind /= Event_Key_Press then
return;
end if;
last_key_type := get_key_type(k);
if last_key_type not in Valid_Key_Type then
return;
end if;
self.last_key_type := last_key_type;
self.status := Status_Idle;
for each of self.actor_list loop
each.update(self);
end loop;
end update;
------------
-- render --
------------
procedure render(self : in out Engine; screen : in out Console.Screen) is
begin
screen.clear;
self.map.render(screen);
for each of reverse self.actor_list loop
if self.map.in_fov(each.x, each.y) then
each.render(screen);
end if;
end loop;
self.gui.render(screen, self);
end render;
end Engines;
|
with Ada.Text_IO;
with ship;
with Planet;
with Player;
with Rule;
procedure main is
my_ship: ship.Ship_Data := ship.is_StarShip;
my_homeworld : Planet.Object := Planet.Build ("Earth", 1, 3, 1);
your_homeworld : Planet.Object := Planet.Build ("Moon", 1, 3, 1);
player1 : Player.Object := Player.Build ("human",
Rule.starship_power,
Rule.hard_build,
Rule.military,
my_homeworld);
begin
Ada.Text_IO.Put_Line ("my ship: " & ship.show_me_ship_type (my_ship));
Ada.Text_IO.Put_Line ("my ship before build: " & Integer'Image (ship.show_me_ship_data (my_ship, ship.build)));
ship.modify_ship_data (my_ship, ship.build, 1);
Ada.Text_IO.Put_Line ("my ship after build: " & Integer'Image (ship.show_me_ship_data (my_ship, ship.build)));
Ada.Text_IO.Put_Line (my_homeworld.show);
Ada.Text_IO.Put_Line (your_homeworld.show);
end main;
|
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Discr8_Pkg2; use Discr8_Pkg2;
package Discr8_Pkg1 is
type T is record
A : Unbounded_String;
B : L;
end record;
end Discr8_Pkg1;
|
with Ada.Unchecked_Conversion;
package Tkmrpc.Response.Ike.Isa_Sign.Convert is
function To_Response is new Ada.Unchecked_Conversion (
Source => Isa_Sign.Response_Type,
Target => Response.Data_Type);
function From_Response is new Ada.Unchecked_Conversion (
Source => Response.Data_Type,
Target => Isa_Sign.Response_Type);
end Tkmrpc.Response.Ike.Isa_Sign.Convert;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- O U T P U T --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with GNAT.OS_Lib; use GNAT.OS_Lib;
package body Output is
Current_FD : File_Descriptor := Standout;
-- File descriptor for current output
-----------------------
-- Local_Subprograms --
-----------------------
procedure Flush_Buffer;
-- Flush buffer if non-empty and reset column counter
------------------
-- Flush_Buffer --
------------------
procedure Flush_Buffer is
Len : constant Natural := Natural (Column - 1);
begin
if Len /= 0 then
if Len /= Write (Current_FD, Buffer'Address, Len) then
Set_Standard_Error;
Write_Line ("fatal error: disk full");
OS_Exit (2);
end if;
Column := 1;
end if;
end Flush_Buffer;
------------------------
-- Set_Standard_Error --
------------------------
procedure Set_Standard_Error is
begin
Flush_Buffer;
Current_FD := Standerr;
Column := 1;
end Set_Standard_Error;
-------------------------
-- Set_Standard_Output --
-------------------------
procedure Set_Standard_Output is
begin
Flush_Buffer;
Current_FD := Standout;
Column := 1;
end Set_Standard_Output;
-------
-- w --
-------
procedure w (C : Character) is
begin
Write_Char (''');
Write_Char (C);
Write_Char (''');
Write_Eol;
end w;
procedure w (S : String) is
begin
Write_Str (S);
Write_Eol;
end w;
procedure w (V : Int) is
begin
Write_Int (V);
Write_Eol;
end w;
procedure w (B : Boolean) is
begin
if B then
w ("True");
else
w ("False");
end if;
end w;
procedure w (L : String; C : Character) is
begin
Write_Str (L);
Write_Char (' ');
w (C);
end w;
procedure w (L : String; S : String) is
begin
Write_Str (L);
Write_Char (' ');
w (S);
end w;
procedure w (L : String; V : Int) is
begin
Write_Str (L);
Write_Char (' ');
w (V);
end w;
procedure w (L : String; B : Boolean) is
begin
Write_Str (L);
Write_Char (' ');
w (B);
end w;
----------------
-- Write_Char --
----------------
procedure Write_Char (C : Character) is
begin
if Column < Buffer'Length then
Buffer (Natural (Column)) := C;
Column := Column + 1;
end if;
end Write_Char;
---------------
-- Write_Eol --
---------------
procedure Write_Eol is
begin
Buffer (Natural (Column)) := ASCII.LF;
Column := Column + 1;
Flush_Buffer;
end Write_Eol;
---------------
-- Write_Int --
---------------
procedure Write_Int (Val : Int) is
begin
if Val < 0 then
Write_Char ('-');
Write_Int (-Val);
else
if Val > 9 then
Write_Int (Val / 10);
end if;
Write_Char (Character'Val ((Val mod 10) + Character'Pos ('0')));
end if;
end Write_Int;
----------------
-- Write_Line --
----------------
procedure Write_Line (S : String) is
begin
Write_Str (S);
Write_Eol;
end Write_Line;
---------------
-- Write_Str --
---------------
procedure Write_Str (S : String) is
begin
for J in S'Range loop
Write_Char (S (J));
end loop;
end Write_Str;
end Output;
|
with Solar_System; use Solar_System;
package My_Solar_System is
-- declare variable Bodies which is an array of Body_Type
Bodies : aliased Bodies_Array_T;
end My_Solar_System;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with HAL; use HAL;
package nRF51.Radio is
procedure Setup_For_Bluetooth_Low_Energy;
-- Configure the radio for Bluetooth Low Energy (BLE) operations
-- This procedure doesn't set:
-- - Power
-- - Frequency
-- - Shortcuts
-- - Adresses
-- nRF51 radio packet format:
--
-- ---------------------------------------------------------------
-- | PREAMBLE | BASE | PREFIX | S0 | LENGTH | S1 | PAYLOAD | CRC |
-- ---------------------------------------------------------------
-- | ADDRESS | Stored in memory |
--
type Radio_State is (Disabled,
Rx_Ramp_Up,
Rx_Idle,
Rx_State,
Rx_Disabled,
Tx_Ramp_Up,
Tx_Idle,
Tx_State,
Tx_Disabled);
type Shortcut is (Ready_To_Start,
End_To_Disable,
Disabled_To_TXen,
Disabled_To_RXen,
Address_To_RSSIstart,
End_To_Start,
Address_To_BCstart);
-- Setup shortcuts for the radio device. Shortcuts will start a task when
-- the associated event is triggered.
subtype Packet_Len is UInt8;
type Radio_Frequency_MHz is range 2400 .. 2527;
type Radio_Power is (Zero_Dbm,
Pos_4_Dbm,
Neg_30_Dbm,
Neg_20_Dbm,
Neg_16_Dbm,
Neg_12_Dbm,
Neg_8_Dbm,
Neg_4_Dbm);
type Radio_Mode is (Nordic_1MBIT,
Nordic_2MBIT,
Nordic_250KBIT,
BLE_1MBIT);
function State return Radio_State;
-- Return the current state of the radio
procedure Enable_Shortcut (Short : Shortcut);
-- Enable event to task shortcut
procedure Disable_Shortcut (Short : Shortcut);
-- Disable event to task shortcut
procedure Set_Packet (Address : System.Address);
-- Set packet address for RX or TX
procedure Set_Frequency (F : Radio_Frequency_MHz);
-- Set radio channel frequency
procedure Set_Power (P : Radio_Power);
-- Set radio output power
procedure Set_Mode (Mode : Radio_Mode);
-- Set radio protocol mode
type Base_Address_Lenght is new Integer range 1 .. 4;
procedure Set_Logic_Addresses
(Base0, Base1 : UInt32;
Base_Length_In_Byte : Base_Address_Lenght;
AP0, AP1, AP2, AP3, AP4, AP5, AP6, AP7 : UInt8);
-- Define base a prefix addresses
type Radio_Logic_Address is new UInt3;
type Logic_Address_Mask is array (Radio_Logic_Address) of Boolean with Pack;
procedure Translate_Logic_Address (Logic_Addr : Radio_Logic_Address;
Base : out UInt32;
Prefix : out UInt8);
-- Return the base a prefix coresponding the given logic address
procedure Set_TX_Address (Logic_Addr : Radio_Logic_Address);
-- Select on of the logic address composed with Base[0-1] and AP[0-7]
-- Logic Address | Base | Prefix Address
-- 0 | Base0 | AP0
-- 1 | Base1 | AP1
-- 2 | Base1 | AP2
-- 3 | Base1 | AP3
-- 4 | Base1 | AP4
-- 5 | Base1 | AP5
-- 6 | Base1 | AP6
-- 7 | Base1 | AP7
function RX_Match_Address return Radio_Logic_Address;
-- Return the logic address on which previous packet was received.
-- (see Set_TX_Address() for definition of logic adresses)
procedure Set_RX_Addresses (Enable_Mask : Logic_Address_Mask);
-- Mask logical adresses that will be used for RX
procedure Configure_CRC (Enable : Boolean;
Length : UInt2;
Skip_Address : Boolean;
Polynomial : UInt24;
Initial_Value : UInt24)
with Pre => (if Enable then Length /= 0);
function CRC_Error return Boolean;
-- Return True if the last packet was recieved with a CRC error
procedure Configure_Whitening (Enable : Boolean;
Initial_Value : UInt6 := 0);
type Length_Field_Endianness is (Little_Endian, Big_Endian);
procedure Configure_Packet
(S0_Field_Size_In_Byte : Bit;
S1_Field_Size_In_Bit : UInt4;
Length_Field_Size_In_Bit : UInt4;
Max_Packet_Length_In_Byte : Packet_Len;
Static_Packet_Length_In_Byte : Packet_Len;
On_Air_Endianness : Length_Field_Endianness);
private
for Radio_State use (Disabled => 0,
Rx_Ramp_Up => 1,
Rx_Idle => 2,
Rx_State => 3,
Rx_Disabled => 4,
Tx_Ramp_Up => 9,
Tx_Idle => 10,
Tx_State => 11,
Tx_Disabled => 12);
for Radio_Power use (Zero_Dbm => 16#00#,
Pos_4_Dbm => 16#04#,
Neg_30_Dbm => 16#D8#,
Neg_20_Dbm => 16#EC#,
Neg_16_Dbm => 16#F0#,
Neg_12_Dbm => 16#F4#,
Neg_8_Dbm => 16#F8#,
Neg_4_Dbm => 16#FC#);
end nRF51.Radio;
|
-- Based on James Munns' https://github.com/jamesmunns/bbqueue
--
-- BBqueue implements lock free, one producer one consumer, BipBuffers.
--
-- This unit only handles index offsets without having an internal buffer.
-- It can be used to allocate slices of an existing array, e.g.:
--
-- Buf : Storage_Array (8 .. 64) := (others => 0);
-- Q : aliased Offsets_Only (Buf'Length);
-- WG : Write_Grant := BBqueue.Empty;
-- S : Slice_Rec;
-- begin
-- Grant (Q, WG, 8);
-- if State (WG) = Valid then
-- S := Slice (WG);
-- Buf (Buf'First + S.From .. Buf'First + S.To) := (others => 42);
-- Commit (Q, WG);
-- end if;
with System.Storage_Elements; use System.Storage_Elements;
private with Atomic;
private with Atomic.Signed;
package BBqueue
with Preelaborate,
SPARK_Mode,
Abstract_State => null
is
type Result_Kind is (Valid, Grant_In_Progress, Insufficient_Size, Empty);
subtype Count is Storage_Count;
subtype Buffer_Size is Count range 1 .. Count'Last;
subtype Buffer_Offset is Storage_Offset range 0 .. Count'Last - 1;
type Offsets_Only (Size : Buffer_Size) is limited private;
-- Producer --
type Write_Grant is limited private;
procedure Grant (This : in out Offsets_Only;
G : in out Write_Grant;
Size : Count)
with Pre => State (G) /= Valid,
Post => State (G) in Valid | Empty | Grant_In_Progress | Insufficient_Size
and then
(if Size = 0 then State (G) = Empty)
and then
(if State (G) = Valid
then Write_Grant_In_Progress (This)
and then Slice (G).Length = Size
and then Valid_Slice (This, Slice (G))
and then Valid_Write_Slice (This, Slice (G)));
-- Request indexes of a contiguous writeable slice of exactly Size elements
procedure Commit (This : in out Offsets_Only;
G : in out Write_Grant;
Size : Count := Count'Last)
with Pre => State (G) = Valid,
Post => (if Write_Grant_In_Progress (This)'Old
then State (G) = Empty
else State (G) = Valid);
-- Commit a writeable slice. Size can be smaller than the granted slice for
-- partial commits. The commited slice is then available for Read.
-- Consumer --
type Read_Grant is limited private;
procedure Read (This : in out Offsets_Only;
G : in out Read_Grant;
Max : Count := Count'Last)
with Pre => State (G) /= Valid,
Post => State (G) in Valid | Empty | Grant_In_Progress
and then
(if State (G) = Valid
then Read_Grant_In_Progress (This)
and then Slice (G).Length <= Max
and then Valid_Slice (This, Slice (G))
and then Valid_Read_Slice (This, Slice (G)));
-- Request indexes of a contiguous readable slice of up to Max elements
procedure Release (This : in out Offsets_Only;
G : in out Read_Grant;
Size : Count := Count'Last)
with Pre => State (G) = Valid,
Post => (if Read_Grant_In_Progress (This)'Old
then State (G) = Empty
else State (G) = Valid);
-- Release a readable slice. Size can be smaller than the granted slice for
-- partial releases.
-- Utils --
function Empty return Write_Grant
with Post => State (Empty'Result) = Empty;
function Empty return Read_Grant
with Post => State (Empty'Result) = Empty;
-- Slices --
type Slice_Rec is record
Length : Count;
From : Buffer_Offset;
To : Buffer_Offset;
end record;
function State (G : Write_Grant) return Result_Kind;
function Slice (G : Write_Grant) return Slice_Rec
with Pre => State (G) = Valid;
function State (G : Read_Grant) return Result_Kind;
function Slice (G : Read_Grant) return Slice_Rec
with Pre => State (G) = Valid;
-- Contract helpers --
function Valid_Slice (This : Offsets_Only; Slice : Slice_Rec) return Boolean
is (Slice.From <= Slice.To
and then Slice.Length = Slice.To - Slice.From + 1
and then Slice.From in 0 .. This.Size - 1
and then Slice.To in 0 .. This.Size - 1)
with Ghost;
-- A valid slice contains offsets within the bounds of the array range.
-- This ensures that:
-- Arr (Arr'First + Start_Offset .. Arr'First + End_Offset)
-- will never be out of bounds.
function Valid_Write_Slice (This : Offsets_Only; Slice : Slice_Rec) return Boolean
with Ghost;
function Valid_Read_Slice (This : Offsets_Only; Slice : Slice_Rec) return Boolean
with Ghost;
function Write_Grant_In_Progress (This : Offsets_Only) return Boolean with Ghost;
function Read_Grant_In_Progress (This : Offsets_Only) return Boolean with Ghost;
private
function In_Readable_Area (This : Offsets_Only;
Offset : Buffer_Offset)
return Boolean
with Ghost;
function In_Writable_Area (This : Offsets_Only;
Offset : Buffer_Offset)
return Boolean
with Ghost;
package Atomic_Count
is new Atomic.Signed (System.Storage_Elements.Storage_Count);
use Atomic_Count;
type Offsets_Only (Size : Buffer_Size) is limited record
Write : aliased Atomic_Count.Instance := Atomic_Count.Init (0);
-- Where the next byte will be written
Read : aliased Atomic_Count.Instance := Atomic_Count.Init (0);
-- Where the next byte will be read from
Last : aliased Atomic_Count.Instance := Atomic_Count.Init (0);
-- Used in the inverted case to mark the end of the
-- readable streak. Otherwise will == sizeof::<self.buf>().
-- Writer is responsible for placing this at the correct
-- place when entering an inverted condition, and Reader
-- is responsible for moving it back to sizeof::<self.buf>()
-- when exiting the inverted condition
--
-- Cooperatively owned
--
-- NOTE: This should generally be initialized as size_of::<self.buf>(),
-- however this would prevent the structure from being entirely
-- zero-initialized, and can cause the .data section to be much larger
-- than necessary. By forcing the `last` pointer to be zero initially, we
-- place the structure in an "inverted" condition, which will be resolved
-- on the first commited bytes that are written to the structure.
--
-- When read == last == write, no bytes will be allowed to be read
-- (good), but write grants can be given out (also good).
Reserve : aliased Atomic_Count.Instance := Atomic_Count.Init (0);
-- Used by the Writer to remember what bytes are currently
-- allowed to be written to, but are not yet ready to be
-- read from
Read_In_Progress : aliased Atomic.Flag := Atomic.Init (False);
-- Is there an active read grant?
Write_In_Progress : aliased Atomic.Flag := Atomic.Init (False);
-- Is there an active write grant?
Granted_Write_Size : Count := 0;
Granted_Read_Size : Count := 0;
end record
with Invariant =>
Size <= Buffer_Size'Last
and then Value (Write) in 0 .. Size
and then Value (Read) in 0 .. Size
and then Value (Last) in 0 .. Size
and then Value (Reserve) in 0 .. Size
and then Value (Last) >= Value (Read)
and then Value (Last) >= Value (Write)
and then Granted_Write_Size <= Buffer_Size'Last
and then Granted_Read_Size <= Buffer_Size'Last
-- Reserve can only be lower than Write when a write grant made an
-- inverted allocation (starting back at 0), but the grant is not
-- commited yet.
and then (if Value (Reserve) < Value (Write) then not Is_Inverted (Offsets_Only))
and then (if Value (Reserve) < Value (Write)
then not Is_Inverted (Offsets_Only)
and then Value (Write) >= Value (Read)
and then Value (Reserve) = Granted_Write_Size
else Value (Reserve) - Granted_Write_Size = Value (Write))
-- Reserve is always in a writable area or else = Size
and then (Value (Reserve) = Size
or else In_Writable_Area (Offsets_Only, Value (Reserve)))
and then (if Is_Inverted (Offsets_Only)
then (Value (Write) + Granted_Write_Size <= Value (Read)
and then
Value (Reserve) <= Value (Read))
else Value (Read) <= Value (Write) - Granted_Read_Size)
-- Read cannot be in reserved area
and then (Value (Read) = Value (Write)
or else
(not (Granted_Write_Size /= 0
and then
Value (Read) in Value (Reserve) - Granted_Write_Size .. Value (Reserve) - 1
)))
-- Write grant bounds
and then (if Is_Inverted (Offsets_Only)
then Granted_Write_Size <= Value (Read) - Value (Write)
else Granted_Write_Size <= Count'Max (Size - Value (Write),
Value (Read)))
-- Read grant bounds
and then (if Is_Inverted (Offsets_Only)
then Granted_Read_Size <= Value (Last) - Value (Read)
else Granted_Read_Size <= Value (Write) - Value (Read))
-- Reserve when about to invert
and then (if not Is_Inverted (Offsets_Only) and then Value (Reserve) < Value (Write) then
-- When Reserved wrapped around, we know that it is because we
-- needed more space than what is available between Write and
-- then end of the buffer
Value (Reserve) > (Size - Value (Write))
)
and then (Value (Read) + Granted_Read_Size in 0 .. Size)
and then (if not Atomic.Value (Write_In_Progress) then Granted_Write_Size = 0)
and then (if not Atomic.Value (Read_In_Progress) then Granted_Read_Size = 0)
-- and then (if Atomic.Value (Write_In_Progress) then Granted_Write_Size /= 0)
-- and then (if Atomic.Value (Read_In_Progress) then Granted_Read_Size /= 0)
;
function Is_Inverted (This : Offsets_Only) return Boolean
is (Value (This.Write) < Value (This.Read))
with Ghost;
Empty_Slice : constant Slice_Rec := (0, 0, 0);
type Write_Grant is limited record
Result : Result_Kind := Empty;
Slice : Slice_Rec := Empty_Slice;
end record;
-- with Invariant => (case Write_Grant.Result is
-- when Valid => not Slices.Empty (Write_Grant.Slice),
-- when others => Slices.Empty (Write_Grant.Slice));
type Read_Grant is limited record
Result : Result_Kind := Empty;
Slice : Slice_Rec := Empty_Slice;
end record;
-- with Invariant => (case Read_Grant.Result is
-- when Valid => not Slices.Empty (Read_Grant.Slice),
-- when others => Slices.Empty (Read_Grant.Slice));
function State (G : Write_Grant) return Result_Kind
is (G.Result);
function Empty return Write_Grant
is (Result => Empty, others => <>);
function Slice (G : Write_Grant) return Slice_Rec
is (G.Slice);
function State (G : Read_Grant) return Result_Kind
is (G.Result);
function Empty return Read_Grant
is (Result => Empty, others => <>);
function Slice (G : Read_Grant) return Slice_Rec
is (G.Slice);
-- Contract helpers --
----------------------
-- In_Readable_Area --
----------------------
function In_Readable_Area (This : Offsets_Only; Offset : Buffer_Offset) return Boolean
is (if Is_Inverted (This) then
-- Already inverted.
(if Value (This.Read) /= Value (This.Last) then
-- |===W-----------R==L..|
-- Data remaining before Last:
-- We can read between R .. L
Offset in Value (This.Read) .. Value (This.Last)
else
-- |===W--------------R..|
-- L
-- Read = Last, the next valid read is inverted:
-- We can read between 0 .. W - 1
Offset in 0 .. Value (This.Write) - 1)
else
-- |----R=========W-----|
-- Not Inverted (R <= W):
-- We can read between R .. W - 1
Offset in Value (This.Read) .. Value (This.Write) - 1);
----------------------
-- In_Writable_Area --
----------------------
function In_Writable_Area (This : Offsets_Only; Offset : Buffer_Offset) return Boolean
is (if Is_Inverted (This) then
-- Already inverted
-- |---W==========R----|
-- Inverted (R > W):
-- We can write between W .. R - 1
Offset in Value (This.Write) .. Value (This.Read) - 1
else (
-- |====R---------W=====|
-- Not Inverted (R <= W):
-- We can write between W .. Size - 1, or 0 .. R - 1 if we invert
(Offset in Value (This.Write) .. This.Size - 1)
or else
(Offset in 0 .. Value (This.Read) - 1)));
-----------------------
-- Valid_Write_Slice --
-----------------------
function Valid_Write_Slice (This : Offsets_Only; Slice : Slice_Rec) return Boolean
is (Valid_Slice (This, Slice)
and then In_Writable_Area (This, Slice.From)
and then In_Writable_Area (This, Slice.To));
function Valid_Read_Slice (This : Offsets_Only; Slice : Slice_Rec) return Boolean
is (Valid_Slice (This, Slice)
and then In_Readable_Area (This, Slice.From)
and then In_Readable_Area (This, Slice.To));
-----------------------------
-- Write_Grant_In_Progress --
-----------------------------
function Write_Grant_In_Progress (This : Offsets_Only) return Boolean
is (Atomic.Value (This.Write_In_Progress));
----------------------------
-- Read_Grant_In_Progress --
----------------------------
function Read_Grant_In_Progress (This : Offsets_Only) return Boolean
is (Atomic.Value (This.Read_In_Progress));
end BBqueue;
|
-- io.adb
-- Plays with console IO.
-- Note that Ada is case-INSENSITIVE.
--
-- Simon Heath
-- 19/7/2004
with Ada.Text_Io;
use Ada.Text_Io;
procedure Io is
C : Character;
S : String(1..32);
begin
Put_Line( "This reads information and then displays it." );
Put_Line( "Please type a character then 'enter'" );
New_Line;
Get( C );
Put_Line( "You typed '" & C & "'" );
--Put_Line( "Now type a string, then 'enter'" );
--Get_Line( S, 32 );
--Put_Line( "You typed:" );
--Put_Line( S );
end Io;
|
with ada.text_io, ada.Integer_text_IO, Ada.Text_IO.Text_Streams, Ada.Strings.Fixed, Interfaces.C;
use ada.text_io, ada.Integer_text_IO, Ada.Strings, Ada.Strings.Fixed, Interfaces.C;
procedure ocaml01 is
type stringptr is access all char_array;
function foo return Integer is
begin
for i in integer range 0..10 loop
NULL;
end loop;
return 0;
end;
function bar return Integer is
a : Integer;
begin
for i in integer range 0..10 loop
a := 0;
end loop;
return 0;
end;
begin
NULL;
end;
|
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . C O N T T . S D --
-- --
-- S p e c --
-- --
-- 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). --
-- --
------------------------------------------------------------------------------
-- This package defines the procedures which scans the tree search paths for
-- a given Context and analyses the availible tree files
with Namet; use Namet;
package A4G.Contt.SD is
First_Tree_File : Name_Id := First_Name_Id;
Last_Tree_File : Name_Id := First_Name_Id - 1;
-- Indexes of the first and the last tree file candidates, which were
-- found during the last scanning of the tree search path of some
-- directory. Are set by Scan_Tree_Files below. These variables are
-- undefinite
-- SHOULD WE MOVE THESE VARIABLES IN THE BODY
-- AND EVEN MORE - DO WE REALLY NEED THEM AT ALL??!!
procedure Scan_Tree_Files_New (C : Context_Id);
-- Stores the names of the tree files making up the Context C in the Tree
-- table for C. Every tree file name is stored only once.
-- In All_Trees Context mode it scans the tree search path, using the same
-- approach for the tree files with the same name as GNAT does for source
-- files in the source search path. In N_Trees mode it scans the Parametes
-- string set when C was associated. In this case, if the name of the same
-- tree file is given more than once, but in diffrent forms (for example
-- ../my_dir/foo.ats and ../../my_home_dir/my_dir/foo.ats), all these
-- different names of the same tree file will be stored in the tree table
procedure Investigate_Trees_New (C : Context_Id);
-- This procedure implements the second step of opening a Context. It uses
-- the names of the tree files in the Context Tree Table. For every tree
-- file, it reads it in and extracts some information about compilation
-- units presented by this file. It also makes the consistency check.
-- Checks which are made by this procedure depend on the context options
-- which were set when C was associated.
--
-- Is this package the right location for this procedure???
procedure Scan_Units_New;
-- Scans the currently accessed tree which was readed in by the
-- immediately preceding call to Read_and_Check_New. If a unit is "new"
-- (that is, if it has not already been encountered during opening a
-- Context), all the black-box information is computed and stored in the
-- Context table. Otherwise (that is, if the unit is already "known")
-- the consistency check is made.
--
-- When this procedure raises ASIS_Failed, it forms the Diagnosis string
-- on befalf on Asis.Ada_Environments.Open
end A4G.Contt.SD;
|
with AAA.Strings;
with CLIC.TTY;
with Ada.Text_IO;
private with GNAT.Strings;
package Commands.Announce is
package IO renames Ada.Text_IO;
package TT renames CLIC.TTY;
type Instance
is new CLIC.Subcommand.Command
with private;
overriding function Name (Cmd : Instance) return
CLIC.Subcommand.Identifier is ("announce");
overriding procedure Execute
(Cmd : in out Instance; Args : AAA.Strings.Vector);
overriding
function Switch_Parsing (This : Instance)
return CLIC.Subcommand.Switch_Parsing_Kind
is (CLIC.Subcommand.All_As_Args);
overriding function Long_Description
(Cmd : Instance) return AAA.Strings.Vector is
(AAA.Strings.Empty_Vector.Append
("Announce posts.")
.New_Line
);
overriding procedure Setup_Switches
(Cmd : in out Instance;
Config : in out CLIC.Subcommand.Switches_Configuration);
overriding function Short_Description (Cmd : Instance)
return String is
("Announce posts to social media and other sites.");
overriding function Usage_Custom_Parameters (Cmd : Instance)
return String is ("");
private
type Instance is new CLIC.Subcommand.Command with null record;
end Commands.Announce;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . B B . C P U _ P R I M I T I V E S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-2002 Universidad Politecnica de Madrid --
-- Copyright (C) 2003-2005 The European Space Agency --
-- Copyright (C) 2003-2013, AdaCore --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
------------------------------------------------------------------------------
-- This version is for ARM bareboard targets using the ARMv7-M targets,
-- which only use Thumb2 instructions.
with Ada.Unchecked_Conversion; use Ada;
with System.Storage_Elements;
with System.Multiprocessors;
with System.BB.Board_Support;
with System.BB.Threads;
with System.BB.Threads.Queues;
with System.BB.Time;
with System.Machine_Code; use System.Machine_Code;
package body System.BB.CPU_Primitives is
use Parameters;
use Threads;
use Queues;
use Board_Support;
use Time;
use System.Multiprocessors;
package SSE renames System.Storage_Elements;
use type SSE.Integer_Address;
use type SSE.Storage_Offset;
NL : constant String := ASCII.LF & ASCII.HT;
-- New line separator in Asm templates
No_Floating_Point : constant Boolean := False;
-- Set True iff the FPU should not be used
-----------
-- Traps --
-----------
Reset_Vector : constant Vector_Id := 1;
NMI_Vector : constant Vector_Id := 2;
Hard_Fault_Vector : constant Vector_Id := 3;
-- Mem_Manage_Vector : constant Vector_Id := 4; -- Never referenced
Bus_Fault_Vector : constant Vector_Id := 5;
Usage_Fault_Vector : constant Vector_Id := 6;
SV_Call_Vector : constant Vector_Id := 10;
-- Debug_Mon_Vector : constant Vector_Id := 11; -- Never referenced
Pend_SV_Vector : constant Vector_Id := 13;
Sys_Tick_Vector : constant Vector_Id := 14;
Interrupt_Request_Vector : constant Vector_Id := 15;
pragma Assert (Interrupt_Request_Vector = Vector_Id'Last);
type Trap_Handler_Ptr is access procedure (Id : Vector_Id);
function To_Pointer is new Unchecked_Conversion (Address, Trap_Handler_Ptr);
type Trap_Handler_Table is array (Vector_Id) of Trap_Handler_Ptr;
pragma Suppress_Initialization (Trap_Handler_Table);
Trap_Handlers : Trap_Handler_Table;
pragma Export (C, Trap_Handlers, "__gnat_bb_exception_handlers");
System_Vectors : constant System.Address;
pragma Import (Asm, System_Vectors, "__vectors");
-- As ARMv7M does not directly provide a single-shot alarm timer, and
-- we have to use Sys_Tick for that, we need to have this clock generate
-- interrupts at a relatively high rate. To avoid unnecessary overhead
-- when no alarms are requested, we'll only call the alarm handler if
-- the current time exceeds the Alarm_Time by at most half the modulus
-- of Timer_Interval.
Alarm_Time : Board_Support.Timer_Interval;
pragma Volatile (Alarm_Time);
pragma Import (C, Alarm_Time, "__gnat_alarm_time");
procedure SV_Call_Handler;
pragma Export (Asm, SV_Call_Handler, "__gnat_sv_call_trap");
procedure Pend_SV_Handler;
pragma Machine_Attribute (Pend_SV_Handler, "naked");
pragma Export (Asm, Pend_SV_Handler, "__gnat_pend_sv_trap");
-- This assembly routine needs to save and restore registers without
-- interference. The "naked" machine attribute communicates this to GCC.
procedure Sys_Tick_Handler;
pragma Export (Asm, Sys_Tick_Handler, "__gnat_sys_tick_trap");
procedure Interrupt_Request_Handler;
pragma Export (Asm, Interrupt_Request_Handler, "__gnat_irq_trap");
procedure GNAT_Error_Handler (Trap : Vector_Id);
pragma No_Return (GNAT_Error_Handler);
-----------------------
-- Context Switching --
-----------------------
-- This port uses the ARMv7-M hardware for saving volatile context for
-- interrupts, see the Hardware_Context type below for details. Any
-- non-volatile registers will be preserved by the interrupt handler in
-- the same way as it happens for ordinary procedure calls.
-- The non-volatile registers, as well as the value of the stack pointer
-- (SP_process) are saved in the Context buffer of the Thread_Descriptor.
-- Any non-volatile floating-point registers are saved on the stack.
-- R4 .. R11 are at offset 0 .. 7
SP_process : constant Context_Id := 8;
type Hardware_Context is record
R0, R1, R2, R3 : Word;
R12, LR, PC, PSR : Word;
end record;
ICSR : Word with Volatile, Address => 16#E000_ED04#; -- Int. Control/State
ICSR_Pend_SV_Set : constant Word := 2**28;
VTOR : Address with Volatile, Address => 16#E000_ED08#; -- Vec. Table Offset
AIRCR : Word with Volatile, Address => 16#E000_ED0C#; -- App Int/Reset Ctrl
CCR : Word with Volatile, Address => 16#E000_ED14#; -- Config. Control
SHPR1 : Word with Volatile, Address => 16#E000_ED18#; -- Sys Hand 4- 7 Prio
SHPR2 : Word with Volatile, Address => 16#E000_ED1C#; -- Sys Hand 8-11 Prio
SHPR3 : Word with Volatile, Address => 16#E000_ED20#; -- Sys Hand 12-15 Prio
SHCSR : Word with Volatile, Address => 16#E000_ED24#; -- Sys Hand Ctrl/State
function PRIMASK return Word with Inline, Export, Convention => C;
-- Function returning the contents of the PRIMASK register
procedure Initialize_CPU;
-- Set the CPU up to use the proper stack for interrupts, initialize and
-- enable system trap handlers.
-------------
-- PRIMASK --
-------------
function PRIMASK return Word is
R : Word;
begin
Asm ("mrs %0, PRIMASK", Outputs => Word'Asm_Output ("=r", R),
Volatile => True);
return R;
end PRIMASK;
--------------------
-- Initialize_CPU --
--------------------
procedure Initialize_CPU is
Interrupt_Stack_Table : array (System.Multiprocessors.CPU)
of System.Address;
pragma Import (Asm, Interrupt_Stack_Table, "interrupt_stack_table");
-- Table containing a pointer to the top of the stack for each processor
begin
-- Switch the stack pointer to SP_process (PSP)
Asm ("mrs r0, MSP" & NL &
"msr PSP, r0" & NL &
"mrs r0, CONTROL" & NL &
"orr r0,r0,2" & NL &
"msr CONTROL,r0",
Clobber => "r0",
Volatile => True);
-- Initialize SP_main (MSP)
Asm ("msr MSP, %0",
Inputs => Address'Asm_Input ("r", Interrupt_Stack_Table (1)),
Volatile => True);
-- Initialize vector table
VTOR := System_Vectors'Address;
-- Set configuration: stack is 8 byte aligned, trap on divide by 0,
-- no trap on unaligned access, can enter thread mode from any level.
CCR := CCR or 16#211#;
-- Set priorities of system handlers. The Pend_SV handler runs at the
-- lowest priority, so context switching does not block higher priority
-- interrupt handlers. All other system handlers run at the highest
-- priority (0), so they will not be interrupted. This is also true for
-- the SysTick interrupt, as this interrupt must be serviced promptly in
-- order to avoid losing track of time.
SHPR1 := 0;
SHPR2 := 0;
SHPR3 := 16#00_FF_00_00#;
-- Write the required key (16#05FA#) and desired PRIGROUP value. We
-- configure this to 3, to have 16 group priorities
AIRCR := 16#05FA_0300#;
pragma Assert (AIRCR = 16#FA05_0300#); -- Key value is swapped
-- Enable usage, bus and memory management fault
SHCSR := SHCSR or 16#7_000#;
-- Unmask Fault
Asm ("cpsie f", Volatile => True);
end Initialize_CPU;
--------------------
-- Context_Switch --
--------------------
procedure Context_Switch is
begin
-- Interrupts must be disabled at this point
pragma Assert (PRIMASK = 1);
-- Make deferred supervisor call pending
ICSR := ICSR_Pend_SV_Set;
-- The context switch better be pending, as otherwise it means
-- interrupts were not disabled.
pragma Assert ((ICSR and ICSR_Pend_SV_Set) /= 0);
-- Memory must be clobbered, as task switching causes a task to signal,
-- which means its memory changes must be visible to all other tasks.
Asm ("", Volatile => True, Clobber => "memory");
end Context_Switch;
-----------------
-- Get_Context --
-----------------
function Get_Context
(Context : Context_Buffer;
Index : Context_Id) return Word
is
(Word (Context (Index)));
------------------------
-- GNAT_Error_Handler --
------------------------
procedure GNAT_Error_Handler (Trap : Vector_Id) is
begin
case Trap is
when Reset_Vector =>
raise Program_Error with "unexpected reset";
when NMI_Vector =>
raise Program_Error with "non-maskable interrupt";
when Hard_Fault_Vector =>
raise Program_Error with "hard fault";
when Bus_Fault_Vector =>
raise Program_Error with "bus fault";
when Usage_Fault_Vector =>
raise Constraint_Error with "usage fault";
when others =>
raise Program_Error with "unhandled trap";
end case;
end GNAT_Error_Handler;
----------------------------------
-- Interrupt_Request_Handler -- --
----------------------------------
procedure Interrupt_Request_Handler is
begin
-- Call the handler (System.BB.Interrupts.Interrupt_Wrapper)
Trap_Handlers (Interrupt_Request_Vector)(Interrupt_Request_Vector);
-- The handler has changed the current priority (BASEPRI), although
-- being useless on ARMv7m. We need to revert it.
-- The interrupt handler may have scheduled a new task, so we need to
-- check whether a context switch is needed.
if Context_Switch_Needed then
-- Perform a context switch because the currently executing thread is
-- no longer the one with the highest priority.
-- No need to update execution time. Already done in the wrapper.
-- Note that the following context switch is not immediate, but
-- will only take effect after interrupts are enabled.
Context_Switch;
end if;
-- Restore interrupt masking of interrupted thread
Enable_Interrupts (Running_Thread.Active_Priority);
end Interrupt_Request_Handler;
---------------------
-- Pend_SV_Handler --
---------------------
procedure Pend_SV_Handler is
begin
-- At most one instance of this handler can run at a time, and
-- interrupts will preserve all state, so interrupts can be left
-- enabled. Note the invariant that at all times the active context is
-- in the ("__gnat_running_thread_table"). Only this handler may update
-- that variable.
Asm
(Template =>
"movw r2, #:lower16:__gnat_running_thread_table" & NL &
"movt r2, #:upper16:__gnat_running_thread_table" & NL &
"mrs r12, PSP " & NL & -- Retrieve current PSP
"ldr r3, [r2]" & NL & -- Load address of running context
-- If floating point is enabled, we may have to save the non-volatile
-- floating point registers, and save bit 4 of the LR register, as
-- this will indicate whether the floating point context was saved
-- or not.
(if No_Floating_Point then "" -- No FP context to save
else
"tst lr, #16" & NL & -- if FPCA flag was set,
"itte eq" & NL & -- then
"vstmdbeq r12!,{s16-s31}" & NL & -- save FP context below PSP
"addeq r12, #1" & NL & -- save flag in bit 0 of PSP
"subne lr, #16" & NL) & -- else set FPCA flag in LR
-- Swap R4-R11 and PSP (stored in R12)
"stm r3, {r4-r12}" & NL & -- Save context
"movw r3, #:lower16:first_thread_table" & NL &
"movt r3, #:upper16:first_thread_table" & NL &
"ldr r3, [r3]" & NL & -- Load address of new context
"str r3, [r2]" & NL & -- Update value of Pend_SV_Context
"ldm r3, {r4-r12}" & NL & -- Load context and new PSP
-- If floating point is enabled, check bit 0 of PSP to see if we
-- need to restore the floating point context.
(if No_Floating_Point then "" -- No FP context to restore
else
"tst r12, #1" & NL & -- if FPCA was set,
"itte ne" & NL & -- then
"subne r12, #1" & NL & -- remove flag from PSP
"vldmiane r12!,{s16-s31}" & NL & -- Restore FP context
"addeq lr, #16" & NL) & -- else clear FPCA flag in LR
-- Finally, update PSP and perform the exception return
"msr PSP, r12" & NL & -- Update PSP
"bx lr", -- return to caller
Volatile => True);
end Pend_SV_Handler;
---------------------
-- SV_Call_Handler --
---------------------
procedure SV_Call_Handler is
begin
GNAT_Error_Handler (SV_Call_Vector);
end SV_Call_Handler;
-----------------
-- Set_Context --
-----------------
procedure Set_Context
(Context : in out Context_Buffer;
Index : Context_Id;
Value : Word) is
begin
Context (Index) := Address (Value);
end Set_Context;
----------------------
-- Sys_Tick_Handler --
----------------------
procedure Sys_Tick_Handler is
Max_Alarm_Interval : constant Timer_Interval := Timer_Interval'Last / 2;
Now : constant Timer_Interval := Read_Clock;
begin
-- The following allows max. efficiency for "useless" tick interrupts
if Alarm_Time - Now <= Max_Alarm_Interval then
-- Alarm is still in the future, nothing to do, so return quickly
return;
end if;
Alarm_Time := Now + Max_Alarm_Interval;
-- Call the alarm handler
Trap_Handlers (Sys_Tick_Vector)(Sys_Tick_Vector);
-- The interrupt handler may have scheduled a new task
if Context_Switch_Needed then
Context_Switch;
end if;
Enable_Interrupts (Running_Thread.Active_Priority);
end Sys_Tick_Handler;
------------------------
-- Initialize_Context --
------------------------
procedure Initialize_Context
(Buffer : not null access Context_Buffer;
Program_Counter : System.Address;
Argument : System.Address;
Stack_Pointer : System.Address)
is
HW_Ctx_Bytes : constant System.Address := Hardware_Context'Size / 8;
New_SP : constant System.Address :=
(Stack_Pointer - HW_Ctx_Bytes) and not 4;
HW_Ctx : Hardware_Context with Address => New_SP;
begin
-- No need to initialize the context of the environment task
if Program_Counter = Null_Address then
return;
end if;
HW_Ctx := (R0 => Word (Argument),
PC => Word (Program_Counter),
PSR => 2**24, -- Set thumb bit
others => 0);
Buffer.all := (SP_process => New_SP, others => 0);
end Initialize_Context;
----------------------------
-- Install_Error_Handlers --
----------------------------
procedure Install_Error_Handlers is
EH : constant Address := GNAT_Error_Handler'Address;
begin
Install_Trap_Handler (EH, Reset_Vector);
Install_Trap_Handler (EH, NMI_Vector);
Install_Trap_Handler (EH, Hard_Fault_Vector);
Install_Trap_Handler (EH, Bus_Fault_Vector);
Install_Trap_Handler (EH, Usage_Fault_Vector);
Install_Trap_Handler (EH, Sys_Tick_Vector);
Install_Trap_Handler (EH, Pend_SV_Vector);
Install_Trap_Handler (EH, SV_Call_Vector);
end Install_Error_Handlers;
--------------------------
-- Install_Trap_Handler --
--------------------------
procedure Install_Trap_Handler
(Service_Routine : System.Address;
Vector : Vector_Id;
Synchronous : Boolean := False)
is
pragma Unreferenced (Synchronous);
begin
Trap_Handlers (Vector) := To_Pointer (Service_Routine);
end Install_Trap_Handler;
------------------------
-- Disable_Interrupts --
------------------------
procedure Disable_Interrupts is
begin
Asm ("cpsid i", Volatile => True);
end Disable_Interrupts;
-----------------------
-- Enable_Interrupts --
-----------------------
procedure Enable_Interrupts (Level : System.Any_Priority) is
begin
-- Set the BASEPRI according to the specified level. PRIMASK is still
-- set, so the change does not take effect until the next Asm.
Set_Current_Priority (Level);
-- The following enables interrupts and will cause any pending
-- interrupts to take effect. The barriers and their placing are
-- essential, otherwise a blocking operation might not cause an
-- immediate context switch, violating mutual exclusion.
Asm ("cpsie i" & NL
& "dsb" & NL
& "isb",
Clobber => "memory", Volatile => True);
end Enable_Interrupts;
-------------------------------
-- Initialize_Floating_Point --
-------------------------------
procedure Initialize_Floating_Point renames Initialize_CPU;
end System.BB.CPU_Primitives;
|
-----------------------------------------------------------------------
-- AWA.Workspaces.Models -- AWA.Workspaces.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2013 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
pragma Warnings (Off, "unit * is not referenced");
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Basic.Lists;
with AWA.Users.Models;
pragma Warnings (On, "unit * is not referenced");
package AWA.Workspaces.Models is
type Workspace_Ref is new ADO.Objects.Object_Ref with null record;
type Workspace_Feature_Ref is new ADO.Objects.Object_Ref with null record;
type Workspace_Member_Ref is new ADO.Objects.Object_Ref with null record;
-- --------------------
-- The workspace controls the features available in the application
-- for a set of users: the workspace members. A user could create
-- several workspaces and be part of several workspaces that other
-- users have created.
-- --------------------
-- Create an object key for Workspace.
function Workspace_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Workspace from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Workspace_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Workspace : constant Workspace_Ref;
function "=" (Left, Right : Workspace_Ref'Class) return Boolean;
-- Set the workspace identifier
procedure Set_Id (Object : in out Workspace_Ref;
Value : in ADO.Identifier);
-- Get the workspace identifier
function Get_Id (Object : in Workspace_Ref)
return ADO.Identifier;
--
function Get_Version (Object : in Workspace_Ref)
return Integer;
--
procedure Set_Create_Date (Object : in out Workspace_Ref;
Value : in Ada.Calendar.Time);
--
function Get_Create_Date (Object : in Workspace_Ref)
return Ada.Calendar.Time;
--
procedure Set_Owner (Object : in out Workspace_Ref;
Value : in AWA.Users.Models.User_Ref'Class);
--
function Get_Owner (Object : in Workspace_Ref)
return AWA.Users.Models.User_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Workspace_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Workspace_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Workspace_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Workspace_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Workspace_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Workspace_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
WORKSPACE_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Workspace_Ref);
-- Copy of the object.
procedure Copy (Object : in Workspace_Ref;
Into : in out Workspace_Ref);
-- Create an object key for Workspace_Feature.
function Workspace_Feature_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Workspace_Feature from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Workspace_Feature_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Workspace_Feature : constant Workspace_Feature_Ref;
function "=" (Left, Right : Workspace_Feature_Ref'Class) return Boolean;
--
procedure Set_Id (Object : in out Workspace_Feature_Ref;
Value : in ADO.Identifier);
--
function Get_Id (Object : in Workspace_Feature_Ref)
return ADO.Identifier;
--
procedure Set_Limit (Object : in out Workspace_Feature_Ref;
Value : in Integer);
--
function Get_Limit (Object : in Workspace_Feature_Ref)
return Integer;
--
procedure Set_Workspace (Object : in out Workspace_Feature_Ref;
Value : in AWA.Workspaces.Models.Workspace_Ref'Class);
--
function Get_Workspace (Object : in Workspace_Feature_Ref)
return AWA.Workspaces.Models.Workspace_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Workspace_Feature_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Workspace_Feature_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Workspace_Feature_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Workspace_Feature_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Workspace_Feature_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Workspace_Feature_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
WORKSPACE_FEATURE_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Workspace_Feature_Ref);
-- Copy of the object.
procedure Copy (Object : in Workspace_Feature_Ref;
Into : in out Workspace_Feature_Ref);
-- --------------------
-- The workspace member indicates the users who
-- are part of the workspace.
-- --------------------
-- Create an object key for Workspace_Member.
function Workspace_Member_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Workspace_Member from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Workspace_Member_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Workspace_Member : constant Workspace_Member_Ref;
function "=" (Left, Right : Workspace_Member_Ref'Class) return Boolean;
--
procedure Set_Id (Object : in out Workspace_Member_Ref;
Value : in ADO.Identifier);
--
function Get_Id (Object : in Workspace_Member_Ref)
return ADO.Identifier;
--
procedure Set_Member (Object : in out Workspace_Member_Ref;
Value : in AWA.Users.Models.User_Ref'Class);
--
function Get_Member (Object : in Workspace_Member_Ref)
return AWA.Users.Models.User_Ref'Class;
--
procedure Set_Workspace (Object : in out Workspace_Member_Ref;
Value : in AWA.Workspaces.Models.Workspace_Ref'Class);
--
function Get_Workspace (Object : in Workspace_Member_Ref)
return AWA.Workspaces.Models.Workspace_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Workspace_Member_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Workspace_Member_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Workspace_Member_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Workspace_Member_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Workspace_Member_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Workspace_Member_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
WORKSPACE_MEMBER_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Workspace_Member_Ref);
-- Copy of the object.
procedure Copy (Object : in Workspace_Member_Ref;
Into : in out Workspace_Member_Ref);
private
WORKSPACE_NAME : aliased constant String := "awa_workspace";
COL_0_1_NAME : aliased constant String := "id";
COL_1_1_NAME : aliased constant String := "version";
COL_2_1_NAME : aliased constant String := "create_date";
COL_3_1_NAME : aliased constant String := "owner_id";
WORKSPACE_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 4,
Table => WORKSPACE_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access,
3 => COL_2_1_NAME'Access,
4 => COL_3_1_NAME'Access
)
);
WORKSPACE_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= WORKSPACE_DEF'Access;
Null_Workspace : constant Workspace_Ref
:= Workspace_Ref'(ADO.Objects.Object_Ref with others => <>);
type Workspace_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => WORKSPACE_DEF'Access)
with record
Version : Integer;
Create_Date : Ada.Calendar.Time;
Owner : AWA.Users.Models.User_Ref;
end record;
type Workspace_Access is access all Workspace_Impl;
overriding
procedure Destroy (Object : access Workspace_Impl);
overriding
procedure Find (Object : in out Workspace_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Workspace_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Workspace_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Workspace_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Workspace_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Workspace_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Workspace_Ref'Class;
Impl : out Workspace_Access);
WORKSPACE_FEATURE_NAME : aliased constant String := "awa_workspace_feature";
COL_0_2_NAME : aliased constant String := "id";
COL_1_2_NAME : aliased constant String := "limit";
COL_2_2_NAME : aliased constant String := "workspace_id";
WORKSPACE_FEATURE_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 3,
Table => WORKSPACE_FEATURE_NAME'Access,
Members => (
1 => COL_0_2_NAME'Access,
2 => COL_1_2_NAME'Access,
3 => COL_2_2_NAME'Access
)
);
WORKSPACE_FEATURE_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= WORKSPACE_FEATURE_DEF'Access;
Null_Workspace_Feature : constant Workspace_Feature_Ref
:= Workspace_Feature_Ref'(ADO.Objects.Object_Ref with others => <>);
type Workspace_Feature_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => WORKSPACE_FEATURE_DEF'Access)
with record
Limit : Integer;
Workspace : AWA.Workspaces.Models.Workspace_Ref;
end record;
type Workspace_Feature_Access is access all Workspace_Feature_Impl;
overriding
procedure Destroy (Object : access Workspace_Feature_Impl);
overriding
procedure Find (Object : in out Workspace_Feature_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Workspace_Feature_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Workspace_Feature_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Workspace_Feature_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Workspace_Feature_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Workspace_Feature_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Workspace_Feature_Ref'Class;
Impl : out Workspace_Feature_Access);
WORKSPACE_MEMBER_NAME : aliased constant String := "awa_workspace_member";
COL_0_3_NAME : aliased constant String := "id";
COL_1_3_NAME : aliased constant String := "member_id";
COL_2_3_NAME : aliased constant String := "workspace_id";
WORKSPACE_MEMBER_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 3,
Table => WORKSPACE_MEMBER_NAME'Access,
Members => (
1 => COL_0_3_NAME'Access,
2 => COL_1_3_NAME'Access,
3 => COL_2_3_NAME'Access
)
);
WORKSPACE_MEMBER_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= WORKSPACE_MEMBER_DEF'Access;
Null_Workspace_Member : constant Workspace_Member_Ref
:= Workspace_Member_Ref'(ADO.Objects.Object_Ref with others => <>);
type Workspace_Member_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => WORKSPACE_MEMBER_DEF'Access)
with record
Member : AWA.Users.Models.User_Ref;
Workspace : AWA.Workspaces.Models.Workspace_Ref;
end record;
type Workspace_Member_Access is access all Workspace_Member_Impl;
overriding
procedure Destroy (Object : access Workspace_Member_Impl);
overriding
procedure Find (Object : in out Workspace_Member_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Workspace_Member_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Workspace_Member_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Workspace_Member_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Workspace_Member_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Workspace_Member_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Workspace_Member_Ref'Class;
Impl : out Workspace_Member_Access);
end AWA.Workspaces.Models;
|
with Ada.Text_IO;
procedure tty_key is
use type Ada.Text_IO.Count;
C, D : Character;
Avail : Boolean;
Line_Length : Ada.Text_IO.Count := Ada.Text_IO.Line_Length;
Start_Col, Current_Col : Ada.Text_IO.Count;
begin
Ada.Text_IO.New_Page; -- clear screen
Ada.Text_IO.Put ("push any key:");
Ada.Text_IO.Get_Immediate (C);
Start_Col := Ada.Text_IO.Col;
Current_Col := Start_Col;
loop
Ada.Text_IO.Get_Immediate (D, Avail);
if Avail then
exit when C = D;
Current_Col := Ada.Text_IO.Col;
else
Ada.Text_IO.Put (C);
Current_Col := Current_Col + 1;
end if;
if Current_Col = Line_Length then
Ada.Text_IO.Set_Col (Start_Col);
Current_Col := Start_Col;
end if;
end loop;
Ada.Text_IO.New_Line;
end tty_key;
|
-----------------------------------------------------------------------
-- awa-events-configs-reader_config -- Event configuration reader setup
-- Copyright (C) 2012, 2013, 2017, 2018 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Serialize.Mappers;
with EL.Contexts;
with AWA.Events.Services;
-- Setup the XML parser to read the <b>queue</b> and <b>on-event</b> description.
-- For example:
--
-- <dispatcher name="async">
-- <queue name="async"/>
-- <queue name="persist"/>
-- <count>4</count>
-- <priority>10</priority>
-- </dispatcher>
--
-- <queue name="async" type="fifo">
-- <property name="size">254</property>
-- </queue>
--
-- <queue name="defer" type="persist">
-- </queue>
--
-- <on-event name="create-user" queue="async">
-- <action>#{mail.send}</action>
-- <property name="user">#{event.name}</property>
-- <property name="template">mail/welcome.xhtml</property>
-- </on-event>
--
-- This defines an event action called when the <b>create-user</b> event is posted.
-- The Ada bean <b>mail</b> is created and is populated with the <b>user</b> and
-- <b>template</b> properties. The Ada bean action method <b>send</b> is called.
generic
Mapper : in out Util.Serialize.Mappers.Processing;
Manager : in AWA.Events.Services.Event_Manager_Access;
Context : in EL.Contexts.ELContext_Access;
package AWA.Events.Configs.Reader_Config is
Config : aliased Controller_Config;
procedure Initialize;
end AWA.Events.Configs.Reader_Config;
|
with STM32_SVD.GPIO;
package STM32GD.GPIO.Port is
pragma Preelaborate;
function GPIO_Port_Representation (Port : STM32_SVD.GPIO.GPIO_Peripheral) return UInt4
with Inline;
end STM32GD.GPIO.Port;
|
-- Copyright (c) 2017 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with League.Strings;
with WebDriver.Drivers;
package WebDriver.Remote is
function Create
(URL : League.Strings.Universal_String)
return WebDriver.Drivers.Driver'Class;
-- Connect to server ("Remote end")
end WebDriver.Remote;
|
pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
private package CUPS.stdint_h is
INT8_MIN : constant := (-128); -- stdint.h:155
INT16_MIN : constant := (-32767-1); -- stdint.h:156
INT32_MIN : constant := (-2147483647-1); -- stdint.h:157
-- unsupported macro: INT64_MIN (-__INT64_C(9223372036854775807)-1)
INT8_MAX : constant := (127); -- stdint.h:160
INT16_MAX : constant := (32767); -- stdint.h:161
INT32_MAX : constant := (2147483647); -- stdint.h:162
-- unsupported macro: INT64_MAX (__INT64_C(9223372036854775807))
UINT8_MAX : constant := (255); -- stdint.h:166
UINT16_MAX : constant := (65535); -- stdint.h:167
UINT32_MAX : constant := (4294967295); -- stdint.h:168
-- unsupported macro: UINT64_MAX (__UINT64_C(18446744073709551615))
INT_LEAST8_MIN : constant := (-128); -- stdint.h:173
INT_LEAST16_MIN : constant := (-32767-1); -- stdint.h:174
INT_LEAST32_MIN : constant := (-2147483647-1); -- stdint.h:175
-- unsupported macro: INT_LEAST64_MIN (-__INT64_C(9223372036854775807)-1)
INT_LEAST8_MAX : constant := (127); -- stdint.h:178
INT_LEAST16_MAX : constant := (32767); -- stdint.h:179
INT_LEAST32_MAX : constant := (2147483647); -- stdint.h:180
-- unsupported macro: INT_LEAST64_MAX (__INT64_C(9223372036854775807))
UINT_LEAST8_MAX : constant := (255); -- stdint.h:184
UINT_LEAST16_MAX : constant := (65535); -- stdint.h:185
UINT_LEAST32_MAX : constant := (4294967295); -- stdint.h:186
-- unsupported macro: UINT_LEAST64_MAX (__UINT64_C(18446744073709551615))
INT_FAST8_MIN : constant := (-128); -- stdint.h:191
INT_FAST16_MIN : constant := (-9223372036854775807-1); -- stdint.h:193
INT_FAST32_MIN : constant := (-9223372036854775807-1); -- stdint.h:194
-- unsupported macro: INT_FAST64_MIN (-__INT64_C(9223372036854775807)-1)
INT_FAST8_MAX : constant := (127); -- stdint.h:201
INT_FAST16_MAX : constant := (9223372036854775807); -- stdint.h:203
INT_FAST32_MAX : constant := (9223372036854775807); -- stdint.h:204
-- unsupported macro: INT_FAST64_MAX (__INT64_C(9223372036854775807))
UINT_FAST8_MAX : constant := (255); -- stdint.h:212
UINT_FAST16_MAX : constant := (18446744073709551615); -- stdint.h:214
UINT_FAST32_MAX : constant := (18446744073709551615); -- stdint.h:215
-- unsupported macro: UINT_FAST64_MAX (__UINT64_C(18446744073709551615))
INTPTR_MIN : constant := (-9223372036854775807-1); -- stdint.h:225
INTPTR_MAX : constant := (9223372036854775807); -- stdint.h:226
UINTPTR_MAX : constant := (18446744073709551615); -- stdint.h:227
-- unsupported macro: INTMAX_MIN (-__INT64_C(9223372036854775807)-1)
-- unsupported macro: INTMAX_MAX (__INT64_C(9223372036854775807))
-- unsupported macro: UINTMAX_MAX (__UINT64_C(18446744073709551615))
PTRDIFF_MIN : constant := (-9223372036854775807-1); -- stdint.h:248
PTRDIFF_MAX : constant := (9223372036854775807); -- stdint.h:249
SIG_ATOMIC_MIN : constant := (-2147483647-1); -- stdint.h:256
SIG_ATOMIC_MAX : constant := (2147483647); -- stdint.h:257
SIZE_MAX : constant := (18446744073709551615); -- stdint.h:261
-- unsupported macro: WCHAR_MIN __WCHAR_MIN
-- unsupported macro: WCHAR_MAX __WCHAR_MAX
WINT_MIN : constant := (0); -- stdint.h:278
WINT_MAX : constant := (4294967295); -- stdint.h:279
-- arg-macro: procedure INT8_C c
-- c
-- arg-macro: procedure INT16_C c
-- c
-- arg-macro: procedure INT32_C c
-- c
-- unsupported macro: INT64_C(c) c ## L
-- arg-macro: procedure UINT8_C c
-- c
-- arg-macro: procedure UINT16_C c
-- c
-- unsupported macro: UINT32_C(c) c ## U
-- unsupported macro: UINT64_C(c) c ## UL
-- unsupported macro: INTMAX_C(c) c ## L
-- unsupported macro: UINTMAX_C(c) c ## UL
-- Copyright (C) 1997-2016 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>.
-- * ISO C99: 7.18 Integer types <stdint.h>
--
-- Exact integral types.
-- Signed.
-- There is some amount of overlap with <sys/types.h> as known by inet code
-- Unsigned.
subtype uint8_t is unsigned_char; -- stdint.h:48
subtype uint16_t is unsigned_short; -- stdint.h:49
subtype uint32_t is unsigned; -- stdint.h:51
subtype uint64_t is unsigned_long; -- stdint.h:55
-- Small types.
-- Signed.
subtype int_least8_t is signed_char; -- stdint.h:65
subtype int_least16_t is short; -- stdint.h:66
subtype int_least32_t is int; -- stdint.h:67
subtype int_least64_t is long; -- stdint.h:69
-- Unsigned.
subtype uint_least8_t is unsigned_char; -- stdint.h:76
subtype uint_least16_t is unsigned_short; -- stdint.h:77
subtype uint_least32_t is unsigned; -- stdint.h:78
subtype uint_least64_t is unsigned_long; -- stdint.h:80
-- Fast types.
-- Signed.
subtype int_fast8_t is signed_char; -- stdint.h:90
subtype int_fast16_t is long; -- stdint.h:92
subtype int_fast32_t is long; -- stdint.h:93
subtype int_fast64_t is long; -- stdint.h:94
-- Unsigned.
subtype uint_fast8_t is unsigned_char; -- stdint.h:103
subtype uint_fast16_t is unsigned_long; -- stdint.h:105
subtype uint_fast32_t is unsigned_long; -- stdint.h:106
subtype uint_fast64_t is unsigned_long; -- stdint.h:107
-- Types for `void *' pointers.
subtype uintptr_t is unsigned_long; -- stdint.h:122
-- Largest integral types.
subtype intmax_t is long; -- stdint.h:134
subtype uintmax_t is unsigned_long; -- stdint.h:135
-- Limits of integral types.
-- Minimum of signed integral types.
-- Maximum of signed integral types.
-- Maximum of unsigned integral types.
-- Minimum of signed integral types having a minimum size.
-- Maximum of signed integral types having a minimum size.
-- Maximum of unsigned integral types having a minimum size.
-- Minimum of fast signed integral types having a minimum size.
-- Maximum of fast signed integral types having a minimum size.
-- Maximum of fast unsigned integral types having a minimum size.
-- Values to test for integral types holding `void *' pointer.
-- Minimum for largest signed integral type.
-- Maximum for largest signed integral type.
-- Maximum for largest unsigned integral type.
-- Limits of other integer types.
-- Limits of `ptrdiff_t' type.
-- Limits of `sig_atomic_t'.
-- Limit of `size_t' type.
-- Limits of `wchar_t'.
-- These constants might also be defined in <wchar.h>.
-- Limits of `wint_t'.
-- Signed.
-- Unsigned.
-- Maximal type.
end CUPS.stdint_h;
|
--===========================================================================
--
-- This package defines the two 5x7 matrix elements used for the WORD
-- sized display capability
--
--===========================================================================
-- Copyright 2021 (C) Holger Rodriguez
--
-- SPDX-License-Identifier: BSD-3-Clause
--
with HAL; use HAL;
with HAL.I2C;
with ItsyBitsy;
with Hex_2Digits_Display;
package Matrix_Area_Word is
--------------------------------------------------------------------------
-- Byte 0: this display is in the right side of the two displays
-- represents the lower byte of the word
--------------------------------------------------------------------------
Byte_0_I2C : HAL.I2C.Any_I2C_Port := ItsyBitsy.I2C'Access;
Byte_0_Address : HAL.I2C.I2C_Address := 16#61# * 2;
package Byte_0 is new
Hex_2Digits_Display (Byte_0_I2C, Byte_0_Address);
--------------------------------------------------------------------------
-- Byte 1: this display is in the left side of the two displays
-- represents the higher byte of the word
--------------------------------------------------------------------------
Byte_1_I2C : HAL.I2C.Any_I2C_Port := ItsyBitsy.I2C'Access;
Byte_1_Address : HAL.I2C.I2C_Address := 16#62# * 2;
package Byte_1 is new
Hex_2Digits_Display (Byte_1_I2C, Byte_1_Address);
--------------------------------------------------------------------------
-- Initializes the Word Matrix Block
-- Must be called before anything else regarding the matrix.
--------------------------------------------------------------------------
procedure Initialize;
end Matrix_Area_Word;
|
procedure Main is
-- This procedure is using top-notch algorithms to calculate info.
-- It will perform a complex calculation (out of this exercice scope),
-- using data you provide, to update a state register.
-- Your job is to declare the data and set it to the right value, at the
-- right time.
-- QUESTION 1
--
-- Declare Running_Calculation of type Boolean, set to False
Running_Calculation : Boolean := False;
-- Declare Active_Processors, a Positive set to 1
Active_Processors : Positive := 1;
-- Declare All_Active_Processors, set to the value of Active_Processors
All_Active_Processors : Positive := Active_Processors;
-- Declare Distance_Meters, a Float with a value of 2
Distance_Meters : Float := 2.0;
-- Declare Body_Weight_Kg, a *named number* with a value of 2.5 x 10^3
Body_Weigth_Kg : constant := 2.5E+3;
-- Declare State_Register, a Natural with a binary value of 1 0101 1010
State_Register : Natural := 2#1_0101_1010#;
begin
-- QUESTION 2 - Part A
--
-- Create a declarative block named Calculate.
--
-- In it declare a new variable Active_Processors, set it to 10
--
-- In Calculate body:
--
-- Set Running_Calculation to True
--
-- At this point your code should compile and run properly.
--
-- QUESTION 2 - Part B
--
-- Set All_Active_Processors to the sum of
-- * the local Active_Processor
-- * and Main.Active_Processor
--
-- QUESTION 2 - Part C
--
-- Use name qualifiers for both to override name hiding.
Calculate : declare
Active_Processors : Positive := 10;
begin
Running_Calculation := True;
All_Active_Processors
:= Main.Active_Processors + Calculate.Active_Processors;
end Calculate;
-- QUESTION 3 - Quiz
--
-- After Calculate, what is the value of Running_Calculation?
-- True
-- What is the value of All_Active_Processors?
-- 11
-- What is the value of Active_Processors?
-- 1
--
-- QUESTION 3 - Part B
--
-- Update them to reflect the fact that we stopped calculating
-- and are now using only one processor.
Running_Calculation := False;
All_Active_Processors := Active_Processors;
end Main;
|
with Common_Formal_Containers; use Common_Formal_Containers;
package AFRL.CMASI.AutomationRequest.SPARK_Boundary with SPARK_Mode is
pragma Annotate (GNATprove, Terminating, SPARK_Boundary);
function Get_EntityList
(Request : AutomationRequest) return Int64_Vect
with Global => null;
function Get_OperatingRegion
(Request : AutomationRequest) return Int64
with Global => null;
function Get_TaskList
(Request : AutomationRequest) return Int64_Vect
with Global => null;
end AFRL.CMASI.AutomationRequest.SPARK_Boundary;
|
--------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
with Ada.Finalization; use Ada.Finalization;
package body SDL.Video.Palettes is
-- function Element_Value (Container : in Palette_array; Pos : in Palette_Cursor) return Colour is
-- begin
-- return Pos.Current.all;
-- end Element_Value;
-- function Has_Element (Pos : in Palette_Cursor) return Boolean is
-- begin
-- -- if Pos.Index < Positive (Pos.Container.Internal.Total) then
-- if Pos.Index < Pos.Total then
-- return True;
-- end if;
-- return False;
-- end Has_Element;
-- function Iterate (Container : not null access Palette_Array) return Palette_Iterators'Class is
-- begin
-- return It : constant Palette_Iterators := Palette_Iterators'(Container => Palette_Access (Container)) do
-- null;
-- end return;
-- end Iterate;
-- function First (Object : in Palette_Iterators) return Palette_Cursor is
-- begin
-- return Palette_Cursor'
-- (-- Container => Object.Internal,
-- Index => Positive'First,
-- Total => Positive (Object.Container.Internal.Total),
-- Current => Object.Container.Internal.Colours);
-- end First;
-- function Next (Object : in Palette_Iterators; Position : in Palette_Cursor) return Palette_Cursor is
-- Curr : Colour_Array_Pointer.Pointer := Position.Current;
-- begin
-- Colour_Array_Pointer.Increment (Curr);
-- return Palette_Cursor'
-- (-- Container => Object.Internal,
-- Index => Position.Index + 1,
-- Total => Position.Total,
-- Current => Curr);
-- end Next;
type Iterator (Container : access constant Palette'Class) is new Limited_Controlled and
Palette_Iterator_Interfaces.Forward_Iterator with
record
Index : Natural;
end record;
overriding
function First (Object : Iterator) return Cursor;
overriding
function Next (Object : Iterator; Position : Cursor) return Cursor;
function Element (Position : in Cursor) return Colour is
begin
-- return Position.Container.Data.Colours (Position.Index);
return Colour_Array_Pointer.Value (Position.Current) (0);
end Element;
function Has_Element (Position : in Cursor) return Boolean is
begin
return Position.Index <= Natural (Position.Container.Data.Total);
end Has_Element;
function Constant_Reference
(Container : aliased Palette;
Position : Cursor) return Colour is
begin
-- Put_Line ("Constant_Reference" & Natural'Image (Position.Index));
-- return Position.Container.Data.Colours (Position.Index);
return Colour_Array_Pointer.Value (Position.Current) (0);
end Constant_Reference;
function Iterate (Container : Palette) return
Palette_Iterator_Interfaces.Forward_Iterator'Class is
begin
-- Put_Line ("Iterate");
return It : constant Iterator :=
(Limited_Controlled with
Container => Container'Access, Index => Natural'First + 1)
do
-- Put_Line (" index = " & Natural'Image(It.Index));
null;
end return;
end Iterate;
function Create (Total_Colours : in Positive) return Palette is
function SDL_Alloc_Palette (Ncolors : in C.int) return Internal_Palette_Access with
Import => True,
Convention => C,
External_Name => "SDL_AllocPalette";
begin
return P : constant Palette :=
(Data => SDL_Alloc_Palette (C.int (Total_Colours)))
do
null;
end return;
end Create;
procedure Free (Container : in out Palette) is
procedure SDL_Free_Palette (Self : in Internal_Palette_Access) with
Import => True,
Convention => C,
External_Name => "SDL_FreePalette";
begin
SDL_Free_Palette (Container.Data);
Container.Data := null;
end Free;
overriding
function First (Object : Iterator) return Cursor is
begin
-- Put_Line ("First -> Index = " & Natural'Image (Object.Index));
return Cursor'(Container => Object.Container,
Index => Object.Index,
Current => Object.Container.Data.Colours);
end First;
overriding
function Next (Object : Iterator; Position : Cursor) return Cursor is
Next_Ptr : Colour_Array_Pointer.Pointer := Position.Current;
begin
Colour_Array_Pointer.Increment (Next_Ptr);
-- Put_Line ("Next");
-- if Object.Container /= Position.Container then
-- raise Program_Error with "Wrong containers";
-- end if;
return Cursor'(Container => Object.Container,
Index => Position.Index + 1,
Current => Next_Ptr);
end Next;
end SDL.Video.Palettes;
|
-----------------------------------------------------------------------
-- Print_User -- Example to find an object from the database
-- Copyright (C) 2010, 2011, 2018 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ADO;
with ADO.Drivers;
with ADO.Configs;
with ADO.Sessions;
with ADO.Connections;
with ADO.SQL;
with ADO.Sessions.Factory;
with Samples.User.Model;
with Util.Log.Loggers;
with Ada.Text_IO;
with Ada.Exceptions;
with Ada.Command_Line;
procedure Print_User is
use ADO;
use Samples.User.Model;
Factory : ADO.Sessions.Factory.Session_Factory;
begin
Util.Log.Loggers.Initialize ("samples.properties");
-- Initialize the database drivers.
ADO.Drivers.Initialize ("samples.properties");
if Ada.Command_Line.Argument_Count < 1 then
Ada.Text_IO.Put_Line ("Usage: print_user user-name ...");
Ada.Text_IO.Put_Line ("Example: print_user joe");
Ada.Command_Line.Set_Exit_Status (2);
return;
end if;
-- Create and configure the connection pool
Factory.Create (ADO.Configs.Get_Config ("ado.database"));
declare
Session : ADO.Sessions.Session := Factory.Get_Session;
User : User_Ref;
Found : Boolean;
begin
for I in 1 .. Ada.Command_Line.Argument_Count loop
declare
User_Name : constant String := Ada.Command_Line.Argument (I);
Query : ADO.SQL.Query;
begin
Ada.Text_IO.Put_Line ("Searching '" & User_Name & "'...");
Query.Bind_Param (1, User_Name);
Query.Set_Filter ("name = ?");
User.Find (Session => Session, Query => Query, Found => Found);
if Found then
Ada.Text_IO.Put_Line (" Id : " & Identifier'Image (User.Get_Id));
Ada.Text_IO.Put_Line (" User : " & User.Get_Name);
Ada.Text_IO.Put_Line (" Email : " & User.Get_Email);
else
Ada.Text_IO.Put_Line (" User '" & User_Name & "' does not exist");
end if;
end;
end loop;
end;
exception
when E : ADO.Connections.Database_Error | ADO.Sessions.Connection_Error =>
Ada.Text_IO.Put_Line ("Cannot connect to database: "
& Ada.Exceptions.Exception_Message (E));
end Print_User;
|
-------------------------------------------------------------------------------
-- --
-- Wee Noise Maker --
-- --
-- Copyright (C) 2016-2017 Fabien Chouteau --
-- --
-- Wee Noise Maker 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. --
-- --
-- Wee Noise Maker 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 We Noise Maker. If not, see <http://www.gnu.org/licenses/>. --
-- --
-------------------------------------------------------------------------------
with STM32.Device; use STM32.Device;
with STM32.GPIO; use STM32.GPIO;
with HAL; use HAL;
with STM32.I2S; use STM32.I2S;
with STM32.Timers; use STM32.Timers;
with STM32.PWM; use STM32.PWM;
with SGTL5000; use SGTL5000;
with Ravenscar_Time; use Ravenscar_Time;
with HAL.Audio; use HAL.Audio;
with STM32.DMA; use STM32.DMA;
with Double_Buffers_Interrupts; use Double_Buffers_Interrupts;
with System; use System;
with Ada.Synchronous_Task_Control;
with Ada.Interrupts.Names;
with Quick_Synth;
with WNM.I2C;
package body WNM.Audio_DAC is
type Stereo_Buffer_Access is access all Quick_Synth.Stereo_Buffer;
Task_Start : Ada.Synchronous_Task_Control.Suspension_Object;
DAC_Dev : SGTL5000.SGTL5000_DAC (Port => WNM.I2C.Port,
Time => Ravenscar_Time.Delays);
-----------
-- Audio --
-----------
Audio_I2S_Points : constant GPIO_Points (1 .. 4) := (PA15, PB3, PB5, PC7);
Audio_I2S_Points_Ext : GPIO_Point renames PB4;
Audio_I2S_TX : I2S_Port renames I2S_3;
Audio_I2S_RX : I2S_Port renames I2S_3_Ext;
---------------
-- Audio DMA --
---------------
Audio_TX_DMA : STM32.DMA.DMA_Controller renames DMA_1;
Audio_TX_DMA_Chan : STM32.DMA.DMA_Channel_Selector renames STM32.DMA.Channel_0;
Audio_TX_DMA_Stream : STM32.DMA.DMA_Stream_Selector renames STM32.DMA.Stream_5;
Audio_TX_DMA_Int : DMA_Interrupt_Controller (Audio_TX_DMA'Access,
Audio_TX_DMA_Stream,
Ada.Interrupts.Names.DMA1_Stream5_Interrupt);
Audio_RX_DMA : STM32.DMA.DMA_Controller renames DMA_1;
Audio_RX_DMA_Chan : STM32.DMA.DMA_Channel_Selector renames STM32.DMA.Channel_2;
Audio_RX_DMA_Stream : STM32.DMA.DMA_Stream_Selector renames STM32.DMA.Stream_2;
Audio_RX_DMA_Int : DMA_Interrupt_Controller (Audio_RX_DMA'Access,
Audio_RX_DMA_Stream,
Ada.Interrupts.Names.DMA1_Stream2_Interrupt);
-- Buffers --
TX0 : constant Stereo_Buffer_Access := new Quick_Synth.Stereo_Buffer;
TX1 : constant Stereo_Buffer_Access := new Quick_Synth.Stereo_Buffer;
RX0 : constant Stereo_Buffer_Access := new Quick_Synth.Stereo_Buffer;
RX1 : constant Stereo_Buffer_Access := new Quick_Synth.Stereo_Buffer;
----------
-- MCLK --
----------
MCLK_Timer : STM32.Timers.Timer renames Timer_8;
MCLK_Timer_AF : constant STM32.GPIO_Alternate_Function := GPIO_AF_TIM8_3;
-- Note that this value MUST match the corresponding timer selected!
Output_Channel : constant Timer_Channel := Channel_2; -- arbitrary
MCLK_Requested_Frequency : constant Hertz := 12_000_000; -- arbitrary
MCLK_Control : PWM_Modulator;
MCLK_Point : GPIO_Point renames PC7;
procedure Initialize;
procedure Initialize_DMA;
procedure Initialize_I2S;
procedure Initialize_MCLK with Unreferenced;
--------------------
-- Initialize_I2S --
--------------------
procedure Initialize_I2S is
procedure Initialize_GPIO;
---------------------
-- Initialize_GPIO --
---------------------
procedure Initialize_GPIO is
begin
-- I2S --
Enable_Clock (Audio_I2S_Points);
Configure_IO (Audio_I2S_Points,
(Speed => Speed_High,
Mode => Mode_AF,
Output_Type => Push_Pull,
Resistors => Floating));
Configure_Alternate_Function (Audio_I2S_Points,
STM32.Device.GPIO_AF_SPI3_6);
Enable_Clock (Audio_I2S_Points_Ext);
Configure_IO (Audio_I2S_Points_Ext,
(Speed => Speed_High,
Mode => Mode_AF,
Output_Type => Push_Pull,
Resistors => Floating));
Configure_Alternate_Function (Audio_I2S_Points_Ext,
STM32.Device.GPIO_AF_I2S3ext_7);
end Initialize_GPIO;
Conf : I2S_Configuration;
begin
Initialize_GPIO;
-- | Sample Freq | PLL N | PLL R |
-- | 8000 | 256 | 5 |
-- | 16000 | 213 | 2 |
-- | 32000 | 213 | 2 |
-- | 48000 | 258 | 3 |
-- | 96000 | 344 | 2 |
-- | 22050 | 429 | 4 |
-- | 44100 | 271 | 2 |
Set_PLLI2S_Factors (Pll_N => 213,
Pll_R => 2);
Enable_PLLI2S;
-- I2S TX --
Enable_Clock (Audio_I2S_TX);
Conf.Mode := Master_Transmit;
Conf.Standard := I2S_Philips_Standard;
Conf.Clock_Polarity := Steady_State_Low;
Conf.Data_Length := Data_16bits;
Conf.Chan_Length := Channel_16bits;
Conf.Master_Clock_Out_Enabled := True;
Conf.Transmit_DMA_Enabled := True;
Conf.Receive_DMA_Enabled := False;
Audio_I2S_TX.Configure (Conf);
Audio_I2S_TX.Set_Frequency (Audio_Freq_32kHz);
-- I2S RX --
Enable_Clock (Audio_I2S_RX);
Conf.Mode := Slave_Receive;
Conf.Master_Clock_Out_Enabled := False;
Conf.Transmit_DMA_Enabled := False;
Conf.Receive_DMA_Enabled := True;
Audio_I2S_RX.Configure (Conf);
Audio_I2S_RX.Set_Frequency (Audio_Freq_32kHz);
Audio_I2S_TX.Enable;
Audio_I2S_RX.Enable;
end Initialize_I2S;
--------------------
-- Initialize_DMA --
--------------------
procedure Initialize_DMA is
Config : DMA_Stream_Configuration;
begin
-- TX DMA --
Enable_Clock (Audio_TX_DMA);
Config.Channel := Audio_TX_DMA_Chan;
Config.Direction := Memory_To_Peripheral;
Config.Increment_Peripheral_Address := False;
Config.Increment_Memory_Address := True;
Config.Peripheral_Data_Format := HalfWords;
Config.Memory_Data_Format := HalfWords;
Config.Operation_Mode := Circular_Mode;
Config.Priority := Priority_Very_High;
Config.FIFO_Enabled := False;
Config.FIFO_Threshold := FIFO_Threshold_Full_Configuration;
Config.Memory_Burst_Size := Memory_Burst_Single;
Config.Peripheral_Burst_Size := Peripheral_Burst_Single;
Configure (Audio_TX_DMA, Audio_TX_DMA_Stream, Config);
-- RX DMA --
Enable_Clock (Audio_RX_DMA);
Config.Channel := Audio_RX_DMA_Chan;
Config.Direction := Peripheral_To_Memory;
Configure (Audio_RX_DMA, Audio_RX_DMA_Stream, Config);
end Initialize_DMA;
---------------------
-- Initialize_MCLK --
---------------------
procedure Initialize_MCLK is
begin
-- The STM32F4 is capable of generating the MCLK for the SGTL5000 DAC.
-- However, we need the MCLK to be always enabled to be able to
-- communicate with the DAC even when we are not sending audio data so
-- we use a timer to generate the MCLK signal.
Configure_PWM_Timer (MCLK_Timer'Access, MCLK_Requested_Frequency);
MCLK_Control.Attach_PWM_Channel
(MCLK_Timer'Access,
Output_Channel,
MCLK_Point,
MCLK_Timer_AF);
MCLK_Control.Set_Duty_Cycle (50);
MCLK_Control.Enable_Output;
end Initialize_MCLK;
----------------
-- Initialize --
----------------
procedure Initialize is
begin
Initialize_DMA;
-- Initialize_MCLK;
Initialize_I2S;
Ada.Synchronous_Task_Control.Set_True (Task_Start);
delay until Clock + Milliseconds (500);
if not DAC_Dev.Valid_Id then
raise Program_Error with "Cannot get DAC chip ID";
end if;
DAC_Dev.Set_Analog_Power (Reftop_PowerUp => True);
DAC_Dev.Set_Linereg_Control (Charge_Pump_Src_Override => True,
Charge_Pump_Src => VDDIO,
Linereg_Out_Voltage => 16#C#);
DAC_Dev.Set_Reference_Control (VAG => 16#1F#,
Bias => 16#1#,
Slow_VAG_Ramp => False);
DAC_Dev.Set_Short_Detectors (Right_HP => 4,
Left_HP => 4,
Center_HP => 4,
Mode_LR => 1,
Mode_CM => 2);
DAC_Dev.Mute_Headphones (True);
DAC_Dev.Mute_DAC (True);
DAC_Dev.Mute_ADC (True);
DAC_Dev.Set_Analog_Power (VAG_PowerUp => True,
Reftop_PowerUp => True,
Headphone_PowerUp => True,
DAC_PowerUp => True,
Capless_Headphone_PowerUp => True,
ADC_PowerUp => True);
DAC_Dev.Set_Power_Control (ADC => On,
DAC => On,
DAP => Off,
I2S_Out => On,
I2S_In => On);
DAC_Dev.Time.Delay_Microseconds (400);
DAC_Dev.Set_Clock_Control (Rate => SYS_FS,
FS => SYS_FS_32kHz,
MCLK => MCLK_256FS);
DAC_Dev.Set_I2S_Control (SCLKFREQ => SCLKFREQ_32FS,
Invert_SCLK => False,
Master_Mode => False,
Data_Len => Data_16b,
I2S => I2S_Left_Justified,
LR_Align => False,
LR_Polarity => False);
-- DAC Routing
DAC_Dev.Select_DAC_Source (I2S_In);
DAC_Dev.Select_HP_Source (DAC, True);
-- ADC Routing
DAC_Dev.Select_ADC_Source (Line_In, True);
DAC_Dev.Select_I2S_Out_Source (ADC);
-- +0db
DAC_Dev.Set_DAC_Volume (16#3C#, 16#3C#);
-- +0db
DAC_Dev.Set_ADC_Volume (16#0#, 16#0#, Minus_6db => False);
DAC_Dev.Set_Headphones_Volume (16#70#, 16#70#);
-- Unmute
DAC_Dev.Mute_DAC (False);
DAC_Dev.Mute_ADC (False);
DAC_Dev.Mute_Headphones (False);
-- Mute
DAC_Dev.Mute_Line_Out (True);
end Initialize;
----------------
-- I2S_Stream --
----------------
task I2S_Stream is
pragma Priority (DAC_Task_Priority);
end I2S_Stream;
task body I2S_Stream is
Unused_TX : Stereo_Buffer_Access;
Unused_RX : Stereo_Buffer_Access;
begin
Ada.Synchronous_Task_Control.Suspend_Until_True (Task_Start);
Audio_TX_DMA_Int.Start_Mem_To_Periph (Audio_I2S_TX.Data_Register_Address,
TX0.all'Address,
TX1.all'Address,
Stereo_Buffer_Size_In_Bytes / 2);
Audio_RX_DMA_Int.Start_Periph_To_Mem (Audio_I2S_RX.Data_Register_Address,
RX0.all'Address,
RX1.all'Address,
Stereo_Buffer_Size_In_Bytes / 2);
loop
Audio_TX_DMA_Int.Wait_For_Interrupt;
if Audio_TX_DMA_Int.Not_In_Transfer = TX0.all'Address then
Unused_TX := TX0;
else
Unused_TX := TX1;
end if;
if Audio_RX_DMA_Int.Not_In_Transfer = RX0.all'Address then
Unused_RX := RX0;
else
Unused_RX := RX1;
end if;
Quick_Synth.Fill (Unused_RX.all, Unused_TX.all);
end loop;
end I2S_Stream;
----------------
-- Set_Volume --
----------------
procedure Set_Volume (Volume : DAC_Volume) is
HP_Vol : HP_Volume;
begin
HP_Vol := HP_Volume'Last - UInt7 (Volume);
DAC_Dev.Set_Headphones_Volume (HP_Vol, HP_Vol);
end Set_Volume;
----------------
-- Power_Down --
----------------
procedure Power_Down is
begin
DAC_Dev.Set_Analog_Power (VAG_PowerUp => False,
Reftop_PowerUp => False,
Headphone_PowerUp => False,
DAC_PowerUp => False,
Capless_Headphone_PowerUp => False,
ADC_PowerUp => False);
DAC_Dev.Set_Power_Control (ADC => Off,
DAC => Off,
DAP => Off,
I2S_Out => Off,
I2S_In => Off);
end Power_Down;
begin
Initialize;
end WNM.Audio_DAC;
|
-- $Header: /dc/uc/self/arcadia/ayacc/src/RCS/actions_file_body.a,v 1.2 1993/05/31 22:36:35 self Exp self $
-- $Header: /dc/uc/self/arcadia/ayacc/src/RCS/actions_file_body.a,v 1.2 1993/05/31 22:36:35 self Exp self $
-- Copyright (c) 1990 Regents of the University of California.
-- All rights reserved.
--
-- The primary authors of ayacc were David Taback and Deepak Tolani.
-- Enhancements were made by Ronald J. Schmalz.
--
-- Send requests for ayacc information to ayacc-info@ics.uci.edu
-- Send bug reports for ayacc to ayacc-bugs@ics.uci.edu
--
-- Redistribution and use in source and binary forms are permitted
-- provided that the above copyright notice and this paragraph are
-- duplicated in all such forms and that any documentation,
-- advertising materials, and other materials related to such
-- distribution and use acknowledge that the software was developed
-- by the University of California, Irvine. The name of the
-- University may not be used to endorse or promote products derived
-- from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-- Module : actions_file_body.ada
-- Component of : ayacc
-- Version : 1.2
-- Date : 11/21/86 12:28:04
-- SCCS File : disk21~/rschm/hasee/sccs/ayacc/sccs/sxactions_file_body.ada
-- $Header: /dc/uc/self/arcadia/ayacc/src/RCS/actions_file_body.a,v 1.2 1993/05/31 22:36:35 self Exp self $
-- $Log: actions_file_body.a,v $
-- Revision 1.2 1993/05/31 22:36:35 self
-- added exception handler when opening files
--
-- Revision 1.1 1993/05/31 22:13:57 self
-- Initial revision
--
--Revision 1.1 88/08/08 14:54:53 arcadia
--Initial revision
--
--Revision 1.1 88/08/08 12:04:56 arcadia
--Initial revision
--Revision 0.1 86/04/01 15:29:59 ada
-- This version fixes some minor bugs with empty grammars
-- and $$ expansion. It also uses vads5.1b enhancements
-- such as pragma inline.
--
with Ayacc_File_Names;
use Ayacc_File_Names;
package body Actions_File is
SCCS_ID : constant String := "@(#) actions_file_body.ada, Version 1.2";
-- The maximum length of the text that an action can expand into.
Maximum_Action_Length : constant Count := 1000;
The_File : File_Type;
procedure Open(Mode: in File_Mode) is
begin
if Mode = Read_File then
Open(The_File, In_File, Get_Actions_File_Name);
else
Create(The_File, Out_File, Get_Actions_File_Name);
--RJS Set_Line_Length(The_File, To => Maximum_Action_Length);
end if;
exception
when Name_Error | Use_Error =>
Put_Line("Ayacc: Error Opening """ & Get_Actions_File_Name & """.");
raise;
end Open;
procedure Close is
begin
Close(The_File);
end Close;
procedure Delete is
begin
Delete(The_File);
end Delete;
procedure Read_Line(S: out String; Last: out Natural) is
begin
Get_Line(The_File, S, Last);
end;
procedure Write(S: in String) is
begin
Put(The_File, S);
end;
procedure Write(C: in Character) is
begin
Put(The_File, C);
end;
procedure Writeln is
begin
New_Line(The_File);
end;
function Is_End_of_File return Boolean is
begin
return End_of_File(The_File);
end Is_End_of_File;
procedure Initialize is
begin
Open(Write_File);
end Initialize;
procedure Finish is
begin
Close;
end Finish;
end Actions_File;
|
-----------------------------------------------------------------------
-- keystore-io-refs -- IO stream reference holder
-- Copyright (C) 2019, 2020 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
package body Keystore.IO.Refs is
use type Util.Concurrent.Counters.Counter_Access;
function Create (Stream : in Wallet_Stream_Access) return Stream_Ref is
begin
return Result : Stream_Ref do
Result.Stream := Stream;
Result.Counter := new Util.Concurrent.Counters.Counter;
Util.Concurrent.Counters.Increment (Result.Counter.all);
end return;
end Create;
function Value (Object : in Stream_Ref) return Wallet_Stream_Access is
begin
return Object.Stream;
end Value;
procedure Free is
new Ada.Unchecked_Deallocation (Object => Util.Concurrent.Counters.Counter,
Name => Util.Concurrent.Counters.Counter_Access);
procedure Free is
new Ada.Unchecked_Deallocation (Object => IO.Wallet_Stream'Class,
Name => IO.Wallet_Stream_Access);
overriding
procedure Finalize (Object : in out Stream_Ref) is
Release : Boolean;
begin
if Object.Counter /= null then
Util.Concurrent.Counters.Decrement (Object.Counter.all, Release);
if Release then
Object.Stream.Close;
Free (Object.Stream);
Free (Object.Counter);
else
Object.Stream := null;
Object.Counter := null;
end if;
end if;
end Finalize;
overriding
procedure Adjust (Object : in out Stream_Ref) is
begin
if Object.Counter /= null then
Util.Concurrent.Counters.Increment (Object.Counter.all);
end if;
end Adjust;
end Keystore.IO.Refs;
|
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired)
--
-- Copyright William A. Whitaker (1936–2010)
--
-- This is a free program, which means it is proper to copy it and pass
-- it on to your friends. Consider it a developmental item for which
-- there is no charge. However, just for form, it is Copyrighted
-- (c). Permission is hereby freely given for any and all use of program
-- and data. You can sell it as your own, but at least tell me.
--
-- This version is distributed without obligation, but the developer
-- would appreciate comments and suggestions.
--
-- All parts of the WORDS system, source code and data files, are made freely
-- available to anyone who wishes to use them, for whatever purpose.
with Text_IO; use Text_IO;
with Latin_Utils.Strings_Package; use Latin_Utils.Strings_Package;
procedure Page2htm is
Line : String (1 .. 300) := (others => ' ');
Last : Integer := 0;
Input, Output : File_Type;
begin
Put_Line ("DICTPAGE.RAW (sorted) -> DICTPAGE.HTM");
Put_Line ("For use in preparing a DICTPAGE.HTM after" &
" running DICTPAGE and sorting.");
Open (Input, In_File, "DICTPAGE.RAW");
Create (Output, Out_File, "DICTPAGE.HTM");
while not End_Of_File (Input) loop
Get_Line (Input, Line, Last);
if Line (1) /= '#' then
Put_Line ("BAD LINE >" & Line (1 .. Last));
end if;
for I in 1 .. Last loop
if Line (I) = '[' then
Put (Output, "<B>" & Line (2 .. I - 1) & "</B> ");
Put_Line (Output, Trim (Line (I .. I + 6) & "<BR>"));
end if;
if Line (I .. I + 1) = "::" then
Put_Line (Output, Trim (Line (I + 2 .. Last)) & "<BR>");
exit;
end if;
end loop; -- On LINE
end loop; -- On file
end Page2htm;
|
-----------------------------------------------------------------------
-- css-commands-list -- List command for CSS tools
-- Copyright (C) 2018, 2020 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Text_IO;
with Ada.Containers.Ordered_Sets;
with CSS.Core.Values;
with CSS.Core.Properties;
with CSS.Analysis.Rules.Main;
package body CSS.Commands.List is
-- The Value_Sets package represents a set of values all of
-- them being strictly different.
package Value_Sets is
new Ada.Containers.Ordered_Sets (Element_Type => CSS.Core.Values.Value_Type,
"<" => CSS.Core.Values."<",
"=" => CSS.Core.Values.Compare);
-- ------------------------------
-- Execute the command with the arguments.
-- ------------------------------
overriding
procedure Execute (Cmd : in out Command;
Name : in String;
Args : in Argument_List'Class;
Context : in out CSS.Commands.Context_Type) is
pragma Unreferenced (Cmd);
use type CSS.Core.Values.Value_Kind;
procedure Process (Pos : in CSS.Analysis.Classes.Cursor);
procedure Process_Value (Value : in CSS.Core.Values.Value_Type);
Console : constant CSS.Commands.Console_Access := Context.Console;
Expect : CSS.Core.Values.Value_Kind;
Column : Field_Type := F_VALUE_1;
Rule : CSS.Analysis.Rules.Rule_Type_Access;
Loc : CSS.Core.Location;
Values : Value_Sets.Set;
procedure Process (Pos : in CSS.Analysis.Classes.Cursor) is
begin
Ada.Text_IO.Put_Line (CSS.Analysis.Classes.Class_Maps.Key (Pos));
end Process;
procedure Process_Value (Value : in CSS.Core.Values.Value_Type) is
begin
if Column < F_VALUE_1 or Column > F_VALUE_4 then
if Column > F_VALUE_4 then
Console.End_Row;
end if;
Console.Start_Row;
Column := F_VALUE_1;
end if;
Console.Print_Field (Column, CSS.Core.Values.To_String (Value));
Column := Field_Type'Succ (Column);
end Process_Value;
procedure Report_Value (Value : in CSS.Core.Values.Value_Type) is
begin
if Column < F_VALUE_1 or Column > F_VALUE_4 then
if Column > F_VALUE_4 then
Console.End_Row;
end if;
Console.Start_Row;
Column := F_VALUE_1;
end if;
Console.Print_Field (Column, CSS.Core.Values.To_String (Value));
Column := Field_Type'Succ (Column);
end Report_Value;
procedure Process_Search (Prop : in CSS.Core.Properties.CSSProperty;
Match : in CSS.Analysis.Rules.Match_Result) is
begin
for M of Match.List loop
if CSS.Analysis.Rules.Is_Rule (M.Rule, Rule) then
for I in M.First .. M.Last loop
Values.Include (CSS.Core.Values.Get_Value (Prop.Value, I));
end loop;
end if;
end loop;
end Process_Search;
begin
CSS.Commands.Load (Args, Context);
if Name = "list" then
CSS.Analysis.Classes.Analyze (Context.Doc, Context.Class_Map, Context.Err_Handler);
Context.Class_Map.Iterate (Process'Access);
end if;
if Name = "list-colors" then
Values.Clear;
Rule := CSS.Analysis.Rules.Main.Rule_Repository.Create_Definition ("<color>", Loc);
Expect := CSS.Core.Values.VALUE_COLOR;
Console.Start_Title;
Console.Print_Title (F_VALUE_1, "", 20);
Console.Print_Title (F_VALUE_2, "", 20);
Console.Print_Title (F_VALUE_3, "", 20);
Console.Print_Title (F_VALUE_4, "", 20);
Console.End_Title;
CSS.Analysis.Rules.Main.Rule_Repository.Search (Context.Doc, Rule, Process_Search'Access);
for V of Values loop
Report_Value (V);
end loop;
end if;
if Name = "list-length" then
Values.Clear;
Rule := CSS.Analysis.Rules.Main.Rule_Repository.Create_Definition ("<length>", Loc);
Expect := CSS.Core.Values.VALUE_COLOR;
Console.Start_Title;
Console.Print_Title (F_VALUE_1, "", 20);
Console.Print_Title (F_VALUE_2, "", 20);
Console.Print_Title (F_VALUE_3, "", 20);
Console.Print_Title (F_VALUE_4, "", 20);
Console.End_Title;
CSS.Analysis.Rules.Main.Rule_Repository.Search (Context.Doc, Rule, Process_Search'Access);
for V of Values loop
Report_Value (V);
end loop;
end if;
end Execute;
-- ------------------------------
-- Write the help associated with the command.
-- ------------------------------
overriding
procedure Help (Cmd : in out Command;
Name : in String;
Context : in out CSS.Commands.Context_Type) is
pragma Unreferenced (Cmd, Name);
Console : constant CSS.Commands.Console_Access := Context.Console;
begin
Console.Notice (N_HELP, "list: list information about the CSS files");
end Help;
end CSS.Commands.List;
|
-----------------------------------------------------------------------
-- mat-expressions-parser_io -- Input IO for Lex parser
-- Copyright (C) 2014, 2015 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
package body MAT.Expressions.Parser_IO is
Input : Ada.Strings.Unbounded.Unbounded_String;
Pos : Natural := 0;
procedure Set_Input (Content : in String) is
begin
Input := Ada.Strings.Unbounded.To_Unbounded_String (Content);
Pos := 1;
MAT.Expressions.Lexer_dfa.yy_init := True;
MAT.Expressions.Lexer_dfa.yy_start := 0;
end Set_Input;
-- gets input and stuffs it into 'buf'. number of characters read, or YY_NULL,
-- is returned in 'result'.
procedure YY_INPUT (Buf : out unbounded_character_array;
Result : out Integer;
Max_Size : in Integer) is
I : Integer := 1;
Loc : Integer := Buf'First;
begin
while I <= Max_Size loop
if Pos > Ada.Strings.Unbounded.Length (Input) then
yy_eof_has_been_seen := True;
Result := I - 1;
return;
end if;
Buf (Loc) := Ada.Strings.Unbounded.Element (Input, Pos);
Pos := Pos + 1;
Loc := Loc + 1;
I := I + 1;
end loop;
Result := I - 1;
end YY_INPUT;
-- yy_get_next_buffer - try to read in new buffer
--
-- returns a code representing an action
-- EOB_ACT_LAST_MATCH -
-- EOB_ACT_RESTART_SCAN - restart the scanner
-- EOB_ACT_END_OF_FILE - end of file
function yy_get_next_buffer return eob_action_type is
dest : Integer := 0;
source : Integer := yytext_ptr - 1; -- copy prev. char, too
number_to_move : Integer;
ret_val : eob_action_type;
num_to_read : Integer;
begin
if yy_c_buf_p > yy_n_chars + 1 then
raise NULL_IN_INPUT;
end if;
-- try to read more data
-- first move last chars to start of buffer
number_to_move := yy_c_buf_p - yytext_ptr;
for i in 0 .. number_to_move - 1 loop
yy_ch_buf (dest) := yy_ch_buf (source);
dest := dest + 1;
source := source + 1;
end loop;
if yy_eof_has_been_seen then
-- don't do the read, it's not guaranteed to return an EOF,
-- just force an EOF
yy_n_chars := 0;
else
num_to_read := YY_BUF_SIZE - number_to_move - 1;
if num_to_read > YY_READ_BUF_SIZE then
num_to_read := YY_READ_BUF_SIZE;
end if;
-- read in more data
YY_INPUT (yy_ch_buf (number_to_move .. yy_ch_buf'Last), yy_n_chars, num_to_read);
end if;
if yy_n_chars = 0 then
if number_to_move = 1 then
ret_val := EOB_ACT_END_OF_FILE;
else
ret_val := EOB_ACT_LAST_MATCH;
end if;
yy_eof_has_been_seen := True;
else
ret_val := EOB_ACT_RESTART_SCAN;
end if;
yy_n_chars := yy_n_chars + number_to_move;
yy_ch_buf (yy_n_chars) := YY_END_OF_BUFFER_CHAR;
yy_ch_buf (yy_n_chars + 1) := YY_END_OF_BUFFER_CHAR;
-- yytext begins at the second character in
-- yy_ch_buf; the first character is the one which
-- preceded it before reading in the latest buffer;
-- it needs to be kept around in case it's a
-- newline, so yy_get_previous_state() will have
-- with '^' rules active
yytext_ptr := 1;
return ret_val;
end yy_get_next_buffer;
function Input_Line return Ada.Text_IO.Count is
begin
return 1;
end Input_Line;
-- default yywrap function - always treat EOF as an EOF
function yywrap return Boolean is
begin
return True;
end yywrap;
procedure Open_Input (Fname : in String) is
pragma Unreferenced (Fname);
begin
yy_init := True;
end Open_Input;
end MAT.Expressions.Parser_IO;
|
package kv.avm.Log is
Verbose : Boolean := False;
procedure Put(Str : String);
procedure Put_Line(Str : String);
procedure Log_If(Callback : access function return String);
procedure Put_Error(Str : String);
procedure New_Line(Count : Positive := 1);
function Get_Last_Log_Line return String;
function Get_Last_Error_Line return String;
end kv.avm.Log;
|
-----------------------------------------------------------------------
-- files.tests -- Unit tests for files
-- Copyright (C) 2011, 2012, 2013, 2014, 2017 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Util.Tests;
with Util.Log.Loggers;
with ASF.Principals;
with ASF.Tests;
with ASF.Responses.Mockup;
with AWA.Applications;
with AWA.Tests;
with AWA.Users.Modules;
with ADO.Sessions;
with ADO.SQL;
package body AWA.Tests.Helpers.Users is
use AWA.Users.Services;
use type AWA.Users.Principals.Principal_Access;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("AWA.Tests.Helpers.Users");
MAX_USERS : constant Positive := 10;
Logged_Users : array (1 .. MAX_USERS) of AWA.Users.Principals.Principal_Access;
procedure Free is
new Ada.Unchecked_Deallocation (Object => AWA.Users.Principals.Principal'Class,
Name => AWA.Users.Principals.Principal_Access);
-- ------------------------------
-- Initialize the service context.
-- ------------------------------
procedure Initialize (Principal : in out Test_User) is
begin
-- Setup the service context.
Principal.Context.Set_Context (AWA.Tests.Get_Application, null);
if Principal.Manager = null then
Principal.Manager := AWA.Users.Modules.Get_User_Manager;
if Principal.Manager = null then
Log.Error ("There is no User_Manager in the application.");
end if;
end if;
end Initialize;
-- ------------------------------
-- Create a test user associated with the given email address.
-- Get an open session for that user. If the user already exists, no error is reported.
-- ------------------------------
procedure Create_User (Principal : in out Test_User;
Email : in String) is
DB : ADO.Sessions.Session;
Query : ADO.SQL.Query;
Found : Boolean;
Key : AWA.Users.Models.Access_Key_Ref;
begin
Initialize (Principal);
DB := Principal.Manager.Get_Session;
-- Find the user
Query.Set_Join ("inner join awa_email e on e.user_id = o.id");
Query.Set_Filter ("e.email = ?");
Query.Bind_Param (1, Email);
Principal.User.Find (DB, Query, Found);
if not Found then
Principal.User.Set_First_Name ("Joe");
Principal.User.Set_Last_Name ("Pot");
Principal.User.Set_Password ("admin");
Principal.Email.Set_Email (Email);
Principal.Manager.Create_User (Principal.User, Principal.Email);
Find_Access_Key (Principal, Email, Key);
-- Run the verification and get the user and its session
Principal.Manager.Verify_User (Key.Get_Access_Key, "192.168.1.1",
Principal.Principal);
else
Principal.Manager.Authenticate (Email => Email,
Password => "admin",
IpAddr => "192.168.1.1",
Principal => Principal.Principal);
end if;
Principal.User := Principal.Principal.Get_User;
Principal.Session := Principal.Principal.Get_Session;
end Create_User;
-- ------------------------------
-- Create a test user for a new test and get an open session.
-- ------------------------------
procedure Create_User (Principal : in out Test_User) is
Key : AWA.Users.Models.Access_Key_Ref;
Email : constant String := "Joe-" & Util.Tests.Get_Uuid & "@gmail.com";
begin
Initialize (Principal);
Principal.User.Set_First_Name ("Joe");
Principal.User.Set_Last_Name ("Pot");
Principal.User.Set_Password ("admin");
Principal.Email.Set_Email (Email);
Principal.Manager.Create_User (Principal.User, Principal.Email);
Find_Access_Key (Principal, Email, Key);
-- Run the verification and get the user and its session
Principal.Manager.Verify_User (Key.Get_Access_Key, "192.168.1.1",
Principal.Principal);
Principal.User := Principal.Principal.Get_User;
Principal.Session := Principal.Principal.Get_Session;
end Create_User;
-- ------------------------------
-- Find the access key associated with a user (if any).
-- ------------------------------
procedure Find_Access_Key (Principal : in out Test_User;
Email : in String;
Key : in out AWA.Users.Models.Access_Key_Ref) is
DB : ADO.Sessions.Session;
Query : ADO.SQL.Query;
Found : Boolean;
Signup_Kind : constant Integer
:= AWA.Users.Models.Key_Type'Pos (AWA.Users.Models.SIGNUP_KEY);
Password_Kind : constant Integer
:= AWA.Users.Models.Key_Type'Pos (AWA.Users.Models.RESET_PASSWORD_KEY);
begin
Initialize (Principal);
DB := Principal.Manager.Get_Session;
-- Find the access key
Query.Set_Join ("inner join awa_email e on e.user_id = o.user_id");
Query.Set_Filter ("e.email = ? AND o.kind = ?");
Query.Bind_Param (1, Email);
Query.Bind_Param (2, Signup_Kind);
Key.Find (DB, Query, Found);
if not Found then
Query.Bind_Param (2, Password_Kind);
Key.Find (DB, Query, Found);
if not Found then
Log.Error ("Cannot find access key for email {0}", Email);
end if;
end if;
end Find_Access_Key;
-- ------------------------------
-- Login a user and create a session
-- ------------------------------
procedure Login (Principal : in out Test_User) is
begin
Initialize (Principal);
Principal.Manager.Authenticate (Email => Principal.Email.Get_Email,
Password => "admin",
IpAddr => "192.168.1.1",
Principal => Principal.Principal);
Principal.User := Principal.Principal.Get_User;
Principal.Session := Principal.Principal.Get_Session;
end Login;
-- ------------------------------
-- Logout the user and closes the current session.
-- ------------------------------
procedure Logout (Principal : in out Test_User) is
begin
Initialize (Principal);
Principal.Manager.Close_Session (Principal.Session.Get_Id, True);
end Logout;
-- ------------------------------
-- Simulate a user login in the given service context.
-- ------------------------------
procedure Login (Context : in out AWA.Services.Contexts.Service_Context'Class;
Sec_Context : in out Security.Contexts.Security_Context;
Email : in String) is
User : Test_User;
Principal : AWA.Users.Principals.Principal_Access;
App : constant AWA.Applications.Application_Access := AWA.Tests.Get_Application;
begin
AWA.Tests.Set_Application_Context;
Create_User (User, Email);
Principal := AWA.Users.Principals.Create (User.User, User.Session);
Context.Set_Context (App, Principal);
Sec_Context.Set_Context (Manager => App.Get_Security_Manager,
Principal => Principal.all'Access);
-- Keep track of the Principal instance so that Tear_Down will release it.
-- Most tests will call Login but don't call Logout because there is no real purpose
-- for the test in doing that and it allows to keep the unit test simple. This creates
-- memory leak because the Principal instance is not freed.
for I in Logged_Users'Range loop
if Logged_Users (I) = null then
Logged_Users (I) := Principal;
exit;
end if;
end loop;
end Login;
-- ------------------------------
-- Simulate a user login on the request. Upon successful login, a session that is
-- authentified is associated with the request object.
-- ------------------------------
procedure Login (Email : in String;
Request : in out ASF.Requests.Mockup.Request) is
User : Test_User;
Reply : ASF.Responses.Mockup.Response;
begin
Create_User (User, Email);
ASF.Tests.Do_Get (Request, Reply, "/auth/login.html", "login-user-1.html");
Request.Set_Parameter ("email", Email);
Request.Set_Parameter ("password", "admin");
Request.Set_Parameter ("login", "1");
Request.Set_Parameter ("login-button", "1");
ASF.Tests.Do_Post (Request, Reply, "/auth/login.html", "login-user-2.html");
end Login;
-- ------------------------------
-- Setup the context and security context to simulate an anonymous user.
-- ------------------------------
procedure Anonymous (Context : in out AWA.Services.Contexts.Service_Context'Class;
Sec_Context : in out Security.Contexts.Security_Context) is
App : constant AWA.Applications.Application_Access := AWA.Tests.Get_Application;
begin
AWA.Tests.Set_Application_Context;
Context.Set_Context (App, null);
Sec_Context.Set_Context (Manager => App.Get_Security_Manager,
Principal => null);
end Anonymous;
-- ------------------------------
-- Simulate the recovery password process for the given user.
-- ------------------------------
procedure Recover_Password (Email : in String) is
use type ASF.Principals.Principal_Access;
Request : ASF.Requests.Mockup.Request;
Reply : ASF.Responses.Mockup.Response;
begin
Request.Set_Parameter ("email", Email);
Request.Set_Parameter ("lost-password", "1");
Request.Set_Parameter ("lost-password-button", "1");
ASF.Tests.Do_Post (Request, Reply, "/auth/lost-password.html", "lost-password-2.html");
if Reply.Get_Status /= ASF.Responses.SC_MOVED_TEMPORARILY then
Log.Error ("Invalid redirect after lost password");
end if;
-- Now, get the access key and simulate a click on the reset password link.
declare
Principal : AWA.Tests.Helpers.Users.Test_User;
Key : AWA.Users.Models.Access_Key_Ref;
begin
AWA.Tests.Set_Application_Context;
AWA.Tests.Helpers.Users.Find_Access_Key (Principal, Email, Key);
if not Key.Is_Null then
Log.Error ("There is no access key associated with the user");
end if;
-- Simulate user clicking on the reset password link.
-- This verifies the key, login the user and redirect him to the change-password page
Request.Set_Parameter ("key", Key.Get_Access_Key);
Request.Set_Parameter ("password", "admin");
Request.Set_Parameter ("reset-password", "1");
ASF.Tests.Do_Post (Request, Reply, "/auth/change-password.html", "reset-password-2.html");
if Reply.Get_Status /= ASF.Responses.SC_MOVED_TEMPORARILY then
Log.Error ("Invalid response");
end if;
-- Check that the user is logged and we have a user principal now.
if Request.Get_User_Principal = null then
Log.Error ("A user principal should be defined");
end if;
end;
end Recover_Password;
overriding
procedure Finalize (Principal : in out Test_User) is
begin
Free (Principal.Principal);
end Finalize;
-- ------------------------------
-- Cleanup and release the Principal that have been allocated from the Login session
-- but not released because the Logout is not called from the unit test.
-- ------------------------------
procedure Tear_Down is
begin
for I in Logged_Users'Range loop
if Logged_Users (I) /= null then
Free (Logged_Users (I));
end if;
end loop;
end Tear_Down;
end AWA.Tests.Helpers.Users;
|
-- { dg-do compile }
private with Ada.Containers.Ordered_Maps;
with Ada.Containers.Ordered_Sets;
with Ada.Unchecked_Deallocation;
package private_with is
type String_Access is access String;
package Index_Sets is new Ada.Containers.Ordered_Sets
(Element_Type => Positive);
procedure Free is new Ada.Unchecked_Deallocation
(Object => String,
Name => String_Access);
end;
|
package My_Pack is
function Get return Integer;
function Get_Count return Integer;
procedure Set (V : in Integer);
end My_Pack;
|
with Ada.Finalization; use Ada.Finalization;
package Lto6_Pkg is
type F_String is new Controlled with record
Data : access String;
end record;
Null_String : constant F_String := (Controlled with Data => null);
end Lto6_Pkg;
|
generic
package Symbolic_Expressions.Solving is
-- ==================== --
-- == SYSTEM SOLVING == --
-- ==================== --
package Equation_Tables is
new Ada.Containers.Indefinite_Ordered_Maps
(Key_Type => Variable_Name,
Element_Type => Symbolic_Expression);
procedure Triangular_Solve (What : in Equation_Tables.Map;
Result : out Variable_Tables.Map;
Success : out Boolean);
-- Parameter What represents a system of equations of the form
--
-- <variable> = <expression>
--
-- This procedure tries to find a solution for that system of
-- equations. If a solution is found, Success is set to True and Result
-- contains the values found for the variables; if a solution is not
-- found Success is set to False and Result can be partially filled.
--
-- To be honest, this procedure is limited to solving
-- systems that can be solved by "back substitution," such as
--
-- x = y*3 + max(u, v)
-- y = min(u, z)
-- u = v*z
-- v = 10
-- z = -1
--
-- Note that the system above can be solved by evaluating
-- the expressions from last to first. Systems like
--
-- x + y = 0
-- x - y = 4
--
-- have a solution, but they cannot be solved by this procedure.
-- This procedure is useful to solve for constraints that come, for
-- example, from a DAG and it has the advantage that no special constraints
-- are posed on the equations that can include non-linear (and badly
-- behaving) functions like max, abs, and so on...
--
end Symbolic_Expressions.Solving;
|
------------------------------------------------------------------------------
-- Copyright (c) 2014, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
with Natools.S_Expressions.Test_Tools;
with Natools.S_Expressions.Parsers;
package body Natools.S_Expressions.Lockable.Tests is
-------------------------------
-- Lockable.Descriptor Tests --
-------------------------------
function Test_Expression return Atom is
begin
return To_Atom ("(begin(command1 arg1.1 arg1.2)"
& "(command2 (subcmd2.1 arg2.1.1) (subcmd2.3) arg2.4)"
& "(command3 (subcmd3.1 ((subcmd3.1.1 arg3.1.1.1)) arg3.1.2))"
& "end)5:extra");
end Test_Expression;
procedure Test_Interface
(Test : in out NT.Test;
Object : in out Lockable.Descriptor'Class)
is
Level_1, Level_2 : Lock_State;
Base : Natural;
begin
Base := Object.Current_Level;
Test_Tools.Next_And_Check (Test, Object, To_Atom ("begin"), Base);
Test_Tools.Next_And_Check (Test, Object, Events.Open_List, Base + 1);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("command1"), Base + 1,
"Before first lock:");
Object.Lock (Level_1);
Test_Tools.Test_Atom_Accessors (Test, Object, To_Atom ("command1"), 0,
"After first lock:");
Test_Tools.Next_And_Check (Test, Object, To_Atom ("arg1.1"), 0);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("arg1.2"), 0);
Test_Tools.Next_And_Check (Test, Object, Events.End_Of_Input, 0,
"Before first unlock:");
Test_Tools.Test_Atom_Accessor_Exceptions (Test, Object);
Object.Unlock (Level_1);
declare
Event : constant Events.Event := Object.Current_Event;
Level : constant Natural := Object.Current_Level;
begin
if Event /= Events.Close_List then
Test.Fail ("Current event is " & Events.Event'Image (Event)
& ", expected Close_List");
end if;
if Level /= Base then
Test.Fail ("Current level is" & Natural'Image (Level)
& ", expected" & Natural'Image (Base));
end if;
end;
Test_Tools.Next_And_Check (Test, Object, Events.Open_List, Base + 1);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("command2"), Base + 1,
"Before second lock:");
Object.Lock (Level_1);
Test_Tools.Test_Atom_Accessors (Test, Object, To_Atom ("command2"), 0,
"After second lock:");
Test_Tools.Next_And_Check (Test, Object, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("subcmd2.1"), 1,
"Before inner lock:");
Object.Lock (Level_2);
Test_Tools.Test_Atom_Accessors (Test, Object, To_Atom ("subcmd2.1"), 0,
"After inner lock:");
Test_Tools.Next_And_Check (Test, Object, To_Atom ("arg2.1.1"), 0,
"Before inner unlock:");
Object.Unlock (Level_2, False);
Test_Tools.Test_Atom_Accessors (Test, Object, To_Atom ("arg2.1.1"), 1,
"After inner unlock:");
Test_Tools.Next_And_Check (Test, Object, Events.Close_List, 0);
Test_Tools.Next_And_Check (Test, Object, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("subcmd2.3"), 1,
"Before inner lock:");
Object.Lock (Level_2);
Test_Tools.Test_Atom_Accessors (Test, Object, To_Atom ("subcmd2.3"), 0,
"After inner lock:");
Test_Tools.Next_And_Check (Test, Object, Events.End_Of_Input, 0,
"Before inner unlock:");
Object.Unlock (Level_2, False);
declare
Event : constant Events.Event := Object.Current_Event;
Level : constant Natural := Object.Current_Level;
begin
if Event /= Events.Close_List then
Test.Fail ("Current event is " & Events.Event'Image (Event)
& ", expected Close_List");
end if;
if Level /= 0 then
Test.Fail ("Current level is" & Natural'Image (Level)
& ", expected 0");
end if;
end;
Object.Unlock (Level_1);
Test_Tools.Next_And_Check (Test, Object, Events.Open_List, Base + 1);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("command3"), Base + 1,
"Before third lock:");
Object.Lock (Level_1);
Test_Tools.Test_Atom_Accessors (Test, Object, To_Atom ("command3"), 0,
"After third lock:");
Test_Tools.Next_And_Check (Test, Object, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("subcmd3.1"), 1);
Test_Tools.Next_And_Check (Test, Object, Events.Open_List, 2);
Test_Tools.Next_And_Check (Test, Object, Events.Open_List, 3);
Object.Unlock (Level_1);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("end"), Base);
Test_Tools.Next_And_Check (Test, Object, Events.Close_List, Base - 1);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("extra"), Base - 1);
Object.Lock (Level_1);
Test_Tools.Test_Atom_Accessors (Test, Object, To_Atom ("extra"), 0);
Object.Unlock (Level_1);
declare
Event : constant Events.Event := Object.Current_Event;
begin
if Event /= Events.End_Of_Input then
Test.Fail ("Last current event is "
& Events.Event'Image (Event)
& ", expected End_Of_Input");
end if;
end;
end Test_Interface;
-------------------------
-- Complete Test Suite --
-------------------------
procedure All_Tests (Report : in out NT.Reporter'Class) is
begin
Test_Stack (Report);
Test_Wrapper_Interface (Report);
Test_Wrapper_Extra (Report);
end All_Tests;
---------------------------
-- Individual Test Cases --
---------------------------
procedure Test_Stack (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Level stack");
begin
declare
Stack : Lock_Stack;
State : array (1 .. 4) of Lock_State;
procedure Check_Level
(Stack : in Lock_Stack;
Expected : in Natural;
Context : in String);
procedure Dump_Data;
procedure Check_Level
(Stack : in Lock_Stack;
Expected : in Natural;
Context : in String)
is
Level : constant Natural := Current_Level (Stack);
begin
if Level /= Expected then
Test.Fail (Context & ": level is"
& Natural'Image (Level) & ", expected"
& Natural'Image (Expected));
Dump_Data;
end if;
end Check_Level;
procedure Dump_Data is
begin
Test.Info (" Stack: (Depth =>"
& Natural'Image (Stack.Depth)
& ", Level =>"
& Natural'Image (Stack.Level) & ')');
for I in State'Range loop
Test.Info (" State"
& Natural'Image (I)
& ": (Depth =>"
& Natural'Image (Stack.Depth)
& ", Level =>"
& Natural'Image (Stack.Level) & ')');
end loop;
end Dump_Data;
begin
Check_Level (Stack, 0, "1");
Push_Level (Stack, 14, State (1));
Check_Level (Stack, 14, "2");
begin
Pop_Level (Stack, State (2));
Test.Fail ("No exception raised after popping blank state");
exception
when Constraint_Error =>
null;
when Error : others =>
Test.Fail
("Unexpected exception raised after popping blank state");
Test.Report_Exception (Error, NT.Fail);
end;
Pop_Level (Stack, State (1));
Check_Level (Stack, 0, "3");
Push_Level (Stack, 15, State (1));
Check_Level (Stack, 15, "4");
Push_Level (Stack, 92, State (2));
Check_Level (Stack, 92, "5");
Push_Level (Stack, 65, State (3));
Check_Level (Stack, 65, "6");
Pop_Level (Stack, State (3));
Check_Level (Stack, 92, "7");
Push_Level (Stack, 35, State (3));
Check_Level (Stack, 35, "8");
Push_Level (Stack, 89, State (4));
Check_Level (Stack, 89, "9");
begin
Pop_Level (Stack, State (3));
Test.Fail ("No exception raised after popping a forbidden gap");
exception
when Constraint_Error =>
null;
when Error : others =>
Test.Fail
("Unexpected exception raised after popping a forbidden gap");
Test.Report_Exception (Error, NT.Fail);
end;
Check_Level (Stack, 89, "10");
Pop_Level (Stack, State (3), True);
Check_Level (Stack, 92, "11");
begin
Pop_Level (Stack, State (4));
Test.Fail ("No exception raised after popping stale state");
exception
when Constraint_Error =>
null;
when Error : others =>
Test.Fail
("Unexpected exception raised after popping stale state");
Test.Report_Exception (Error, NT.Fail);
end;
Check_Level (Stack, 92, "12");
Pop_Level (Stack, State (2));
Check_Level (Stack, 15, "13");
Pop_Level (Stack, State (1));
Check_Level (Stack, 0, "14");
end;
exception
when Error : others => Test.Report_Exception (Error);
end Test_Stack;
procedure Test_Wrapper_Extra (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Extra tests of wrapper");
begin
declare
Input : aliased Test_Tools.Memory_Stream;
Parser : aliased Parsers.Stream_Parser (Input'Access);
Tested : Wrapper (Parser'Access);
State : Lock_State;
begin
Input.Set_Data (To_Atom ("(cmd1 arg1)(cmd2 4:arg2"));
-- Check Events.Error is returned by Next when finished
Test_Tools.Next_And_Check (Test, Tested, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, Tested, To_Atom ("cmd1"), 1);
Tested.Lock (State);
Test_Tools.Next_And_Check (Test, Tested, To_Atom ("arg1"), 0);
Test_Tools.Next_And_Check (Test, Tested, Events.End_Of_Input, 0);
Test_Tools.Next_And_Check (Test, Tested, Events.Error, 0);
Tested.Unlock (State);
-- Run Unlock with End_Of_Input in backend
Test_Tools.Next_And_Check (Test, Tested, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, Tested, To_Atom ("cmd2"), 1);
Tested.Lock (State);
Test_Tools.Next_And_Check (Test, Tested, To_Atom ("arg2"), 0);
Tested.Unlock (State);
end;
exception
when Error : others => Test.Report_Exception (Error);
end Test_Wrapper_Extra;
procedure Test_Wrapper_Interface (Report : in out NT.Reporter'Class) is
Test : NT.Test
:= Report.Item ("Lockable.Descriptor interface of wrapper");
begin
declare
Input : aliased Test_Tools.Memory_Stream;
Parser : aliased Parsers.Stream_Parser (Input'Access);
Tested : Wrapper (Parser'Access);
begin
Input.Set_Data (Test_Expression);
Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 1);
Test_Interface (Test, Tested);
end;
exception
when Error : others => Test.Report_Exception (Error);
end Test_Wrapper_Interface;
end Natools.S_Expressions.Lockable.Tests;
|
with Ada.Characters.Latin_1;
with SPARK.Text_IO;
with Error_Reporter;
with Tokens;
package Scanners with SPARK_Mode is
procedure Scan_Tokens (Source : String; Token_List : in out Tokens.List) with
Global => (in_out => (Error_Reporter.State, SPARK.Text_IO.Standard_Error)),
Pre => Source'First >= 1 and then Source'Last < Integer'Last;
LF : constant Character := Ada.Characters.Latin_1.LF;
NUL : constant Character := Ada.Characters.Latin_1.NUL;
CR : constant Character := Ada.Characters.Latin_1.CR;
HT : constant Character := Ada.Characters.Latin_1.HT;
function Is_Alphanumeric (C : Character) return Boolean with
Global => null,
Post => (if Is_Alphanumeric'Result then C /= NUL);
function Is_Decimal_Digit (C : Character) return Boolean with
Global => null,
Post => (if Is_Decimal_Digit'Result then C /= NUL);
function Is_Letter (C : Character) return Boolean with
Global => null,
Post => (if Is_Letter'Result then C /= NUL);
end Scanners;
|
------------------------------------------------------------------------------
-- Copyright (c) 2014, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
with Natools.S_Expressions.Parsers;
with Natools.S_Expressions.Test_Tools;
with Natools.S_Expressions.Templates.Integers;
with Natools.Static_Maps.S_Expressions.Templates.Integers.T;
package body Natools.S_Expressions.Templates.Tests.Integers is
procedure Test_Render
(Test : in out NT.Test;
Defaults : in Templates.Integers.Format;
Template : in String;
Value : in Integer;
Expected : in String);
procedure Test_Render
(Test : in out NT.Test;
Template : in String;
Value : in Integer;
Expected : in String);
-- Run Template with Value and compare the result with Expected
------------------------------
-- Local Helper Subprograms --
------------------------------
procedure Test_Render
(Test : in out NT.Test;
Template : in String;
Value : in Integer;
Expected : in String)
is
Input : aliased Test_Tools.Memory_Stream;
Output : Test_Tools.Memory_Stream;
Parser : Parsers.Stream_Parser (Input'Access);
begin
Input.Set_Data (To_Atom (Template));
Parser.Next;
Output.Set_Expected (To_Atom (Expected));
Templates.Integers.Render (Output, Parser, Value);
Output.Check_Stream (Test);
end Test_Render;
procedure Test_Render
(Test : in out NT.Test;
Defaults : in Templates.Integers.Format;
Template : in String;
Value : in Integer;
Expected : in String)
is
Input : aliased Test_Tools.Memory_Stream;
Output : Test_Tools.Memory_Stream;
Parser : Parsers.Stream_Parser (Input'Access);
begin
Input.Set_Data (To_Atom (Template));
Parser.Next;
Output.Set_Expected (To_Atom (Expected));
Templates.Integers.Render (Output, Defaults, Parser, Value);
Output.Check_Stream (Test);
end Test_Render;
-------------------------
-- Complete Test Suite --
-------------------------
procedure All_Tests (Report : in out NT.Reporter'Class) is
begin
Alignment (Report);
Default_Format (Report);
Explicit_Images (Report);
Explicit_Sign (Report);
Hexadecimal (Report);
Overflow (Report);
Parse_Errors (Report);
Static_Hash_Map (Report);
Explicit_Default_Format (Report);
Prefix_And_Suffix (Report);
end All_Tests;
-----------------------
-- Inidividual Tests --
-----------------------
procedure Alignment (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Debug instantiation");
begin
Test_Render (Test, "(width 5)", 0, " 0");
Test_Render (Test, "(width 5)(padding _)(align center)", 10, "_10__");
Test_Render (Test, "(width 5 10)(left-align)", 7, "7 ");
Test_Render (Test, "(min-width 5)(right-align)", 2, " 2");
Test_Render (Test, "(width 5)(padding > <)(centered)", 4, ">>4<<");
Test_Render
(Test,
"(width 5)(left-padding ""["")(right-padding ""]"")(centered)",
126,
"[126]");
Test_Render (Test, "(width 3)(centered)", 16, "16 ");
Test_Render (Test, "(width 3)(centered)", 456, "456");
Test_Render (Test, "(width 3)(align left)", 567, "567");
Test_Render (Test, "(width 3)(align right)", 678, "678");
exception
when Error : others => Test.Report_Exception (Error);
end Alignment;
procedure Default_Format (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Debug instantiation");
begin
Test_Render (Test, "", 42, "42");
exception
when Error : others => Test.Report_Exception (Error);
end Default_Format;
procedure Explicit_Default_Format (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Client-provided default format");
begin
declare
Default : Templates.Integers.Format;
begin
Default.Set_Minimum_Width (2);
Default.Set_Left_Padding (To_Atom ("0"));
Test_Render (Test, Default, "", 5, "05");
Test_Render (Test, Default, "", 12, "12");
Test_Render (Test, Default, "(padding 1: )", 7, " 7");
end;
exception
when Error : others => Test.Report_Exception (Error);
end Explicit_Default_Format;
procedure Explicit_Images (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Explicit images in template");
begin
Test_Render (Test, "(image (-2 two) (666 evil))", 10, "10");
Test_Render (Test, "(image (-2 two) (666 evil))", -2, "two");
Test_Render (Test, "(image (-2 two) (666 evil))", 666, "evil");
Test_Render (Test, "(image (-2 two) (666 evil) (-2))", -2, "-2");
Test_Render (Test, "(image (1 one))3:Two4:four", 1, "one");
Test_Render (Test, "(image (1 one))3:Two4:four", 2, "Two");
Test_Render (Test, "(image (1 one))3:Two4:four", 3, "four");
Test_Render (Test, "(image (1 one))3:Two4:four", 4, "4");
Test_Render (Test, "(image (invalid -))5:first", Integer'First, "first");
Test_Render (Test, "(image-range (""?"" (10 19)))", 9, "9");
Test_Render (Test, "(image-range (""?"" (10 19)))", 10, "?");
Test_Render (Test, "(image-range (""?"" (10 19)))", 15, "?");
Test_Render (Test, "(image-range (""?"" (10 19)))", 19, "?");
Test_Render (Test, "(image-range (""?"" (10 19)))", 20, "20");
exception
when Error : others => Test.Report_Exception (Error);
end Explicit_Images;
procedure Explicit_Sign (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Explicit sign specification");
begin
Test_Render (Test, "(sign +)", 42, "+42");
Test_Render (Test, "(sign + _)", 42, "+42");
Test_Render (Test, "(sign + _)", -42, "_42");
exception
when Error : others => Test.Report_Exception (Error);
end Explicit_Sign;
procedure Hexadecimal (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Hexadecimal representation");
Hex_Spec : constant String
:= "(base 0 1 2 3 4 5 6 7 8 9 A B C D E F)";
begin
Test_Render (Test, Hex_Spec, 8, "8");
Test_Render (Test, Hex_Spec, 16#BEE#, "BEE");
exception
when Error : others => Test.Report_Exception (Error);
end Hexadecimal;
procedure Overflow (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Width overflow");
begin
Test_Render (Test, "(width 3)", 10_000, "");
Test_Render (Test, "(max-width 4)", 10_000, "");
Test_Render (Test, "(max-width 3 ""[...]"")", 10_000, "[...]");
Test_Render (Test, "(width 2 3 ...)", 10_000, "...");
exception
when Error : others => Test.Report_Exception (Error);
end Overflow;
procedure Parse_Errors (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Parse errors in template");
begin
Test_Render (Test, "(invalid-command)", 1, "1");
Test_Render (Test, "(align)", 2, "2");
Test_Render (Test, "(align invalid)", 3, "3");
Test_Render (Test, "(padding)", 4, "4");
Test_Render (Test, "(left-padding)", 5, "5");
Test_Render (Test, "(right-padding)", 6, "6");
Test_Render (Test, "(signs)", 7, "7");
Test_Render (Test, "(width)", 8, "8");
Test_Render (Test, "(max-width)", 9, "9");
Test_Render (Test, "(min-width)", 10, "10");
exception
when Error : others => Test.Report_Exception (Error);
end Parse_Errors;
procedure Prefix_And_Suffix (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Parse errors in template");
Ordinal : constant String
:= "(suffix 1:? (th (0 31)) (st 1 21 31) (nd 2 22) (rd 3 23) (0: 0))";
begin
declare
Format : Templates.Integers.Format;
begin
Format.Set_Prefix ((0, 9), To_Atom ("a"));
Format.Set_Prefix ((-99, -10), To_Atom ("b"));
Format.Set_Prefix ((50, 99), To_Atom ("c"));
Format.Set_Prefix (0, To_Atom ("d"));
Format.Set_Prefix (-10, To_Atom ("e"));
Format.Set_Prefix (5, To_Atom ("f"));
Format.Set_Prefix ((7, 52), To_Atom ("g"));
Format.Set_Prefix ((-52, -49), To_Atom ("h"));
Format.Set_Prefix ((-100, -90), To_Atom ("i"));
Format.Remove_Prefix (8);
Test_Render (Test, Format, "", -196, "-196");
Test_Render (Test, Format, "", -101, "-101");
Test_Render (Test, Format, "", -100, "i-100");
Test_Render (Test, Format, "", -90, "i-90");
Test_Render (Test, Format, "", -89, "b-89");
Test_Render (Test, Format, "", -53, "b-53");
Test_Render (Test, Format, "", -52, "h-52");
Test_Render (Test, Format, "", -49, "h-49");
Test_Render (Test, Format, "", -48, "b-48");
Test_Render (Test, Format, "", -11, "b-11");
Test_Render (Test, Format, "", -10, "e-10");
Test_Render (Test, Format, "", -9, "-9");
Test_Render (Test, Format, "", -1, "-1");
Test_Render (Test, Format, "", 0, "d0");
Test_Render (Test, Format, "", 1, "a1");
Test_Render (Test, Format, "", 4, "a4");
Test_Render (Test, Format, "", 5, "f5");
Test_Render (Test, Format, "", 6, "a6");
Test_Render (Test, Format, "", 7, "g7");
Test_Render (Test, Format, "", 8, "8");
Test_Render (Test, Format, "", 9, "g9");
Test_Render (Test, Format, "", 52, "g52");
Test_Render (Test, Format, "", 53, "c53");
Test_Render (Test, Format, "", 99, "c99");
Test_Render (Test, Format, "", 100, "100");
Test_Render (Test, Format, "", 192, "192");
end;
declare
Format : Templates.Integers.Format;
begin
Format.Set_Suffix ((0, 10), To_Atom ("th"));
Format.Set_Suffix (1, To_Atom ("st"));
Format.Remove_Suffix (0);
Test_Render (Test, Format, "", -1, "-1");
Test_Render (Test, Format, "", 0, "0");
Test_Render (Test, Format, "", 1, "1st");
Test_Render (Test, Format, "", 4, "4th");
Test_Render (Test, Format, "", 10, "10th");
end;
Test_Render (Test, Ordinal, -1, "-1?");
Test_Render (Test, Ordinal, 0, "0");
Test_Render (Test, Ordinal, 1, "1st");
Test_Render (Test, Ordinal, 2, "2nd");
Test_Render (Test, Ordinal, 3, "3rd");
Test_Render (Test, Ordinal, 4, "4th");
Test_Render (Test, "(prefix (a) (b invalid (9 5)))", 0, "0");
Test_Render (Test, "(prefix (c (invalid 5) (-1 invalid)))", 0, "0");
Test_Render (Test, "(prefix (d ((invalid) 5) (-1)) ())", 0, "0");
declare
Format : Templates.Integers.Format;
begin
Format.Set_Minimum_Width (10);
Format.Set_Suffix (1, To_Atom ("<sup>er</sup>"), 2);
Format.Set_Prefix (10, To_Atom ("dix : "));
Test_Render (Test, Format, "", 5, " 5");
Test_Render (Test, Format, "", 1, " 1<sup>er</sup>");
Test_Render (Test, Format, "(centered)", 10, " dix : 10 ");
Test_Render (Test, Format, "(suffix ((th 0) 7))", 7, " 7th");
end;
exception
when Error : others => Test.Report_Exception (Error);
end Prefix_And_Suffix;
procedure Static_Hash_Map (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Parse errors in template");
begin
if not Natools.Static_Maps.S_Expressions.Templates.Integers.T then
Test.Fail;
end if;
exception
when Error : others => Test.Report_Exception (Error);
end Static_Hash_Map;
end Natools.S_Expressions.Templates.Tests.Integers;
|
with
ada.unchecked_Deallocation;
package body openGL.Glyph.Container
is
---------
--- Forge
--
function to_glyph_Container (parent_Face : in freetype.Face.view) return openGL.glyph.Container.item
is
Self : openGL.glyph.Container.item;
begin
Self.Face := parent_Face;
Self.Err := 0;
Self.charMap := new freetype.charMap.Item' (freetype.charMap.to_charMap (Self.Face));
return Self;
end to_glyph_Container;
procedure destruct (Self : in out Item)
is
use Glyph_Vectors;
procedure deallocate is new ada.unchecked_Deallocation (openGL.Glyph.item'Class, Glyph_view);
procedure deallocate is new ada.unchecked_Deallocation (freetype.charMap.item'Class, charMap_view);
Cursor : Glyph_Vectors.Cursor := Self.Glyphs.First;
the_Glyph : Glyph_view;
begin
while has_Element (Cursor)
loop
the_Glyph := Element (Cursor);
deallocate (the_Glyph);
next (Cursor);
end loop;
Self.Glyphs .clear;
Self.charMap.destruct;
deallocate (Self.charMap);
end destruct;
--------------
-- Attributes
--
function CharMap (Self : access Item; Encoding : in freeType_c.FT_Encoding) return Boolean
is
Result : constant Boolean := Self.charMap.CharMap (Encoding);
begin
Self.Err := Self.charMap.Error;
return Result;
end CharMap;
function FontIndex (Self : in Item; Character : in freetype.charMap.characterCode) return Natural
is
begin
return Natural (Self.charMap.FontIndex (Character));
end FontIndex;
procedure add (Self : in out Item; Glyph : in Glyph_view;
Character : in freetype.charMap.characterCode)
is
begin
Self.glyphs.append (Glyph);
Self.charMap.insertIndex (Character, Self.Glyphs.Length);
end add;
function Glyph (Self : in Item; Character : in freetype.charMap.characterCode) return Glyph_view
is
use type freetype.charMap.glyphIndex;
Index : constant freetype.charMap.glyphIndex := Self.charMap.GlyphListIndex (Character);
begin
if Index = -1
then return null;
else return Self.Glyphs.Element (Integer (Index));
end if;
end Glyph;
function BBox (Self : in Item; Character : in freetype.charMap.characterCode) return Bounds
is
begin
return Self.Glyph (Character).BBox;
end BBox;
function Advance (Self : in Item; Character : in freetype.charMap.characterCode;
nextCharacterCode : in freetype.charMap.characterCode) return Real
is
Left : constant freetype.charMap.glyphIndex := Self.charMap.FontIndex (Character);
Right : constant freetype.charMap.glyphIndex := Self.charMap.FontIndex (nextCharacterCode);
begin
return Real (Self.Face.KernAdvance (Integer (Left),
Integer (Right)) (1) + Float (Self.Glyph (Character).Advance));
end Advance;
function Error (Self : in Item) return freetype_c.FT_Error
is
begin
return Self.Err;
end Error;
--------------
-- Operations
--
function render (Self : access Item; Character : in freetype.charMap.characterCode;
nextCharacterCode : in freetype.charMap.characterCode;
penPosition : in Vector_3;
renderMode : in Integer) return Vector_3
is
use type freetype_c.FT_Error,
freetype.charMap.glyphIndex;
Left : constant freetype.charMap.glyphIndex := Self.charMap.FontIndex (Character) - 0;
Right : constant freetype.charMap.glyphIndex := Self.charMap.FontIndex (nextCharacterCode) - 0;
ft_kernAdvance : constant freetype.Vector_3 := Self.Face.KernAdvance (Integer (Left),
Integer (Right));
kernAdvance : Vector_3 := (ft_kernAdvance (1),
ft_kernAdvance (2),
ft_kernAdvance (3));
Index : freetype.charMap.glyphIndex;
begin
if Self.Face.Error = 0
then
Index := Self.charMap.GlyphListIndex (Character);
kernAdvance := kernAdvance + Self.Glyphs.Element (Integer (Index)).Render (penPosition,
renderMode);
else
raise openGL.Error with "Unable to render character '" & Character'Image & "'";
end if;
return kernAdvance;
end Render;
end openGL.Glyph.Container;
|
------------------------------------------------------------------------------
-- Copyright (c) 2014-2019, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
with Ada.Strings.Unbounded;
with AWS.Cookie;
with AWS.Headers.Values;
with AWS.MIME;
with AWS.Parameters;
with AWS.Response.Set;
with Natools.S_Expressions.Atom_Ref_Constructors;
package body Natools.Web.Exchanges is
package Constructors renames Natools.S_Expressions.Atom_Ref_Constructors;
procedure Ensure_Kind
(Object : in out Exchange;
Kind : in Responses.Kind);
-- Switch Object.Kind to Kind, resetting internal state if needed
function Make_Row (Key, Value : in String)
return Containers.Atom_Array_Refs.Immutable_Reference;
-- Create an atom table row from key and value
------------------------------
-- Local Helper Subprograms --
------------------------------
procedure Ensure_Kind
(Object : in out Exchange;
Kind : in Responses.Kind)
is
use type Responses.Kind;
begin
if Object.Kind /= Kind then
Object.Kind := Kind;
Object.Response_Body.Soft_Reset;
end if;
end Ensure_Kind;
function Make_Row (Key, Value : in String)
return Containers.Atom_Array_Refs.Immutable_Reference
is
Data : constant Containers.Atom_Array_Refs.Data_Access
:= new Containers.Atom_Array (1 .. 2);
Result : constant Containers.Atom_Array_Refs.Immutable_Reference
:= Containers.Atom_Array_Refs.Create (Data);
begin
Data (1) := Constructors.Create (S_Expressions.To_Atom (Key));
Data (2) := Constructors.Create (S_Expressions.To_Atom (Value));
return Result;
end Make_Row;
--------------------------------
-- Request Method Subprograms --
--------------------------------
function To_Set (List : Method_Array) return Method_Set is
Result : Method_Set := (others => False);
begin
for I in List'Range loop
Result (List (I)) := True;
end loop;
return Result;
end To_Set;
function Image (List : Method_Array) return String is
begin
return Image (To_Set (List));
end Image;
function Image (Set : Method_Set) return String is
Buffer : String := "GET, HEAD, POST";
First : Boolean := True;
Last : Natural := Buffer'First - 1;
procedure Raw_Append (S : in String);
procedure Append (S : in String);
procedure Raw_Append (S : in String) is
begin
Buffer (Last + 1 .. Last + S'Length) := S;
Last := Last + S'Length;
end Raw_Append;
procedure Append (S : in String) is
begin
if First then
First := False;
else
Raw_Append (", ");
end if;
Raw_Append (S);
end Append;
begin
for M in Set'Range loop
if Set (M) then
Append (Request_Method'Image (M));
end if;
end loop;
return Buffer (Buffer'First .. Last);
end Image;
-----------------------
-- Request Accessors --
-----------------------
function Cookie (Object : in Exchange; Name : in String) return String is
begin
return AWS.Cookie.Get (Object.Request.all, Name);
end Cookie;
function Cookie_Table
(Object : in Exchange)
return Containers.Atom_Table_Refs.Immutable_Reference
is
Headers : constant AWS.Headers.List
:= AWS.Status.Header (Object.Request.all);
Cookies : constant String
:= AWS.Headers.Get_Values (Headers, AWS.Messages.Cookie_Token);
Headers_Set : constant AWS.Headers.Values.Set
:= AWS.Headers.Values.Split (Cookies);
List : Containers.Atom_Row_Lists.List;
begin
for I in Headers_Set'Range loop
if Headers_Set (I).Named_Value then
List.Append (Make_Row
(Ada.Strings.Unbounded.To_String (Headers_Set (I).Name),
Ada.Strings.Unbounded.To_String (Headers_Set (I).Value)));
else
Log (Severities.Error, "Nameless cookie """
& Ada.Strings.Unbounded.To_String (Headers_Set (I).Value) & '"');
end if;
end loop;
return Containers.Create (List);
end Cookie_Table;
function Has_Parameter (Object : Exchange; Name : String) return Boolean is
begin
return AWS.Parameters.Exist
(AWS.Status.Parameters (Object.Request.all),
Name);
end Has_Parameter;
function Header (Object : Exchange; Name : String) return String is
begin
return AWS.Headers.Get_Values
(AWS.Status.Header (Object.Request.all),
Name);
end Header;
procedure Iterate_Parameters
(Object : in Exchange;
Process : not null access procedure (Name, Value : String))
is
Parameters : constant AWS.Parameters.List
:= AWS.Status.Parameters (Object.Request.all);
begin
for I in 1 .. AWS.Parameters.Count (Parameters) loop
Process.all
(AWS.Parameters.Get_Name (Parameters, I),
AWS.Parameters.Get_Value (Parameters, I));
end loop;
end Iterate_Parameters;
function Method (Object : Exchange) return Request_Method is
begin
case AWS.Status.Method (Object.Request.all) is
when AWS.Status.GET => return GET;
when AWS.Status.HEAD => return HEAD;
when AWS.Status.POST => return POST;
when others => return Unknown_Method;
end case;
end Method;
function Parameter
(Object : Exchange;
Name : String)
return String is
begin
return AWS.Parameters.Get
(AWS.Status.Parameters (Object.Request.all), Name);
end Parameter;
overriding procedure Read
(Stream : in out Exchange;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset)
is
pragma Unreferenced (Stream, Item, Last);
begin
raise Program_Error with "Reading exchange stream is not implemented";
end Read;
function Path (Object : Exchange) return String is
begin
return AWS.Status.URI (Object.Request.all);
end Path;
-------------------------
-- Identity Management --
-------------------------
function Identity (Object : Exchange) return Containers.Identity is
begin
return Object.Identity;
end Identity;
procedure Set_Identity
(Object : in out Exchange;
Identity : in Containers.Identity) is
begin
Object.Has_Identity := True;
Object.Identity := Identity;
end Set_Identity;
---------------------------
-- Response Construction --
---------------------------
procedure Append
(Object : in out Exchange;
Data : in S_Expressions.Atom) is
begin
Ensure_Kind (Object, Responses.Buffer);
Object.Filter.Apply (Object.Response_Body, Data);
end Append;
procedure Insert_Filter
(Object : in out Exchange;
Filter : in Filters.Filter'Class;
Side : in Filters.Side := Filters.Top) is
begin
Object.Filter.Insert (Filter, Side);
end Insert_Filter;
procedure Method_Not_Allowed
(Object : in out Exchange;
Allow : in Method_Set) is
begin
Object.Status_Code := AWS.Messages.S405;
Object.Allow := Allow;
end Method_Not_Allowed;
procedure Not_Found (Object : in out Exchange) is
begin
Object.Status_Code := AWS.Messages.S404;
end Not_Found;
procedure Remove_Filter
(Object : in out Exchange;
Filter : in Filters.Filter'Class;
Side : in Filters.Side := Filters.Top) is
begin
Object.Filter.Remove (Filter, Side);
end Remove_Filter;
procedure Send_File
(Object : in out Exchange;
File_Name : in S_Expressions.Atom) is
begin
Ensure_Kind (Object, Responses.File);
Object.Response_Body.Soft_Reset;
Object.Response_Body.Append (File_Name);
end Send_File;
procedure Set_Cookie
(Object : in out Exchange;
Key : in String;
Value : in String;
Comment : in String := "";
Domain : in String := "";
Max_Age : in Duration := 10.0 * 365.0 * 86400.0;
Path : in String := "/";
Secure : in Boolean := False;
HTTP_Only : in Boolean := False) is
begin
Object.Set_Cookies.Include (Key,
(Value_Length => Value'Length,
Comment_Length => Comment'Length,
Domain_Length => Domain'Length,
Path_Length => Path'Length,
Value => Value,
Comment => Comment,
Domain => Domain,
Max_Age => Max_Age,
Path => Path,
Secure => Secure,
HTTP_Only => HTTP_Only));
end Set_Cookie;
procedure Set_MIME_Type
(Object : in out Exchange;
MIME_Type : in S_Expressions.Atom)
is
use type S_Expressions.Count;
begin
if Object.Response_Body.Length /= 0 then
Log (Severities.Warning,
"Changing MIME type of partially-created response");
end if;
Object.MIME_Type
:= S_Expressions.Atom_Ref_Constructors.Create (MIME_Type);
end Set_MIME_Type;
procedure Permanent_Redirect
(Object : in out Exchange;
Target : in S_Expressions.Atom) is
begin
Object.Status_Code := AWS.Messages.S301;
Object.Location := Constructors.Create (Target);
end Permanent_Redirect;
procedure Permanent_Redirect
(Object : in out Exchange;
Target : in S_Expressions.Atom_Refs.Immutable_Reference) is
begin
Object.Status_Code := AWS.Messages.S301;
Object.Location := Target;
end Permanent_Redirect;
procedure See_Other
(Object : in out Exchange;
Target : in S_Expressions.Atom) is
begin
See_Other (Object, Constructors.Create (Target));
end See_Other;
procedure See_Other
(Object : in out Exchange;
Target : in S_Expressions.Atom_Refs.Immutable_Reference) is
begin
if AWS.Status.HTTP_Version (Object.Request.all) = AWS.HTTP_10 then
Object.Status_Code := AWS.Messages.S302;
else
Object.Status_Code := AWS.Messages.S303;
end if;
Object.Location := Target;
end See_Other;
---------------------
-- Response Export --
---------------------
function Response (Object : Exchange) return AWS.Response.Data is
Result : AWS.Response.Data;
begin
case Object.Kind is
when Responses.Empty =>
raise Program_Error with "Empty response cannot be exported";
when Responses.Buffer =>
if Object.MIME_Type.Is_Empty then
Result := AWS.Response.Build
("text/html",
Object.Response_Body.Data,
Object.Status_Code);
else
Result := AWS.Response.Build
(S_Expressions.To_String (Object.MIME_Type.Query.Data.all),
Object.Response_Body.Data,
Object.Status_Code);
end if;
when Responses.File =>
if Object.MIME_Type.Is_Empty then
declare
Filename : constant String
:= S_Expressions.To_String (Object.Response_Body.Data);
begin
Result := AWS.Response.File
(AWS.MIME.Content_Type (Filename),
Filename,
Object.Status_Code);
end;
else
Result := AWS.Response.File
(S_Expressions.To_String (Object.MIME_Type.Query.Data.all),
S_Expressions.To_String (Object.Response_Body.Data),
Object.Status_Code);
end if;
end case;
if Object.Allow /= Method_Set'(others => False) then
AWS.Response.Set.Add_Header
(Result,
AWS.Messages.Allow_Token,
Image (Object.Allow));
end if;
if not Object.Location.Is_Empty then
AWS.Response.Set.Add_Header
(Result,
AWS.Messages.Location_Token,
S_Expressions.To_String (Object.Location.Query));
end if;
for Cursor in Object.Set_Cookies.Iterate loop
declare
Element : constant Cookie_Data := Cookie_Maps.Element (Cursor);
begin
-- For newer AWS with HttpOnly support:
-- AWS.Cookie.Set
-- (Content => Result,
-- Key => Cookie_Maps.Key (Cursor),
-- Value => Element.Value,
-- Comment => Element.Comment,
-- Domain => Element.Domain,
-- Max_Age => Element.Max_Age,
-- Path => Element.Path,
-- Secure => Element.Secure,
-- HTTP_Only => Element.HTTP_Only);
-- Otherwise, inject HttpOnly after the always-added Path
AWS.Cookie.Set
(Content => Result,
Key => Cookie_Maps.Key (Cursor),
Value => Element.Value,
Comment => Element.Comment,
Domain => Element.Domain,
Max_Age => Element.Max_Age,
Path => (if Element.HTTP_Only
then Element.Path & "; HttpOnly"
else Element.Path),
Secure => Element.Secure);
end;
end loop;
return Result;
end Response;
end Natools.Web.Exchanges;
|
-- Copyright 2017-2021 Bartek thindil Jasicki
--
-- This file is part of Steam Sky.
--
-- Steam Sky 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.
--
-- Steam Sky 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 Steam Sky. If not, see <http://www.gnu.org/licenses/>.
-- ****h* Bases/BCargo
-- FUNCTION
-- Provide code for manipulate cargo of sky bases
-- SOURCE
package Bases.Cargo is
-- ****
-- ****f* BCargo/BCargo.Generate_Cargo
-- FUNCTION
-- Generate base cargo
-- SOURCE
procedure Generate_Cargo with
Test_Case => (Name => "Test_GenerateCargo", Mode => Robustness);
-- ****
-- ****f* BCargo/BCargo.Update_Base_Cargo
-- FUNCTION
-- Update cargo in base
-- PARAMETERS
-- Proto_Index - Index of item prototype. Can be empty if Cargo_Index is set
-- Amount - Amount of item to add or remove
-- Durability - Durability of item to add or remove. Can be empty
-- Cargo_Index - Index of item in sky base cargo. Can be empty if Proto_Index
-- is set
-- SOURCE
procedure Update_Base_Cargo
(Proto_Index: Unbounded_String := Null_Unbounded_String; Amount: Integer;
Durability: Items_Durability := Default_Item_Durability;
Cargo_Index: Inventory_Container.Extended_Index := 0) with
Test_Case => (Name => "Test_UpdateBaseCargo", Mode => Robustness);
-- ****
-- ****f* BCargo/BCargo.Find_Base_Cargo
-- FUNCTION
-- Find index of item in base cargo
-- PARAMETERS
-- Proto_Index - Index of prototype of item to search
-- Durability - Durability of item to search. Can be empty
-- RESULT
-- Index of item in sky base cargo or 0 if item not found
-- SOURCE
function Find_Base_Cargo
(Proto_Index: Unbounded_String;
Durability: Items_Durability := Items_Durability'Last)
return Natural with
Pre => Length(Source => Proto_Index) > 0,
Test_Case => (Name => "Test_FindBaseCargo", Mode => Nominal);
-- ****
end Bases.Cargo;
|
with Exprs; use Exprs;
use Exprs.Visitors;
with L_Strings; use L_Strings;
package Ast_Printers is
-- Creates an unambiguous, if ugly, string representation of AST nodes.
-- SPARK implementation follows Matthew Heaney
-- http://www.adapower.com/index.php?Command=Class&ClassID=Patterns&CID=288
-- This is because in Ada, generic functions cannot be overloaded, so we
-- cannot follow Bob's implementation
type Ast_Printer is new Visitor with
record
Image : L_String := To_Bounded_String ("");
end record;
function Print (V : Ast_Printer) return String;
function Print (The_Expr : Expr'Class) return String;
overriding
procedure visit_Binary_Expr (Self : in out Ast_Printer; The_Expr : Binary) with
Global => (input => Exprs.State);
overriding
procedure visit_Grouping_Expr (Self : in out Ast_Printer; The_Expr : Grouping);
overriding
procedure visit_Float_Literal_Expr (Self : in out Ast_Printer; The_Expr : Float_Literal);
overriding
procedure visit_Num_Literal_Expr (Self : in out Ast_Printer; The_Expr : Num_Literal);
overriding
procedure visit_Str_Literal_Expr (Self : in out Ast_Printer; The_Expr : Str_Literal);
overriding
procedure visit_Unary_Expr (Self : in out Ast_Printer; The_Expr : Unary);
private
function Print (The_Expr : Binary) return String;
function Print (The_Expr : Grouping) return String;
function Print (The_Expr : Float_Literal) return String;
function Print (The_Expr : Num_Literal) return String;
function Print (The_Expr : Str_Literal) return String;
function Print (The_Expr : Unary) return String;
end Ast_Printers;
|
with
any_Math.any_Arithmetic;
package float_Math.Arithmetic is new float_Math.any_Arithmetic;
pragma Pure (float_Math.Arithmetic);
|
-------------------------------------------------------------------------------
-- Copyright 2021, The Trendy Terminal Developers (see AUTHORS file)
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
-- http://www.apache.org/licenses/LICENSE-2.0
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-------------------------------------------------------------------------------
with Ada.Strings.Unbounded;
-- Ties together Lines to associated VT100 commands.
package Trendy_Terminal.Lines is
package ASU renames Ada.Strings.Unbounded;
-- The number of individual cursor positions in a string.
-- TODO: Support UTF-8
function Num_Cursor_Positions (S : String) return Natural is (S'Length);
-- A generic line to Lines text using a single cursor.
--
-- The cursor position is defined as being the position at which the new
-- Lines will appear. For an empty line, the only valid cursor position
-- is 1. For other lines, with a line range of [1,n], appropriate cursor
-- positions will be [1, n+1], 1 being "new character will be added at
-- index 1", and n+1 meaning "appending and increasing the length of the
-- Lines line".
--
-- Sample: sample
-- Length: 6
-- Indices: 123456
-- Cursor: ^
-- Valid cursor range: [1, 7]
--
type Line is private
with Type_Invariant => Get_Cursor_Index (Line) in 1 .. Length (Line) + 1;
type Cursor_Direction is (Left, Right);
function Length(Self : in Line) return Natural;
procedure Move_Cursor (Self : in out Line; Direction : Cursor_Direction);
function Make (Contents : ASU.Unbounded_String; Index : Positive) return Line;
function Make (S : String; Index : Positive) return Line;
function Make (S : String) return Line;
procedure Set (Self : in out Line; S : String; Index : Positive);
function Get_Cursor_Index (Self : in Line) return Positive;
procedure Set_Cursor_Index (Self : in out Line; Cursor_Index : Positive);
procedure Insert (Self : in out Line; S : String)
with Pre => S'Length >= 0,
Post => Length(Self'Old) + S'Length = Length(Self)
and then Get_Cursor_Index (Self'Old) + Num_Cursor_Positions (S) = Get_Cursor_Index(Self);
procedure Backspace (Self : in out Line)
with Post => Length(Self'Old) = 0
or else Get_Cursor_Index(Self'Old) = 1
or else (Length(Self'Old) = Length(Self) + 1
and then Get_Cursor_Index(Self'Old) - 1 = Get_Cursor_Index(Self));
-- Deletes a characters after the cursor position, shifting all text
-- afterwards to the left. Deleting does not modify the cursor position.
-- Nothing happens if cursor is after the last character in the Line.
procedure Delete (Self : in out Line)
with Post => Length (Self'Old) = 0
or else Get_Cursor_Index (Self'Old) = Length (Self) + 1
or else (Length(Self'Old) = Length(Self) + 1
and then Get_Cursor_Index (Self'Old) = Get_Cursor_Index (Self));
procedure Clear (Self : in out Line)
with Post => Length (Self) = 0
and then Get_Cursor_Index (Self) = 1;
function Current (Self : Line) return String;
overriding
function "="(Left, Right : Line) return Boolean is (
Get_Cursor_Index (Left) = Get_Cursor_Index (Right)
and then Current (Left) = Current (Right));
private
type Line is record
Contents : ASU.Unbounded_String := ASU.Null_Unbounded_String;
Cursor : Positive := 1;
end record;
end Trendy_Terminal.Lines;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014-2018, Vadim Godunko <vgodunko@gmail.com> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- Extends the ServletRequest interface to provide request information for
-- HTTP servlets.
--
-- The servlet container creates an HttpServletRequest object and passes it as
-- an argument to the servlet's service methods (doGet, doPost, etc).
------------------------------------------------------------------------------
with League.IRIs;
with League.String_Vectors;
with League.Strings;
with Servlet.HTTP_Cookie_Sets;
with Servlet.HTTP_Parameters;
with Servlet.HTTP_Parameter_Vectors;
with Servlet.HTTP_Sessions;
with Servlet.HTTP_Upgrade_Handlers;
with Servlet.Requests;
package Servlet.HTTP_Requests is
pragma Preelaborate;
type HTTP_Method is
(Options, Get, Head, Post, Put, Delete, Trace, Connect);
type HTTP_Servlet_Request is limited interface
and Servlet.Requests.Servlet_Request;
not overriding function Change_Session_Id
(Self : HTTP_Servlet_Request)
return League.Strings.Universal_String is abstract;
procedure Change_Session_Id (Self : HTTP_Servlet_Request'Class);
-- Change the session id of the current session associated with this
-- request and return the new session id.
--
-- Raises Program_Error if there is no session associates with the request.
not overriding function Get_Context_Path
(Self : HTTP_Servlet_Request)
return League.String_Vectors.Universal_String_Vector is abstract;
function Get_Context_Path
(Self : HTTP_Servlet_Request'Class) return League.Strings.Universal_String;
-- Returns the portion of the request URI that indicates the context of the
-- request. The context path always comes first in a request URI. The path
-- starts with a "/" character but does not end with a "/" character. For
-- servlets in the default (root) context, this method returns "". The
-- container does not decode this string.
--
-- It is possible that a servlet container may match a context by more than
-- one context path. In such cases this method will return the actual
-- context path used by the request and it may differ from the path
-- returned by the ServletContext.getContextPath() method. The context path
-- returned by ServletContext.getContextPath() should be considered as the
-- prime or preferred context path of the application.
not overriding function Get_Cookies
(Self : HTTP_Servlet_Request)
return Servlet.HTTP_Cookie_Sets.Cookie_Set is abstract;
-- Returns an array containing all of the Cookie objects the client sent
-- with this request. This method returns null if no cookies were sent.
not overriding function Get_Headers
(Self : HTTP_Servlet_Request;
Name : League.Strings.Universal_String)
return League.String_Vectors.Universal_String_Vector is abstract;
-- Returns all the values of the specified request header as an Enumeration
-- of String objects.
--
-- Some headers, such as Accept-Language can be sent by clients as several
-- headers each with a different value rather than sending the header as a
-- comma separated list.
--
-- If the request did not include any headers of the specified name, this
-- method returns an empty Enumeration. The header name is case
-- insensitive. You can use this method with any request header.
not overriding function Get_Method
(Self : HTTP_Servlet_Request) return HTTP_Method is abstract;
-- Returns the name of the HTTP method with which this request was made,
-- for example, GET, POST, or PUT. Same as the value of the CGI variable
-- REQUEST_METHOD.
function Get_Parameter
(Self : HTTP_Servlet_Request'Class;
Name : League.Strings.Universal_String)
return Servlet.HTTP_Parameters.HTTP_Parameter;
-- Gets the Parameters with the given name.
not overriding function Get_Parameter_Values
(Self : HTTP_Servlet_Request;
Name : League.Strings.Universal_String)
return Servlet.HTTP_Parameter_Vectors.HTTP_Parameter_Vector is abstract;
-- Gets the Parameters with the given name.
not overriding function Get_Path_Info
(Self : HTTP_Servlet_Request)
return League.String_Vectors.Universal_String_Vector is abstract;
function Get_Path_Info
(Self : HTTP_Servlet_Request'Class) return League.Strings.Universal_String;
-- Returns any extra path information associated with the URL the client
-- sent when it made this request. The extra path information follows the
-- servlet path but precedes the query string and will start with a "/"
-- character.
--
-- This method returns null if there was no extra path information.
--
-- Same as the value of the CGI variable PATH_INFO.
not overriding function Get_Request_URL
(Self : HTTP_Servlet_Request) return League.IRIs.IRI is abstract;
-- Returns the URL the client used to make the request. The returned URL
-- contains a protocol, server name, port number, and server path, but it
-- does not include query string parameters.
--
-- If this request has been forwarded using RequestDispatcher.forward
-- (ServletRequest, ServletResponse), the server path in the reconstructed
-- URL must reflect the path used to obtain the RequestDispatcher, and not
-- the server path specified by the client.
--
-- This method is useful for creating redirect messages and for reporting errors.
not overriding function Get_Requested_Session_Id
(Self : HTTP_Servlet_Request)
return League.Strings.Universal_String is abstract;
-- Returns the session ID specified by the client. This may not be the same
-- as the ID of the current valid session for this request. If the client
-- did not specify a session ID, this method returns null.
not overriding function Get_Servlet_Path
(Self : HTTP_Servlet_Request)
return League.String_Vectors.Universal_String_Vector is abstract;
function Get_Servlet_Path
(Self : HTTP_Servlet_Request'Class) return League.Strings.Universal_String;
-- Returns the part of this request's URL that calls the servlet. This path
-- starts with a "/" character and includes either the servlet name or a
-- path to the servlet, but does not include any extra path information or
-- a query string. Same as the value of the CGI variable SCRIPT_NAME.
--
-- This method will return an empty string ("") if the servlet used to
-- process this request was matched using the "/*" pattern.
not overriding function Get_Session
(Self : HTTP_Servlet_Request;
Create : Boolean := True)
return access Servlet.HTTP_Sessions.HTTP_Session'Class is abstract;
-- Returns the current HttpSession associated with this request or, if
-- there is no current session and create is true, returns a new session.
--
-- If create is false and the request has no valid HttpSession, this method
-- returns null.
--
-- To make sure the session is properly maintained, you must call this
-- method before the response is committed. If the container is using
-- cookies to maintain session integrity and is asked to create a new
-- session when the response is committed, an IllegalStateException is
-- thrown.
not overriding function Is_Requested_Session_Id_Valid
(Self : HTTP_Servlet_Request) return Boolean is abstract;
-- Checks whether the requested session ID is still valid.
--
-- If the client did not specify any session ID, this method returns false.
not overriding procedure Upgrade
(Self : HTTP_Servlet_Request;
Handler :
not null Servlet.HTTP_Upgrade_Handlers.HTTP_Upgrade_Handler_Access)
is abstract;
-- Uses given upgrade handler for the http protocol upgrade processing.
end Servlet.HTTP_Requests;
|
pragma License (Unrestricted);
-- extended unit specialized for Windows
with Ada.IO_Exceptions;
private with Ada.Finalization;
private with C.windef;
package System.Program.Dynamic_Linking is
-- Loading dynamic-link library.
pragma Preelaborate;
type Library is limited private;
-- subtype Open_Library is Library
-- with
-- Dynamic_Predicate => Is_Open (Open_Library),
-- Predicate_Failure => raise Status_Error;
function Is_Open (Lib : Library) return Boolean;
pragma Inline (Is_Open);
procedure Open (Lib : in out Library; Name : String);
function Open (Name : String) return Library;
procedure Close (Lib : in out Library);
function Import (
Lib : Library; -- Open_Library
Symbol : String)
return Address;
Status_Error : exception
renames Ada.IO_Exceptions.Status_Error;
Name_Error : exception
renames Ada.IO_Exceptions.Name_Error;
Use_Error : exception
renames Ada.IO_Exceptions.Use_Error;
Data_Error : exception
renames Ada.IO_Exceptions.Data_Error;
private
package Controlled is
type Library is limited private;
function Reference (Lib : Dynamic_Linking.Library)
return not null access C.windef.HMODULE;
pragma Inline (Reference);
private
type Library is
limited new Ada.Finalization.Limited_Controlled with
record
Handle : aliased C.windef.HMODULE := null;
end record;
overriding procedure Finalize (Object : in out Library);
end Controlled;
type Library is new Controlled.Library;
end System.Program.Dynamic_Linking;
|
with Ada.Real_Time; use Ada.Real_Time;
with Ada.Text_IO;use Ada.Text_IO;
with Ada.Dispatching.EDF; use Ada.Dispatching.EDF;
procedure Edf is
Interval : Time_Span := Milliseconds(1000);
Next : Time;
begin
Next := Clock;
Set_Deadline(Clock+Interval);
for Iter in 0 .. 50 loop
Put(Integer'Image(Iter));
Put_Line(":Delay 30 ms" );
Next := Next + Interval;
Delay_Until_And_Set_Deadline(Next, Interval);
end loop;
end Edf;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . V A L _ R E A L --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Powten_Table; use System.Powten_Table;
with System.Val_Util; use System.Val_Util;
package body System.Val_Real is
---------------
-- Scan_Real --
---------------
function Scan_Real
(Str : String;
Ptr : access Integer;
Max : Integer) return Long_Long_Float
is
procedure Reset;
pragma Import (C, Reset, "__gnat_init_float");
-- We import the floating-point processor reset routine so that we can
-- be sure the floating-point processor is properly set for conversion
-- calls (see description of Reset in GNAT.Float_Control (g-flocon.ads).
-- This is notably need on Windows, where calls to the operating system
-- randomly reset the processor into 64-bit mode.
P : Integer;
-- Local copy of string pointer
Base : Long_Long_Float;
-- Base value
Uval : Long_Long_Float;
-- Accumulated float result
subtype Digs is Character range '0' .. '9';
-- Used to check for decimal digit
Scale : Integer := 0;
-- Power of Base to multiply result by
Start : Positive;
-- Position of starting non-blank character
Minus : Boolean;
-- Set to True if minus sign is present, otherwise to False
Bad_Base : Boolean := False;
-- Set True if Base out of range or if out of range digit
After_Point : Natural := 0;
-- Set to 1 after the point
Num_Saved_Zeroes : Natural := 0;
-- This counts zeroes after the decimal point. A non-zero value means
-- that this number of previously scanned digits are zero. if the end
-- of the number is reached, these zeroes are simply discarded, which
-- ensures that trailing zeroes after the point never affect the value
-- (which might otherwise happen as a result of rounding). With this
-- processing in place, we can ensure that, for example, we get the
-- same exact result from 1.0E+49 and 1.0000000E+49. This is not
-- necessarily required in a case like this where the result is not
-- a machine number, but it is certainly a desirable behavior.
procedure Scanf;
-- Scans integer literal value starting at current character position.
-- For each digit encountered, Uval is multiplied by 10.0, and the new
-- digit value is incremented. In addition Scale is decremented for each
-- digit encountered if we are after the point (After_Point = 1). The
-- longest possible syntactically valid numeral is scanned out, and on
-- return P points past the last character. On entry, the current
-- character is known to be a digit, so a numeral is definitely present.
-----------
-- Scanf --
-----------
procedure Scanf is
Digit : Natural;
begin
loop
Digit := Character'Pos (Str (P)) - Character'Pos ('0');
P := P + 1;
-- Save up trailing zeroes after the decimal point
if Digit = 0 and After_Point = 1 then
Num_Saved_Zeroes := Num_Saved_Zeroes + 1;
-- Here for a non-zero digit
else
-- First deal with any previously saved zeroes
if Num_Saved_Zeroes /= 0 then
while Num_Saved_Zeroes > Maxpow loop
Uval := Uval * Powten (Maxpow);
Num_Saved_Zeroes := Num_Saved_Zeroes - Maxpow;
Scale := Scale - Maxpow;
end loop;
Uval := Uval * Powten (Num_Saved_Zeroes);
Scale := Scale - Num_Saved_Zeroes;
Num_Saved_Zeroes := 0;
end if;
-- Accumulate new digit
Uval := Uval * 10.0 + Long_Long_Float (Digit);
Scale := Scale - After_Point;
end if;
-- Done if end of input field
if P > Max then
return;
-- Check next character
elsif Str (P) not in Digs then
if Str (P) = '_' then
Scan_Underscore (Str, P, Ptr, Max, False);
else
return;
end if;
end if;
end loop;
end Scanf;
-- Start of processing for System.Scan_Real
begin
Reset;
Scan_Sign (Str, Ptr, Max, Minus, Start);
P := Ptr.all;
Ptr.all := Start;
-- If digit, scan numeral before point
if Str (P) in Digs then
Uval := 0.0;
Scanf;
-- Initial point, allowed only if followed by digit (RM 3.5(47))
elsif Str (P) = '.'
and then P < Max
and then Str (P + 1) in Digs
then
Uval := 0.0;
-- Any other initial character is an error
else
raise Constraint_Error;
end if;
-- Deal with based case
if P < Max and then (Str (P) = ':' or else Str (P) = '#') then
declare
Base_Char : constant Character := Str (P);
Digit : Natural;
Fdigit : Long_Long_Float;
begin
-- Set bad base if out of range, and use safe base of 16.0,
-- to guard against division by zero in the loop below.
if Uval < 2.0 or else Uval > 16.0 then
Bad_Base := True;
Uval := 16.0;
end if;
Base := Uval;
Uval := 0.0;
P := P + 1;
-- Special check to allow initial point (RM 3.5(49))
if Str (P) = '.' then
After_Point := 1;
P := P + 1;
end if;
-- Loop to scan digits of based number. On entry to the loop we
-- must have a valid digit. If we don't, then we have an illegal
-- floating-point value, and we raise Constraint_Error, note that
-- Ptr at this stage was reset to the proper (Start) value.
loop
if P > Max then
raise Constraint_Error;
elsif Str (P) in Digs then
Digit := Character'Pos (Str (P)) - Character'Pos ('0');
elsif Str (P) in 'A' .. 'F' then
Digit :=
Character'Pos (Str (P)) - (Character'Pos ('A') - 10);
elsif Str (P) in 'a' .. 'f' then
Digit :=
Character'Pos (Str (P)) - (Character'Pos ('a') - 10);
else
raise Constraint_Error;
end if;
-- Save up trailing zeroes after the decimal point
if Digit = 0 and After_Point = 1 then
Num_Saved_Zeroes := Num_Saved_Zeroes + 1;
-- Here for a non-zero digit
else
-- First deal with any previously saved zeroes
if Num_Saved_Zeroes /= 0 then
Uval := Uval * Base ** Num_Saved_Zeroes;
Scale := Scale - Num_Saved_Zeroes;
Num_Saved_Zeroes := 0;
end if;
-- Now accumulate the new digit
Fdigit := Long_Long_Float (Digit);
if Fdigit >= Base then
Bad_Base := True;
else
Scale := Scale - After_Point;
Uval := Uval * Base + Fdigit;
end if;
end if;
P := P + 1;
if P > Max then
raise Constraint_Error;
elsif Str (P) = '_' then
Scan_Underscore (Str, P, Ptr, Max, True);
else
-- Skip past period after digit. Note that the processing
-- here will permit either a digit after the period, or the
-- terminating base character, as allowed in (RM 3.5(48))
if Str (P) = '.' and then After_Point = 0 then
P := P + 1;
After_Point := 1;
if P > Max then
raise Constraint_Error;
end if;
end if;
exit when Str (P) = Base_Char;
end if;
end loop;
-- Based number successfully scanned out (point was found)
Ptr.all := P + 1;
end;
-- Non-based case, check for being at decimal point now. Note that
-- in Ada 95, we do not insist on a decimal point being present
else
Base := 10.0;
After_Point := 1;
if P <= Max and then Str (P) = '.' then
P := P + 1;
-- Scan digits after point if any are present (RM 3.5(46))
if P <= Max and then Str (P) in Digs then
Scanf;
end if;
end if;
Ptr.all := P;
end if;
-- At this point, we have Uval containing the digits of the value as
-- an integer, and Scale indicates the negative of the number of digits
-- after the point. Base contains the base value (an integral value in
-- the range 2.0 .. 16.0). Test for exponent, must be at least one
-- character after the E for the exponent to be valid.
Scale := Scale + Scan_Exponent (Str, Ptr, Max, Real => True);
-- At this point the exponent has been scanned if one is present and
-- Scale is adjusted to include the exponent value. Uval contains the
-- the integral value which is to be multiplied by Base ** Scale.
-- If base is not 10, use exponentiation for scaling
if Base /= 10.0 then
Uval := Uval * Base ** Scale;
-- For base 10, use power of ten table, repeatedly if necessary
elsif Scale > 0 then
while Scale > Maxpow loop
Uval := Uval * Powten (Maxpow);
Scale := Scale - Maxpow;
end loop;
if Scale > 0 then
Uval := Uval * Powten (Scale);
end if;
elsif Scale < 0 then
while (-Scale) > Maxpow loop
Uval := Uval / Powten (Maxpow);
Scale := Scale + Maxpow;
end loop;
if Scale < 0 then
Uval := Uval / Powten (-Scale);
end if;
end if;
-- Here is where we check for a bad based number
if Bad_Base then
raise Constraint_Error;
-- If OK, then deal with initial minus sign, note that this processing
-- is done even if Uval is zero, so that -0.0 is correctly interpreted.
else
if Minus then
return -Uval;
else
return Uval;
end if;
end if;
end Scan_Real;
----------------
-- Value_Real --
----------------
function Value_Real (Str : String) return Long_Long_Float is
V : Long_Long_Float;
P : aliased Integer := Str'First;
begin
V := Scan_Real (Str, P'Access, Str'Last);
Scan_Trailing_Blanks (Str, P);
return V;
end Value_Real;
end System.Val_Real;
|
separate (Numerics.Sparse_Matrices)
procedure Transposed (Mat : in out Sparse_Matrix) is
Tmp : Pos;
begin
Convert (Mat);
case Mat.Format is
when Triplet => null;
when CSR => Mat.Format := CSC;
when CSC => Mat.Format := CSR;
end case;
Tmp := Mat.N_Row;
Mat.N_Row := Mat.N_Col;
Mat.N_Col := Tmp;
end Transposed;
|
-- Copyright (c) 2019-2020 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Finalization;
with Ada.Streams;
with League.IRIs;
with League.String_Vectors;
with League.Strings;
package Torrent.Metainfo_Files is
type Metainfo_File is tagged limited private;
-- Metainfo files also known as .torrent files
type Metainfo_File_Access is access all Metainfo_File'Class;
not overriding procedure Read
(Self : in out Metainfo_File;
File_Name : League.Strings.Universal_String);
-- Read and decode given metainfo file
not overriding function Announce
(Self : Metainfo_File) return League.IRIs.IRI;
-- The URL of the tracker.
type String_Vector_Array is array (Positive range <>) of
League.String_Vectors.Universal_String_Vector;
not overriding function Announce_List
(Self : Metainfo_File) return String_Vector_Array;
-- A list of tiers of announces.
-- See BEP - 12 "Multitracker Metadata Extension".
not overriding function Name
(Self : Metainfo_File) return League.Strings.Universal_String;
-- The suggested name to save the file (or directory) as. It is purely
-- advisory.
not overriding function Piece_Length
(Self : Metainfo_File) return Piece_Offset;
-- The number of bytes in each piece the file is split into (except last).
not overriding function Last_Piece_Length
(Self : Metainfo_File) return Piece_Offset;
-- The number of bytes in the last piece.
not overriding function Piece_Count
(Self : Metainfo_File) return Piece_Index;
-- Number of pieces
not overriding function Piece_SHA1
(Self : Metainfo_File;
Index : Piece_Index) return SHA1
with Pre => Index <= Self.Piece_Count;
-- The SHA1 hash of the piece at the corresponding index.
not overriding function File_Count (Self : Metainfo_File) return Positive;
-- Number of files
not overriding function File_Length
(Self : Metainfo_File;
Index : Positive) return Ada.Streams.Stream_Element_Count
with Pre => Index <= Self.File_Count;
-- The length of the file in bytes.
not overriding function File_Path
(Self : Metainfo_File;
Index : Positive) return League.String_Vectors.Universal_String_Vector
with Pre => Index <= Self.File_Count;
-- A list of strings corresponding to subdirectory names, the last of
-- which is the actual file name.
not overriding function Info_Hash (Self : Metainfo_File) return SHA1;
-- The hash of the bencoded form of the info value from the metainfo file.
private
type SHA1_Array is array (Piece_Index range <>) of SHA1;
type File_Information is record
Length : Ada.Streams.Stream_Element_Count;
Path : League.String_Vectors.Universal_String_Vector;
end record;
type File_Information_Array is array (Positive range <>)
of File_Information;
type Metainfo
(Piece_Count : Piece_Index;
File_Count : Positive;
Announce_Count : Natural) is
record
Announce : League.IRIs.IRI;
Name : League.Strings.Universal_String;
Piece_Length : Piece_Offset;
Last_Piece : Piece_Offset;
Info_Hash : SHA1;
Hashes : SHA1_Array (1 .. Piece_Count);
Files : File_Information_Array (1 .. File_Count);
Announces : String_Vector_Array (1 .. Announce_Count);
end record;
type Metainfo_Access is access all Metainfo;
type Metainfo_File is new Ada.Finalization.Limited_Controlled with record
Data : Metainfo_Access;
end record;
procedure Finalize (Self : in out Metainfo_File);
end Torrent.Metainfo_Files;
|
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired)
--
-- Copyright William A. Whitaker (1936–2010)
--
-- This is a free program, which means it is proper to copy it and pass
-- it on to your friends. Consider it a developmental item for which
-- there is no charge. However, just for form, it is Copyrighted
-- (c). Permission is hereby freely given for any and all use of program
-- and data. You can sell it as your own, but at least tell me.
--
-- This version is distributed without obligation, but the developer
-- would appreciate comments and suggestions.
--
-- All parts of the WORDS system, source code and data files, are made freely
-- available to anyone who wishes to use them, for whatever purpose.
with Ada.Text_IO;
with Latin_Utils.Strings_Package; use Latin_Utils.Strings_Package;
with Latin_Utils.Latin_File_Names; use Latin_Utils.Latin_File_Names;
with Support_Utils.Word_Parameters; use Support_Utils.Word_Parameters;
with Support_Utils.Developer_Parameters; use Support_Utils.Developer_Parameters;
with Latin_Utils.Inflections_Package; use Latin_Utils.Inflections_Package;
with Latin_Utils.Dictionary_Package; use Latin_Utils.Dictionary_Package;
with Support_Utils.Word_Support_Package; use Support_Utils.Word_Support_Package;
with Latin_Utils.Preface;
with Words_Engine.Word_Package; use Words_Engine.Word_Package;
with Latin_Utils.Config; use Latin_Utils.Config;
--with Words_Engine.English_Support_Package;
--use Words_Engine.English_Support_Package;
with Banner;
use Latin_Utils;
with Words_Engine.Parse;
pragma Elaborate (Support_Utils.Word_Parameters);
procedure Process_Input (Configuration : Configuration_Type;
Command_Line : String := "")
is
-- use Inflections_Package.Integer_IO;
-- use Inflection_Record_IO;
use Ada.Text_IO;
procedure Delete_If_Open (Dict_Name : Dictionary_Kind) is
begin
begin
if Dict_IO.Is_Open (Dict_File (Dict_Name)) then
Dict_IO.Delete (Dict_File (Dict_Name));
else
Dict_IO.Open (Dict_File (Dict_Name), Dict_IO.In_File,
Path (Dict_File_Name & '.' & Ext (Dict_Name)));
Dict_IO.Delete (Dict_File (Dict_Name));
end if;
exception when others => null;
end; -- not there, so don't have to DELETE
end Delete_If_Open;
-- Get and handle a line of Input
-- return value says whether there is more Input, i.e. False -> quit
function Get_Input_Line return Boolean
is
Blank_Line : constant String (1 .. 2500) := (others => ' ');
Line : String (1 .. 2500) := (others => ' ');
L : Integer := 0;
begin
-- Block to manipulate file of lines
if Name (Current_Input) = Name (Standard_Input) then
Scroll_Line_Number :=
Integer (Ada.Text_IO.Line (Ada.Text_IO.Standard_Output));
--Preface.New_Line;
Preface.Put (" ");
end if;
Line := Blank_Line;
Get_Line (Line, L);
if (L = 0) or else (Trim (Line (1 .. L)) = "") then
-- Count blank lines
--LINE_NUMBER := LINE_NUMBER + 1;
if Name (Current_Input) = Name (Standard_Input) then
-- INPUT is keyboard
Preface.Put (" ");
Get_Line (Line, L);
-- Second try
if (L = 0) or else (Trim (Line (1 .. L)) = "") then
-- Two in a row
return False;
end if;
else
-- INPUT is file
--LINE_NUMBER := LINE_NUMBER + 1;
-- Count blank lines in file
if End_Of_File (Current_Input) then
Set_Input (Standard_Input);
Close (Input);
end if;
end if;
end if;
if Trim (Line (1 .. L)) /= "" then
-- Not a blank line so L (1) (in file Input)
if Line (1) = Start_File_Character then
if Name (Current_Input) /= Name (Standard_Input) then
Ada.Text_IO.Put_Line ("Cannot have file of words (@FILE) " &
"in an @FILE");
else
Ada.Text_IO.Open
(Input, Ada.Text_IO.In_File, Trim (Line (2 .. L)));
Ada.Text_IO.Set_Input (Input);
end if;
elsif Line (1) = Change_Parameters_Character and then
(Name (Current_Input) = Name (Standard_Input)) and then
not Config.Suppress_Preface
then
Change_Parameters;
elsif Line (1) = Change_Language_Character then
Change_Language (Line (2));
elsif
Line (1) = Change_Developer_Modes_Character and then
(Name (Current_Input) = Name (Standard_Input)) and then
not Config.Suppress_Preface
then
Change_Developer_Modes;
else
if Name (Current_Input) /= Name (Standard_Input) then
Preface.Put_Line (Line (1 .. L));
end if;
if Words_Mode (Write_Output_To_File) then
if not Config.Suppress_Preface then
New_Line (Output);
Ada.Text_IO.Put_Line (Output, Line (1 .. L));
end if;
end if;
-- Count lines to be parsed
Line_Number := Line_Number + 1;
Words_Engine.Parse.Parse_Line (Configuration, Line (1 .. L));
end if;
end if;
return True;
exception
when Name_Error | Use_Error =>
if Name (Current_Input) /= Name (Standard_Input) then
Set_Input (Standard_Input);
Close (Input);
end if;
Put_Line ("An unknown or unacceptable file name. Try Again");
return True;
when End_Error =>
-- The end of the input file resets to CON:
if Name (Current_Input) /= Name (Standard_Input) then
Set_Input (Standard_Input);
Close (Input);
if Method = Command_Line_Files then
raise Give_Up;
end if;
return True;
else
raise Give_Up;
end if;
when Status_Error =>
-- The end of the Input file resets to CON:
Put_Line ("Raised STATUS_ERROR");
return False;
end Get_Input_Line;
begin
-- PARSE
if Method = Command_Line_Input then
if Trim (Command_Line) /= "" then
Words_Engine.Parse.Parse_Line (Configuration, Command_Line);
end if;
else
-- Banner.Print_Main_Banner (Start_File_Character,
-- Change_Parameters_Character, Help_Character);
-- if English_Dictionary_Available (General) then
-- Preface.Put_Line (
-- Change_Language_Character & "E/L switches Eng-Lat/Lat-Eng");
-- end if;
if Configuration = Only_Meanings then
Banner.Print_Mode_Warning;
end if;
while Get_Input_Line loop
null;
end loop;
end if; -- On command line Input
begin
Stem_Io.Open (Stem_File (Local), Stem_Io.In_File,
Path (Stem_File_Name & '.' & Ext (Local)));
-- Failure to OPEN will raise an exception, to be handled below
if Stem_Io.Is_Open (Stem_File (Local)) then
Stem_Io.Delete (Stem_File (Local));
end if;
exception
when others =>
null; -- If cannot OPEN then it does not exist, so is deleted
end;
-- The rest of this seems like overkill, it might have been done elsewhere
Delete_If_Open (Local);
Delete_If_Open (Addons);
Delete_If_Open (Unique);
exception
when Storage_Error => -- Have tried at least twice, fail
Preface.Put_Line ("Continuing STORAGE_ERROR Exception in PARSE");
Preface.Put_Line ("If insufficient memory in DOS, try removing TSRs");
when Give_Up =>
Preface.Put_Line ("Exit...");
when others =>
Preface.Put_Line ("Unexpected exception raised in PARSE");
end Process_Input;
|
-- { dg-do compile }
package CPP_Assignment is
type T is tagged record
Data : Integer := 0;
end record;
pragma Convention (CPP, T);
Obj1 : T := (Data => 1); Obj2 : T'Class := Obj1;
end;
|
-- { dg-do compile }
procedure Entry_Queues3 is
generic
type Large_Range is range <>;
package Queue is
end;
package body Queue is
task T is
entry E(Large_Range);
end T ;
task body T is
begin
accept E(Large_Range'First) do
null;
end e ;
end T ;
end Queue;
type Large_Range is range 0 .. Long_Integer'Last;
package My_Queue is new Queue(Large_Range); -- { dg-warning "warning" }
begin
null;
end;
|
with Text_IO; use Text_IO;
procedure Call_CPP is
procedure cpp_routine;
pragma Import (C, cpp_routine);
Error : exception;
procedure Raise_And_Catch is
begin
Put ("in Ada: raise ... ");
raise Error;
exception
when Error =>
Put_Line ("and catch!");
end Raise_And_Catch;
begin
Put_Line ("In Call_CPP");
Raise_And_Catch;
cpp_routine;
Put_Line ("Back in Call_CPP");
Raise_And_Catch;
end Call_CPP;
|
with Interfaces; use Interfaces;
with Types; use Types;
package Stack is
Stack_Capacity : constant Natural := 16;
subtype Stack_Range is Natural range 0 .. Stack_Capacity - 1;
type Stack_Elements is array (Stack_Range) of Address;
type Stack_Record is record
Arr : Stack_Elements;
Size : Natural;
end record;
procedure Push_Stack(Stack : in out Stack_Record; Element : Address)
with Pre => Stack.Size < Stack_Capacity,
Post => Stack.Size <= Stack_Capacity
and then Stack.Size = Stack.Size'Old + 1;
function Pop_Stack(Stack : in out Stack_Record) return Address
with Pre => Stack.Size > 0,
Post => Stack.Size = Stack.Size'Old - 1
and then Pop_Stack'Result = Stack.Arr(Stack.Size);
function Peek_Stack(Stack : Stack_Record) return Address
with Pre => Stack.Size > 0,
Post => Peek_Stack'Result = Stack.Arr(Stack.Size - 1);
function Init_Stack return Stack_Record;
end Stack;
|
-- Institution: Technische Universitaet Muenchen
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
--
-- Authors: Martin Becker (becker@rcs.ei.tum.de>
with HIL.Config;
with HIL.Timers;
with HIL.Devices.Timers;
-- @summary
-- Target-independent specification for simple HIL of Piezo Buzzer
package body HIL.Buzzer is
procedure Initialize is
begin
case HIL.Config.BUZZER_PORT is
when HIL.Config.BUZZER_USE_AUX5 =>
HIL.Timers.Initialize (HIL.Devices.Timers.Timer_Buzzer_Aux);
when HIL.Config.BUZZER_USE_PORT =>
HIL.Timers.Initialize (HIL.Devices.Timers.Timer_Buzzer_Port);
end case;
end Initialize;
procedure Enable is
begin
case HIL.Config.BUZZER_PORT is
when HIL.Config.BUZZER_USE_AUX5 =>
HIL.Timers.Enable (t => HIL.Devices.Timers.Timer_Buzzer_Aux,
ch => HIL.Devices.Timers.Timerchannel_Buzzer_Aux);
when HIL.Config.BUZZER_USE_PORT =>
HIL.Timers.Enable (t => HIL.Devices.Timers.Timer_Buzzer_Port,
ch => HIL.Devices.Timers.Timerchannel_Buzzer_Port);
end case;
end Enable;
procedure Disable is begin
case HIL.Config.BUZZER_PORT is
when HIL.Config.BUZZER_USE_AUX5 =>
HIL.Timers.Disable (t => HIL.Devices.Timers.Timer_Buzzer_Aux,
ch => HIL.Devices.Timers.Timerchannel_Buzzer_Aux);
when HIL.Config.BUZZER_USE_PORT =>
HIL.Timers.Disable (t => HIL.Devices.Timers.Timer_Buzzer_Port,
ch => HIL.Devices.Timers.Timerchannel_Buzzer_Port);
end case;
end Disable;
procedure Set_Frequency (Frequency : Units.Frequency_Type) is
begin
case HIL.Config.BUZZER_PORT is
when HIL.Config.BUZZER_USE_AUX5 =>
HIL.Timers.Configure_OC_Toggle (This => HIL.Devices.Timers.Timer_Buzzer_Aux,
Channel => HIL.Devices.Timers.Timerchannel_Buzzer_Aux,
Frequency => Frequency);
when HIL.Config.BUZZER_USE_PORT =>
HIL.Timers.Configure_OC_Toggle (This => HIL.Devices.Timers.Timer_Buzzer_Port,
Channel => HIL.Devices.Timers.Timerchannel_Buzzer_Port,
Frequency => Frequency);
end case;
end Set_Frequency;
end HIL.Buzzer;
|
-- The Village of Vampire by YT, このソースコードはNYSLです
with Tabula.Users;
procedure Vampire.R3.User_Page (
Output : not null access Ada.Streams.Root_Stream_Type'Class;
Form : in Forms.Root_Form_Type'Class;
Template : in String;
Summaries : in Tabula.Villages.Lists.Summary_Maps.Map;
User_Id : in String;
User_Password : in String;
User_Info : in Users.User_Info);
|
-------------------------------------------------------------------------------
-- Package : Show_Version --
-- Description : Display current program version and build info. --
-- Author : Simon Rowe <simon@wiremoons.com> --
-- License : MIT Open Source. --
-------------------------------------------------------------------------------
package Show_Version is
procedure Show;
-- Main procedure to output program version information
procedure Set_Debug (Is_Debug : in out Boolean);
-- Test if application is a debug build
function Is_Linux return Boolean;
-- Check if running on a Linux operating system
function Is_Windows return Boolean;
-- Check if running on a Windows operating system
function Get_Linux_OS return String;
-- Get the name and version of the running Linux operating system
end Show_Version;
|
-- A lexical scanner generated by aflex
with text_io; use text_io;
with vole_lex_dfa; use vole_lex_dfa;
with vole_lex_io; use vole_lex_io;
--# line 1 "vole_lex.l"
--FLOAT_SEQUENCE {DIGIT_SEQUENCE}[.]{DIGIT_SEQUENCE}{EXPONENT}?
--# line 12 "vole_lex.l"
with Vole_Tokens;
use Vole_Tokens;
package kv.avm.Vole_Lex is
Line_Number : Positive := 1;
procedure Report;
procedure Inc_Line;
function YYLex return Token;
end kv.avm.Vole_Lex;
|
------------------------------------------------------------------------------
-- AGAR CORE LIBRARY --
-- A G A R . O B J E C T --
-- S p e c --
------------------------------------------------------------------------------
with Agar.Data_Source;
with Agar.Event;
with Agar.Timer;
with Agar.Types; use Agar.Types;
with Interfaces;
with Interfaces.C;
with Interfaces.C.Strings;
with System;
--
-- Interface to the Agar Object System. This defines the base type, Agar.Object.
-- It maps transparently to AG_Object(3) in C. This allows new Agar object
-- classes to be written in Ada (and subclasses of Ada-implemented classes
-- to be written also in Ada, or again in C).
--
-- In C, Agar objects are structs derived from AG_Object. Similarly in Ada,
-- Agar object instances are limited records which derive from Agar.Object.
--
-- Shared, class-wide data is represented by limited records which derive
-- from Agar.Class (equivalent to AG_ObjectClass in C).
--
package Agar.Object is
package C renames Interfaces.C;
package CS renames Interfaces.C.Strings;
package DS renames Agar.Data_Source;
package EV renames Agar.Event;
package TMR renames Agar.Timer;
NAME_MAX : constant Natural := $AG_OBJECT_NAME_MAX;
HIERARCHY_MAX : constant Natural := $AG_OBJECT_HIER_MAX;
TYPE_MAX : constant Natural := $AG_OBJECT_TYPE_MAX;
LIBRARIES_MAX : constant Natural := $AG_OBJECT_LIBS_MAX;
----------------
-- Base Types --
----------------
type Signed_8 is range -127 .. 127 with Convention => C;
for Signed_8'Size use 8;
type Signed_16 is range -(2 **15) .. +(2 **15 - 1) with Convention => C;
for Signed_16'Size use 16;
type Signed_32 is range -(2 **31) .. +(2 **31 - 1) with Convention => C;
for Signed_32'Size use 32;
type Signed_64 is range -(2 **63) .. +(2 **63 - 1) with Convention => C;
for Signed_64'Size use 64;
subtype Unsigned_8 is Interfaces.Unsigned_8;
subtype Unsigned_16 is Interfaces.Unsigned_16;
subtype Unsigned_32 is Interfaces.Unsigned_32;
subtype Unsigned_64 is Interfaces.Unsigned_64;
#if HAVE_FLOAT
subtype Float is Interfaces.C.C_float;
subtype Double is Interfaces.C.double;
# if HAVE_LONG_DOUBLE
subtype Long_Double is Interfaces.C.long_double;
# end if;
#end if;
--------------------------
-- Agar Object variable --
--------------------------
type Variable is array (1 .. $SIZEOF_AG_Variable) of
aliased Interfaces.Unsigned_8 with Convention => C;
for Variable'Size use $SIZEOF_AG_Variable * System.Storage_Unit;
type Variable_Access is access all Variable with Convention => C;
subtype Variable_not_null_Access is not null Variable_Access;
-------------------------------
-- Serialized Object version --
-------------------------------
type Version_t is record
Major : Interfaces.Unsigned_32;
Minor : Interfaces.Unsigned_32;
end record
with Convention => C;
type Version_Access is access all Version_t
with Convention => C;
--------------------------
-- Agar Object Instance --
--------------------------
type Object;
type Object_Access is access all Object with Convention => C;
subtype Object_not_null_Access is not null Object_Access;
type Object_Name is array (1 .. NAME_MAX) of
aliased c.char with Convention => C;
type Class;
type Class_Access is access all Class with Convention => C;
subtype Class_not_null_Access is not null Class_Access;
type Dependency is array (1 .. $SIZEOF_AG_ObjectDep) of
aliased Interfaces.Unsigned_8 with Convention => C;
for Dependency'Size use $SIZEOF_Ag_ObjectDep * System.Storage_Unit;
type Dependency_Access is access all Dependency with Convention => C;
subtype Dependency_not_null_Access is not null Dependency_Access;
type Dependency_List is limited record
First : Dependency_Access;
Last : access Dependency_Access;
end record
with Convention => C;
type Event_List is limited record
First : EV.Event_Access;
Last : access EV.Event_Access;
end record
with Convention => C;
type Timer_List is limited record
First : TMR.Timer_Access;
Last : access TMR.Timer_Access;
end record
with Convention => C;
type Variable_List is limited record
First : Variable_Access;
Last : access Variable_Access;
end record
with Convention => C;
type Children_List is limited record
First : Object_Access;
Last : access Object_Access;
end record
with Convention => C;
type Entry_in_Parent_t is limited record
Next : Object_Access;
Prev : access Object_Access;
end record
with Convention => C;
type Object_Private is array (1 .. $SIZEOF_AG_ObjectPvt) of
aliased Interfaces.Unsigned_8 with Convention => C;
for Object_Private'Size use $SIZEOF_AG_ObjectPvt * System.Storage_Unit;
OBJECT_FLOATING_VARIABLES : constant C.unsigned := 16#0_0001#;
OBJECT_NON_PERSISTENT : constant C.unsigned := 16#0_0002#;
OBJECT_INDESTRUCTIBLE : constant C.unsigned := 16#0_0004#;
OBJECT_RESIDENT : constant C.unsigned := 16#0_0008#;
OBJECT_PRESERVE_DEPENDENCIES : constant C.unsigned := 16#0_0010#;
OBJECT_STATIC : constant C.unsigned := 16#0_0020#;
OBJECT_READ_ONLY : constant C.unsigned := 16#0_0040#;
OBJECT_WAS_RESIDENT : constant C.unsigned := 16#0_0080#;
OBJECT_REOPEN_ON_LOAD : constant C.unsigned := 16#0_0200#;
OBJECT_REMAIN_DATA : constant C.unsigned := 16#0_0400#;
OBJECT_DEBUG : constant C.unsigned := 16#0_0800#;
OBJECT_NAME_ON_ATTACH : constant C.unsigned := 16#0_1000#;
OBJECT_CHILD_AUTO_SAVE : constant C.unsigned := 16#0_2000#;
OBJECT_DEBUG_DATA : constant C.unsigned := 16#0_4000#;
OBJECT_IN_ATTACH_ROUTINE : constant C.unsigned := 16#0_8000#;
OBJECT_IN_DETACH_ROUTINE : constant C.unsigned := 16#1_0000#;
OBJECT_BOUND_EVENTS : constant C.unsigned := 16#2_0000#;
type Object is limited record
Name : Object_Name;
-- TODO 1.6 archivePath/savePfx are going away
Archive_Path : CS.chars_ptr;
Save_Prefix : CS.chars_ptr;
Class : Class_not_null_Access;
Flags : C.unsigned;
Events : Event_List;
Timers : Timer_List;
Variables : Variable_List;
Dependencies : Dependency_List;
Children : Children_List;
Entry_in_Parent : Entry_in_Parent_t;
Parent : Object_Access;
Root : Object_Access;
Private_Data : Object_Private;
end record
with Convention => C;
-------------------------------------
-- Accesses to Base Object Methods --
-------------------------------------
type Init_Func_Access is access procedure (Object : Object_Access)
with Convention => C;
type Reset_Func_Access is access procedure (Object : Object_Access)
with Convention => C;
type Destroy_Func_Access is access procedure (Object : Object_Access)
with Convention => C;
type Load_Func_Access is access function
(Object : Object_Access;
Source : DS.Data_Source_Access;
Version : Version_Access) return C.int with Convention => C;
type Save_Func_Access is access function
(Object : Object_Access;
Dest : DS.Data_Source_Access) return C.int with Convention => C;
type Edit_Func_Access is access function
(Object : Object_Access) return System.Address with Convention => C;
------------------------------
-- Object Class Description --
------------------------------
type Class_Name is array (1 .. TYPE_MAX) of aliased c.char
with Convention => C;
type Class_Hierarchy is array (1 .. HIERARCHY_MAX) of aliased c.char
with Convention => C;
type Class_Private is array (1 .. $SIZEOF_AG_ObjectClassPvt) of
aliased Interfaces.Unsigned_8 with Convention => C;
for Class_Private'Size use $SIZEOF_AG_ObjectClassPvt * System.Storage_Unit;
type Class_Private_Access is access all Class_Private with Convention => C;
type Class is limited record
Hierarchy : Class_Hierarchy;
Size : AG_Size;
Version : Version_t;
Init_Func : Init_Func_Access;
Reset_Func : Reset_Func_Access;
Destroy_Func : Destroy_Func_Access;
Load_Func : Load_Func_Access;
Save_Func : Save_Func_Access;
Edit_Func : Edit_Func_Access;
-- Generated fields --
Name : Class_Name;
Superclass : Class_Access;
Private_Data : Class_Private;
end record
with Convention => C;
---------------------------------
-- Serialized Object Signature --
---------------------------------
type Object_Header is array (1 .. $SIZEOF_AG_ObjectHeader) of
aliased Interfaces.Unsigned_8 with Convention => C;
for Object_Header'Size use $SIZEOF_AG_ObjectHeader * System.Storage_Unit;
type Header_Access is access all Object_Header with Convention => C;
subtype Header_not_null_Access is not null Header_Access;
-----------------------
-- Virtual Functions --
-----------------------
type Function_Access is access all EV.Event with Convention => C;
subtype Function_not_null_Access is not null Function_Access;
type Event_Func_Access is not null access procedure
(Event : EV.Event_Access)
with Convention => C;
--
-- Create a new instance of Class under Parent with the given name. Fail
-- and return null if an object of the same name already exists.
--
function New_Object
(Parent : in Object_Access;
Name : in String;
Class : in Class_not_null_Access) return Object_Access;
--
-- Create a new instance of Class under Parent, without naming the object.
--
function New_Object
(Parent : in Object_Access;
Class : in Class_not_null_Access) return Object_Access;
--
-- Create a new instance of Class not attached to any parent.
--
function New_Object
(Class : in Class_not_null_Access) return Object_Access;
--
-- Initialize an Agar Object. Used internally by New_Object. Static should be
-- set unless Object points to auto-allocated and Agar-freeable memory.
--
procedure Init_Object
(Object : in Object_not_null_Access;
Class : in Class_not_null_Access;
Static : in Boolean := False);
--
-- Make Object a child of Parent.
--
procedure Attach
(Parent : in Object_Access;
Child : in Object_not_null_Access);
--
-- Detach Object from its current Parent (if any).
--
procedure Detach (Object : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "AG_ObjectDetach";
--
-- Change an object's position within its parent's list of child objects.
-- This list is ordered and the order is preserved by serialization.
--
procedure Move_Up (Object : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "AG_ObjectMoveUp";
procedure Move_Down (Object : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "AG_ObjectMoveDown";
procedure Move_To_Head (Object : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "AG_ObjectMoveToHead";
procedure Move_To_Tail (Object : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "AG_ObjectMoveToTail";
-- Shorthand for Detach and Destroy.
--procedure Delete (Object : in Object_not_null_Access)
-- with Import, Convention => C, Link_Name => "AG_ObjectDelete";
--
-- Return the root object of the VFS that Object is part of.
-- May return the Object itself if Object is the VFS root.
--
function Root (Object : in Object_not_null_Access) return Object_not_null_Access
with Import, Convention => C, Link_Name => "AG_ObjectRoot";
--
-- Return an access to the Parent of an Object (which can be Null).
--
function Parent (Object : in Object_not_null_Access) return Object_Access
with Import, Convention => C, Link_Name => "AG_ObjectParent";
--
-- Lookup an object using an absolute path name (relative to the root of
-- the VFS which has object Root as its root).
--
function Find
(Root : in Object_not_null_Access;
Path : in String) return Object_Access;
--
-- Search for a parent object matching Name and Object_Type.
--
function Find_Parent
(Object : in Object_not_null_Access;
Name : in String;
Class : in String) return Object_Access;
--
-- Return Parent's first immediate child object called Name.
--
function Find_Child
(Parent : in Object_not_null_Access;
Name : in String) return Object_Access;
--
-- Return the fully qualified path name of Object (within its parent VFS).
-- The "/" character is used as path separator.
--
function Get_Name (Object : in Object_not_null_Access) return String;
--
-- Acquire or release the general-purpose mutex lock protecting Object's data.
-- This lock is always held implicitely during event processing.
--
procedure Lock (Object : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "ag_object_lock";
procedure Unlock (Object : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "ag_object_unlock";
--
-- Acquire or release the mutex lock protecting the entire VFS.
--
procedure Lock_VFS (Object : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "ag_lock_vfs";
procedure Unlock_VFS(Object : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "ag_unlock_vfs";
--
-- Rename the object. Does not check for potential conflict.
--
procedure Set_Name
(Object : in Object_not_null_Access;
Name : in String);
--
-- Return a unique (relative to its Parent) name for the Object.
-- With a class argument, use the form : "<Class name> #123"
-- With a Prefix string, use the form : "<Prefix> #123"
--
function Generate_Name
(Object : in Object_not_null_Access;
Class : in Class_not_null_Access) return String;
function Generate_Name
(Object : in Object_not_null_Access;
Prefix : in String) return String;
--
-- Register a new class given a class description.
--
procedure Register_Class (Class : Class_not_null_Access)
with Import, Convention => C, Link_Name => "AG_RegisterClass";
--
-- Delete an existing class.
--
procedure Unregister_Class (Class : Class_not_null_Access)
with Import, Convention => C, Link_Name => "AG_UnregisterClass";
--
-- Register a new Agar object class.
--
function Create_Class
(Hierarchy : in String;
Object_Size : in Natural;
Class_Size : in Natural;
Major : in Natural := 1;
Minor : in Natural := 0;
Init_Func : in Init_Func_Access := null;
Reset_Func : in Reset_Func_Access := null;
Destroy_Func : in Destroy_Func_Access := null;
Load_Func : in Load_Func_Access := null;
Save_Func : in Save_Func_Access := null;
Edit_Func : in Edit_Func_Access := null) return Class_not_null_Access;
--
-- Remove and deallocate an Agar object class.
--
procedure Destroy_Class (Class : Class_not_null_Access)
with Import, Convention => C, Link_Name => "AG_DestroyClass";
--
-- Modify the initialization procedure of a class.
--
procedure Class_Set_Init
(Class : in Class_not_null_Access;
Init_Func : in Init_Func_Access);
function Class_Set_Init
(Class : in Class_not_null_Access;
Init_Func : in Init_Func_Access) return Init_Func_Access;
--
-- Modify the reset procedure of a class.
--
procedure Class_Set_Reset
(Class : in Class_not_null_Access;
Reset_Func : in Reset_Func_Access);
function Class_Set_Reset
(Class : in Class_not_null_Access;
Reset_Func : in Reset_Func_Access) return Reset_Func_Access;
--
-- Modify the finalization procedure of a class.
--
procedure Class_Set_Destroy
(Class : in Class_not_null_Access;
Destroy_Func : in Destroy_Func_Access);
function Class_Set_Destroy
(Class : in Class_not_null_Access;
Destroy_Func : in Destroy_Func_Access) return Destroy_Func_Access;
--
-- Modify the deserialization function of a class.
--
procedure Class_Set_Load
(Class : in Class_not_null_Access;
Load_Func : in Load_Func_Access);
function Class_Set_Load
(Class : in Class_not_null_Access;
Load_Func : in Load_Func_Access) return Load_Func_Access;
--
-- Modify the serialization function of a class.
--
procedure Class_Set_Save
(Class : in Class_not_null_Access;
Save_Func : in Save_Func_Access);
function Class_Set_Save
(Class : in Class_not_null_Access;
Save_Func : in Save_Func_Access) return Save_Func_Access;
--
-- Modify the (application-specific) edit function of a class.
--
procedure Class_Set_Edit
(Class : in Class_not_null_Access;
Edit_Func : in Edit_Func_Access);
function Class_Set_Edit
(Class : in Class_not_null_Access;
Edit_Func : in Edit_Func_Access) return Edit_Func_Access;
--
-- Register a new namespace and prefix. This is used for expanding inheritance
-- hierarchy strings such as "Agar(Foo:Bar)" to "AG_Foo:AG_Bar".
-- For example, ("Agar", "AG_", "http://libagar.org/").
--
procedure Register_Namespace
(Name : in String;
Prefix : in String;
URL : in String);
procedure Unregister_Namespace
(Name : in String);
--
-- Return access to the registered class described by a hierarchy string.
--
function Lookup_Class (Class : in String) return Class_Access;
--
-- Load any module (and register any class) required to satisfy the given
-- inheritance hierarchy. Modules are specified as a comma-separated list
-- following '@'. For example: "MySuper:MySubclass@mymodule" specifies
-- that Load_Class should scan the registered Module Directories for a DSO
-- such as mymodule.so. If found, it expects to find a symbol "mySubclass"
-- pointing to an initialized Class describing MySubclass.
--
function Load_Class (Class : in String) return Class_Access;
--
-- Add or remove directories to the search path used by Load_Class.
--
procedure Register_Module_Directory (Path : in String);
procedure Unregister_Module_Directory (Path : in String);
--
-- Test if Object is a member of the class described by a String pattern.
-- Pattern describes an inheritance hierarchy with possible wildcards ("*").
-- "Vehicle:Car" <= True if this is a Car (but not a subclass of Car).
-- "Vehicle:Car:*" <= True if this is a Car (or a subclass of Car).
--
function Is_Of_Class
(Object : in Object_not_null_Access;
Pattern : in String) return Boolean;
function Is_A
(Object : in Object_not_null_Access;
Pattern : in String) return Boolean;
--
-- Test if an object is being referenced by another object in the same VFS.
--
function In_Use (Object : in Object_not_null_Access) return Boolean;
--
-- Add Dependency to Object's dependency table. If Persistent is True,
-- mark the reference as serializable.
--
function Add_Dependency
(Object : in Object_not_null_Access;
Dependency : in Object_not_null_Access;
Persistent : in Boolean := False) return Dependency_Access;
--
-- Remove Dependency from Object's dependency table.
--
procedure Delete_Dependency
(Object : in Object_not_null_Access;
Dependency : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "AG_ObjectDelDep";
--
-- Return a serializable handle uniquely identifying the entry corresponding
-- to the object Dependency within Object's dependency table.
--
function Encode_Dependency
(Object : in Object_not_null_Access;
Dependency : in Object_not_null_Access) return Interfaces.Unsigned_32
with Import, Convention => C, Link_Name => "AG_ObjectEncodeName";
--
-- Resolve a dependency handle previously generated by Encode_Dependency. If
-- successful, return access to the resolved Object in Pointer.
--
function Find_Dependency
(Object : in Object_not_null_Access;
Index : in Interfaces.Unsigned_32;
Pointer : access Object_not_null_Access) return Boolean;
--
-- Free an Object instance from memory.
--
procedure Destroy (Object : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "AG_ObjectDestroy";
--
-- Restore the Object to an initial state. Invoked by both Load and Destroy.
--
procedure Reset (Object : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "AG_ObjectReset";
--
-- Clear the registered event handlers, Variables and Dependencies.
--
procedure Free_Events (Object : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "AG_ObjectFreeEvents";
procedure Free_Variables (Object : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "AG_ObjectFreeVariables";
procedure Free_Dependencies (Object : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "AG_ObjectFreeDeps";
--
-- Remove any dependencies with a reference count of 0.
--
procedure Clean_Up_Dependencies (Object : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "AG_ObjectFreeDummyDeps";
--
-- Detach and Destroy all child objects.
--
procedure Free_Children (Object : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "AG_ObjectFreeChildren";
--
-- Load the state of an object from serialized storage.
--
-- If File is not given, load from the application's default data directory
-- (see: Agar.Init.Init_Core arguments Program_Name, Create_Directory).
--
function Load (Object : in Object_not_null_Access) return Boolean;
function Load
(Object : in Object_not_null_Access;
File : in String) return Boolean;
--
-- Load an Object's data part only (ignoring the generic Object part).
--
function Load_Data (Object : in Object_not_null_Access) return Boolean;
function Load_Data
(Object : in Object_not_null_Access;
File : in String) return Boolean;
--
-- Load an Object's generic part only (ignoring its data part).
--
function Load_Generic (Object : in Object_not_null_Access) return Boolean;
function Load_Generic
(Object : in Object_not_null_Access;
File : in String) return Boolean;
--
-- Save the state of an object to serialized storage.
--
-- If File is not given, save to the application's default data directory
-- (see: Agar.Init.Init_Core arguments Program_Name, Create_Directory).
--
function Save (Object : in Object_not_null_Access) return Boolean;
function Save
(Object : in Object_not_null_Access;
File : in String) return Boolean;
--
-- Save the state of an Object and all of its descendants to the default
-- data directory.
--
function Save_All (Object : in Object_not_null_Access) return Boolean;
--
-- Transfer a serialized representation of an object from/to an Agar data
-- source (which could be a file, memory, network stream, etc).
--
function Serialize
(Object : in Object_not_null_Access;
Source : in DS.Data_Source_not_null_Access) return Boolean;
function Unserialize
(Object : in Object_not_null_Access;
Source : in DS.Data_Source_not_null_Access) return Boolean;
--
-- Try reading an Agar object signature from a data source. If successful
-- (True), return signature information in Header.
--
function Read_Header
(Source : in DS.Data_Source_not_null_Access;
Header : in Header_Access) return Boolean;
--
-- Page the data of an object in or out of serialized storage.
--
function Page_In (Object : in Object_not_null_Access) return Boolean;
function Page_Out (Object : in Object_not_null_Access) return Boolean;
--
-- Set a callback routine for handling an event. The function forms
-- returns an Event access which can be used to specify arguments
-- (see Agar.Event). Set_Event does not allow more than one callback
-- per event.
--
-- Async => True : Process events in a separate thread.
-- Propagate => True : Broadcast events to all child objects.
--
function Set_Event
(Object : in Object_not_null_Access;
Event : in String;
Func : in Event_Func_Access;
Async : in Boolean := False;
Propagate : in Boolean := False) return EV.Event_not_null_Access;
procedure Set_Event
(Object : in Object_not_null_Access;
Event : in String;
Func : in Event_Func_Access;
Async : in Boolean := False;
Propagate : in Boolean := False);
--
-- Variant of Set_Event which allows more than one callback per Event.
-- Instead of replacing an existing Event, Add_Event appends the callback
-- the list. All registered callbacks will be invoked by Post_Event.
--
function Add_Event
(Object : in Object_not_null_Access;
Event : in String;
Func : in Event_Func_Access;
Async : in Boolean := False;
Propagate : in Boolean := False) return EV.Event_not_null_Access;
procedure Add_Event
(Object : in Object_not_null_Access;
Event : in String;
Func : in Event_Func_Access;
Async : in Boolean := False;
Propagate : in Boolean := False);
--
-- Post an Event to a Target object.
-- Message-passing style with specified Source object.
--
procedure Post_Event
(Source : in Object_Access;
Target : in Object_not_null_Access;
Event : in String);
procedure Post_Event
(Source : in Object_Access;
Target : in Object_not_null_Access;
Event : in EV.Event_not_null_Access);
--
-- Post an Event to a Target object.
-- Anonymous style without specified Source.
--
procedure Post_Event
(Target : in Object_not_null_Access;
Event : in String);
procedure Post_Event
(Target : in Object_not_null_Access;
Event : in EV.Event_not_null_Access);
--
-- Log object name and message to the console for debugging purposes.
--
procedure Debug
(Object : in Object_Access;
Message : in String);
--
-- Attach an initialized timer to an object and activate it. The callback
-- routine will be executed after the timer expires in Interval milliseconds.
-- Timer will be restarted or deleted based on the callback's return value.
--
function Add_Timer
(Object : in Object_Access;
Timer : in TMR.Timer_not_null_Access;
Interval : in Interfaces.Unsigned_32;
Func : in TMR.Timer_Callback) return Boolean;
--
-- Auto-allocated alternative to Init_Timer and Add_Timer. The timer structure
-- will be auto allocated and freed implicitely.
--
function Add_Timer
(Object : in Object_Access;
Interval : in Interfaces.Unsigned_32;
Func : in TMR.Timer_Callback) return TMR.Timer_Access;
--
-- Cancel and delete an active timer.
--
procedure Delete_Timer
(Object : in Object_not_null_Access;
Timer : in TMR.Timer_not_null_Access)
with Import, Convention => C, Link_Name => "AG_DelTimer";
--
-- Evaluate whether a variable is set.
--
function Defined
(Object : in Object_not_null_Access;
Variable : in String) return Boolean;
--
-- Compare two variables with no dereference. Discrete types are compared
-- by value. Strings are compared case-sensitively. Reference types are
-- compared by their pointer value.
--
function "=" (Left, Right : in Variable_not_null_Access) return Boolean;
private
--
-- AG_Object(3)
--
function AG_ObjectNew
(Parent : in System.Address;
Name : in CS.chars_ptr;
Class : in Class_not_null_Access) return Object_Access
with Import, Convention => C, Link_Name => "AG_ObjectNew";
procedure AG_ObjectInit
(Object : in Object_not_null_Access;
Class : in Class_not_null_Access)
with Import, Convention => C, Link_Name => "AG_ObjectInit";
procedure AG_ObjectInitStatic
(Object : in Object_not_null_Access;
Class : in Class_not_null_Access)
with Import, Convention => C, Link_Name => "AG_ObjectInitStatic";
procedure AG_ObjectAttach
(Parent : in Object_Access;
Child : in Object_not_null_Access)
with Import, Convention => C, Link_Name => "AG_ObjectAttach";
function AG_ObjectFindS
(Root : in Object_not_null_Access;
Path : in CS.chars_ptr) return Object_Access
with Import, Convention => C, Link_Name => "AG_ObjectFindS";
function AG_ObjectFindParent
(Object : in Object_not_null_Access;
Name : in CS.chars_ptr;
Class : in CS.chars_ptr) return Object_Access
with Import, Convention => C, Link_Name => "AG_ObjectFindParent";
function AG_ObjectFindChild
(Parent : in Object_not_null_Access;
Name : in CS.chars_ptr) return Object_Access
with Import, Convention => C, Link_Name => "ag_object_find_child";
function AG_ObjectCopyName
(Object : in Object_not_null_Access;
Buffer : in System.Address;
Size : in AG_Size) return C.int
with Import, Convention => C, Link_Name => "AG_ObjectCopyName";
procedure AG_ObjectSetNameS
(Object : in Object_not_null_Access;
Name : in CS.chars_ptr)
with Import, Convention => C, Link_Name => "AG_ObjectSetNameS";
procedure AG_ObjectGenName
(Object : in Object_not_null_Access;
Class : in Class_not_null_Access;
Buffer : in System.Address;
Size : in AG_Size)
with Import, Convention => C, Link_Name => "AG_ObjectGenName";
procedure AG_ObjectGenNamePfx
(Object : in Object_not_null_Access;
Prefix : in CS.chars_ptr;
Buffer : in System.Address;
Size : in AG_Size)
with Import, Convention => C, Link_Name => "AG_ObjectGenNamePfx";
function AG_CreateClass
(Hierarchy : in CS.chars_ptr;
Object_Size : in AG_Size;
Class_Size : in AG_Size;
Major : in C.unsigned;
Minor : in C.unsigned) return Class_not_null_Access
with Import, Convention => C, Link_Name => "AG_CreateClass";
procedure AG_ClassSetInit
(Class : in Class_not_null_Access;
Init_Func : in Init_Func_Access)
with Import, Convention => C, Link_Name => "AG_ClassSetInit";
function AG_ClassSetInit
(Class : in Class_not_null_Access;
Init_Func : in Init_Func_Access) return Init_Func_Access
with Import, Convention => C, Link_Name => "AG_ClassSetInit";
procedure AG_ClassSetReset
(Class : in Class_not_null_Access;
Reset_Func : in Reset_Func_Access)
with Import, Convention => C, Link_Name => "AG_ClassSetReset";
function AG_ClassSetReset
(Class : in Class_not_null_Access;
Reset_Func : in Reset_Func_Access) return Reset_Func_Access
with Import, Convention => C, Link_Name => "AG_ClassSetReset";
procedure AG_ClassSetDestroy
(Class : in Class_not_null_Access;
Destroy_Func : in Destroy_Func_Access)
with Import, Convention => C, Link_Name => "AG_ClassSetDestroy";
function AG_ClassSetDestroy
(Class : in Class_not_null_Access;
Destroy_Func : in Destroy_Func_Access) return Destroy_Func_Access
with Import, Convention => C, Link_Name => "AG_ClassSetDestroy";
procedure AG_ClassSetLoad
(Class : in Class_not_null_Access;
Load_Func : in Load_Func_Access)
with Import, Convention => C, Link_Name => "AG_ClassSetLoad";
function AG_ClassSetLoad
(Class : in Class_not_null_Access;
Load_Func : in Load_Func_Access) return Load_Func_Access
with Import, Convention => C, Link_Name => "AG_ClassSetLoad";
procedure AG_ClassSetSave
(Class : in Class_not_null_Access;
Save_Func : in Save_Func_Access)
with Import, Convention => C, Link_Name => "AG_ClassSetSave";
function AG_ClassSetSave
(Class : in Class_not_null_Access;
Save_Func : in Save_Func_Access) return Save_Func_Access
with Import, Convention => C, Link_Name => "AG_ClassSetSave";
procedure AG_ClassSetEdit
(Class : in Class_not_null_Access;
Edit_Func : in Edit_Func_Access)
with Import, Convention => C, Link_Name => "AG_ClassSetEdit";
function AG_ClassSetEdit
(Class : in Class_not_null_Access;
Edit_Func : in Edit_Func_Access) return Edit_Func_Access
with Import, Convention => C, Link_Name => "AG_ClassSetEdit";
procedure AG_RegisterNamespace
(Name : in CS.chars_ptr;
Prefix : in CS.chars_ptr;
URL : in CS.chars_ptr)
with Import, Convention => C, Link_Name => "AG_RegisterNamespace";
procedure AG_UnregisterNamespace (Name : in CS.chars_ptr)
with Import, Convention => C, Link_Name => "AG_UnregisterNamespace";
function AG_LookupClass (Class : in CS.chars_ptr) return Class_Access
with Import, Convention => C, Link_Name => "AG_LookupClass";
function AG_LoadClass (Class : in CS.chars_ptr) return Class_Access
with Import, Convention => C, Link_Name => "AG_LoadClass";
procedure AG_RegisterModuleDirectory (Path : in CS.chars_ptr)
with Import, Convention => C, Link_Name => "AG_RegisterModuleDirectory";
procedure AG_UnregisterModuleDirectory (Path : in CS.chars_ptr)
with Import, Convention => C, Link_Name => "AG_UnregisterModuleDirectory";
function AG_OfClass
(Object : in Object_not_null_Access;
Pattern : in CS.chars_ptr) return C.int
with Import, Convention => C, Link_Name => "ag_of_class";
function AG_ObjectInUse (Object : in Object_not_null_Access) return C.int
with Import, Convention => C, Link_Name => "AG_ObjectInUse";
function AG_ObjectAddDep
(Object : in Object_not_null_Access;
Dependency : in Object_not_null_Access;
Persistent : in C.int) return Dependency_Access
with Import, Convention => C, Link_Name => "AG_ObjectAddDep";
function AG_ObjectFindDep
(Object : in Object_not_null_Access;
Index : in Interfaces.Unsigned_32;
Pointer : access Object_not_null_Access) return C.int
with Import, Convention => C, Link_Name => "AG_ObjectFindDep";
function AG_ObjectLoad (Object : in Object_not_null_Access) return C.int
with Import, Convention => C, Link_Name => "AG_ObjectLoad";
function AG_ObjectLoadFromFile
(Object : in Object_not_null_Access;
File : in CS.chars_ptr) return C.int
with Import, Convention => C, Link_Name => "AG_ObjectLoadFromFile";
function AG_ObjectLoadData (Object : in Object_not_null_Access) return C.int
with Import, Convention => C, Link_Name => "AG_ObjectLoadData";
function AG_ObjectLoadDataFromFile
(Object : in Object_not_null_Access;
File : in CS.chars_ptr) return C.int
with Import, Convention => C, Link_Name => "AG_ObjectLoadDataFromFile";
function AG_ObjectLoadGeneric (Object : in Object_not_null_Access) return C.int
with Import, Convention => C, Link_Name => "AG_ObjectLoadGeneric";
function AG_ObjectLoadGenericFromFile
(Object : in Object_not_null_Access;
File : in CS.chars_ptr) return C.int
with Import, Convention => C, Link_Name => "AG_ObjectLoadGenericFromFile";
function AG_ObjectSave (Object : in Object_not_null_Access) return C.int
with Import, Convention => C, Link_Name => "AG_ObjectSave";
function AG_ObjectSaveAll (Object : in Object_not_null_Access) return C.int
with Import, Convention => C, Link_Name => "AG_ObjectSaveAll";
function AG_ObjectSaveToFile
(Object : in Object_not_null_Access;
File : in CS.chars_ptr) return C.int
with Import, Convention => C, Link_Name => "AG_ObjectSaveToFile";
function AG_ObjectSerialize
(Object : in Object_not_null_Access;
Source : in DS.Data_Source_not_null_Access) return C.int
with Import, Convention => C, Link_Name => "AG_ObjectSerialize";
function AG_ObjectUnserialize
(Object : in Object_not_null_Access;
Source : in DS.Data_Source_not_null_Access) return C.int
with Import, Convention => C, Link_Name => "AG_ObjectUnserialize";
function AG_ObjectReadHeader
(Object : in DS.Data_Source_not_null_Access;
Header : in Header_Access) return C.int
with Import, Convention => C, Link_Name => "AG_ObjectReadHeader";
function AG_ObjectPageIn (Object : in Object_not_null_Access) return C.int
with Import, Convention => C, Link_Name => "AG_ObjectPageIn";
function AG_ObjectPageOut (Object : in Object_not_null_Access) return C.int
with Import, Convention => C, Link_Name => "AG_ObjectPageOut";
procedure AG_Debug
(Object : in Object_Access;
Format : in CS.chars_ptr;
Message : in CS.chars_ptr)
with Import, Convention => C, Link_Name => "AG_Debug";
--
-- AG_Event(3)
--
function AG_SetEvent
(Object : in Object_not_null_Access;
Event : in CS.chars_ptr;
Func : in Event_Func_Access;
Format : in CS.chars_ptr) return EV.Event_not_null_Access
with Import, Convention => C, Link_Name => "AG_SetEvent";
procedure AG_SetEvent
(Object : in Object_not_null_Access;
Event : in CS.chars_ptr;
Func : in Event_Func_Access;
Format : in CS.chars_ptr)
with Import, Convention => C, Link_Name => "AG_SetEvent";
function AG_AddEvent
(Object : in Object_not_null_Access;
Event : in CS.chars_ptr;
Func : in Event_Func_Access;
Format : in CS.chars_ptr) return EV.Event_not_null_Access
with Import, Convention => C, Link_Name => "AG_AddEvent";
procedure AG_AddEvent
(Object : in Object_not_null_Access;
Event : in CS.chars_ptr;
Func : in Event_Func_Access;
Format : in CS.chars_ptr)
with Import, Convention => C, Link_Name => "AG_AddEvent";
function AG_PostEvent
(Source : in Object_Access;
Target : in Object_not_null_Access;
Event : in CS.chars_ptr;
Format : in CS.chars_ptr) return EV.Event_not_null_Access
with Import, Convention => C, Link_Name => "AG_PostEvent";
procedure AG_PostEvent
(Source : in Object_Access;
Target : in Object_not_null_Access;
Event : in CS.chars_ptr;
Format : in CS.chars_ptr)
with Import, Convention => C, Link_Name => "AG_PostEvent";
procedure AG_PostEventByPtr
(Source : in Object_Access;
Target : in Object_not_null_Access;
Event : in EV.Event_Access;
Format : in CS.chars_ptr)
with Import, Convention => C, Link_Name => "AG_PostEventByPtr";
--
-- AG_Timer(3)
--
function AG_AddTimer
(Object : in Object_Access;
Timer : in TMR.Timer_not_null_Access;
Interval : in Interfaces.Unsigned_32;
Func : in TMR.Timer_Callback;
Flags : in C.unsigned;
Format : in CS.chars_ptr) return C.int
with Import, Convention => C, Link_Name => "AG_AddTimer";
function AG_AddTimerAuto
(Object : in Object_Access;
Interval : in Interfaces.Unsigned_32;
Func : in TMR.Timer_Callback;
Format : in CS.chars_ptr) return TMR.Timer_Access
with Import, Convention => C, Link_Name => "AG_AddTimerAuto";
--------------------
-- AG_Variable(3) --
--------------------
function AG_Defined
(Object : in Object_not_null_Access;
Name : in CS.chars_ptr) return C.int
with Import, Convention => C, Link_Name => "ag_defined";
procedure AG_CopyVariable
(Destination : in Variable_not_null_Access;
Source : in Variable_not_null_Access)
with Import, Convention => C, Link_Name => "AG_CopyVariable";
procedure AG_Unset
(Object : in Object_not_null_Access;
Name : in System.Address)
with Import, Convention => C, Link_Name => "AG_Unset";
procedure AG_GetUint8
(Object : in Object_not_null_Access;
Name : in System.Address)
with Import, Convention => C, Link_Name => "AG_GetUint8";
function AG_SetUint8
(Object : in System.Address;
Name : in System.Address;
Value : in Interfaces.Unsigned_8) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_SetUint8";
function AG_BindUint8
(Object : in System.Address;
Name : in System.Address;
Value : access Interfaces.Unsigned_8) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_BindUint8";
function AG_GetSint8
(Object : in System.Address;
Name : in System.Address) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_GetSint8";
function AG_SetSint8
(Object : in System.Address;
Name : in System.Address;
Value : in Signed_8) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_SetSint8";
function AG_BindSint8
(Object : in System.Address;
Name : in System.Address;
Value : access Signed_8) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_BindSint8";
procedure AG_GetUint16
(Object : in System.Address;
Name : in System.Address)
with Import, Convention => C, Link_Name => "AG_GetUint16";
function AG_SetUint16
(Object : in System.Address;
Name : in System.Address;
Value : in Interfaces.Unsigned_16) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_SetUint16";
function AG_BindUint16
(Object : in System.Address;
Name : in System.Address;
Value : access Interfaces.Unsigned_16) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_BindUint16";
function AG_GetSint16
(Object : in System.Address;
Name : in System.Address) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_GetSint16";
function AG_SetSint16
(Object : in System.Address;
Name : in System.Address;
Value : in Signed_16) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_SetSint16";
function AG_BindSint16
(Object : in System.Address;
Name : in System.Address;
Value : access Signed_16) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_BindSint16";
procedure AG_GetUint32
(Object : in System.Address;
Name : in System.Address)
with Import, Convention => C, Link_Name => "AG_GetUint32";
function AG_SetUint32
(Object : in System.Address;
Name : in System.Address;
Value : in Interfaces.Unsigned_32) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_SetUint32";
function AG_BindUint32
(Object : in System.Address;
Name : in System.Address;
Value : access Interfaces.Unsigned_32) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_BindUint32";
function AG_GetSint32
(Object : in System.Address;
Name : in System.Address) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_GetSint32";
function AG_SetSint32
(Object : in System.Address;
Name : in System.Address;
Value : in Signed_32) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_SetSint32";
function AG_BindSint32
(Object : in System.Address;
Name : in System.Address;
Value : access Signed_32) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_BindSint32";
#if HAVE_64BIT
procedure AG_GetUint64
(Object : in System.Address;
Name : in System.Address)
with Import, Convention => C, Link_Name => "AG_GetUint64";
function AG_SetUint64
(Object : in System.Address;
Name : in System.Address;
Value : in Interfaces.Unsigned_64) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_SetUint64";
function AG_BindUint64
(Object : in System.Address;
Name : in System.Address;
Value : access Interfaces.Unsigned_64) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_BindUint64";
function AG_GetSint64
(Object : in System.Address;
Name : in System.Address) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_GetSint64";
function AG_SetSint64
(Object : in System.Address;
Name : in System.Address;
Value : in Signed_64) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_SetSint64";
function AG_BindSint64
(Object : in System.Address;
Name : in System.Address;
Value : access Signed_64) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_BindSint64";
#end if;
#if HAVE_FLOAT
function AG_GetFloat
(Object : in System.Address;
Name : in System.Address) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_GetFloat";
function AG_SetFloat
(Object : in System.Address;
Name : in System.Address;
Value : in Float) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_SetFloat";
function AG_BindFloat
(Object : in System.Address;
Name : in System.Address;
Value : access Float) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_BindFloat";
function AG_GetDouble
(Object : in System.Address;
Name : in System.Address) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_GetDouble";
function AG_SetDouble
(Object : in System.Address;
Name : in System.Address;
Value : in Double) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_SetDouble";
function AG_BindDouble
(Object : in System.Address;
Name : in System.Address;
Value : access Double) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_BindDouble";
# if HAVE_LONG_DOUBLE
function AG_GetLongDouble
(Object : in System.Address;
Name : in System.Address) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_GetLongDouble";
function AG_SetLongDouble
(Object : in System.Address;
Name : in System.Address;
Value : in Long_Double) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_SetLongDouble";
function AG_BindLongDouble
(Object : in System.Address;
Name : in System.Address;
Value : access Long_Double) return Variable_not_null_Access
with Import, Convention => C, Link_Name => "AG_BindLongDouble";
# end if;
#end if;
function AG_GetString
(Object : in System.Address;
Name : in System.Address;
Buffer : in System.Address;
Size : in AG_Size) return AG_Size
with Import, Convention => C, Link_Name => "AG_GetString";
function AG_GetStringDup
(Object : in System.Address;
Name : in System.Address) return System.Address
with Import, Convention => C, Link_Name => "AG_GetStringDup";
function AG_SetString
(Variable : in Variable_not_null_Access;
Name : in System.Address;
Data : in System.Address) return Variable_Access
with Import, Convention => C, Link_Name => "AG_SetString";
function AG_BindString
(Variable : in Variable_not_null_Access;
Name : in System.Address;
Data : in System.Address;
Size : in AG_Size) return Variable_Access
with Import, Convention => C, Link_Name => "AG_BindString";
function AG_GetPointer
(Object : in System.Address;
Name : in System.Address) return System.Address
with Import, Convention => C, Link_Name => "AG_GetPointer";
function AG_SetPointer
(Variable : in Variable_not_null_Access;
Name : in System.Address;
Data : in System.Address) return Variable_Access
with Import, Convention => C, Link_Name => "AG_SetPointer";
function AG_BindPointer
(Variable : in Variable_not_null_Access;
Name : in System.Address;
Data : access System.Address) return Variable_Access
with Import, Convention => C, Link_Name => "AG_BindPointer";
function AG_CompareVariables
(Left, Right : in Variable_not_null_Access) return C.int
with Import, Convention => C, Link_Name => "AG_CompareVariables";
end Agar.Object;
|
with Ada.Tags;
package Project_Processor.Parsers.Abstract_Parsers is
type Abstract_Parser is interface;
function Create (Params : not null access Plugins.Parameter_Maps.Map)
return Abstract_Parser is abstract;
procedure Parse
(Parser : in out Abstract_Parser;
Project : out EU_Projects.Projects.Project_Descriptor;
Input : String)
is abstract;
procedure Register (Format : Parser_ID;
Tag : Ada.Tags.Tag)
with Pre => Ada.Tags.Is_Descendant_At_Same_Level (Descendant => Tag,
Ancestor => Abstract_Parser'Tag);
function Get_Parser (Format : Parser_ID;
Parameters : Parser_Parameter_access)
return Abstract_Parser'Class;
function Is_Known (Format : Parser_ID) return Boolean;
end Project_Processor.Parsers.Abstract_Parsers;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <vgodunko@gmail.com> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Streams.Stream_IO;
with League.Application;
with League.Stream_Element_Vectors;
with League.Strings;
with League.Text_Codecs;
with AMF.Facility;
with AMF.URI_Stores;
with XMI.Reader;
with XMI.Writer;
with AMF.Transformations.CMOF_To_UML_MOF;
with AMF.Internals.Modules.MOF_Module;
pragma Unreferenced (AMF.Internals.Modules.MOF_Module);
with AMF.Internals.Modules.UML_Module;
pragma Unreferenced (AMF.Internals.Modules.UML_Module);
procedure CMOF2UMLMOF is
function To_UTF8_String
(Item : League.Strings.Universal_String) return String;
--------------------
-- To_UTF8_String --
--------------------
function To_UTF8_String
(Item : League.Strings.Universal_String) return String
is
Codec : constant League.Text_Codecs.Text_Codec
:= League.Text_Codecs.Codec
(League.Strings.To_Universal_String ("utf-8"));
Encoded : constant League.Stream_Element_Vectors.Stream_Element_Vector
:= Codec.Encode (Item);
Aux : constant Ada.Streams.Stream_Element_Array
:= Encoded.To_Stream_Element_Array;
Result : String (1 .. Aux'Length);
for Result'Address use Aux'Address;
pragma Import (Ada, Result);
begin
return Result;
end To_UTF8_String;
Source : AMF.URI_Stores.URI_Store_Access;
Target : AMF.URI_Stores.URI_Store_Access;
begin
-- Initialize facility.
AMF.Facility.Initialize;
-- Load source metamodel.
Source :=
XMI.Reader.Read_URI (League.Application.Arguments.Element (1));
-- Create target extent.
Target :=
AMF.Facility.Create_URI_Store (League.Strings.Empty_Universal_String);
-- Transform CMOF model into UML+MOF model.
AMF.Transformations.CMOF_To_UML_MOF.Transform (Source, Target);
-- Output result model.
declare
File : Ada.Streams.Stream_IO.File_Type;
begin
Ada.Streams.Stream_IO.Create
(File,
Ada.Streams.Stream_IO.Out_File,
To_UTF8_String (League.Application.Arguments.Element (2)));
String'Write
(Ada.Streams.Stream_IO.Stream (File),
To_UTF8_String (XMI.Writer (Target)));
Ada.Streams.Stream_IO.Close (File);
end;
end CMOF2UMLMOF;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S E M _ C H 6 --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. 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 Types; use Types;
package Sem_Ch6 is
type Conformance_Type is
(Type_Conformant, Mode_Conformant, Subtype_Conformant, Fully_Conformant);
pragma Ordered (Conformance_Type);
-- Conformance type used in conformance checks between specs and bodies,
-- and for overriding. The literals match the RM definitions of the
-- corresponding terms. This is an ordered type, since each conformance
-- type is stronger than the ones preceding it.
procedure Analyze_Abstract_Subprogram_Declaration (N : Node_Id);
procedure Analyze_Expression_Function (N : Node_Id);
procedure Analyze_Extended_Return_Statement (N : Node_Id);
procedure Analyze_Function_Call (N : Node_Id);
procedure Analyze_Operator_Symbol (N : Node_Id);
procedure Analyze_Parameter_Association (N : Node_Id);
procedure Analyze_Procedure_Call (N : Node_Id);
procedure Analyze_Simple_Return_Statement (N : Node_Id);
procedure Analyze_Subprogram_Declaration (N : Node_Id);
procedure Analyze_Subprogram_Body (N : Node_Id);
function Analyze_Subprogram_Specification (N : Node_Id) return Entity_Id;
-- Analyze subprogram specification in both subprogram declarations
-- and body declarations. Returns the defining entity for the
-- specification N.
procedure Check_Conventions (Typ : Entity_Id);
-- Ada 2005 (AI-430): Check that the conventions of all inherited and
-- overridden dispatching operations of type Typ are consistent with their
-- respective counterparts.
procedure Check_Delayed_Subprogram (Designator : Entity_Id);
-- Designator can be a E_Subprogram_Type, E_Procedure or E_Function. If a
-- type in its profile depends on a private type without a full
-- declaration, indicate that the subprogram or type is delayed.
procedure Check_Discriminant_Conformance
(N : Node_Id;
Prev : Entity_Id;
Prev_Loc : Node_Id);
-- Check that the discriminants of a full type N fully conform to the
-- discriminants of the corresponding partial view Prev. Prev_Loc indicates
-- the source location of the partial view, which may be different than
-- Prev in the case of private types.
procedure Check_Fully_Conformant
(New_Id : Entity_Id;
Old_Id : Entity_Id;
Err_Loc : Node_Id := Empty);
-- Check that two callable entities (subprograms, entries, literals)
-- are fully conformant, post error message if not (RM 6.3.1(17)) with
-- the flag being placed on the Err_Loc node if it is specified, and
-- on the appropriate component of the New_Id construct if not. Note:
-- when checking spec/body conformance, New_Id must be the body entity
-- and Old_Id is the spec entity (the code in the implementation relies
-- on this ordering, and in any case, this makes sense, since if flags
-- are to be placed on the construct, they clearly belong on the body.
procedure Check_Mode_Conformant
(New_Id : Entity_Id;
Old_Id : Entity_Id;
Err_Loc : Node_Id := Empty;
Get_Inst : Boolean := False);
-- Check that two callable entities (subprograms, entries, literals)
-- are mode conformant, post error message if not (RM 6.3.1(15)) with
-- the flag being placed on the Err_Loc node if it is specified, and
-- on the appropriate component of the New_Id construct if not. The
-- argument Get_Inst is set to True when this is a check against a
-- formal access-to-subprogram type, indicating that mapping of types
-- is needed.
procedure Check_Overriding_Indicator
(Subp : Entity_Id;
Overridden_Subp : Entity_Id;
Is_Primitive : Boolean);
-- Verify the consistency of an overriding_indicator given for subprogram
-- declaration, body, renaming, or instantiation. Overridden_Subp is set
-- if the scope where we are introducing the subprogram contains a
-- type-conformant subprogram that becomes hidden by the new subprogram.
-- Is_Primitive indicates whether the subprogram is primitive.
procedure Check_Subtype_Conformant
(New_Id : Entity_Id;
Old_Id : Entity_Id;
Err_Loc : Node_Id := Empty;
Skip_Controlling_Formals : Boolean := False;
Get_Inst : Boolean := False);
-- Check that two callable entities (subprograms, entries, literals)
-- are subtype conformant, post error message if not (RM 6.3.1(16)),
-- the flag being placed on the Err_Loc node if it is specified, and
-- on the appropriate component of the New_Id construct if not.
-- Skip_Controlling_Formals is True when checking the conformance of
-- a subprogram that implements an interface operation. In that case,
-- only the non-controlling formals can (and must) be examined. The
-- argument Get_Inst is set to True when this is a check against a
-- formal access-to-subprogram type, indicating that mapping of types
-- is needed.
procedure Check_Synchronized_Overriding
(Def_Id : Entity_Id;
Overridden_Subp : out Entity_Id);
-- First determine if Def_Id is an entry or a subprogram either defined in
-- the scope of a task or protected type, or that is a primitive of such
-- a type. Check whether Def_Id overrides a subprogram of an interface
-- implemented by the synchronized type, returning the overridden entity
-- or Empty.
procedure Check_Type_Conformant
(New_Id : Entity_Id;
Old_Id : Entity_Id;
Err_Loc : Node_Id := Empty);
-- Check that two callable entities (subprograms, entries, literals)
-- are type conformant, post error message if not (RM 6.3.1(14)) with
-- the flag being placed on the Err_Loc node if it is specified, and
-- on the appropriate component of the New_Id construct if not.
function Conforming_Types
(T1 : Entity_Id;
T2 : Entity_Id;
Ctype : Conformance_Type;
Get_Inst : Boolean := False) return Boolean;
-- Check that the types of two formal parameters are conforming. In most
-- cases this is just a name comparison, but within an instance it involves
-- generic actual types, and in the presence of anonymous access types
-- it must examine the designated types. The argument Get_Inst is set to
-- True when this is a check against a formal access-to-subprogram type,
-- indicating that mapping of types is needed.
procedure Create_Extra_Formals (E : Entity_Id);
-- For each parameter of a subprogram or entry that requires an additional
-- formal (such as for access parameters and indefinite discriminated
-- parameters), creates the appropriate formal and attach it to its
-- associated parameter. Each extra formal will also be appended to
-- the end of Subp's parameter list (with each subsequent extra formal
-- being attached to the preceding extra formal).
function Find_Corresponding_Spec
(N : Node_Id;
Post_Error : Boolean := True) return Entity_Id;
-- Use the subprogram specification in the body to retrieve the previous
-- subprogram declaration, if any.
function Fully_Conformant (New_Id, Old_Id : Entity_Id) return Boolean;
-- Determine whether two callable entities (subprograms, entries,
-- literals) are fully conformant (RM 6.3.1(17))
function Fully_Conformant_Expressions
(Given_E1 : Node_Id;
Given_E2 : Node_Id) return Boolean;
-- Determines if two (non-empty) expressions are fully conformant
-- as defined by (RM 6.3.1(18-21))
function Fully_Conformant_Discrete_Subtypes
(Given_S1 : Node_Id;
Given_S2 : Node_Id) return Boolean;
-- Determines if two subtype definitions are fully conformant. Used
-- for entry family conformance checks (RM 6.3.1 (24)).
procedure Install_Entity (E : Entity_Id);
-- Place a single entity on the visibility chain
procedure Install_Formals (Id : Entity_Id);
-- On entry to a subprogram body, make the formals visible. Note that
-- simply placing the subprogram on the scope stack is not sufficient:
-- the formals must become the current entities for their names. This
-- procedure is also used to get visibility to the formals when analyzing
-- preconditions and postconditions appearing in the spec.
function Is_Interface_Conformant
(Tagged_Type : Entity_Id;
Iface_Prim : Entity_Id;
Prim : Entity_Id) return Boolean;
-- Returns true if both primitives have a matching name (including support
-- for names of inherited private primitives --which have suffix 'P'), they
-- are type conformant, and Prim is defined in the scope of Tagged_Type.
-- Special management is done for functions returning interfaces.
procedure List_Inherited_Pre_Post_Aspects (E : Entity_Id);
-- E is the entity for a subprogram or generic subprogram spec. This call
-- lists all inherited Pre/Post aspects if List_Inherited_Pre_Post is True.
procedure May_Need_Actuals (Fun : Entity_Id);
-- Flag functions that can be called without parameters, i.e. those that
-- have no parameters, or those for which defaults exist for all parameters
-- Used for subprogram declarations and for access subprogram declarations,
-- where they apply to the anonymous designated type. On return the flag
-- Set_Needs_No_Actuals is set appropriately in Fun.
function Mode_Conformant (New_Id, Old_Id : Entity_Id) return Boolean;
-- Determine whether two callable entities (subprograms, entries,
-- literals) are mode conformant (RM 6.3.1(15))
procedure New_Overloaded_Entity
(S : Entity_Id;
Derived_Type : Entity_Id := Empty);
-- Process new overloaded entity. Overloaded entities are created by
-- enumeration type declarations, subprogram specifications, entry
-- declarations, and (implicitly) by type derivations. If Derived_Type
-- is non-empty then this is a subprogram derived for that type.
procedure Process_Formals (T : List_Id; Related_Nod : Node_Id);
-- Enter the formals in the scope of the subprogram or entry, and
-- analyze default expressions if any. The implicit types created for
-- access parameter are attached to the Related_Nod which comes from the
-- context.
procedure Reference_Body_Formals (Spec : Entity_Id; Bod : Entity_Id);
-- If there is a separate spec for a subprogram or generic subprogram, the
-- formals of the body are treated as references to the corresponding
-- formals of the spec. This reference does not count as an actual use of
-- the formal, in order to diagnose formals that are unused in the body.
-- This procedure is also used in renaming_as_body declarations, where
-- the formals of the specification must be treated as body formals that
-- correspond to the previous subprogram declaration, and not as new
-- entities with their defining entry in the cross-reference information.
procedure Set_Actual_Subtypes (N : Node_Id; Subp : Entity_Id);
-- If the formals of a subprogram are unconstrained, build a subtype
-- declaration that uses the bounds or discriminants of the actual to
-- construct an actual subtype for them. This is an optimization that
-- is done only in some cases where the actual subtype cannot change
-- during execution of the subprogram. By setting the actual subtype
-- once, we avoid recomputing it unnecessarily.
procedure Set_Formal_Mode (Formal_Id : Entity_Id);
-- Set proper Ekind to reflect formal mode (in, out, in out)
function Subtype_Conformant
(New_Id : Entity_Id;
Old_Id : Entity_Id;
Skip_Controlling_Formals : Boolean := False) return Boolean;
-- Determine whether two callable entities (subprograms, entries, literals)
-- are subtype conformant (RM 6.3.1(16)). Skip_Controlling_Formals is True
-- when checking the conformance of a subprogram that implements an
-- interface operation. In that case, only the non-controlling formals
-- can (and must) be examined.
function Type_Conformant
(New_Id : Entity_Id;
Old_Id : Entity_Id;
Skip_Controlling_Formals : Boolean := False) return Boolean;
-- Determine whether two callable entities (subprograms, entries, literals)
-- are type conformant (RM 6.3.1(14)). Skip_Controlling_Formals is True
-- when checking the conformance of a subprogram that implements an
-- interface operation. In that case, only the non-controlling formals
-- can (and must) be examined.
procedure Valid_Operator_Definition (Designator : Entity_Id);
-- Verify that an operator definition has the proper number of formals
end Sem_Ch6;
|
with Asis.Ada_Environments;
with Asis.Compilation_Units;
with Asis.Exceptions;
with Asis.Errors;
with Asis.Implementation;
with GNAT.Directory_Operations;
with Asis_Adapter.Unit;
with a_nodes_h.Support;
package body Asis_Adapter.Context is
procedure Set_Context
(Asis_Context : in Asis.Context;
A_Nodes : in Standard.A_Nodes.Access_Class)
is
use Asis.Ada_Environments;
begin
A_Nodes.Set
(Context =>
(Name => To_Chars_Ptr (Name (Asis_Context)),
Parameters => To_Chars_Ptr (Parameters (Asis_Context)),
Debug_Image => To_Chars_Ptr (Debug_Image (Asis_Context))));
end Set_Context;
procedure Process_Units
(This : in out Class;
Options : in Unit.Options_Record;
Outputs : in Outputs_Record)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Units";
package Logging is new Generic_Logging (Module_Name); use Logging;
use Asis.Exceptions;
Units : Asis.Compilation_Unit_List :=
Asis.Compilation_Units.Compilation_Units (This.Asis_Context);
begin
for Unit of Units loop
declare
Tool_Unit : Asis_Adapter.Unit.Class;
begin
Tool_Unit.Process (Unit, Options, Outputs);
end;
end loop;
exception
when Ex : ASIS_Inappropriate_Context |
ASIS_Inappropriate_Container |
ASIS_Inappropriate_Compilation_Unit |
ASIS_Inappropriate_Element |
ASIS_Inappropriate_Line |
ASIS_Inappropriate_Line_Number |
ASIS_Failed =>
Log ("Caught ASIS exception: " & AEX.Exception_Name (Ex));
Log ("ASIS Error Status: " &
Asis.Errors.Error_Kinds'Image (Asis.Implementation.Status));
Log ("ASIS Diagnosis: " & To_String (Asis.Implementation.Diagnosis));
Log ("Reraising");
raise;
end Process_Units;
------------
-- EXPORTED:
------------
procedure Process
(This : in out Class;
Tree_File_Name : in String;
Unit_Options : in Unit.Options_Record;
Outputs : in Outputs_Record)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process";
package Logging is new Generic_Logging (Module_Name); use Logging;
procedure Begin_Environment is begin
Asis.Ada_Environments.Associate
(The_Context => This.Asis_Context,
Name => To_Wide_String (Tree_File_Name),
Parameters => To_Wide_String ("-C1 " & Tree_File_Name));
Asis.Ada_Environments.Open (This.Asis_Context);
Trace_Put_Line ("Context info: " & Asis.Ada_Environments.Debug_Image
(This.Asis_Context));
end;
procedure End_Environment is begin
Asis.Ada_Environments.Close (This.Asis_Context);
Asis.Ada_Environments.Dissociate (This.Asis_Context);
end;
begin
Log ("BEGIN");
Log ("Tree_File_Name => """ & Tree_File_Name & """");
Begin_Environment;
-- Call Begin_Environment first:
Outputs.Graph.Set_ID
("""" & To_String (Asis.Ada_Environments.Name (This.Asis_Context)) & """");
Set_Context (This.Asis_Context, Outputs.A_Nodes);
Process_Units (This, Unit_Options, Outputs);
End_Environment;
Log ("END");
end Process;
end Asis_Adapter.Context;
|
-- ----------------------------------------------------------------- --
-- --
-- This is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public --
-- License as published by the Free Software Foundation; either --
-- version 2 of the License, or (at your option) any later version. --
-- --
-- This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public --
-- License along with this library; if not, write to the --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
-- Boston, MA 02111-1307, USA. --
-- --
-- ----------------------------------------------------------------- --
-- ----------------------------------------------------------------- --
-- This is a translation, to the Ada programming language, of the --
-- original C test files written by Sam Lantinga - www.libsdl.org --
-- translation made by Antonio F. Vargas - www.adapower.net/~avargas --
-- ----------------------------------------------------------------- --
with System.OS_Interface;
with Interfaces.C.Strings;
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.OS_Lib;
with Lib_C;
with SDL.Timer;
with SDL.Error;
package body TestLock_Sprogs is
use type C.int;
package Tm renames SDL.Timer;
package Er renames SDL.Error;
package CS renames Interfaces.C.Strings;
-- ======================================
procedure printid is
begin
Put_Line ("Process " & Uint32'Image (T.ThreadID) &
": exiting");
end printid;
-- ======================================
procedure terminating (sig : C.int) is
begin
Put_Line ("Process " & Uint32'Image (T.ThreadID) &
": raising SIGTERM");
Lib_C.Raise_The_Signal (System.OS_Interface.SIGTERM);
end terminating;
-- ======================================
procedure closemutex (sig : C.int) is
id : Uint32 := T.ThreadID;
begin
Put ("Process ");
if id = mainthread then
Put ("0");
else
Put (Uint32'Image (id));
end if;
Put_Line (": Cleaning up...");
for i in 0 .. 5 loop
T.KillThread (threads (i));
end loop;
M.DestroyMutex (mutex);
GNAT.OS_Lib.OS_Exit (Integer (sig));
end closemutex;
-- ======================================
function Run (data : System.Address) return C.int is
begin
if T.ThreadID = mainthread then
Lib_C.Set_Signal (System.OS_Interface.SIGTERM, closemutex'Access);
end if;
while true loop
Put_Line ("Process " & Uint32'Image (T.ThreadID) &
" ready to work");
if M.mutexP (mutex) < 0 then
Put_Line ("Couldn't lock mutex: " & Er.Get_Error);
GNAT.OS_Lib.OS_Exit (1);
end if;
Put_Line ("Process " & Uint32'Image (T.ThreadID) &
", working!");
Tm.SDL_Delay (1 * 1000);
Put_Line ("Process " & Uint32'Image (T.ThreadID) &
", done!");
if M.mutexV (mutex) < 0 then
Put_Line ("Couldn't unlock mutex: " & Er.Get_Error);
GNAT.OS_Lib.OS_Exit (1);
end if;
-- If this sleep isn't done, then threads may starve
Tm.SDL_Delay (10);
end loop;
return 0;
end Run;
-- ======================================
end TestLock_Sprogs;
|
with Memory.Wrapper; use Memory.Wrapper;
package Memory.Split is
type Split_Type is new Wrapper_Type with private;
type Split_Pointer is access all Split_Type'Class;
function Create_Split return Split_Pointer;
function Random_Split(next : access Memory_Type'Class;
generator : Distribution_Type;
max_cost : Cost_Type)
return Memory_Pointer;
overriding
function Clone(mem : Split_Type) return Memory_Pointer;
overriding
procedure Permute(mem : in out Split_Type;
generator : in Distribution_Type;
max_cost : in Cost_Type);
function Get_Bank(mem : Split_Type;
index : Natural) return Memory_Pointer;
procedure Set_Bank(mem : in out Split_Type;
index : in Natural;
other : access Memory_Type'Class);
function Get_Offset(mem : Split_Type'Class) return Address_Type;
procedure Set_Offset(mem : in out Split_Type'Class;
offset : in Address_Type);
overriding
procedure Reset(mem : in out Split_Type;
context : in Natural);
overriding
procedure Read(mem : in out Split_Type;
address : in Address_Type;
size : in Positive);
overriding
procedure Write(mem : in out Split_Type;
address : in Address_Type;
size : in Positive);
overriding
procedure Idle(mem : in out Split_Type;
cycles : in Time_Type);
overriding
procedure Show_Access_Stats(mem : in out Split_Type);
overriding
function To_String(mem : Split_Type) return Unbounded_String;
overriding
function Get_Cost(mem : Split_Type) return Cost_Type;
overriding
function Get_Writes(mem : Split_Type) return Long_Integer;
overriding
function Get_Path_Length(mem : Split_Type) return Natural;
overriding
procedure Generate(mem : in Split_Type;
sigs : in out Unbounded_String;
code : in out Unbounded_String);
overriding
procedure Adjust(mem : in out Split_Type);
overriding
procedure Finalize(mem : in out Split_Type);
overriding
procedure Forward_Read(mem : in out Split_Type;
source : in Natural;
address : in Address_Type;
size : in Positive);
overriding
procedure Forward_Write(mem : in out Split_Type;
source : in Natural;
address : in Address_Type;
size : in Positive);
overriding
procedure Forward_Idle(mem : in out Split_Type;
source : in Natural;
cycles : in Time_Type);
overriding
function Forward_Get_Time(mem : Split_Type) return Time_Type;
overriding
function Get_Join_Length(mem : Split_Type) return Natural;
private
type Split_Data is record
mem : access Memory_Type'Class;
end record;
type Split_Data_Array is array(0 .. 1) of Split_Data;
type Split_Type is new Wrapper_Type with record
banks : Split_Data_Array;
offset : Address_Type;
end record;
end Memory.Split;
|
with Ada.Containers.Functional_Vectors;
with Ada.Containers.Functional_Sets;
with Ada.Containers.Functional_Maps;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Interfaces;
package Common with SPARK_Mode is
type UInt32 is new Interfaces.Unsigned_32;
type Int64 is new Integer;
type Real32 is new Interfaces.IEEE_Float_32;
type Real64 is new Interfaces.IEEE_Float_64;
function Get_TaskID (TaskOptionID : Int64) return Int64 is (TaskOptionID / 100000);
-- Retrieve the TaskId from a TaskOptionId
function Get_OptionID (TaskOptionID : Int64) return Int64 is (TaskOptionID rem 100000);
-- Retrieve the OptionId from a TaskOptionId
function Get_TaskOptionID (TaskID, OptionID : Int64) return Int64 is (TaskID * 100000 + OptionID);
-- Generate TaskOptionID from TaskID and OptionID
function Int64_Hash (X : Int64) return Ada.Containers.Hash_Type is
(Ada.Containers.Hash_Type'Mod (X));
package Int64_Sequences is new Ada.Containers.Functional_Vectors
(Index_Type => Positive,
Element_Type => Int64);
type Int64_Seq is new Int64_Sequences.Sequence;
package Int64_Sets is new Ada.Containers.Functional_Sets (Int64);
type Int64_Set is new Int64_Sets.Set;
package Int64_Maps is new Ada.Containers.Functional_Maps
(Int64, Int64);
type Int64_Map is new Int64_Maps.Map;
-- Messages are unbounded strings. To avoid having to prove that messages
-- do not overflow Integer'Last, we use a procedure which will truncate
-- the message if it is too long. We can justify that this should not
-- happen in practice.
procedure Append_To_Msg
(Msg : in out Unbounded_String;
Tail : String);
-- Append Tail to Msg if there is enough room in the unbounded string
end Common;
|
with Ada.Containers.Indefinite_Ordered_Maps;
with Ada.Strings.Unbounded;
with Ada.Exceptions; use Ada.Exceptions;
with String_Ops; use String_Ops;
with kv.avm.Log; use kv.avm.Log;
package body kv.avm.Symbol_Tables is
subtype String_Type is Ada.Strings.Unbounded.Unbounded_String;
function "+"(S : String) return String_Type renames Ada.Strings.Unbounded.To_Unbounded_String;
function "+"(U : String_Type) return String renames Ada.Strings.Unbounded.To_String;
type Data_Type is
record
Name : String_Type;
Index : Integer;
Kind : kv.avm.Registers.Data_Kind;
Init : String_Type;
end record;
type Data_Pointer is access Data_Type;
package Symbol_Maps is new Ada.Containers.Indefinite_Ordered_Maps
(Key_Type => String,
Element_Type => Data_Pointer);
type Table_Type is limited
record
Symbols : Symbol_Maps.Map;
Count : Natural := 0;
Super : Symbol_Table_Access;
end record;
-----------------------------------------------------------------------------
procedure Initialize
(Self : in out Symbol_Table) is
begin
Self.Table := new Table_Type;
end Initialize;
-----------------------------------------------------------------------------
function Count(Self : Symbol_Table) return Natural is
begin
return Natural(Self.Table.Symbols.Length);
end Count;
-----------------------------------------------------------------------------
procedure Add
(Self : in out Symbol_Table;
Name : in String;
Kind : in kv.avm.Registers.Data_Kind := kv.avm.Registers.Unset;
Init : in String := "") is
Data : Data_Pointer;
begin
Data := new Data_Type;
Data.Name := +Name;
Data.Index := Self.Table.Count;
Data.Kind := Kind;
Data.Init := +Init;
Self.Table.Symbols.Insert(Name, Data);
Self.Table.Count := Self.Table.Count + 1;
exception
when Error: others =>
Put_Error("EXCEPTION: "&Exception_Information(Error)&" Name=<"&Name&">.");
raise;
end Add;
-----------------------------------------------------------------------------
procedure Set_Kind
(Self : in out Symbol_Table;
Name : in String;
Kind : in kv.avm.Registers.Data_Kind) is
Data : Data_Pointer;
Location : Symbol_Maps.Cursor;
use Symbol_Maps;
begin
Location := Self.Table.Symbols.Find(Name);
if Location /= Symbol_Maps.No_Element then
Data := Element(Location);
Data.Kind := Kind;
else
raise Missing_Element_Error;
end if;
end Set_Kind;
-----------------------------------------------------------------------------
procedure Set_Init
(Self : in out Symbol_Table;
Name : in String;
Init : in String) is
Data : Data_Pointer;
Location : Symbol_Maps.Cursor;
use Symbol_Maps;
begin
Location := Self.Table.Symbols.Find(Name);
if Location /= Symbol_Maps.No_Element then
Data := Element(Location);
Data.Init := +Init;
else
raise Missing_Element_Error;
end if;
end Set_Init;
-----------------------------------------------------------------------------
function Get_Kind(Self : Symbol_Table; Name : String) return kv.avm.Registers.Data_Kind is
Data : Data_Pointer;
Location : Symbol_Maps.Cursor;
use Symbol_Maps;
begin
Location := Self.Table.Symbols.Find(Name);
if Location /= Symbol_Maps.No_Element then
Data := Element(Location);
else
raise Missing_Element_Error;
end if;
return Data.Kind;
end Get_Kind;
-----------------------------------------------------------------------------
function Get_Index(Self : Symbol_Table; Name : String) return Natural is
Data : Data_Pointer;
Location : Symbol_Maps.Cursor;
use Symbol_Maps;
begin
Location := Self.Table.Symbols.Find(Name);
if Location /= Symbol_Maps.No_Element then
Data := Element(Location);
else
if Self.Table.Super /= null then
return Self.Table.Super.Get_Index(Name);
else
raise Missing_Element_Error;
end if;
end if;
return Natural(Data.Index);
end Get_Index;
-----------------------------------------------------------------------------
function Has(Self : Symbol_Table; Name : String) return Boolean is
begin
return Self.Table.Symbols.Contains(Name);
end Has;
-----------------------------------------------------------------------------
procedure Set_All_Indexes
(Self : in out Symbol_Table;
Starting : in Natural := 1) is
Next_Index : Natural := Starting;
procedure Process
(Position : in Symbol_Maps.Cursor) is
Data : Data_Pointer;
begin
Data := Symbol_Maps.Element(Position);
Data.Index := Next_Index;
Next_Index := Next_Index + 1;
end Process;
begin
Self.Table.Symbols.Iterate(Process'ACCESS);
end Set_All_Indexes;
-----------------------------------------------------------------------------
procedure For_Each
(Self : in out Symbol_Table;
Proc : not null access procedure
(Name : in String;
Kind : in kv.avm.Registers.Data_Kind;
Indx : in Natural;
Init : in String)) is
procedure Process
(Position : in Symbol_Maps.Cursor) is
Data : Data_Pointer;
begin
Data := Symbol_Maps.Element(Position);
Proc(+Data.Name, Data.Kind, Natural(Data.Index), +Data.Init);
end Process;
begin
if Self.Table.Super /= null then
Self.Table.Super.For_Each(Proc);
end if;
Self.Table.Symbols.Iterate(Process'ACCESS);
end For_Each;
-----------------------------------------------------------------------------
procedure Link_Superclass_Table
(Self : in out Symbol_Table;
Super : in Symbol_Table_Access) is
begin
Self.Table.Super := Super;
end Link_Superclass_Table;
end kv.avm.Symbol_Tables;
|
------------------------------------------------------------------------------
-- EMAIL: <darkestkhan@gmail.com> --
-- License: ISC License (see COPYING file) --
-- --
-- Copyright © 2012 - 2015 darkestkhan --
------------------------------------------------------------------------------
-- Permission to use, copy, modify, and/or distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- The software is provided "as is" and the author disclaims all warranties --
-- with regard to this software including all implied warranties of --
-- merchantability and fitness. In no event shall the author be liable for --
-- any special, direct, indirect, or consequential damages or any damages --
-- whatsoever resulting from loss of use, data or profits, whether in an --
-- action of contract, negligence or other tortious action, arising out of --
-- or in connection with the use or performance of this software. --
------------------------------------------------------------------------------
with Ada.Environment_Variables;
package body VT100.Utils is
---------------
-- L I N E S --
---------------
function Lines return Natural
is
begin
if Ada.Environment_Variables.Exists ("LINES") then
return Natural'Value (Ada.Environment_Variables.Value (Name => "LINES"));
else
return 0;
end if;
end Lines;
-------------------
-- C O L U M N S --
-------------------
function Columns return Natural
is
begin
if Ada.Environment_Variables.Exists ("COLUMNS") then
return Natural'Value (Ada.Environment_Variables.Value
(Name => "COLUMNS"));
else
return 0;
end if;
end Columns;
end VT100.Utils;
|
-- Taken from Ada Crash Course by Peter Chapin)
-- Context clause specifies packages that will be used.
-- `use` includes that package in the namespace
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
-- Our main function is "Prime"
procedure Prime is
-- Declare local variables here
Num : Integer; -- Type comes after the name
begin
Put("Enter an integer: ");
Get(Num); -- Retrieve the input into Num.
if Num < 2 then
Put("The value "); Put(Num, 0); Put_Line(" is bad.");
else
Put("The value "); Put(Num, 0);
-- For loop syntax similar to Python range
-- Requires reverse loop for decrementing
for idx in 2 .. (Num - 1) loop
-- rem is % in C. Single `=` to test for equality
-- Assignment uses :=
if Num rem idx = 0 then
Put_Line(" is not prime.");
return;
end if;
exit when (idx * idx > Num); -- Break early when we've hit all possible factors.
end loop;
Put_Line(" is prime.");
end if;
end Prime;
|
------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- ANNEXI-STRAYLINE Reference Implementation --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- This package provides facilities for querying the PATH (or equivalent)
-- Environment Variable for the presence (and full path) of a program, which
-- can be supplied as an Image_Path
with Ada.Strings.Bounded;
package Child_Processes.Path_Searching is
Not_In_Path: exception;
function Search_Path (Program: String) return String;
-- Searches all directories in the PATH environment variable for a file
-- named Name, to which it returns the full-path.
--
-- If the search fails Not_In_Path is raised.
type Elaboration_Path_Search (<>) is limited private;
function Initialize (Program: aliased String)
return Elaboration_Path_Search;
-- A Elaboration_Path_Search initialization performs Search_Path for
-- Program upon and is intended to be used to initialize an
-- Elaboration_Path_Search object during elaboration of a library package.
--
-- The purpose is to allow for elaboration-time search for optional
-- programs, which may or may not be later invoked by the partition.
--
-- Attempting to extract the Path of a Elaboration_Path_Search where this
-- search fails results in a Not_In_Path exception
function Found (Search: Elaboration_Path_Search) return Boolean;
-- Returns True iff Search.Program was located in PATH, and will thus
-- implies that a subsequent invocation of Image_Path will be successful
function Image_Path (Search: Elaboration_Path_Search) return String with
Pre => Found (Search);
-- Returns the full path of Search.Program. If Found (Search) is False,
-- Not_In_Path is raised
private
package Image_Path_Strings is
new Ada.Strings.Bounded.Generic_Bounded_Length (256);
type Elaboration_Path_Search (Program: not null access constant String) is
record
Result: Image_Path_Strings.Bounded_String;
end record;
end Child_Processes.Path_Searching;
|
with Ada.Text_IO; use Ada.Text_IO;
procedure Test is
type R is record Foo: access R; end record;
begin
New_Line;
end;
|
-- SPDX-FileCopyrightText: 2021 Max Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Interpretations.Expressions is
procedure Step
(Self : Iterator'Class;
Cursor : in out Expressions.Cursor);
----------
-- Each --
----------
function Each (Set : Interpretation_Set) return Iterator is
begin
return (Set => Set,
Expected => (Is_Set => False));
end Each;
------------------
-- Each_Of_Type --
------------------
function Each_Of_Type
(Set : Interpretation_Set;
Expected_Type : Program.Visibility.View)
return Iterator is
begin
return (Set => Set,
Expected => (True, Expected_Type));
end Each_Of_Type;
-----------
-- First --
-----------
overriding function First (Self : Iterator) return Cursor is
begin
return Result : Cursor := (Index => Self.Set.From, State => <>) do
Self.Step (Result);
end return;
end First;
-----------------
-- Has_Element --
-----------------
function Has_Element (Self : Cursor) return Boolean is
begin
return Self.Index > 0;
end Has_Element;
----------
-- Next --
----------
overriding function Next
(Self : Iterator; Position : Cursor) return Cursor is
begin
return Result : Cursor := Position do
case Position.State.Kind is
when Symbol =>
Result.State.Cursor := Result.State.Iter.Next
(Result.State.Cursor);
if Program.Visibility.Has_Element (Result.State.Cursor) then
return;
end if;
when Name | Expression | Expression_Category =>
null;
end case;
Result.Index := Result.Index + 1;
Self.Step (Result);
end return;
end Next;
--------------
-- Solution --
--------------
function Solution (Self : Cursor) return Program.Interpretations.Solution is
begin
case Self.State.Kind is
when Symbol =>
return (Defining_Name_Solution,
Program.Visibility.Get_View (Self.State.Cursor));
when Name =>
return (Defining_Name_Solution, Self.State.View);
when Expression =>
return (Tuple_Solution, Self.State.Tuple);
when Expression_Category =>
return (Expression_Solution, Self.State.Type_View);
end case;
end Solution;
----------
-- Step --
----------
procedure Step
(Self : Iterator'Class;
Cursor : in out Expressions.Cursor)
is
use type Program.Visibility.View_Cursor;
function Check_Name (View : Program.Visibility.View) return Boolean;
-- Check if View is an expression of expected type
function Check_Type (View : Program.Visibility.View) return Boolean;
-- Check expression type is expected type
function Check_Name (View : Program.Visibility.View) return Boolean is
use all type Program.Visibility.View_Kind;
begin
return View.Kind in
Enumeration_Literal_View | Character_Literal_View
| Program.Visibility.Object_View
and then Check_Type (Program.Visibility.Type_Of (View));
end Check_Name;
function Check_Type (View : Program.Visibility.View) return Boolean is
begin
if Self.Expected.Is_Set then
return Program.Visibility.Is_Expected_Type
(View, Self.Expected.View);
end if;
return True;
end Check_Type;
Env : constant Program.Visibility.Context_Access := Self.Set.Context.Env;
begin
while Cursor.Index <= Self.Set.To loop
declare
Item : Interpretation renames Self.Set.Context.Data (Cursor.Index);
begin
case Item.Kind is
when Symbol =>
Cursor.State :=
(Kind => Symbol,
Iter => Env.Directly_Visible (Item.Symbol),
Cursor => <>);
Cursor.State.Cursor := Cursor.State.Iter.First;
while Program.Visibility.Has_Element (Cursor.State.Cursor)
loop
if Check_Name (+Cursor.State.Cursor) then
return;
end if;
Cursor.State.Cursor := Cursor.State.Iter.Next
(Cursor.State.Cursor);
end loop;
when Name =>
if Check_Name (Item.Name_View) then
Cursor.State := (Kind => Name, View => Item.Name_View);
return;
end if;
when Expression =>
if Check_Type (Item.Type_View) then
Cursor.State :=
(Kind => Expression,
Type_View => Item.Type_View,
Tuple => Solution_Tuple_Access (Item.Solutions));
return;
end if;
when Expression_Category =>
if Self.Expected.Is_Set and then
Item.Matcher.Is_Matched (Self.Expected.View)
then
Cursor.State :=
(Kind => Expression_Category,
Type_View => Self.Expected.View,
Tuple => null);
return;
end if;
end case;
end;
Cursor.Index := Cursor.Index + 1;
end loop;
Cursor.Index := 0;
end Step;
---------------
-- Type_View --
---------------
function Type_View (Self : Cursor) return Program.Visibility.View is
Object : Program.Visibility.View;
begin
case Self.State.Kind is
when Symbol =>
Object := Program.Visibility.Get_View (Self.State.Cursor);
when Name =>
Object := Self.State.View;
when Expression | Expression_Category =>
return Self.State.Type_View;
end case;
return Program.Visibility.Type_Of (Object);
end Type_View;
end Program.Interpretations.Expressions;
|
package Pointer_Discr1_Pkg3 is
type T_TYPE is (One, Two, Three);
type T_DATA (D : T_TYPE);
type T_DATA (D : T_TYPE) is null record;
type T_WINDOW is access T_DATA;
procedure Map (Window : in T_WINDOW);
end Pointer_Discr1_Pkg3;
|
-- C95040D.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT TASKING_ERROR IS RAISED IN A CALLING
-- TASK WHEN THE TASK OWNING THE ENTRY TERMINATES BEFORE RENDEZVOUS
-- CAN OCCUR.
-- CHECK THAT RE-RAISING TASKING_ERROR, ONCE TRAPPED IN THE CALLER,
-- DOES NOT PROPAGATE OUTSIDE THE TASK BODY.
-- GOM 11/29/84
-- JWC 05/14/85
-- PWB 02/11/86 CORRECTED CALL TO TEST TO SHOW CORRECT TEST NAME.
-- RLB 12/15/99 REMOVED POTENTIALLY ERRONEOUS CALLS TO REPORT.COMMENT.
WITH REPORT;
USE REPORT;
PROCEDURE C95040D IS
PROCEDURE DRIVER IS
TASK NEST IS
ENTRY OUTER;
ENTRY INNER;
END NEST;
TASK SLAVE;
TASK BODY NEST IS
BEGIN
--COMMENT("AT TOP OF 'NEST' TASK WAITING ON 'OUTER' " &
-- "RENDEZVOUS");
ACCEPT OUTER DO
--COMMENT("IN 'OUTER' RENDEZVOUS OF 'NEST' TASK " &
-- "ABOUT TO 'RETURN'");
RETURN; -- CAUSES 'INNER' RENDEZVOUS TO BE SKIPPED.
ACCEPT INNER DO
FAILED("'INNER' RENDEZVOUS OF 'NEST' TASK " &
"SHOULD NEVER BE PERFORMED");
END INNER;
END OUTER;
--COMMENT("'OUTER' RENDEZVOUS COMPLETED IN 'NEST' TASK " &
-- "AND NOW TERMINATING");
END NEST;
TASK BODY SLAVE IS
BEGIN
--COMMENT("AT TOP OF 'SLAVE' TASK. CALLING 'INNER' " &
-- "RENDEZVOUS");
NEST.INNER;
FAILED("SHOULD HAVE RAISED 'TASKING_ERROR' IN 'SLAVE' " &
"TASK");
EXCEPTION
WHEN TASKING_ERROR =>
--COMMENT("'SLAVE' TASK CORRECTLY TRAPPING " &
-- "'TASKING_ERROR' AND RE-RAISING IT (BUT " &
-- "SHOULD NOT BE PROPAGATED)");
RAISE;
END SLAVE;
BEGIN -- START OF DRIVER PROCEDURE.
--COMMENT("AT TOP OF 'DRIVER'. CALLING 'OUTER' ENTRY OF " &
-- "'NEST' TASK");
NEST.OUTER;
--COMMENT("'OUTER' RENDEZVOUS COMPLETED. 'DRIVER' AWAITING " &
-- "TERMINATION OF 'NEST' AND 'SLAVE' TASKS");
EXCEPTION
WHEN TASKING_ERROR =>
FAILED("'TASKING_ERROR' CAUGHT IN 'DRIVER' WHEN IT " &
"SHOULD HAVE BEEN CAUGHT IN 'SLAVE' TASK, OR " &
"'TASKING_ERROR' WAS INCORRECTLY PROPAGATED BY " &
"'SLAVE' TASK");
END DRIVER;
BEGIN -- START OF MAIN PROGRAM.
TEST("C95040D","CHECK THAT 'TASKING_ERROR' IS RAISED IN A " &
"CALLER TASK WHEN TASK OWNING THE ENTRY CANNOT " &
"PERFORM RENDEZVOUS. ALSO CHECK THAT " &
"'TASKING_ERROR', ONCE RAISED, IS NOT PROPAGATED " &
"OUTSIDE THE TASK BODY");
--COMMENT("MAIN PROGRAM CALLING 'DRIVER' PROCEDURE");
DRIVER;
--COMMENT("MAIN PROGRAM NOW TERMINATING");
RESULT;
END C95040D;
|
package PyGamer.Controls is
procedure Scan;
type Buttons is (A, B, Left, Right, Up, Down, Sel, Start);
-- The Left, Right, Up, Down buttons are simulated from the position of the
-- joystick.
function Pressed (Button : Buttons) return Boolean;
function Rising (Button : Buttons) return Boolean;
function Falling (Button : Buttons) return Boolean;
type Joystick_Range is range -128 .. 127;
function Joystick_X return Joystick_Range;
function Joystick_Y return Joystick_Range;
end PyGamer.Controls;
|
-----------------------------------------------------------------------
-- awa-changelogs-modules -- Module changelogs
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Calendar;
with Util.Log.Loggers;
with AWA.Modules.Get;
with AWA.Users.Models;
with AWA.Services.Contexts;
with AWA.Changelogs.Models;
with ADO.Sessions;
with ADO.Sessions.Entities;
package body AWA.Changelogs.Modules is
package ASC renames AWA.Services.Contexts;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Awa.Changelogs.Module");
-- ------------------------------
-- Initialize the changelogs module.
-- ------------------------------
overriding
procedure Initialize (Plugin : in out Changelog_Module;
App : in AWA.Modules.Application_Access;
Props : in ASF.Applications.Config) is
begin
Log.Info ("Initializing the changelogs module");
AWA.Modules.Module (Plugin).Initialize (App, Props);
-- Add here the creation of manager instances.
end Initialize;
-- ------------------------------
-- Get the changelogs module.
-- ------------------------------
function Get_Changelog_Module return Changelog_Module_Access is
function Get is new AWA.Modules.Get (Changelog_Module, Changelog_Module_Access, NAME);
begin
return Get;
end Get_Changelog_Module;
-- ------------------------------
-- Add the log message and associate it with the database entity identified by
-- the given id and the entity type. The log message is associated with the current user.
-- ------------------------------
procedure Add_Log (Model : in Changelog_Module;
Id : in ADO.Identifier;
Entity_Type : in String;
Message : in String) is
pragma Unreferenced (Model);
Ctx : constant ASC.Service_Context_Access := ASC.Current;
User : constant AWA.Users.Models.User_Ref := Ctx.Get_User;
DB : ADO.Sessions.Master_Session := AWA.Services.Contexts.Get_Master_Session (Ctx);
Kind : ADO.Entity_Type;
History : AWA.Changelogs.Models.Changelog_Ref;
begin
Ctx.Start;
Kind := ADO.Sessions.Entities.Find_Entity_Type (DB, Entity_Type);
History.Set_For_Entity_Id (Id);
History.Set_User (User);
History.Set_Date (Ada.Calendar.Clock);
History.Set_Entity_Type (Kind);
History.Set_Text (Message);
History.Save (DB);
DB.Commit;
end Add_Log;
end AWA.Changelogs.Modules;
|
with Text_IO;
procedure Hello is
begin
Text_IO.Put("Hello");
end Hello;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.