repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
charlesdaniels/libagar | Ada | 13,811 | ads | ------------------------------------------------------------------------------
-- AGAR GUI LIBRARY --
-- A G A R . T E X T --
-- S p e c --
------------------------------------------------------------------------------
with Ada.Containers.Indefinite_Vectors;
with Interfaces; use Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
with Interfaces.C.Strings;
with Agar.Types; use Agar.Types;
with Agar.Object;
with Agar.Surface;
with System;
package Agar.Text is
package C renames Interfaces.C;
package CS renames Interfaces.C.Strings;
package SU renames Agar.Surface;
use type C.int;
use type C.unsigned;
TEXT_STATES_MAX : constant C.unsigned := $AG_TEXT_STATES_MAX;
FONT_BOLD : constant C.unsigned := 16#01#;
FONT_ITALIC : constant C.unsigned := 16#02#;
FONT_UNDERLINE : constant C.unsigned := 16#04#;
FONT_UPPERCASE : constant C.unsigned := 16#08#;
-----------------------------------
-- Horizontal Justification Mode --
-----------------------------------
type AG_Text_Justify is
(LEFT,
CENTER,
RIGHT);
for AG_Text_Justify use
(LEFT => 0,
CENTER => 1,
RIGHT => 2);
for AG_Text_Justify'Size use C.int'Size;
-----------------------------
-- Vertical Alignment Mode --
-----------------------------
type AG_Text_Valign is
(TOP,
MIDDLE,
BOTTOM);
for AG_Text_Valign use
(TOP => 0,
MIDDLE => 1,
BOTTOM => 2);
for AG_Text_Valign'Size use C.int'Size;
--------------------------------
-- Type of message to display --
--------------------------------
type AG_Text_Message_Title is
(ERROR, -- Error message alert
WARNING, -- Warning (ignorable)
INFO); -- Informational message (ignorable)
for AG_Text_Message_Title use
(ERROR => 0,
WARNING => 1,
INFO => 2);
for AG_Text_Message_Title'Size use C.int'Size;
------------------
-- Type of font --
------------------
type AG_Font_Type is
(VECTOR, -- Vector font engine (e.g., FreeType)
BITMAP, -- Bitmap font engine (builtin)
DUMMY); -- Null font engine
for AG_Font_Type use
(VECTOR => 0,
BITMAP => 1,
DUMMY => 2);
for AG_Font_Type'Size use C.int'Size;
-------------------------------------------
-- Type of data source to load font from --
-------------------------------------------
type AG_Font_Spec_Source is
(FONT_FILE, -- Load font from file
FONT_IN_MEMORY); -- Deserialize in-memory font data
for AG_Font_Spec_Source use
(FONT_FILE => 0,
FONT_IN_MEMORY => 1);
for AG_Font_Spec_Source'Size use C.int'Size;
----------------------------
-- Size of font in points --
----------------------------
#if HAVE_FLOAT
subtype AG_Font_Points is C.double;
#else
subtype AG_Font_Points is C.int;
#end if;
type Font_Points_Access is access all AG_Font_Points with Convention => C;
----------------------
-- Filename of font --
----------------------
type AG_Font_Source_Filename is array (1 .. $AG_FILENAME_MAX) of
aliased C.char with Convention => C;
-----------------------------
-- Agar font specification --
-----------------------------
type AG_Font_Spec
(Spec_Source : AG_Font_Spec_Source := FONT_FILE) is
record
Size : AG_Font_Points; -- Font size in points
Index : C.int; -- Font index (FC_INDEX)
Font_Type : AG_Font_Type; -- Font engine
Font_Source : AG_Font_Spec_Source; -- Source type
#if HAVE_FLOAT
Matrix_XX : C.double; -- 1 -- -- Transformation matrix
Matrix_XY : C.double; -- 0 --
Matrix_YX : C.double; -- 0 --
Matrix_YY : C.double; -- 1 --
#end if;
case Spec_Source is
when FONT_FILE =>
File_Source : AG_Font_Source_Filename; -- Font file name
when FONT_IN_MEMORY =>
Memory_Source : access Unsigned_8; -- Source memory region
Memory_Size : AG_Size; -- Size in bytes
end case;
end record
with Convention => C;
pragma Unchecked_Union (AG_Font_Spec);
type Font_Spec_Access is access all AG_Font_Spec with Convention => C;
------------------
-- An Agar Font --
------------------
type AG_Font;
type Font_Access is access all AG_Font with Convention => C;
subtype Font_not_null_Access is not null Font_Access;
type AG_Font_Entry is limited record
Next : Font_Access;
Prev : access Font_Access;
end record
with Convention => C;
type AG_Font_Bitmap_Spec is array (1 .. 32) of aliased C.char
with Convention => C;
type AG_Font is limited record
Super : aliased Agar.Object.Object; -- [Font]
Spec : aliased AG_Font_Spec; -- Font specification
Flags : C.unsigned; -- Options
Height : C.int; -- Height in pixels
Ascent : C.int; -- Ascent relative to baseline
Descent : C.int; -- Descent relative to baseline
Line_Skip : C.int; -- Multiline Y-increment
TTF : System.Address; -- TODO TTF interface
Bitmap_Spec : aliased AG_Font_Bitmap_Spec; -- Bitmap font spec
Bitmap_Glyphs : System.Address; -- TODO Bitmap glyph array
Bitmap_Glyph_Count : C.unsigned; -- Bitmap glyph count
Char_0, Char_1 : AG_Char; -- Bitmap font spec
Reference_Count : C.unsigned; -- Reference count for cache
Entry_in_Cache : AG_Font_Entry; -- Entry in cache
end record
with Convention => C;
----------------------------------
-- A rendered (in-memory) glyph --
----------------------------------
type AG_Glyph;
type Glyph_Access is access all AG_Glyph with Convention => C;
type AG_Glyph_Entry is limited record
Next : Glyph_Access;
end record
with Convention => C;
type AG_Glyph is limited record
Font : Font_not_null_Access; -- Back pointer to font
Color : SU.AG_Color; -- Base color
Char : AG_Char; -- Native character
Surface : SU.Surface_not_null_Access; -- Rendered surface
Advance : C.int; -- Advance in pixels
Texture : C.unsigned; -- Mapped texture (by driver)
Texcoords : SU.AG_Texcoord; -- Texture coordinates
Entry_in_Cache : AG_Glyph_Entry; -- Entry in cache
end record
with Convention => C;
---------------------------------------
-- Pushable/poppable state variables --
---------------------------------------
type AG_Text_State is record
Font : Font_not_null_Access; -- Font face
Color : SU.AG_Color; -- Foreground text color
Color_BG : SU.AG_Color; -- Background color
Justify : AG_Text_Justify; -- Justification mode
Valign : AG_Text_Valign; -- Vertical alignment
Tab_Wd : C.int; -- Width of tabs in pixels
end record
with Convention => C;
------------------------------------------
-- Statically-compiled font description --
------------------------------------------
type AG_Static_Font is array (1 .. $SIZEOF_AG_StaticFont)
of aliased Unsigned_8 with Convention => C;
for AG_Static_Font'Size use $SIZEOF_AG_StaticFont * System.Storage_Unit;
------------------------------
-- Measure of rendered text --
------------------------------
type AG_Text_Metrics is record
W, H : C.int; -- Dimensions in pixels
Line_Widths : access C.unsigned; -- Width of each line
Line_Count : C.unsigned; -- Total line count
end record
with Convention => C;
type Text_Metrics_Access is access all AG_Text_Metrics with Convention => C;
subtype Text_Metrics_not_null_Access is not null Text_Metrics_Access;
package Text_Line_Widths_Packages is new Ada.Containers.Indefinite_Vectors
(Index_Type => Positive,
Element_Type => Natural);
subtype Text_Line_Widths is Text_Line_Widths_Packages.Vector;
--------------------------
-- Internal glyph cache --
--------------------------
type AG_Glyph_Cache is array (1 .. $SIZEOF_AG_GlyphCache)
of aliased Unsigned_8 with Convention => C;
for AG_Glyph_Cache'Size use $SIZEOF_AG_GlyphCache * System.Storage_Unit;
--
-- Initialize the font engine.
--
function Init_Text_Subsystem return Boolean;
--
-- Release all resources allocated by the font engine.
--
procedure Destroy_Text_Subsystem;
--
-- Set the default Agar font (by access to a Font object).
--
procedure Set_Default_Font (Font : in Font_not_null_Access)
with Import, Convention => C, Link_Name => "AG_SetDefaultFont";
--
-- Set the default Agar font (by a font specification string).
--
-- Syntax: "(family):(size):(style)". Valid field separators include
-- `:', `,', `.' and `/'. This works with fontconfig if available.
-- Size is whole points (no fractional allowed with the default font).
-- Style may include `b' (bold), `i' (italic) and `U' (uppercase).
--
procedure Set_Default_Font (Spec : in String);
--
-- Load (or fetch from cache) a font.
--
function Fetch_Font
(Family : in String := "_agFontVera";
Size : in AG_Font_Points := AG_Font_Points(12);
Bold : in Boolean := False;
Italic : in Boolean := False;
Underlined : in Boolean := False;
Uppercase : in Boolean := False) return Font_Access;
--
-- Decrement the reference count of a font (and free unreferenced fonts).
--
procedure Unused_Font (Font : in Font_not_null_Access)
with Import, Convention => C, Link_Name => "AG_UnusedFont";
--
-- Push and pop the font engine rendering state.
--
procedure Push_Text_State
with Import, Convention => C, Link_Name => "AG_PushTextState";
procedure Pop_Text_State
with Import, Convention => C, Link_Name => "AG_PopTextState";
--
-- Set the current font to the specified family+size+style (or just size).
--
function Set_Font
(Family : in String;
Size : in AG_Font_Points := AG_Font_Points(12);
Bold : in Boolean := False;
Italic : in Boolean := False;
Underlined : in Boolean := False;
Uppercase : in Boolean := False) return Font_Access;
--
-- Set the current font to a given % of the current font size.
--
function Set_Font (Percent : in Natural) return Font_Access;
--
-- Return the expected size in pixels of rendered (UTF-8) text.
--
procedure Size_Text
(Text : in String;
W,H : out Natural);
procedure Size_Text
(Text : in String;
W,H : out Natural;
Line_Count : out Natural);
procedure Size_Text
(Text : in String;
W,H : out Natural;
Line_Count : out Natural;
Line_Widths : out Text_Line_Widths);
--
-- Display an informational message window (canned dialog).
--
procedure Message_Box
(Title : in AG_Text_Message_Title := INFO;
Text : in String);
#if AG_TIMERS
procedure Message_Box
(Title : in AG_Text_Message_Title := INFO;
Text : in String;
Time : in Natural := 2000);
#end if;
private
function AG_InitTextSubsystem return C.int
with Import, Convention => C, Link_Name => "AG_InitTextSubsystem";
procedure AG_DestroyTextSubsystem
with Import, Convention => C, Link_Name => "AG_DestroyTextSubsystem";
procedure AG_TextParseFontSpec
(Spec : in CS.chars_ptr)
with Import, Convention => C, Link_Name => "AG_TextParseFontSpec";
function AG_FetchFont
(Family : in CS.chars_ptr;
Size : in Font_Points_Access;
Flags : in C.unsigned) return Font_Access
with Import, Convention => C, Link_Name => "AG_FetchFont";
function AG_TextFontLookup
(Family : in CS.chars_ptr;
Size : in Font_Points_Access;
Flags : in C.unsigned) return Font_Access
with Import, Convention => C, Link_Name => "AG_TextFontLookup";
function AG_TextFontPct
(Percent : in C.int) return Font_Access
with Import, Convention => C, Link_Name => "AG_TextFontPct";
procedure AG_TextSize
(Text : in CS.chars_ptr;
W,H : access C.int)
with Import, Convention => C, Link_Name => "AG_TextSize";
type AG_TextSizeMulti_Line_Entry is array (C.unsigned range <>)
of aliased C.unsigned with Convention => C;
package Line_Width_Array is new Interfaces.C.Pointers
(Index => C.unsigned,
Element => C.unsigned,
Element_Array => AG_TextSizeMulti_Line_Entry,
Default_Terminator => 0);
procedure AG_TextSizeMulti
(Text : in CS.chars_ptr;
W,H : access C.int;
W_Lines : in Line_Width_Array.Pointer;
N_Lines : access C.unsigned)
with Import, Convention => C, Link_Name => "AG_TextSizeMulti";
procedure AG_TextMsgS
(Title : in AG_Text_Message_Title;
Text : in CS.chars_ptr)
with Import, Convention => C, Link_Name => "AG_TextMsgS";
#if AG_TIMERS
procedure AG_TextTmsgS
(Title : in AG_Text_Message_Title;
Time : in Unsigned_32;
Text : in CS.chars_ptr)
with Import, Convention => C, Link_Name => "AG_TextTmsgS";
#end if;
end Agar.Text;
|
ohenley/black | Ada | 1,216 | adb | with
Ada.Characters.Handling;
package body Black.HTTP is
overriding
function "=" (Left, Right : in Header_Key) return Boolean is
use Ada.Characters.Handling;
begin
return To_Lower (String (Left)) = To_Lower (String (Right));
end "=";
function Status_Line (Status : in Statuses) return String is
begin
pragma Style_Checks ("M100"); -- Nice tabular format:
case Status is
when Switching_Protocols => return Version & " 101 Switching Protocols";
when OK => return Version & " 200 OK";
when No_Content => return Version & " 204 No Content";
when Moved_Permanently => return Version & " 301 Moved Permanently";
when Moved_Temporarily => return Version & " 302 Found";
when Bad_Request => return Version & " 400 Bad Request";
when Unauthorized => return Version & " 401 Not Authorized";
when Forbidden => return Version & " 403 Forbidden";
when Not_Found => return Version & " 404 Not Found";
when Server_Error => return Version & " 500 Internal Server Error";
end case;
end Status_Line;
end Black.HTTP;
|
glencornell/ada-object-framework | Ada | 402 | ads | with Aof.Core.Root_Objects;
with Aof.Core.Objects;
package Derived_Objects is
type Derived_Object is new Aof.Core.Objects.Object with record
Id : Natural;
end record;
type Access_Derived_Object is access all Derived_Object;
procedure My_Slot (This : in Derived_Object);
procedure My_Slot (This : in not null Aof.Core.Root_Objects.Access_Object);
end Derived_Objects;
|
fractal-mind/Amass | Ada | 2,536 | ads | -- Copyright 2021 Jeff Foley. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local json = require("json")
name = "Spamhaus"
type = "api"
function start()
set_rate_limit(1)
end
function check()
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c ~= nil and c.username ~= nil and
c.password ~= nil and c.username ~= "" and c.password ~= "") then
return true
end
return false
end
function vertical(ctx, domain)
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c == nil or c.username == nil or
c.username == "" or c.password == nil or c.password == "") then
return
end
local token = bearer_token(ctx, c.username, c.password)
if token == "" then
return
end
local resp, err = request(ctx, {
['url']=build_url(domain),
headers={
['Accept']="application/json",
['Content-Type']="application/json",
['Authorization']="Bearer " .. token,
},
})
if (err ~= nil and err ~= "") then
log(ctx, "vertical request to service failed: " .. err)
return
end
local d = json.decode(resp)
if (d == nil or d.error == true or d.hits == 0) then
return
end
for _, record in pairs(d.records) do
new_name(ctx, record.rrname)
if (record.rrtype == "A" or record.rrtype == "AAAA") then
new_addr(ctx, record.rdata, record.rrname)
end
end
end
function build_url(domain)
return "https://api-pdns.spamhaustech.com/v2/_search/rrset/" .. domain .. "/ANY?stype=rm&limit=1000"
end
function bearer_token(ctx, username, password)
local body, err = json.encode({
['username']=username,
['password']=password,
})
if (err ~= nil and err ~= "") then
return ""
end
resp, err = request(ctx, {
method="POST",
data=body,
['url']="https://api-pdns.spamhaustech.com/v2/login",
headers={
['Accept']="application/json",
['Content-Type']="application/json",
},
})
if (err ~= nil and err ~= "") then
log(ctx, "bearer_token request to service failed: " .. err)
return ""
end
local d = json.decode(resp)
if (d == nil or d.token == nil or d.token == "") then
return ""
end
return d.token
end
|
tj800x/SPARKNaCl | Ada | 1,448 | ads | with SPARKNaCl.Stream;
with SPARKNaCl.Core;
package SPARKNaCl.Secretbox
with SPARK_Mode => On
is
--------------------------------------------------------
-- Secret Key Authenticated Encryption - "SecretBox" --
--------------------------------------------------------
Secretbox_Zero_Bytes : constant := 32;
procedure Create (C : out Byte_Seq;
Status : out Boolean;
M : in Byte_Seq;
N : in Stream.HSalsa20_Nonce;
K : in Core.Salsa20_Key)
with Global => null,
Pre => (M'First = 0 and
C'First = 0 and
C'Last = M'Last and
M'Length >= 32) and then
Equal (M (0 .. 31), Zero_Bytes_32),
Post => Equal (C (0 .. 15), Zero_Bytes_16);
procedure Open
(M : out Byte_Seq; -- Output plaintext
Status : out Boolean;
C : in Byte_Seq; -- Input ciphertext
N : in Stream.HSalsa20_Nonce;
K : in Core.Salsa20_Key)
with Global => null,
Pre => (M'First = 0 and
C'First = 0 and
M'Last = C'Last and
C'Length >= 32) and then
Equal (C (0 .. 15), Zero_Bytes_16),
Post => Equal (M (0 .. 31), Zero_Bytes_32);
end SPARKNaCl.Secretbox;
|
optikos/oasis | Ada | 1,591 | adb | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
separate (Program.Scanners)
procedure On_Accept
(Self : not null access Program.Scanned_Rule_Handlers.Handler'Class;
Scanner : not null access Program.Scanners.Scanner'Class;
Rule : Program.Scanner_States.Rule_Index;
Token : out Program.Scanner_Destinations.Token_Kind;
Skip : in out Boolean) is
begin
case Rule is
when 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
| 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20
| 21 | 22 | 23 | 24 | 25 | 26 | 27 =>
Self.Delimiter (Scanner, Rule, Token, Skip);
when 28 =>
Self.Identifier (Scanner, Rule, Token, Skip);
when 29 =>
Self.Numeric_Literal (Scanner, Rule, Token, Skip);
when 30 =>
Self.Obsolescent_Numeric_Literal (Scanner, Rule, Token, Skip);
when 31 =>
Self.Character_Literal (Scanner, Rule, Token, Skip);
when 32 =>
Self.String_Literal (Scanner, Rule, Token, Skip);
when 33 =>
Self.Obsolescent_String_Literal (Scanner, Rule, Token, Skip);
when 34 =>
Self.Comment (Scanner, Rule, Token, Skip);
when 35 =>
Self.Space (Scanner, Rule, Token, Skip);
when 36 =>
Self.New_Line (Scanner, Rule, Token, Skip);
when 37 | 38 =>
Self.Error (Scanner, Rule, Token, Skip);
when others =>
raise Constraint_Error;
end case;
end On_Accept;
|
Fabien-Chouteau/GESTE | Ada | 4,401 | adb | ------------------------------------------------------------------------------
-- --
-- GESTE --
-- --
-- Copyright (C) 2019 Fabien Chouteau --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
package body GESTE.Sprite.Animated is
-------------------
-- Set_Animation --
-------------------
procedure Set_Animation
(This : in out Instance;
Anim : Animation;
Looping : Boolean)
is
begin
if Anim'Length = 0 then
This.Anim := No_Animation;
This.TTL := Frame_Counter'Last;
This.Set_Tile (This.Init_Frame);
else
This.Anim := Anim;
This.Looping := Looping;
This.Current_Step := This.Anim'First;
This.TTL := This.Anim (This.Current_Step).Frame_Cnt - 1;
This.Set_Tile (This.Anim (This.Current_Step).Tile);
end if;
end Set_Animation;
---------------
-- Anim_Done --
---------------
function Anim_Done (This : Instance) return Boolean
is (This.Anim = No_Animation);
------------------
-- Signal_Frame --
------------------
procedure Signal_Frame (This : in out Instance) is
begin
-- Check if we are at the last frame for this step
if This.TTL = 0 then
-- Check if we are at the last step of the anim
if This.Current_Step = This.Anim'Last then
if This.Looping then
-- Restart the anim
This.Current_Step := This.Anim'First;
else
-- Stop the anim
This.Set_Animation (No_Animation, False);
return;
end if;
else
-- Go to the next step
This.Current_Step := This.Current_Step + 1;
end if;
This.TTL := This.Anim (This.Current_Step).Frame_Cnt - 1;
This.Set_Tile (This.Anim (This.Current_Step).Tile);
else
This.TTL := This.TTL - 1;
end if;
end Signal_Frame;
end GESTE.Sprite.Animated;
|
zhmu/ananas | Ada | 112 | adb | package body Limited2_Pack_1 is
type B is record
F : Integer := 0;
end record;
end Limited2_Pack_1;
|
charlie5/lace | Ada | 28,507 | adb | with
openGL.Images,
openGL.Viewport,
openGL.Tasks,
openGL.Errors,
GID,
GL.Binding,
GL.safe,
GL.Pointers,
ada.unchecked_Conversion,
ada.Calendar,
ada.Characters.handling,
System;
package body openGL.IO
is
use ada.Characters.handling,
ada.Streams.Stream_IO;
use type Index_t;
--------
-- Face
--
function Vertices_of (Self : in Face) return Vertices
is
begin
case Self.Kind
is
when Triangle => return Self.Tri;
when Quad => return Self.Quad;
when Polygon => return Self.Poly.all;
end case;
end Vertices_of;
procedure set_Vertex_in (Self : in out Face; Which : in long_Index_t;
To : in Vertex)
is
begin
case Self.Kind
is
when Triangle => Self.Tri (Which) := To;
when Quad => Self.Quad (Which) := To;
when Polygon => Self.Poly (Which) := To;
end case;
end set_Vertex_in;
procedure destroy (Self : in out Face)
is
procedure free is new ada.unchecked_Deallocation (Vertices, Vertices_view);
begin
if Self.Kind = Polygon
then
free (Self.Poly);
end if;
end destroy;
-------------
-- Operations
--
function current_Frame return Image
is
use GL,
GL.Binding,
GL.Pointers,
Texture;
Extent : constant Extent_2d := openGL.Viewport.Extent;
Frame : Image (1 .. Index_t (Extent.Width),
1 .. Index_t (Extent.Height));
begin
glReadPixels (0, 0,
GLsizei (Extent.Width),
GLsizei (Extent.Height),
to_GL (Format' (Texture.RGB)),
GL_UNSIGNED_BYTE,
to_GLvoid_access (Frame (1, 1).Red'Access));
return Frame;
end current_Frame;
---------
-- Forge
--
function to_height_Map (image_Filename : in asset_Name;
Scale : in Real := 1.0) return height_Map_view
is
File : Ada.Streams.Stream_IO.File_Type;
Image : GID.Image_Descriptor;
up_Name : constant String := To_Upper (to_String (image_Filename));
next_Frame : ada.Calendar.Day_Duration := 0.0;
begin
open (File, in_File, to_String (image_Filename));
GID.load_Image_Header (Image,
Stream (File).all,
try_tga => image_Filename'Length >= 4
and then up_Name (up_Name'Last - 3 .. up_Name'Last) = ".TGA");
declare
image_Width : constant Positive := GID.Pixel_Width (Image);
image_Height : constant Positive := GID.Pixel_Height (Image);
the_Heights : constant access height_Map := new height_Map' (1 .. Index_t (image_height) =>
(1 .. Index_t (image_width) => <>));
procedure load_raw_Image
is
subtype primary_Color_range is GL.GLubyte;
Row, Col : Index_t;
procedure set_X_Y (x, y : Natural)
is
begin
Col := Index_t (X + 1);
Row := Index_t (Y + 1);
end Set_X_Y;
procedure put_Pixel (Red, Green, Blue : primary_Color_range;
Alpha : primary_Color_range)
is
pragma Warnings (Off, alpha); -- Alpha is just ignored.
use type GL.GLubyte, Real;
begin
the_Heights (Row, Col) := (Real (Red) + Real (Green) + Real (Blue))
/ (3.0 * 255.0)
* Scale;
if Col = Index_t (image_Width)
then
Row := Row + 1;
Col := 1;
else
Col := Col + 1;
end if;
-- ^ GID requires us to look to next pixel on the right for next time.
end put_Pixel;
procedure Feedback (Percents : Natural) is null;
procedure load_Image is new GID.load_Image_contents (primary_Color_range,
set_X_Y,
put_Pixel,
Feedback,
GID.fast);
begin
load_Image (Image, next_Frame);
end load_Raw_image;
begin
load_raw_Image;
close (File);
return the_Heights.all'unchecked_Access;
end;
end to_height_Map;
function fetch_Image (Stream : in ada.Streams.Stream_IO.Stream_access;
try_TGA : in Boolean) return Image
is
begin
return Images.fetch_Image (Stream, try_TGA);
end fetch_Image;
function to_Image (image_Filename : in asset_Name) return Image
is
File : ada.Streams.Stream_IO.File_type;
up_Name : constant String := to_Upper (to_String (image_Filename));
begin
open (File, In_File, to_String (image_Filename));
declare
the_Image : constant Image
:= fetch_Image (Stream (File),
try_TGA => image_Filename'Length >= 4
and then up_Name (up_Name'Last - 3 .. up_Name'Last) = ".TGA");
begin
close (File);
return the_Image;
end;
end to_Image;
function to_lucid_Image (image_Filename : in asset_Name) return lucid_Image
is
Unused : aliased Boolean;
begin
return to_lucid_Image (image_Filename, Unused'Access);
end to_lucid_Image;
function to_lucid_Image (image_Filename : in asset_Name;
is_Lucid : access Boolean) return lucid_Image
is
File : ada.Streams.Stream_IO.File_type;
the_Image : GID.Image_Descriptor;
up_Name : constant String := to_Upper (to_String (image_Filename));
next_Frame : ada.Calendar.Day_Duration := 0.0;
begin
open (File, in_File, to_String (image_Filename));
GID.load_Image_Header (the_Image,
Stream (File).all,
try_TGA => image_Filename'Length >= 4
and then up_Name (up_Name'Last - 3 .. up_Name'Last) = ".TGA");
declare
image_Width : constant Positive := GID.Pixel_Width (the_Image);
image_Height : constant Positive := GID.Pixel_Height (the_Image);
Frame : lucid_Image (1 .. Index_t (image_Height),
1 .. Index_t (image_Width));
procedure load_raw_Image
is
subtype primary_Color_range is GL.GLubyte;
Row, Col : Index_t;
procedure set_X_Y (X, Y : Natural)
is
begin
Col := Index_t (X + 1);
Row := Index_t (Y + 1);
end set_X_Y;
procedure put_Pixel (Red, Green, Blue : primary_Color_range;
Alpha : primary_Color_range)
is
use type GL.GLubyte, Real;
begin
Frame (Row, Col) := ((Red, Green, Blue), Alpha);
if Col = Index_t (image_Width)
then -- GID requires us to look to next pixel on the right for next time.
Row := Row + 1;
Col := 1;
else
Col := Col + 1;
end if;
if Alpha /= opaque_Value
then
is_Lucid.all := True;
end if;
end put_Pixel;
procedure Feedback (Percents : Natural) is null;
procedure load_Image is new GID.load_Image_contents (primary_Color_range,
set_X_Y,
put_Pixel,
Feedback,
GID.fast);
begin
load_Image (the_Image, next_Frame);
end Load_raw_image;
begin
is_Lucid.all := False;
load_raw_Image;
close (File);
return Frame;
end;
end to_lucid_Image;
function to_Texture (image_Filename : in asset_Name) return Texture.Object
is
use Texture;
is_Lucid : aliased Boolean;
the_lucid_Image : constant lucid_Image := to_lucid_Image (image_Filename, is_Lucid'Access);
the_Texture : Texture.Object := Forge.to_Texture (Texture.Dimensions' (the_lucid_Image'Length (2),
the_lucid_Image'Length (1)));
begin
if is_Lucid
then
set_Image (the_Texture, the_lucid_Image);
else
declare
the_opaque_Image : constant Image := to_Image (the_lucid_Image);
begin
set_Image (the_Texture, the_opaque_Image);
end;
end if;
return the_Texture;
end to_Texture;
procedure destroy (Self : in out Model)
is
procedure free is new ada.unchecked_Deallocation (bone_Weights, bone_Weights_view);
procedure free is new ada.unchecked_Deallocation (bone_Weights_array, bone_Weights_array_view);
begin
free (Self.Sites);
free (Self.Coords);
free (Self.Normals);
if Self.Weights /= null
then
for Each in Self.Weights'Range
loop
free (Self.Weights (Each));
end loop;
free (Self.Weights);
end if;
for Each in Self.Faces'Range
loop
destroy (Self.Faces (Each));
end loop;
free (Self.Faces);
end destroy;
--------------------
--- Raw Image Frames
--
procedure write_raw_Frame (to_Stream : in Stream_access;
Width, Height : in Natural;
with_Alpha : in Boolean)
is
use GL,
GL.Binding,
Texture;
-- 4-byte padding for .bmp/.avi formats is the same as GL's default
-- padding: see glPixelStore, GL_[UN]PACK_ALIGNMENT = 4 as initial value.
-- http://www.openGL.org/sdk/docs/man/xhtml/glPixelStore.xml
--
padded_row_Size : constant Positive := (if with_Alpha then 4 * Integer (Float'Ceiling (Float (Width)))
else 4 * Integer (Float'Ceiling (Float (Width) * 3.0 / 4.0)));
-- (in bytes)
type temp_Bitmap_type is array (Natural range <>) of aliased gl.GLUbyte;
PicData : temp_Bitmap_type (0 .. (padded_row_size + 4) * (height + 4) - 1);
--
-- No dynamic allocation needed!
-- The "+4" are there to avoid parity address problems when GL writes
-- to the buffer.
type Loc_pointer is new gl.safe.GLvoid_Pointer;
function convert is new ada.unchecked_Conversion (System.Address, Loc_pointer);
--
-- This method is functionally identical as GNAT's Unrestricted_Access
-- but has no type safety (cf GNAT Docs).
pragma no_strict_Aliasing (Loc_pointer); -- Recommended by GNAT 2005+.
pPicData : Loc_pointer;
data_Max : constant Integer := padded_row_Size * Height - 1;
-- Workaround for the severe xxx'Read xxx'Write performance
-- problems in the GNAT and ObjectAda compilers (as in 2009)
-- This is possible if and only if Byte = Stream_Element and
-- arrays types are both packed the same way.
--
type Byte_array is array (Integer range <>) of aliased GLUByte;
subtype Size_Test_a is Byte_Array (1..19);
subtype Size_Test_b is ada.Streams.Stream_Element_array (1 .. 19);
Workaround_possible: constant Boolean := Size_Test_a'Size = Size_Test_b'Size
and then Size_Test_a'Alignment = Size_Test_b'Alignment;
begin
Tasks.check;
pPicData:= convert (PicData (0)'Address);
GLReadPixels (0, 0,
GLSizei (width),
GLSizei (height),
(if with_Alpha then to_GL (openGL.Texture.BGRA)
else to_GL (openGL.Texture.BGR)),
GL.GL_UNSIGNED_BYTE,
pPicData);
Errors.log;
if Workaround_possible
then
declare
use ada.Streams;
SE_Buffer : Stream_Element_array (0 .. Stream_Element_Offset (PicData'Last));
for SE_Buffer'Address use PicData'Address;
pragma Import (Ada, SE_Buffer);
begin
ada.Streams.write (to_Stream.all, SE_Buffer (0 .. Stream_Element_Offset (data_Max)));
end;
else
temp_Bitmap_type'write (to_Stream, PicData (0 .. data_Max));
end if;
end write_raw_Frame;
--------------
-- Bitmap File
--
type U8 is mod 2 ** 8; for U8 'Size use 8;
type U16 is mod 2 ** 16; for U16'Size use 16;
type U32 is mod 2 ** 32; for U32'Size use 32;
type I32 is range -2 ** 31 .. 2 ** 31 - 1;
for I32'Size use 32;
generic
type Number is mod <>;
S : Stream_Access;
procedure write_Intel_x86_Number (N : in Number);
procedure write_Intel_x86_Number (N : in Number)
is
M : Number := N;
Bytes : constant Integer := Number'Size / 8;
begin
for i in 1 .. bytes
loop
U8'write (S, U8 (M mod 256));
M := M / 256;
end loop;
end write_Intel_x86_Number;
subtype FxPt2dot30 is U32;
type CIExyz is
record
ciexyzX : FxPt2dot30;
ciexyzY : FxPt2dot30;
ciexyzZ : FxPt2dot30;
end record;
type CIExyzTriple is
record
ciexyzRed : CIExyz;
ciexyzGreen : CIExyz;
ciexyzBlue : CIExyz;
end record;
type BitMapFileHeader is
record
bfType : U16;
bfSize : U32;
bfReserved1 : U16 := 0;
bfReserved2 : U16 := 0;
bfOffBits : U32;
end record;
pragma pack (BitMapFileHeader);
for BitMapFileHeader'Size use 8 * 14;
type BitMapInfoHeader is
record
biSize : U32;
biWidth : I32;
biHeight : I32;
biPlanes : U16;
biBitCount : U16;
biCompression : U32;
biSizeImage : U32;
biXPelsPerMeter : I32 := 0;
biYPelsPerMeter : I32 := 0;
biClrUsed : U32 := 0;
biClrImportant : U32 := 0;
end record;
pragma pack (BitMapInfoHeader);
for BitMapInfoHeader'Size use 8 * 40;
type BitMapV4Header is
record
Core : BitMapInfoHeader;
bV4RedMask : U32;
bV4GreenMask : U32;
bV4BlueMask : U32;
bV4AlphaMask : U32;
bV4CSType : U32;
bV4Endpoints : CIExyzTriple;
bV4GammaRed : U32;
bV4GammaGreen : U32;
bV4GammaBlue : U32;
end record;
pragma pack (BitMapV4Header);
for BitMapV4Header'Size use 8 * 108;
procedure write_BMP_Header (to_Stream : in Stream_Access;
Width, Height : in GL.GLint;
with_Alpha : in Boolean)
is
use GL,
GL.Binding,
Texture;
FileHeader : BitMapFileHeader;
FileInfo : BitMapV4Header;
begin
FileHeader.bfType := 16#4D42#; -- 'BM'
FileInfo.Core.biWidth := I32 (Width);
FileInfo.Core.biHeight := I32 (Height);
FileInfo.Core.biPlanes := 1;
if with_Alpha
then
FileHeader.bfOffBits := BitMapFileHeader'Size / 8
+ BitMapV4Header 'Size / 8;
FileInfo.Core.biSize := BitMapV4Header'Size / 8;
FileInfo.Core.biBitCount := 32;
FileInfo.Core.biCompression := 3;
FileInfo.Core.biSizeImage := U32 ( 4 -- 4-byte padding for '.bmp/.avi' formats.
* Integer (Float'Ceiling (Float (FileInfo.Core.biWidth)))
* Integer (FileInfo.Core.biHeight));
FileInfo.bV4RedMask := 16#00FF0000#;
FileInfo.bV4GreenMask := 16#0000FF00#;
FileInfo.bV4BlueMask := 16#000000FF#;
FileInfo.bV4AlphaMask := 16#FF000000#;
FileInfo.bV4CSType := 0;
FileInfo.bV4Endpoints := (others => (others => 0));
FileInfo.bV4GammaRed := 0;
FileInfo.bV4GammaGreen := 0;
FileInfo.bV4GammaBlue := 0;
else
FileHeader.bfOffBits := BitMapFileHeader'Size / 8
+ BitMapInfoHeader'Size / 8;
FileInfo.Core.biSize := BitMapInfoHeader'Size / 8;
FileInfo.Core.biBitCount := 24;
FileInfo.Core.biCompression := 0;
FileInfo.Core.biSizeImage := U32 ( 4 -- 4-byte padding for '.bmp/.avi' formats.
* Integer (Float'Ceiling (Float (FileInfo.Core.biWidth) * 3.0 / 4.0))
* Integer (FileInfo.Core.biHeight));
end if;
FileHeader.bfSize := FileHeader.bfOffBits + FileInfo.Core.biSizeImage;
declare
procedure write_Intel is new write_Intel_x86_Number (U16, to_Stream);
procedure write_Intel is new write_Intel_x86_Number (U32, to_Stream);
function convert is new ada.unchecked_Conversion (I32, U32);
begin
-- ** Endian-safe: ** --
write_Intel (FileHeader.bfType);
write_Intel (FileHeader.bfSize);
write_Intel (FileHeader.bfReserved1);
write_Intel (FileHeader.bfReserved2);
write_Intel (FileHeader.bfOffBits);
--
write_Intel ( FileInfo.Core.biSize);
write_Intel (convert (FileInfo.Core.biWidth));
write_Intel (convert (FileInfo.Core.biHeight));
write_Intel ( FileInfo.Core.biPlanes);
write_Intel ( FileInfo.Core.biBitCount);
write_Intel ( FileInfo.Core.biCompression);
write_Intel ( FileInfo.Core.biSizeImage);
write_Intel (convert (FileInfo.Core.biXPelsPerMeter));
write_Intel (convert (FileInfo.Core.biYPelsPerMeter));
write_Intel ( FileInfo.Core.biClrUsed);
write_Intel ( FileInfo.Core.biClrImportant);
if with_Alpha
then
write_Intel (FileInfo.bV4RedMask);
write_Intel (FileInfo.bV4GreenMask);
write_Intel (FileInfo.bV4BlueMask);
write_Intel (FileInfo.bV4AlphaMask);
write_Intel (FileInfo.bV4CSType);
write_Intel (FileInfo.bV4Endpoints.ciexyzRed.ciexyzX);
write_Intel (FileInfo.bV4Endpoints.ciexyzRed.ciexyzY);
write_Intel (FileInfo.bV4Endpoints.ciexyzRed.ciexyzZ);
write_Intel (FileInfo.bV4Endpoints.ciexyzGreen.ciexyzX);
write_Intel (FileInfo.bV4Endpoints.ciexyzGreen.ciexyzY);
write_Intel (FileInfo.bV4Endpoints.ciexyzGreen.ciexyzZ);
write_Intel (FileInfo.bV4Endpoints.ciexyzBlue.ciexyzX);
write_Intel (FileInfo.bV4Endpoints.ciexyzBlue.ciexyzY);
write_Intel (FileInfo.bV4Endpoints.ciexyzBlue.ciexyzZ);
write_Intel (FileInfo.bV4GammaRed);
write_Intel (FileInfo.bV4GammaGreen);
write_Intel (FileInfo.bV4GammaBlue);
end if;
end;
end write_BMP_Header;
-------------
-- Save Image
--
procedure save (image_Filename : in String;
the_Image : in Image)
is
use GL,
GL.Binding,
ada.Streams.Stream_IO;
File : ada.Streams.Stream_IO.File_type;
S : ada.Streams.Stream_IO.Stream_access;
Size : Extent_2D := (Width => the_Image'Length (2),
Height => the_Image'Length (1));
begin
create (File, out_File, image_Filename);
S := Stream (File);
write_BMP_Header (to_Stream => S,
Width => GLint (Size.Width),
Height => GLint (Size.Height),
with_Alpha => True);
for r in 1 .. Index_t (Size.Height)
loop
for c in 1 .. Index_t (Size.Width)
loop
color_Value'write (S, the_Image (r, c).Blue);
color_Value'write (S, the_Image (r, c).Green);
color_Value'write (S, the_Image (r, c).Red);
color_Value'write (S, 255);
end loop;
end loop;
close (File);
exception
when others =>
if is_Open (File)
then
close (File);
end if;
raise;
end Save;
-------------
-- Screenshot
--
procedure Screenshot (Filename : in String;
with_Alpha : in Boolean := False)
is
use GL,
GL.Binding,
ada.Streams.Stream_IO;
File : ada.Streams.Stream_IO.File_type;
S : ada.Streams.Stream_IO.Stream_access;
Viewport : array (0 .. 3) of aliased GLint;
begin
Tasks.check;
glGetIntegerv (GL_VIEWPORT,
Viewport (0)'unchecked_Access);
Errors.log;
create (File, out_File, Filename);
S := Stream (File);
write_BMP_Header (to_Stream => S,
Width => Viewport (2),
Height => Viewport (3),
with_Alpha => with_Alpha);
write_raw_Frame (to_Stream => S,
Width => Integer (Viewport (2)),
Height => Integer (Viewport (3)),
with_Alpha => with_Alpha);
close (File);
exception
when others =>
if is_Open (File)
then
close (File);
end if;
raise;
end Screenshot;
----------------
-- Video Capture
--
-- We define global variables since it is not expected
-- that more that one capture is taken at the same time.
--
avi : ada.Streams.Stream_IO.File_type;
frames : Natural;
rate : Positive;
width, height : Positive;
bmp_size : U32;
procedure write_RIFF_Headers
is
-- Written 1st time to take place (but # of frames unknown)
-- Written 2nd time for setting # of frames, sizes, etc.
--
calc_bmp_size : constant U32 := U32 (((width)) * height * 3);
-- !! stuff to multiple of 4 !!
index_size : constant U32 := U32 (frames) * 16;
movie_size : constant U32 := 4 + U32 (frames) * (calc_bmp_size + 8);
second_list_size : constant U32 := 4 + 64 + 48;
first_list_size : constant U32 := (4 + 64) + (8 + second_list_size);
file_size : constant U32 := 8 + (8 + first_list_size) + (4 + movie_size) + (8 + index_size);
Stream : constant Stream_access := ada.Streams.Stream_IO.Stream (avi);
procedure write_Intel is new write_Intel_x86_Number (U16, Stream);
procedure write_Intel is new write_Intel_x86_Number (U32, Stream);
microseconds_per_frame : constant U32 := U32 (1_000_000.0 / long_Float (rate));
begin
bmp_size := calc_bmp_size;
String'write (Stream, "RIFF");
U32 'write (Stream, file_size);
String'write (Stream, "AVI ");
String'write (Stream, "LIST");
write_Intel (first_list_size);
String'write (Stream, "hdrl");
String'write (Stream, "avih");
write_Intel (U32' (56));
-- Begin of AVI Header
write_Intel (microseconds_per_frame);
write_Intel (U32'(0)); -- MaxBytesPerSec
write_Intel (U32'(0)); -- Reserved1
write_Intel (U32'(16)); -- Flags (16 = has an index)
write_Intel (U32 (frames));
write_Intel (U32'(0)); -- InitialFrames
write_Intel (U32'(1)); -- Streams
write_Intel (bmp_size);
write_Intel (U32 (width));
write_Intel (U32 (height));
write_Intel (U32'(0)); -- Scale
write_Intel (U32'(0)); -- Rate
write_Intel (U32'(0)); -- Start
write_Intel (U32'(0)); -- Length
-- End of AVI Header
String'write (Stream, "LIST");
write_Intel (second_list_size);
String'write (Stream, "strl");
-- Begin of Str
String'write (Stream, "strh");
write_Intel (U32'(56));
String'write (Stream, "vids");
String'write (Stream, "DIB ");
write_Intel (U32'(0)); -- flags
write_Intel (U32'(0)); -- priority
write_Intel (U32'(0)); -- initial frames
write_Intel (microseconds_per_frame); -- Scale
write_Intel (U32'(1_000_000)); -- Rate
write_Intel (U32'(0)); -- Start
write_Intel (U32 (frames)); -- Length
write_Intel (bmp_size); -- SuggestedBufferSize
write_Intel (U32'(0)); -- Quality
write_Intel (U32'(0)); -- SampleSize
write_Intel (U32'(0));
write_Intel (U16 (width));
write_Intel (U16 (height));
-- End of Str
String'write (Stream, "strf");
write_Intel (U32'(40));
-- Begin of BMI
write_Intel (U32'(40)); -- BM header size (like BMP)
write_Intel (U32 (width));
write_Intel (U32 (height));
write_Intel (U16'(1)); -- Planes
write_Intel (U16'(24)); -- BitCount
write_Intel (U32'(0)); -- Compression
write_Intel (bmp_size); -- SizeImage
write_Intel (U32'(3780)); -- XPelsPerMeter
write_Intel (U32'(3780)); -- YPelsPerMeter
write_Intel (U32'(0)); -- ClrUsed
write_Intel (U32'(0)); -- ClrImportant
-- End of BMI
String'write (Stream, "LIST");
write_Intel (movie_size);
String'write (Stream, "movi");
end Write_RIFF_headers;
procedure start_Capture (AVI_Name : String;
frame_Rate : Positive)
is
use GL,
GL.Binding;
Viewport : array (0 .. 3) of aliased GLint;
begin
Tasks.check;
create (Avi, out_File, AVI_Name);
Frames := 0;
Rate := frame_Rate;
glGetIntegerv (GL_VIEWPORT,
Viewport (0)'unchecked_Access);
Errors.log;
Width := Positive (Viewport (2));
Height := Positive (Viewport (3));
-- NB: GL viewport resizing should be blocked during the video capture !
write_RIFF_Headers;
end start_Capture;
procedure capture_Frame
is
S : constant Stream_Access := Stream (Avi);
procedure Write_Intel is new Write_Intel_x86_number (U32, s);
begin
String'write (S, "00db");
write_Intel (bmp_Size);
write_raw_Frame (S, Width, Height, with_Alpha => False);
Frames := Frames + 1;
end capture_Frame;
procedure stop_Capture
is
index_Size : constant U32 := U32 (Frames) * 16;
S : constant Stream_Access := Stream (Avi);
ChunkOffset : U32 := 4;
procedure write_Intel is new write_Intel_x86_Number (U32, S);
begin
-- Write the index section
--
String'write (S, "idx1");
write_Intel (index_Size);
for f in 1 .. Frames
loop
String'write (S, "00db");
write_Intel (U32'(16)); -- Keyframe.
write_Intel (ChunkOffset);
ChunkOffset := ChunkOffset + bmp_Size + 8;
write_Intel (bmp_Size);
end loop;
Set_Index (avi, 1); -- Go back to file beginning.
write_RIFF_Headers; -- Rewrite headers with correct data.
close (Avi);
end stop_Capture;
end openGL.IO;
|
reznikmm/matreshka | Ada | 5,121 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
package Engines is
type Text_Property is
(Code,
Condition,
Lower, Upper, -- Code for range return X'First X'Last
Intrinsic_Name,
Associations, -- names of record assotiation a,b,c
Tag_Name, -- external tag name image
Method_Name, -- name of subrogram in virtual table
Address, -- Access or address of an object
Initialize,
-- Code to initialize an object of given type
Typed_Array_Initialize, -- Iniitalize component of Typed_Array aggr
Typed_Array_Item_Type, -- Elementary type of Typed_Array item
Assign, -- Code to copy component, discriminant or variant
Bounds, -- "First,Last" bounds for nested named array aggregate
Size); -- value of S'Size or X'Size
type Boolean_Property is
(Export,
Has_Simple_Output, -- Has parameters of Is_Simple_Type and
-- has [in] out mode
Is_Simple_Type, -- Is non-object type (Number, Boolean, etc)
Is_Simple_Ref, -- Wrapper for non-object type (Number, Boolean, etc)
Is_Array_Of_Simple, -- Is array elements Is_Simple_Type
Inside_Package, -- Enclosing Element is a package
Is_Dispatching); -- Declaration/call is a dispatching subprogram
type Integer_Property is
(Alignment); -- value of S'Alignment or X'Alignment
type Convention_Property is
(Call_Convention);
type Convention_Kind is
(Intrinsic,
JavaScript_Property_Getter, -- obj.prop
JavaScript_Property_Setter, -- obj.prop = val
JavaScript_Function, -- funct (args)
JavaScript_Method, -- obj.funct (args)
JavaScript_Getter, -- collection.getter (index - 1)
Unspecified);
end Engines;
|
twdroeger/ada-awa | Ada | 5,385 | ads | -----------------------------------------------------------------------
-- AWA.Sysadmin.Models -- AWA.Sysadmin.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) 2019 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
pragma Warnings (Off);
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with ADO.Queries;
with ADO.Queries.Loaders;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Basic.Lists;
with Util.Beans.Methods;
pragma Warnings (On);
package AWA.Sysadmin.Models is
pragma Style_Checks ("-mr");
-- --------------------
-- The information about a wiki page.
-- --------------------
type User_Info is
new Util.Beans.Basic.Bean with record
-- the user page identifier.
Id : ADO.Identifier;
-- the wiki page name.
Name : Ada.Strings.Unbounded.Unbounded_String;
-- the wiki page title.
Title : Ada.Strings.Unbounded.Unbounded_String;
-- whether the wiki is public.
Is_Public : Boolean;
-- the last version.
Last_Version : Integer;
-- the read count.
Read_Count : Integer;
-- the wiki creation date.
Create_Date : Ada.Calendar.Time;
-- the wiki page author.
Author : Ada.Strings.Unbounded.Unbounded_String;
end record;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in User_Info;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out User_Info;
Name : in String;
Value : in Util.Beans.Objects.Object);
package User_Info_Beans is
new Util.Beans.Basic.Lists (Element_Type => User_Info);
package User_Info_Vectors renames User_Info_Beans.Vectors;
subtype User_Info_List_Bean is User_Info_Beans.List_Bean;
type User_Info_List_Bean_Access is access all User_Info_List_Bean;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out User_Info_List_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
subtype User_Info_Vector is User_Info_Vectors.Vector;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out User_Info_Vector;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
Query_Sysadmin_User_List : constant ADO.Queries.Query_Definition_Access;
-- --------------------
-- authenticate the sysadmin user
-- --------------------
type Authenticate_Bean is abstract limited
new Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with record
-- the password.
Password : Ada.Strings.Unbounded.Unbounded_String;
end record;
-- This bean provides some methods that can be used in a Method_Expression.
overriding
function Get_Method_Bindings (From : in Authenticate_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in Authenticate_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Authenticate_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Authenticate (Bean : in out Authenticate_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
private
package File_1 is
new ADO.Queries.Loaders.File (Path => "sysadmin-users.xml",
Sha1 => "54186E969C872FD5295A3FA31BA701F514B38284");
package Def_Userinfo_Sysadmin_User_List is
new ADO.Queries.Loaders.Query (Name => "sysadmin-user-list",
File => File_1.File'Access);
Query_Sysadmin_User_List : constant ADO.Queries.Query_Definition_Access
:= Def_Userinfo_Sysadmin_User_List.Query'Access;
end AWA.Sysadmin.Models;
|
docandrew/troodon | Ada | 1,144 | ads | pragma Ada_2012;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with bits_types_u_locale_t_h;
package bits_types_locale_t_h is
-- Definition of locale_t.
-- Copyright (C) 2017-2021 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
-- <https://www.gnu.org/licenses/>.
subtype locale_t is bits_types_u_locale_t_h.uu_locale_t; -- /usr/include/bits/types/locale_t.h:24
end bits_types_locale_t_h;
|
tum-ei-rcs/StratoX | Ada | 2,916 | ads | -- Institution: Technische Universität München
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
-- Module: Hardware Configuration
--
-- Authors: Emanuel Regnath ([email protected])
--
-- Description:
-- Hardware Configuration of the board.
with Units; use Units;
with Units.Navigation; use Units.Navigation;
package Config with SPARK_Mode is
-- Board
-- -------------------------------
LED_PIN : constant := 12;
BARO_I2C_ADDRESS : constant := 0;
-- Estimator
-- -------------------------------
DEFAULT_HOME_LONG : constant Longitude_Type := 11.815031 * Degree; -- east of munich
DEFAULT_HOME_LAT : constant Latitude_Type := 48.192574 * Degree; -- east of munich
DEFAULT_HOME_ALT_MSL : constant Altitude_Type := 518.0 * Meter; -- east of munich
TARGET_AREA_RADIUS : constant Length_Type := 50.0 * Meter; -- final: 50...100.
pragma Assert (TARGET_AREA_RADIUS >= 20.0 * Meter); -- below 15m the navigation is too imprecise
-- Flight
-- -------------------------------
TARGET_PITCH : constant Pitch_Type := -3.0 * Degree; -- assuming that this pitch eventually results in good airspeed
CIRCLE_TRAJECTORY_ROLL : constant Roll_Type := 5.0 * Degree; -- roll angle when circles are requested
-- target attitude limits in controlled flights (symmetric around zero; may be overshot in real world)
MAX_ROLL : constant Roll_Type := 5.0 * Degree;
MAX_PITCH : constant Pitch_Type := 20.0 * Degree;
-- Mission
-- -------------------------------
CFG_TARGET_ALTITUDE : constant Altitude_Type := 6100.0 * Meter; -- 20_000ft
-- when reaching this relative altitude, we detach
CFG_TARGET_ALTITUDE_TIME : constant := 6.0 * Second;
-- after so much time at target altitude the detach happens
CFG_DELTA_ALTITUDE_THRESH : constant Altitude_Type := 20.0 * Meter; -- Diff
CFG_DELTA_ALTITUDE_THRESH_TIME : constant := 2.0 * Second;
-- Servos
-- -------------------------------
CFG_LEFT_SERVO_OFFSET : constant := 8.0 * Degree;
CFG_RIGHT_SERVO_OFFSET : constant := 4.0 * Degree;
-- Limits
CFG_SERVO_ANGLE_LIMIT_MIN : constant := -45.0 * Degree;
CFG_SERVO_ANGLE_LIMIT_MAX : constant := 45.0 * Degree;
CFG_SERVO_PULSE_LENGTH_LIMIT_MIN : constant := 1.100 * Milli*Second;
CFG_SERVO_PULSE_LENGTH_LIMIT_MAX : constant := 1.900 * Milli*Second;
CFG_MOTOR_SPEED_LIMIT_MIN : constant := 0.0 * Degree / Second;
CFG_MOTOR_SPEED_LIMIT_MAX : constant := 10.0 * 360.0 * Degree / Second; -- Degree per Second
-- Parameter Server
-- organize parameters in groups
type Float_Parameter_Type is( TIMEOUT_TEST,
BUADRATE
);
type FLoat_Parameter_Array is array( Float_Parameter_Type ) of Float;
-- procedure get_Parameter( param : Float_Parameter_Type; value : out Float );
end Config;
|
twdroeger/ada-awa | Ada | 1,290 | ads | -----------------------------------------------------------------------
-- awa-images -- Image module
-- Copyright (C) 2012, 2016, 2018 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
-- = Images Module =
-- The image plugin is an extension to the storage plugin that identifies images and
-- provides thumbnails as well as resizing of the original image.
--
-- @include awa-images-modules.ads
-- @include awa-images-beans.ads
--
-- == Queries ==
-- @include-query image-info.xml
-- @include-query image-list.xml
--
-- == Data model ==
-- [images/awa_images_model.png]
--
package AWA.Images is
end AWA.Images;
|
stcarrez/mat | Ada | 12,604 | adb | -----------------------------------------------------------------------
-- mat-symbols-targets - Symbol files management
-- Copyright (C) 2014, 2015, 2019, 2021 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Interfaces;
with Bfd.Sections;
with ELF;
with Util.Strings;
with Util.Files;
with Util.Log.Loggers;
with Ada.Directories;
with MAT.Formats;
package body MAT.Symbols.Targets is
use Ada.Strings.Unbounded;
-- The logger
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("MAT.Symbols.Targets");
procedure Find_Nearest_Line (Symbols : in Region_Symbols;
Addr : in MAT.Types.Target_Addr;
Symbol : out Symbol_Info);
-- ------------------------------
-- Open the binary and load the symbols from that file.
-- ------------------------------
procedure Open (Symbols : in out Target_Symbols;
Path : in String) is
begin
Log.Info ("Loading symbols from {0}", Path);
--
-- Bfd.Files.Open (Symbols.File, Path, "");
-- if Bfd.Files.Check_Format (Symbols.File, Bfd.Files.OBJECT) then
-- Bfd.Symbols.Read_Symbols (Symbols.File, Symbols.Symbols);
-- end if;
end Open;
-- ------------------------------
-- Load the symbol table for the associated region.
-- ------------------------------
procedure Open (Symbols : in out Region_Symbols;
Path : in String;
Search_Path : in String) is
Pos : Natural;
begin
Log.Info ("Loading symbols from {0}", Path);
if Ada.Directories.Exists (Path) then
Bfd.Files.Open (Symbols.File, Path, "");
else
Pos := Util.Strings.Rindex (Path, '/');
if Pos > 0 then
Bfd.Files.Open (Symbols.File,
Util.Files.Find_File_Path (Path (Pos + 1 .. Path'Last), Search_Path));
end if;
end if;
if Bfd.Files.Check_Format (Symbols.File, Bfd.Files.OBJECT) then
Bfd.Symbols.Read_Symbols (Symbols.File, Symbols.Symbols);
end if;
end Open;
-- ------------------------------
-- Load the symbols associated with a shared library described by the memory region.
-- ------------------------------
procedure Load_Symbols (Symbols : in out Target_Symbols;
Region : in MAT.Memory.Region_Info;
Offset_Addr : in MAT.Types.Target_Addr) is
use type Bfd.File_Flags;
Pos : constant Symbols_Cursor := Symbols.Libraries.Find (Region.Start_Addr);
Syms : Region_Symbols_Ref;
begin
if not Symbols_Maps.Has_Element (Pos) then
Syms := Region_Symbols_Refs.Create;
Syms.Value.Region := Region;
Syms.Value.Offset := Offset_Addr;
Symbols.Libraries.Insert (Region.Start_Addr, Syms);
else
Syms := Symbols_Maps.Element (Pos);
end if;
if Ada.Strings.Unbounded.Length (Region.Path) > 0 then
Open (Syms.Value, Ada.Strings.Unbounded.To_String (Region.Path),
Ada.Strings.Unbounded.To_String (Symbols.Search_Path));
if Bfd.Files.Is_Open (Syms.Value.File) and
then (Bfd.Files.Get_File_Flags (Syms.Value.File) and Bfd.Files.EXEC_P) /= 0
then
Syms.Value.Offset := 0;
end if;
end if;
end Load_Symbols;
-- ------------------------------
-- Load the symbols associated with all the shared libraries described by
-- the memory region map.
-- ------------------------------
procedure Load_Symbols (Symbols : in out Target_Symbols;
Regions : in MAT.Memory.Region_Info_Map) is
use type ELF.Elf32_Word;
Iter : MAT.Memory.Region_Info_Cursor := Regions.First;
begin
while MAT.Memory.Region_Info_Maps.Has_Element (Iter) loop
declare
Region : MAT.Memory.Region_Info := MAT.Memory.Region_Info_Maps.Element (Iter);
Offset : MAT.Types.Target_Addr;
begin
if (Region.Flags and ELF.PF_X) /= 0 then
if Ada.Strings.Unbounded.Length (Region.Path) = 0 then
Region.Path := Symbols.Path;
Offset := 0;
else
Offset := Region.Offset;
end if;
MAT.Symbols.Targets.Load_Symbols (Symbols, Region, Offset);
end if;
exception
when Bfd.OPEN_ERROR =>
Symbols.Console.Error ("Cannot open symbol library file '"
& Ada.Strings.Unbounded.To_String (Region.Path) & "'");
end;
MAT.Memory.Region_Info_Maps.Next (Iter);
end loop;
end Load_Symbols;
-- ------------------------------
-- Demangle the symbol.
-- ------------------------------
procedure Demangle (Symbols : in Target_Symbols;
Symbol : in out Symbol_Info) is
use type Bfd.Demangle_Flags;
Pos : constant Natural := Index (Symbol.File, ".", Ada.Strings.Backward);
begin
if Symbol.Line = 0 or else Pos = 0 or else Symbol.Symbols.Is_Null then
return;
end if;
declare
Mode : Bfd.Demangle_Flags := Symbols.Demangle;
Len : constant Positive := Length (Symbol.File);
Ext : constant String := Slice (Symbol.File, Pos, Len);
Sym : constant String := To_String (Symbol.Name);
begin
if Mode = Bfd.Constants.DMGL_AUTO and then Ext = ".adb" then
Mode := Bfd.Constants.DMGL_GNAT;
end if;
declare
Name : constant String := Bfd.Symbols.Demangle (Symbol.Symbols.Value.File, Sym, Mode);
begin
if Name'Length > 0 then
Symbol.Name := To_Unbounded_String (Name);
end if;
end;
end;
end Demangle;
procedure Find_Nearest_Line (Symbols : in Region_Symbols;
Addr : in MAT.Types.Target_Addr;
Symbol : out Symbol_Info) is
use type Bfd.Vma_Type;
Text_Section : Bfd.Sections.Section;
Pc : constant Bfd.Vma_Type := Bfd.Vma_Type (Addr);
begin
if not Bfd.Files.Is_Open (Symbols.File) then
Symbol.File := Symbols.Region.Path;
return;
end if;
Text_Section := Bfd.Sections.Find_Section (Symbols.File, ".text");
Bfd.Symbols.Find_Nearest_Line (File => Symbols.File,
Sec => Text_Section,
Symbols => Symbols.Symbols,
Addr => Pc,
Name => Symbol.File,
Func => Symbol.Name,
Line => Symbol.Line);
end Find_Nearest_Line;
-- ------------------------------
-- Find the nearest source file and line for the given address.
-- ------------------------------
procedure Find_Nearest_Line (Symbols : in Target_Symbols;
Addr : in MAT.Types.Target_Addr;
Symbol : out Symbol_Info) is
Pos : constant Symbols_Cursor := Symbols.Libraries.Floor (Addr);
begin
Symbol.Line := 0;
if Symbols_Maps.Has_Element (Pos) then
declare
Syms : constant Region_Symbols_Ref := Symbols_Maps.Element (Pos);
begin
if Syms.Value.Region.End_Addr > Addr then
Symbol.Symbols := Syms;
Find_Nearest_Line (Symbols => Syms.Value,
Addr => Addr - Syms.Value.Region.Offset,
Symbol => Symbol);
if Symbols.Use_Demangle then
Demangle (Symbols, Symbol);
end if;
return;
end if;
exception
when Bfd.NOT_FOUND =>
Symbol.Line := 0;
Symbol.File := Syms.Value.Region.Path;
Symbol.Name := Ada.Strings.Unbounded.To_Unbounded_String (MAT.Formats.Addr (Addr));
return;
end;
end if;
Symbol.Line := 0;
Symbol.File := Ada.Strings.Unbounded.To_Unbounded_String ("");
Symbol.Name := Ada.Strings.Unbounded.To_Unbounded_String (MAT.Formats.Addr (Addr));
end Find_Nearest_Line;
-- ------------------------------
-- Find the symbol in the symbol table and return the start and end address.
-- ------------------------------
procedure Find_Symbol_Range (Symbols : in Target_Symbols;
Name : in String;
From : out MAT.Types.Target_Addr;
To : out MAT.Types.Target_Addr) is
use type Bfd.Symbols.Symbol;
Iter : Symbols_Cursor := Symbols.Libraries.First;
begin
while Symbols_Maps.Has_Element (Iter) loop
declare
Syms : constant Region_Symbols_Ref := Symbols_Maps.Element (Iter);
Sym : Bfd.Symbols.Symbol;
Sec : Bfd.Sections.Section;
begin
if not Syms.Is_Null and then Bfd.Files.Is_Open (Syms.Value.File) then
Sym := Bfd.Symbols.Get_Symbol (Syms.Value.Symbols, Name);
if Sym /= Bfd.Symbols.Null_Symbol then
Sec := Bfd.Symbols.Get_Section (Sym);
if not Bfd.Sections.Is_Undefined_Section (Sec) then
From := MAT.Types.Target_Addr (Bfd.Symbols.Get_Value (Sym));
From := From + Syms.Value.Offset;
To := From + MAT.Types.Target_Addr (Bfd.Symbols.Get_Symbol_Size (Sym));
return;
end if;
end if;
end if;
end;
Symbols_Maps.Next (Iter);
end loop;
end Find_Symbol_Range;
-- ------------------------------
-- Find the symbol region in the symbol table which contains the given address
-- and return the start and end address.
-- ------------------------------
procedure Find_Symbol_Range (Symbols : in Target_Symbols;
Addr : in MAT.Types.Target_Addr;
From : out MAT.Types.Target_Addr;
To : out MAT.Types.Target_Addr) is
use type Bfd.Symbols.Symbol;
Pos : constant Symbols_Cursor := Symbols.Libraries.Floor (Addr);
begin
if Symbols_Maps.Has_Element (Pos) then
declare
Syms : constant Region_Symbols_Ref := Symbols_Maps.Element (Pos);
Symbol : Symbol_Info;
Sym : Bfd.Symbols.Symbol;
Sec : Bfd.Sections.Section;
begin
if Syms.Value.Region.End_Addr > Addr then
Symbol.Line := 0;
Symbol.Symbols := Syms;
Find_Nearest_Line (Symbols => Syms.Value,
Addr => Addr - Syms.Value.Offset,
Symbol => Symbol);
Sym := Bfd.Symbols.Get_Symbol (Syms.Value.Symbols, To_String (Symbol.Name));
if Sym /= Bfd.Symbols.Null_Symbol then
Sec := Bfd.Symbols.Get_Section (Sym);
if not Bfd.Sections.Is_Undefined_Section (Sec) then
From := MAT.Types.Target_Addr (Bfd.Symbols.Get_Value (Sym));
From := From + Syms.Value.Offset;
To := From + MAT.Types.Target_Addr (Bfd.Symbols.Get_Symbol_Size (Sym));
return;
end if;
end if;
end if;
end;
end if;
From := Addr;
To := Addr;
exception
when Bfd.NOT_FOUND =>
From := Addr;
To := Addr;
end Find_Symbol_Range;
end MAT.Symbols.Targets;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 10,718 | ads | -- This spec has been automatically generated from STM32F303xE.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.FPU is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CPACR_CP0_Field is STM32_SVD.Bit;
subtype CPACR_CP1_Field is STM32_SVD.Bit;
subtype CPACR_CP2_Field is STM32_SVD.Bit;
subtype CPACR_CP3_Field is STM32_SVD.Bit;
subtype CPACR_CP4_Field is STM32_SVD.Bit;
subtype CPACR_CP5_Field is STM32_SVD.Bit;
subtype CPACR_CP6_Field is STM32_SVD.UInt2;
subtype CPACR_CP7_Field is STM32_SVD.Bit;
subtype CPACR_CP10_Field is STM32_SVD.Bit;
subtype CPACR_CP11_Field is STM32_SVD.Bit;
-- Coprocessor Access Control Register
type CPACR_Register is record
-- Access privileges for coprocessor 0
CP0 : CPACR_CP0_Field := 16#0#;
-- unspecified
Reserved_1_1 : STM32_SVD.Bit := 16#0#;
-- Access privileges for coprocessor 1
CP1 : CPACR_CP1_Field := 16#0#;
-- unspecified
Reserved_3_3 : STM32_SVD.Bit := 16#0#;
-- Access privileges for coprocessor 2
CP2 : CPACR_CP2_Field := 16#0#;
-- unspecified
Reserved_5_5 : STM32_SVD.Bit := 16#0#;
-- Access privileges for coprocessor 3
CP3 : CPACR_CP3_Field := 16#0#;
-- unspecified
Reserved_7_7 : STM32_SVD.Bit := 16#0#;
-- Access privileges for coprocessor 4
CP4 : CPACR_CP4_Field := 16#0#;
-- unspecified
Reserved_9_9 : STM32_SVD.Bit := 16#0#;
-- Access privileges for coprocessor 5
CP5 : CPACR_CP5_Field := 16#0#;
-- unspecified
Reserved_11_11 : STM32_SVD.Bit := 16#0#;
-- Access privileges for coprocessor 6
CP6 : CPACR_CP6_Field := 16#0#;
-- Access privileges for coprocessor 7
CP7 : CPACR_CP7_Field := 16#0#;
-- unspecified
Reserved_15_19 : STM32_SVD.UInt5 := 16#0#;
-- Access privileges for coprocessor 10
CP10 : CPACR_CP10_Field := 16#0#;
-- unspecified
Reserved_21_21 : STM32_SVD.Bit := 16#0#;
-- Access privileges for coprocessor 11
CP11 : CPACR_CP11_Field := 16#0#;
-- unspecified
Reserved_23_31 : STM32_SVD.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CPACR_Register use record
CP0 at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
CP1 at 0 range 2 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
CP2 at 0 range 4 .. 4;
Reserved_5_5 at 0 range 5 .. 5;
CP3 at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
CP4 at 0 range 8 .. 8;
Reserved_9_9 at 0 range 9 .. 9;
CP5 at 0 range 10 .. 10;
Reserved_11_11 at 0 range 11 .. 11;
CP6 at 0 range 12 .. 13;
CP7 at 0 range 14 .. 14;
Reserved_15_19 at 0 range 15 .. 19;
CP10 at 0 range 20 .. 20;
Reserved_21_21 at 0 range 21 .. 21;
CP11 at 0 range 22 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
subtype FPCCR_LSPACT_Field is STM32_SVD.Bit;
subtype FPCCR_USER_Field is STM32_SVD.Bit;
subtype FPCCR_THREAD_Field is STM32_SVD.Bit;
subtype FPCCR_HFRDY_Field is STM32_SVD.Bit;
subtype FPCCR_MMRDY_Field is STM32_SVD.Bit;
subtype FPCCR_BFRDY_Field is STM32_SVD.Bit;
subtype FPCCR_MONRDY_Field is STM32_SVD.Bit;
subtype FPCCR_LSPEN_Field is STM32_SVD.Bit;
subtype FPCCR_ASPEN_Field is STM32_SVD.Bit;
-- FP Context Control Register
type FPCCR_Register is record
-- LSPACT
LSPACT : FPCCR_LSPACT_Field := 16#0#;
-- USER
USER : FPCCR_USER_Field := 16#0#;
-- unspecified
Reserved_2_2 : STM32_SVD.Bit := 16#0#;
-- THREAD
THREAD : FPCCR_THREAD_Field := 16#0#;
-- HFRDY
HFRDY : FPCCR_HFRDY_Field := 16#0#;
-- MMRDY
MMRDY : FPCCR_MMRDY_Field := 16#0#;
-- BFRDY
BFRDY : FPCCR_BFRDY_Field := 16#0#;
-- unspecified
Reserved_7_7 : STM32_SVD.Bit := 16#0#;
-- MONRDY
MONRDY : FPCCR_MONRDY_Field := 16#0#;
-- unspecified
Reserved_9_29 : STM32_SVD.UInt21 := 16#0#;
-- LSPEN
LSPEN : FPCCR_LSPEN_Field := 16#1#;
-- ASPEN
ASPEN : FPCCR_ASPEN_Field := 16#1#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FPCCR_Register use record
LSPACT at 0 range 0 .. 0;
USER at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
THREAD at 0 range 3 .. 3;
HFRDY at 0 range 4 .. 4;
MMRDY at 0 range 5 .. 5;
BFRDY at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
MONRDY at 0 range 8 .. 8;
Reserved_9_29 at 0 range 9 .. 29;
LSPEN at 0 range 30 .. 30;
ASPEN at 0 range 31 .. 31;
end record;
subtype FPCAR_ADDRESS_Field is STM32_SVD.UInt29;
-- FP Context Address Register
type FPCAR_Register is record
-- unspecified
Reserved_0_2 : STM32_SVD.UInt3 := 16#0#;
-- ADDRESS
ADDRESS : FPCAR_ADDRESS_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FPCAR_Register use record
Reserved_0_2 at 0 range 0 .. 2;
ADDRESS at 0 range 3 .. 31;
end record;
subtype FPDSCR_RMode_Field is STM32_SVD.UInt2;
subtype FPDSCR_FZ_Field is STM32_SVD.Bit;
subtype FPDSCR_DN_Field is STM32_SVD.Bit;
subtype FPDSCR_AHP_Field is STM32_SVD.Bit;
-- FP Default Status Control Register
type FPDSCR_Register is record
-- unspecified
Reserved_0_21 : STM32_SVD.UInt22 := 16#0#;
-- RMode
RMode : FPDSCR_RMode_Field := 16#0#;
-- FZ
FZ : FPDSCR_FZ_Field := 16#0#;
-- DN
DN : FPDSCR_DN_Field := 16#0#;
-- AHP
AHP : FPDSCR_AHP_Field := 16#0#;
-- unspecified
Reserved_27_31 : STM32_SVD.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FPDSCR_Register use record
Reserved_0_21 at 0 range 0 .. 21;
RMode at 0 range 22 .. 23;
FZ at 0 range 24 .. 24;
DN at 0 range 25 .. 25;
AHP at 0 range 26 .. 26;
Reserved_27_31 at 0 range 27 .. 31;
end record;
subtype MVFR0_A_SIMD_Field is STM32_SVD.UInt4;
subtype MVFR0_Single_precision_Field is STM32_SVD.UInt4;
subtype MVFR0_Double_precision_Field is STM32_SVD.UInt4;
subtype MVFR0_FP_exception_trapping_Field is STM32_SVD.UInt4;
subtype MVFR0_Divide_Field is STM32_SVD.UInt4;
subtype MVFR0_Square_root_Field is STM32_SVD.UInt4;
subtype MVFR0_Short_vectors_Field is STM32_SVD.UInt4;
subtype MVFR0_FP_rounding_modes_Field is STM32_SVD.UInt4;
-- Media and VFP Feature Register 0
type MVFR0_Register is record
-- Read-only. A_SIMD registers
A_SIMD : MVFR0_A_SIMD_Field;
-- Read-only. Single_precision
Single_precision : MVFR0_Single_precision_Field;
-- Read-only. Double_precision
Double_precision : MVFR0_Double_precision_Field;
-- Read-only. FP exception trapping
FP_exception_trapping : MVFR0_FP_exception_trapping_Field;
-- Read-only. Divide
Divide : MVFR0_Divide_Field;
-- Read-only. Square root
Square_root : MVFR0_Square_root_Field;
-- Read-only. Short vectors
Short_vectors : MVFR0_Short_vectors_Field;
-- Read-only. FP rounding modes
FP_rounding_modes : MVFR0_FP_rounding_modes_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for MVFR0_Register use record
A_SIMD at 0 range 0 .. 3;
Single_precision at 0 range 4 .. 7;
Double_precision at 0 range 8 .. 11;
FP_exception_trapping at 0 range 12 .. 15;
Divide at 0 range 16 .. 19;
Square_root at 0 range 20 .. 23;
Short_vectors at 0 range 24 .. 27;
FP_rounding_modes at 0 range 28 .. 31;
end record;
subtype MVFR1_FtZ_mode_Field is STM32_SVD.UInt4;
subtype MVFR1_D_NaN_mode_Field is STM32_SVD.UInt4;
subtype MVFR1_FP_HPFP_Field is STM32_SVD.UInt4;
subtype MVFR1_FP_fused_MAC_Field is STM32_SVD.UInt4;
-- Media and VFP Feature Register 1
type MVFR1_Register is record
-- Read-only. FtZ mode
FtZ_mode : MVFR1_FtZ_mode_Field;
-- Read-only. D_NaN mode
D_NaN_mode : MVFR1_D_NaN_mode_Field;
-- unspecified
Reserved_8_23 : STM32_SVD.UInt16;
-- Read-only. FP HPFP
FP_HPFP : MVFR1_FP_HPFP_Field;
-- Read-only. FP fused MAC
FP_fused_MAC : MVFR1_FP_fused_MAC_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for MVFR1_Register use record
FtZ_mode at 0 range 0 .. 3;
D_NaN_mode at 0 range 4 .. 7;
Reserved_8_23 at 0 range 8 .. 23;
FP_HPFP at 0 range 24 .. 27;
FP_fused_MAC at 0 range 28 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Floting point unit
type FPU_Peripheral is record
-- Coprocessor Access Control Register
CPACR : aliased CPACR_Register;
-- FP Context Control Register
FPCCR : aliased FPCCR_Register;
-- FP Context Address Register
FPCAR : aliased FPCAR_Register;
-- FP Default Status Control Register
FPDSCR : aliased FPDSCR_Register;
-- Media and VFP Feature Register 0
MVFR0 : aliased MVFR0_Register;
-- Media and VFP Feature Register 1
MVFR1 : aliased MVFR1_Register;
end record
with Volatile;
for FPU_Peripheral use record
CPACR at 16#0# range 0 .. 31;
FPCCR at 16#1AC# range 0 .. 31;
FPCAR at 16#1B0# range 0 .. 31;
FPDSCR at 16#1B4# range 0 .. 31;
MVFR0 at 16#1B8# range 0 .. 31;
MVFR1 at 16#1BC# range 0 .. 31;
end record;
-- Floting point unit
FPU_Periph : aliased FPU_Peripheral
with Import, Address => System'To_Address (16#E000ED88#);
end STM32_SVD.FPU;
|
Fabien-Chouteau/GESTE | Ada | 19,016 | ads | package GESTE_Fonts.FreeMonoBoldOblique8pt7b is
Font : constant Bitmap_Font_Ref;
private
FreeMonoBoldOblique8pt7bBitmaps : aliased constant Font_Bitmap := (
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#70#,
16#07#, 16#00#, 16#60#, 16#06#, 16#00#, 16#60#, 16#04#, 16#00#, 16#00#,
16#0C#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#0D#, 16#80#, 16#D8#, 16#09#, 16#80#, 16#90#,
16#09#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#06#, 16#80#, 16#58#, 16#0D#, 16#81#, 16#FC#, 16#1F#, 16#C0#, 16#B0#,
16#3F#, 16#83#, 16#F8#, 16#12#, 16#03#, 16#60#, 16#36#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#30#, 16#03#, 16#00#, 16#FC#,
16#18#, 16#81#, 16#80#, 16#1F#, 16#00#, 16#78#, 16#21#, 16#83#, 16#18#,
16#3F#, 16#00#, 16#C0#, 16#0C#, 16#00#, 16#80#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#0E#, 16#01#, 16#B0#, 16#13#, 16#01#, 16#20#,
16#0F#, 16#81#, 16#C0#, 16#27#, 16#00#, 16#98#, 16#09#, 16#00#, 16#60#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#78#, 16#0F#, 16#80#, 16#80#, 16#08#, 16#01#, 16#C0#,
16#35#, 16#82#, 16#70#, 16#3F#, 16#03#, 16#F0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#20#,
16#02#, 16#00#, 16#20#, 16#04#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#18#, 16#01#, 16#80#, 16#30#,
16#02#, 16#00#, 16#60#, 16#06#, 16#00#, 16#60#, 16#06#, 16#00#, 16#60#,
16#06#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#0C#, 16#00#, 16#C0#, 16#0C#, 16#00#, 16#40#, 16#04#, 16#00#, 16#40#,
16#0C#, 16#00#, 16#C0#, 16#08#, 16#01#, 16#80#, 16#30#, 16#02#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#20#,
16#1B#, 16#C1#, 16#F8#, 16#0F#, 16#01#, 16#B0#, 16#11#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#20#, 16#02#, 16#00#, 16#60#,
16#3F#, 16#C3#, 16#FC#, 16#04#, 16#00#, 16#40#, 16#0C#, 16#00#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#0C#, 16#01#, 16#80#, 16#10#, 16#03#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#3F#, 16#C3#, 16#FC#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#,
16#00#, 16#C0#, 16#08#, 16#01#, 16#80#, 16#30#, 16#02#, 16#00#, 16#60#,
16#0C#, 16#01#, 16#80#, 16#18#, 16#03#, 16#00#, 16#60#, 16#04#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#78#, 16#0F#, 16#80#, 16#8C#,
16#18#, 16#C1#, 16#0C#, 16#30#, 16#83#, 16#08#, 16#31#, 16#83#, 16#18#,
16#3F#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#07#, 16#01#, 16#E0#, 16#12#, 16#00#, 16#60#,
16#06#, 16#00#, 16#40#, 16#04#, 16#00#, 16#C0#, 16#3F#, 16#03#, 16#F0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#70#,
16#0F#, 16#81#, 16#8C#, 16#10#, 16#C0#, 16#18#, 16#03#, 16#80#, 16#70#,
16#1E#, 16#03#, 16#80#, 16#7F#, 16#07#, 16#F0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F8#, 16#1F#, 16#C0#, 16#0C#,
16#00#, 16#C0#, 16#78#, 16#07#, 16#00#, 16#18#, 16#01#, 16#80#, 16#18#,
16#7F#, 16#03#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#03#, 16#80#, 16#58#,
16#09#, 16#01#, 16#30#, 16#3F#, 16#83#, 16#F8#, 16#0F#, 16#00#, 16#F0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#0F#, 16#C0#, 16#FC#, 16#08#, 16#01#, 16#F0#, 16#1F#, 16#81#, 16#98#,
16#00#, 16#80#, 16#18#, 16#7F#, 16#03#, 16#E0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#07#, 16#C0#, 16#E0#,
16#0C#, 16#01#, 16#F0#, 16#1F#, 16#81#, 16#98#, 16#30#, 16#81#, 16#18#,
16#1F#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#1F#, 16#C1#, 16#FC#, 16#00#, 16#C0#, 16#18#,
16#01#, 16#00#, 16#30#, 16#02#, 16#00#, 16#60#, 16#0C#, 16#00#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#78#,
16#0F#, 16#81#, 16#8C#, 16#18#, 16#C1#, 16#98#, 16#0F#, 16#01#, 16#F0#,
16#31#, 16#83#, 16#18#, 16#3F#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#78#, 16#0F#, 16#C0#, 16#8C#,
16#18#, 16#C1#, 16#9C#, 16#1F#, 16#C0#, 16#E8#, 16#01#, 16#80#, 16#30#,
16#3E#, 16#03#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#60#,
16#06#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#60#, 16#0E#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#0C#, 16#01#, 16#80#, 16#10#, 16#02#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#C0#, 16#38#, 16#0E#, 16#03#, 16#80#, 16#1E#, 16#00#, 16#70#,
16#01#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#FC#,
16#3F#, 16#C0#, 16#00#, 16#7F#, 16#C7#, 16#F8#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#10#, 16#01#, 16#C0#, 16#07#, 16#00#, 16#3C#,
16#07#, 16#03#, 16#C0#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#81#, 16#FC#,
16#18#, 16#C0#, 16#0C#, 16#03#, 16#80#, 16#70#, 16#04#, 16#00#, 16#00#,
16#0C#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#70#, 16#0F#, 16#81#, 16#88#, 16#10#, 16#81#, 16#38#,
16#37#, 16#82#, 16#D8#, 16#2D#, 16#82#, 16#F0#, 16#27#, 16#02#, 16#00#,
16#3E#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#1F#, 16#01#, 16#F0#, 16#07#, 16#00#, 16#F0#, 16#19#, 16#81#, 16#98#,
16#3F#, 16#87#, 16#F8#, 16#F3#, 16#CF#, 16#3C#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#83#, 16#FC#,
16#18#, 16#C1#, 16#0C#, 16#1F#, 16#83#, 16#F8#, 16#30#, 16#C3#, 16#0C#,
16#7F#, 16#8F#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#07#, 16#C1#, 16#FC#, 16#38#, 16#C3#, 16#0C#,
16#60#, 16#06#, 16#00#, 16#60#, 16#06#, 16#08#, 16#3F#, 16#81#, 16#E0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#3F#, 16#03#, 16#F8#, 16#10#, 16#C1#, 16#0C#, 16#30#, 16#C3#, 16#0C#,
16#20#, 16#82#, 16#18#, 16#7F#, 16#0F#, 16#E0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#C3#, 16#FC#,
16#10#, 16#C1#, 16#20#, 16#3E#, 16#03#, 16#E0#, 16#34#, 16#02#, 16#08#,
16#FF#, 16#8F#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#3F#, 16#C3#, 16#FC#, 16#10#, 16#C1#, 16#60#,
16#3E#, 16#03#, 16#E0#, 16#24#, 16#02#, 16#00#, 16#FC#, 16#0F#, 16#80#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#07#, 16#C1#, 16#FC#, 16#38#, 16#C2#, 16#00#, 16#60#, 16#06#, 16#7C#,
16#67#, 16#C6#, 16#18#, 16#7F#, 16#83#, 16#E0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3D#, 16#C3#, 16#DC#,
16#10#, 16#81#, 16#18#, 16#3F#, 16#83#, 16#F8#, 16#21#, 16#02#, 16#10#,
16#F7#, 16#8F#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#1F#, 16#C1#, 16#F8#, 16#06#, 16#00#, 16#40#,
16#04#, 16#00#, 16#C0#, 16#0C#, 16#00#, 16#C0#, 16#7F#, 16#07#, 16#F0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#0F#, 16#E0#, 16#FC#, 16#01#, 16#00#, 16#10#, 16#03#, 16#00#, 16#30#,
16#43#, 16#0C#, 16#60#, 16#FE#, 16#07#, 16#80#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3D#, 16#E3#, 16#DC#,
16#13#, 16#83#, 16#60#, 16#3C#, 16#03#, 16#E0#, 16#23#, 16#02#, 16#30#,
16#FB#, 16#8F#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#3F#, 16#03#, 16#E0#, 16#08#, 16#01#, 16#80#,
16#18#, 16#01#, 16#80#, 16#10#, 16#C1#, 16#08#, 16#7F#, 16#8F#, 16#F8#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#38#, 16#73#, 16#8F#, 16#39#, 16#E3#, 16#9C#, 16#2F#, 16#42#, 16#EC#,
16#6E#, 16#C6#, 16#08#, 16#F3#, 16#CF#, 16#3C#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#39#, 16#E3#, 16#9E#,
16#1C#, 16#C3#, 16#CC#, 16#3E#, 16#C3#, 16#68#, 16#26#, 16#82#, 16#38#,
16#7B#, 16#8F#, 16#18#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#0F#, 16#01#, 16#F8#, 16#30#, 16#C6#, 16#0C#,
16#60#, 16#C6#, 16#0C#, 16#60#, 16#86#, 16#38#, 16#3F#, 16#01#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#3F#, 16#83#, 16#FC#, 16#18#, 16#C1#, 16#0C#, 16#10#, 16#C3#, 16#F8#,
16#3F#, 16#03#, 16#00#, 16#7C#, 16#0F#, 16#C0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#01#, 16#F8#,
16#30#, 16#C6#, 16#0C#, 16#60#, 16#C6#, 16#0C#, 16#60#, 16#86#, 16#38#,
16#3F#, 16#01#, 16#C0#, 16#3F#, 16#87#, 16#F0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#3F#, 16#03#, 16#F8#, 16#10#, 16#81#, 16#18#,
16#3F#, 16#83#, 16#E0#, 16#23#, 16#02#, 16#30#, 16#F9#, 16#CF#, 16#1C#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#07#, 16#41#, 16#FC#, 16#18#, 16#81#, 16#00#, 16#1C#, 16#01#, 16#F8#,
16#21#, 16#86#, 16#18#, 16#7F#, 16#05#, 16#E0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#C3#, 16#FC#,
16#64#, 16#C6#, 16#48#, 16#0C#, 16#00#, 16#C0#, 16#0C#, 16#00#, 16#80#,
16#3E#, 16#07#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#3D#, 16#E3#, 16#DE#, 16#30#, 16#C3#, 16#08#,
16#20#, 16#82#, 16#18#, 16#61#, 16#86#, 16#30#, 16#3F#, 16#01#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#79#, 16#E7#, 16#9E#, 16#20#, 16#83#, 16#18#, 16#33#, 16#03#, 16#30#,
16#36#, 16#01#, 16#40#, 16#1C#, 16#01#, 16#80#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#79#, 16#E7#, 16#9E#,
16#20#, 16#C6#, 16#6C#, 16#6E#, 16#86#, 16#F8#, 16#7F#, 16#87#, 16#70#,
16#77#, 16#06#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#39#, 16#E3#, 16#9E#, 16#19#, 16#80#, 16#F0#,
16#0E#, 16#00#, 16#E0#, 16#1F#, 16#03#, 16#30#, 16#F3#, 16#8F#, 16#78#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#39#, 16#C7#, 16#9C#, 16#31#, 16#81#, 16#B0#, 16#1E#, 16#00#, 16#C0#,
16#08#, 16#00#, 16#80#, 16#7E#, 16#07#, 16#E0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#C1#, 16#F8#,
16#11#, 16#80#, 16#30#, 16#06#, 16#00#, 16#C0#, 16#18#, 16#03#, 16#18#,
16#7F#, 16#87#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#38#, 16#02#, 16#00#, 16#60#,
16#06#, 16#00#, 16#60#, 16#04#, 16#00#, 16#C0#, 16#0C#, 16#00#, 16#C0#,
16#0E#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#80#,
16#08#, 16#00#, 16#C0#, 16#0C#, 16#00#, 16#C0#, 16#04#, 16#00#, 16#60#,
16#06#, 16#00#, 16#60#, 16#02#, 16#00#, 16#30#, 16#03#, 16#00#, 16#10#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#E0#,
16#02#, 16#00#, 16#60#, 16#06#, 16#00#, 16#60#, 16#04#, 16#00#, 16#C0#,
16#0C#, 16#00#, 16#C0#, 16#38#, 16#03#, 16#80#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#02#, 16#00#, 16#70#, 16#0D#, 16#81#, 16#98#,
16#10#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#F8#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#06#, 16#00#, 16#20#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F0#,
16#1F#, 16#81#, 16#F8#, 16#3F#, 16#86#, 16#10#, 16#7F#, 16#83#, 16#F8#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#38#, 16#03#, 16#80#, 16#10#, 16#01#, 16#78#, 16#3F#, 16#C3#, 16#0C#,
16#30#, 16#C3#, 16#1C#, 16#FF#, 16#8F#, 16#F0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#FC#, 16#3F#, 16#C3#, 16#08#, 16#60#, 16#06#, 16#00#,
16#7F#, 16#83#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#0C#, 16#00#, 16#40#, 16#FC#,
16#3F#, 16#C3#, 16#18#, 16#60#, 16#86#, 16#18#, 16#7F#, 16#C3#, 16#DC#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#1F#, 16#83#, 16#0C#,
16#7F#, 16#C7#, 16#F8#, 16#7F#, 16#83#, 16#F0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E0#, 16#7E#,
16#04#, 16#01#, 16#FC#, 16#1F#, 16#80#, 16#C0#, 16#0C#, 16#00#, 16#80#,
16#3F#, 16#07#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#EE#,
16#3F#, 16#C7#, 16#18#, 16#61#, 16#86#, 16#38#, 16#7F#, 16#03#, 16#F0#,
16#03#, 16#03#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#38#, 16#03#, 16#80#, 16#18#, 16#01#, 16#70#, 16#1F#, 16#83#, 16#08#,
16#31#, 16#83#, 16#18#, 16#73#, 16#87#, 16#38#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#02#, 16#00#, 16#60#,
16#00#, 16#01#, 16#E0#, 16#1E#, 16#00#, 16#60#, 16#04#, 16#00#, 16#C0#,
16#7F#, 16#87#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#01#, 16#80#, 16#10#, 16#00#, 16#01#, 16#F8#,
16#1F#, 16#80#, 16#10#, 16#01#, 16#00#, 16#30#, 16#03#, 16#00#, 16#30#,
16#02#, 16#07#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#18#, 16#03#, 16#80#, 16#18#, 16#01#, 16#BC#, 16#1B#, 16#C1#, 16#E0#,
16#1C#, 16#03#, 16#60#, 16#77#, 16#87#, 16#78#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#E0#,
16#02#, 16#00#, 16#60#, 16#06#, 16#00#, 16#60#, 16#04#, 16#00#, 16#C0#,
16#7F#, 16#87#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#DC#,
16#7F#, 16#C2#, 16#6C#, 16#64#, 16#C6#, 16#48#, 16#EE#, 16#CE#, 16#EC#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#F0#, 16#3F#, 16#83#, 16#08#,
16#31#, 16#83#, 16#18#, 16#73#, 16#87#, 16#38#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#F0#, 16#3F#, 16#83#, 16#0C#, 16#60#, 16#C6#, 16#18#,
16#3F#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#78#,
16#7F#, 16#C3#, 16#0C#, 16#30#, 16#C3#, 16#1C#, 16#7F#, 16#86#, 16#F0#,
16#60#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#EE#, 16#3F#, 16#C6#, 16#18#,
16#41#, 16#86#, 16#38#, 16#7F#, 16#03#, 16#F0#, 16#03#, 16#00#, 16#F8#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#03#, 16#DC#, 16#3F#, 16#C0#, 16#C0#, 16#18#, 16#01#, 16#80#,
16#7F#, 16#07#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F8#,
16#1F#, 16#81#, 16#08#, 16#1F#, 16#82#, 16#18#, 16#7F#, 16#01#, 16#E0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#08#, 16#00#, 16#80#, 16#18#, 16#03#, 16#F8#, 16#3F#, 16#81#, 16#00#,
16#10#, 16#03#, 16#00#, 16#3F#, 16#81#, 16#F0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#03#, 16#BC#, 16#33#, 16#81#, 16#08#, 16#31#, 16#83#, 16#18#,
16#3F#, 16#81#, 16#D8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#BE#,
16#7B#, 16#C3#, 16#18#, 16#13#, 16#01#, 16#E0#, 16#1C#, 16#01#, 16#C0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#9E#, 16#71#, 16#C2#, 16#68#,
16#2F#, 16#83#, 16#F0#, 16#37#, 16#03#, 16#20#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#03#, 16#DC#, 16#39#, 16#C1#, 16#F0#, 16#0E#, 16#01#, 16#F0#,
16#33#, 16#8F#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#9C#,
16#39#, 16#C3#, 16#18#, 16#13#, 16#01#, 16#A0#, 16#1C#, 16#00#, 16#C0#,
16#18#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F8#, 16#1F#, 16#81#, 16#30#,
16#0C#, 16#01#, 16#80#, 16#3F#, 16#87#, 16#F0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#80#, 16#38#,
16#02#, 16#00#, 16#60#, 16#06#, 16#01#, 16#C0#, 16#1C#, 16#00#, 16#C0#,
16#0C#, 16#00#, 16#C0#, 16#0E#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#20#, 16#02#, 16#00#, 16#60#,
16#06#, 16#00#, 16#60#, 16#04#, 16#00#, 16#40#, 16#0C#, 16#00#, 16#C0#,
16#08#, 16#00#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#0E#, 16#00#, 16#E0#, 16#02#, 16#00#, 16#60#, 16#06#, 16#00#, 16#70#,
16#07#, 16#00#, 16#40#, 16#0C#, 16#00#, 16#C0#, 16#38#, 16#03#, 16#80#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#01#, 16#C0#, 16#3E#, 16#00#, 16#7C#, 16#03#, 16#80#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#);
Font_D : aliased constant Bitmap_Font :=
(
Bytes_Per_Glyph => 24,
Glyph_Width => 12,
Glyph_Height => 16,
Data => FreeMonoBoldOblique8pt7bBitmaps'Access);
Font : constant Bitmap_Font_Ref := Font_D'Access;
end GESTE_Fonts.FreeMonoBoldOblique8pt7b;
|
reznikmm/matreshka | Ada | 7,751 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.DC;
with AMF.DG.Clip_Paths;
with AMF.DG.Groups;
with AMF.DG.Styles.Collections;
with AMF.DG.Texts;
with AMF.Internals.DG_Elements;
with AMF.Visitors;
package AMF.Internals.DG_Texts is
type DG_Text_Proxy is
limited new AMF.Internals.DG_Elements.DG_Element_Proxy
and AMF.DG.Texts.DG_Text with null record;
overriding function Get_Data
(Self : not null access constant DG_Text_Proxy)
return League.Strings.Universal_String;
-- Getter of Text::data.
--
-- the text as a string of characters.
overriding procedure Set_Data
(Self : not null access DG_Text_Proxy;
To : League.Strings.Universal_String);
-- Setter of Text::data.
--
-- the text as a string of characters.
overriding function Get_Bounds
(Self : not null access constant DG_Text_Proxy)
return AMF.DC.DC_Bounds;
-- Getter of Text::bounds.
--
-- the bounds inside which the text is rendered (possibly wrapped into
-- multiple lines)
overriding procedure Set_Bounds
(Self : not null access DG_Text_Proxy;
To : AMF.DC.DC_Bounds);
-- Setter of Text::bounds.
--
-- the bounds inside which the text is rendered (possibly wrapped into
-- multiple lines)
overriding function Get_Alignment
(Self : not null access constant DG_Text_Proxy)
return AMF.DC.DC_Alignment_Kind;
-- Getter of Text::alignment.
--
-- the text alignment when wrapped into multiple lines.
overriding procedure Set_Alignment
(Self : not null access DG_Text_Proxy;
To : AMF.DC.DC_Alignment_Kind);
-- Setter of Text::alignment.
--
-- the text alignment when wrapped into multiple lines.
overriding function Get_Group
(Self : not null access constant DG_Text_Proxy)
return AMF.DG.Groups.DG_Group_Access;
-- Getter of GraphicalElement::group.
--
-- the group element that owns this graphical element.
overriding procedure Set_Group
(Self : not null access DG_Text_Proxy;
To : AMF.DG.Groups.DG_Group_Access);
-- Setter of GraphicalElement::group.
--
-- the group element that owns this graphical element.
overriding function Get_Local_Style
(Self : not null access constant DG_Text_Proxy)
return AMF.DG.Styles.Collections.Ordered_Set_Of_DG_Style;
-- Getter of GraphicalElement::localStyle.
--
-- a list of locally-owned styles for this graphical element.
overriding function Get_Shared_Style
(Self : not null access constant DG_Text_Proxy)
return AMF.DG.Styles.Collections.Ordered_Set_Of_DG_Style;
-- Getter of GraphicalElement::sharedStyle.
--
-- a list of shared styles for this graphical element.
overriding function Get_Transform
(Self : not null access constant DG_Text_Proxy)
return AMF.DG.Sequence_Of_DG_Transform;
-- Getter of GraphicalElement::transform.
--
-- a list of zero or more transforms to apply to this graphical element.
overriding function Get_Clip_Path
(Self : not null access constant DG_Text_Proxy)
return AMF.DG.Clip_Paths.DG_Clip_Path_Access;
-- Getter of GraphicalElement::clipPath.
--
-- an optional reference to a clip path element that masks the painting of
-- this graphical element.
overriding procedure Set_Clip_Path
(Self : not null access DG_Text_Proxy;
To : AMF.DG.Clip_Paths.DG_Clip_Path_Access);
-- Setter of GraphicalElement::clipPath.
--
-- an optional reference to a clip path element that masks the painting of
-- this graphical element.
overriding procedure Enter_Element
(Self : not null access constant DG_Text_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Leave_Element
(Self : not null access constant DG_Text_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Visit_Element
(Self : not null access constant DG_Text_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
end AMF.Internals.DG_Texts;
|
godunko/adawebui | Ada | 3,597 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2017-2020, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision: 5742 $ $Date: 2017-01-29 11:45:35 +0300 (Sun, 29 Jan 2017) $
------------------------------------------------------------------------------
with Web.Core.Connectables.Slots_0.Slots_1.Generic_Emitters;
package Web.UI.Slots.Strings.Emitters is
new Web.UI.Slots.Strings.Generic_Emitters;
pragma Preelaborate (Web.UI.Slots.Strings.Emitters);
|
JeremyGrosser/clock3 | Ada | 983 | adb | package body Hex is
function To_String
(Nibble : UInt4)
return Character
is
Hex : constant String := "0123456789abcdef";
begin
return Hex (Natural (Nibble) + 1);
end To_String;
function To_String
(Byte : UInt8)
return String
is
Result : constant String :=
(To_String (UInt4 (Shift_Right (Byte, 4))),
To_String (UInt4 (Byte and 16#F#)));
begin
return Result;
end To_String;
function To_String
(Bytes : UInt8_Array;
Delimiter : Character := ' ')
return String
is
Result : String (1 .. (Bytes'Length * 3) - 1);
J : Natural;
begin
for I in 0 .. (Bytes'Length - 1) loop
J := (I * 3) + Result'First;
Result (J .. J + 1) := To_String (Bytes (Bytes'First + I));
if J + 2 <= Result'Length then
Result (J + 2) := Delimiter;
end if;
end loop;
return Result;
end To_String;
end Hex;
|
ZinebZaad/ENSEEIHT | Ada | 2,851 | adb | with Ada.Text_IO;
use Ada.Text_IO;
-- Dans ce programme, les commentaires de spécification
-- ont **volontairement** été omis !
procedure Comprendre_Mode_Parametre is
function Double (N : in Integer) return Integer is
begin
return 2 * N;
end Double;
procedure Incrementer (N : in out Integer) is
begin
N := N + 1;
end Incrementer;
procedure Mettre_A_Zero (N : out Integer) is
begin
N := 0;
end Mettre_A_Zero;
procedure Comprendre_Les_Contraintes_Sur_L_Appelant is
A, B, R : Integer;
begin
A := 5;
-- Indiquer pour chacune des instructions suivantes si elles sont
-- acceptées par le compilateur. Si elles sont refusées, expliquer
-- pourquoi dans un commentaire sur la ligne.
R := Double (A); -- Accepté: Double est une fonction qui admet un 'in integer' et retourne un integer
R := Double (10); -- De même, même si 10 est une valeur mais le 'in' autorise ça
R := Double (10 * A); -- De même
R := Double (B); -- Accepté même si B n'est pas initialisé, B prend la valeur des bits déja presents dans son emplacement dans la memoire.
Incrementer (A); -- Accepté: A est une variable Integer et la fonction demande un parametre Integer
--Incrementer (10); -- Refusé: Le out de 'Incrementer' refuse qu'une valeur soit passée.
--Incrementer (10 * A); -- De même refusé: 10*A est une valeur non pas variable.
Incrementer (B); -- Accepté: Même si B n'est pas initialisée mais elle a une valeur aléatoire des bits déja présents dans son emplacement.
Mettre_A_Zero (A); -- Accepté: A variable de type Integer et la fonction demande un Integer
--Mettre_A_Zero (10); -- Refusé: 10 n'est pas une variable.
--Mettre_A_Zero (10 * A); -- Refusé: 10*A n'est pas une variable.
Mettre_A_Zero (B); -- Accepté: B variable de type Integer et la fonction demande un Integer
end Comprendre_Les_Contraintes_Sur_L_Appelant;
procedure Comprendre_Les_Contrainte_Dans_Le_Corps (
A : in Integer;
B1, B2 : in out Integer;
C1, C2 : out Integer)
is
L: Integer;
begin
-- pour chaque affectation suivante indiquer si elle est autorisée
L := A; -- Autorisé
--A := 1; -- Non autorisé (A en mode in)
B1 := 5; -- Autorisé (B1 en mode in out)
L := B2; -- Autorisé
B2 := B2 + 1; -- Autorisé (mode in ET out)
C1 := L; -- Autorisé
L := C2; -- Autorisé à partir d'une certaine version de ADA
C2 := A; -- Autorisé car C2 en 'out'
C2 := C2 + 1; -- Autorisé à partir d'une certaine version de ADA (la lecture de C2 pose ce problème)
end Comprendre_Les_Contrainte_Dans_Le_Corps;
begin
--Comprendre_Mode_Parametre;
Comprendre_Les_Contraintes_Sur_L_Appelant;
--Put_Line ("Fin");
end Comprendre_Mode_Parametre;
|
ficorax/PortAudioAda | Ada | 1,029 | ads | with Ada.Numerics;
with PortAudioAda; use PortAudioAda;
package PaTest_TooManySines_Types is
Max_Sines : constant := 500;
Max_Load : constant := 1.2;
Sample_Rate : constant := 44100.0;
Frames_Per_Buffer : constant := 512;
Pi : constant := Ada.Numerics.Pi;
Two_Pi : constant := Pi * 2.0;
type Float_Array
is array (Integer range <>) of aliased Float;
pragma Convention (C, Float_Array);
type Double_Array is array (Integer range <>) of aliased Long_Float;
type paTestData is
record
numSines : aliased Integer;
phases : aliased Double_Array (1 .. Max_Sines);
end record;
pragma Convention (C, paTestData);
type paTestData_Ptr is access all paTestData;
pragma Convention (C, paTestData_Ptr);
pragma No_Strict_Aliasing (paTestData_Ptr);
outputParameters : aliased PA_Stream_Parameters;
data : aliased paTestData;
pragma Convention (C, data);
end PaTest_TooManySines_Types;
|
reznikmm/matreshka | Ada | 4,161 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Examples Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2016-2019, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Text_IO;
with League.Holders;
with League.Settings;
with League.Strings;
with Spikedog.HTTP_Session_Managers;
with Spikedog.Servlet_Contexts;
with Sessions.Managers;
-- List of used servlets:
with Servlets.Hello;
pragma Unreferenced (Servlets.Hello);
package body Startup is
----------------
-- On_Startup --
----------------
overriding procedure On_Startup
(Self : in out Servlet_Container_Initializer;
Context : in out Servlet.Contexts.Servlet_Context'Class)
is
pragma Unreferenced (Self);
Manager : constant Sessions.Managers.HTTP_Session_Manager_Access :=
new Sessions.Managers.HTTP_Session_Manager;
begin
Ada.Text_IO.Put_Line ("Open: http://localhost:8080/count");
Spikedog.Servlet_Contexts.Spikedog_Servlet_Context'Class
(Context).Set_Session_Manager
(Spikedog.HTTP_Session_Managers.HTTP_Session_Manager_Access
(Manager));
end On_Startup;
end Startup;
|
jwarwick/aoc_2020 | Ada | 190 | ads | -- AOC 2020, Day 24
package Day is
function count_tiles(filename : in String) return Natural;
function evolve_tiles(filename : in String; steps : in Natural) return Natural;
end Day;
|
reznikmm/matreshka | Ada | 4,721 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Visitors;
with ODF.DOM.Office_Database_Elements;
package Matreshka.ODF_Office.Database_Elements is
type Office_Database_Element_Node is
new Matreshka.ODF_Office.Abstract_Office_Element_Node
and ODF.DOM.Office_Database_Elements.ODF_Office_Database
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Office_Database_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Office_Database_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Office_Database_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Leave_Node
(Self : not null access Office_Database_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Visit_Node
(Self : not null access Office_Database_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
end Matreshka.ODF_Office.Database_Elements;
|
charlie5/lace | Ada | 2,802 | ads | with
openGL.Display,
openGL.Screen,
OSMesa_C;
package openGL.surface_Profile
--
-- Models an openGL surface profile.
--
is
type Item is tagged private;
type View is access all Item'Class;
type Items is array (Positive range <>) of Item;
-------------------
-- Surface Quality
--
Irrelevant : constant Natural := Natural'Last;
type color_Buffer is
record
Bits_red : Natural := Irrelevant;
Bits_green : Natural := Irrelevant;
Bits_blue : Natural := Irrelevant;
Bits_luminence : Natural := Irrelevant;
Bits_alpha : Natural := Irrelevant;
Bits_alpha_mask : Natural := Irrelevant;
end record;
function Image (Self : in color_Buffer) return String;
type Qualities is
record
color_Buffer : surface_Profile.color_Buffer;
depth_buffer_Bits : Natural := Irrelevant;
stencil_buffer_Bits : Natural := Irrelevant;
end record;
default_Qualities : constant Qualities;
function Image (Self : in Qualities) return String;
---------
-- Forge
--
desired_Qualitites_unavailable : exception;
procedure define (Self : in out Item; the_Display : access openGL.Display.item'Class;
Screen : access openGL.Screen .item'Class;
Desired : in Qualities := default_Qualities);
function fetch_All (the_Display : access openGL.Display.item'class) return surface_Profile.items;
--------------
-- Attributes
--
function Quality (Self : in Item) return Qualities;
-- function get_Visual (Self : in Item) return access GLX.XVisualInfo;
private
type Item is tagged
record
-- glx_Config : GLX.GLXFBConfig;
Display : access openGL.Display.item'Class;
-- Visual : access GLX.XVisualInfo;
end record;
default_Qualities : constant Qualities := (color_Buffer => (Bits_red => 8,
Bits_green => 8,
Bits_blue => 8,
Bits_luminence => Irrelevant,
Bits_alpha => Irrelevant,
Bits_alpha_mask => Irrelevant),
depth_buffer_Bits => 24,
stencil_buffer_Bits => Irrelevant);
end openGL.surface_Profile;
|
reznikmm/matreshka | Ada | 3,905 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- SQL Database Access --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with System.Storage_Elements;
package body Matreshka.Internals.SQL_Drivers.MySQL is
----------------
-- Initialize --
----------------
procedure Initialize (Item : in out MYSQL_BIND_Array) is
use type System.Storage_Elements.Storage_Offset;
Aux : System.Storage_Elements.Storage_Array
(1 .. Item'Size / System.Storage_Elements.Storage_Element'Size);
for Aux'Address use Item'Address;
pragma Import (Ada, Aux);
begin
Aux := (others => 0);
end Initialize;
end Matreshka.Internals.SQL_Drivers.MySQL;
|
psyomn/ash | Ada | 752 | ads | -- Copyright 2019 Simon Symeonidis (psyomn)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package File_Utils is
function Read (File_Name : String) return String;
function Is_Dir (Path : String) return Boolean;
end File_Utils;
|
Tim-Tom/project-euler | Ada | 58 | ads | package Problem_39 is
procedure Solve;
end Problem_39;
|
wiremoons/apass | Ada | 996 | ads | -------------------------------------------------------------------------------
-- Package : Show_Version --
-- Description : Display current program version and build info. --
-- Author : Simon Rowe <[email protected]> --
-- 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;
|
tum-ei-rcs/StratoX | Ada | 2,325 | ads | ------------------------------------------------------------------------------
-- --
-- SPARK LIBRARY COMPONENTS --
-- --
-- S P A R K . L O N G _ I N T E G E R _ A R I T H M E T I C _ L E M M A S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2016, AdaCore --
-- --
-- SPARK 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. SPARK is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
------------------------------------------------------------------------------
pragma SPARK_Mode;
with SPARK.Arithmetic_Lemmas; pragma Elaborate_All (SPARK.Arithmetic_Lemmas);
package SPARK.Long_Integer_Arithmetic_Lemmas is new
SPARK.Arithmetic_Lemmas (Long_Integer);
|
AdaCore/training_material | Ada | 390 | adb | with Ada.Text_IO; use Ada.Text_IO;
with Task_Select; use Task_Select;
procedure Main is
begin
Select_Loop_Task.Receive_Message ("1");
Select_Loop_Task.Send_Message ("A");
Select_Loop_Task.Send_Message ("B");
Select_Loop_Task.Receive_Message ("2");
Select_Loop_Task.Stop;
exception
when Tasking_Error =>
Put_Line ("Expected exception: Entry not reached");
end Main;
|
charlie5/cBound | Ada | 635 | ads | -- This file is generated by SWIG. Please do *not* modify by hand.
--
with gmp_c.a_a_mpf_struct;
with Interfaces.C;
package gmp_c.mpf_srcptr is
-- Item
--
subtype Item is gmp_c.a_a_mpf_struct.Pointer;
-- Items
--
type Items is
array (Interfaces.C.size_t range <>) of aliased gmp_c.mpf_srcptr.Item;
-- Pointer
--
type Pointer is access all gmp_c.mpf_srcptr.Item;
-- Pointers
--
type Pointers is
array (Interfaces.C.size_t range <>) of aliased gmp_c.mpf_srcptr.Pointer;
-- Pointer_Pointer
--
type Pointer_Pointer is access all gmp_c.mpf_srcptr.Pointer;
end gmp_c.mpf_srcptr;
|
vpodzime/ada-util | Ada | 3,808 | ads | -----------------------------------------------------------------------
-- util-dates -- Date utilities
-- Copyright (C) 2011, 2013 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Calendar;
with Ada.Calendar.Formatting;
with Ada.Calendar.Arithmetic;
with Ada.Calendar.Time_Zones;
package Util.Dates is
-- The Unix equivalent of 'struct tm'.
type Date_Record is record
Date : Ada.Calendar.Time;
Year : Ada.Calendar.Year_Number;
Month : Ada.Calendar.Month_Number;
Month_Day : Ada.Calendar.Day_Number;
Day : Ada.Calendar.Formatting.Day_Name;
Hour : Ada.Calendar.Formatting.Hour_Number;
Minute : Ada.Calendar.Formatting.Minute_Number;
Second : Ada.Calendar.Formatting.Second_Number;
Sub_Second : Ada.Calendar.Formatting.Second_Duration;
Time_Zone : Ada.Calendar.Time_Zones.Time_Offset;
Leap_Second : Boolean;
end record;
-- Split the date into a date record (See Ada.Calendar.Formatting.Split).
procedure Split (Into : out Date_Record;
Date : in Ada.Calendar.Time;
Time_Zone : in Ada.Calendar.Time_Zones.Time_Offset := 0);
-- Returns true if the given year is a leap year.
function Is_Leap_Year (Year : in Ada.Calendar.Year_Number) return Boolean;
-- Get the number of days in the given year.
function Get_Day_Count (Year : in Ada.Calendar.Year_Number)
return Ada.Calendar.Arithmetic.Day_Count;
-- Get the number of days in the given month.
function Get_Day_Count (Year : in Ada.Calendar.Year_Number;
Month : in Ada.Calendar.Month_Number)
return Ada.Calendar.Arithmetic.Day_Count;
-- Get a time representing the given date at 00:00:00.
function Get_Day_Start (Date : in Date_Record) return Ada.Calendar.Time;
function Get_Day_Start (Date : in Ada.Calendar.Time) return Ada.Calendar.Time;
-- Get a time representing the given date at 23:59:59.
function Get_Day_End (Date : in Date_Record) return Ada.Calendar.Time;
function Get_Day_End (Date : in Ada.Calendar.Time) return Ada.Calendar.Time;
-- Get a time representing the beginning of the week at 00:00:00.
function Get_Week_Start (Date : in Date_Record) return Ada.Calendar.Time;
function Get_Week_Start (Date : in Ada.Calendar.Time) return Ada.Calendar.Time;
-- Get a time representing the end of the week at 23:59:99.
function Get_Week_End (Date : in Date_Record) return Ada.Calendar.Time;
function Get_Week_End (Date : in Ada.Calendar.Time) return Ada.Calendar.Time;
-- Get a time representing the beginning of the month at 00:00:00.
function Get_Month_Start (Date : in Date_Record) return Ada.Calendar.Time;
function Get_Month_Start (Date : in Ada.Calendar.Time) return Ada.Calendar.Time;
-- Get a time representing the end of the month at 23:59:59.
function Get_Month_End (Date : in Date_Record) return Ada.Calendar.Time;
function Get_Month_End (Date : in Ada.Calendar.Time) return Ada.Calendar.Time;
end Util.Dates;
|
reznikmm/matreshka | Ada | 7,955 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2009, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
package body Utils is
use Matreshka.Internals.Unicode;
use Matreshka.Internals.Unicode.Ucd;
--------------------------
-- Code_Point_Ada_Image --
--------------------------
function Code_Point_Ada_Image (Item : Code_Point) return String is
To_Hex_Digit : constant
array (Code_Point range 0 .. 15) of Character
:= "0123456789ABCDEF";
begin
return Result : String (1 .. 10) := "16#XXXXXX#" do
Result (9) := To_Hex_Digit (Item mod 16);
Result (8) := To_Hex_Digit ((Item / 16) mod 16);
Result (7) := To_Hex_Digit ((Item / 256) mod 16);
Result (6) := To_Hex_Digit ((Item / 4096) mod 16);
Result (5) := To_Hex_Digit ((Item / 65536) mod 16);
Result (4) := To_Hex_Digit ((Item / 1048576) mod 16);
end return;
end Code_Point_Ada_Image;
----------------------
-- Code_Point_Image --
----------------------
function Code_Point_Image (Item : Code_Point) return String is
To_Hex_Digit : constant
array (Code_Point range 0 .. 15) of Character
:= "0123456789ABCDEF";
begin
if Item <= 16#FFFF# then
return Result : String (1 .. 4) do
Result (4) := To_Hex_Digit (Item mod 16);
Result (3) := To_Hex_Digit ((Item / 16) mod 16);
Result (2) := To_Hex_Digit ((Item / 256) mod 16);
Result (1) := To_Hex_Digit ((Item / 4096) mod 16);
end return;
else
return Result : String (1 .. 6) do
Result (6) := To_Hex_Digit (Item mod 16);
Result (5) := To_Hex_Digit ((Item / 16) mod 16);
Result (4) := To_Hex_Digit ((Item / 256) mod 16);
Result (3) := To_Hex_Digit ((Item / 4096) mod 16);
Result (2) := To_Hex_Digit ((Item / 65536) mod 16);
Result (1) := To_Hex_Digit ((Item / 1048576) mod 16);
end return;
end if;
end Code_Point_Image;
-----------------------
-- First_Stage_Image --
-----------------------
function First_Stage_Image (Item : First_Stage_Index) return String is
To_Hex_Digit : constant
array (First_Stage_Index range 0 .. 15) of Character
:= "0123456789ABCDEF";
Result : String (1 .. 4);
begin
Result (4) := To_Hex_Digit (Item mod 16);
Result (3) := To_Hex_Digit ((Item / 16) mod 16);
Result (2) := To_Hex_Digit ((Item / 256) mod 16);
Result (1) := To_Hex_Digit ((Item / 4096) mod 16);
return Result;
end First_Stage_Image;
-------------------------------
-- Parse_Code_Point_Sequence --
-------------------------------
function Parse_Code_Point_Sequence (Text : String)
return Code_Point_Sequence
is
First : Positive := Text'First;
Last : Natural;
Result : Code_Point_Sequence (1 .. Text'Length / 4);
Last_Result : Sequence_Count := 0;
procedure Scan;
----------
-- Scan --
----------
procedure Scan is
begin
while First < Text'Last
and then Text (First) = ' '
loop
First := First + 1;
end loop;
Last := First - 1;
while Last < Text'Last loop
Last := Last + 1;
if Text (Last) not in '0' .. '9'
and then Text (Last) not in 'A' .. 'F'
then
Last := Last - 1;
exit;
end if;
end loop;
end Scan;
begin
while First < Text'Last loop
Scan;
Last_Result := Last_Result + 1;
Result (Last_Result) :=
Code_Point'Value ("16#" & Text (First .. Last) & "#");
First := Last + 1;
end loop;
return Result (1 .. Last_Result);
end Parse_Code_Point_Sequence;
------------------------
-- Second_Stage_Image --
------------------------
function Second_Stage_Image (Item : Second_Stage_Index) return String is
To_Hex_Digit : constant
array (Second_Stage_Index range 0 .. 15) of Character
:= "0123456789ABCDEF";
Result : String (1 .. 2);
begin
Result (2) := To_Hex_Digit (Item mod 16);
Result (1) := To_Hex_Digit ((Item / 16) mod 16);
return Result;
end Second_Stage_Image;
--------------------------
-- Sequence_Count_Image --
--------------------------
function Sequence_Count_Image (Item : Sequence_Count) return String is
Aux : constant String := Sequence_Count'Image (Item);
begin
return Aux (Aux'First + 1 .. Aux'Last);
end Sequence_Count_Image;
end Utils;
|
reznikmm/matreshka | Ada | 3,639 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Dc_Title_Elements is
pragma Preelaborate;
type ODF_Dc_Title is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Dc_Title_Access is
access all ODF_Dc_Title'Class
with Storage_Size => 0;
end ODF.DOM.Dc_Title_Elements;
|
reznikmm/matreshka | Ada | 4,397 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Nodes;
with XML.DOM.Elements.Internals;
package body ODF.DOM.Elements.Text.Linenumbering_Configuration.Internals is
------------
-- Create --
------------
function Create
(Node : Matreshka.ODF_Elements.Text.Linenumbering_Configuration.Text_Linenumbering_Configuration_Access)
return ODF.DOM.Elements.Text.Linenumbering_Configuration.ODF_Text_Linenumbering_Configuration is
begin
return
(XML.DOM.Elements.Internals.Create
(Matreshka.DOM_Nodes.Element_Access (Node)) with null record);
end Create;
----------
-- Wrap --
----------
function Wrap
(Node : Matreshka.ODF_Elements.Text.Linenumbering_Configuration.Text_Linenumbering_Configuration_Access)
return ODF.DOM.Elements.Text.Linenumbering_Configuration.ODF_Text_Linenumbering_Configuration is
begin
return
(XML.DOM.Elements.Internals.Wrap
(Matreshka.DOM_Nodes.Element_Access (Node)) with null record);
end Wrap;
end ODF.DOM.Elements.Text.Linenumbering_Configuration.Internals;
|
psyomn/ash | Ada | 1,796 | adb | -- Copyright 2019 Simon Symeonidis (psyomn)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Text_IO;
with Ada.Directories;
with Ada.Direct_IO;
with Ada.Exceptions; use Ada.Exceptions;
package body File_Utils is
package IO renames Ada.Text_IO;
function Read (File_Name : String) return String is
File_Size : constant Natural :=
Natural (Ada.Directories.Size (File_Name));
subtype File_String is String (1 .. File_Size);
package File_String_IO is new Ada.Direct_IO (File_String);
The_File : File_String_IO.File_Type;
Contents : File_String;
begin
File_String_IO.Open
(File => The_File,
Mode => File_String_IO.In_File,
Name => File_Name);
File_String_IO.Read (The_File, Item => Contents);
File_String_IO.Close (File => The_File);
return Contents;
exception
when File_String_IO.Device_Error =>
File_String_IO.Close (File => The_File);
raise File_String_IO.Device_Error;
end Read;
function Is_Dir (Path : String) return Boolean is
use type Ada.Directories.File_Kind;
begin
return Ada.Directories.Exists (Path)
and then Ada.Directories.Kind (Path) = Ada.Directories.Directory;
end Is_Dir;
end File_Utils;
|
flyx/OpenGLAda | Ada | 941 | ads | -- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
package Glfw.Input.Mouse is
type Button is new Interfaces.C.int range 0 .. 7;
type Enter_Action is (Leaving, Entering);
type Cursor_Mode is (Normal, Hidden, Disabled);
Left_Button : constant := 0;
Right_Button : constant := 1;
Middle_Button : constant := 2;
subtype Coordinate is Interfaces.C.double;
subtype Scroll_Offset is Interfaces.C.double;
function Raw_Motion_Supported return Boolean;
private
for Button'Size use Interfaces.C.int'Size;
for Enter_Action use (Leaving => 0,
Entering => 1);
for Enter_Action'Size use C.int'Size;
for Cursor_Mode use (Normal => 16#34001#,
Hidden => 16#34002#,
Disabled => 16#34003#);
for Cursor_Mode'Size use Interfaces.C.int'Size;
end Glfw.Input.Mouse;
|
reznikmm/matreshka | Ada | 7,118 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This version of subprogram intended to be used on POSIX systems.
------------------------------------------------------------------------------
with Ada.Characters.Conversions;
with Ada.Strings.Fixed;
with Interfaces.C.Strings;
separate (League.Text_Codecs)
function Codec_For_Application_Locale return Text_Codec is
function Determine_Encoding return League.Strings.Universal_String;
-- Determines application locale encoding and returns its name.
function Encoding_Component
(Locale : String) return League.Strings.Universal_String;
-- Returns encoding/character set component of locale specification, or
-- empty string when there are no such component specified.
--
-- language[_territory][.codeset][@variant]
function Get_Environment_Variable (Name : String) return String;
-- Returns value of the specified environment variable, or empty string
-- if variable is not defined.
------------------------
-- Determine_Encoding --
------------------------
function Determine_Encoding return League.Strings.Universal_String is
LC_CTYPE_Encoding : constant League.Strings.Universal_String
:= Encoding_Component (Get_Environment_Variable ("LC_TYPE"));
LC_ALL_Encoding : constant League.Strings.Universal_String
:= Encoding_Component (Get_Environment_Variable ("LC_ALL"));
LANG_Encoding : constant League.Strings.Universal_String
:= Encoding_Component (Get_Environment_Variable ("LANG"));
begin
-- Analyze LC_CTYPE, LC_ALL, LANG for codeset part, use first found,
-- otherwise fallback to ISO-8859-1.
if not LC_CTYPE_Encoding.Is_Empty then
return LC_CTYPE_Encoding;
elsif not LC_ALL_Encoding.Is_Empty then
return LC_ALL_Encoding;
elsif not LANG_Encoding.Is_Empty then
return LANG_Encoding;
else
return League.Strings.To_Universal_String ("ISO-8859-1");
end if;
end Determine_Encoding;
------------------------
-- Encoding_Component --
------------------------
function Encoding_Component
(Locale : String) return League.Strings.Universal_String
is
Dot_Index : constant Natural := Ada.Strings.Fixed.Index (Locale, ".");
At_Index : constant Natural := Ada.Strings.Fixed.Index (Locale, "@");
begin
if Dot_Index = 0 then
return League.Strings.Empty_Universal_String;
else
if At_Index = 0 then
return
League.Strings.To_Universal_String
(Ada.Characters.Conversions.To_Wide_Wide_String
(Locale (Dot_Index + 1 .. Locale'Last)));
else
return
League.Strings.To_Universal_String
(Ada.Characters.Conversions.To_Wide_Wide_String
(Locale (Dot_Index + 1 .. At_Index - 1)));
end if;
end if;
end Encoding_Component;
------------------------------
-- Get_Environment_Variable --
------------------------------
function Get_Environment_Variable (Name : String) return String is
use type Interfaces.C.Strings.chars_ptr;
function getenv
(Name : Interfaces.C.Strings.chars_ptr)
return Interfaces.C.Strings.chars_ptr;
pragma Import (C, getenv);
C_Name : Interfaces.C.Strings.chars_ptr
:= Interfaces.C.Strings.New_String (Name);
C_Value : constant Interfaces.C.Strings.chars_ptr := getenv (C_Name);
begin
Interfaces.C.Strings.Free (C_Name);
if C_Value = Interfaces.C.Strings.Null_Ptr then
return "";
else
return Interfaces.C.Strings.Value (C_Value);
end if;
end Get_Environment_Variable;
begin
return Codec (Determine_Encoding);
end Codec_For_Application_Locale;
|
Fabien-Chouteau/AGATE | Ada | 9,704 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with System.Machine_Code; use System.Machine_Code;
with HAL; use HAL;
with Ada.Unchecked_Conversion;
with Interfaces.C; use Interfaces.C;
package body Semihosting is
type SH_u32_Array is array (Integer range <>) of SH_Word
with Pack, Convention => C, Volatile_Components;
function To_SH_u32 is new Ada.Unchecked_Conversion
(Source => System.Address, Target => SH_Word);
function To_SH_u32 is new Ada.Unchecked_Conversion
(Source => Integer, Target => SH_Word);
subtype Syscall is SH_Word;
SYS_OPEN : constant Syscall := 16#01#;
SYS_CLOSE : constant Syscall := 16#02#;
SYS_WRITEC : constant Syscall := 16#03#;
SYS_WRITE0 : constant Syscall := 16#04#;
SYS_WRITE : constant Syscall := 16#05#;
SYS_READ : constant Syscall := 16#06#;
-- SYS_READC : constant Syscall := 16#07#;
-- SYS_ISERROR : constant Syscall := 16#08#;
-- SYS_ISTTY : constant Syscall := 16#09#;
SYS_SEEK : constant Syscall := 16#0A#;
-- SYS_FLEN : constant Syscall := 16#0C#;
-- SYS_TMPNAM : constant Syscall := 16#0D#;
SYS_REMOVE : constant Syscall := 16#0E#;
-- SYS_RENAME : constant Syscall := 16#0E#;
-- SYS_CLOCK : constant Syscall := 16#10#;
-- SYS_TIME : constant Syscall := 16#11#;
SYS_ERRNO : constant Syscall := 16#13#;
-- SYS_GET_CMD : constant Syscall := 16#15#;
-- SYS_HEAPINFO : constant Syscall := 16#16#;
-- SYS_ELAPSED : constant Syscall := 16#30#;
-- SYS_TICKFREQ : constant Syscall := 16#31#;
function Semihosting_Enabled return Boolean is
(True);
function Generic_SH_Call (R0, R1 : SH_Word) return SH_Word;
function Generic_SH_Call (R0 : SH_Word; R1 : System.Address) return SH_Word;
---------------------
-- Generic_SH_Call --
---------------------
function Generic_SH_Call (R0, R1 : SH_Word) return SH_Word is
Ret : SH_Word;
begin
Asm ("mov r0, %1" & ASCII.LF & ASCII.HT &
"mov r1, %2" & ASCII.LF & ASCII.HT &
"bkpt #0xAB" & ASCII.LF & ASCII.HT &
"mov %0, r0",
Outputs => (SH_Word'Asm_Output ("=r", Ret)),
Inputs => (SH_Word'Asm_Input ("r", R0),
SH_Word'Asm_Input ("r", R1)),
Volatile => True,
Clobber => ("r1, r0"));
return Ret;
end Generic_SH_Call;
---------------------
-- Generic_SH_Call --
---------------------
function Generic_SH_Call
(R0 : SH_Word;
R1 : System.Address)
return SH_Word
is
begin
return Generic_SH_Call (R0, To_SH_u32 (R1));
end Generic_SH_Call;
-----------
-- Close --
-----------
function Close (File_Handle : SH_Word) return SH_Word is
Block : SH_u32_Array (0 .. 0);
begin
if not Semihosting_Enabled then
-- No debugger attached
return SH_Word'Last;
end if;
Block (0) := File_Handle;
return Generic_SH_Call (SYS_CLOSE, Block'Address);
end Close;
----------
-- Open --
----------
function Open (Filename : String; Mode : Flag) return SH_Word is
Block : SH_u32_Array (0 .. 2);
C_Name : char_array (0 .. Filename'Length) with Volatile;
begin
if not Semihosting_Enabled then
-- No debugger attached
return SH_Word'Last;
end if;
for J in Filename'Range loop
C_Name (size_t (J - Filename'First)) :=
char'Val (Character'Pos (Filename (J)));
end loop;
C_Name (C_Name'Last) := nul;
Block (0) := To_SH_u32 (C_Name'Address);
Block (1) := Mode;
Block (2) := Filename'Length;
return Generic_SH_Call (SYS_OPEN, Block'Address);
end Open;
----------
-- Read --
----------
function Read (File_Handle : SH_Word;
Buffer_Address : System.Address;
Buffer_Size : SH_Word) return SH_Word
is
Block : SH_u32_Array (0 .. 2);
begin
if not Semihosting_Enabled then
-- No debugger attached
return Buffer_Size;
end if;
Block (0) := File_Handle;
Block (1) := To_SH_u32 (Buffer_Address);
Block (2) := Buffer_Size;
return Generic_SH_Call (SYS_READ, Block'Address);
end Read;
-----------
-- Write --
-----------
function Write (File_Handle : SH_Word;
Buffer_Address : System.Address;
Buffer_Size : SH_Word) return SH_Word
is
Block : SH_u32_Array (0 .. 3);
begin
if not Semihosting_Enabled then
-- No debugger attached
return Buffer_Size;
end if;
Block (0) := File_Handle;
Block (1) := To_SH_u32 (Buffer_Address);
Block (2) := Buffer_Size;
return Generic_SH_Call (SYS_WRITE, Block'Address);
end Write;
------------
-- Remove --
------------
function Remove (Filename : String) return SH_Word is
Block : SH_u32_Array (0 .. 1);
C_Name : char_array (0 .. Filename'Length) with Volatile;
begin
if not Semihosting_Enabled then
-- No debugger attached
return SH_Word'Last;
end if;
for J in Filename'Range loop
C_Name (size_t (J - Filename'First)) :=
char'Val (Character'Pos (Filename (J)));
end loop;
C_Name (C_Name'Last) := nul;
Block (0) := To_SH_u32 (C_Name'Address);
Block (1) := To_SH_u32 (Filename'Length);
return Generic_SH_Call (SYS_REMOVE, Block'Address);
end Remove;
----------
-- Seek --
----------
function Seek (File_Handle : SH_Word;
Absolute_Position : SH_Word) return SH_Word
is
Block : SH_u32_Array (0 .. 1);
begin
if not Semihosting_Enabled then
-- No debugger attached
return SH_Word'Last;
end if;
Block (0) := File_Handle;
Block (1) := Absolute_Position;
return Generic_SH_Call (SYS_SEEK, Block'Address);
end Seek;
-----------
-- Errno --
-----------
function Errno return SH_Word is
begin
return Generic_SH_Call (SYS_ERRNO, 0);
end Errno;
-------------
-- Write_C --
-------------
procedure Write_C (C : Character) is
Ret : SH_Word with Unreferenced;
begin
if not Semihosting_Enabled then
-- No debugger attached
return;
end if;
Ret := Generic_SH_Call (SYS_WRITEC, C'Address);
end Write_C;
-------------
-- Write_0 --
-------------
procedure Write_0 (Str : String) is
Data : UInt8_Array (Str'First .. Str'Last + 1);
Ret : SH_Word with Unreferenced;
begin
if not Semihosting_Enabled then
-- No debugger attached
return;
end if;
for Index in Str'Range loop
Data (Index) := Character'Pos (Str (Index));
end loop;
-- Add trailing zero
Data (Str'Last + 1) := 0;
Ret := Generic_SH_Call (SYS_WRITE0, Data'Address);
end Write_0;
--------------
-- Log_Line --
--------------
procedure Log_Line (Str : String) is
begin
Log (Str);
Log_New_Line;
end Log_Line;
------------------
-- Log_New_Line --
------------------
procedure Log_New_Line is
begin
Write_C (ASCII.LF);
end Log_New_Line;
end Semihosting;
|
reznikmm/matreshka | Ada | 4,998 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Generic_Collections;
package AMF.UML.Enumerations.Collections is
pragma Preelaborate;
package UML_Enumeration_Collections is
new AMF.Generic_Collections
(UML_Enumeration,
UML_Enumeration_Access);
type Set_Of_UML_Enumeration is
new UML_Enumeration_Collections.Set with null record;
Empty_Set_Of_UML_Enumeration : constant Set_Of_UML_Enumeration;
type Ordered_Set_Of_UML_Enumeration is
new UML_Enumeration_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_UML_Enumeration : constant Ordered_Set_Of_UML_Enumeration;
type Bag_Of_UML_Enumeration is
new UML_Enumeration_Collections.Bag with null record;
Empty_Bag_Of_UML_Enumeration : constant Bag_Of_UML_Enumeration;
type Sequence_Of_UML_Enumeration is
new UML_Enumeration_Collections.Sequence with null record;
Empty_Sequence_Of_UML_Enumeration : constant Sequence_Of_UML_Enumeration;
private
Empty_Set_Of_UML_Enumeration : constant Set_Of_UML_Enumeration
:= (UML_Enumeration_Collections.Set with null record);
Empty_Ordered_Set_Of_UML_Enumeration : constant Ordered_Set_Of_UML_Enumeration
:= (UML_Enumeration_Collections.Ordered_Set with null record);
Empty_Bag_Of_UML_Enumeration : constant Bag_Of_UML_Enumeration
:= (UML_Enumeration_Collections.Bag with null record);
Empty_Sequence_Of_UML_Enumeration : constant Sequence_Of_UML_Enumeration
:= (UML_Enumeration_Collections.Sequence with null record);
end AMF.UML.Enumerations.Collections;
|
stcarrez/ada-util | Ada | 3,892 | ads | -----------------------------------------------------------------------
-- util-executors -- Execute work that is queued
-- Copyright (C) 2019 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Finalization;
with Ada.Exceptions;
private with Util.Concurrent.Fifos;
-- == Executors ==
-- The `Util.Executors` generic package defines a queue of work that will be executed
-- by one or several tasks. The `Work_Type` describes the type of the work and the
-- `Execute` procedure will be called by the task to execute the work. After instantiation
-- of the package, an instance of the `Executor_Manager` is created with a number of desired
-- tasks. The tasks are then started by calling the `Start` procedure.
--
-- A work object is added to the executor's queue by using the `Execute` procedure.
-- The work object is added in a concurrent fifo queue. One of the task managed by the
-- executor manager will pick the work object and run it.
--
generic
type Work_Type is private;
with procedure Execute (Work : in out Work_Type);
with procedure Error (Work : in out Work_Type;
Err : in Ada.Exceptions.Exception_Occurrence) is null;
Default_Queue_Size : Positive := 32;
package Util.Executors is
use Ada.Finalization;
type Executor_Manager (Count : Positive) is limited new Limited_Controlled with private;
type Executor_Manager_Access is access all Executor_Manager'Class;
overriding
procedure Initialize (Manager : in out Executor_Manager);
-- Execute the work through the executor.
procedure Execute (Manager : in out Executor_Manager;
Work : in Work_Type);
-- Start the executor tasks.
procedure Start (Manager : in out Executor_Manager;
Autostop : in Boolean := False);
-- Stop the tasks and wait for their completion.
procedure Stop (Manager : in out Executor_Manager);
-- Set the work queue size.
procedure Set_Queue_Size (Manager : in out Executor_Manager;
Capacity : in Positive);
-- Wait for the pending work to be executed by the executor tasks.
procedure Wait (Manager : in out Executor_Manager);
-- Get the number of elements in the queue.
function Get_Count (Manager : in Executor_Manager) return Natural;
-- Stop and release the executor.
overriding
procedure Finalize (Manager : in out Executor_Manager);
private
type Work_Info is record
Work : Work_Type;
Done : Boolean := False;
end record;
package Work_Queue is
new Util.Concurrent.Fifos (Element_Type => Work_Info,
Default_Size => Default_Queue_Size,
Clear_On_Dequeue => True);
task type Worker_Task is
entry Start (Manager : in Executor_Manager_Access);
end Worker_Task;
type Worker_Task_Array is array (Positive range <>) of Worker_Task;
type Executor_Manager (Count : Positive) is limited new Limited_Controlled with record
Self : Executor_Manager_Access;
Autostop : Boolean := False;
Queue : Work_Queue.Fifo;
Workers : Worker_Task_Array (1 .. Count);
end record;
end Util.Executors;
|
reznikmm/matreshka | Ada | 100 | ads |
package Documentation_Generator.Wiki is
procedure Generate;
end Documentation_Generator.Wiki;
|
peterfrankjohnson/kernel | Ada | 1,081 | ads | with Process; use Process;
package Queue is
type Node;
type Node_Ptr is access Node;
type Node is
record
Item : Process_Ptr;
Previous : Node_Ptr;
Next : Node_Ptr;
end record;
NewNode : Node_Ptr;
type Object is
record
CurrentNode : Node_Ptr;
FirstNode : Node_Ptr;
PreviousNode : Node_Ptr;
LastNode : Node_Ptr;
end record;
function Current (NodeObj : in Object) return Process_Ptr;
-- function Next (NodeObj : in Object) return Process_Ptr;
-- function Previous (NodeObj : in Object) return Process_Ptr;
procedure Next (NodeObj : in out Object);
procedure Previous (NodeObj : in out Object);
function EndOfQueue (NodeObj : Object) return Boolean;
procedure FastForward (NodeObj : in out Object);
procedure InsertEnd (NodeObj : in out Object; Proc : Process_Ptr);
procedure Remove (NodeObj : in out Object; Proc : Process_Ptr);
procedure Rewind (NodeObj : in out Object);
end Queue;
|
sungyeon/drake | Ada | 236 | ads | pragma License (Unrestricted);
with Ada.Numerics.Generic_Elementary_Functions;
package Ada.Numerics.Short_Elementary_Functions is
new Generic_Elementary_Functions (Short_Float);
pragma Pure (Ada.Numerics.Short_Elementary_Functions);
|
jscparker/math_packages | Ada | 1,501 | adb |
package body Quadrature is
function Norm (Y : Dynamical_Variable)
return Real
is
Sum : Real := +0.0;
begin
for i in Dyn_Index loop
Sum := Sum + Abs Y(i);
--Sum := Sum + Y(i) * Y(i); -- return Sqrt (Sum);
end loop;
return Sum;
end Norm;
function "-"
(Left : Dynamical_Variable;
Right : Dynamical_Variable)
return Dynamical_Variable
is
Result : Dynamical_Variable;
begin
for I in Dyn_Index loop
Result(I) := Left(I) - Right(I);
end loop;
return Result;
end "-";
function "*"
(Left : Real;
Right : Dynamical_Variable)
return Dynamical_Variable
is
Result : Dynamical_Variable;
begin
for I in Dyn_Index loop
Result(I) := Left * Right(I);
end loop;
return Result;
end "*";
function "+"
(Left : Dynamical_Variable;
Right : Dynamical_Variable)
return Dynamical_Variable
is
Result : Dynamical_Variable;
begin
for I in Dyn_Index loop
Result(I) := Left(I) + Right(I);
end loop;
return Result;
end "+";
-- The differential equation is dY/dt = F (t, Y)
function F
(Time : Real;
Y : Dynamical_Variable)
return Dynamical_Variable
is
Deriv : Dynamical_Variable;
begin
for I in Dyn_Index range Dyn_Index'First .. Dyn_Index'Last-1 loop
Deriv(I) := Y(I+1);
end loop;
Deriv(Dyn_Index'Last) := Integrand (Time);
return Deriv;
end F;
end Quadrature;
|
reznikmm/matreshka | Ada | 3,978 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2017, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with Matreshka.Internals.Strings;
package AMF.Internals.Tables.CMOF_String_Data_02 is
-- "association"
MS_0200 : aliased Matreshka.Internals.Strings.Shared_String
:= (Capacity => 15,
Unused => 11,
Length => 11,
Value =>
(16#0061#, 16#0073#, 16#0073#, 16#006F#,
16#0063#, 16#0069#, 16#0061#, 16#0074#,
16#0069#, 16#006F#, 16#006E#,
others => 16#0000#),
others => <>);
end AMF.Internals.Tables.CMOF_String_Data_02;
|
reznikmm/matreshka | Ada | 4,117 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Db_Parameter_Name_Substitution_Attributes;
package Matreshka.ODF_Db.Parameter_Name_Substitution_Attributes is
type Db_Parameter_Name_Substitution_Attribute_Node is
new Matreshka.ODF_Db.Abstract_Db_Attribute_Node
and ODF.DOM.Db_Parameter_Name_Substitution_Attributes.ODF_Db_Parameter_Name_Substitution_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Db_Parameter_Name_Substitution_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Db_Parameter_Name_Substitution_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Db.Parameter_Name_Substitution_Attributes;
|
alexcamposruiz/dds-requestreply | Ada | 1,378 | ads | package DDS.Request_Reply.Replieruntypedimpl is
pragma Elaborate_Body;
-- function RTI_Connext_ReplierUntypedImpl_Send_Sample
-- (Self : not null access RTI_Connext_ReplierUntypedImpl;
-- Data : System.Address;
-- Related_Request_Info : DDS.SampleIdentity_T;
-- WriteParams : in out DDS.WriteParams_T) return DDS.ReturnCode_T;
-- Retcode : DDS.ReturnCode_T;
--
-- function RTI_Connext_ReplierUntypedImpl_Configure_Params_For_Reply
-- (Self : not null access RTI_Connext_ReplierUntypedImpl;
-- Params : in out WriteParams_T;
-- Related_Request_Info : DDS.SampleIdentity_T) return DDS.ReturnCode_T;
--
-- function RTI_Connext_ReplierUntypedImpl_Create_Reader_Topic
-- (Self : not null access RTI_Connext_EntityUntypedImpl;
-- Params : RTI_Connext_EntityParams;
-- Request_Type_Name : DDS.String) return DDS.Topic.Ref_Access;
--
-- function RTI_Connext_ReplierUntypedImpl_Create_Writer_Topic
-- (Self : not null access RTI_Connext_EntityUntypedImpl;
-- Params : RTI_Connext_EntityParams;
-- Reply_Type_Name : DDS.String) return DDS.Topic.Ref_Access;
end DDS.Request_Reply.Replieruntypedimpl;
|
reznikmm/matreshka | Ada | 6,881 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Chart.Data_Point_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Chart_Data_Point_Element_Node is
begin
return Self : Chart_Data_Point_Element_Node do
Matreshka.ODF_Chart.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Chart_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Chart_Data_Point_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Chart_Data_Point
(ODF.DOM.Chart_Data_Point_Elements.ODF_Chart_Data_Point_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Chart_Data_Point_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Data_Point_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Chart_Data_Point_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Chart_Data_Point
(ODF.DOM.Chart_Data_Point_Elements.ODF_Chart_Data_Point_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Chart_Data_Point_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Chart_Data_Point
(Visitor,
ODF.DOM.Chart_Data_Point_Elements.ODF_Chart_Data_Point_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Chart_URI,
Matreshka.ODF_String_Constants.Data_Point_Element,
Chart_Data_Point_Element_Node'Tag);
end Matreshka.ODF_Chart.Data_Point_Elements;
|
stcarrez/etherscope | Ada | 4,001 | adb | -----------------------------------------------------------------------
-- ui-texts -- Utilities to draw text strings
-- Copyright (C) 2016, 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Bitmapped_Drawing;
with Bitmap_Color_Conversion;
package body UI.Texts is
function Char_Width (C : in Character) return Natural;
function Char_Width (C : in Character) return Natural is
pragma Unreferenced (C);
use type BMP_Fonts.BMP_Font;
begin
if Current_Font /= BMP_Fonts.Font12x12 then
return BMP_Fonts.Char_Width (Current_Font);
end if;
return BMP_Fonts.Char_Width (Current_Font) - 2;
end Char_Width;
-- ------------------------------
-- Get the width of the string in pixels after rendering with the current font.
-- ------------------------------
function Get_Width (S : in String) return Natural is
W : constant Natural := Char_Width ('a');
begin
return W * S'Length;
end Get_Width;
-- ------------------------------
-- Draw the string at the given position and using the justification so that we don't
-- span more than the width. The current font, foreground and background are used
-- to draw the string.
-- ------------------------------
procedure Draw_String (Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class;
Start : in HAL.Bitmap.Point;
Width : in Natural;
Msg : in String;
Justify : in Justify_Type := LEFT) is
X : Natural := Start.X;
Y : constant Natural := Start.Y;
Last : Natural := Start.X + Width;
FG : constant HAL.UInt32 := Bitmap_Color_Conversion.Bitmap_Color_To_Word (Buffer.Color_Mode,
Foreground);
BG : constant HAL.UInt32 := Bitmap_Color_Conversion.Bitmap_Color_To_Word (Buffer.Color_Mode,
Background);
begin
if Last > Buffer.Width then
Last := Buffer.Width;
end if;
case Justify is
when LEFT =>
for C of Msg loop
exit when X > Last;
Bitmapped_Drawing.Draw_Char (Buffer => Buffer,
Start => (X, Y),
Char => C,
Font => Current_Font,
Foreground => FG,
Background => BG);
X := X + Char_Width (C);
end loop;
when RIGHT =>
X := X + Width;
for C of reverse Msg loop
exit when X - Char_Width (C) < Start.X;
X := X - Char_Width (C);
Bitmapped_Drawing.Draw_Char (Buffer => Buffer,
Start => (X, Y),
Char => C,
Font => Current_Font,
Foreground => FG,
Background => BG);
end loop;
end case;
end Draw_String;
end UI.Texts;
|
SayCV/rtems-addon-packages | Ada | 3,556 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Text_IO.Aux --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
-- $Revision$
-- $Date$
-- Binding Version 01.00
------------------------------------------------------------------------------
private package Terminal_Interface.Curses.Text_IO.Aux is
-- pragma Preelaborate (Aux);
-- This routine is called from the Text_IO output routines for numeric
-- and enumeration types.
--
procedure Put_Buf
(Win : Window; -- The output window
Buf : String; -- The buffer containing the text
Width : Field; -- The width of the output field
Signal : Boolean := True; -- If true, we raise Layout_Error
Ljust : Boolean := False); -- The Buf is left justified
end Terminal_Interface.Curses.Text_IO.Aux;
|
charlie5/aIDE | Ada | 1,677 | adb | with
AdaM.Factory;
package body AdaM.protected_Unit
is
-- Storage Pool
--
record_Version : constant := 1;
pool_Size : constant := 5_000;
package Pool is new AdaM.Factory.Pools (".adam-store",
"protected_Units",
pool_Size,
record_Version,
protected_Unit.item,
protected_Unit.view);
-- Forge
--
procedure define (Self : in out Item)
is
begin
null;
end define;
procedure destruct (Self : in out Item)
is
begin
null;
end destruct;
function new_Subprogram return View
is
new_View : constant protected_Unit.view := Pool.new_Item;
begin
define (protected_Unit.item (new_View.all));
return new_View;
end new_Subprogram;
procedure free (Self : in out protected_Unit.view)
is
begin
destruct (protected_Unit.item (Self.all));
Pool.free (Self);
end free;
-- Attributes
--
overriding
function Id (Self : access Item) return AdaM.Id
is
begin
return Pool.to_Id (Self);
end Id;
-- Streams
--
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View)
renames Pool.View_write;
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View)
renames Pool.View_read;
end AdaM.protected_Unit;
|
reznikmm/matreshka | Ada | 3,649 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Table_Body_Elements is
pragma Preelaborate;
type ODF_Table_Body is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Table_Body_Access is
access all ODF_Table_Body'Class
with Storage_Size => 0;
end ODF.DOM.Table_Body_Elements;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 6,348 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- . Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of STMicroelectronics nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
-- --
-- This file is based on: --
-- --
-- @file stm32f407xx.h et al. --
-- @author MCD Application Team --
-- @version V..0 --
-- @date 19-June-2014 --
-- @brief CMSIS STM32F407xx Device Peripheral Access Layer Header File. --
-- --
-- COPYRIGHT(c) 2014 STMicroelectronics --
------------------------------------------------------------------------------
-- This file provides register definitions for the STM32F4 (ARM Cortex M4F)
-- microcontrollers from ST Microelectronics.
with STM32_SVD; use STM32_SVD;
with STM32_SVD.EXTI; use STM32_SVD.EXTI;
package body STM32GD.EXTI is
-------------------------------
-- Enable_External_Interrupt --
-------------------------------
procedure Enable_External_Interrupt
(Line : External_Line_Number;
Trigger : Interrupt_Triggers)
is
Index : constant Natural := External_Line_Number'Pos (Line);
begin
EXTI_Periph.IMR.MR.Arr (Index) := 1;
EXTI_Periph.RTSR.TR.Arr (Index) :=
(if Trigger in Interrupt_Rising_Edge | Interrupt_Rising_Falling_Edge then 1 else 0);
EXTI_Periph.FTSR.TR.Arr (Index) :=
(if Trigger in Interrupt_Falling_Edge | Interrupt_Rising_Falling_Edge then 1 else 0);
end Enable_External_Interrupt;
--------------------------------
-- Disable_External_Interrupt --
--------------------------------
procedure Disable_External_Interrupt (Line : External_Line_Number) is
Index : constant Natural := External_Line_Number'Pos (Line);
begin
EXTI_Periph.IMR.MR.Arr (Index) := 0;
EXTI_Periph.RTSR.TR.Arr (Index) := 0;
EXTI_Periph.FTSR.TR.Arr (Index) := 0;
end Disable_External_Interrupt;
---------------------------
-- Enable_External_Event --
---------------------------
procedure Enable_External_Event
(Line : External_Line_Number;
Trigger : Event_Triggers)
is
Index : constant Natural := External_Line_Number'Pos (Line);
begin
EXTI_Periph.EMR.MR.Arr (Index) := 1;
EXTI_Periph.RTSR.TR.Arr (Index) :=
(if Trigger in Interrupt_Rising_Edge | Interrupt_Rising_Falling_Edge then 1 else 0);
EXTI_Periph.FTSR.TR.Arr (Index) :=
(if Trigger in Interrupt_Falling_Edge | Interrupt_Rising_Falling_Edge then 1 else 0);
end Enable_External_Event;
----------------------------
-- Disable_External_Event --
----------------------------
procedure Disable_External_Event (Line : External_Line_Number) is
Index : constant Natural := External_Line_Number'Pos (Line);
begin
EXTI_Periph.EMR.MR.Arr (Index) := 0;
EXTI_Periph.RTSR.TR.Arr (Index) := 0;
EXTI_Periph.FTSR.TR.Arr (Index) := 0;
end Disable_External_Event;
------------------
-- Generate_SWI --
------------------
procedure Generate_SWI (Line : External_Line_Number) is
begin
EXTI_Periph.SWIER.SWIER.Arr (External_Line_Number'Pos (Line)) := 1;
end Generate_SWI;
--------------------------------
-- External_Interrupt_Pending --
--------------------------------
function External_Interrupt_Pending (Line : External_Line_Number)
return Boolean
is (if EXTI_Periph.PR.PR.Arr (External_Line_Number'Pos (Line)) = 1 then True else False);
------------------------------
-- Clear_External_Interrupt --
------------------------------
procedure Clear_External_Interrupt (Line : External_Line_Number) is
begin
-- yes, one to clear
EXTI_Periph.PR.PR.Arr (External_Line_Number'Pos (Line)) := 1;
end Clear_External_Interrupt;
end STM32GD.EXTI;
|
rveenker/sdlada | Ada | 5,878 | ads | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
-- SDL.Video.Windows.Manager
--
-- Access to the underlying window system.
--
-- Due to the nature of free OSes like Linux, one user may be using X11, another XCB, another Wayland and another
-- using Mir. We don't want to use build specific data for all these three, that makes sense for the varying OSes,
-- such as Linux, Windows, MacOS X, etc. So, if building on Windows, the compiler should only allow access to the
-- Windows/WinRT specific stuff, Linux, then X11/Wayland/Mir, etc.
--------------------------------------------------------------------------------------------------------------------
with Interfaces.C;
with SDL.Versions;
package SDL.Video.Windows.Manager is
type WM_Types is (WM_Unknown,
WM_Windows,
WM_X11,
WM_Direct_FB,
WM_Cocoa,
WM_UI_Kit,
WM_Wayland,
WM_Mir,
WM_Win_RT,
WM_Android) with
Convention => C;
type C_Address is access all Interfaces.Unsigned_32 with
Convention => C;
-- These are dummy types that (should) match what a real binding would provide so that the end user can
-- convert these using Unchecked_Conversion to pass into any other API's.
package Windows is
type HWNDs is new C_Address;
type HDCs is new C_Address;
end Windows;
-- WinRT only available since version 2.0.3.
package Win_RT is
type Inspectable is new C_Address;
end Win_RT;
package X11 is
type Display is new C_Address;
type Window is new Interfaces.Unsigned_32;
end X11;
package Direct_FB is
type Direct_FB is new C_Address;
type Direct_FB_Window is new C_Address;
type Direct_FB_Surface is new C_Address;
end Direct_FB;
package Cocoa is
type NS_Window is new C_Address;
end Cocoa;
package UI_Kit is
package C renames Interfaces.C;
type Window is new C_Address;
Frame_Buffer : C.unsigned;
Colour_Buffer : C.unsigned;
Resolve_Frame_Buffer : C.unsigned;
end UI_Kit;
-- Wayland only available since version 2.0.2.
package Wayland is
type Display is new C_Address;
type Surface is new C_Address;
type Shell_Surface is new C_Address;
end Wayland;
-- Mir only available since version 2.0.2.
package Mir is
type Connection is new C_Address;
type Surface is new C_Address;
end Mir;
-- Android only available since version 2.0.4.
package Android is
type Native_Window is new C_Address;
type EGL_Surface is new C_Address;
end Android;
type Information (WM : WM_Types) is
record
case WM is
when WM_Unknown =>
null;
when WM_Windows =>
HWND : Windows.HWNDs;
HDC : Windows.HDCs;
when WM_Win_RT =>
RT_Inspectable : Win_RT.Inspectable;
when WM_X11 =>
X11_Display : X11.Display;
X11_Window : X11.Window;
when WM_Direct_FB =>
DFB_Main_Interface : Direct_FB.Direct_FB;
DFB_Window : Direct_FB.Direct_FB_Window;
DFB_Surface : Direct_FB.Direct_FB_Surface;
when WM_Cocoa =>
Cocoa_Window : Cocoa.NS_Window;
when WM_UI_Kit =>
UIK_Window : UI_Kit.Window;
UIK_Frame_Buffer : UI_Kit.Window;
UIK_Colour_Buffer : UI_Kit.Window;
UIK_Resolve_Frame_Buffer : UI_Kit.Window;
when WM_Wayland =>
Wayland_Display : Wayland.Display;
Wayland_Surface : Wayland.Surface;
Wayland_Shell_Surface : Wayland.Shell_Surface;
when WM_Mir =>
Mir_Connection : Mir.Connection;
Mir_Surface : Mir.Surface;
when WM_Android =>
Android_Window : Android.Native_Window;
Android_Surface : Android.EGL_Surface;
end case;
end record with
Unchecked_Union;
type WM_Info is
record
Version : SDL.Versions.Version;
Sub_System : WM_Types;
Info : Information (WM => WM_Unknown);
end record with
Convention => C;
function Get_WM_Info (Win : in Window; Info : out WM_Info) return Boolean with
Inline => True;
end SDL.Video.Windows.Manager;
|
reznikmm/matreshka | Ada | 6,436 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- A collaboration use represents one particular use of a collaboration to
-- explain the relationships between the properties of a classifier. A
-- collaboration use shows how the pattern described by a collaboration is
-- applied in a given context, by binding specific entities from that context
-- to the roles of the collaboration. Depending on the context, these
-- entities could be structural features of a classifier, instance
-- specifications, or even roles in some containing collaboration. There may
-- be multiple occurrences of a given collaboration within a classifier, each
-- involving a different set of roles and connectors. A given role or
-- connector may be involved in multiple occurrences of the same or different
-- collaborations. Associated dependencies map features of the collaboration
-- type to features in the classifier. These dependencies indicate which role
-- in the classifier plays which role in the collaboration.
------------------------------------------------------------------------------
limited with AMF.UML.Collaborations;
limited with AMF.UML.Dependencies.Collections;
with AMF.UML.Named_Elements;
package AMF.UML.Collaboration_Uses is
pragma Preelaborate;
type UML_Collaboration_Use is limited interface
and AMF.UML.Named_Elements.UML_Named_Element;
type UML_Collaboration_Use_Access is
access all UML_Collaboration_Use'Class;
for UML_Collaboration_Use_Access'Storage_Size use 0;
not overriding function Get_Role_Binding
(Self : not null access constant UML_Collaboration_Use)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is abstract;
-- Getter of CollaborationUse::roleBinding.
--
-- A mapping between features of the collaboration type and features of
-- the owning classifier. This mapping indicates which connectable element
-- of the classifier plays which role(s) in the collaboration. A
-- connectable element may be bound to multiple roles in the same
-- collaboration use (that is, it may play multiple roles).
not overriding function Get_Type
(Self : not null access constant UML_Collaboration_Use)
return AMF.UML.Collaborations.UML_Collaboration_Access is abstract;
-- Getter of CollaborationUse::type.
--
-- The collaboration which is used in this occurrence. The collaboration
-- defines the cooperation between its roles which are mapped to
-- properties of the classifier owning the collaboration use.
not overriding procedure Set_Type
(Self : not null access UML_Collaboration_Use;
To : AMF.UML.Collaborations.UML_Collaboration_Access) is abstract;
-- Setter of CollaborationUse::type.
--
-- The collaboration which is used in this occurrence. The collaboration
-- defines the cooperation between its roles which are mapped to
-- properties of the classifier owning the collaboration use.
end AMF.UML.Collaboration_Uses;
|
AdaCore/training_material | Ada | 3,713 | adb | -----------------------------------------------------------------------
-- Ada Labs --
-- --
-- Copyright (C) 2008-2009, AdaCore --
-- --
-- Labs 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. You should have received --
-- a copy of the GNU General Public License along with this program; --
-- if not, write to the Free Software Foundation, Inc., 59 Temple --
-- Place - Suite 330, Boston, MA 02111-1307, USA. --
-----------------------------------------------------------------------
with Libm_Single; use Libm_Single;
package body Solar_System is
procedure Init_Body
(B : Bodies_Enum_T;
Bodies : in out Bodies_Array_T;
Radius : Float;
Color : RGBA_T;
Distance : Float;
Angle : Float;
Speed : Float;
Turns_Around : Bodies_Enum_T;
Visible : Boolean := True)
is
begin
Bodies (B) :=
(Distance => Distance,
Speed => Speed,
Angle => Angle,
Turns_Around => Turns_Around,
Visible => Visible,
Color => Color,
Radius => Radius,
others => <>);
end Init_Body;
procedure Set_Center(Bodies : in out Bodies_Array_T; X : Float; Y : Float) is
begin
Bodies(Bodies_Enum_T'First).X := X;
Bodies(Bodies_Enum_T'First).Y := Y;
end Set_Center;
-- implement a function to compute the X coordinate
-- x of the reference + distance * cos(angle)
function Compute_X
(Body_To_Move : Body_T;
Turns_Around : Body_T) return Float;
-- implement a function to compute the Y coordinate
-- y of the reference + distance * sin(angle)
function Compute_Y
(Body_To_Move : Body_T;
Turns_Around : Body_T) return Float;
function Compute_X
(Body_To_Move : Body_T;
Turns_Around : Body_T) return Float
is
begin
return Turns_Around.X + Body_To_Move.Distance * Cos (Body_To_Move.Angle);
end Compute_X;
function Compute_Y
(Body_To_Move : Body_T;
Turns_Around : Body_T) return Float
is
begin
return Turns_Around.Y + Body_To_Move.Distance * Sin (Body_To_Move.Angle);
end Compute_Y;
procedure Move (Body_To_Move : in out Body_T; Bodies : Bodies_Array_T) is
begin
Body_To_Move.X :=
Compute_X (Body_To_Move, Bodies (Body_To_Move.Turns_Around));
Body_To_Move.Y :=
Compute_Y (Body_To_Move, Bodies (Body_To_Move.Turns_Around));
Body_To_Move.Angle := Body_To_Move.Angle + Body_To_Move.Speed;
end Move;
procedure Move_All (Bodies : in out Bodies_Array_T) is
begin
-- loop over all bodies and call Move procedure
for B of Bodies loop
-- call the move procedure for each body
Move (B, Bodies);
end loop;
end Move_All;
end Solar_System;
|
stcarrez/dynamo | Ada | 4,956 | adb | -- part of AdaYaml, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "copying.txt"
with Ada.Strings.Hash;
with Ada.Unchecked_Deallocation;
package body Yaml.Text_Set is
use type Ada.Containers.Hash_Type;
use type Text.Reference;
function Grow_If_Needed (Object : in out Reference) return Boolean;
function Non_Zero_Hash (S : Standard.String)
return Ada.Containers.Hash_Type;
function Raw_Set (Object : in out Reference;
Hash : Ada.Containers.Hash_Type;
S : Standard.String)
return not null access Holder;
function Non_Zero_Hash (S : Standard.String)
return Ada.Containers.Hash_Type is
Hash : constant Ada.Containers.Hash_Type := Ada.Strings.Hash (S);
begin
if Hash = 0 then
return 1;
else
return Hash;
end if;
end Non_Zero_Hash;
function Raw_Set (Object : in out Reference;
Hash : Ada.Containers.Hash_Type;
S : Standard.String)
return not null access Holder is
Pos : Natural :=
Natural (Hash mod Ada.Containers.Hash_Type (Object.Elements'Length));
Cur : not null access Holder := Object.Elements (Pos)'Access;
begin
while Cur.Hash /= 0 and then
(Cur.Hash /= Hash or else Cur.Key /= S) loop
Pos := Pos + 1;
if Pos = Object.Elements'Length then
Pos := 0;
end if;
Cur := Object.Elements (Pos)'Access;
end loop;
return Cur;
end Raw_Set;
procedure Free is new Ada.Unchecked_Deallocation
(Holder_Array, Holder_Array_Access);
function Grow_If_Needed (Object : in out Reference) return Boolean is
Old_Elements : Holder_Array_Access := Object.Elements;
begin
if Object.Count = Object.Elements'Length / 2 then
Object.Elements := new Holder_Array (0 .. Object.Count * 4 - 1);
Object.Elements.all := (others => (Hash => 0, others => <>));
for E of Old_Elements.all loop
if E.Hash /= 0 then
Raw_Set (Object, E.Hash, To_String (E.Key)).all := E;
end if;
end loop;
Free (Old_Elements);
return True;
else
return False;
end if;
end Grow_If_Needed;
function Get (Object : in out Reference; S : Standard.String;
Create : Boolean) return Holder is
Hash : constant Ada.Containers.Hash_Type := Non_Zero_Hash (S);
begin
<<Start>>
declare
Cur : constant not null access Holder := Raw_Set (Object, Hash, S);
begin
if Cur.Hash = 0 then
if Grow_If_Needed (Object) then
goto Start;
end if;
if Create then
Object.Count := Object.Count + 1;
Cur.Hash := Hash;
Cur.Key := Object.Pool.From_String (S);
end if;
end if;
return Cur.all;
end;
end Get;
procedure Update (Object : in out Reference; S : Standard.String;
Value : Value_Type) is
Hash : constant Ada.Containers.Hash_Type := Non_Zero_Hash (S);
begin
<<Start>>
declare
Cur : constant not null access Holder := Raw_Set (Object, Hash, S);
begin
if Cur.Hash = 0 then
if Grow_If_Needed (Object) then
goto Start;
end if;
Object.Count := Object.Count + 1;
Cur.Hash := Hash;
Cur.Key := Object.Pool.From_String (S);
end if;
Cur.Value := Value;
end;
end Update;
function Set (Object : in out Reference;
S : Standard.String; Value : Value_Type) return Boolean is
Hash : constant Ada.Containers.Hash_Type := Non_Zero_Hash (S);
begin
if Grow_If_Needed (Object) then null; end if;
declare
Cur : constant not null access Holder := Raw_Set (Object, Hash, S);
begin
if Cur.Hash = 0 then
Object.Count := Object.Count + 1;
Cur.Hash := Hash;
Cur.Key := Object.Pool.From_String (S);
Cur.Value := Value;
return True;
else
return False;
end if;
end;
end Set;
procedure Clear (Object : in out Reference) is
begin
Object.Elements.all := (others => (Hash => 0, others => <>));
Object.Count := 0;
end Clear;
procedure Init (Object : in out Reference; Pool : Text.Pool.Reference;
Initial_Size : Positive) is
begin
Object.Pool := Pool;
Object.Elements := new Holder_Array (0 .. Initial_Size - 1);
Clear (Object);
end Init;
overriding
procedure Finalize (Object : in out Reference) is
begin
if Object.Elements /= null then
Free (Object.Elements);
end if;
end Finalize;
end Yaml.Text_Set;
|
luk9400/nsi | Ada | 662 | adb | package body Bubble with SPARK_Mode is
procedure Sort (A : in out Arr) is
Tmp : Integer;
begin
Outer: for I in reverse A'First .. A'Last - 1 loop
Inner: for J in A'First .. I loop
if A(J) > A(J + 1) then
Tmp := A(J);
A(J) := A(J + 1);
A(J + 1) := Tmp;
end if;
pragma Loop_Invariant (for all K1 in A'Range => (for some K2 in A'Range => A(K1) = A'Loop_Entry(Inner)(K2)));
end loop Inner;
pragma Loop_Invariant (for all K1 in A'Range => (for some K2 in A'Range => A(K1) = A'Loop_Entry(Outer)(K2)));
end loop Outer;
end Sort;
end Bubble;
|
mgrojo/smk | Ada | 4,401 | adb | -- -----------------------------------------------------------------------------
-- smk, the smart make
-- © 2018 Lionel Draghi <[email protected]>
-- SPDX-License-Identifier: APSL-2.0
-- -----------------------------------------------------------------------------
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
-- http://www.apache.org/licenses/LICENSE-2.0
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- -----------------------------------------------------------------------------
-- -----------------------------------------------------------------------------
-- Package: Smk.Cmd_Line body
--
-- Implementation Notes:
--
-- Portability Issues:
--
-- Anticipated Changes:
--
-- -----------------------------------------------------------------------------
with Smk.IO;
with Smk.Settings;
with Ada.Command_Line;
with Ada.Directories;
separate (Smk.Main)
procedure Analyze_Cmd_Line is
-- --------------------------------------------------------------------------
Arg_Counter : Positive := 1;
-- --------------------------------------------------------------------------
-- Procedure: Next_Arg
-- --------------------------------------------------------------------------
procedure Next_Arg is
begin
Arg_Counter := Arg_Counter + 1;
end Next_Arg;
-- --------------------------------------------------------------------------
-- Procedure: Put_Version
-- --------------------------------------------------------------------------
procedure Put_Version is
begin
IO.Put_Line (Settings.Smk_Version);
end Put_Version;
begin
if Ada.Command_Line.Argument_Count < 1 then
Put_Help;
return;
end if;
while Arg_Counter <= Ada.Command_Line.Argument_Count loop
declare
Opt : constant String := Ada.Command_Line.Argument (Arg_Counter);
begin
if Opt = "-a" or Opt = "--always-make" then
Settings.Always_Make := True;
Next_Arg;
elsif Opt = "-e" or Opt = "--explain" then
Settings.Explain := True;
Next_Arg;
elsif Opt = "-n" or Opt = "--dry-run" then
Settings.Dry_Run := True;
Next_Arg;
elsif Opt = "-i" or Opt = "--ignore-errors" then
Settings.Ignore_Errors := True;
Next_Arg;
elsif Opt = "-lm" or Opt = "--list_makefile" then
Settings.List_Makefile := True;
Next_Arg;
elsif Opt = "-ls" or Opt = "--list_saved_run" then
Settings.List_Saved_Run := True;
Next_Arg;
elsif Opt = "-lt" or Opt = "--list_targets" then
Settings.List_Targets := True;
Next_Arg;
elsif Opt = "--clean" then
Settings.Clean_Smk_Files := True;
Next_Arg;
elsif Opt = "-We" or Opt = "--Warnings=error" then
Settings.Warnings_As_Errors := True;
Next_Arg;
elsif Opt = "-v" or Opt = "--verbose" then
Settings.Verbosity := Verbose;
Next_Arg;
elsif Opt = "-q" or Opt = "--quiet" then
Settings.Verbosity := Quiet;
Next_Arg;
elsif Opt = "--version" then
Put_Version;
Next_Arg;
elsif Opt = "-h" or Opt = "--help" then
Put_Help;
Next_Arg;
elsif Opt = "-d" then
-- undocumented option
Settings.Verbosity := Debug;
Next_Arg;
elsif Ada.Directories.Exists (Opt) then
-- should be the Makefile
Settings.Set_Makefile_Name (Opt);
Next_Arg;
else
Put_Error ("Unknown Makefile or unknow option "
& Opt, With_Help => False);
end if;
if IO.Some_Error then return; end if;
-- No need to further analyze command line, or to do
-- Options_Coherency_Tests.
end;
end loop;
-- Options_Coherency_Tests;
end Analyze_Cmd_Line;
|
ytomino/vampire | Ada | 10,690 | adb | -- The Village of Vampire by YT, このソースコードはNYSLです
with Ada.Calendar.Formatting;
with Ada.Directories;
with Ada.Exception_Identification.From_Here;
with Ada.Hierarchical_File_Names;
with Ada.Streams.Stream_IO;
with Tabula.Calendar;
with Tabula.Users;
with Vampire.Villages.Text;
package body Vampire.R3 is
use type Ada.Calendar.Time;
use type Tabula.Villages.Village_State;
use type Tabula.Villages.Village_Term;
function Read (
Template_Source : in String;
Template_Cache : in String := "")
return Web.Producers.Template
is
File : Ada.Streams.Stream_IO.File_Type :=
Ada.Streams.Stream_IO.Open (Ada.Streams.Stream_IO.In_File,
Name => Template_Source);
begin
return Template : Web.Producers.Template :=
Web.Producers.Read (
Ada.Streams.Stream_IO.Stream (File),
Ada.Streams.Stream_IO.Size (File),
Parsing => False)
do
if Template_Cache'Length > 0 then
if Ada.Directories.Exists (Template_Cache)
and then Ada.Directories.Modification_Time (Template_Cache) >
Ada.Directories.Modification_Time (Template_Source)
then
-- read parsed-structure from cache file
declare
Cache_File : Ada.Streams.Stream_IO.File_Type;
begin
Ada.Streams.Stream_IO.Open (
Cache_File,
Ada.Streams.Stream_IO.In_File,
Name => Template_Cache);
Web.Producers.Read_Parsed_Information (
Ada.Streams.Stream_IO.Stream (Cache_File),
Template);
Ada.Streams.Stream_IO.Close (Cache_File);
end;
else
Web.Producers.Parse (Template);
-- save parsed-structure to cache file
declare
Cache_File : Ada.Streams.Stream_IO.File_Type;
begin
Ada.Streams.Stream_IO.Create (
Cache_File,
Name => Template_Cache);
Web.Producers.Write_Parsed_Information (
Ada.Streams.Stream_IO.Stream (Cache_File),
Template);
Ada.Streams.Stream_IO.Close (Cache_File);
end;
end if;
else
Web.Producers.Parse (Template);
end if;
Ada.Streams.Stream_IO.Close(File);
end return;
end Read;
function Day_Name (
Day : Natural;
Today : Natural;
State : Tabula.Villages.Village_State)
return String is
begin
if Day = 0 then
return "プロローグ";
elsif State >= Tabula.Villages.Epilogue and then Today = Day then
return "エピローグ";
else
return Image (Day) & "日目";
end if;
end Day_Name;
procedure Raise_Unknown_Tag (
Tag : in String;
File : in String := Ada.Debug.File;
Line : in Integer := Ada.Debug.Line) is
begin
Ada.Exception_Identification.From_Here.Raise_Exception (
Web.Producers.Data_Error'Identity,
File => File,
Line => Line,
Message => "Invalid template """ & Tag & """");
end Raise_Unknown_Tag;
procedure Handle_User_Panel (
Output : not null access Ada.Streams.Root_Stream_Type'Class;
Template : in Web.Producers.Template;
Form : in Forms.Root_Form_Type'Class;
User_Id : in String;
User_Password : in String)
is
Extract : constant array (Boolean) of access constant String := (
new String'("logoff"),
new String'("logon"));
procedure Handle (
Output : not null access Ada.Streams.Root_Stream_Type'Class;
Tag : in String;
Contents : in Web.Producers.Template) is
begin
if Tag = "action_page" then
Forms.Write_Attribute_Name (Output, "action");
Forms.Write_Link (
Output,
Form,
Current_Directory => ".",
Resource => Forms.Self,
Parameters =>
Form.Parameters_To_Index_Page (
User_Id => User_Id,
User_Password => User_Password));
elsif Tag = "administrator" then
if User_Id = Users.Administrator then
Web.Producers.Produce (Output, Contents, Handler => Handle'Access); -- rec
end if;
elsif Tag = "notadmin" then
if User_Id /= Users.Administrator then
Web.Producers.Produce (Output, Contents, Handler => Handle'Access); -- rec
end if;
elsif Tag = "id" then
Forms.Write_In_HTML (Output, Form, User_Id);
elsif Tag = "href_user" then
Forms.Write_Attribute_Name (Output, "href");
Forms.Write_Link (
Output,
Form,
Current_Directory => ".",
Resource => Forms.Self,
Parameters =>
Form.Parameters_To_User_Page (
User_Id => User_Id,
User_Password => User_Password));
else
Raise_Unknown_Tag (Tag);
end if;
end Handle;
begin
Web.Producers.Produce (
Output,
Template,
Extract (User_Id'Length /= 0).all,
Handler => Handle'Access);
end Handle_User_Panel;
procedure Handle_Village_List (
Output : not null access Ada.Streams.Root_Stream_Type'Class;
Template : in Web.Producers.Template;
Form : in Forms.Root_Form_Type'Class;
Current_Directory : in String;
HTML_Directory : in String;
Summaries : in Tabula.Villages.Lists.Summary_Maps.Map;
Log : in Boolean;
Limits : in Natural;
User_Id : in String;
User_Password : in String)
is
Exists : Boolean := False;
begin
for I in Summaries.Iterate loop
if (Summaries.Constant_Reference (I).State = Tabula.Villages.Closed) = Log then
Exists := True;
exit;
end if;
end loop;
if Exists then
declare
procedure Handle (
Output : not null access Ada.Streams.Root_Stream_Type'Class;
Tag : in String;
Contents : in Web.Producers.Template) is
begin
if Tag = "item" then
declare
Start : Tabula.Villages.Lists.Summary_Maps.Cursor := Summaries.First;
begin
if Log then
declare
C : Natural := Limits;
begin
for J in reverse Summaries.Iterate loop
if Summaries.Constant_Reference (J).State = Tabula.Villages.Closed then
C := C - 1;
if C = 0 then
Start := J;
exit;
end if;
end if;
end loop;
end;
end if;
for I in Summaries.Iterate (Start, Summaries.Last) loop
declare
Key : Tabula.Villages.Village_Id
renames Tabula.Villages.Lists.Summary_Maps.Key (I);
Element : Tabula.Villages.Lists.Village_Summary
renames Summaries.Constant_Reference (I);
begin
if (Element.State = Tabula.Villages.Closed) = Log then
declare
procedure Handle (
Output : not null access Ada.Streams.Root_Stream_Type'Class;
Tag : in String;
Contents : in Web.Producers.Template) is
begin
if Tag = "day" then
Forms.Write_In_HTML (
Output,
Form,
Day_Name (Element.Today, Element.Today, Element.State));
elsif Tag = "href_village" then
Forms.Write_Attribute_Name (Output, "href");
Forms.Write_Link_To_Village_Page (
Output,
Form,
Current_Directory => Current_Directory,
HTML_Directory => HTML_Directory,
Log => Log,
Village_Id => Key,
User_Id => User_Id,
User_Password => User_Password);
elsif Tag = "id" then
Forms.Write_In_HTML (Output, Form, Key);
elsif Tag = "name" then
if Element.Term = Tabula.Villages.Short then
Forms.Write_In_HTML (Output, Form, "短期 ");
end if;
Forms.Write_In_HTML (Output, Form, Element.Name.Constant_Reference);
elsif Tag = "people" then
Forms.Write_In_HTML (Output, Form, Image (Element.People.Length) & "人");
else
Raise_Unknown_Tag (Tag);
end if;
end Handle;
begin
Web.Producers.Produce (Output, Contents, Handler => Handle'Access);
end;
end if;
end;
end loop;
end;
else
Raise_Unknown_Tag (Tag);
end if;
end Handle;
begin
Web.Producers.Produce (Output, Template, Handler => Handle'Access);
end;
end if;
end Handle_Village_List;
procedure Handle_Speech (
Output : not null access Ada.Streams.Root_Stream_Type'Class;
Template : in Web.Producers.Template;
Tag : in String := "";
Form : in Forms.Root_Form_Type'Class;
Current_Directory : in String;
Image_Directory : in String;
Face_Width : in Integer;
Face_Height : in Integer;
Subject : in Tabula.Villages.Person_Type'Class;
Text : in String;
Time : in Ada.Calendar.Time;
Filter : in String)
is
procedure Handle (
Output : not null access Ada.Streams.Root_Stream_Type'Class;
Tag : in String;
Contents : in Web.Producers.Template) is
begin
if Tag = "src_image" then
Forms.Write_Attribute_Name (Output, "src");
Forms.Write_Link (
Output,
Form,
Current_Directory => Current_Directory,
Resource =>
Ada.Hierarchical_File_Names.Compose (
Directory => Image_Directory,
Relative_Name => Subject.Image.Constant_Reference));
elsif Tag = "width_image" then
if Face_Width /= 0 then
Forms.Write_Attribute_Name (Output, "width");
Forms.Write_Attribute_Open (Output);
Forms.Write_In_Attribute (Output, Form, Image (Face_Width));
Forms.Write_Attribute_Close (Output);
end if;
elsif Tag = "height_image" then
if Face_Height /= 0 then
Forms.Write_Attribute_Name (Output, "height");
Forms.Write_Attribute_Open (Output);
Forms.Write_In_Attribute (Output, Form, Image (Face_Height));
Forms.Write_Attribute_Close (Output);
end if;
elsif Tag = "name" then
Forms.Write_In_HTML (Output, Form, Villages.Text.Name (Subject));
elsif Tag = "time" then
Forms.Write_In_HTML (
Output,
Form,
Ada.Calendar.Formatting.Image(Time, Time_Zone => Calendar.Time_Offset));
elsif Tag = "text" then
if Text'Length > Villages.Max_Length_Of_Message then
declare
I : Natural := Villages.Max_Length_Of_Message;
begin
while I >= Text'First
and then Character'Pos (Text (I + 1)) in 16#80# .. 16#bf#
loop
I := I - 1;
end loop;
Forms.Write_In_HTML (Output, Form, Text (Text'First .. I));
String'Write (Output, "<b>");
Forms.Write_In_HTML (Output, Form, Text (I + 1 .. Text'Last));
String'Write (Output, "</b>");
end;
else
Forms.Write_In_HTML (Output, Form, Text);
end if;
elsif Tag = "class_filter" then
Forms.Write_Attribute_Name (Output, "class");
Forms.Write_Attribute_Open (Output);
Forms.Write_In_Attribute (Output, Form, Filter);
Forms.Write_Attribute_Close (Output);
else
Raise_Unknown_Tag (Tag);
end if;
end Handle;
begin
Web.Producers.Produce (Output, Template, Tag, Handler => Handle'Access);
end Handle_Speech;
end Vampire.R3;
|
charlie5/lace | Ada | 953 | ads | with
openGL.surface_Profile,
openGL.Display;
-- private
-- with
-- Glx;
limited
with
openGL.Context;
package openGL.Surface
--
-- Models an openGL surface.
--
is
type Item is tagged private;
type Items is array (Positive range <>) of aliased Item;
type View is access all Item'class;
type Views is array (Positive range <>) of View;
procedure define (Self : in out Item; surface_Profile : in openGL.surface_Profile.item'Class;
Display : in openGL.Display.Item;
Window_Id : in Natural);
-- Operations
--
procedure swap_Buffers (Self : in Item);
private
type Item is tagged
record
-- glx_Surface : glx.GLXDrawable;
Context : access openGL.Context.item'Class;
Display : openGL.Display.item;
end record;
end openGL.Surface;
|
AdaCore/training_material | Ada | 3,244 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 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. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Real_Time; use Ada.Real_Time;
with Screen_Interface;
with Railroad;
package body Driver is
----------------
-- Controller --
----------------
task body Controller is
Period : constant Time_Span := Milliseconds (60);
-- arbitrary, but directly affects how fast the trains move
-- and how quickly the screen responds to touch
Next_Start : Time := Clock + Seconds (1);
Current : Screen_Interface.Touch_State;
Previous : Screen_Interface.Touch_State;
begin
delay until Next_Start;
Screen_Interface.Initialize;
Railroad.Initialize;
Current := Screen_Interface.Get_Touch_State;
Previous := Current;
loop
Current := Screen_Interface.Get_Touch_State;
if Current.Touch_Detected /= Previous.Touch_Detected then
if Current.Touch_Detected then
Railroad.On_Touch ((Current.X, Current.Y));
end if;
Previous := Current;
end if;
Railroad.Simulation_Step;
Railroad.Draw;
Next_Start := Next_Start + Period;
delay until Next_Start;
end loop;
end Controller;
end Driver;
|
zrmyers/VulkanAda | Ada | 6,542 | ads | --------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2021 Zane Myers
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--------------------------------------------------------------------------------
with Vulkan.Math.GenDMatrix;
with Vulkan.Math.Dvec3;
use Vulkan.Math.GenDMatrix;
use Vulkan.Math.Dvec3;
--------------------------------------------------------------------------------
--< @group Vulkan Math Basic Types
--------------------------------------------------------------------------------
--< @summary
--< This package provides a single precision floating point matrix with 3 rows
--< and 3 columns.
--------------------------------------------------------------------------------
package Vulkan.Math.Dmat4x3 is
pragma Preelaborate;
pragma Pure;
--< A 4x3 matrix of single-precision floating point numbers.
subtype Vkm_Dmat4x3 is Vkm_Dmat(
last_row_index => 3, last_column_index => 2);
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Dmat4x3 type.
--<
--< @description
--< Construct a 4x3 matrix with each component set to the corresponding
--< component in the identity matrix.
--<
--< @return
--< A 4x3 matrix.
----------------------------------------------------------------------------
function Make_Dmat4x3 return Vkm_Dmat4x3 is
(GDM.Make_GenMatrix(cN => 2, rN => 3)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Dmat4x3 type.
--<
--< @description
--< Construct a 4x3 matrix with each component set to a different value.
--<
--< @param value1
--< The first value to set for the matrix.
--<
--< @param value2
--< The second value to set for the matrix.
--<
--< @param value3
--< The third value to set for the matrix.
--<
--< @param value4
--< The fourth value to set for the matrix.
--<
--< @param value5
--< The fifth value to set for the matrix.
--<
--< @param value6
--< The sixth value to set for the matrix.
--<
--< @param value7
--< The seventh value to set for the matrix.
--<
--< @param value8
--< The eighth value to set for the matrix.
--<
--< @param value9
--< The ninth value to set for the matrix.
--<
--< @return
--< A 4x3 matrix.
----------------------------------------------------------------------------
function Make_Dmat4x3 (
value1 , value2 , value3 ,
value4 , value5 , value6 ,
value7 , value8 , value9 ,
value10, value11, value12 : in Vkm_Double) return Vkm_Dmat4x3 is
(GDM.Make_GenMatrix(
cN => 2, rN => 3,
c0r0_val => value1, c0r1_val => value4, c0r2_val => value7, c0r3_val => value10,
c1r0_val => value2, c1r1_val => value5, c1r2_val => value8, c1r3_val => value11,
c2r0_val => value3, c2r1_val => value6, c2r2_val => value9, c2r3_val => value12)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Dmat4x3 type.
--<
--< @description
--< Construct a 4x3 matrix with each column set to the value of a 2 dimmensional
--< vector.
--<
--< @param value1
--< The first value to set for the matrix.
--<
--< @param value2
--< The second value to set for the matrix.
--<
--< @return
--< A 4x3 matrix.
----------------------------------------------------------------------------
function Make_Dmat4x3 (
value1, value2, value3, value4 : in Vkm_Dvec3) return Vkm_Dmat4x3 is
(GDM.Make_GenMatrix(
cN => 2, rN => 3,
c0r0_val => value1.x, c0r1_val => value2.x, c0r2_val => value3.x, c0r3_val => value4.x,
c1r0_val => value1.y, c1r1_val => value2.y, c1r2_val => value3.y, c1r3_val => value4.y,
c2r0_val => value1.z, c2r1_val => value2.z, c2r2_val => value3.z, c2r3_val => value4.z)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Dmat4x3 type.
--<
--< @description
--< Construct a 4x3 matrix using values from an existing matrix.
--<
--< If the provided matrix has dimmensions that are not the same as this
--< matrix, the corresponding element in the 4x4 identity matrix is used for
--< out of bounds accesses.
--<
--< @param value1
--< The submatrix to extract values from.
--<
--< @return
--< A 4x3 matrix.
----------------------------------------------------------------------------
function Make_Dmat4x3 (
value1 : in Vkm_Dmat) return Vkm_Dmat4x3 is
(GDM.Make_GenMatrix(
cN => 2, rN => 3,
c0r0_val => value1.c0r0, c0r1_val => value1.c0r1, c0r2_val => value1.c0r2, c0r3_val => value1.c0r3,
c1r0_val => value1.c1r0, c1r1_val => value1.c1r1, c1r2_val => value1.c1r2, c1r3_val => value1.c1r3,
c2r0_val => value1.c2r0, c2r1_val => value1.c2r1, c2r2_val => value1.c2r2, c2r3_val => value1.c2r3)) with Inline;
end Vulkan.Math.Dmat4x3;
|
zhmu/ananas | Ada | 344 | ads | with Inline20_G;
generic
with package Msg is new Inline20_G (<>);
package Inline20_H is
generic
type T is private;
with function Image (Data : T) return String;
package Nested_H is
package My_Nested_G is new Msg.Nested_G (T);
function F return Integer renames My_Nested_G.F;
end Nested_H;
end Inline20_H;
|
sungyeon/drake | Ada | 3,923 | ads | pragma License (Unrestricted);
-- implementation unit
with System.Reference_Counting;
package Ada.Strings.Naked_Maps is
pragma Pure;
-- Representation for a set of Wide_Wide_Character values
subtype Character_Type is Wide_Wide_Character;
subtype Character_Sequence is Wide_Wide_String;
-- alternative conversions functions
-- raising exception instead of using substitute.
function To_Character (Item : Wide_Wide_Character)
return Character;
function To_Wide_Character (Item : Wide_Wide_Character)
return Wide_Character;
function To_Wide_Wide_Character (Item : Character)
return Wide_Wide_Character;
function To_Wide_Wide_Character (Item : Wide_Character)
return Wide_Wide_Character;
-- sets
type Character_Range is record
Low : Character_Type;
High : Character_Type;
end record;
pragma Suppress_Initialization (Character_Range);
type Character_Ranges is array (Positive range <>) of Character_Range;
pragma Suppress_Initialization (Character_Ranges);
type Character_Set_Data (Length : Natural) is limited record
Reference_Count : aliased System.Reference_Counting.Counter;
Items : aliased Character_Ranges (1 .. Length);
end record;
pragma Suppress_Initialization (Character_Set_Data);
-- place Reference_Count at first
for Character_Set_Data use record
Reference_Count at 0 range
0 ..
System.Reference_Counting.Counter'Size - 1;
end record;
type Character_Set_Access is access all Character_Set_Data;
for Character_Set_Access'Storage_Size use 0;
function Is_In (Element : Character_Type; Set : Character_Set_Data)
return Boolean;
-- making operations
procedure Add (
A : in out Character_Ranges;
Last : in out Natural;
L, H : Character_Type);
-- "and"
procedure Intersection (
Result : out Character_Ranges;
Last : out Natural;
Left, Right : Character_Ranges);
-- "or"
procedure Union (
Target : out Character_Ranges;
Last : out Natural;
Left, Right : Character_Ranges);
-- maps
type Character_Mapping_Data (Length : Natural) is limited record
Reference_Count : aliased System.Reference_Counting.Counter;
From : Character_Sequence (1 .. Length); -- To_Domain
To : Character_Sequence (1 .. Length); -- To_Range
end record;
pragma Suppress_Initialization (Character_Mapping_Data);
-- place Reference_Count at first
for Character_Mapping_Data use record
Reference_Count at 0 range
0 ..
System.Reference_Counting.Counter'Size - 1;
end record;
type Character_Mapping_Access is access all Character_Mapping_Data;
for Character_Mapping_Access'Storage_Size use 0;
function Value (Map : Character_Mapping_Data; Element : Character_Type)
return Character_Type;
-- for Handling
function Translate (
Source : String;
Mapping : Character_Mapping_Data)
return String;
function Translate (
Source : Wide_String;
Mapping : Character_Mapping_Data)
return Wide_String;
function Translate (
Source : Wide_Wide_String;
Mapping : Character_Mapping_Data)
return Wide_Wide_String;
-- making operations
procedure To_Mapping (
From, To : Character_Sequence;
Out_From, Out_To : out Character_Sequence; -- should have same 'First
Out_Last : out Natural);
private
type Character_Set_Array is
array (Positive range <>) of not null access constant Character_Set_Data;
pragma Suppress_Initialization (Character_Set_Array);
-- for Set_Constants
procedure Union (
Target : out Character_Ranges;
Last : out Natural;
Source : in out Character_Set_Array); -- destructive
-- for Case_Mapping
procedure Sort (From, To : in out Character_Sequence);
end Ada.Strings.Naked_Maps;
|
zhmu/ananas | Ada | 59 | ads | package Pack8_Pkg is
N : Natural := 1;
end Pack8_Pkg;
|
sungyeon/drake | Ada | 2,845 | ads | pragma License (Unrestricted);
-- Ada 2012
private with System;
package Ada.Strings.UTF_Encoding is
pragma Pure;
-- Declarations common to the string encoding packages
-- modified
-- UTF-32 support is added.
type Encoding_Scheme is (
UTF_8, UTF_16BE, UTF_16LE,
UTF_32BE, UTF_32LE); -- additional
subtype UTF_String is String;
subtype UTF_8_String is String;
subtype UTF_16_Wide_String is Wide_String;
-- extended
subtype UTF_32_Wide_Wide_String is Wide_Wide_String;
Encoding_Error : exception;
BOM_8 : aliased constant String := -- "aliased" is extended
Character'Val (16#EF#)
& Character'Val (16#BB#)
& Character'Val (16#BF#);
BOM_16BE : aliased constant String := -- "aliased" is extended
Character'Val (16#FE#)
& Character'Val (16#FF#);
BOM_16LE : aliased constant String := -- "aliased" is extended
Character'Val (16#FF#)
& Character'Val (16#FE#);
BOM_16 : constant Wide_String :=
(1 => Wide_Character'Val (16#FEFF#));
-- extended
BOM_32BE : aliased constant String :=
Character'Val (16#00#)
& Character'Val (16#00#)
& Character'Val (16#FE#)
& Character'Val (16#FF#);
-- extended
BOM_32LE : aliased constant String :=
Character'Val (16#FF#)
& Character'Val (16#FE#)
& Character'Val (16#00#)
& Character'Val (16#00#);
-- extended
BOM_32 : constant Wide_Wide_String :=
(1 => Wide_Wide_Character'Val (16#0000FEFF#));
function Encoding (
Item : UTF_String;
Default : Encoding_Scheme := UTF_8)
return Encoding_Scheme;
-- extended
UTF_16_Wide_String_Scheme : constant
Encoding_Scheme range UTF_16BE .. UTF_16LE;
UTF_32_Wide_Wide_String_Scheme : constant
Encoding_Scheme range UTF_32BE .. UTF_32LE;
private
use type System.Bit_Order;
UTF_16_Wide_String_Scheme : constant Encoding_Scheme :=
Encoding_Scheme'Val (
Encoding_Scheme'Pos (UTF_16BE)
* Boolean'Pos (System.Default_Bit_Order = System.High_Order_First)
+ Encoding_Scheme'Pos (UTF_16LE)
* Boolean'Pos (System.Default_Bit_Order = System.Low_Order_First));
UTF_32_Wide_Wide_String_Scheme : constant Encoding_Scheme :=
Encoding_Scheme'Val (
Encoding_Scheme'Pos (UTF_32BE)
* Boolean'Pos (System.Default_Bit_Order = System.High_Order_First)
+ Encoding_Scheme'Pos (UTF_32LE)
* Boolean'Pos (System.Default_Bit_Order = System.Low_Order_First));
BOM_Table : constant
array (Encoding_Scheme) of not null access constant UTF_String := (
UTF_8 => BOM_8'Access,
UTF_16BE => BOM_16BE'Access,
UTF_16LE => BOM_16LE'Access,
UTF_32BE => BOM_32BE'Access,
UTF_32LE => BOM_32LE'Access);
end Ada.Strings.UTF_Encoding;
|
GLADORG/glad-cli | Ada | 1,000 | adb | with Ada.Text_IO;
with Ada.Directories;
with Init_Project;
with Blueprint; use Blueprint;
package body Commands.Init is
package IO renames Ada.Text_IO;
package TT renames CLIC.TTY;
-------------
-- Execute --
-------------
overriding
procedure Execute ( Cmd : in out Command;
Args : AAA.Strings.Vector)
is
ToDo : Action := Write;
begin
if Cmd.Dry_Run then
IO.Put_Line(TT.Emph("You specified the dry-run flag, so no changes will be written."));
ToDo := DryRun;
end if;
Init_Project.Init(Ada.Directories.Current_Directory,ToDo);
end Execute;
--------------------
-- Setup_Switches --
--------------------
overriding
procedure Setup_Switches
(Cmd : in out Command;
Config : in out CLIC.Subcommand.Switches_Configuration)
is
use CLIC.Subcommand;
begin
Define_Switch
(Config, Cmd.Dry_Run'Access, "", "-dry-run", "Dry-run");
end Setup_Switches;
end Commands.Init; |
stcarrez/ada-asf | Ada | 2,034 | ads | -----------------------------------------------------------------------
-- asf-converters-tests - Unit tests for ASF.Converters
-- Copyright (C) 2014, 2018, 2019 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
with ASF.Contexts.Faces.Tests;
package ASF.Converters.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new ASF.Contexts.Faces.Tests.Test with null record;
-- Test the date short converter.
procedure Test_Date_Short_Converter (T : in out Test);
-- Test the date medium converter.
procedure Test_Date_Medium_Converter (T : in out Test);
-- Test the date long converter.
procedure Test_Date_Long_Converter (T : in out Test);
-- Test the date full converter.
procedure Test_Date_Full_Converter (T : in out Test);
-- Test the time short converter.
procedure Test_Time_Short_Converter (T : in out Test);
-- Test the time short converter.
procedure Test_Time_Medium_Converter (T : in out Test);
-- Test the time long converter.
procedure Test_Time_Long_Converter (T : in out Test);
-- Test converter reporting conversion errors when converting a string back to a date.
procedure Test_Date_Converter_Error (T : in out Test);
-- Test number converter.
procedure Test_Number_Converter (T : in out Test);
end ASF.Converters.Tests;
|
reznikmm/matreshka | Ada | 3,681 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Internals.Elements;
function AMF.Elements.Generic_Hash
(Item : Element_Access) return Ada.Containers.Hash_Type is
begin
if Item = null then
return 0;
else
return
Ada.Containers.Hash_Type
(AMF.Internals.Elements.Element_Base'Class (Item.all).Element);
end if;
end AMF.Elements.Generic_Hash;
|
Gabriel-Degret/adalib | Ada | 680 | ads | -- Standard Ada library specification
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
generic
with package Bounded is
new Ada.Strings.Bounded.Generic_Bounded_Length (<>);
function Ada.Strings.Bounded.Equal_Case_Insensitive
(Left, Right : Bounded.Bounded_String) return Boolean;
pragma Preelaborate(Ada.Strings.Bounded.Equal_Case_Insensitive);
|
faelys/natools | Ada | 1,495 | ads | ------------------------------------------------------------------------------
-- 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.Real_Time;
with Natools.Time_Statistics.Fine_Timer_Difference;
with Natools.Time_Statistics.Generic_Timers;
package Natools.Time_Statistics.Fine_Timers
is new Natools.Time_Statistics.Generic_Timers
(Ada.Real_Time.Time,
Ada.Real_Time.Clock,
Natools.Time_Statistics.Fine_Timer_Difference);
|
wookey-project/ewok-legacy | Ada | 1,010 | ads | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
package ewok.dma_shared
with spark_mode => off
is
ID_DMA_UNUSED : constant := 0;
type t_user_dma_index is range ID_DMA_UNUSED .. 8;
subtype t_registered_dma_index is t_user_dma_index range 1 .. 8;
end ewok.dma_shared;
|
zhmu/ananas | Ada | 240 | ads | generic
package Interface9_Root.Child is
type Base_Type is abstract new Base_Interface with null record;
type Derived_Type is abstract new Base_Type and Derived_Interface
with null record; -- Test
end Interface9_Root.Child;
|
RREE/ada-util | Ada | 11,152 | adb | -----------------------------------------------------------------------
-- Util.Serialize.Mappers.Record_Mapper -- Mapper for record types
-- Copyright (C) 2010, 2011 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Util.Serialize.Contexts;
with Util.Strings.Transforms;
with Util.Log.Loggers;
package body Util.Serialize.Mappers.Record_Mapper is
use Util.Log;
Key : Util.Serialize.Contexts.Data_Key;
-- The logger
Log : constant Loggers.Logger := Loggers.Create ("Util.Serialize.Mappers.Record_Mapper",
Util.Log.WARN_LEVEL);
-- -----------------------
-- Get the element object.
-- -----------------------
function Get_Element (Data : in Element_Data) return Element_Type_Access is
begin
return Data.Element;
end Get_Element;
-- -----------------------
-- Set the element object. When <b>Release</b> is set, the element <b>Element</b>
-- will be freed when the reader context is deleted (by <b>Finalize</b>).
-- -----------------------
procedure Set_Element (Data : in out Element_Data;
Element : in Element_Type_Access;
Release : in Boolean := False) is
begin
Data.Element := Element;
Data.Release := Release;
end Set_Element;
-- -----------------------
-- Finalize the object when it is removed from the reader context.
-- If the
-- -----------------------
overriding
procedure Finalize (Data : in out Element_Data) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => Element_Type,
Name => Element_Type_Access);
begin
if Data.Release then
Free (Data.Element);
end if;
end Finalize;
-- -----------------------
-- Execute the mapping operation on the object associated with the current context.
-- The object is extracted from the context and the <b>Execute</b> operation is called.
-- -----------------------
procedure Execute (Handler : in Mapper;
Map : in Mapping'Class;
Ctx : in out Util.Serialize.Contexts.Context'Class;
Value : in Util.Beans.Objects.Object) is
D : constant Contexts.Data_Access := Ctx.Get_Data (Key);
begin
if not (D.all in Element_Data'Class) then
raise Util.Serialize.Contexts.No_Data;
end if;
declare
DE : constant Element_Data_Access := Element_Data'Class (D.all)'Access;
begin
if DE.Element = null then
raise Util.Serialize.Contexts.No_Data;
end if;
Handler.Execute (Map, DE.Element.all, Value);
end;
end Execute;
-- -----------------------
-- Add a mapping for setting a member. When the attribute rule defined by <b>Path</b>
-- is matched, the <b>Set_Member</b> procedure will be called with the value and the
-- <b>Field</b> identification.
-- -----------------------
procedure Add_Mapping (Into : in out Mapper;
Path : in String;
Field : in Fields) is
Map : constant Attribute_Mapping_Access := new Attribute_Mapping;
begin
Map.Index := Field;
Into.Add_Mapping (Path, Map.all'Unchecked_Access);
end Add_Mapping;
-- -----------------------
-- Add a mapping associated with the path and described by a mapper object.
-- The <b>Proxy</b> procedure is in charge of giving access to the target
-- object used by the <b>Map</b> mapper.
-- -----------------------
procedure Add_Mapping (Into : in out Mapper;
Path : in String;
Map : in Util.Serialize.Mappers.Mapper_Access;
Proxy : in Proxy_Object) is
M : constant Proxy_Mapper_Access := new Proxy_Mapper;
begin
M.Mapper := Map;
M.Execute := Proxy;
M.Is_Proxy_Mapper := True;
Into.Add_Mapping (Path, M.all'Unchecked_Access);
end Add_Mapping;
--
procedure Bind (Into : in out Mapper;
Getter : in Get_Member_Access) is
begin
Into.Get_Member := Getter;
end Bind;
procedure Bind (Into : in out Mapper;
From : in Mapper_Access) is
begin
Into.Get_Member := From.Get_Member;
end Bind;
function Get_Getter (From : in Mapper) return Get_Member_Access is
begin
return From.Get_Member;
end Get_Getter;
procedure Set_Member (Attr : in Attribute_Mapping;
Element : in out Element_Type;
Value : in Util.Beans.Objects.Object) is
begin
Set_Member (Element, Attr.Index, Value);
end Set_Member;
-- -----------------------
-- Set the attribute member described by the <b>Attr</b> mapping
-- into the value passed in <b>Element</b>. This operation will call
-- the package parameter function of the same name.
-- -----------------------
procedure Set_Member (Attr : in Mapping'Class;
Element : in out Element_Type;
Value : in Util.Beans.Objects.Object) is
begin
if not (Attr in Attribute_Mapping) then
Log.Error ("Mapping is not an Attribute_Mapping");
raise Mapping_Error;
end if;
Attribute_Mapping (Attr).Set_Member (Element, Value);
end Set_Member;
-- -----------------------
-- Set the element in the context. When <b>Release</b> is set, the element <b>Element</b>
-- will be freed when the reader context is deleted (by <b>Finalize</b>).
-- -----------------------
procedure Set_Context (Ctx : in out Util.Serialize.Contexts.Context'Class;
Element : in Element_Type_Access;
Release : in Boolean := False) is
Data_Context : constant Element_Data_Access := new Element_Data;
begin
Data_Context.Element := Element;
Data_Context.Release := Release;
Ctx.Set_Data (Key => Key, Content => Data_Context.all'Unchecked_Access);
end Set_Context;
-- -----------------------
-- Find the mapper associated with the given name.
-- Returns null if there is no mapper.
-- -----------------------
overriding
function Find_Mapper (Controller : in Proxy_Mapper;
Name : in String;
Attribute : in Boolean := False) return Mappers.Mapper_Access is
Result : constant Mappers.Mapper_Access := Controller.Mapper.Find_Mapper (Name, Attribute);
begin
if Result /= null then
return Result;
else
return Util.Serialize.Mappers.Mapper (Controller).Find_Mapper (Name, Attribute);
end if;
end Find_Mapper;
-- -----------------------
-- Build a default mapping based on the <b>Fields</b> enumeration.
-- The enumeration name is used for the mapping name with the optional <b>FIELD_</b>
-- prefix stripped.
-- -----------------------
procedure Add_Default_Mapping (Into : in out Mapper) is
use Util.Strings.Transforms;
begin
for Field in Fields'Range loop
declare
Name : constant String := To_Lower_Case (Fields'Image (Field));
begin
if Name (Name'First .. Name'First + 5) = "field_" then
Into.Add_Mapping (Name (Name'First + 6 .. Name'Last), Field);
else
Into.Add_Mapping (Name, Field);
end if;
end;
end loop;
end Add_Default_Mapping;
-- -----------------------
-- Write the element on the stream using the mapper description.
-- -----------------------
procedure Write (Handler : in Mapper;
Stream : in out Util.Serialize.IO.Output_Stream'Class;
Element : in Element_Type) is
begin
if Handler.Get_Member = null then
Log.Error ("The mapper has a null Get_Member function");
raise Mapping_Error with "The mapper has a null Get_Member function";
end if;
Write (Handler, Handler.Get_Member, Stream, Element);
end Write;
-- -----------------------
-- Write the element on the stream using the mapper description.
-- -----------------------
procedure Write (Handler : in Util.Serialize.Mappers.Mapper'Class;
Getter : in Get_Member_Access;
Stream : in out Util.Serialize.IO.Output_Stream'Class;
Element : in Element_Type) is
use Ada.Strings.Unbounded;
procedure Write (Map : in Util.Serialize.Mappers.Mapper'Class);
procedure Write (Map : in Util.Serialize.Mappers.Mapper'Class) is
Name : constant String := To_String (Map.Name);
begin
if Map.Mapping /= null then
declare
M : constant Attribute_Mapping_Access
:= Attribute_Mapping'Class (Map.Mapping.all)'Access;
Val : constant Util.Beans.Objects.Object := Getter (Element, M.Index);
begin
if M.Is_Attribute then
Stream.Write_Attribute (Name => Name, Value => Val);
else
Stream.Write_Entity (Name => Name, Value => Val);
end if;
end;
else
Stream.Start_Entity (Name);
Map.Iterate (Write'Access);
Stream.End_Entity (Name);
end if;
end Write;
begin
Handler.Iterate (Write'Access);
end Write;
-- -----------------------
-- Clone the <b>Handler</b> instance and get a copy of that single object.
-- -----------------------
function Clone (Handler : in Mapper) return Util.Serialize.Mappers.Mapper_Access is
Result : constant Mapper_Access := new Mapper;
begin
Result.Name := Handler.Name;
Result.Mapper := Handler.Mapper;
Result.Mapping := Handler.Mapping;
Result.Is_Proxy_Mapper := Handler.Is_Proxy_Mapper;
Result.Is_Wildcard := Handler.Is_Wildcard;
Result.Is_Deep_Wildcard := Handler.Is_Deep_Wildcard;
Result.Get_Member := Handler.Get_Member;
Result.Execute := Handler.Execute;
return Result.all'Unchecked_Access;
end Clone;
begin
-- Allocate the unique data key.
Util.Serialize.Contexts.Allocate (Key);
end Util.Serialize.Mappers.Record_Mapper; |
AdaCore/langkit | Ada | 476 | ads | with Langkit_Support.Adalog.Main_Support;
package Support is
use Langkit_Support.Adalog.Main_Support.Solver_Ifc;
type Transformer is new Converter_Type with null record;
overriding function Convert
(Dummy : Transformer; I : Integer) return Integer is (I * 3);
overriding function Image (Dummy : Transformer) return String is ("*3");
Transformer_Singleton : constant Transformer :=
(Cache_Set => False, Ref_Count => 1, others => <>);
end Support;
|
AdaCore/Ada_Drivers_Library | Ada | 32,596 | ads | -- This spec has been automatically generated from STM32F429x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.LTDC is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype SSCR_VSH_Field is HAL.UInt11;
subtype SSCR_HSW_Field is HAL.UInt12;
-- Synchronization Size Configuration Register
type SSCR_Register is record
-- Vertical Synchronization Height (in units of horizontal scan line)
VSH : SSCR_VSH_Field := 16#0#;
-- unspecified
Reserved_11_15 : HAL.UInt5 := 16#0#;
-- Horizontal Synchronization Width (in units of pixel clock period)
HSW : SSCR_HSW_Field := 16#0#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SSCR_Register use record
VSH at 0 range 0 .. 10;
Reserved_11_15 at 0 range 11 .. 15;
HSW at 0 range 16 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype BPCR_AVBP_Field is HAL.UInt11;
subtype BPCR_AHBP_Field is HAL.UInt12;
-- Back Porch Configuration Register
type BPCR_Register is record
-- Accumulated Vertical back porch (in units of horizontal scan line)
AVBP : BPCR_AVBP_Field := 16#0#;
-- unspecified
Reserved_11_15 : HAL.UInt5 := 16#0#;
-- Accumulated Horizontal back porch (in units of pixel clock period)
AHBP : BPCR_AHBP_Field := 16#0#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BPCR_Register use record
AVBP at 0 range 0 .. 10;
Reserved_11_15 at 0 range 11 .. 15;
AHBP at 0 range 16 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype AWCR_AAH_Field is HAL.UInt11;
subtype AWCR_AAW_Field is HAL.UInt12;
-- Active Width Configuration Register
type AWCR_Register is record
-- Accumulated Active Height (in units of horizontal scan line)
AAH : AWCR_AAH_Field := 16#0#;
-- unspecified
Reserved_11_15 : HAL.UInt5 := 16#0#;
-- Accumulated Active Width (in units of pixel clock period)
AAW : AWCR_AAW_Field := 16#0#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for AWCR_Register use record
AAH at 0 range 0 .. 10;
Reserved_11_15 at 0 range 11 .. 15;
AAW at 0 range 16 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype TWCR_TOTALH_Field is HAL.UInt11;
subtype TWCR_TOTALW_Field is HAL.UInt12;
-- Total Width Configuration Register
type TWCR_Register is record
-- Total Height (in units of horizontal scan line)
TOTALH : TWCR_TOTALH_Field := 16#0#;
-- unspecified
Reserved_11_15 : HAL.UInt5 := 16#0#;
-- Total Width (in units of pixel clock period)
TOTALW : TWCR_TOTALW_Field := 16#0#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TWCR_Register use record
TOTALH at 0 range 0 .. 10;
Reserved_11_15 at 0 range 11 .. 15;
TOTALW at 0 range 16 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype GCR_DBW_Field is HAL.UInt3;
subtype GCR_DGW_Field is HAL.UInt3;
subtype GCR_DRW_Field is HAL.UInt3;
-- Global Control Register
type GCR_Register is record
-- LCD-TFT controller enable bit
LTDCEN : Boolean := False;
-- unspecified
Reserved_1_3 : HAL.UInt3 := 16#0#;
-- Read-only. Dither Blue Width
DBW : GCR_DBW_Field := 16#2#;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- Read-only. Dither Green Width
DGW : GCR_DGW_Field := 16#2#;
-- unspecified
Reserved_11_11 : HAL.Bit := 16#0#;
-- Read-only. Dither Red Width
DRW : GCR_DRW_Field := 16#2#;
-- unspecified
Reserved_15_15 : HAL.Bit := 16#0#;
-- Dither Enable
DEN : Boolean := False;
-- unspecified
Reserved_17_27 : HAL.UInt11 := 16#0#;
-- Pixel Clock Polarity
PCPOL : Boolean := False;
-- Data Enable Polarity
DEPOL : Boolean := False;
-- Vertical Synchronization Polarity
VSPOL : Boolean := False;
-- Horizontal Synchronization Polarity
HSPOL : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for GCR_Register use record
LTDCEN at 0 range 0 .. 0;
Reserved_1_3 at 0 range 1 .. 3;
DBW at 0 range 4 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
DGW at 0 range 8 .. 10;
Reserved_11_11 at 0 range 11 .. 11;
DRW at 0 range 12 .. 14;
Reserved_15_15 at 0 range 15 .. 15;
DEN at 0 range 16 .. 16;
Reserved_17_27 at 0 range 17 .. 27;
PCPOL at 0 range 28 .. 28;
DEPOL at 0 range 29 .. 29;
VSPOL at 0 range 30 .. 30;
HSPOL at 0 range 31 .. 31;
end record;
-- Shadow Reload Configuration Register
type SRCR_Register is record
-- Immediate Reload
IMR : Boolean := False;
-- Vertical Blanking Reload
VBR : Boolean := False;
-- unspecified
Reserved_2_31 : HAL.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SRCR_Register use record
IMR at 0 range 0 .. 0;
VBR at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
subtype BCCR_BC_Field is HAL.UInt24;
-- Background Color Configuration Register
type BCCR_Register is record
-- Background Color Red value
BC : BCCR_BC_Field := 16#0#;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BCCR_Register use record
BC at 0 range 0 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
-- Interrupt Enable Register
type IER_Register is record
-- Line Interrupt Enable
LIE : Boolean := False;
-- FIFO Underrun Interrupt Enable
FUIE : Boolean := False;
-- Transfer Error Interrupt Enable
TERRIE : Boolean := False;
-- Register Reload interrupt enable
RRIE : 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 IER_Register use record
LIE at 0 range 0 .. 0;
FUIE at 0 range 1 .. 1;
TERRIE at 0 range 2 .. 2;
RRIE at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-- Interrupt Status Register
type ISR_Register is record
-- Read-only. Line Interrupt flag
LIF : Boolean;
-- Read-only. FIFO Underrun Interrupt flag
FUIF : Boolean;
-- Read-only. Transfer Error interrupt flag
TERRIF : Boolean;
-- Read-only. Register Reload Interrupt Flag
RRIF : Boolean;
-- unspecified
Reserved_4_31 : HAL.UInt28;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ISR_Register use record
LIF at 0 range 0 .. 0;
FUIF at 0 range 1 .. 1;
TERRIF at 0 range 2 .. 2;
RRIF at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-- Interrupt Clear Register
type ICR_Register is record
-- Write-only. Clears the Line Interrupt Flag
CLIF : Boolean := False;
-- Write-only. Clears the FIFO Underrun Interrupt flag
CFUIF : Boolean := False;
-- Write-only. Clears the Transfer Error Interrupt Flag
CTERRIF : Boolean := False;
-- Write-only. Clears Register Reload Interrupt Flag
CRRIF : 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 ICR_Register use record
CLIF at 0 range 0 .. 0;
CFUIF at 0 range 1 .. 1;
CTERRIF at 0 range 2 .. 2;
CRRIF at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
subtype LIPCR_LIPOS_Field is HAL.UInt11;
-- Line Interrupt Position Configuration Register
type LIPCR_Register is record
-- Line Interrupt Position
LIPOS : LIPCR_LIPOS_Field := 16#0#;
-- unspecified
Reserved_11_31 : HAL.UInt21 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for LIPCR_Register use record
LIPOS at 0 range 0 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
subtype CPSR_CYPOS_Field is HAL.UInt16;
subtype CPSR_CXPOS_Field is HAL.UInt16;
-- Current Position Status Register
type CPSR_Register is record
-- Read-only. Current Y Position
CYPOS : CPSR_CYPOS_Field;
-- Read-only. Current X Position
CXPOS : CPSR_CXPOS_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CPSR_Register use record
CYPOS at 0 range 0 .. 15;
CXPOS at 0 range 16 .. 31;
end record;
-- Current Display Status Register
type CDSR_Register is record
-- Read-only. Vertical Data Enable display Status
VDES : Boolean;
-- Read-only. Horizontal Data Enable display Status
HDES : Boolean;
-- Read-only. Vertical Synchronization display Status
VSYNCS : Boolean;
-- Read-only. Horizontal Synchronization display Status
HSYNCS : Boolean;
-- unspecified
Reserved_4_31 : HAL.UInt28;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CDSR_Register use record
VDES at 0 range 0 .. 0;
HDES at 0 range 1 .. 1;
VSYNCS at 0 range 2 .. 2;
HSYNCS at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-- Layerx Control Register
type L1CR_Register is record
-- Layer Enable
LEN : Boolean := False;
-- Color Keying Enable
COLKEN : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- Color Look-Up Table Enable
CLUTEN : Boolean := False;
-- unspecified
Reserved_5_31 : HAL.UInt27 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L1CR_Register use record
LEN at 0 range 0 .. 0;
COLKEN at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
CLUTEN at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
subtype L1WHPCR_WHSTPOS_Field is HAL.UInt12;
subtype L1WHPCR_WHSPPOS_Field is HAL.UInt12;
-- Layerx Window Horizontal Position Configuration Register
type L1WHPCR_Register is record
-- Window Horizontal Start Position
WHSTPOS : L1WHPCR_WHSTPOS_Field := 16#0#;
-- unspecified
Reserved_12_15 : HAL.UInt4 := 16#0#;
-- Window Horizontal Stop Position
WHSPPOS : L1WHPCR_WHSPPOS_Field := 16#0#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L1WHPCR_Register use record
WHSTPOS at 0 range 0 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
WHSPPOS at 0 range 16 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype L1WVPCR_WVSTPOS_Field is HAL.UInt11;
subtype L1WVPCR_WVSPPOS_Field is HAL.UInt11;
-- Layerx Window Vertical Position Configuration Register
type L1WVPCR_Register is record
-- Window Vertical Start Position
WVSTPOS : L1WVPCR_WVSTPOS_Field := 16#0#;
-- unspecified
Reserved_11_15 : HAL.UInt5 := 16#0#;
-- Window Vertical Stop Position
WVSPPOS : L1WVPCR_WVSPPOS_Field := 16#0#;
-- unspecified
Reserved_27_31 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L1WVPCR_Register use record
WVSTPOS at 0 range 0 .. 10;
Reserved_11_15 at 0 range 11 .. 15;
WVSPPOS at 0 range 16 .. 26;
Reserved_27_31 at 0 range 27 .. 31;
end record;
subtype L1CKCR_CKBLUE_Field is HAL.UInt8;
subtype L1CKCR_CKGREEN_Field is HAL.UInt8;
subtype L1CKCR_CKRED_Field is HAL.UInt8;
-- Layerx Color Keying Configuration Register
type L1CKCR_Register is record
-- Color Key Blue value
CKBLUE : L1CKCR_CKBLUE_Field := 16#0#;
-- Color Key Green value
CKGREEN : L1CKCR_CKGREEN_Field := 16#0#;
-- Color Key Red value
CKRED : L1CKCR_CKRED_Field := 16#0#;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L1CKCR_Register use record
CKBLUE at 0 range 0 .. 7;
CKGREEN at 0 range 8 .. 15;
CKRED at 0 range 16 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype L1PFCR_PF_Field is HAL.UInt3;
-- Layerx Pixel Format Configuration Register
type L1PFCR_Register is record
-- Pixel Format
PF : L1PFCR_PF_Field := 16#0#;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L1PFCR_Register use record
PF at 0 range 0 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype L1CACR_CONSTA_Field is HAL.UInt8;
-- Layerx Constant Alpha Configuration Register
type L1CACR_Register is record
-- Constant Alpha
CONSTA : L1CACR_CONSTA_Field := 16#0#;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L1CACR_Register use record
CONSTA at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype L1DCCR_DCBLUE_Field is HAL.UInt8;
subtype L1DCCR_DCGREEN_Field is HAL.UInt8;
subtype L1DCCR_DCRED_Field is HAL.UInt8;
subtype L1DCCR_DCALPHA_Field is HAL.UInt8;
-- Layerx Default Color Configuration Register
type L1DCCR_Register is record
-- Default Color Blue
DCBLUE : L1DCCR_DCBLUE_Field := 16#0#;
-- Default Color Green
DCGREEN : L1DCCR_DCGREEN_Field := 16#0#;
-- Default Color Red
DCRED : L1DCCR_DCRED_Field := 16#0#;
-- Default Color Alpha
DCALPHA : L1DCCR_DCALPHA_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L1DCCR_Register use record
DCBLUE at 0 range 0 .. 7;
DCGREEN at 0 range 8 .. 15;
DCRED at 0 range 16 .. 23;
DCALPHA at 0 range 24 .. 31;
end record;
subtype L1BFCR_BF2_Field is HAL.UInt3;
subtype L1BFCR_BF1_Field is HAL.UInt3;
-- Layerx Blending Factors Configuration Register
type L1BFCR_Register is record
-- Blending Factor 2
BF2 : L1BFCR_BF2_Field := 16#7#;
-- unspecified
Reserved_3_7 : HAL.UInt5 := 16#0#;
-- Blending Factor 1
BF1 : L1BFCR_BF1_Field := 16#6#;
-- unspecified
Reserved_11_31 : HAL.UInt21 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L1BFCR_Register use record
BF2 at 0 range 0 .. 2;
Reserved_3_7 at 0 range 3 .. 7;
BF1 at 0 range 8 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
subtype L1CFBLR_CFBLL_Field is HAL.UInt13;
subtype L1CFBLR_CFBP_Field is HAL.UInt13;
-- Layerx Color Frame Buffer Length Register
type L1CFBLR_Register is record
-- Color Frame Buffer Line Length
CFBLL : L1CFBLR_CFBLL_Field := 16#0#;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
-- Color Frame Buffer Pitch in bytes
CFBP : L1CFBLR_CFBP_Field := 16#0#;
-- unspecified
Reserved_29_31 : HAL.UInt3 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L1CFBLR_Register use record
CFBLL at 0 range 0 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
CFBP at 0 range 16 .. 28;
Reserved_29_31 at 0 range 29 .. 31;
end record;
subtype L1CFBLNR_CFBLNBR_Field is HAL.UInt11;
-- Layerx ColorFrame Buffer Line Number Register
type L1CFBLNR_Register is record
-- Frame Buffer Line Number
CFBLNBR : L1CFBLNR_CFBLNBR_Field := 16#0#;
-- unspecified
Reserved_11_31 : HAL.UInt21 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L1CFBLNR_Register use record
CFBLNBR at 0 range 0 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
subtype L1CLUTWR_BLUE_Field is HAL.UInt8;
subtype L1CLUTWR_GREEN_Field is HAL.UInt8;
subtype L1CLUTWR_RED_Field is HAL.UInt8;
subtype L1CLUTWR_CLUTADD_Field is HAL.UInt8;
-- Layerx CLUT Write Register
type L1CLUTWR_Register is record
-- Write-only. Blue value
BLUE : L1CLUTWR_BLUE_Field := 16#0#;
-- Write-only. Green value
GREEN : L1CLUTWR_GREEN_Field := 16#0#;
-- Write-only. Red value
RED : L1CLUTWR_RED_Field := 16#0#;
-- Write-only. CLUT Address
CLUTADD : L1CLUTWR_CLUTADD_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L1CLUTWR_Register use record
BLUE at 0 range 0 .. 7;
GREEN at 0 range 8 .. 15;
RED at 0 range 16 .. 23;
CLUTADD at 0 range 24 .. 31;
end record;
-- Layerx Control Register
type L2CR_Register is record
-- Layer Enable
LEN : Boolean := False;
-- Color Keying Enable
COLKEN : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- Color Look-Up Table Enable
CLUTEN : Boolean := False;
-- unspecified
Reserved_5_31 : HAL.UInt27 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L2CR_Register use record
LEN at 0 range 0 .. 0;
COLKEN at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
CLUTEN at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
subtype L2WHPCR_WHSTPOS_Field is HAL.UInt12;
subtype L2WHPCR_WHSPPOS_Field is HAL.UInt12;
-- Layerx Window Horizontal Position Configuration Register
type L2WHPCR_Register is record
-- Window Horizontal Start Position
WHSTPOS : L2WHPCR_WHSTPOS_Field := 16#0#;
-- unspecified
Reserved_12_15 : HAL.UInt4 := 16#0#;
-- Window Horizontal Stop Position
WHSPPOS : L2WHPCR_WHSPPOS_Field := 16#0#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L2WHPCR_Register use record
WHSTPOS at 0 range 0 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
WHSPPOS at 0 range 16 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype L2WVPCR_WVSTPOS_Field is HAL.UInt11;
subtype L2WVPCR_WVSPPOS_Field is HAL.UInt11;
-- Layerx Window Vertical Position Configuration Register
type L2WVPCR_Register is record
-- Window Vertical Start Position
WVSTPOS : L2WVPCR_WVSTPOS_Field := 16#0#;
-- unspecified
Reserved_11_15 : HAL.UInt5 := 16#0#;
-- Window Vertical Stop Position
WVSPPOS : L2WVPCR_WVSPPOS_Field := 16#0#;
-- unspecified
Reserved_27_31 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L2WVPCR_Register use record
WVSTPOS at 0 range 0 .. 10;
Reserved_11_15 at 0 range 11 .. 15;
WVSPPOS at 0 range 16 .. 26;
Reserved_27_31 at 0 range 27 .. 31;
end record;
subtype L2CKCR_CKBLUE_Field is HAL.UInt8;
subtype L2CKCR_CKGREEN_Field is HAL.UInt7;
subtype L2CKCR_CKRED_Field is HAL.UInt9;
-- Layerx Color Keying Configuration Register
type L2CKCR_Register is record
-- Color Key Blue value
CKBLUE : L2CKCR_CKBLUE_Field := 16#0#;
-- Color Key Green value
CKGREEN : L2CKCR_CKGREEN_Field := 16#0#;
-- Color Key Red value
CKRED : L2CKCR_CKRED_Field := 16#0#;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L2CKCR_Register use record
CKBLUE at 0 range 0 .. 7;
CKGREEN at 0 range 8 .. 14;
CKRED at 0 range 15 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype L2PFCR_PF_Field is HAL.UInt3;
-- Layerx Pixel Format Configuration Register
type L2PFCR_Register is record
-- Pixel Format
PF : L2PFCR_PF_Field := 16#0#;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L2PFCR_Register use record
PF at 0 range 0 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype L2CACR_CONSTA_Field is HAL.UInt8;
-- Layerx Constant Alpha Configuration Register
type L2CACR_Register is record
-- Constant Alpha
CONSTA : L2CACR_CONSTA_Field := 16#0#;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L2CACR_Register use record
CONSTA at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype L2DCCR_DCBLUE_Field is HAL.UInt8;
subtype L2DCCR_DCGREEN_Field is HAL.UInt8;
subtype L2DCCR_DCRED_Field is HAL.UInt8;
subtype L2DCCR_DCALPHA_Field is HAL.UInt8;
-- Layerx Default Color Configuration Register
type L2DCCR_Register is record
-- Default Color Blue
DCBLUE : L2DCCR_DCBLUE_Field := 16#0#;
-- Default Color Green
DCGREEN : L2DCCR_DCGREEN_Field := 16#0#;
-- Default Color Red
DCRED : L2DCCR_DCRED_Field := 16#0#;
-- Default Color Alpha
DCALPHA : L2DCCR_DCALPHA_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L2DCCR_Register use record
DCBLUE at 0 range 0 .. 7;
DCGREEN at 0 range 8 .. 15;
DCRED at 0 range 16 .. 23;
DCALPHA at 0 range 24 .. 31;
end record;
subtype L2BFCR_BF2_Field is HAL.UInt3;
subtype L2BFCR_BF1_Field is HAL.UInt3;
-- Layerx Blending Factors Configuration Register
type L2BFCR_Register is record
-- Blending Factor 2
BF2 : L2BFCR_BF2_Field := 16#7#;
-- unspecified
Reserved_3_7 : HAL.UInt5 := 16#0#;
-- Blending Factor 1
BF1 : L2BFCR_BF1_Field := 16#6#;
-- unspecified
Reserved_11_31 : HAL.UInt21 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L2BFCR_Register use record
BF2 at 0 range 0 .. 2;
Reserved_3_7 at 0 range 3 .. 7;
BF1 at 0 range 8 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
subtype L2CFBLR_CFBLL_Field is HAL.UInt13;
subtype L2CFBLR_CFBP_Field is HAL.UInt13;
-- Layerx Color Frame Buffer Length Register
type L2CFBLR_Register is record
-- Color Frame Buffer Line Length
CFBLL : L2CFBLR_CFBLL_Field := 16#0#;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
-- Color Frame Buffer Pitch in bytes
CFBP : L2CFBLR_CFBP_Field := 16#0#;
-- unspecified
Reserved_29_31 : HAL.UInt3 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L2CFBLR_Register use record
CFBLL at 0 range 0 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
CFBP at 0 range 16 .. 28;
Reserved_29_31 at 0 range 29 .. 31;
end record;
subtype L2CFBLNR_CFBLNBR_Field is HAL.UInt11;
-- Layerx ColorFrame Buffer Line Number Register
type L2CFBLNR_Register is record
-- Frame Buffer Line Number
CFBLNBR : L2CFBLNR_CFBLNBR_Field := 16#0#;
-- unspecified
Reserved_11_31 : HAL.UInt21 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L2CFBLNR_Register use record
CFBLNBR at 0 range 0 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
subtype L2CLUTWR_BLUE_Field is HAL.UInt8;
subtype L2CLUTWR_GREEN_Field is HAL.UInt8;
subtype L2CLUTWR_RED_Field is HAL.UInt8;
subtype L2CLUTWR_CLUTADD_Field is HAL.UInt8;
-- Layerx CLUT Write Register
type L2CLUTWR_Register is record
-- Write-only. Blue value
BLUE : L2CLUTWR_BLUE_Field := 16#0#;
-- Write-only. Green value
GREEN : L2CLUTWR_GREEN_Field := 16#0#;
-- Write-only. Red value
RED : L2CLUTWR_RED_Field := 16#0#;
-- Write-only. CLUT Address
CLUTADD : L2CLUTWR_CLUTADD_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for L2CLUTWR_Register use record
BLUE at 0 range 0 .. 7;
GREEN at 0 range 8 .. 15;
RED at 0 range 16 .. 23;
CLUTADD at 0 range 24 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- LCD-TFT Controller
type LTDC_Peripheral is record
-- Synchronization Size Configuration Register
SSCR : aliased SSCR_Register;
-- Back Porch Configuration Register
BPCR : aliased BPCR_Register;
-- Active Width Configuration Register
AWCR : aliased AWCR_Register;
-- Total Width Configuration Register
TWCR : aliased TWCR_Register;
-- Global Control Register
GCR : aliased GCR_Register;
-- Shadow Reload Configuration Register
SRCR : aliased SRCR_Register;
-- Background Color Configuration Register
BCCR : aliased BCCR_Register;
-- Interrupt Enable Register
IER : aliased IER_Register;
-- Interrupt Status Register
ISR : aliased ISR_Register;
-- Interrupt Clear Register
ICR : aliased ICR_Register;
-- Line Interrupt Position Configuration Register
LIPCR : aliased LIPCR_Register;
-- Current Position Status Register
CPSR : aliased CPSR_Register;
-- Current Display Status Register
CDSR : aliased CDSR_Register;
-- Layerx Control Register
L1CR : aliased L1CR_Register;
-- Layerx Window Horizontal Position Configuration Register
L1WHPCR : aliased L1WHPCR_Register;
-- Layerx Window Vertical Position Configuration Register
L1WVPCR : aliased L1WVPCR_Register;
-- Layerx Color Keying Configuration Register
L1CKCR : aliased L1CKCR_Register;
-- Layerx Pixel Format Configuration Register
L1PFCR : aliased L1PFCR_Register;
-- Layerx Constant Alpha Configuration Register
L1CACR : aliased L1CACR_Register;
-- Layerx Default Color Configuration Register
L1DCCR : aliased L1DCCR_Register;
-- Layerx Blending Factors Configuration Register
L1BFCR : aliased L1BFCR_Register;
-- Layerx Color Frame Buffer Address Register
L1CFBAR : aliased HAL.UInt32;
-- Layerx Color Frame Buffer Length Register
L1CFBLR : aliased L1CFBLR_Register;
-- Layerx ColorFrame Buffer Line Number Register
L1CFBLNR : aliased L1CFBLNR_Register;
-- Layerx CLUT Write Register
L1CLUTWR : aliased L1CLUTWR_Register;
-- Layerx Control Register
L2CR : aliased L2CR_Register;
-- Layerx Window Horizontal Position Configuration Register
L2WHPCR : aliased L2WHPCR_Register;
-- Layerx Window Vertical Position Configuration Register
L2WVPCR : aliased L2WVPCR_Register;
-- Layerx Color Keying Configuration Register
L2CKCR : aliased L2CKCR_Register;
-- Layerx Pixel Format Configuration Register
L2PFCR : aliased L2PFCR_Register;
-- Layerx Constant Alpha Configuration Register
L2CACR : aliased L2CACR_Register;
-- Layerx Default Color Configuration Register
L2DCCR : aliased L2DCCR_Register;
-- Layerx Blending Factors Configuration Register
L2BFCR : aliased L2BFCR_Register;
-- Layerx Color Frame Buffer Address Register
L2CFBAR : aliased HAL.UInt32;
-- Layerx Color Frame Buffer Length Register
L2CFBLR : aliased L2CFBLR_Register;
-- Layerx ColorFrame Buffer Line Number Register
L2CFBLNR : aliased L2CFBLNR_Register;
-- Layerx CLUT Write Register
L2CLUTWR : aliased L2CLUTWR_Register;
end record
with Volatile;
for LTDC_Peripheral use record
SSCR at 16#8# range 0 .. 31;
BPCR at 16#C# range 0 .. 31;
AWCR at 16#10# range 0 .. 31;
TWCR at 16#14# range 0 .. 31;
GCR at 16#18# range 0 .. 31;
SRCR at 16#24# range 0 .. 31;
BCCR at 16#2C# range 0 .. 31;
IER at 16#34# range 0 .. 31;
ISR at 16#38# range 0 .. 31;
ICR at 16#3C# range 0 .. 31;
LIPCR at 16#40# range 0 .. 31;
CPSR at 16#44# range 0 .. 31;
CDSR at 16#48# range 0 .. 31;
L1CR at 16#84# range 0 .. 31;
L1WHPCR at 16#88# range 0 .. 31;
L1WVPCR at 16#8C# range 0 .. 31;
L1CKCR at 16#90# range 0 .. 31;
L1PFCR at 16#94# range 0 .. 31;
L1CACR at 16#98# range 0 .. 31;
L1DCCR at 16#9C# range 0 .. 31;
L1BFCR at 16#A0# range 0 .. 31;
L1CFBAR at 16#AC# range 0 .. 31;
L1CFBLR at 16#B0# range 0 .. 31;
L1CFBLNR at 16#B4# range 0 .. 31;
L1CLUTWR at 16#C4# range 0 .. 31;
L2CR at 16#104# range 0 .. 31;
L2WHPCR at 16#108# range 0 .. 31;
L2WVPCR at 16#10C# range 0 .. 31;
L2CKCR at 16#110# range 0 .. 31;
L2PFCR at 16#114# range 0 .. 31;
L2CACR at 16#118# range 0 .. 31;
L2DCCR at 16#11C# range 0 .. 31;
L2BFCR at 16#120# range 0 .. 31;
L2CFBAR at 16#12C# range 0 .. 31;
L2CFBLR at 16#130# range 0 .. 31;
L2CFBLNR at 16#134# range 0 .. 31;
L2CLUTWR at 16#144# range 0 .. 31;
end record;
-- LCD-TFT Controller
LTDC_Periph : aliased LTDC_Peripheral
with Import, Address => System'To_Address (16#40016800#);
end STM32_SVD.LTDC;
|
reznikmm/matreshka | Ada | 4,744 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Table.Use_Banding_Columns_Styles_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Table_Use_Banding_Columns_Styles_Attribute_Node is
begin
return Self : Table_Use_Banding_Columns_Styles_Attribute_Node do
Matreshka.ODF_Table.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Table_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Table_Use_Banding_Columns_Styles_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Use_Banding_Columns_Styles_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Table_URI,
Matreshka.ODF_String_Constants.Use_Banding_Columns_Styles_Attribute,
Table_Use_Banding_Columns_Styles_Attribute_Node'Tag);
end Matreshka.ODF_Table.Use_Banding_Columns_Styles_Attributes;
|
reznikmm/gela | Ada | 2,171 | ads | with Ada.Containers.Hashed_Maps;
with Gela.Compilation_Unit_Sets;
with Gela.Compilation_Units;
with Gela.Lexical_Types;
package Gela.Plain_Compilation_Unit_Sets is
pragma Preelaborate;
type Compilation_Unit_Set is
limited new Gela.Compilation_Unit_Sets.Compilation_Unit_Set with private;
type Compilation_Unit_Set_Access is access all Compilation_Unit_Set'Class;
not overriding procedure Add
(Self : in out Compilation_Unit_Set;
Item : Gela.Compilation_Units.Compilation_Unit_Access);
-- Add compilation unit into set.
private
function Hash
(Item : Gela.Lexical_Types.Symbol) return Ada.Containers.Hash_Type;
package Maps is new Ada.Containers.Hashed_Maps
(Key_Type => Gela.Lexical_Types.Symbol,
Element_Type => Gela.Compilation_Units.Compilation_Unit_Access,
Hash => Hash,
Equivalent_Keys => Gela.Lexical_Types."=",
"=" => Gela.Compilation_Units."=");
type Compilation_Unit_Set is
limited new Gela.Compilation_Unit_Sets.Compilation_Unit_Set with
record
Map : Maps.Map;
end record;
type Compilation_Unit_Cursor is
new Gela.Compilation_Unit_Sets.Compilation_Unit_Cursor with
record
Value : Maps.Cursor;
end record;
type Compilation_Unit_Cursor_Access is access all
Compilation_Unit_Cursor'Class;
overriding function Is_Empty
(Self : Compilation_Unit_Set) return Boolean;
overriding function Length
(Self : Compilation_Unit_Set) return Natural;
overriding function Find
(Self : Compilation_Unit_Set;
Symbol : Gela.Lexical_Types.Symbol)
return Gela.Compilation_Units.Compilation_Unit_Access;
overriding function First
(Self : Compilation_Unit_Set)
return Gela.Compilation_Unit_Sets.Compilation_Unit_Cursor'Class;
overriding function Has_Element
(Self : Compilation_Unit_Cursor)
return Boolean;
overriding function Element
(Self : Compilation_Unit_Cursor)
return Gela.Compilation_Units.Compilation_Unit_Access;
overriding procedure Next
(Self : in out Compilation_Unit_Cursor);
end Gela.Plain_Compilation_Unit_Sets;
|
jsonn/src | Ada | 3,336 | adb | ----------------------------------------------------------------
-- ZLib for Ada thick binding. --
-- --
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
-- --
-- Open source license information is in the zlib.ads file. --
----------------------------------------------------------------
-- $Id: zlib-thin.adb,v 1.1.1.2 2017/01/10 00:25:30 christos Exp $
package body ZLib.Thin is
ZLIB_VERSION : constant Chars_Ptr := zlibVersion;
Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit;
--------------
-- Avail_In --
--------------
function Avail_In (Strm : in Z_Stream) return UInt is
begin
return Strm.Avail_In;
end Avail_In;
---------------
-- Avail_Out --
---------------
function Avail_Out (Strm : in Z_Stream) return UInt is
begin
return Strm.Avail_Out;
end Avail_Out;
------------------
-- Deflate_Init --
------------------
function Deflate_Init
(strm : Z_Streamp;
level : Int;
method : Int;
windowBits : Int;
memLevel : Int;
strategy : Int)
return Int is
begin
return deflateInit2
(strm,
level,
method,
windowBits,
memLevel,
strategy,
ZLIB_VERSION,
Z_Stream_Size);
end Deflate_Init;
------------------
-- Inflate_Init --
------------------
function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int is
begin
return inflateInit2 (strm, windowBits, ZLIB_VERSION, Z_Stream_Size);
end Inflate_Init;
------------------------
-- Last_Error_Message --
------------------------
function Last_Error_Message (Strm : in Z_Stream) return String is
use Interfaces.C.Strings;
begin
if Strm.msg = Null_Ptr then
return "";
else
return Value (Strm.msg);
end if;
end Last_Error_Message;
------------
-- Set_In --
------------
procedure Set_In
(Strm : in out Z_Stream;
Buffer : in Voidp;
Size : in UInt) is
begin
Strm.Next_In := Buffer;
Strm.Avail_In := Size;
end Set_In;
------------------
-- Set_Mem_Func --
------------------
procedure Set_Mem_Func
(Strm : in out Z_Stream;
Opaque : in Voidp;
Alloc : in alloc_func;
Free : in free_func) is
begin
Strm.opaque := Opaque;
Strm.zalloc := Alloc;
Strm.zfree := Free;
end Set_Mem_Func;
-------------
-- Set_Out --
-------------
procedure Set_Out
(Strm : in out Z_Stream;
Buffer : in Voidp;
Size : in UInt) is
begin
Strm.Next_Out := Buffer;
Strm.Avail_Out := Size;
end Set_Out;
--------------
-- Total_In --
--------------
function Total_In (Strm : in Z_Stream) return ULong is
begin
return Strm.Total_In;
end Total_In;
---------------
-- Total_Out --
---------------
function Total_Out (Strm : in Z_Stream) return ULong is
begin
return Strm.Total_Out;
end Total_Out;
end ZLib.Thin;
|
justinjhendrick/learning-ada | Ada | 186 | adb | with Ada.Text_IO; use Ada.Text_IO;
procedure Inplace_Print is
begin
for i in 1 .. 10 loop
Put("count" & Integer'Image(i) & ASCII.CR);
delay 1.0;
end loop;
end Inplace_Print;
|
Blady-Com/Gate3 | Ada | 10,650 | adb | ------------------------------------------------------------------------------
--
-- Gate3 code sketcher :
--
-- Parse a Glade3's XML project file and generate the Ada code
-- to test User Interface.
--
-- Gate3 is limited in scope and does not generate User_Handler
-- callbacks. It is just a simple tool to avoid tedious typing.
--
-- Error messages are output on Standard_Output
-- Resulting Ada code is put in [glade-file-name].ada
-- Use gnatchop to generate *.ads and *.adb
------------------------------------------------------------------------------
--
-- Requires Ada libraries :
-- GtkAda : only for Glib
-- templates_parser
------------------------------------------------------------------------------
-- Legal licensing note:
--
-- Copyright (c) Francois Fabien 2012/2013/2016
-- FRANCE
--
-- Gate3 web site : https://sourceforge.net/projects/lorenz/
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
--
-- NB: this is the MIT License, as found 12-Sep-2007 on the site
-- http://www.opensource.org/licenses/mit-license.php
------------------------------------------------------------------------------
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Directories; use Ada.Directories;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Characters.Handling; use Ada.Characters.Handling;
with GNAT.Command_Line; use GNAT.Command_Line;
with GNAT.OS_Lib; use GNAT.OS_Lib;
with System.Assertions;
with Glade3_Generate; use Glade3_Generate;
procedure Gate3 is
package UBS renames Ada.Strings.Unbounded;
Version : constant String := "0.5 (8-Aug-2016)";
-- gate3 version and release date
Cmd : constant String := Ada.Command_Line.Command_Name;
-- command typed to launch gate3
InputFileName : UBS.String_Access := null;
-- file name passed at input
GladeFileName : UBS.String_Access := null;
-- complete input file name with optional input directory
Main_Proc_Name : UBS.String_Access := null;
-- The name of the main Ada procedure
-- By default will take the prefix of the glade file.
Input_Dir : UBS.String_Access := null;
-- optional input directory
Output_Dir : UBS.String_Access := null;
-- The directory where the resulting Ada file will be written
-- By default will be the directory of the input glade file
Template_Dir : UBS.String_Access := null;
-- The directory where the templates are read (default is current exec directory)
Create_Output_Dir : Boolean := False;
Option : Character;
procedure Clean_All is
-- garbage collection
procedure Clean (SA : in out UBS.String_Access) is
begin
if SA /= null then
Free (SA);
end if;
end Clean;
begin
Clean (InputFileName);
Clean (GladeFileName);
Clean (Main_Proc_Name);
Clean (Input_Dir);
Clean (Output_Dir);
end Clean_All;
procedure Print_Help is
begin
Put_Line ("Usage: gate3 [options] glade3-file");
Put_Line ("Options:");
Put_Line (" -h --help show this message");
Put_Line (" --version show version");
Put_Line (" -m proc_name Proc_Name : Ada main procedure name");
Put_Line (" -d some/dir search some/dir for input files");
Put_Line (" -o some/dir some/dir : directory for output");
Put_Line (" -t some/dir some/dir : directory for templates");
Put_Line (" -p create output directory");
New_Line;
end Print_Help;
procedure Usage is
begin
Put_Line ("Usage: " & Command_Name & " [options] glade3-file");
Put_Line ("Help: " & Command_Name & " --help");
New_Line;
end Usage;
begin
loop
begin
Option := GNAT.Command_Line.Getopt ("h -help -version m: d: o: t: p", False);
case Option is
when 'h' =>
Print_Help;
return;
when '-' =>
if Full_Switch = "-version" then
Put_Line (Version);
return;
elsif Full_Switch = "-help" then
Print_Help;
return;
else
Usage;
return;
end if;
when 'm' =>
Main_Proc_Name := new String'(To_Lower (Parameter));
when 'o' =>
Output_Dir := new String'(Parameter);
when 'd' =>
Input_Dir := new String'(Parameter);
when 't' =>
Template_Dir := new String'(Parameter);
when 'p' =>
Create_Output_Dir := True;
when others =>
null;
end case;
exit when Option = ASCII.NUL;
exception
when GNAT.Command_Line.Invalid_Switch =>
Put_Line ("Unknown option [" & Full_Switch & "] ! Ignoring.");
end;
end loop;
-- Find where the gate3 exec file is.
-- Or find in Template_Dir if set.
--
--
declare
Gate3_Path : GNAT.OS_Lib.String_Access := GNAT.OS_Lib.Locate_Exec_On_Path (Cmd);
begin
if Template_Dir /= null then
Set_Template_Dir (Template_Dir.all);
-- setup the path where gate3 will find templates gate3_xxx.tmplt
elsif Gate3_Path = null then
Put_Line ("Could not locate gate3 on Path ! stopping.");
raise Program_Error;
else
Set_Template_Dir (Ada.Directories.Containing_Directory (Gate3_Path.all));
-- setup the path where gate3 will find templates gate3_xxx.tmplt
GNAT.OS_Lib.Free (Gate3_Path);
end if;
end;
InputFileName := new String'(Get_Argument);
if InputFileName.all = "" then
Put_Line ("Gate3 Error : Missing glade-file.");
Usage;
Clean_All;
Set_Exit_Status (1);
return;
end if;
if Input_Dir = null then
Input_Dir := new String'("");
GladeFileName := new String'(InputFileName.all);
elsif Input_Dir.all = "" then
GladeFileName := new String'(InputFileName.all);
elsif Ada.Directories.Exists (Input_Dir.all) then
if (Ada.Directories.Kind (Input_Dir.all) = Directory) then
GladeFileName :=
new String'
(Compose
(Input_Dir.all,
Base_Name (InputFileName.all),
Extension (InputFileName.all)));
else
Put_Line ("Gate3 Error : input parameter [" & Input_Dir.all & "] is not a directory.");
Clean_All;
Set_Exit_Status (1);
return;
end if;
else
Put_Line ("Gate3 Error : input directory [" & Input_Dir.all & "] does not exist.");
Clean_All;
Set_Exit_Status (1);
return;
end if;
if not Ada.Directories.Exists (GladeFileName.all) then
Put_Line ("Gate3 Error : file [" & GladeFileName.all & "] does not exist.");
Clean_All;
Set_Exit_Status (1);
return;
end if;
if Main_Proc_Name = null then
Main_Proc_Name := new String'("");
end if;
-- checks on the output directory
if Output_Dir = null then
Output_Dir := new String'("");
else
if not Ada.Directories.Exists (Output_Dir.all) then
if Create_Output_Dir then
begin
Ada.Directories.Create_Directory (Output_Dir.all);
exception
when E : others =>
Put_Line ("Exception = " & Exception_Name (E));
Put_Line ("Gate3 Error : Invalid directory name [" & Output_Dir.all & "].");
Clean_All;
Set_Exit_Status (2);
return;
end;
else
Put_Line ("Gate3 Error : Output directory [" & Output_Dir.all & "] does not exist.");
Clean_All;
Set_Exit_Status (2);
return;
end if;
else
-- output dir exists, stops when it is not a dir
if not (Ada.Directories.Kind (Output_Dir.all) = Directory) then
Put_Line ("Gate3 Error : [" & Output_Dir.all & "] is not a directory.");
Clean_All;
Set_Exit_Status (2);
return;
end if;
end if;
end if;
Generate (GladeFileName.all, Project_Name => Main_Proc_Name.all, Output_Dir => Output_Dir.all);
Put_Line ("Gate3 v" & Version & " | Your file has been successfully processed.");
Clean_All;
exception
when System.Assertions.Assert_Failure =>
Put_Line ("gate3 Error : the XML file seems corrupted.");
Put_Line ("Please check it up manually, and try again");
Clean_All;
Set_Exit_Status (2);
when E : Glade3_Generate.Old_Version =>
Put_Line (Exception_Message (E));
Put_Line ("Version of Glade file is too old");
Put_Line ("Use Version 2.24 of GTK and Glade 3.8.");
Clean_All;
Set_Exit_Status (2);
when E : Glade3_Generate.Bad_Xml =>
Put_Line (Exception_Message (E));
Put_Line ("Glade Xml file could not be processed");
Clean_All;
Set_Exit_Status (2);
when E : others =>
Put_Line ("Exception = " & Exception_Name (E));
Put_Line ("Message = " & Exception_Message (E));
Put_Line ("gate3 : Internal error.");
Put_Line
("Please send a bug report with the XML file " &
" and the GtkAda version to [email protected]");
Clean_All;
Set_Exit_Status (2);
end Gate3;
|
mfkiwl/ewok-kernel-security-OS | Ada | 10,045 | ads | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with ewok.tasks_shared; use ewok.tasks_shared;
with ewok.devices_shared; use ewok.devices_shared;
with ewok.ipc;
with ewok.exported.dma;
with ewok.dma_shared;
with soc;
with soc.layout;
package ewok.tasks
with spark_mode => on
is
subtype t_task_name is string (1 .. 10);
type t_task_state is (
-- No task
TASK_STATE_EMPTY,
-- Task can be elected by the scheduler with its standard priority
-- or an ISR is ready for execution
TASK_STATE_RUNNABLE,
-- Force the scheduler to choose that task
TASK_STATE_FORCED,
-- Pending syscall. Task can't be scheduled.
TASK_STATE_SVC_BLOCKED,
-- An ISR is finished
TASK_STATE_ISR_DONE,
-- Task currently has nothing to do, not schedulable
TASK_STATE_IDLE,
-- Task is sleeping
TASK_STATE_SLEEPING,
-- Task is deeply sleeping
TASK_STATE_SLEEPING_DEEP,
-- Task has generated an exception (memory fault, etc.), not
-- schedulable anymore
TASK_STATE_FAULT,
-- Task has return from its main() function. Yet its ISR handlers can
-- still be executed if needed
TASK_STATE_FINISHED,
-- Task has emitted a blocking send() and is waiting for the
-- receiver to emit a recv()
TASK_STATE_IPC_SEND_BLOCKED,
-- Task has emitted a blocking recv() and is waiting for a message
TASK_STATE_IPC_RECV_BLOCKED,
-- Task has emitted a blocking send() and is waiting an
-- acknowledgement after the message has been received
TASK_STATE_IPC_WAIT_ACK,
-- Task has entered in a critical section. Related ISRs can't be executed
TASK_STATE_LOCKED);
type t_task_type is
(-- Kernel task
TASK_TYPE_KERNEL,
-- User task, being executed in user mode, with restricted access
TASK_TYPE_USER);
type t_main_context is record
frame_a : ewok.t_stack_frame_access := NULL;
end record;
type t_isr_context is record
entry_point : system_address := 0;
device_id : ewok.devices_shared.t_device_id := ID_DEV_UNUSED;
sched_policy : ewok.tasks_shared.t_scheduling_post_isr := ISR_STANDARD;
frame_a : ewok.t_stack_frame_access := NULL;
end record;
--
-- Tasks
--
MAX_DEVS_PER_TASK : constant := 10;
MAX_DMAS_PER_TASK : constant := 8;
MAX_INTERRUPTS_PER_TASK : constant := 8;
MAX_DMA_SHM_PER_TASK : constant := 4;
type t_registered_dma_index_list is array (unsigned_32 range <>) of
ewok.dma_shared.t_user_dma_index
with default_component_value => ewok.dma_shared.ID_DMA_UNUSED;
type t_dma_shm_info_list is array (unsigned_32 range <>) of
ewok.exported.dma.t_dma_shm_info;
type t_device is record
device_id : ewok.devices_shared.t_device_id := ID_DEV_UNUSED;
mounted : boolean := false;
end record;
type t_device_list is array (unsigned_8 range <>) of t_device;
type t_ipc_endpoint_id_list is array (ewok.tasks_shared.t_task_id) of
ewok.ipc.t_extended_endpoint_id
with default_component_value => ewok.ipc.ID_ENDPOINT_UNUSED;
type t_task is record
name : t_task_name := " ";
entry_point : system_address := 0;
ttype : t_task_type := TASK_TYPE_USER;
mode : t_task_mode := TASK_MODE_MAINTHREAD;
id : ewok.tasks_shared.t_task_id := ID_UNUSED;
prio : unsigned_8 := 0;
#if CONFIG_KERNEL_DOMAIN
domain : unsigned_8 := 0;
#end if;
#if CONFIG_KERNEL_SCHED_DEBUG
count : unsigned_32 := 0;
force_count : unsigned_32 := 0;
isr_count : unsigned_32 := 0;
#end if;
num_dma_shms : unsigned_32 range 0 .. MAX_DMA_SHM_PER_TASK := 0;
dma_shm : t_dma_shm_info_list (1 .. MAX_DMA_SHM_PER_TASK);
num_dma_id : unsigned_32 range 0 .. MAX_DMAS_PER_TASK := 0;
dma_id : t_registered_dma_index_list (1 .. MAX_DMAS_PER_TASK);
num_devs : unsigned_8 range 0 .. MAX_DEVS_PER_TASK := 0;
devices : t_device_list (1 .. MAX_DEVS_PER_TASK);
init_done : boolean := false;
data_start : system_address := 0;
data_end : system_address := 0;
txt_start : system_address := 0;
txt_end : system_address := 0;
stack_bottom : system_address := 0;
stack_top : system_address := 0;
stack_size : unsigned_16 := 0;
state : t_task_state := TASK_STATE_EMPTY;
isr_state : t_task_state := TASK_STATE_EMPTY;
ipc_endpoint_id : t_ipc_endpoint_id_list;
ctx : aliased t_main_context;
isr_ctx : aliased t_isr_context;
end record;
type t_task_array is array (t_task_id range <>) of aliased t_task;
-------------
-- Globals --
-------------
-- The list of the running tasks
tasks_list : t_task_array (ID_APP1 .. ID_KERNEL);
softirq_task_name : aliased t_task_name := "SOFTIRQ" & " ";
idle_task_name : aliased t_task_name := "IDLE" & " ";
---------------
-- Functions --
---------------
pragma assertion_policy (pre => IGNORE, post => IGNORE, assert => IGNORE);
procedure idle_task with no_return;
procedure finished_task with no_return;
-- create various task's stack
-- preconditions :
-- Here we check that generated headers, defining stack address and
-- program counter of various stack are valid for the currently
-- supported SoC. This is a sanitizing function for generated files.
procedure create_stack
(sp : in system_address;
pc : in system_address;
params : in ewok.t_parameters;
frame_a : out ewok.t_stack_frame_access)
with
-- precondition 1 : stack pointer must be in RAM
pre =>
(
(sp >= soc.layout.USER_RAM_BASE and
sp <= (soc.layout.USER_RAM_BASE + soc.layout.USER_RAM_SIZE)) or
(sp >= soc.layout.KERNEL_RAM_BASE and
sp <= (soc.layout.KERNEL_RAM_BASE + soc.layout.KERNEL_RAM_SIZE))
) and (
-- precondition 2 : program counter must be in flash
pc >= soc.layout.FLASH_BASE and
pc <= soc.layout.FLASH_BASE + soc.layout.FLASH_SIZE
),
global => ( in_out => tasks_list );
procedure set_default_values (tsk : out t_task);
procedure init_softirq_task;
procedure init_idle_task;
procedure init_apps;
function is_real_user (id : ewok.tasks_shared.t_task_id) return boolean
with inline_always;
#if CONFIG_KERNEL_DOMAIN
function get_domain (id : in ewok.tasks_shared.t_task_id)
return unsigned_8
with inline;
#end if;
function get_task_id (name : t_task_name)
return ewok.tasks_shared.t_task_id;
procedure set_state
(id : ewok.tasks_shared.t_task_id;
mode : t_task_mode;
state : t_task_state)
with inline;
function get_state
(id : ewok.tasks_shared.t_task_id;
mode : t_task_mode)
return t_task_state
with inline;
function get_mode
(id : in ewok.tasks_shared.t_task_id)
return t_task_mode
with
inline,
global => null;
procedure set_mode
(id : in ewok.tasks_shared.t_task_id;
mode : in ewok.tasks_shared.t_task_mode)
with
inline,
global => ( in_out => tasks_list );
function is_ipc_waiting
(id : in ewok.tasks_shared.t_task_id)
return boolean;
-- Set return value inside a syscall
-- Note: mode must be defined as a task can do a syscall while in ISR mode
-- or in THREAD mode
procedure set_return_value
(id : in ewok.tasks_shared.t_task_id;
mode : in t_task_mode;
val : in unsigned_32)
with inline;
procedure task_init
with
global => null;
function is_init_done
(id : ewok.tasks_shared.t_task_id)
return boolean;
procedure append_device
(id : in ewok.tasks_shared.t_task_id;
dev_id : in ewok.devices_shared.t_device_id;
descriptor : out unsigned_8;
success : out boolean)
with
post => (if success = false then
descriptor = 0
else
descriptor > 0 and
descriptor < tasks_list(id).devices'last);
procedure remove_device
(id : in ewok.tasks_shared.t_task_id;
dev_descriptor : in unsigned_8);
function is_mounted
(id : in ewok.tasks_shared.t_task_id;
dev_descriptor : in unsigned_8)
return boolean;
procedure mount_device
(id : in ewok.tasks_shared.t_task_id;
dev_descriptor : in unsigned_8;
success : out boolean);
procedure unmount_device
(id : in ewok.tasks_shared.t_task_id;
dev_descriptor : in unsigned_8;
success : out boolean);
end ewok.tasks;
|
reznikmm/matreshka | Ada | 3,679 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Attributes.Style.Contextual_Spacing is
type ODF_Style_Contextual_Spacing is
new XML.DOM.Attributes.DOM_Attribute with private;
private
type ODF_Style_Contextual_Spacing is
new XML.DOM.Attributes.DOM_Attribute with null record;
end ODF.DOM.Attributes.Style.Contextual_Spacing;
|
reznikmm/matreshka | Ada | 7,826 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.Utp_Attributes;
with AMF.UML.Dependencies;
with AMF.Visitors.Utp_Iterators;
with AMF.Visitors.Utp_Visitors;
with League.Strings.Internals;
with Matreshka.Internals.Strings;
package body AMF.Internals.Utp_Test_Objectives is
-------------------------
-- Get_Base_Dependency --
-------------------------
overriding function Get_Base_Dependency
(Self : not null access constant Utp_Test_Objective_Proxy)
return AMF.UML.Dependencies.UML_Dependency_Access is
begin
return
AMF.UML.Dependencies.UML_Dependency_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.Utp_Attributes.Internal_Get_Base_Dependency
(Self.Element)));
end Get_Base_Dependency;
-------------------------
-- Set_Base_Dependency --
-------------------------
overriding procedure Set_Base_Dependency
(Self : not null access Utp_Test_Objective_Proxy;
To : AMF.UML.Dependencies.UML_Dependency_Access) is
begin
AMF.Internals.Tables.Utp_Attributes.Internal_Set_Base_Dependency
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Base_Dependency;
------------------
-- Get_Priority --
------------------
overriding function Get_Priority
(Self : not null access constant Utp_Test_Objective_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.Utp_Attributes.Internal_Get_Priority (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Priority;
------------------
-- Set_Priority --
------------------
overriding procedure Set_Priority
(Self : not null access Utp_Test_Objective_Proxy;
To : AMF.Optional_String) is
begin
if To.Is_Empty then
AMF.Internals.Tables.Utp_Attributes.Internal_Set_Priority
(Self.Element, null);
else
AMF.Internals.Tables.Utp_Attributes.Internal_Set_Priority
(Self.Element,
League.Strings.Internals.Internal (To.Value));
end if;
end Set_Priority;
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant Utp_Test_Objective_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.Utp_Visitors.Utp_Visitor'Class then
AMF.Visitors.Utp_Visitors.Utp_Visitor'Class
(Visitor).Enter_Test_Objective
(AMF.Utp.Test_Objectives.Utp_Test_Objective_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant Utp_Test_Objective_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.Utp_Visitors.Utp_Visitor'Class then
AMF.Visitors.Utp_Visitors.Utp_Visitor'Class
(Visitor).Leave_Test_Objective
(AMF.Utp.Test_Objectives.Utp_Test_Objective_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant Utp_Test_Objective_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.Utp_Iterators.Utp_Iterator'Class then
AMF.Visitors.Utp_Iterators.Utp_Iterator'Class
(Iterator).Visit_Test_Objective
(Visitor,
AMF.Utp.Test_Objectives.Utp_Test_Objective_Access (Self),
Control);
end if;
end Visit_Element;
end AMF.Internals.Utp_Test_Objectives;
|
Rodeo-McCabe/orka | Ada | 10,780 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with System.Multiprocessors.Dispatching_Domains;
with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
with Ada.Exceptions;
with Orka.Futures;
with Orka.Loggers;
with Orka.Logging;
with Orka.Simulation;
with Orka.Simulation_Jobs;
package body Orka.Loops is
use all type Orka.Logging.Source;
use all type Orka.Logging.Severity;
use Orka.Logging;
package Messages is new Orka.Logging.Messages (Game_Loop);
procedure Free is new Ada.Unchecked_Deallocation
(Behaviors.Behavior_Array, Behaviors.Behavior_Array_Access);
function "<" (Left, Right : Behaviors.Behavior_Ptr) return Boolean is
function Convert is new Ada.Unchecked_Conversion
(Source => System.Address, Target => Long_Integer);
begin
return Convert (Left.all'Address) < Convert (Right.all'Address);
end "<";
protected body Handler is
procedure Stop is
begin
Stop_Flag := True;
end Stop;
procedure Set_Frame_Limit (Value : Time_Span) is
begin
Limit := Value;
end Set_Frame_Limit;
function Frame_Limit return Time_Span is (Limit);
procedure Enable_Limit (Enable : Boolean) is
begin
Limit_Flag := Enable;
end Enable_Limit;
function Limit_Enabled return Boolean is (Limit_Flag);
function Should_Stop return Boolean is (Stop_Flag);
end Handler;
protected body Scene is
procedure Add (Object : Behaviors.Behavior_Ptr) is
begin
Behaviors_Set.Insert (Object);
Modified_Flag := True;
end Add;
procedure Remove (Object : Behaviors.Behavior_Ptr) is
begin
Behaviors_Set.Delete (Object);
Modified_Flag := True;
end Remove;
procedure Replace_Array (Target : in out Behaviors.Behavior_Array_Access) is
pragma Assert (Modified);
Index : Positive := 1;
Count : constant Positive := Positive (Behaviors_Set.Length);
begin
Free (Target);
Target := new Behaviors.Behavior_Array'(1 .. Count => Behaviors.Null_Behavior);
-- Copy the elements from the set to the array
-- for faster iteration by the game loop
for Element of Behaviors_Set loop
Target (Index) := Element;
Index := Index + 1;
end loop;
Modified_Flag := False;
end Replace_Array;
function Modified return Boolean is
(Modified_Flag);
procedure Set_Camera (Camera : Cameras.Camera_Ptr) is
begin
Scene_Camera := Camera;
end Set_Camera;
function Camera return Cameras.Camera_Ptr is
(Scene_Camera);
end Scene;
package SJ renames Simulation_Jobs;
procedure Stop_Loop is
begin
Handler.Stop;
end Stop_Loop;
procedure Run_Game_Loop
(Fence : not null access SJ.Fences.Buffer_Fence;
Render : Simulation.Render_Ptr)
is
Previous_Time : Time := Clock;
Next_Time : Time := Previous_Time;
Lag : Time_Span := Time_Span_Zero;
Scene_Array : not null Behaviors.Behavior_Array_Access := Behaviors.Empty_Behavior_Array;
Batch_Length : constant := 10;
One_Second : constant Time_Span := Seconds (1);
Frame_Counter : Natural := 0;
Exceeded_Frame_Counter : Natural := 0;
Clock_FPS_Start : Time := Clock;
Stat_Sum : Time_Span := Time_Span_Zero;
Stat_Min : Duration := To_Duration (One_Second);
Stat_Max : Duration := To_Duration (-One_Second);
begin
Scene.Replace_Array (Scene_Array);
Messages.Log (Debug, "Simulation tick resolution: " & Trim (Image (Tick)));
-- Based on http://gameprogrammingpatterns.com/game-loop.html
loop
declare
Current_Time : constant Time := Clock;
Elapsed : constant Time_Span := Current_Time - Previous_Time;
begin
Previous_Time := Current_Time;
Lag := Lag + Elapsed;
exit when Handler.Should_Stop;
declare
Iterations : constant Natural := Lag / Time_Step;
begin
Lag := Lag - Iterations * Time_Step;
Scene.Camera.Update (To_Duration (Lag));
declare
Fixed_Update_Job : constant Jobs.Job_Ptr
:= Jobs.Parallelize (SJ.Create_Fixed_Update_Job
(Scene_Array, Time_Step, Iterations),
SJ.Clone_Fixed_Update_Job'Access,
Scene_Array'Length, Batch_Length);
Finished_Job : constant Jobs.Job_Ptr := SJ.Create_Finished_Job
(Scene_Array, Time_Step, Scene.Camera.View_Position, Batch_Length);
Render_Scene_Job : constant Jobs.Job_Ptr
:= SJ.Create_Scene_Render_Job (Render, Scene_Array, Scene.Camera);
Render_Start_Job : constant Jobs.Job_Ptr
:= SJ.Create_Start_Render_Job (Fence, Window);
Render_Finish_Job : constant Jobs.Job_Ptr
:= SJ.Create_Finish_Render_Job (Fence, Window,
Stop_Loop'Unrestricted_Access);
Handle : Futures.Pointers.Mutable_Pointer;
Status : Futures.Status;
begin
Orka.Jobs.Chain
((Render_Start_Job, Fixed_Update_Job, Finished_Job,
Render_Scene_Job, Render_Finish_Job));
Job_Manager.Queue.Enqueue (Render_Start_Job, Handle);
declare
Frame_Future : constant Orka.Futures.Future_Access := Handle.Get.Value;
begin
select
Frame_Future.Wait_Until_Done (Status);
or
delay until Current_Time + Maximum_Frame_Time;
raise Program_Error with
"Maximum frame time of " & Trim (Image (Maximum_Frame_Time)) &
" exceeded";
end select;
end;
end;
end;
if Scene.Modified then
Scene.Replace_Array (Scene_Array);
end if;
declare
Total_Elapsed : constant Time_Span := Clock - Clock_FPS_Start;
Limit_Exceeded : constant Time_Span := Elapsed - Handler.Frame_Limit;
begin
Frame_Counter := Frame_Counter + 1;
if Limit_Exceeded > Time_Span_Zero then
Stat_Sum := Stat_Sum + Limit_Exceeded;
Stat_Min := Duration'Min (Stat_Min, To_Duration (Limit_Exceeded));
Stat_Max := Duration'Max (Stat_Max, To_Duration (Limit_Exceeded));
Exceeded_Frame_Counter := Exceeded_Frame_Counter + 1;
end if;
if Total_Elapsed > One_Second then
declare
Frame_Time : constant Time_Span := Total_Elapsed / Frame_Counter;
FPS : constant Integer := Integer (1.0 / To_Duration (Frame_Time));
begin
Messages.Log (Debug, Trim (FPS'Image) & " FPS, frame time: " &
Trim (Image (Frame_Time)));
end;
if Exceeded_Frame_Counter > 0 then
declare
Stat_Avg : constant Time_Span := Stat_Sum / Exceeded_Frame_Counter;
begin
Messages.Log (Debug, " deadline missed: " &
Trim (Exceeded_Frame_Counter'Image) & " (limit is " &
Trim (Image (Handler.Frame_Limit)) & ")");
Messages.Log (Debug, " avg/min/max: " &
Image (Stat_Avg) &
Image (To_Time_Span (Stat_Min)) &
Image (To_Time_Span (Stat_Max)));
end;
end if;
Clock_FPS_Start := Clock;
Frame_Counter := 0;
Exceeded_Frame_Counter := 0;
Stat_Sum := Time_Span_Zero;
Stat_Min := To_Duration (One_Second);
Stat_Max := To_Duration (Time_Span_Zero);
end if;
end;
if Handler.Limit_Enabled then
-- Do not sleep if Next_Time fell behind more than one frame
-- due to high workload (FPS dropping below limit), otherwise
-- the FPS will be exceeded during a subsequent low workload
-- until Next_Time has catched up
if Next_Time < Current_Time - Handler.Frame_Limit then
Next_Time := Current_Time;
else
Next_Time := Next_Time + Handler.Frame_Limit;
delay until Next_Time;
end if;
end if;
end;
end loop;
Job_Manager.Shutdown;
exception
when others =>
Job_Manager.Shutdown;
raise;
end Run_Game_Loop;
procedure Run_Loop (Render : not null access procedure
(Scene : not null Behaviors.Behavior_Array_Access;
Camera : Cameras.Camera_Ptr))
is
Fence : aliased SJ.Fences.Buffer_Fence := SJ.Fences.Create_Buffer_Fence;
begin
declare
-- Create a separate task for the game loop. The current task
-- will be used to dequeue and execute GPU jobs.
task Simulation;
use Ada.Exceptions;
task body Simulation is
begin
System.Multiprocessors.Dispatching_Domains.Set_CPU (1);
Run_Game_Loop (Fence'Unchecked_Access, Render);
exception
when Error : others =>
Messages.Log (Loggers.Error, Exception_Information (Error));
end Simulation;
begin
System.Multiprocessors.Dispatching_Domains.Set_CPU (1);
-- Execute GPU jobs in the current task
Job_Manager.Execute_GPU_Jobs;
end;
end Run_Loop;
end Orka.Loops;
|
io7m/coreland-vector-ada | Ada | 1,441 | adb | with ada.text_io;
with vector;
with vector.sum;
procedure sum_double is
package io renames ada.text_io;
package v16 is new vector (16);
package v16_sum is new v16.sum;
use type v16.scalar_d_t;
base_a : constant v16.vector_d_t := (others => 1.0);
want : constant v16.scalar_d_t := 16.0;
testno : integer := 0;
procedure sys_exit (e: integer);
pragma import (c, sys_exit, "exit");
procedure fail (want, got : v16.scalar_d_t) is
s_tnum : constant string := integer'image (testno);
s_want : constant string := v16.scalar_d_t'image (want);
s_got : constant string := v16.scalar_d_t'image (got);
begin
io.put_line ("[" & s_tnum & "] fail " & s_want & " /= " & s_got);
sys_exit (1);
end fail;
procedure pass (want, got : v16.scalar_d_t) is
s_tnum : constant string := integer'image (testno);
s_want : constant string := v16.scalar_d_t'image (want);
s_got : constant string := v16.scalar_d_t'image (got);
begin
io.put_line ("[" & s_tnum & "] " & s_want & " = " & s_got);
end pass;
procedure check (got : v16.scalar_d_t) is
begin
if (want /= got) then
fail (want, got);
else
pass (want, got);
end if;
testno := testno + 1;
end check;
begin
--
-- sum, in place
--
declare
tmp_a : constant v16.vector_d_t := base_a;
got : constant v16.scalar_d_t := v16_sum.d (tmp_a);
begin
check (got);
end;
end sum_double;
|
reznikmm/matreshka | Ada | 46,142 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Internals.UML_Classes;
with AMF.String_Collections;
with AMF.UML.Behavioral_Features;
with AMF.UML.Behaviored_Classifiers;
with AMF.UML.Behaviors.Collections;
with AMF.UML.Classes.Collections;
with AMF.UML.Classifier_Template_Parameters;
with AMF.UML.Classifiers.Collections;
with AMF.UML.Collaboration_Uses.Collections;
with AMF.UML.Connectable_Elements.Collections;
with AMF.UML.Connectors.Collections;
with AMF.UML.Constraints.Collections;
with AMF.UML.Dependencies.Collections;
with AMF.UML.Element_Imports.Collections;
with AMF.UML.Extensions.Collections;
with AMF.UML.Features.Collections;
with AMF.UML.Generalization_Sets.Collections;
with AMF.UML.Generalizations.Collections;
with AMF.UML.Interface_Realizations.Collections;
with AMF.UML.Named_Elements.Collections;
with AMF.UML.Namespaces;
with AMF.UML.Opaque_Behaviors;
with AMF.UML.Operations.Collections;
with AMF.UML.Package_Imports.Collections;
with AMF.UML.Packageable_Elements.Collections;
with AMF.UML.Packages.Collections;
with AMF.UML.Parameter_Sets.Collections;
with AMF.UML.Parameterable_Elements.Collections;
with AMF.UML.Parameters.Collections;
with AMF.UML.Ports.Collections;
with AMF.UML.Properties.Collections;
with AMF.UML.Receptions.Collections;
with AMF.UML.Redefinable_Elements.Collections;
with AMF.UML.Redefinable_Template_Signatures;
with AMF.UML.String_Expressions;
with AMF.UML.Substitutions.Collections;
with AMF.UML.Template_Bindings.Collections;
with AMF.UML.Template_Parameters;
with AMF.UML.Template_Signatures;
with AMF.UML.Types;
with AMF.UML.Use_Cases.Collections;
with AMF.Visitors;
package AMF.Internals.UML_Opaque_Behaviors is
type UML_Opaque_Behavior_Proxy is
limited new AMF.Internals.UML_Classes.UML_Class_Proxy
and AMF.UML.Opaque_Behaviors.UML_Opaque_Behavior with null record;
overriding function Get_Body
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.String_Collections.Sequence_Of_String;
-- Getter of OpaqueBehavior::body.
--
-- Specifies the behavior in one or more languages.
overriding function Get_Language
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.String_Collections.Ordered_Set_Of_String;
-- Getter of OpaqueBehavior::language.
--
-- Languages the body strings use in the same order as the body strings.
overriding function Get_Context
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Behaviored_Classifiers.UML_Behaviored_Classifier_Access;
-- Getter of Behavior::context.
--
-- The classifier that is the context for the execution of the behavior.
-- If the behavior is owned by a BehavioredClassifier, that classifier is
-- the context. Otherwise, the context is the first BehavioredClassifier
-- reached by following the chain of owner relationships. For example,
-- following this algorithm, the context of an entry action in a state
-- machine is the classifier that owns the state machine. The features of
-- the context classifier as well as the elements visible to the context
-- classifier are visible to the behavior.
overriding function Get_Is_Reentrant
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return Boolean;
-- Getter of Behavior::isReentrant.
--
-- Tells whether the behavior can be invoked while it is still executing
-- from a previous invocation.
overriding procedure Set_Is_Reentrant
(Self : not null access UML_Opaque_Behavior_Proxy;
To : Boolean);
-- Setter of Behavior::isReentrant.
--
-- Tells whether the behavior can be invoked while it is still executing
-- from a previous invocation.
overriding function Get_Owned_Parameter
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Parameters.Collections.Ordered_Set_Of_UML_Parameter;
-- Getter of Behavior::ownedParameter.
--
-- References a list of parameters to the behavior which describes the
-- order and type of arguments that can be given when the behavior is
-- invoked and of the values which will be returned when the behavior
-- completes its execution.
overriding function Get_Owned_Parameter_Set
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Parameter_Sets.Collections.Set_Of_UML_Parameter_Set;
-- Getter of Behavior::ownedParameterSet.
--
-- The ParameterSets owned by this Behavior.
overriding function Get_Postcondition
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint;
-- Getter of Behavior::postcondition.
--
-- An optional set of Constraints specifying what is fulfilled after the
-- execution of the behavior is completed, if its precondition was
-- fulfilled before its invocation.
overriding function Get_Precondition
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint;
-- Getter of Behavior::precondition.
--
-- An optional set of Constraints specifying what must be fulfilled when
-- the behavior is invoked.
overriding function Get_Redefined_Behavior
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Behaviors.Collections.Set_Of_UML_Behavior;
-- Getter of Behavior::redefinedBehavior.
--
-- References a behavior that this behavior redefines. A subtype of
-- Behavior may redefine any other subtype of Behavior. If the behavior
-- implements a behavioral feature, it replaces the redefined behavior. If
-- the behavior is a classifier behavior, it extends the redefined
-- behavior.
overriding function Get_Specification
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Behavioral_Features.UML_Behavioral_Feature_Access;
-- Getter of Behavior::specification.
--
-- Designates a behavioral feature that the behavior implements. The
-- behavioral feature must be owned by the classifier that owns the
-- behavior or be inherited by it. The parameters of the behavioral
-- feature and the implementing behavior must match. A behavior does not
-- need to have a specification, in which case it either is the classifer
-- behavior of a BehavioredClassifier or it can only be invoked by another
-- behavior of the classifier.
overriding procedure Set_Specification
(Self : not null access UML_Opaque_Behavior_Proxy;
To : AMF.UML.Behavioral_Features.UML_Behavioral_Feature_Access);
-- Setter of Behavior::specification.
--
-- Designates a behavioral feature that the behavior implements. The
-- behavioral feature must be owned by the classifier that owns the
-- behavior or be inherited by it. The parameters of the behavioral
-- feature and the implementing behavior must match. A behavior does not
-- need to have a specification, in which case it either is the classifer
-- behavior of a BehavioredClassifier or it can only be invoked by another
-- behavior of the classifier.
overriding function Get_Extension
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Extensions.Collections.Set_Of_UML_Extension;
-- Getter of Class::extension.
--
-- References the Extensions that specify additional properties of the
-- metaclass. The property is derived from the extensions whose memberEnds
-- are typed by the Class.
overriding function Get_Is_Abstract
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return Boolean;
-- Getter of Class::isAbstract.
--
-- True when a class is abstract.
-- If true, the Classifier does not provide a complete declaration and can
-- typically not be instantiated. An abstract classifier is intended to be
-- used by other classifiers e.g. as the target of general
-- metarelationships or generalization relationships.
overriding function Get_Is_Active
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return Boolean;
-- Getter of Class::isActive.
--
-- Determines whether an object specified by this class is active or not.
-- If true, then the owning class is referred to as an active class. If
-- false, then such a class is referred to as a passive class.
overriding procedure Set_Is_Active
(Self : not null access UML_Opaque_Behavior_Proxy;
To : Boolean);
-- Setter of Class::isActive.
--
-- Determines whether an object specified by this class is active or not.
-- If true, then the owning class is referred to as an active class. If
-- false, then such a class is referred to as a passive class.
overriding function Get_Nested_Classifier
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Classifiers.Collections.Ordered_Set_Of_UML_Classifier;
-- Getter of Class::nestedClassifier.
--
-- References all the Classifiers that are defined (nested) within the
-- Class.
overriding function Get_Owned_Attribute
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property;
-- Getter of Class::ownedAttribute.
--
-- The attributes (i.e. the properties) owned by the class.
overriding function Get_Owned_Operation
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Operations.Collections.Ordered_Set_Of_UML_Operation;
-- Getter of Class::ownedOperation.
--
-- The operations owned by the class.
overriding function Get_Owned_Reception
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Receptions.Collections.Set_Of_UML_Reception;
-- Getter of Class::ownedReception.
--
-- Receptions that objects of this class are willing to accept.
overriding function Get_Super_Class
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Classes.Collections.Set_Of_UML_Class;
-- Getter of Class::superClass.
--
-- This gives the superclasses of a class.
overriding function Get_Classifier_Behavior
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Behaviors.UML_Behavior_Access;
-- Getter of BehavioredClassifier::classifierBehavior.
--
-- A behavior specification that specifies the behavior of the classifier
-- itself.
overriding procedure Set_Classifier_Behavior
(Self : not null access UML_Opaque_Behavior_Proxy;
To : AMF.UML.Behaviors.UML_Behavior_Access);
-- Setter of BehavioredClassifier::classifierBehavior.
--
-- A behavior specification that specifies the behavior of the classifier
-- itself.
overriding function Get_Interface_Realization
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Interface_Realizations.Collections.Set_Of_UML_Interface_Realization;
-- Getter of BehavioredClassifier::interfaceRealization.
--
-- The set of InterfaceRealizations owned by the BehavioredClassifier.
-- Interface realizations reference the Interfaces of which the
-- BehavioredClassifier is an implementation.
overriding function Get_Owned_Behavior
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Behaviors.Collections.Set_Of_UML_Behavior;
-- Getter of BehavioredClassifier::ownedBehavior.
--
-- References behavior specifications owned by a classifier.
overriding function Get_Attribute
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Properties.Collections.Set_Of_UML_Property;
-- Getter of Classifier::attribute.
--
-- Refers to all of the Properties that are direct (i.e. not inherited or
-- imported) attributes of the classifier.
overriding function Get_Collaboration_Use
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Collaboration_Uses.Collections.Set_Of_UML_Collaboration_Use;
-- Getter of Classifier::collaborationUse.
--
-- References the collaboration uses owned by the classifier.
overriding function Get_Feature
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Features.Collections.Set_Of_UML_Feature;
-- Getter of Classifier::feature.
--
-- Specifies each feature defined in the classifier.
-- Note that there may be members of the Classifier that are of the type
-- Feature but are not included in this association, e.g. inherited
-- features.
overriding function Get_General
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Getter of Classifier::general.
--
-- Specifies the general Classifiers for this Classifier.
-- References the general classifier in the Generalization relationship.
overriding function Get_Generalization
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization;
-- Getter of Classifier::generalization.
--
-- Specifies the Generalization relationships for this Classifier. These
-- Generalizations navigaten to more general classifiers in the
-- generalization hierarchy.
overriding function Get_Inherited_Member
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Getter of Classifier::inheritedMember.
--
-- Specifies all elements inherited by this classifier from the general
-- classifiers.
overriding function Get_Is_Final_Specialization
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return Boolean;
-- Getter of Classifier::isFinalSpecialization.
--
-- If true, the Classifier cannot be specialized by generalization. Note
-- that this property is preserved through package merge operations; that
-- is, the capability to specialize a Classifier (i.e.,
-- isFinalSpecialization =false) must be preserved in the resulting
-- Classifier of a package merge operation where a Classifier with
-- isFinalSpecialization =false is merged with a matching Classifier with
-- isFinalSpecialization =true: the resulting Classifier will have
-- isFinalSpecialization =false.
overriding procedure Set_Is_Final_Specialization
(Self : not null access UML_Opaque_Behavior_Proxy;
To : Boolean);
-- Setter of Classifier::isFinalSpecialization.
--
-- If true, the Classifier cannot be specialized by generalization. Note
-- that this property is preserved through package merge operations; that
-- is, the capability to specialize a Classifier (i.e.,
-- isFinalSpecialization =false) must be preserved in the resulting
-- Classifier of a package merge operation where a Classifier with
-- isFinalSpecialization =false is merged with a matching Classifier with
-- isFinalSpecialization =true: the resulting Classifier will have
-- isFinalSpecialization =false.
overriding function Get_Owned_Template_Signature
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access;
-- Getter of Classifier::ownedTemplateSignature.
--
-- The optional template signature specifying the formal template
-- parameters.
overriding procedure Set_Owned_Template_Signature
(Self : not null access UML_Opaque_Behavior_Proxy;
To : AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access);
-- Setter of Classifier::ownedTemplateSignature.
--
-- The optional template signature specifying the formal template
-- parameters.
overriding function Get_Owned_Use_Case
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case;
-- Getter of Classifier::ownedUseCase.
--
-- References the use cases owned by this classifier.
overriding function Get_Powertype_Extent
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Generalization_Sets.Collections.Set_Of_UML_Generalization_Set;
-- Getter of Classifier::powertypeExtent.
--
-- Designates the GeneralizationSet of which the associated Classifier is
-- a power type.
overriding function Get_Redefined_Classifier
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Getter of Classifier::redefinedClassifier.
--
-- References the Classifiers that are redefined by this Classifier.
overriding function Get_Representation
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access;
-- Getter of Classifier::representation.
--
-- References a collaboration use which indicates the collaboration that
-- represents this classifier.
overriding procedure Set_Representation
(Self : not null access UML_Opaque_Behavior_Proxy;
To : AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access);
-- Setter of Classifier::representation.
--
-- References a collaboration use which indicates the collaboration that
-- represents this classifier.
overriding function Get_Substitution
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Substitutions.Collections.Set_Of_UML_Substitution;
-- Getter of Classifier::substitution.
--
-- References the substitutions that are owned by this Classifier.
overriding function Get_Template_Parameter
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access;
-- Getter of Classifier::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding procedure Set_Template_Parameter
(Self : not null access UML_Opaque_Behavior_Proxy;
To : AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access);
-- Setter of Classifier::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding function Get_Use_Case
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case;
-- Getter of Classifier::useCase.
--
-- The set of use cases for which this Classifier is the subject.
overriding function Get_Element_Import
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import;
-- Getter of Namespace::elementImport.
--
-- References the ElementImports owned by the Namespace.
overriding function Get_Imported_Member
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Getter of Namespace::importedMember.
--
-- References the PackageableElements that are members of this Namespace
-- as a result of either PackageImports or ElementImports.
overriding function Get_Member
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Getter of Namespace::member.
--
-- A collection of NamedElements identifiable within the Namespace, either
-- by being owned or by being introduced by importing or inheritance.
overriding function Get_Owned_Member
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Getter of Namespace::ownedMember.
--
-- A collection of NamedElements owned by the Namespace.
overriding function Get_Owned_Rule
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint;
-- Getter of Namespace::ownedRule.
--
-- Specifies a set of Constraints owned by this Namespace.
overriding function Get_Package_Import
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import;
-- Getter of Namespace::packageImport.
--
-- References the PackageImports owned by the Namespace.
overriding function Get_Client_Dependency
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency;
-- Getter of NamedElement::clientDependency.
--
-- Indicates the dependencies that reference the client.
overriding function Get_Name_Expression
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access;
-- Getter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding procedure Set_Name_Expression
(Self : not null access UML_Opaque_Behavior_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access);
-- Setter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding function Get_Namespace
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Getter of NamedElement::namespace.
--
-- Specifies the namespace that owns the NamedElement.
overriding function Get_Qualified_Name
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.Optional_String;
-- Getter of NamedElement::qualifiedName.
--
-- A name which allows the NamedElement to be identified within a
-- hierarchy of nested Namespaces. It is constructed from the names of the
-- containing namespaces starting at the root of the hierarchy and ending
-- with the name of the NamedElement itself.
overriding function Get_Package
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Packages.UML_Package_Access;
-- Getter of Type::package.
--
-- Specifies the owning package of this classifier, if any.
overriding procedure Set_Package
(Self : not null access UML_Opaque_Behavior_Proxy;
To : AMF.UML.Packages.UML_Package_Access);
-- Setter of Type::package.
--
-- Specifies the owning package of this classifier, if any.
overriding function Get_Owning_Template_Parameter
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
-- Getter of ParameterableElement::owningTemplateParameter.
--
-- The formal template parameter that owns this element.
overriding procedure Set_Owning_Template_Parameter
(Self : not null access UML_Opaque_Behavior_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
-- Setter of ParameterableElement::owningTemplateParameter.
--
-- The formal template parameter that owns this element.
overriding function Get_Template_Parameter
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
-- Getter of ParameterableElement::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding procedure Set_Template_Parameter
(Self : not null access UML_Opaque_Behavior_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
-- Setter of ParameterableElement::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding function Get_Owned_Template_Signature
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Template_Signatures.UML_Template_Signature_Access;
-- Getter of TemplateableElement::ownedTemplateSignature.
--
-- The optional template signature specifying the formal template
-- parameters.
overriding procedure Set_Owned_Template_Signature
(Self : not null access UML_Opaque_Behavior_Proxy;
To : AMF.UML.Template_Signatures.UML_Template_Signature_Access);
-- Setter of TemplateableElement::ownedTemplateSignature.
--
-- The optional template signature specifying the formal template
-- parameters.
overriding function Get_Template_Binding
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding;
-- Getter of TemplateableElement::templateBinding.
--
-- The optional bindings from this element to templates.
overriding function Get_Is_Leaf
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return Boolean;
-- Getter of RedefinableElement::isLeaf.
--
-- Indicates whether it is possible to further redefine a
-- RedefinableElement. If the value is true, then it is not possible to
-- further redefine the RedefinableElement. Note that this property is
-- preserved through package merge operations; that is, the capability to
-- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in
-- the resulting RedefinableElement of a package merge operation where a
-- RedefinableElement with isLeaf=false is merged with a matching
-- RedefinableElement with isLeaf=true: the resulting RedefinableElement
-- will have isLeaf=false. Default value is false.
overriding procedure Set_Is_Leaf
(Self : not null access UML_Opaque_Behavior_Proxy;
To : Boolean);
-- Setter of RedefinableElement::isLeaf.
--
-- Indicates whether it is possible to further redefine a
-- RedefinableElement. If the value is true, then it is not possible to
-- further redefine the RedefinableElement. Note that this property is
-- preserved through package merge operations; that is, the capability to
-- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in
-- the resulting RedefinableElement of a package merge operation where a
-- RedefinableElement with isLeaf=false is merged with a matching
-- RedefinableElement with isLeaf=true: the resulting RedefinableElement
-- will have isLeaf=false. Default value is false.
overriding function Get_Redefined_Element
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element;
-- Getter of RedefinableElement::redefinedElement.
--
-- The redefinable element that is being redefined by this element.
overriding function Get_Redefinition_Context
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Getter of RedefinableElement::redefinitionContext.
--
-- References the contexts that this element may be redefined from.
overriding function Get_Owned_Port
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Ports.Collections.Set_Of_UML_Port;
-- Getter of EncapsulatedClassifier::ownedPort.
--
-- References a set of ports that an encapsulated classifier owns.
overriding function Get_Owned_Connector
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Connectors.Collections.Set_Of_UML_Connector;
-- Getter of StructuredClassifier::ownedConnector.
--
-- References the connectors owned by the classifier.
overriding function Get_Part
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Properties.Collections.Set_Of_UML_Property;
-- Getter of StructuredClassifier::part.
--
-- References the properties specifying instances that the classifier owns
-- by composition. This association is derived, selecting those owned
-- properties where isComposite is true.
overriding function Get_Role
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Connectable_Elements.Collections.Set_Of_UML_Connectable_Element;
-- Getter of StructuredClassifier::role.
--
-- References the roles that instances may play in this classifier.
overriding function Context
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Behaviored_Classifiers.UML_Behaviored_Classifier_Access;
-- Operation Behavior::context.
--
-- Missing derivation for Behavior::/context : BehavioredClassifier
overriding function Extension
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Extensions.Collections.Set_Of_UML_Extension;
-- Operation Class::extension.
--
-- Missing derivation for Class::/extension : Extension
overriding function Inherit
(Self : not null access constant UML_Opaque_Behavior_Proxy;
Inhs : AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Operation Class::inherit.
--
-- The inherit operation is overridden to exclude redefined properties.
overriding function Super_Class
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Classes.Collections.Set_Of_UML_Class;
-- Operation Class::superClass.
--
-- Missing derivation for Class::/superClass : Class
overriding function All_Features
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Features.Collections.Set_Of_UML_Feature;
-- Operation Classifier::allFeatures.
--
-- The query allFeatures() gives all of the features in the namespace of
-- the classifier. In general, through mechanisms such as inheritance,
-- this will be a larger set than feature.
overriding function Conforms_To
(Self : not null access constant UML_Opaque_Behavior_Proxy;
Other : AMF.UML.Classifiers.UML_Classifier_Access)
return Boolean;
-- Operation Classifier::conformsTo.
--
-- The query conformsTo() gives true for a classifier that defines a type
-- that conforms to another. This is used, for example, in the
-- specification of signature conformance for operations.
overriding function General
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Operation Classifier::general.
--
-- The general classifiers are the classifiers referenced by the
-- generalization relationships.
overriding function Has_Visibility_Of
(Self : not null access constant UML_Opaque_Behavior_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access)
return Boolean;
-- Operation Classifier::hasVisibilityOf.
--
-- The query hasVisibilityOf() determines whether a named element is
-- visible in the classifier. By default all are visible. It is only
-- called when the argument is something owned by a parent.
overriding function Inheritable_Members
(Self : not null access constant UML_Opaque_Behavior_Proxy;
C : AMF.UML.Classifiers.UML_Classifier_Access)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Operation Classifier::inheritableMembers.
--
-- The query inheritableMembers() gives all of the members of a classifier
-- that may be inherited in one of its descendants, subject to whatever
-- visibility restrictions apply.
overriding function Inherited_Member
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Operation Classifier::inheritedMember.
--
-- The inheritedMember association is derived by inheriting the
-- inheritable members of the parents.
-- The inheritedMember association is derived by inheriting the
-- inheritable members of the parents.
overriding function Is_Template
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return Boolean;
-- Operation Classifier::isTemplate.
--
-- The query isTemplate() returns whether this templateable element is
-- actually a template.
overriding function May_Specialize_Type
(Self : not null access constant UML_Opaque_Behavior_Proxy;
C : AMF.UML.Classifiers.UML_Classifier_Access)
return Boolean;
-- Operation Classifier::maySpecializeType.
--
-- The query maySpecializeType() determines whether this classifier may
-- have a generalization relationship to classifiers of the specified
-- type. By default a classifier may specialize classifiers of the same or
-- a more general type. It is intended to be redefined by classifiers that
-- have different specialization constraints.
overriding function Exclude_Collisions
(Self : not null access constant UML_Opaque_Behavior_Proxy;
Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Operation Namespace::excludeCollisions.
--
-- The query excludeCollisions() excludes from a set of
-- PackageableElements any that would not be distinguishable from each
-- other in this namespace.
overriding function Get_Names_Of_Member
(Self : not null access constant UML_Opaque_Behavior_Proxy;
Element : AMF.UML.Named_Elements.UML_Named_Element_Access)
return AMF.String_Collections.Set_Of_String;
-- Operation Namespace::getNamesOfMember.
--
-- The query getNamesOfMember() takes importing into account. It gives
-- back the set of names that an element would have in an importing
-- namespace, either because it is owned, or if not owned then imported
-- individually, or if not individually then from a package.
-- The query getNamesOfMember() gives a set of all of the names that a
-- member would have in a Namespace. In general a member can have multiple
-- names in a Namespace if it is imported more than once with different
-- aliases. The query takes account of importing. It gives back the set of
-- names that an element would have in an importing namespace, either
-- because it is owned, or if not owned then imported individually, or if
-- not individually then from a package.
overriding function Import_Members
(Self : not null access constant UML_Opaque_Behavior_Proxy;
Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Operation Namespace::importMembers.
--
-- The query importMembers() defines which of a set of PackageableElements
-- are actually imported into the namespace. This excludes hidden ones,
-- i.e., those which have names that conflict with names of owned members,
-- and also excludes elements which would have the same name when imported.
overriding function Imported_Member
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Operation Namespace::importedMember.
--
-- The importedMember property is derived from the ElementImports and the
-- PackageImports. References the PackageableElements that are members of
-- this Namespace as a result of either PackageImports or ElementImports.
overriding function Members_Are_Distinguishable
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return Boolean;
-- Operation Namespace::membersAreDistinguishable.
--
-- The Boolean query membersAreDistinguishable() determines whether all of
-- the namespace's members are distinguishable within it.
overriding function Owned_Member
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Operation Namespace::ownedMember.
--
-- Missing derivation for Namespace::/ownedMember : NamedElement
overriding function All_Owning_Packages
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package;
-- Operation NamedElement::allOwningPackages.
--
-- The query allOwningPackages() returns all the directly or indirectly
-- owning packages.
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Opaque_Behavior_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean;
-- Operation NamedElement::isDistinguishableFrom.
--
-- The query isDistinguishableFrom() determines whether two NamedElements
-- may logically co-exist within a Namespace. By default, two named
-- elements are distinguishable if (a) they have unrelated types or (b)
-- they have related types but different names.
overriding function Namespace
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Operation NamedElement::namespace.
--
-- Missing derivation for NamedElement::/namespace : Namespace
overriding function Conforms_To
(Self : not null access constant UML_Opaque_Behavior_Proxy;
Other : AMF.UML.Types.UML_Type_Access)
return Boolean;
-- Operation Type::conformsTo.
--
-- The query conformsTo() gives true for a type that conforms to another.
-- By default, two types do not conform to each other. This query is
-- intended to be redefined for specific conformance situations.
overriding function Is_Compatible_With
(Self : not null access constant UML_Opaque_Behavior_Proxy;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean;
-- Operation ParameterableElement::isCompatibleWith.
--
-- The query isCompatibleWith() determines if this parameterable element
-- is compatible with the specified parameterable element. By default
-- parameterable element P is compatible with parameterable element Q if
-- the kind of P is the same or a subtype as the kind of Q. Subclasses
-- should override this operation to specify different compatibility
-- constraints.
overriding function Is_Template_Parameter
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return Boolean;
-- Operation ParameterableElement::isTemplateParameter.
--
-- The query isTemplateParameter() determines if this parameterable
-- element is exposed as a formal template parameter.
overriding function Parameterable_Elements
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Parameterable_Elements.Collections.Set_Of_UML_Parameterable_Element;
-- Operation TemplateableElement::parameterableElements.
--
-- The query parameterableElements() returns the set of elements that may
-- be used as the parametered elements for a template parameter of this
-- templateable element. By default, this set includes all the owned
-- elements. Subclasses may override this operation if they choose to
-- restrict the set of parameterable elements.
overriding function Is_Consistent_With
(Self : not null access constant UML_Opaque_Behavior_Proxy;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean;
-- Operation RedefinableElement::isConsistentWith.
--
-- The query isConsistentWith() specifies, for any two RedefinableElements
-- in a context in which redefinition is possible, whether redefinition
-- would be logically consistent. By default, this is false; this
-- operation must be overridden for subclasses of RedefinableElement to
-- define the consistency conditions.
overriding function Is_Redefinition_Context_Valid
(Self : not null access constant UML_Opaque_Behavior_Proxy;
Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean;
-- Operation RedefinableElement::isRedefinitionContextValid.
--
-- The query isRedefinitionContextValid() specifies whether the
-- redefinition contexts of this RedefinableElement are properly related
-- to the redefinition contexts of the specified RedefinableElement to
-- allow this element to redefine the other. By default at least one of
-- the redefinition contexts of this element must be a specialization of
-- at least one of the redefinition contexts of the specified element.
overriding function Owned_Port
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Ports.Collections.Set_Of_UML_Port;
-- Operation EncapsulatedClassifier::ownedPort.
--
-- Missing derivation for EncapsulatedClassifier::/ownedPort : Port
overriding function Part
(Self : not null access constant UML_Opaque_Behavior_Proxy)
return AMF.UML.Properties.Collections.Set_Of_UML_Property;
-- Operation StructuredClassifier::part.
--
-- Missing derivation for StructuredClassifier::/part : Property
overriding procedure Enter_Element
(Self : not null access constant UML_Opaque_Behavior_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Leave_Element
(Self : not null access constant UML_Opaque_Behavior_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Visit_Element
(Self : not null access constant UML_Opaque_Behavior_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of iterator interface.
end AMF.Internals.UML_Opaque_Behaviors;
|
Vovanium/stm32-ada | Ada | 5,025 | ads | with Interfaces;
use Interfaces;
package STM32.F4.GPIO is
pragma Pure;
subtype Port_Bit_Number is Natural range 0 .. 15;
-- MODER
type Port_Mode is (
Input_Mode,
Output_Mode,
Alternate_Mode,
Analog_mode
) with Size => 2;
for Port_Mode use (
Input_Mode => 2#00#,
Output_Mode => 2#01#,
Alternate_Mode => 2#10#,
Analog_Mode => 2#11#
);
type Port_Mode_Register is array(Port_Bit_Number) of Port_Mode
with Pack, Size => 32;
-- OTYPER
type Output_Type is (
Push_Pull_Type,
Open_Low_Type
) with Size => 1;
for Output_Type use (
Push_Pull_Type => 2#0#,
Open_Low_Type => 2#1#
);
pragma Warnings(Off, "16 bits of ""Output_Type_Register"" unused");
type Output_Type_Register is array(Port_Bit_Number) of Output_Type
with Pack, Size => 32;
pragma Warnings(On, "16 bits of ""Output_Type_Register"" unused");
-- OSPEEDR
type Output_Speed is (
Low_Speed, -- 50pF ---100--- ns
Medium_Speed, -- 50pF 20 10 6 ns
High_Speed, -- 40pF 10 6 4 ns
Very_High_Speed -- 30pF 6 4 2.5ns
) with Size => 2;
for Output_Speed use (
Low_Speed => 2#00#,
Medium_Speed => 2#01#,
High_Speed => 2#10#,
Very_High_Speed => 2#11#
);
type Output_Speed_Register is array(Port_Bit_Number) of Output_Speed
with Pack, Size => 32;
-- PUPDR
type Port_Pull is (
No_Pull,
Pull_Up,
Pull_Down
) with Size => 2;
for Port_Pull use (
No_Pull => 2#00#,
Pull_Up => 2#01#,
Pull_Down => 2#10#
);
type Port_Pull_Register is array(Port_Bit_Number) of Port_Pull
with Pack, Size => 32;
-- BSRR
type Bit_Set_Reset_Register is record
BS: Unsigned_16;
BR: Unsigned_16;
end record with Size => 32;
for Bit_Set_Reset_Register use record
BS at 0 range 0 .. 15;
BR at 0 range 16 .. 31;
end record;
-- LCKR
type Lock_Bit_Array is array (Port_Bit_Number) of Boolean with Pack, Size => 16;
type Configuration_Lock_Register is record
LCK: Lock_Bit_Array;
LCKK: Boolean;
end record with Size => 32;
for Configuration_Lock_Register use record
LCK at 0 range 0 .. 15;
LCKK at 0 range 16 .. 16;
end record;
-- AFRL/AFRH
type Alternate_Function is mod 16;
package Alternate_Functions is
-- AFL constants
SYS : constant Alternate_Function := 0;
TIM1 : constant Alternate_Function := 1;
TIM2 : constant Alternate_Function := 1;
TIM3 : constant Alternate_Function := 2;
TIM4 : constant Alternate_Function := 2;
TIM5 : constant Alternate_Function := 2;
TIM8 : constant Alternate_Function := 3;
TIM9 : constant Alternate_Function := 3;
TIM10 : constant Alternate_Function := 3;
TIM11 : constant Alternate_Function := 3;
I2C1 : constant Alternate_Function := 4;
I2C2 : constant Alternate_Function := 4;
I2C3 : constant Alternate_Function := 4;
SPI1 : constant Alternate_Function := 5;
SPI2 : constant Alternate_Function := 5;
I2S2 : constant Alternate_Function := 5;
I2S2Ext : constant Alternate_Function := 5;
SPI3 : constant Alternate_Function := 6;
I2SExt : constant Alternate_Function := 6;
I2S3 : constant Alternate_Function := 6;
USART1 : constant Alternate_Function := 7;
USART2 : constant Alternate_Function := 7;
USART3 : constant Alternate_Function := 7;
I2S3Ext : constant Alternate_Function := 7;
UART4 : constant Alternate_Function := 8;
UART5 : constant Alternate_Function := 8;
USART6 : constant Alternate_Function := 8;
CAN1 : constant Alternate_Function := 9;
CAN2 : constant Alternate_Function := 9;
TIM12 : constant Alternate_Function := 9;
TIM13 : constant Alternate_Function := 9;
TIM14 : constant Alternate_Function := 9;
OTG_FS : constant Alternate_Function := 10;
OTG_HS : constant Alternate_Function := 10;
ETH : constant Alternate_Function := 11;
FSMC : constant Alternate_Function := 12;
SDIO : constant Alternate_Function := 12;
OTG_FS_B : constant Alternate_Function := 12;
DCMI : constant Alternate_Function := 13;
EVENTOUT : constant Alternate_Function := 15;
end Alternate_Functions;
type Alternate_Function_Register is array (0 .. 15) of Alternate_Function
with Pack, Size => 64;
type GPIO_Registers is record
MODER: Port_Mode_Register;
OTYPER: Output_Type_Register;
OSPEEDR: Output_Speed_Register;
PUPDR: Port_Pull_Register;
IDR: Interfaces.Unsigned_32;
ODR: Interfaces.Unsigned_32;
BSRR: Bit_Set_Reset_Register;
LCKR: Configuration_Lock_Register;
AFR: Alternate_Function_Register;
end record with Volatile;
for GPIO_Registers use record
MODER at 16#00# range 0 .. 31;
OTYPER at 16#04# range 0 .. 31;
OSPEEDR at 16#08# range 0 .. 31;
PUPDR at 16#0C# range 0 .. 31;
IDR at 16#10# range 0 .. 31;
ODR at 16#14# range 0 .. 31;
BSRR at 16#18# range 0 .. 31;
LCKR at 16#1C# range 0 .. 31;
AFR at 16#20# range 0 .. 63;
end record;
end STM32.F4.GPIO; |
reznikmm/matreshka | Ada | 3,729 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Presentation_Delay_Attributes is
pragma Preelaborate;
type ODF_Presentation_Delay_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Presentation_Delay_Attribute_Access is
access all ODF_Presentation_Delay_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Presentation_Delay_Attributes;
|
reznikmm/matreshka | Ada | 4,849 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Visitors;
with ODF.DOM.Text_List_Level_Style_Image_Elements;
package Matreshka.ODF_Text.List_Level_Style_Image_Elements is
type Text_List_Level_Style_Image_Element_Node is
new Matreshka.ODF_Text.Abstract_Text_Element_Node
and ODF.DOM.Text_List_Level_Style_Image_Elements.ODF_Text_List_Level_Style_Image
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Text_List_Level_Style_Image_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Text_List_Level_Style_Image_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Text_List_Level_Style_Image_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Leave_Node
(Self : not null access Text_List_Level_Style_Image_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Visit_Node
(Self : not null access Text_List_Level_Style_Image_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
end Matreshka.ODF_Text.List_Level_Style_Image_Elements;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 158 | ads | with Interfaces; use Interfaces;
package Monotonic_Counter is
Counter : Unsigned_32;
Overflow : Boolean;
procedure Reset;
end Monotonic_Counter;
|
reznikmm/matreshka | Ada | 3,906 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision: 3559 $ $Date: 2012-12-07 13:08:31 +0200 (Пт., 07 дек. 2012) $
------------------------------------------------------------------------------
with League.Application;
with Matreshka.XML_Schema.URI_Rewriter;
with XML.Schema.Models;
with XML.Schema.Utilities;
with XSD_To_Ada.Generator;
procedure XSD_To_Ada_Generator is
Model : XML.Schema.Models.XS_Model;
begin
Matreshka.XML_Schema.URI_Rewriter.Initialize;
Model :=
XML.Schema.Utilities.Load (League.Application.Arguments.Element (1));
if Model.Is_Null then
raise Program_Error;
end if;
XSD_To_Ada.Generator.Generate (Model);
end XSD_To_Ada_Generator;
|
stcarrez/ada-util | Ada | 1,055 | ads | -----------------------------------------------------------------------
-- Util.Beans.Objects.Discrets -- Unit tests for long/int/float package
-- Copyright (C) 2009, 2010, 2011 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
package Util.Beans.Objects.Discretes is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
end Util.Beans.Objects.Discretes;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 347 | adb | with STM32_SVD; use STM32_SVD;
with STM32_SVD.RCC; use STM32_SVD.RCC;
with HAL;
package body STM32GD.CLOCKS.TREE is
procedure Init is
RCC : RCC_Peripheral renames RCC_Periph;
begin
if PLL_Source = HSE_Input then
RCC.CR.HSEON := 1;
while RCC.CR.HSERDY = 0 loop
null;
end loop;
end if;
end;
end STM32GD.CLOCKS.TREE;
|
mirror/ncurses | Ada | 3,042 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Tour --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright 2020 Thomas E. Dickey --
-- Copyright 1998-2002,2003 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control
-- $Revision: 1.11 $
-- Binding Version 01.00
------------------------------------------------------------------------------
procedure Tour;
|
iyan22/AprendeAda | Ada | 1,140 | adb | with Ada.Text_Io; use Ada.Text_Io;
with Ada.Integer_Text_Io; use Ada.Integer_Text_Io;
with Nt_Console; use Nt_console;
with conecta4; use conecta4;
procedure imprimir_tablero (Tablero: in T_Tablero) is
-- Solo para poder imprimir
package P_Celda_IO is new Enumeration_IO(T_Celda); use P_Celda_IO;
begin
Clear_Screen;
new_line;
Put_Line(" El estado del tablero es:");
New_Line;
-- Imprimimos indicadores para identificar mejor las columnas
Set_Foreground(Light_Green);
put(" ");
for Indicador in 1..Max_Columnas loop
put(Indicador, width=>3); put(" ");
end loop;
Set_Foreground;
new_line;
-- Imprimimos el estado actual del tablero
for Fila in 1..Max_Filas loop
put(" ");
for Columna in 1..Max_Columnas loop
if (Tablero(Fila,Columna)=Azul) then
Set_Foreground(Light_Blue);
elsif
(Tablero(Fila,Columna)=Rojo) then
Set_Foreground(Light_Red);
end if;
Put(Tablero(Fila,Columna));
Put(" ");
Set_Foreground;
end loop;
New_Line;
end loop;
end imprimir_tablero;
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.