repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
SSOCsoft/Log_Reporter | Ada | 34 | ads | Package NSO with Pure is
End NSO;
|
persan/A-gst | Ada | 17,013 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with glib;
with glib.Values;
with System;
-- with GStreamer.GST_Low_Level.glib_2_0_gobject_gobject_h;
-- limited -- with GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h;
with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h;
-- limited -- with GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h;
-- with GStreamer.GST_Low_Level.libxml2_libxml_tree_h;
-- limited -- with GStreamer.GST_Low_Level.glib_2_0_gobject_gparam_h;
with glib;
with System;
-- limited with GStreamer.GST_Low_Level.glib_2_0_glib_glist_h;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h is
-- unsupported macro: GST_TYPE_OBJECT (gst_object_get_type ())
-- arg-macro: function GST_IS_OBJECT (obj)
-- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_OBJECT);
-- arg-macro: function GST_IS_OBJECT_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_OBJECT);
-- arg-macro: function GST_OBJECT_GET_CLASS (obj)
-- return G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_OBJECT, GstObjectClass);
-- arg-macro: function GST_OBJECT (obj)
-- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_OBJECT, GstObject);
-- arg-macro: function GST_OBJECT_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_OBJECT, GstObjectClass);
-- arg-macro: function GST_OBJECT_CAST (obj)
-- return (GstObject*)(obj);
-- arg-macro: function GST_OBJECT_CLASS_CAST (klass)
-- return (GstObjectClass*)(klass);
-- unsupported macro: GstXmlNodePtr xmlNodePtr
-- arg-macro: function GST_OBJECT_REFCOUNT (obj)
-- return ((GObject*)(obj)).ref_count;
-- arg-macro: procedure GST_OBJECT_REFCOUNT_VALUE (obj)
-- g_atomic_int_get ((gint *) andGST_OBJECT_REFCOUNT(obj))
-- arg-macro: function GST_OBJECT_GET_LOCK (obj)
-- return GST_OBJECT_CAST(obj).lock;
-- arg-macro: procedure GST_OBJECT_LOCK (obj)
-- g_mutex_lock(GST_OBJECT_GET_LOCK(obj))
-- arg-macro: procedure GST_OBJECT_TRYLOCK (obj)
-- g_mutex_trylock(GST_OBJECT_GET_LOCK(obj))
-- arg-macro: procedure GST_OBJECT_UNLOCK (obj)
-- g_mutex_unlock(GST_OBJECT_GET_LOCK(obj))
-- arg-macro: function GST_OBJECT_NAME (obj)
-- return GST_OBJECT_CAST(obj).name;
-- arg-macro: function GST_OBJECT_PARENT (obj)
-- return GST_OBJECT_CAST(obj).parent;
-- arg-macro: function GST_OBJECT_FLAGS (obj)
-- return GST_OBJECT_CAST (obj).flags;
-- arg-macro: function GST_OBJECT_FLAG_IS_SET (obj, flag)
-- return (GST_OBJECT_FLAGS (obj) and (flag)) = (flag);
-- arg-macro: function GST_OBJECT_FLAG_SET (obj, flag)
-- return GST_OBJECT_FLAGS (obj) |= (flag);
-- arg-macro: function GST_OBJECT_FLAG_UNSET (obj, flag)
-- return GST_OBJECT_FLAGS (obj) &= ~(flag);
-- arg-macro: function GST_OBJECT_IS_DISPOSING (obj)
-- return GST_OBJECT_FLAG_IS_SET (obj, GST_OBJECT_DISPOSING);
-- arg-macro: function GST_OBJECT_IS_FLOATING (obj)
-- return GST_OBJECT_FLAG_IS_SET (obj, GST_OBJECT_FLOATING);
-- arg-macro: function GST_CLASS_GET_LOCK (obj)
-- return GST_OBJECT_CLASS_CAST(obj).lock;
-- arg-macro: function GST_CLASS_LOCK (obj)
-- return g_static_rec_mutex_lock(GST_CLASS_GET_LOCK(obj));
-- arg-macro: function GST_CLASS_TRYLOCK (obj)
-- return g_static_rec_mutex_trylock(GST_CLASS_GET_LOCK(obj));
-- arg-macro: function GST_CLASS_UNLOCK (obj)
-- return g_static_rec_mutex_unlock(GST_CLASS_GET_LOCK(obj));
-- GStreamer
-- * Copyright (C) 1999,2000 Erik Walthinsen <[email protected]>
-- * 2000 Wim Taymans <[email protected]>
-- * 2005 Wim Taymans <[email protected]>
-- *
-- * gstobject.h: Header for base GstObject
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA 02111-1307, USA.
--
-- make sure we don't change the object size but still make it compile
-- * without libxml
--*
-- * GstObjectFlags:
-- * @GST_OBJECT_DISPOSING: the object is been destroyed, don't use it anymore
-- * @GST_OBJECT_FLOATING: the object has a floating reference count (e.g. its
-- * not assigned to a bin)
-- * @GST_OBJECT_FLAG_LAST: subclasses can add additional flags starting from this flag
-- *
-- * The standard flags that an gstobject may have.
--
-- padding
subtype GstObjectFlags is unsigned;
GST_OBJECT_DISPOSING : constant GstObjectFlags := 1;
GST_OBJECT_FLOATING : constant GstObjectFlags := 2;
GST_OBJECT_FLAG_LAST : constant GstObjectFlags := 16; -- gst/gstobject.h:65
--*
-- * GST_OBJECT_REFCOUNT:
-- * @obj: a #GstObject
-- *
-- * Get access to the reference count field of the object.
--
--*
-- * GST_OBJECT_REFCOUNT_VALUE:
-- * @obj: a #GstObject
-- *
-- * Get the reference count value of the object.
--
-- we do a GST_OBJECT_CAST to avoid type checking, better call these
-- * function with a valid object!
--*
-- * GST_OBJECT_GET_LOCK:
-- * @obj: a #GstObject
-- *
-- * Acquire a reference to the mutex of this object.
--
--*
-- * GST_OBJECT_LOCK:
-- * @obj: a #GstObject to lock
-- *
-- * This macro will obtain a lock on the object, making serialization possible.
-- * It blocks until the lock can be obtained.
--
--*
-- * GST_OBJECT_TRYLOCK:
-- * @obj: a #GstObject.
-- *
-- * This macro will try to obtain a lock on the object, but will return with
-- * FALSE if it can't get it immediately.
--
--*
-- * GST_OBJECT_UNLOCK:
-- * @obj: a #GstObject to unlock.
-- *
-- * This macro releases a lock on the object.
--
--*
-- * GST_OBJECT_NAME:
-- * @obj: a #GstObject
-- *
-- * Get the name of this object
--
--*
-- * GST_OBJECT_PARENT:
-- * @obj: a #GstObject
-- *
-- * Get the parent of this object
--
--*
-- * GST_OBJECT_FLAGS:
-- * @obj: a #GstObject
-- *
-- * This macro returns the entire set of flags for the object.
--
--*
-- * GST_OBJECT_FLAG_IS_SET:
-- * @obj: a #GstObject
-- * @flag: Flag to check for
-- *
-- * This macro checks to see if the given flag is set.
--
--*
-- * GST_OBJECT_FLAG_SET:
-- * @obj: a #GstObject
-- * @flag: Flag to set
-- *
-- * This macro sets the given bits.
--
--*
-- * GST_OBJECT_FLAG_UNSET:
-- * @obj: a #GstObject
-- * @flag: Flag to set
-- *
-- * This macro usets the given bits.
--
--*
-- * GST_OBJECT_IS_DISPOSING:
-- * @obj: a #GstObject
-- *
-- * Check if the given object is beeing destroyed.
--
--*
-- * GST_OBJECT_IS_FLOATING:
-- * @obj: a #GstObject
-- *
-- * Check if the given object is floating (has no owner).
--
type GstObject;
--subtype GstObject is u_GstObject; -- gst/gstobject.h:181
type GstObjectClass;
type u_GstObjectClass_u_gst_reserved_array is array (0 .. 3) of System.Address;
--subtype GstObjectClass is u_GstObjectClass; -- gst/gstobject.h:182
--*
-- * GstObject:
-- * @refcount: unused
-- * @lock: object LOCK
-- * @name: The name of the object
-- * @name_prefix: unused
-- * @parent: this object's parent, weak ref
-- * @flags: use GST_OBJECT_IS_XXX macros to access the flags
-- *
-- * GStreamer base object class.
--
type GstObject is record
object : aliased GLIB.Object.GObject; -- gst/gstobject.h:196
refcount : aliased GLIB.gint; -- gst/gstobject.h:199
lock : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GMutex; -- gst/gstobject.h:202
name : access GLIB.gchar; -- gst/gstobject.h:203
name_prefix : access GLIB.gchar; -- gst/gstobject.h:204
parent : access GstObject; -- gst/gstobject.h:205
flags : aliased GLIB.guint32; -- gst/gstobject.h:206
u_gst_reserved : System.Address; -- gst/gstobject.h:209
end record;
pragma Convention (C_Pass_By_Copy, GstObject); -- gst/gstobject.h:195
--< public >
-- unused (FIXME 0.11: remove)
--< public >
-- with LOCK
-- object LOCK
-- object name
-- (un)used for debugging (FIXME 0.11: remove)
-- this object's parent, weak ref
--< private >
--*
-- * GST_CLASS_GET_LOCK:
-- * @obj: a #GstObjectClass
-- *
-- * This macro will return the class lock used to protect deep_notify signal
-- * emission on thread-unsafe glib versions (glib < 2.8).
-- *
-- * Deprecated: 0.10.36: Don't use this, it's not needed any longer.
--
--*
-- * GST_CLASS_LOCK:
-- * @obj: a #GstObjectClass
-- *
-- * Lock the class.
-- *
-- * Deprecated: 0.10.36: Don't use this, it's not needed any longer.
--
--*
-- * GST_CLASS_TRYLOCK:
-- * @obj: a #GstObjectClass
-- *
-- * Try to lock the class, returns TRUE if class could be locked.
-- *
-- * Deprecated: 0.10.36: Don't use this, it's not needed any longer.
--
--*
-- * GST_CLASS_UNLOCK:
-- * @obj: a #GstObjectClass
-- *
-- * Unlock the class.
-- *
-- * Deprecated: 0.10.36: Don't use this, it's not needed any longer.
--
--*
-- * GstObjectClass:
-- * @parent_class: parent
-- * @path_string_separator: separator used by gst_object_get_path_string()
-- * @signal_object: is used to signal to the whole class
-- * @lock: class lock to be used with GST_CLASS_GET_LOCK(), GST_CLASS_LOCK(), GST_CLASS_UNLOCK() and others.
-- * @parent_set: default signal handler
-- * @parent_unset: default signal handler
-- * @object_saved: default signal handler
-- * @deep_notify: default signal handler
-- * @save_thyself: xml serialisation
-- * @restore_thyself: xml de-serialisation
-- *
-- * GStreamer base object class.
--
type GstObjectClass is record
parent_class : aliased GLIB.Object.GObject_Class; -- gst/gstobject.h:277
path_string_separator : access GLIB.gchar; -- gst/gstobject.h:279
signal_object : access GLIB.Object.GObject; -- gst/gstobject.h:280
lock : access GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h.GStaticRecMutex; -- gst/gstobject.h:283
parent_set : access procedure (arg1 : access GstObject; arg2 : access GstObject); -- gst/gstobject.h:287
parent_unset : access procedure (arg1 : access GstObject; arg2 : access GstObject); -- gst/gstobject.h:288
object_saved : access procedure (arg1 : access GstObject; arg2 : GStreamer.GST_Low_Level.libxml2_libxml_tree_h.xmlNodePtr); -- gst/gstobject.h:290
deep_notify : access procedure
(arg1 : access GstObject;
arg2 : access GstObject;
arg3 : access GStreamer.GST_Low_Level.glib_2_0_gobject_gparam_h.GParamSpec); -- gst/gstobject.h:291
save_thyself : access function (arg1 : access GstObject; arg2 : GStreamer.GST_Low_Level.libxml2_libxml_tree_h.xmlNodePtr) return GStreamer.GST_Low_Level.libxml2_libxml_tree_h.xmlNodePtr; -- gst/gstobject.h:296
restore_thyself : access procedure (arg1 : access GstObject; arg2 : GStreamer.GST_Low_Level.libxml2_libxml_tree_h.xmlNodePtr); -- gst/gstobject.h:297
u_gst_reserved : u_GstObjectClass_u_gst_reserved_array; -- gst/gstobject.h:300
end record;
pragma Convention (C_Pass_By_Copy, GstObjectClass); -- gst/gstobject.h:276
-- FIXME-0.11: remove this, plus the above GST_CLASS_*_LOCK macros
-- signals
-- FIXME-0.11: remove, and pass NULL in g_signal_new(), we never used them
-- FIXME 0.11: Remove this, it's deprecated
--< public >
-- virtual methods for subclasses
-- FIXME 0.11: Remove this, it's deprecated
--< private >
-- normal GObject stuff
function gst_object_get_type return GLIB.GType; -- gst/gstobject.h:304
pragma Import (C, gst_object_get_type, "gst_object_get_type");
-- name routines
function gst_object_set_name (object : access GstObject; name : access GLIB.gchar) return GLIB.gboolean; -- gst/gstobject.h:307
pragma Import (C, gst_object_set_name, "gst_object_set_name");
function gst_object_get_name (object : access GstObject) return access GLIB.gchar; -- gst/gstobject.h:308
pragma Import (C, gst_object_get_name, "gst_object_get_name");
procedure gst_object_set_name_prefix (object : access GstObject; name_prefix : access GLIB.gchar); -- gst/gstobject.h:311
pragma Import (C, gst_object_set_name_prefix, "gst_object_set_name_prefix");
function gst_object_get_name_prefix (object : access GstObject) return access GLIB.gchar; -- gst/gstobject.h:312
pragma Import (C, gst_object_get_name_prefix, "gst_object_get_name_prefix");
-- parentage routines
function gst_object_set_parent (object : access GstObject; parent : access GstObject) return GLIB.gboolean; -- gst/gstobject.h:316
pragma Import (C, gst_object_set_parent, "gst_object_set_parent");
function gst_object_get_parent (object : access GstObject) return access GstObject; -- gst/gstobject.h:317
pragma Import (C, gst_object_get_parent, "gst_object_get_parent");
procedure gst_object_unparent (object : access GstObject); -- gst/gstobject.h:318
pragma Import (C, gst_object_unparent, "gst_object_unparent");
function gst_object_has_ancestor (object : access GstObject; ancestor : access GstObject) return GLIB.gboolean; -- gst/gstobject.h:319
pragma Import (C, gst_object_has_ancestor, "gst_object_has_ancestor");
procedure gst_object_default_deep_notify
(object : access GLIB.Object.GObject;
orig : access GstObject;
pspec : access GStreamer.GST_Low_Level.glib_2_0_gobject_gparam_h.GParamSpec;
excluded_props : System.Address); -- gst/gstobject.h:321
pragma Import (C, gst_object_default_deep_notify, "gst_object_default_deep_notify");
-- refcounting + life cycle
function gst_object_ref (object : System.Address) return System.Address; -- gst/gstobject.h:325
pragma Import (C, gst_object_ref, "gst_object_ref");
procedure gst_object_unref (object : System.Address); -- gst/gstobject.h:326
pragma Import (C, gst_object_unref, "gst_object_unref");
procedure gst_object_ref_sink (object : System.Address); -- gst/gstobject.h:327
pragma Import (C, gst_object_ref_sink, "gst_object_ref_sink");
procedure gst_object_sink (object : System.Address); -- gst/gstobject.h:328
pragma Import (C, gst_object_sink, "gst_object_sink");
-- replace object pointer
procedure gst_object_replace (oldobj : System.Address; newobj : access GstObject); -- gst/gstobject.h:331
pragma Import (C, gst_object_replace, "gst_object_replace");
-- printing out the 'path' of the object
function gst_object_get_path_string (object : access GstObject) return access GLIB.gchar; -- gst/gstobject.h:334
pragma Import (C, gst_object_get_path_string, "gst_object_get_path_string");
-- misc utils
function gst_object_check_uniqueness (list : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; name : access GLIB.gchar) return GLIB.gboolean; -- gst/gstobject.h:337
pragma Import (C, gst_object_check_uniqueness, "gst_object_check_uniqueness");
-- load/save
function gst_object_save_thyself (object : access GstObject; parent : GStreamer.GST_Low_Level.libxml2_libxml_tree_h.xmlNodePtr) return GStreamer.GST_Low_Level.libxml2_libxml_tree_h.xmlNodePtr; -- gst/gstobject.h:342
pragma Import (C, gst_object_save_thyself, "gst_object_save_thyself");
procedure gst_object_restore_thyself (object : access GstObject; self : GStreamer.GST_Low_Level.libxml2_libxml_tree_h.xmlNodePtr); -- gst/gstobject.h:343
pragma Import (C, gst_object_restore_thyself, "gst_object_restore_thyself");
-- class signal stuff
function gst_class_signal_connect
(klass : access GstObjectClass;
name : access GLIB.gchar;
func : System.Address;
func_data : System.Address) return GLIB.guint; -- gst/gstobject.h:353
pragma Import (C, gst_class_signal_connect, "gst_class_signal_connect");
procedure gst_class_signal_emit_by_name
(object : access GstObject;
name : access GLIB.gchar;
self : GStreamer.GST_Low_Level.libxml2_libxml_tree_h.xmlNodePtr); -- gst/gstobject.h:360
pragma Import (C, gst_class_signal_emit_by_name, "gst_class_signal_emit_by_name");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h;
|
AdaCore/libadalang | Ada | 132 | ads | package Generic_Stack is
procedure Pop;
private
pragma Inline (Pop); -- line 4
pragma Test_Statement;
end Generic_Stack;
|
soccasys/Ada_Drivers_Library | Ada | 5,308 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2020, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of 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 stm32f4xx_hal_cortex.c --
-- @author MCD Application Team --
-- @version V1.1.0 --
-- @date 19-June-2014 --
-- @brief CORTEX HAL module driver. --
-- --
-- COPYRIGHT(c) 2014 STMicroelectronics --
------------------------------------------------------------------------------
with Cortex_M_SVD.NVIC; use Cortex_M_SVD.NVIC;
package body Cortex_M.NVIC is
------------------
-- Set_Priority --
------------------
procedure Set_Priority
(IRQn : Interrupt_ID;
Priority : Interrupt_Priority)
is
type As_Array (As_Arr : Boolean := True) is record
case As_Arr is
when True =>
Arr : UInt8_Array (0 .. 3);
when False =>
IPR : UInt32;
end case;
end record with Unchecked_Union, Pack, Size => 32;
IPR_Index : constant Natural := Natural (IRQn) / 4;
IP_Index : constant Natural := Natural (IRQn) mod 4;
IPR : As_Array;
begin
IPR.IPR := NVIC_Periph.NVIC_IPR (IPR_Index);
IPR.Arr (IP_Index) := UInt8 (Priority);
NVIC_Periph.NVIC_IPR (IPR_Index) := IPR.IPR;
end Set_Priority;
-------------
-- Enable_ --
-------------
procedure Enable_Interrupt (IRQn : Interrupt_ID) is
begin
NVIC_Periph.NVIC_ISER := Shift_Left (1, Natural (IRQn));
end Enable_Interrupt;
-------------
-- Disable --
-------------
procedure Disable_Interrupt (IRQn : Interrupt_ID) is
begin
NVIC_Periph.NVIC_ICER := Shift_Left (1, Natural (IRQn));
end Disable_Interrupt;
-------------
-- Enabled --
-------------
function Enabled (IRQn : Interrupt_ID) return Boolean is
begin
return ((NVIC_Periph.NVIC_ISER and Shift_Left (1, Natural (IRQn))) /= 0);
end Enabled;
-------------
-- Pending --
-------------
function Pending (IRQn : Interrupt_ID) return Boolean is
begin
return ((NVIC_Periph.NVIC_ISPR and Shift_Left (1, Natural (IRQn))) /= 0);
end Pending;
-----------------
-- Set_Pending --
-----------------
procedure Set_Pending (IRQn : Interrupt_ID) is
begin
NVIC_Periph.NVIC_ISPR := Shift_Left (1, Natural (IRQn));
end Set_Pending;
-------------------
-- Clear_Pending --
-------------------
procedure Clear_Pending (IRQn : Interrupt_ID) is
begin
NVIC_Periph.NVIC_ICPR := Shift_Left (1, Natural (IRQn));
end Clear_Pending;
end Cortex_M.NVIC;
|
reznikmm/matreshka | Ada | 6,762 | 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_Number.Day_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Number_Day_Element_Node is
begin
return Self : Number_Day_Element_Node do
Matreshka.ODF_Number.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Number_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Number_Day_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_Number_Day
(ODF.DOM.Number_Day_Elements.ODF_Number_Day_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 Number_Day_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Day_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Number_Day_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_Number_Day
(ODF.DOM.Number_Day_Elements.ODF_Number_Day_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 Number_Day_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_Number_Day
(Visitor,
ODF.DOM.Number_Day_Elements.ODF_Number_Day_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.Number_URI,
Matreshka.ODF_String_Constants.Day_Element,
Number_Day_Element_Node'Tag);
end Matreshka.ODF_Number.Day_Elements;
|
reznikmm/increment | Ada | 1,973 | ads | -- Copyright (c) 2015-2017 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with League.Strings;
with XML.SAX.Attributes;
with XML.SAX.Content_Handlers;
with XML.Templates.Streams;
with Tests.Commands;
package Tests.Parser_Data.XML_Reader is
type Reader (Data : access Provider) is limited
new XML.SAX.Content_Handlers.SAX_Content_Handler with private;
function Get_Commands
(Self : Reader) return Tests.Commands.Command_Vectors.Vector;
private
type Reader (Data : access Provider) is limited
new XML.SAX.Content_Handlers.SAX_Content_Handler with record
Collect_Text : Boolean := False;
Collect_XML : Boolean := False;
Index : Positive;
Text : League.Strings.Universal_String;
List : League.String_Vectors.Universal_String_Vector;
Commands : Tests.Commands.Command_Vectors.Vector;
Vector : XML.Templates.Streams.XML_Stream_Element_Vectors.Vector;
end record;
overriding procedure Characters
(Self : in out Reader;
Text : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure End_Element
(Self : in out Reader;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Success : in out Boolean);
overriding function Error_String
(Self : Reader) return League.Strings.Universal_String;
overriding procedure Start_Element
(Self : in out Reader;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Attributes : XML.SAX.Attributes.SAX_Attributes;
Success : in out Boolean);
end Tests.Parser_Data.XML_Reader;
|
sparre/Command-Line-Parser-Generator | Ada | 334 | ads | with Bad_Declares_Function;
package Good_Procedure_Renamings is
procedure Run (Help : in Boolean := False)
renames Bad_Declares_Function.Run;
procedure Batch_Mode (Help : in Boolean := False;
A, B : in Natural)
renames Bad_Declares_Function.Batch_Mode;
end Good_Procedure_Renamings;
|
stcarrez/ada-keystore | Ada | 1,889 | ads | -----------------------------------------------------------------------
-- keystore-logs -- Log support for the keystore
-- Copyright (C) 2019, 2020 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Log.Loggers;
with Keystore.IO;
private package Keystore.Logs is
procedure Dump (Log : in Util.Log.Loggers.Logger;
Content : in Ada.Streams.Stream_Element_Array);
procedure Error (Log : in Util.Log.Loggers.Logger;
Message : in String;
Block : in IO.Storage_Block);
procedure Warn (Log : in Util.Log.Loggers.Logger;
Message : in String;
Block : in IO.Storage_Block);
procedure Info (Log : in Util.Log.Loggers.Logger;
Message : in String;
Block : in IO.Storage_Block);
procedure Debug (Log : in Util.Log.Loggers.Logger;
Message : in String;
Block : in IO.Storage_Block);
procedure Debug (Log : in Util.Log.Loggers.Logger;
Message : in String;
Block1 : in IO.Storage_Block;
Block2 : in IO.Storage_Block);
end Keystore.Logs;
|
AdaCore/gpr | Ada | 3,408 | adb | ------------------------------------------------------------------------------
-- --
-- GPR2 PROJECT MANAGER --
-- --
-- Copyright (C) 2019-2023, AdaCore --
-- --
-- This 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. This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
-- License for more details. You should have received a copy of the GNU --
-- General Public License distributed with GNAT; see file COPYING. If not, --
-- see <http://www.gnu.org/licenses/>. --
-- --
------------------------------------------------------------------------------
with Ada.Text_IO;
package body GPRname.Options is
----------------------------
-- Ignore_Duplicate_Files --
----------------------------
function Ignore_Duplicate_Files (Self : Object) return Boolean is
(Self.Ignore_Duplicate_Files);
-----------------------------
-- Ignore_Predefined_Units --
-----------------------------
function Ignore_Predefined_Units (Self : Object) return Boolean is
(Self.Ignore_Predefined_Units);
------------------
-- Minimal_Dirs --
------------------
function Minimal_Dirs (Self : Object) return Boolean is
(Self.Minimal_Dirs);
---------------
-- No_Backup --
---------------
function No_Backup (Self : Object) return Boolean is
(Self.No_Backup);
-------------------
-- Prep_Switches --
-------------------
function Prep_Switches (Self : Object) return String_Vector.Vector is
(Self.Prep_Switches);
------------------
-- Project_File --
------------------
function Project_File (Self : Object) return String is
(if Self.Project_File /= Null_Unbounded_String
then To_String (Self.Project_File)
else No_String);
---------
-- RTS --
---------
function RTS (Self : Object) return String is
(if Self.Project_File /= Null_Unbounded_String
then To_String (Self.RTS)
else No_String);
--------------
-- Sections --
--------------
function Sections (Self : Object) return Section.Vector.Object is
(Self.Sections);
------------
-- Target --
------------
function Target (Self : Object) return String is
(if Self.Target /= Null_Unbounded_String
then To_String (Self.Target)
else No_String);
---------------
-- Verbosity --
---------------
function Verbosity (Self : Object) return Verbosity_Level_Type is
(Self.Verbosity);
-----------------------------
-- Build_From_Command_Line --
-----------------------------
procedure Build_From_Command_Line (Self : in out Object) is separate;
end GPRname.Options;
|
onox/orka | Ada | 991 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2021 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Orka.SIMD.AVX.Doubles;
package Orka.SIMD.AVX.Longs.Convert is
pragma Pure;
use SIMD.AVX.Doubles;
function Convert (Elements : m256l) return m256d is
((Float_64 (Elements (X)),
Float_64 (Elements (Y)),
Float_64 (Elements (Z)),
Float_64 (Elements (W))));
end Orka.SIMD.AVX.Longs.Convert;
|
kjseefried/coreland-cgbc | Ada | 1,573 | adb | package body CGBC.Bounded_Stacks is
--
-- Clear
--
procedure Clear (Container : in out Stack) is
begin
Container.Used := 0;
end Clear;
--
-- Is_Empty
--
function Is_Empty (Container : in Stack) return Boolean is
begin
return Container.Used = 0;
end Is_Empty;
--
-- Length
--
function Length (Container : in Stack) return Count_Type is
begin
return Container.Used;
end Length;
--
-- Peek
--
procedure Peek
(Container : in Stack;
Underflow : out Boolean) is
begin
if Container.Used > 0 then
Underflow := False;
Process (Container.Elements (Container.Used));
else
Underflow := True;
end if;
end Peek;
--
-- Pop
--
procedure Pop
(Container : in out Stack;
Item : out Element_Type;
Underflow : out Boolean) is
begin
if Container.Used > 0 then
Item := Container.Elements (Container.Used);
Container.Used := Container.Used - 1;
Underflow := False;
else
Underflow := True;
end if;
end Pop;
--
-- Push
--
procedure Push
(Container : in out Stack;
New_Item : in Element_Type;
Overflow : out Boolean) is
begin
if Container.Used < Container.Capacity then
Container.Used := Container.Used + 1;
Container.Elements (Container.Used) := New_Item;
Overflow := False;
else
Overflow := True;
end if;
end Push;
end CGBC.Bounded_Stacks;
|
AdaCore/libadalang | Ada | 49 | ads | package Pkg is
type T is (Foo, Bar);
end Pkg;
|
vasil-sd/ada-tlsf | Ada | 380 | adb | package body BitOperations.Shift.Axiom.Logic_Left
with SPARK_Mode => Off is
-----------------------------------------------------
-- Axiom_Shift_Left_Is_Eq_Multiplying_By_Power_Of2 --
-----------------------------------------------------
procedure Equal_Mult_By_Power_2
(Value : Modular; Amount : Natural)
is null;
end BitOperations.Shift.Axiom.Logic_Left;
|
Tim-Tom/scratch | Ada | 2,060 | adb | with Ada.Text_IO;
package body Word_List is
package IO renames Ada.Text_IO;
use Word_Lists;
use Pattern_Sets;
function "<"(a, b: pattern) return Boolean is
begin
return String(a) < String(b);
end "<";
function "="(a, b: pattern) return Boolean is
begin
return String(a) = String(b);
end "=";
function Make_Pattern(w : Word) return Pattern is
p : Pattern := (others => ' ');
seen : Array(1 .. 26) of Character;
seen_max : Natural := 0;
function Map_Letter(c : Character) return Character is
begin
for i in 1 .. seen_max loop
if seen(i) = c then
return Character'Val(Character'Pos('a') + i);
end if;
end loop;
seen_max := seen_max + 1;
seen(seen_max) := c;
return Character'Val(Character'Pos('a') + seen_max);
end Map_Letter;
begin
for i in w'Range loop
exit when w(i) = ' ';
p(i) := Map_Letter(w(i));
end loop;
return p;
end Make_Pattern;
function Build_Word_List(filename : String; patterns : Pattern_Set) return Word_List is
list : Word_List;
input : IO.File_Type;
w : Word;
p : Pattern;
last : Natural;
c : Word_Lists.Cursor;
inserted : Boolean;
begin
IO.Open(input, IO.In_File, filename);
while not IO.End_Of_File(input) loop
IO.Get_Line(input, w, last);
if last = Word'Last then
IO.Put_Line(w);
raise Constraint_Error;
end if;
w(last + 1 .. Word'Last) := (others => ' ');
p := Make_Pattern(w);
if Pattern_Sets.Find(patterns, p) /= Pattern_Sets.No_Element then
c := Word_Lists.Find(list, p);
if c = Word_Lists.No_Element then
Word_Lists.Insert(list, p, new Word_Vectors.Vector, c, inserted);
end if;
Word_Vectors.Append(Word_Lists.Element(c).all, w);
end if;
end loop;
return list;
end Build_Word_List;
end Word_List;
|
zhmu/ananas | Ada | 1,536 | adb | -- { dg-do compile }
procedure Private_Overriding is
package Foo is
type Bar is abstract tagged null record;
procedure Overloaded_Subprogram
(Self : in out Bar)
is abstract;
procedure Overloaded_Subprogram
(Self : in out Bar;
P1 : Integer)
is abstract;
procedure Not_Overloaded_Subprogram
(Self : in out Bar)
is abstract;
type Baz is new Bar with null record;
-- promise to override both overloaded subprograms,
-- shouldn't matter that they're defined in the private part,
private -- workaround: override in the public view
overriding
procedure Overloaded_Subprogram
(Self : in out Baz)
is null;
overriding
procedure Overloaded_Subprogram
(Self : in out Baz;
P1 : Integer)
is null;
overriding
procedure Not_Overloaded_Subprogram
(Self : in out Baz)
is null;
end Foo;
Qux : Foo.Baz;
begin
-- this is allowed, as expected
Foo.Not_Overloaded_Subprogram(Qux);
Foo.Overloaded_Subprogram(Qux);
Foo.Overloaded_Subprogram(Foo.Baz'Class(Qux));
Foo.Overloaded_Subprogram(Foo.Bar'Class(Qux));
-- however, using object-dot notation
Qux.Not_Overloaded_Subprogram; -- this is allowed
Qux.Overloaded_Subprogram; -- "no selector..."
Foo.Baz'Class(Qux).Overloaded_Subprogram; -- "no selector..."
Foo.Bar'Class(Qux).Overloaded_Subprogram; -- this is allowed
end Private_Overriding;
|
reznikmm/matreshka | Ada | 6,506 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2011, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.Internals.Strings.Configuration;
package body League.Application is
procedure Initialize_Arguments_Environment;
-- Initialize arguments list and process environment.
Args : League.String_Vectors.Universal_String_Vector;
Env : League.Environment_Variables.Environment_Variable_Set;
App_Name : League.Strings.Universal_String;
App_Version : League.Strings.Universal_String;
Org_Name : League.Strings.Universal_String;
Org_Domain : League.Strings.Universal_String;
----------------------
-- Application_Name --
----------------------
function Application_Name return League.Strings.Universal_String is
begin
return App_Name;
end Application_Name;
-------------------------
-- Application_Version --
-------------------------
function Application_Version return League.Strings.Universal_String is
begin
return App_Version;
end Application_Version;
---------------
-- Arguments --
---------------
function Arguments return League.String_Vectors.Universal_String_Vector is
begin
return Args;
end Arguments;
-----------------
-- Environment --
-----------------
function Environment
return League.Environment_Variables.Environment_Variable_Set is
begin
return Env;
end Environment;
--------------------------------------
-- Initialize_Arguments_Environment --
--------------------------------------
procedure Initialize_Arguments_Environment is separate;
-------------------------
-- Organization_Domain --
-------------------------
function Organization_Domain return League.Strings.Universal_String is
begin
return Org_Domain;
end Organization_Domain;
-----------------------
-- Organization_Name --
-----------------------
function Organization_Name return League.Strings.Universal_String is
begin
return Org_Name;
end Organization_Name;
--------------------------
-- Set_Application_Name --
--------------------------
procedure Set_Application_Name (Name : League.Strings.Universal_String) is
begin
App_Name := Name;
end Set_Application_Name;
-----------------------------
-- Set_Application_Version --
-----------------------------
procedure Set_Application_Version
(Name : League.Strings.Universal_String) is
begin
App_Version := Name;
end Set_Application_Version;
-----------------------------
-- Set_Organization_Domain --
-----------------------------
procedure Set_Organization_Domain
(Name : League.Strings.Universal_String) is
begin
Org_Domain := Name;
end Set_Organization_Domain;
---------------------------
-- Set_Organization_Name --
---------------------------
procedure Set_Organization_Name (Name : League.Strings.Universal_String) is
begin
Org_Name := Name;
end Set_Organization_Name;
begin
-- Setup most optimal string handler.
Matreshka.Internals.Strings.Configuration.Initialize;
-- Initialize arguments and environment.
Initialize_Arguments_Environment;
end League.Application;
|
sbksba/Concurrence-LI330 | Ada | 908 | adb | with Ada.Text_Io,Ada.Integer_text_io;
use Ada.Text_Io,Ada.Integer_text_io;
procedure Affichage is
Fin : constant Natural := 10;
-- Declaration d un type tache avec un entier natural comme descriminant
task type Boucle (N: Natural);
-- Corps de la tache qui affiche les "fin" premiers entiers
-- (en s identifiant a chaque affichage) et qui signale a la fin qu elle a termine
task body Boucle is
begin
Put_Line("t: "&Natural'Image(N));
for I in 0..Fin-1 loop
Put_Line(Natural'Image(I));
end loop;
Put_Line("t: "&Natural'Image(N)&" se termine");
end Boucle;
begin
Put_Line("--Debut tache principale--");
declare
T1 : Boucle(1);
T2 : Boucle(2);
T3 : Boucle(3);
T4 : Boucle(4);
T5 : Boucle(5);
T6 : Boucle(6);
begin
null;
end;
Put_Line("--Fin tache principale--");
end Affichage;
|
rveenker/sdlada | Ada | 1,481 | adb | --------------------------------------------------------------------------------------------------------------------
-- 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.
--------------------------------------------------------------------------------------------------------------------
package body SDL.Platform is
-- Bring in the platform specific version for each build of the library. It's also defined as inline so
-- that the compiler can eliminate redundant code in the static expressions that use this function.
function Get return Platforms is separate;
end SDL.Platform;
|
AdaCore/training_material | Ada | 132 | ads | package Tasks is
task T is
entry Start;
entry Receive_Message (V : String);
entry Stop;
end T;
end Tasks;
|
AdaCore/training_material | Ada | 67 | adb | O : My_Array (2);
-- Multiline cut
O : My_Array (1 .. 2);
|
zhmu/ananas | Ada | 20,399 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . G R A P H S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2018-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Note: this unit is used during bootstrap, see ADA_GENERATED_FILES in
-- gcc-interface/Make-lang.in for details on the constraints.
with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables;
with GNAT.Lists; use GNAT.Lists;
with GNAT.Sets; use GNAT.Sets;
package GNAT.Graphs is
---------------
-- Component --
---------------
-- The following type denotes a strongly connected component handle
-- (referred to as simply "component") in a graph.
type Component_Id is new Natural;
No_Component : constant Component_Id := Component_Id'First;
function Hash_Component (Comp : Component_Id) return Bucket_Range_Type;
-- Map component Comp into the range of buckets
function Present (Comp : Component_Id) return Boolean;
-- Determine whether component Comp exists
---------------------
-- Directed_Graphs --
---------------------
-- The following package offers a directed graph abstraction with the
-- following characteristics:
--
-- * Dynamic resizing based on number of vertices and edges
-- * Creation of multiple instances, of different sizes
-- * Discovery of strongly connected components
-- * Iterable attributes
--
-- The following use pattern must be employed when operating this graph:
--
-- Graph : Directed_Graph := Create (<some size>, <some size>);
--
-- <various operations>
--
-- Destroy (Graph);
--
-- The destruction of the graph reclaims all storage occupied by it.
generic
--------------
-- Vertices --
--------------
type Vertex_Id is private;
-- The handle of a vertex
No_Vertex : Vertex_Id;
-- An indicator for a nonexistent vertex
with function Hash_Vertex (V : Vertex_Id) return Bucket_Range_Type;
-- Map vertex V into the range of buckets
with function Same_Vertex
(Left : Vertex_Id;
Right : Vertex_Id) return Boolean;
-- Compare vertex Left to vertex Right for identity
-----------
-- Edges --
-----------
type Edge_Id is private;
-- The handle of an edge
No_Edge : Edge_Id;
-- An indicator for a nonexistent edge
with function Hash_Edge (E : Edge_Id) return Bucket_Range_Type;
-- Map edge E into the range of buckets
with function Same_Edge
(Left : Edge_Id;
Right : Edge_Id) return Boolean;
-- Compare edge Left to edge Right for identity
package Directed_Graphs is
-- The following exceptions are raised when an attempt is made to add
-- the same edge or vertex in a graph.
Duplicate_Edge : exception;
Duplicate_Vertex : exception;
-- The following exceptions are raised when an attempt is made to delete
-- or reference a nonexistent component, edge, or vertex in a graph.
Missing_Component : exception;
Missing_Edge : exception;
Missing_Vertex : exception;
----------------------
-- Graph operations --
----------------------
-- The following type denotes a graph handle. Each instance must be
-- created using routine Create.
type Directed_Graph is private;
Nil : constant Directed_Graph;
procedure Add_Edge
(G : Directed_Graph;
E : Edge_Id;
Source : Vertex_Id;
Destination : Vertex_Id);
-- Add edge E to graph G which links vertex source Source and desination
-- vertex Destination. The edge is "owned" by vertex Source. This action
-- raises the following exceptions:
--
-- * Duplicate_Edge, when the edge is already present in the graph
--
-- * Iterated, when the graph has an outstanding edge iterator
--
-- * Missing_Vertex, when either the source or desination are not
-- present in the graph.
procedure Add_Vertex
(G : Directed_Graph;
V : Vertex_Id);
-- Add vertex V to graph G. This action raises the following exceptions:
--
-- * Duplicate_Vertex, when the vertex is already present in the graph
--
-- * Iterated, when the graph has an outstanding vertex iterator
function Component
(G : Directed_Graph;
V : Vertex_Id) return Component_Id;
-- Obtain the component where vertex V of graph G resides. This action
-- raises the following exceptions:
--
-- * Missing_Vertex, when the vertex is not present in the graph
function Contains_Component
(G : Directed_Graph;
Comp : Component_Id) return Boolean;
-- Determine whether graph G contains component Comp
function Contains_Edge
(G : Directed_Graph;
E : Edge_Id) return Boolean;
-- Determine whether graph G contains edge E
function Contains_Vertex
(G : Directed_Graph;
V : Vertex_Id) return Boolean;
-- Determine whether graph G contains vertex V
function Create
(Initial_Vertices : Positive;
Initial_Edges : Positive) return Directed_Graph;
-- Create a new graph with vertex capacity Initial_Vertices and edge
-- capacity Initial_Edges. This routine must be called at the start of
-- a graph's lifetime.
procedure Delete_Edge
(G : Directed_Graph;
E : Edge_Id);
-- Delete edge E from graph G. This action raises these exceptions:
--
-- * Iterated, when the graph has an outstanding edge iterator
--
-- * Missing_Edge, when the edge is not present in the graph
--
-- * Missing_Vertex, when the source vertex that "owns" the edge is
-- not present in the graph.
function Destination_Vertex
(G : Directed_Graph;
E : Edge_Id) return Vertex_Id;
-- Obtain the destination vertex of edge E of graph G. This action
-- raises the following exceptions:
--
-- * Missing_Edge, when the edge is not present in the graph
procedure Destroy (G : in out Directed_Graph);
-- Destroy the contents of graph G, rendering it unusable. This routine
-- must be called at the end of a graph's lifetime. This action raises
-- the following exceptions:
--
-- * Iterated, if the graph has any outstanding iterator
procedure Find_Components (G : Directed_Graph);
-- Find all components of graph G. This action raises the following
-- exceptions:
--
-- * Iterated, when the components or vertices of the graph have an
-- outstanding iterator.
function Is_Empty (G : Directed_Graph) return Boolean;
-- Determine whether graph G is empty
function Number_Of_Component_Vertices
(G : Directed_Graph;
Comp : Component_Id) return Natural;
-- Obtain the total number of vertices of component Comp of graph G
function Number_Of_Components (G : Directed_Graph) return Natural;
-- Obtain the total number of components of graph G
function Number_Of_Edges (G : Directed_Graph) return Natural;
-- Obtain the total number of edges of graph G
function Number_Of_Outgoing_Edges
(G : Directed_Graph;
V : Vertex_Id) return Natural;
-- Obtain the total number of outgoing edges of vertex V of graph G
function Number_Of_Vertices (G : Directed_Graph) return Natural;
-- Obtain the total number of vertices of graph G
function Present (G : Directed_Graph) return Boolean;
-- Determine whether graph G exists
function Source_Vertex
(G : Directed_Graph;
E : Edge_Id) return Vertex_Id;
-- Obtain the source vertex that "owns" edge E of graph G. This action
-- raises the following exceptions:
--
-- * Missing_Edge, when the edge is not present in the graph
-------------------------
-- Iterator operations --
-------------------------
-- The following types represent iterators over various attributes of a
-- graph. Each iterator locks all mutation operations of its associated
-- attribute, and unlocks them once it is exhausted. The iterators must
-- be used with the following pattern:
--
-- Iter : Iterate_XXX (Graph);
-- while Has_Next (Iter) loop
-- Next (Iter, Element);
-- end loop;
--
-- It is possible to advance the iterators by using Next only, however
-- this risks raising Iterator_Exhausted.
-- The following type represents an iterator over all edges of a graph
type All_Edge_Iterator is private;
function Has_Next (Iter : All_Edge_Iterator) return Boolean;
-- Determine whether iterator Iter has more edges to examine
function Iterate_All_Edges (G : Directed_Graph) return All_Edge_Iterator;
-- Obtain an iterator over all edges of graph G
procedure Next
(Iter : in out All_Edge_Iterator;
E : out Edge_Id);
-- Return the current edge referenced by iterator Iter and advance to
-- the next available edge. This action raises the following exceptions:
--
-- * Iterator_Exhausted, when the iterator has been exhausted and
-- further attempts are made to advance it.
-- The following type represents an iterator over all vertices of a
-- graph.
type All_Vertex_Iterator is private;
function Has_Next (Iter : All_Vertex_Iterator) return Boolean;
-- Determine whether iterator Iter has more vertices to examine
function Iterate_All_Vertices
(G : Directed_Graph) return All_Vertex_Iterator;
-- Obtain an iterator over all vertices of graph G
procedure Next
(Iter : in out All_Vertex_Iterator;
V : out Vertex_Id);
-- Return the current vertex referenced by iterator Iter and advance
-- to the next available vertex. This action raises the following
-- exceptions:
--
-- * Iterator_Exhausted, when the iterator has been exhausted and
-- further attempts are made to advance it.
-- The following type represents an iterator over all components of a
-- graph.
type Component_Iterator is private;
function Has_Next (Iter : Component_Iterator) return Boolean;
-- Determine whether iterator Iter has more components to examine
function Iterate_Components
(G : Directed_Graph) return Component_Iterator;
-- Obtain an iterator over all components of graph G
procedure Next
(Iter : in out Component_Iterator;
Comp : out Component_Id);
-- Return the current component referenced by iterator Iter and advance
-- to the next component. This action raises the following exceptions:
--
-- * Iterator_Exhausted, when the iterator has been exhausted and
-- further attempts are made to advance it.
-- The following type prepresents an iterator over all vertices of a
-- component.
type Component_Vertex_Iterator is private;
function Has_Next (Iter : Component_Vertex_Iterator) return Boolean;
-- Determine whether iterator Iter has more vertices to examine
function Iterate_Component_Vertices
(G : Directed_Graph;
Comp : Component_Id) return Component_Vertex_Iterator;
-- Obtain an iterator over all vertices that comprise component Comp of
-- graph G.
procedure Next
(Iter : in out Component_Vertex_Iterator;
V : out Vertex_Id);
-- Return the current vertex referenced by iterator Iter and advance to
-- the next vertex. This action raises the following exceptions:
--
-- * Iterator_Exhausted, when the iterator has been exhausted and
-- further attempts are made to advance it.
-- The following type represents an iterator over all outgoing edges of
-- a vertex.
type Outgoing_Edge_Iterator is private;
function Has_Next (Iter : Outgoing_Edge_Iterator) return Boolean;
-- Determine whether iterator Iter has more outgoing edges to examine
function Iterate_Outgoing_Edges
(G : Directed_Graph;
V : Vertex_Id) return Outgoing_Edge_Iterator;
-- Obtain an iterator over all the outgoing edges "owned" by vertex V of
-- graph G.
procedure Next
(Iter : in out Outgoing_Edge_Iterator;
E : out Edge_Id);
-- Return the current outgoing edge referenced by iterator Iter and
-- advance to the next available outgoing edge. This action raises the
-- following exceptions:
--
-- * Iterator_Exhausted, when the iterator has been exhausted and
-- further attempts are made to advance it.
private
pragma Unreferenced (No_Edge);
--------------
-- Edge_Map --
--------------
type Edge_Attributes is record
Destination : Vertex_Id := No_Vertex;
-- The target of a directed edge
Source : Vertex_Id := No_Vertex;
-- The origin of a directed edge. The source vertex "owns" the edge.
end record;
No_Edge_Attributes : constant Edge_Attributes :=
(Destination => No_Vertex,
Source => No_Vertex);
procedure Destroy_Edge_Attributes (Attrs : in out Edge_Attributes);
-- Destroy the contents of attributes Attrs
package Edge_Map is new Dynamic_Hash_Tables
(Key_Type => Edge_Id,
Value_Type => Edge_Attributes,
No_Value => No_Edge_Attributes,
Expansion_Threshold => 1.5,
Expansion_Factor => 2,
Compression_Threshold => 0.3,
Compression_Factor => 2,
"=" => Same_Edge,
Destroy_Value => Destroy_Edge_Attributes,
Hash => Hash_Edge);
--------------
-- Edge_Set --
--------------
package Edge_Set is new Membership_Sets
(Element_Type => Edge_Id,
"=" => "=",
Hash => Hash_Edge);
-----------------
-- Vertex_List --
-----------------
procedure Destroy_Vertex (V : in out Vertex_Id);
-- Destroy the contents of a vertex
package Vertex_List is new Doubly_Linked_Lists
(Element_Type => Vertex_Id,
"=" => Same_Vertex,
Destroy_Element => Destroy_Vertex);
----------------
-- Vertex_Map --
----------------
type Vertex_Attributes is record
Component : Component_Id := No_Component;
-- The component where a vertex lives
Outgoing_Edges : Edge_Set.Membership_Set := Edge_Set.Nil;
-- The set of edges that extend out from a vertex
end record;
No_Vertex_Attributes : constant Vertex_Attributes :=
(Component => No_Component,
Outgoing_Edges => Edge_Set.Nil);
procedure Destroy_Vertex_Attributes (Attrs : in out Vertex_Attributes);
-- Destroy the contents of attributes Attrs
package Vertex_Map is new Dynamic_Hash_Tables
(Key_Type => Vertex_Id,
Value_Type => Vertex_Attributes,
No_Value => No_Vertex_Attributes,
Expansion_Threshold => 1.5,
Expansion_Factor => 2,
Compression_Threshold => 0.3,
Compression_Factor => 2,
"=" => Same_Vertex,
Destroy_Value => Destroy_Vertex_Attributes,
Hash => Hash_Vertex);
-------------------
-- Component_Map --
-------------------
type Component_Attributes is record
Vertices : Vertex_List.Doubly_Linked_List := Vertex_List.Nil;
end record;
No_Component_Attributes : constant Component_Attributes :=
(Vertices => Vertex_List.Nil);
procedure Destroy_Component_Attributes
(Attrs : in out Component_Attributes);
-- Destroy the contents of attributes Attrs
package Component_Map is new Dynamic_Hash_Tables
(Key_Type => Component_Id,
Value_Type => Component_Attributes,
No_Value => No_Component_Attributes,
Expansion_Threshold => 1.5,
Expansion_Factor => 2,
Compression_Threshold => 0.3,
Compression_Factor => 2,
"=" => "=",
Destroy_Value => Destroy_Component_Attributes,
Hash => Hash_Component);
-----------
-- Graph --
-----------
type Directed_Graph_Attributes is record
All_Edges : Edge_Map.Dynamic_Hash_Table := Edge_Map.Nil;
-- The map of edge -> edge attributes for all edges in the graph
All_Vertices : Vertex_Map.Dynamic_Hash_Table := Vertex_Map.Nil;
-- The map of vertex -> vertex attributes for all vertices in the
-- graph.
Components : Component_Map.Dynamic_Hash_Table := Component_Map.Nil;
-- The map of component -> component attributes for all components
-- in the graph.
end record;
type Directed_Graph is access Directed_Graph_Attributes;
Nil : constant Directed_Graph := null;
---------------
-- Iterators --
---------------
type All_Edge_Iterator is new Edge_Map.Iterator;
type All_Vertex_Iterator is new Vertex_Map.Iterator;
type Component_Iterator is new Component_Map.Iterator;
type Component_Vertex_Iterator is new Vertex_List.Iterator;
type Outgoing_Edge_Iterator is new Edge_Set.Iterator;
end Directed_Graphs;
private
First_Component : constant Component_Id := No_Component + 1;
end GNAT.Graphs;
|
optikos/oasis | Ada | 4,384 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Element_Vectors;
with Program.Elements.Expressions;
with Program.Elements.Case_Expression_Paths;
with Program.Element_Visitors;
package Program.Nodes.Case_Expression_Paths is
pragma Preelaborate;
type Case_Expression_Path is
new Program.Nodes.Node
and Program.Elements.Case_Expression_Paths.Case_Expression_Path
and Program.Elements.Case_Expression_Paths.Case_Expression_Path_Text
with private;
function Create
(When_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Choices : not null Program.Element_Vectors.Element_Vector_Access;
Arrow_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Expression : not null Program.Elements.Expressions.Expression_Access)
return Case_Expression_Path;
type Implicit_Case_Expression_Path is
new Program.Nodes.Node
and Program.Elements.Case_Expression_Paths.Case_Expression_Path
with private;
function Create
(Choices : not null Program.Element_Vectors
.Element_Vector_Access;
Expression : not null Program.Elements.Expressions
.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Case_Expression_Path
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Case_Expression_Path is
abstract new Program.Nodes.Node
and Program.Elements.Case_Expression_Paths.Case_Expression_Path
with record
Choices : not null Program.Element_Vectors.Element_Vector_Access;
Expression : not null Program.Elements.Expressions.Expression_Access;
end record;
procedure Initialize
(Self : aliased in out Base_Case_Expression_Path'Class);
overriding procedure Visit
(Self : not null access Base_Case_Expression_Path;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Choices
(Self : Base_Case_Expression_Path)
return not null Program.Element_Vectors.Element_Vector_Access;
overriding function Expression
(Self : Base_Case_Expression_Path)
return not null Program.Elements.Expressions.Expression_Access;
overriding function Is_Case_Expression_Path_Element
(Self : Base_Case_Expression_Path)
return Boolean;
overriding function Is_Path_Element
(Self : Base_Case_Expression_Path)
return Boolean;
type Case_Expression_Path is
new Base_Case_Expression_Path
and Program.Elements.Case_Expression_Paths.Case_Expression_Path_Text
with record
When_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Arrow_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
end record;
overriding function To_Case_Expression_Path_Text
(Self : aliased in out Case_Expression_Path)
return Program.Elements.Case_Expression_Paths
.Case_Expression_Path_Text_Access;
overriding function When_Token
(Self : Case_Expression_Path)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Arrow_Token
(Self : Case_Expression_Path)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Case_Expression_Path is
new Base_Case_Expression_Path
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Case_Expression_Path_Text
(Self : aliased in out Implicit_Case_Expression_Path)
return Program.Elements.Case_Expression_Paths
.Case_Expression_Path_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Case_Expression_Path)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Case_Expression_Path)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Case_Expression_Path)
return Boolean;
end Program.Nodes.Case_Expression_Paths;
|
MatrixMike/AdaDemo1 | Ada | 3,095 | 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. --
-- --
-- --
-- --
-- --
-- --
-- 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 LEDs; use LEDs;
with Button; use Button;
with Ada.Real_Time; use Ada.Real_Time;
package body Driver is
type Index is mod 4;
Pattern : constant array (Index) of User_LED := (Orange, Red, Blue, Green);
-- The LEDs are not physically laid out "consecutively" in such a way that
-- we can simply go in enumeral order to get circular rotation. Thus we
-- define this mapping, using a consecutive index to get the physical LED
-- blinking order desired.
task body Controller is
Period : constant Time_Span := Milliseconds (100); -- arbitrary
Next_Start : Time := Clock;
Next_LED : Index := 0;
begin
loop
Off (Pattern (Next_LED));
if Button.Current_Direction = Clockwise then
Next_LED := Next_LED - 1;
else
Next_LED := Next_LED + 1;
end if;
On (Pattern (Next_LED));
Next_Start := Next_Start + Period;
delay until Next_Start;
end loop;
end Controller;
end Driver;
|
reznikmm/matreshka | Ada | 4,047 | 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.Svg_GradientTransform_Attributes;
package Matreshka.ODF_Svg.GradientTransform_Attributes is
type Svg_GradientTransform_Attribute_Node is
new Matreshka.ODF_Svg.Abstract_Svg_Attribute_Node
and ODF.DOM.Svg_GradientTransform_Attributes.ODF_Svg_GradientTransform_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Svg_GradientTransform_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Svg_GradientTransform_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Svg.GradientTransform_Attributes;
|
optikos/oasis | Ada | 4,820 | adb | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Program.Nodes.Real_Range_Specifications is
function Create
(Range_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Lower_Bound : not null Program.Elements.Expressions
.Expression_Access;
Double_Dot_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Upper_Bound : not null Program.Elements.Expressions
.Expression_Access)
return Real_Range_Specification is
begin
return Result : Real_Range_Specification :=
(Range_Token => Range_Token, Lower_Bound => Lower_Bound,
Double_Dot_Token => Double_Dot_Token, Upper_Bound => Upper_Bound,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Lower_Bound : not null Program.Elements.Expressions
.Expression_Access;
Upper_Bound : not null Program.Elements.Expressions
.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Real_Range_Specification is
begin
return Result : Implicit_Real_Range_Specification :=
(Lower_Bound => Lower_Bound, Upper_Bound => Upper_Bound,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Lower_Bound
(Self : Base_Real_Range_Specification)
return not null Program.Elements.Expressions.Expression_Access is
begin
return Self.Lower_Bound;
end Lower_Bound;
overriding function Upper_Bound
(Self : Base_Real_Range_Specification)
return not null Program.Elements.Expressions.Expression_Access is
begin
return Self.Upper_Bound;
end Upper_Bound;
overriding function Range_Token
(Self : Real_Range_Specification)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Range_Token;
end Range_Token;
overriding function Double_Dot_Token
(Self : Real_Range_Specification)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Double_Dot_Token;
end Double_Dot_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Real_Range_Specification)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Real_Range_Specification)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Real_Range_Specification)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize
(Self : aliased in out Base_Real_Range_Specification'Class) is
begin
Set_Enclosing_Element (Self.Lower_Bound, Self'Unchecked_Access);
Set_Enclosing_Element (Self.Upper_Bound, Self'Unchecked_Access);
null;
end Initialize;
overriding function Is_Real_Range_Specification_Element
(Self : Base_Real_Range_Specification)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Real_Range_Specification_Element;
overriding function Is_Definition_Element
(Self : Base_Real_Range_Specification)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Definition_Element;
overriding procedure Visit
(Self : not null access Base_Real_Range_Specification;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Real_Range_Specification (Self);
end Visit;
overriding function To_Real_Range_Specification_Text
(Self : aliased in out Real_Range_Specification)
return Program.Elements.Real_Range_Specifications
.Real_Range_Specification_Text_Access is
begin
return Self'Unchecked_Access;
end To_Real_Range_Specification_Text;
overriding function To_Real_Range_Specification_Text
(Self : aliased in out Implicit_Real_Range_Specification)
return Program.Elements.Real_Range_Specifications
.Real_Range_Specification_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Real_Range_Specification_Text;
end Program.Nodes.Real_Range_Specifications;
|
Maxelweb/concurrency-sandbox | Ada | 4,369 | adb | with Ada.Text_IO;
package body RCP.Control is
protected body Controller is
entry Demand
(Res : out Resource_T;
Req : Request_T) when Free > 0 is
-- we accept the request if we have spare resources to offer
begin
-- but we satisfy it ONLY if have enough for it
if Req <= Free then
-- the lucky user has got all the items
-- that it wanted the first time round!
Res.Granted := Req;
Free := Free - Req;
else
-- otherwise we transfer the request to an internal queue
-- after keeping record of the smallest request that
-- we were unable to satisfy
-- (this value will help us update the guard to
-- the private channel Assign)
if Req < Min_Request then
Min_Request := Req;
end if;
-- with this statement we transfer the current request
-- to the queue of the private channel Assign
-- (the transfer is executed directly,
-- WITHOUT evaluating the guard associated to Assign
-- because the target is the queue, NOT the channel itself)
requeue Assign;
-- try and see what would happen if we used an EXTERNAL requeue
-- to the same target:
-- requeue Controller.Assign;
end if;
end Demand;
-------------
entry Assign
(Res : out Resource_T;
Req : Request_T) when Available is
-- users will enter this service only if there are
-- enough spare resources (Available = True)
-- AND those users had previously been denied service
--+---------
-- THE PROTOCOL ASSUMES (and requires) FIFO QUEUEING
begin
-- one less request in queue
Considered := Considered - 1;
-- was this call the last one in the Assign queue?
if Considered = 0 then
-- then we close the guard to this channel
Available := False;
-- at this point we should update Min_Request!
end if;
-- can we now satisfy this request?
if Req <= Free then
-- yes, this requeued user can now be granted
-- what it initially wanted
Res.Granted := Req;
Free := Free - Req;
else
-- otherwise we must requeue the unlucky user
-- again and update the record of the smallest
-- pending request
if Req < Min_Request then
Min_Request := Req;
end if;
requeue Assign;
-- try and see what would happen if we used an EXTERNAL requeue
-- to the same target:
-- requeue Controller.Assign;
end if;
end Assign;
-------------
procedure Release (Res : Resource_T) is
begin
-- this service is executed when a user
-- returns its allocation of resources
Free := Free + Res.Granted;
-- as the level of reserve has now increased
-- we should take a look at the requests that
-- are awaiting in the Assign queue
if Free > Min_Request and then Assign'Count > 0 then
-- since we do NOT know which user placed the smallest demand
-- we simply take note of the number of requests
-- currently enqueued at Assign and open the guard to it
-- ===> IS THIS CLEVER? <===
Considered := Assign'Count;
Available := True;
-- and finally we reset the value of Min_Request
-- so that it may be recomputed by the execution of Assign
Min_Request := Request_T'Last;
end if;
end Release;
function Query return Request_T is
begin
return Free;
end Query;
end Controller;
-------------------------
begin
Ada.Text_IO.Put_Line
("The system starts with "
& RCP.Control.Controller.Query'Img
& " free resources");
Ada.Text_IO.Put_Line
("-----+---------+------------+--------");
Ada.Text_IO.Put_Line
("User | Request | Allocation | Release");
Ada.Text_IO.Put_Line
("-----+---------+------------+--------");
end RCP.Control;
|
AdaCore/training_material | Ada | 1,180 | adb | package body Sort is
-- Swap the values of Values (X) and Values (Y)
procedure Swap (Values : in out Nat_Array; X, Y : Index) is
Temp : Integer;
Temp_Index : Index with Ghost;
begin
Temp := Values (X);
Values (X) := Values (Y);
Values (Y) := Temp;
end Swap;
-- Finds the index of the smallest element in the slice Values (From .. To)
function Index_Of_Minimum (Values : Nat_Array; From, To : Index) return Index is
Min : Index := From;
begin
for Index in From .. To loop
if Values (Index) < Values (Min) then
Min := Index;
end if;
end loop;
return Min;
end Index_Of_Minimum;
procedure Selection_Sort (Values : in out Nat_Array) is
Smallest : Index; -- Index of the smallest value in the unsorted part
begin
for Current in 1 .. Values'Last - 1 loop
Smallest := Index_Of_Minimum (Values, Current, Values'Last);
if Smallest /= Current then
Swap (Values => Values,
X => Current,
Y => Smallest);
end if;
end loop;
end Selection_Sort;
end Sort;
|
sungyeon/drake | Ada | 1,208 | ads | pragma License (Unrestricted);
-- implementation unit specialized for Linux
with C.netdb;
with C.sys.socket;
package System.Native_IO.Sockets is
pragma Preelaborate;
type Port_Number is range 0 .. 16#ffff#;
subtype Socket_Address is C.sys.socket.struct_sockaddr;
procedure Close_Socket (Handle : Handle_Type; Raise_On_Error : Boolean);
-- Close_Ordinary without Name
-- client
subtype End_Point is C.netdb.struct_addrinfo_ptr;
function Resolve (Host_Name : String; Service : String)
return End_Point;
function Resolve (Host_Name : String; Port : Port_Number)
return End_Point;
procedure Connect (Handle : aliased out Handle_Type; Peer : End_Point);
procedure Finalize (Item : End_Point);
-- server
subtype Listener is Handle_Type;
Invalid_Listener : Listener
renames Invalid_Handle;
procedure Listen (Server : aliased out Listener; Port : Port_Number);
procedure Accept_Socket (
Server : Listener;
Handle : aliased out Handle_Type;
Remote_Address : out Socket_Address);
procedure Close_Listener (Server : Listener; Raise_On_Error : Boolean)
renames Close_Socket;
end System.Native_IO.Sockets;
|
egustafson/sandbox | Ada | 320 | ads | with Ada.Finalization;
package Object is
type Object is new Ada.Finalization.Controlled with private;
function New_Object( X : in Integer ) return Object;
procedure Put( O : Object );
private
type Object is new Ada.Finalization.Controlled with
record
X : Integer := 0;
end record;
|
gagath/cellular | Ada | 1,610 | adb | with Ada.Text_IO; use Ada.Text_IO;
package body Cellular is
procedure Generate(Previous : in out CellularArray) is
Generator : Boolean_Random.Generator;
begin
Reset(Generator);
for I in Previous'Range loop
Previous(I) := Random(Generator);
end loop;
end Generate;
function "="(Left, Right : in CellularArray) return Boolean is
begin
if Left'Size /= Right'Size then
return False;
end if;
for I in Left'Range loop
if Left(I) /= Right(I) then
return False;
end if;
end loop;
return True;
end;
function NextStep(Left, Cell, Right : in Boolean) return Boolean is
begin
return (not Left and (Cell or Right)) or
(Left and not Cell and not Right);
end NextStep;
function NextArray(Previous : in CellularArray) return CellularArray is
Result : CellularArray(Previous'Range) := (
Others => False
);
begin
for I in Previous'Range loop
if I > Previous'First and I < Previous'Last then
Result(I) := NextStep(Previous(I-1), Previous(I), Previous(I+1));
else
Result(I) := Previous(I);
end if;
end loop;
return Result;
end NextArray;
procedure Put(Line : in CellularArray) is
begin
for I in Line'Range loop
if Line(I) then
Put("@");
else
Put(".");
end if;
end loop;
end Put;
end Cellular;
|
reznikmm/matreshka | Ada | 4,727 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Text.Dont_Balance_Text_Columns_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Dont_Balance_Text_Columns_Attribute_Node is
begin
return Self : Text_Dont_Balance_Text_Columns_Attribute_Node do
Matreshka.ODF_Text.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Text_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Text_Dont_Balance_Text_Columns_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Dont_Balance_Text_Columns_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.Dont_Balance_Text_Columns_Attribute,
Text_Dont_Balance_Text_Columns_Attribute_Node'Tag);
end Matreshka.ODF_Text.Dont_Balance_Text_Columns_Attributes;
|
reznikmm/matreshka | Ada | 3,719 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Table_Show_Empty_Attributes is
pragma Preelaborate;
type ODF_Table_Show_Empty_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Table_Show_Empty_Attribute_Access is
access all ODF_Table_Show_Empty_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Table_Show_Empty_Attributes;
|
zhmu/ananas | Ada | 3,351 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ P R A G --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Expand routines for pragmas
with Types; use Types;
package Exp_Prag is
procedure Expand_N_Pragma (N : Node_Id);
procedure Expand_Pragma_Contract_Cases
(CCs : Node_Id;
Subp_Id : Entity_Id;
Decls : List_Id;
Stmts : in out List_Id);
-- Given pragma Contract_Cases CCs, create the circuitry needed to evaluate
-- case guards and trigger consequence expressions. Subp_Id is the related
-- subprogram for which the pragma applies. Decls are the declarations of
-- Subp_Id's body. All generated code is added to list Stmts. If Stmts is
-- No_List on entry, a new list is created.
procedure Expand_Pragma_Initial_Condition
(Pack_Id : Entity_Id;
N : Node_Id);
-- Verify the run-time semantics of pragma Initial_Condition when it
-- applies to package Pack_Id. N denotes the related package spec or
-- body.
procedure Expand_Pragma_Subprogram_Variant
(Prag : Node_Id;
Subp_Id : Entity_Id;
Body_Decls : List_Id);
-- Given pragma Subprogram_Variant Prag, create the circuitry needed
-- to evaluate variant expressions at the subprogram entry and at the
-- recursive call. Subp_Id is the related subprogram for which the pragma
-- applies and Body_Decls are its body declarations. On exit, the argument
-- of Prag is replaced with a reference to procedure with checks for the
-- variant expressions.
end Exp_Prag;
|
stcarrez/ada-css | Ada | 26,683 | ads | private package CSS.Parser.Parser_Shift_Reduce is
type Small_Integer is range -32_000 .. 32_000;
type Shift_Reduce_Entry is record
T : Small_Integer;
Act : Small_Integer;
end record;
pragma Pack (Shift_Reduce_Entry);
type Row is new Integer range -1 .. Integer'Last;
-- pragma suppress(index_check);
type Shift_Reduce_Array is array (Row range <>) of Shift_Reduce_Entry;
Shift_Reduce_Matrix : constant Shift_Reduce_Array :=
((-1, -1) -- Dummy Entry
-- State 0
, (1, 3), (3, 33), (4, 41), (5, 21), (25, 36), (29, 39), (40, 16)
, (41, 19), (43, 28), (44, 23), (45, 24), (46, 32), (50, 27), (51, 22)
, (64, 40), (68, 43), (69, 42), (-1, -25)
-- State 1
, (1, 45), (3, 33), (4, 41), (5, 21), (25, 36), (29, 39), (40, 16)
, (41, 19), (43, 28), (44, 23), (45, 24), (46, 32), (50, 27), (51, 22)
, (64, 40), (68, 43), (69, 42), (-1, -1)
-- State 2
, (-1, -3)
-- State 3
, (61, 47), (62, 48), (-1, -4)
-- State 4
, (-1, -5)
-- State 5
, (-1, -6)
-- State 6
, (-1, -7)
-- State 7
, (-1, -8)
-- State 8
, (-1, -9)
-- State 9
, (-1, -10)
-- State 10
, (43, 28), (44, 23), (45, 24), (-1, -11)
-- State 11
, (43, 28), (-1, -25)
-- State 12
, (61, 51), (-1, -3000)
-- State 13
, (43, 28), (-1, -25)
-- State 14
, (43, 28), (-1, -25)
-- State 15
, (61, 54), (-1, -3000)
-- State 16
, (11, 55), (-1, -3000)
-- State 17
, (-1, -19)
-- State 18
, (61, 56), (63, 57), (-1, -3000)
-- State 19
, (43, 28), (-1, -25)
-- State 20
, (43, 28), (-1, -25)
-- State 21
, (1, 61), (43, 28), (-1, -25)
-- State 22
, (43, 28), (-1, -25)
-- State 23
, (-1, -20)
-- State 24
, (-1, -21)
-- State 25
, (43, 63), (-1, -22)
-- State 26
, (3, 33), (4, 41), (25, 36), (29, 39), (35, 66), (38, 65), (46, 32)
, (64, 40), (66, 64), (68, 43), (69, 42), (-1, -113)
-- State 27
, (-1, -90)
-- State 28
, (-1, -24)
-- State 29
, (3, 33), (4, 41), (25, 36), (29, 39), (43, 28), (46, 32), (64, 40)
, (68, 43), (69, 42), (-1, -25)
-- State 30
, (-1, -118)
-- State 31
, (-1, -119)
-- State 32
, (-1, -120)
-- State 33
, (-1, -121)
-- State 34
, (-1, -122)
-- State 35
, (-1, -123)
-- State 36
, (3, 73), (4, 41), (29, 39), (46, 72), (64, 40), (68, 43), (69, 42)
, (-1, -3000)
-- State 37
, (4, 77), (69, 78), (-1, -3000)
-- State 38
, (-1, -129)
-- State 39
, (1, 81), (43, 28), (-1, -25)
-- State 40
, (4, 83), (47, 84), (64, 82), (-1, -3000)
-- State 41
, (68, 85), (-1, -130)
-- State 42
, (68, 86), (-1, -131)
-- State 43
, (-1, -127)
-- State 44
, (0, -3001), (-1, -3000)
-- State 45
, (61, 47), (62, 48), (-1, -3000)
-- State 46
, (-1, -2)
-- State 47
, (43, 28), (-1, -25)
-- State 48
, (43, 28), (-1, -25)
-- State 49
, (-1, -18)
-- State 50
, (1, 93), (4, 94), (43, 63), (62, 97), (69, 95), (-1, -3000)
-- State 51
, (43, 28), (-1, -25)
-- State 52
, (43, 63), (61, 99), (-1, -3000)
-- State 53
, (1, 104), (3, 33), (4, 41), (8, 105), (14, 107), (15, 108), (16, 109)
, (17, 111), (18, 112), (25, 36), (29, 39), (43, 63), (46, 32), (48, 110)
, (52, 106), (64, 40), (68, 43), (69, 42), (-1, -3000)
-- State 54
, (43, 28), (-1, -25)
-- State 55
, (60, 114), (-1, -3000)
-- State 56
, (-1, -110)
-- State 57
, (43, 28), (-1, -25)
-- State 58
, (4, 125), (23, 129), (25, 123), (26, 124), (27, 128), (43, 63), (-1, -3000)
-- State 59
, (4, 133), (43, 63), (64, 132), (-1, -93)
-- State 60
, (4, 137), (8, 105), (11, 141), (13, 142), (14, 107), (15, 108), (16, 109)
, (17, 111), (18, 112), (43, 63), (46, 146), (47, 147), (48, 110), (52, 106)
, (56, 145), (66, 138), (67, 139), (-1, -3000)
-- State 61
, (61, 148), (-1, -3000)
-- State 62
, (43, 63), (-1, -48)
-- State 63
, (-1, -23)
-- State 64
, (43, 28), (-1, -25)
-- State 65
, (43, 28), (-1, -25)
-- State 66
, (43, 28), (-1, -25)
-- State 67
, (3, 33), (4, 41), (25, 36), (29, 39), (43, 28), (46, 32), (64, 40)
, (68, 43), (69, 42), (-1, -25)
-- State 68
, (3, 33), (4, 41), (25, 36), (29, 39), (46, 32), (64, 40), (68, 43)
, (69, 42), (-1, -3000)
-- State 69
, (43, 63), (-1, -116)
-- State 70
, (-1, -117)
-- State 71
, (-1, -132)
-- State 72
, (-1, -133)
-- State 73
, (-1, -134)
-- State 74
, (-1, -135)
-- State 75
, (-1, -136)
-- State 76
, (43, 28), (-1, -25)
-- State 77
, (-1, -130)
-- State 78
, (-1, -131)
-- State 79
, (-1, -128)
-- State 80
, (4, 155), (43, 63), (-1, -3000)
-- State 81
, (30, 156), (-1, -3000)
-- State 82
, (4, 157), (-1, -3000)
-- State 83
, (-1, -148)
-- State 84
, (43, 28), (-1, -25)
-- State 85
, (-1, -125)
-- State 86
, (-1, -126)
-- State 87
, (-1, -3000)
-- State 88
, (1, 161), (3, 33), (4, 162), (25, 36), (29, 39), (43, 63), (46, 32)
, (64, 40), (68, 43), (69, 163), (-1, -36)
-- State 89
, (43, 63), (-1, -107)
-- State 90
, (1, 167), (60, 166), (-1, -109)
-- State 91
, (43, 28), (-1, -25)
-- State 92
, (1, 170), (64, 169), (-1, -3000)
-- State 93
, (62, 171), (-1, -167)
-- State 94
, (43, 28), (-1, -25)
-- State 95
, (4, 173), (-1, -3000)
-- State 96
, (62, 174), (-1, -3000)
-- State 97
, (43, 28), (-1, -25)
-- State 98
, (1, 104), (3, 33), (4, 41), (25, 36), (29, 39), (43, 63), (46, 32)
, (64, 40), (68, 43), (69, 42), (-1, -36)
-- State 99
, (43, 28), (-1, -25)
-- State 100
, (1, 104), (3, 33), (4, 41), (8, 105), (14, 107), (15, 108), (16, 109)
, (17, 111), (18, 112), (25, 36), (29, 39), (46, 32), (48, 110), (52, 106)
, (62, 178), (64, 40), (68, 43), (69, 42), (-1, -3000)
-- State 101
, (-1, -43)
-- State 102
, (-1, -44)
-- State 103
, (61, 180), (-1, -3000)
-- State 104
, (61, 181), (62, 48), (-1, -3000)
-- State 105
, (43, 28), (-1, -25)
-- State 106
, (43, 28), (-1, -25)
-- State 107
, (43, 28), (-1, -25)
-- State 108
, (43, 28), (-1, -25)
-- State 109
, (43, 28), (-1, -25)
-- State 110
, (43, 28), (-1, -25)
-- State 111
, (43, 28), (-1, -25)
-- State 112
, (43, 28), (-1, -25)
-- State 113
, (1, 190), (4, 94), (43, 63), (69, 95), (-1, -3000)
-- State 114
, (43, 28), (-1, -25)
-- State 115
, (3, 33), (4, 41), (25, 36), (29, 39), (43, 63), (46, 32), (64, 40)
, (68, 43), (69, 42), (-1, -3000)
-- State 116
, (63, 194), (-1, -37)
-- State 117
, (-1, -50)
-- State 118
, (-1, -51)
-- State 119
, (-1, -52)
-- State 120
, (24, 196), (-1, -60)
-- State 121
, (24, 197), (-1, -61)
-- State 122
, (23, 129), (-1, -62)
-- State 123
, (43, 28), (-1, -25)
-- State 124
, (43, 28), (-1, -25)
-- State 125
, (43, 28), (-1, -25)
-- State 126
, (-1, -66)
-- State 127
, (-1, -69)
-- State 128
, (1, 204), (43, 28), (-1, -25)
-- State 129
, (27, 128), (-1, -3000)
-- State 130
, (64, 132), (-1, -89)
-- State 131
, (-1, -92)
-- State 132
, (4, 207), (-1, -3000)
-- State 133
, (64, 132), (-1, -93)
-- State 134
, (4, 137), (8, 105), (11, 141), (13, 142), (14, 107), (15, 108), (16, 109)
, (17, 111), (18, 112), (46, 146), (47, 147), (48, 110), (52, 106), (56, 145)
, (61, 210), (63, 211), (66, 138), (67, 139), (-1, -3000)
-- State 135
, (4, 214), (8, 105), (11, 141), (13, 142), (14, 107), (15, 108), (16, 109)
, (17, 111), (18, 112), (46, 146), (47, 147), (48, 110), (52, 106), (56, 145)
, (66, 212), (67, 213), (-1, -176)
-- State 136
, (-1, -180)
-- State 137
, (43, 28), (-1, -25)
-- State 138
, (8, 105), (14, 107), (15, 108), (16, 109), (17, 111), (18, 112), (48, 110)
, (52, 106), (-1, -3000)
-- State 139
, (8, 105), (14, 107), (15, 108), (16, 109), (17, 111), (18, 112), (48, 110)
, (52, 106), (-1, -3000)
-- State 140
, (-1, -187)
-- State 141
, (43, 28), (-1, -25)
-- State 142
, (43, 28), (-1, -25)
-- State 143
, (-1, -191)
-- State 144
, (-1, -192)
-- State 145
, (-1, -193)
-- State 146
, (43, 28), (-1, -25)
-- State 147
, (1, 223), (43, 28), (-1, -25)
-- State 148
, (-1, -41)
-- State 149
, (43, 63), (-1, -99)
-- State 150
, (43, 63), (-1, -100)
-- State 151
, (43, 63), (-1, -101)
-- State 152
, (43, 63), (-1, -115)
-- State 153
, (3, 33), (4, 41), (25, 36), (29, 39), (43, 28), (46, 32), (64, 40)
, (68, 43), (69, 42), (-1, -25)
-- State 154
, (28, 225), (43, 63), (-1, -3000)
-- State 155
, (43, 28), (-1, -25)
-- State 156
, (-1, -140)
-- State 157
, (-1, -147)
-- State 158
, (4, 230), (8, 105), (14, 107), (15, 108), (16, 109), (17, 111), (18, 112)
, (43, 63), (48, 110), (52, 106), (-1, -3000)
-- State 159
, (1, 104), (3, 33), (4, 41), (25, 36), (29, 39), (46, 32), (62, 231)
, (64, 40), (68, 43), (69, 42), (-1, -3000)
-- State 160
, (-1, -35)
-- State 161
, (61, 181), (62, 48), (-1, -167)
-- State 162
, (3, -130), (4, -130), (25, -130), (29, -130), (35, -130), (38, -130), (43, 28)
, (46, -130), (61, -130), (63, -130), (66, -130), (68, 85), (69, -130), (-1, -25)
-- State 163
, (4, 173), (68, 86), (-1, -131)
-- State 164
, (62, 233), (-1, -3000)
-- State 165
, (1, 190), (4, 94), (60, 235), (69, 95), (-1, -108)
-- State 166
, (43, 28), (-1, -25)
-- State 167
, (60, 166), (-1, -3000)
-- State 168
, (43, 63), (-1, -159)
-- State 169
, (1, 239), (43, 28), (-1, -25)
-- State 170
, (-1, -166)
-- State 171
, (43, 28), (-1, -25)
-- State 172
, (43, 63), (-1, -168)
-- State 173
, (43, 28), (-1, -25)
-- State 174
, (43, 28), (-1, -25)
-- State 175
, (43, 63), (-1, -106)
-- State 176
, (1, 104), (3, 33), (4, 41), (25, 36), (29, 39), (46, 32), (62, 243)
, (64, 40), (68, 43), (69, 42), (-1, -3000)
-- State 177
, (1, 190), (4, 94), (43, 63), (69, 95), (-1, -3000)
-- State 178
, (43, 28), (-1, -25)
-- State 179
, (-1, -42)
-- State 180
, (43, 28), (-1, -25)
-- State 181
, (-1, -111)
-- State 182
, (43, 63), (-1, -194)
-- State 183
, (43, 63), (-1, -195)
-- State 184
, (43, 63), (-1, -196)
-- State 185
, (43, 63), (-1, -197)
-- State 186
, (43, 63), (-1, -198)
-- State 187
, (43, 63), (-1, -199)
-- State 188
, (43, 63), (-1, -200)
-- State 189
, (43, 63), (-1, -201)
-- State 190
, (-1, -167)
-- State 191
, (62, 248), (-1, -3000)
-- State 192
, (43, 63), (-1, -15)
-- State 193
, (3, 33), (4, 41), (25, 36), (29, 39), (35, 66), (38, 65), (46, 32)
, (64, 40), (66, 64), (68, 43), (69, 42), (-1, -112)
-- State 194
, (43, 28), (-1, -25)
-- State 195
, (24, 196), (-1, -53)
-- State 196
, (43, 28), (-1, -25)
-- State 197
, (43, 28), (-1, -25)
-- State 198
, (-1, -65)
-- State 199
, (-1, -68)
-- State 200
, (4, 254), (27, 128), (43, 63), (-1, -3000)
-- State 201
, (4, 255), (43, 63), (-1, -3000)
-- State 202
, (24, 196), (43, 63), (-1, -60)
-- State 203
, (4, 257), (8, 105), (14, 107), (15, 108), (16, 109), (17, 111), (18, 112)
, (23, 129), (27, 128), (43, 63), (48, 110), (52, 106), (-1, -3000)
-- State 204
, (28, 261), (-1, -3000)
-- State 205
, (-1, -70)
-- State 206
, (-1, -91)
-- State 207
, (-1, -94)
-- State 208
, (64, 132), (-1, -88)
-- State 209
, (4, 214), (8, 105), (11, 141), (13, 142), (14, 107), (15, 108), (16, 109)
, (17, 111), (18, 112), (46, 146), (47, 147), (48, 110), (52, 106), (56, 145)
, (66, 212), (67, 213), (-1, -175)
-- State 210
, (-1, -40)
-- State 211
, (43, 28), (-1, -25)
-- State 212
, (8, 105), (14, 107), (15, 108), (16, 109), (17, 111), (18, 112), (43, 28)
, (48, 110), (52, 106), (-1, -25)
-- State 213
, (8, 105), (14, 107), (15, 108), (16, 109), (17, 111), (18, 112), (43, 28)
, (48, 110), (52, 106), (-1, -25)
-- State 214
, (43, 28), (-1, -25)
-- State 215
, (-1, -179)
-- State 216
, (32, 266), (43, 63), (-1, -189)
-- State 217
, (-1, -185)
-- State 218
, (-1, -186)
-- State 219
, (43, 63), (-1, -188)
-- State 220
, (43, 63), (-1, -190)
-- State 221
, (43, 63), (-1, -202)
-- State 222
, (4, 137), (8, 105), (11, 141), (13, 142), (14, 107), (15, 108), (16, 109)
, (17, 111), (18, 112), (28, 268), (43, 63), (46, 146), (47, 147), (48, 110)
, (52, 106), (56, 145), (66, 138), (67, 139), (-1, -3000)
-- State 223
, (28, 269), (-1, -3000)
-- State 224
, (43, 63), (-1, -114)
-- State 225
, (-1, -124)
-- State 226
, (30, 276), (32, 270), (43, 63), (49, 271), (53, 272), (57, 273), (58, 274)
, (59, 275), (-1, -3000)
-- State 227
, (4, 279), (28, 278), (66, 280), (-1, -3000)
-- State 228
, (-1, -152)
-- State 229
, (-1, -153)
-- State 230
, (43, 28), (-1, -25)
-- State 231
, (43, 28), (-1, -25)
-- State 232
, (-1, -34)
-- State 233
, (43, 28), (-1, -25)
-- State 234
, (43, 28), (-1, -25)
-- State 235
, (43, 28), (-1, -25)
-- State 236
, (43, 63), (-1, -161)
-- State 237
, (1, 190), (4, 94), (60, 235), (69, 95), (-1, -158)
-- State 238
, (4, 214), (8, 105), (11, 141), (13, 142), (14, 107), (15, 108), (16, 109)
, (17, 111), (18, 112), (43, 63), (46, 146), (47, 147), (48, 110), (52, 106)
, (55, 289), (56, 145), (66, 138), (67, 139), (-1, -3000)
-- State 239
, (-1, -165)
-- State 240
, (43, 63), (-1, -105)
-- State 241
, (43, 63), (-1, -169)
-- State 242
, (43, 63), (-1, -104)
-- State 243
, (43, 28), (-1, -25)
-- State 244
, (60, 291), (62, 292), (-1, -3000)
-- State 245
, (43, 28), (-1, -25)
-- State 246
, (43, 63), (-1, -39)
-- State 247
, (1, 190), (4, 94), (43, 63), (69, 95), (-1, -3000)
-- State 248
, (43, 28), (-1, -25)
-- State 249
, (4, 125), (23, 129), (25, 123), (26, 124), (27, 128), (43, 63), (-1, -3000)
-- State 250
, (24, 196), (-1, -58)
-- State 251
, (27, 128), (43, 63), (-1, -3000)
-- State 252
, (27, 128), (43, 63), (-1, -3000)
-- State 253
, (-1, -54)
-- State 254
, (43, 28), (-1, -25)
-- State 255
, (43, 28), (-1, -25)
-- State 256
, (24, 196), (-1, -57)
-- State 257
, (43, 28), (-1, -25)
-- State 258
, (43, 28), (-1, -25)
-- State 259
, (43, 28), (-1, -25)
-- State 260
, (43, 28), (-1, -25)
-- State 261
, (43, 28), (-1, -25)
-- State 262
, (4, 137), (8, 105), (11, 141), (13, 142), (14, 107), (15, 108), (16, 109)
, (17, 111), (18, 112), (43, 63), (46, 146), (47, 147), (48, 110), (52, 106)
, (56, 145), (66, 138), (67, 139), (-1, -3000)
-- State 263
, (4, 214), (8, 105), (11, 141), (13, 142), (14, 107), (15, 108), (16, 109)
, (17, 111), (18, 112), (43, 63), (46, 146), (47, 147), (48, 110), (52, 106)
, (56, 145), (66, 138), (67, 139), (-1, -3000)
-- State 264
, (4, 214), (8, 105), (11, 141), (13, 142), (14, 107), (15, 108), (16, 109)
, (17, 111), (18, 112), (43, 63), (46, 146), (47, 147), (48, 110), (52, 106)
, (56, 145), (66, 138), (67, 139), (-1, -3000)
-- State 265
, (43, 63), (-1, -189)
-- State 266
, (43, 28), (-1, -25)
-- State 267
, (4, 137), (8, 105), (11, 141), (13, 142), (14, 107), (15, 108), (16, 109)
, (17, 111), (18, 112), (28, 311), (46, 146), (47, 147), (48, 110), (52, 106)
, (56, 145), (63, 211), (66, 138), (67, 139), (-1, -3000)
-- State 268
, (43, 28), (-1, -25)
-- State 269
, (43, 28), (-1, -25)
-- State 270
, (-1, -141)
-- State 271
, (-1, -142)
-- State 272
, (-1, -143)
-- State 273
, (-1, -144)
-- State 274
, (-1, -145)
-- State 275
, (-1, -146)
-- State 276
, (-1, -137)
-- State 277
, (43, 28), (-1, -25)
-- State 278
, (-1, -149)
-- State 279
, (43, 28), (-1, -25)
-- State 280
, (4, 230), (8, 105), (14, 107), (15, 108), (16, 109), (17, 111), (18, 112)
, (48, 110), (52, 106), (-1, -3000)
-- State 281
, (32, 317), (43, 63), (-1, -155)
-- State 282
, (43, 63), (-1, -33)
-- State 283
, (43, 63), (-1, -47)
-- State 284
, (43, 63), (-1, -156)
-- State 285
, (43, 63), (-1, -160)
-- State 286
, (43, 28), (-1, -25)
-- State 287
, (4, 214), (8, 105), (11, 141), (13, 142), (14, 107), (15, 108), (16, 109)
, (17, 111), (18, 112), (22, 319), (46, 146), (47, 147), (48, 110), (52, 106)
, (56, 145), (63, 321), (65, 320), (66, 138), (67, 139), (-1, -163)
-- State 288
, (-1, -184)
-- State 289
, (-1, -164)
-- State 290
, (43, 63), (-1, -32)
-- State 291
, (43, 28), (-1, -25)
-- State 292
, (43, 28), (-1, -25)
-- State 293
, (43, 63), (-1, -96)
-- State 294
, (62, 327), (-1, -3000)
-- State 295
, (43, 63), (-1, -46)
-- State 296
, (-1, -49)
-- State 297
, (27, 128), (-1, -64)
-- State 298
, (-1, -59)
-- State 299
, (-1, -67)
-- State 300
, (43, 63), (-1, -55)
-- State 301
, (43, 63), (-1, -56)
-- State 302
, (28, 331), (37, 329), (38, 330), (43, 63), (64, 333), (-1, -3000)
-- State 303
, (37, 329), (38, 330), (43, 63), (-1, -3000)
-- State 304
, (28, 335), (43, 63), (-1, -3000)
-- State 305
, (28, 336), (43, 63), (-1, -3000)
-- State 306
, (43, 63), (-1, -74)
-- State 307
, (4, 214), (8, 105), (11, 141), (13, 142), (14, 107), (15, 108), (16, 109)
, (17, 111), (18, 112), (46, 146), (47, 147), (48, 110), (52, 106), (56, 145)
, (66, 212), (67, 213), (-1, -174)
-- State 308
, (-1, -177)
-- State 309
, (-1, -178)
-- State 310
, (8, 105), (14, 107), (15, 108), (16, 109), (17, 111), (18, 112), (43, 63)
, (48, 110), (52, 106), (-1, -3000)
-- State 311
, (43, 28), (-1, -25)
-- State 312
, (43, 63), (-1, -172)
-- State 313
, (43, 63), (-1, -173)
-- State 314
, (4, 339), (11, 340), (43, 63), (-1, -3000)
-- State 315
, (43, 63), (-1, -150)
-- State 316
, (-1, -151)
-- State 317
, (43, 28), (-1, -25)
-- State 318
, (43, 63), (-1, -157)
-- State 319
, (43, 28), (-1, -25)
-- State 320
, (43, 28), (-1, -25)
-- State 321
, (43, 28), (-1, -25)
-- State 322
, (-1, -162)
-- State 323
, (4, 214), (8, 105), (11, 141), (13, 142), (14, 107), (15, 108), (16, 109)
, (17, 111), (18, 112), (46, 146), (47, 147), (48, 110), (52, 106), (56, 145)
, (66, 138), (67, 139), (-1, -3000)
-- State 324
, (-1, -183)
-- State 325
, (1, 190), (4, 94), (43, 63), (62, 346), (69, 95), (-1, -3000)
-- State 326
, (43, 63), (-1, -87)
-- State 327
, (43, 28), (-1, -25)
-- State 328
, (24, 197), (-1, -63)
-- State 329
, (32, 349), (-1, -78)
-- State 330
, (32, 350), (-1, -77)
-- State 331
, (43, 28), (-1, -25)
-- State 332
, (43, 28), (-1, -25)
-- State 333
, (43, 28), (-1, -25)
-- State 334
, (43, 28), (-1, -25)
-- State 335
, (43, 28), (-1, -25)
-- State 336
, (43, 28), (-1, -25)
-- State 337
, (43, 28), (-1, -25)
-- State 338
, (43, 63), (-1, -171)
-- State 339
, (43, 28), (-1, -25)
-- State 340
, (43, 28), (-1, -25)
-- State 341
, (8, 105), (14, 107), (15, 108), (16, 109), (17, 111), (18, 112), (43, 63)
, (48, 110), (52, 106), (-1, -3000)
-- State 342
, (43, 63), (-1, -170)
-- State 343
, (43, 63), (-1, -97)
-- State 344
, (43, 63), (-1, -98)
-- State 345
, (-1, -182)
-- State 346
, (43, 28), (-1, -25)
-- State 347
, (43, 28), (-1, -25)
-- State 348
, (43, 63), (-1, -45)
-- State 349
, (-1, -75)
-- State 350
, (-1, -76)
-- State 351
, (43, 63), (-1, -73)
-- State 352
, (8, 105), (14, 107), (15, 108), (16, 109), (17, 111), (18, 112), (43, 63)
, (48, 110), (52, 106), (-1, -3000)
-- State 353
, (4, 365), (8, 105), (14, 107), (15, 108), (16, 109), (17, 111), (18, 112)
, (43, 63), (48, 110), (52, 106), (-1, -3000)
-- State 354
, (4, 367), (43, 63), (-1, -3000)
-- State 355
, (43, 63), (-1, -71)
-- State 356
, (43, 63), (-1, -72)
-- State 357
, (43, 63), (-1, -181)
-- State 358
, (30, 368), (43, 63), (-1, -3000)
-- State 359
, (30, 369), (43, 63), (-1, -3000)
-- State 360
, (-1, -154)
-- State 361
, (43, 63), (-1, -86)
-- State 362
, (43, 63), (-1, -95)
-- State 363
, (-1, -79)
-- State 364
, (-1, -84)
-- State 365
, (-1, -85)
-- State 366
, (-1, -82)
-- State 367
, (28, -81), (43, 28), (-1, -25)
-- State 368
, (-1, -138)
-- State 369
, (-1, -139)
-- State 370
, (8, 105), (14, 107), (15, 108), (16, 109), (17, 111), (18, 112), (43, 63)
, (48, 110), (52, 106), (-1, -3000)
-- State 371
, (-1, -80)
);
-- The offset vector
Shift_Reduce_Offset : constant array (0 .. 371) of Row :=
(0,
18, 36, 37, 40, 41, 42, 43, 44, 45, 46,
50, 52, 54, 56, 58, 60, 62, 63, 66, 68,
70, 73, 75, 76, 77, 79, 91, 92, 93, 103,
104, 105, 106, 107, 108, 109, 117, 120, 121, 124,
128, 130, 132, 133, 135, 138, 139, 141, 143, 144,
150, 152, 155, 174, 176, 178, 179, 181, 188, 192,
210, 212, 214, 215, 217, 219, 221, 231, 240, 242,
243, 244, 245, 246, 247, 248, 250, 251, 252, 253,
256, 258, 260, 261, 263, 264, 265, 266, 277, 279,
282, 284, 287, 289, 291, 293, 295, 297, 308, 310,
329, 330, 331, 333, 336, 338, 340, 342, 344, 346,
348, 350, 352, 357, 359, 369, 371, 372, 373, 374,
376, 378, 380, 382, 384, 386, 387, 388, 391, 393,
395, 396, 398, 400, 419, 436, 437, 439, 448, 457,
458, 460, 462, 463, 464, 465, 467, 470, 471, 473,
475, 477, 479, 489, 492, 494, 495, 496, 507, 518,
519, 522, 536, 539, 541, 546, 548, 550, 552, 555,
556, 558, 560, 562, 564, 566, 577, 582, 584, 585,
587, 588, 590, 592, 594, 596, 598, 600, 602, 604,
605, 607, 609, 621, 623, 625, 627, 629, 630, 631,
635, 638, 641, 654, 656, 657, 658, 659, 661, 678,
679, 681, 691, 701, 703, 704, 707, 708, 709, 711,
713, 715, 734, 736, 738, 739, 748, 752, 753, 754,
756, 758, 759, 761, 763, 765, 767, 772, 791, 792,
794, 796, 798, 800, 803, 805, 807, 812, 814, 821,
823, 826, 829, 830, 832, 834, 836, 838, 840, 842,
844, 846, 864, 882, 900, 902, 904, 923, 925, 927,
928, 929, 930, 931, 932, 933, 934, 936, 937, 939,
949, 952, 954, 956, 958, 960, 962, 982, 983, 984,
986, 988, 990, 992, 994, 996, 997, 999, 1000, 1001,
1003, 1005, 1011, 1015, 1018, 1021, 1023, 1040, 1041, 1042,
1052, 1054, 1056, 1058, 1062, 1064, 1065, 1067, 1069, 1071,
1073, 1075, 1076, 1093, 1094, 1100, 1102, 1104, 1106, 1108,
1110, 1112, 1114, 1116, 1118, 1120, 1122, 1124, 1126, 1128,
1130, 1140, 1142, 1144, 1146, 1147, 1149, 1151, 1153, 1154,
1155, 1157, 1167, 1178, 1181, 1183, 1185, 1187, 1190, 1193,
1194, 1196, 1198, 1199, 1200, 1201, 1202, 1205, 1206, 1207,
1217);
end CSS.Parser.Parser_Shift_Reduce;
|
AdaCore/gpr | Ada | 1,275 | adb | --
-- Copyright (C) 2014-2022, AdaCore
-- SPDX-License-Identifier: Apache-2.0
--
package body Gpr_Parser_Support.Packrat is
function Entry_Index (Offset : Token_Index) return Natural is
(Integer (Offset) mod Memo_Size);
-----------
-- Clear --
-----------
procedure Clear (Memo : in out Memo_Type) is
begin
for E of Memo loop
E.State := No_Result;
end loop;
end Clear;
---------
-- Get --
---------
function Get (Memo : Memo_Type; Offset : Token_Index) return Memo_Entry is
E : Memo_Entry renames Memo (Entry_Index (Offset));
begin
if E.Offset = Offset then
return E;
else
return (State => No_Result, others => <>);
end if;
end Get;
---------
-- Set --
---------
procedure Set (Memo : in out Memo_Type;
Is_Success : Boolean;
Instance : T;
Offset, Final_Pos : Token_Index)
is
E : Memo_Entry renames Memo (Entry_Index (Offset));
begin
E := (State => (if Is_Success then Success else Failure),
Instance => Instance,
Offset => Offset,
Final_Pos => Final_Pos);
end Set;
end Gpr_Parser_Support.Packrat;
|
reznikmm/matreshka | Ada | 5,561 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 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$
------------------------------------------------------------------------------
package body League.Holders.Generic_Compound_Holders is
---------------
-- Component --
---------------
overriding procedure Component
(Self : not null access Element_Container;
Name : League.Strings.Universal_String;
Value : out Container_Access;
Success : out Boolean)
is
Result : League.Holders.Holder;
begin
Component (Self.Value, Name, Result, Success);
if Success then
Value := Result.Data;
Reference (Value);
else
Value := null;
end if;
end Component;
-----------------
-- Constructor --
-----------------
overriding function Constructor
(Is_Empty : not null access Boolean) return Element_Container
is
pragma Assert (Is_Empty.all);
begin
return
(Counter => <>,
Is_Empty => Is_Empty.all,
Value => <>);
end Constructor;
-------------
-- Element --
-------------
function Element (Self : Holder) return Element_Type is
begin
if Self.Data.all not in Element_Container then
raise Constraint_Error with "invalid type of value";
end if;
if Self.Data.Is_Empty then
raise Constraint_Error with "value is empty";
end if;
return Element_Container'Class (Self.Data.all).Value;
end Element;
---------------------
-- Replace_Element --
---------------------
procedure Replace_Element (Self : in out Holder; To : Element_Type) is
begin
if Self.Data.all not in Element_Container then
raise Constraint_Error with "invalid type of value";
end if;
-- XXX This subprogram can be improved to reuse shared segment when
-- possible.
Dereference (Self.Data);
Self.Data :=
new Element_Container'(Counter => <>, Is_Empty => False, Value => To);
end Replace_Element;
---------------
-- To_Holder --
---------------
function To_Holder (Item : Element_Type) return Holder is
begin
return
(Ada.Finalization.Controlled with
new Element_Container'
(Counter => <>, Is_Empty => False, Value => Item));
end To_Holder;
end League.Holders.Generic_Compound_Holders;
|
SSOCsoft/Log_Reporter | Ada | 5,209 | ads | With
Ada.Streams,
Ada.Strings.Less_Case_Insensitive,
Ada.Strings.Equal_Case_Insensitive,
Ada.Containers.Indefinite_Ordered_Maps;
Package INI with Preelaborate, Elaborate_Body is
Type Value_Type is ( vt_String, vt_Float, vt_Integer, vt_Boolean );
Type Instance(Convert : Boolean) is private;
Function Exists( Object : in Instance;
Key : in String;
Section: in String:= ""
) return Boolean;
-- Return the type of the associated value.
Function Value( Object : in Instance;
Key : in String;
Section: in String:= ""
) return Value_Type
with Pre => Exists(Object, Key, Section);
-- Return the value associated with the key in the indicated section.
Function Value( Object : in Instance;
Key : in String;
Section: in String:= ""
) return String
with Pre => Exists(Object, Key, Section);
Function Value( Object : in Instance;
Key : in String;
Section: in String:= ""
) return Float
with Pre => Exists(Object, Key, Section);
Function Value( Object : in Instance;
Key : in String;
Section: in String:= ""
) return Integer
with Pre => Exists(Object, Key, Section);
Function Value( Object : in Instance;
Key : in String;
Section: in String:= ""
) return Boolean
with Pre => Exists(Object, Key, Section);
-- Associates a value with the given key in the indicated section.
Procedure Value( Object : in out Instance;
Key : in String;
Value : in String;
Section: in String:= ""
)
with Post => Exists(Object, Key, Section);
Procedure Value( Object : in out Instance;
Key : in String;
Value : in Float;
Section: in String:= ""
)
with Post => Exists(Object, Key, Section);
Procedure Value( Object : in out Instance;
Key : in String;
Value : in Integer;
Section: in String:= ""
)
with Post => Exists(Object, Key, Section);
Procedure Value( Object : in out Instance;
Key : in String;
Value : in Boolean;
Section: in String:= ""
)
with Post => Exists(Object, Key, Section);
-- This value sets the Convert discriminant for the object that is generated
-- by the 'Input attribute.
Default_Conversion : Boolean := False;
Empty : Constant Instance;
Private
Type Value_Object( Kind : Value_Type; Length : Natural ) ;
Function "ABS"( Object : Value_Object ) return String;
Function "="(Left, Right : Value_Object) return Boolean;
Package Object_Package is
procedure Value_Output(
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : in Value_Object
) is null;
function Value_Input(
Stream : not null access Ada.Streams.Root_Stream_Type'Class
) return Value_Object;
End Object_Package;
Type Value_Object( Kind : Value_Type; Length : Natural ) is record
case Kind is
when vt_String => String_Value : String(1..Length):= (Others=>' ');
when vt_Float => Float_Value : Float := 0.0;
when vt_Integer => Integer_Value: Integer := 0;
when vt_Boolean => Boolean_Value: Boolean := False;
end case;
end record;
-- with Input => Object_Package.Value_Input,
-- Output => Object_Package.Value_Output;
Package KEY_VALUE_MAP is new Ada.Containers.Indefinite_Ordered_Maps(
-- "=" => ,
"<" => Ada.Strings.Less_Case_Insensitive,
Key_Type => String,
Element_Type => Value_Object
);
Function "="(Left, Right : KEY_VALUE_MAP.Map) return Boolean;
Package KEY_SECTION_MAP is new Ada.Containers.Indefinite_Ordered_Maps(
"=" => "=",
"<" => Ada.Strings.Less_Case_Insensitive,
Key_Type => String,
Element_Type => KEY_VALUE_MAP.Map
);
procedure INI_Output(
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : in Instance
);
function INI_Input(
Stream : not null access Ada.Streams.Root_Stream_Type'Class
) return Instance;
Type Instance(Convert : Boolean) is new KEY_SECTION_MAP.Map
with null record
with Input => INI_Input, Output => INI_Output;
overriding
function Copy (Source : Instance) return Instance is
( Source );
Empty : Constant Instance:=
(KEY_SECTION_MAP.map with Convert => True, others => <>);
End INI;
|
docandrew/troodon | Ada | 6,803 | ads | pragma Ada_2012;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with bits_types_h;
with bits_types_struct_timespec_h;
package bits_struct_stat_h is
-- unsupported macro: st_atime st_atim.tv_sec
-- unsupported macro: st_mtime st_mtim.tv_sec
-- unsupported macro: st_ctime st_ctim.tv_sec
-- Definition for struct stat.
-- Copyright (C) 2020-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/>.
-- Device.
type stat_array1037 is array (0 .. 2) of aliased bits_types_h.uu_syscall_slong_t;
type stat is record
st_dev : aliased bits_types_h.uu_dev_t; -- /usr/include/bits/struct_stat.h:28
st_ino : aliased bits_types_h.uu_ino_t; -- /usr/include/bits/struct_stat.h:33
st_nlink : aliased bits_types_h.uu_nlink_t; -- /usr/include/bits/struct_stat.h:41
st_mode : aliased bits_types_h.uu_mode_t; -- /usr/include/bits/struct_stat.h:42
st_uid : aliased bits_types_h.uu_uid_t; -- /usr/include/bits/struct_stat.h:44
st_gid : aliased bits_types_h.uu_gid_t; -- /usr/include/bits/struct_stat.h:45
uu_pad0 : aliased int; -- /usr/include/bits/struct_stat.h:47
st_rdev : aliased bits_types_h.uu_dev_t; -- /usr/include/bits/struct_stat.h:49
st_size : aliased bits_types_h.uu_off_t; -- /usr/include/bits/struct_stat.h:54
st_blksize : aliased bits_types_h.uu_blksize_t; -- /usr/include/bits/struct_stat.h:58
st_blocks : aliased bits_types_h.uu_blkcnt_t; -- /usr/include/bits/struct_stat.h:60
st_atim : aliased bits_types_struct_timespec_h.timespec; -- /usr/include/bits/struct_stat.h:71
st_mtim : aliased bits_types_struct_timespec_h.timespec; -- /usr/include/bits/struct_stat.h:72
st_ctim : aliased bits_types_struct_timespec_h.timespec; -- /usr/include/bits/struct_stat.h:73
uu_glibc_reserved : aliased stat_array1037; -- /usr/include/bits/struct_stat.h:86
end record
with Convention => C_Pass_By_Copy; -- /usr/include/bits/struct_stat.h:26
-- File serial number.
-- 32bit file serial number.
-- File mode.
-- Link count.
-- Link count.
-- File mode.
-- User ID of the file's owner.
-- Group ID of the file's group.
-- Device number, if device.
-- Size of file, in bytes.
-- Size of file, in bytes.
-- Optimal block size for I/O.
-- Number 512-byte blocks allocated.
-- Number 512-byte blocks allocated.
-- Nanosecond resolution timestamps are stored in a format
-- equivalent to 'struct timespec'. This is the type used
-- whenever possible but the Unix namespace rules do not allow the
-- identifier 'timespec' to appear in the <sys/stat.h> header.
-- Therefore we have to handle the use of this header in strictly
-- standard-compliant sources special.
-- Time of last access.
-- Time of last modification.
-- Time of last status change.
-- Time of last access.
-- Nscecs of last access.
-- Time of last modification.
-- Nsecs of last modification.
-- Time of last status change.
-- Nsecs of last status change.
-- File serial number.
-- Note stat64 has the same shape as stat for x86-64.
-- Device.
type stat64_array1037 is array (0 .. 2) of aliased bits_types_h.uu_syscall_slong_t;
type stat64 is record
st_dev : aliased bits_types_h.uu_dev_t; -- /usr/include/bits/struct_stat.h:101
st_ino : aliased bits_types_h.uu_ino64_t; -- /usr/include/bits/struct_stat.h:103
st_nlink : aliased bits_types_h.uu_nlink_t; -- /usr/include/bits/struct_stat.h:104
st_mode : aliased bits_types_h.uu_mode_t; -- /usr/include/bits/struct_stat.h:105
st_uid : aliased bits_types_h.uu_uid_t; -- /usr/include/bits/struct_stat.h:112
st_gid : aliased bits_types_h.uu_gid_t; -- /usr/include/bits/struct_stat.h:113
uu_pad0 : aliased int; -- /usr/include/bits/struct_stat.h:115
st_rdev : aliased bits_types_h.uu_dev_t; -- /usr/include/bits/struct_stat.h:116
st_size : aliased bits_types_h.uu_off_t; -- /usr/include/bits/struct_stat.h:117
st_blksize : aliased bits_types_h.uu_blksize_t; -- /usr/include/bits/struct_stat.h:123
st_blocks : aliased bits_types_h.uu_blkcnt64_t; -- /usr/include/bits/struct_stat.h:124
st_atim : aliased bits_types_struct_timespec_h.timespec; -- /usr/include/bits/struct_stat.h:132
st_mtim : aliased bits_types_struct_timespec_h.timespec; -- /usr/include/bits/struct_stat.h:133
st_ctim : aliased bits_types_struct_timespec_h.timespec; -- /usr/include/bits/struct_stat.h:134
uu_glibc_reserved : aliased stat64_array1037; -- /usr/include/bits/struct_stat.h:144
end record
with Convention => C_Pass_By_Copy; -- /usr/include/bits/struct_stat.h:99
-- File serial number.
-- Link count.
-- File mode.
-- 32bit file serial number.
-- File mode.
-- Link count.
-- User ID of the file's owner.
-- Group ID of the file's group.
-- Device number, if device.
-- Size of file, in bytes.
-- Device number, if device.
-- Size of file, in bytes.
-- Optimal block size for I/O.
-- Nr. 512-byte blocks allocated.
-- Nanosecond resolution timestamps are stored in a format
-- equivalent to 'struct timespec'. This is the type used
-- whenever possible but the Unix namespace rules do not allow the
-- identifier 'timespec' to appear in the <sys/stat.h> header.
-- Therefore we have to handle the use of this header in strictly
-- standard-compliant sources special.
-- Time of last access.
-- Time of last modification.
-- Time of last status change.
-- Time of last access.
-- Nscecs of last access.
-- Time of last modification.
-- Nsecs of last modification.
-- Time of last status change.
-- Nsecs of last status change.
-- File serial number.
-- Tell code we have these members.
-- Nanosecond resolution time values are supported.
end bits_struct_stat_h;
|
zhmu/ananas | Ada | 11,111 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- D E B U G --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains global flags used to control the inclusion
-- of debugging code in various phases of the compiler. Some of these
-- flags are also used by the binder and gnatmake.
package Debug is
pragma Preelaborate;
-------------------------
-- Dynamic Debug Flags --
-------------------------
-- Flags that can be used to activate various specialized debugging output
-- information. The flags are preset to False, which corresponds to the
-- given output being suppressed. The individual flags can be turned on
-- using the undocumented switch dxxx where xxx is a string of letters for
-- flags to be turned on. Documentation on the current usage of these flags
-- is contained in the body of Debug rather than the spec, so that we don't
-- have to recompile the world when a new debug flag is added.
-- WARNING: There is a matching C declaration of a few flags in fe.h
Debug_Flag_A : Boolean := False;
Debug_Flag_B : Boolean := False;
Debug_Flag_C : Boolean := False;
Debug_Flag_D : Boolean := False;
Debug_Flag_E : Boolean := False;
Debug_Flag_F : Boolean := False;
Debug_Flag_G : Boolean := False;
Debug_Flag_H : Boolean := False;
Debug_Flag_I : Boolean := False;
Debug_Flag_J : Boolean := False;
Debug_Flag_K : Boolean := False;
Debug_Flag_L : Boolean := False;
Debug_Flag_M : Boolean := False;
Debug_Flag_N : Boolean := False;
Debug_Flag_O : Boolean := False;
Debug_Flag_P : Boolean := False;
Debug_Flag_Q : Boolean := False;
Debug_Flag_R : Boolean := False;
Debug_Flag_S : Boolean := False;
Debug_Flag_T : Boolean := False;
Debug_Flag_U : Boolean := False;
Debug_Flag_V : Boolean := False;
Debug_Flag_W : Boolean := False;
Debug_Flag_X : Boolean := False;
Debug_Flag_Y : Boolean := False;
Debug_Flag_Z : Boolean := False;
Debug_Flag_AA : Boolean := False;
Debug_Flag_BB : Boolean := False;
Debug_Flag_CC : Boolean := False;
Debug_Flag_DD : Boolean := False;
Debug_Flag_EE : Boolean := False;
Debug_Flag_FF : Boolean := False;
Debug_Flag_GG : Boolean := False;
Debug_Flag_HH : Boolean := False;
Debug_Flag_II : Boolean := False;
Debug_Flag_JJ : Boolean := False;
Debug_Flag_KK : Boolean := False;
Debug_Flag_LL : Boolean := False;
Debug_Flag_MM : Boolean := False;
Debug_Flag_NN : Boolean := False;
Debug_Flag_OO : Boolean := False;
Debug_Flag_PP : Boolean := False;
Debug_Flag_QQ : Boolean := False;
Debug_Flag_RR : Boolean := False;
Debug_Flag_SS : Boolean := False;
Debug_Flag_TT : Boolean := False;
Debug_Flag_UU : Boolean := False;
Debug_Flag_VV : Boolean := False;
Debug_Flag_WW : Boolean := False;
Debug_Flag_XX : Boolean := False;
Debug_Flag_YY : Boolean := False;
Debug_Flag_ZZ : Boolean := False;
Debug_Flag_1 : Boolean := False;
Debug_Flag_2 : Boolean := False;
Debug_Flag_3 : Boolean := False;
Debug_Flag_4 : Boolean := False;
Debug_Flag_5 : Boolean := False;
Debug_Flag_6 : Boolean := False;
Debug_Flag_7 : Boolean := False;
Debug_Flag_8 : Boolean := False;
Debug_Flag_9 : Boolean := False;
Debug_Flag_Dot_A : Boolean := False;
Debug_Flag_Dot_B : Boolean := False;
Debug_Flag_Dot_C : Boolean := False;
Debug_Flag_Dot_D : Boolean := False;
Debug_Flag_Dot_E : Boolean := False;
Debug_Flag_Dot_F : Boolean := False;
Debug_Flag_Dot_G : Boolean := False;
Debug_Flag_Dot_H : Boolean := False;
Debug_Flag_Dot_I : Boolean := False;
Debug_Flag_Dot_J : Boolean := False;
Debug_Flag_Dot_K : Boolean := False;
Debug_Flag_Dot_L : Boolean := False;
Debug_Flag_Dot_M : Boolean := False;
Debug_Flag_Dot_N : Boolean := False;
Debug_Flag_Dot_O : Boolean := False;
Debug_Flag_Dot_P : Boolean := False;
Debug_Flag_Dot_Q : Boolean := False;
Debug_Flag_Dot_R : Boolean := False;
Debug_Flag_Dot_S : Boolean := False;
Debug_Flag_Dot_T : Boolean := False;
Debug_Flag_Dot_U : Boolean := False;
Debug_Flag_Dot_V : Boolean := False;
Debug_Flag_Dot_W : Boolean := False;
Debug_Flag_Dot_X : Boolean := False;
Debug_Flag_Dot_Y : Boolean := False;
Debug_Flag_Dot_Z : Boolean := False;
Debug_Flag_Dot_AA : Boolean := False;
Debug_Flag_Dot_BB : Boolean := False;
Debug_Flag_Dot_CC : Boolean := False;
Debug_Flag_Dot_DD : Boolean := False;
Debug_Flag_Dot_EE : Boolean := False;
Debug_Flag_Dot_FF : Boolean := False;
Debug_Flag_Dot_GG : Boolean := False;
Debug_Flag_Dot_HH : Boolean := False;
Debug_Flag_Dot_II : Boolean := False;
Debug_Flag_Dot_JJ : Boolean := False;
Debug_Flag_Dot_KK : Boolean := False;
Debug_Flag_Dot_LL : Boolean := False;
Debug_Flag_Dot_MM : Boolean := False;
Debug_Flag_Dot_NN : Boolean := False;
Debug_Flag_Dot_OO : Boolean := False;
Debug_Flag_Dot_PP : Boolean := False;
Debug_Flag_Dot_QQ : Boolean := False;
Debug_Flag_Dot_RR : Boolean := False;
Debug_Flag_Dot_SS : Boolean := False;
Debug_Flag_Dot_TT : Boolean := False;
Debug_Flag_Dot_UU : Boolean := False;
Debug_Flag_Dot_VV : Boolean := False;
Debug_Flag_Dot_WW : Boolean := False;
Debug_Flag_Dot_XX : Boolean := False;
Debug_Flag_Dot_YY : Boolean := False;
Debug_Flag_Dot_ZZ : Boolean := False;
Debug_Flag_Dot_1 : Boolean := False;
Debug_Flag_Dot_2 : Boolean := False;
Debug_Flag_Dot_3 : Boolean := False;
Debug_Flag_Dot_4 : Boolean := False;
Debug_Flag_Dot_5 : Boolean := False;
Debug_Flag_Dot_6 : Boolean := False;
Debug_Flag_Dot_7 : Boolean := False;
Debug_Flag_Dot_8 : Boolean := False;
Debug_Flag_Dot_9 : Boolean := False;
Debug_Flag_Underscore_A : Boolean := False;
Debug_Flag_Underscore_B : Boolean := False;
Debug_Flag_Underscore_C : Boolean := False;
Debug_Flag_Underscore_D : Boolean := False;
Debug_Flag_Underscore_E : Boolean := False;
Debug_Flag_Underscore_F : Boolean := False;
Debug_Flag_Underscore_G : Boolean := False;
Debug_Flag_Underscore_H : Boolean := False;
Debug_Flag_Underscore_I : Boolean := False;
Debug_Flag_Underscore_J : Boolean := False;
Debug_Flag_Underscore_K : Boolean := False;
Debug_Flag_Underscore_L : Boolean := False;
Debug_Flag_Underscore_M : Boolean := False;
Debug_Flag_Underscore_N : Boolean := False;
Debug_Flag_Underscore_O : Boolean := False;
Debug_Flag_Underscore_P : Boolean := False;
Debug_Flag_Underscore_Q : Boolean := False;
Debug_Flag_Underscore_R : Boolean := False;
Debug_Flag_Underscore_S : Boolean := False;
Debug_Flag_Underscore_T : Boolean := False;
Debug_Flag_Underscore_U : Boolean := False;
Debug_Flag_Underscore_V : Boolean := False;
Debug_Flag_Underscore_W : Boolean := False;
Debug_Flag_Underscore_X : Boolean := False;
Debug_Flag_Underscore_Y : Boolean := False;
Debug_Flag_Underscore_Z : Boolean := False;
Debug_Flag_Underscore_AA : Boolean := False;
Debug_Flag_Underscore_BB : Boolean := False;
Debug_Flag_Underscore_CC : Boolean := False;
Debug_Flag_Underscore_DD : Boolean := False;
Debug_Flag_Underscore_EE : Boolean := False;
Debug_Flag_Underscore_FF : Boolean := False;
Debug_Flag_Underscore_GG : Boolean := False;
Debug_Flag_Underscore_HH : Boolean := False;
Debug_Flag_Underscore_II : Boolean := False;
Debug_Flag_Underscore_JJ : Boolean := False;
Debug_Flag_Underscore_KK : Boolean := False;
Debug_Flag_Underscore_LL : Boolean := False;
Debug_Flag_Underscore_MM : Boolean := False;
Debug_Flag_Underscore_NN : Boolean := False;
Debug_Flag_Underscore_OO : Boolean := False;
Debug_Flag_Underscore_PP : Boolean := False;
Debug_Flag_Underscore_QQ : Boolean := False;
Debug_Flag_Underscore_RR : Boolean := False;
Debug_Flag_Underscore_SS : Boolean := False;
Debug_Flag_Underscore_TT : Boolean := False;
Debug_Flag_Underscore_UU : Boolean := False;
Debug_Flag_Underscore_VV : Boolean := False;
Debug_Flag_Underscore_WW : Boolean := False;
Debug_Flag_Underscore_XX : Boolean := False;
Debug_Flag_Underscore_YY : Boolean := False;
Debug_Flag_Underscore_ZZ : Boolean := False;
Debug_Flag_Underscore_1 : Boolean := False;
Debug_Flag_Underscore_2 : Boolean := False;
Debug_Flag_Underscore_3 : Boolean := False;
Debug_Flag_Underscore_4 : Boolean := False;
Debug_Flag_Underscore_5 : Boolean := False;
Debug_Flag_Underscore_6 : Boolean := False;
Debug_Flag_Underscore_7 : Boolean := False;
Debug_Flag_Underscore_8 : Boolean := False;
Debug_Flag_Underscore_9 : Boolean := False;
procedure Set_Debug_Flag (C : Character; Val : Boolean := True);
-- Where C is 0-9, A-Z, or a-z, sets the corresponding debug flag to
-- the given value. In the checks off version of debug, the call to
-- Set_Debug_Flag is always a null operation.
procedure Set_Dotted_Debug_Flag (C : Character; Val : Boolean := True);
-- Where C is 0-9, A-Z, or a-z, sets the corresponding dotted debug
-- flag (e.g. call with C = 'a' for the .a flag).
procedure Set_Underscored_Debug_Flag (C : Character; Val : Boolean := True);
-- Where C is 0-9, A-Z, or a-z, sets the corresponding underscored debug
-- flag (e.g. call with C = 'a' for the _a flag).
end Debug;
|
AdaCore/training_material | Ada | 5,729 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . L I B M _ D O U B L E . S Q R T --
-- --
-- B o d y --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
-- This is the Ada Cert Math specific implementation of sqrt (powerpc)
with Ada.Unchecked_Conversion;
with System.Machine_Code;
package body Libm_Double.Squareroot is
function Rsqrt (X : Long_Float) return Long_Float;
-- Compute the reciprocal square root. There are two reasons for computing
-- the reciprocal square root instead of computing directly the square
-- root: PowerPc provides an instruction (fsqrte) to compute an estimate of
-- the reciprocal (with 5 bits of precision), and the Newton-Raphson method
-- is more efficient on the reciprocal than on the direct root (because the
-- direct root needs divisions, while the reciprocal does not). Note that
-- PowerPc core e300 doesn't support the direct square root operation.
-----------
-- Rsqrt --
-----------
function Rsqrt (X : Long_Float) return Long_Float is
X_Half : constant Long_Float := X * 0.5;
Y : Long_Float;
begin
if Standard'Target_Name = "powerpc-elf" then
-- On powerpc, the precision of fsqrte is at least 5 binary digits
System.Machine_Code.Asm ("frsqrte %0,%1",
Outputs => Long_Float'Asm_Output ("=f", Y),
Inputs => Long_Float'Asm_Input ("f", X));
else
-- Provide the exact result for 1.0
if X = 1.0 then
return X;
end if;
-- Use the method described in Fast Inverse Square Root article by
-- Chris Lomont (http://www.lomont.org/Math/Papers/2003/InvSqrt.pdf),
-- although the code was known before that article.
declare
type Unsigned_Long is mod 2**64;
function To_Unsigned_Long is new Ada.Unchecked_Conversion
(Long_Float, Unsigned_Long);
function From_Unsigned_Long is new Ada.Unchecked_Conversion
(Unsigned_Long, Long_Float);
U : Unsigned_Long;
begin
U := To_Unsigned_Long (X);
U := 16#5fe6ec85_e7de30da# - (U / 2);
Y := From_Unsigned_Long (U);
-- Precision is about 4 digits
end;
end if;
-- Newton iterations: X <- X - F(X)/F'(X)
-- Here F(X) = 1/X^2 - A, so F'(X) = -2/X^3
-- So: X <- X - (1/X^2 - A) / (-2/X^3)
-- <- X + .5(X - A*X^3)
-- <- X + .5*X*(1 - A*X^2)
-- <- X (1 + .5 - .5*A*X^2)
-- <- X(1.5 - .5*A*X^2)
-- Precision is doubled at each iteration.
-- Refine: 10 digits (PowerPc) or 8 digits (fast method)
Y := Y * (1.5 - X_Half * Y * Y);
-- Refine: 20 digits (PowerPc) or 16 digits (fast method)
Y := Y * (1.5 - X_Half * Y * Y);
-- Refine: 40 digits (PowerPc) or 32 digits (fast method)
Y := Y * (1.5 - X_Half * Y * Y);
-- Refine (beyond the precision of Long_Float)
Y := Y * (1.5 - X_Half * Y * Y);
return Y;
end Rsqrt;
----------
-- Sqrt --
----------
function Sqrt (X : Long_Float) return Long_Float is
begin
if X <= 0.0 then
if X = 0.0 then
return X;
else
return NaN;
end if;
elsif X = Infinity then
return X;
else
return X * Rsqrt (X);
end if;
end Sqrt;
end Libm_Double.Squareroot;
|
stcarrez/ada-mail | Ada | 3,439 | adb | -----------------------------------------------------------------------
-- mgrep -- Mail grep command
-- Copyright (C) 2020 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.Command_Line;
with Ada.Directories;
with Ada.Text_IO;
with Ada.IO_Exceptions;
with Ada.Exceptions;
with GNAT.Command_Line;
with GNAT.Regpat;
with Util.Log.Loggers;
with Util.Commands;
with Mgrep.Matcher;
with Mgrep.Scanner;
with Mgrep.Printer;
procedure Mgrep.Main is
use Ada.Text_IO;
use Ada.Directories;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Mgrep.Main");
Printer : aliased Mgrep.Printer.Printer_Type;
Rule : aliased Mgrep.Matcher.Mail_Rule;
Count : constant Natural := Ada.Command_Line.Argument_Count;
begin
Rule.Collector := Printer'Unchecked_Access;
if Count < 2 then
Put_Line ("Usage: mgrep <pattern> {file|directory}");
return;
end if;
Configure_Logs (False, False, False);
GNAT.Regpat.Compile (Rule.Pattern, Ada.Command_Line.Argument (1));
declare
Scanner : Mgrep.Scanner.Scanner_Type (8, Rule'Access);
Done : Boolean;
begin
Scanner.Start;
for I in 2 .. Ada.Command_Line.Argument_Count loop
declare
Path : constant String := Ada.Command_Line.Argument (I);
Kind : constant File_Kind := Ada.Directories.Kind (Path);
begin
if Kind /= Ada.Directories.Directory then
Scanner.Add_File (Path);
else
Scanner.Add_Directory (Path);
end if;
end;
end loop;
loop
Scanner.Process (Done);
Printer.Report;
exit when Done;
end loop;
Scanner.Stop;
Put_Line ("Directories :" & Natural'Image (Scanner.Get_Directory_Count));
Put_Line ("Files :" & Natural'Image (Scanner.Get_File_Count));
exception
when E : others =>
Log.Error ("Internal error", E);
Scanner.Stop;
end;
exception
when GNAT.Command_Line.Exit_From_Command_Line | GNAT.Command_Line.Invalid_Switch =>
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
when GNAT.Regpat.Expression_Error =>
Log.Error (-("Invalid pattern"));
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
when Util.Commands.Not_Found =>
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
when E : Ada.IO_Exceptions.Name_Error =>
Log.Error (-("Cannot access file: {0}"), Ada.Exceptions.Exception_Message (E));
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
when E : others =>
Log.Error (-("Some internal error occurred"), E);
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
end Mgrep.Main;
|
reznikmm/matreshka | Ada | 4,712 | 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$
------------------------------------------------------------------------------
package Matreshka.ODF_Elements.Text.Sequence_Decl is
type Text_Sequence_Decl_Node is
new Matreshka.ODF_Elements.Text.Text_Node_Base with null record;
type Text_Sequence_Decl_Access is
access all Text_Sequence_Decl_Node'Class;
overriding procedure Enter_Element
(Self : not null access Text_Sequence_Decl_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Leave_Element
(Self : not null access Text_Sequence_Decl_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Visit_Element
(Self : not null access Text_Sequence_Decl_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);
-- Dispatch call to corresponding subprogram of iterator interface.
overriding function Get_Local_Name
(Self : not null access constant Text_Sequence_Decl_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Elements.Text.Sequence_Decl;
|
reznikmm/matreshka | Ada | 4,943 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Complete Meta Object Facility --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Elements;
with AMF.Extents;
package AMF.URI_Extents is
pragma Preelaborate;
type URI_Extent is limited interface and AMF.Extents.Extent;
type URI_Extent_Access is access all URI_Extent'Class;
for URI_Extent_Access'Storage_Size use 0;
not overriding function Context_URI
(Self : not null access constant URI_Extent)
return League.Strings.Universal_String is abstract;
-- Specifies an identifier for the extent that establishes a URI context
-- for identifying elements in the extent. An extent has an identifier if a
-- URI is assigned. URI is defined in IETF RFC-2396 available at
-- http://www.ietf.org/rfc/rfc2396.txt.
not overriding function URI
(Self : not null access constant URI_Extent;
Element : not null access constant AMF.Elements.Abstract_Element'Class)
return League.Strings.Universal_String is abstract;
-- Returns the URI of the given element in the extent. Returns Null if the
-- element is not in the extent.
not overriding function Element
(Self : not null access constant URI_Extent;
URI : League.Strings.Universal_String)
return AMF.Elements.Element_Access is abstract;
-- Returns the Element identified by the given URI in the extent. Returns
-- Null if there is no element in the extent with the given URI. Note the
-- Element does not (necessarily) contain a property corresponding to the
-- URI. The URI identifies the element in the context of the extent. The
-- same element may have a different identifier in another extent.
end AMF.URI_Extents;
|
reznikmm/matreshka | Ada | 4,663 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Text.Use_Other_Objects_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Use_Other_Objects_Attribute_Node is
begin
return Self : Text_Use_Other_Objects_Attribute_Node do
Matreshka.ODF_Text.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Text_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Text_Use_Other_Objects_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Use_Other_Objects_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.Use_Other_Objects_Attribute,
Text_Use_Other_Objects_Attribute_Node'Tag);
end Matreshka.ODF_Text.Use_Other_Objects_Attributes;
|
kjseefried/coreland-cgbc | Ada | 788 | adb | with Ada.Strings;
with CGBC.Bounded_Wide_Strings;
with Test;
procedure T_WBstr_Append_R02 is
package BS renames CGBC.Bounded_Wide_Strings;
TC : Test.Context_t;
S1 : BS.Bounded_String (8);
begin
Test.Initialize
(Test_Context => TC,
Program => "t_wbstr_append_r02",
Test_DB => "TEST_DB",
Test_Results => "TEST_RESULTS");
BS.Append (S1, "ABCDEFG");
-- Right does not require truncation.
BS.Append
(Source => S1,
New_Item => "H",
Drop => Ada.Strings.Right);
Test.Check (TC, 1286, BS.Length (S1) = 8, "BS.Length (S1) = 8");
Test.Check (TC, 1287, BS.Maximum_Length (S1) = 8, "BS.Maximum_Length (S1) = 8");
Test.Check (TC, 1288, BS.To_String (S1) = "ABCDEFGH", "BS.To_String (S1) = ""ABCDEFGH""");
end T_WBstr_Append_R02;
|
zhmu/ananas | Ada | 428 | adb | -- { dg-do run }
with Ada.Unchecked_Deallocation;
procedure Release_UNC_Maxalign is
type List is array (Natural range <>) of Integer;
for List'Alignment use Standard'Maximum_Alignment;
type List_Access is access all List;
procedure Release is new Ada.Unchecked_Deallocation
(Object => List, Name => List_Access);
My_List : List_Access;
begin
My_List := new List (1 .. 3);
Release (My_List);
end;
|
HeisenbugLtd/flac-ada | Ada | 3,029 | ads | ------------------------------------------------------------------------------
-- Copyright (C) 2020 by Heisenbug Ltd. ([email protected])
--
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.
------------------------------------------------------------------------------
pragma License (Unrestricted);
------------------------------------------------------------------------------
-- FLAC/Ada
--
-- SPARK_Stream_IO
--
-- Very simple wrapper around Ada.Streams.Stream_IO.
------------------------------------------------------------------------------
with Ada.Streams.Stream_IO;
package SPARK_Stream_IO with
Preelaborate => True,
SPARK_Mode => On
is
package ASS renames Ada.Streams.Stream_IO;
---------------------------------------------------------------------------
-- Is_Open
---------------------------------------------------------------------------
function Is_Open (File : in ASS.File_Type) return Boolean;
---------------------------------------------------------------------------
-- Open
---------------------------------------------------------------------------
procedure Open (File : out ASS.File_Type;
Name : in String;
Error : out Boolean)
with
Post => (Is_Open (File => File) = not Error),
Depends => (File => Name,
Error => Name);
---------------------------------------------------------------------------
-- Close
---------------------------------------------------------------------------
procedure Close (File : in out ASS.File_Type)
with
Pre => Is_Open (File => File),
Post => (not Is_Open (File => File)),
Depends => (File => File);
---------------------------------------------------------------------------
-- Read
---------------------------------------------------------------------------
procedure Read (File : in ASS.File_Type;
Item : out Ada.Streams.Stream_Element_Array;
Error : out Boolean)
with
Relaxed_Initialization => Item,
Pre => Is_Open (File => File),
Post => (Is_Open (File => File) and then
(if not Error then Item'Initialized)),
Depends => (Error => (File, Item),
Item => (File, Item));
---------------------------------------------------------------------------
-- Skip
---------------------------------------------------------------------------
procedure Skip (File : in ASS.File_Type;
Num_Elements : in ASS.Count;
Error : out Boolean)
with
Pre => Is_Open (File => File),
Post => Is_Open (File => File),
Depends => (Error => (File, Num_Elements));
end SPARK_Stream_IO;
|
reznikmm/matreshka | Ada | 5,130 | 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.Time_Constraints.Collections is
pragma Preelaborate;
package UML_Time_Constraint_Collections is
new AMF.Generic_Collections
(UML_Time_Constraint,
UML_Time_Constraint_Access);
type Set_Of_UML_Time_Constraint is
new UML_Time_Constraint_Collections.Set with null record;
Empty_Set_Of_UML_Time_Constraint : constant Set_Of_UML_Time_Constraint;
type Ordered_Set_Of_UML_Time_Constraint is
new UML_Time_Constraint_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_UML_Time_Constraint : constant Ordered_Set_Of_UML_Time_Constraint;
type Bag_Of_UML_Time_Constraint is
new UML_Time_Constraint_Collections.Bag with null record;
Empty_Bag_Of_UML_Time_Constraint : constant Bag_Of_UML_Time_Constraint;
type Sequence_Of_UML_Time_Constraint is
new UML_Time_Constraint_Collections.Sequence with null record;
Empty_Sequence_Of_UML_Time_Constraint : constant Sequence_Of_UML_Time_Constraint;
private
Empty_Set_Of_UML_Time_Constraint : constant Set_Of_UML_Time_Constraint
:= (UML_Time_Constraint_Collections.Set with null record);
Empty_Ordered_Set_Of_UML_Time_Constraint : constant Ordered_Set_Of_UML_Time_Constraint
:= (UML_Time_Constraint_Collections.Ordered_Set with null record);
Empty_Bag_Of_UML_Time_Constraint : constant Bag_Of_UML_Time_Constraint
:= (UML_Time_Constraint_Collections.Bag with null record);
Empty_Sequence_Of_UML_Time_Constraint : constant Sequence_Of_UML_Time_Constraint
:= (UML_Time_Constraint_Collections.Sequence with null record);
end AMF.UML.Time_Constraints.Collections;
|
reznikmm/matreshka | Ada | 6,852 | 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$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.UML_Attributes;
with AMF.UML.Usages;
with AMF.Visitors.Standard_Profile_L2_Iterators;
with AMF.Visitors.Standard_Profile_L2_Visitors;
package body AMF.Internals.Standard_Profile_L2_Instantiates is
--------------------
-- Get_Base_Usage --
--------------------
overriding function Get_Base_Usage
(Self : not null access constant Standard_Profile_L2_Instantiate_Proxy)
return AMF.UML.Usages.UML_Usage_Access is
begin
return
AMF.UML.Usages.UML_Usage_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Base_Usage
(Self.Element)));
end Get_Base_Usage;
--------------------
-- Set_Base_Usage --
--------------------
overriding procedure Set_Base_Usage
(Self : not null access Standard_Profile_L2_Instantiate_Proxy;
To : AMF.UML.Usages.UML_Usage_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Base_Usage
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Base_Usage;
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant Standard_Profile_L2_Instantiate_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.Standard_Profile_L2_Visitors.Standard_Profile_L2_Visitor'Class then
AMF.Visitors.Standard_Profile_L2_Visitors.Standard_Profile_L2_Visitor'Class
(Visitor).Enter_Instantiate
(AMF.Standard_Profile_L2.Instantiates.Standard_Profile_L2_Instantiate_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant Standard_Profile_L2_Instantiate_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.Standard_Profile_L2_Visitors.Standard_Profile_L2_Visitor'Class then
AMF.Visitors.Standard_Profile_L2_Visitors.Standard_Profile_L2_Visitor'Class
(Visitor).Leave_Instantiate
(AMF.Standard_Profile_L2.Instantiates.Standard_Profile_L2_Instantiate_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant Standard_Profile_L2_Instantiate_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.Standard_Profile_L2_Iterators.Standard_Profile_L2_Iterator'Class then
AMF.Visitors.Standard_Profile_L2_Iterators.Standard_Profile_L2_Iterator'Class
(Iterator).Visit_Instantiate
(Visitor,
AMF.Standard_Profile_L2.Instantiates.Standard_Profile_L2_Instantiate_Access (Self),
Control);
end if;
end Visit_Element;
end AMF.Internals.Standard_Profile_L2_Instantiates;
|
reznikmm/matreshka | Ada | 4,741 | 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.Style_Region_Left_Elements;
package Matreshka.ODF_Style.Region_Left_Elements is
type Style_Region_Left_Element_Node is
new Matreshka.ODF_Style.Abstract_Style_Element_Node
and ODF.DOM.Style_Region_Left_Elements.ODF_Style_Region_Left
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Style_Region_Left_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Style_Region_Left_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Style_Region_Left_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 Style_Region_Left_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 Style_Region_Left_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_Style.Region_Left_Elements;
|
stcarrez/ada-util | Ada | 5,440 | adb | -----------------------------------------------------------------------
-- util-commands-consoles-text -- Text console interface
-- Copyright (C) 2014, 2015, 2017, 2018, 2020, 2021, 2022, 2023 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body Util.Commands.Consoles.Text is
procedure Set_Col (Console : in out Console_Type;
Col : in Positive) is
begin
if Console.Cur_Col < Col then
declare
Count : constant Positive := Col - Console.Cur_Col;
Spaces : constant String (1 .. Count)
:= (others => ' ');
begin
IO.Put (Spaces);
Console.Cur_Col := Col;
end;
end if;
end Set_Col;
procedure Put (Console : in out Console_Type;
Content : in Input_Type) is
begin
IO.Put (To_String (Content));
Console.Cur_Col := Console.Cur_Col + Content'Length;
end Put;
-- ------------------------------
-- Report an error message.
-- ------------------------------
overriding
procedure Error (Console : in out Console_Type;
Message : in Input_Type) is
begin
IO.Put_Line (To_String (Message));
Console.Cur_Col := 1;
end Error;
-- ------------------------------
-- Report a notice message.
-- ------------------------------
overriding
procedure Notice (Console : in out Console_Type;
Kind : in Notice_Type;
Message : in Input_Type) is
pragma Unreferenced (Kind);
begin
IO.Put_Line (To_String (Message));
Console.Cur_Col := 1;
end Notice;
-- ------------------------------
-- Print the field value for the given field.
-- ------------------------------
overriding
procedure Print_Field (Console : in out Console_Type;
Field : in Field_Type;
Value : in Input_Type;
Justify : in Justify_Type := J_LEFT) is
Pos : constant Positive := Console.Cols (Field);
Size : constant Natural := Console.Sizes (Field);
Start : Natural := Value'First;
Last : constant Natural := Value'Last;
Pad : Natural := 0;
begin
case Justify is
when J_LEFT =>
if Value'Length >= Size and then Size > 0 then
Start := Last - Size + 1 + 1;
end if;
when J_RIGHT =>
if Value'Length < Size then
Pad := Size - Value'Length - 1;
else
Start := Last - Size + 1;
end if;
when J_CENTER =>
if Value'Length < Size then
Pad := (Size - Value'Length) / 2;
else
Start := Last - Size + 1;
end if;
when J_RIGHT_NO_FILL =>
if Value'Length >= Size then
Start := Last - Size + 1;
end if;
end case;
if Pad > 0 then
Console.Set_Col (Pos + Pad);
elsif Pos > 1 then
Console.Set_Col (Pos);
end if;
Console.Put (Value (Start .. Last));
end Print_Field;
-- ------------------------------
-- Print the title for the given field.
-- ------------------------------
overriding
procedure Print_Title (Console : in out Console_Type;
Field : in Field_Type;
Title : in Input_Type;
Justify : in Justify_Type := J_LEFT) is
begin
Console.Print_Field (Field, Title, Justify);
end Print_Title;
-- ------------------------------
-- Start a new title in a report.
-- ------------------------------
overriding
procedure Start_Title (Console : in out Console_Type) is
begin
Console.Field_Count := 0;
Console.Sizes := (others => 0);
Console.Cols := (others => 1);
end Start_Title;
-- ------------------------------
-- Finish a new title in a report.
-- ------------------------------
overriding
procedure End_Title (Console : in out Console_Type) is
begin
IO.New_Line (IO.Count_Type'First);
Console.Cur_Col := 1;
end End_Title;
-- ------------------------------
-- Start a new row in a report.
-- ------------------------------
overriding
procedure Start_Row (Console : in out Console_Type) is
pragma Unreferenced (Console);
begin
null;
end Start_Row;
-- ------------------------------
-- Finish a new row in a report.
-- ------------------------------
overriding
procedure End_Row (Console : in out Console_Type) is
begin
IO.New_Line (IO.Count_Type'First);
Console.Cur_Col := 1;
end End_Row;
end Util.Commands.Consoles.Text;
|
reznikmm/matreshka | Ada | 4,075 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Style_Text_Overline_Type_Attributes;
package Matreshka.ODF_Style.Text_Overline_Type_Attributes is
type Style_Text_Overline_Type_Attribute_Node is
new Matreshka.ODF_Style.Abstract_Style_Attribute_Node
and ODF.DOM.Style_Text_Overline_Type_Attributes.ODF_Style_Text_Overline_Type_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Text_Overline_Type_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Style_Text_Overline_Type_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Style.Text_Overline_Type_Attributes;
|
SietsevanderMolen/fly-thing | Ada | 929 | ads | with Quaternions;
with Vector_Math; use Vector_Math;
package AHRS is
package Float_Quaternion is new Quaternions (Float);
use Float_Quaternion;
type Mahony is
record
Sample_Period : Float;
Proportional_Gain : Float;
Integral_Gain : Float;
Integral_Error : Vector_Math.Float3 := (0.0, 0.0, 0.0);
Output : Quaternion := (1.0, 0.0, 0.0, 0.0);
end record;
function Make (Sample_Period : Float;
Proportional_Gain : Float;
Integral_Gain : Float) return Mahony;
procedure Update (M : in out Mahony;
Accelerometer : Vector_Math.Float3;
Gyroscope : Vector_Math.Float3);
procedure Update (M : in out Mahony;
Accelerometer : Vector_Math.Float3;
Gyroscope : Vector_Math.Float3;
Magnetometer : Vector_Math.Float3);
end AHRS;
|
AdaCore/gpr | Ada | 50 | ads | package Pack2 is
procedure Dummy;
end Pack2;
|
stcarrez/ada-util | Ada | 2,210 | ads | -----------------------------------------------------------------------
-- util-dates-iso8601 -- ISO8601 dates
-- Copyright (C) 2011, 2013, 2016, 2018 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Calendar;
-- == ISO8601 Dates ==
-- The ISO8601 defines a standard date format that is commonly used and easily parsed by programs.
-- The `Util.Dates.ISO8601` package provides an `Image` function to convert a date into that
-- target format and a `Value` function to parse such format string and return the date.
--
-- Now : constant Ada.Calendar.Time := Ada.Calendar.Clock;
-- S : constant String := Util.Dates.ISO8601.Image (Now);
-- Date : Ada.Calendar.time := Util.Dates.ISO8601.Value (S);
--
-- A `Constraint_Error` exception is raised when the date string is not in the correct format.
package Util.Dates.ISO8601 is
type Precision_Type is (YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, SUBSECOND);
-- Parses an ISO8601 date and return it as a calendar time.
-- Raises Constraint_Error if the date format is not recognized.
function Value (Date : in String) return Ada.Calendar.Time;
-- Return the ISO8601 date.
function Image (Date : in Ada.Calendar.Time) return String;
function Image (Date : in Date_Record) return String;
function Image (Date : in Ada.Calendar.Time;
Precision : in Precision_Type) return String;
function Image (Date : in Date_Record;
Precision : in Precision_Type) return String;
end Util.Dates.ISO8601;
|
godunko/adagl | Ada | 3,390 | adb | ------------------------------------------------------------------------------
-- --
-- Ada binding for OpenGL/WebGL --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2018, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
package body OpenGL.Shaders.Internals is
---------------------
-- Get_GLEW_Shader --
---------------------
function Get_GLEW_Shader
(Self : not null access OpenGL_Shader'Class) return GLEW.GLuint is
begin
return Self.Shader;
end Get_GLEW_Shader;
end OpenGL.Shaders.Internals;
|
stcarrez/etherscope | Ada | 5,162 | adb | -----------------------------------------------------------------------
-- ui -- User Interface Framework
-- 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 BMP_Fonts;
package body UI.Buttons is
-- ------------------------------
-- Draw the button in its current state on the bitmap.
-- ------------------------------
procedure Draw_Button (Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class;
Button : in Button_Type) is
Color : constant HAL.Bitmap.Bitmap_Color
:= (if Button.State = B_RELEASED then Background else Active_Background);
begin
Buffer.Set_Source (Color);
Buffer.Fill_Rect (Area => (Position => (Button.Pos.X + 1, Button.Pos.Y + 1),
Width => Button.Width - 2,
Height => Button.Height - 2));
if Button.State = B_PRESSED then
Buffer.Set_Source (HAL.Bitmap.Grey);
Buffer.Draw_Rect (Area => (Position => (Button.Pos.X + 3, Button.Pos.Y + 3),
Width => Button.Width - 5,
Height => Button.Height - 6));
Buffer.Draw_Horizontal_Line (Pt => (Button.Pos.X + 2, Button.Pos.Y + 2),
Width => Button.Width - 4);
Buffer.Draw_Vertical_Line (Pt => (Button.Pos.X + 2, Button.Pos.Y + 2),
Height => Button.Height - 4);
end if;
Bitmapped_Drawing.Draw_String
(Buffer,
Start => (Button.Pos.X + 4, Button.Pos.Y + 6),
Msg => Button.Name,
Font => BMP_Fonts.Font16x24,
Foreground => (if Button.State = B_RELEASED then Foreground else Active_Foreground),
Background => Color);
end Draw_Button;
-- ------------------------------
-- Layout and draw a list of buttons starting at the given top position.
-- Each button is assigned the given width and height.
-- ------------------------------
procedure Draw_Buttons (Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class;
List : in out Button_Array;
X : in Natural;
Y : in Natural;
Width : in Natural;
Height : in Natural) is
By : Natural := Y;
begin
for I in List'Range loop
List (I).Width := Width;
List (I).Height := Height;
List (I).Pos := (X, By);
Draw_Button (Buffer, List (I));
By := By + Height;
end loop;
end Draw_Buttons;
-- ------------------------------
-- Set the active button in a list of button. Update <tt>Change</tt> to indicate whether
-- some button state was changed and a redraw is necessary.
-- ------------------------------
procedure Set_Active (List : in out Button_Array;
Index : in Button_Event;
Changed : out Boolean) is
State : Button_State;
begin
Changed := False;
for I in List'Range loop
if List (I).State /= B_DISABLED then
State := (if I = Index then B_PRESSED else B_RELEASED);
if State /= List (I).State then
List (I).State := State;
Changed := True;
end if;
end if;
end loop;
end Set_Active;
-- ------------------------------
-- Check the touch panel for a button being pressed.
-- ------------------------------
procedure Get_Event (Buffer : in HAL.Bitmap.Bitmap_Buffer'Class;
Touch : in out HAL.Touch_Panel.Touch_Panel_Device'Class;
List : in Button_Array;
Event : out Button_Event) is
pragma Unreferenced (Buffer);
State : constant HAL.Touch_Panel.TP_State := Touch.Get_All_Touch_Points;
X : Natural;
Y : Natural;
begin
if State'Length > 0 then
X := State (State'First).X;
Y := State (State'First).Y;
for I in List'Range loop
if X >= List (I).Pos.X and Y >= List (I).Pos.Y
and X < List (I).Pos.X + List (I).Width
and Y < List (I).Pos.Y + List (I).Height
then
Event := I;
return;
end if;
end loop;
end if;
Event := NO_EVENT;
end Get_Event;
end UI.Buttons;
|
joakim-strandberg/wayland_ada_binding | Ada | 15,335 | adb | with Linux.Files;
with Linux.File_Status;
with Linux.Memory_Maps;
with C_Binding;
with Wayland_Client;
with Ada.Real_Time;
with System;
-- sudo apt install libwayland-dev
-- This is a wayland hello world application. It uses the wayland
-- client library and the wayland protocol to display a window.
--
-- Original code that was translated from C to Ada:
-- https://github.com/hdante/hello_wayland
-- https://hdante.wordpress.com/2014/07/08/the-hello-wayland-tutorial/
--
-- When compiled go to the .../bin directory
-- and execute the executable from there.
package body Client_Examples.Hdante_Hello_World is
subtype Unsigned_32 is Wayland_Client.Unsigned_32;
use type Unsigned_32;
use all type Linux.Files.File_Mode;
use all type Linux.Files.File_Permission;
use all type Linux.Files.File;
use all type Linux.File_Status.Status;
use all type Linux.Memory_Maps.Memory_Map;
use all type Linux.Memory_Maps.Memory_Protection;
use all type Wayland_Client.Check_For_Events_Status;
use all type Wayland_Client.Call_Result_Code;
use all type Ada.Real_Time.Time;
use all type Ada.Real_Time.Time_Span;
Compositor : aliased Wayland_Client.Compositor;
Pointer : aliased Wayland_Client.Pointer;
Seat : aliased Wayland_Client.Seat;
Shell : aliased Wayland_Client.Shell;
Shm : aliased Wayland_Client.Shm;
Done : Boolean := false;
type Data_Type is limited record
Compositor : not null access Wayland_Client.Compositor;
Pointer : not null access Wayland_Client.Pointer;
Seat : not null access Wayland_Client.Seat;
Shell : not null access Wayland_Client.Shell;
Shm : not null access Wayland_Client.Shm;
end record;
type Data_Ptr is access all Data_Type;
Data : aliased Data_Type :=
(
Compositor => Compositor'Unchecked_Access,
Pointer => Pointer'Unchecked_Access,
Seat => Seat'Unchecked_Access,
Shell => Shell'Unchecked_Access,
Shm => Shm'Unchecked_Access
);
function Min (L, R : Unsigned_32) return Unsigned_32 renames
Unsigned_32'Min;
Exists_Mouse : Boolean := False;
Exists_Keyboard : Boolean := False;
procedure Seat_Capabilities
(Data : not null Data_Ptr;
Seat : Wayland_Client.Seat;
Capabilities : Unsigned_32) is
begin
if (Capabilities and Wayland_Client.Seat_Capability_Pointer) > 0 then
Put_Line ("Display has a pointer");
Exists_Mouse := True;
end if;
if (Capabilities and Wayland_Client.Seat_Capability_Keyboard) > 0 then
Put_Line ("Display has a keyboard");
Exists_Keyboard := True;
end if;
if (Capabilities and Wayland_Client.Seat_Capability_Touch) > 0 then
Put_Line ("Display has a touch screen");
end if;
end Seat_Capabilities;
procedure Seat_Name
(Data : not null Data_Ptr;
Seat : Wayland_Client.Seat;
Name : String) is
begin
null;
end Seat_Name;
package Seat_Events is new Wayland_Client.Seat_Events
(Data_Type => Data_Type,
Data_Ptr => Data_Ptr,
Seat_Capabilities => Seat_Capabilities,
Seat_Name => Seat_Name);
procedure Global_Registry_Handler (Data : not null Data_Ptr;
Registry : Wayland_Client.Registry;
Id : Unsigned_32;
Name : String;
Version : Unsigned_32)
is
Call_Result : Wayland_Client.Call_Result_Code;
begin
if Name = Wayland_Client.Compositor_Interface.Name then
Compositor.Get_Proxy (Registry,
Id,
Min (Version, 4));
Put_Line ("Got compositor proxy");
elsif Name = Wayland_Client.Shm_Interface.Name then
Shm.Get_Proxy (Registry,
Id,
Min (Version, 1));
Put_Line ("Got shm proxy");
elsif Name = Wayland_Client.Shell_Interface.Name then
Shell.Get_Proxy (Registry,
Id,
Min (Version, 1));
Put_Line ("Got shell proxy");
elsif Name = Wayland_Client.Seat_Interface.Name then
Seat.Get_Proxy (Registry,
Id,
Min (Version, 2));
Call_Result := Seat_Events.Subscribe (Seat, Data);
case Call_Result is
when Success => Put_Line ("Successfully subscribed to seat events");
when Error => Put_Line ("Failed to subscribe to seat events");
end case;
end if;
end Global_Registry_Handler;
procedure Global_Registry_Remover (Data : not null Data_Ptr;
Registry : Wayland_Client.Registry;
Id : Unsigned_32) is
begin
Linux.Text_IO.Put_Line ("Got a registry losing event for" & Id'Image);
end Global_Registry_Remover;
package Registry_Events is new Wayland_Client.Registry_Events
(Data_Type => Data_Type,
Data_Ptr => Data_Ptr,
Global_Object_Added => Global_Registry_Handler,
Global_Object_Removed => Global_Registry_Remover);
procedure Shell_Surface_Ping
(Data : not null Data_Ptr;
Surface : Wayland_Client.Shell_Surface;
Serial : Unsigned_32) is
begin
Surface.Pong (Serial);
end Shell_Surface_Ping;
procedure Shell_Surface_Configure
(Data : not null Data_Ptr;
Surface : Wayland_Client.Shell_Surface;
Edges : Unsigned_32;
Width : Integer;
Height : Integer) is
begin
null;
end Shell_Surface_Configure;
procedure Shell_Surface_Popup_Done
(Data : not null Data_Ptr;
Surface : Wayland_Client.Shell_Surface) is
begin
null;
end Shell_Surface_Popup_Done;
package Shell_Surface_Events is new Wayland_Client.Shell_Surface_Events
(Data_Type => Data_Type,
Data_Ptr => Data_Ptr,
Shell_Surface_Ping => Shell_Surface_Ping,
Shell_Surface_Configure => Shell_Surface_Configure,
Shell_Surface_Popup_Done => Shell_Surface_Popup_Done);
procedure Mouse_Enter
(Data : not null Data_Ptr;
Pointer : Wayland_Client.Pointer;
Serial : Unsigned_32;
Surface : Wayland_Client.Surface;
Surface_X : Wayland_Client.Fixed;
Surface_Y : Wayland_Client.Fixed) is
begin
Put_Line ("Pointer enter");
end Mouse_Enter;
procedure Pointer_Leave
(Data : not null Data_Ptr;
Pointer : Wayland_Client.Pointer;
Serial : Unsigned_32;
Surface : Wayland_Client.Surface) is
begin
Put_Line ("Pointer leave");
end Pointer_Leave;
procedure Pointer_Motion
(Data : not null Data_Ptr;
Pointer : Wayland_Client.Pointer;
Time : Unsigned_32;
Surface_X : Wayland_Client.Fixed;
Surface_Y : Wayland_Client.Fixed) is
begin
Put_Line ("Pointer motion");
end Pointer_Motion;
procedure Pointer_Button
(Data : not null Data_Ptr;
Pointer : Wayland_Client.Pointer;
Serial : Unsigned_32;
Time : Unsigned_32;
Button : Unsigned_32;
State : Unsigned_32) is
begin
Put_Line ("Pointer button");
Done := True;
end Pointer_Button;
procedure Pointer_Axis
(Data : not null Data_Ptr;
Pointer : Wayland_Client.Pointer;
Time : Unsigned_32;
Axis : Unsigned_32;
Value : Wayland_Client.Fixed) is
begin
Put_Line ("Pointer axis");
end Pointer_Axis;
procedure Pointer_Frame (Data : not null Data_Ptr;
Pointer : Wayland_Client.Pointer) is
begin
Put_Line ("Pointer frame");
end Pointer_Frame;
procedure Pointer_Axis_Source
(Data : not null Data_Ptr;
Pointer : Wayland_Client.Pointer;
Axis_Source : Unsigned_32) is
begin
Put_Line ("Pointer axis source");
end Pointer_Axis_Source;
procedure Pointer_Axis_Stop
(Data : not null Data_Ptr;
Pointer : Wayland_Client.Pointer;
Time : Unsigned_32;
Axis : Unsigned_32) is
begin
Put_Line ("Pointer axis stop");
end Pointer_Axis_Stop;
procedure Pointer_Axis_Discrete
(Data : not null Data_Ptr;
Pointer : Wayland_Client.Pointer;
Axis : Unsigned_32;
Discrete : Integer) is
begin
Put_Line ("Pointer axis discrete");
end Pointer_Axis_Discrete;
package Mouse_Events is new Wayland_Client.Pointer_Events
(Data_Type => Data_Type,
Data_Ptr => Data_Ptr,
Pointer_Enter => Mouse_Enter,
Pointer_Leave => Pointer_Leave,
Pointer_Motion => Pointer_Motion,
Pointer_Button => Pointer_Button,
Pointer_Axis => Pointer_Axis,
Pointer_Frame => Pointer_Frame,
Pointer_Axis_Source => Pointer_Axis_Source,
Pointer_Axis_Stop => Pointer_Axis_Stop,
Pointer_Axis_Discrete => Pointer_Axis_Discrete);
Display : Wayland_Client.Display;
Registry : Wayland_Client.Registry;
WIDTH : constant := 320;
HEIGHT : constant := 200;
-- CURSOR_WIDTH : constant := 100;
-- CURSOR_HEIGHT : constant := 59;
-- CURSOR_HOT_SPOT_X : constant := 10;
-- CURSOR_HOT_SPOT_Y : constant := 35;
--
--
Buffer : Wayland_Client.Buffer;
Pool : Wayland_Client.Shm_Pool;
Surface : Wayland_Client.Surface;
Shell_Surface : Wayland_Client.Shell_Surface;
Image : Linux.Files.File;
File_Status : Linux.File_Status.Status;
File_Name : String := "hello_world_image.bin";
Memory_Map : Linux.Memory_Maps.Memory_Map;
Events_Status : Wayland_Client.Check_For_Events_Status;
Status_Code : Integer;
Timestamp : Ada.Real_Time.Time := Clock;
Call_Result : Wayland_Client.Call_Result_Code;
procedure Run is
begin
Display.Connect;
if not Display.Is_Connected then
Put_Line ("Can't connect to display");
return;
end if;
Put_Line ("Connected to display");
Display.Get_Registry (Registry);
if not Registry.Has_Proxy then
Put_Line ("Can't get global registry object");
return;
end if;
Call_Result := Registry_Events.Subscribe (Registry, Data'Access);
case Call_Result is
when Success => null;
when Error =>
Put_Line ("Failed to subscribe to registry events");
Display.Disconnect;
return;
end case;
Display.Dispatch;
Display.Roundtrip;
Registry.Destroy;
if Exists_Mouse then
Put_Line ("Start mouse subscription");
Seat.Get_Pointer (Pointer);
Call_Result := Mouse_Events.Subscribe (Pointer, Data'Access);
case Call_Result is
when Success =>
Put_Line ("Successfully subscribed to mouse events");
when Error =>
Put_Line ("Failed to subscribe to mouse events");
end case;
end if;
Linux.Files.Open
(Image,
File_Name,
Mode => Read_Write,
Permissions => (
Owner_Read => True,
Group_Read => True,
Others_Read => True,
others => False
));
if Linux.Files.Is_Closed (Image) then
Put_Line ("Error opening surface image");
return;
end if;
Get_File_Status (Image, File_Status);
if not Is_Valid (File_Status) then
Put_Line ("File does not exist?");
return;
end if;
Get_Map_Memory
(Image,
System.Null_Address,
Size (File_Status),
Page_Can_Be_Read,
Linux.Memory_Maps.MAP_SHARED, 0, Memory_Map);
if Memory_Map.Has_Mapping then
Shm.Create_Pool (Image,
Integer (Size (File_Status)),
Pool);
else
Put_Line ("Failed to map file");
return;
end if;
if not Pool.Has_Proxy then
Put_Line ("Failed to create pool");
return;
end if;
Compositor.Get_Surface_Proxy (Surface);
if not Surface.Has_Proxy then
Put_Line ("Failed to create surface");
return;
end if;
Wayland_Client.Get_Shell_Surface (Shell, Surface, Shell_Surface);
if not Shell_Surface.Has_Proxy then
Surface.Destroy;
Put_Line ("Failed to create shell surface");
return;
end if;
Call_Result := Shell_Surface_Events.Subscribe (Shell_Surface,
Data'Access);
case Call_Result is
when Success =>
Put_Line ("Successfully subscribed to shell surface events");
when Error =>
Put_Line ("Failed to subscribe to shell surface events");
Display.Disconnect;
return;
end case;
Shell_Surface.Set_Toplevel;
Pool.Create_Buffer (0,
Integer (Width),
Integer (Height),
Integer (Width)*4,
Wayland_Client.Shm_Format_Argb_8888,
Buffer);
if not Buffer.Has_Proxy then
Put_Line ("Failed to create buffer");
return;
end if;
Surface.Attach (Buffer, 0, 0);
Surface.Commit;
Display.Dispatch;
while not Done loop
while Display.Prepare_Read /= 0 loop
Status_Code := Display.Dispatch_Pending;
if Status_Code = -1 then
Put_Line ("Failed dispatch pending");
end if;
end loop;
declare
Interval : Ada.Real_Time.Time_Span
:= Ada.Real_Time.To_Time_Span (1.0);
Timeout : constant Integer
:= Integer (To_Duration ((Timestamp + Interval) - Clock)*1000);
-- The timeout to check for events in millisends
begin
if Timeout > 0 then
Events_Status := Display.Check_For_Events (Timeout);
else
Events_Status := Display.Check_For_Events (0);
end if;
end;
case Events_Status is
when Events_Need_Processing =>
Call_Result := Display.Read_Events;
if Call_Result = Error then
Put_Line ("Failed read events");
end if;
Status_Code := Display.Dispatch_Pending;
if Status_Code = -1 then
Put_Line ("Failed dispatch pending 2");
end if;
when No_Events =>
Put_Line ("loop");
Display.Cancel_Read;
Timestamp := Clock;
when Error =>
Put_Line ("Error checking for events");
Done := True;
Display.Cancel_Read;
end case;
end loop;
end Run;
end Client_Examples.Hdante_Hello_World;
|
jhumphry/PRNG_Zoo | Ada | 3,434 | adb | --
-- PRNG Zoo
-- Copyright (c) 2014 - 2015, James Humphry
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-- PERFORMANCE OF THIS SOFTWARE.
with PRNG_Zoo;
use PRNG_Zoo;
with PRNG_Zoo.Register;
with Parse_Args;
with Common_CLI, Common_CLI_Options;
use Common_CLI_Options;
with Ada.Text_IO, Ada.Integer_Text_IO;
use Ada.Text_IO, Ada.Integer_Text_IO;
with Ada.Containers;
use type Ada.Containers.Count_Type;
procedure sample_output is
package U64_IO is new Ada.Text_IO.Modular_IO(Num => U64);
use U64_IO;
package U32_IO is new Ada.Text_IO.Modular_IO(Num => U32);
use U32_IO;
AP : Parse_Args.Argument_Parser;
PRNG_Specs : Common_CLI_Options.PRNG_Spec_Lists.List;
Seed : PRNG_Zoo.U64;
Seed_From_Array : U64_array_access;
Number : Natural;
Columns : Natural;
Generate_32bit: Boolean;
begin
AP.Set_Prologue("Generate samples of the output from different PRNG.");
AP.Add_Option(Parse_Args.Make_Natural_Option(16), "number", 'n',
Usage => "Specify number of outputs per PRNG (default 16)");
AP.Add_Option(Parse_Args.Make_Natural_Option(2), "columns", 'c',
Usage => "Specify number of output columns (default 2)");
AP.Add_Option(Parse_Args.Make_Boolean_Option(False), "generate-32bit", 'g',
Usage => "Generate 32-bit outputs (default false)");
Common_CLI(AP, PRNG_Specs);
if PRNG_Specs.Length = 0 then
goto Finish;
end if;
Seed := U64_Options.Value(AP, "seed");
Seed_From_Array := U64_array_Options.Value(AP, "seed-from-array");
Number := AP.Integer_Value("number");
Columns := AP.Integer_Value("columns");
Generate_32bit := AP.Boolean_Value("generate-32bit");
for Spec of PRNG_Specs loop
declare
G : PRNG'Class := Register.Make_PRNG(Spec);
begin
Put(Number);
Put(" outputs from " & Register.Name(Spec));
if Seed_From_Array /= null
and G in PRNG_Seed_From_Array'Class
then
PRNG_Seed_From_Array'Class(G).Reset(Seed_From_Array.all);
Put(" seeded from an array length: "
& Integer'Image(Seed_From_Array.all'Length)
& "."
);
else
G.Reset(Seed);
Put(" with seed: ");
Put(Seed);
Put(".");
end if;
New_Line;
for I in 1..Number loop
if Generate_32bit then
Put(U32'(G.Generate));
else
Put(G.Generate_Padded);
end if;
if I mod Columns = 0 then
New_Line;
else
Put(" ");
end if;
end loop;
end;
New_Line;
end loop;
New_Line;
<<Finish>>
null;
end sample_output;
|
reznikmm/matreshka | Ada | 3,860 | 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$
------------------------------------------------------------------------------
package Matreshka.ODF_Attributes.Draw.End_Line_Spacing_Vertical is
type Draw_End_Line_Spacing_Vertical_Node is
new Matreshka.ODF_Attributes.Draw.Draw_Node_Base with null record;
type Draw_End_Line_Spacing_Vertical_Access is
access all Draw_End_Line_Spacing_Vertical_Node'Class;
overriding function Get_Local_Name
(Self : not null access constant Draw_End_Line_Spacing_Vertical_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Attributes.Draw.End_Line_Spacing_Vertical;
|
AdaCore/libadalang | Ada | 399 | adb | --
-- Copyright (C) 2014-2022, AdaCore
-- SPDX-License-Identifier: Apache-2.0
--
with Libadalang.Implementation;
package body Libadalang.Config_Pragmas_Impl is
----------
-- Hash --
----------
function Hash (Unit : Internal_Unit) return Hash_Type is
begin
return Implementation.Hash (Implementation.Internal_Unit (Unit));
end Hash;
end Libadalang.Config_Pragmas_Impl;
|
io7m/coreland-openal-ada | Ada | 1,477 | ads | with OpenAL.Types;
package OpenAL.Global is
--
-- Distance_Model
--
type Distance_Model_t is
(None,
Inverse_Distance,
Inverse_Distance_Clamped,
Linear_Distance,
Linear_Distance_Clamped,
Exponent_Distance,
Exponent_Distance_Clamped,
Unknown_Distance_Model);
subtype Valid_Distance_Model_t is Distance_Model_t range None .. Exponent_Distance_Clamped;
-- proc_map : alDistanceModel
procedure Set_Distance_Model (Model : in Valid_Distance_Model_t);
-- proc_map : alGetInteger
function Get_Distance_Model return Distance_Model_t;
--
-- Doppler_Factor
--
-- proc_map : alDopplerFactor
procedure Set_Doppler_Factor (Factor : in Types.Natural_Float_t);
-- proc_map : alGetFloat
function Get_Doppler_Factor return Types.Natural_Float_t;
--
-- Speed_Of_Sound
--
-- proc_map : alSpeedOfSound
procedure Set_Speed_Of_Sound (Factor : in Types.Positive_Float_t);
-- proc_map : alGetFloat
function Get_Speed_Of_Sound return Types.Positive_Float_t;
--
-- String queries
--
-- proc_map : alGetString
function Version return String;
-- proc_map : alGetString
function Renderer return String;
-- proc_map : alGetString
function Vendor return String;
-- proc_map : alGetString
function Extensions return String;
--
-- Is_Extension_Present
--
-- proc_map : alIsExtensionPresent
function Is_Extension_Present (Name : in String) return Boolean;
end OpenAL.Global;
|
tum-ei-rcs/StratoX | Ada | 2,718 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . A S S E R T I O N S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This version is for restricted run times (ZFP, Ravenscar, Cert)
package body System.Assertions is
--------------------------
-- Raise_Assert_Failure --
--------------------------
procedure Raise_Assert_Failure (Msg : String) is
begin
raise Assert_Failure with Msg;
end Raise_Assert_Failure;
end System.Assertions;
|
annexi-strayline/AURA | Ada | 8,638 | ads | ------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- ANNEXI-STRAYLINE Reference Implementation --
-- --
-- Command Line Interface --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2019-2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- This package implements the Subsystem type for use in tracking Subsystem
-- dependencies for an AURA project when invoking the CLI. This type is
-- intended to act as the Element_Type for the Hashed Set declared in the
-- Subsystems.Subsystem_Sets child package.
with Ada.Strings.Unbounded;
with Ada.Strings.Wide_Wide_Unbounded;
with Ada.Containers.Vectors;
with Ada.Containers.Hashed_Sets;
with Unit_Names;
with Unit_Names.Hash;
with Unit_Names.Sets;
with Repositories;
with Registrar.Source_Files;
package Registrar.Subsystems is
-- Subsystem_State --
---------------------
-- The Subsystem_State pertains to each Subsystem referenced by withed
-- library units of a project. The Subsystem_State begings at Registered
-- when entered into a Set, and will never regress. If a Subsystem can never
-- reach Available, AURA fails
type Subsystem_State is
(Requested,
-- Subsystem must be aquired and entered into the AURA project
--
-- Once all Subsystems in a Set have reached Registered, each Subsystem
-- is checked for existence in the current project. If the Subsystem
-- has been aquired previously, the Status for the Subsystem advances
-- to Aquired. Otherwise, the Subsystem needs to be aquired, and is
-- advanced to Requested.
Aquired,
-- Requested Subsystems must be aquired. Failure to aquire any Requested
-- Subsystem causes AURA to fail.
--
-- Aquired means that the Subsystem's sources have been checked-out into
-- the appropriate subdirectory, but that Configuration has not been
-- completed. Units in the subsystem root directory have been entered,
-- but special codepaths have not been, as this must happen after
-- configuration
Unavailable,
-- Aquisition of the subsystem failed. The reason for this failure is
-- assigned to the Aquisition_Note component (and thus only applies
-- to AURA subsystems)
Available);
-- The subsystem has been Configured, and is now available for
-- compilation
-- Configuration_Pack --
------------------------
-- The Configuration_Pack contains all of the important configuration
-- parameters for configuration a subsystem for the local system.
--
-- These values are loaded from a configuration unit, and are a collection
-- of named strings, where the names are just for readability of the
-- configuration unit, but have no other significant meaning
package WWU renames Ada.Strings.Wide_Wide_Unbounded;
package UBS renames Ada.Strings.Unbounded;
type Configuration_Pair is
record
Name : WWU.Unbounded_Wide_Wide_String;
Value: UBS.Unbounded_String;
end record;
package Configuration_Vectors is new Ada.Containers.Vectors
(Index_Type => Positive,
Element_Type => Configuration_Pair);
subtype Configuration_Vector is Configuration_Vectors.Vector;
type Configuration_Pack is
record
External_Libraries: Configuration_Vector;
Ada_Compiler_Opts : Configuration_Vector;
C_Compiler_Opts : Configuration_Vector;
C_Definitions : Configuration_Vector;
Codepaths : Configuration_Vector;
Information : Configuration_Vector;
end record;
---------------
-- Subsystem --
---------------
use type Unit_Names.Unit_Name;
type Subsystem (AURA: Boolean := False) is
-- AURA = True => the Subsystem is an AURA subsystem
-- False => the Subsystem is part of the root project
record
Name : Unit_Names.Unit_Name;
State: Subsystem_State := Requested;
Configuration: Configuration_Pack;
-- Mostly for AURA subsystems, however the root project also
-- contains configuration, which is registered with the
-- "AURA" subsystem itself (which is a non AURA subsystem!)
case AURA is
when True =>
Source_Repository : Repositories.Repository_Index;
-- Checkout repository information
Aquisition_Failure: UBS.Unbounded_String;
-- Reason for failure to aquire, set by the checkout process,
-- and valid only if State = Unavailable
when False =>
-- the Subsystem is part of the core project
null;
end case;
end record;
-- For implementation of Subsystems.Subsystem_Sets
function Subsystem_Name_Hash (SS: Subsystem) return Ada.Containers.Hash_Type
is (Unit_Names.Hash (SS.Name));
function Equivalent_Subsystems (Left, Right: Subsystem) return Boolean
is (Left.Name = Right.Name);
--------------------
-- Subsystem_Sets --
--------------------
package Subsystem_Sets is new Ada.Containers.Hashed_Sets
(Element_Type => Subsystem,
Hash => Subsystem_Name_Hash,
Equivalent_Elements => Equivalent_Subsystems);
end Registrar.Subsystems;
|
tum-ei-rcs/StratoX | Ada | 3,440 | ads | -- This spec has been automatically generated from STM32F427x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
with System;
with HAL;
package STM32_SVD.WWDG is
pragma Preelaborate;
---------------
-- Registers --
---------------
-----------------
-- CR_Register --
-----------------
subtype CR_T_Field is HAL.UInt7;
-- Control register
type CR_Register is record
-- 7-bit counter (MSB to LSB)
T : CR_T_Field := 16#7F#;
-- Activation bit
WDGA : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
T at 0 range 0 .. 6;
WDGA at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
------------------
-- CFR_Register --
------------------
subtype CFR_W_Field is HAL.UInt7;
---------------
-- CFR.WDGTB --
---------------
-- CFR_WDGTB array
type CFR_WDGTB_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for CFR_WDGTB
type CFR_WDGTB_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- WDGTB as a value
Val : HAL.UInt2;
when True =>
-- WDGTB as an array
Arr : CFR_WDGTB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for CFR_WDGTB_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Configuration register
type CFR_Register is record
-- 7-bit window value
W : CFR_W_Field := 16#7F#;
-- Timer base
WDGTB : CFR_WDGTB_Field := (As_Array => False, Val => 16#0#);
-- Early wakeup interrupt
EWI : Boolean := False;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CFR_Register use record
W at 0 range 0 .. 6;
WDGTB at 0 range 7 .. 8;
EWI at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-----------------
-- SR_Register --
-----------------
-- Status register
type SR_Register is record
-- Early wakeup interrupt flag
EWIF : Boolean := False;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
EWIF at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Window watchdog
type WWDG_Peripheral is record
-- Control register
CR : CR_Register;
-- Configuration register
CFR : CFR_Register;
-- Status register
SR : SR_Register;
end record
with Volatile;
for WWDG_Peripheral use record
CR at 0 range 0 .. 31;
CFR at 4 range 0 .. 31;
SR at 8 range 0 .. 31;
end record;
-- Window watchdog
WWDG_Periph : aliased WWDG_Peripheral
with Import, Address => WWDG_Base;
end STM32_SVD.WWDG;
|
AdaCore/Ada_Drivers_Library | Ada | 9,497 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-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. --
-- --
------------------------------------------------------------------------------
-- Initially based on stm32f7xx_hal_sd.h
-- V1.0.4
-- 09-December-2015
--
-- SDCard driver. Controls the SDMMC peripheral.
with System;
with SDMMC_SVD_Periph;
with HAL.SDMMC; use HAL.SDMMC;
with HAL.Block_Drivers;
with STM32.DMA;
with STM32.DMA.Interrupts;
with STM32.SDMMC_Interrupt;
package STM32.SDMMC is
type SDMMC_Controller
(Periph : not null access SDMMC_SVD_Periph.Peripheral)
is limited new HAL.Block_Drivers.Block_Driver
and
SDMMC_Driver
with private;
procedure Ensure_Card_Informations (This : in out SDMMC_Controller);
-- Make sure the sdcard information is read and stored in the Controller
-- structure
procedure Set_Clk_Src_Speed
(This : in out SDMMC_Controller;
CLK : UInt32);
function Initialize
(This : in out SDMMC_Controller) return SD_Error;
overriding function Read
(This : in out SDMMC_Controller;
Block_Number : UInt64;
Data : out HAL.Block_Drivers.Block) return Boolean
with Pre => Data'Length <= 16#10000#;
-- Reads Data.
-- Data size needs to be a multiple of the card's block size and maximum
-- length is 2**16
overriding function Write
(This : in out SDMMC_Controller;
Block_Number : UInt64;
Data : HAL.Block_Drivers.Block) return Boolean
with Pre => Data'Length <= 16#10000#;
-- Writes Data.
-- Data size needs to be a multiple of the card's block size and maximum
-- length is 2**16
function Read_Blocks
(This : in out SDMMC_Controller;
Addr : UInt64;
Data : out HAL.Block_Drivers.Block) return SD_Error
with Pre => Data'Length mod 512 = 0;
function Read_Blocks_DMA
(This : in out SDMMC_Controller;
Addr : UInt64;
Data : out HAL.Block_Drivers.Block) return SD_Error
with Pre => Data'Length <= 65536;
function Write_Blocks_DMA
(This : in out SDMMC_Controller;
Addr : UInt64;
Data : HAL.Block_Drivers.Block) return SD_Error
with Pre => Data'Length <= 65535;
function Stop_Transfer
(This : in out SDMMC_Controller) return SD_Error;
function Get_FIFO_Address
(This : SDMMC_Controller) return System.Address;
function Get_Transfer_Status
(This : in out SDMMC_Controller) return SD_Error;
type SDMMC_Flags is
(Data_End,
Data_CRC_Fail,
Data_Timeout,
RX_Overrun,
TX_Underrun,
RX_Active,
TX_Active);
subtype SDMMC_Clearable_Flags is SDMMC_Flags range Data_End .. TX_Underrun;
function Get_Flag
(This : SDMMC_Controller;
Flag : SDMMC_Flags) return Boolean;
procedure Clear_Flag
(This : in out SDMMC_Controller;
Flag : SDMMC_Clearable_Flags);
procedure Clear_Static_Flags (This : in out SDMMC_Controller);
type SDMMC_Interrupts is
(Data_End_Interrupt,
Data_CRC_Fail_Interrupt,
Data_Timeout_Interrupt,
TX_FIFO_Empty_Interrupt,
RX_FIFO_Full_Interrupt,
TX_Underrun_Interrupt,
RX_Overrun_Interrupt);
procedure Enable_Interrupt
(This : in out SDMMC_Controller;
Interrupt : SDMMC_Interrupts);
procedure Disable_Interrupt
(This : in out SDMMC_Controller;
Interrupt : SDMMC_Interrupts);
type SDMMC_Operation is
(No_Operation,
Read_Single_Block_Operation,
Read_Multiple_Blocks_Operation,
Write_Single_Block_Operation,
Write_Multiple_Blocks_Operation);
function Last_Operation
(This : SDMMC_Controller) return SDMMC_Operation;
procedure Disable_Data
(This : in out SDMMC_Controller);
-- Sets DCFGR.DTEN to False to stop the data transfer mode.
procedure Enable_DMA_Transfers
(This : in out SDMMC_Controller;
RX_Int : not null STM32.DMA.Interrupts.DMA_Interrupt_Controller_Access;
TX_Int : not null STM32.DMA.Interrupts.DMA_Interrupt_Controller_Access;
SD_Int : not null STM32.SDMMC_Interrupt.SDMMC_Interrupt_Handler_Access);
-- Enable DMA for SDMMC tranfers by setting the required interrupt
-- controllers. See the examples for more info on how to initialize DMA for
-- SDMMC.
function Has_Card_Information
(This : SDMMC_Controller)
return Boolean;
function Card_Information
(This : SDMMC_Controller)
return HAL.SDMMC.Card_Information
with Pre => This.Has_Card_Information;
procedure Clear_Card_Information
(This : in out SDMMC_Controller);
private
type SDMMC_Controller
(Periph : not null access SDMMC_SVD_Periph.Peripheral)
is limited new HAL.Block_Drivers.Block_Driver
and
SDMMC_Driver
with record
CLK_In : UInt32 := 48_000_000; -- By default at hardware reset
RCA : UInt16;
Card_Type : Supported_SD_Memory_Cards :=
STD_Capacity_SD_Card_V1_1;
Operation : SDMMC_Operation := No_Operation;
Has_Info : Boolean := False;
Info : HAL.SDMMC.Card_Information;
TX_DMA_Int : STM32.DMA.Interrupts.DMA_Interrupt_Controller_Access := null;
RX_DMA_Int : STM32.DMA.Interrupts.DMA_Interrupt_Controller_Access := null;
SD_Int : STM32.SDMMC_Interrupt.SDMMC_Interrupt_Handler_Access := null;
end record;
overriding procedure Delay_Milliseconds
(This : SDMMC_Controller;
Amount : Natural);
overriding procedure Reset
(This : in out SDMMC_Controller;
Status : out SD_Error);
overriding procedure Set_Clock
(This : in out SDMMC_Controller;
Freq : Natural);
overriding procedure Set_Bus_Size
(This : in out SDMMC_Controller;
Mode : Wide_Bus_Mode);
overriding procedure Send_Cmd
(This : in out SDMMC_Controller;
Cmd : Cmd_Desc_Type;
Arg : UInt32;
Status : out SD_Error);
overriding procedure Read_Cmd
(This : in out SDMMC_Controller;
Cmd : Cmd_Desc_Type;
Arg : UInt32;
Buf : out UInt32_Array;
Status : out SD_Error);
overriding procedure Read_Rsp48
(This : in out SDMMC_Controller;
Rsp : out UInt32);
overriding procedure Read_Rsp136
(This : in out SDMMC_Controller;
W0, W1, W2, W3 : out UInt32);
function Command_Error
(Controller : in out SDMMC_Controller) return SD_Error;
type Data_Direction is (Read, Write);
function Get_FIFO_Address
(This : SDMMC_Controller) return System.Address
is (This.Periph.FIFO'Address);
function Get_Flag
(This : SDMMC_Controller;
Flag : SDMMC_Flags) return Boolean
is (case Flag is
when Data_End => This.Periph.STA.DATAEND,
when Data_CRC_Fail => This.Periph.STA.DCRCFAIL,
when Data_Timeout => This.Periph.STA.DTIMEOUT,
when RX_Overrun => This.Periph.STA.RXOVERR,
when TX_Underrun => This.Periph.STA.TXUNDERR,
when RX_Active => This.Periph.STA.RXACT,
when TX_Active => This.Periph.STA.TXACT);
function Last_Operation
(This : SDMMC_Controller) return SDMMC_Operation
is (This.Operation);
end STM32.SDMMC;
|
reznikmm/matreshka | Ada | 17,728 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Testsuite 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 Ada.Wide_Wide_Text_IO;
with League.IRIs;
with Matreshka.XML_Catalogs.Entry_Files;
with Matreshka.XML_Catalogs.Loader;
with Matreshka.XML_Catalogs.Resolver;
package body XMLCatConf.Testsuite_Handlers is
use type League.Strings.Universal_String;
type Test_Type is (Error, Match, No_Match);
-- Tags
Test_Suite_Tag : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("TestSuite");
Test_Cases_Tag : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("TestCases");
Entity_Test_Tag : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("EntityTest");
URI_Test_Tag : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("UriTest");
-- Attributes
Catalog_Attribute : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("catalog");
Expected_File_Attribute : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("expectedFile");
Expected_URI_Attribute : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("expectedUri");
Id_Attribute : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("id");
Prefer_Attribute : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("prefer");
Public_Id_Attribute : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("publicId");
System_Id_Attribute : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("systemId");
Type_Attribute : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("type");
URI_Attribute : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("uri");
-- Literals
Error_Literal : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("error");
Match_Literal : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("match");
No_Match_Literal : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("nomatch");
Public_Literal : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("public");
System_Literal : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("system");
procedure Process_Entity_Test_Start_Tag
(Self : in out Testsuite_Handler;
Attributes : XML.SAX.Attributes.SAX_Attributes;
Success : in out Boolean);
procedure Process_Uri_Test_Start_Tag
(Self : in out Testsuite_Handler;
Attributes : XML.SAX.Attributes.SAX_Attributes;
Success : in out Boolean);
function Value (Image : League.Strings.Universal_String) return Test_Type;
-- Converts string representation of test type into internal
-- representation.
function Value
(Image : League.Strings.Universal_String)
return Matreshka.XML_Catalogs.Entry_Files.Prefer_Mode;
-- Converts string representation of test type into internal
-- representation.
-----------
-- Error --
-----------
overriding procedure Error
(Self : in out Testsuite_Handler;
Occurrence : XML.SAX.Parse_Exceptions.SAX_Parse_Exception;
Success : in out Boolean) is
begin
Ada.Wide_Wide_Text_IO.Put_Line
(Ada.Wide_Wide_Text_IO.Standard_Error,
"(error) " & Occurrence.Message.To_Wide_Wide_String);
end Error;
------------------
-- Error_String --
------------------
overriding function Error_String
(Self : Testsuite_Handler) return League.Strings.Universal_String is
begin
return League.Strings.Empty_Universal_String;
end Error_String;
-----------------
-- Fatal_Error --
-----------------
overriding procedure Fatal_Error
(Self : in out Testsuite_Handler;
Occurrence : XML.SAX.Parse_Exceptions.SAX_Parse_Exception) is
begin
Ada.Wide_Wide_Text_IO.Put_Line
(Ada.Wide_Wide_Text_IO.Standard_Error,
"(fatal) " & Occurrence.Message.To_Wide_Wide_String);
end Fatal_Error;
-----------------------------------
-- Process_Entity_Test_Start_Tag --
-----------------------------------
procedure Process_Entity_Test_Start_Tag
(Self : in out Testsuite_Handler;
Attributes : XML.SAX.Attributes.SAX_Attributes;
Success : in out Boolean)
is
Id : constant League.Strings.Universal_String
:= Attributes.Value (Id_Attribute);
Catalog : constant League.Strings.Universal_String
:= Self.Locator.Base_URI.Resolve
(League.IRIs.From_Universal_String
(Attributes.Value (Catalog_Attribute))).To_Universal_String;
Expected_File : constant League.Strings.Universal_String
:= Attributes.Value (Expected_File_Attribute);
Expected_URI : constant League.Strings.Universal_String
:= Attributes.Value (Expected_URI_Attribute);
Kind : constant Test_Type
:= Value (Attributes.Value (Type_Attribute));
Public_Id : constant League.Strings.Universal_String
:= Attributes.Value (Public_Id_Attribute);
System_Id : constant League.Strings.Universal_String
:= Attributes.Value (System_Id_Attribute);
Prefer : constant Matreshka.XML_Catalogs.Entry_Files.Prefer_Mode
:= Value (Attributes.Value (Prefer_Attribute));
Expected : League.Strings.Universal_String;
Resolved_URI : League.Strings.Universal_String;
Resolved : Boolean;
File :
Matreshka.XML_Catalogs.Entry_Files.Catalog_Entry_File_Access
:= Matreshka.XML_Catalogs.Loader.Load (Catalog, Prefer);
List :
aliased Matreshka.XML_Catalogs.Entry_Files.Catalog_Entry_File_List;
begin
List.Catalog_Entry_Files.Append (File);
if Expected_File.Is_Empty and not Expected_URI.Is_Empty then
Expected := Expected_URI;
elsif not Expected_File.Is_Empty and Expected_URI.Is_Empty then
Expected := Expected_File;
else
Expected.Clear;
end if;
-- Resolve document.
Matreshka.XML_Catalogs.Resolver.Resolve_External_Identifier
(List'Unchecked_Access, Public_Id, System_Id, Resolved_URI, Resolved);
case Kind is
when Error =>
if Resolved then
raise Program_Error;
end if;
when Match =>
if not Resolved then
Ada.Wide_Wide_Text_IO.Put_Line
("FAIL " & Id.To_Wide_Wide_String);
Ada.Wide_Wide_Text_IO.Put_Line
("Expected: '" & Expected.To_Wide_Wide_String & ''');
raise Program_Error;
end if;
-- Construct expected absolute URI.
Expected :=
Self.Locator.Base_URI.Resolve
(League.IRIs.From_Universal_String
(Expected)).To_Universal_String;
if Resolved_URI /= Expected then
Ada.Wide_Wide_Text_IO.Put_Line
("FAIL " & Id.To_Wide_Wide_String);
Ada.Wide_Wide_Text_IO.Put_Line
(" Expected: '" & Expected.To_Wide_Wide_String & ''');
Ada.Wide_Wide_Text_IO.Put_Line
(" Resolved: '" & Resolved_URI.To_Wide_Wide_String & ''');
raise Program_Error;
end if;
when No_Match =>
if Resolved then
raise Program_Error;
end if;
if Resolved_URI /= Expected then
Ada.Wide_Wide_Text_IO.Put_Line
("FAIL " & Id.To_Wide_Wide_String);
Ada.Wide_Wide_Text_IO.Put_Line
(" Expected: '" & Expected.To_Wide_Wide_String & ''');
Ada.Wide_Wide_Text_IO.Put_Line
(" Resolved: '" & Resolved_URI.To_Wide_Wide_String & ''');
raise Program_Error;
end if;
end case;
end Process_Entity_Test_Start_Tag;
--------------------------------
-- Process_Uri_Test_Start_Tag --
--------------------------------
procedure Process_Uri_Test_Start_Tag
(Self : in out Testsuite_Handler;
Attributes : XML.SAX.Attributes.SAX_Attributes;
Success : in out Boolean)
is
Id : constant League.Strings.Universal_String
:= Attributes.Value (Id_Attribute);
Catalog : constant League.Strings.Universal_String
:= Self.Locator.Base_URI.Resolve
(League.IRIs.From_Universal_String
(Attributes.Value (Catalog_Attribute))).To_Universal_String;
Expected_File : constant League.Strings.Universal_String
:= Attributes.Value (Expected_File_Attribute);
Expected_URI : constant League.Strings.Universal_String
:= Attributes.Value (Expected_URI_Attribute);
Kind : constant Test_Type
:= Value (Attributes.Value (Type_Attribute));
URI : constant League.Strings.Universal_String
:= Attributes.Value (URI_Attribute);
Expected : League.Strings.Universal_String;
Resolved_URI : League.Strings.Universal_String;
Resolved : Boolean;
File :
Matreshka.XML_Catalogs.Entry_Files.Catalog_Entry_File_Access
:= Matreshka.XML_Catalogs.Loader.Load
(Catalog, Matreshka.XML_Catalogs.Entry_Files.System);
List :
aliased Matreshka.XML_Catalogs.Entry_Files.Catalog_Entry_File_List;
begin
List.Catalog_Entry_Files.Append (File);
if Expected_File.Is_Empty and not Expected_URI.Is_Empty then
Expected := Expected_URI;
elsif not Expected_File.Is_Empty and Expected_URI.Is_Empty then
Expected := Expected_File;
else
Expected.Clear;
end if;
-- Resolve URI.
Matreshka.XML_Catalogs.Resolver.Resolve_URI
(List'Unchecked_Access, URI, Resolved_URI, Resolved);
case Kind is
when Error =>
if Resolved then
raise Program_Error;
end if;
when Match =>
if not Resolved then
Ada.Wide_Wide_Text_IO.Put_Line
("FAIL " & Id.To_Wide_Wide_String);
Ada.Wide_Wide_Text_IO.Put_Line
(" Expected: '" & Expected.To_Wide_Wide_String & ''');
raise Program_Error;
end if;
-- Construct expected absolute URI.
Expected :=
Self.Locator.Base_URI.Resolve
(League.IRIs.From_Universal_String
(Expected)).To_Universal_String;
if Resolved_URI /= Expected then
Ada.Wide_Wide_Text_IO.Put_Line
("FAIL " & Id.To_Wide_Wide_String);
Ada.Wide_Wide_Text_IO.Put_Line
(" Expected: '" & Expected.To_Wide_Wide_String & ''');
Ada.Wide_Wide_Text_IO.Put_Line
(" Resolved: '" & Resolved_URI.To_Wide_Wide_String & ''');
raise Program_Error;
end if;
when No_Match =>
if Resolved then
raise Program_Error;
end if;
if Resolved_URI /= Expected then
Ada.Wide_Wide_Text_IO.Put_Line
("FAIL " & Id.To_Wide_Wide_String);
Ada.Wide_Wide_Text_IO.Put_Line
(" Expected: '" & Expected.To_Wide_Wide_String & ''');
Ada.Wide_Wide_Text_IO.Put_Line
(" Resolved: '" & Resolved_URI.To_Wide_Wide_String & ''');
raise Program_Error;
end if;
end case;
end Process_Uri_Test_Start_Tag;
--------------------------
-- Set_Document_Locator --
--------------------------
overriding procedure Set_Document_Locator
(Self : in out Testsuite_Handler;
Locator : XML.SAX.Locators.SAX_Locator) is
begin
Self.Locator := Locator;
end Set_Document_Locator;
-------------------
-- Start_Element --
-------------------
overriding procedure Start_Element
(Self : in out Testsuite_Handler;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Attributes : XML.SAX.Attributes.SAX_Attributes;
Success : in out Boolean) is
begin
if Qualified_Name = Test_Suite_Tag then
null;
elsif Qualified_Name = Test_Cases_Tag then
null;
elsif Qualified_Name = Entity_Test_Tag then
Process_Entity_Test_Start_Tag (Self, Attributes, Success);
elsif Qualified_Name = Uri_Test_Tag then
Process_Uri_Test_Start_Tag (Self, Attributes, Success);
else
raise Program_Error;
end if;
end Start_Element;
-----------
-- Value --
-----------
function Value
(Image : League.Strings.Universal_String)
return Matreshka.XML_Catalogs.Entry_Files.Prefer_Mode is
begin
if Image = Public_Literal then
return Matreshka.XML_Catalogs.Entry_Files.Public;
elsif Image = System_Literal then
return Matreshka.XML_Catalogs.Entry_Files.System;
else
raise Constraint_Error;
end if;
end Value;
-----------
-- Value --
-----------
function Value (Image : League.Strings.Universal_String) return Test_Type is
begin
if Image = Error_Literal then
return Error;
elsif Image = Match_Literal then
return Match;
elsif Image = No_Match_Literal then
return No_Match;
else
raise Constraint_Error;
end if;
end Value;
-------------
-- Warning --
-------------
overriding procedure Warning
(Self : in out Testsuite_Handler;
Occurrence : XML.SAX.Parse_Exceptions.SAX_Parse_Exception;
Success : in out Boolean) is
begin
Ada.Wide_Wide_Text_IO.Put_Line
(Ada.Wide_Wide_Text_IO.Standard_Error,
"(warning) " & Occurrence.Message.To_Wide_Wide_String);
end Warning;
end XMLCatConf.Testsuite_Handlers;
|
kqr/qweyboard | Ada | 2,282 | ads | with System;
with Interfaces.C;
with Interfaces.C.Strings;
with Interfaces.C.Pointers;
package XLib_H is
package C renames Interfaces.C;
EXTENSION_MISSING, HARDWARE_PROBLEM : exception;
GENERAL_X11_ERROR : exception;
ENCODING_ERROR : exception;
GenericEvent : constant C.Int := 35;
type Display is null record;
type Display_Access is access all Display;
subtype Keycode is C.Int;
subtype XID is C.Unsigned_Long;
subtype Window is XID;
subtype Keysym is XID;
function XOpenDisplay (Display_Name : C.Strings.Chars_Ptr) return Display_Access;
pragma Import (C, XOpenDisplay, "XOpenDisplay");
function XCloseDisplay (Display : Display_Access) return C.Int;
pragma Import (C, XCloseDisplay, "XCloseDisplay");
function XQueryExtension (Display : Display_Access; Name : C.Strings.Chars_Ptr; Major_Opcode : out C.Int; Event : out C.Int; Error : out C.Int) return C.Int;
pragma Import (C, XQueryExtension, "XQueryExtension");
function XSync (Display : Display_Access; Discard : C.Int) return C.Int;
pragma Import (C, XSync, "XSync");
function XFree (Addr : System.Address) return C.Int;
pragma Import (C, XFree, "XFree");
function XDefaultRootWindow (Display : Display_Access) return Window;
pragma Import (C, XDefaultRootWindow, "XDefaultRootWindow");
function XPending (Display : Display_Access) return C.Int;
pragma Import (C, XPending, "XPending");
type Keysym_Array is array (C.Unsigned range <>) of aliased Keysym;
package Keysym_Accesses is new C.Pointers (Index => C.Unsigned, Element => Keysym, Element_Array => Keysym_Array, Default_Terminator => 0);
procedure XDisplayKeycodes (Display : Display_Access; Min : out C.Int; Max : out C.Int);
pragma Import (C, XDisplayKeycodes, "XDisplayKeycodes");
function XGetKeyboardMapping (Display : Display_Access; Key : C.Int; Keycode_Count : C.Int; Keysyms_Count : out C.Int) return Keysym_Accesses.Pointer;
pragma Import (C, XGetKeyboardMapping, "XGetKeyboardMapping");
function XChangeKeyboardMapping (Display : Display_Access; Keycode : C.Int; Keysyms_Per_Key : C.Int; KeySyms : Keysym_Array; Num_Codes : C.Int) return C.Int;
pragma Import (C, XChangeKeyboardMapping, "XChangeKeyboardMapping");
end XLib_H;
|
reznikmm/ada-pretty | Ada | 4,615 | adb | -- Copyright (c) 2017 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Ada_Pretty.Clauses is
--------------
-- Document --
--------------
overriding function Document
(Self : Aspect;
Printer : not null access League.Pretty_Printers.Printer'Class;
Pad : Natural)
return League.Pretty_Printers.Document
is
Result : League.Pretty_Printers.Document := Printer.New_Document;
begin
Result.Append (Self.Name.Document (Printer, Pad));
if Self.Value /= null then
declare
Value : League.Pretty_Printers.Document := Printer.New_Document;
begin
Value.New_Line;
Value.Append (Self.Value.Document (Printer, 0).Group);
Value.Nest (2);
Value.Group;
Result.Put (" =>");
Result.Append (Value);
end;
end if;
return Result;
end Document;
--------------
-- Document --
--------------
overriding function Document
(Self : Pragma_Node;
Printer : not null access League.Pretty_Printers.Printer'Class;
Pad : Natural)
return League.Pretty_Printers.Document
is
Result : League.Pretty_Printers.Document := Printer.New_Document;
begin
Result.New_Line;
Result.Put ("pragma ");
Result.Append (Self.Name.Document (Printer, 0));
if Self.Arguments /= null then
Result.Put (" (");
Result.Append (Self.Arguments.Document (Printer, Pad));
Result.Put (")");
end if;
Result.Put (";");
return Result;
end Document;
--------------
-- Document --
--------------
overriding function Document
(Self : Use_Clause;
Printer : not null access League.Pretty_Printers.Printer'Class;
Pad : Natural)
return League.Pretty_Printers.Document
is
Result : League.Pretty_Printers.Document := Printer.New_Document;
begin
Result.New_Line;
Result.Put ("use ");
if Self.Use_Type then
Result.Put ("type ");
end if;
Result.Append (Self.Name.Document (Printer, Pad));
Result.Put (";");
return Result;
end Document;
--------------
-- Document --
--------------
overriding function Document
(Self : With_Clause;
Printer : not null access League.Pretty_Printers.Printer'Class;
Pad : Natural)
return League.Pretty_Printers.Document
is
Result : League.Pretty_Printers.Document := Printer.New_Document;
begin
Result.New_Line;
if Self.Is_Limited then
Result.Put ("limited ");
end if;
if Self.Is_Private then
Result.Put ("private ");
end if;
Result.Put ("with ");
Result.Append (Self.Name.Document (Printer, Pad));
Result.Put (";");
return Result;
end Document;
----------
-- Join --
----------
overriding function Join
(Self : Aspect;
List : Node_Access_Array;
Pad : Natural;
Printer : not null access League.Pretty_Printers.Printer'Class)
return League.Pretty_Printers.Document
is
Result : League.Pretty_Printers.Document := Printer.New_Document;
begin
Result.Append (Self.Document (Printer, Pad));
for J in List'Range loop
Result.Put (",");
Result.New_Line;
Result.Put (" ");
Result.Append (List (J).Document (Printer, Pad));
end loop;
return Result;
end Join;
----------------
-- New_Aspect --
----------------
function New_Aspect
(Name : not null Node_Access;
Value : Node_Access) return Node'Class is
begin
return Aspect'(Name, Value);
end New_Aspect;
----------------
-- New_Pragma --
----------------
function New_Pragma
(Name : not null Node_Access;
Arguments : Node_Access) return Node'Class is
begin
return Pragma_Node'(Name, Arguments);
end New_Pragma;
-------------
-- New_Use --
-------------
function New_Use
(Name : not null Node_Access;
Use_Type : Boolean) return Node'Class is
begin
return Use_Clause'(Name, Use_Type);
end New_Use;
--------------
-- New_With --
--------------
function New_With
(Name : not null Node_Access;
Is_Limited : Boolean;
Is_Private : Boolean) return Node'Class is
begin
return With_Clause'(Name, Is_Limited, Is_Private);
end New_With;
end Ada_Pretty.Clauses;
|
reznikmm/matreshka | Ada | 3,654 | 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 League.Holders.Generic_Holders;
package AMF.DG.Holders.Transforms is
new League.Holders.Generic_Holders
(AMF.DG.DG_Transform);
pragma Preelaborate (AMF.DG.Holders.Transforms);
|
yannickmoy/StratoX | Ada | 756 | adb |
-- todo: initialize in several functions: initGPIO, initI2C, use HAL
-- with Config; use Config;
with HIL.GPIO;
with HIL.SPI;
with HIL.Clock;
with HIL.UART;
with HIL.I2C;
with HIL.Random;
with Ada.Real_Time; use Ada.Real_Time;
package body CPU with SPARK_Mode is
-- configures hardware registers
procedure initialize is
startup_time : constant Ada.Real_Time.Time := Ada.Real_Time.Clock;
begin
-- Configure GPIO
HIL.Clock.configure;
HIL.Random.initialize;
HIL.UART.configure;
HIL.GPIO.configure;
HIL.SPI.configure;
delay until startup_time + Ada.Real_Time.Milliseconds (200);
HIL.I2C.initialize;
end initialize;
procedure sleep is
begin
null;
end sleep;
end CPU;
|
msrLi/portingSources | Ada | 4,150 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Termcap --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 2000 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.3 $
-- Binding Version 01.00
------------------------------------------------------------------------------
package Terminal_Interface.Curses.Termcap is
pragma Preelaborate (Terminal_Interface.Curses.Termcap);
-- |=====================================================================
-- | Man page curs_termcap.3x
-- |=====================================================================
-- Not implemented: tputs (see curs_terminfo)
type Termcap_String is new String;
-- |
function TGoto (Cap : String;
Col : Column_Position;
Row : Line_Position) return Termcap_String;
-- AKA: tgoto()
-- |
function Get_Entry (Name : String) return Boolean;
-- AKA: tgetent()
-- |
function Get_Flag (Name : String) return Boolean;
-- AKA: tgetflag()
-- |
procedure Get_Number (Name : String;
Value : out Integer;
Result : out Boolean);
-- AKA: tgetnum()
-- |
procedure Get_String (Name : String;
Value : out String;
Result : out Boolean);
function Get_String (Name : String) return Boolean;
-- Returns True if the string is found.
-- AKA: tgetstr()
end Terminal_Interface.Curses.Termcap;
|
zhmu/ananas | Ada | 9,051 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 2 0 --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Storage_Elements;
with System.Unsigned_Types;
package body System.Pack_20 is
subtype Bit_Order is System.Bit_Order;
Reverse_Bit_Order : constant Bit_Order :=
Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
subtype Ofs is System.Storage_Elements.Storage_Offset;
subtype Uns is System.Unsigned_Types.Unsigned;
subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
use type System.Storage_Elements.Storage_Offset;
use type System.Unsigned_Types.Unsigned;
type Cluster is record
E0, E1, E2, E3, E4, E5, E6, E7 : Bits_20;
end record;
for Cluster use record
E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
end record;
for Cluster'Size use Bits * 8;
for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
1 +
1 * Boolean'Pos (Bits mod 2 = 0) +
2 * Boolean'Pos (Bits mod 4 = 0));
-- Use maximum possible alignment, given the bit field size, since this
-- will result in the most efficient code possible for the field.
type Cluster_Ref is access Cluster;
type Rev_Cluster is new Cluster
with Bit_Order => Reverse_Bit_Order,
Scalar_Storage_Order => Reverse_Bit_Order;
type Rev_Cluster_Ref is access Rev_Cluster;
-- The following declarations are for the case where the address
-- passed to GetU_20 or SetU_20 is not guaranteed to be aligned.
-- These routines are used when the packed array is itself a
-- component of a packed record, and therefore may not be aligned.
type ClusterU is new Cluster;
for ClusterU'Alignment use 1;
type ClusterU_Ref is access ClusterU;
type Rev_ClusterU is new ClusterU
with Bit_Order => Reverse_Bit_Order,
Scalar_Storage_Order => Reverse_Bit_Order;
type Rev_ClusterU_Ref is access Rev_ClusterU;
------------
-- Get_20 --
------------
function Get_20
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_20
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => return RC.E0;
when 1 => return RC.E1;
when 2 => return RC.E2;
when 3 => return RC.E3;
when 4 => return RC.E4;
when 5 => return RC.E5;
when 6 => return RC.E6;
when 7 => return RC.E7;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end if;
end Get_20;
-------------
-- GetU_20 --
-------------
function GetU_20
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_20
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : ClusterU_Ref with Address => A'Address, Import;
RC : Rev_ClusterU_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => return RC.E0;
when 1 => return RC.E1;
when 2 => return RC.E2;
when 3 => return RC.E3;
when 4 => return RC.E4;
when 5 => return RC.E5;
when 6 => return RC.E6;
when 7 => return RC.E7;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end if;
end GetU_20;
------------
-- Set_20 --
------------
procedure Set_20
(Arr : System.Address;
N : Natural;
E : Bits_20;
Rev_SSO : Boolean)
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => RC.E0 := E;
when 1 => RC.E1 := E;
when 2 => RC.E2 := E;
when 3 => RC.E3 := E;
when 4 => RC.E4 := E;
when 5 => RC.E5 := E;
when 6 => RC.E6 := E;
when 7 => RC.E7 := E;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end if;
end Set_20;
-------------
-- SetU_20 --
-------------
procedure SetU_20
(Arr : System.Address;
N : Natural;
E : Bits_20;
Rev_SSO : Boolean)
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : ClusterU_Ref with Address => A'Address, Import;
RC : Rev_ClusterU_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => RC.E0 := E;
when 1 => RC.E1 := E;
when 2 => RC.E2 := E;
when 3 => RC.E3 := E;
when 4 => RC.E4 := E;
when 5 => RC.E5 := E;
when 6 => RC.E6 := E;
when 7 => RC.E7 := E;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end if;
end SetU_20;
end System.Pack_20;
|
AdaCore/Ada_Drivers_Library | Ada | 2,553 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2020, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with HAL; use HAL;
separate (RISCV.CSR_Generic)
function Read_CSR_64 return HAL.UInt64 is
function Reg is new Read_CSR (Reg_Name, UInt64);
begin
return Reg;
end Read_CSR_64;
|
jhumphry/Ada_BinToAsc | Ada | 2,814 | ads | -- BinToAsc.Base16
-- Binary data to ASCII codecs - Base16 codec as in RFC4648
-- Copyright (c) 2015, James Humphry - see LICENSE file for details
generic
Alphabet : Alphabet_16;
Case_Sensitive : Boolean;
package BinToAsc.Base16 is
type Base16_To_String is new Codec_To_String with null record;
overriding
procedure Reset (C : out Base16_To_String);
overriding
function Input_Group_Size (C : in Base16_To_String) return Positive is (1);
overriding
function Output_Group_Size (C : in Base16_To_String) return Positive is (2);
overriding
procedure Process (C : in out Base16_To_String;
Input : in Bin;
Output : out String;
Output_Length : out Natural)
with Post => (Output_Length = 2);
overriding
procedure Process (C : in out Base16_To_String;
Input : in Bin_Array;
Output : out String;
Output_Length : out Natural)
with Post => (Output_Length / 2 = Input'Length and
Output_Length mod 2 = 0);
overriding
procedure Complete (C : in out Base16_To_String;
Output : out String;
Output_Length : out Natural)
with Post => (Output_Length = 0 or Output_Length = 2);
function To_String (Input : in Bin_Array) return String;
type Base16_To_Bin is new Codec_To_Bin with private;
overriding
procedure Reset (C : out Base16_To_Bin);
overriding
function Input_Group_Size (C : in Base16_To_Bin) return Positive is (2);
overriding
function Output_Group_Size (C : in Base16_To_Bin) return Positive is (1);
overriding
procedure Process (C : in out Base16_To_Bin;
Input : in Character;
Output : out Bin_Array;
Output_Length : out Bin_Array_Index)
with Post => (Output_Length = 0 or Output_Length = 1);
overriding
procedure Process (C : in out Base16_To_Bin;
Input : in String;
Output : out Bin_Array;
Output_Length : out Bin_Array_Index)
with Post => (Output_Length = Input'Length / 2 or
Output_Length = Input'Length / 2 + 1 or
C.State = Failed);
overriding
procedure Complete (C : in out Base16_To_Bin;
Output : out Bin_Array;
Output_Length : out Bin_Array_Index)
with Post => (Output_Length = 0);
function To_Bin (Input : in String) return Bin_Array;
private
subtype Half_Bin is Bin range 0..15;
type Base16_To_Bin is new Codec_To_Bin with
record
Loaded : Boolean := False;
Load : Half_Bin := 0;
end record;
end BinToAsc.Base16;
|
reznikmm/matreshka | Ada | 55,207 | adb | with Ada.Characters.Wide_Wide_Latin_1;
with Ada.Integer_Wide_Wide_Text_IO;
with Ada.Strings.Wide_Wide_Unbounded;
with Ada.Wide_Wide_Text_IO;
with misc_defs, misc, sym;
use misc_defs;
with Matreshka.Internals.Unicode.Ucd;
with Unicode;
with scanner.DFA; use scanner.DFA;
with scanner.IO; use scanner.IO;
package body scanner is
use Ada.Integer_Wide_Wide_Text_IO;
use Ada.Strings.Wide_Wide_Unbounded;
use Ada.Wide_Wide_Text_IO;
use Parser_Tokens;
use Unicode;
function "+" (Item : Wide_Wide_String) return Unbounded_Wide_Wide_String
renames To_Unbounded_Wide_Wide_String;
beglin : boolean := false;
i, bracelevel: integer;
function YYLex return Token is
toktype : Token;
didadef, indented_code : boolean;
cclval : Integer;
nmdefptr : Unbounded_Wide_Wide_String;
nmdef : Unbounded_Wide_Wide_String;
tmpbuf : Unbounded_Wide_Wide_String;
procedure ACTION_ECHO is
begin
Put (temp_action_file, YYText (1 .. YYLength));
end ACTION_ECHO;
procedure MARK_END_OF_PROLOG is
begin
Put (temp_action_file, "%%%% end of prolog");
New_Line (temp_action_file);
end MARK_END_OF_PROLOG;
---------------------
-- Put_Back_String --
---------------------
procedure Put_Back_String
(Str : Unbounded_Wide_Wide_String; Start : Integer) is
begin
for J in reverse Start + 1 .. Length (Str) loop
unput (Element (Str, J));
end loop;
end Put_Back_String;
function check_yylex_here return boolean is
begin
return yytext'length >= 2
and then ((yytext(1) = '#') and (yytext(2) = '#'));
end check_yylex_here;
function YYLex return Token is
subtype short is Integer range -32768..32767;
yy_act : Integer;
yy_c : short;
-- returned upon end-of-file
YY_END_TOK : constant Integer := 0;
YY_END_OF_BUFFER : constant := 84;
YY_JAMSTATE : constant := 331;
YY_FIRST_TEMPLATE : constant := 332;
YY_Current_State : YY_State_Type;
INITIAL : constant YY_State_Type := 0;
SECT2 : constant YY_State_Type := 1;
SECT2PROLOG : constant YY_State_Type := 2;
SECT3 : constant YY_State_Type := 3;
PICKUPDEF : constant YY_State_Type := 4;
SC : constant YY_State_Type := 5;
CARETISBOL : constant YY_State_Type := 6;
NUM : constant YY_State_Type := 7;
QUOTE : constant YY_State_Type := 8;
FIRSTCCL : constant YY_State_Type := 9;
CCL : constant YY_State_Type := 10;
ACTION : constant YY_State_Type := 11;
RECOVER : constant YY_State_Type := 12;
BRACEERROR : constant YY_State_Type := 13;
ACTION_STRING : constant YY_State_Type := 14;
yy_accept : constant array(0..331) of short :=
( 0,
0, 0, 0, 0, 0, 0, 82, 82, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
84, 13, 6, 12, 10, 1, 11, 13, 13, 13,
9, 40, 31, 32, 25, 40, 39, 23, 40, 40,
40, 31, 21, 40, 40, 24, 83, 19, 82, 82,
15, 14, 16, 46, 83, 42, 43, 45, 47, 61,
62, 59, 58, 60, 48, 50, 49, 48, 54, 53,
54, 54, 56, 56, 56, 57, 67, 72, 71, 73,
67, 73, 68, 65, 66, 83, 17, 64, 63, 74,
76, 77, 78, 6, 12, 10, 1, 11, 0, 0,
2, 0, 7, 4, 5, 0, 9, 31, 32, 0,
28, 0, 0, 0, 79, 79, 79, 79, 27, 26,
27, 0, 31, 21, 0, 0, 35, 0, 0, 19,
18, 82, 82, 15, 14, 44, 45, 58, 80, 80,
80, 80, 51, 52, 55, 67, 0, 70, 0, 67,
68, 0, 17, 74, 75, 0, 7, 0, 0, 3,
0, 29, 0, 36, 0, 0, 0, 79, 0, 0,
27, 27, 38, 0, 0, 0, 35, 0, 30, 80,
0, 0, 67, 69, 0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 22, 0, 22, 0, 22, 0, 0, 0, 4,
0, 0, 0, 0, 0, 0, 79, 0, 0, 80,
34, 0, 0, 0, 0, 0, 79, 0, 0, 80,
0, 0, 0, 0, 0, 79, 0, 0, 80, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 37,
0, 0, 81, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0
);
type Secondary_Stage_Index is range 0 .. 16#FF#;
type Primary_Stage_Index is range 0 .. 16#10FF#;
type Secondary_Stage_Array is array (Secondary_Stage_Index) of Short;
type Secondary_Stage_Array_Access is access constant Secondary_Stage_Array;
yy_ec_0 : aliased constant Secondary_Stage_Array :=
(
0, 1, 1, 1, 1, 1, 1, 1, 1, 2,
3, 1, 4, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 5, 1, 6, 7, 8, 9, 1, 10,
11, 11, 11, 11, 12, 13, 11, 14, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 1, 1,
16, 1, 17, 11, 1, 23, 24, 25, 26, 27,
28, 29, 30, 31, 32, 32, 32, 32, 33, 34,
35, 32, 36, 37, 38, 39, 32, 40, 41, 42,
32, 18, 19, 20, 21, 22, 1, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 32, 32, 32,
33, 34, 35, 32, 36, 37, 38, 39, 32, 40,
41, 42, 32, 43, 44, 45, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1
);
yy_ec_1 : aliased constant Secondary_Stage_Array :=
(
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1
);
yy_ec_base : constant
array (Primary_Stage_Index) of Secondary_Stage_Array_Access :=
( 0 => yy_ec_0'Access, others => yy_ec_1'Access);
function yy_ec (Item : Wide_Wide_Character) return short is
Code : constant Integer := Wide_Wide_Character'Pos (Item);
Group : constant Primary_Stage_Index :=
Primary_Stage_Index (Code / 256);
Offset : constant Secondary_Stage_Index :=
Secondary_Stage_Index (Code mod 256);
begin
return yy_ec_base (Group) (Offset);
end yy_ec;
yy_meta : constant array(0..45) of short :=
( 0,
1, 2, 3, 2, 2, 4, 1, 1, 1, 5,
1, 1, 6, 5, 7, 1, 1, 1, 8, 9,
1, 10, 11, 11, 11, 11, 11, 11, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 5, 1, 12
);
yy_base : constant array(0..385) of short :=
( 0,
0, 45, 89, 132, 1244, 1243, 1242, 1241, 107, 111,
176, 0, 1222, 1221, 114, 115, 125, 136, 144, 149,
153, 219, 239, 0, 1237, 1236, 116, 119, 282, 283,
1238, 1248, 221, 1248, 0, 290, 1248, 1232, 278, 1221,
0, 1248, 294, 1248, 1248, 96, 1248, 1217, 1211, 275,
338, 382, 1248, 1220, 1215, 1248, 1222, 0, 1221, 1248,
0, 119, 1248, 1248, 1248, 1248, 1202, 0, 1248, 1248,
1248, 1248, 1205, 1248, 1248, 1248, 1248, 81, 1248, 1248,
285, 1206, 1248, 0, 290, 1248, 0, 1248, 1248, 139,
1205, 1248, 0, 1248, 1248, 1212, 1248, 1248, 1248, 0,
1248, 1248, 0, 225, 1248, 0, 304, 1248, 1201, 1210,
1248, 1205, 0, 1171, 1248, 1205, 0, 386, 1248, 1166,
1248, 1141, 214, 296, 1248, 1152, 1121, 0, 0, 1248,
430, 1150, 474, 1248, 1149, 309, 0, 1156, 1155, 0,
1248, 1154, 1248, 0, 328, 1248, 0, 1127, 1248, 1126,
1097, 0, 1248, 1248, 1248, 0, 294, 1248, 0, 518,
0, 1114, 1248, 0, 1248, 1103, 0, 1079, 1098, 1248,
1097, 1248, 1031, 1248, 216, 373, 549, 1038, 139, 0,
0, 0, 1248, 1033, 315, 323, 0, 1039, 1248, 1026,
364, 0, 0, 1248, 577, 1021, 1248, 987, 983, 381,
378, 607, 977, 980, 0, 999, 993, 987, 951, 943,
0, 923, 943, 383, 385, 387, 621, 907, 886, 0,
920, 1248, 885, 1248, 879, 1248, 835, 833, 0, 1248,
853, 461, 395, 635, 819, 802, 0, 682, 665, 0,
1248, 398, 463, 649, 676, 672, 0, 659, 657, 0,
402, 465, 663, 652, 646, 1248, 638, 632, 1248, 469,
471, 404, 638, 624, 626, 610, 474, 476, 610, 607,
597, 604, 479, 486, 581, 297, 577, 474, 580, 583,
567, 559, 557, 538, 538, 541, 546, 585, 587, 1248,
537, 536, 1248, 484, 484, 591, 594, 466, 459, 448,
391, 618, 632, 404, 398, 396, 384, 493, 589, 368,
319, 286, 301, 660, 620, 284, 254, 634, 202, 136,
646, 144, 131, 673, 100, 81, 675, 77, 75, 678,
1248, 705, 717, 729, 741, 753, 765, 777, 789, 801,
813, 825, 832, 843, 855, 862, 873, 885, 897, 909,
921, 933, 945, 952, 963, 975, 987, 999, 1008, 1015,
1026, 1038, 1050, 1062, 1074, 1086, 1092, 1103, 1114, 1126,
1132, 1143, 1149, 1154, 1159, 1170, 1182, 1194, 1200, 1205,
1210, 1215, 1220, 1225, 1230
);
yy_def : constant array(0..385) of short :=
( 0,
331, 331, 332, 332, 333, 333, 334, 334, 335, 335,
331, 11, 336, 336, 337, 337, 338, 338, 339, 339,
340, 340, 331, 23, 341, 341, 336, 336, 342, 342,
331, 331, 331, 331, 343, 331, 331, 344, 345, 331,
346, 331, 331, 331, 331, 331, 331, 331, 347, 348,
331, 349, 331, 331, 331, 331, 350, 351, 352, 331,
353, 331, 331, 331, 331, 331, 331, 354, 331, 331,
331, 331, 331, 331, 331, 331, 331, 348, 331, 331,
355, 356, 331, 357, 348, 331, 358, 331, 331, 359,
358, 331, 360, 331, 331, 361, 331, 331, 331, 362,
331, 331, 363, 331, 331, 343, 331, 331, 331, 344,
331, 331, 364, 331, 331, 365, 346, 331, 331, 366,
331, 331, 347, 347, 331, 331, 331, 367, 368, 331,
331, 331, 349, 331, 331, 366, 369, 370, 350, 351,
331, 352, 331, 353, 331, 331, 354, 331, 331, 331,
331, 371, 331, 331, 331, 358, 359, 331, 359, 331,
360, 361, 331, 362, 331, 372, 364, 331, 365, 331,
366, 331, 331, 331, 347, 347, 347, 331, 331, 373,
368, 131, 331, 331, 370, 366, 369, 370, 331, 331,
331, 374, 160, 331, 160, 372, 331, 331, 331, 347,
347, 177, 331, 331, 375, 376, 377, 378, 331, 331,
379, 331, 331, 347, 347, 347, 177, 331, 331, 380,
376, 331, 377, 331, 378, 331, 331, 331, 381, 331,
331, 347, 347, 177, 331, 331, 382, 331, 331, 383,
331, 347, 347, 177, 331, 331, 384, 331, 331, 385,
347, 347, 177, 331, 331, 331, 331, 331, 331, 347,
347, 347, 331, 331, 331, 331, 347, 347, 331, 331,
331, 331, 347, 347, 331, 331, 331, 331, 347, 347,
331, 331, 331, 331, 331, 331, 347, 347, 347, 331,
331, 331, 331, 331, 331, 347, 347, 331, 331, 331,
331, 347, 347, 331, 331, 331, 331, 347, 347, 331,
331, 331, 331, 347, 347, 331, 331, 347, 331, 331,
347, 331, 331, 347, 331, 331, 347, 331, 331, 347,
0, 331, 331, 331, 331, 331, 331, 331, 331, 331,
331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
331, 331, 331, 331, 331
);
yy_nxt : constant array(0..1293) of short :=
( 0,
32, 33, 34, 33, 33, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 35, 35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 32, 32, 32, 32, 36, 37, 36, 36,
32, 38, 32, 39, 32, 32, 32, 40, 32, 32,
32, 32, 32, 32, 32, 32, 41, 41, 41, 41,
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
41, 41, 41, 41, 41, 41, 41, 32, 32, 32,
43, 44, 43, 43, 45, 126, 46, 121, 121, 47,
121, 284, 47, 281, 48, 329, 49, 50, 62, 63,
62, 62, 62, 63, 62, 62, 71, 71, 98, 128,
145, 98, 145, 145, 328, 72, 72, 76, 73, 73,
77, 51, 47, 52, 53, 52, 52, 45, 76, 46,
54, 77, 47, 78, 55, 47, 65, 48, 158, 49,
50, 65, 56, 326, 78, 65, 80, 159, 74, 74,
99, 80, 81, 99, 82, 84, 325, 81, 203, 82,
323, 85, 86, 204, 51, 47, 64, 64, 65, 64,
64, 64, 64, 64, 64, 64, 64, 66, 64, 64,
64, 64, 67, 64, 64, 64, 64, 68, 68, 68,
68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
68, 68, 68, 68, 68, 68, 68, 68, 64, 64,
64, 65, 104, 105, 104, 104, 104, 105, 104, 104,
200, 84, 124, 174, 124, 174, 322, 85, 86, 87,
87, 88, 87, 87, 89, 87, 87, 87, 90, 87,
87, 91, 92, 87, 87, 87, 87, 87, 87, 87,
93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
93, 94, 87, 95, 101, 101, 113, 102, 102, 126,
320, 107, 108, 107, 107, 118, 119, 118, 118, 150,
103, 103, 109, 158, 126, 107, 108, 107, 107, 127,
175, 172, 159, 128, 114, 123, 109, 189, 115, 151,
319, 186, 317, 152, 127, 172, 284, 207, 128, 145,
176, 145, 145, 282, 177, 208, 283, 120, 129, 129,
316, 129, 129, 129, 129, 129, 129, 129, 129, 129,
129, 129, 130, 129, 129, 129, 129, 129, 129, 131,
131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
129, 129, 129, 133, 134, 133, 133, 118, 119, 118,
118, 124, 174, 209, 135, 214, 124, 174, 210, 124,
174, 124, 174, 124, 174, 124, 174, 215, 281, 233,
313, 232, 216, 124, 174, 201, 124, 174, 312, 251,
124, 174, 124, 174, 311, 136, 310, 260, 307, 120,
181, 181, 243, 181, 181, 181, 181, 181, 181, 181,
181, 181, 182, 181, 182, 181, 181, 181, 181, 181,
181, 182, 182, 182, 182, 182, 182, 182, 182, 182,
182, 182, 182, 182, 182, 182, 182, 182, 182, 182,
182, 182, 181, 181, 183, 133, 134, 133, 133, 124,
174, 124, 174, 124, 174, 306, 135, 124, 174, 124,
174, 261, 124, 174, 124, 174, 305, 124, 174, 267,
252, 242, 273, 304, 124, 174, 268, 280, 274, 279,
285, 124, 174, 286, 301, 314, 300, 136, 193, 193,
194, 193, 193, 195, 193, 193, 193, 195, 193, 193,
193, 195, 193, 193, 193, 193, 193, 193, 193, 195,
195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
195, 193, 195, 202, 124, 174, 299, 124, 174, 298,
295, 202, 202, 202, 202, 202, 202, 195, 195, 294,
195, 195, 293, 195, 195, 195, 292, 195, 195, 195,
214, 195, 195, 195, 195, 195, 195, 195, 124, 174,
291, 124, 174, 124, 174, 124, 174, 124, 174, 124,
174, 290, 124, 174, 284, 315, 297, 287, 281, 288,
195, 217, 289, 302, 303, 278, 296, 277, 276, 217,
217, 217, 217, 217, 217, 234, 124, 174, 124, 174,
275, 318, 272, 234, 234, 234, 234, 234, 234, 244,
124, 174, 124, 174, 271, 308, 270, 244, 244, 244,
244, 244, 244, 253, 124, 174, 269, 266, 265, 309,
321, 253, 253, 253, 253, 253, 253, 262, 124, 174,
324, 264, 263, 258, 257, 262, 262, 262, 262, 262,
262, 124, 174, 124, 174, 327, 124, 174, 255, 330,
287, 254, 249, 248, 287, 42, 42, 42, 42, 42,
42, 42, 42, 42, 42, 42, 42, 57, 57, 57,
57, 57, 57, 57, 57, 57, 57, 57, 57, 59,
59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
59, 61, 61, 61, 61, 61, 61, 61, 61, 61,
61, 61, 61, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 70, 70, 70, 70, 70,
70, 70, 70, 70, 70, 70, 70, 75, 75, 75,
75, 75, 75, 75, 75, 75, 75, 75, 75, 79,
79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
79, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 96, 96, 96, 96, 96, 96, 96,
96, 96, 96, 96, 96, 100, 100, 100, 100, 100,
100, 100, 100, 100, 100, 100, 100, 106, 106, 246,
245, 106, 106, 110, 110, 110, 110, 110, 110, 110,
110, 110, 110, 110, 110, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 117, 117, 241,
239, 117, 117, 123, 123, 238, 123, 123, 123, 123,
123, 226, 123, 123, 123, 125, 125, 224, 125, 125,
125, 125, 125, 125, 125, 125, 125, 132, 132, 132,
132, 132, 132, 132, 132, 132, 132, 132, 132, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 141, 222, 236, 141, 141, 141, 141, 141, 141,
141, 141, 141, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 144, 144, 235, 144, 144,
144, 144, 144, 144, 144, 144, 144, 147, 147, 231,
230, 147, 147, 149, 149, 228, 149, 149, 149, 149,
149, 149, 149, 149, 149, 153, 153, 227, 153, 153,
153, 153, 153, 153, 153, 153, 153, 155, 155, 226,
155, 155, 155, 155, 155, 224, 155, 155, 155, 156,
156, 222, 219, 218, 156, 156, 156, 156, 157, 157,
213, 157, 157, 157, 157, 157, 157, 157, 157, 157,
161, 161, 212, 197, 161, 161, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162, 164, 164,
149, 189, 164, 164, 164, 206, 164, 164, 164, 164,
165, 165, 125, 165, 165, 165, 165, 165, 165, 165,
165, 165, 167, 167, 199, 167, 167, 167, 167, 167,
167, 167, 167, 167, 169, 169, 169, 169, 169, 169,
169, 169, 169, 169, 169, 169, 171, 171, 171, 171,
171, 171, 171, 171, 171, 171, 171, 171, 180, 172,
170, 198, 180, 181, 181, 197, 181, 181, 181, 181,
181, 181, 181, 181, 187, 187, 163, 187, 187, 187,
187, 187, 187, 187, 187, 187, 188, 188, 188, 188,
188, 188, 188, 188, 188, 188, 188, 188, 192, 191,
190, 148, 192, 196, 196, 196, 196, 196, 196, 196,
196, 196, 196, 196, 196, 205, 143, 140, 189, 205,
211, 185, 184, 179, 211, 220, 178, 173, 172, 220,
221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
221, 221, 223, 223, 223, 223, 223, 223, 223, 223,
223, 223, 223, 223, 225, 225, 225, 225, 225, 225,
225, 225, 225, 225, 225, 225, 229, 170, 168, 166,
229, 237, 111, 116, 163, 237, 240, 160, 154, 148,
240, 247, 146, 143, 140, 247, 250, 138, 137, 124,
250, 256, 122, 116, 111, 256, 259, 331, 97, 97,
259, 69, 69, 60, 60, 58, 58, 31, 331, 331,
331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
331, 331, 331
);
yy_chk : constant array(0..1293) of short :=
( 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 78, 3, 46, 46, 3,
46, 329, 3, 328, 3, 326, 3, 3, 9, 9,
9, 9, 10, 10, 10, 10, 15, 16, 27, 78,
62, 28, 62, 62, 325, 15, 16, 17, 15, 16,
17, 3, 3, 4, 4, 4, 4, 4, 18, 4,
4, 18, 4, 17, 4, 4, 19, 4, 90, 4,
4, 20, 4, 323, 18, 21, 19, 90, 15, 16,
27, 20, 19, 28, 19, 21, 322, 20, 179, 20,
320, 21, 21, 179, 4, 4, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 22, 33, 33, 33, 33, 104, 104, 104, 104,
175, 22, 123, 123, 175, 175, 319, 22, 22, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 29, 30, 39, 29, 30, 50,
317, 36, 36, 36, 36, 43, 43, 43, 43, 81,
29, 30, 36, 157, 85, 107, 107, 107, 107, 50,
124, 136, 157, 50, 39, 124, 107, 185, 39, 81,
316, 136, 313, 81, 85, 186, 312, 185, 85, 145,
124, 145, 145, 276, 124, 186, 276, 43, 51, 51,
311, 51, 51, 51, 51, 51, 51, 51, 51, 51,
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
51, 51, 51, 52, 52, 52, 52, 118, 118, 118,
118, 176, 176, 191, 52, 200, 201, 201, 191, 200,
200, 214, 214, 215, 215, 216, 216, 201, 310, 216,
307, 215, 201, 233, 233, 176, 242, 242, 306, 242,
251, 251, 262, 262, 305, 52, 304, 251, 301, 118,
131, 131, 233, 131, 131, 131, 131, 131, 131, 131,
131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
131, 131, 131, 131, 131, 133, 133, 133, 133, 232,
232, 243, 243, 252, 252, 300, 133, 260, 260, 261,
261, 252, 267, 267, 268, 268, 299, 273, 273, 260,
243, 232, 267, 298, 274, 274, 261, 274, 268, 273,
278, 308, 308, 278, 295, 308, 294, 133, 160, 160,
160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
160, 160, 160, 177, 287, 287, 292, 177, 177, 291,
286, 177, 177, 177, 177, 177, 177, 195, 195, 285,
195, 195, 284, 195, 195, 195, 283, 195, 195, 195,
287, 195, 195, 195, 195, 195, 195, 195, 279, 279,
282, 280, 280, 288, 288, 289, 289, 309, 309, 296,
296, 281, 297, 297, 277, 309, 289, 279, 275, 280,
195, 202, 280, 296, 297, 272, 288, 271, 270, 202,
202, 202, 202, 202, 202, 217, 302, 302, 315, 315,
269, 315, 266, 217, 217, 217, 217, 217, 217, 234,
303, 303, 318, 318, 265, 302, 264, 234, 234, 234,
234, 234, 234, 244, 321, 321, 263, 258, 257, 303,
318, 244, 244, 244, 244, 244, 244, 253, 314, 314,
321, 255, 254, 249, 248, 253, 253, 253, 253, 253,
253, 324, 324, 327, 327, 324, 330, 330, 246, 327,
314, 245, 239, 238, 330, 332, 332, 332, 332, 332,
332, 332, 332, 332, 332, 332, 332, 333, 333, 333,
333, 333, 333, 333, 333, 333, 333, 333, 333, 334,
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
334, 335, 335, 335, 335, 335, 335, 335, 335, 335,
335, 335, 335, 336, 336, 336, 336, 336, 336, 336,
336, 336, 336, 336, 336, 337, 337, 337, 337, 337,
337, 337, 337, 337, 337, 337, 337, 338, 338, 338,
338, 338, 338, 338, 338, 338, 338, 338, 338, 339,
339, 339, 339, 339, 339, 339, 339, 339, 339, 339,
339, 340, 340, 340, 340, 340, 340, 340, 340, 340,
340, 340, 340, 341, 341, 341, 341, 341, 341, 341,
341, 341, 341, 341, 341, 342, 342, 342, 342, 342,
342, 342, 342, 342, 342, 342, 342, 343, 343, 236,
235, 343, 343, 344, 344, 344, 344, 344, 344, 344,
344, 344, 344, 344, 344, 345, 345, 345, 345, 345,
345, 345, 345, 345, 345, 345, 345, 346, 346, 231,
228, 346, 346, 347, 347, 227, 347, 347, 347, 347,
347, 225, 347, 347, 347, 348, 348, 223, 348, 348,
348, 348, 348, 348, 348, 348, 348, 349, 349, 349,
349, 349, 349, 349, 349, 349, 349, 349, 349, 350,
350, 350, 350, 350, 350, 350, 350, 350, 350, 350,
350, 351, 221, 219, 351, 351, 351, 351, 351, 351,
351, 351, 351, 352, 352, 352, 352, 352, 352, 352,
352, 352, 352, 352, 352, 353, 353, 218, 353, 353,
353, 353, 353, 353, 353, 353, 353, 354, 354, 213,
212, 354, 354, 355, 355, 210, 355, 355, 355, 355,
355, 355, 355, 355, 355, 356, 356, 209, 356, 356,
356, 356, 356, 356, 356, 356, 356, 357, 357, 208,
357, 357, 357, 357, 357, 207, 357, 357, 357, 358,
358, 206, 204, 203, 358, 358, 358, 358, 359, 359,
199, 359, 359, 359, 359, 359, 359, 359, 359, 359,
360, 360, 198, 196, 360, 360, 361, 361, 361, 361,
361, 361, 361, 361, 361, 361, 361, 361, 362, 362,
190, 188, 362, 362, 362, 184, 362, 362, 362, 362,
363, 363, 178, 363, 363, 363, 363, 363, 363, 363,
363, 363, 364, 364, 173, 364, 364, 364, 364, 364,
364, 364, 364, 364, 365, 365, 365, 365, 365, 365,
365, 365, 365, 365, 365, 365, 366, 366, 366, 366,
366, 366, 366, 366, 366, 366, 366, 366, 367, 171,
169, 168, 367, 368, 368, 166, 368, 368, 368, 368,
368, 368, 368, 368, 369, 369, 162, 369, 369, 369,
369, 369, 369, 369, 369, 369, 370, 370, 370, 370,
370, 370, 370, 370, 370, 370, 370, 370, 371, 151,
150, 148, 371, 372, 372, 372, 372, 372, 372, 372,
372, 372, 372, 372, 372, 373, 142, 139, 138, 373,
374, 135, 132, 127, 374, 375, 126, 122, 120, 375,
376, 376, 376, 376, 376, 376, 376, 376, 376, 376,
376, 376, 377, 377, 377, 377, 377, 377, 377, 377,
377, 377, 377, 377, 378, 378, 378, 378, 378, 378,
378, 378, 378, 378, 378, 378, 379, 116, 114, 112,
379, 380, 110, 109, 96, 380, 381, 91, 82, 73,
381, 382, 67, 59, 57, 382, 383, 55, 54, 49,
383, 384, 48, 40, 38, 384, 385, 31, 26, 25,
385, 14, 13, 8, 7, 6, 5, 331, 331, 331,
331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
331, 331, 331
);
-- copy whatever the last rule matched to the standard output
procedure ECHO is
begin
if Ada.Wide_Wide_Text_IO.Is_Open (User_Output_File) then
Ada.Wide_Wide_Text_IO.Put (User_Output_File, YYText);
else
Ada.Wide_Wide_Text_IO.Put (YYText);
end if;
end ECHO;
-- enter a start condition.
-- Using procedure requires a () after the ENTER, but makes
-- everything much neater.
procedure ENTER (State : Integer) is
begin
YY_Start := 1 + 2 * State;
end ENTER;
pragma Inline (ENTER);
-- action number for EOF rule of a given start state
function YY_STATE_EOF(state : Integer) return Integer is
begin
return YY_END_OF_BUFFER + state + 1;
end YY_STATE_EOF;
pragma Inline (YY_STATE_EOF);
-- return all but the first 'n' matched characters back to the input stream
procedure yyless(n : Integer) is
begin
yy_cp := yy_bp + n;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
end yyless;
pragma Inline (yyless);
-- redefine this if you have something you want each time.
procedure YY_USER_ACTION is
begin
null;
end;
pragma Inline (YY_USER_ACTION);
-- yy_get_previous_state - get the state just before the EOB char
-- was reached
function YY_Get_Previous_State return YY_State_Type is
YY_Current_State : YY_State_Type;
YY_C : Short;
Index : Integer;
Code : Wide_Wide_Character;
yy_bp : integer := yytext_ptr;
begin
yy_current_state := yy_start;
if Previous (yy_ch_buf, yy_bp) = Ada.Characters.Wide_Wide_Latin_1.LF then
yy_current_state := yy_current_state + 1;
end if;
declare
yy_cp : integer := yytext_ptr;
begin
while yy_cp < yy_c_buf_p loop
Index := yy_cp;
Index := yy_cp;
Next (yy_ch_buf, Index, Code);
yy_c := yy_ec(Code);
if (yy_accept(yy_current_state) /= 0 ) then
yy_last_accepting_state := yy_current_state;
yy_last_accepting_cpos := yy_cp;
end if;
while ( yy_chk(yy_base(yy_current_state) + yy_c) /= yy_current_state ) loop
yy_current_state := yy_def(yy_current_state);
if yy_current_state >= YY_FIRST_TEMPLATE then
yy_c := yy_meta(yy_c);
end if;
end loop;
yy_current_state := yy_nxt(yy_base(yy_current_state) + yy_c);
yy_cp := Index;
end loop;
end;
return yy_current_state;
end yy_get_previous_state;
procedure YYRestart (Input_File : Ada.Wide_Wide_Text_IO.File_Type) is
begin
Open_Input (Ada.Wide_Wide_Text_IO.Name (Input_File));
end YYRestart;
Index : Integer;
Code : Wide_Wide_Character;
begin -- of YYLex
<<new_file>>
-- This is where we enter upon encountering an end-of-file and
-- yywrap() indicating that we should continue processing
if ( yy_init ) then
if ( yy_start = 0 ) then
yy_start := 1; -- first start state
end if;
-- we put in the '\n' and start reading from [1] so that an
-- initial match-at-newline will be true.
yy_ch_buf.data (0) := Ada.Characters.Wide_Wide_Latin_1.LF;
yy_n_chars := 1;
-- we always need two end-of-buffer characters. The first causes
-- a transition to the end-of-buffer state. The second causes
-- a jam in that state.
yy_ch_buf.data (yy_n_chars) := YY_END_OF_BUFFER_CHAR;
yy_ch_buf.data (yy_n_chars + 1) := YY_END_OF_BUFFER_CHAR;
yy_eof_has_been_seen := false;
yytext_ptr := 1;
yy_c_buf_p := yytext_ptr;
yy_init := false;
end if; -- yy_init
loop -- loops until end-of-file is reached
yy_cp := yy_c_buf_p;
-- yy_bp points to the position in yy_ch_buf of the start of the
-- current run.
yy_bp := yy_cp;
yy_current_state := yy_start;
if Previous (yy_ch_buf, yy_bp) = Ada.Characters.Wide_Wide_Latin_1.LF then
yy_current_state := yy_current_state + 1;
end if;
loop
Index := yy_cp;
Next (yy_ch_buf, Index, Code);
yy_c := yy_ec(Code);
if (yy_accept(yy_current_state) /= 0 ) then
yy_last_accepting_state := yy_current_state;
yy_last_accepting_cpos := yy_cp;
end if;
while ( yy_chk(yy_base(yy_current_state) + yy_c) /= yy_current_state ) loop
yy_current_state := yy_def(yy_current_state);
if yy_current_state >= YY_FIRST_TEMPLATE then
yy_c := yy_meta(yy_c);
end if;
end loop;
yy_current_state := yy_nxt(yy_base(yy_current_state) + yy_c);
yy_cp := Index;
exit when yy_current_state = YY_JAMSTATE;
end loop;
yy_cp := yy_last_accepting_cpos;
yy_current_state := yy_last_accepting_state;
<<next_action>>
yy_act := yy_accept(yy_current_state);
YY_DO_BEFORE_ACTION;
YY_USER_ACTION;
if Aflex_Debug then
-- output acceptance info. for (-d) debug mode
Ada.Wide_Wide_Text_IO.Put
(Ada.Wide_Wide_Text_IO.Standard_Error,
"--accepting rule #" );
Ada.Wide_Wide_Text_IO.Put
(Ada.Wide_Wide_Text_IO.Standard_Error,
Integer'Wide_Wide_Image (YY_Act));
Ada.Wide_Wide_Text_IO.Put_Line
(Ada.Wide_Wide_Text_IO.Standard_Error,
"(""" & yytext & """)");
end if;
<<do_action>> -- this label is used only to access EOF actions
case yy_act is
when 0 => -- must backtrack
yy_cp := yy_last_accepting_cpos;
yy_current_state := yy_last_accepting_state;
goto next_action;
when 1 =>
--# line 47 "scanner.l"
indented_code := true;
when 2 =>
--# line 48 "scanner.l"
linenum := linenum + 1; ECHO;
-- treat as a comment;
when 3 =>
--# line 51 "scanner.l"
linenum := linenum + 1; ECHO;
when 4 =>
--# line 52 "scanner.l"
return ( SCDECL );
when 5 =>
--# line 53 "scanner.l"
return ( XSCDECL );
when 6 =>
--# line 55 "scanner.l"
return ( WHITESPACE );
when 7 =>
--# line 57 "scanner.l"
sectnum := 2;
misc.line_directive_out;
ENTER(SECT2PROLOG);
return ( SECTEND );
when 8 =>
--# line 64 "scanner.l"
Put (Standard_Error, "old-style lex command at line ");
Put (Standard_Error, Linenum);
Put (Standard_Error, "ignored:");
New_Line (Standard_Error );
Put (Standard_Error, Unicode.HT );
Put (Standard_Error, YYText (1 .. YYLength));
Linenum := Linenum + 1;
when 9 =>
--# line 74 "scanner.l"
nmstr := +YYText (1 .. YYLength);
didadef := false;
ENTER(PICKUPDEF);
when 10 =>
--# line 80 "scanner.l"
nmstr := +YYText (1 .. YYLength);
return NAME;
when 11 =>
--# line 83 "scanner.l"
linenum := linenum + 1;
-- allows blank lines in section 1;
when 12 =>
--# line 86 "scanner.l"
linenum := linenum + 1; return Newline;
when 13 =>
--# line 87 "scanner.l"
misc.synerr( "illegal character" );ENTER(RECOVER);
when 14 =>
--# line 89 "scanner.l"
null;
-- separates name and definition;
when 15 =>
--# line 93 "scanner.l"
nmdef := +YYText (1 .. YYLength);
i := length (nmdef);
while i >= 1 loop
if Element (nmdef, i) /= ' '
and Element (nmdef, i) /= Unicode.HT
then
exit;
end if;
i := i - 1;
end loop;
sym.ndinstal (nmstr, Unbounded_Slice (nmdef, 1, i));
didadef := true;
when 16 =>
--# line 110 "scanner.l"
if ( not didadef ) then
misc.synerr( "incomplete name definition" );
end if;
ENTER(0);
linenum := linenum + 1;
when 17 =>
--# line 118 "scanner.l"
linenum := linenum + 1;
ENTER(0);
nmstr := +YYText (1 .. YYLength);
return NAME;
when 18 =>
yy_cp := yy_cp - 1;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
--# line 124 "scanner.l"
linenum := linenum + 1;
ACTION_ECHO;
MARK_END_OF_PROLOG;
ENTER(SECT2);
when 19 =>
--# line 131 "scanner.l"
linenum := linenum + 1; ACTION_ECHO;
when YY_END_OF_BUFFER +SECT2PROLOG + 1
=>
--# line 133 "scanner.l"
MARK_END_OF_PROLOG;
return End_Of_Input;
when 21 =>
--# line 137 "scanner.l"
linenum := linenum + 1;
-- allow blank lines in sect2;
-- this rule matches indented lines which
-- are not comments.
when 22 =>
--# line 142 "scanner.l"
misc.synerr("indented code found outside of action");
linenum := linenum + 1;
when 23 =>
--# line 147 "scanner.l"
ENTER(SC); return ( '<' );
when 24 =>
--# line 148 "scanner.l"
return ( '^' );
when 25 =>
--# line 149 "scanner.l"
ENTER(QUOTE); return ( '"' );
when 26 =>
yy_cp := yy_bp + 1;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
--# line 150 "scanner.l"
ENTER(NUM); return ( '{' );
when 27 =>
--# line 151 "scanner.l"
ENTER(BRACEERROR);
when 28 =>
yy_cp := yy_bp + 1;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
--# line 152 "scanner.l"
return ( '$' );
when 29 =>
--# line 154 "scanner.l"
continued_action := true;
linenum := linenum + 1;
return Newline;
when 30 =>
--# line 159 "scanner.l"
linenum := linenum + 1; ACTION_ECHO;
when 31 =>
--# line 161 "scanner.l"
-- this rule is separate from the one below because
-- otherwise we get variable trailing context, so
-- we can't build the scanner using -f,F
bracelevel := 0;
continued_action := false;
ENTER(ACTION);
return Newline;
when 32 =>
yy_cp := yy_cp - 1;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
--# line 172 "scanner.l"
bracelevel := 0;
continued_action := false;
ENTER(ACTION);
return Newline;
when 33 =>
--# line 179 "scanner.l"
linenum := linenum + 1; return Newline;
when 34 =>
--# line 181 "scanner.l"
return ( EOF_OP );
when 35 =>
--# line 183 "scanner.l"
sectnum := 3;
ENTER(SECT3);
return ( End_Of_Input );
-- to stop the parser
when 36 =>
--# line 190 "scanner.l"
nmstr := +YYText (1 .. YYLength);
-- check to see if we've already encountered this ccl
cclval := sym.ccllookup (nmstr);
if ( cclval /= 0 ) then
yylval := cclval;
cclreuse := cclreuse + 1;
return ( PREVCCL );
else
-- we fudge a bit. We know that this ccl will
-- soon be numbered as lastccl + 1 by cclinit
sym.cclinstal (nmstr, lastccl + 1);
-- push back everything but the leading bracket
-- so the ccl can be rescanned
Put_Back_String (nmstr, 1);
ENTER(FIRSTCCL);
return ( '[' );
end if;
when 37 =>
--# line 215 "scanner.l"
declare
Image : constant Wide_Wide_String := YYText;
begin
YYLVal :=
Matreshka.Internals.Unicode.Ucd.Boolean_Properties'Pos
(Matreshka.Internals.Unicode.Ucd.Boolean_Properties'Wide_Wide_Value
(Image (Image'First + 3 .. Image'Last - 1))) + 1;
if Image (Image'First + 1) = 'P' then
YYLVal := -YYLVal;
end if;
return PROP;
end;
when 38 =>
--# line 233 "scanner.l"
nmstr := +YYText (1 .. YYLength);
-- chop leading and trailing brace
tmpbuf := Unbounded_Slice (+yytext (1 .. YYLength),
2, YYLength - 1);
nmdefptr := sym.ndlookup (tmpbuf);
if nmdefptr = Null_Unbounded_Wide_Wide_String then
misc.synerr( "undefined {name}" );
else
-- push back name surrounded by ()'s
unput(')');
Put_Back_String (nmdefptr, 0);
unput('(');
end if;
when 39 =>
--# line 250 "scanner.l"
tmpbuf := +YYText (1 .. YYLength);
case Element (tmpbuf, 1) is
when '/' => return '/';
when '|' => return '|';
when '*' => return '*';
when '+' => return '+';
when '?' => return '?';
when '.' => return '.';
when '(' => return '(';
when ')' => return ')';
when others =>
Misc.Aflex_Error ("error in aflex case");
end case;
when 40 =>
--# line 264 "scanner.l"
tmpbuf := +YYText (1 .. YYLength);
yylval := Wide_Wide_Character'Pos (Element (tmpbuf, 1));
return CHAR;
when 41 =>
--# line 268 "scanner.l"
linenum := linenum + 1; return Newline;
when 42 =>
--# line 271 "scanner.l"
return ( ',' );
when 43 =>
--# line 272 "scanner.l"
ENTER(SECT2); return ( '>' );
when 44 =>
yy_cp := yy_bp + 1;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
--# line 273 "scanner.l"
ENTER(CARETISBOL); return ( '>' );
when 45 =>
--# line 274 "scanner.l"
nmstr := +YYText (1 .. YYLength);
return NAME;
when 46 =>
--# line 277 "scanner.l"
misc.synerr( "bad start condition name" );
when 47 =>
--# line 279 "scanner.l"
ENTER(SECT2); return ( '^' );
when 48 =>
--# line 282 "scanner.l"
tmpbuf := +YYText (1 .. YYLength);
yylval := Wide_Wide_Character'Pos (Element (tmpbuf, 1));
return CHAR;
when 49 =>
--# line 286 "scanner.l"
ENTER(SECT2); return ( '"' );
when 50 =>
--# line 288 "scanner.l"
misc.synerr( "missing quote" );
ENTER(SECT2);
linenum := linenum + 1;
return ( '"' );
when 51 =>
yy_cp := yy_bp + 1;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
--# line 296 "scanner.l"
ENTER(CCL); return ( '^' );
when 52 =>
yy_cp := yy_bp + 1;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
--# line 297 "scanner.l"
return ( '^' );
when 53 =>
--# line 298 "scanner.l"
ENTER(CCL); yylval := Wide_Wide_Character'Pos('-'); return ( CHAR );
when 54 =>
--# line 299 "scanner.l"
ENTER(CCL);
tmpbuf := +YYText (1 .. YYLength);
yylval := Wide_Wide_Character'Pos (Element (tmpbuf, 1));
return CHAR;
when 55 =>
yy_cp := yy_bp + 1;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
--# line 305 "scanner.l"
return ( '-' );
when 56 =>
--# line 306 "scanner.l"
tmpbuf := +YYText (1 .. YYLength);
yylval := Wide_Wide_Character'Pos (Element (tmpbuf, 1));
return CHAR;
when 57 =>
--# line 310 "scanner.l"
ENTER(SECT2); return ( ']' );
when 58 =>
--# line 313 "scanner.l"
yylval := misc.myctoi (+YYText (1 .. YYLength));
return ( NUMBER );
when 59 =>
--# line 318 "scanner.l"
return ( ',' );
when 60 =>
--# line 319 "scanner.l"
ENTER(SECT2); return ( '}' );
when 61 =>
--# line 321 "scanner.l"
misc.synerr( "bad character inside {}'s" );
ENTER(SECT2);
return ( '}' );
when 62 =>
--# line 327 "scanner.l"
misc.synerr( "missing }" );
ENTER(SECT2);
linenum := linenum + 1;
return ( '}' );
when 63 =>
--# line 335 "scanner.l"
misc.synerr( "bad name in {}'s" ); ENTER(SECT2);
when 64 =>
--# line 336 "scanner.l"
misc.synerr( "missing }" );
linenum := linenum + 1;
ENTER(SECT2);
when 65 =>
--# line 341 "scanner.l"
bracelevel := bracelevel + 1;
when 66 =>
--# line 342 "scanner.l"
bracelevel := bracelevel - 1;
when 67 =>
--# line 343 "scanner.l"
ACTION_ECHO;
when 68 =>
--# line 344 "scanner.l"
ACTION_ECHO;
when 69 =>
--# line 345 "scanner.l"
linenum := linenum + 1; ACTION_ECHO;
when 70 =>
--# line 346 "scanner.l"
ACTION_ECHO;
-- character constant;
when 71 =>
--# line 350 "scanner.l"
ACTION_ECHO; ENTER(ACTION_STRING);
when 72 =>
--# line 352 "scanner.l"
linenum := linenum + 1;
ACTION_ECHO;
if ( bracelevel = 0 ) then
New_Line (Temp_Action_File);
ENTER(SECT2);
end if;
when 73 =>
--# line 360 "scanner.l"
ACTION_ECHO;
when 74 =>
--# line 362 "scanner.l"
ACTION_ECHO;
when 75 =>
--# line 363 "scanner.l"
ACTION_ECHO;
when 76 =>
--# line 364 "scanner.l"
linenum := linenum + 1; ACTION_ECHO;
when 77 =>
--# line 365 "scanner.l"
ACTION_ECHO; ENTER(ACTION);
when 78 =>
--# line 366 "scanner.l"
ACTION_ECHO;
when 79 =>
--# line 369 "scanner.l"
yylval :=
Unicode_Character'Pos
(Misc.MYESC (+YYText (1 .. YYLength)));
return CHAR;
when 80 =>
--# line 377 "scanner.l"
yylval :=
Unicode_Character'Pos
(misc.myesc (+YYText (1 .. YYLength)));
ENTER(CCL);
return ( CHAR );
when 81 =>
--# line 385 "scanner.l"
declare
Image : constant Wide_Wide_String := YYText;
begin
YYLVal :=
Matreshka.Internals.Unicode.Ucd.Boolean_Properties'Pos
(Matreshka.Internals.Unicode.Ucd.Boolean_Properties'Wide_Wide_Value
(Image (Image'First + 3 .. Image'Last - 1))) + 1;
if Image (Image'First + 1) = 'P' then
YYLVal := -YYLVal;
end if;
ENTER(CCL);
return PROP;
end;
when 82 =>
--# line 406 "scanner.l"
if ( check_yylex_here ) then
return End_Of_Input;
else
ECHO;
end if;
when 83 =>
--# line 412 "scanner.l"
raise AFLEX_SCANNER_JAMMED;
when YY_END_OF_BUFFER + INITIAL + 1
| YY_END_OF_BUFFER + SECT2 + 1
| YY_END_OF_BUFFER + SECT3 + 1
| YY_END_OF_BUFFER + PICKUPDEF + 1
| YY_END_OF_BUFFER + SC + 1
| YY_END_OF_BUFFER + CARETISBOL + 1
| YY_END_OF_BUFFER + NUM + 1
| YY_END_OF_BUFFER + QUOTE + 1
| YY_END_OF_BUFFER + FIRSTCCL + 1
| YY_END_OF_BUFFER + CCL + 1
| YY_END_OF_BUFFER + ACTION + 1
| YY_END_OF_BUFFER + RECOVER + 1
| YY_END_OF_BUFFER + BRACEERROR + 1
| YY_END_OF_BUFFER + ACTION_STRING + 1
=>
return End_Of_Input;
when YY_END_OF_BUFFER =>
yytext_ptr := yy_bp;
case yy_get_next_buffer is
when EOB_ACT_END_OF_FILE =>
begin
if yywrap then
-- note: because we've taken care in
-- yy_get_next_buffer() to have set up yytext,
-- we can now set up yy_c_buf_p so that if some
-- total hoser (like aflex itself) wants
-- to call the scanner after we return the
-- End_Of_Input, it'll still work - another
-- End_Of_Input will get returned.
yy_c_buf_p := yytext_ptr;
yy_act := YY_STATE_EOF ((yy_start - 1) / 2);
goto do_action;
else
-- start processing a new file
yy_init := true;
goto new_file;
end if;
end;
when EOB_ACT_RESTART_SCAN =>
yy_c_buf_p := yytext_ptr;
when EOB_ACT_LAST_MATCH =>
yy_c_buf_p := yy_n_chars;
yy_current_state := yy_get_previous_state;
yy_cp := yy_c_buf_p;
yy_bp := yytext_ptr;
goto next_action;
end case; -- case yy_get_next_buffer()
when others =>
Ada.Wide_Wide_Text_IO.Put ("action # ");
Ada.Wide_Wide_Text_IO.Put (Integer'Wide_Wide_Image (yy_act));
Ada.Wide_Wide_Text_IO.New_Line;
raise AFLEX_INTERNAL_ERROR;
end case; -- case (yy_act)
end loop; -- end of loop waiting for end of file
end YYLex;
--# line 412 "scanner.l"
begin
if (call_yylex) then
toktype := YYLex;
call_yylex := false;
return toktype;
end if;
if eofseen then
toktype := End_Of_Input;
else
toktype := YYLex;
end if;
-- this tracing code allows easy tracing of aflex runs
if trace then
New_Line (Standard_Error);
Put (Standard_Error, "toktype = :");
Put (Standard_Error, Token'Wide_Wide_Image (toktype));
Put_line (Standard_Error, ":");
end if;
if toktype = End_Of_Input then
eofseen := true;
if sectnum = 1 then
misc.synerr( "unexpected EOF" );
sectnum := 2;
toktype := SECTEND;
elsif sectnum = 2 then
sectnum := 3;
toktype := SECTEND;
end if;
end if;
if trace then
if ( beglin ) then
Put (Standard_Error, Num_Rules + 1);
Put (Standard_Error, Unicode.HT);
Beglin := False;
end if;
case toktype is
when '<' | '>'|'^'|'$'|'"'|'['|']'|'{'|'}'|'|'|'('|
')'|'-'|'/'|'?'|'.'|'*'|'+'|',' =>
Put (Standard_Error, Token'Wide_Wide_Image (Toktype));
when NEWLINE =>
New_Line (Standard_Error);
if sectnum = 2 then
beglin := true;
end if;
when SCDECL =>
Put (Standard_Error, "%s");
when XSCDECL =>
Put (Standard_Error, "%x");
when WHITESPACE =>
Put (Standard_Error, " ");
when SECTEND =>
Put_Line (Standard_Error, "%%");
-- we set beglin to be true so we'll start
-- writing out numbers as we echo rules. aflexscan() has
-- already assigned sectnum
if sectnum = 2 then
beglin := true;
end if;
when NAME =>
Put (Standard_Error, ''');
Put (Standard_Error, YYText);
Put (Standard_Error, ''');
when CHAR =>
if ( (yylval < Wide_Wide_Character'Pos (' ')) or
(yylval = Wide_Wide_Character'Pos (Unicode.DEL)) )
then
Put (Standard_Error, '\');
Put (Standard_Error, YYLVal);
Put (Standard_Error, '\');
else
Put (Standard_Error, Token'Wide_Wide_Image (toktype));
end if;
when NUMBER =>
Put (Standard_Error, YYLVal);
when PREVCCL =>
Put (Standard_Error, '[');
Put (Standard_Error, YYLVal);
Put (Standard_Error, ']');
when End_Of_Input =>
Put (Standard_Error, "End Marker");
when others =>
Put (Standard_Error, "Something weird:");
Put_Line (Standard_Error, Token'Wide_Wide_Image (toktype));
end case;
end if;
return toktype;
end YYLex;
end scanner;
|
reznikmm/matreshka | Ada | 3,789 | 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.Dr3d_Texture_Generation_Mode_Y_Attributes is
pragma Preelaborate;
type ODF_Dr3d_Texture_Generation_Mode_Y_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Dr3d_Texture_Generation_Mode_Y_Attribute_Access is
access all ODF_Dr3d_Texture_Generation_Mode_Y_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Dr3d_Texture_Generation_Mode_Y_Attributes;
|
reznikmm/matreshka | Ada | 3,709 | 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.Number_Country_Attributes is
pragma Preelaborate;
type ODF_Number_Country_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Number_Country_Attribute_Access is
access all ODF_Number_Country_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Number_Country_Attributes;
|
sungyeon/drake | Ada | 2,027 | adb | with Ada.Characters.ASCII.Handling;
with Ada.Characters.Handling;
with Ada.Strings.Maps.Constants;
procedure charhandling is
package UH renames Ada.Characters.Handling;
package AH renames Ada.Characters.ASCII.Handling;
package M renames Ada.Strings.Maps;
begin
begin
if UH.Is_Control (Character'Val (16#80#)) then -- raise Constraint_Error
raise Program_Error;
end if;
raise Program_Error;
exception
when Constraint_Error => null;
end;
for I in Ada.Characters.Handling.ISO_646 loop
begin
pragma Assert (UH.Is_Control (I) = AH.Is_Control (I));
pragma Assert (UH.Is_Graphic (I) = AH.Is_Graphic (I));
pragma Assert (UH.Is_Letter (I) = AH.Is_Letter (I));
pragma Assert (UH.Is_Lower (I) = AH.Is_Lower (I));
pragma Assert (UH.Is_Upper (I) = AH.Is_Upper (I));
pragma Assert (UH.Is_Basic (I) = AH.Is_Basic (I));
pragma Assert (M.Is_In (I, M.Constants.Basic_Set) = AH.Is_Basic (I));
pragma Assert (UH.Is_Digit (I) = AH.Is_Digit (I));
pragma Assert (UH.Is_Decimal_Digit (I) = AH.Is_Decimal_Digit (I));
pragma Assert (UH.Is_Hexadecimal_Digit (I) = AH.Is_Hexadecimal_Digit (I));
pragma Assert (UH.Is_Alphanumeric (I) = AH.Is_Alphanumeric (I));
pragma Assert (UH.Is_Special (I) = AH.Is_Special (I));
pragma Assert (UH.To_Lower (I) = AH.To_Lower (I));
pragma Assert (UH.To_Upper (I) = AH.To_Upper (I));
pragma Assert (UH.To_Case_Folding (I) = AH.To_Case_Folding (I));
pragma Assert (M.Value (M.Constants.Case_Folding_Map, I) = AH.To_Case_Folding (I));
pragma Assert (UH.To_Basic (I) = AH.To_Basic (I));
pragma Assert (M.Value (M.Constants.Basic_Map, I) = AH.To_Basic (I));
null;
exception
when others =>
Ada.Debug.Put (Character'Image (I));
raise;
end;
end loop;
-- illegal sequence
pragma Assert (UH.To_Upper ("a" & Character'Val (16#E0#) & "b") = "A" & Character'Val (16#E0#) & "B");
pragma Assert (UH.To_Lower ("A" & Character'Val (16#C0#) & "B") = "a" & Character'Val (16#C0#) & "b");
pragma Debug (Ada.Debug.Put ("OK"));
end charhandling;
|
MinimSecure/unum-sdk | Ada | 1,412 | adb | -- Copyright 2017-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Ada.Text_IO; use Ada.Text_IO;
procedure Crash is
procedure Request_For_Crash is
begin
null; -- Just an anchor for the debugger...
end Request_For_Crash;
task type T is
entry Done;
end T;
task body T is
begin
accept Done do
null;
end Done;
Put_Line ("Task T: Rendez-vous completed.");
end T;
My_T : T;
begin
-- Give some time for the task to be created, and start its execution,
-- so that it reaches the accept statement.
delay 0.01;
Request_For_Crash;
delay 0.01;
Put_Line ("*** We didn't crash !?!");
-- Complete the rendez-vous with our task, so it can complete.
My_T.Done;
end Crash;
|
annexi-strayline/AURA | Ada | 36,564 | adb | ------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- ANNEXI-STRAYLINE Reference Implementation --
-- --
-- Command Line Interface --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2019, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
separate (Ada_Lexical_Parser)
function Next_Element (Source: in out Source_Buffer)
return Lexical_Element
is
Buffer: Wide_Wide_String (1 .. 201);
Last : Natural := 0;
-- Ada standard says that the compiler shall be able to handle lengths of
-- at least 200 (2020 RM 2.2-14)
function Decode_Next
(UTF8_Stream: not null access Ada.Streams.Root_Stream_Type'Class
:= Source.Stream)
return Wide_Wide_Character
renames Unicode.UTF8_Stream_Decoder.Decode_Next;
function To_Unbounded_WWS (Source: in Wide_Wide_String)
return WWU.Unbounded_Wide_Wide_String
renames WWU.To_Unbounded_Wide_Wide_String;
-- Current_Position --
----------------------
-- Returns the position of the character immediately before "Next_Pos",
-- used to give the correct starting position for a Lexical Element.
-- and also to adjust Next_Pos on Push_Source.
--
-- Consume_History is only used by Push when Current_Position is being
-- used to set Next_Pos, and so Source.Last_Line should actually be
-- decremented when necessary
function Current_Position (Consume_History: Boolean := False)
return Source_Position
with Inline is
begin
return Cur_Pos: Source_Position := Source.Next_Pos do
if Cur_Pos.Column = 1 then
declare
Last_Line: Positive;
begin
if Source.Last_Line = Source.Line_History'First then
Last_Line := Source.Line_History'Last;
else
Last_Line := Source.Last_Line - 1;
end if;
Cur_Pos.Line := Cur_Pos.Line - 1;
Cur_Pos.Column := Source.Line_History(Last_Line);
if Consume_History then
Source.Last_Line := Last_Line;
end if;
end;
else
Cur_Pos.Column := Cur_Pos.Column - 1;
end if;
Cur_Pos.Absolute_Position := Cur_Pos.Absolute_Position - 1;
end return;
end Current_Position;
-- Push_Source --
-----------------
-- Push_Source is for when we've looked too far into the buffer, and
-- need to back-up.
procedure Push_Source (C: Wide_Wide_Character) with Inline is
begin
-- This should never be able to cause the loss of any characters
if Source.Level = Buffer_Count'Last then
raise Storage_Error with "Source buffer is insufficient";
end if;
Source.Level := Source.Level + 1;
Source.Content(Source.Level) := C;
-- Backtrack Next_Pos
Source.Next_Pos := Current_Position (Consume_History => True);
end Push_Source;
-- Pop_Source --
----------------
-- Pop_Source is always used to pull the next character from the stream,
-- if Push_Source put characters back, those will be given first. If the
-- buffer is empty, then new characters will be pulled from the stream
function Pop_Source (In_Comment: Boolean := False)
return Wide_Wide_Character
is
begin
return C: Wide_Wide_Character do
if Source.Level = 0 then
C := Decode_Next;
else
C := Source.Content(Source.Level);
Source.Level := Source.Level - 1;
end if;
-- Advance Next_Pos
-- Next character is column 1 on a new line if we just popped an
-- End_Of_Line indicator
if Is_End_Of_Line (C) then
-- Next item at new line, first column. We need to save the
-- current column before resetting Column
if Source.Last_Line = Source.Line_History'Last then
-- Wrap-around
Source.Last_Line := Source.Line_History'First;
else
Source.Last_Line := Source.Last_Line + 1;
end if;
Source.Line_History(Source.Last_Line) := Source.Next_Pos.Column;
Source.Next_Pos.Column := 1;
Source.Next_Pos.Line := Source.Next_Pos.Line + 1;
else
Source.Next_Pos.Column := Source.Next_Pos.Column + 1;
end if;
Source.Next_Pos.Absolute_Position
:= Source.Next_Pos.Absolute_Position + 1;
-- Check basic legality
if not Is_NFC (C) then
raise Invalid_Ada with
"Source is not in Normalization Form C. "
& "(Ada 2020 RM 2.1-4.1/5)";
end if;
if not In_Comment
and then not Is_Legal_Outside_Comments (C)
then
raise Invalid_Ada with
"Illegal character (Codepoint"
& Natural'Image(Wide_Wide_Character'Pos (C))
& ") (Ada 2020 RM 2.1-4/5)";
end if;
end return;
end Pop_Source;
-- Skip_Separators --
---------------------
-- Separators are allowed between all lexical elements, and have no
-- meaning, we will skip them at the start and enf of our search for
-- Next_Element. Doing that at the end allows for the graceful detection
-- of the legal end of the source.
procedure Skip_Separators (Char_Buffer: in out Wide_Wide_Character)
with Inline is
begin
-- Skip_Separators is intended to be called on a fetched character which
-- is expected to be a location where separators are allowed. Therefore
-- due to RM 2.2-7.1/3, Other_Format is also allowed.
-- After calling this, Char_Buffer contains a non-separator character,
-- or else End_Error will be raised by Pop_Source.
while Is_Separator (Char_Buffer)
or else General_Category (Char_Buffer) = Other_Format
loop
Char_Buffer := Pop_Source;
end loop;
end Skip_Separators;
-- Specifically to call Skip_Separators on a discard buffer to see if there
-- are any trailing separators
procedure Skip_Trailing_Separators with Inline is
C: Wide_Wide_Character;
begin
C := Pop_Source;
Skip_Separators (C);
Push_Source (C);
exception
when Ada.IO_Exceptions.End_Error =>
-- Nothing after this group of separators
-- (or maybe no separators at all!)
null;
end Skip_Trailing_Separators;
begin
-- Start by loading in the next character of the source into position 1
-- of the buffer
Buffer(1) := Pop_Source;
-- Skip any leading separators / Other_Format (RM 2.2-7.1/3), but also
Skip_Separators (Buffer(1));
-- Store Last_Pos at this point, since we are expecting that we're
-- looking at the start of a lexical element, which we will want to
-- be able to pinpoint for the user. Whenever we find an illegal
-- condition, we will adjust it accordingly
Source.Last_Pos := Current_Position;
-- In order of the RM, we look for
-- 1. Delimiters (2.2-9/5 and 2.2-10)
-- 2. Identifiers (2.3) (and Reserved words 2.9)
-- 4. Numeric Literals (2.4)
-- 5. Character Literals (2.5)
-- 6. String Literals (2.6)
-- 7. Comments
if Is_Delimiter (Buffer(1)) then
-- Try a compound delimiter
if Possible_Compound_Delimiter (Buffer(1)) then
-- Load one more for a look-ahead
Buffer(2) := Pop_Source;
if Is_Compound_Delimiter (Buffer(1 .. 2)) then
Skip_Trailing_Separators;
return (Category => Delimiter,
Content => To_Unbounded_WWS (Buffer(1 .. 2)));
else
-- Read-ahead is not needed, so we put it back in the buffer
Push_Source (Buffer(2));
Last := 1;
Skip_Trailing_Separators;
return (Category => Delimiter,
Content => To_Unbounded_WWS (Buffer(1 .. 1)));
end if;
else
-- Check for a comment, otherwise we will mistake this as a '-'
-- delimiter
if Buffer(1) = '-' then
-- Load one more for the look-ahead
Buffer(2) := Pop_Source;
if Buffer(2) = '-' then
-- We have a comment. We load everything until we reach the
-- end of the line (we also stip the leading "--"
for I in Buffer'Range loop
-- End of file here is not illegal!
begin
Buffer(I) := Pop_Source (In_Comment => True);
exception
when End_Error => exit;
when others => raise;
end;
exit when Is_End_Of_Line (Buffer(I));
Last := I;
end loop;
-- Look for buffer limitation
if Last = Buffer'Last then
raise Invalid_Ada with
"Comment line exceeds" & Natural'Image (Last)
& " characters. The Ada RM does not require an "
& "implementation to handle such length. "
& "This source is rejected.";
end if;
Skip_Trailing_Separators;
return
(Category => Comment,
Content => To_Unbounded_WWS (Buffer (1 .. Last)));
else
-- False alarm
Push_Source (Buffer(2));
end if;
-- Check for a possible character literal, which is not a "tick"
-- delimiter!
elsif Buffer(1) = ''' then
-- The rules are clear (Ada 2020 RM 2.5), a legal character
-- literal is always exactly 3 characters long
Buffer(2) := Pop_Source;
Buffer(3) := Pop_Source;
if Buffer(3) = ''' then
-- Bingo.
if not Is_Graphic_Character (Buffer(2)) then
raise Invalid_Ada with
"Character literals shall be graphic_characters "
& "(RM 2.5-2)";
end if;
Skip_Trailing_Separators;
return
(Category => Character_Literal,
Content => To_Unbounded_WWS (Buffer(2 .. 2)));
else
-- We looked ahead too far
Push_Source (Buffer(3));
Push_Source (Buffer(2));
end if;
end if;
-- If we make it here, this is regular delimiter
Skip_Trailing_Separators;
return (Category => Delimiter,
Content => To_Unbounded_WWS (Buffer(1 .. 1)));
end if;
end if;
-- We get here if any only if we are not looking at a delimiter, comment,
-- or character literal
-- As much as possible, we follow the order set-out in the RM (clause 2),
-- so we now check for an identifier.
-- If it not an identifier, (due to the rules) it may must then be
-- a literal of some kind, or else it is illegal.
-- First check that the first character is a legal beginning of an
-- Identifier
if Is_Legal_Identifier (Buffer(1 .. 1)) then
-- Load in all characters until we get to a separator or delimiter
-- This may include many illegal identifier characters, but those
-- will be illegal!
Last := 1;
for I in 2 .. Buffer'Last loop
-- End of line here is not "technically" illegal (lexically),
-- but is almost certainly illegal symantically. That is not
-- our jurisdiction, however.
begin
Buffer(I) := Pop_Source;
exception
when End_Error => exit;
when others => raise;
end;
-- According to the RM 2.2-7, a separator is required between
-- an identifier and an adjacent identifier/reserved word, numeric
-- or literal. Obviously two identifiers without a separator would
-- just look like a single identifier. Similarily, a numeric
-- literal could be part of the identifier, unless it included
-- a '#', which would be illegal in an identifier
-- This means that we should stop when we find the beginning of any
-- of the following lexical elements:
-- 1. A delimiter
-- 2. A character literal (handled by 1 since ''' is a delimiter
-- also)
-- 3. A string literal ('"'), or
-- We are doing this all by look-ahead, but the numeric literal
-- logic will also ensure it is followed by something appropriate
-- as well (not an identifier/reserved word or numeric literal).
--
-- This will have the effect of ensuring that the previous element
-- has already been separated from this one if required
exit when Is_Separator (Buffer(I))
or else Is_Delimiter (Buffer(I))
or else Buffer(I) = '"';
-- Note that we check specifically for Is_Separator, and not
-- "Other_Format" (see RM 2.2-7.1/3). This is because any
-- "Other_Format" before a separator means it would be part of
-- the identifier (and thus illegal) - see AI05-0079-1
Last := I;
end loop;
-- Check for a buffer limitation
if Last = Buffer'Last then
raise Invalid_Ada with
"Identifier too long: Identifier longer than"
& Natural'Image (Buffer'Last)
& " is not required to be accepted by the Ada standard";
elsif not Is_Separator (Buffer(Last + 1)) then
-- Anything except for a separator at Last + 1 needs to be pushed
-- back to the buffer
Push_Source (Buffer(Last + 1));
end if;
-- Now we are ready to check the legality or reserved status of this
-- apparent identifier
if not Is_Legal_Identifier (Buffer(1 .. Last)) then
raise Invalid_Ada with "Illegal identifier";
end if;
-- Now we can finally apply case folding and check for reserved status
for C of Buffer(1 .. Last) loop
C := Unicode.Case_Folding.Simple (C);
end loop;
-- Finally - reserved or not?
return E: Lexical_Element do
declare
Content: Wide_Wide_String renames Buffer(1 .. Last);
begin
E.Content := To_Unbounded_WWS (Content);
if Is_Reserved_Word (Content) then
E.Category := Reserved_Word;
else
E.Category := Identifier;
end if;
end;
Skip_Trailing_Separators;
end return;
end if;
-- Getting here means: not an identifier or Reserved Word. Next-up are
-- numeric literals (2.4). These consist of Decimal Literals and
-- Based Literals
-- The first character of every numeric literal is always a Digit
-- (RM 2.4.1-4.1/2)
if Is_Digit (Buffer(1)) then
-- The bulk of the work here is verifying the legality of the
-- presentation.
-- We will load it one chunk at a time, handling bases, decimals,
-- and exponents as we find them.
-- For any given numeric literal, we should find only the following
-- non-numeral characters in the literal
-- 1. a '.' indicating a decimal real number
-- -> Could be a compound delimiter "..", otherwise,
-- -> Only 1 (2.4.1-2, 2.4.2-2)
-- -> shall be inside '#'s of a based literal (2.4.2-2)
-- 2. a '#' indicating a based literal
-- -> Must have exactly 2, (2.4.2-2)
-- -> must come after at least one numeral (2.4.2-2)
-- -> Must demarcate at least one based numeral (2.4.2-2)
-- 3. a 'e' indicating an exponent
-- -> only 1 (2.4.1-2, 2.4.2-2)
-- -> Must follow '#' if based (2.4.2-2),
-- or a numeral if decimal (2.4.1-2)
-- -> Must be followed by at least one numeral,
-- or else '+' or '-' (2.4.1-4)
-- 3. a separator indicating the end of the literal
-- 4. a delimiter indicating the end of the literal
-- Based on these rules, we can set-up some variables and loop through
-- until the end, detecting illegalities along the way.
declare
Special : Boolean := False;
Is_Real : Boolean := False;
Is_Based : Boolean := False;
Inside_Hash: Boolean := False;
In_Exponent: Boolean := False;
Got_Sign : Boolean := False;
Need_More : Boolean := False;
Decimal_At : Positive; -- Index of the decimal point
First_Hash : Positive; -- Index of first '#'
Last_Hash : Positive; -- Index of last '#'
Exponent_Mark : Positive; -- Index of end of exponent's 'e'
Exponent_Sign : Positive; -- Index of exponents sign (if any),
-- or equal to Exponent_Mark
begin
Last := 1;
for I in 2 .. Buffer'Last loop
begin
Buffer(I) := Pop_Source;
exception
when End_Error =>
if Need_More then
raise Invalid_Ada with
"Unexpected end of source during numeric literal";
else
exit;
end if;
when others => raise;
end;
-- Separators are always the end of the literal
exit when Is_Separator (Buffer(I));
-- If we find a delimiter, we need to make sure we push it
-- back to the buffer before exiting
if Is_Delimiter (Buffer(I)) then
-- A few delimiters are part of the numeric literal syntax
if Buffer(I) not in '.' | '-' | '+' then
-- These are definate delimiters ending the literal
Push_Source (Buffer(I));
exit;
elsif Buffer(I) in '.' | '-' then
-- These could be part of the literal, unless they are
-- compound delimiters (either a range or comment)
declare
T: Wide_Wide_Character;
begin
-- Just a peak!
T := Pop_Source;
Push_Source (T);
if T = Buffer(I) then
-- Valid compound delimiter.
Push_Source (Buffer(I));
exit;
end if;
exception
when End_Error =>
raise Invalid_Ada with
"Unexpected end of source during "
& "numeric literal";
when others => raise;
end;
end if;
end if;
-- Still in the literal
if Inside_Hash then
Buffer(I) := Unicode.Case_Folding.Simple (Buffer(I));
Special := not (Is_Extended_Digit (Buffer(I))
or else Buffer(I) = '_');
-- This doesn't detect invalid numerals like, say '__AB_',
-- but that is checked after the loop.
else
Special := not (Is_Digit (Buffer(I))
or else Buffer(I) = '_');
end if;
Need_More := False;
if Special then
if not Inside_Hash then
-- Case folding for exponent 'e'
Buffer(I) := Unicode.Case_Folding.Simple (Buffer(I));
end if;
-- Non-digit, so we need to interpret their meaning
case Buffer(I) is
when '.' =>
if Is_Real then
-- More than one found, illegal
raise Invalid_Ada with "Numeric literal with "
& "multiple decimal points.";
elsif In_Exponent then
raise Invalid_Ada with
"Invalid Numeric literal: '.' is not legal in "
& "an exponent.";
else
if (Inside_Hash
and then not Is_Extended_Digit
(Buffer(I - 1)))
or else (not Inside_Hash
and then not Is_Digit (Buffer(I - 1)))
then
raise Invalid_Ada with
"Numeric literal invalid: Decimal point shall "
& "be preceeded with a digit.";
end if;
Need_More := True;
Is_Real := True;
Decimal_At := I;
end if;
when '#' =>
if Inside_Hash then
Last_Hash := I;
Inside_Hash := False;
if not Is_Extended_Digit (Buffer(I - 1)) then
-- Something like: "16##", "16#2.#", "16#2_#,
-- all illegal
raise Invalid_Ada with
"Based numeric literal with invalid based "
& "value.";
end if;
elsif Is_Based then
-- Not in a hash, yet based, that means we
-- passed two '#' already
raise Invalid_Ada with
"Numeric literal with > 2 '#' characters";
elsif In_Exponent then
-- We're in an exponent (after an 'e'), so this
-- doesn't work!
raise Invalid_Ada with
"Invalid Numeric literal: '#' not allowed in "
& "an exponent";
else
-- Not inside hash, and not based, and not in an
-- exponent.
if Buffer(I - 1) = '.' then
raise Invalid_Ada with
"Numeric literal invalid: "
& "Decimal point must be followed by a digit.";
end if;
Is_Based := True;
Inside_Hash := True;
First_Hash := I;
Need_More := True;
end if;
when 'e' =>
-- Note if In_Hash, 'e' is not considered special, it
-- is an extended digit, so we'd never end up here.
if In_Exponent then
raise Invalid_Ada with
"Invalid Numeric literal: multiple 'e's";
end if;
if (not Is_Digit (Buffer(I - 1)))
and then Buffer(I - 1) /= '#'
then
raise Invalid_Ada with
"Invalid Numeric literal: Exponent shall follow "
& "a digit or '#'";
end if;
-- We also need to do a look-ahead here, because the
-- there needs to be exactly a '-', '+' or a digit
-- following the e
declare
T: Wide_Wide_Character;
begin
-- Peek
T := Pop_Source;
Push_Source (T);
if T not in '-' | '+'
and then not Is_Digit (T)
then
raise Invalid_Ada with
"Invalid Numeric literal: Exponment shall "
& "be followed with +,-, or a digit.";
end if;
exception
when End_Error =>
raise Invalid_Ada with
"Invalid numeric literal: "
& "source ended at exponent.";
end;
In_Exponent := True;
Exponent_Mark := I;
Exponent_Sign := I;
Need_More := True;
when '-' | '+' =>
if not In_Exponent then
if Inside_Hash then
raise Invalid_Ada with
"Invalid Numeric literal: based literal not "
& "terminated";
else
-- This should be considered as encountering a
-- delimiter, and so the literal should be over
Push_Source (Buffer(I));
exit;
end if;
elsif Got_Sign then
-- Multiple +/- after an exponent
-- If they are paired, that's no good, but
-- if a number has is before us, then it is really
-- just a delimiter
if Is_Digit (Buffer(I - 1)) then
Push_Source (Buffer(I));
exit;
else
raise Invalid_Ada with
"Invalid Numeric literal: multiple signs "
& "following exponent";
end if;
else
-- Last character was 'e', so this is our sign
Got_Sign := True;
Exponent_Sign := I;
Need_More := True;
end if;
when others =>
raise Invalid_Ada with
"Invalid character in Numeric literal";
end case;
end if;
-- Corner case.. If we have a based literal and we are outside
-- of the hash, then the next character must be 'e', a space,
-- or a delimiter. Anything else is illegal.
-- We most of this already, and if we made it this far, with
-- Inside_Hash false, it means that what follows '#' is a digit
-- or '_'. That is not legal (according to 2.4.2-2), and that
-- adjacent numeric literals must be separated by a separator.
if not Inside_Hash and then Is_Based and then not Special then
raise Invalid_Ada with
"Invalid Numeric literal: " &
"Based literals must end with an exponent, " &
"a delimiter, or a at least one separator space.";
end if;
Last := I;
end loop;
-- Check for buffer limit
if Last = Buffer'Last then
raise Invalid_Ada with
"Numeric literal too long: Literal longer than"
& Natural'Image (Buffer'Last)
& " is not required to be accepted by the Ada standard";
end if;
-- Completion checks
if Inside_Hash -- e.g "16#ABC"
or else (Is_Real and then Decimal_At = Last) -- e.g ".123"
or else (In_Exponent and then Exponent_Mark = Last)
-- e.g "123e+"
then
raise Invalid_Ada with "Incomplete numeric literal";
end if;
declare
OK: Boolean := False;
begin
if Is_Based then
OK := Is_Numeral (Buffer(1 .. First_Hash - 1));
if Is_Real then
OK := OK
and then
(Is_Based_Numeral
(Buffer(First_Hash + 1 .. Decimal_At - 1))
and then
Is_Based_Numeral
(Buffer(Decimal_At + 1 .. Last_Hash - 1)));
else
OK := OK and then Is_Based_Numeral
(Buffer(First_Hash + 1 .. Last_Hash - 1));
end if;
else
if Is_Real then
OK := Is_Numeral (Buffer(1 .. Decimal_At - 1));
if In_Exponent then
OK := OK and then Is_Numeral
(Buffer(Decimal_At + 1 .. Exponent_Mark - 1));
else
OK := OK and then Is_Numeral
(Buffer(Decimal_At + 1 .. Last));
end if;
elsif In_Exponent then
OK := Is_Numeral (Buffer(1 .. Exponent_Mark - 1));
else
OK := Is_Numeral (Buffer(1 .. Last));
end if;
end if;
if In_Exponent then
OK := OK and then Is_Numeral
(Buffer(Exponent_Sign + 1 .. Last));
end if;
-- Tally it up
if not OK then
raise Invalid_Ada with "Numeric literal invalid: "
& "bad numerals";
end if;
end;
end;
-- We have a valid Numeric literal!
Skip_Trailing_Separators;
return (Category => Numeric_Literal,
Content => To_Unbounded_WWS (Buffer(1 .. Last)));
end if;
-- Getting here means: we better see a string literal!
if Buffer(1) /= '"' then
raise Invalid_Ada with
"Not a legal Ada lexical element.";
end if;
-- The rules (RM 2.6) are fairly simple We should see a sequence of
-- zero or more graphic characters, followed by a '"'. If we see two
-- consecutive quotation marks, that counts as a single quotation mark
-- in the string literal itself. Anything else is just illegal.
Last := 1;
for I in Buffer'Range loop
Buffer(I) := Pop_Source;
if not Is_Graphic_Character (Buffer(I)) then
raise Invalid_Ada with
"Illegal characters in String Literal";
elsif Buffer(I) = '"' then
declare
Look_Ahead: Wide_Wide_Character := Pop_Source;
begin
if Look_Ahead /= '"' then
-- Not a double quotation mark, this means we have the
-- actual end of the string literal
Push_Source (Look_Ahead);
exit;
end if;
-- Otherwise, it is a double quotation mark in the string
-- sequence which collapses into an actual quotation mark in the
-- literal. We've bascially done that already with the second
-- Pop_Source, which effectively discards the "extra" quotation
-- mark
end;
end if;
Last := I;
end loop;
-- Check for buffer limit
if Last = Buffer'Last then
raise Invalid_Ada with
"String literal too long: String literal longer than"
& Natural'Image (Buffer'Last)
& " is not required to be accepted by the Ada standard";
end if;
-- :)
Skip_Trailing_Separators;
return (Category => String_Literal,
Content => To_Unbounded_WWS (Buffer(1 .. Last)));
exception
when Invalid_Ada =>
-- Note the position of the (last) illegal characrer in Last_Post
Source.Last_Pos := Current_Position;
raise;
end Next_Element;
|
sungyeon/drake | Ada | 784 | adb | with Ada.Locales;
procedure locale is
use type Ada.Locales.ISO_639_Alpha_2;
use type Ada.Locales.ISO_639_Alpha_3;
begin
Ada.Debug.Put (String (Ada.Locales.ISO_639_Alpha_2'(Ada.Locales.Language)));
Ada.Debug.Put (String (Ada.Locales.ISO_639_Alpha_3'(Ada.Locales.Language)));
Ada.Debug.Put (String (Ada.Locales.Country));
pragma Assert (Ada.Locales.To_Alpha_2 (Ada.Locales.Language) = Ada.Locales.Language);
pragma Assert (Ada.Locales.To_Alpha_3 (Ada.Locales.Language) = Ada.Locales.Language);
pragma Assert (Ada.Locales.To_Alpha_2 (Ada.Locales.ISO_639_Alpha_3_Unknown) = Ada.Locales.ISO_639_Alpha_2_Unknown);
pragma Assert (Ada.Locales.To_Alpha_3 (Ada.Locales.ISO_639_Alpha_2_Unknown) = Ada.Locales.ISO_639_Alpha_3_Unknown);
pragma Assert (Ada.Debug.Put ("OK"));
end locale;
|
reznikmm/matreshka | Ada | 4,166 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- 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 package provides implementation of built-in entity resolver.
------------------------------------------------------------------------------
package XML.SAX.Simple_Readers.Resolver is
procedure Resolve_Entity
(Public_Id : League.Strings.Universal_String;
Base_URI : League.Strings.Universal_String;
System_Id : League.Strings.Universal_String;
Source : out XML.SAX.Input_Sources.SAX_Input_Source_Access;
Success : in out Boolean;
Error_Message : in out League.Strings.Universal_String);
-- Resolves specified external entity and sets Source to the created input
-- source; Success and Error_Message are untouched. On error it sets Source
-- to null, Success to False and Error_Message to diagnosis message.
end XML.SAX.Simple_Readers.Resolver;
|
reznikmm/matreshka | Ada | 5,163 | 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.Generic_Collections;
package AMF.DG.Graphical_Elements.Collections is
pragma Preelaborate;
package DG_Graphical_Element_Collections is
new AMF.Generic_Collections
(DG_Graphical_Element,
DG_Graphical_Element_Access);
type Set_Of_DG_Graphical_Element is
new DG_Graphical_Element_Collections.Set with null record;
Empty_Set_Of_DG_Graphical_Element : constant Set_Of_DG_Graphical_Element;
type Ordered_Set_Of_DG_Graphical_Element is
new DG_Graphical_Element_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_DG_Graphical_Element : constant Ordered_Set_Of_DG_Graphical_Element;
type Bag_Of_DG_Graphical_Element is
new DG_Graphical_Element_Collections.Bag with null record;
Empty_Bag_Of_DG_Graphical_Element : constant Bag_Of_DG_Graphical_Element;
type Sequence_Of_DG_Graphical_Element is
new DG_Graphical_Element_Collections.Sequence with null record;
Empty_Sequence_Of_DG_Graphical_Element : constant Sequence_Of_DG_Graphical_Element;
private
Empty_Set_Of_DG_Graphical_Element : constant Set_Of_DG_Graphical_Element
:= (DG_Graphical_Element_Collections.Set with null record);
Empty_Ordered_Set_Of_DG_Graphical_Element : constant Ordered_Set_Of_DG_Graphical_Element
:= (DG_Graphical_Element_Collections.Ordered_Set with null record);
Empty_Bag_Of_DG_Graphical_Element : constant Bag_Of_DG_Graphical_Element
:= (DG_Graphical_Element_Collections.Bag with null record);
Empty_Sequence_Of_DG_Graphical_Element : constant Sequence_Of_DG_Graphical_Element
:= (DG_Graphical_Element_Collections.Sequence with null record);
end AMF.DG.Graphical_Elements.Collections;
|
AdaCore/Ada_Drivers_Library | Ada | 27,915 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2019, 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. --
-- --
------------------------------------------------------------------------------
-- This packages provide a low level driver for the FAT file system
-- architecture. It is recommended to _not_ use this interface directly but to
-- access the file system using the File_IO package. For more info, see the
-- file system chapter of the documentation.
with System;
with Interfaces; use Interfaces;
with HAL; use HAL;
with HAL.Block_Drivers; use HAL.Block_Drivers;
with HAL.Filesystem; use HAL.Filesystem;
package Filesystem.FAT is
MAX_VOLUMES : constant := 1;
-- Maximum number of mounted volumes
MAX_FILENAME_LENGTH : constant := 255;
-- Maximum size of a file or directory name
MAX_FILE_HANDLES : constant := 10;
-- Maximum number of handles opened simultaneously.
MAX_DIR_HANDLES : constant := 10;
-- Maximum number of handles opened simultaneously.
type FAT_Name is private;
type FAT_Filesystem is limited new Filesystem_Driver with private;
type FAT_Filesystem_Access is access all FAT_Filesystem;
type FAT_Node is new Node_Handle with private;
-----------------------
-- PATH MANIPULATION --
-----------------------
function "-" (Name : FAT_Name) return String;
function "-" (Name : String) return FAT_Name
with Pre => Name'Length < MAX_FILENAME_LENGTH;
overriding function "=" (Name1, Name2 : FAT_Name) return Boolean;
function Is_Root (Path : String) return Boolean with Inline_Always;
function Parent (Path : String) return String;
function Basename (Path : String) return String;
function Normalize (Path : String;
Ensure_Dir : Boolean := False) return String;
------------------------
-- DIRECTORY HANDLING --
------------------------
overriding function Open
(FS : in out FAT_Filesystem;
Path : String;
Handle : out Any_Directory_Handle) return Status_Code;
overriding function Root_Node
(FS : in out FAT_Filesystem;
As : String;
Handle : out Any_Node_Handle)
return Status_Code;
function Long_Name (E : FAT_Node) return FAT_Name;
function Short_Name (E : FAT_Node) return FAT_Name;
overriding function Basename (E : FAT_Node) return String;
overriding function Is_Read_Only (E : FAT_Node) return Boolean;
overriding function Is_Hidden (E : FAT_Node) return Boolean;
function Is_System_File (E : FAT_Node) return Boolean;
overriding function Is_Symlink (E : FAT_Node) return Boolean;
overriding function Is_Subdirectory
(E : FAT_Node) return Boolean;
function Is_Archive (E : FAT_Node) return Boolean;
overriding function Size (E : FAT_Node) return File_Size;
overriding procedure Close (E : in out FAT_Node);
overriding function Get_FS
(E : FAT_Node) return Any_Filesystem_Driver;
-------------------
-- FILE HANDLING --
-------------------
overriding function Open
(FS : in out FAT_Filesystem;
Path : String;
Mode : File_Mode;
Handle : out Any_File_Handle)
return Status_Code;
overriding function Open
(Parent : FAT_Node;
Name : String;
Mode : File_Mode;
Handle : out Any_File_Handle)
return Status_Code
with Pre => Name'Length <= MAX_FILENAME_LENGTH;
--------------------
-- FAT FILESYSTEM --
--------------------
function Open
(Controller : HAL.Block_Drivers.Any_Block_Driver;
LBA : Block_Number;
FS : in out FAT_Filesystem)
return Status_Code;
-- Opens a FAT partition at the given LBA
overriding procedure Close (FS : in out FAT_Filesystem);
-----------------------
-- FAT FS PROPERTIES --
-----------------------
type FAT_Version is
(FAT16,
FAT32);
function Version (FS : FAT_Filesystem) return FAT_Version;
-- The FAT version of the volume
function OEM_Name (FS : FAT_Filesystem) return String;
-- The OEM Name of the Volume. Different from the Volume Label.
function Is_Volume
(FS : FAT_Filesystem) return Boolean;
function Volume_ID
(FS : FAT_Filesystem) return Unsigned_32;
function Volume_Label
(FS : FAT_Filesystem) return String;
function File_System_Type
(FS : FAT_Filesystem) return String;
private
type Cluster_Type is new Interfaces.Unsigned_32;
subtype Valid_Cluster is Cluster_Type range 2 .. 16#0FFF_FFFF#;
type Block_Offset is new Interfaces.Unsigned_32;
type FAT_File_Size is new Interfaces.Unsigned_32;
-- FAT Filesystem does not support files >= 4GB (e.g. 2**32)
INVALID_CLUSTER : constant Cluster_Type := 0;
FREE_CLUSTER_VALUE : constant Cluster_Type := 16#0000_0000#;
LAST_CLUSTER_VALUE : constant Cluster_Type := 16#0FFF_FFFF#;
BAD_CLUSTER_VALUE : constant Cluster_Type := 16#0FFF_FFF7#;
function Get_Start_Cluster
(E : FAT_Node) return Cluster_Type;
function Size (E : FAT_Node) return FAT_File_Size;
function Block_Size
(FS : FAT_Filesystem) return FAT_File_Size;
function Blocks_Per_Cluster
(FS : FAT_Filesystem) return Block_Offset;
function Cluster_Size
(FS : FAT_Filesystem) return FAT_File_Size;
function Reserved_Blocks
(FS : FAT_Filesystem) return Unsigned_16;
function Number_Of_FATs
(FS : FAT_Filesystem) return Unsigned_8;
function Total_Number_Of_Blocks
(FS : FAT_Filesystem) return Unsigned_32;
function FAT_Table_Size_In_Blocks
(FS : FAT_Filesystem) return Unsigned_32;
function Number_Of_Hidden_Blocks
(FS : FAT_Filesystem) return Unsigned_32;
function Root_Dir_Cluster
(FS : FAT_Filesystem) return Cluster_Type;
function FAT16_Root_Dir_Num_Entries
(FS : FAT_Filesystem) return Unsigned_16;
function Flags_For_FAT_Mirroring
(FS : FAT_Filesystem) return Unsigned_16
with Pre => Version (FS) = FAT32;
function FS_Version_Number
(FS : FAT_Filesystem) return Unsigned_16
with Pre => Version (FS) = FAT32;
function FSInfo_Block_Number
(FS : FAT_Filesystem) return Unsigned_16
with Pre => Version (FS) = FAT32;
function Boot_Block_Backup_Block_Number
(FS : FAT_Filesystem) return Unsigned_16
with Pre => Version (FS) = FAT32;
function Last_Known_Free_Data_Clusters_Number
(FS : FAT_Filesystem) return Unsigned_32
with Pre => Version (FS) = FAT32;
function Most_Recently_Allocated_Cluster
(FS : FAT_Filesystem) return Cluster_Type
with Pre => Version (FS) = FAT32;
type FAT_Name is record
Name : String (1 .. MAX_FILENAME_LENGTH);
Len : Natural := 0;
end record;
type FAT_Disk_Parameter is record
OEM_Name : String (1 .. 8);
Block_Size_In_Bytes : Unsigned_16;
Blocks_Per_Cluster : Unsigned_8;
Reserved_Blocks : Unsigned_16;
Number_Of_FATs : Unsigned_8;
Root_Dir_Entries_Fat16 : Unsigned_16;
Number_Of_Blocks_Fat16 : Unsigned_16;
Removable_Drive : Boolean;
Table_Size_Fat16 : Unsigned_16;
Blocks_Per_Cylinder : Unsigned_16;
Number_Of_Heads : Unsigned_16;
Hidden_Blocks : Unsigned_32;
Number_Of_Blocks_Fat32 : Unsigned_32;
Table_Size_Fat32 : Unsigned_32;
Fat_Mirroring_Flags : Unsigned_16;
FS_Version_Number : Unsigned_16;
Root_Directory_Cluster : Cluster_Type;
FSInfo_Block_Number : Unsigned_16;
Boot_Block_Backup_Block : Unsigned_16;
Drive_Number_Fat32 : Unsigned_8;
Current_Head_Fat32 : Unsigned_8;
Boot_Signature_Fat32 : Unsigned_8;
Volume_Id_Fat32 : Unsigned_32;
Volume_Label_Fat32 : String (1 .. 11);
FS_Type_Fat32 : String (1 .. 8);
end record with Size => 92 * 8;
for FAT_Disk_Parameter use record
OEM_Name at 16#03# range 0 .. 63;
Block_Size_In_Bytes at 16#0B# range 0 .. 15;
Blocks_Per_Cluster at 16#0D# range 0 .. 7;
Reserved_Blocks at 16#0E# range 0 .. 15;
Number_Of_FATs at 16#10# range 0 .. 7;
Root_Dir_Entries_Fat16 at 16#11# range 0 .. 15;
Number_Of_Blocks_Fat16 at 16#13# range 0 .. 15;
Removable_Drive at 16#15# range 2 .. 2;
Table_Size_Fat16 at 16#16# range 0 .. 15;
Blocks_Per_Cylinder at 16#18# range 0 .. 15;
Number_Of_Heads at 16#1A# range 0 .. 15;
Hidden_Blocks at 16#1C# range 0 .. 31;
Number_Of_Blocks_Fat32 at 16#20# range 0 .. 31;
Table_Size_Fat32 at 16#24# range 0 .. 31;
Fat_Mirroring_Flags at 16#28# range 0 .. 15;
FS_Version_Number at 16#2A# range 0 .. 15;
Root_Directory_Cluster at 16#2C# range 0 .. 31;
FSInfo_Block_Number at 16#30# range 0 .. 15;
Boot_Block_Backup_Block at 16#32# range 0 .. 15;
Drive_Number_Fat32 at 16#40# range 0 .. 7;
Current_Head_Fat32 at 16#41# range 0 .. 7;
Boot_Signature_Fat32 at 16#42# range 0 .. 7;
Volume_Id_Fat32 at 16#43# range 0 .. 31;
Volume_Label_Fat32 at 16#47# range 0 .. 87;
FS_Type_Fat32 at 16#52# range 0 .. 63;
end record;
function Trim (S : String) return String;
type FAT_FS_Info is record
Signature : String (1 .. 4);
Free_Clusters : Unsigned_32;
Last_Allocated_Cluster : Cluster_Type;
end record;
for FAT_FS_Info use record
Signature at 0 range 0 .. 31;
Free_Clusters at 4 range 0 .. 31;
Last_Allocated_Cluster at 8 range 0 .. 31;
end record;
type FAT_Filesystem is limited new Filesystem_Driver with record
Initialized : Boolean := False;
Disk_Parameters : FAT_Disk_Parameter;
LBA : Block_Number;
Controller : Any_Block_Driver;
FSInfo : FAT_FS_Info;
FSInfo_Changed : Boolean := False;
Root_Dir_Area : Block_Offset := 0;
Data_Area : Block_Offset; -- address to the data area, rel. to LBA
FAT_Addr : Block_Offset; -- address to the FAT table, rel. to LBA
Num_Clusters : Cluster_Type;
Window_Block : Block_Offset := Block_Offset'Last;
Window : Block (0 .. 511);
FAT_Block : Block_Offset := Block_Offset'Last;
FAT_Window : Block (0 .. 511);
Root_Entry : aliased FAT_Node;
end record;
function Ensure_Block
(FS : in out FAT_Filesystem;
Block : Block_Offset)
return Status_Code;
-- Ensures the block is visible within the FS window.
-- Block_Base_OFfset returns the index within the FS window of the block
function Write_Window (FS : in out FAT_Filesystem)
return Status_Code;
function Cluster_To_Block
(FS : FAT_Filesystem;
Cluster : Cluster_Type) return Block_Offset
is (FS.Data_Area + Block_Offset (Cluster - 2) * FS.Blocks_Per_Cluster);
function "+" (Base : Block_Number;
Off : Block_Offset) return Block_Number
is (Base + Block_Number (Off));
function Get_FAT
(FS : in out FAT_Filesystem;
Cluster : Cluster_Type) return Cluster_Type;
function Set_FAT
(FS : in out FAT_Filesystem;
Cluster : Cluster_Type;
Value : Cluster_Type)
return Status_Code;
function Get_Free_Cluster
(FS : in out FAT_Filesystem;
Previous : Cluster_Type := INVALID_CLUSTER) return Cluster_Type;
-- Retrieve a free cluster from the filesystem.
-- Returns INVALID_CLUSTER in case the filesystem is full.
procedure Write_FSInfo
(FS : in out FAT_Filesystem);
-- Writes back the FSInfo structure on the Filesystem
function Is_Last_Cluster
(FS : FAT_Filesystem;
Ent : Cluster_Type) return Boolean
is (case Version (FS) is
when FAT16 => (Ent and 16#FFF8#) = 16#FFF8#,
when FAT32 => (Ent and 16#0FFF_FFF8#) = 16#0FFF_FFF8#);
-- return true if this is the last cluster for an entry
function Is_Reserved_Cluster
(FS : FAT_Filesystem;
Ent : Cluster_Type) return Boolean
is (case Version (FS) is
when FAT16 => Ent > FS.Num_Clusters and Ent <= 16#FFF6#,
when FAT32 => Ent > FS.Num_Clusters and Ent <= 16#0FFF_FFF6#);
-- return true if this cluster is reserved
function Is_Bad_Cluster
(FS : FAT_Filesystem;
Ent : Cluster_Type) return Boolean
is (case Version (FS) is
when FAT16 => (Ent and 16#FFF7#) = 16#FFF7#,
when FAT32 => (Ent and 16#FFFF_FFF7#) = 16#FFFF_FFF7#);
-- return true if this cluster is defective
function Is_Free_Cluster
(FS : FAT_Filesystem;
Ent : Cluster_Type) return Boolean
is ((Ent and 16#0FFF_FFFF#) = FREE_CLUSTER_VALUE);
-- return true if the FAT entry indicates the cluster being unused
function New_Cluster
(FS : in out FAT_Filesystem) return Cluster_Type;
function New_Cluster
(FS : in out FAT_Filesystem;
Previous : Cluster_Type) return Cluster_Type;
type Entry_Index is new Unsigned_16;
Null_Index : Entry_Index := 16#FFFF#;
type FAT_Directory_Handle is limited new Directory_Handle with record
Is_Free : Boolean := True;
FS : FAT_Filesystem_Access;
Current_Index : Entry_Index;
Start_Cluster : Cluster_Type;
Current_Cluster : Cluster_Type;
Current_Block : Block_Offset;
Current_Node : aliased FAT_Node;
end record;
type FAT_Directory_Handle_Access is access all FAT_Directory_Handle;
type Any_FAT_Directory_Handle is access all FAT_Directory_Handle'Class;
overriding function Get_FS
(Dir : FAT_Directory_Handle) return Any_Filesystem_Driver;
overriding function Read
(Dir : in out FAT_Directory_Handle;
Handle : out Any_Node_Handle)
return Status_Code;
overriding procedure Reset (Dir : in out FAT_Directory_Handle);
overriding procedure Close (Dir : in out FAT_Directory_Handle);
overriding
function Create_File (This : in out FAT_Filesystem;
Path : String)
return Status_Code;
overriding
function Unlink (This : in out FAT_Filesystem;
Path : String)
return Status_Code;
overriding
function Remove_Directory (This : in out FAT_Filesystem;
Path : String)
return Status_Code;
function FAT_Open
(FS : in out FAT_Filesystem;
Path : String;
Handle : out FAT_Directory_Handle_Access)
return Status_Code;
function FAT_Open
(D_Entry : FAT_Node;
Handle : out FAT_Directory_Handle_Access)
return Status_Code;
type FAT_Directory_Entry_Attribute is record
Read_Only : Boolean;
Hidden : Boolean;
System_File : Boolean;
Volume_Label : Boolean;
Subdirectory : Boolean;
Archive : Boolean;
end record with Size => 8, Pack;
type FAT_Node is new Node_Handle with record
FS : FAT_Filesystem_Access;
L_Name : FAT_Name;
S_Name : String (1 .. 8);
S_Name_Ext : String (1 .. 3);
Attributes : FAT_Directory_Entry_Attribute;
Start_Cluster : Cluster_Type; -- The content of this entry
Size : FAT_File_Size;
Index : Entry_Index;
-- Index of the FAT_Directory_Intry within Parent's content
Is_Root : Boolean := False;
-- Is it the root directory ?
Is_Dirty : Boolean := False;
-- Whether changes need to be written on disk
end record;
type FAT_File_Handle is limited new File_Handle with record
Is_Free : Boolean := True;
FS : FAT_Filesystem_Access;
Mode : File_Mode;
-- The current cluster from which we read or write
Current_Cluster : Cluster_Type := 0;
-- The current block from which we read or write, offset from
-- current_cluster base block
Current_Block : Block_Offset := 0;
-- Buffer with the content of the current block
Buffer : Block (0 .. 511);
-- How much data in Buffer is meaningful
Buffer_Filled : Boolean := False;
-- Whether there's a discrepency between the disk data and the buffer
Buffer_Dirty : Boolean := False;
-- The actual file index
File_Index : FAT_File_Size := 0;
-- The associated directory entry
D_Entry : FAT_Node;
-- The parent's directory directory entry
Parent : FAT_Node;
end record;
type FAT_File_Handle_Access is access all FAT_File_Handle;
overriding function Get_FS
(File : in out FAT_File_Handle) return Any_Filesystem_Driver;
overriding function Size (File : FAT_File_Handle)
return File_Size;
overriding function Mode (File : FAT_File_Handle)
return File_Mode;
overriding function Read
(File : in out FAT_File_Handle;
Addr : System.Address;
Length : in out File_Size)
return Status_Code;
-- read data from file.
-- @return number of bytes read (at most Data'Length), or -1 on error.
overriding function Offset
(File : FAT_File_Handle)
return File_Size;
-- Current index within the file
overriding function Write
(File : in out FAT_File_Handle;
Addr : System.Address;
Length : File_Size)
return Status_Code;
-- write to file
-- @return number of bytes written (at most Data'Length), or -1 on error.
overriding function Flush
(File : in out FAT_File_Handle)
return Status_Code;
-- force writing file to disk at this very moment (slow!)
overriding function Seek
(File : in out FAT_File_Handle;
Origin : Seek_Mode;
Amount : in out File_Size)
return Status_Code;
-- Moves the current file position to "Amount", according to the Origin
-- parameter. If the command makes the file pointer move outside of the
-- file, it stops at the file boundary and returns the actual amount of
-- bytes moved.
overriding procedure Close (File : in out FAT_File_Handle);
-- invalidates the handle, and ensures that
-- everything is flushed to the disk
-- Type definition for implementation details, make them visible to all
-- children of the package
type FAT_Directory_Entry is record
Filename : String (1 .. 8);
Extension : String (1 .. 3);
Attributes : FAT_Directory_Entry_Attribute;
Reserved : String (1 .. 8);
Cluster_H : Unsigned_16;
Time : Unsigned_16;
Date : Unsigned_16;
Cluster_L : Unsigned_16;
Size : FAT_File_Size;
end record with Size => 32 * 8;
for FAT_Directory_Entry use record
Filename at 16#00# range 0 .. 63;
Extension at 16#08# range 0 .. 23;
Attributes at 16#0B# range 0 .. 7;
Reserved at 16#0C# range 0 .. 63;
Cluster_H at 16#14# range 0 .. 15;
Time at 16#16# range 0 .. 15;
Date at 16#18# range 0 .. 15;
Cluster_L at 16#1A# range 0 .. 15;
Size at 16#1C# range 0 .. 31;
end record;
VFAT_Directory_Entry_Attribute : constant FAT_Directory_Entry_Attribute :=
(Subdirectory => False,
Archive => False,
others => True);
-- Attrite value 16#F0# defined at offset 16#0B# and identifying a VFAT
-- entry rather than a regular directory entry
type VFAT_Sequence_Number is mod 2 ** 6
with Size => 6;
type VFAT_Sequence is record
Sequence : VFAT_Sequence_Number;
Stop_Bit : Boolean;
end record with Size => 8;
for VFAT_Sequence use record
Sequence at 0 range 0 .. 5;
Stop_Bit at 0 range 6 .. 7;
end record;
type VFAT_Directory_Entry is record
VFAT_Attr : VFAT_Sequence;
Name_1 : Wide_String (1 .. 5);
Attribute : FAT_Directory_Entry_Attribute;
Reserved : Unsigned_8 := 0;
Checksum : Unsigned_8;
Name_2 : Wide_String (1 .. 6);
Cluster : Unsigned_16 := 0;
Name_3 : Wide_String (1 .. 2);
end record with Pack, Size => 32 * 8;
--------------------------------------------------
-- Inlined implementations of utility functions --
--------------------------------------------------
function Version
(FS : FAT_Filesystem) return FAT_Version
is (if FS.Disk_Parameters.Root_Dir_Entries_Fat16 /= 0
then FAT16 else FAT32);
function OEM_Name (FS : FAT_Filesystem) return String
is (FS.Disk_Parameters.OEM_Name);
function Block_Size
(FS : FAT_Filesystem) return FAT_File_Size
is (FAT_File_Size (FS.Disk_Parameters.Block_Size_In_Bytes));
function Blocks_Per_Cluster
(FS : FAT_Filesystem) return Block_Offset
is (Block_Offset (FS.Disk_Parameters.Blocks_Per_Cluster));
function Cluster_Size
(FS : FAT_Filesystem) return FAT_File_Size
is (FAT_File_Size (FS.Blocks_Per_Cluster) * FS.Block_Size);
function Reserved_Blocks
(FS : FAT_Filesystem) return Unsigned_16
is (FS.Disk_Parameters.Reserved_Blocks);
function Number_Of_FATs
(FS : FAT_Filesystem) return Unsigned_8
is (FS.Disk_Parameters.Number_Of_FATs);
function Total_Number_Of_Blocks
(FS : FAT_Filesystem) return Unsigned_32
is (FS.Disk_Parameters.Number_Of_Blocks_Fat32);
function FAT_Table_Size_In_Blocks
(FS : FAT_Filesystem) return Unsigned_32
is ((if FS.Version = FAT16
then Unsigned_32 (FS.Disk_Parameters.Table_Size_Fat16)
else FS.Disk_Parameters.Table_Size_Fat32));
function Number_Of_Hidden_Blocks
(FS : FAT_Filesystem) return Unsigned_32
is (FS.Disk_Parameters.Hidden_Blocks);
function Is_Volume
(FS : FAT_Filesystem) return Boolean
is (FS.Disk_Parameters.Boot_Signature_Fat32 = 16#29#);
function Volume_ID
(FS : FAT_Filesystem) return Unsigned_32
is (if not Is_Volume (FS)
then 0
else FS.Disk_Parameters.Volume_Id_Fat32);
function Volume_Label
(FS : FAT_Filesystem) return String
is (if FS.Version = FAT16 then "UNKNOWN"
elsif not Is_Volume (FS)
then "UNKNOWN"
else Trim (FS.Disk_Parameters.Volume_Label_Fat32));
function File_System_Type
(FS : FAT_Filesystem) return String
is (if FS.Version = FAT16 then "FAT16"
elsif not Is_Volume (FS) then "FAT32"
else Trim (FS.Disk_Parameters.FS_Type_Fat32));
function Flags_For_FAT_Mirroring
(FS : FAT_Filesystem) return Unsigned_16
is (FS.Disk_Parameters.Fat_Mirroring_Flags);
function FS_Version_Number
(FS : FAT_Filesystem) return Unsigned_16
is (FS.Disk_Parameters.FS_Version_Number);
function Root_Dir_Cluster
(FS : FAT_Filesystem) return Cluster_Type
is (FS.Disk_Parameters.Root_Directory_Cluster);
function FAT16_Root_Dir_Num_Entries
(FS : FAT_Filesystem) return Unsigned_16
is (FS.Disk_Parameters.Root_Dir_Entries_Fat16);
function FSInfo_Block_Number
(FS : FAT_Filesystem) return Unsigned_16
is (FS.Disk_Parameters.FSInfo_Block_Number);
function Boot_Block_Backup_Block_Number
(FS : FAT_Filesystem) return Unsigned_16
is (FS.Disk_Parameters.Boot_Block_Backup_Block);
function Last_Known_Free_Data_Clusters_Number
(FS : FAT_Filesystem) return Unsigned_32
is (FS.FSInfo.Free_Clusters);
function Most_Recently_Allocated_Cluster
(FS : FAT_Filesystem) return Cluster_Type
is (FS.FSInfo.Last_Allocated_Cluster);
function Get_Num_VFAT_Entries (Name : FAT_Name) return Natural
is ((Name.Len + 12) / 13);
-- Returns the number of VFAT Entries needed to encode 'Name'
-- There's 13 characters in each entry, and we need Name.Len + 2 characters
-- for the trailing ASCII.NUL + 0xFFFF sequence.
overriding function Get_FS
(Dir : FAT_Directory_Handle) return Any_Filesystem_Driver
is (Any_Filesystem_Driver (Dir.FS));
overriding function Get_FS
(File : in out FAT_File_Handle) return Any_Filesystem_Driver
is (Any_Filesystem_Driver (File.FS));
overriding function Get_FS (E : FAT_Node) return Any_Filesystem_Driver
is (Any_Filesystem_Driver (E.FS));
function Long_Name (E : FAT_Node) return FAT_Name
is (if E.L_Name.Len > 0 then E.L_Name else Short_Name (E));
function Short_Name (E : FAT_Node) return FAT_Name
is (-(Trim (E.S_Name) &
(if E.S_Name_Ext /= " "
then "." & E.S_Name_Ext
else "")));
overriding function Basename (E : FAT_Node) return String
is (-E.Long_Name);
overriding function Is_Read_Only (E : FAT_Node) return Boolean
is (E.Attributes.Read_Only);
overriding function Is_Hidden (E : FAT_Node) return Boolean
is (E.Attributes.Hidden);
function Is_System_File (E : FAT_Node) return Boolean
is (E.Attributes.System_File);
overriding function Is_Subdirectory (E : FAT_Node) return Boolean
is (E.Attributes.Subdirectory);
function Is_Archive (E : FAT_Node) return Boolean
is (E.Attributes.Archive);
function Get_Start_Cluster (E : FAT_Node) return Cluster_Type
is (E.Start_Cluster);
function Size (E : FAT_Node) return FAT_File_Size
is (E.Size);
overriding function Is_Symlink (E : FAT_Node) return Boolean
is (False);
end Filesystem.FAT;
|
stcarrez/ada-ado | Ada | 4,322 | ads | -----------------------------------------------------------------------
-- ado-schemas-databases -- Database creation and upgrade
-- Copyright (C) 2018, 2022 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Containers.Doubly_Linked_Lists;
with Util.Strings.Vectors;
with ADO.Sessions.Sources;
package ADO.Schemas.Databases is
subtype UString is Ada.Strings.Unbounded.Unbounded_String;
type Upgrade_Type is record
Version : Positive;
Name : UString;
Depend : UString;
Path : UString;
end record;
-- Compare two upgrade records and tell whether Left must be run before Right.
function "<" (Left, Right : in Upgrade_Type) return Boolean;
package Upgrade_Lists is
new Ada.Containers.Doubly_Linked_Lists (Upgrade_Type);
subtype Upgrade_List is Upgrade_Lists.List;
-- Create the database and initialize it with the schema SQL file.
-- The `Admin` parameter describes the database connection with administrator access.
-- The `Config` parameter describes the target database connection: this is the
-- database that must be created and configured. The `Schema_Path` is the path
-- of the SQL file that can be used to populate the database with the schema.
-- The `Messages` vector will contain the messages produced during the setup and
-- configuration of the database.
--
-- For the `sqlite` driver, the `Admin` parameter is not used.
procedure Create_Database (Admin : in ADO.Sessions.Sources.Data_Source'Class;
Config : in ADO.Sessions.Sources.Data_Source'Class;
Schema_Path : in String;
Messages : out Util.Strings.Vectors.Vector);
-- Scan the directory for migration script and check with the database to define
-- the database upgrade scripts that must be executed. The result list must then
-- be sorted by using `Sort_Migration` to honor the module dependencies.
procedure Scan_Migration (Session : in ADO.Sessions.Session'Class;
Path : in String;
Result : in out Upgrade_List);
-- Sort the list of upgrade directories depending on the module dependencies.
procedure Sort_Migration (List : in out Upgrade_List);
-- Prepare the database migration described by the `Upgrade` record.
-- Collect the SQL files according to the current database driver,
-- sort them and return the list of absolute pathes in `Files`.
procedure Prepare_Migration (Session : in ADO.Sessions.Session'Class;
Upgrade : in Upgrade_Type;
Files : in out Util.Strings.Vectors.Vector);
-- Run the database migration scripts described by the `Upgrade` record.
-- If the `Files` is not empty and matches the `Upgrade` path, the list of
-- files is used to perform the database migration. Otherwise, `Prepare_Migration`
-- is executed. For each SQL file, read and execute each SQL statement
-- by executing the `Execute` procedure. At the end, the version associated
-- with the module is updated to match the value defined in `Upgrade`.
procedure Run_Migration (Session : in ADO.Sessions.Master_Session'Class;
Upgrade : in Upgrade_Type;
Files : in out Util.Strings.Vectors.Vector;
Execute : not null
access procedure (Session : in ADO.Sessions.Session'Class;
SQL : in String));
end ADO.Schemas.Databases;
|
reznikmm/matreshka | Ada | 3,714 | 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.Text_Table_Name_Attributes is
pragma Preelaborate;
type ODF_Text_Table_Name_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Text_Table_Name_Attribute_Access is
access all ODF_Text_Table_Name_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Text_Table_Name_Attributes;
|
Rodeo-McCabe/orka | Ada | 1,384 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2013 Felix Krause <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Interfaces.C.Strings;
with Glfw.API;
package body Glfw.Windows.Clipboard is
function Get (Object : not null access Window'Class) return String is
use type Interfaces.C.Strings.chars_ptr;
Raw : constant Interfaces.C.Strings.chars_ptr
:= API.Get_Clipboard_String (Object.Handle);
begin
if Raw = Interfaces.C.Strings.Null_Ptr then
raise Operation_Exception with "Could not get clipboard string";
end if;
return Interfaces.C.Strings.Value (Raw);
end Get;
procedure Set (Object : not null access Window'Class; Value : String) is
begin
API.Set_Clipboard_String (Object.Handle, Interfaces.C.To_C (Value));
end Set;
end Glfw.Windows.Clipboard;
|
msrLi/portingSources | Ada | 930 | adb | -- Copyright 2008-2014 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package body Pck is
function Ident (P : Parameter) return Parameter is
begin
return P;
end Ident;
procedure Do_Nothing (P : in out Parameter) is
begin
null;
end Do_Nothing;
end Pck;
|
reznikmm/matreshka | Ada | 3,759 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Table_Maximum_Difference_Attributes is
pragma Preelaborate;
type ODF_Table_Maximum_Difference_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Table_Maximum_Difference_Attribute_Access is
access all ODF_Table_Maximum_Difference_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Table_Maximum_Difference_Attributes;
|
reznikmm/matreshka | Ada | 3,801 | 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 ODF.Constants;
package body Matreshka.ODF_Attributes.Style.Footnote_Max_Height is
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Style_Footnote_Max_Height_Node)
return League.Strings.Universal_String is
begin
return ODF.Constants.Footnote_Max_Height_Name;
end Get_Local_Name;
end Matreshka.ODF_Attributes.Style.Footnote_Max_Height;
|
stcarrez/ada-awa | Ada | 3,204 | adb | -----------------------------------------------------------------------
-- awa-mail-module-tests -- Unit tests for Mail module
-- Copyright (C) 2012, 2017, 2020 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Test_Caller;
with AWA.Events;
package body AWA.Mail.Modules.Tests is
package Caller is new Util.Test_Caller (Test, "Mail.Modules");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test AWA.Mail.Module.Create_Message",
Test_Create_Message'Access);
Caller.Add_Test (Suite, "Test AWA.Mail.Module.Create_Message (CC:)",
Test_Cc_Message'Access);
Caller.Add_Test (Suite, "Test AWA.Mail.Module.Create_Message (BCC:)",
Test_Bcc_Message'Access);
end Add_Tests;
-- ------------------------------
-- Create an email message with the given template and verify its content.
-- ------------------------------
procedure Test_Mail_Message (T : in out Test;
Name : in String) is
use Util.Beans.Objects;
Mail : constant AWA.Mail.Modules.Mail_Module_Access := AWA.Mail.Modules.Get_Mail_Module;
Event : AWA.Events.Module_Event;
Props : Util.Beans.Objects.Maps.Map;
begin
T.Assert (Mail /= null, "There is no current mail module");
Props.Insert ("name", To_Object (String '("joe")));
Props.Insert ("email", To_Object (String '("[email protected]")));
Mail.Send_Mail (Template => Name,
Props => Props,
Params => Props,
Content => Event);
end Test_Mail_Message;
-- ------------------------------
-- Create an email message and verify its content.
-- ------------------------------
procedure Test_Create_Message (T : in out Test) is
begin
T.Test_Mail_Message ("mail-info.html");
end Test_Create_Message;
-- ------------------------------
-- Create an email message with Cc: and verify its content.
-- ------------------------------
procedure Test_Cc_Message (T : in out Test) is
begin
T.Test_Mail_Message ("mail-cc.html");
end Test_Cc_Message;
-- ------------------------------
-- Create an email message with Bcc: and verify its content.
-- ------------------------------
procedure Test_Bcc_Message (T : in out Test) is
begin
T.Test_Mail_Message ("mail-bcc.html");
end Test_Bcc_Message;
end AWA.Mail.Modules.Tests;
|
Componolit/libsparkcrypto | Ada | 2,533 | ads | -------------------------------------------------------------------------------
-- This file is part of libsparkcrypto.
--
-- @author Alexander Senier
-- @date 2019-01-21
--
-- Copyright (C) 2018 Componolit GmbH
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- * Neither the name of the nor the names of its contributors may be used
-- to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
-- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
package LSC.RIPEMD160.HMAC_Generic
is
pragma Pure;
generic
type Key_Index_Type is (<>);
type Key_Elem_Type is (<>);
type Key_Type is array (Key_Index_Type range <>) of Key_Elem_Type;
type Message_Index_Type is (<>);
type Message_Elem_Type is (<>);
type Message_Type is array (Message_Index_Type range <>) of Message_Elem_Type;
type Hash_Index_Type is (<>);
type Hash_Elem_Type is (<>);
type Hash_Type is array (Hash_Index_Type) of Hash_Elem_Type;
function HMAC (Key : Key_Type;
Message : Message_Type) return Hash_Type;
end LSC.RIPEMD160.HMAC_Generic;
|
AdaCore/langkit | Ada | 299 | adb | with Langkit_Support.Adalog.Main_Support;
use Langkit_Support.Adalog.Main_Support;
-- Test domain primitive
procedure Main is
use T_Solver; use Refs;
X : constant Refs.Logic_Var := Create ("X");
R : constant Relation := Domain (X, (1, 2, 3, 4, 5, 6));
begin
Solve_All (R);
end Main;
|
reznikmm/matreshka | Ada | 7,000 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Text.Page_Variable_Get_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Text_Page_Variable_Get_Element_Node is
begin
return Self : Text_Page_Variable_Get_Element_Node do
Matreshka.ODF_Text.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Text_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Text_Page_Variable_Get_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Text_Page_Variable_Get
(ODF.DOM.Text_Page_Variable_Get_Elements.ODF_Text_Page_Variable_Get_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Text_Page_Variable_Get_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Page_Variable_Get_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Text_Page_Variable_Get_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Text_Page_Variable_Get
(ODF.DOM.Text_Page_Variable_Get_Elements.ODF_Text_Page_Variable_Get_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Text_Page_Variable_Get_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Text_Page_Variable_Get
(Visitor,
ODF.DOM.Text_Page_Variable_Get_Elements.ODF_Text_Page_Variable_Get_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.Page_Variable_Get_Element,
Text_Page_Variable_Get_Element_Node'Tag);
end Matreshka.ODF_Text.Page_Variable_Get_Elements;
|
reznikmm/matreshka | Ada | 52,769 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements;
with AMF.Internals.Element_Collections;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.OCL_Attributes;
with AMF.String_Collections;
with AMF.UML.Classifier_Template_Parameters;
with AMF.UML.Classifiers.Collections;
with AMF.UML.Collaboration_Uses.Collections;
with AMF.UML.Comments.Collections;
with AMF.UML.Constraints.Collections;
with AMF.UML.Dependencies.Collections;
with AMF.UML.Element_Imports.Collections;
with AMF.UML.Elements.Collections;
with AMF.UML.Features.Collections;
with AMF.UML.Generalization_Sets.Collections;
with AMF.UML.Generalizations.Collections;
with AMF.UML.Named_Elements.Collections;
with AMF.UML.Namespaces.Collections;
with AMF.UML.Operations;
with AMF.UML.Package_Imports.Collections;
with AMF.UML.Packageable_Elements.Collections;
with AMF.UML.Packages.Collections;
with AMF.UML.Parameterable_Elements.Collections;
with AMF.UML.Properties.Collections;
with AMF.UML.Redefinable_Elements.Collections;
with AMF.UML.Redefinable_Template_Signatures;
with AMF.UML.Signals;
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.OCL_Iterators;
with AMF.Visitors.OCL_Visitors;
with League.Strings.Internals;
with Matreshka.Internals.Strings;
package body AMF.Internals.OCL_Message_Types is
-------------------------
-- Get_Referred_Signal --
-------------------------
overriding function Get_Referred_Signal
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Signals.UML_Signal_Access is
begin
return
AMF.UML.Signals.UML_Signal_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Referred_Signal
(Self.Element)));
end Get_Referred_Signal;
-------------------------
-- Set_Referred_Signal --
-------------------------
overriding procedure Set_Referred_Signal
(Self : not null access OCL_Message_Type_Proxy;
To : AMF.UML.Signals.UML_Signal_Access) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Referred_Signal
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Referred_Signal;
----------------------------
-- Get_Referred_Operation --
----------------------------
overriding function Get_Referred_Operation
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Operations.UML_Operation_Access is
begin
return
AMF.UML.Operations.UML_Operation_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Referred_Operation
(Self.Element)));
end Get_Referred_Operation;
----------------------------
-- Set_Referred_Operation --
----------------------------
overriding procedure Set_Referred_Operation
(Self : not null access OCL_Message_Type_Proxy;
To : AMF.UML.Operations.UML_Operation_Access) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Referred_Operation
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Referred_Operation;
-------------------
-- Get_Attribute --
-------------------
overriding function Get_Attribute
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Properties.Collections.Set_Of_UML_Property is
begin
return
AMF.UML.Properties.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Attribute
(Self.Element)));
end Get_Attribute;
---------------------------
-- Get_Collaboration_Use --
---------------------------
overriding function Get_Collaboration_Use
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Collaboration_Uses.Collections.Set_Of_UML_Collaboration_Use is
begin
return
AMF.UML.Collaboration_Uses.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Collaboration_Use
(Self.Element)));
end Get_Collaboration_Use;
-----------------
-- Get_Feature --
-----------------
overriding function Get_Feature
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Features.Collections.Set_Of_UML_Feature is
begin
return
AMF.UML.Features.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Feature
(Self.Element)));
end Get_Feature;
-----------------
-- Get_General --
-----------------
overriding function Get_General
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_General
(Self.Element)));
end Get_General;
------------------------
-- Get_Generalization --
------------------------
overriding function Get_Generalization
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization is
begin
return
AMF.UML.Generalizations.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Generalization
(Self.Element)));
end Get_Generalization;
--------------------------
-- Get_Inherited_Member --
--------------------------
overriding function Get_Inherited_Member
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
return
AMF.UML.Named_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Inherited_Member
(Self.Element)));
end Get_Inherited_Member;
---------------------
-- Get_Is_Abstract --
---------------------
overriding function Get_Is_Abstract
(Self : not null access constant OCL_Message_Type_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.OCL_Attributes.Internal_Get_Is_Abstract
(Self.Element);
end Get_Is_Abstract;
---------------------
-- Set_Is_Abstract --
---------------------
overriding procedure Set_Is_Abstract
(Self : not null access OCL_Message_Type_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Is_Abstract
(Self.Element, To);
end Set_Is_Abstract;
---------------------------------
-- Get_Is_Final_Specialization --
---------------------------------
overriding function Get_Is_Final_Specialization
(Self : not null access constant OCL_Message_Type_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.OCL_Attributes.Internal_Get_Is_Final_Specialization
(Self.Element);
end Get_Is_Final_Specialization;
---------------------------------
-- Set_Is_Final_Specialization --
---------------------------------
overriding procedure Set_Is_Final_Specialization
(Self : not null access OCL_Message_Type_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Is_Final_Specialization
(Self.Element, To);
end Set_Is_Final_Specialization;
----------------------------------
-- Get_Owned_Template_Signature --
----------------------------------
overriding function Get_Owned_Template_Signature
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access is
begin
return
AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Template_Signature
(Self.Element)));
end Get_Owned_Template_Signature;
----------------------------------
-- Set_Owned_Template_Signature --
----------------------------------
overriding procedure Set_Owned_Template_Signature
(Self : not null access OCL_Message_Type_Proxy;
To : AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Owned_Template_Signature
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owned_Template_Signature;
------------------------
-- Get_Owned_Use_Case --
------------------------
overriding function Get_Owned_Use_Case
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is
begin
return
AMF.UML.Use_Cases.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Use_Case
(Self.Element)));
end Get_Owned_Use_Case;
--------------------------
-- Get_Powertype_Extent --
--------------------------
overriding function Get_Powertype_Extent
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Generalization_Sets.Collections.Set_Of_UML_Generalization_Set is
begin
return
AMF.UML.Generalization_Sets.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Powertype_Extent
(Self.Element)));
end Get_Powertype_Extent;
------------------------------
-- Get_Redefined_Classifier --
------------------------------
overriding function Get_Redefined_Classifier
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Redefined_Classifier
(Self.Element)));
end Get_Redefined_Classifier;
------------------------
-- Get_Representation --
------------------------
overriding function Get_Representation
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access is
begin
return
AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Representation
(Self.Element)));
end Get_Representation;
------------------------
-- Set_Representation --
------------------------
overriding procedure Set_Representation
(Self : not null access OCL_Message_Type_Proxy;
To : AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Representation
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Representation;
----------------------
-- Get_Substitution --
----------------------
overriding function Get_Substitution
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Substitutions.Collections.Set_Of_UML_Substitution is
begin
return
AMF.UML.Substitutions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Substitution
(Self.Element)));
end Get_Substitution;
----------------------------
-- Get_Template_Parameter --
----------------------------
overriding function Get_Template_Parameter
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access is
begin
return
AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Template_Parameter
(Self.Element)));
end Get_Template_Parameter;
----------------------------
-- Set_Template_Parameter --
----------------------------
overriding procedure Set_Template_Parameter
(Self : not null access OCL_Message_Type_Proxy;
To : AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Template_Parameter;
------------------
-- Get_Use_Case --
------------------
overriding function Get_Use_Case
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is
begin
return
AMF.UML.Use_Cases.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Use_Case
(Self.Element)));
end Get_Use_Case;
------------------------
-- Get_Element_Import --
------------------------
overriding function Get_Element_Import
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import is
begin
return
AMF.UML.Element_Imports.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Element_Import
(Self.Element)));
end Get_Element_Import;
-------------------------
-- Get_Imported_Member --
-------------------------
overriding function Get_Imported_Member
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
begin
return
AMF.UML.Packageable_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Imported_Member
(Self.Element)));
end Get_Imported_Member;
----------------
-- Get_Member --
----------------
overriding function Get_Member
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
return
AMF.UML.Named_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Member
(Self.Element)));
end Get_Member;
----------------------
-- Get_Owned_Member --
----------------------
overriding function Get_Owned_Member
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
return
AMF.UML.Named_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Member
(Self.Element)));
end Get_Owned_Member;
--------------------
-- Get_Owned_Rule --
--------------------
overriding function Get_Owned_Rule
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Rule
(Self.Element)));
end Get_Owned_Rule;
------------------------
-- Get_Package_Import --
------------------------
overriding function Get_Package_Import
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import is
begin
return
AMF.UML.Package_Imports.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Package_Import
(Self.Element)));
end Get_Package_Import;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
begin
return
AMF.UML.Dependencies.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Client_Dependency
(Self.Element)));
end Get_Client_Dependency;
--------------
-- Get_Name --
--------------
overriding function Get_Name
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.OCL_Attributes.Internal_Get_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Name;
--------------
-- Set_Name --
--------------
overriding procedure Set_Name
(Self : not null access OCL_Message_Type_Proxy;
To : AMF.Optional_String) is
begin
if To.Is_Empty then
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name
(Self.Element, null);
else
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name
(Self.Element,
League.Strings.Internals.Internal (To.Value));
end if;
end Set_Name;
-------------------------
-- Get_Name_Expression --
-------------------------
overriding function Get_Name_Expression
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access is
begin
return
AMF.UML.String_Expressions.UML_String_Expression_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Name_Expression
(Self.Element)));
end Get_Name_Expression;
-------------------------
-- Set_Name_Expression --
-------------------------
overriding procedure Set_Name_Expression
(Self : not null access OCL_Message_Type_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name_Expression
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Name_Expression;
-------------------
-- Get_Namespace --
-------------------
overriding function Get_Namespace
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
return
AMF.UML.Namespaces.UML_Namespace_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Namespace
(Self.Element)));
end Get_Namespace;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.OCL_Attributes.Internal_Get_Qualified_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Qualified_Name;
--------------------
-- Get_Visibility --
--------------------
overriding function Get_Visibility
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Optional_UML_Visibility_Kind is
begin
return
AMF.Internals.Tables.OCL_Attributes.Internal_Get_Visibility
(Self.Element);
end Get_Visibility;
--------------------
-- Set_Visibility --
--------------------
overriding procedure Set_Visibility
(Self : not null access OCL_Message_Type_Proxy;
To : AMF.UML.Optional_UML_Visibility_Kind) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Visibility
(Self.Element, To);
end Set_Visibility;
-----------------------
-- Get_Owned_Comment --
-----------------------
overriding function Get_Owned_Comment
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Comments.Collections.Set_Of_UML_Comment is
begin
return
AMF.UML.Comments.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Comment
(Self.Element)));
end Get_Owned_Comment;
-----------------------
-- Get_Owned_Element --
-----------------------
overriding function Get_Owned_Element
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
return
AMF.UML.Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Element
(Self.Element)));
end Get_Owned_Element;
---------------
-- Get_Owner --
---------------
overriding function Get_Owner
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Elements.UML_Element_Access is
begin
return
AMF.UML.Elements.UML_Element_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owner
(Self.Element)));
end Get_Owner;
-----------------
-- Get_Package --
-----------------
overriding function Get_Package
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Packages.UML_Package_Access is
begin
return
AMF.UML.Packages.UML_Package_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Package
(Self.Element)));
end Get_Package;
-----------------
-- Set_Package --
-----------------
overriding procedure Set_Package
(Self : not null access OCL_Message_Type_Proxy;
To : AMF.UML.Packages.UML_Package_Access) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Package
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Package;
--------------------
-- Get_Visibility --
--------------------
overriding function Get_Visibility
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.UML_Visibility_Kind is
begin
return
AMF.Internals.Tables.OCL_Attributes.Internal_Get_Visibility
(Self.Element).Value;
end Get_Visibility;
--------------------
-- Set_Visibility --
--------------------
overriding procedure Set_Visibility
(Self : not null access OCL_Message_Type_Proxy;
To : AMF.UML.UML_Visibility_Kind) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Visibility
(Self.Element, (False, To));
end Set_Visibility;
-----------------------------------
-- Get_Owning_Template_Parameter --
-----------------------------------
overriding function Get_Owning_Template_Parameter
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owning_Template_Parameter
(Self.Element)));
end Get_Owning_Template_Parameter;
-----------------------------------
-- Set_Owning_Template_Parameter --
-----------------------------------
overriding procedure Set_Owning_Template_Parameter
(Self : not null access OCL_Message_Type_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Owning_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owning_Template_Parameter;
----------------------------
-- Get_Template_Parameter --
----------------------------
overriding function Get_Template_Parameter
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Template_Parameter
(Self.Element)));
end Get_Template_Parameter;
----------------------------
-- Set_Template_Parameter --
----------------------------
overriding procedure Set_Template_Parameter
(Self : not null access OCL_Message_Type_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Template_Parameter;
----------------------------------
-- Get_Owned_Template_Signature --
----------------------------------
overriding function Get_Owned_Template_Signature
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Template_Signatures.UML_Template_Signature_Access is
begin
return
AMF.UML.Template_Signatures.UML_Template_Signature_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Template_Signature
(Self.Element)));
end Get_Owned_Template_Signature;
----------------------------------
-- Set_Owned_Template_Signature --
----------------------------------
overriding procedure Set_Owned_Template_Signature
(Self : not null access OCL_Message_Type_Proxy;
To : AMF.UML.Template_Signatures.UML_Template_Signature_Access) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Owned_Template_Signature
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owned_Template_Signature;
--------------------------
-- Get_Template_Binding --
--------------------------
overriding function Get_Template_Binding
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding is
begin
return
AMF.UML.Template_Bindings.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Template_Binding
(Self.Element)));
end Get_Template_Binding;
-----------------
-- Get_Is_Leaf --
-----------------
overriding function Get_Is_Leaf
(Self : not null access constant OCL_Message_Type_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.OCL_Attributes.Internal_Get_Is_Leaf
(Self.Element);
end Get_Is_Leaf;
-----------------
-- Set_Is_Leaf --
-----------------
overriding procedure Set_Is_Leaf
(Self : not null access OCL_Message_Type_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Is_Leaf
(Self.Element, To);
end Set_Is_Leaf;
---------------------------
-- Get_Redefined_Element --
---------------------------
overriding function Get_Redefined_Element
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is
begin
return
AMF.UML.Redefinable_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Redefined_Element
(Self.Element)));
end Get_Redefined_Element;
------------------------------
-- Get_Redefinition_Context --
------------------------------
overriding function Get_Redefinition_Context
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Redefinition_Context
(Self.Element)));
end Get_Redefinition_Context;
------------------
-- All_Features --
------------------
overriding function All_Features
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Features.Collections.Set_Of_UML_Feature is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Features unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.All_Features";
return All_Features (Self);
end All_Features;
-----------------
-- All_Parents --
-----------------
overriding function All_Parents
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Parents unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.All_Parents";
return All_Parents (Self);
end All_Parents;
-----------------
-- Conforms_To --
-----------------
overriding function Conforms_To
(Self : not null access constant OCL_Message_Type_Proxy;
Other : AMF.UML.Classifiers.UML_Classifier_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Conforms_To";
return Conforms_To (Self, Other);
end Conforms_To;
-------------
-- General --
-------------
overriding function General
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "General unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.General";
return General (Self);
end General;
-----------------------
-- Has_Visibility_Of --
-----------------------
overriding function Has_Visibility_Of
(Self : not null access constant OCL_Message_Type_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Has_Visibility_Of unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Has_Visibility_Of";
return Has_Visibility_Of (Self, N);
end Has_Visibility_Of;
-------------
-- Inherit --
-------------
overriding function Inherit
(Self : not null access constant OCL_Message_Type_Proxy;
Inhs : AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Inherit unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Inherit";
return Inherit (Self, Inhs);
end Inherit;
-------------------------
-- Inheritable_Members --
-------------------------
overriding function Inheritable_Members
(Self : not null access constant OCL_Message_Type_Proxy;
C : AMF.UML.Classifiers.UML_Classifier_Access)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Inheritable_Members unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Inheritable_Members";
return Inheritable_Members (Self, C);
end Inheritable_Members;
----------------------
-- Inherited_Member --
----------------------
overriding function Inherited_Member
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Inherited_Member unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Inherited_Member";
return Inherited_Member (Self);
end Inherited_Member;
-----------------
-- Is_Template --
-----------------
overriding function Is_Template
(Self : not null access constant OCL_Message_Type_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Template unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Is_Template";
return Is_Template (Self);
end Is_Template;
-------------------------
-- May_Specialize_Type --
-------------------------
overriding function May_Specialize_Type
(Self : not null access constant OCL_Message_Type_Proxy;
C : AMF.UML.Classifiers.UML_Classifier_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "May_Specialize_Type unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.May_Specialize_Type";
return May_Specialize_Type (Self, C);
end May_Specialize_Type;
-------------
-- Parents --
-------------
overriding function Parents
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Parents unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Parents";
return Parents (Self);
end Parents;
------------------------
-- Exclude_Collisions --
------------------------
overriding function Exclude_Collisions
(Self : not null access constant OCL_Message_Type_Proxy;
Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Exclude_Collisions unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Exclude_Collisions";
return Exclude_Collisions (Self, Imps);
end Exclude_Collisions;
-------------------------
-- Get_Names_Of_Member --
-------------------------
overriding function Get_Names_Of_Member
(Self : not null access constant OCL_Message_Type_Proxy;
Element : AMF.UML.Named_Elements.UML_Named_Element_Access)
return AMF.String_Collections.Set_Of_String is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Get_Names_Of_Member unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Get_Names_Of_Member";
return Get_Names_Of_Member (Self, Element);
end Get_Names_Of_Member;
--------------------
-- Import_Members --
--------------------
overriding function Import_Members
(Self : not null access constant OCL_Message_Type_Proxy;
Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Import_Members unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Import_Members";
return Import_Members (Self, Imps);
end Import_Members;
---------------------
-- Imported_Member --
---------------------
overriding function Imported_Member
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Imported_Member unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Imported_Member";
return Imported_Member (Self);
end Imported_Member;
---------------------------------
-- Members_Are_Distinguishable --
---------------------------------
overriding function Members_Are_Distinguishable
(Self : not null access constant OCL_Message_Type_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Members_Are_Distinguishable unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Members_Are_Distinguishable";
return Members_Are_Distinguishable (Self);
end Members_Are_Distinguishable;
------------------
-- Owned_Member --
------------------
overriding function Owned_Member
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Owned_Member unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Owned_Member";
return Owned_Member (Self);
end Owned_Member;
--------------------
-- All_Namespaces --
--------------------
overriding function All_Namespaces
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Namespaces.Collections.Ordered_Set_Of_UML_Namespace is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Namespaces unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.All_Namespaces";
return All_Namespaces (Self);
end All_Namespaces;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.All_Owning_Packages";
return All_Owning_Packages (Self);
end All_Owning_Packages;
-----------------------------
-- Is_Distinguishable_From --
-----------------------------
overriding function Is_Distinguishable_From
(Self : not null access constant OCL_Message_Type_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Is_Distinguishable_From";
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
---------------
-- Namespace --
---------------
overriding function Namespace
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Namespace";
return Namespace (Self);
end Namespace;
--------------------
-- Qualified_Name --
--------------------
overriding function Qualified_Name
(Self : not null access constant OCL_Message_Type_Proxy)
return League.Strings.Universal_String is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Qualified_Name unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Qualified_Name";
return Qualified_Name (Self);
end Qualified_Name;
---------------
-- Separator --
---------------
overriding function Separator
(Self : not null access constant OCL_Message_Type_Proxy)
return League.Strings.Universal_String is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Separator unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Separator";
return Separator (Self);
end Separator;
------------------------
-- All_Owned_Elements --
------------------------
overriding function All_Owned_Elements
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owned_Elements unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.All_Owned_Elements";
return All_Owned_Elements (Self);
end All_Owned_Elements;
-------------------
-- Must_Be_Owned --
-------------------
overriding function Must_Be_Owned
(Self : not null access constant OCL_Message_Type_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Must_Be_Owned unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Must_Be_Owned";
return Must_Be_Owned (Self);
end Must_Be_Owned;
-----------------
-- Conforms_To --
-----------------
overriding function Conforms_To
(Self : not null access constant OCL_Message_Type_Proxy;
Other : AMF.UML.Types.UML_Type_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Conforms_To";
return Conforms_To (Self, Other);
end Conforms_To;
------------------------
-- Is_Compatible_With --
------------------------
overriding function Is_Compatible_With
(Self : not null access constant OCL_Message_Type_Proxy;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Is_Compatible_With";
return Is_Compatible_With (Self, P);
end Is_Compatible_With;
---------------------------
-- Is_Template_Parameter --
---------------------------
overriding function Is_Template_Parameter
(Self : not null access constant OCL_Message_Type_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Is_Template_Parameter";
return Is_Template_Parameter (Self);
end Is_Template_Parameter;
----------------------------
-- Parameterable_Elements --
----------------------------
overriding function Parameterable_Elements
(Self : not null access constant OCL_Message_Type_Proxy)
return AMF.UML.Parameterable_Elements.Collections.Set_Of_UML_Parameterable_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Parameterable_Elements unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Parameterable_Elements";
return Parameterable_Elements (Self);
end Parameterable_Elements;
------------------------
-- Is_Consistent_With --
------------------------
overriding function Is_Consistent_With
(Self : not null access constant OCL_Message_Type_Proxy;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Is_Consistent_With";
return Is_Consistent_With (Self, Redefinee);
end Is_Consistent_With;
-----------------------------------
-- Is_Redefinition_Context_Valid --
-----------------------------------
overriding function Is_Redefinition_Context_Valid
(Self : not null access constant OCL_Message_Type_Proxy;
Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Message_Type_Proxy.Is_Redefinition_Context_Valid";
return Is_Redefinition_Context_Valid (Self, Redefined);
end Is_Redefinition_Context_Valid;
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant OCL_Message_Type_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.OCL_Visitors.OCL_Visitor'Class then
AMF.Visitors.OCL_Visitors.OCL_Visitor'Class
(Visitor).Enter_Message_Type
(AMF.OCL.Message_Types.OCL_Message_Type_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant OCL_Message_Type_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.OCL_Visitors.OCL_Visitor'Class then
AMF.Visitors.OCL_Visitors.OCL_Visitor'Class
(Visitor).Leave_Message_Type
(AMF.OCL.Message_Types.OCL_Message_Type_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant OCL_Message_Type_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.OCL_Iterators.OCL_Iterator'Class then
AMF.Visitors.OCL_Iterators.OCL_Iterator'Class
(Iterator).Visit_Message_Type
(Visitor,
AMF.OCL.Message_Types.OCL_Message_Type_Access (Self),
Control);
end if;
end Visit_Element;
end AMF.Internals.OCL_Message_Types;
|
zertovitch/excel-writer | Ada | 22,866 | adb | -- Dump the contents of a file in BIFF (Excel .xls) format.
-- The output is also an Excel file.
with Excel_Out; use Excel_Out;
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Directories;
with Ada.Sequential_IO;
with Ada.Strings.Fixed; use Ada.Strings, Ada.Strings.Fixed;
with Ada.Strings.Unbounded;
with Ada.Text_IO;
with Interfaces; use Interfaces;
procedure BIFF_Dump is
package BIO is new Ada.Sequential_IO (Unsigned_8);
use BIO;
f : BIO.File_Type;
code, record_length, x : Integer;
function in8 return Integer is
b : Unsigned_8;
begin
Read (f, b);
return Integer (b);
end in8;
function in16 return Integer is
b1, b2 : Unsigned_8;
begin
Read (f, b1);
Read (f, b2);
return Integer (b1) + Integer (b2) * 256;
end in16;
function str8 return String is
b : Unsigned_8;
begin
Read (f, b);
declare
r : String (1 .. Integer (b));
begin
for i in r'Range loop
Read (f, b);
r (i) := Character'Val (b);
end loop;
return r;
end;
end str8;
function str8len16 return String is
r : String (1 .. in16);
b : Unsigned_8;
begin
for i in r'Range loop
Read (f, b);
r (i) := Character'Val (b);
end loop;
return r;
end str8len16;
bof_2 : constant := 16#0009#; -- 5.8 p.135
bof_3 : constant := 16#0209#; -- 5.8 p.135
bof_4 : constant := 16#0409#; -- 5.8 p.135
bof_5_8 : constant := 16#0809#; -- 5.8 p.135
row_2 : constant := 16#0008#; -- 5.88 p.202
row_3 : constant := 16#0208#; -- 5.88 p.202
style : constant := 16#0293#;
xf_2 : constant := 16#0043#;
xf_3 : constant := 16#0243#;
xf_4 : constant := 16#0443#;
xf_5 : constant := 16#00E0#;
ole_2 : constant := 16#CFD0#;
pane : constant := 16#0041#;
selection : constant := 16#001D#;
window1 : constant := 16#003D#;
window2_b2 : constant := 16#003E#;
window2_b3 : constant := 16#023E#;
hideobj : constant := 16#008D#;
font_b2 : constant := 16#0031#;
font_b3 : constant := 16#0231#;
fontcolor : constant := 16#0045#;
format2 : constant := 16#001E#;
format4 : constant := 16#041E#;
blank2 : constant := 16#0001#;
index3 : constant := 16#020B#; -- 5.59
integer2 : constant := 16#0002#; -- 5.60
number2 : constant := 16#0003#; -- 5.71
number3 : constant := 16#0203#; -- 5.71
rk : constant := 16#027E#; -- 5.87 RK p.201
note : constant := 16#001C#; -- 5.70 NOTE p. 190
label2 : constant := 16#0004#;
label3 : constant := 16#0204#;
labelsst : constant := 16#00FD#;
formula2 : constant := 16#0006#; -- Formula BIFF 2, 5.50 p.176
formula4 : constant := 16#0406#; -- Formula BIFF 4
def_row_hgt_b2 : constant := 16#0025#; -- DEFAULTROWHEIGHT
colwidth : constant := 16#0024#;
defcolwidth : constant := 16#0055#;
colinfo : constant := 16#007D#;
header_x : constant := 16#0014#; -- 5.55 p.180
footer_x : constant := 16#0015#; -- 5.48 p.173
page_setup_x : constant := 16#00A1#; -- 5.73 p.192
dimension_b2 : constant := 16#0000#;
dimension_b3 : constant := 16#0200#;
writeaccess : constant := 16#005C#; -- 5.112 WRITEACCESS
saverecalc : constant := 16#005F#; -- 5.90 SAVERECALC
guts : constant := 16#0080#; -- 5.53 GUTS
sheetpr : constant := 16#0081#; -- 5.97 SHEETPR
gridset : constant := 16#0082#; -- 5.52 GRIDSET
hcenter : constant := 16#0083#; -- 5.54 HCENTER
vcenter : constant := 16#0084#; -- 5.107 VCENTER
country : constant := 16#008C#; -- 5.22 COUNTRY
subtype margin is Integer range 16#26# .. 16#29#;
b : Unsigned_8;
w : Unsigned_16;
xfs : Natural := 0;
fmt : Natural := 0;
fnt : Natural := 0;
biff_version : Natural := 0;
defaults : Boolean;
xl : Excel_Out_File;
fmt_ul : Format_type;
procedure Cell_Attributes is
begin
Put (xl, "xf=" & Integer'Image (in8 mod 16#40#));
Read (f, b);
Put (xl, "num format=" & Unsigned_8'Image (b mod 16#40#));
Put (xl, "font=" & Unsigned_8'Image (b / 16#40#));
Read (f, b);
end Cell_Attributes;
package FIO is new Ada.Text_IO.Float_IO (Float);
function Img (r : Float; digits_displayed : Natural := 0) return String is
s : String (1 .. 120);
begin
if digits_displayed > 0 then
FIO.Put (s, r, digits_displayed, 0);
return Trim (s, Both);
else
return Trim (Integer_64'Image (Integer_64 (r)), Both);
end if;
end Img;
package IIO is new Ada.Text_IO.Integer_IO (Integer);
function Hexa (i : Integer) return String is
s : String (1 .. 120);
begin
IIO.Put (s, i, 16);
return Trim (s, Both);
end Hexa;
procedure Ignore_from (from : Positive) is
begin
for i in from .. record_length loop
Read (f, b);
end loop;
end Ignore_from;
use Ada.Strings.Unbounded;
excel_file_name : Unbounded_String;
begin
if Argument_Count = 0 then
excel_file_name := To_Unbounded_String ("Big [BIFF3].xls");
else
excel_file_name := To_Unbounded_String (Argument (1));
end if;
Create (xl, "_Dump of " & Ada.Directories.Simple_Name (To_String (excel_file_name)) & "");
-- Some page layout...
Header (xl, "&LBiff_dump of...&R" & Ada.Directories.Simple_Name (To_String (excel_file_name)));
Footer (xl, "&L&D");
Margins (xl, 0.7, 0.5, 1.0, 0.8);
Print_Gridlines (xl);
Page_Setup (
xl,
orientation => landscape,
scale_or_fit => fit,
fit_height_with_n_pages => 0
);
--
Write_default_column_width (xl, 18);
Write_column_width (xl, 1, 11);
Write_column_width (xl, 3, 3);
Write_column_width (xl, 4, 20);
--
Define_Format (xl, Default_font (xl), general, fmt_ul, border => bottom);
--
Put_Line (xl, "Dump of the BIFF (Excel .xls) file: " & To_String (excel_file_name));
New_Line (xl);
--
Use_format (xl, fmt_ul);
Put (xl, "BIFF Code");
Put (xl, "Bytes");
Put (xl, " ");
Put (xl, "BIFF Topic");
Put_Line (xl, "Comments");
Freeze_Panes_at_cursor (xl);
--
Use_format (xl, Default_format (xl));
Open (f, In_File, To_String (excel_file_name));
while not End_Of_File (f) loop
code := in16;
record_length := in16;
Put (xl, code, base => 16);
Put (xl, record_length);
Put (xl, " ");
case code is
--
when bof_2 =>
Put (xl, "BOF");
Put (xl, "Beginning of File (Excel 2.1, BIFF2)");
biff_version := 2; -- some items, like font, are reused in biff 5 but not 3,4
when bof_3 =>
Put (xl, "BOF");
Put (xl, "Beginning of File (Excel 3.0, BIFF3)");
biff_version := 3;
when bof_4 =>
Put (xl, "BOF");
Put (xl, "Beginning of File (Excel 4.0, BIFF4)");
biff_version := 4;
when bof_5_8 =>
Put (xl, "BOF");
Put (xl, "Beginning of File (Excel 5-95 / 97-2003, BIFF5 / 8)");
biff_version := 5;
when 16#000A# => Put (xl, "EOF"); Put (xl, "End of File");
--
when dimension_b2 => Put (xl, "DIMENSION (BIFF2)"); -- 5.35 DIMENSION
when dimension_b3 => Put (xl, "DIMENSION (BIFF3+)"); -- 5.35 DIMENSION
when 16#000C# => Put (xl, "CALCCOUNT");
when 16#000D# => Put (xl, "CALCMODE");
when 16#000E# => Put (xl, "PRECISION");
when 16#000F# => Put (xl, "REFMODE");
when 16#0010# => Put (xl, "DELTA");
when 16#0011# => Put (xl, "ITERATION");
when 16#002A# => Put (xl, "PRINTHEADERS");
when 16#002B# => Put (xl, "PRINTGRIDLINES");
when page_setup_x => Put (xl, "PAGESETUP");
when header_x => Put (xl, "HEADER");
when footer_x => Put (xl, "FOOTER");
when margin => Put (xl, "MARGIN");
when 16#0022# => Put (xl, "DATEMODE");
when 16#0042# => Put (xl, "CODEPAGE");
when colwidth => Put (xl, "COLWIDTH (BIFF2)");
when defcolwidth => Put (xl, "DEFCOLWIDTH");
when colinfo => Put (xl, "COLINFO (BIFF3+)"); -- 5.18
when def_row_hgt_b2 => Put (xl, "DEFAULTROWHEIGHT (BIFF2)");
when 16#0225# => Put (xl, "DEFAULTROWHEIGHT (BIFF3+)");
when row_2 | row_3 =>
Put (xl, "ROW");
when format2 =>
Put (xl, "FORMAT (BIFF2-3)" & Integer'Image (fmt));
fmt := fmt + 1;
when format4 =>
Put (xl, "FORMAT (BIFF4+)" & Integer'Image (fmt)); -- 5.49
fmt := fmt + 1;
when xf_2 | -- Extended Format, BIFF2 -- 5.115
xf_3 | -- Extended Format, BIFF3
xf_4 | -- Extended Format, BIFF4
xf_5 => -- Extended Format, BIFF5+
Put (xl, "XF" & Integer'Image (xfs));
xfs := xfs + 1;
when 16#001F# | 16#0056# =>
Put (xl, "BUILTINFMTCOUNT");
when font_b2 | font_b3 =>
if fnt = 4 then
fnt := 5; -- Excel anomaly (p.171)
end if;
Put (xl, "FONT" & Integer'Image (fnt));
-- 5.45, p.171
fnt := fnt + 1;
when fontcolor => Put (xl, "FONTCOLOR");
when blank2 => Put (xl, "BLANK (BIFF2)"); -- 5.7 p.137
when 16#0201# => Put (xl, "BLANK (BIFF3+)");
when index3 => Put (xl, "INDEX (BIFF3+)");
when integer2 => Put (xl, "INTEGER (BIFF2)");
when number2 => Put (xl, "NUMBER (BIFF2)");
when number3 => Put (xl, "NUMBER (BIFF3+)");
when formula2 => Put (xl, "FORMULA (BIFF2)"); -- 5.50 p.176
when formula4 => Put (xl, "FORMULA (BIFF4)");
when rk => Put (xl, "RK (BIFF3+)");
when note => Put (xl, "NOTE (Comment)"); -- 5.70 NOTE p. 190
when label2 => Put (xl, "LABEL (BIFF2)");
when label3 => Put (xl, "LABEL (BIFF3+)");
when labelsst => Put (xl, "LABELSST (BIFF8)"); -- SST = shared string table
when 16#0019# => Put (xl, "WINDOWPROTECT");
when 16#0040# => Put (xl, "BACKUP");
when style => Put (xl, "STYLE"); -- 5.103
when pane => Put (xl, "PANE"); -- 5.75 p.197
when selection => Put (xl, "SELECTION"); -- 5.93 p.205
when window1 => Put (xl, "WINDOW1"); -- 5.109
when window2_b2 => Put (xl, "WINDOW2 (BIFF2)"); -- 5.110 p.216
when window2_b3 => Put (xl, "WINDOW2 (BIFF3+)"); -- 5.110 p.216
when hideobj => Put (xl, "HIDEOBJ"); -- 5.56
when 16#4D# => Put (xl, "PLS (Current printer blob)");
when 16#3C# => Put (xl, "CONTINUE (Continue last BIFF record)");
when writeaccess => Put (xl, "WRITEACCESS"); -- 5.112 WRITEACCESS
when saverecalc => Put (xl, "SAVERECALC"); -- 5.90 SAVERECALC
when gridset => Put (xl, "GRIDSET"); -- 5.52 GRIDSET
when guts => Put (xl, "GUTS"); -- 5.53 GUTS
when hcenter => Put (xl, "HCENTER"); -- 5.107 HCENTER
when vcenter => Put (xl, "VCENTER");
when sheetpr => Put (xl, "SHEETPR"); -- 5.97 SHEETPR
when country => Put (xl, "COUNTRY"); -- 5.22 COUNTRY
when others => Put (xl, "- ??? -");
end case;
--
-- Expand parameters
--
case code is
when bof_2 | bof_3 | bof_4 | bof_5_8 =>
Next (xl);
Put (xl, "BIFF=" & Integer'Image (in16));
Put (xl, "Type=" & Integer'Image (in16));
for i in 5 .. record_length loop
Read (f, b);
end loop;
when row_2 | row_3 => -- 5.88 p.202
Put (xl, "row=" & Integer'Image (in16 + 1));
Put (xl, "col1=" & Integer'Image (in16 + 1));
Put (xl, "col2+1=" & Integer'Image (in16 + 1));
w := Unsigned_16 (in16);
if (w and 16#8000#) /= 0 then
Put (xl, "default height, code=" & Hexa (Integer (w)));
else
Put (xl, "height=" & Img (Float (w and 16#7FFF#) / 20.0, 2));
end if;
Next (xl);
Put (xl, "reserved1=" & Integer'Image (in16)); -- reserved1 (2 bytes): MUST be zero, and MUST be ignored.
if biff_version = 2 then
Read (f, b);
defaults := b = 0;
if defaults then
Put (xl, "0: no default row format");
else
Put (xl, "default row format");
end if;
Put (xl, "offset to contents = " & Integer'Image (in16));
for i in 14 .. record_length loop
Put (xl, in8);
end loop;
else
Put (xl, "unused1=" & Integer'Image (in16)); -- unused1 (2 bytes): Undefined and MUST be ignored.
Put (xl, "flags=" & Integer'Image (in8));
-- A - iOutLevel (3 bits): An unsigned integer that specifies the outline level (1) of the row.
-- B - reserved2 (1 bit): MUST be zero, and MUST be ignored.
-- C - fCollapsed (1 bit): A bit that specifies whether the rows that are one level of outlining deeper than the current row are included in the collapsed outline state.
-- D - fDyZero (1 bit): A bit that specifies whether the row is hidden.
-- E - fUnsynced (1 bit): A bit that specifies whether the row height was manually set.
-- F - fGhostDirty (1 bit): A bit that specifies whether the row was formatted.
Put (xl, "reserved3=" & Integer'Image (in8)); -- MUST be 1, and MUST be ignored
Put (xl, "ixfe_val_etc=" & Integer'Image (in16)); -- ixfe_val (12 bits) and 4 bits
end if;
when blank2 | number2 =>
Put (xl, "row=" & Integer'Image (in16 + 1));
Put (xl, "col=" & Integer'Image (in16 + 1));
Cell_Attributes;
Ignore_from (8);
when integer2 =>
Put (xl, "row=" & Integer'Image (in16 + 1));
Put (xl, "col=" & Integer'Image (in16 + 1));
Cell_Attributes;
Put (xl, in16);
when number3 | rk =>
Put (xl, "row=" & Integer'Image (in16 + 1));
Put (xl, "col=" & Integer'Image (in16 + 1));
Put (xl, "xf=" & Integer'Image (in16));
Ignore_from (7);
when note => -- 5.70 NOTE p. 190
Put (xl, "row=" & Integer'Image (in16 + 1));
Put (xl, "col=" & Integer'Image (in16 + 1));
Put (xl, "total length=" & Integer'Image (in16 + 1));
declare
chunk : String (7 .. record_length);
begin
for i in chunk'Range loop
Read (f, b);
chunk (i) := Character'Val (b);
end loop;
Put (xl, chunk);
end;
when label2 => -- 5.63 LABEL p.187
Put (xl, "row=" & Integer'Image (in16 + 1));
Put (xl, "col=" & Integer'Image (in16 + 1));
Cell_Attributes;
Put (xl, str8);
when label3 => -- 5.63 LABEL p.187
Put (xl, "row=" & Integer'Image (in16 + 1));
Put (xl, "col=" & Integer'Image (in16 + 1));
Put (xl, "xf=" & Integer'Image (in16));
Put (xl, str8len16);
when labelsst => -- SST = shared string table
Put (xl, "row=" & Integer'Image (in16 + 1));
Put (xl, "col=" & Integer'Image (in16 + 1));
Ignore_from (5);
when format2 =>
Put (xl, str8);
when format4 =>
Read (f, b);
Read (f, b);
Put (xl, str8);
when font_b2 =>
Put (xl, "height=" & Img (Float (in16) / 20.0, 2));
Put (xl, "options=" & Integer'Image (in16));
if biff_version = 2 then
declare
font_name : constant String := str8;
begin
Put (xl, font_name);
for i in 6 + font_name'Length .. record_length loop
-- Excel 2002 puts garbage, sometimes...
Read (f, b);
end loop;
end;
else -- BIFF 5-8
for i in 5 .. record_length loop -- just skip the contents
Read (f, b);
end loop;
end if;
when fontcolor =>
Put (xl, "colour=" & Integer'Image (in16));
when font_b3 =>
Put (xl, "height=" & Img (Float (in16) / 20.0));
Put (xl, "options=" & Integer'Image (in16));
Put (xl, "colour=" & Integer'Image (in16));
Put (xl, str8);
when style => -- 5.103 STYLE p. 212
x := in16;
Put (xl, " xf=");
Put (xl, x mod 16#2000#, 3);
if x >= 16#8000# then
Put (xl, "; built-in style: ");
Read (f, b);
case b is
when 0 => Put (xl, "Normal");
when 3 => Put (xl, "Comma");
when 4 => Put (xl, "Currency");
when 5 => Put (xl, "Percent");
when others => Put (xl, Unsigned_8'Image (b));
end case;
Read (f, b);
Put (xl, "Level" & Unsigned_8'Image (b));
else
Put (xl, "; user: " & str8);
end if;
when xf_2 => -- 5.115 XF - Extended Format p.219
Read (f, b);
Put (xl, "Using font #" & Unsigned_8'Image (b));
Read (f, b); -- skip
Read (f, b);
Put (xl, "(Number) format #" & Unsigned_8'Image (b and 16#3F#));
Ignore_from (4); -- skip remaining contents
when xf_3 | xf_4 =>
Read (f, b);
Put (xl, "Using font #" & Unsigned_8'Image (b));
Read (f, b);
Put (xl, "(Number) format #" & Unsigned_8'Image (b));
Read (f, b); -- skip Protection
Read (f, b); -- skip Used attributes
Ignore_from (5); -- skip remaining contents
when ole_2 =>
Put_Line (xl, "This is an OLE-OLE 2 file, eventually wrapping a BIFF one");
Put_Line (xl, "Check: Microsoft Compound Document File Format, compdocfileformat.pdf");
Put_Line (xl, "Aborting dump");
Close (f);
Close (xl);
return;
when def_row_hgt_b2 =>
Next (xl);
w := Unsigned_16 (in16);
if (w and 16#8000#) /= 0 then
Put (xl, "height not changed manually, code=" & Hexa (Integer (w)));
else
Put (xl, "height=" & Img (Float (w and 16#7FFF#) / 20.0, 2));
end if;
when colwidth =>
Put (xl, "First Column: " & Integer'Image (in8 + 1));
Put (xl, "Last Column : " & Integer'Image (in8 + 1));
Put (xl, "Width: " & Img (Float (in16) / 256.0, 2));
when defcolwidth =>
Put (xl, "Width:" & Integer'Image (in16) & " zeros");
when header_x | footer_x =>
if record_length > 0 then
declare
head_foot : constant String := str8;
begin
Put (xl, head_foot);
for i in 2 + head_foot'Length .. record_length loop
-- garbage
Read (f, b);
end loop;
end;
end if;
when page_setup_x =>
Put (xl, "paper=" & Integer'Image (in16));
Put (xl, "scaling=" & Integer'Image (in16));
Put (xl, "start page=" & Integer'Image (in16));
Put (xl, "fit width=" & Integer'Image (in16));
Put (xl, "fit height=" & Integer'Image (in16));
Put (xl, "options=" & Integer'Image (in16));
Ignore_from (13); -- remaining contents (BIFF5+)
when dimension_b2 | dimension_b3 =>
Put (xl, "row_min=" & Integer'Image (in16));
Put (xl, "row_max+1=" & Integer'Image (in16));
Put (xl, "col_min=" & Integer'Image (in16));
Put (xl, "col_max+1=" & Integer'Image (in16));
Ignore_from (9); -- remaining contents (BIFF3+)
when writeaccess =>
declare
r : constant String := str8;
begin
Put (xl, "User name=" & r);
for i in r'Length + 2 .. record_length loop -- remaining characters (spaces)
Read (f, b);
end loop;
end;
when pane => -- 5.75 PANE p.197
Put (xl, "split_px=" & Integer'Image (in16)); -- vertical split
Put (xl, "split_py=" & Integer'Image (in16)); -- horizontal split
Put (xl, "row_1=" & Integer'Image (in16)); -- 1st visible row in bottom pane
Put (xl, "col_1=" & Integer'Image (in16)); -- 1st visible column in right pane
Put (xl, "active_pane_id=" & Integer'Image (in8)); -- identifier of pane with active cell cursor
Ignore_from (10);
when selection => -- 5.93 SELECTION p.205
Put (xl, "pane_id=" & Integer'Image (in8));
Put (xl, "active_cell_row=" & Integer'Image (in16));
Put (xl, "active_cell_col=" & Integer'Image (in16));
Put (xl, "selected_idx=" & Integer'Image (in16));
Ignore_from (8); -- cell range list - 2.5.15 p.27
when window1 =>
Put (xl, "w_x=" & Img (Float (in16) / 20.0, 2));
Put (xl, "w_y=" & Img (Float (in16) / 20.0, 2));
Put (xl, "w_w=" & Img (Float (in16) / 20.0, 2));
Put (xl, "w_h=" & Img (Float (in16) / 20.0, 2));
Put (xl, "w_hidden=" & Integer'Image (in8));
Ignore_from (10); -- Excel v.2002 puts an extra byte there, some other versions not...
when window2_b2 =>
Put (xl, "form_results=" & Integer'Image (in8));
Put (xl, "grid_lines=" & Integer'Image (in8));
Put (xl, "sheet_head=" & Integer'Image (in8));
Put (xl, "frozen_panes=" & Integer'Image (in8));
Put (xl, "zero_as_empty=" & Integer'Image (in8));
Put (xl, "first_row=" & Integer'Image (in16));
Put (xl, "first_column=" & Integer'Image (in16));
Put (xl, "use_auto_grid_colour=" & Integer'Image (in8));
for i in 1 .. 4 loop -- RGB
Read (f, b);
end loop;
when window2_b3 =>
Put (xl, "option_flags=" & Integer'Image (in16));
Put (xl, "first_row=" & Integer'Image (in16));
Put (xl, "first_column=" & Integer'Image (in16));
Ignore_from (7);
when others =>
-- if length > 0 then
-- Put(xl, "skipping contents");
-- end if;
for i in 1 .. record_length loop -- just skip the contents, show some
if i <= 10 then
Put (xl, in8);
else
Read (f, b);
end if;
end loop;
end case;
New_Line (xl);
end loop;
Close (f);
Close (xl);
exception
when others =>
if Is_Open (f) then
Close (f);
end if;
if Is_Open (xl) then
Close (xl);
end if;
raise;
end BIFF_Dump;
|
reznikmm/matreshka | Ada | 6,900 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Text.Bibliography_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Text_Bibliography_Element_Node is
begin
return Self : Text_Bibliography_Element_Node do
Matreshka.ODF_Text.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Text_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Text_Bibliography_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Text_Bibliography
(ODF.DOM.Text_Bibliography_Elements.ODF_Text_Bibliography_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Text_Bibliography_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Bibliography_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Text_Bibliography_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Text_Bibliography
(ODF.DOM.Text_Bibliography_Elements.ODF_Text_Bibliography_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Text_Bibliography_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Text_Bibliography
(Visitor,
ODF.DOM.Text_Bibliography_Elements.ODF_Text_Bibliography_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.Bibliography_Element,
Text_Bibliography_Element_Node'Tag);
end Matreshka.ODF_Text.Bibliography_Elements;
|
Heziode/lsystem-editor | Ada | 1,525 | ads | -------------------------------------------------------------------------------
-- LSE -- L-System Editor
-- Author: Heziode
--
-- License:
-- MIT License
--
-- Copyright (c) 2018 Quentin Dauprat (Heziode) <[email protected]>
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------------
-- @description
-- This package encompass utility packages
--
package LSE.Utils is
pragma Pure;
end LSE.Utils;
|
LionelDraghi/smk | Ada | 5,376 | adb | -- -----------------------------------------------------------------------------
-- smk, the smart make (http://lionel.draghi.free.fr/smk/)
-- © 2018, 2019 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.
-- -----------------------------------------------------------------------------
with Smk.Assertions;
with Smk.Definitions; use Smk.Definitions;
with Smk.IO;
with Smk.Files;
with Smk.Files.File_Lists;
with Smk.Files.Find_Unused;
with Smk.Smkfiles;
with Smk.Runfiles;
with Smk.Settings; use Smk.Settings;
with Ada.Command_Line;
with Ada.Directories;
with Ada.Containers;
with Ada.Strings.Unbounded;
with Ada.Text_IO;
procedure Smk.Main is
-- --------------------------------------------------------------------------
-- Put_Line Utilities:
procedure Put_Help is separate;
procedure Put_Error (Msg : in String := "";
With_Help : in Boolean := False) is separate;
-- --------------------------------------------------------------------------
procedure Analyze_Cmd_Line is separate;
-- Cmd line options are then available in the Settings package.
-- --------------------------------------------------------------------------
procedure Build is separate;
begin
-- --------------------------------------------------------------------------
Analyze_Cmd_Line;
if IO.Some_Error then
-- If some error occurs during command line analysis, stop here,
-- even if Ignore_Errors or Keep_Going is set
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
return;
end if;
case Current_Command is
when Read_Smkfile =>
Smkfiles.Dump;
when Status =>
declare
The_Runfile : Runfiles.Runfile;
use Files;
Updated_List : Assertions.Condition_Lists.List;
begin
if Runfiles.Runfiles_Found then
The_Runfile := Runfiles.Get_Saved_Run
(+To_Runfile_Name (Smkfile_Name));
Runfiles.Update_Files_Status
(The_Runfile.Run_List, Updated_List);
Runfiles.Put_Run (The_Runfile.Run_List);
else
Put_Error ("No previous run found.");
end if;
end;
when List_Previous_Runs =>
Runfiles.Put_Run_List;
when List_Targets =>
Runfiles.Put_Files (Runfiles.Load_Runfile,
Print_Targets => True);
when List_Sources =>
Runfiles.Put_Files (Runfiles.Load_Runfile,
Print_Sources => True);
when List_Unused =>
declare
use Runfiles;
use Files;
use Files.File_Lists;
The_Runfile : Runfile;
Known_Files : File_Lists.Map;
Known_Dirs : File_Lists.Map;
Unknown_Files : File_Lists.Map;
begin
The_Runfile := Load_Runfile;
Known_Files := Get_File_List (The_Runfile);
Known_Dirs := Get_Dir_List (Known_Files);
for F in Known_Dirs.Iterate loop
Find_Unused (From => Key (F),
Not_In => Known_Files,
Put_In => Unknown_Files);
end loop;
if Settings.Long_Listing_Format then
for F in Unknown_Files.Iterate loop
IO.Put_Line (+Key (F));
end loop;
else
for F in Unknown_Files.Iterate loop
IO.Put_Line (Shorten (+Key (F)));
end loop;
end if;
end;
when Whatsnew =>
declare
use Runfiles;
The_Runfile : Runfile;
Updated_List : Assertions.Condition_Lists.List;
begin
The_Runfile := Load_Runfile;
Update_Files_Status (The_Runfile.Run_List, Updated_List);
Put_Updated (Updated_List);
end;
when Clean =>
Runfiles.Delete_Targets (Runfiles.Load_Runfile);
when Reset =>
Runfiles.Clean_Run_Files;
when Version =>
IO.Put_Line (Settings.Smk_Version);
when Build =>
Build;
when Add =>
Smkfiles.Add_To_Smkfile (Command_Line);
when Dump =>
Runfiles.Dump (Runfiles.Load_Runfile);
when Run =>
Smkfiles.Add_To_Smkfile (Command_Line);
Build;
when Help =>
Put_Help;
when None =>
Put_Error
("Internal error : exiting Analyze_Cmd_Line without Command");
end case;
if IO.Some_Error and not Ignore_Errors then
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
end if;
end Smk.Main;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.